@vue-skuilder/platform-ui 0.1.32-e → 0.1.32-f

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 (125) hide show
  1. package/dist/assets/About-C1hlB_VW.js +2 -0
  2. package/dist/assets/About-C1hlB_VW.js.map +1 -0
  3. package/dist/assets/AdminDashboard-BOyrJfAQ.js +2 -0
  4. package/dist/assets/AdminDashboard-BOyrJfAQ.js.map +1 -0
  5. package/dist/assets/ClassroomCtrlPanel-vV8w0uBc.js +2 -0
  6. package/dist/assets/ClassroomCtrlPanel-vV8w0uBc.js.map +1 -0
  7. package/dist/assets/Classrooms-BZmnwuIB.js +3 -0
  8. package/dist/assets/Classrooms-BZmnwuIB.js.map +1 -0
  9. package/dist/assets/CourseRouter-DFPpLiug.js +7 -0
  10. package/dist/assets/CourseRouter-DFPpLiug.js.map +1 -0
  11. package/dist/assets/{CourseRouter-DuzvSsqI.css → CourseRouter-DvfjFpWl.css} +1 -1
  12. package/dist/assets/Courses-CsGfVDf9.css +1 -0
  13. package/dist/assets/Courses-CyWX8Aq4.js +3 -0
  14. package/dist/assets/Courses-CyWX8Aq4.js.map +1 -0
  15. package/dist/assets/DataInputFormTester-DtEEvEZS.js +2 -0
  16. package/dist/assets/DataInputFormTester-DtEEvEZS.js.map +1 -0
  17. package/dist/assets/EloModeration-DgUqPPoO.css +1 -0
  18. package/dist/assets/EloModeration-_LQTP9qx.js +2 -0
  19. package/dist/assets/EloModeration-_LQTP9qx.js.map +1 -0
  20. package/dist/assets/JoinCode-BQeXXd8M.js +3 -0
  21. package/dist/assets/JoinCode-BQeXXd8M.js.map +1 -0
  22. package/dist/assets/JoinCode-DPSfXf5z.css +1 -0
  23. package/dist/assets/MarkdownRenderer-DoVbFpA6-BIbDxYC4.js +53 -0
  24. package/dist/assets/MarkdownRenderer-DoVbFpA6-BIbDxYC4.js.map +1 -0
  25. package/dist/assets/MarkdownRenderer-DoVbFpA6-CQGwEJFh.js +1 -0
  26. package/dist/assets/NewCourseDialog-lQEm3iJe.js +2 -0
  27. package/dist/assets/NewCourseDialog-lQEm3iJe.js.map +1 -0
  28. package/dist/assets/ReleaseNotes-BSxuZ5W7.js +2 -0
  29. package/dist/assets/ReleaseNotes-BSxuZ5W7.js.map +1 -0
  30. package/dist/assets/RequestPasswordReset-GPKssrPH.js +2 -0
  31. package/dist/assets/RequestPasswordReset-GPKssrPH.js.map +1 -0
  32. package/dist/assets/ResetPassword-By7RvJkB.js +2 -0
  33. package/dist/assets/ResetPassword-By7RvJkB.js.map +1 -0
  34. package/dist/assets/Study-R4LCAP7J.css +1 -0
  35. package/dist/assets/Study-yDCrOQ1i.js +2 -0
  36. package/dist/assets/Study-yDCrOQ1i.js.map +1 -0
  37. package/dist/assets/TagInformation-BjkMAGf0.js +2 -0
  38. package/dist/assets/TagInformation-BjkMAGf0.js.map +1 -0
  39. package/dist/assets/User-1-_6oW2W.js +3 -0
  40. package/dist/assets/User-1-_6oW2W.js.map +1 -0
  41. package/dist/assets/UserStats-BW2xTraR.js +2 -0
  42. package/dist/assets/UserStats-BW2xTraR.js.map +1 -0
  43. package/dist/assets/VerifyEmail-B5pYw6N1.js +2 -0
  44. package/dist/assets/VerifyEmail-B5pYw6N1.js.map +1 -0
  45. package/dist/assets/chunk-D6hFPZc3.js +1 -0
  46. package/dist/assets/common-ui-BY2Ut5jf.css +1 -0
  47. package/dist/assets/common-ui.es-Bc_4fHTb.js +1 -0
  48. package/dist/assets/common-ui.es-mrcutgtG.js +38 -0
  49. package/dist/assets/common-ui.es-mrcutgtG.js.map +1 -0
  50. package/dist/assets/dist-BlP52QF6.js +186 -0
  51. package/dist/assets/dist-BlP52QF6.js.map +1 -0
  52. package/dist/assets/dist-C2-hg8GS.js +1 -0
  53. package/dist/assets/dist-CFgc27Ho.js +1 -0
  54. package/dist/assets/dist-CrcJCHFk.js +12 -0
  55. package/dist/assets/dist-CrcJCHFk.js.map +1 -0
  56. package/dist/assets/dist-DkeESCP4.js +353 -0
  57. package/dist/assets/dist-DkeESCP4.js.map +1 -0
  58. package/dist/assets/edit-ui.es-CLyYUxsi.js +36 -0
  59. package/dist/assets/edit-ui.es-CLyYUxsi.js.map +1 -0
  60. package/dist/assets/edit-ui.es-DWg1GnhC.js +1 -0
  61. package/dist/assets/index-CCh27qXk.css +1 -0
  62. package/dist/assets/index-jZbLHVSV.js +4 -0
  63. package/dist/assets/index-jZbLHVSV.js.map +1 -0
  64. package/dist/assets/server-DvlG_kpF.js +2 -0
  65. package/dist/assets/server-DvlG_kpF.js.map +1 -0
  66. package/dist/assets/vue.runtime.esm-bundler-C3q8JS9f.js +4 -0
  67. package/dist/assets/vue.runtime.esm-bundler-C3q8JS9f.js.map +1 -0
  68. package/dist/assets/workbox-window.prod.es5-DBwpKi3B.js +3 -0
  69. package/dist/assets/workbox-window.prod.es5-DBwpKi3B.js.map +1 -0
  70. package/dist/index.html +9 -2
  71. package/dist/sw.js +1 -1
  72. package/dist/sw.js.map +1 -1
  73. package/package.json +9 -11
  74. package/dist/assets/About-C3u52t0d.js +0 -2
  75. package/dist/assets/About-C3u52t0d.js.map +0 -1
  76. package/dist/assets/AdminDashboard-Dz5u2cex.js +0 -2
  77. package/dist/assets/AdminDashboard-Dz5u2cex.js.map +0 -1
  78. package/dist/assets/ClassroomCtrlPanel-Dk6oR2Ns.js +0 -2
  79. package/dist/assets/ClassroomCtrlPanel-Dk6oR2Ns.js.map +0 -1
  80. package/dist/assets/Classrooms-vb9OkpYQ.js +0 -2
  81. package/dist/assets/Classrooms-vb9OkpYQ.js.map +0 -1
  82. package/dist/assets/CourseRouter-Blm2dYn-.js +0 -2
  83. package/dist/assets/CourseRouter-Blm2dYn-.js.map +0 -1
  84. package/dist/assets/Courses-CEw9ARaf.js +0 -2
  85. package/dist/assets/Courses-CEw9ARaf.js.map +0 -1
  86. package/dist/assets/Courses-DQW3kca9.css +0 -1
  87. package/dist/assets/DataInputFormTester-CGzywVuh.js +0 -2
  88. package/dist/assets/DataInputFormTester-CGzywVuh.js.map +0 -1
  89. package/dist/assets/EloModeration-B90G61YI.css +0 -1
  90. package/dist/assets/EloModeration-DAmUYf5F.js +0 -2
  91. package/dist/assets/EloModeration-DAmUYf5F.js.map +0 -1
  92. package/dist/assets/JoinCode-B3oyqgv9.js +0 -2
  93. package/dist/assets/JoinCode-B3oyqgv9.js.map +0 -1
  94. package/dist/assets/JoinCode-DFiral3R.css +0 -1
  95. package/dist/assets/NewCourseDialog-5K53pY-W.js +0 -2
  96. package/dist/assets/NewCourseDialog-5K53pY-W.js.map +0 -1
  97. package/dist/assets/ReleaseNotes-DJQ5CKxz.js +0 -2
  98. package/dist/assets/ReleaseNotes-DJQ5CKxz.js.map +0 -1
  99. package/dist/assets/RequestPasswordReset-1bvNIeyh.js +0 -2
  100. package/dist/assets/RequestPasswordReset-1bvNIeyh.js.map +0 -1
  101. package/dist/assets/ResetPassword-CDlcjyGc.js +0 -2
  102. package/dist/assets/ResetPassword-CDlcjyGc.js.map +0 -1
  103. package/dist/assets/Study-Ci2qFB3t.js +0 -2
  104. package/dist/assets/Study-Ci2qFB3t.js.map +0 -1
  105. package/dist/assets/Study-Cxxw_AYM.css +0 -1
  106. package/dist/assets/TagInformation-CtiIiC9l.js +0 -2
  107. package/dist/assets/TagInformation-CtiIiC9l.js.map +0 -1
  108. package/dist/assets/User-CWCez7if.js +0 -2
  109. package/dist/assets/User-CWCez7if.js.map +0 -1
  110. package/dist/assets/UserStats-BDj614VL.js +0 -2
  111. package/dist/assets/UserStats-BDj614VL.js.map +0 -1
  112. package/dist/assets/VerifyEmail-Bt6Mb6Q3.js +0 -2
  113. package/dist/assets/VerifyEmail-Bt6Mb6Q3.js.map +0 -1
  114. package/dist/assets/edit-ui.es-BE3brRCi.js +0 -2
  115. package/dist/assets/edit-ui.es-BE3brRCi.js.map +0 -1
  116. package/dist/assets/index-C8n-yF4Q.js +0 -3
  117. package/dist/assets/index-C8n-yF4Q.js.map +0 -1
  118. package/dist/assets/index-CfcuevG4.js +0 -3
  119. package/dist/assets/index-CfcuevG4.js.map +0 -1
  120. package/dist/assets/index-DpBS80zR.css +0 -1
  121. package/dist/assets/mousetrap-Ca0hLdT-.js +0 -2
  122. package/dist/assets/mousetrap-Ca0hLdT-.js.map +0 -1
  123. package/dist/assets/workbox-window.prod.es5-p40uij6f.js +0 -2
  124. package/dist/assets/workbox-window.prod.es5-p40uij6f.js.map +0 -1
  125. package/dist/manifest.webmanifest +0 -1
@@ -0,0 +1,186 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/common-ui.es-Bc_4fHTb.js","assets/dist-CrcJCHFk.js","assets/chunk-D6hFPZc3.js","assets/common-ui.es-mrcutgtG.js","assets/dist-DkeESCP4.js","assets/vue.runtime.esm-bundler-C3q8JS9f.js","assets/MarkdownRenderer-DoVbFpA6-BIbDxYC4.js","assets/common-ui-BY2Ut5jf.css"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./chunk-D6hFPZc3.js";import{$ as t,B as n,C as r,H as a,I as o,It as c,K as l,N as u,Rt as d,S as p,T as m,Vt as h,W as g,Z as _,_ as y,at as b,b as x,et as S,f as C,g as w,lt as T,s as E,v as D,w as O,y as k,z as A}from"./vue.runtime.esm-bundler-C3q8JS9f.js";import{E as j,H as M,m as N,v as P,w as F,y as I}from"./common-ui.es-mrcutgtG.js";import{C as L,E as ee,S as R,T as z,d as B,f as V,n as H,y as U}from"./dist-CrcJCHFk.js";import{C as te,S as W,_ as ne,d as re,n as ie,o as ae,s as G,x as K}from"./MarkdownRenderer-DoVbFpA6-BIbDxYC4.js";import{k as oe}from"./dist-DkeESCP4.js";var se=Object.create,ce=Object.defineProperty,__name=(e,t)=>ce(e,`name`,{value:t,configurable:!0}),q=Object.getOwnPropertyDescriptor,le=Object.getOwnPropertyNames,ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var a=le(t),o=0,c=a.length,l;o<c;o++)l=a[o],!de.call(e,l)&&l!==n&&ce(e,l,{get:(e=>t[e]).bind(null,l),enumerable:!(r=q(t,l))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:se(ue(e)),__copyProps(t||!e||!e.__esModule?ce(n,`default`,{value:e,enumerable:!0}):n,e)),fe=(t=>typeof e<`u`?e:typeof Proxy<`u`?new Proxy(t,{get:(t,n)=>(typeof e<`u`?e:t)[n]}):t)(function(t){if(typeof e<`u`)return e.apply(this,arguments);throw Error('Calling `require` for "'+t+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),pe=[{name:H.Blanks,fields:[{name:`Input`,type:R.MARKDOWN},{name:`Uploads`,type:R.MEDIA_UPLOADS}]}],me={name:H.MATH_SingleDigitAddition,fields:[{name:`a`,type:R.INT},{name:`b`,type:R.INT}]},he={name:H.MATH_EqualityTest,fields:[{name:`a`,type:R.STRING},{name:`b`,type:R.STRING}]},J,Y,X,Z,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je;function randomInt(e,t){return Math.floor(Math.random()*(t-e+1))+e}function shuffle(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function cos(e){return Math.cos(toRadians(e))}function sin(e){return Math.sin(toRadians(e))}function toRadians(e){return e/360*2*Math.PI}function gradeSpellingAttempt(e,t){let n=Array(t.length).fill(`_`),r=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 e=0;e<t.length;e++)e<r.length&&r[e]===t[e]&&(n[e]=r[e],r[e]=``);for(let e=t.length-1;e>=0;e--)if(n[e]===`_`){let a=r.findIndex(n=>n===t[e]);a!==-1&&(n[e]=t[e],r[a]=``)}return console.log(n.join(` `)),n.join(` `)}var Me=m({name:`FillInView`,components:{MarkdownRenderer:O(()=>M(()=>import(`./common-ui.es-Bc_4fHTb.js`).then(e=>e.MarkdownRenderer),__vite__mapDeps([0,1,2,3,4,5,6,7]))),RadioMultipleChoice:F,AudioAutoPlayer:te},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let r=W(e,t,`FillInView`),a=K(r);a.question.value=new ze(e.data);let o=T(),c=w(()=>{if(!a.question.value)throw r.logger.error(`Question not initialized`),Error(`Question not initialized`);return a.question.value});A(()=>{try{a.question.value||(a.question.value=new ze(e.data)),a.question.value.options&&(o.value=shuffle(getTruncatedList()))}catch(e){r.logger.error(`Failed to initialize question:`,e)}}),n(()=>{a.question.value=void 0});let l=w(()=>o.value??[]),u=w(()=>!!e.data[0][`image-1`]),d=w(()=>{if(!u.value)return[``];let t=[],n=1;for(;e.data[0][`image-${n}`];)t.push(URL.createObjectURL(e.data[0][`image-${n}`])),n++;return t}),p=w(()=>!!e.data[0][`audio-1`]),m=w(()=>c.value?.mdText||``),h=w(()=>{if(!p.value)return[``];let t=[],n=1;for(;e.data[0][`audio-${n}`];)t.push(URL.createObjectURL(e.data[0][`audio-${n}`])),n++;return t}),g=w(()=>{if(c.value.answers)return c.value.answers[Math.floor(c.value.answers.length*Math.random())];throw Error(`No answers provided`)}),y=w(()=>{let e=g.value;if(console.log(`Prior answers: ${a.priorAnswers.value}`),e&&a.priorAnswers.value[0]?.[0]&&a.priorAnswers.value[0][1]===`UserInputString`)return gradeSpellingAttempt(a.priorAnswers.value[0][0],e);if(console.log(`found no UserInputString`),g.value){let e=``;for(let t=0;t<g.value.length;t++)e+=`_ `;return e}return``}),b=w(()=>!!(c.value.answers&&c.value.answers.length>0)),getTruncatedList=()=>{if(!c.value?.options)return;if(c.value.options.length<=6)return c.value.options;let t=[];t.push(c.value.answers[Math.floor(Math.random()*c.value.answers.length)]);let n=shuffle(c.value.options.filter(e=>c.value.answers?.indexOf(e)===-1));return e.modifyDifficulty&&(console.log(`Modifying difficulty: ${e.modifyDifficulty}`),n=e.modifyDifficulty<-200?n.slice(0,1):e.modifyDifficulty<-150?n.slice(0,2):e.modifyDifficulty<-100?n.slice(0,3):e.modifyDifficulty<-50?n.slice(0,4):n.slice(0,5)),t.push(...n.slice(0,5)),t},handleNext=()=>{a.submitAnswer(``)};return _(()=>e.data,e=>{try{a.question.value=new ze(e),a.question.value?.options&&(o.value=shuffle(getTruncatedList()))}catch(e){r.logger.error(`Failed to initialize/update question:`,e)}},{deep:!0}),{...r,...a,question:c,truncatedOptions:l,hasImage:u,imageURLs:d,hasAudio:p,audioURL:h,obscuredAnswer:y,someAnswer:g,isQuestion:b,handleNext,markdownText:m}}}),Ne=__name((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},`default`),Pe={"data-viewable":`FillInView`},Fe=[`src`],Ie={key:4,class:`text-center text-h6`},Le={key:5,class:`text-center text-h6`};function _sfc_render$25(e,n,o,c,u,d){let m=l(`audio-auto-player`),_=l(`markdown-renderer`),b=l(`radio-multiple-choice`),S=l(`v-spacer`),w=l(`v-btn`),T=l(`v-card-actions`);return a(),x(`div`,Pe,[e.hasAudio?(a(),D(m,{key:0,src:e.audioURL},null,8,[`src`])):k(``,!0),e.hasImage?(a(!0),x(C,{key:1},g(e.imageURLs,(e,t)=>(a(),x(`img`,{key:t,src:e},null,8,Fe))),128)):k(``,!0),e.markdownText?(a(),D(_,{key:2,md:e.markdownText},null,8,[`md`])):k(``,!0),e.question?.options?(a(),D(b,{key:3,"choice-list":e.truncatedOptions},null,8,[`choice-list`])):e.priorAttempts==1?(a(),x(`div`,Ie,[y(`span`,null,h(e.obscuredAnswer),1)])):e.priorAttempts==2?(a(),x(`div`,Le,[y(`span`,null,h(e.someAnswer),1)])):k(``,!0),e.isQuestion?k(``,!0):(a(),D(T,{key:6},{default:t(()=>[r(S),r(w,{color:`primary`,autofocus:`autofocus`,onClick:e.handleNext},{default:t(()=>n[0]||(n[0]=[p(` Next `)])),_:1},8,[`onClick`])]),_:1}))])}__name(_sfc_render$25,`_sfc_render`);var Re=Ne(Me,[[`render`,_sfc_render$25],[`__scopeId`,`data-v-f91502f8`]]);function splitText(e,t,n){let r=e.split(t),a=r[0],o=r[1].split(n);return{left:a,middle:o[0],right:o[1]}}var ze=(J=class BlanksCard extends N{splitTextToken(e){if(ae(e)){let t=splitText(e.text,`{{`,`}}`),n=splitText(e.raw,`{{`,`}}`),r=[];return n.left.length>0&&r.push({type:`text`,raw:n.left,text:t.left}),n.middle.length>0&&r.push({type:`text`,raw:`{{`+n.middle+`}}`,text:`{{`+t.middle+`}}`}),n.right.length>0&&r.push({type:`text`,raw:n.right,text:t.right}),r}else return[e]}optionsFromString(e){if(!e.startsWith(`{{`)||!e.endsWith(`}}`))throw Error(`string ${e} is not fill-in text - must look like "{{someText}}"`);e=e.substring(2,e.length-2);let t=e.split(`||`);if(t.length>1){let e=t[0].split(`|`).map(e=>e.trim()),n=t[1].split(`|`).map(e=>e.trim()).filter(t=>!e.includes(t));return n.push(e[randomInt(0,e.length-1)]),{answers:e,options:shuffle(n)}}else return{answers:[e.trim()],options:null}}constructor(e){var _super=(...e)=>(super(...e),U(this,`mdText`,``),U(this,`answers`,null),U(this,`options`,null),this);_super(e),this.mdText=e[0].Input,this.mdText===void 0&&(this.mdText=``);let t=ne(this.mdText,`{{`,`}}`),n=[];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a.startsWith(`{{`)&&a.endsWith(`}}`))if(re(a.slice(2,-2).trim()))n.push(r);else try{let e=this.optionsFromString(r);this.answers=e.answers,this.options=e.options,this.options?.length?n.push(`{{ || }}`):n.push(`{{ }}`)}catch{n.push(r)}else n.push(r)}this.mdText=n.join(``)}isCorrect(e){if(console.log(`answers:${this.answers}\nuser answer: ${JSON.stringify(e)}`),typeof e==`string`){if(this.answers)return this.answers.includes(e);if(e===``)return!0;throw Error(`Question has no configured answers!`)}else if(Array.isArray(e)){if(this.answers)return e.every(e=>this.answers.includes(e));throw Error(`Question has no configured answers!`)}else return this.isCorrectRadio(e)}dataShapes(){return BlanksCard.dataShapes}views(){return BlanksCard.views}isCorrectRadio(e){return this.answers?this.answers.includes(e.choiceList[e.selection]):!1}},U(J,`dataShapes`,pe),U(J,`views`,[Re]),J),CourseWare=class{get questions(){return this.questionList}get allViews(){let e=[];return this.questionList.forEach(t=>{t.views.forEach(t=>{e.push(t)})}),e}get allViewsMap(){let e={};return this.allViews.forEach(t=>{if(t.name)e[t.name]=t;else throw Error(`View has no name`)}),e}constructor(e,t){U(this,`name`,void 0),U(this,`questionList`,void 0),this.name=e,this.questionList=t,this.questionList=this.questionList.concat(this.getBaseQTypes())}getQuestion(e){return this.questionList.find(t=>{let n=t.name.replace(/^_/,``).replace(/\d+$/,``),r=e.replace(/^_/,``).replace(/\d+$/,``);return t.name===e||n===r||t.name.includes(r)||e.includes(n)})}getBaseQTypes(){return[ze]}},Be=new CourseWare(`default`,[ze]),Ve=[`cg-white`,`cg-black`],He=[`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`],Ue=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`],Q=[...Ue].reverse(),We=Array.prototype.concat(...He.map(e=>Ue.map(t=>e+t))),pos2key=e=>We[8*e[0]+e[1]],key2pos=e=>[e.charCodeAt(0)-97,e.charCodeAt(1)-49],Ge=We.map(key2pos);function memo(e){let t,ret=()=>(t===void 0&&(t=e()),t);return ret.clear=()=>{t=void 0},ret}var timer=()=>{let e;return{start(){e=performance.now()},cancel(){e=void 0},stop(){if(!e)return 0;let t=performance.now()-e;return e=void 0,t}}},opposite=e=>e===`cg-white`?`cg-black`:`cg-white`,distanceSq=(e,t)=>{let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},samePiece=(e,t)=>e.role===t.role&&e.color===t.color,posToTranslate=e=>(t,n)=>[(n?t[0]:7-t[0])*e.width/8,(n?7-t[1]:t[1])*e.height/8],translate=(e,t)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px)`},translateAndScale=(e,t,n=1)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px) scale(${n})`},setVisible=(e,t)=>{e.style.visibility=t?`visible`:`hidden`},eventPosition=e=>{if(e.clientX||e.clientX===0)return[e.clientX,e.clientY];if(e.targetTouches?.[0])return[e.targetTouches[0].clientX,e.targetTouches[0].clientY]},isRightButton=e=>e.button===2,createEl=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n};function computeSquareCenter(e,t,n){let r=key2pos(e);return t||(r[0]=7-r[0],r[1]=7-r[1]),[n.left+n.width*r[0]/8+n.width/16,n.top+n.height*(7-r[1])/8+n.height/16]}var diff=(e,t)=>Math.abs(e-t),pawn=e=>(t,n,r,a)=>diff(t,r)<2&&(e===`cg-white`?a===n+1||n<=1&&a===n+2&&t===r:a===n-1||n>=6&&a===n-2&&t===r),knight=(e,t,n,r)=>{let a=diff(e,n),o=diff(t,r);return a===1&&o===2||a===2&&o===1},bishop=(e,t,n,r)=>diff(e,n)===diff(t,r),rook=(e,t,n,r)=>e===n||t===r,queen=(e,t,n,r)=>bishop(e,t,n,r)||rook(e,t,n,r),king=(e,t,n)=>(r,a,o,c)=>diff(r,o)<2&&diff(a,c)<2||n&&a===c&&a===(e===`cg-white`?0:7)&&(r===4&&(o===2&&t.includes(0)||o===6&&t.includes(7))||t.includes(o));function rookFilesOf(e,t){let n=t===`cg-white`?`1`:`8`,r=[];for(let[a,o]of e)a[1]===n&&o.color===t&&o.role===`rook`&&r.push(key2pos(a)[0]);return r}function premove(e,t,n){let r=e.get(t);if(!r)return[];let a=key2pos(t),o=r.role,c=o===`pawn`?pawn(r.color):o===`knight`?knight:o===`bishop`?bishop:o===`rook`?rook:o===`queen`?queen:king(r.color,rookFilesOf(e,r.color),n);return Ge.filter(e=>(a[0]!==e[0]||a[1]!==e[1])&&c(a[0],a[1],e[0],e[1])).map(pos2key)}function callUserFunction(e,...t){e&&setTimeout(()=>e(...t),1)}function toggleOrientation(e){e.orientation=opposite(e.orientation),e.animation.current=e.draggable.current=e.selected=void 0}function setPieces(e,t){for(let[n,r]of t)r?e.pieces.set(n,r):e.pieces.delete(n)}function setCheck(e,t){if(e.check=void 0,t===!0&&(t=e.turnColor),t)for(let[n,r]of e.pieces)r.role===`king`&&r.color===t&&(e.check=n)}function setPremove(e,t,n,r){unsetPredrop(e),e.premovable.current=[t,n],callUserFunction(e.premovable.events.set,t,n,r)}function unsetPremove(e){e.premovable.current&&(e.premovable.current=void 0,callUserFunction(e.premovable.events.unset))}function setPredrop(e,t,n){unsetPremove(e),e.predroppable.current={role:t,key:n},callUserFunction(e.predroppable.events.set,t,n)}function unsetPredrop(e){let t=e.predroppable;t.current&&(t.current=void 0,callUserFunction(t.events.unset))}function tryAutoCastle(e,t,n){if(!e.autoCastle)return!1;let r=e.pieces.get(t);if(!r||r.role!==`king`)return!1;let a=key2pos(t),o=key2pos(n);if(a[1]!==0&&a[1]!==7||a[1]!==o[1])return!1;a[0]===4&&!e.pieces.has(n)&&(o[0]===6?n=pos2key([7,o[1]]):o[0]===2&&(n=pos2key([0,o[1]])));let c=e.pieces.get(n);return!c||c.color!==r.color||c.role!==`rook`?!1:(e.pieces.delete(t),e.pieces.delete(n),a[0]<o[0]?(e.pieces.set(pos2key([6,o[1]]),r),e.pieces.set(pos2key([5,o[1]]),c)):(e.pieces.set(pos2key([2,o[1]]),r),e.pieces.set(pos2key([3,o[1]]),c)),!0)}function baseMove(e,t,n){let r=e.pieces.get(t),a=e.pieces.get(n);if(t===n||!r)return!1;let o=a&&a.color!==r.color?a:void 0;return n===e.selected&&unselect(e),callUserFunction(e.events.move,t,n,o),tryAutoCastle(e,t,n)||(e.pieces.set(n,r),e.pieces.delete(t)),e.lastMove=[t,n],e.check=void 0,callUserFunction(e.events.change),o||!0}function baseNewPiece(e,t,n,r){if(e.pieces.has(n))if(r)e.pieces.delete(n);else return!1;return callUserFunction(e.events.dropNewPiece,t,n),e.pieces.set(n,t),e.lastMove=[n],e.check=void 0,callUserFunction(e.events.change),e.movable.dests=void 0,e.turnColor=opposite(e.turnColor),!0}function baseUserMove(e,t,n){let r=baseMove(e,t,n);return r&&(e.movable.dests=void 0,e.turnColor=opposite(e.turnColor),e.animation.current=void 0),r}function userMove(e,t,n){if(canMove(e,t,n)){let r=baseUserMove(e,t,n);if(r){let a=e.hold.stop();unselect(e);let o={premove:!1,ctrlKey:e.stats.ctrlKey,holdTime:a};return r!==!0&&(o.captured=r),callUserFunction(e.movable.events.after,t,n,o),!0}}else if(canPremove(e,t,n))return setPremove(e,t,n,{ctrlKey:e.stats.ctrlKey}),unselect(e),!0;return unselect(e),!1}function dropNewPiece(e,t,n,r){let a=e.pieces.get(t);a&&(canDrop(e,t,n)||r)?(e.pieces.delete(t),baseNewPiece(e,a,n,r),callUserFunction(e.movable.events.afterNewPiece,a.role,n,{premove:!1,predrop:!1})):a&&canPredrop(e,t,n)?setPredrop(e,a.role,n):(unsetPremove(e),unsetPredrop(e)),e.pieces.delete(t),unselect(e)}function selectSquare(e,t,n){if(callUserFunction(e.events.select,t),e.selected){if(e.selected===t&&!e.draggable.enabled){unselect(e),e.hold.cancel();return}else if((e.selectable.enabled||n)&&e.selected!==t&&userMove(e,e.selected,t)){e.stats.dragged=!1;return}}(e.selectable.enabled||e.draggable.enabled)&&(isMovable(e,t)||isPremovable(e,t))&&(setSelected(e,t),e.hold.start())}function setSelected(e,t){e.selected=t,isPremovable(e,t)?e.premovable.customDests||(e.premovable.dests=premove(e.pieces,t,e.premovable.castle)):e.premovable.dests=void 0}function unselect(e){e.selected=void 0,e.premovable.dests=void 0,e.hold.cancel()}function isMovable(e,t){let n=e.pieces.get(t);return!!n&&(e.movable.color===`both`||e.movable.color===n.color&&e.turnColor===n.color)}var canMove=(e,t,n)=>t!==n&&isMovable(e,t)&&(e.movable.free||!!e.movable.dests?.get(t)?.includes(n));function canDrop(e,t,n){let r=e.pieces.get(t);return!!r&&(t===n||!e.pieces.has(n))&&(e.movable.color===`both`||e.movable.color===r.color&&e.turnColor===r.color)}function isPremovable(e,t){let n=e.pieces.get(t);return!!n&&e.premovable.enabled&&e.movable.color===n.color&&e.turnColor!==n.color}function canPremove(e,t,n){let r=e.premovable.customDests?.get(t)??premove(e.pieces,t,e.premovable.castle);return t!==n&&isPremovable(e,t)&&r.includes(n)}function canPredrop(e,t,n){let r=e.pieces.get(t),a=e.pieces.get(n);return!!r&&(!a||a.color!==e.movable.color)&&e.predroppable.enabled&&(r.role!==`pawn`||n[1]!==`1`&&n[1]!==`8`)&&e.movable.color===r.color&&e.turnColor!==r.color}function isDraggable(e,t){let n=e.pieces.get(t);return!!n&&e.draggable.enabled&&(e.movable.color===`both`||e.movable.color===n.color&&(e.turnColor===n.color||e.premovable.enabled))}function playPremove(e){let t=e.premovable.current;if(!t)return!1;let n=t[0],r=t[1],a=!1;if(canMove(e,n,r)){let t=baseUserMove(e,n,r);if(t){let o={premove:!0};t!==!0&&(o.captured=t),callUserFunction(e.movable.events.after,n,r,o),a=!0}}return unsetPremove(e),a}function playPredrop(e,t){let n=e.predroppable.current,r=!1;return n?(t(n)&&baseNewPiece(e,{role:n.role,color:e.movable.color},n.key)&&(callUserFunction(e.movable.events.afterNewPiece,n.role,n.key,{premove:!1,predrop:!0}),r=!0),unsetPredrop(e),r):!1}function cancelMove(e){unsetPremove(e),unsetPredrop(e),unselect(e)}function stop(e){e.movable.color=e.movable.dests=e.animation.current=void 0,cancelMove(e)}function getKeyAtDomPos(e,t,n){let r=Math.floor(8*(e[0]-n.left)/n.width);t||(r=7-r);let a=7-Math.floor(8*(e[1]-n.top)/n.height);return t||(a=7-a),r>=0&&r<8&&a>=0&&a<8?pos2key([r,a]):void 0}function getSnappedKeyAtDomPos(e,t,n,r){let a=key2pos(e),o=Ge.filter(e=>queen(a[0],a[1],e[0],e[1])||knight(a[0],a[1],e[0],e[1])),c=o.map(e=>computeSquareCenter(pos2key(e),n,r)).map(e=>distanceSq(t,e)),[,l]=c.reduce((e,t,n)=>e[0]<t?e:[t,n],[c[0],0]);return pos2key(o[l])}var whitePov=e=>e.orientation===`cg-white`,Ke=`rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR`,qe={p:`pawn`,r:`rook`,n:`knight`,b:`bishop`,q:`queen`,k:`king`},Je={pawn:`p`,rook:`r`,knight:`n`,bishop:`b`,queen:`q`,king:`k`};function read(e){e===`start`&&(e=Ke);let t=new Map,n=7,r=0;for(let a of e)switch(a){case` `:case`[`:return t;case`/`:if(--n,n<0)return t;r=0;break;case`~`:{let e=t.get(pos2key([r-1,n]));e&&(e.promoted=!0);break}default:{let e=a.charCodeAt(0);if(e<57)r+=e-48;else{let e=a.toLowerCase();t.set(pos2key([r,n]),{role:qe[e],color:a===e?`cg-black`:`cg-white`}),++r}}}return t}function write(e){return Q.map(t=>He.map(n=>{let r=e.get(n+t);if(r){let e=Je[r.role];return r.color===`cg-white`&&(e=e.toUpperCase()),r.promoted&&(e+=`~`),e}else return`1`}).join(``)).join(`/`).replace(/1{2,}/g,e=>e.length.toString())}function applyAnimation(e,t){t.animation&&(deepMerge(e.animation,t.animation),(e.animation.duration||0)<70&&(e.animation.enabled=!1))}function configure(e,t){if(t.movable?.dests&&(e.movable.dests=void 0),t.drawable?.autoShapes&&(e.drawable.autoShapes=[]),deepMerge(e,t),t.fen&&(e.pieces=read(t.fen),e.drawable.shapes=t.drawable?.shapes||[]),`check`in t&&setCheck(e,t.check||!1),`lastMove`in t&&!t.lastMove?e.lastMove=void 0:t.lastMove&&(e.lastMove=t.lastMove),e.selected&&setSelected(e,e.selected),applyAnimation(e,t),!e.movable.rookCastle&&e.movable.dests){let t=e.movable.color===`cg-white`?`1`:`8`,n=`e`+t,r=e.movable.dests.get(n),a=e.pieces.get(n);if(!r||!a||a.role!==`king`)return;e.movable.dests.set(n,r.filter(e=>!(e===`a`+t&&r.includes(`c`+t))&&!(e===`h`+t&&r.includes(`g`+t))))}}function deepMerge(e,t){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)&&isPlainObject(e[n])&&isPlainObject(t[n])?deepMerge(e[n],t[n]):e[n]=t[n])}function isPlainObject(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}var anim=(e,t)=>t.animation.enabled?animate(e,t):render$2(e,t);function render$2(e,t){let n=e(t);return t.dom.redraw(),n}__name(render$2,`render`);var makePiece=(e,t)=>({key:e,pos:key2pos(e),piece:t}),closer=(e,t)=>t.sort((t,n)=>distanceSq(e.pos,t.pos)-distanceSq(e.pos,n.pos))[0];function computePlan(e,t){let n=new Map,r=[],a=new Map,o=[],c=[],l=new Map,u,d,p;for(let[t,n]of e)l.set(t,makePiece(t,n));for(let e of We)u=t.pieces.get(e),d=l.get(e),u?d?samePiece(u,d.piece)||(o.push(d),c.push(makePiece(e,u))):c.push(makePiece(e,u)):d&&o.push(d);for(let e of c)d=closer(e,o.filter(t=>samePiece(e.piece,t.piece))),d&&(p=[d.pos[0]-e.pos[0],d.pos[1]-e.pos[1]],n.set(e.key,p.concat(p)),r.push(d.key));for(let e of o)r.includes(e.key)||a.set(e.key,e.piece);return{anims:n,fadings:a}}function step(e,t){let n=e.animation.current;if(n===void 0){e.dom.destroyed||e.dom.redrawNow();return}let r=1-(t-n.start)*n.frequency;if(r<=0)e.animation.current=void 0,e.dom.redrawNow();else{let t=easing(r);for(let e of n.plan.anims.values())e[2]=e[0]*t,e[3]=e[1]*t;e.dom.redrawNow(!0),requestAnimationFrame((t=performance.now())=>step(e,t))}}function animate(e,t){let n=new Map(t.pieces),r=e(t),a=computePlan(n,t);if(a.anims.size||a.fadings.size){let e=t.animation.current&&t.animation.current.start;t.animation.current={start:performance.now(),frequency:1/t.animation.duration,plan:a},e||step(t,performance.now())}else t.dom.redraw();return r}var easing=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,Ye=[`green`,`red`,`blue`,`yellow`];function start$2(e,t){if(t.touches&&t.touches.length>1)return;t.stopPropagation(),t.preventDefault(),t.ctrlKey?unselect(e):cancelMove(e);let n=eventPosition(t),r=getKeyAtDomPos(n,whitePov(e),e.dom.bounds());r&&(e.drawable.current={orig:r,pos:n,brush:eventBrush(t),snapToValidMove:e.drawable.defaultSnapToValidMove},processDraw(e))}__name(start$2,`start`);function processDraw(e){requestAnimationFrame(()=>{let t=e.drawable.current;if(t){let n=getKeyAtDomPos(t.pos,whitePov(e),e.dom.bounds());n||(t.snapToValidMove=!1);let r=t.snapToValidMove?getSnappedKeyAtDomPos(t.orig,t.pos,whitePov(e),e.dom.bounds()):n;r!==t.mouseSq&&(t.mouseSq=r,t.dest=r===t.orig?void 0:r,e.dom.redrawNow()),processDraw(e)}})}function move$1(e,t){e.drawable.current&&(e.drawable.current.pos=eventPosition(t))}__name(move$1,`move`);function end$1(e){let t=e.drawable.current;t&&(t.mouseSq&&addShape(e.drawable,t),cancel$1(e))}__name(end$1,`end`);function cancel$1(e){e.drawable.current&&(e.drawable.current=void 0,e.dom.redraw())}__name(cancel$1,`cancel`);function clear(e){e.drawable.shapes.length&&(e.drawable.shapes=[],e.dom.redraw(),onChange(e.drawable))}function eventBrush(e){let t=(e.shiftKey||e.ctrlKey)&&isRightButton(e),n=e.altKey||e.metaKey||e.getModifierState?.(`AltGraph`);return Ye[(t?1:0)+(n?2:0)]}function addShape(e,t){let sameShape=e=>e.orig===t.orig&&e.dest===t.dest,n=e.shapes.find(sameShape);n&&(e.shapes=e.shapes.filter(e=>!sameShape(e))),(!n||n.brush!==t.brush)&&e.shapes.push({orig:t.orig,dest:t.dest,brush:t.brush}),onChange(e)}function onChange(e){e.onChange&&e.onChange(e.shapes)}function start$1(e,t){if(!(e.trustAllEvents||t.isTrusted)||t.buttons!==void 0&&t.buttons>1||t.touches&&t.touches.length>1)return;let n=e.dom.bounds(),r=eventPosition(t),a=getKeyAtDomPos(r,whitePov(e),n);if(!a)return;let o=e.pieces.get(a),c=e.selected;if(!c&&e.drawable.enabled&&(e.drawable.eraseOnClick||!o||o.color!==e.turnColor)&&clear(e),t.cancelable!==!1&&(!t.touches||e.blockTouchScroll||o||c||pieceCloseTo(e,r)))t.preventDefault();else if(t.touches)return;let l=!!e.premovable.current,u=!!e.predroppable.current;e.stats.ctrlKey=t.ctrlKey,e.selected&&canMove(e,e.selected,a)?anim(e=>selectSquare(e,a),e):selectSquare(e,a);let d=e.selected===a,p=pieceElementByKey(e,a);if(o&&p&&d&&isDraggable(e,a)){e.draggable.current={orig:a,piece:o,origPos:r,pos:r,started:e.draggable.autoDistance&&e.stats.dragged,element:p,previouslySelected:c,originTarget:t.target,keyHasChanged:!1},p.cgDragging=!0,p.classList.add(`dragging`);let l=e.dom.elements.ghost;l&&(l.className=`ghost ${o.color} ${o.role}`,translate(l,posToTranslate(n)(key2pos(a),whitePov(e))),setVisible(l,!0)),processDrag(e)}else l&&unsetPremove(e),u&&unsetPredrop(e);e.dom.redraw()}__name(start$1,`start`);function pieceCloseTo(e,t){let n=whitePov(e),r=e.dom.bounds(),a=(r.width/8)**2;for(let o of e.pieces.keys())if(distanceSq(computeSquareCenter(o,n,r),t)<=a)return!0;return!1}function dragNewPiece(e,t,n,r){e.pieces.set(`a0`,t),e.dom.redraw();let a=eventPosition(n);e.draggable.current={orig:`a0`,piece:t,origPos:a,pos:a,started:!0,element:()=>pieceElementByKey(e,`a0`),originTarget:n.target,newPiece:!0,force:!!r,keyHasChanged:!1},processDrag(e)}function processDrag(e){requestAnimationFrame(()=>{let t=e.draggable.current;if(!t)return;e.animation.current?.plan.anims.has(t.orig)&&(e.animation.current=void 0);let n=e.pieces.get(t.orig);if(!n||!samePiece(n,t.piece))cancel(e);else if(!t.started&&distanceSq(t.pos,t.origPos)>=e.draggable.distance**2&&(t.started=!0),t.started){if(typeof t.element==`function`){let e=t.element();if(!e)return;e.cgDragging=!0,e.classList.add(`dragging`),t.element=e}let n=e.dom.bounds();translate(t.element,[t.pos[0]-n.left-n.width/16,t.pos[1]-n.top-n.height/16]),t.keyHasChanged=t.keyHasChanged||t.orig!==getKeyAtDomPos(t.pos,whitePov(e),n)}processDrag(e)})}function move(e,t){e.draggable.current&&(!t.touches||t.touches.length<2)&&(e.draggable.current.pos=eventPosition(t))}function end(e,t){let n=e.draggable.current;if(!n)return;if(t.type===`touchend`&&t.cancelable!==!1&&t.preventDefault(),t.type===`touchend`&&n.originTarget!==t.target&&!n.newPiece){e.draggable.current=void 0;return}unsetPremove(e),unsetPredrop(e);let r=getKeyAtDomPos(eventPosition(t)||n.pos,whitePov(e),e.dom.bounds());r&&n.started&&n.orig!==r?n.newPiece?dropNewPiece(e,n.orig,r,n.force):(e.stats.ctrlKey=t.ctrlKey,userMove(e,n.orig,r)&&(e.stats.dragged=!0)):n.newPiece?e.pieces.delete(n.orig):e.draggable.deleteOnDropOff&&!r&&(e.pieces.delete(n.orig),callUserFunction(e.events.change)),(n.orig===n.previouslySelected||n.keyHasChanged)&&(n.orig===r||!r)?unselect(e):e.selectable.enabled||unselect(e),removeDragElements(e),e.draggable.current=void 0,e.dom.redraw()}function cancel(e){let t=e.draggable.current;t&&(t.newPiece&&e.pieces.delete(t.orig),e.draggable.current=void 0,unselect(e),removeDragElements(e),e.dom.redraw())}function removeDragElements(e){let t=e.dom.elements;t.ghost&&setVisible(t.ghost,!1)}function pieceElementByKey(e,t){let n=e.dom.elements.board.firstChild;for(;n;){if(n.cgKey===t&&n.tagName===`PIECE`)return n;n=n.nextSibling}}function explosion(e,t){e.exploding={stage:1,keys:t},e.dom.redraw(),setTimeout(()=>{setStage(e,2),setTimeout(()=>setStage(e,void 0),120)},120)}function setStage(e,t){e.exploding&&(t?e.exploding.stage=t:e.exploding=void 0,e.dom.redraw())}function start(e,t){function toggleOrientation$1(){toggleOrientation(e),t()}return __name(toggleOrientation$1,`toggleOrientation`),{set(t){t.orientation&&t.orientation!==e.orientation&&toggleOrientation$1(),applyAnimation(e,t),(t.fen?anim:render$2)(e=>configure(e,t),e)},state:e,getFen:()=>write(e.pieces),toggleOrientation:toggleOrientation$1,setPieces(t){anim(e=>setPieces(e,t),e)},selectSquare(t,n){t?anim(e=>selectSquare(e,t,n),e):e.selected&&(unselect(e),e.dom.redraw())},move(t,n){anim(e=>baseMove(e,t,n),e)},newPiece(t,n){anim(e=>baseNewPiece(e,t,n),e)},playPremove(){if(e.premovable.current){if(anim(playPremove,e))return!0;e.dom.redraw()}return!1},playPredrop(t){if(e.predroppable.current){let n=playPredrop(e,t);return e.dom.redraw(),n}return!1},cancelPremove(){render$2(unsetPremove,e)},cancelPredrop(){render$2(unsetPredrop,e)},cancelMove(){render$2(e=>{cancelMove(e),cancel(e)},e)},stop(){render$2(e=>{stop(e),cancel(e)},e)},explode(t){explosion(e,t)},setAutoShapes(t){render$2(e=>e.drawable.autoShapes=t,e)},setShapes(t){render$2(e=>e.drawable.shapes=t,e)},getKeyAtDomPos(t){return getKeyAtDomPos(t,whitePov(e),e.dom.bounds())},redrawAll:t,dragNewPiece(t,n,r){dragNewPiece(e,t,n,r)},destroy(){stop(e),e.dom.unbind?.(),e.dom.destroyed=!0}}}function defaults(){return{pieces:read(Ke),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:timer()}}var Xe={hilitePrimary:{key:`hilitePrimary`,color:`#3291ff`,opacity:1,lineWidth:1},hiliteWhite:{key:`hiliteWhite`,color:`#ffffff`,opacity:1,lineWidth:1}};function createDefs(){let e=createElement(`defs`),t=setAttributes(createElement(`filter`),{id:`cg-filter-blur`});return t.appendChild(setAttributes(createElement(`feGaussianBlur`),{stdDeviation:`0.019`})),e.appendChild(t),e}function renderSvg(e,t,n){let r=e.drawable,a=r.current,o=a&&a.mouseSq?a:void 0,c=new Map,l=e.dom.bounds(),u=r.autoShapes.filter(e=>!e.piece);for(let t of r.shapes.concat(u).concat(o?[o]:[])){if(!t.dest)continue;let n=c.get(t.dest)??new Set,r=pos2user(orient(key2pos(t.orig),e.orientation),l),a=pos2user(orient(key2pos(t.dest),e.orientation),l);n.add(moveAngle(r,a)),c.set(t.dest,n)}let d=r.shapes.concat(u).map(e=>({shape:e,current:!1,hash:shapeHash(e,isShort(e.dest,c),!1,l)}));o&&d.push({shape:o,current:!0,hash:shapeHash(o,isShort(o.dest,c),!0,l)});let p=d.map(e=>e.hash).join(`;`);p!==e.drawable.prevSvgHash&&(e.drawable.prevSvgHash=p,syncDefs(r,d,t.querySelector(`defs`)),syncShapes$1(d,t.querySelector(`g`),n.querySelector(`g`),t=>renderShape$1(e,t,r.brushes,c,l)))}function syncDefs(e,t,n){let r=new Map,a;for(let n of t.filter(e=>e.shape.dest&&e.shape.brush))a=makeCustomBrush(e.brushes[n.shape.brush],n.shape.modifiers),n.shape.modifiers?.hilite&&r.set(hilite(a).key,hilite(a)),r.set(a.key,a);let o=new Set,c=n.firstElementChild;for(;c;)o.add(c.getAttribute(`cgKey`)),c=c.nextElementSibling;for(let[e,t]of r.entries())o.has(e)||n.appendChild(renderMarker(t))}function syncShapes$1(e,t,n,r){let a=new Map;for(let t of e)a.set(t.hash,!1);for(let e of[t,n]){let t=[],n=e.firstElementChild,r;for(;n;)r=n.getAttribute(`cgHash`),a.has(r)?a.set(r,!0):t.push(n),n=n.nextElementSibling;for(let n of t)e.removeChild(n)}for(let o of e.filter(e=>!a.get(e.hash)))for(let e of r(o))e.isCustom?n.appendChild(e.el):t.appendChild(e.el)}__name(syncShapes$1,`syncShapes`);function shapeHash({orig:e,dest:t,brush:n,piece:r,modifiers:a,customSvg:o,label:c},l,u,d){return[d.width,d.height,u,e,t,n,l&&`-`,r&&pieceHash(r),a&&modifiersHash(a),o&&`custom-${textHash(o.html)},${o.center?.[0]??`o`}`,c&&`label-${textHash(c.text)}`].filter(e=>e).join(`,`)}function pieceHash(e){return[e.color,e.role,e.scale].filter(e=>e).join(`,`)}function modifiersHash(e){return[e.lineWidth,e.hilite&&`*`].filter(e=>e).join(`,`)}function textHash(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)>>>0;return t.toString()}function renderShape$1(e,{shape:t,current:n,hash:r},a,o,c){let l=pos2user(orient(key2pos(t.orig),e.orientation),c),u=t.dest?pos2user(orient(key2pos(t.dest),e.orientation),c):l,d=t.brush&&makeCustomBrush(a[t.brush],t.modifiers),p=o.get(t.dest),m=[];if(d){let e=setAttributes(createElement(`g`),{cgHash:r});m.push({el:e}),l[0]!==u[0]||l[1]!==u[1]?e.appendChild(renderArrow(t,d,l,u,n,isShort(t.dest,o))):e.appendChild(renderCircle(a[t.brush],l,n,c))}if(t.label){let e=t.label;e.fill||t.brush&&a[t.brush]&&(e.fill=a[t.brush].color);let n=t.brush?void 0:`tr`;m.push({el:renderLabel(e,r,l,u,p,n),isCustom:!0})}if(t.customSvg){let e=t.customSvg.center??`orig`,[n,a]=e===`label`?labelCoords(l,u,p).map(e=>e-.5):e===`dest`?u:l,o=setAttributes(createElement(`g`),{transform:`translate(${n},${a})`,cgHash:r});o.innerHTML=`<svg width="1" height="1" viewBox="0 0 100 100">${t.customSvg.html}</svg>`,m.push({el:o,isCustom:!0})}return m}__name(renderShape$1,`renderShape`);function renderCircle(e,t,n,r){let a=circleWidth(),o=(r.width+r.height)/(4*Math.max(r.width,r.height));return setAttributes(createElement(`circle`),{stroke:e.color,"stroke-width":a[n?0:1],fill:`none`,opacity:opacity(e,n),cx:t[0],cy:t[1],r:o-a[1]/2})}function hilite(e){return[`#ffffff`,`#fff`,`white`].includes(e.color)?Xe.hilitePrimary:Xe.hiliteWhite}function renderArrow(e,t,n,r,a,o){function renderLine(c){let l=arrowMargin(o&&!a),u=r[0]-n[0],d=r[1]-n[1],p=Math.atan2(d,u),m=Math.cos(p)*l,h=Math.sin(p)*l;return setAttributes(createElement(`line`),{stroke:c?hilite(t).color:t.color,"stroke-width":lineWidth(t,a)+(c?.04:0),"stroke-linecap":`round`,"marker-end":`url(#arrowhead-${c?hilite(t).key:t.key})`,opacity:e.modifiers?.hilite?1:opacity(t,a),x1:n[0],y1:n[1],x2:r[0]-m,y2:r[1]-h})}if(!e.modifiers?.hilite)return renderLine(!1);let c=createElement(`g`),l=setAttributes(createElement(`g`),{filter:`url(#cg-filter-blur)`});return l.appendChild(filterBox(n,r)),l.appendChild(renderLine(!0)),c.appendChild(l),c.appendChild(renderLine(!1)),c}function renderMarker(e){let t=setAttributes(createElement(`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(setAttributes(createElement(`path`),{d:`M0,0 V4 L3,2 Z`,fill:e.color})),t.setAttribute(`cgKey`,e.key),t}function renderLabel(e,t,n,r,a,o){let c=.4,l=c*.75**e.text.length,u=labelCoords(n,r,a),d=o===`tr`?.4:0,p=setAttributes(createElement(`g`),{transform:`translate(${u[0]+d},${u[1]-d})`,cgHash:t});p.appendChild(setAttributes(createElement(`circle`),{r:c/2,"fill-opacity":o?1:.8,"stroke-opacity":o?1:.7,"stroke-width":.03,fill:e.fill??`#666`,stroke:`white`}));let m=setAttributes(createElement(`text`),{"font-size":l,"font-family":`Noto Sans`,"text-anchor":`middle`,fill:`white`,y:.13*.75**e.text.length});return m.innerHTML=e.text,p.appendChild(m),p}function orient(e,t){return t===`cg-white`?e:[7-e[0],7-e[1]]}function isShort(e,t){return!0===(e&&t.has(e)&&t.get(e).size>1)}function createElement(e){return document.createElementNS(`http://www.w3.org/2000/svg`,e)}function setAttributes(e,t){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.setAttribute(n,t[n]);return e}function makeCustomBrush(e,t){return t?{color:e.color,opacity:Math.round(e.opacity*10)/10,lineWidth:Math.round(t.lineWidth||e.lineWidth),key:[e.key,t.lineWidth].filter(e=>e).join(``)}:e}function circleWidth(){return[3/64,4/64]}function lineWidth(e,t){return(e.lineWidth||10)*(t?.85:1)/64}function opacity(e,t){return(e.opacity||1)*(t?.9:1)}function arrowMargin(e){return(e?20:10)/64}function pos2user(e,t){let n=Math.min(1,t.width/t.height),r=Math.min(1,t.height/t.width);return[(e[0]-3.5)*n,(3.5-e[1])*r]}function filterBox(e,t){let n={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 setAttributes(createElement(`rect`),{x:n.from[0],y:n.from[1],width:n.to[0]-n.from[0],height:n.to[1]-n.from[1],fill:`none`,stroke:`none`})}function moveAngle(e,t,n=!0){let r=Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI;return n?(Math.round(r*8/Math.PI)+16)%16:r}function dist(e,t){return Math.sqrt([e[0]-t[0],e[1]-t[1]].reduce((e,t)=>e+t*t,0))}function labelCoords(e,t,n){let r=dist(e,t),a=moveAngle(e,t,!1);if(n&&(r-=33/64,n.size>1)){r-=10/64;let a=moveAngle(e,t);(n.has((a+1)%16)||n.has((a+15)%16))&&a&1&&(r-=.4)}return[e[0]-Math.cos(a)*r,e[1]-Math.sin(a)*r].map(e=>e+.5)}function renderWrap(e,t){e.innerHTML=``,e.classList.add(`cg-wrap`);for(let n of Ve)e.classList.toggle(`orientation-`+n,t.orientation===n);e.classList.toggle(`manipulable`,!t.viewOnly);let n=createEl(`cg-container`);e.appendChild(n);let r=createEl(`cg-board`);n.appendChild(r);let a,o,c;if(t.drawable.visible&&(a=setAttributes(createElement(`svg`),{class:`cg-shapes`,viewBox:`-4 -4 8 8`,preserveAspectRatio:`xMidYMid slice`}),a.appendChild(createDefs()),a.appendChild(createElement(`g`)),o=setAttributes(createElement(`svg`),{class:`cg-custom-svgs`,viewBox:`-3.5 -3.5 8 8`,preserveAspectRatio:`xMidYMid slice`}),o.appendChild(createElement(`g`)),c=createEl(`cg-auto-pieces`),n.appendChild(a),n.appendChild(o),n.appendChild(c)),t.coordinates){let e=t.orientation===`cg-black`?` black`:``,r=t.ranksPosition===`left`?` left`:``;if(t.coordinatesOnSquares){let a=t.orientation===`cg-white`?e=>e+1:e=>8-e;He.forEach((t,o)=>n.appendChild(renderCoords(Ue.map(e=>t+e),`squares rank`+a(o)+e+r)))}else n.appendChild(renderCoords(Ue,`ranks`+e+r)),n.appendChild(renderCoords(He,`files`+e))}let l;return t.draggable.enabled&&t.draggable.showGhost&&(l=createEl(`piece`,`ghost`),setVisible(l,!1),n.appendChild(l)),{board:r,container:n,wrap:e,ghost:l,svg:a,customSvg:o,autoPieces:c}}function renderCoords(e,t){let n=createEl(`coords`,t),r;for(let t of e)r=createEl(`coord`),r.textContent=t,n.appendChild(r);return n}function drop(e,t){if(!e.dropmode.active)return;unsetPremove(e),unsetPredrop(e);let n=e.dropmode.piece;if(n){e.pieces.set(`a0`,n);let r=eventPosition(t),a=r&&getKeyAtDomPos(r,whitePov(e),e.dom.bounds());a&&dropNewPiece(e,`a0`,a)}e.dom.redraw()}function bindBoard(e){let t=e.dom.elements.board;if((e.disableContextMenu||e.drawable.enabled)&&t.addEventListener(`contextmenu`,e=>e.preventDefault()),e.viewOnly)return;let n=startDragOrDraw(e);t.addEventListener(`touchstart`,n,{passive:!1}),t.addEventListener(`mousedown`,n,{passive:!1})}function bindDocument(e,t){let n=[];if(`ResizeObserver`in window||n.push(unbindable(document.body,`chessground.resize`,t)),!e.viewOnly){let t=dragOrDraw(e,move,move$1),r=dragOrDraw(e,end,end$1);for(let e of[`touchmove`,`mousemove`])n.push(unbindable(document,e,t));for(let e of[`touchend`,`mouseup`])n.push(unbindable(document,e,r));let onScroll=()=>e.dom.bounds.clear();n.push(unbindable(document,`scroll`,onScroll,{capture:!0,passive:!0})),n.push(unbindable(window,`resize`,onScroll,{passive:!0}))}return()=>n.forEach(e=>e())}function unbindable(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var startDragOrDraw=e=>t=>{e.draggable.current?cancel(e):e.drawable.current?cancel$1(e):t.shiftKey||isRightButton(t)?e.drawable.enabled&&start$2(e,t):e.viewOnly||(e.dropmode.active?drop(e,t):start$1(e,t))},dragOrDraw=(e,t,n)=>r=>{e.drawable.current?e.drawable.enabled&&n(e,r):e.viewOnly||t(e,r)};function render$1(e){let t=whitePov(e),n=posToTranslate(e.dom.bounds()),r=e.dom.elements.board,a=e.pieces,o=e.animation.current,c=o?o.plan.anims:new Map,l=o?o.plan.fadings:new Map,u=e.draggable.current,d=computeSquareClasses(e),p=new Set,m=new Set,h=new Map,g=new Map,_,y,b,x,S,C,w,T,E,D;for(y=r.firstChild;y;){if(_=y.cgKey,isPieceNode(y))if(b=a.get(_),S=c.get(_),C=l.get(_),x=y.cgPiece,y.cgDragging&&(!u||u.orig!==_)&&(y.classList.remove(`dragging`),translate(y,n(key2pos(_),t)),y.cgDragging=!1),!C&&y.cgFading&&(y.cgFading=!1,y.classList.remove(`fading`)),b){if(S&&y.cgAnimating&&x===pieceNameOf(b)){let e=key2pos(_);e[0]+=S[2],e[1]+=S[3],y.classList.add(`anim`),translate(y,n(e,t))}else y.cgAnimating&&(y.cgAnimating=!1,y.classList.remove(`anim`),translate(y,n(key2pos(_),t)),e.addPieceZIndex&&(y.style.zIndex=posZIndex(key2pos(_),t)));x===pieceNameOf(b)&&(!C||!y.cgFading)?p.add(_):C&&x===pieceNameOf(C)?(y.classList.add(`fading`),y.cgFading=!0):appendValue(h,x,y)}else appendValue(h,x,y);else if(isSquareNode(y)){let e=y.className;d.get(_)===e?m.add(_):appendValue(g,e,y)}y=y.nextSibling}for(let[e,a]of d)if(!m.has(e)){E=g.get(a),D=E&&E.pop();let o=n(key2pos(e),t);if(D)D.cgKey=e,translate(D,o);else{let t=createEl(`square`,a);t.cgKey=e,translate(t,o),r.insertBefore(t,r.firstChild)}}for(let[o,l]of a)if(S=c.get(o),!p.has(o))if(w=h.get(pieceNameOf(l)),T=w&&w.pop(),T){T.cgKey=o,T.cgFading&&(T.classList.remove(`fading`),T.cgFading=!1);let r=key2pos(o);e.addPieceZIndex&&(T.style.zIndex=posZIndex(r,t)),S&&(T.cgAnimating=!0,T.classList.add(`anim`),r[0]+=S[2],r[1]+=S[3]),translate(T,n(r,t))}else{let a=pieceNameOf(l),c=createEl(`piece`,a),u=key2pos(o);c.cgPiece=a,c.cgKey=o,S&&(c.cgAnimating=!0,u[0]+=S[2],u[1]+=S[3]),translate(c,n(u,t)),e.addPieceZIndex&&(c.style.zIndex=posZIndex(u,t)),r.appendChild(c)}for(let t of h.values())removeNodes(e,t);for(let t of g.values())removeNodes(e,t)}__name(render$1,`render`);function renderResized$1(e){let t=whitePov(e),n=posToTranslate(e.dom.bounds()),r=e.dom.elements.board.firstChild;for(;r;)(isPieceNode(r)&&!r.cgAnimating||isSquareNode(r))&&translate(r,n(key2pos(r.cgKey),t)),r=r.nextSibling}__name(renderResized$1,`renderResized`);function updateBounds(e){let t=e.dom.elements.wrap.getBoundingClientRect(),n=e.dom.elements.container,r=t.height/t.width,a=Math.floor(t.width*window.devicePixelRatio/8)*8/window.devicePixelRatio,o=a*r;n.style.width=a+`px`,n.style.height=o+`px`,e.dom.bounds.clear(),e.addDimensionsCssVarsTo?.style.setProperty(`---cg-width`,a+`px`),e.addDimensionsCssVarsTo?.style.setProperty(`---cg-height`,o+`px`)}var isPieceNode=e=>e.tagName===`PIECE`,isSquareNode=e=>e.tagName===`SQUARE`;function removeNodes(e,t){for(let n of t)e.dom.elements.board.removeChild(n)}function posZIndex(e,t){let n=e[1];return`${t?10-n:3+n}`}var pieceNameOf=e=>`${e.color} ${e.role}`;function computeSquareClasses(e){let t=new Map;if(e.lastMove&&e.highlight.lastMove)for(let n of e.lastMove)addSquare(t,n,`last-move`);if(e.check&&e.highlight.check&&addSquare(t,e.check,`check`),e.selected&&(addSquare(t,e.selected,`selected`),e.movable.showDests)){let n=e.movable.dests?.get(e.selected);if(n)for(let r of n)addSquare(t,r,`move-dest`+(e.pieces.has(r)?` oc`:``));let r=e.premovable.customDests?.get(e.selected)??e.premovable.dests;if(r)for(let n of r)addSquare(t,n,`premove-dest`+(e.pieces.has(n)?` oc`:``))}let n=e.premovable.current;if(n)for(let e of n)addSquare(t,e,`current-premove`);else e.predroppable.current&&addSquare(t,e.predroppable.current.key,`current-premove`);let r=e.exploding;if(r)for(let e of r.keys)addSquare(t,e,`exploding`+r.stage);return e.highlight.custom&&e.highlight.custom.forEach((e,n)=>{addSquare(t,n,e)}),t}function addSquare(e,t,n){let r=e.get(t);r?e.set(t,`${r} ${n}`):e.set(t,n)}function appendValue(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function syncShapes(e,t,n){let r=new Map,a=[];for(let t of e)r.set(t.hash,!1);let o=t.firstElementChild,c;for(;o;)c=o.getAttribute(`cgHash`),r.has(c)?r.set(c,!0):a.push(o),o=o.nextElementSibling;for(let e of a)t.removeChild(e);for(let a of e)r.get(a.hash)||t.appendChild(n(a))}function render(e,t){syncShapes(e.drawable.autoShapes.filter(e=>e.piece).map(e=>({shape:e,hash:hash(e),current:!1})),t,t=>renderShape(e,t,e.dom.bounds()))}function renderResized(e){let t=whitePov(e),n=posToTranslate(e.dom.bounds()),r=e.dom.elements.autoPieces?.firstChild;for(;r;)translateAndScale(r,n(key2pos(r.cgKey),t),r.cgScale),r=r.nextSibling}function renderShape(e,{shape:t,hash:n},r){let a=t.orig,o=t.piece?.role,c=t.piece?.color,l=t.piece?.scale,u=createEl(`piece`,`${o} ${c}`);return u.setAttribute(`cgHash`,n),u.cgKey=a,u.cgScale=l,translateAndScale(u,posToTranslate(r)(key2pos(a),whitePov(e)),l),u}var hash=e=>[e.orig,e.piece?.role,e.piece?.color,e.piece?.scale].join(`,`);function Chessground(e,t){let n=defaults();configure(n,t||{});function redrawAll(){let t=`dom`in n?n.dom.unbind:void 0,r=renderWrap(e,n),a=memo(()=>r.board.getBoundingClientRect()),redrawNow=e=>{render$1(o),r.autoPieces&&render(o,r.autoPieces),!e&&r.svg&&renderSvg(o,r.svg,r.customSvg)},onResize=()=>{updateBounds(o),renderResized$1(o),r.autoPieces&&renderResized(o)},o=n;return o.dom={elements:r,bounds:a,redraw:debounceRedraw(redrawNow),redrawNow,unbind:t},o.drawable.prevSvgHash=``,updateBounds(o),redrawNow(!1),bindBoard(o),t||(o.dom.unbind=bindDocument(o,onResize)),o.events.insert?.(r),o}return start(redrawAll(),redrawAll)}function debounceRedraw(e){let t=!1;return()=>{t||(t=!0,requestAnimationFrame(()=>{e(),t=!1}))}}var Ze=`rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1`,Move=class{constructor(e,t){U(this,`color`,void 0),U(this,`from`,void 0),U(this,`to`,void 0),U(this,`piece`,void 0),U(this,`captured`,void 0),U(this,`promotion`,void 0),U(this,`flags`,void 0),U(this,`san`,void 0),U(this,`lan`,void 0),U(this,`before`,void 0),U(this,`after`,void 0);let{color:n,piece:r,from:a,to:o,flags:c,captured:l,promotion:u}=t,d=algebraic(a),p=algebraic(o);this.color=n,this.piece=r,this.from=d,this.to=p,this.san=e._moveToSan(t,e._moves({legal:!0})),this.lan=d+p,this.before=e.fen(),e._makeMove(t),this.after=e.fen(),e._undoMove(),this.flags=``;for(let e in $)$[e]&c&&(this.flags+=$e[e]);l&&(this.captured=l),u&&(this.promotion=u,this.lan+=u)}isCapture(){return this.flags.indexOf($e.CAPTURE)>-1}isPromotion(){return this.flags.indexOf($e.PROMOTION)>-1}isEnPassant(){return this.flags.indexOf($e.EP_CAPTURE)>-1}isKingsideCastle(){return this.flags.indexOf($e.KSIDE_CASTLE)>-1}isQueensideCastle(){return this.flags.indexOf($e.QSIDE_CASTLE)>-1}isBigPawn(){return this.flags.indexOf($e.BIG_PAWN)>-1}},Qe=-1,$e={NORMAL:`n`,CAPTURE:`c`,BIG_PAWN:`b`,EP_CAPTURE:`e`,PROMOTION:`p`,KSIDE_CASTLE:`k`,QSIDE_CASTLE:`q`},et=`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`.split(`.`),$={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},tt={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},nt={b:[16,32,17,15],w:[-16,-32,-17,-15]},rt={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]},it=[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],ot=[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],st={p:1,n:2,b:4,r:8,q:16,k:32},ct=`pnbrqkPNBRQK`,lt=[`n`,`b`,`r`,`q`],ut=7,dt=6,ft=1,pt=0,mt={k:$.KSIDE_CASTLE,q:$.QSIDE_CASTLE},ht={w:[{square:tt.a1,flag:$.QSIDE_CASTLE},{square:tt.h1,flag:$.KSIDE_CASTLE}],b:[{square:tt.a8,flag:$.QSIDE_CASTLE},{square:tt.h8,flag:$.KSIDE_CASTLE}]},gt={b:ft,w:dt},_t=[`1-0`,`0-1`,`1/2-1/2`,`*`];function rank(e){return e>>4}function file(e){return e&15}function isDigit(e){return`0123456789`.indexOf(e)!==-1}function algebraic(e){let t=file(e),n=rank(e);return`abcdefgh`.substring(t,t+1)+`87654321`.substring(n,n+1)}function swapColor$1(e){return e===`w`?`b`:`w`}__name(swapColor$1,`swapColor`);function validateFen(e){let t=e.split(/\s+/);if(t.length!==6)return{ok:!1,error:`Invalid FEN: must contain six space-delimited fields`};let n=parseInt(t[5],10);if(isNaN(n)||n<=0)return{ok:!1,error:`Invalid FEN: move number must be a positive integer`};let r=parseInt(t[4],10);if(isNaN(r)||r<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`};let a=t[0].split(`/`);if(a.length!==8)return{ok:!1,error:`Invalid FEN: piece data does not contain 8 '/'-delimited rows`};for(let e=0;e<a.length;e++){let t=0,n=!1;for(let r=0;r<a[e].length;r++)if(isDigit(a[e][r])){if(n)return{ok:!1,error:`Invalid FEN: piece data is invalid (consecutive number)`};t+=parseInt(a[e][r],10),n=!0}else{if(!/^[prnbqkPRNBQK]$/.test(a[e][r]))return{ok:!1,error:`Invalid FEN: piece data is invalid (invalid piece)`};t+=1,n=!1}if(t!==8)return{ok:!1,error:`Invalid FEN: piece data is invalid (too many squares in rank)`}}if(t[3][1]==`3`&&t[1]==`w`||t[3][1]==`6`&&t[1]==`b`)return{ok:!1,error:`Invalid FEN: illegal en-passant square`};for(let{color:e,regex:n}of[{color:`white`,regex:/K/g},{color:`black`,regex:/k/g}]){if(!n.test(t[0]))return{ok:!1,error:`Invalid FEN: missing ${e} king`};if((t[0].match(n)||[]).length>1)return{ok:!1,error:`Invalid FEN: too many ${e} kings`}}return Array.from(a[0]+a[7]).some(e=>e.toUpperCase()===`P`)?{ok:!1,error:`Invalid FEN: some pawns are on the edge rows`}:{ok:!0}}function getDisambiguator(e,t){let n=e.from,r=e.to,a=e.piece,o=0,c=0,l=0;for(let e=0,u=t.length;e<u;e++){let u=t[e].from,d=t[e].to;a===t[e].piece&&n!==u&&r===d&&(o++,rank(n)===rank(u)&&c++,file(n)===file(u)&&l++)}return o>0?c>0&&l>0?algebraic(n):l>0?algebraic(n).charAt(1):algebraic(n).charAt(0):``}function addMove(e,t,n,r,a,o=void 0,c=$.NORMAL){let l=rank(r);if(a===`p`&&(l===ut||l===pt))for(let l=0;l<lt.length;l++){let u=lt[l];e.push({color:t,from:n,to:r,piece:a,captured:o,promotion:u,flags:c|$.PROMOTION})}else e.push({color:t,from:n,to:r,piece:a,captured:o,flags:c})}function inferPieceType(e){let t=e.charAt(0);return t>=`a`&&t<=`h`?e.match(/[a-h]\d.*[a-h]\d/)?void 0:`p`:(t=t.toLowerCase(),t===`o`?`k`:t)}function strippedSan(e){return e.replace(/=/,``).replace(/[+#]?[?!]*$/,``)}function trimFen(e){return e.split(` `).slice(0,4).join(` `)}var Chess=class{constructor(e=Ze,{skipValidation:t=!1}={}){U(this,`_board`,Array(128)),U(this,`_turn`,`w`),U(this,`_header`,{}),U(this,`_kings`,{w:Qe,b:Qe}),U(this,`_epSquare`,-1),U(this,`_halfMoves`,0),U(this,`_moveNumber`,0),U(this,`_history`,[]),U(this,`_comments`,{}),U(this,`_castling`,{w:0,b:0}),U(this,`_positionCount`,{}),this.load(e,{skipValidation:t})}clear({preserveHeaders:e=!1}={}){this._board=Array(128),this._kings={w:Qe,b:Qe},this._turn=`w`,this._castling={w:0,b:0},this._epSquare=Qe,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:n=!1}={}){let r=e.split(/\s+/);if(r.length>=2&&r.length<6&&(e=r.concat([`-`,`-`,`0`,`1`].slice(-(6-r.length))).join(` `)),r=e.split(/\s+/),!t){let{ok:t,error:n}=validateFen(e);if(!t)throw Error(n)}let a=r[0],o=0;this.clear({preserveHeaders:n});for(let e=0;e<a.length;e++){let t=a.charAt(e);if(t===`/`)o+=8;else if(isDigit(t))o+=parseInt(t,10);else{let e=t<`a`?`w`:`b`;this._put({type:t.toLowerCase(),color:e},algebraic(o)),o++}}this._turn=r[1],r[2].indexOf(`K`)>-1&&(this._castling.w|=$.KSIDE_CASTLE),r[2].indexOf(`Q`)>-1&&(this._castling.w|=$.QSIDE_CASTLE),r[2].indexOf(`k`)>-1&&(this._castling.b|=$.KSIDE_CASTLE),r[2].indexOf(`q`)>-1&&(this._castling.b|=$.QSIDE_CASTLE),this._epSquare=r[3]===`-`?Qe:tt[r[3]],this._halfMoves=parseInt(r[4],10),this._moveNumber=parseInt(r[5],10),this._updateSetup(e),this._incPositionCount(e)}fen(){let e=0,t=``;for(let n=tt.a8;n<=tt.h1;n++){if(this._board[n]){e>0&&(t+=e,e=0);let{color:r,type:a}=this._board[n];t+=r===`w`?a.toUpperCase():a.toLowerCase()}else e++;n+1&136&&(e>0&&(t+=e),n!==tt.h1&&(t+=`/`),e=0,n+=8)}let n=``;this._castling.w&$.KSIDE_CASTLE&&(n+=`K`),this._castling.w&$.QSIDE_CASTLE&&(n+=`Q`),this._castling.b&$.KSIDE_CASTLE&&(n+=`k`),this._castling.b&$.QSIDE_CASTLE&&(n+=`q`),n||(n=`-`);let r=`-`;if(this._epSquare!==Qe){let e=this._epSquare+(this._turn===`w`?16:-16),t=[e+1,e-1];for(let e of t){if(e&136)continue;let t=this._turn;if(this._board[e]?.color===t&&this._board[e]?.type===`p`){this._makeMove({color:t,from:e,to:this._epSquare,piece:`p`,captured:`p`,flags:$.EP_CAPTURE});let n=!this._isKingAttacked(t);if(this._undoMove(),n){r=algebraic(this._epSquare);break}}}}return[t,this._turn,n,r,this._halfMoves,this._moveNumber].join(` `)}_updateSetup(e){this._history.length>0||(e===`rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1`?(delete this._header.SetUp,delete this._header.FEN):(this._header.SetUp=`1`,this._header.FEN=e))}reset(){this.load(Ze)}get(e){return this._board[tt[e]]}put({type:e,color:t},n){return this._put({type:e,color:t},n)?(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0):!1}_put({type:e,color:t},n){if(ct.indexOf(e.toLowerCase())===-1||!(n in tt))return!1;let r=tt[n];if(e==`k`&&!(this._kings[t]==Qe||this._kings[t]==r))return!1;let a=this._board[r];return a&&a.type===`k`&&(this._kings[a.color]=Qe),this._board[r]={type:e,color:t},e===`k`&&(this._kings[t]=r),!0}remove(e){let t=this.get(e);return delete this._board[tt[e]],t&&t.type===`k`&&(this._kings[t.color]=Qe),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),t}_updateCastlingRights(){let e=this._board[tt.e1]?.type===`k`&&this._board[tt.e1]?.color===`w`,t=this._board[tt.e8]?.type===`k`&&this._board[tt.e8]?.color===`b`;(!e||this._board[tt.a1]?.type!==`r`||this._board[tt.a1]?.color!==`w`)&&(this._castling.w&=~$.QSIDE_CASTLE),(!e||this._board[tt.h1]?.type!==`r`||this._board[tt.h1]?.color!==`w`)&&(this._castling.w&=~$.KSIDE_CASTLE),(!t||this._board[tt.a8]?.type!==`r`||this._board[tt.a8]?.color!==`b`)&&(this._castling.b&=~$.QSIDE_CASTLE),(!t||this._board[tt.h8]?.type!==`r`||this._board[tt.h8]?.color!==`b`)&&(this._castling.b&=~$.KSIDE_CASTLE)}_updateEnPassantSquare(){if(this._epSquare===Qe)return;let e=this._epSquare+(this._turn===`w`?-16:16),t=this._epSquare+(this._turn===`w`?16:-16),n=[t+1,t-1];if(this._board[e]!==null||this._board[this._epSquare]!==null||this._board[t]?.color!==swapColor$1(this._turn)||this._board[t]?.type!==`p`){this._epSquare=Qe;return}let canCapture=e=>!(e&136)&&this._board[e]?.color===this._turn&&this._board[e]?.type===`p`;n.some(canCapture)||(this._epSquare=Qe)}_attacked(e,t,n){let r=[];for(let a=tt.a8;a<=tt.h1;a++){if(a&136){a+=7;continue}if(this._board[a]===void 0||this._board[a].color!==e)continue;let o=this._board[a],c=a-t;if(c===0)continue;let l=c+119;if(it[l]&st[o.type]){if(o.type===`p`){if(c>0&&o.color===`w`||c<=0&&o.color===`b`)if(n)r.push(algebraic(a));else return!0;continue}if(o.type===`n`||o.type===`k`)if(n){r.push(algebraic(a));continue}else return!0;let e=ot[l],u=a+e,d=!1;for(;u!==t;){if(this._board[u]!=null){d=!0;break}u+=e}if(!d)if(n){r.push(algebraic(a));continue}else return!0}}return n?r:!1}attackers(e,t){return t?this._attacked(t,tt[e],!0):this._attacked(this._turn,tt[e],!0)}_isKingAttacked(e){let t=this._kings[e];return t===-1?!1:this._attacked(swapColor$1(e),t)}isAttacked(e,t){return this._attacked(t,tt[e])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&this._moves().length===0}isStalemate(){return!this.isCheck()&&this._moves().length===0}isInsufficientMaterial(){let e={b:0,n:0,r:0,q:0,k:0,p:0},t=[],n=0,r=0;for(let a=tt.a8;a<=tt.h1;a++){if(r=(r+1)%2,a&136){a+=7;continue}let o=this._board[a];o&&(e[o.type]=o.type in e?e[o.type]+1:1,o.type===`b`&&t.push(r),n++)}if(n===2||n===3&&(e.b===1||e.n===1))return!0;if(n===e.b+2){let e=0,n=t.length;for(let r=0;r<n;r++)e+=t[r];if(e===0||e===n)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=void 0,piece:n=void 0}={}){let r=this._moves({square:t,piece:n});return e?r.map(e=>new Move(this,e)):r.map(e=>this._moveToSan(e,r))}_moves({legal:e=!0,piece:t=void 0,square:n=void 0}={}){let r=n?n.toLowerCase():void 0,a=t?.toLowerCase(),o=[],c=this._turn,l=swapColor$1(c),u=tt.a8,d=tt.h1,p=!1;if(r)if(r in tt)u=d=tt[r],p=!0;else return[];for(let e=u;e<=d;e++){if(e&136){e+=7;continue}if(!this._board[e]||this._board[e].color===l)continue;let{type:t}=this._board[e],n;if(t===`p`){if(a&&a!==t)continue;n=e+nt[c][0],this._board[n]||(addMove(o,c,e,n,`p`),n=e+nt[c][1],gt[c]===rank(e)&&!this._board[n]&&addMove(o,c,e,n,`p`,void 0,$.BIG_PAWN));for(let t=2;t<4;t++)n=e+nt[c][t],!(n&136)&&(this._board[n]?.color===l?addMove(o,c,e,n,`p`,this._board[n].type,$.CAPTURE):n===this._epSquare&&addMove(o,c,e,n,`p`,`p`,$.EP_CAPTURE))}else{if(a&&a!==t)continue;for(let r=0,a=rt[t].length;r<a;r++){let a=rt[t][r];for(n=e;n+=a,!(n&136);){if(!this._board[n])addMove(o,c,e,n,t);else{if(this._board[n].color===c)break;addMove(o,c,e,n,t,this._board[n].type,$.CAPTURE);break}if(t===`n`||t===`k`)break}}}}if((a===void 0||a===`k`)&&(!p||d===this._kings[c])){if(this._castling[c]&$.KSIDE_CASTLE){let e=this._kings[c],t=e+2;!this._board[e+1]&&!this._board[t]&&!this._attacked(l,this._kings[c])&&!this._attacked(l,e+1)&&!this._attacked(l,t)&&addMove(o,c,this._kings[c],t,`k`,void 0,$.KSIDE_CASTLE)}if(this._castling[c]&$.QSIDE_CASTLE){let e=this._kings[c],t=e-2;!this._board[e-1]&&!this._board[e-2]&&!this._board[e-3]&&!this._attacked(l,this._kings[c])&&!this._attacked(l,e-1)&&!this._attacked(l,t)&&addMove(o,c,this._kings[c],t,`k`,void 0,$.QSIDE_CASTLE)}}if(!e||this._kings[c]===-1)return o;let m=[];for(let e=0,t=o.length;e<t;e++)this._makeMove(o[e]),this._isKingAttacked(c)||m.push(o[e]),this._undoMove();return m}move(e,{strict:t=!1}={}){let n=null;if(typeof e==`string`)n=this._moveFromSan(e,t);else if(typeof e==`object`){let t=this._moves();for(let r=0,a=t.length;r<a;r++)if(e.from===algebraic(t[r].from)&&e.to===algebraic(t[r].to)&&(!(`promotion`in t[r])||e.promotion===t[r].promotion)){n=t[r];break}}if(!n)throw typeof e==`string`?Error(`Invalid move: ${e}`):Error(`Invalid move: ${JSON.stringify(e)}`);let r=new Move(this,n);return this._makeMove(n),this._incPositionCount(r.after),r}_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){let t=this._turn,n=swapColor$1(t);if(this._push(e),this._board[e.to]=this._board[e.from],delete this._board[e.from],e.flags&$.EP_CAPTURE&&(this._turn===`b`?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===`k`){if(this._kings[t]=e.to,e.flags&$.KSIDE_CASTLE){let t=e.to-1,n=e.to+1;this._board[t]=this._board[n],delete this._board[n]}else if(e.flags&$.QSIDE_CASTLE){let t=e.to+1,n=e.to-2;this._board[t]=this._board[n],delete this._board[n]}this._castling[t]=0}if(this._castling[t]){for(let n=0,r=ht[t].length;n<r;n++)if(e.from===ht[t][n].square&&this._castling[t]&ht[t][n].flag){this._castling[t]^=ht[t][n].flag;break}}if(this._castling[n]){for(let t=0,r=ht[n].length;t<r;t++)if(e.to===ht[n][t].square&&this._castling[n]&ht[n][t].flag){this._castling[n]^=ht[n][t].flag;break}}e.flags&$.BIG_PAWN?t===`b`?this._epSquare=e.to-16:this._epSquare=e.to+16:this._epSquare=Qe,e.piece===`p`||e.flags&($.CAPTURE|$.EP_CAPTURE)?this._halfMoves=0:this._halfMoves++,t===`b`&&this._moveNumber++,this._turn=n}undo(){let e=this._undoMove();if(e){let t=new Move(this,e);return this._decPositionCount(t.after),t}return null}_undoMove(){let e=this._history.pop();if(e===void 0)return null;let 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;let n=this._turn,r=swapColor$1(n);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&$.EP_CAPTURE){let e;e=n===`b`?t.to-16:t.to+16,this._board[e]={type:`p`,color:r}}else this._board[t.to]={type:t.captured,color:r};if(t.flags&($.KSIDE_CASTLE|$.QSIDE_CASTLE)){let e,n;t.flags&$.KSIDE_CASTLE?(e=t.to+1,n=t.to-1):(e=t.to-2,n=t.to+1),this._board[e]=this._board[n],delete this._board[n]}return t}pgn({newline:e=`
3
+ `,maxWidth:t=0}={}){let n=[],r=!1;for(let t in this._header)n.push(`[`+t+` "`+this._header[t]+`"]`+e),r=!0;r&&this._history.length&&n.push(e);let appendComment=e=>{let t=this._comments[this.fen()];if(t!==void 0){let n=e.length>0?` `:``;e=`${e}${n}{${t}}`}return e},a=[];for(;this._history.length>0;)a.push(this._undoMove());let o=[],c=``;for(a.length===0&&o.push(appendComment(``));a.length>0;){c=appendComment(c);let e=a.pop();if(!e)break;if(!this._history.length&&e.color===`b`){let e=`${this._moveNumber}. ...`;c=c?`${c} ${e}`:e}else e.color===`w`&&(c.length&&o.push(c),c=this._moveNumber+`.`);c=c+` `+this._moveToSan(e,this._moves({legal:!0})),this._makeMove(e)}if(c.length&&o.push(appendComment(c)),this._header.Result!==void 0&&o.push(this._header.Result),t===0)return n.join(``)+o.join(` `);let strip=function(){return n.length>0&&n[n.length-1]===` `?(n.pop(),!0):!1},wrapComment=function(r,a){for(let o of a.split(` `))if(o){if(r+o.length>t){for(;strip();)r--;n.push(e),r=0}n.push(o),r+=o.length,n.push(` `),r++}return strip()&&r--,r},l=0;for(let r=0;r<o.length;r++){if(l+o[r].length>t&&o[r].includes(`{`)){l=wrapComment(l,o[r]);continue}l+o[r].length>t&&r!==0?(n[n.length-1]===` `&&n.pop(),n.push(e),l=0):r!==0&&(n.push(` `),l++),n.push(o[r]),l+=o[r].length}return n.join(``)}header(...e){for(let t=0;t<e.length;t+=2)typeof e[t]==`string`&&typeof e[t+1]==`string`&&(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):!1}getHeaders(){return this._header}loadPgn(e,{strict:t=!1,newlineChar:n=`\r?
4
+ `}={}){function mask(e){return e.replace(/\\/g,`\\`)}function parsePgnHeader(e){let t={},r=e.split(new RegExp(mask(n))),a=``,o=``;for(let e=0;e<r.length;e++){let n=/^\s*\[\s*([A-Za-z]+)\s*"(.*)"\s*\]\s*$/;a=r[e].replace(n,`$1`),o=r[e].replace(n,`$2`),a.trim().length>0&&(t[a]=o)}return t}e=e.trim();let r=RegExp(`^(\\[((?:`+mask(n)+`)|.)*\\])((?:\\s*`+mask(n)+`){2}|(?:\\s*`+mask(n)+`)*$)`).exec(e),a=r&&r.length>=2?r[1]:``;this.reset();let o=parsePgnHeader(a),c=``;for(let e in o)e.toLowerCase()===`fen`&&(c=o[e]),this.header(e,o[e]);if(!t)c&&this.load(c,{preserveHeaders:!0});else if(o.SetUp===`1`){if(!(`FEN`in o))throw Error(`Invalid PGN: FEN tag must be supplied with SetUp tag`);this.load(o.FEN,{preserveHeaders:!0})}function toHex(e){return Array.from(e).map(function(e){return e.charCodeAt(0)<128?e.charCodeAt(0).toString(16):encodeURIComponent(e).replace(/%/g,``).toLowerCase()}).join(``)}function fromHex(e){return e.length==0?``:decodeURIComponent(`%`+(e.match(/.{1,2}/g)||[]).join(`%`))}let encodeComment=function(e){return e=e.replace(new RegExp(mask(n),`g`),` `),`{${toHex(e.slice(1,e.length-1))}}`},decodeComment=function(e){if(e.startsWith(`{`)&&e.endsWith(`}`))return fromHex(e.slice(1,e.length-1))},l=e.replace(a,``).replace(RegExp(`({[^}]*})+?|;([^${mask(n)}]*)`,`g`),function(e,t,n){return t===void 0?` `+encodeComment(`{${n.slice(1)}}`):encodeComment(t)}).replace(new RegExp(mask(n),`g`),` `),u=/(\([^()]+\))+?/g;for(;u.test(l);)l=l.replace(u,``);l=l.replace(/\d+\.(\.\.)?/g,``),l=l.replace(/\.\.\./g,``),l=l.replace(/\$\d+/g,``);let d=l.trim().split(new RegExp(/\s+/));d=d.filter(e=>e!==``);let p=``;for(let e=0;e<d.length;e++){let n=decodeComment(d[e]);if(n!==void 0){this._comments[this.fen()]=n;continue}let r=this._moveFromSan(d[e],t);if(r==null)if(_t.indexOf(d[e])>-1)p=d[e];else throw Error(`Invalid move in PGN: ${d[e]}`);else p=``,this._makeMove(r),this._incPositionCount(this.fen())}p&&Object.keys(this._header).length&&!this._header.Result&&this.header(`Result`,p)}_moveToSan(e,t){let n=``;if(e.flags&$.KSIDE_CASTLE)n=`O-O`;else if(e.flags&$.QSIDE_CASTLE)n=`O-O-O`;else{if(e.piece!==`p`){let r=getDisambiguator(e,t);n+=e.piece.toUpperCase()+r}e.flags&($.CAPTURE|$.EP_CAPTURE)&&(e.piece===`p`&&(n+=algebraic(e.from)[0]),n+=`x`),n+=algebraic(e.to),e.promotion&&(n+=`=`+e.promotion.toUpperCase())}return this._makeMove(e),this.isCheck()&&(this.isCheckmate()?n+=`#`:n+=`+`),this._undoMove(),n}_moveFromSan(e,t=!1){let n=strippedSan(e),r=inferPieceType(n),a=this._moves({legal:!0,piece:r});for(let e=0,t=a.length;e<t;e++)if(n===strippedSan(this._moveToSan(a[e],a)))return a[e];if(t)return null;let o,c,l,u,d,p=!1;if(c=n.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/),c?(o=c[1],l=c[2],u=c[3],d=c[4],l.length==1&&(p=!0)):(c=n.match(/([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/),c&&(o=c[1],l=c[2],u=c[3],d=c[4],l.length==1&&(p=!0))),r=inferPieceType(n),a=this._moves({legal:!0,piece:o||r}),!u)return null;for(let e=0,t=a.length;e<t;e++)if(!l){if(n===strippedSan(this._moveToSan(a[e],a)).replace(`x`,``))return a[e]}else if((!o||o.toLowerCase()==a[e].piece)&&tt[l]==a[e].from&&tt[u]==a[e].to&&(!d||d.toLowerCase()==a[e].promotion))return a[e];else if(p){let t=algebraic(a[e].from);if((!o||o.toLowerCase()==a[e].piece)&&tt[u]==a[e].to&&(l==t[0]||l==t[1])&&(!d||d.toLowerCase()==a[e].promotion))return a[e]}return null}ascii(){let e=` +------------------------+
5
+ `;for(let t=tt.a8;t<=tt.h1;t++){if(file(t)===0&&(e+=` `+`87654321`[rank(t)]+` |`),this._board[t]){let n=this._board[t].type,r=this._board[t].color===`w`?n.toUpperCase():n.toLowerCase();e+=` `+r+` `}else e+=` . `;t+1&136&&(e+=`|
6
+ `,t+=8)}return e+=` +------------------------+
7
+ `,e+=` a b c d e f g h`,e}perft(e){let t=this._moves({legal:!1}),n=0,r=this._turn;for(let a=0,o=t.length;a<o;a++)this._makeMove(t[a]),this._isKingAttacked(r)||(e-1>0?n+=this.perft(e-1):n++),this._undoMove();return n}turn(){return this._turn}board(){let e=[],t=[];for(let n=tt.a8;n<=tt.h1;n++)this._board[n]==null?t.push(null):t.push({square:algebraic(n),type:this._board[n].type,color:this._board[n].color}),n+1&136&&(e.push(t),t=[],n+=8);return e}squareColor(e){if(e in tt){let t=tt[e];return(rank(t)+file(t))%2==0?`light`:`dark`}return null}history({verbose:e=!1}={}){let t=[],n=[];for(;this._history.length>0;)t.push(this._undoMove());for(;;){let r=t.pop();if(!r)break;e?n.push(new Move(this,r)):n.push(this._moveToSan(r,this._moves())),this._makeMove(r)}return n}_getPositionCount(e){let t=trimFen(e);return this._positionCount[t]||0}_incPositionCount(e){let t=trimFen(e);this._positionCount[t]===void 0&&(this._positionCount[t]=0),this._positionCount[t]+=1}_decPositionCount(e){let t=trimFen(e);this._positionCount[t]===1?delete this._positionCount[t]:--this._positionCount[t]}_pruneComments(){let e=[],t={},copyComment=e=>{e in this._comments&&(t[e]=this._comments[e])};for(;this._history.length>0;)e.push(this._undoMove());for(copyComment(this.fen());;){let t=e.pop();if(!t)break;this._makeMove(t),copyComment(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(){let 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=>{let t=this._comments[e];return delete this._comments[e],{fen:e,comment:t}})}setCastlingRights(e,t){for(let n of[`k`,`q`])t[n]!==void 0&&(t[n]?this._castling[e]|=mt[n]:this._castling[e]&=~mt[n]);this._updateCastlingRights();let n=this.getCastlingRights(e);return(t.k===void 0||t.k===n.k)&&(t.q===void 0||t.q===n.q)}getCastlingRights(e){return{k:(this._castling[e]&mt.k)!==0,q:(this._castling[e]&mt.q)!==0}}moveNumber(){return this._moveNumber}},parseUciMove=e=>{if(e.length<4||e.length>5)throw Error(`Invalid UCI move format: ${e}`);return{from:e.substring(0,2),to:e.substring(2,4),promotion:e.length===5?e[4]:void 0}},toDests=e=>{let t=new Map;return et.forEach(n=>{let r=e.moves({square:n,verbose:!0});r.length&&t.set(n,r.map(e=>e.to))}),t},swapColor=e=>e===`cg-white`?`cg-black`:`cg-white`,toColor=e=>e.turn()===`w`?`cg-white`:`cg-black`,vt=m({name:`PuzzleView`,props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let r=W(e,t,`PuzzleView`),a=K(r),o=T(null),c=T(),l=T(),u=T(`cg-white`),d=T(!1),p=T(null),m=[{value:`q`,name:`Queen`,whiteSymbol:`♕`,blackSymbol:`♛`},{value:`r`,name:`Rook`,whiteSymbol:`♖`,blackSymbol:`♜`},{value:`b`,name:`Bishop`,whiteSymbol:`♗`,blackSymbol:`♝`},{value:`n`,name:`Knight`,whiteSymbol:`♘`,blackSymbol:`♞`}],h=w(()=>{let e=[`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`];return u.value===`cg-white`?e:e.reverse()}),isPromotionPiece=e=>e?[`q`,`r`,`b`,`n`].includes(e):!1,isUnfinishedPromotion=(e,t,n)=>isPromotionPiece(n)?!1:c.value?.get(e)?.type===`p`&&(t[1]===`8`||t[1]===`1`),updateChessground=()=>{!c.value||!l.value||l.value.set({fen:c.value.fen(),turnColor:toColor(c.value),movable:{color:toColor(c.value),dests:toDests(c.value)}})},handlePromotion=e=>{if(e!==`q`&&e!==`r`&&e!==`b`&&e!==`n`){r.logger.error(`Invalid promotion piece: ${e}`);return}p.value&&(r.logger.log(`promoting to ${e}`),d.value=!1,checkMove(p.value.from,p.value.to,e))},checkMove=(e,t,n)=>{if(!a.question.value?.moves.length)throw Error(`No moves`);if(isUnfinishedPromotion(e,t,n)){p.value={from:e,to:t},d.value=!0;return}a.question.value.moves[0]===(isPromotionPiece(n)?`${e}${t}${n}`:`${e}${t}`)?(c.value?.move({from:e,to:t,promotion:isPromotionPiece(n)?n:void 0}),updateChessground(),a.question.value.moves.shift(),a.question.value.moves.length===0?a.submitAnswer(``):window.setTimeout(()=>{if(!a.question.value)return;let e=parseUciMove(a.question.value.moves.shift());c.value?.move(e),updateChessground()},300)):(c.value?.move({from:e,to:t,promotion:n}),c.value?.isCheckmate()?a.submitAnswer(kt.CHECKMATE):c.value?.undo(),a.submitAnswer(e+t+n),updateChessground())};return A(()=>{if(!o.value)return;a.question.value=new kt(e.data),c.value=new Chess(a.question.value.fen),u.value=swapColor(toColor(c.value)),l.value=Chessground(o.value,{movable:{free:!1,showDests:!0,dests:toDests(c.value),events:{after:checkMove}},draggable:{showGhost:!0},fen:c.value.fen(),orientation:u.value,coordinates:!1,animation:{duration:300,enabled:!0}});let t=a.question.value.moves.shift();l.value.move(t.substring(0,2),t.substring(2)),c.value.move({from:t.substring(0,2),to:t.substring(2)}),updateChessground()}),n(()=>{l.value?.destroy(),c.value=void 0}),{boardElement:o,playerColor:u,files:h,showPromotionDialog:d,promotionPieces:m,handlePromotion,...r,...a}}}),yt={"data-viewable":`PuzzleView`},bt={class:`text-h5`},xt={class:`puzzle-board-wrapper`},St={class:`puzzle-ranks-labels`},Ct={class:`puzzle-board-and-files`},wt={id:`cg`,ref:`boardElement`},Tt={class:`puzzle-files-labels`},Et={key:0,class:`puzzle-promotion-dialog`},Dt=[`onClick`];function _sfc_render$24(e,t,n,r,o,c){return a(),x(`div`,yt,[y(`p`,bt,` Make the best move for `+h(e.playerColor===`cg-white`?`White ♖♘♗♕♔♗♘♖`:`Black ♜♞♝♚♛♝♞♜`)+`: `,1),y(`div`,xt,[y(`div`,St,[(a(),x(C,null,g(8,t=>y(`div`,{key:t},h(e.playerColor===`cg-white`?9-t:t),1)),64))]),y(`div`,Ct,[y(`div`,wt,null,512),y(`div`,Tt,[(a(!0),x(C,null,g(e.files,e=>(a(),x(`div`,{key:e},h(e),1))),128))])])]),e.showPromotionDialog?(a(),x(`div`,Et,[(a(!0),x(C,null,g(e.promotionPieces,t=>(a(),x(`button`,{key:t.value,onClick:n=>e.handlePromotion(t.value)},h(e.playerColor===`cg-white`?t.whiteSymbol:t.blackSymbol)+` `+h(t.name),9,Dt))),128))])):k(``,!0)])}__name(_sfc_render$24,`_sfc_render`);var Ot=Ne(vt,[[`render`,_sfc_render$24]]),kt=(Y=class ChessPuzzle extends N{constructor(e){super(e),U(this,`fen`,void 0),U(this,`id`,void 0),U(this,`moves`,void 0),U(this,`rating`,void 0),U(this,`themes`,void 0),U(this,`checkMove`,(e,t)=>(alert(`checkMove`),console.log(`checkMove`,e,t),console.log(`this.moves[0]`,this.moves[0]),this.moves[0]===t));let[t,n,r,a,,,,o]=e[0].puzzleData.split(`,`);this.id=t,this.fen=n,this.moves=r.split(` `),this.rating=parseInt(a,10),this.themes=o.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){let t=this.moves.length===0;return e===ChessPuzzle.CHECKMATE||t}},U(Y,`dataShapes`,[{name:H.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?e.split(`,`).length==10?{status:z.ok,msg:``}:{status:z.error,msg:`puzzleData must have 8 comma-separated fields`}:{status:z.error,msg:`no defined input`}}},tagger:()=>[`test`]}]}]),U(Y,`views`,[Ot]),U(Y,`acceptsUserData`,!0),U(Y,`CHECKMATE`,`CHECKMATE`),Y),At=new CourseWare(`chess`,[kt]),jt=m({name:`AudioParseView`,components:{AudioAutoPlayer:te},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`AudioParseView`),r=K(n),a=T(``);r.question.value=new Pt(e.data);let o=w(()=>r.question.value),submit=()=>{o.value};return{...n,...r,answer:a,question:o,submit}}}),Mt={"data-viewable":`AudioParseView`};function _sfc_render$23(e,t,n,o,c,u){let d=l(`AudioAutoPlayer`);return a(),x(`div`,Mt,[e.question?(a(),x(C,{key:0},[r(d,{src:e.getURL(`audio`)},null,8,[`src`]),t[0]||(t[0]=y(`br`,null,null,-1)),t[1]||(t[1]=y(`br`,null,null,-1)),p(` `+h(e.question.text),1)],64)):k(``,!0)])}__name(_sfc_render$23,`_sfc_render`);var Nt=Ne(jt,[[`render`,_sfc_render$23]]),Pt=(X=class AudioParsingQuestion extends N{constructor(e){var _super2=(...e)=>(super(...e),U(this,`audio`,void 0),U(this,`text`,void 0),this);_super2(e),this.audio=e[0].audio,this.text=e[0].text}isCorrect(e){throw Error(`isCorrect() not implemented - cannor parse ${e}`)}dataShapes(){return AudioParsingQuestion.dataShapes}views(){return AudioParsingQuestion.views}},U(X,`dataShapes`,[{name:H.FRENCH_AudioParse,fields:[{name:`audio`,type:R.IMAGE},{name:`text`,type:R.STRING,validator:{test:e=>{let t=e.length<45;return{msg:t?``:`It's too long!`,status:t?z.ok:z.error}}}}]}]),U(X,`views`,[Nt]),X),Ft=m({name:`IdentifyVocab`,components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`IdentifyVocab`),r=K(n);r.question.value=new zt(e.data);let a=w(()=>r.question.value);return{...n,...r,question:a}}}),It={"data-viewable":`IdentifyVocab`};function _sfc_render$22(e,t,n,r,o,c){return a(),x(`div`,It,[e.question?(a(),x(C,{key:0},[p(` This is a vocabulary question. `)],64)):k(``,!0)])}__name(_sfc_render$22,`_sfc_render`);var Lt=Ne(Ft,[[`render`,_sfc_render$22]]),Rt=[{name:`word`,type:R.STRING,validator:B.NonEmptyString},{name:`image`,type:R.IMAGE},{name:`audio`,type:R.AUDIO}],zt=(Z=class VocabQuestion extends N{isCorrect(e){throw Error(`isCorrect() not implemented. Cannot parse ${e}`)}dataShapes(){return VocabQuestion.dataShapes}views(){return VocabQuestion.views}},U(Z,`dataShapes`,[{fields:Rt,name:H.FRENCH_Vocab}]),U(Z,`views`,[Lt]),Z),Bt=new CourseWare(`french`,[Pt,zt]),Vt=m({name:`AdditionHorizontal`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`AdditionHorizontal`),r=K(n),a=T(``);r.question.value=new Jt(e.data);let o=w(()=>r.question.value),submit=()=>{if(o.value){let e=o.value.isCorrect(parseInt(a.value,10));alert(e)}};return{...n,...r,answer:a,question:o,submit}}}),Ht={"data-viewable":`AdditionHorizontal`};function _sfc_render$21(e,t,n,o,c,u){let d=l(`UserInputNumber`);return a(),x(`div`,Ht,[e.question?(a(),x(C,{key:0},[p(h(e.question.a)+` + `+h(e.question.b)+` = `,1),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])],64)):k(``,!0)])}__name(_sfc_render$21,`_sfc_render`);var Ut=Ne(Vt,[[`render`,_sfc_render$21]]),Wt=m({name:`VerbalAddition`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`VerbalAddition`),r=K(n),a=T(``);r.question.value=new Jt(e.data);let o=w(()=>r.question.value),submit=()=>{if(o.value){let e=o.value.isCorrect(parseInt(a.value,10));alert(e)}};return{...n,...r,answer:a,question:o,submit}}}),Gt={"data-viewable":`VerbalAddition`};function _sfc_render$20(e,t,n,o,c,u){let d=l(`UserInputNumber`);return a(),x(`div`,Gt,[e.question?(a(),x(C,{key:0},[p(h(e.question.a)+` plus `+h(e.question.b)+` is `,1),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])],64)):k(``,!0)])}__name(_sfc_render$20,`_sfc_render`);var Kt=Ne(Wt,[[`render`,_sfc_render$20]]),qt=__name(function(){let e=[];for(let t=0;t<10;t++)for(let n=0;n<10;n++)e.push({a:t,b:n});return e},`data`),Jt=(ge=class SingleDigitAdditionQuestion extends N{constructor(e){var _super3=(...e)=>(super(...e),U(this,`a`,void 0),U(this,`b`,void 0),this);_super3(e),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}},U(ge,`dataShapes`,[me]),U(ge,`views`,[Ut,Kt]),U(ge,`seedData`,qt()),U(ge,`acceptsUserData`,!1),ge),Yt=m({name:`DivisionHorizontal`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`DivisionHorizontal`),r=K(n),a=T(``);r.question.value=new $t(e.data);let o=w(()=>r.question.value),submit=()=>{if(o.value){let e=o.value.isCorrect(parseInt(a.value,10));alert(e)}};return{...n,...r,answer:a,question:o,submit}}}),Xt={"data-viewable":`DivisionHorizontal`};function _sfc_render$19(e,t,n,o,c,u){let d=l(`UserInputNumber`);return a(),x(`div`,Xt,[e.question?(a(),x(C,{key:0},[p(h(e.question.a*e.question.b)+` ÷ `+h(e.question.b)+` = `,1),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])],64)):k(``,!0)])}__name(_sfc_render$19,`_sfc_render`);var Zt=Ne(Yt,[[`render`,_sfc_render$19]]),Qt=[{name:`a`,type:R.INT},{name:`b`,type:R.INT,validator:{instructions:`An integer between 1 and 10, inclusive.`,test:e=>{let t=parseInt(e,10);return 0<t&&t<11?{status:z.ok,msg:``}:t===0?{status:z.error,msg:`Thou shalt not divide by zero.`}:{status:z.error,msg:`Single digit division problem divisors must be between 1 and 10, inclusive.`}}}}],$t=(_e=class SingleDigitDivisionQuestion extends N{constructor(e){var _super4=(...e)=>(super(...e),U(this,`a`,void 0),U(this,`b`,void 0),this);_super4(e),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}},U(_e,`dataShapes`,[{name:H.MATH_SingleDigitDivision,fields:Qt}]),U(_e,`views`,[Zt]),_e),en=m({name:`MultiplicationHorizontal`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`MultiplicationHorizontal`),r=K(n),a=T(``);r.question.value=new ln(e.data);let o=w(()=>r.question.value),submit=()=>{if(o.value){let e=o.value.isCorrect(parseInt(a.value,10));alert(e)}};return{...n,...r,answer:a,question:o,submit}}}),tn={"data-viewable":`MultiplicationHorizontal`};function _sfc_render$18(e,t,n,o,c,u){let d=l(`UserInputNumber`);return a(),x(`div`,tn,[e.question?(a(),x(C,{key:0},[p(h(e.question.a)+` × `+h(e.question.b)+` = `,1),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])],64)):k(``,!0)])}__name(_sfc_render$18,`_sfc_render`);var nn=Ne(en,[[`render`,_sfc_render$18]]),rn=m({name:`VerbalMultiplication`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`VerbalMultiplication`),r=K(n),a=T(``);r.question.value=new ln(e.data);let o=w(()=>r.question.value),submit=()=>{if(o.value){let e=o.value.isCorrect(parseInt(a.value,10));alert(e)}};return{...n,...r,answer:a,question:o,submit}}}),an={"data-viewable":`VerbalMultiplication`};function _sfc_render$17(e,t,n,o,c,u){let d=l(`UserInputNumber`);return a(),x(`div`,an,[e.question?(a(),x(C,{key:0},[p(h(e.question.a)+` times `+h(e.question.b)+` is `,1),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])],64)):k(``,!0)])}__name(_sfc_render$17,`_sfc_render`);var on=Ne(rn,[[`render`,_sfc_render$17]]),sn={instructions:`An integer between 0 and 10, inclusive.`,test:e=>{let t=parseInt(e,10);return 0<=t&&t<=10?{status:z.ok,msg:``}:{status:z.error,msg:`Single digit multiplication problem inputs must be between 0 and 10, inclusive.`}}},cn=[{name:`a`,type:R.INT,validator:sn},{name:`b`,type:R.INT,validator:sn}],ln=(ve=class SingleDigitMultiplicationQuestion extends N{constructor(e){var _super5=(...e)=>(super(...e),U(this,`a`,void 0),U(this,`b`,void 0),this);_super5(e),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}},U(ve,`dataShapes`,[{name:H.MATH_SingleDigitMultiplication,fields:cn}]),U(ve,`views`,[on,nn]),ve),un=m({name:`TrueFalse`,components:{TFSelect:j},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=K(W(e,t,`TrueFalse`));n.question.value=new pn(e.data);let r=w(()=>new pn(e.data)),submit=e=>{alert(r.value.isCorrect(e===0))};return{question:r,submit}}}),dn={"data-viewable":`TrueFalse`};function _sfc_render$16(e,t,n,o,c,u){let d=l(`TFSelect`);return a(),x(`div`,dn,[p(h(e.question.a)+` = `+h(e.question.b)+` `,1),r(d,{submit:e.submit},null,8,[`submit`])])}__name(_sfc_render$16,`_sfc_render`);var fn=Ne(un,[[`render`,_sfc_render$16]]),pn=(ye=class EqualityTest extends N{constructor(e){var _super6=(...e)=>(super(...e),U(this,`a`,void 0),U(this,`b`,void 0),this);_super6(e),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}},U(ye,`dataShapes`,[he]),U(ye,`views`,[fn]),ye),mn=m({name:`SolveView`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`Solve`),r=K(n),a=T(``),o=[`a`,`b`,`d`,`A`,`z`,`B`,`d`,`y`],c=T(o[randomInt(0,o.length)]);r.question.value=new Tn(e.data);let l=w(()=>r.question.value),submit=()=>{if(l.value){let e=l.value.isCorrect(parseInt(a.value,10));alert(e)}};return{...n,...r,answer:a,question:l,variable:c,submit}}}),hn={"data-viewable":`Solve`},gn={key:0},_n={key:1},vn={key:2},yn={key:3},bn={key:4};function _sfc_render$15(e,t,n,o,c,u){let d=l(`UserInputNumber`);return a(),x(`div`,hn,[e.question?(a(),x(C,{key:0},[t[1]||(t[1]=y(`h4`,null,`Solve the Equation`,-1)),t[2]||(t[2]=y(`br`,null,null,-1)),t[3]||(t[3]=y(`br`,null,null,-1)),e.question.operation.valueOf()===`ADDITION`?(a(),x(`div`,gn,h(e.variable)+` - `+h(e.question.a)+` = `+h(e.question.b),1)):e.question.operation.valueOf()===`SUBTRACTION`?(a(),x(`div`,_n,h(e.variable)+` + `+h(e.question.a)+` = `+h(e.question.b),1)):e.question.operation.valueOf()===`MULTIPLICATION`?(a(),x(`div`,vn,h(e.variable)+` ÷ `+h(e.question.a)+` = `+h(e.question.b),1)):e.question.operation.valueOf()===`DIVISION`?(a(),x(`div`,yn,h(e.variable)+` * `+h(e.question.a)+` = `+h(e.question.b*e.question.a),1)):(a(),x(`div`,bn,`No operation!? (This should never show)`)),t[4]||(t[4]=y(`br`,null,null,-1)),t[5]||(t[5]=y(`br`,null,null,-1)),p(` `+h(e.variable)+` = `,1),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])],64)):k(``,!0)])}__name(_sfc_render$15,`_sfc_render`);var xn=Ne(mn,[[`render`,_sfc_render$15]]),Sn={instructions:`An integer between 0 and 10, inclusive.`,test:e=>{let t=parseInt(e,10);return 0<=t&&t<=100?{status:z.ok,msg:``}:{status:z.error,msg:`Single-step equation problem inputs must be between 0 and 100, inclusive.`}}},Cn=[{name:`a`,type:R.INT,validator:Sn},{name:`b`,type:R.INT,validator:Sn},{name:`operation`,type:R.STRING,validator:{test:e=>e===wn.ADDITION||e===wn.SUBTRACTION||e===wn.MULTIPLICATION||e===wn.DIVISION?{status:z.ok,msg:``}:{status:z.error,msg:`Operation must be ADDITION, SUBTRACTION, MULTIPLICATION, or DIVISION`}}}],wn=function(e){return e.ADDITION=`ADDITION`,e.SUBTRACTION=`SUBTRACTION`,e.MULTIPLICATION=`MULTIPLICATION`,e.DIVISION=`DIVISION`,e}(wn||{}),Tn=(be=class OneStepEquation extends N{constructor(e){var _super7=(...e)=>(super(...e),U(this,`a`,void 0),U(this,`b`,void 0),U(this,`operation`,void 0),this);_super7(e),this.a=e[0].a,this.b=e[0].b,this.operation=e[0].operation}answer(){let e=0;return this.operation===wn.ADDITION?e=this.a+this.b:this.operation===wn.SUBTRACTION?e=this.b-this.a:this.operation===wn.MULTIPLICATION?e=this.a*this.b:this.operation===wn.DIVISION&&(e=this.b),V(`The answer is ${e}
8
+ The operation is ${this.operation.valueOf()}
9
+ this.a = ${this.a}
10
+ this.b = ${this.b}
11
+ `),e}isCorrect(e){return e===this.answer()}dataShapes(){return OneStepEquation.dataShapes}views(){return OneStepEquation.views}},U(be,`dataShapes`,[{name:H.MATH_OneStepEquation,fields:Cn}]),U(be,`views`,[xn]),be),En=m({name:`AngleCategorizeV`,components:{RadioMultipleChoice:F},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`AngleCategorizeV`),r=K(n),a=T(null);r.question.value=new Nn(e.data);let o=w(()=>r.question.value),c=w(()=>{if(!o.value)return 0;let e=o.value.angleCategory;if(e===jn.ACUTE)return randomInt(10,83);if(e===jn.RIGHT)return 90;if(e===jn.OBTUSE)return randomInt(97,173);if(e===jn.STRAIGHT)return 180;if(e===jn.REFLEX)return randomInt(190,350);throw Error(`Unknown Angle type on AngleCategorize question`)});return A(()=>{if(!a.value)return;let e=a.value.width,t=a.value.height,n=a.value.getContext(`2d`);if(!n)return;let r=randomInt(0,360),o=r+c.value;n.moveTo(e/2,t/2);let l=e/2+e*Math.cos(r/360*2*Math.PI),u=t/2+e*Math.sin(r/360*2*Math.PI);n.lineTo(l,u),n.stroke(),n.moveTo(e/2,t/2);let d=e/2+e*Math.cos(o/360*2*Math.PI),p=t/2+e*Math.sin(o/360*2*Math.PI);n.lineTo(d,p),n.stroke(),n.moveTo(e/2,t/2),n.beginPath(),n.arc(e/2,t/2,25,r/360*2*Math.PI,o/360*2*Math.PI),n.stroke()}),{...n,...r,canvasRef:a,question:o}}}),Dn={"data-viewable":`AngleCategorizeV`},On={ref:`canvasRef`,width:`300`,height:`300`};function _sfc_render$14(e,t,n,o,c,u){let d=l(`radio-multiple-choice`);return a(),x(`div`,Dn,[e.question?(a(),x(C,{key:0},[t[0]||(t[0]=y(`h2`,null,`What kind of angle is this?`,-1)),y(`canvas`,On,null,512),r(d,{"choice-list":e.question.answers},null,8,[`choice-list`])],64)):k(``,!0)])}__name(_sfc_render$14,`_sfc_render`);var kn=Ne(En,[[`render`,_sfc_render$14],[`__scopeId`,`data-v-57f16e4a`]]),An={instructions:`Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".`,test:e=>e===jn.ACUTE||e===jn.OBTUSE||e===jn.REFLEX||e===jn.RIGHT||e===jn.STRAIGHT?{status:z.ok,msg:``}:{status:z.error,msg:`Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".`}},jn=function(e){return e.ACUTE=`ACUTE`,e.RIGHT=`RIGHT`,e.OBTUSE=`OBTUSE`,e.STRAIGHT=`STRAIGHT`,e.REFLEX=`REFLEX`,e}({}),Mn=[{name:`Category`,type:R.STRING,validator:An}],Nn=(xe=class AngleCategorize extends N{constructor(e){var _super8=(...e)=>(super(...e),U(this,`angleCategory`,void 0),U(this,`answers`,void 0),this);_super8(e),this.angleCategory=e[0].Category,this.answers=shuffle([jn.ACUTE,jn.OBTUSE,jn.REFLEX,jn.RIGHT,jn.STRAIGHT])}isCorrect(e){return this.angleCategory.valueOf()===e.choiceList[e.selection]}dataShapes(){return AngleCategorize.dataShapes}views(){return AngleCategorize.views}},U(xe,`dataShapes`,[{name:H.MATH_AngleCategorize,fields:Mn}]),U(xe,`views`,[kn]),xe),Pn=__commonJSMin(((e,t)=>{t.exports={}})),Fn=__commonJSMin(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.acorn={}))})(e,(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],n=[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],r=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,a=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,o={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`},c=`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`,l={5:c,"5module":c+` export import`,6:c+` const class extends export import super`},u=/^in(stanceof)?$/,d=RegExp(`[`+a+`]`),p=RegExp(`[`+a+r+`]`);function isInAstralSet(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function isIdentifierStart(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&d.test(String.fromCharCode(e)):t===!1?!1:isInAstralSet(e,n)}function isIdentifierChar(e,r){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&p.test(String.fromCharCode(e)):r===!1?!1:isInAstralSet(e,n)||isInAstralSet(e,t)}var m=function TokenType(e,t){t===void 0&&(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 binop(e,t){return new m(e,{beforeExpr:!0,binop:t})}var h={beforeExpr:!0},g={startsExpr:!0},_={};function kw(e,t){return t===void 0&&(t={}),t.keyword=e,_[e]=new m(e,t)}var y={num:new m(`num`,g),regexp:new m(`regexp`,g),string:new m(`string`,g),name:new m(`name`,g),privateId:new m(`privateId`,g),eof:new m(`eof`),bracketL:new m(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new m(`]`),braceL:new m(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new m(`}`),parenL:new m(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new m(`)`),comma:new m(`,`,h),semi:new m(`;`,h),colon:new m(`:`,h),dot:new m(`.`),question:new m(`?`,h),questionDot:new m(`?.`),arrow:new m(`=>`,h),template:new m(`template`),invalidTemplate:new m(`invalidTemplate`),ellipsis:new m(`...`,h),backQuote:new m("`",g),dollarBraceL:new m("${",{beforeExpr:!0,startsExpr:!0}),eq:new m(`=`,{beforeExpr:!0,isAssign:!0}),assign:new m(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new m(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new m(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop(`||`,1),logicalAND:binop(`&&`,2),bitwiseOR:binop(`|`,3),bitwiseXOR:binop(`^`,4),bitwiseAND:binop(`&`,5),equality:binop(`==/!=/===/!==`,6),relational:binop(`</>/<=/>=`,7),bitShift:binop(`<</>>/>>>`,8),plusMin:new m(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop(`%`,10),star:binop(`*`,10),slash:binop(`/`,10),starstar:new m(`**`,{beforeExpr:!0}),coalesce:binop(`??`,1),_break:kw(`break`),_case:kw(`case`,h),_catch:kw(`catch`),_continue:kw(`continue`),_debugger:kw(`debugger`),_default:kw(`default`,h),_do:kw(`do`,{isLoop:!0,beforeExpr:!0}),_else:kw(`else`,h),_finally:kw(`finally`),_for:kw(`for`,{isLoop:!0}),_function:kw(`function`,g),_if:kw(`if`),_return:kw(`return`,h),_switch:kw(`switch`),_throw:kw(`throw`,h),_try:kw(`try`),_var:kw(`var`),_const:kw(`const`),_while:kw(`while`,{isLoop:!0}),_with:kw(`with`),_new:kw(`new`,{beforeExpr:!0,startsExpr:!0}),_this:kw(`this`,g),_super:kw(`super`,g),_class:kw(`class`,g),_extends:kw(`extends`,h),_export:kw(`export`),_import:kw(`import`,g),_null:kw(`null`,g),_true:kw(`true`,g),_false:kw(`false`,g),_in:kw(`in`,{beforeExpr:!0,binop:7}),_instanceof:kw(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:kw(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},b=/\r\n?|\n|\u2028|\u2029/,x=new RegExp(b.source,`g`);function isNewLine(e){return e===10||e===13||e===8232||e===8233}function nextLineBreak(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var a=e.charCodeAt(r);if(isNewLine(a))return r<n-1&&a===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var S=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,C=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,w=Object.prototype,T=w.hasOwnProperty,E=w.toString,D=Object.hasOwn||(function(e,t){return T.call(e,t)}),O=Array.isArray||(function(e){return E.call(e)===`[object Array]`}),k=Object.create(null);function wordsRegexp(e){return k[e]||(k[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var A=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,j=function Position(e,t){this.line=e,this.column=t};j.prototype.offset=function offset(e){return new j(this.line,this.column+e)};var M=function SourceLocation(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function getLineInfo(e,t){for(var n=1,r=0;;){var a=nextLineBreak(e,r,t);if(a<0)return new j(n,t-r);++n,r=a}}var N={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},P=!1;function getOptions(e){var t={};for(var n in N)t[n]=e&&D(e,n)?e[n]:N[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!P&&typeof console==`object`&&console.warn&&(P=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
12
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),O(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return O(t.onComment)&&(t.onComment=pushComment(t,t.onComment)),t}function pushComment(e,t){return function(n,r,a,o,c,l){var u={type:n?`Block`:`Line`,value:r,start:a,end:o};e.locations&&(u.loc=new M(this,c,l)),e.ranges&&(u.range=[a,o]),t.push(u)}}var F=1,I=2,L=4,ee=8,R=16,z=32,B=64,V=128,H=256,U=F|I|H;function functionFlags(e,t){return I|(e?L:0)|(t?ee:0)}var te=0,W=1,ne=2,re=3,ie=4,ae=5,G=function Parser(e,t,n){this.options=e=getOptions(e),this.sourceFile=e.sourceFile,this.keywords=wordsRegexp(l[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=o[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=wordsRegexp(r);var a=(r?r+` `:``)+o.strict;this.reservedWordsStrict=wordsRegexp(a),this.reservedWordsStrictBind=wordsRegexp(a+` `+o.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
13
+ `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(b).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=e.sourceType===`module`,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),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(F),this.regexpState=null,this.privateNameStack=[]},K={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}};G.prototype.parse=function parse(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},K.inFunction.get=function(){return(this.currentVarScope().flags&I)>0},K.inGenerator.get=function(){return(this.currentVarScope().flags&ee)>0&&!this.currentVarScope().inClassFieldInit},K.inAsync.get=function(){return(this.currentVarScope().flags&L)>0&&!this.currentVarScope().inClassFieldInit},K.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&H)return!1;if(t.flags&I)return(t.flags&L)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},K.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(t&B)>0||n||this.options.allowSuperOutsideMethod},K.allowDirectSuper.get=function(){return(this.currentThisScope().flags&V)>0},K.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},K.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(t&(I|H))>0||n},K.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&H)>0},G.extend=function extend(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},G.parse=function parse(e,t){return new this(t,e).parse()},G.parseExpressionAt=function parseExpressionAt(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},G.tokenizer=function tokenizer(e,t){return new this(t,e)},Object.defineProperties(G.prototype,K);var oe=G.prototype,se=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;oe.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){C.lastIndex=e,e+=C.exec(this.input)[0].length;var t=se.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){C.lastIndex=e+t[0].length;var n=C.exec(this.input),r=n.index+n[0].length,a=this.input.charAt(r);return a===`;`||a===`}`||b.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(a)||a===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,C.lastIndex=e,e+=C.exec(this.input)[0].length,this.input[e]===`;`&&e++}},oe.eat=function(e){return this.type===e?(this.next(),!0):!1},oe.isContextual=function(e){return this.type===y.name&&this.value===e&&!this.containsEsc},oe.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},oe.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},oe.canInsertSemicolon=function(){return this.type===y.eof||this.type===y.braceR||b.test(this.input.slice(this.lastTokEnd,this.start))},oe.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},oe.semicolon=function(){!this.eat(y.semi)&&!this.insertSemicolon()&&this.unexpected()},oe.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},oe.expect=function(e){this.eat(e)||this.unexpected()},oe.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var ce=function DestructuringErrors(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};oe.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},oe.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},oe.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`)},oe.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var q=G.prototype;q.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==y.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,a=Object.keys(this.undefinedExports);r<a.length;r+=1){var o=a[r];this.raiseRecoverable(this.undefinedExports[o].start,`Export '`+o+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var le={kind:`loop`},ue={kind:`switch`};q.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;C.lastIndex=this.pos;var t=C.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(isIdentifierStart(r,!0)){for(var a=n+1;isIdentifierChar(r=this.input.charCodeAt(a),!0);)++a;if(r===92||r>55295&&r<56320)return!0;var o=this.input.slice(n,a);if(!u.test(o))return!0}return!1},q.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;C.lastIndex=this.pos;var e=C.exec(this.input),t=this.pos+e[0].length,n;return!b.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(isIdentifierChar(n=this.input.charCodeAt(t+8))||n>55295&&n<56320))},q.parseStatement=function(e,t,n){var r=this.type,a=this.startNode(),o;switch(this.isLet(e)&&(r=y._var,o=`let`),r){case y._break:case y._continue:return this.parseBreakContinueStatement(a,r.keyword);case y._debugger:return this.parseDebuggerStatement(a);case y._do:return this.parseDoStatement(a);case y._for:return this.parseForStatement(a);case y._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case y._class:return e&&this.unexpected(),this.parseClass(a,!0);case y._if:return this.parseIfStatement(a);case y._return:return this.parseReturnStatement(a);case y._switch:return this.parseSwitchStatement(a);case y._throw:return this.parseThrowStatement(a);case y._try:return this.parseTryStatement(a);case y._const:case y._var:return o||(o=this.value),e&&o!==`var`&&this.unexpected(),this.parseVarStatement(a,o);case y._while:return this.parseWhileStatement(a);case y._with:return this.parseWithStatement(a);case y.braceL:return this.parseBlock(!0,a);case y.semi:return this.parseEmptyStatement(a);case y._export:case y._import:if(this.options.ecmaVersion>10&&r===y._import){C.lastIndex=this.pos;var c=C.exec(this.input),l=this.pos+c[0].length,u=this.input.charCodeAt(l);if(u===40||u===46)return this.parseExpressionStatement(a,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(a):this.parseExport(a,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var d=this.value,p=this.parseExpression();return r===y.name&&p.type===`Identifier`&&this.eat(y.colon)?this.parseLabeledStatement(a,d,p,e):this.parseExpressionStatement(a,p)}},q.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(y.semi)||this.insertSemicolon()?e.label=null:this.type===y.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var a=this.labels[r];if((e.label==null||a.name===e.label.name)&&(a.kind!=null&&(n||a.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},q.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},q.parseDoStatement=function(e){return this.next(),this.labels.push(le),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`)},q.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(le),this.enterScope(0),this.expect(y.parenL),this.type===y.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===y._var||this.type===y._const||n){var r=this.startNode(),a=n?`let`:this.value;return this.next(),this.parseVar(r,!0,a),this.finishNode(r,`VariableDeclaration`),(this.type===y._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===y._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var o=this.isContextual(`let`),c=!1,l=this.containsEsc,u=new ce,d=this.start,p=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===y._in||(c=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===y._in&&this.unexpected(t),e.await=!0):c&&this.options.ecmaVersion>=8&&(p.start===d&&!l&&p.type===`Identifier`&&p.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),o&&c&&this.raise(p.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(p,!1,u),this.checkLValPattern(p),this.parseForIn(e,p)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,p))},q.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,fe|(n?0:pe),!1,t)},q.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`)},q.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`)},q.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(y.braceL),this.labels.push(ue),this.enterScope(0);for(var t,n=!1;this.type!==y.braceR;)if(this.type===y._case||this.type===y._default){var r=this.type===y._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!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`)},q.parseThrowStatement=function(e){return this.next(),b.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 de=[];q.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?z:0),this.checkLValPattern(e,t?ie:ne),this.expect(y.parenR),e},q.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`)},q.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},q.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(le),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},q.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`)},q.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},q.parseLabeledStatement=function(e,t,n,r){for(var a=0,o=this.labels;a<o.length;a+=1)o[a].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var c=this.type.isLoop?`loop`:this.type===y._switch?`switch`:null,l=this.labels.length-1;l>=0;l--){var u=this.labels[l];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=c;else break}return this.labels.push({name:t,kind:c,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},q.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},q.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(y.braceL),e&&this.enterScope(0);this.type!==y.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},q.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`)},q.parseForIn=function(e,t){var n=this.type===y._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(y.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},q.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var a=this.startNode();if(this.parseVarId(a,n),this.eat(y.eq)?a.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===y._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&a.id.type!==`Identifier`&&!(t&&(this.type===y._in||this.isContextual(`of`)))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):a.init=null,e.declarations.push(this.finishNode(a,`VariableDeclarator`)),!this.eat(y.comma))break}return e},q.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?W:ne,!1)};var fe=1,pe=2,me=4;q.parseFunction=function(e,t,n,r,a){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===y.star&&t&pe&&this.unexpected(),e.generator=this.eat(y.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&fe&&(e.id=t&me&&this.type!==y.name?null:this.parseIdent(),e.id&&!(t&pe)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?W:ne:re));var o=this.yieldPos,c=this.awaitPos,l=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(e.async,e.generator)),t&fe||(e.id=this.type===y.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,a),this.yieldPos=o,this.awaitPos=c,this.awaitIdentPos=l,this.finishNode(e,t&fe?`FunctionDeclaration`:`FunctionExpression`)},q.parseFunctionParams=function(e){this.expect(y.parenL),e.params=this.parseBindingList(y.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},q.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),a=this.startNode(),o=!1;for(a.body=[],this.expect(y.braceL);this.type!==y.braceR;){var c=this.parseClassElement(e.superClass!==null);c&&(a.body.push(c),c.type===`MethodDefinition`&&c.kind===`constructor`?(o&&this.raiseRecoverable(c.start,`Duplicate constructor in the same class`),o=!0):c.key&&c.key.type===`PrivateIdentifier`&&isPrivateNameConflicted(r,c)&&this.raiseRecoverable(c.key.start,`Identifier '#`+c.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(a,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},q.parseClassElement=function(e){if(this.eat(y.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,a=!1,o=!1,c=`method`,l=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(y.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===y.star?l=!0:r=`static`}if(n.static=l,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===y.star)&&!this.canInsertSemicolon()?o=!0:r=`async`),!r&&(t>=9||!o)&&this.eat(y.star)&&(a=!0),!r&&!o&&!a){var u=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?c=u:r=u)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===y.parenL||c!==`method`||a||o){var d=!n.static&&checkKeyName(n,`constructor`),p=d&&e;d&&c!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=d?`constructor`:c,this.parseClassMethod(n,a,o,p)}else this.parseClassField(n);return n},q.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},q.parseClassElementName=function(e){this.type===y.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},q.parseClassMethod=function(e,t,n,r){var a=e.key;e.kind===`constructor`?(t&&this.raise(a.start,`Constructor can't be a generator`),n&&this.raise(a.start,`Constructor can't be an async method`)):e.static&&checkKeyName(e,`prototype`)&&this.raise(a.start,`Classes may not have a static property named prototype`);var o=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&o.params.length!==0&&this.raiseRecoverable(o.start,`getter should have no params`),e.kind===`set`&&o.params.length!==1&&this.raiseRecoverable(o.start,`setter should have exactly one param`),e.kind===`set`&&o.params[0].type===`RestElement`&&this.raiseRecoverable(o.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},q.parseClassField=function(e){if(checkKeyName(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&checkKeyName(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(y.eq)){var t=this.currentThisScope(),n=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=n}else e.value=null;return this.semicolon(),this.finishNode(e,`PropertyDefinition`)},q.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(H|B);this.type!==y.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},q.parseClassId=function(e,t){this.type===y.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,ne,!1)):(t===!0&&this.unexpected(),e.id=null)},q.parseClassSuper=function(e){e.superClass=this.eat(y._extends)?this.parseExprSubscripts(null,!1):null},q.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},q.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,a=r===0?null:this.privateNameStack[r-1],o=0;o<n.length;++o){var c=n[o];D(t,c.name)||(a?a.used.push(c):this.raiseRecoverable(c.start,`Private field '#`+c.name+`' must be declared in an enclosing class`))}};function isPrivateNameConflicted(e,t){var n=t.key.name,r=e[n],a=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(a=(t.static?`s`:`i`)+t.kind),r===`iget`&&a===`iset`||r===`iset`&&a===`iget`||r===`sget`&&a===`sset`||r===`sset`&&a===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=a,!1)}function checkKeyName(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}q.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`)},q.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),e.declaration.type===`VariableDeclaration`?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 n=0,r=e.specifiers;n<r.length;n+=1){var a=r[n];this.checkUnreserved(a.local),this.checkLocalExport(a.local),a.local.type===`Literal`&&this.raise(a.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},q.parseExportDeclaration=function(e){return this.parseStatement(null)},q.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,fe|me,!1,e)}else if(this.type===y._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},q.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),D(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},q.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,a=t.properties;r<a.length;r+=1){var o=a[r];this.checkPatternExport(e,o)}else if(n===`ArrayPattern`)for(var c=0,l=t.elements;c<l.length;c+=1){var u=l[c];u&&this.checkPatternExport(e,u)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},q.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var a=r[n];this.checkPatternExport(e,a.id)}},q.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},q.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`)},q.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(y.braceL);!this.eat(y.braceR);){if(n)n=!1;else if(this.expect(y.comma),this.afterTrailingComma(y.braceR))break;t.push(this.parseExportSpecifier(e))}return t},q.parseImport=function(e){return this.next(),this.type===y.string?(e.specifiers=de,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`)},q.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,ne),this.finishNode(e,`ImportSpecifier`)},q.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,ne),this.finishNode(e,`ImportDefaultSpecifier`)},q.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,ne),this.finishNode(e,`ImportNamespaceSpecifier`)},q.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},q.parseWithClause=function(){var e=[];if(!this.eat(y._with))return e;this.expect(y.braceL);for(var t={},n=!0;!this.eat(y.braceR);){if(n)n=!1;else if(this.expect(y.comma),this.afterTrailingComma(y.braceR))break;var r=this.parseImportAttribute(),a=r.key.type===`Identifier`?r.key.name:r.key.value;D(t,a)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+a+`'`),t[a]=!0,e.push(r)}return e},q.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===y.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(y.colon),this.type!==y.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},q.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===y.string){var e=this.parseLiteral(this.value);return A.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},q.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)},q.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var he=G.prototype;he.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&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`,n&&this.checkPatternErrors(n,!0);for(var r=0,a=e.properties;r<a.length;r+=1){var o=a[r];this.toAssignable(o,t),o.type===`RestElement`&&(o.argument.type===`ArrayPattern`||o.argument.type===`ObjectPattern`)&&this.raise(o.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&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,n);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 n&&this.checkPatternErrors(n,!0);return e},he.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var a=e[r];a&&this.toAssignable(a,t)}if(n){var o=e[n-1];this.options.ecmaVersion===6&&t&&o&&o.type===`RestElement`&&o.argument.type!==`Identifier`&&this.unexpected(o.argument.start)}return e},he.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},he.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==y.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},he.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()},he.parseBindingList=function(e,t,n,r){for(var a=[],o=!0;!this.eat(e);)if(o?o=!1:this.expect(y.comma),t&&this.type===y.comma)a.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===y.ellipsis){var c=this.parseRestBinding();this.parseBindingListItem(c),a.push(c),this.type===y.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else a.push(this.parseAssignableListItem(r));return a},he.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},he.parseBindingListItem=function(e){return e},he.parseMaybeDefault=function(e,t,n){if(n||(n=this.parseBindingAtom()),this.options.ecmaVersion<6||!this.eat(y.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},he.checkLValSimple=function(e,t,n){t===void 0&&(t=te);var r=t!==te;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===ne&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(D(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==ae&&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`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},he.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=te),e.type){case`ObjectPattern`:for(var r=0,a=e.properties;r<a.length;r+=1){var o=a[r];this.checkLValInnerPattern(o,t,n)}break;case`ArrayPattern`:for(var c=0,l=e.elements;c<l.length;c+=1){var u=l[c];u&&this.checkLValInnerPattern(u,t,n)}break;default:this.checkLValSimple(e,t,n)}},he.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=te),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var J=function TokContext(e,t,n,r,a){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!a},Y={b_stat:new J(`{`,!1),b_expr:new J(`{`,!0),b_tmpl:new J("${",!1),p_stat:new J(`(`,!1),p_expr:new J(`(`,!0),q_tmpl:new J("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new J(`function`,!1),f_expr:new J(`function`,!0),f_expr_gen:new J(`function`,!0,!1,null,!0),f_gen:new J(`function`,!1,!1,null,!0)},X=G.prototype;X.initialContext=function(){return[Y.b_stat]},X.curContext=function(){return this.context[this.context.length-1]},X.braceIsBlock=function(e){var t=this.curContext();return t===Y.f_expr||t===Y.f_stat?!0:e===y.colon&&(t===Y.b_stat||t===Y.b_expr)?!t.isExpr:e===y._return||e===y.name&&this.exprAllowed?b.test(this.input.slice(this.lastTokEnd,this.start)):e===y._else||e===y.semi||e===y.eof||e===y.parenR||e===y.arrow?!0:e===y.braceL?t===Y.b_stat:e===y._var||e===y._const||e===y.name?!1:!this.exprAllowed},X.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},X.updateContext=function(e){var t,n=this.type;n.keyword&&e===y.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},X.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},y.parenR.updateContext=y.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===Y.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},y.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Y.b_stat:Y.b_expr),this.exprAllowed=!0},y.dollarBraceL.updateContext=function(){this.context.push(Y.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?Y.p_stat:Y.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()!==Y.p_stat)&&!(e===y._return&&b.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===y.colon||e===y.braceL)&&this.curContext()===Y.b_stat)?this.context.push(Y.f_expr):this.context.push(Y.f_stat),this.exprAllowed=!1},y.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},y.backQuote.updateContext=function(){this.curContext()===Y.q_tmpl?this.context.pop():this.context.push(Y.q_tmpl),this.exprAllowed=!1},y.star.updateContext=function(e){if(e===y._function){var t=this.context.length-1;this.context[t]===Y.f_expr?this.context[t]=Y.f_expr_gen:this.context[t]=Y.f_gen}this.exprAllowed=!0},y.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==y.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Z=G.prototype;Z.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,a;switch(r.type){case`Identifier`:a=r.name;break;case`Literal`:a=String(r.value);break;default:return}var o=e.kind;if(this.options.ecmaVersion>=6){a===`__proto__`&&o===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}a=`$`+a;var c=t[a];c?(o===`init`?this.strict&&c.init||c.get||c.set:c.init||c[o])&&this.raiseRecoverable(r.start,`Redefinition of property`):c=t[a]={init:!1,get:!1,set:!1},c[o]=!0}},Z.parseExpression=function(e,t){var n=this.start,r=this.startLoc,a=this.parseMaybeAssign(e,t);if(this.type===y.comma){var o=this.startNodeAt(n,r);for(o.expressions=[a];this.eat(y.comma);)o.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(o,`SequenceExpression`)}return a},Z.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,a=-1,o=-1,c=-1;t?(a=t.parenthesizedAssign,o=t.trailingComma,c=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ce,r=!0);var l=this.start,u=this.startLoc;(this.type===y.parenL||this.type===y.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var d=this.parseMaybeConditional(e,t);if(n&&(d=n.call(this,d,l,u)),this.type.isAssign){var p=this.startNodeAt(l,u);return p.operator=this.value,this.type===y.eq&&(d=this.toAssignable(d,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=d.start&&(t.shorthandAssign=-1),this.type===y.eq?this.checkLValPattern(d):this.checkLValSimple(d),p.left=d,this.next(),p.right=this.parseMaybeAssign(e),c>-1&&(t.doubleProto=c),this.finishNode(p,`AssignmentExpression`)}else r&&this.checkExpressionErrors(t,!0);return a>-1&&(t.parenthesizedAssign=a),o>-1&&(t.trailingComma=o),d},Z.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,a=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return a;if(this.eat(y.question)){var o=this.startNodeAt(n,r);return o.test=a,o.consequent=this.parseMaybeAssign(),this.expect(y.colon),o.alternate=this.parseMaybeAssign(e),this.finishNode(o,`ConditionalExpression`)}return a},Z.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,a=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||a.start===n&&a.type===`ArrowFunctionExpression`?a:this.parseExprOp(a,n,r,-1,e)},Z.parseExprOp=function(e,t,n,r,a){var o=this.type.binop;if(o!=null&&(!a||this.type!==y._in)&&o>r){var c=this.type===y.logicalOR||this.type===y.logicalAND,l=this.type===y.coalesce;l&&(o=y.logicalAND.binop);var u=this.value;this.next();var d=this.start,p=this.startLoc,m=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,a),d,p,o,a),h=this.buildBinary(t,n,e,m,u,c||l);return(c&&this.type===y.coalesce||l&&(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(h,t,n,r,a)}return e},Z.buildBinary=function(e,t,n,r,a,o){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var c=this.startNodeAt(e,t);return c.left=n,c.operator=a,c.right=r,this.finishNode(c,o?`LogicalExpression`:`BinaryExpression`)},Z.parseMaybeUnary=function(e,t,n,r){var a=this.start,o=this.startLoc,c;if(this.isContextual(`await`)&&this.canAwait)c=this.parseAwait(r),t=!0;else if(this.type.prefix){var l=this.startNode(),u=this.type===y.incDec;l.operator=this.value,l.prefix=!0,this.next(),l.argument=this.parseMaybeUnary(null,!0,u,r),this.checkExpressionErrors(e,!0),u?this.checkLValSimple(l.argument):this.strict&&l.operator===`delete`&&isLocalVariableAccess(l.argument)?this.raiseRecoverable(l.start,`Deleting local variable in strict mode`):l.operator===`delete`&&isPrivateFieldAccess(l.argument)?this.raiseRecoverable(l.start,`Private fields can not be deleted`):t=!0,c=this.finishNode(l,u?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===y.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),c=this.parsePrivateIdent(),this.type!==y._in&&this.unexpected();else{if(c=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return c;for(;this.type.postfix&&!this.canInsertSemicolon();){var d=this.startNodeAt(a,o);d.operator=this.value,d.prefix=!1,d.argument=c,this.checkLValSimple(c),this.next(),c=this.finishNode(d,`UpdateExpression`)}}if(!n&&this.eat(y.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(a,o,c,this.parseMaybeUnary(null,!1,!1,r),`**`,!1);else return c};function isLocalVariableAccess(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&isLocalVariableAccess(e.expression)}function isPrivateFieldAccess(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&isPrivateFieldAccess(e.expression)||e.type===`ParenthesizedExpression`&&isPrivateFieldAccess(e.expression)}Z.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,a=this.parseExprAtom(e,t);if(a.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return a;var o=this.parseSubscripts(a,n,r,!1,t);return e&&o.type===`MemberExpression`&&(e.parenthesizedAssign>=o.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=o.start&&(e.parenthesizedBind=-1),e.trailingComma>=o.start&&(e.trailingComma=-1)),o},Z.parseSubscripts=function(e,t,n,r,a){for(var o=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,c=!1;;){var l=this.parseSubscript(e,t,n,r,o,c,a);if(l.optional&&(c=!0),l===e||l.type===`ArrowFunctionExpression`){if(c){var u=this.startNodeAt(t,n);u.expression=l,l=this.finishNode(u,`ChainExpression`)}return l}e=l}},Z.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(y.arrow)},Z.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},Z.parseSubscript=function(e,t,n,r,a,o,c){var l=this.options.ecmaVersion>=11,u=l&&this.eat(y.questionDot);r&&u&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var d=this.eat(y.bracketL);if(d||u&&this.type!==y.parenL&&this.type!==y.backQuote||this.eat(y.dot)){var p=this.startNodeAt(t,n);p.object=e,d?(p.property=this.parseExpression(),this.expect(y.bracketR)):this.type===y.privateId&&e.type!==`Super`?p.property=this.parsePrivateIdent():p.property=this.parseIdent(this.options.allowReserved!==`never`),p.computed=!!d,l&&(p.optional=u),e=this.finishNode(p,`MemberExpression`)}else if(!r&&this.eat(y.parenL)){var m=new ce,h=this.yieldPos,g=this.awaitPos,_=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var b=this.parseExprList(y.parenR,this.options.ecmaVersion>=8,!1,m);if(a&&!u&&this.shouldParseAsyncArrow())return this.checkPatternErrors(m,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=h,this.awaitPos=g,this.awaitIdentPos=_,this.parseSubscriptAsyncArrow(t,n,b,c);this.checkExpressionErrors(m,!0),this.yieldPos=h||this.yieldPos,this.awaitPos=g||this.awaitPos,this.awaitIdentPos=_||this.awaitIdentPos;var x=this.startNodeAt(t,n);x.callee=e,x.arguments=b,l&&(x.optional=u),e=this.finishNode(x,`CallExpression`)}else if(this.type===y.backQuote){(u||o)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var S=this.startNodeAt(t,n);S.tag=e,S.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(S,`TaggedTemplateExpression`)}return e},Z.parseExprAtom=function(e,t,n){this.type===y.slash&&this.readRegexp();var r,a=this.potentialArrowAt===this.start;switch(this.type){case y._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===y.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==y.dot&&this.type!==y.bracketL&&this.type!==y.parenL&&this.unexpected(),this.finishNode(r,`Super`);case y._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case y.name:var o=this.start,c=this.startLoc,l=this.containsEsc,u=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!l&&u.name===`async`&&!this.canInsertSemicolon()&&this.eat(y._function))return this.overrideContext(Y.f_expr),this.parseFunction(this.startNodeAt(o,c),0,!1,!0,t);if(a&&!this.canInsertSemicolon()){if(this.eat(y.arrow))return this.parseArrowExpression(this.startNodeAt(o,c),[u],!1,t);if(this.options.ecmaVersion>=8&&u.name===`async`&&this.type===y.name&&!l&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return u=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(y.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(o,c),[u],!0,t)}return u;case y.regexp:var d=this.value;return r=this.parseLiteral(d.value),r.regex={pattern:d.pattern,flags:d.flags},r;case y.num:case y.string:return this.parseLiteral(this.value);case y._null:case y._true:case y._false:return r=this.startNode(),r.value=this.type===y._null?null:this.type===y._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case y.parenL:var p=this.start,m=this.parseParenAndDistinguishExpression(a,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(m)&&(e.parenthesizedAssign=p),e.parenthesizedBind<0&&(e.parenthesizedBind=p)),m;case y.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(y.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case y.braceL:return this.overrideContext(Y.b_expr),this.parseObj(!1,e);case y._function:return r=this.startNode(),this.next(),this.parseFunction(r,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(n):this.unexpected();default:return this.parseExprAtomDefault()}},Z.parseExprAtomDefault=function(){this.unexpected()},Z.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 n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}else this.unexpected()},Z.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`)},Z.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&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`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},Z.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,``)),this.next(),this.finishNode(t,`Literal`)},Z.parseParenExpression=function(){this.expect(y.parenL);var e=this.parseExpression();return this.expect(y.parenR),e},Z.shouldParseArrow=function(e){return!this.canInsertSemicolon()},Z.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,a,o=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var c=this.start,l=this.startLoc,u=[],d=!0,p=!1,m=new ce,h=this.yieldPos,g=this.awaitPos,_;for(this.yieldPos=0,this.awaitPos=0;this.type!==y.parenR;)if(d?d=!1:this.expect(y.comma),o&&this.afterTrailingComma(y.parenR,!0)){p=!0;break}else if(this.type===y.ellipsis){_=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===y.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}else u.push(this.parseMaybeAssign(!1,m,this.parseParenItem));var b=this.lastTokEnd,x=this.lastTokEndLoc;if(this.expect(y.parenR),e&&this.shouldParseArrow(u)&&this.eat(y.arrow))return this.checkPatternErrors(m,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=h,this.awaitPos=g,this.parseParenArrowList(n,r,u,t);(!u.length||p)&&this.unexpected(this.lastTokStart),_&&this.unexpected(_),this.checkExpressionErrors(m,!0),this.yieldPos=h||this.yieldPos,this.awaitPos=g||this.awaitPos,u.length>1?(a=this.startNodeAt(c,l),a.expressions=u,this.finishNodeAt(a,`SequenceExpression`,b,x)):a=u[0]}else a=this.parseParenExpression();if(this.options.preserveParens){var S=this.startNodeAt(n,r);return S.expression=a,this.finishNode(S,`ParenthesizedExpression`)}else return a},Z.parseParenItem=function(e){return e},Z.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var ge=[];Z.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 n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&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 r=this.start,a=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,a,!0,!1),this.eat(y.parenL)?e.arguments=this.parseExprList(y.parenR,this.options.ecmaVersion>=8,!1):e.arguments=ge,this.finishNode(e,`NewExpression`)},Z.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===y.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
14
+ `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
15
+ `),cooked:this.value},this.next(),n.tail=this.type===y.backQuote,this.finishNode(n,`TemplateElement`)},Z.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===y.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(y.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(y.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},Z.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(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)&&!b.test(this.input.slice(this.lastTokEnd,this.start))},Z.parseObj=function(e,t){var n=this.startNode(),r=!0,a={};for(n.properties=[],this.next();!this.eat(y.braceR);){if(r)r=!1;else if(this.expect(y.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(y.braceR))break;var o=this.parseProperty(e,t);e||this.checkPropClash(o,a,t),n.properties.push(o)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},Z.parseProperty=function(e,t){var n=this.startNode(),r,a,o,c;if(this.options.ecmaVersion>=9&&this.eat(y.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===y.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===y.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(o=this.start,c=this.startLoc),e||(r=this.eat(y.star)));var l=this.containsEsc;return this.parsePropertyName(n),!e&&!l&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(a=!0,r=this.options.ecmaVersion>=9&&this.eat(y.star),this.parsePropertyName(n)):a=!1,this.parsePropertyValue(n,e,r,a,o,c,t,l),this.finishNode(n,`Property`)},Z.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind===`get`?0:1;if(e.value.params.length!==t){var n=e.value.start;e.kind===`get`?this.raiseRecoverable(n,`getter should have no params`):this.raiseRecoverable(n,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},Z.parsePropertyValue=function(e,t,n,r,a,o,c,l){(n||r)&&this.type===y.colon&&this.unexpected(),this.eat(y.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,c),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===y.parenL?(t&&this.unexpected(),e.kind=`init`,e.method=!0,e.value=this.parseMethod(n,r)):!t&&!l&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==y.comma&&this.type!==y.braceR&&this.type!==y.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=a),e.kind=`init`,t?e.value=this.parseMaybeDefault(a,o,this.copyNode(e.key)):this.type===y.eq&&c?(c.shorthandAssign<0&&(c.shorthandAssign=this.start),e.value=this.parseMaybeDefault(a,o,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()},Z.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(this.options.allowReserved!==`never`)},Z.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Z.parseMethod=function(e,t,n){var r=this.startNode(),a=this.yieldPos,o=this.awaitPos,c=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(t,r.generator)|B|(n?V:0)),this.expect(y.parenL),r.params=this.parseBindingList(y.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=c,this.finishNode(r,`FunctionExpression`)},Z.parseArrowExpression=function(e,t,n,r){var a=this.yieldPos,o=this.awaitPos,c=this.awaitIdentPos;return this.enterScope(functionFlags(n,!1)|R),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=c,this.finishNode(e,`ArrowFunctionExpression`)},Z.parseFunctionBody=function(e,t,n,r){var a=t&&this.type!==y.braceL,o=this.strict,c=!1;if(a)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var l=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!o||l)&&(c=this.strictDirective(this.end),c&&l&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var u=this.labels;this.labels=[],c&&(this.strict=!0),this.checkParams(e,!o&&!c&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ae),e.body=this.parseBlock(!1,void 0,c&&!o),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=u}this.exitScope()},Z.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},Z.checkParams=function(e,t){for(var n=Object.create(null),r=0,a=e.params;r<a.length;r+=1){var o=a[r];this.checkLValInnerPattern(o,W,t?null:n)}},Z.parseExprList=function(e,t,n,r){for(var a=[],o=!0;!this.eat(e);){if(o)o=!1;else if(this.expect(y.comma),t&&this.afterTrailingComma(e))break;var c=void 0;n&&this.type===y.comma?c=null:this.type===y.ellipsis?(c=this.parseSpread(r),r&&this.type===y.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):c=this.parseMaybeAssign(!1,r),a.push(c)}return a},Z.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),this.currentThisScope().inClassFieldInit&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},Z.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},Z.parseIdentNode=function(){var e=this.startNode();return this.type===y.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=y.name):this.unexpected(),e},Z.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&&(this.privateNameStack.length===0?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},Z.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`)},Z.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 _e=G.prototype;_e.raise=function(e,t){var n=getLineInfo(this.input,e);t+=` (`+n.line+`:`+n.column+`)`;var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},_e.raiseRecoverable=_e.raise,_e.curPosition=function(){if(this.options.locations)return new j(this.curLine,this.pos-this.lineStart)};var ve=G.prototype,ye=function Scope(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};ve.enterScope=function(e){this.scopeStack.push(new ye(e))},ve.exitScope=function(){this.scopeStack.pop()},ve.treatFunctionsAsVarInScope=function(e){return e.flags&I||!this.inModule&&e.flags&F},ve.declareName=function(e,t,n){var r=!1;if(t===ne){var a=this.currentScope();r=a.lexical.indexOf(e)>-1||a.functions.indexOf(e)>-1||a.var.indexOf(e)>-1,a.lexical.push(e),this.inModule&&a.flags&F&&delete this.undefinedExports[e]}else if(t===ie)this.currentScope().lexical.push(e);else if(t===re){var o=this.currentScope();r=this.treatFunctionsAsVar?o.lexical.indexOf(e)>-1:o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var c=this.scopeStack.length-1;c>=0;--c){var l=this.scopeStack[c];if(l.lexical.indexOf(e)>-1&&!(l.flags&z&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){r=!0;break}if(l.var.push(e),this.inModule&&l.flags&F&&delete this.undefinedExports[e],l.flags&U)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},ve.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},ve.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ve.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&U)return t}},ve.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&U&&!(t.flags&R))return t}};var be=function Node(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new M(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},xe=G.prototype;xe.startNode=function(){return new be(this,this.start,this.startLoc)},xe.startNodeAt=function(e,t){return new be(this,e,t)};function finishNodeAt(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}xe.finishNode=function(e,t){return finishNodeAt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},xe.finishNodeAt=function(e,t,n,r){return finishNodeAt.call(this,e,t,n,r)},xe.copyNode=function(e){var t=new be(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var Se=`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`,Ce=`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`,we=Ce+` Extended_Pictographic`,Te=we,Ee=Te+` EBase EComp EMod EPres ExtPict`,De=Ee,Oe=De,ke={9:Ce,10:we,11:Te,12:Ee,13:De,14:Oe},Ae=`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`,je={9:``,10:``,11:``,12:``,13:``,14:Ae},Me=`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`,Ne=`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`,Pe=Ne+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Fe=Pe+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Ie=Fe+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Le=Ie+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Re=Le+` `+Se,ze={9:Ne,10:Pe,11:Fe,12:Ie,13:Le,14:Re},Be={};function buildUnicodeData(e){var t=Be[e]={binary:wordsRegexp(ke[e]+` `+Me),binaryOfStrings:wordsRegexp(je[e]),nonBinary:{General_Category:wordsRegexp(Me),Script:wordsRegexp(ze[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Ve=0,He=[9,10,11,12,13,14];Ve<He.length;Ve+=1){var Ue=He[Ve];buildUnicodeData(Ue)}var Q=G.prototype,We=function BranchID(e,t){this.parent=e,this.base=t||this};We.prototype.separatedFrom=function separatedFrom(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},We.prototype.sibling=function sibling(){return new We(this.parent,this.base)};var Ge=function RegExpValidationState(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=Be[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};Ge.prototype.reset=function reset(e,t,n){var r=n.indexOf(`v`)!==-1,a=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)},Ge.prototype.raise=function raise(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Ge.prototype.at=function at(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var a=n.charCodeAt(e);if(!(t||this.switchU)||a<=55295||a>=57344||e+1>=r)return a;var o=n.charCodeAt(e+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a},Ge.prototype.nextIndex=function nextIndex(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var a=n.charCodeAt(e),o;return!(t||this.switchU)||a<=55295||a>=57344||e+1>=r||(o=n.charCodeAt(e+1))<56320||o>57343?e+1:e+2},Ge.prototype.current=function current(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Ge.prototype.lookahead=function lookahead(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Ge.prototype.advance=function advance(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Ge.prototype.eat=function eat(e,t){return t===void 0&&(t=!1),this.current(t)===e?(this.advance(t),!0):!1},Ge.prototype.eatChars=function eatChars(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,a=e;r<a.length;r+=1){var o=a[r],c=this.at(n,t);if(c===-1||c!==o)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},Q.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,a=!1,o=0;o<n.length;o++){var c=n.charAt(o);t.indexOf(c)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(c,o+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),c===`u`&&(r=!0),c===`v`&&(a=!0)}this.options.ecmaVersion>=15&&r&&a&&this.raise(e.start,`Invalid regular expression flag`)};function hasProp(e){for(var t in e)return!0;return!1}Q.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&hasProp(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},Q.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,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},Q.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new We(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`)},Q.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},Q.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):!1},Q.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 n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},Q.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},Q.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},Q.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,a=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(a=e.lastIntValue),e.eat(125)))return a!==-1&&a<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},Q.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)},Q.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},Q.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var a=0;a<n.length;a++){var o=n.charAt(a);n.indexOf(o,a+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var c=this.regexp_eatModifiers(e);!n&&!c&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var l=0;l<c.length;l++){var u=c.charAt(l);(c.indexOf(u,l+1)>-1||n.indexOf(u)>-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},Q.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},Q.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&isRegularExpressionModifier(n);)t+=codePointToString(n),e.advance();return t};function isRegularExpressionModifier(e){return e===105||e===109||e===115}Q.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)},Q.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},Q.regexp_eatSyntaxCharacter=function(e){var t=e.current();return isSyntaxCharacter(t)?(e.lastIntValue=t,e.advance(),!0):!1};function isSyntaxCharacter(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}Q.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!isSyntaxCharacter(n);)e.advance();return e.pos!==t},Q.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},Q.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,a=n;r<a.length;r+=1)a[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`);t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},Q.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},Q.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=codePointToString(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=codePointToString(e.lastIntValue);return!0}return!1},Q.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),isRegExpIdentifierStart(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function isRegExpIdentifierStart(e){return isIdentifierStart(e,!0)||e===36||e===95}Q.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),isRegExpIdentifierPart(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function isRegExpIdentifierPart(e){return isIdentifierChar(e,!0)||e===36||e===95||e===8204||e===8205}Q.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},Q.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},Q.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},Q.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)},Q.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},Q.regexp_eatZero=function(e){return e.current()===48&&!isDecimalDigit(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},Q.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},Q.regexp_eatControlLetter=function(e){var t=e.current();return isControlLetter(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function isControlLetter(e){return e>=65&&e<=90||e>=97&&e<=122}Q.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(r&&a>=55296&&a<=56319){var o=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var c=e.lastIntValue;if(c>=56320&&c<=57343)return e.lastIntValue=(a-55296)*1024+(c-56320)+65536,!0}e.pos=o,e.lastIntValue=a}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&isValidUnicode(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function isValidUnicode(e){return e>=0&&e<=1114111}Q.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},Q.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};var Ke=0,qe=1,Je=2;Q.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(isCharacterClassEscape(t))return e.lastIntValue=-1,e.advance(),qe;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Je&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Ke};function isCharacterClassEscape(e){return e===100||e===68||e===115||e===83||e===119||e===87}Q.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),qe}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var a=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,a)}return Ke},Q.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){D(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},Q.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return qe;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Je;e.raise(`Invalid property name`)},Q.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;isUnicodePropertyNameCharacter(t=e.current());)e.lastStringValue+=codePointToString(t),e.advance();return e.lastStringValue!==``};function isUnicodePropertyNameCharacter(e){return isControlLetter(e)||e===95}Q.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;isUnicodePropertyValueCharacter(t=e.current());)e.lastStringValue+=codePointToString(t),e.advance();return e.lastStringValue!==``};function isUnicodePropertyValueCharacter(e){return isUnicodePropertyNameCharacter(e)||isDecimalDigit(e)}Q.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},Q.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Je&&e.raise(`Negated character class may contain strings`),!0}return!1},Q.regexp_classContents=function(e){return e.current()===93?qe:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),qe)},Q.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},Q.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||isOctalDigit(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r===93?!1:(e.lastIntValue=r,e.advance(),!0)},Q.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)},Q.regexp_classSetExpression=function(e){var t=qe,n;if(!this.regexp_eatClassSetRange(e))if(n=this.regexp_eatClassSetOperand(e)){n===Je&&(t=Je);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Je&&(t=qe);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`);for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Je&&(t=Je)}},Q.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},Q.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?qe:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},Q.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Je&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var a=this.regexp_eatCharacterClassEscape(e);if(a)return a;e.pos=t}return null},Q.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},Q.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Je&&(t=Je);return t},Q.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?qe:Je},Q.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&isClassSetReservedDoublePunctuatorCharacter(n)||isClassSetSyntaxCharacter(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function isClassSetReservedDoublePunctuatorCharacter(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function isClassSetSyntaxCharacter(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}Q.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return isClassSetReservedPunctuator(t)?(e.lastIntValue=t,e.advance(),!0):!1};function isClassSetReservedPunctuator(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}Q.regexp_eatClassControlLetter=function(e){var t=e.current();return isDecimalDigit(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},Q.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},Q.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;isDecimalDigit(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function isDecimalDigit(e){return e>=48&&e<=57}Q.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;isHexDigit(n=e.current());)e.lastIntValue=16*e.lastIntValue+hexToInt(n),e.advance();return e.pos!==t};function isHexDigit(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function hexToInt(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}Q.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+n*8+e.lastIntValue:e.lastIntValue=t*8+n}else e.lastIntValue=t;return!0}return!1},Q.regexp_eatOctalDigit=function(e){var t=e.current();return isOctalDigit(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function isOctalDigit(e){return e>=48&&e<=55}Q.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var a=e.current();if(!isHexDigit(a))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+hexToInt(a),e.advance()}return!0};var Ye=function Token(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new M(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Xe=G.prototype;Xe.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 Ye(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Xe.getToken=function(){return this.next(),new Ye(this)},typeof Symbol<`u`&&(Xe[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===y.eof,value:t}}}}),Xe.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(y.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},Xe.readToken=function(e){return isIdentifierStart(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},Xe.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},Xe.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,a=t;(r=nextLineBreak(this.input,a,this.pos))>-1;)++this.curLine,a=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},Xe.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!isNewLine(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},Xe.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++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 loop}break;default:if(e>8&&e<14||e>=5760&&S.test(String.fromCharCode(e)))++this.pos;else break loop}}},Xe.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},Xe.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&&e===46&&t===46?(this.pos+=3,this.finishToken(y.ellipsis)):(++this.pos,this.finishToken(y.dot))},Xe.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(y.assign,2):this.finishOp(y.slash,1)},Xe.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?y.star:y.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=y.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(y.assign,n+1):this.finishOp(r,n)},Xe.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(y.assign,3):this.finishOp(e===124?y.logicalOR:y.logicalAND,2):t===61?this.finishOp(y.assign,2):this.finishOp(e===124?y.bitwiseOR:y.bitwiseAND,1)},Xe.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(y.assign,2):this.finishOp(y.bitwiseXOR,1)},Xe.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||b.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(y.incDec,2):t===61?this.finishOp(y.assign,2):this.finishOp(y.plusMin,1)},Xe.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(y.assign,n+1):this.finishOp(y.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(y.relational,n))},Xe.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(y.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(y.arrow)):this.finishOp(e===61?y.eq:y.prefix,1)},Xe.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(y.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(y.assign,3):this.finishOp(y.coalesce,2)}return this.finishOp(y.question,1)},Xe.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),isIdentifierStart(t,!0)||t===92))return this.finishToken(y.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+codePointToString(t)+`'`)},Xe.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(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)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 '`+codePointToString(e)+`'`)},Xe.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},Xe.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(b.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var a=this.input.slice(n,this.pos);++this.pos;var o=this.pos,c=this.readWord1();this.containsEsc&&this.unexpected(o);var l=this.regexpState||(this.regexpState=new Ge(this));l.reset(n,a,c),this.validateRegExpFlags(l),this.validateRegExpPattern(l);var u=null;try{u=new RegExp(a,c)}catch{}return this.finishToken(y.regexp,{pattern:a,flags:c,value:u})},Xe.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,a=n&&this.input.charCodeAt(this.pos)===48,o=this.pos,c=0,l=0,u=0,d=t??1/0;u<d;++u,++this.pos){var p=this.input.charCodeAt(this.pos),m=void 0;if(r&&p===95){a&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),l===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),u===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),l=p;continue}if(m=p>=97?p-97+10:p>=65?p-65+10:p>=48&&p<=57?p-48:1/0,m>=e)break;l=p,c=c*e+m}return r&&l===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===o||t!=null&&this.pos-o!==t?null:c};function stringToNumber(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function stringToBigInt(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}Xe.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=stringToBigInt(this.input.slice(t,this.pos)),++this.pos):isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(y.num,n)},Xe.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var a=stringToBigInt(this.input.slice(t,this.pos));return++this.pos,isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(y.num,a)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var o=stringToNumber(this.input.slice(t,this.pos),n);return this.finishToken(y.num,o)},Xe.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},Xe.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(isNewLine(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(y.string,t)};var Ze={};Xe.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ze)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},Xe.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ze;this.raise(e,t)},Xe.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===y.template||this.type===y.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(y.dollarBraceL)):(++this.pos,this.finishToken(y.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(y.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(isNewLine(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
16
+ `;break;default:e+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else ++this.pos}},Xe.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`:this.input[this.pos+1]===`
17
+ `&&++this.pos;case`
18
+ `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,`Unterminated template`)},Xe.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
19
+ `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++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 n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],a=parseInt(r,8);return a>255&&(r=r.slice(0,-1),a=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(a)}return isNewLine(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},Xe.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Xe.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var a=this.fullCharCodeAtPos();if(isIdentifierChar(a,r))this.pos+=a<=65535?1:2;else if(a===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var o=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var c=this.readCodePoint();(t?isIdentifierStart:isIdentifierChar)(c,r)||this.invalidStringToken(o,`Invalid Unicode escape`),e+=codePointToString(c),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Xe.readWord=function(){var e=this.readWord1(),t=y.name;return this.keywords.test(e)&&(t=_[e]),this.finishToken(t,e)};var Qe=`8.14.0`;G.acorn={Parser:G,version:Qe,defaultOptions:N,Position:j,SourceLocation:M,getLineInfo,Node:be,TokenType:m,tokTypes:y,keywordTypes:_,TokContext:J,tokContexts:Y,isIdentifierChar,isIdentifierStart,Token:Ye,isNewLine,lineBreak:b,lineBreakG:x,nonASCIIwhitespace:S};function parse(e,t){return G.parse(e,t)}function parseExpressionAt(e,t,n){return G.parseExpressionAt(e,t,n)}function tokenizer(e,t){return G.tokenizer(e,t)}e.Node=be,e.Parser=G,e.Position=j,e.SourceLocation=M,e.TokContext=J,e.Token=Ye,e.TokenType=m,e.defaultOptions=N,e.getLineInfo=getLineInfo,e.isIdentifierChar=isIdentifierChar,e.isIdentifierStart=isIdentifierStart,e.isNewLine=isNewLine,e.keywordTypes=_,e.lineBreak=b,e.lineBreakG=x,e.nonASCIIwhitespace=S,e.parse=parse,e.parseExpressionAt=parseExpressionAt,e.tokContexts=Y,e.tokTypes=y,e.tokenizer=tokenizer,e.version=Qe}))})),In=__toESM(__commonJSMin(((e,t)=>{(function(e,n){e||(e=Pn());var r=e.window,a=e.document,o=new function(){var e=/^(statics|enumerable|beans|preserve)$/,t=[],r=t.slice,a=Object.create,o=Object.getOwnPropertyDescriptor,c=Object.defineProperty,l=t.forEach||function(e,t){for(var n=0,r=this.length;n<r;n++)e.call(t,this[n],n,this)},forIn=function(e,t){for(var n in this)this.hasOwnProperty(n)&&e.call(t,this[n],n,this)},u=Object.assign||function(e){for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var a in r)r.hasOwnProperty(a)&&(e[a]=r[a])}return e},each=function(e,t,n){if(e){var r=o(e,`length`);(r&&typeof r.value==`number`?l:forIn).call(e,t,n||(n=e))}return n};function inject(t,n,r,a,l){var u={};function field(e,d){d||(d=(d=o(n,e))&&(d.get?d:d.value)),typeof d==`string`&&d[0]===`#`&&(d=t[d.substring(1)]||d);var p=typeof d==`function`,m=d,h=l||p&&!d.base?d&&d.get?e in t:t[e]:null,g;(!l||!h)&&(p&&h&&(d.base=h),p&&a!==!1&&(g=e.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(u[g[3].toLowerCase()+g[4]]=g[2]),(!m||p||!m.get||typeof m.get!=`function`||!Base.isPlainObject(m))&&(m={value:m,writable:!0}),(o(t,e)||{configurable:!0}).configurable&&(m.configurable=!0,m.enumerable=r??!g),c(t,e,m))}if(n){for(var d in n)n.hasOwnProperty(d)&&!e.test(d)&&field(d);for(var d in u){var p=u[d],m=t[`set`+p],h=t[`get`+p]||m&&t[`is`+p];h&&(a===!0||h.length===0)&&field(d,{get:h,set:m})}}return t}function Base(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];n&&u(this,n)}return this}return inject(Base,{inject:function(e){if(e){var t=e.statics===!0?e:e.statics,n=e.beans,r=e.preserve;t!==e&&inject(this.prototype,e,e.enumerable,n,r),inject(this,t,null,n,r)}for(var a=1,o=arguments.length;a<o;a++)this.inject(arguments[a]);return this},extend:function(){for(var e=this,ctor,t,n=0,r,o=arguments.length;n<o&&!(ctor&&t);n++)r=arguments[n],ctor||(ctor=r.initialize),t||(t=r.prototype);return ctor||(ctor=function(){e.apply(this,arguments)}),t=ctor.prototype=t||a(this.prototype),c(t,`constructor`,{value:ctor,writable:!0,configurable:!0}),inject(ctor,this),arguments.length&&this.inject.apply(ctor,arguments),ctor.base=e,ctor}}).inject({enumerable:!1,initialize:Base,set:Base,inject:function(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];n&&inject(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var e=a(this);return e.inject.apply(e,arguments)},each:function(e,t){return each(this,e,t)},clone:function(){return new this.constructor(this)},statics:{set:u,each,create:a,define:c,describe:o,clone:function(e){return u(new e.constructor,e)},isPlainObject:function(e){var t=e!=null&&e.constructor;return t&&(t===Object||t===Base||t.name===`Object`)},pick:function(e,t){return e===n?t:e},slice:function(e,t,n){return r.call(e,t,n)}}})};t!==void 0&&(t.exports=o),o.inject({enumerable:!1,toString:function(){return this._id==null?`{ `+o.each(this,function(e,t){if(!/^_/.test(t)){var n=typeof e;this.push(t+`: `+(n===`number`?p.instance.number(e):n===`string`?`'`+e+`'`:e))}},[]).join(`, `)+` }`:(this._class||`Object`)+(this._name?` '`+this._name+`'`:` @`+this._id)},getClassName:function(){return this._class||``},importJSON:function(e){return o.importJSON(e,this)},exportJSON:function(e){return o.exportJSON(this,e)},toJSON:function(){return o.serialize(this)},set:function(e,t){return e&&o.filter(this,e,t,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function extend(){var e=extend.base.apply(this,arguments),t=e.prototype._class;return t&&!o.exports[t]&&(o.exports[t]=e),e},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&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){var n=e.length;if(n!==t.length)return!1;for(;n--;)if(!o.equals(e[n],t[n]))return!1}else{var r=Object.keys(e),n=r.length;if(n!==Object.keys(t).length)return!1;for(;n--;){var a=r[n];if(!(t.hasOwnProperty(a)&&o.equals(e[a],t[a])))return!1}}return!0}return!1},read:function(e,t,r,a){if(this===o){var c=this.peek(e,t);return e.__index++,c}var l=this.prototype,u=l._readIndex,d=t||u&&e.__index||0,p=e.length,m=e[d];if(a||(a=p-d),m instanceof this||r&&r.readNull&&m==null&&a<=1)return u&&(e.__index=d+1),m&&r&&r.clone?m.clone():m;if(m=o.create(l),u&&(m.__read=!0),m=m.initialize.apply(m,d>0||d+a<p?o.slice(e,d,d+a):e)||m,u){e.__index=d+m.__read;var h=m.__filtered;h&&(e.__filtered=h,m.__filtered=n),m.__read=n}return m},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,n,r){for(var a=[],o,c=t||0,l=r?c+r:e.length,u=c;u<l;u++)a.push(Array.isArray(o=e[u])?this.read(o,0,n):this.read(e,u,n,1));return a},readNamed:function(e,t,r,a,c){var l=this.getNamed(e,t),u=l!==n;if(u){var d=e.__filtered;if(!d){var p=this.getSource(e);d=e.__filtered=o.create(p),d.__unfiltered=p}d[t]=n}return this.read(u?[l]:e,r,a,c)},readSupported:function(e,t){var r=this.getSource(e),a=this,o=!1;return r&&Object.keys(r).forEach(function(r){if(r in t){var c=a.readNamed(e,r);c!==n&&(t[r]=c),o=!0}}),o},getSource:function(e){var t=e.__source;if(t===n){var r=e.length===1&&e[0];t=e.__source=r&&o.isPlainObject(r)?r:null}return t},getNamed:function(e,t){var n=this.getSource(e);if(n)return t?n[t]:e.__filtered||n},hasNamed:function(e,t){return!!this.getNamed(e,t)},filter:function(e,t,r,a){var o;function handleKey(a){if(!(r&&a in r)&&!(o&&a in o)){var c=t[a];c!==n&&(e[a]=c)}}if(a){for(var c={},l=0,u,d=a.length;l<d;l++)(u=a[l])in t&&(handleKey(u),c[u]=!0);o=c}return Object.keys(t.__unfiltered||t).forEach(handleKey),e},isPlainValue:function(e,t){return o.isPlainObject(e)||Array.isArray(e)||t&&typeof e==`string`},serialize:function(e,t,n,r){t||(t={});var a=!r,c;if(a&&(t.formatter=new p(t.precision),r={length:0,definitions:{},references:{},add:function(e,t){var n=`#`+e._id,r=this.references[n];if(!r){this.length++;var a=t.call(e),o=e._class;o&&a[0]!==o&&a.unshift(o),this.definitions[n]=a,r=this.references[n]=[n]}return r}}),e&&e._serialize){c=e._serialize(t,r);var l=e._class;l&&!e._compactSerialize&&(a||!n)&&c[0]!==l&&c.unshift(l)}else if(Array.isArray(e)){c=[];for(var u=0,d=e.length;u<d;u++)c[u]=o.serialize(e[u],t,n,r)}else if(o.isPlainObject(e)){c={};for(var m=Object.keys(e),u=0,d=m.length;u<d;u++){var h=m[u];c[h]=o.serialize(e[h],t,n,r)}}else c=typeof e==`number`?t.formatter.number(e,t.precision):e;return a&&r.length>0?[[`dictionary`,r.definitions],c]:c},deserialize:function(e,t,n,r,a){var c=e,l=!n,u=l&&e&&e.length&&e[0][0]===`dictionary`;if(n||(n={}),Array.isArray(e)){var d=e[0],p=d===`dictionary`;if(e.length==1&&/^#/.test(d))return n.dictionary[d];d=o.exports[d],c=[];for(var m=d?1:0,h=e.length;m<h;m++)c.push(o.deserialize(e[m],t,n,p,u));if(d){var g=c;c=t?t(d,g,l||a):new d(g)}}else if(o.isPlainObject(e))for(var _ in c={},r&&(n.dictionary=c),e)c[_]=o.deserialize(e[_],t,n);return u?c[1]:c},exportJSON:function(e,t){var n=o.serialize(e,t);return t&&t.asString==0?n:JSON.stringify(n)},importJSON:function(e,t){return o.deserialize(typeof e==`string`?JSON.parse(e):e,function(e,n,r){var a=r&&t&&t.constructor===e,c=a?t:o.create(e.prototype);if(n.length===1&&c instanceof E&&(a||!(c instanceof O))){var l=n[0];o.isPlainObject(l)&&(l.insert=!1,a&&(n=n.concat([E.INSERT])))}return(a?c.set:e).apply(c,n),a&&(t=null),c})},push:function(e,t){var n=t.length;if(n<4096)e.push.apply(e,t);else{var r=e.length;e.length+=n;for(var a=0;a<n;a++)e[r+a]=t[a]}return e},splice:function(e,t,r,a){var c=t&&t.length,l=r===n;r=l?e.length:r,r>e.length&&(r=e.length);for(var u=0;u<c;u++)t[u]._index=r+u;if(l)return o.push(e,t),[];var d=[r,a];t&&o.push(d,t);for(var p=e.splice.apply(e,d),u=0,m=p.length;u<m;u++)p[u]._index=n;for(var u=r+c,m=e.length;u<m;u++)e[u]._index=u;return p},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 c={on:function(e,t){if(typeof e!=`string`)o.each(e,function(e,t){this.on(t,e)},this);else{var n=this._eventTypes,r=n&&n[e],a=this._callbacks=this._callbacks||{};a=a[e]=a[e]||[],a.indexOf(t)===-1&&(a.push(t),r&&r.install&&a.length===1&&r.install.call(this,e))}return this},off:function(e,t){if(typeof e!=`string`){o.each(e,function(e,t){this.off(t,e)},this);return}var n=this._eventTypes,r=n&&n[e],a=this._callbacks&&this._callbacks[e],c;return a&&(!t||(c=a.indexOf(t))!==-1&&a.length===1?(r&&r.uninstall&&r.uninstall.call(this,e),delete this._callbacks[e]):c!==-1&&a.splice(c,1)),this},once:function(e,t){return this.on(e,function handler(){t.apply(this,arguments),this.off(e,handler)})},emit:function(e,t){var n=this._callbacks&&this._callbacks[e];if(!n)return!1;var r=o.slice(arguments,1),a=t&&t.target&&!t.currentTarget;n=n.slice(),a&&(t.currentTarget=this);for(var c=0,l=n.length;c<l;c++)if(n[c].apply(this,r)==0){t&&t.stop&&t.stop();break}return a&&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,n=this._callbacks,r=e?`install`:`uninstall`;if(t){for(var a in n)if(n[a].length>0){var o=t[a],c=o&&o[r];c&&c.call(this,a)}}},statics:{inject:function inject(e){var t=e._events;if(t){var n={};o.each(t,function(t,r){var a=typeof t==`string`,c=a?t:r,l=o.capitalize(c),u=c.substring(2).toLowerCase();n[u]=a?{}:t,c=`_`+c,e[`get`+l]=function(){return this[c]},e[`set`+l]=function(e){var t=this[c];t&&this.off(u,t),e&&this.on(u,e),this[c]=e}}),e._eventTypes=n}return inject.base.apply(this,arguments)}}},l=o.extend({_class:`PaperScope`,initialize:function PaperScope(){X=this,this.settings=new o({applyMatrix:!0,insertItems:!0,handleSize:4,hitTolerance:0}),this.project=null,this.projects=[],this.tools=[],this._id=PaperScope._id++,PaperScope._scopes[this._id]=this;var t=PaperScope.prototype;if(!this.support){var n=me.getContext(1,1)||{};t.support={nativeDash:`setLineDash`in n||`mozDash`in n,nativeBlendModes:he.nativeModes},me.release(n)}if(!this.agent){var r=e.navigator.userAgent.toLowerCase(),a=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(r)||[])[0],c=a===`darwin`?`mac`:a,l=t.agent=t.browser={platform:c};c&&(l[c]=!0),r.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,function(e,t,n,r,a){if(!l.chrome){var o=t===`opera`?r:/^(node|trident)$/.test(t)?a:n;l.version=o,l.versionNumber=parseFloat(o),t={trident:`msie`,jsdom:`node`}[t]||t,l.name=t,l[t]=!0}}),l.chrome&&delete l.webkit,l.atom&&delete l.chrome}},version:`0.12.18`,getView:function(){var e=this.project;return e&&e._view},getPaper:function(){return this},execute:function(e,t){var n=X.PaperScript.execute(e,this,t);return G.updateFocus(),n},install:function(e){var t=this;for(var n in o.each([`project`,`view`,`tool`],function(n){o.define(e,n,{configurable:!0,get:function(){return t[n]}})}),this)!/^_/.test(n)&&this[n]&&(e[n]=this[n])},setup:function(e){return X=this,this.project=new T(e),this},createCanvas:function(e,t){return me.getCanvas(e,t)},activate:function(){X=this},clear:function(){for(var e=this.projects,t=this.tools,n=e.length-1;n>=0;n--)e[n].remove();for(var n=t.length-1;n>=0;n--)t[n].remove()},remove:function(){this.clear(),delete l._scopes[this._id]},statics:new function(){function handleAttribute(e){return e+=`Attribute`,function(t,n){return t[e](n)||t[e](`data-paper-`+n)}}return{_scopes:{},_id:0,get:function(e){return this._scopes[e]||null},getAttribute:handleAttribute(`get`),hasAttribute:handleAttribute(`has`)}}}),u=o.extend(c,{initialize:function(e){this._scope=X,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 this._index==null?!1:(o.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()}}),d={findItemBoundsCollisions:function(e,t,n){function getBounds(e){for(var t=Array(e.length),n=0;n<e.length;n++){var r=e[n].getBounds();t[n]=[r.left,r.top,r.right,r.bottom]}return t}var r=getBounds(e),a=!t||t===e?r:getBounds(t);return this.findBoundsCollisions(r,a,n||0)},findCurveBoundsCollisions:function(e,t,n,r){function getBounds(e){for(var t=Math.min,n=Math.max,r=Array(e.length),a=0;a<e.length;a++){var o=e[a];r[a]=[t(o[0],o[2],o[4],o[6]),t(o[1],o[3],o[5],o[7]),n(o[0],o[2],o[4],o[6]),n(o[1],o[3],o[5],o[7])]}return r}var a=getBounds(e),o=!t||t===e?a:getBounds(t);if(r){for(var c=this.findBoundsCollisions(a,o,n||0,!1,!0),l=this.findBoundsCollisions(a,o,n||0,!0,!0),u=[],d=0,p=c.length;d<p;d++)u[d]={hor:c[d],ver:l[d]};return u}return this.findBoundsCollisions(a,o,n||0)},findBoundsCollisions:function(e,t,n,r,a){var o=!t||e===t,c=o?e:e.concat(t),l=e.length,u=c.length;function binarySearch(e,t,n){for(var r=0,a=e.length;r<a;){var o=a+r>>>1;c[e[o]][t]<n?r=o+1:a=o}return r-1}for(var d=r?1:0,p=d+2,m=r?0:1,h=m+2,g=Array(u),_=0;_<u;_++)g[_]=_;g.sort(function(e,t){return c[e][d]-c[t][d]});for(var y=[],b=Array(l),_=0;_<u;_++){var x=g[_],S=c[x],C=o?x:x-l,w=x<l,T=o||!w,E=w?[]:null;if(y.length){var D=binarySearch(y,p,S[d]-n)+1;if(y.splice(0,D),o&&a){E=E.concat(y);for(var O=0;O<y.length;O++){var k=y[O];b[k].push(C)}}else for(var A=S[h],j=S[m],O=0;O<y.length;O++){var k=y[O],M=c[k],N=k<l,P=o||k>=l;(a||(w&&P||T&&N)&&A>=M[m]-n&&j<=M[h]+n)&&(w&&P&&E.push(o?k:k-l),T&&N&&b[k].push(C))}}if(w&&(e===t&&E.push(x),b[x]=E),y.length){var F=S[p],I=binarySearch(y,p,F);y.splice(I+1,0,x)}else y.push(x)}for(var _=0;_<b.length;_++){var L=b[_];L&&L.sort(function(e,t){return e-t})}return b}},p=o.extend({initialize:function(e){this.precision=o.pick(e,5),this.multiplier=10**this.precision},number:function(e){return this.precision<16?Math.round(e*this.multiplier)/this.multiplier:e},pair:function(e,t,n){return this.number(e)+(n||`,`)+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)}});p.instance=new p;var m=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]],n=Math.abs,r=Math.sqrt,a=Math.pow,o=Math.log2||function(e){return Math.log(e)*Math.LOG2E},c=1e-12,l=112e-18;function clamp(e,t,n){return e<t?t:e>n?n:e}function getDiscriminant(e,t,r){function split(e){var t=e*134217729,n=e-t+t;return[n,e-n]}var a=t*t-e*r,o=t*t+e*r;if(n(a)*3<o){var c=split(e),l=split(t),u=split(r),d=t*t,p=l[0]*l[0]-d+2*l[0]*l[1]+l[1]*l[1],m=e*r,h=c[0]*u[0]-m+c[0]*u[1]+c[1]*u[0]+c[1]*u[1];a=d-m+(p-h)}return a}function getNormalizationFactor(){var e=Math.max.apply(Math,arguments);return e&&(e<1e-8||e>1e8)?a(2,-Math.round(o(e))):0}return{EPSILON:c,MACHINE_EPSILON:l,CURVETIME_EPSILON:1e-8,GEOMETRIC_EPSILON:1e-7,TRIGONOMETRIC_EPSILON:1e-8,ANGULAR_EPSILON:1e-5,KAPPA:4*(r(2)-1)/3,isZero:function(e){return e>=-c&&e<=c},isMachineZero:function(e){return e>=-l&&e<=l},clamp,integrate:function(n,r,a,o){for(var c=e[o-2],l=t[o-2],u=(a-r)*.5,d=u+r,p=0,m=o+1>>1,h=o&1?l[p++]*n(d):0;p<m;){var g=u*c[p];h+=l[p++]*(n(d+g)+n(d-g))}return u*h},findRoot:function(e,t,r,a,o,c,l){for(var u=0;u<c;u++){var d=e(r),p=d/t(r),m=r-p;if(n(p)<l){r=m;break}d>0?(o=r,r=m<=a?(a+o)*.5:m):(a=r,r=m>=o?(a+o)*.5:m)}return clamp(r,a,o)},solveQuadratic:function(e,t,a,o,u,d){var p,m=1/0;if(n(e)<c){if(n(t)<c)return n(a)<c?-1:0;p=-a/t}else{t*=-.5;var h=getDiscriminant(e,t,a);if(h&&n(h)<l){var g=getNormalizationFactor(n(e),n(t),n(a));g&&(e*=g,t*=g,a*=g,h=getDiscriminant(e,t,a))}if(h>=-l){var _=h<0?0:r(h),y=t+(t<0?-_:_);y===0?(p=a/e,m=-p):(p=y/e,m=a/y)}}var b=0,x=u==null,S=u-c,C=d+c;return isFinite(p)&&(x||p>S&&p<C)&&(o[b++]=x?p:clamp(p,u,d)),m!==p&&isFinite(m)&&(x||m>S&&m<C)&&(o[b++]=x?m:clamp(m,u,d)),b},solveCubic:function(e,t,o,u,d,p,h){var g=getNormalizationFactor(n(e),n(t),n(o),n(u)),_,y,b,x,S;g&&(e*=g,t*=g,o*=g,u*=g);function evaluate(n){_=n;var r=e*_;y=r+t,b=y*_+o,x=(r+y)*_+b,S=b*_+u}if(n(e)<c)e=t,y=o,b=u,_=1/0;else if(n(u)<c)y=t,b=o,_=0;else{evaluate(-(t/e)/3);var C=S/e,w=a(n(C),1/3),T=C<0?-1:1,E=-x/e,D=E>0?1.324717957244746*Math.max(w,r(E)):w,O=_-T*D;if(O!==_){do evaluate(O),O=x===0?_:_-S/x/(1+l);while(T*O>T*_);n(e)*_*_>n(u/_)&&(b=-u/_,y=(b-o)/_)}}var k=m.solveQuadratic(e,y,b,d,p,h),A=p==null;return isFinite(_)&&(k===0||k>0&&_!==d[0]&&_!==d[1])&&(A||_>p-c&&_<h+c)&&(d[k++]=A?_:clamp(_,p,h)),k}}},h={_id:1,_pools:{},get:function(e){if(e){var t=this._pools[e];return t||(t=this._pools[e]={_id:1}),t._id++}else return this._id++}},g=o.extend({_class:`Point`,_readIndex:!0,initialize:function Point(e,t){var n=typeof e,r=this.__read,a=0;if(n===`number`){var o=typeof t==`number`;this._set(e,o?t:e),r&&(a=o?2:1)}else if(n===`undefined`||e===null)this._set(0,0),r&&(a=e===null?1:0);else{var c=n===`string`?e.split(/[\s,]+/)||[]:e;a=1,Array.isArray(c)?this._set(+c[0],+(c.length>1?c[1]:c[0])):`x`in c?this._set(c.x||0,c.y||0):`width`in c?this._set(c.width||0,c.height||0):`angle`in c?(this._set(c.length||0,0),this.setAngle(c.angle||0)):(this._set(0,0),a=0)}return r&&(this.__read=a),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 g(this.x,this.y)},toString:function(){var e=p.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 n=e/this.getLength();m.isZero(n)&&this.getAngle(),this._set(this.x*n,this.y*n)}},getAngle:function(){return this.getAngleInRadians.apply(this,arguments)*180/Math.PI},setAngle:function(e){this.setAngleInRadians.call(this,e*Math.PI/180)},getAngleInDegrees:`#getAngle`,setAngleInDegrees:`#setAngle`,getAngleInRadians:function(){if(arguments.length){var e=g.read(arguments),t=this.getLength()*e.getLength();if(m.isZero(t))return NaN;var n=this.dot(e)/t;return Math.acos(n<-1?-1:n>1?1:n)}else 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=g.read(arguments);return Math.atan2(this.cross(e),this.dot(e))*180/Math.PI},getDistance:function(){var e=arguments,t=g.read(e),n=t.x-this.x,r=t.y-this.y,a=n*n+r*r;return o.read(e)?a:Math.sqrt(a)},normalize:function(e){e===n&&(e=1);var t=this.getLength(),r=t===0?0:e/t,a=new g(this.x*r,this.y*r);return r>=0&&(a._angle=this._angle),a},rotate:function(e,t){if(e===0)return this.clone();e=e*Math.PI/180;var n=t?this.subtract(t):this,r=Math.sin(e),a=Math.cos(e);return n=new g(n.x*a-n.y*r,n.x*r+n.y*a),t?n.add(t):n},transform:function(e){return e?e._transformPoint(this):this},add:function(){var e=g.read(arguments);return new g(this.x+e.x,this.y+e.y)},subtract:function(){var e=g.read(arguments);return new g(this.x-e.x,this.y-e.y)},multiply:function(){var e=g.read(arguments);return new g(this.x*e.x,this.y*e.y)},divide:function(){var e=g.read(arguments);return new g(this.x/e.x,this.y/e.y)},modulo:function(){var e=g.read(arguments);return new g(this.x%e.x,this.y%e.y)},negate:function(){return new g(-this.x,-this.y)},isInside:function(){return x.read(arguments).contains(this)},isClose:function(){var e=arguments,t=g.read(e),n=o.read(e);return this.getDistance(t)<=n},isCollinear:function(){var e=g.read(arguments);return g.isCollinear(this.x,this.y,e.x,e.y)},isColinear:`#isCollinear`,isOrthogonal:function(){var e=g.read(arguments);return g.isOrthogonal(this.x,this.y,e.x,e.y)},isZero:function(){var e=m.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=g.read(arguments);return this.x*e.x+this.y*e.y},cross:function(){var e=g.read(arguments);return this.x*e.y-this.y*e.x},project:function(){var e=g.read(arguments),t=e.isZero()?0:this.dot(e)/e.dot(e);return new g(e.x*t,e.y*t)},statics:{min:function(){var e=arguments,t=g.read(e),n=g.read(e);return new g(Math.min(t.x,n.x),Math.min(t.y,n.y))},max:function(){var e=arguments,t=g.read(e),n=g.read(e);return new g(Math.max(t.x,n.x),Math.max(t.y,n.y))},random:function(){return new g(Math.random(),Math.random())},isCollinear:function(e,t,n,r){return Math.abs(e*r-t*n)<=Math.sqrt((e*e+t*t)*(n*n+r*r))*1e-8},isOrthogonal:function(e,t,n,r){return Math.abs(e*n+t*r)<=Math.sqrt((e*e+t*t)*(n*n+r*r))*1e-8}}},o.each([`round`,`ceil`,`floor`,`abs`],function(e){var t=Math[e];this[e]=function(){return new g(t(this.x),t(this.y))}},{})),_=g.extend({initialize:function Point(e,t,n,r){this._x=e,this._y=t,this._owner=n,this._setter=r},_set:function(e,t,n){return this._x=e,this._y=t,n||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 this._setter===`setPosition`?4:0}}),y=o.extend({_class:`Size`,_readIndex:!0,initialize:function Size(e,t){var n=typeof e,r=this.__read,a=0;if(n===`number`){var o=typeof t==`number`;this._set(e,o?t:e),r&&(a=o?2:1)}else if(n===`undefined`||e===null)this._set(0,0),r&&(a=e===null?1:0);else{var c=n===`string`?e.split(/[\s,]+/)||[]:e;a=1,Array.isArray(c)?this._set(+c[0],+(c.length>1?c[1]:c[0])):`width`in c?this._set(c.width||0,c.height||0):`x`in c?this._set(c.x||0,c.y||0):(this._set(0,0),a=0)}return r&&(this.__read=a),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 y(this.width,this.height)},toString:function(){var e=p.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=y.read(arguments);return new y(this.width+e.width,this.height+e.height)},subtract:function(){var e=y.read(arguments);return new y(this.width-e.width,this.height-e.height)},multiply:function(){var e=y.read(arguments);return new y(this.width*e.width,this.height*e.height)},divide:function(){var e=y.read(arguments);return new y(this.width/e.width,this.height/e.height)},modulo:function(){var e=y.read(arguments);return new y(this.width%e.width,this.height%e.height)},negate:function(){return new y(-this.width,-this.height)},isZero:function(){var e=m.isZero;return e(this.width)&&e(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(e,t){return new y(Math.min(e.width,t.width),Math.min(e.height,t.height))},max:function(e,t){return new y(Math.max(e.width,t.width),Math.max(e.height,t.height))},random:function(){return new y(Math.random(),Math.random())}}},o.each([`round`,`ceil`,`floor`,`abs`],function(e){var t=Math[e];this[e]=function(){return new y(t(this.width),t(this.height))}},{})),b=y.extend({initialize:function Size(e,t,n,r){this._width=e,this._height=t,this._owner=n,this._setter=r},_set:function(e,t,n){return this._width=e,this._height=t,n||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)}}),x=o.extend({_class:`Rectangle`,_readIndex:!0,beans:!0,initialize:function Rectangle(e,t,r,a){var c=arguments,l=typeof e,u;if(l===`number`?(this._set(e,t,r,a),u=4):l===`undefined`||e===null?(this._set(0,0,0,0),u=e===null?1:0):c.length===1&&(Array.isArray(e)?(this._set.apply(this,e),u=1):e.x!==n||e.width!==n?(this._set(e.x||0,e.y||0,e.width||0,e.height||0),u=1):e.from===n&&e.to===n&&(this._set(0,0,0,0),o.readSupported(c,this)&&(u=1))),u===n){var d=g.readNamed(c,`from`),p=o.peek(c),m=d.x,h=d.y,_,b;if(p&&p.x!==n||o.hasNamed(c,`to`)){var x=g.readNamed(c,`to`);_=x.x-m,b=x.y-h,_<0&&(m=x.x,_=-_),b<0&&(h=x.y,b=-b)}else{var S=y.read(c);_=S.width,b=S.height}this._set(m,h,_,b),u=c.__index}var C=c.__filtered;return C&&(this.__filtered=C),this.__read&&(this.__read=u),this},set:`#initialize`,_set:function(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this},clone:function(){return new x(this.x,this.y,this.width,this.height)},equals:function(e){var t=o.isPlainValue(e)?x.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=p.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?g:_)(this.x,this.y,this,`setPoint`)},setPoint:function(){var e=g.read(arguments);this.x=e.x,this.y=e.y},getSize:function(e){return new(e?y:b)(this.width,this.height,this,`setSize`)},_fw:1,_fh:1,setSize:function(){var e=y.read(arguments),t=this._sx,n=this._sy,r=e.width,a=e.height;t&&(this.x+=(this.width-r)*t),n&&(this.y+=(this.height-a)*n),this.width=r,this.height=a,this._fw=this._fh=1},getLeft:function(){return this.x},setLeft:function(e){if(!this._fw){var t=e-this.x;this.width-=this._sx===.5?t*2: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-=this._sy===.5?t*2: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=this._sx===.5?t*2: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=this._sy===.5?t*2: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||this._sx===.5?this.x=e-this.width/2:(this._sx&&(this.x+=(e-this.x)*2*this._sx),this.width=(e-this.x)*2),this._sx=.5,this._fw=0},getCenterY:function(){return this.y+this.height/2},setCenterY:function(e){this._fh||this._sy===.5?this.y=e-this.height/2:(this._sy&&(this.y+=(e-this.y)*2*this._sy),this.height=(e-this.y)*2),this._sy=.5,this._fh=0},getCenter:function(e){return new(e?g:_)(this.getCenterX(),this.getCenterY(),this,`setCenter`)},setCenter:function(){var e=g.read(arguments);return this.setCenterX(e.x),this.setCenterY(e.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return this.width===0||this.height===0},contains:function(e){return e&&e.width!==n||(Array.isArray(e)?e:arguments).length===4?this._containsRectangle(x.read(arguments)):this._containsPoint(g.read(arguments))},_containsPoint:function(e){var t=e.x,n=e.y;return t>=this.x&&n>=this.y&&t<=this.x+this.width&&n<=this.y+this.height},_containsRectangle:function(e){var t=e.x,n=e.y;return t>=this.x&&n>=this.y&&t+e.width<=this.x+this.width&&n+e.height<=this.y+this.height},intersects:function(){var e=x.read(arguments),t=o.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=x.read(arguments),t=Math.max(this.x,e.x),n=Math.max(this.y,e.y),r=Math.min(this.x+this.width,e.x+e.width),a=Math.min(this.y+this.height,e.y+e.height);return new x(t,n,r-t,a-n)},unite:function(){var e=x.read(arguments),t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),r=Math.max(this.x+this.width,e.x+e.width),a=Math.max(this.y+this.height,e.y+e.height);return new x(t,n,r-t,a-n)},include:function(){var e=g.read(arguments),t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),r=Math.max(this.x+this.width,e.x),a=Math.max(this.y+this.height,e.y);return new x(t,n,r-t,a-n)},expand:function(){var e=y.read(arguments),t=e.width,n=e.height;return new x(this.x-t/2,this.y-n/2,this.width+t,this.height+n)},scale:function(e,t){return this.expand(this.width*e-this.width,this.height*(t===n?e:t)-this.height)}},o.each([[`Top`,`Left`],[`Top`,`Right`],[`Bottom`,`Left`],[`Bottom`,`Right`],[`Left`,`Center`],[`Top`,`Center`],[`Right`,`Center`],[`Bottom`,`Center`]],function(e,t){var n=e.join(``),r=/^[RL]/.test(n);t>=4&&(e[1]+=r?`Y`:`X`);var a=e[r?0:1],o=e[r?1:0],c=`get`+a,l=`get`+o,u=`set`+a,d=`set`+o,p=`get`+n,m=`set`+n;this[p]=function(e){return new(e?g:_)(this[c](),this[l](),this,m)},this[m]=function(){var e=g.read(arguments);this[u](e.x),this[d](e.y)}},{beans:!0})),S=x.extend({initialize:function Rectangle(e,t,n,r,a,o){this._set(e,t,n,r,!0),this._owner=a,this._setter=o},_set:function(e,t,n,r,a){return this._x=e,this._y=t,this._width=n,this._height=r,a||this._owner[this._setter](this),this}},new function(){var e=x.prototype;return o.each([`x`,`y`,`width`,`height`],function(e){var t=o.capitalize(e),n=`_`+e;this[`get`+t]=function(){return this[n]},this[`set`+t]=function(e){this[n]=e,this._dontNotify||this._owner[this._setter](this)}},o.each([`Point`,`Size`,`Center`,`Left`,`Top`,`Right`,`Bottom`,`CenterX`,`CenterY`,`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`,`LeftCenter`,`TopCenter`,`RightCenter`,`BottomCenter`],function(t){var n=`set`+t;this[n]=function(){this._dontNotify=!0,e[n].apply(this,arguments),this._dontNotify=!1,this._owner[this._setter](this)}},{isSelected:function(){return!!(this._owner._selection&2)},setSelected:function(e){var t=this._owner;t._changeSelection&&t._changeSelection(2,e)}}))}),C=o.extend({_class:`Matrix`,initialize:function Matrix(e,t){var n=arguments,r=n.length,a=!0;if(r>=6?this._set.apply(this,n):r===1||r===2?e instanceof Matrix?this._set(e._a,e._b,e._c,e._d,e._tx,e._ty,t):Array.isArray(e)?this._set.apply(this,t?e.concat([t]):e):a=!1:r?a=!1:this.reset(),!a)throw Error(`Unsupported matrix parameters`);return this},set:`#initialize`,_set:function(e,t,n,r,a,o,c){return this._a=e,this._b=t,this._c=n,this._d=r,this._tx=a,this._ty=o,c||this._changed(),this},_serialize:function(e,t){return o.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 C(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=p.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 n=this._owner;return n?(n.transform(null,o.pick(e,!0),t),this.isIdentity()):!1},translate:function(){var e=g.read(arguments),t=e.x,n=e.y;return this._tx+=t*this._a+n*this._c,this._ty+=t*this._b+n*this._d,this._changed(),this},scale:function(){var e=arguments,t=g.read(e),n=g.read(e,0,{readNull:!0});return n&&this.translate(n),this._a*=t.x,this._b*=t.x,this._c*=t.y,this._d*=t.y,n&&this.translate(n.negate()),this._changed(),this},rotate:function(e){e*=Math.PI/180;var t=g.read(arguments,1),n=t.x,r=t.y,a=Math.cos(e),o=Math.sin(e),c=n-n*a+r*o,l=r-n*o-r*a,u=this._a,d=this._b,p=this._c,m=this._d;return this._a=a*u+o*p,this._b=a*d+o*m,this._c=-o*u+a*p,this._d=-o*d+a*m,this._tx+=c*u+l*p,this._ty+=c*d+l*m,this._changed(),this},shear:function(){var e=arguments,t=g.read(e),n=g.read(e,0,{readNull:!0});n&&this.translate(n);var r=this._a,a=this._b;return this._a+=t.y*this._c,this._b+=t.y*this._d,this._c+=t.x*r,this._d+=t.x*a,n&&this.translate(n.negate()),this._changed(),this},skew:function(){var e=arguments,t=g.read(e),n=g.read(e,0,{readNull:!0}),r=Math.PI/180,a=new g(Math.tan(t.x*r),Math.tan(t.y*r));return this.shear(a,n)},append:function(e,t){if(e){var n=this._a,r=this._b,a=this._c,o=this._d,c=e._a,l=e._c,u=e._b,d=e._d,p=e._tx,m=e._ty;this._a=c*n+u*a,this._c=l*n+d*a,this._b=c*r+u*o,this._d=l*r+d*o,this._tx+=p*n+m*a,this._ty+=p*r+m*o,t||this._changed()}return this},prepend:function(e,t){if(e){var n=this._a,r=this._b,a=this._c,o=this._d,c=this._tx,l=this._ty,u=e._a,d=e._c,p=e._b,m=e._d,h=e._tx,g=e._ty;this._a=u*n+d*r,this._c=u*a+d*o,this._b=p*n+m*r,this._d=p*a+m*o,this._tx=u*c+d*l+h,this._ty=p*c+m*l+g,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,n=this._c,r=this._d,a=this._tx,o=this._ty,c=e*r-t*n,l=null;return c&&!isNaN(c)&&isFinite(a)&&isFinite(o)&&(this._a=r/c,this._b=-t/c,this._c=-n/c,this._d=e/c,this._tx=(n*o-r*a)/c,this._ty=(t*a-e*o)/c,l=this),l},inverted:function(){return this.clone().invert()},concatenate:`#append`,preConcatenate:`#prepend`,chain:`#appended`,_shiftless:function(){return new C(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return this._a===1&&this._b===0&&this._c===0&&this._d===1&&this._tx===0&&this._ty===0},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,n){return arguments.length<3?this._transformPoint(g.read(arguments)):this._transformCoordinates(e,t,n)},_transformPoint:function(e,t,n){var r=e.x,a=e.y;return t||(t=new g),t._set(r*this._a+a*this._c+this._tx,r*this._b+a*this._d+this._ty,n)},_transformCoordinates:function(e,t,n){for(var r=0,a=2*n;r<a;r+=2){var o=e[r],c=e[r+1];t[r]=o*this._a+c*this._c+this._tx,t[r+1]=o*this._b+c*this._d+this._ty}return t},_transformCorners:function(e){var t=e.x,n=e.y,r=t+e.width,a=n+e.height,o=[t,n,r,n,r,a,t,a];return this._transformCoordinates(o,o,4)},_transformBounds:function(e,t,n){for(var r=this._transformCorners(e),a=r.slice(0,2),o=a.slice(),c=2;c<8;c++){var l=r[c],u=c&1;l<a[u]?a[u]=l:l>o[u]&&(o[u]=l)}return t||(t=new x),t._set(a[0],a[1],o[0]-a[0],o[1]-a[1],n)},inverseTransform:function(){return this._inverseTransform(g.read(arguments))},_inverseTransform:function(e,t,n){var r=this._a,a=this._b,o=this._c,c=this._d,l=this._tx,u=this._ty,d=r*c-a*o,p=null;if(d&&!isNaN(d)&&isFinite(l)&&isFinite(u)){var m=e.x-this._tx,h=e.y-this._ty;t||(t=new g),p=t._set((m*c-h*o)/d,(h*r-m*a)/d,n)}return p},decompose:function(){var e=this._a,t=this._b,n=this._c,r=this._d,a=e*r-t*n,o=Math.sqrt,c=Math.atan2,l=180/Math.PI,u,d,p;if(e!==0||t!==0){var m=o(e*e+t*t);u=Math.acos(e/m)*(t>0?1:-1),d=[m,a/m],p=[c(e*n+t*r,m*m),0]}else if(n!==0||r!==0){var h=o(n*n+r*r);u=Math.asin(n/h)*(r>0?1:-1),d=[a/h,h],p=[0,c(e*n+t*r,h*h)]}else u=0,p=d=[0,0];return{translation:this.getTranslation(),rotation:u*l,scaling:new g(d),skewing:new g(p[0]*l,p[1]*l)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new g(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)}},o.each([`a`,`b`,`c`,`d`,`tx`,`ty`],function(e){var t=o.capitalize(e),n=`_`+e;this[`get`+t]=function(){return this[n]},this[`set`+t]=function(e){this[n]=e,this._changed()}},{})),w=o.extend({_class:`Line`,initialize:function Line(e,t,n,r,a){var o=!1;arguments.length>=4?(this._px=e,this._py=t,this._vx=n,this._vy=r,o=a):(this._px=e.x,this._py=e.y,this._vx=t.x,this._vy=t.y,o=n),o||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new g(this._px,this._py)},getVector:function(){return new g(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(e,t){return w.intersect(this._px,this._py,this._vx,this._vy,e._px,e._py,e._vx,e._vy,!0,t)},getSide:function(e,t){return w.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 w.getSignedDistance(this._px,this._py,this._vx,this._vy,e.x,e.y,!0)},isCollinear:function(e){return g.isCollinear(this._vx,this._vy,e._vx,e._vy)},isOrthogonal:function(e){return g.isOrthogonal(this._vx,this._vy,e._vx,e._vy)},statics:{intersect:function(e,t,n,r,a,o,c,l,u,d){u||(n-=e,r-=t,c-=a,l-=o);var p=n*l-r*c;if(!m.isMachineZero(p)){var h=e-a,_=t-o,y=(c*_-l*h)/p,b=(n*_-r*h)/p,x=1e-12,S=-x,C=1+x;if(d||S<y&&y<C&&S<b&&b<C)return d||(y=y<=0?0:y>=1?1:y),new g(e+y*n,t+y*r)}},getSide:function(e,t,n,r,a,o,c,l){c||(n-=e,r-=t);var u=a-e,d=o-t,p=u*r-d*n;return!l&&m.isMachineZero(p)&&(p=(u*n+u*n)/(n*n+r*r),p>=0&&p<=1&&(p=0)),p<0?-1:p>0?1:0},getSignedDistance:function(e,t,n,r,a,o,c){return c||(n-=e,r-=t),n===0?r>0?a-e:e-a:r===0?n<0?o-t:t-o:((a-e)*r-(o-t)*n)/(r>n?r*Math.sqrt(1+n*n/(r*r)):n*Math.sqrt(1+r*r/(n*n)))},getDistance:function(e,t,n,r,a,o,c){return Math.abs(w.getSignedDistance(e,t,n,r,a,o,c))}}}),T=u.extend({_class:`Project`,_list:`projects`,_reference:`project`,_compactSerialize:!0,initialize:function Project(e){u.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new re(null,null,this),this._view=G.create(this,e||me.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(e,t){return o.serialize(this._children,e,!0,t)},_changed:function(e,t){if(e&1){var n=this._view;n&&(n._needsUpdate=!0,!n._requested&&n._autoUpdate&&n.requestUpdate())}var r=this._changes;if(r&&t){var a=this._changesById,o=t._id,c=a[o];c?c.flags|=e:r.push(a[o]={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 remove(){return remove.base.call(this)?(this._view&&this._view.remove(),!0):!1},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 O({project:this,insert:!0})},getSymbolDefinitions:function(){var e=[],t={};return this.getItems({class:j,match:function(n){var r=n._definition,a=r._id;return t[a]||(t[a]=!0,e.push(r)),!1}}),e},getSymbols:`getSymbolDefinitions`,getSelectedItems:function(){var e=this._selectionItems,t=[];for(var n in e){var r=e[n],a=r._selection;a&1&&r.isInserted()?t.push(r):a||this._updateSelection(r)}return t},_updateSelection:function(e){var t=e._id,n=this._selectionItems;e._selection?n[t]!==e&&(this._selectionCount++,n[t]=e):n[t]===e&&(this._selectionCount--,delete n[t])},selectAll:function(){for(var e=this._children,t=0,n=e.length;t<n;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(n,e)},insertLayer:function(e,t){if(t instanceof O){t._remove(!1,!0),o.splice(this._children,[t],e,0),t._setProject(this,!0);var n=t._name;n&&t.setName(n),this._changes&&t._changed(5),this._activeLayer||(this._activeLayer=t)}else t=null;return t},_insertItem:function(e,t,r){return t=this.insertLayer(e,t)||(this._activeLayer||this._insertItem(n,new O(E.NO_INSERT),!0)).insertChild(e,t),r&&t.activate&&t.activate(),t},getItems:function(e){return E._getItems(this,e)},getItem:function(e){return E._getItems(this,e,null,null,!0)[0]||null},importJSON:function(e){this.activate();var t=this._activeLayer;return o.importJSON(e,t&&t.isEmpty()&&t)},removeOn:function(e){var t=this._removeSets;if(t){e===`mouseup`&&(t.mousedrag=null);var n=t[e];if(n){for(var r in n){var a=n[r];for(var o in t){var c=t[o];c&&c!=n&&delete c[a._id]}a.remove()}t[e]=null}}},draw:function(e,t,n){this._updateVersion++,e.save(),t.applyToContext(e);for(var r=this._children,a=new o({offset:new g(0,0),pixelRatio:n,viewMatrix:t.isIdentity()?null:t,matrices:[new C],updateMatrix:!0}),c=0,l=r.length;c<l;c++)r[c].draw(e,a);if(e.restore(),this._selectionCount>0){e.save(),e.strokeWidth=1;var u=this._selectionItems,d=this._scope.settings.handleSize,p=this._updateVersion;for(var m in u)u[m]._drawSelection(e,t,d,u,p);e.restore()}}}),E=o.extend(c,{statics:{extend:function extend(e){return e._serializeFields&&(e._serializeFields=o.set({},this.prototype._serializeFields,e._serializeFields)),extend.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 C,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 o.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 Item(){},_initialize:function(e,t){var r=e&&o.isPlainObject(e),a=r&&e.internal===!0,c=this._matrix=new C,l=r&&e.project||X.project,u=X.settings;return this._id=a?null:h.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&u.applyMatrix,t&&c.translate(t),c._owner=this,this._style=new re(l._currentStyle,this,l),a||r&&e.insert==0||!u.insertItems&&!(r&&e.insert==1)?this._setProject(l):(r&&e.parent||l)._insertItem(n,this,!0),r&&e!==E.NO_INSERT&&e!==E.INSERT&&this.set(e,{internal:!0,insert:!0,project:!0,parent:!0}),r},_serialize:function(e,t){var n={},r=this;function serialize(a){for(var c in a){var l=r[c];o.equals(l,c===`leading`?a.fontSize*1.2:a[c])||(n[c]=o.serialize(l,e,c!==`data`,t))}}return serialize(this._serializeFields),this instanceof D||serialize(this._style._defaults),[this._class,n]},_changed:function(e){var t=this._symbol,r=this._parent||t,a=this._project;e&8&&(this._bounds=this._position=this._decomposed=n),e&16&&(this._globalMatrix=n),r&&e&72&&E._clearBoundsCache(r),e&2&&E._clearBoundsCache(this),a&&a._changed(e,this),t&&t._changed(e)},getId:function(){return this._id},getName:function(){return this._name},setName:function(e){if(this._name&&this._removeNamed(),e===+e+``)throw Error(`Names consisting only of numbers are not supported.`);var t=this._getOwner();if(e&&t){var r=t._children,a=t._namedChildren;(a[e]=a[e]||[]).push(this),e in r||(r[e]=this)}this._name=e||n,this._changed(256)},getStyle:function(){return this._style},setStyle:function(e){this.getStyle().set(e)}},o.each([`locked`,`visible`,`blendMode`,`opacity`,`guide`],function(e){var t=o.capitalize(e),n=`_`+e,r={locked:256,visible:265};this[`get`+t]=function(){return this[n]},this[`set`+t]=function(t){t!=this[n]&&(this[n]=t,this._changed(r[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 n=this._selection;this.setSelection(t?n|e:n&~e)},isSelected:function(){if(this._selectChildren){for(var e=this._children,t=0,n=e.length;t<n;t++)if(e[t].isSelected())return!0}return!!(this._selection&1)},setSelected:function(e){if(this._selectChildren)for(var t=this._children,n=0,r=t.length;n<r;n++)t[n].setSelected(e);this._changeSelection(1,e)},isFullySelected:function(){var e=this._children,t=!!(this._selection&1);if(e&&t){for(var n=0,r=e.length;n<r;n++)if(!e[n].isFullySelected())return!1;return!0}return t},setFullySelected:function(e){var t=this._children;if(t)for(var n=0,r=t.length;n<r;n++)t[n].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?g:_,n=this._position||(this._position=this._getPositionFromBounds());return new t(n.x,n.y,this,`setPosition`)},setPosition:function(){this.translate(g.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 _(e.x,e.y,this,`setPivot`):null},setPivot:function(){this._pivot=g.read(arguments,0,{clone:!0,readNull:!0}),this._position=n}},o.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 n=t||e instanceof C,r=o.set({},n?t:e,this._boundsOptions);(!r.stroke||this.getStrokeScaling())&&(r.cacheItem=this);var a=this._getCachedBounds(n&&e,r).rect;return arguments.length?a:new S(a.x,a.y,a.width,a.height,this,`setBounds`)},setBounds:function(){var e=x.read(arguments),t=this.getBounds(),n=this._matrix,r=new C,a=e.getCenter();r.translate(a),(e.width!=t.width||e.height!=t.height)&&(n.isInvertible()||(n.set(n._backup||new C().translate(n.getTranslation())),t=this.getBounds()),r.scale(t.width===0?0:e.width/t.width,t.height===0?0:e.height/t.height)),a=t.getCenter(),r.translate(-a.x,-a.y),this.transform(r)},_getBounds:function(e,t){var n=this._children;return!n||!n.length?new x:(E._updateBoundsCache(this,t.cacheItem),E._getBounds(n,e,t))},_getBoundsCacheKey:function(e,t){return[e.stroke?1:0,e.handle?1:0,t?1:0].join(``)},_getCachedBounds:function(e,t,n){e&&(e=e._orNullIfIdentity());var r=t.internal&&!n,a=t.cacheItem,o=r?null:this._matrix._orNullIfIdentity(),c=a&&(!e||e.equals(o))&&this._getBoundsCacheKey(t,r),l=this._bounds;if(E._updateBoundsCache(this._parent||this._symbol,a),c&&l&&c in l){var u=l[c];return{rect:u.rect.clone(),nonscaling:u.nonscaling}}var d=this._getBounds(e||o,t),p=d.rect||d,m=this._style,h=d.nonscaling||m.hasStroke()&&!m.getStrokeScaling();if(c){l||(this._bounds=l={});var u=l[c]={rect:p.clone(),nonscaling:h,internal:r}}return{rect:p,nonscaling:h}},_getStrokeMatrix:function(e,t){var n=this.getStrokeScaling()?null:t&&t.internal?this:this._parent||this._symbol&&this._symbol._item,r=n?n.getViewMatrix().invert():e;return r&&r._shiftless()},statics:{_updateBoundsCache:function(e,t){if(e&&t){var n=t._id,r=e._boundsCache=e._boundsCache||{ids:{},list:[]};r.ids[n]||(r.list.push(t),r.ids[n]=t)}},_clearBoundsCache:function(e){var t=e._boundsCache;if(t){e._bounds=e._position=e._boundsCache=n;for(var r=0,a=t.list,o=a.length;r<o;r++){var c=a[r];c!==e&&(c._bounds=c._position=n,c._boundsCache&&E._clearBoundsCache(c))}}},_getBounds:function(e,t,n){var r=1/0,a=-r,o=r,c=a,l=!1;n||(n={});for(var u=0,d=e.length;u<d;u++){var p=e[u];if(p._visible&&!p.isEmpty(!0)){var m=p._getCachedBounds(t&&t.appended(p._matrix),n,!0),h=m.rect;r=Math.min(h.x,r),o=Math.min(h.y,o),a=Math.max(h.x+h.width,a),c=Math.max(h.y+h.height,c),m.nonscaling&&(l=!0)}}return{rect:isFinite(r)?new x(r,o,a-r,c-o):new x,nonscaling:l}}}}),{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(t!=null&&e!=null){var n=this._decomposed;this.rotate(e-t),n&&(n.rotation=e,this._decomposed=n)}},getScaling:function(){var e=this._decompose(),t=e&&e.scaling;return new _(t?t.x:1,t?t.y:1,this,`setScaling`)},setScaling:function(){var e=this.getScaling(),t=g.read(arguments,0,{clone:!0,readNull:!0});if(e&&t&&!e.equals(t)){var n=this.getRotation(),r=this._decomposed,a=new C,o=m.isZero;if(o(e.x)||o(e.y))a.translate(r.translation),n&&a.rotate(n),a.scale(t.x,t.y),this._matrix.set(a);else{var c=this.getPosition(!0);a.translate(c),n&&a.rotate(n),a.scale(t.x/e.x,t.y/e.y),n&&a.rotate(-n),a.translate(c.negate()),this.transform(a)}r&&(r.scaling=t,this._decomposed=r)}},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 n=this._parent,r=[];n;){if(!n._globalMatrix){t=null;for(var a=0,o=r.length;a<o;a++)r[a]._globalMatrix=null;break}r.push(n),n=n._parent}if(!t){t=this._globalMatrix=this._matrix.clone();var n=this._parent;n&&t.prepend(n.getGlobalMatrix(!0))}return 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 n=this._children,r=0,a=n&&n.length;r<a;r++)n[r]._setProject(e);t=!0}t&&this._installEvents(!0)},getView:function(){return this._project._view},_installEvents:function _installEvents(e){_installEvents.base.call(this,e);for(var t=this._children,n=0,r=t&&t.length;n<r;n++)t[n]._installEvents(e)},getLayer:function(){for(var e=this;e=e._parent;)if(e instanceof O)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 t=this._parent,r=t&&t._children;r&&t.insertChildren(e in r?e:n,[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 o.equals(this._children,e._children)},clone:function(e){var t=new this.constructor(E.NO_INSERT),r=this._children,a=o.pick(e?e.insert:n,e===n||e===!0),c=o.pick(e?e.deep:n,!0);r&&t.copyAttributes(this),(!r||c)&&t.copyContent(this),r||t.copyAttributes(this),a&&t.insertAbove(this);var l=this._name,u=this._parent;if(l&&u){for(var r=u._children,d=l,p=1;r[l];)l=d+` `+ p++;l!==d&&t.setName(l)}return t},copyContent:function(e){for(var t=e._children,n=0,r=t&&t.length;n<r;n++)this.addChild(t[n].clone(!1),!0)},copyAttributes:function(e,t){this.setStyle(e._style);for(var n=[`_locked`,`_visible`,`_blendMode`,`_opacity`,`_clipMask`,`_guide`],r=0,a=n.length;r<a;r++){var c=n[r];e.hasOwnProperty(c)&&(this[c]=e[c])}t||this._matrix.set(e._matrix,!0),this.setApplyMatrix(e._applyMatrix),this.setPivot(e._pivot),this.setSelection(e._selection);var l=e._data,u=e._name;this._data=l?o.clone(l):null,u&&this.setName(u)},rasterize:function(e,t){var r,a,c;o.isPlainObject(e)?(r=e.resolution,a=e.insert,c=e.raster):(r=e,a=t),c||(c=new A(E.NO_INSERT));var l=this.getStrokeBounds(),u=(r||this.getView().getResolution())/72,d=l.getTopLeft().floor(),p=new y(l.getBottomRight().ceil().subtract(d)),m=p.multiply(u);if(c.setSize(m,!0),!m.isZero()){var h=c.getContext(!0),g=new C().scale(u).translate(d.negate());h.save(),g.applyToContext(h),this.draw(h,new o({matrices:[g]})),h.restore()}return c._matrix.set(new C().translate(d.add(p.divide(2))).scale(1/u)),(a===n||a)&&c.insertAbove(this),c},contains:function(){var e=this._matrix;return e.isInvertible()&&!!this._contains(e._inverseTransform(g.read(arguments)))},_contains:function(e){var t=this._children;if(t){for(var n=t.length-1;n>=0;n--)if(t[n].contains(e))return!0;return!1}return e.isInside(this.getInternalBounds())},isInside:function(){return x.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new R.Rectangle({rectangle:this.getInternalBounds(),matrix:this._matrix,insert:!1})},intersects:function(e,t){return e instanceof E?this._asPathItem().getIntersections(e._asPathItem(),null,t,!0).length>0:!1}},new function(){function hitTest(){var e=arguments;return this._hitTest(g.read(e),N.getOptions(e))}function hitTestAll(){var e=arguments,t=g.read(e),n=N.getOptions(e),r=[];return this._hitTest(t,new o({all:r},n)),r}function hitTestChildren(e,t,n,r){var a=this._children;if(a)for(var o=a.length-1;o>=0;o--){var c=a[o],l=c!==r&&c._hitTest(e,t,n);if(l&&!t.all)return l}return null}return T.inject({hitTest,hitTestAll,_hitTest:hitTestChildren}),{hitTest,hitTestAll,_hitTestChildren:hitTestChildren}},{_hitTest:function(e,t,n){if(this._locked||!this._visible||this._guide&&!t.guides||this.isEmpty())return null;var r=this._matrix,a=n?n.appended(r):this.getGlobalMatrix().prepend(this.getView()._matrix),c=Math.max(t.tolerance,1e-12),l=t._tolerancePadding=new y(R._getStrokePadding(c,r._shiftless().invert()));if(e=r._inverseTransform(e),!e||!this._children&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(l.multiply(2))._containsPoint(e))return null;var u=!(t.guides&&!this._guide||t.selected&&!this.isSelected()||t.type&&t.type!==o.hyphenate(this._class)||t.class&&!(this instanceof t.class)),d=t.match,p=this,m,h;function filter(e){return e&&d&&!d(e)&&(e=null),e&&t.all&&t.all.push(e),e}function checkPoint(t,n){var r=n?m[`get`+n]():p.getPosition();if(e.subtract(r).divide(l).length<=1)return new N(t,p,{name:n?o.hyphenate(n):t,point:r})}var g=t.position,_=t.center,b=t.bounds;if(u&&this._parent&&(g||_||b)){if((_||b)&&(m=this.getInternalBounds()),h=g&&checkPoint(`position`)||_&&checkPoint(`center`,`Center`),!h&&b)for(var x=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`,`LeftCenter`,`TopCenter`,`RightCenter`,`BottomCenter`],S=0;S<8&&!h;S++)h=checkPoint(`bounds`,x[S]);h=filter(h)}return h||(h=this._hitTestChildren(e,t,a)||u&&filter(this._hitTestSelf(e,t,a,this.getStrokeScaling()?null:a._shiftless().invert()))||null),h&&h.point&&(h.point=r.transform(h.point)),h},_hitTestSelf:function(e,t){if(t.fill&&this.hasFill()&&this._contains(e))return new N(`fill`,this)},matches:function(e,t){function matchObject(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n],a=t[n];if(o.isPlainObject(r)&&o.isPlainObject(a)){if(!matchObject(r,a))return!1}else if(!o.equals(r,a))return!1}return!0}var n=typeof e;if(n===`object`){for(var r in e)if(e.hasOwnProperty(r)&&!this.matches(r,e[r]))return!1;return!0}else if(n===`function`)return e(this);else if(e===`match`)return t(this);else{var a=/^(empty|editable)$/.test(e)?this[`is`+o.capitalize(e)]():e===`type`?o.hyphenate(this._class):this[e];if(e===`class`){if(typeof t==`function`)return this instanceof t;a=this._class}if(typeof t==`function`)return!!t(a);if(t){if(t.test)return t.test(a);if(o.isPlainObject(t))return matchObject(t,a)}return o.equals(a,t)}},getItems:function(e){return E._getItems(this,e,this._matrix)},getItem:function(e){return E._getItems(this,e,this._matrix,null,!0)[0]||null},statics:{_getItems:function _getItems(e,t,n,r,a){if(!r){var c=typeof t==`object`&&t,l=c&&c.overlapping,u=c&&c.inside,d=l||u,p=d&&x.read([d]);r={items:[],recursive:c&&c.recursive!==!1,inside:!!u,overlapping:!!l,rect:p,path:l&&new R.Rectangle({rectangle:p,insert:!1})},c&&(t=o.filter({},t,{recursive:!0,inside:!0,overlapping:!0}))}var m=e._children,h=r.items,p=r.rect;n=p&&(n||new C);for(var g=0,_=m&&m.length;g<_;g++){var y=m[g],b=n&&n.appended(y._matrix),S=!0;if(p){var d=y.getBounds(b);if(!p.intersects(d))continue;p.contains(d)||r.overlapping&&(d.contains(p)||r.path.intersects(y,b))||(S=!1)}if(S&&y.matches(t)&&(h.push(y),a)||(r.recursive!==!1&&_getItems(y,t,b,r,a),a&&h.length>0))break}return h}}},{importJSON:function(e){var t=o.importJSON(e,this);return t===this?t:this.addChild(t)},addChild:function(e){return this.insertChild(n,e)},insertChild:function(e,t){var n=t?this.insertChildren(e,[t]):null;return n&&n[0]},addChildren:function(e){return this.insertChildren(this._children.length,e)},insertChildren:function(e,t){var n=this._children;if(n&&t&&t.length>0){t=o.slice(t);for(var r={},a=t.length-1;a>=0;a--){var c=t[a],l=c&&c._id;!c||r[l]?t.splice(a,1):(c._remove(!1,!0),r[l]=!0)}o.splice(n,t,e,0);for(var u=this._project,d=u._changes,a=0,p=t.length;a<p;a++){var c=t[a],m=c._name;c._parent=this,c._setProject(u,!0),m&&c.setName(m),d&&c._changed(5)}this._changed(11)}else t=null;return t},_insertItem:`#insertChild`,_insertAt:function(e,t){var n=e&&e._getOwner(),r=e!==this&&n?this:null;return r&&(r._remove(!1,!0),n._insertItem(e._index+t,r)),r},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(n,this):null},appendTop:`#addChild`,appendBottom:function(e){return this.insertChild(0,e)},moveAbove:`#insertAbove`,moveBelow:`#insertBelow`,addTo:function(e){return e._insertItem(n,this)},copyTo:function(e){return this.clone(!1).addTo(e)},reduce:function(e){var t=this._children;if(t&&t.length===1){var n=t[0].reduce(e);return this._parent?(n.insertAbove(this),this.remove()):n.remove(),n}return this},_removeNamed:function(){var e=this._getOwner();if(e){var t=e._children,n=e._namedChildren,r=this._name,a=n[r],o=a?a.indexOf(this):-1;o!==-1&&(t[r]==this&&delete t[r],a.splice(o,1),a.length?t[r]=a[0]:delete n[r])}},_remove:function(e,t){var n=this._getOwner(),r=this._project,a=this._index;return this._style&&this._style._dispose(),n?(this._name&&this._removeNamed(),a!=null&&(r._activeLayer===this&&(r._activeLayer=this.getNextSibling()||this.getPreviousSibling()),o.splice(n._children,null,a,1)),this._installEvents(!1),e&&r._changes&&this._changed(5),t&&n._changed(11,this),this._parent=null,!0):!1},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=o.pick(t,this._children.length);for(var n=o.splice(this._children,null,e,t-e),r=n.length-1;r>=0;r--)n[r]._remove(!0,!1);return n.length>0&&this._changed(11),n},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,n=t?t.length:0;if(e){for(var r=0;r<n;r++)if(!t[r].isEmpty(e))return!1;return!0}return!n},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 getList(e){var t=[];do t.unshift(e);while(e=e._parent);return t}for(var t=getList(this),n=getList(e),r=0,a=Math.min(t.length,n.length);r<a;r++)if(t[r]!=n[r])return t[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():!1},isAbove:function(e){return this._getOrder(e)===-1},isBelow:function(e){return this._getOrder(e)===1},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):!1},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}},o.each([`rotate`,`scale`,`shear`,`skew`],function(e){var t=e===`rotate`;this[e]=function(){var n=arguments,r=(t?o:g).read(n),a=g.read(n,0,{readNull:!0});return this.transform(new C()[e](r,a||this.getPosition(!0)))}},{translate:function(){var e=new C;return this.transform(e.translate.apply(e,arguments))},transform:function(e,t,n){var r=this._matrix,a=e&&!e.isIdentity(),o=n&&this._canApplyMatrix||this._applyMatrix&&(a||!r.isIdentity()||t&&this._children);if(!a&&!o)return this;if(a){!e.isInvertible()&&r.isInvertible()&&(r._backup=r.getValues()),r.prepend(e,!0);var c=this._style,l=c.getFillColor(!0),u=c.getStrokeColor(!0);l&&l.transform(e),u&&u.transform(e)}if(o&&(o=this._transformContent(r,t,n))){var d=this._pivot;d&&r._transformPoint(d,d,!0),r.reset(!0),n&&this._canApplyMatrix&&(this._applyMatrix=!0)}var p=this._bounds,m=this._position;(a||o)&&this._changed(25);var h=a&&p&&e.decompose();if(h&&h.skewing.isZero()&&h.rotation%90==0){for(var g in p){var _=p[g];if(_.nonscaling)delete p[g];else if(o||!_.internal){var y=_.rect;e._transformBounds(y,y)}}this._bounds=p;var b=p[this._getBoundsCacheKey(this._boundsOptions||{})];b&&(this._position=this._getPositionFromBounds(b.rect))}else a&&m&&this._pivot&&(this._position=e._transformPoint(m,m));return this},_transformContent:function(e,t,n){var r=this._children;if(r){for(var a=0,o=r.length;a<o;a++)r[a].transform(e,t,n);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(g.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(g.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(g.read(arguments))},localToParent:function(){return this._matrix._transformPoint(g.read(arguments))},fitBounds:function(e,t){e=x.read(arguments);var n=this.getBounds(),r=n.height/n.width,a=e.height/e.width,o=(t?r>a:r<a)?e.width/n.width:e.height/n.height,c=new x(new g,new y(n.width*o,n.height*o));c.setCenter(e.getCenter()),this.setBounds(c)}}),{_setStyles:function(e,t,n){var r=this._style,a=this._matrix;if(r.hasFill()&&(e.fillStyle=r.getFillColor().toCanvasStyle(e,a)),r.hasStroke()){e.strokeStyle=r.getStrokeColor().toCanvasStyle(e,a),e.lineWidth=r.getStrokeWidth();var o=r.getStrokeJoin(),c=r.getStrokeCap(),l=r.getMiterLimit();if(o&&(e.lineJoin=o),c&&(e.lineCap=c),l&&(e.miterLimit=l),X.support.nativeDash){var u=r.getDashArray(),d=r.getDashOffset();u&&u.length&&(`setLineDash`in e?(e.setLineDash(u),e.lineDashOffset=d):(e.mozDash=u,e.mozDashOffset=d))}}if(r.hasShadow()){var p=t.pixelRatio||1,m=n._shiftless().prepend(new C().scale(p,p)),h=m.transform(new g(r.getShadowBlur(),0)),_=m.transform(this.getShadowOffset());e.shadowColor=r.getShadowColor().toCanvasStyle(e),e.shadowBlur=h.getLength(),e.shadowOffsetX=_.x,e.shadowOffsetY=_.y}},draw:function(e,t,n){if(this._updateVersion=this._project._updateVersion,!(!this._visible||this._opacity===0)){var r=t.matrices,a=t.viewMatrix,o=this._matrix,c=r[r.length-1].appended(o);if(c.isInvertible()){a=a?a.appended(c):c,r.push(c),t.updateMatrix&&(this._globalMatrix=c);var l=this._blendMode,u=m.clamp(this._opacity,0,1),d=l===`normal`,p=he.nativeModes[l],h=d&&u===1||t.dontStart||t.clip||(p||d&&u<1)&&this._canComposite(),g=t.pixelRatio||1,_,y,b;if(!h){var x=this.getStrokeBounds(a);if(!x.width||!x.height){r.pop();return}b=t.offset,y=t.offset=x.getTopLeft().floor(),_=e,e=me.getContext(x.getSize().ceil().add(1).multiply(g)),g!==1&&e.scale(g,g)}e.save();var S=n?n.appended(o):this._canScaleStroke&&!this.getStrokeScaling(!0)&&a,C=!h&&t.clipItem,w=!S||C;if(h?(e.globalAlpha=u,p&&(e.globalCompositeOperation=l)):w&&e.translate(-y.x,-y.y),w&&(h?o:a).applyToContext(e),C&&t.clipItem.draw(e,t.extend({clip:!0})),S){e.setTransform(g,0,0,g,0,0);var T=t.offset;T&&e.translate(-T.x,-T.y)}this._draw(e,t,a,S),e.restore(),r.pop(),t.clip&&!t.dontFinish&&e.clip(this.getFillRule()),h||(he.process(l,e,_,u,y.subtract(b).multiply(g)),me.release(e),t.offset=b)}}},_isUpdated:function(e){var t=this._parent;if(t instanceof z)return t._isUpdated(e);var n=this._updateVersion===e;return!n&&t&&t._visible&&t._isUpdated(e)&&(this._updateVersion=e,n=!0),n},_drawSelection:function(e,t,n,r,a){var o=this._selection,c=o&1,l=o&2||c&&this._selectBounds,u=o&4;if(this._drawSelected||(c=!1),(c||l||u)&&this._isUpdated(a)){var d,p=this.getSelectedColor(!0)||(d=this.getLayer())&&d.getSelectedColor(!0),m=t.appended(this.getGlobalMatrix(!0)),h=n/2;if(e.strokeStyle=e.fillStyle=p?p.toCanvasStyle(e):`#009dec`,c&&this._drawSelected(e,m,r),u){var g=this.getPosition(!0),_=this._parent,y=_?_.localToGlobal(g):g,b=y.x,x=y.y;e.beginPath(),e.arc(b,x,h,0,Math.PI*2,!0),e.stroke();for(var S=[[0,-1],[1,0],[0,1],[-1,0]],C=h,w=n+1,T=0;T<4;T++){var E=S[T],D=E[0],O=E[1];e.moveTo(b+D*C,x+O*C),e.lineTo(b+D*w,x+O*w),e.stroke()}}if(l){var k=m._transformCorners(this.getInternalBounds());e.beginPath();for(var T=0;T<8;T++)e[T?`lineTo`:`moveTo`](k[T],k[++T]);e.closePath(),e.stroke();for(var T=0;T<8;T++)e.fillRect(k[T]-h,k[++T]-h,n,n)}}},_canComposite:function(){return!1}},o.each([`down`,`drag`,`up`,`move`],function(e){this[`removeOn`+o.capitalize(e)]=function(){var t={};return t[e]=!0,this.removeOn(t)}},{removeOn:function(e){for(var t in e)if(e[t]){var n=`mouse`+t,r=this._project,a=r._removeSets=r._removeSets||{};a[n]=a[n]||{},a[n][this._id]=this}return this}}),{tween:function(e,t,n){n||(n=t,t=e,e=null,n||(n=t,t=null));var r=n&&n.easing,a=n&&n.start,o=n!=null&&(typeof n==`number`?n:n.duration),c=new de(this,e,t,o,r,a);function onFrame(e){c._handleFrame(e.time*1e3),c.running||this.off(`frame`,onFrame)}return o&&this.on(`frame`,onFrame),c},tweenTo:function(e,t){return this.tween(null,e,t)},tweenFrom:function(e,t){return this.tween(e,null,t)}}),D=E.extend({_class:`Group`,_selectBounds:!1,_selectChildren:!0,_serializeFields:{children:[]},initialize:function Group(e){this._children=[],this._namedChildren={},this._initialize(e)||this.addChildren(Array.isArray(e)?e:arguments)},_changed:function _changed(e){_changed.base.call(this,e),e&2050&&(this._clipItem=n)},_getClipItem:function(){var e=this._clipItem;if(e===n){e=null;for(var t=this._children,r=0,a=t.length;r<a;r++)if(t[r]._clipMask){e=t[r];break}this._clipItem=e}return e},isClipped:function(){return!!this._getClipItem()},setClipped:function(e){var t=this.getFirstChild();t&&t.setClipMask(e)},_getBounds:function _getBounds(e,t){var n=this._getClipItem();return n?n._getCachedBounds(n._matrix.prepended(e),o.set({},t,{stroke:!1})):_getBounds.base.call(this,e,t)},_hitTestChildren:function _hitTestChildren(e,t,n){var r=this._getClipItem();return(!r||r.contains(e))&&_hitTestChildren.base.call(this,e,t,n,r)},_draw:function(e,t){var n=t.clip,r=!n&&this._getClipItem();t=t.extend({clipItem:r,clip:!1}),n?(e.beginPath(),t.dontStart=t.dontFinish=!0):r&&r.draw(e,t.extend({clip:!0}));for(var a=this._children,o=0,c=a.length;o<c;o++){var l=a[o];l!==r&&l.draw(e,t)}}}),O=D.extend({_class:`Layer`,initialize:function Layer(){D.apply(this,arguments)},_getOwner:function(){return this._parent||this._index!=null&&this._project},isInserted:function isInserted(){return this._parent?isInserted.base.call(this):this._index!=null},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),k=E.extend({_class:`Shape`,_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},initialize:function Shape(e,t){this._initialize(e,t)},_equals:function(e){return this._type===e._type&&this._size.equals(e._size)&&o.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 b(e.width,e.height,this,`setSize`)},setSize:function(){var e=y.read(arguments);if(!this._size)this._size=e.clone();else if(!this._size.equals(e)){var t=this._type,n=e.width,r=e.height;t===`rectangle`?this._radius.set(y.min(this._radius,e.divide(2).abs())):t===`circle`?(n=r=(n+r)/2,this._radius=n/2):t===`ellipse`&&this._radius._set(n/2,r/2),this._size._set(n,r),this._changed(9)}},getRadius:function(){var e=this._radius;return this._type===`circle`?e:new b(e.width,e.height,this,`setRadius`)},setRadius:function(e){var t=this._type;if(t===`circle`){if(e===this._radius)return;var n=e*2;this._radius=e,this._size._set(n,n)}else if(e=y.read(arguments),!this._radius)this._radius=e.clone();else{if(this._radius.equals(e))return;if(this._radius.set(e),t===`rectangle`){var n=y.max(this._size,e.multiply(2));this._size.set(n)}else t===`ellipse`&&this._size._set(e.width*2,e.height*2)}this._changed(9)},isEmpty:function(){return!1},toPath:function(e){var t=new R[o.capitalize(this._type)]({center:new g,size:this._size,radius:this._radius,insert:!1});return t.copyAttributes(this),X.settings.applyMatrix&&t.setApplyMatrix(!0),(e===n||e)&&t.insertAbove(this),t},toShape:`#clone`,_asPathItem:function(){return this.toPath(!1)},_draw:function(e,t,n,r){var a=this._style,o=a.hasFill(),c=a.hasStroke(),l=t.dontFinish||t.clip,u=!r;if(o||c||l){var d=this._type,p=this._radius,m=d===`circle`;if(t.dontStart||e.beginPath(),u&&m)e.arc(0,0,p,0,Math.PI*2,!0);else{var h=m?p:p.width,g=m?p:p.height,_=this._size,y=_.width,b=_.height;if(u&&d===`rectangle`&&h===0&&g===0)e.rect(-y/2,-b/2,y,b);else{var x=y/2,S=b/2,C=.44771525016920644,w=h*C,T=g*C,E=[-x,-S+g,-x,-S+T,-x+w,-S,-x+h,-S,x-h,-S,x-w,-S,x,-S+T,x,-S+g,x,S-g,x,S-T,x-w,S,x-h,S,-x+h,S,-x+w,S,-x,S-T,-x,S-g];r&&r.transform(E,E,32),e.moveTo(E[0],E[1]),e.bezierCurveTo(E[2],E[3],E[4],E[5],E[6],E[7]),x!==h&&e.lineTo(E[8],E[9]),e.bezierCurveTo(E[10],E[11],E[12],E[13],E[14],E[15]),S!==g&&e.lineTo(E[16],E[17]),e.bezierCurveTo(E[18],E[19],E[20],E[21],E[22],E[23]),x!==h&&e.lineTo(E[24],E[25]),e.bezierCurveTo(E[26],E[27],E[28],E[29],E[30],E[31])}}e.closePath()}!l&&(o||c)&&(this._setStyles(e,t,n),o&&(e.fill(a.getFillRule()),e.shadowColor=`rgba(0,0,0,0)`),c&&e.stroke())},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(e,t){var n=new x(this._size).setCenter(0,0),r=this._style,a=t.stroke&&r.hasStroke()&&r.getStrokeWidth();return e&&(n=e._transformBounds(n)),a?n.expand(R._getStrokePadding(a,this._getStrokeMatrix(e,t))):n}},new function(){function getCornerCenter(e,t,n){var r=e._radius;if(!r.isZero())for(var a=e._size.divide(2),o=1;o<=4;o++){var c=new g(o>1&&o<4?-1:1,o>2?-1:1),l=c.multiply(a),u=l.subtract(c.multiply(r));if(new x(n?l.add(c.multiply(n)):l,u).contains(t))return{point:u,quadrant:o}}}function isOnEllipseStroke(e,t,n,r){var a=e.divide(t);return(!r||a.isInQuadrant(r))&&a.subtract(a.normalize()).multiply(t).divide(n).length<=1}return{_contains:function _contains(e){if(this._type===`rectangle`){var t=getCornerCenter(this,e);return t?e.subtract(t.point).divide(this._radius).getLength()<=1:_contains.base.call(this,e)}else return e.divide(this.size).getLength()<=.5},_hitTestSelf:function _hitTestSelf(e,t,n,r){var a=!1,o=this._style,c=t.stroke&&o.hasStroke(),l=t.fill&&o.hasFill();if(c||l){var u=this._type,d=this._radius,p=c?o.getStrokeWidth()/2:0,m=t._tolerancePadding.add(R._getStrokePadding(p,!o.getStrokeScaling()&&r));if(u===`rectangle`){var h=m.multiply(2),g=getCornerCenter(this,e,h);if(g)a=isOnEllipseStroke(e.subtract(g.point),d,m,g.quadrant);else{var _=new x(this._size).setCenter(0,0),y=_.expand(h),b=_.expand(h.negate());a=y._containsPoint(e)&&!b._containsPoint(e)}}else a=isOnEllipseStroke(e,d,m)}return a?new N(c?`stroke`:`fill`,this):_hitTestSelf.base.apply(this,arguments)}}},{statics:new function(){function createShape(e,t,n,r,a){var c=o.create(k.prototype);return c._type=e,c._size=n,c._radius=r,c._initialize(o.getNamed(a),t),c}return{Circle:function(){var e=arguments,t=g.readNamed(e,`center`),n=o.readNamed(e,`radius`);return createShape(`circle`,t,new y(n*2),n,e)},Rectangle:function(){var e=arguments,t=x.readNamed(e,`rectangle`),n=y.min(y.readNamed(e,`radius`),t.getSize(!0).divide(2));return createShape(`rectangle`,t.getCenter(!0),t.getSize(!0),n,e)},Ellipse:function(){var e=arguments,t=k._readEllipse(e),n=t.radius;return createShape(`ellipse`,t.center,n.multiply(2),n,e)},_readEllipse:function(e){var t,n;if(o.hasNamed(e,`radius`))t=g.readNamed(e,`center`),n=y.readNamed(e,`radius`);else{var r=x.readNamed(e,`rectangle`);t=r.getCenter(!0),n=r.getSize(!0).divide(2)}return{center:t,radius:n}}}}}),A=E.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 Raster(e,t){if(!this._initialize(e,t!==n&&g.read(arguments))){var r,o=typeof e,c=o===`string`?a.getElementById(e):o===`object`?e:null;if(c&&c!==E.NO_INSERT){if(c.getContext||c.naturalHeight!=null)r=c;else if(c){var l=y.read(arguments);l.isZero()||(r=me.getCanvas(l))}}r?this.setImage(r):this.setSource(e)}this._size||(this._size=new y,this._loaded=!1)},_equals:function(e){return this.getSource()===e.getSource()},copyContent:function(e){var t=e._image,n=e._canvas;if(t)this._setImage(t);else if(n){var r=me.getCanvas(e._size);r.getContext(`2d`).drawImage(n,0,0),this._setImage(r)}this._crossOrigin=e._crossOrigin},getSize:function(){var e=this._size;return new b(e?e.width:0,e?e.height:0,this,`setSize`)},setSize:function(e,t){var n=y.read(arguments);if(n.equals(this._size))t&&this.clear();else if(n.width>0&&n.height>0){var r=!t&&this.getElement();this._setImage(me.getCanvas(n)),r&&this.getContext(!0).drawImage(r,0,0,n.width,n.height)}else this._canvas&&me.release(this._canvas),this._size=n.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||e.width===0&&e.height===0},getResolution:function(){var e=this._matrix,t=new g(0,0).transform(e),n=new g(1,0).transform(e).subtract(t),r=new g(0,1).transform(e).subtract(t);return new y(72/n.getLength(),72/r.getLength())},getPpi:`#getResolution`,getImage:function(){return this._image},setImage:function(e){var t=this;function emit(e){var n=t.getView(),r=e&&e.type||`load`;n&&t.responds(r)&&(X=n._scope,t.emit(r,new oe(e)))}this._setImage(e),this._loaded?setTimeout(emit,0):e&&ae.add(e,{load:function(n){t._setImage(e),emit(n)},error:emit})},_setImage:function(e){this._canvas&&me.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 y(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=me.getContext(this._size);try{this._image&&e.drawImage(this._image,0,0),this._canvas=e.canvas}catch{me.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 n=new e.Image,r=this._crossOrigin;r&&(n.crossOrigin=r),t&&(n.src=t),this.setImage(n)},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=typeof e==`string`?e:e?`low`:`off`,this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var e=x.read(arguments),t=me.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=x.read(arguments),t=new A(E.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 n=this.getCanvas();return n?n.toDataURL.apply(n,arguments):null},drawImage:function(e){var t=g.read(arguments,1);this.getContext(!0).drawImage(e,t.x,t.y)},getAverageColor:function(e){var t,n;if(e?e instanceof ee?(n=e,t=e.getBounds()):typeof e==`object`&&(`width`in e?t=new x(e):`x`in e&&(t=new x(e.x-.5,e.y-.5,1,1))):t=this.getBounds(),!t)return null;var r=32,a=Math.min(t.width,r),c=Math.min(t.height,r),l=A._sampleContext;l?l.clearRect(0,0,r+1,r+1):l=A._sampleContext=me.getContext(new y(r)),l.save();var u=new C().scale(a/t.width,c/t.height).translate(-t.x,-t.y);u.applyToContext(l),n&&n.draw(l,new o({clip:!0,matrices:[u]})),this._matrix.applyToContext(l);var d=this.getElement(),p=this._size;d&&l.drawImage(d,-p.width/2,-p.height/2),l.restore();for(var m=l.getImageData(.5,.5,Math.ceil(a),Math.ceil(c)).data,h=[0,0,0],g=0,_=0,b=m.length;_<b;_+=4){var S=m[_+3];g+=S,S/=255,h[0]+=m[_]*S,h[1]+=m[_+1]*S,h[2]+=m[_+2]*S}for(var _=0;_<3;_++)h[_]/=g;return g?te.read(h):null},getPixel:function(){var e=g.read(arguments),t=this.getContext().getImageData(e.x,e.y,1,1).data;return new te(`rgb`,[t[0]/255,t[1]/255,t[2]/255],t[3]/255)},setPixel:function(){var e=arguments,t=g.read(e),n=te.read(e),r=n._convert(`rgb`),a=n._alpha,o=this.getContext(!0),c=o.createImageData(1,1),l=c.data;l[0]=r[0]*255,l[1]=r[1]*255,l[2]=r[2]*255,l[3]=a==null?255:a*255,o.putImageData(c,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=y.read(arguments);return this.getContext().createImageData(e.width,e.height)},getImageData:function(){var e=x.read(arguments);return e.isEmpty()&&(e=new x(this._size)),this.getContext().getImageData(e.x,e.y,e.width,e.height)},putImageData:function(e){var t=g.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 n=new x(this._size).setCenter(0,0);return e?e._transformBounds(n):n},_hitTestSelf:function(e){if(this._contains(e)){var t=this;return new N(`pixel`,t,{offset:e.add(t._size.divide(2)).round(),color:{get:function(){return t.getPixel(this.offset)}}})}},_draw:function(e,t,n){var r=this.getElement();if(r&&r.width>0&&r.height>0){e.globalAlpha=m.clamp(this._opacity,0,1),this._setStyles(e,t,n);var a=this._smoothing,o=a===`off`;ie.setPrefixed(e,o?`imageSmoothingEnabled`:`imageSmoothingQuality`,o?!1:a),e.drawImage(r,-this._size.width/2,-this._size.height/2)}},_canComposite:function(){return!0}}),j=E.extend({_class:`SymbolItem`,_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function SymbolItem(e,t){this._initialize(e,t!==n&&g.read(arguments,1))||this.setDefinition(e instanceof M?e:new M(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 n=this._definition._item;return n._getCachedBounds(n._matrix.prepended(e),t)},_hitTestSelf:function(e,t,n){var r=t.extend({all:!1}),a=this._definition._item._hitTest(e,r,n);return a&&(a.item=this),a},_draw:function(e,t){this._definition._item.draw(e,t)}}),M=o.extend({_class:`SymbolDefinition`,initialize:function SymbolDefinition(e,t){this._id=h.get(),this.project=X.project,e&&this.setItem(e,t)},_serialize:function(e,t){return t.add(this,function(){return o.serialize([this._class,this._item],e,!1,t)})},_changed:function(e){e&8&&E._clearBoundsCache(this),e&1&&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 g),e._symbol=this,this._changed(9)},getDefinition:`#getItem`,setDefinition:`#setItem`,place:function(e){return new j(this,e)},clone:function(){return new M(this._item.clone(!1))},equals:function(e){return e===this||e&&this._item.equals(e._item)||!1}}),N=o.extend({_class:`HitResult`,initialize:function HitResult(e,t,n){this.type=e,this.item=t,n&&this.inject(n)},statics:{getOptions:function(e){var t=e&&o.read(e);return new o({type:null,tolerance:X.settings.hitTolerance,fill:!t,stroke:!t,segments:!t,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},t)}}}),P=o.extend({_class:`Segment`,beans:!0,_selection:0,initialize:function Segment(e,t,r,a,o,c){var l=arguments.length,u,d,p,m;l>0&&(e==null||typeof e==`object`?l===1&&e&&`point`in e?(u=e.point,d=e.handleIn,p=e.handleOut,m=e.selection):(u=e,d=t,p=r,m=a):(u=[e,t],d=r===n?null:[r,a],p=o===n?null:[o,c])),new F(u,this,`_point`),new F(d,this,`_handleIn`),new F(p,this,`_handleOut`),m&&this.setSelection(m)},_serialize:function(e,t){var n=this._point,r=this._selection,a=r||this.hasHandles()?[n,this._handleIn,this._handleOut]:n;return r&&a.push(r),o.serialize(a,e,!0,t)},_changed:function(e){var t=this._path;if(t){var n=t._curves,r=this._index,a;n&&((!e||e===this._point||e===this._handleIn)&&(a=r>0?n[r-1]:t._closed?n[n.length-1]:null)&&a._changed(),(!e||e===this._point||e===this._handleOut)&&(a=n[r])&&a._changed()),t._changed(41)}},getPoint:function(){return this._point},setPoint:function(){this._point.set(g.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(g.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(g.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,n=this._path;this._selection=e||(e=0),n&&e!==t&&(n._updateSelection(this,t,e),n._changed(257))},_changeSelection:function(e,t){var n=this._selection;this.setSelection(t?n|e:n&~e)},isSelected:function(){return!!(this._selection&7)},setSelected:function(e){this._changeSelection(7,e)},getIndex:function(){return this._index===n?null:this._index},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 L(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,t,r){var a=e||{},o=a.type,c=a.factor,l=this.getPrevious(),u=this.getNext(),d=(l||this)._point,p=this._point,m=(u||this)._point,h=d.getDistance(p),_=p.getDistance(m);if(!o||o===`catmull-rom`){var y=c===n?.5:c,b=h**+y,x=b*b,S=_**+y,C=S*S;if(!t&&l){var w=2*C+3*S*b+x,T=3*S*(S+b);this.setHandleIn(T===0?new g:new g((C*d._x+w*p._x-x*m._x)/T-p._x,(C*d._y+w*p._y-x*m._y)/T-p._y))}if(!r&&u){var w=2*x+3*b*S+C,T=3*b*(b+S);this.setHandleOut(T===0?new g:new g((x*m._x+w*p._x-C*d._x)/T-p._x,(x*m._y+w*p._y-C*d._y)/T-p._y))}}else if(o===`geometric`){if(l&&u){var E=d.subtract(m),D=c===n?.4:c,O=D*h/(h+_);t||this.setHandleIn(E.multiply(O)),r||this.setHandleOut(E.multiply(O-D))}}else throw Error(`Smoothing method '`+o+`' not supported.`)},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,n=e.clone();e.set(t),t.set(n)},reversed:function(){return new P(this._point,this._handleOut,this._handleIn)},remove:function(){return this._path?!!this._path.removeSegment(this._index):!1},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,[,,,,,,],!0),this._changed()},interpolate:function(e,t,n){var r=1-n,a=n,o=e._point,c=t._point,l=e._handleIn,u=t._handleIn,d=t._handleOut,p=e._handleOut;this._point._set(r*o._x+a*c._x,r*o._y+a*c._y,!0),this._handleIn._set(r*l._x+a*u._x,r*l._y+a*u._y,!0),this._handleOut._set(r*p._x+a*d._x,r*p._y+a*d._y,!0),this._changed()},_transformCoordinates:function(e,t,n){var r=this._point,a=!n||!this._handleIn.isZero()?this._handleIn:null,o=!n||!this._handleOut.isZero()?this._handleOut:null,c=r._x,l=r._y,u=2;return t[0]=c,t[1]=l,a&&(t[u++]=a._x+c,t[u++]=a._y+l),o&&(t[u++]=o._x+c,t[u++]=o._y+l),e&&(e._transformCoordinates(t,t,u/2),c=t[0],l=t[1],n?(r._x=c,r._y=l,u=2,a&&(a._x=t[u++]-c,a._y=t[u++]-l),o&&(o._x=t[u++]-c,o._y=t[u++]-l)):(a||(t[u++]=c,t[u++]=l),o||(t[u++]=c,t[u++]=l))),t}}),F=g.extend({initialize:function SegmentPoint(e,t,r){var a,o,c;if(!e)a=o=0;else if((a=e[0])!==n)o=e[1];else{var l=e;(a=l.x)===n&&(l=g.read(arguments),a=l.x),o=l.y,c=l.selected}this._x=a,this._y=o,this._owner=t,t[r]=this,c&&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=m.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=o.extend({_class:`Curve`,beans:!0,initialize:function Curve(e,t,n,r,a,o,c,l){var u=arguments.length,d,p,m,h,g,_;u===3?(this._path=e,d=t,p=n):u?u===1?`segment1`in e?(d=new P(e.segment1),p=new P(e.segment2)):`point1`in e?(m=e.point1,g=e.handle1,_=e.handle2,h=e.point2):Array.isArray(e)&&(m=[e[0],e[1]],h=[e[6],e[7]],g=[e[2]-e[0],e[3]-e[1]],_=[e[4]-e[6],e[5]-e[7]]):u===2?(d=new P(e),p=new P(t)):u===4?(m=e,g=t,_=n,h=r):u===8&&(m=[e,t],h=[c,l],g=[n-e,r-t],_=[a-c,o-l]):(d=new P,p=new P),this._segment1=d||new P(m,null,g),this._segment2=p||new P(h,_,null)},_serialize:function(e,t){return o.serialize(this.hasHandles()?[this.getPoint1(),this.getHandle1(),this.getHandle2(),this.getPoint2()]:[this.getPoint1(),this.getPoint2()],e,!0,t)},_changed:function(){this._length=this._bounds=n},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,n=t._handleOut;e=t.remove(),e&&this._segment1._handleOut.set(n)}return e},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(g.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(g.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(g.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(g.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=[],n=0;n<8;n+=2)t.push(new g(e[n],e[n+1]));return t}},{getLength:function(){return this._length??(this._length=I.getLength(this.getValues(),0,1)),this._length},getArea:function(){return I.getArea(this.getValues())},getLine:function(){return new w(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 n=1e-8,r=1-n,a=null;if(e>=n&&e<=r){var o=I.subdivide(this.getValues(),e),c=o[0],l=o[1],u=t||this.hasHandles(),d=this._segment1,p=this._segment2,m=this._path;u&&(d._handleOut._set(c[2]-c[0],c[3]-c[1]),p._handleIn._set(l[4]-l[6],l[5]-l[7]));var h=c[6],_=c[7],y=new P(new g(h,_),u&&new g(c[4]-h,c[5]-_),u&&new g(l[2]-h,l[3]-_));m?(m.insert(d._index+1,y),a=this.getNext()):(this._segment2=y,this._changed(),a=new I(y,p))}return a},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,t){return this.divideAtTime(e===n?.5:t?e:this.getTimeAt(e))},split:function(e,t){return this.splitAtTime(e===n?.5:t?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,n,r){var a=e._point,o=e._handleOut,c=t._handleIn,l=t._point,u=a.x,d=a.y,p=l.x,m=l.y,h=r?[u,d,u,d,p,m,p,m]:[u,d,u+o._x,d+o._y,p+c._x,m+c._y,p,m];return n&&n._transformCoordinates(h,h,4),h},subdivide:function(e,t){var r=e[0],a=e[1],o=e[2],c=e[3],l=e[4],u=e[5],d=e[6],p=e[7];t===n&&(t=.5);var m=1-t,h=m*r+t*o,g=m*a+t*c,_=m*o+t*l,y=m*c+t*u,b=m*l+t*d,x=m*u+t*p,S=m*h+t*_,C=m*g+t*y,w=m*_+t*b,T=m*y+t*x,E=m*S+t*w,D=m*C+t*T;return[[r,a,h,g,S,C,E,D],[E,D,w,T,b,x,d,p]]},getMonoCurves:function(e,t){var n=[],r=t?0:1,a=e[r+0],o=e[r+2],c=e[r+4],l=e[r+6];if(a>=o==o>=c&&o>=c==c>=l||I.isStraight(e))n.push(e);else{var u=3*(o-c)-a+l,d=2*(a+c)-4*o,p=o-a,h=1e-8,g=1-h,_=[],y=m.solveQuadratic(u,d,p,_,h,g);if(!y)n.push(e);else{_.sort();var b=_[0],x=I.subdivide(e,b);n.push(x[0]),y>1&&(b=(_[1]-b)/(1-b),x=I.subdivide(x[1],b),n.push(x[0])),n.push(x[1])}}return n},solveCubic:function(e,t,n,r,a,o){var c=e[t],l=e[t+2],u=e[t+4],d=e[t+6],p=0;if(!(c<n&&d<n&&l<n&&u<n||c>n&&d>n&&l>n&&u>n)){var h=3*(l-c),g=3*(u-l)-h,_=d-c-h-g;p=m.solveCubic(_,g,h,c-n,r,a,o)}return p},getTimeOf:function(e,t){var n=new g(e[0],e[1]),r=new g(e[6],e[7]),a=1e-12,o=1e-7;if((t.isClose(n,a)?0:t.isClose(r,a)?1:null)===null)for(var c=[t.x,t.y],l=[],u=0;u<2;u++)for(var d=I.solveCubic(e,u,c[u],l,0,1),p=0;p<d;p++){var m=l[p];if(t.isClose(I.getPoint(e,m),o))return m}return t.isClose(n,o)?0:t.isClose(r,o)?1:null},getNearestTime:function(e,t){if(I.isStraight(e)){var n=e[0],r=e[1],a=e[6],o=e[7],c=a-n,l=o-r,u=c*c+l*l;if(u===0)return 0;var d=((t.x-n)*c+(t.y-r)*l)/u;return d<1e-12?0:d>.999999999999?1:I.getTimeOf(e,new g(n+d*c,r+d*l))}var p=100,m=1/0,h=0;function refine(n){if(n>=0&&n<=1){var r=t.getDistance(I.getPoint(e,n),!0);if(r<m)return m=r,h=n,!0}}for(var _=0;_<=p;_++)refine(_/p);for(var y=1/(p*2);y>1e-8;)!refine(h-y)&&!refine(h+y)&&(y/=2);return h},getPart:function(e,t,n){var r=t>n;if(r){var a=t;t=n,n=a}return t>0&&(e=I.subdivide(e,t)[1]),n<1&&(e=I.subdivide(e,(n-t)/(1-t))[0]),r?[e[6],e[7],e[4],e[5],e[2],e[3],e[0],e[1]]:e},isFlatEnough:function(e,t){var n=e[0],r=e[1],a=e[2],o=e[3],c=e[4],l=e[5],u=e[6],d=e[7],p=3*a-2*n-u,m=3*o-2*r-d,h=3*c-2*u-n,g=3*l-2*d-r;return Math.max(p*p,h*h)+Math.max(m*m,g*g)<=16*t*t},getArea:function(e){var t=e[0],n=e[1],r=e[2],a=e[3],o=e[4],c=e[5],l=e[6],u=e[7];return 3*((u-n)*(r+o)-(l-t)*(a+c)+a*(t-o)-r*(n-c)+u*(o+t/3)-l*(c+n/3))/20},getBounds:function(e){for(var t=e.slice(0,2),n=t.slice(),r=[0,0],a=0;a<2;a++)I._addBounds(e[a],e[a+2],e[a+4],e[a+6],a,0,t,n,r);return new x(t[0],t[1],n[0]-t[0],n[1]-t[1])},_addBounds:function(e,t,n,r,a,o,c,l,u){function add(e,t){var n=e-t,r=e+t;n<c[a]&&(c[a]=n),r>l[a]&&(l[a]=r)}o/=2;var d=c[a]+o,p=l[a]-o;if(e<d||t<d||n<d||r<d||e>p||t>p||n>p||r>p)if(t<e!=t<r&&n<e!=n<r)add(e,0),add(r,0);else{var h=3*(t-n)-e+r,g=2*(e+n)-4*t,_=t-e,y=m.solveQuadratic(h,g,_,u),b=1e-8,x=1-b;add(r,0);for(var S=0;S<y;S++){var C=u[S],w=1-C;b<=C&&C<=x&&add(w*w*w*e+3*w*w*C*t+3*w*C*C*n+C*C*C*r,o)}}}}},o.each([`getBounds`,`getStrokeBounds`,`getHandleBounds`],function(e){this[e]=function(){this._bounds||(this._bounds={});var t=this._bounds[e];return t||(t=this._bounds[e]=R[e]([this._segment1,this._segment2],!1,this._path)),t.clone()}},{}),o.each({isStraight:function(e,t,n,r){if(t.isZero()&&n.isZero())return!0;var a=r.subtract(e);if(a.isZero())return!1;if(a.isCollinear(t)&&a.isCollinear(n)){var o=new w(e,r),c=1e-7;if(o.getDistance(e.add(t))<c&&o.getDistance(r.add(n))<c){var l=a.dot(a),u=a.dot(t)/l,d=a.dot(n)/l;return u>=0&&u<=1&&d<=0&&d>=-1}}return!1},isLinear:function(e,t,n,r){var a=r.subtract(e).divide(3);return t.equals(a)&&n.negate().equals(a)}},function(e,t){this[t]=function(t){var n=this._segment1,r=this._segment2;return e(n._point,n._handleOut,r._handleIn,r._point,t)},this.statics[t]=function(t,n){var r=t[0],a=t[1],o=t[6],c=t[7];return e(new g(r,a),new g(t[2]-r,t[3]-a),new g(t[4]-o,t[5]-c),new g(o,c),n)}},{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 e!=null&&e>=0&&e<=1?new L(this,e):null},getTimeAt:function(e,t){return I.getTimeAt(this.getValues(),e,t)},getParameterAt:`#getTimeAt`,getTimesWithTangent:function(){var e=g.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(g.read(arguments)))},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getTimeOf:function(){return I.getTimeOf(this.getValues(),g.read(arguments))},getParameterOf:`#getTimeOf`,getNearestLocation:function(){var e=g.read(arguments),t=this.getValues(),n=I.getNearestTime(t,e),r=I.getPoint(t,n);return new L(this,n,r,null,e.getDistance(r))},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e&&e.getPoint()}},new function(){var e=[`getPoint`,`getTangent`,`getNormal`,`getWeightedTangent`,`getWeightedNormal`,`getCurvature`];return o.each(e,function(e){this[e+`At`]=function(t,n){var r=this.getValues();return I[e](r,n?t:I.getTimeAt(r,t))},this[e+`AtTime`]=function(t){return I[e](this.getValues(),t)}},{statics:{_evaluateMethods:e}})},new function(){function getLengthIntegrand(e){var t=e[0],n=e[1],r=e[2],a=e[3],o=e[4],c=e[5],l=e[6],u=e[7],d=9*(r-o)+3*(l-t),p=6*(t+o)-12*r,m=3*(r-t),h=9*(a-c)+3*(u-n),g=6*(n+c)-12*a,_=3*(a-n);return function(e){var t=(d*e+p)*e+m,n=(h*e+g)*e+_;return Math.sqrt(t*t+n*n)}}function getIterations(e,t){return Math.max(2,Math.min(16,Math.ceil(Math.abs(t-e)*32)))}function evaluate(e,t,n,r){if(t==null||t<0||t>1)return null;var a=e[0],o=e[1],c=e[2],l=e[3],u=e[4],d=e[5],p=e[6],h=e[7],_=m.isZero;_(c-a)&&_(l-o)&&(c=a,l=o),_(u-p)&&_(d-h)&&(u=p,d=h);var y=3*(c-a),b=3*(u-c)-y,x=p-a-y-b,S=3*(l-o),C=3*(d-l)-S,w=h-o-S-C,T,E;if(n===0)T=t===0?a:t===1?p:((x*t+b)*t+y)*t+a,E=t===0?o:t===1?h:((w*t+C)*t+S)*t+o;else{var D=1e-8,O=1-D;if(t<D?(T=y,E=S):t>O?(T=3*(p-u),E=3*(h-d)):(T=(3*x*t+2*b)*t+y,E=(3*w*t+2*C)*t+S),r){T===0&&E===0&&(t<D||t>O)&&(T=u-c,E=d-l);var k=Math.sqrt(T*T+E*E);k&&(T/=k,E/=k)}if(n===3){var u=6*x*t+2*b,d=6*w*t+2*C,A=(T*T+E*E)**(3/2);T=A===0?0:(T*d-E*u)/A,E=0}}return n===2?new g(E,-T):new g(T,E)}return{statics:{classify:function(e){var t=e[0],r=e[1],a=e[2],o=e[3],c=e[4],l=e[5],u=e[6],d=e[7],p=t*(d-l)+r*(c-u)+u*l-d*c,h=a*(r-d)+o*(u-t)+t*d-r*u,g=3*(c*(o-r)+l*(t-a)+a*r-o*t),_=g-h,y=_-h+p,b=Math.sqrt(y*y+_*_+g*g),x=b===0?0:1/b,S=m.isZero,C=`serpentine`;y*=x,_*=x,g*=x;function type(e,t,r){var a=t!==n,o=a&&t>0&&t<1,c=a&&r>0&&r<1;return a&&(!(o||c)||e===`loop`&&!(o&&c))&&(e=`arch`,o=c=!1),{type:e,roots:o||c?o&&c?t<r?[t,r]:[r,t]:[o?t:r]:null}}if(S(y))return S(_)?type(S(g)?`line`:`quadratic`):type(C,g/(3*_));var w=3*_*_-4*y*g;if(S(w))return type(`cusp`,_/(2*y));var T=w>0?Math.sqrt(w/3):Math.sqrt(-w),E=2*y;return type(w>0?C:`loop`,(_+T)/E,(_-T)/E)},getLength:function(e,t,r,a){if(t===n&&(t=0),r===n&&(r=1),I.isStraight(e)){var o=e;r<1&&(o=I.subdivide(o,r)[0],t/=r),t>0&&(o=I.subdivide(o,t)[1]);var c=o[6]-o[0],l=o[7]-o[1];return Math.sqrt(c*c+l*l)}return m.integrate(a||getLengthIntegrand(e),t,r,getIterations(t,r))},getTimeAt:function(e,t,r){if(r===n&&(r=t<0?1:0),t===0)return r;var a=Math.abs,o=1e-12,c=t>0,l=c?r:0,u=c?1:r,d=getLengthIntegrand(e),p=I.getLength(e,l,u,d),h=a(t)-p;if(a(h)<o)return c?u:l;if(h>o)return null;var g=t/p,_=0;function f(e){return _+=m.integrate(d,r,e,getIterations(r,e)),r=e,_-t}return m.findRoot(f,d,r+g,l,u,32,1e-12)},getPoint:function(e,t){return evaluate(e,t,0,!1)},getTangent:function(e,t){return evaluate(e,t,1,!0)},getWeightedTangent:function(e,t){return evaluate(e,t,1,!1)},getNormal:function(e,t){return evaluate(e,t,2,!0)},getWeightedNormal:function(e,t){return evaluate(e,t,2,!1)},getCurvature:function(e,t){return evaluate(e,t,3,!1).x},getPeaks:function(e){var t=e[0],n=e[1],r=e[2],a=e[3],o=e[4],c=e[5],l=e[6],u=e[7],d=-t+3*r-3*o+l,p=3*t-6*r+3*o,h=-3*t+3*r,g=-n+3*a-3*c+u,_=3*n-6*a+3*c,y=-3*n+3*a,b=1e-8,x=1-b,S=[];return m.solveCubic(9*(d*d+g*g),9*(d*p+_*g),2*(p*p+_*_)+3*(h*d+y*g),h*p+_*y,S,b,x),S.sort()}}}},new function(){function addLocation(e,t,n,r,a,o,c){var l=!c&&n.getPrevious()===a,u=!c&&n!==a&&n.getNext()===a,d=1e-8,p=1-d;if(r!==null&&r>=(l?d:0)&&r<=(u?p:1)&&o!==null&&o>=(u?d:0)&&o<=(l?p:1)){var m=new L(n,r,null,c),h=new L(a,o,null,c);m._intersection=h,h._intersection=m,(!t||t(m))&&L.insert(e,m,!0)}}function addCurveIntersections(e,t,n,r,a,o,c,l,u,d,p,m,h){if(++u>=4096||++l>=40)return u;var g=1e-9,_=t[0],y=t[1],b=t[6],x=t[7],S=w.getSignedDistance,C=S(_,y,b,x,t[2],t[3]),T=S(_,y,b,x,t[4],t[5]),E=C*T>0?3/4:4/9,D=E*Math.min(0,C,T),O=E*Math.max(0,C,T),k=S(_,y,b,x,e[0],e[1]),A=S(_,y,b,x,e[2],e[3]),j=S(_,y,b,x,e[4],e[5]),M=S(_,y,b,x,e[6],e[7]),N=getConvexHull(k,A,j,M),P=N[0],F=N[1],L,ee;if(C===0&&T===0&&k===0&&A===0&&j===0&&M===0||(L=clipConvexHull(P,F,D,O))==null||(ee=clipConvexHull(P.reverse(),F.reverse(),D,O))==null)return u;var R=d+(p-d)*L,z=d+(p-d)*ee;if(Math.max(h-m,z-R)<g){var B=(R+z)/2,V=(m+h)/2;addLocation(a,o,c?r:n,c?V:B,c?n:r,c?B:V)}else{e=I.getPart(e,L,ee);var H=h-m;if(ee-L>.8)if(z-R>H){var U=I.subdivide(e,.5),B=(R+z)/2;u=addCurveIntersections(t,U[0],r,n,a,o,!c,l,u,m,h,R,B),u=addCurveIntersections(t,U[1],r,n,a,o,!c,l,u,m,h,B,z)}else{var U=I.subdivide(t,.5),V=(m+h)/2;u=addCurveIntersections(U[0],e,r,n,a,o,!c,l,u,m,V,R,z),u=addCurveIntersections(U[1],e,r,n,a,o,!c,l,u,V,h,R,z)}else u=H===0||H>=g?addCurveIntersections(t,e,r,n,a,o,!c,l,u,m,h,R,z):addCurveIntersections(e,t,n,r,a,o,c,l,u,R,z,m,h)}return u}function getConvexHull(e,t,n,r){var a=[0,e],o=[1/3,t],c=[2/3,n],l=[1,r],u=t-(2*e+r)/3,d=n-(e+2*r)/3,p;if(u*d<0)p=[[a,o,l],[a,c,l]];else{var m=u/d;p=[m>=2?[a,o,l]:m<=.5?[a,c,l]:[a,o,c,l],[a,l]]}return(u||d)<0?p.reverse():p}function clipConvexHull(e,t,n,r){return e[0][1]<n?clipConvexHullPart(e,!0,n):t[0][1]>r?clipConvexHullPart(t,!1,r):e[0][0]}function clipConvexHullPart(e,t,n){for(var r=e[0][0],a=e[0][1],o=1,c=e.length;o<c;o++){var l=e[o][0],u=e[o][1];if(t?u>=n:u<=n)return u===n?l:r+(n-a)*(l-r)/(u-a);r=l,a=u}return null}function getCurveLineIntersections(e,t,n,r,a){var o=m.isZero;if(o(r)&&o(a)){var c=I.getTimeOf(e,new g(t,n));return c===null?[]:[c]}for(var l=Math.atan2(-a,r),u=Math.sin(l),d=Math.cos(l),p=[],h=[],_=0;_<8;_+=2){var y=e[_]-t,b=e[_+1]-n;p.push(y*d-b*u,y*u+b*d)}return I.solveCubic(p,1,0,h,0,1),h}function addCurveLineIntersections(e,t,n,r,a,o,c){for(var l=t[0],u=t[1],d=t[6],p=t[7],m=getCurveLineIntersections(e,l,u,d-l,p-u),h=0,g=m.length;h<g;h++){var _=m[h],y=I.getPoint(e,_),b=I.getTimeOf(t,y);b!==null&&addLocation(a,o,c?r:n,c?b:_,c?n:r,c?_:b)}}function addLineIntersection(e,t,n,r,a,o){var c=w.intersect(e[0],e[1],e[6],e[7],t[0],t[1],t[6],t[7]);c&&addLocation(a,o,n,I.getTimeOf(e,c),r,I.getTimeOf(t,c))}function getCurveIntersections(e,t,n,r,a,o){var c=1e-12,l=Math.min,u=Math.max;if(u(e[0],e[2],e[4],e[6])+c>l(t[0],t[2],t[4],t[6])&&l(e[0],e[2],e[4],e[6])-c<u(t[0],t[2],t[4],t[6])&&u(e[1],e[3],e[5],e[7])+c>l(t[1],t[3],t[5],t[7])&&l(e[1],e[3],e[5],e[7])-c<u(t[1],t[3],t[5],t[7])){var d=getOverlaps(e,t);if(d)for(var p=0;p<2;p++){var m=d[p];addLocation(a,o,n,m[0],r,m[1],!0)}else{var h=I.isStraight(e),_=I.isStraight(t),y=h&&_,b=h&&!_,x=a.length;if((y?addLineIntersection:h||_?addCurveLineIntersections:addCurveIntersections)(b?t:e,b?e:t,b?r:n,b?n:r,a,o,b,0,0,0,1,0,1),!y||a.length===x)for(var p=0;p<4;p++){var S=p>>1,C=p&1,w=S*6,T=C*6,E=new g(e[w],e[w+1]),D=new g(t[T],t[T+1]);E.isClose(D,c)&&addLocation(a,o,n,S,r,C)}}}return a}function getSelfIntersection(e,t,n,r){var a=I.classify(e);if(a.type===`loop`){var o=a.roots;addLocation(n,r,t,o[0],t,o[1])}return n}function getIntersections(e,t,n,r,a,o){var c=1e-7,l=!t;l&&(t=e);for(var u=e.length,p=t.length,m=Array(u),h=l?m:Array(p),g=[],_=0;_<u;_++)m[_]=e[_].getValues(r);if(!l)for(var _=0;_<p;_++)h[_]=t[_].getValues(a);for(var y=d.findCurveBoundsCollisions(m,h,c),b=0;b<u;b++){var x=e[b],S=m[b];l&&getSelfIntersection(S,x,g,n);var C=y[b];if(C)for(var w=0;w<C.length;w++){if(o&&g.length)return g;var T=C[w];if(!l||T>b){var E=t[T],D=h[T];getCurveIntersections(S,D,x,E,g,n)}}}return g}function getOverlaps(e,t){function getSquaredLineLength(e){var t=e[6]-e[0],n=e[7]-e[1];return t*t+n*n}var n=Math.abs,r=w.getDistance,a=1e-8,o=1e-7,c=I.isStraight(e),l=I.isStraight(t),u=c&&l,d=getSquaredLineLength(e)<getSquaredLineLength(t),p=d?t:e,m=d?e:t,h=p[0],_=p[1],y=p[6]-h,b=p[7]-_;if(r(h,_,y,b,m[0],m[1],!0)<o&&r(h,_,y,b,m[6],m[7],!0)<o)!u&&r(h,_,y,b,p[2],p[3],!0)<o&&r(h,_,y,b,p[4],p[5],!0)<o&&r(h,_,y,b,m[2],m[3],!0)<o&&r(h,_,y,b,m[4],m[5],!0)<o&&(c=l=u=!0);else if(u)return null;if(c^l)return null;for(var x=[e,t],S=[],C=0;C<4&&S.length<2;C++){var T=C&1,E=T^1,D=C>>1,O=I.getTimeOf(x[T],new g(x[E][D?6:0],x[E][D?7:1]));if(O!=null){var k=T?[D,O]:[O,D];(!S.length||n(k[0]-S[0][0])>a&&n(k[1]-S[0][1])>a)&&S.push(k)}if(C>2&&!S.length)break}if(S.length!==2)S=null;else if(!u){var A=I.getPart(e,S[0][0],S[1][0]),j=I.getPart(t,S[0][1],S[1][1]);(n(j[2]-A[2])>o||n(j[3]-A[3])>o||n(j[4]-A[4])>o||n(j[5]-A[5])>o)&&(S=null)}return S}function getTimesWithTangent(e,t){var n=e[0],r=e[1],a=e[2],o=e[3],c=e[4],l=e[5],u=e[6],d=e[7],p=t.normalize(),h=p.x,g=p.y,_=3*u-9*c+9*a-3*n,y=3*d-9*l+9*o-3*r,b=6*c-12*a+6*n,x=6*l-12*o+6*r,S=3*a-3*n,C=3*o-3*r,w=2*_*g-2*y*h,T=[];if(Math.abs(w)<m.CURVETIME_EPSILON){var E=_*C-y*S,w=_*x-y*b;if(w!=0){var D=-E/w;D>=0&&D<=1&&T.push(D)}}else{var O=(b*b-4*_*S)*g*g+(-2*b*x+4*y*S+4*_*C)*h*g+(x*x-4*y*C)*h*h,k=b*g-x*h;if(O>=0&&w!=0){var A=Math.sqrt(O),j=-(k+A)/w,M=(-k+A)/w;j>=0&&j<=1&&T.push(j),M>=0&&M<=1&&T.push(M)}}return T}return{getIntersections:function(e){var t=this.getValues(),n=e&&e!==this&&e.getValues();return n?getCurveIntersections(t,n,this,e,[]):getSelfIntersection(t,this,[])},statics:{getOverlaps,getIntersections,getCurveLineIntersections,getTimesWithTangent}}}),L=o.extend({_class:`CurveLocation`,initialize:function CurveLocation(e,t,n,r,a){if(t>=.99999999){var o=e.getNext();o&&(t=0,e=o)}this._setCurve(e),this._time=t,this._point=n||e.getPointAtTime(t),this._overlap=r,this._distance=a,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(),n=this.getTime();n===0?e=t._segment1:n===1?e=t._segment2:n!=null&&(e=t.getPartLength(0,n)<t.getPartLength(n,1)?t._segment1:t._segment2),this._segment=e}return e},getCurve:function(){var e=this._path,t=this;e&&e._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null);function trySegment(e){var n=e&&e.getCurve();if(n&&(t._time=n.getTimeOf(t._point))!=null)return t._setCurve(n),n}return this._curve||trySegment(this._segment)||trySegment(this._segment1)||trySegment(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&&t==null?this._time=e.getTimeOf(this._point):t},getParameter:`#getTime`,getPoint:function(){return this._point},getOffset:function(){var e=this._offset;if(e==null){e=0;var t=this.getPath(),n=this.getIndex();if(t&&n!=null)for(var r=t.getCurves(),a=0;a<n;a++)e+=r[a].getLength();this._offset=e+=this.getCurveOffset()}return e},getCurveOffset:function(){var e=this._curveOffset;if(e==null){var t=this.getCurve(),n=this.getTime();this._curveOffset=e=n!=null&&t&&t.getPartLength(0,n)}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,n=e&&e.splitAtTime(this.getTime());return n&&this._setSegment(t.getLastSegment()),n},equals:function(e,t){var n=this===e;if(!n&&e instanceof L){var r=this.getCurve(),a=e.getCurve(),o=r._path;if(o===a._path){var c=Math.abs,l=1e-7,u=c(this.getOffset()-e.getOffset()),d=!t&&this._intersection,p=!t&&e._intersection;n=(u<l||o&&c(o.getLength()-u)<l)&&(!d&&!p||d&&p&&d.equals(p,!0))}}return n},toString:function(){var e=[],t=this.getPoint(),n=p.instance;t&&e.push(`point: `+t);var r=this.getIndex();r!=null&&e.push(`index: `+r);var a=this.getTime();return a!=null&&e.push(`time: `+n.number(a)),this._distance!=null&&e.push(`distance: `+n.number(this._distance)),`{ `+e.join(`, `)+` }`},isTouching:function(){var e=this._intersection;if(e&&this.getTangent().isCollinear(e.getTangent())){var t=this.getCurve(),n=e.getCurve();return!(t.isStraight()&&n.isStraight()&&t.getLine().intersect(n.getLine()))}return!1},isCrossing:function(){var e=this._intersection;if(!e)return!1;var t=this.getTime(),n=e.getTime(),r=1e-8,a=1-r,o=t>=r&&t<=a,c=n>=r&&n<=a;if(o&&c)return!this.isTouching();var l=this.getCurve(),u=l&&t<r?l.getPrevious():l,d=e.getCurve(),p=d&&n<r?d.getPrevious():d;if(t>a&&(l=l.getNext()),n>a&&(d=d.getNext()),!u||!l||!p||!d)return!1;var m=[];function addOffsets(e,t){var n=e.getValues(),r=I.classify(n).roots||I.getPeaks(n),a=r.length,o=I.getLength(n,t&&a?r[a-1]:0,!t&&a?r[0]:1);m.push(a?o:o/32)}function isInRange(e,t,n){return t<n?e>t&&e<n:e>t||e<n}o||(addOffsets(u,!0),addOffsets(l,!1)),c||(addOffsets(p,!0),addOffsets(d,!1));var h=this.getPoint(),g=Math.min.apply(Math,m),_=o?l.getTangentAtTime(t):l.getPointAt(g).subtract(h),y=o?_.negate():u.getPointAt(-g).subtract(h),b=c?d.getTangentAtTime(n):d.getPointAt(g).subtract(h),x=c?b.negate():p.getPointAt(-g).subtract(h),S=y.getAngle(),C=_.getAngle(),w=x.getAngle(),T=b.getAngle();return!!(o?isInRange(S,w,T)^isInRange(C,w,T)&&isInRange(S,T,w)^isInRange(C,T,w):isInRange(w,S,C)^isInRange(T,S,C)&&isInRange(w,C,S)^isInRange(T,C,S))},hasOverlap:function(){return!!this._overlap}},o.each(I._evaluateMethods,function(e){var t=e+`At`;this[e]=function(){var e=this.getCurve(),n=this.getTime();return n!=null&&e&&e[t](n,!0)}},{preserve:!0}),new function(){function insert(e,t,n){var r=e.length,a=0,o=r-1;function search(n,a){for(var o=n+a;o>=-1&&o<=r;o+=a){var c=e[(o%r+r)%r];if(!t.getPoint().isClose(c.getPoint(),1e-7))break;if(t.equals(c))return c}return null}for(;a<=o;){var c=a+o>>>1,l=e[c],u;if(n&&(u=t.equals(l)?l:search(c,-1)||search(c,1)))return t._overlap&&(u._overlap=u._intersection._overlap=!0),u;var d=t.getPath(),p=l.getPath();(d===p?t.getIndex()+t.getTime()-(l.getIndex()+l.getTime()):d._id-p._id)<0?o=c-1:a=c+1}return e.splice(a,0,t),t}return{statics:{insert,expand:function(e){for(var t=e.slice(),n=e.length-1;n>=0;n--)insert(t,e[n]._intersection,!1);return t}}}}),ee=E.extend({_class:`PathItem`,_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function PathItem(){},statics:{create:function(e){var t,n,r;if(o.isPlainObject(e)?(n=e.segments,t=e.pathData):Array.isArray(e)?n=e:typeof e==`string`&&(t=e),n){var a=n[0];r=a&&Array.isArray(a[0])}else t&&(r=(t.match(/m/gi)||[]).length>1||/z\s*\S+/i.test(t));return new(r?z:R)(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=e&&e.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),n,r=!1,a,o,c=new g,l=new g;function getCoord(e,t){var a=+n[e];return r&&(a+=c[t]),a}function getPoint(e){return new g(getCoord(e,`x`),getCoord(e+1,`y`))}this.clear();for(var u=0,d=t&&t.length;u<d;u++){var p=t[u],m=p[0],h=m.toLowerCase();n=p.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g);var _=n&&n.length;switch(r=m===h,a===`z`&&!/[mz]/.test(h)&&this.moveTo(c),h){case`m`:case`l`:for(var b=h===`m`,x=0;x<_;x+=2)this[b?`moveTo`:`lineTo`](c=getPoint(x)),b&&(b=(l=c,!1));o=c;break;case`h`:case`v`:var S=h===`h`?`x`:`y`;c=c.clone();for(var x=0;x<_;x++)c[S]=getCoord(x,S),this.lineTo(c);o=c;break;case`c`:for(var x=0;x<_;x+=6)this.cubicCurveTo(getPoint(x),o=getPoint(x+2),c=getPoint(x+4));break;case`s`:for(var x=0;x<_;x+=4)this.cubicCurveTo(/[cs]/.test(a)?c.multiply(2).subtract(o):c,o=getPoint(x),c=getPoint(x+2)),a=h;break;case`q`:for(var x=0;x<_;x+=4)this.quadraticCurveTo(o=getPoint(x),c=getPoint(x+2));break;case`t`:for(var x=0;x<_;x+=2)this.quadraticCurveTo(o=/[qt]/.test(a)?c.multiply(2).subtract(o):c,c=getPoint(x)),a=h;break;case`a`:for(var x=0;x<_;x+=7)this.arcTo(c=getPoint(x+5),new y(+n[x],+n[x+1]),+n[x+2],+n[x+4],+n[x+3]);break;case`z`:this.closePath(1e-12),c=l;break}a=h}},_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||!!(this.getFillRule()===`evenodd`?t.windingL&1||t.windingR&1:t.winding)},getIntersections:function(e,t,n,r){var a=this===e||!e,o=this._matrix._orNullIfIdentity(),c=a?o:(n||e._matrix)._orNullIfIdentity();return a||this.getBounds(o).intersects(e.getBounds(c),1e-12)?I.getIntersections(this.getCurves(),!a&&e.getCurves(),t,o,c,r):[]},getCrossings:function(e){return this.getIntersections(e,function(e){return e.isCrossing()})},getNearestLocation:function(){for(var e=g.read(arguments),t=this.getCurves(),n=1/0,r=null,a=0,o=t.length;a<o;a++){var c=t[a].getNearestLocation(e);c._distance<n&&(n=c._distance,r=c)}return r},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e&&e.getPoint()},interpolate:function(e,t,n){var r=!this._children,a=r?`_segments`:`_children`,o=e[a],c=t[a],l=this[a];if(!o||!c||o.length!==c.length)throw Error(`Invalid operands in interpolate() call: `+e+`, `+t);var u=l.length,d=c.length;if(u<d)for(var p=r?P:R,m=u;m<d;m++)this.add(new p);else u>d&&this[r?`removeSegments`:`removeChildren`](d,u);for(var m=0;m<d;m++)l[m].interpolate(o[m],c[m],n);r&&(this.setClosed(e._closed),this._changed(9))},compare:function(e){var t=!1;if(e){var n=this._children||[this],r=e._children?e._children.slice():[e],a=n.length,o=r.length,c=[],l=0;t=!0;for(var u=d.findItemBoundsCollisions(n,r,m.GEOMETRIC_EPSILON),p=a-1;p>=0&&t;p--){var h=n[p];t=!1;var g=u[p];if(g)for(var _=g.length-1;_>=0&&!t;_--)h.compare(r[g[_]])&&(c[g[_]]||(c[g[_]]=!0,l++),t=!0)}t&&(t=l===o)}return t}}),R=ee.extend({_class:`Path`,_serializeFields:{segments:[],closed:!1},initialize:function Path(e){this._closed=!1,this._segments=[],this._version=0;var t=arguments,r=Array.isArray(e)?typeof e[0]==`object`?e:t:e&&e.size===n&&(e.x!==n||e.point!==n)?t:null;r&&r.length>0?this.setSegments(r):(this._curves=n,this._segmentSelection=0,!r&&typeof e==`string`&&(this.setPathData(e),e=null)),this._initialize(!r&&e)},_equals:function(e){return this._closed===e._closed&&o.equals(this._segments,e._segments)},copyContent:function(e){this.setSegments(e._segments),this._closed=e._closed},_changed:function _changed(e){if(_changed.base.call(this,e),e&8){if(this._length=this._area=n,e&32)this._version++;else if(this._curves)for(var t=0,r=this._curves.length;t<r;t++)this._curves[t]._changed()}else e&64&&(this._bounds=n)},getStyle:function(){var e=this._parent;return(e instanceof z?e:this)._style},getSegments:function(){return this._segments},setSegments:function(e){var t=this.isFullySelected(),r=e&&e.length;if(this._segments.length=0,this._segmentSelection=0,this._curves=n,r){var a=e[r-1];typeof a==`boolean`&&(this.setClosed(a),r--),this._add(P.readList(e,0,{},r))}t&&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 n=this._countCurves();e=this._curves=Array(n);for(var r=0;r<n;r++)e[r]=new I(this,t[r],t[r+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 n=this._segments,r=n.length,a=new p(t),o=[,,,,,,],c=!0,l,u,d,m,h,g,_,y,b=[];function addSegment(t,n){if(t._transformCoordinates(e,o),l=o[0],u=o[1],c)b.push(`M`+a.pair(l,u)),c=!1;else if(h=o[2],g=o[3],h===l&&g===u&&_===d&&y===m){if(!n){var r=l-d,p=u-m;b.push(r===0?`v`+a.number(p):p===0?`h`+a.number(r):`l`+a.pair(r,p))}}else b.push(`c`+a.pair(_-d,y-m)+` `+a.pair(h-d,g-m)+` `+a.pair(l-d,u-m));d=l,m=u,_=o[4],y=o[5]}if(!r)return``;for(var x=0;x<r;x++)addSegment(n[x]);return this._closed&&r>0&&(addSegment(n[0],!0),b.push(`z`)),b.join(``)},isEmpty:function(){return!this._segments.length},_transformContent:function(e){for(var t=this._segments,n=[,,,,,,],r=0,a=t.length;r<a;r++)t[r]._transformCoordinates(e,n,!0);return!0},_add:function(e,t){for(var n=this._segments,r=this._curves,a=e.length,c=t==null,t=c?n.length:t,l=0;l<a;l++){var u=e[l];u._path&&(u=e[l]=u.clone()),u._path=this,u._index=t+l,u._selection&&this._updateSelection(u,0,u._selection)}if(c)o.push(n,e);else{n.splice.apply(n,[t,0].concat(e));for(var l=t+a,d=n.length;l<d;l++)n[l]._index=l}if(r){var p=this._countCurves(),m=t>0&&t+a-1===p?t-1:t,h=m,g=Math.min(m+a,p);e._curves&&(r.splice.apply(r,[m,0].concat(e._curves)),h+=e._curves.length);for(var l=h;l<g;l++)r.splice(l,0,new I(this,null,null));this._adjustCurves(m,g)}return this._changed(41),e},_adjustCurves:function(e,t){for(var n=this._segments,r=this._curves,a,o=e;o<t;o++)a=r[o],a._path=this,a._segment1=n[o],a._segment2=n[o+1]||n[0],a._changed();(a=r[this._closed&&!e?n.length-1:e-1])&&(a._segment2=n[e]||n[0],a._changed()),(a=r[t])&&(a._segment1=n[t],a._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&&typeof e!=`number`?this._add(P.readList(t)):this._add([P.read(t)])[0]},insert:function(e,t){var n=arguments;return n.length>2&&typeof t!=`number`?this._add(P.readList(n,1),e):this._add([P.read(n,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,n){e||(e=0),t=o.pick(t,this._segments.length);var r=this._segments,a=this._curves,c=r.length,l=r.splice(e,t-e),u=l.length;if(!u)return l;for(var d=0;d<u;d++){var p=l[d];p._selection&&this._updateSelection(p,p._selection,0),p._index=p._path=null}for(var d=e,m=r.length;d<m;d++)r[d]._index=d;if(a){for(var h=e>0&&t===c+(this._closed?1:0)?e-1:e,a=a.splice(h,u),d=a.length-1;d>=0;d--)a[d]._path=null;n&&(l._curves=a.slice(1)),this._adjustCurves(h,h)}return this._changed(41),l},clear:`#removeSegments`,hasHandles:function(){for(var e=this._segments,t=0,n=e.length;t<n;t++)if(e[t].hasHandles())return!0;return!1},clearHandles:function(){for(var e=this._segments,t=0,n=e.length;t<n;t++)e[t].clearHandles()},getLength:function(){if(this._length==null){for(var e=this.getCurves(),t=0,n=0,r=e.length;n<r;n++)t+=e[n].getLength();this._length=t}return this._length},getArea:function(){var e=this._area;if(e==null){var t=this._segments,n=this._closed;e=0;for(var r=0,a=t.length;r<a;r++){var o=r+1===a;e+=I.getArea(I.getValues(t[r],t[o?0:r+1],null,o&&!n))}this._area=e}return e},isFullySelected:function(){var e=this._segments.length;return this.isSelected()&&e>0&&this._segmentSelection===e*7},setFullySelected:function(e){e&&this._selectSegments(!0),this.setSelected(e)},setSelection:function setSelection(e){e&1||this._selectSegments(!1),setSelection.base.call(this,e)},_selectSegments:function(e){var t=this._segments,n=t.length,r=e?7:0;this._segmentSelection=r*n;for(var a=0;a<n;a++)t[a]._selection=r},_updateSelection:function(e,t,n){e._selection=n,(this._segmentSelection+=n-t)>0&&this.setSelected(!0)},divideAt:function(e){var t=this.getLocationAt(e),n;return t&&(n=t.getCurve().divideAt(t.getCurveOffset()))?n._segment1:null},splitAt:function(e){var t=this.getLocationAt(e),n=t&&t.index,r=t&&t.time,a=1e-8,o=1-a;r>o&&(n++,r=0);var c=this.getCurves();if(n>=0&&n<c.length){r>=a&&c[n++].divideAtTime(r);var l=this.removeSegments(n,this._segments.length,!0),u;return this._closed?(this.setClosed(!1),u=this):(u=new R(E.NO_INSERT),u.insertAbove(this),u.copyAttributes(this)),u._add(l,0),this.addSegment(l[0]),u}return null},split:function(e,t){var r,a=t===n?e:(r=this.getCurves()[e])&&r.getLocationAtTime(t);return a==null?null:this.splitAt(a)},join:function(e,t){var n=t||0;if(e&&e!==this){var r=e._segments,a=this.getLastSegment(),o=e.getLastSegment();if(!o)return this;a&&a._point.isClose(o._point,n)&&e.reverse();var c=e.getFirstSegment();if(a&&a._point.isClose(c._point,n))a.setHandleOut(c._handleOut),this._add(r.slice(1));else{var l=this.getFirstSegment();l&&l._point.isClose(c._point,n)&&e.reverse(),o=e.getLastSegment(),l&&l._point.isClose(o._point,n)?(l.setHandleIn(o._handleIn),this._add(r.slice(0,r.length-1),0)):this._add(r.slice())}e._closed&&this._add([r[0]]),e.remove()}var u=this.getFirstSegment(),d=this.getLastSegment();return u!==d&&u._point.isClose(d._point,n)&&(u.setHandleIn(d._handleIn),d.remove(),this.setClosed(!0)),this},reduce:function(e){for(var t=this.getCurves(),n=e&&e.simplify,r=n?1e-7:0,a=t.length-1;a>=0;a--){var o=t[a];!o.hasHandles()&&(!o.hasLength(r)||n&&o.isCollinear(o.getNext()))&&o.remove()}return this},reverse:function(){this._segments.reverse();for(var e=0,t=this._segments.length;e<t;e++){var n=this._segments[e],r=n._handleIn;n._handleIn=n._handleOut,n._handleOut=r,n._index=e}this._curves=null,this._changed(9)},flatten:function(e){for(var t=new B(this,e||.25,256,!0).parts,n=t.length,r=[],a=0;a<n;a++)r.push(new P(t[a].curve.slice(0,2)));!this._closed&&n>0&&r.push(new P(t[n-1].curve.slice(6))),this.setSegments(r)},simplify:function(e){var t=new V(this).fit(e||2.5);return t&&this.setSegments(t),!!t},smooth:function(e){var t=this,r=e||{},a=r.type||`asymmetric`,o=this._segments,c=o.length,l=this._closed;function getIndex(e,n){var r=e&&e.index;if(r!=null){var a=e.path;if(a&&a!==t)throw Error(e._class+` `+r+` of `+a+` is not part of `+t);n&&e instanceof I&&r++}else r=typeof e==`number`?e:n;return Math.min(r<0&&l?r%c:r<0?r+c:r,c-1)}var u=l&&r.from===n&&r.to===n,d=getIndex(r.from,0),p=getIndex(r.to,c-1);if(d>p)if(l)d-=c;else{var m=d;d=p,p=m}if(/^(?:asymmetric|continuous)$/.test(a)){var h=a===`asymmetric`,g=Math.min,_=p-d+1,y=_-1,b=u?g(_,4):1,x=b,S=b,C=[];if(l||(x=g(1,d),S=g(1,c-p-1)),y+=x+S,y<=1)return;for(var w=0,T=d-x;w<=y;w++,T++)C[w]=o[(T<0?T+c:T)%c]._point;for(var E=C[0]._x+2*C[1]._x,D=C[0]._y+2*C[1]._y,O=2,k=y-1,A=[E],j=[D],M=[O],N=[],P=[],w=1;w<y;w++){var F=w<k,L=F||h?1:2,ee=F?4:h?2:7,R=F?4:h?3:8,z=F?2:h?0:1,B=L/O;O=M[w]=ee-B,E=A[w]=R*C[w]._x+z*C[w+1]._x-B*E,D=j[w]=R*C[w]._y+z*C[w+1]._y-B*D}N[k]=A[k]/M[k],P[k]=j[k]/M[k];for(var w=y-2;w>=0;w--)N[w]=(A[w]-N[w+1])/M[w],P[w]=(j[w]-P[w+1])/M[w];N[y]=(3*C[y]._x-N[k])/2,P[y]=(3*C[y]._y-P[k])/2;for(var w=x,V=y-S,T=d;w<=V;w++,T++){var H=o[T<0?T+c:T],U=H._point,te=N[w]-U._x,W=P[w]-U._y;(u||w<V)&&H.setHandleOut(te,W),(u||w>x)&&H.setHandleIn(-te,-W)}}else for(var w=d;w<=p;w++)o[w<0?w+c:w].smooth(r,!u&&w===d,!u&&w===p)},toShape:function(e){if(!this._closed)return null;var t=this._segments,r,a,o,c;function isCollinear(e,n){var r=t[e],a=r.getNext(),o=t[n],c=o.getNext();return r._handleOut.isZero()&&a._handleIn.isZero()&&o._handleOut.isZero()&&c._handleIn.isZero()&&a._point.subtract(r._point).isCollinear(c._point.subtract(o._point))}function isOrthogonal(e){var n=t[e],r=n.getPrevious(),a=n.getNext();return r._handleOut.isZero()&&n._handleIn.isZero()&&n._handleOut.isZero()&&a._handleIn.isZero()&&n._point.subtract(r._point).isOrthogonal(a._point.subtract(n._point))}function isArc(e){var n=t[e],r=n.getNext(),a=n._handleOut,o=r._handleIn,c=.5522847498307936;if(a.isOrthogonal(o)){var l=n._point,u=r._point,d=new w(l,a,!0).intersect(new w(u,o,!0),!0);return d&&m.isZero(a.getLength()/d.subtract(l).getLength()-c)&&m.isZero(o.getLength()/d.subtract(u).getLength()-c)}return!1}function getDistance(e,n){return t[e]._point.getDistance(t[n]._point)}if(!this.hasHandles()&&t.length===4&&isCollinear(0,2)&&isCollinear(1,3)&&isOrthogonal(1)?(r=k.Rectangle,a=new y(getDistance(0,3),getDistance(0,1)),c=t[1]._point.add(t[2]._point).divide(2)):t.length===8&&isArc(0)&&isArc(2)&&isArc(4)&&isArc(6)&&isCollinear(1,5)&&isCollinear(3,7)?(r=k.Rectangle,a=new y(getDistance(1,6),getDistance(0,3)),o=a.subtract(new y(getDistance(0,7),getDistance(1,2))).divide(2),c=t[3]._point.add(t[4]._point).divide(2)):t.length===4&&isArc(0)&&isArc(1)&&isArc(2)&&isArc(3)&&(m.isZero(getDistance(0,2)-getDistance(1,3))?(r=k.Circle,o=getDistance(0,2)/2):(r=k.Ellipse,o=new y(getDistance(2,0)/2,getDistance(3,1)/2)),c=t[1]._point),r){var l=this.getPosition(!0),u=new r({center:l,size:a,radius:o,insert:!1});return u.copyAttributes(this,!0),u._matrix.prepend(this._matrix),u.rotate(c.subtract(l).getAngle()+90),(e===n||e)&&u.insertAbove(this),u}return null},toPath:`#clone`,compare:function compare(e){if(!e||e instanceof z)return compare.base.call(this,e);var t=this.getCurves(),n=e.getCurves(),r=t.length,a=n.length;if(!r||!a)return r==a;for(var o=t[0].getValues(),c=[],l=0,u,d=0,p,m=0;m<a;m++){var h=n[m].getValues();c.push(h);var g=I.getOverlaps(o,h);if(g){u=!m&&g[0][0]>0?a-1:m,p=g[0][1];break}}for(var _=Math.abs,y=1e-8,h=c[u],b;o&&h;){var g=I.getOverlaps(o,h);if(g){var x=g[0][0];if(_(x-d)<y){d=g[1][0],d===1&&(o=++l<r?t[l].getValues():null,d=0);var S=g[0][1];if(_(S-p)<y){if(b||(b=[u,S]),p=g[1][1],p===1&&(++u>=a&&(u=0),h=c[u]||n[u].getValues(),p=0),!o)return b[0]===u&&b[1]===p;continue}}}break}return!1},_hitTestSelf:function(e,t,n,r){var a=this,o=this.getStyle(),c=this._segments,l=c.length,u=this._closed,d=t._tolerancePadding,p=d,m,h,g,_,y,b,x=t.stroke&&o.hasStroke(),S=t.fill&&o.hasFill(),C=t.curves,w=x?o.getStrokeWidth()/2:S&&t.tolerance>0||C?0:null;w!==null&&(w>0?(m=o.getStrokeJoin(),h=o.getStrokeCap(),g=o.getMiterLimit(),p=p.add(R._getStrokePadding(w,r))):m=h=`round`);function isCloseEnough(t,n){return e.subtract(t).divide(n).length<=1}function checkSegmentPoint(e,n,r){if(!t.selected||n.isSelected()){var o=e._point;if(n!==o&&(n=n.add(o)),isCloseEnough(n,p))return new N(r,a,{segment:e,point:n})}}function checkSegmentPoints(e,n){return(n||t.segments)&&checkSegmentPoint(e,e._point,`segment`)||!n&&t.handles&&(checkSegmentPoint(e,e._handleIn,`handle-in`)||checkSegmentPoint(e,e._handleOut,`handle-out`))}function addToArea(e){_.add(e)}function checkSegmentStroke(t){var n=u||t._index>0&&t._index<l-1;if((n?m:h)===`round`)return isCloseEnough(t._point,p);if(_=new R({internal:!0,closed:!0}),n?t.isSmooth()||R._addBevelJoin(t,m,w,g,null,r,addToArea,!0):h===`square`&&R._addSquareCap(t,h,w,null,r,addToArea,!0),!_.isEmpty()){var a;return _.contains(e)||(a=_.getNearestLocation(e))&&isCloseEnough(a.getPoint(),d)}}if(t.ends&&!t.segments&&!u){if(b=checkSegmentPoints(c[0],!0)||checkSegmentPoints(c[l-1],!0))return b}else if(t.segments||t.handles){for(var T=0;T<l;T++)if(b=checkSegmentPoints(c[T]))return b}if(w!==null){if(y=this.getNearestLocation(e),y){var E=y.getTime();E===0||E===1&&l>1?checkSegmentStroke(y.getSegment())||(y=null):isCloseEnough(y.getPoint(),p)||(y=null)}if(!y&&m===`miter`&&l>1)for(var T=0;T<l;T++){var D=c[T];if(e.getDistance(D._point)<=g*w&&checkSegmentStroke(D)){y=D.getLocation();break}}}return!y&&S&&this._contains(e)||y&&!x&&!C?new N(`fill`,this):y?new N(x?`stroke`:`curve`,this,{location:y,point:y.getPoint()}):null}},o.each(I._evaluateMethods,function(e){this[e+`At`]=function(t){var n=this.getLocationAt(t);return n&&n[e]()}},{beans:!1,getLocationOf:function(){for(var e=g.read(arguments),t=this.getCurves(),n=0,r=t.length;n<r;n++){var a=t[n].getLocationOf(e);if(a)return a}return null},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getLocationAt:function(e){if(typeof e==`number`){for(var t=this.getCurves(),n=0,r=0,a=t.length;r<a;r++){var o=n,c=t[r];if(n+=c.getLength(),n>e)return c.getLocationAt(e-o)}if(t.length>0&&e<=this.getLength())return new L(t[t.length-1],1)}else if(e&&e.getPath&&e.getPath()===this)return e;return null},getOffsetsWithTangent:function(){var e=g.read(arguments);if(e.isZero())return[];for(var t=[],n=0,r=this.getCurves(),a=0,o=r.length;a<o;a++){for(var c=r[a],l=c.getTimesWithTangent(e),u=0,d=l.length;u<d;u++){var p=n+c.getOffsetAtTime(l[u]);t.indexOf(p)<0&&t.push(p)}n+=c.length}return t}}),new function(){function drawHandles(e,t,n,r){if(r<=0)return;var a=r/2,o=r-2,c=a-1,l=[,,,,,,],u,d;function drawHandle(t){var n=l[t],r=l[t+1];(u!=n||d!=r)&&(e.beginPath(),e.moveTo(u,d),e.lineTo(n,r),e.stroke(),e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!0),e.fill())}for(var p=0,m=t.length;p<m;p++){var h=t[p],g=h._selection;if(h._transformCoordinates(n,l),u=l[0],d=l[1],g&2&&drawHandle(2),g&4&&drawHandle(4),e.fillRect(u-a,d-a,r,r),o>0&&!(g&1)){var _=e.fillStyle;e.fillStyle=`#ffffff`,e.fillRect(u-c,d-c,o,o),e.fillStyle=_}}}function drawSegments(e,t,n){var r=t._segments,a=r.length,o=[,,,,,,],c=!0,l,u,d,p,m,h,g,_;function drawSegment(t){if(n)t._transformCoordinates(n,o),l=o[0],u=o[1];else{var r=t._point;l=r._x,u=r._y}if(c)e.moveTo(l,u),c=!1;else{if(n)m=o[2],h=o[3];else{var a=t._handleIn;m=l+a._x,h=u+a._y}m===l&&h===u&&g===d&&_===p?e.lineTo(l,u):e.bezierCurveTo(g,_,m,h,l,u)}if(d=l,p=u,n)g=o[4],_=o[5];else{var a=t._handleOut;g=d+a._x,_=p+a._y}}for(var y=0;y<a;y++)drawSegment(r[y]);t._closed&&a>0&&drawSegment(r[0])}return{_draw:function(e,t,n,r){var a=t.dontStart,o=t.dontFinish||t.clip,c=this.getStyle(),l=c.hasFill(),u=c.hasStroke(),d=c.getDashArray(),p=!X.support.nativeDash&&u&&d&&d.length;a||e.beginPath(),(l||u&&!p||o)&&(drawSegments(e,this,r),this._closed&&e.closePath());function getOffset(e){return d[(e%p+p)%p]}if(!o&&(l||u)&&(this._setStyles(e,t,n),l&&(e.fill(c.getFillRule()),e.shadowColor=`rgba(0,0,0,0)`),u)){if(p){a||e.beginPath();for(var m=new B(this,.25,32,!1,r),h=m.length,g=-c.getDashOffset(),_,y=0;g>0;)g-=getOffset(y--)+getOffset(y--);for(;g<h;)_=g+getOffset(y++),(g>0||_>0)&&m.drawPart(e,Math.max(g,0),Math.max(_,0)),g=_+getOffset(y++)}e.stroke()}},_drawSelected:function(e,t){e.beginPath(),drawSegments(e,this,t),e.stroke(),drawHandles(e,this._segments,t,X.settings.handleSize)}}},new function(){function getCurrentSegment(e){var t=e._segments;if(!t.length)throw Error(`Use a moveTo() command first`);return t[t.length-1]}return{moveTo:function(){var e=this._segments;e.length===1&&this.removeSegment(0),e.length||this._add([new P(g.read(arguments))])},moveBy:function(){throw Error(`moveBy() is unsupported on Path items.`)},lineTo:function(){this._add([new P(g.read(arguments))])},cubicCurveTo:function(){var e=arguments,t=g.read(e),n=g.read(e),r=g.read(e),a=getCurrentSegment(this);a.setHandleOut(t.subtract(a._point)),this._add([new P(r,n.subtract(r))])},quadraticCurveTo:function(){var e=arguments,t=g.read(e),n=g.read(e),r=getCurrentSegment(this)._point;this.cubicCurveTo(t.add(r.subtract(t).multiply(1/3)),t.add(n.subtract(t).multiply(1/3)),n)},curveTo:function(){var e=arguments,t=g.read(e),n=g.read(e),r=o.pick(o.read(e),.5),a=1-r,c=getCurrentSegment(this)._point,l=t.subtract(c.multiply(a*a)).subtract(n.multiply(r*r)).divide(2*r*a);if(l.isNaN())throw Error(`Cannot put a curve through points with parameter = `+r);this.quadraticCurveTo(l,n)},arcTo:function(){var e=arguments,t=Math.abs,n=Math.sqrt,r=getCurrentSegment(this),a=r._point,c=g.read(e),l,u=o.peek(e),d=o.pick(u,!0),p,h,_,b;if(typeof d==`boolean`)var x=a.add(c).divide(2),l=x.add(x.subtract(a).rotate(d?-90:90));else if(o.remain(e)<=2)l=c,c=g.read(e);else if(!a.equals(c)){var S=y.read(e),T=m.isZero;if(T(S.width)||T(S.height))return this.lineTo(c);var E=o.read(e),d=!!o.read(e),D=!!o.read(e),x=a.add(c).divide(2),O=a.subtract(x).rotate(-E),k=O.x,A=O.y,j=t(S.width),M=t(S.height),N=j*j,F=M*M,I=k*k,L=A*A,ee=n(I/N+L/F);if(ee>1&&(j*=ee,M*=ee,N=j*j,F=M*M),ee=(N*F-N*L-F*I)/(N*L+F*I),t(ee)<1e-12&&(ee=0),ee<0)throw Error(`Cannot create an arc with the given arguments`);p=new g(j*A/M,-M*k/j).multiply((D===d?-1:1)*n(ee)).rotate(E).add(x),b=new C().translate(p).rotate(E).scale(j,M),_=b._inverseTransform(a),h=_.getDirectedAngle(b._inverseTransform(c)),!d&&h>0?h-=360:d&&h<0&&(h+=360)}if(l){var R=new w(a.add(l).divide(2),l.subtract(a).rotate(90),!0),z=new w(l.add(c).divide(2),c.subtract(l).rotate(90),!0),B=new w(a,c),V=B.getSide(l);if(p=R.intersect(z,!0),!p){if(!V)return this.lineTo(c);throw Error(`Cannot create an arc with the given arguments`)}_=a.subtract(p),h=_.getDirectedAngle(c.subtract(p));var H=B.getSide(p,!0);H===0?h=V*t(h):V===H&&(h+=h<0?360:-360)}if(h){for(var U=1e-5,te=t(h),W=te>=360?4:Math.ceil((te-U)/90),ne=h/W,re=ne*Math.PI/360,ie=4/3*Math.sin(re)/(1+Math.cos(re)),ae=[],G=0;G<=W;G++){var O=c,K=null;if(G<W&&(K=_.rotate(90).multiply(ie),b?(O=b._transformPoint(_),K=b._transformPoint(_.add(K)).subtract(O)):O=p.add(_)),!G)r.setHandleOut(K);else{var oe=_.rotate(-90).multiply(ie);b&&(oe=b._transformPoint(_.add(oe)).subtract(O)),ae.push(new P(O,oe,K))}_=_.rotate(ne)}this._add(ae)}},lineBy:function(){var e=g.read(arguments),t=getCurrentSegment(this)._point;this.lineTo(t.add(e))},curveBy:function(){var e=arguments,t=g.read(e),n=g.read(e),r=o.read(e),a=getCurrentSegment(this)._point;this.curveTo(a.add(t),a.add(n),r)},cubicCurveBy:function(){var e=arguments,t=g.read(e),n=g.read(e),r=g.read(e),a=getCurrentSegment(this)._point;this.cubicCurveTo(a.add(t),a.add(n),a.add(r))},quadraticCurveBy:function(){var e=arguments,t=g.read(e),n=g.read(e),r=getCurrentSegment(this)._point;this.quadraticCurveTo(r.add(t),r.add(n))},arcBy:function(){var e=arguments,t=getCurrentSegment(this)._point,n=t.add(g.read(e)),r=o.pick(o.peek(e),!0);typeof r==`boolean`?this.arcTo(n,r):this.arcTo(n,t.add(g.read(e)))},closePath:function(e){this.setClosed(!0),this.join(this,e)}}},{_getBounds:function(e,t){return R[t.handle?`getHandleBounds`:t.stroke?`getStrokeBounds`:`getBounds`](this._segments,this._closed,this,e,t)},statics:{getBounds:function(e,t,n,r,a,o){var c=e[0];if(!c)return new x;var l=[,,,,,,],u=c._transformCoordinates(r,[,,,,,,]),d=u.slice(0,2),p=d.slice(),m=[,,];function processSegment(e){e._transformCoordinates(r,l);for(var t=0;t<2;t++)I._addBounds(u[t],u[t+4],l[t+2],l[t],t,o?o[t]:0,d,p,m);var n=u;u=l,l=n}for(var h=1,g=e.length;h<g;h++)processSegment(e[h]);return t&&processSegment(c),new x(d[0],d[1],p[0]-d[0],p[1]-d[1])},getStrokeBounds:function(e,t,n,r,a){var o=n.getStyle(),c=o.hasStroke(),l=o.getStrokeWidth(),u=c&&n._getStrokeMatrix(r,a),d=c&&R._getStrokePadding(l,u),p=R.getBounds(e,t,n,r,a,d);if(!c)return p;var m=l/2,h=o.getStrokeJoin(),g=o.getStrokeCap(),_=o.getMiterLimit(),b=new x(new y(d));function addPoint(e){p=p.include(e)}function addRound(e){p=p.unite(b.setCenter(e._point.transform(r)))}function addJoin(e,t){t===`round`||e.isSmooth()?addRound(e):R._addBevelJoin(e,t,m,_,r,u,addPoint)}function addCap(e,t){t===`round`?addRound(e):R._addSquareCap(e,t,m,r,u,addPoint)}var S=e.length-(t?0:1);if(S>0){for(var C=1;C<S;C++)addJoin(e[C],h);t?addJoin(e[0],h):(addCap(e[0],g),addCap(e[e.length-1],g))}return p},_getStrokePadding:function(e,t){if(!t)return[e,e];var n=new g(e,0).transform(t),r=new g(0,e).transform(t),a=n.getAngleInRadians(),o=n.getLength(),c=r.getLength(),l=Math.sin(a),u=Math.cos(a),d=Math.tan(a),p=Math.atan2(c*d,o),m=Math.atan2(c,d*o);return[Math.abs(o*Math.cos(p)*u+c*Math.sin(p)*l),Math.abs(c*Math.sin(m)*u+o*Math.cos(m)*l)]},_addBevelJoin:function(e,t,n,r,a,o,c,l){var u=e.getCurve(),d=u.getPrevious(),p=u.getPoint1().transform(a),m=d.getNormalAtTime(1).multiply(n).transform(o),h=u.getNormalAtTime(0).multiply(n).transform(o),_=m.getDirectedAngle(h);if((_<0||_>=180)&&(m=m.negate(),h=h.negate()),l&&c(p),c(p.add(m)),t===`miter`){var y=new w(p.add(m),new g(-m.y,m.x),!0).intersect(new w(p.add(h),new g(-h.y,h.x),!0),!0);y&&p.getDistance(y)<=r*n&&c(y)}c(p.add(h))},_addSquareCap:function(e,t,n,r,a,o,c){var l=e._point.transform(r),u=e.getLocation(),d=u.getNormal().multiply(u.getTime()===0?n:-n).transform(a);t===`square`&&(c&&(o(l.subtract(d)),o(l.add(d))),l=l.add(d.rotate(-90))),o(l.add(d)),o(l.subtract(d))},getHandleBounds:function(e,t,n,r,a){var o=n.getStyle(),c=a.stroke&&o.hasStroke(),l,u;if(c){var d=n._getStrokeMatrix(r,a),p=o.getStrokeWidth()/2,m=p;o.getStrokeJoin()===`miter`&&(m=p*o.getMiterLimit()),o.getStrokeCap()===`square`&&(m=Math.max(m,p*Math.SQRT2)),l=R._getStrokePadding(p,d),u=R._getStrokePadding(m,d)}for(var h=[,,,,,,],g=1/0,_=-g,y=g,b=_,S=0,C=e.length;S<C;S++){e[S]._transformCoordinates(r,h);for(var w=0;w<6;w+=2){var T=w?l:u,E=T?T[0]:0,D=T?T[1]:0,O=h[w],k=h[w+1],A=O-E,j=O+E,M=k-D,N=k+D;A<g&&(g=A),j>_&&(_=j),M<y&&(y=M),N>b&&(b=N)}}return new x(g,y,_-g,b-y)}}});R.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 createPath(e,t,n){var r=o.getNamed(n),a=new R(r&&(r.insert==1?E.INSERT:r.insert==0?E.NO_INSERT:null));return a._add(e),a._closed=t,a.set(r,E.INSERT)}function createEllipse(e,n,r){for(var a=[,,,,],o=0;o<4;o++){var c=t[o];a[o]=new P(c._point.multiply(n).add(e),c._handleIn.multiply(n),c._handleOut.multiply(n))}return createPath(a,!0,r)}return{Line:function(){var e=arguments;return createPath([new P(g.readNamed(e,`from`)),new P(g.readNamed(e,`to`))],!1,e)},Circle:function(){var e=arguments;return createEllipse(g.readNamed(e,`center`),new y(o.readNamed(e,`radius`)),e)},Rectangle:function(){var t=arguments,n=x.readNamed(t,`rectangle`),r=y.readNamed(t,`radius`,0,{readNull:!0}),a=n.getBottomLeft(!0),o=n.getTopLeft(!0),c=n.getTopRight(!0),l=n.getBottomRight(!0),u;if(!r||r.isZero())u=[new P(a),new P(o),new P(c),new P(l)];else{r=y.min(r,n.getSize(!0).divide(2));var d=r.width,p=r.height,m=d*e,h=p*e;u=[new P(a.add(d,0),null,[-m,0]),new P(a.subtract(0,p),[0,h]),new P(o.add(0,p),null,[0,-h]),new P(o.add(d,0),[-m,0],null),new P(c.subtract(d,0),null,[m,0]),new P(c.add(0,p),[0,-h],null),new P(l.subtract(0,p),null,[0,h]),new P(l.subtract(d,0),[m,0])]}return createPath(u,!0,t)},RoundRectangle:`#Rectangle`,Ellipse:function(){var e=arguments,t=k._readEllipse(e);return createEllipse(t.center,t.radius,e)},Oval:`#Ellipse`,Arc:function(){var e=arguments,t=g.readNamed(e,`from`),n=g.readNamed(e,`through`),r=g.readNamed(e,`to`),a=o.getNamed(e),c=new R(a&&a.insert==0&&E.NO_INSERT);return c.moveTo(t),c.arcTo(n,r),c.set(a)},RegularPolygon:function(){for(var e=arguments,t=g.readNamed(e,`center`),n=o.readNamed(e,`sides`),r=o.readNamed(e,`radius`),a=360/n,c=n%3==0,l=new g(0,c?-r:r),u=c?-1:.5,d=Array(n),p=0;p<n;p++)d[p]=new P(t.add(l.rotate((p+u)*a)));return createPath(d,!0,e)},Star:function(){for(var e=arguments,t=g.readNamed(e,`center`),n=o.readNamed(e,`points`)*2,r=o.readNamed(e,`radius1`),a=o.readNamed(e,`radius2`),c=360/n,l=new g(0,-1),u=Array(n),d=0;d<n;d++)u[d]=new P(t.add(l.rotate(c*d).multiply(d%2?a:r)));return createPath(u,!0,e)}}}});var z=ee.extend({_class:`CompoundPath`,_serializeFields:{children:[]},beans:!0,initialize:function CompoundPath(e){this._children=[],this._namedChildren={},this._initialize(e)||(typeof e==`string`?this.setPathData(e):this.addChildren(Array.isArray(e)?e:arguments))},insertChildren:function insertChildren(e,t){var n=t,r=n[0];r&&typeof r[0]==`number`&&(n=[n]);for(var a=t.length-1;a>=0;a--){var c=n[a];n===t&&!(c instanceof R)&&(n=o.slice(n)),Array.isArray(c)?n[a]=new R({segments:c,insert:!1}):c instanceof z&&(n.splice.apply(n,[a,1].concat(c.removeChildren())),c.remove())}return insertChildren.base.call(this,e,n)},reduce:function reduce(e){for(var t=this._children,n=t.length-1;n>=0;n--){var r=t[n].reduce(e);r.isEmpty()&&r.remove()}if(!t.length){var r=new R(E.NO_INSERT);return r.copyAttributes(this),r.insertAbove(this),this.remove(),r}return reduce.base.call(this)},isClosed:function(){for(var e=this._children,t=0,n=e.length;t<n;t++)if(!e[t]._closed)return!1;return!0},setClosed:function(e){for(var t=this._children,n=0,r=t.length;n<r;n++)t[n].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=[],n=0,r=e.length;n<r;n++)o.push(t,e[n].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,n=0,r=e.length;n<r;n++)t+=e[n].getArea();return t},getLength:function(){for(var e=this._children,t=0,n=0,r=e.length;n<r;n++)t+=e[n].getLength();return t},getPathData:function(e,t){for(var n=this._children,r=[],a=0,o=n.length;a<o;a++){var c=n[a],l=c._matrix;r.push(c.getPathData(e&&!l.isIdentity()?e.appended(l):e,t))}return r.join(``)},_hitTestChildren:function _hitTestChildren(e,t,n){return _hitTestChildren.base.call(this,e,t.class===R||t.type===`path`?t:o.set({},t,{fill:!1}),n)},_draw:function(e,t,n,r){var a=this._children;if(a.length){t=t.extend({dontStart:!0,dontFinish:!0}),e.beginPath();for(var o=0,c=a.length;o<c;o++)a[o].draw(e,t,r);if(!t.clip){this._setStyles(e,t,n);var l=this._style;l.hasFill()&&(e.fill(l.getFillRule()),e.shadowColor=`rgba(0,0,0,0)`),l.hasStroke()&&e.stroke()}}},_drawSelected:function(e,t,n){for(var r=this._children,a=0,o=r.length;a<o;a++){var c=r[a],l=c._matrix;n[c._id]||c._drawSelected(e,l.isIdentity()?t:t.appended(l))}}},new function(){function getCurrentPath(e,t){var n=e._children;if(t&&!n.length)throw Error(`Use a moveTo() command first`);return n[n.length-1]}return o.each([`lineTo`,`cubicCurveTo`,`quadraticCurveTo`,`curveTo`,`arcTo`,`lineBy`,`cubicCurveBy`,`quadraticCurveBy`,`curveBy`,`arcBy`],function(e){this[e]=function(){var t=getCurrentPath(this,!0);t[e].apply(t,arguments)}},{moveTo:function(){var e=getCurrentPath(this),t=e&&e.isEmpty()?e:new R(E.NO_INSERT);t!==e&&this.addChild(t),t.moveTo.apply(t,arguments)},moveBy:function(){var e=getCurrentPath(this,!0),t=e&&e.getLastSegment(),n=g.read(arguments);this.moveTo(t?n.add(t._point):n)},closePath:function(e){getCurrentPath(this,!0).closePath(e)}})},o.each([`reverse`,`flatten`,`simplify`,`smooth`],function(e){this[e]=function(t){for(var n=this._children,r,a=0,o=n.length;a<o;a++)r=n[a][e](t)||r;return r}},{}));ee.inject(new function(){var e=Math.min,t=Math.max,r=Math.abs,a={unite:{1:!0,2:!0},intersect:{2:!0},subtract:{1:!0},exclude:{1:!0,"-1":!0}};function getPaths(e){return e._children||[e]}function preparePath(e,t){var n=e.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);if(t){for(var r=getPaths(n),a=0,o=r.length;a<o;a++){var e=r[a];!e._closed&&!e.isEmpty()&&(e.closePath(1e-12),e.getFirstSegment().setHandleIn(0,0),e.getLastSegment().setHandleOut(0,0))}n=n.resolveCrossings().reorient(n.getFillRule()===`nonzero`,!0)}return n}function createResult(e,t,n,r,a){var o=new z(E.NO_INSERT);return o.addChildren(e,!0),o=o.reduce({simplify:t}),a&&a.insert==0||o.insertAbove(r&&n.isSibling(r)&&n.getIndex()<r.getIndex()?r:n),o.copyAttributes(n,!0),o}function filterIntersection(e){return e.hasOverlap()||e.isCrossing()}function traceBoolean(e,t,n,r){if(r&&(r.trace==0||r.stroke)&&/^(subtract|intersect)$/.test(n))return splitBoolean(e,t,n);var c=preparePath(e,!0),l=t&&e!==t&&preparePath(t,!0),u=a[n];u[n]=!0,l&&(u.subtract||u.exclude)^(l.isClockwise()^c.isClockwise())&&l.reverse();var p=divideLocations(L.expand(c.getIntersections(l,filterIntersection))),m=getPaths(c),h=l&&getPaths(l),g=[],_=[],y;function collectPaths(e){for(var t=0,n=e.length;t<n;t++){var r=e[t];o.push(g,r._segments),o.push(_,r.getCurves()),r._overlapsOnly=!0}}function getCurves(e){for(var t=[],n=0,r=e&&e.length;n<r;n++)t.push(_[e[n]]);return t}if(p.length){collectPaths(m),h&&collectPaths(h);for(var b=Array(_.length),x=0,S=_.length;x<S;x++)b[x]=_[x].getValues();for(var C=d.findCurveBoundsCollisions(b,b,0,!0),w={},x=0;x<_.length;x++){var T=_[x],E=T._path._id,D=w[E]=w[E]||{};D[T.getIndex()]={hor:getCurves(C[x].hor),ver:getCurves(C[x].ver)}}for(var x=0,S=p.length;x<S;x++)propagateWinding(p[x]._segment,c,l,w,u);for(var x=0,S=g.length;x<S;x++){var O=g[x],k=O._intersection;O._winding||propagateWinding(O,c,l,w,u),k&&k._overlap||(O._path._overlapsOnly=!1)}y=tracePaths(g,u)}else y=reorientPaths(h?m.concat(h):m.slice(),function(e){return!!u[e]});return createResult(y,!0,e,t,r)}function splitBoolean(e,t,n){var r=preparePath(e),a=preparePath(t),o=r.getIntersections(a,filterIntersection),c=n===`subtract`,l=n===`divide`,u={},d=[];function addPath(e){if(!u[e._id]&&(l||a.contains(e.getPointAt(e.getLength()/2))^c))return d.unshift(e),u[e._id]=!0}for(var p=o.length-1;p>=0;p--){var m=o[p].split();m&&(addPath(m)&&m.getFirstSegment().setHandleIn(0,0),r.getLastSegment().setHandleOut(0,0))}return addPath(r),createResult(d,!1,e,t)}function linkIntersections(e,t){for(var n=e;n;){if(n===t)return;n=n._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 clearCurveHandles(e){for(var t=e.length-1;t>=0;t--)e[t].clearHandles()}function reorientPaths(e,t,n){var a=e&&e.length;if(a){var c=o.each(e,function(e,t){this[e._id]={container:null,winding:e.isClockwise()?1:-1,index:t}},{}),l=e.slice().sort(function(e,t){return r(t.getArea())-r(e.getArea())}),u=l[0],p=d.findItemBoundsCollisions(l,null,m.GEOMETRIC_EPSILON);n??(n=u.isClockwise());for(var h=0;h<a;h++){var g=l[h],_=c[g._id],y=0,b=p[h];if(b){for(var x=null,S=b.length-1;S>=0;S--)if(b[S]<h){x||(x=g.getInteriorPoint());var C=l[b[S]];if(C.contains(x)){var w=c[C._id];y=w.winding,_.winding+=y,_.container=w.exclude?w.container:C;break}}}if(t(_.winding)===t(y))_.exclude=!0,e[_.index]=null;else{var T=_.container;g.setClockwise(T?!T.isClockwise():n)}}}return e}function divideLocations(e,t,n){var r=t&&[],a=1e-8,o=1-a,c=!1,l=n||[],u=n&&{},d,p,m;function getId(e){return e._path._id+`.`+e._segment1._index}for(var h=(n&&n.length)-1;h>=0;h--){var g=n[h];g._path&&(u[getId(g)]=!0)}for(var h=e.length-1;h>=0;h--){var _=e[h],y=_._time,b=y,x=t&&!t(_),g=_._curve,S;if(g&&(g===p?m>=a&&(y/=m):(c=!g.hasHandles()||u&&u[getId(g)],d=[],m=null,p=g)),x){d&&d.push(_);continue}else t&&r.unshift(_);if(m=b,y<a)S=g._segment1;else if(y>o)S=g._segment2;else{var C=g.divideAtTime(y,!0);c&&l.push(g,C),S=C._segment1;for(var w=d.length-1;w>=0;w--){var T=d[w];T._time=(T._time-y)/(1-y)}}_._setSegment(S);var E=S._intersection,D=_._intersection;if(E){linkIntersections(E,D);for(var O=E;O;)linkIntersections(O._intersection,E),O=O._next}else S._intersection=D}return n||clearCurveHandles(l),r||e}function getWinding(n,a,o,c,l){var u=Array.isArray(a)?a:a[o?`hor`:`ver`],d=o?1:0,p=d^1,m=[n.x,n.y],h=m[d],g=m[p],_=1e-9,y=1e-6,b=h-_,x=h+_,S=0,C=0,w=0,T=0,E=!1,D=!1,O=1,k=[],A,j;function addWinding(r){var u=r[p+0],m=r[p+6];if(!(g<e(u,m)||g>t(u,m))){var _=r[d+0],S=r[d+2],C=r[d+4],D=r[d+6];if(u===m){(_<x&&D>b||D<x&&_>b)&&(E=!0);return}var j=g===u?0:g===m||b>t(_,S,C,D)||x<e(_,S,C,D)?1:I.solveCubic(r,p,g,k,0,1)>0?k[0]:1,M=j===0?_:j===1?D:I.getPoint(r,j)[o?`y`:`x`],N=u>m?1:-1,P=A[p]>A[p+6]?1:-1,F=A[d+6];return g===u?(N===P?_!=F&&(F<x&&M>x?(T+=N,E=!0):F>b&&M<b&&(w+=N,E=!0)):_<b?w+=N:_>x&&(T+=N),O/=4):(M<b?w+=N:M>x?T+=N:E=!0,M>h-y&&M<h+y&&(O/=2)),A=r,!l&&M>b&&M<x&&I.getTangent(r,j)[o?`x`:`y`]===0&&getWinding(n,a,!o,c,!0)}}function handleCurve(n){var r=n[p+0],a=n[p+2],c=n[p+4],l=n[p+6];if(g<=t(r,a,c,l)&&g>=e(r,a,c,l)){for(var u=n[d+0],m=n[d+2],h=n[d+4],_=n[d+6],y=b>t(u,m,h,_)||x<e(u,m,h,_)?[n]:I.getMonoCurves(n,o),S,C=0,w=y.length;C<w;C++)if(S=addWinding(y[C]))return S}}for(var M=0,N=u.length;M<N;M++){var P=u[M],F=P._path,L=P.getValues(),ee;if((!M||u[M-1]._path!==F)&&(A=null,F._closed||(j=I.getValues(F.getLastCurve().getSegment2(),P.getSegment1(),null,!c),j[p]!==j[p+6]&&(A=j)),!A)){A=L;for(var R=F.getLastCurve();R&&R!==P;){var z=R.getValues();if(z[p]!==z[p+6]){A=z;break}R=R.getPrevious()}}if(ee=handleCurve(L))return ee;if(M+1===N||u[M+1]._path!==F){if(j&&(ee=handleCurve(j)))return ee;E&&!w&&!T&&(w=T=F.isClockwise(c)^o?1:-1),S+=w,C+=T,w=T=0,E&&(E=(D=!0,!1)),j=null}}return S=r(S),C=r(C),{winding:t(S,C),windingL:S,windingR:C,quality:O,onPath:D}}function propagateWinding(e,t,n,a,o){var c=[],l=e,u=0,d;do{var p=e.getCurve();if(p){var h=p.getLength();c.push({segment:e,curve:p,length:h}),u+=h}e=e.getNext()}while(e&&!e._intersection&&e!==l);for(var g=[.5,.25,.75],d={winding:0,quality:-1},_=.001,y=1-_,b=0;b<g.length&&d.quality<.5;b++)for(var h=u*g[b],x=0,S=c.length;x<S;x++){var C=c[x],w=C.length;if(h<=w){var p=C.curve,T=p._path,E=T._parent,D=E instanceof z?E:T,O=m.clamp(p.getTimeAt(h),_,y),k=p.getPointAtTime(O),A=r(p.getTangentAtTime(O).y)<Math.SQRT1_2,j=null;if(o.subtract&&n){var M=(D===t?n:t)._getWinding(k,A,!0);if(D===t&&M.winding||D===n&&!M.winding){if(M.quality<1)continue;j={winding:0,quality:1}}}j||(j=getWinding(k,a[T._id][p.getIndex()],A,!0)),j.quality>d.quality&&(d=j);break}h-=w}for(var x=c.length-1;x>=0;x--)c[x].segment._winding=d}function tracePaths(e,t){var n=[],r;function isValid(e){var n;return!!(e&&!e._visited&&(!t||t[(n=e._winding||{}).winding]&&!(t.unite&&n.winding===2&&n.windingL&&n.windingR)))}function isStart(e){if(e){for(var t=0,n=r.length;t<n;t++)if(e===r[t])return!0}return!1}function visitPath(e){for(var t=e._segments,n=0,r=t.length;n<r;n++)t[n]._visited=!0}function getCrossingSegments(e,t){var n=e._intersection,a=n,o=[];t&&(r=[e]);function collect(n,a){for(;n&&n!==a;){var c=n._segment,l=c&&c._path;if(l){var u=c.getNext()||l.getFirstSegment(),d=u._intersection;c!==e&&(isStart(c)||isStart(u)||u&&isValid(c)&&(isValid(u)||d&&isValid(d._segment)))&&o.push(c),t&&r.push(c)}n=n._next}}if(n){for(collect(n);n&&n._previous;)n=n._previous;collect(n,a)}return o}e.sort(function(e,t){var n=e._intersection,r=t._intersection,a=!!(n&&n._overlap),o=!!(r&&r._overlap),c=e._path,l=t._path;return a^o?a?1:-1:!n^!r?n?1:-1:c===l?e._index-t._index:c._id-l._id});for(var a=0,o=e.length;a<o;a++){var c=e[a],l=isValid(c),u=null,d=!1,p=!0,m=[],h,g,_;if(l&&c._path._overlapsOnly){var y=c._path,b=c._intersection._segment._path;y.compare(b)&&(y.getArea()&&n.push(y.clone(!1)),visitPath(y),visitPath(b),l=!1)}for(;l;){var x=!u,S=getCrossingSegments(c,x),C=S.shift(),d=!x&&(isStart(c)||isStart(C)),w=!d&&C;if(x&&(u=new R(E.NO_INSERT),h=null),d){(c.isFirst()||c.isLast())&&(p=c._path._closed),c._visited=!0;break}if(w&&h&&(m.push(h),h=null),h||(h=(w&&S.push(c),{start:u._segments.length,crossings:S,visited:g=[],handleIn:_})),w&&(c=C),!isValid(c)){u.removeSegments(h.start);for(var T=0,D=g.length;T<D;T++)g[T]._visited=!1;g.length=0;do c=h&&h.crossings.shift(),(!c||!c._path)&&(c=null,h=m.pop(),h&&(g=h.visited,_=h.handleIn));while(h&&!isValid(c));if(!c)break}var O=c.getNext();u.add(new P(c._point,_,O&&c._handleOut)),c._visited=!0,g.push(c),c=O||c._path.getFirstSegment(),_=O&&O._handleIn}d&&(p&&(u.getFirstSegment().setHandleIn(_),u.setClosed(p)),u.getArea()!==0&&n.push(u))}return n}return{_getWinding:function(e,t,n){return getWinding(e,this.getCurves(),t,n)},unite:function(e,t){return traceBoolean(this,e,`unite`,t)},intersect:function(e,t){return traceBoolean(this,e,`intersect`,t)},subtract:function(e,t){return traceBoolean(this,e,`subtract`,t)},exclude:function(e,t){return traceBoolean(this,e,`exclude`,t)},divide:function(e,t){return t&&(t.trace==0||t.stroke)?splitBoolean(this,e,`divide`):createResult([this.subtract(e,t),this.intersect(e,t)],!0,this,e,t)},resolveCrossings:function(){var e=this._children,t=e||[this];function hasOverlap(e,t){var n=e&&e._intersection;return n&&n._overlap&&n._path===t}var n=!1,r=!1,a=this.getIntersections(null,function(e){return e.hasOverlap()&&(n=!0)||e.isCrossing()&&(r=!0)}),c=n&&r&&[];if(a=L.expand(a),n)for(var l=divideLocations(a,function(e){return e.hasOverlap()},c),u=l.length-1;u>=0;u--){var d=l[u],p=d._path,m=d._segment,h=m.getPrevious(),g=m.getNext();hasOverlap(h,p)&&hasOverlap(g,p)&&(m.remove(),h._handleOut._set(0,0),g._handleIn._set(0,0),h!==m&&!h.getCurve().hasLength()&&(g._handleIn.set(h._handleIn),h.remove()))}r&&(divideLocations(a,n&&function(e){var t=e.getCurve(),n=e.getSegment(),r=e._intersection,a=r._curve,o=r._segment;if(t&&a&&t._path&&a._path)return!0;n&&(n._intersection=null),o&&(o._intersection=null)},c),c&&clearCurveHandles(c),t=tracePaths(o.each(t,function(e){o.push(this,e._segments)},[])));var _=t.length,y;return _>1&&e?(t!==e&&this.setChildren(t),y=this):_===1&&!e&&(t[0]!==this&&this.setSegments(t[0].removeSegments()),y=this),y||(y=new z(E.NO_INSERT),y.addChildren(t),y=y.reduce(),y.copyAttributes(this),this.replaceWith(y)),y},reorient:function(e,t){var r=this._children;return r&&r.length?this.setChildren(reorientPaths(this.removeChildren(),function(t){return!!(e?t:t&1)},t)):t!==n&&this.setClockwise(t),this},getInteriorPoint:function(){var n=this.getBounds().getCenter(!0);if(!this.contains(n)){for(var r=this.getCurves(),a=n.y,o=[],c=[],l=0,u=r.length;l<u;l++){var d=r[l].getValues(),p=d[1],m=d[3],h=d[5],g=d[7];if(a>=e(p,m,h,g)&&a<=t(p,m,h,g))for(var _=I.getMonoCurves(d),y=0,b=_.length;y<b;y++){var x=_[y],S=x[1],C=x[7];if(S!==C&&(a>=S&&a<=C||a>=C&&a<=S)){var w=a===S?x[0]:a===C?x[6]:I.solveCubic(x,1,a,c,0,1)===1?I.getPoint(x,c[0]).x:(x[0]+x[6])/2;o.push(w)}}}o.length>1&&(o.sort(function(e,t){return e-t}),n.x=(o[0]+o[1])/2)}return n}}});var B=o.extend({_class:`PathFlattener`,initialize:function(e,t,n,r,a){var o=[],c=[],l=0,u=1/(n||32),d=e._segments,p=d[0],m;function addCurve(e,t){var n=I.getValues(e,t,a);o.push(n),computeParts(n,e._index,0,1)}function computeParts(e,n,a,o){if(o-a>u&&!(r&&I.isStraight(e))&&!I.isFlatEnough(e,t||.25)){var d=I.subdivide(e,.5),p=(a+o)/2;computeParts(d[0],n,a,p),computeParts(d[1],n,p,o)}else{var m=e[6]-e[0],h=e[7]-e[1],g=Math.sqrt(m*m+h*h);g>0&&(l+=g,c.push({offset:l,curve:e,index:n,time:o}))}}for(var h=1,g=d.length;h<g;h++)m=d[h],addCurve(p,m),p=m;e._closed&&addCurve(m||p,d[0]),this.curves=o,this.parts=c,this.length=l,this.index=0},_get:function(e){for(var t=this.parts,n=t.length,r,a=this.index;r=a,!(!a||t[--a].offset<e););for(;r<n;r++){var o=t[r];if(o.offset>=e){this.index=r;var c=t[r-1],l=c&&c.index===o.index?c.time:0,u=c?c.offset:0;return{index:o.index,time:l+(o.time-l)*(e-u)/(o.offset-u)}}}return{index:t[n-1].index,time:1}},drawPart:function(e,t,n){for(var r=this._get(t),a=this._get(n),o=r.index,c=a.index;o<=c;o++){var l=I.getPart(this.curves[o],o===r.index?r.time:0,o===a.index?a.time:1);o===r.index&&e.moveTo(l[0],l[1]),e.bezierCurveTo.apply(e,l.slice(2))}}},o.each(I._evaluateMethods,function(e){this[e+`At`]=function(t){var n=this._get(t);return I[e](this.curves[n.index],n.time)}},{})),V=o.extend({initialize:function(e){for(var t=this.points=[],n=e._segments,r=e._closed,a=0,o,c=n.length;a<c;a++){var l=n[a].point;(!o||!o.equals(l))&&t.push(o=l.clone())}r&&(t.unshift(t[t.length-1]),t.push(t[1])),this.closed=r},fit:function(e){var t=this.points,n=t.length,r=null;return n>0&&(r=[new P(t[0])],n>1&&(this.fitCubic(r,e,0,n-1,t[1].subtract(t[0]),t[n-2].subtract(t[n-1])),this.closed&&(r.shift(),r.pop()))),r},fitCubic:function(e,t,n,r,a,o){var c=this.points;if(r-n===1){var l=c[n],u=c[r],d=l.getDistance(u)/3;this.addCurve(e,[l,l.add(a.normalize(d)),u.add(o.normalize(d)),u]);return}for(var p=this.chordLengthParameterize(n,r),m=Math.max(t,t*t),h,g=!0,_=0;_<=4;_++){var y=this.generateBezier(n,r,p,a,o),b=this.findMaxError(n,r,y,p);if(b.error<t&&g){this.addCurve(e,y);return}if(h=b.index,b.error>=m)break;g=this.reparameterize(n,r,p,y),m=b.error}var x=c[h-1].subtract(c[h+1]);this.fitCubic(e,t,n,h,a,x),this.fitCubic(e,t,h,r,x.negate(),o)},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,n,r,a){for(var o=1e-12,c=Math.abs,l=this.points,u=l[e],d=l[t],p=[[0,0],[0,0]],m=[0,0],h=0,g=t-e+1;h<g;h++){var _=n[h],y=1-_,b=3*_*y,x=y*y*y,S=b*y,C=b*_,w=_*_*_,T=r.normalize(S),E=a.normalize(C),D=l[e+h].subtract(u.multiply(x+S)).subtract(d.multiply(C+w));p[0][0]+=T.dot(T),p[0][1]+=T.dot(E),p[1][0]=p[0][1],p[1][1]+=E.dot(E),m[0]+=T.dot(D),m[1]+=E.dot(D)}var O=p[0][0]*p[1][1]-p[1][0]*p[0][1],k,A;if(c(O)>o){var j=p[0][0]*m[1]-p[1][0]*m[0];k=(m[0]*p[1][1]-m[1]*p[0][1])/O,A=j/O}else{var M=p[0][0]+p[0][1],N=p[1][0]+p[1][1];k=A=c(M)>o?m[0]/M:c(N)>o?m[1]/N:0}var P=d.getDistance(u),F=o*P,I,L;if(k<F||A<F)k=A=P/3;else{var ee=d.subtract(u);I=r.normalize(k),L=a.normalize(A),I.dot(ee)-L.dot(ee)>P*P&&(k=A=P/3,I=L=null)}return[u,u.add(I||r.normalize(k)),d.add(L||a.normalize(A)),d]},reparameterize:function(e,t,n,r){for(var a=e;a<=t;a++)n[a-e]=this.findRoot(r,this.points[a],n[a-e]);for(var a=1,o=n.length;a<o;a++)if(n[a]<=n[a-1])return!1;return!0},findRoot:function(e,t,n){for(var r=[],a=[],o=0;o<=2;o++)r[o]=e[o+1].subtract(e[o]).multiply(3);for(var o=0;o<=1;o++)a[o]=r[o+1].subtract(r[o]).multiply(2);var c=this.evaluate(3,e,n),l=this.evaluate(2,r,n),u=this.evaluate(1,a,n),d=c.subtract(t),p=l.dot(l)+d.dot(u);return m.isMachineZero(p)?n:n-d.dot(l)/p},evaluate:function(e,t,n){for(var r=t.slice(),a=1;a<=e;a++)for(var o=0;o<=e-a;o++)r[o]=r[o].multiply(1-n).add(r[o+1].multiply(n));return r[0]},chordLengthParameterize:function(e,t){for(var n=[0],r=e+1;r<=t;r++)n[r-e]=n[r-e-1]+this.points[r].getDistance(this.points[r-1]);for(var r=1,a=t-e;r<=a;r++)n[r]/=n[a];return n},findMaxError:function(e,t,n,r){for(var a=Math.floor((t-e+1)/2),o=0,c=e+1;c<t;c++){var l=this.evaluate(3,n,r[c-e]).subtract(this.points[c]),u=l.x*l.x+l.y*l.y;u>=o&&(o=u,a=c)}return{error:o,index:a}}}),H=E.extend({_class:`TextItem`,_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null},_boundsOptions:{stroke:!1,handle:!1},initialize:function TextItem(e){this._content=``,this._lines=[];var t=e&&o.isPlainObject(e)&&e.x===n&&e.y===n;this._initialize(t&&e,!t&&g.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`}),U=H.extend({_class:`PointText`,initialize:function PointText(){H.apply(this,arguments)},getPoint:function(){var e=this._matrix.getTranslation();return new _(e.x,e.y,this,`setPoint`)},setPoint:function(){var e=g.read(arguments);this.translate(e.subtract(this._matrix.getTranslation()))},_draw:function(e,t,n){if(this._content){this._setStyles(e,t,n);var r=this._lines,a=this._style,o=a.hasFill(),c=a.hasStroke(),l=a.getLeading(),u=e.shadowColor;e.font=a.getFontStyle(),e.textAlign=a.getJustification();for(var d=0,p=r.length;d<p;d++){e.shadowColor=u;var m=r[d];o&&(e.fillText(m,0,0),e.shadowColor=`rgba(0,0,0,0)`),c&&e.strokeText(m,0,0),e.translate(0,l)}}},_getBounds:function(e,t){var n=this._style,r=this._lines,a=r.length,o=n.getJustification(),c=n.getLeading(),l=this.getView().getTextWidth(n.getFontStyle(),r),u=0;o!==`left`&&(u-=l/(o===`center`?2:1));var d=new x(u,a?-.75*c:0,l,a*c);return e?e._transformBounds(d,d):d}}),te=o.extend(new function(){var e={gray:[`gray`],rgb:[`red`,`green`,`blue`],hsb:[`hue`,`saturation`,`brightness`],hsl:[`hue`,`saturation`,`lightness`],gradient:[`gradient`,`origin`,`destination`,`highlight`]},t={},n={transparent:[0,0,0,0]},a;function fromCSS(e){var t=e.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||e.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),o=`rgb`,c;if(t){var l=t[4]?4:3;c=Array(l);for(var u=0;u<l;u++){var d=t[u+1];c[u]=parseInt(d.length==1?d+d:d,16)/255}}else if(t=e.match(/^(rgb|hsl)a?\((.*)\)$/)){o=t[1],c=t[2].trim().split(/[,\s]+/g);for(var p=o===`hsl`,u=0,m=Math.min(c.length,4);u<m;u++){var h=c[u],d=parseFloat(h);if(p)if(u===0){var g=h.match(/([a-z]*)$/)[1];d*={turn:360,rad:180/Math.PI,grad:.9}[g]||1}else u<3&&(d/=100);else u<3&&(d/=/%$/.test(h)?100:255);c[u]=d}}else{var _=n[e];if(!_)if(r){a||(a=me.getContext(1,1,{willReadFrequently:!0}),a.globalCompositeOperation=`copy`),a.fillStyle=`rgba(0,0,0,0)`,a.fillStyle=e,a.fillRect(0,0,1,1);var y=a.getImageData(0,0,1,1).data;_=n[e]=[y[0]/255,y[1]/255,y[2]/255]}else _=[0,0,0];c=_.slice()}return[o,c]}var c=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],l={"rgb-hsb":function(e,t,n){var r=Math.max(e,t,n),a=r-Math.min(e,t,n);return[a===0?0:(r==e?(t-n)/a+(t<n?6:0):r==t?(n-e)/a+2:(e-t)/a+4)*60,r===0?0:a/r,r]},"hsb-rgb":function(e,t,n){e=(e/60%6+6)%6;var r=Math.floor(e),a=e-r,r=c[r],o=[n,n*(1-t),n*(1-t*a),n*(1-t*(1-a))];return[o[r[0]],o[r[1]],o[r[2]]]},"rgb-hsl":function(e,t,n){var r=Math.max(e,t,n),a=Math.min(e,t,n),o=r-a,c=o===0,l=c?0:(r==e?(t-n)/o+(t<n?6:0):r==t?(n-e)/o+2:(e-t)/o+4)*60,u=(r+a)/2;return[l,c?0:u<.5?o/(r+a):o/(2-r-a),u]},"hsl-rgb":function(e,t,n){if(e=(e/360%1+1)%1,t===0)return[n,n,n];for(var r=[e+1/3,e,e-1/3],a=n<.5?n*(1+t):n+t-n*t,o=2*n-a,c=[],l=0;l<3;l++){var u=r[l];u<0&&(u+=1),u>1&&--u,c[l]=6*u<1?o+(a-o)*6*u:2*u<1?a:3*u<2?o+(a-o)*(2/3-u)*6:o}return c},"rgb-gray":function(e,t,n){return[e*.2989+t*.587+n*.114]},"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 o.each(e,function(n,r){t[r]=[],o.each(n,function(n,a){var c=o.capitalize(n),l=/^(hue|saturation)$/.test(n),u=t[r][a]=r===`gradient`?n===`gradient`?function(e){var t=this._components[0];return e=W.read(Array.isArray(e)?e:arguments,0,{readNull:!0}),t!==e&&(t&&t._removeOwner(this),e&&e._addOwner(this)),e}:function(){return g.read(arguments,0,{readNull:n===`highlight`,clone:!0})}:function(e){return e==null||isNaN(e)?0:+e};this[`get`+c]=function(){return this._type===r||l&&/^hs[bl]$/.test(this._type)?this._components[a]:this._convert(r)[a]},this[`set`+c]=function(t){this._type!==r&&!(l&&/^hs[bl]$/.test(this._type))&&(this._components=this._convert(r),this._properties=e[r],this._type=r),this._components[a]=u.call(this,t),this._changed()}},this)},{_class:`Color`,_readIndex:!0,initialize:function Color(n){var r=arguments,a=this.__read,c=0,l,u,d,p;Array.isArray(n)&&(r=n,n=r[0]);var m=n!=null&&typeof n;if(m===`string`&&n in e&&(l=n,n=r[1],Array.isArray(n)?(u=n,d=r[2]):(a&&(c=1),r=o.slice(r,1),m=typeof n)),!u){if(p=m===`number`?r:m===`object`&&n.length!=null?n:null,p){l||(l=p.length>=3?`rgb`:`gray`);var h=e[l].length;d=p[h],a&&(c+=p===arguments?h+(d==null?0:1):1),p.length>h&&(p=o.slice(p,0,h))}else if(m===`string`){var g=fromCSS(n);l=g[0],u=g[1],u.length===4&&(d=u[3],u.length--)}else if(m===`object`)if(n.constructor===Color){if(l=n._type,u=n._components.slice(),d=n._alpha,l===`gradient`)for(var _=1,y=u.length;_<y;_++){var b=u[_];b&&(u[_]=b.clone())}}else if(n.constructor===W)l=`gradient`,p=r;else{l=`hue`in n?`lightness`in n?`hsl`:`hsb`:`gradient`in n||`stops`in n||`radial`in n?`gradient`:`gray`in n?`gray`:`rgb`;var x=e[l],S=t[l];this._components=u=[];for(var _=0,y=x.length;_<y;_++){var C=n[x[_]];C==null&&!_&&l===`gradient`&&`stops`in n&&(C={stops:n.stops,radial:n.radial}),C=S[_].call(this,C),C!=null&&(u[_]=C)}d=n.alpha}a&&l&&(c=1)}if(this._type=l||`rgb`,!u){this._components=u=[];for(var S=t[this._type],_=0,y=S.length;_<y;_++){var C=S[_].call(this,p&&p[_]);C!=null&&(u[_]=C)}}return this._components=u,this._properties=e[this._type],this._alpha=d,a&&(this.__read=c),this},set:`#initialize`,_serialize:function(e,t){var n=this.getComponents();return o.serialize(/^(gray|rgb)$/.test(this._type)?n:[this._type].concat(n),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=l[this._type+`-`+e])?t.apply(this,this._components):l[`rgb-`+e].apply(this,l[this._type+`-rgb`].apply(this,this._components))},convert:function(e){return new te(e,this._convert(e),this._alpha)},getType:function(){return this._type},setType:function(t){this._components=this._convert(t),this._properties=e[t],this._type=t},getComponents:function(){var e=this._components.slice();return this._alpha!=null&&e.push(this._alpha),e},getAlpha:function(){return this._alpha==null?1:this._alpha},setAlpha:function(e){this._alpha=e==null?null:Math.min(Math.max(e,0),1),this._changed()},hasAlpha:function(){return this._alpha!=null},equals:function(e){var t=o.isPlainValue(e,!0)?te.read(arguments):e;return t===this||t&&this._class===t._class&&this._type===t._type&&this.getAlpha()===t.getAlpha()&&o.equals(this._components,t._components)||!1},toString:function(){for(var e=this._properties,t=[],n=this._type===`gradient`,r=p.instance,a=0,o=e.length;a<o;a++){var c=this._components[a];c!=null&&t.push(e[a]+`: `+(n?c:r.number(c)))}return this._alpha!=null&&t.push(`alpha: `+r.number(this._alpha)),`{ `+t.join(`, `)+` }`},toCSS:function(e){var t=this._convert(`rgb`),n=e||this._alpha==null?1:this._alpha;function convert(e){return Math.round((e<0?0:e>1?1:e)*255)}return t=[convert(t[0]),convert(t[1]),convert(t[2])],n<1&&t.push(n<0?0:n),e?`#`+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1):(t.length==4?`rgba(`:`rgb(`)+t.join(`,`)+`)`},toCanvasStyle:function(e,t){if(this._canvasStyle)return this._canvasStyle;if(this._type!==`gradient`)return this._canvasStyle=this.toCSS();var n=this._components,r=n[0],a=r._stops,o=n[1],c=n[2],l=n[3],u=t&&t.inverted(),d;if(u&&(o=u._transformPoint(o),c=u._transformPoint(c),l&&(l=u._transformPoint(l))),r._radial){var p=c.getDistance(o);if(l){var m=l.subtract(o);m.getLength()>p&&(l=o.add(m.normalize(p-.1)))}var h=l||o;d=e.createRadialGradient(h.x,h.y,0,o.x,o.y,p)}else d=e.createLinearGradient(o.x,o.y,c.x,c.y);for(var g=0,_=a.length;g<_;g++){var y=a[g],b=y._offset;d.addColorStop(b??g/(_-1),y._color.toCanvasStyle())}return this._canvasStyle=d},transform:function(e){if(this._type===`gradient`){for(var t=this._components,n=1,r=t.length;n<r;n++){var a=t[n];e._transformPoint(a,a,!0)}this._changed()}},statics:{_types:e,random:function(){var e=Math.random;return new te(e(),e(),e())},_setOwner:function(e,t,n){return e&&(e._owner&&t&&e._owner!==t&&(e=e.clone()),!e._owner^!t&&(e._owner=t||null,e._setter=n||null)),e}}})},new function(){return o.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=te.read(arguments);for(var n=this._type,r=this._components,a=t._convert(n),o=0,c=r.length;o<c;o++)a[o]=e(r[o],a[o]);return new te(n,a,this._alpha==null?null:e(this._alpha,t.getAlpha()))}},{})}),W=o.extend({_class:`Gradient`,initialize:function Gradient(e,t){this._id=h.get(),e&&o.isPlainObject(e)&&(this.set(e),e=t=null),this._stops??this.setStops(e||[`white`,`black`]),this._radial??this.setRadial(typeof t==`string`&&t===`radial`||t||!1)},_serialize:function(e,t){return t.add(this,function(){return o.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 t=this._owners?this._owners.indexOf(e):-1;t!=-1&&(this._owners.splice(t,1),this._owners.length||(this._owners=n))},clone:function(){for(var e=[],t=0,n=this._stops.length;t<n;t++)e[t]=this._stops[t].clone();return new W(e,this._radial)},getStops:function(){return this._stops},setStops:function(e){if(e.length<2)throw Error(`Gradient stop list needs to contain at least two stops.`);var t=this._stops;if(t)for(var r=0,a=t.length;r<a;r++)t[r]._owner=n;t=this._stops=ne.readList(e,0,{clone:!0});for(var r=0,a=t.length;r<a;r++)t[r]._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,n=e._stops,r=t.length;if(r===n.length){for(var a=0;a<r;a++)if(!t[a].equals(n[a]))return!1;return!0}}return!1}}),ne=o.extend({_class:`GradientStop`,initialize:function GradientStop(e,t){var r=e,a=t;typeof e==`object`&&t===n&&(Array.isArray(e)&&typeof e[0]!=`number`?(r=e[0],a=e[1]):(`color`in e||`offset`in e||`rampPoint`in e)&&(r=e.color,a=e.offset||e.rampPoint||0)),this.setColor(r),this.setOffset(a)},clone:function(){return new ne(this._color.clone(),this._offset)},_serialize:function(e,t){var n=this._color,r=this._offset;return o.serialize(r==null?[n]:[n,r],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(){te._setOwner(this._color,null),this._color=te._setOwner(te.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}}),re=o.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 g,selectedColor:null},t=o.set({},e,{fontFamily:`sans-serif`,fontWeight:`normal`,fontSize:12,leading:null,justification:`left`}),r=o.set({},t,{fillColor:new te}),a={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,justification:9},c={beans:!0},l={_class:`Style`,beans:!0,initialize:function Style(n,a,o){this._values={},this._owner=a,this._project=a&&a._project||o||X.project,this._defaults=!a||a instanceof D?t:a instanceof H?r:e,n&&this.set(n)}};return o.each(t,function(e,t){var r=/Color$/.test(t),u=t===`shadowOffset`,d=o.capitalize(t),p=a[t],m=`set`+d,h=`get`+d;l[m]=function(e){var n=this._owner,a=n&&n._children,o=a&&a.length>0&&!(n instanceof z);if(o)for(var c=0,l=a.length;c<l;c++)a[c]._style[m](e);if((t===`selectedColor`||!o)&&t in this._defaults){var u=this._values[t];u!==e&&(r&&(u&&(te._setOwner(u,null),u._canvasStyle=null),e&&e.constructor===te&&(e=te._setOwner(e,n,o&&m))),this._values[t]=e,n&&n._changed(p||129))}},l[h]=function(e){var a=this._owner,c=a&&a._children,l=c&&c.length>0&&!(a instanceof z),d;if(l&&!e)for(var p=0,_=c.length;p<_;p++){var y=c[p]._style[h]();if(!p)d=y;else if(!o.equals(d,y))return n}else if(t in this._defaults){var d=this._values[t];if(d===n)d=this._defaults[t],d&&d.clone&&(d=d.clone());else{var b=r?te:u?g:null;b&&!(d&&d.constructor===b)&&(this._values[t]=d=b.read([d],0,{readNull:!0,clone:!0}))}}return d&&r&&(d=te._setOwner(d,a,l&&m)),d},c[h]=function(e){return this._style[h](e)},c[m]=function(e){this._style[m](e)}}),o.each({Font:`FontFamily`,WindingRule:`FillRule`},function(e,t){var n=`get`+t,r=`set`+t;l[n]=c[n]=`#get`+e,l[r]=c[r]=`#set`+e}),E.inject(c),l},{set:function(e){var t=e instanceof re,n=t?e._values:e;if(n){for(var r in n)if(r in this._defaults){var a=n[r];this[r]=a&&t&&a.clone?a.clone():a}}},equals:function(e){function compare(e,t,r){var a=e._values,c=t._values,l=t._defaults;for(var u in a){var d=a[u],p=c[u];if(!(r&&u in c)&&!o.equals(d,p===n?l[u]:p))return!1}return!0}return e===this||e&&this._class===e._class&&compare(this,e)&&compare(e,this,!0)||!1},_dispose:function(){var e=this.getFillColor();e&&(e._canvasStyle=null),e=this.getStrokeColor(),e&&(e._canvasStyle=null),e=this.getShadowColor(),e&&(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 getLeading(){var e=getLeading.base.call(this),t=this.getFontSize();return/pt|em|%|px/.test(t)&&(t=this.getView().getPixelSize(t)),e??t*1.2}}),ie=new function(){function handlePrefix(e,t,n,r){for(var a=[``,`webkit`,`moz`,`Moz`,`ms`,`o`],o=t[0].toUpperCase()+t.substring(1),c=0;c<6;c++){var l=a[c],u=l?l+o:t;if(u in e){if(n)e[u]=r;else return e[u];break}}}return{getStyles:function(e){var t=e&&e.nodeType!==9?e.ownerDocument:e,n=t&&t.defaultView;return n&&n.getComputedStyle(e,``)},getBounds:function(e,t){var n=e.ownerDocument,r=n.body,a=n.documentElement,o;try{o=e.getBoundingClientRect()}catch{o={left:0,top:0,width:0,height:0}}var c=o.left-(a.clientLeft||r.clientLeft||0),l=o.top-(a.clientTop||r.clientTop||0);if(!t){var u=n.defaultView;c+=u.pageXOffset||a.scrollLeft||r.scrollLeft,l+=u.pageYOffset||a.scrollTop||r.scrollTop}return new x(c,l,o.width,o.height)},getViewportBounds:function(e){var t=e.ownerDocument,n=t.defaultView,r=t.documentElement;return new x(0,0,n.innerWidth||r.clientWidth,n.innerHeight||r.clientHeight)},getOffset:function(e,t){return ie.getBounds(e,t).getPoint()},getSize:function(e){return ie.getBounds(e,!0).getSize()},isInvisible:function(e){return ie.getSize(e).equals(new y(0,0))},isInView:function(e){return!ie.isInvisible(e)&&ie.getViewportBounds(e).intersects(ie.getBounds(e,!0))},isInserted:function(e){return a.body.contains(e)},getPrefixed:function(e,t){return e&&handlePrefix(e,t)},setPrefixed:function(e,t,n){if(typeof t==`object`)for(var r in t)handlePrefix(e,r,!0,t[r]);else handlePrefix(e,t,!0,n)}}},ae={add:function(e,t){if(e)for(var n in t)for(var r=t[n],o=n.split(/[\s,]+/g),c=0,l=o.length;c<l;c++){var u=o[c],d=e===a&&(u===`touchstart`||u===`touchmove`)?{passive:!1}:!1;e.addEventListener(u,r,d)}},remove:function(e,t){if(e)for(var n in t)for(var r=t[n],a=n.split(/[\s,]+/g),o=0,c=a.length;o<c;o++)e.removeEventListener(a[o],r,!1)},getPoint:function(e){var t=e.targetTouches?e.targetTouches.length?e.targetTouches[0]:e.changedTouches[0]:e;return new g(t.pageX||t.clientX+a.documentElement.scrollLeft,t.pageY||t.clientY+a.documentElement.scrollTop)},getTarget:function(e){return e.target||e.srcElement},getRelatedTarget:function(e){return e.relatedTarget||e.toElement},getOffset:function(e,t){return ae.getPoint(e).subtract(ie.getOffset(t||ae.getTarget(e)))}};ae.requestAnimationFrame=new function(){var e=ie.getPrefixed(r,`requestAnimationFrame`),t=!1,n=[],a;function handleCallbacks(){var r=n;n=[];for(var a=0,o=r.length;a<o;a++)r[a]();t=e&&n.length,t&&e(handleCallbacks)}return function(r){n.push(r),e?t||(t=(e(handleCallbacks),!0)):a||(a=setInterval(handleCallbacks,1e3/60))}};var G=o.extend(c,{_class:`View`,initialize:function View(e,t){function getSize(e){return t[e]||parseInt(t.getAttribute(e),10)}function getCanvasSize(){var e=ie.getSize(t);return e.isNaN()||e.isZero()?new y(getSize(`width`),getSize(`height`)):e}var n;if(r&&t){this._id=t.getAttribute(`id`),this._id??t.setAttribute(`id`,this._id=`paper-view-`+ View._id++),ae.add(t,this._viewEvents);var o=`none`;if(ie.setPrefixed(t.style,{userDrag:o,userSelect:o,touchCallout:o,contentZooming:o,tapHighlightColor:`rgba(0,0,0,0)`}),l.hasAttribute(t,`resize`)){var c=this;ae.add(r,this._windowEvents={resize:function(){c.setViewSize(getCanvasSize())}})}if(n=getCanvasSize(),l.hasAttribute(t,`stats`)&&typeof Stats<`u`){this._stats=new Stats;var u=this._stats.domElement,d=u.style,p=ie.getOffset(t);d.position=`absolute`,d.left=p.x+`px`,d.top=p.y+`px`,a.body.appendChild(u)}}else n=new y(t),t=null;this._project=e,this._scope=e._scope,this._element=t,this._pixelRatio||(this._pixelRatio=r&&r.devicePixelRatio||1),this._setElementSize(n.width,n.height),this._viewSize=n,View._views.push(this),View._viewsById[this._id]=this,(this._matrix=new C)._owner=this,View._focused||(View._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!X.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;G._focused===this&&(G._focused=null),G._views.splice(G._views.indexOf(this),1),delete G._viewsById[this._id];var e=this._project;return e._view===this&&(e._view=null),ae.remove(this._element,this._viewEvents),ae.remove(r,this._windowEvents),this._element=this._project=null,this.off(`frame`),this._animate=!1,this._frameItems={},!0},_events:o.each(E._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;ae.requestAnimationFrame(function(){if(e._requested=!1,e._animate){e.requestUpdate();var t=e._element;(!ie.getPrefixed(a,`hidden`)||l.getAttribute(t,`keepalive`)===`true`)&&ie.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(){X=this._scope;var e=Date.now()/1e3,t=this._last?e-this._last:0;this._last=e,this.emit(`frame`,new o({delta:t,time:this._time+=t,count:this._count++})),this._stats&&this._stats.update()},_animateItem:function(e,t){var n=this._frameItems;t?(n[e._id]={item:e,time:0,count:0},++this._frameItemCount===1&&this.on(`frame`,this._handleFrameItems)):(delete n[e._id],--this._frameItemCount===0&&this.off(`frame`,this._handleFrameItems))},_handleFrameItems:function(e){for(var t in this._frameItems){var n=this._frameItems[t];n.item.emit(`frame`,new o(e,{time:n.time+=e.delta,count:n.count++}))}},_changed:function(){this._project._changed(4097),this._bounds=this._decomposed=n},getElement:function(){return this._element},getPixelRatio:function(){return this._pixelRatio},getResolution:function(){return this._pixelRatio*72},getViewSize:function(){var e=this._viewSize;return new b(e.width,e.height,this,`setViewSize`)},setViewSize:function(){var e=y.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 n=this._element;n&&(n.width!==e&&(n.width=e),n.height!==t&&(n.height=t))},getBounds:function(){return this._bounds||(this._bounds=this._matrix.inverted()._transformBounds(new x(new g,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return ie.isInView(this._element)},isInserted:function(){return ie.isInserted(this._element)},getPixelSize:function(e){var t=this._element,n;if(t){var r=t.parentNode,o=a.createElement(`div`);o.style.fontSize=e,r.appendChild(o),n=parseFloat(ie.getStyles(o).fontSize),r.removeChild(o)}else n=parseFloat(n);return n},getTextWidth:function(e,t){return 0}},o.each([`rotate`,`scale`,`shear`,`skew`],function(e){var t=e===`rotate`;this[e]=function(){var n=arguments,r=(t?o:g).read(n),a=g.read(n,0,{readNull:!0});return this.transform(new C()[e](r,a||this.getCenter(!0)))}},{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var e=new C;return this.transform(e.translate.apply(e,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var e=g.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 C().scale(e/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(e){var t=this.getRotation();t!=null&&e!=null&&this.rotate(e-t)},getScaling:function(){var e=this._decompose().scaling;return new _(e.x,e.y,this,`setScaling`)},setScaling:function(){var e=this.getScaling(),t=g.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(g.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(g.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(g.read(arguments))},getEventPoint:function(e){return this.viewToProject(ae.getOffset(e,this._element))}},{statics:{_views:[],_viewsById:{},_id:0,create:function(e,t){return a&&typeof t==`string`&&(t=a.getElementById(t)),new(r?K:G)(e,t)}}},new function(){if(!r)return;var e,t,n=!1,o=!1;function getView(e){var t=ae.getTarget(e);return t.getAttribute&&G._viewsById[t.getAttribute(`id`)]}function updateFocus(){var e=G._focused;if(!e||!e.isVisible()){for(var n=0,r=G._views.length;n<r;n++)if((e=G._views[n]).isVisible()){G._focused=t=e;break}}}function handleMouseMove(e,t,n){e._handleMouseEvent(`mousemove`,t,n)}var c=r.navigator,l,u,d;c.pointerEnabled||c.msPointerEnabled?(l=`pointerdown MSPointerDown`,u=`pointermove MSPointerMove`,d=`pointerup pointercancel MSPointerUp MSPointerCancel`):(l=`touchstart`,u=`touchmove`,d=`touchend touchcancel`,`ontouchstart`in r&&c.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(l+=` mousedown`,u+=` mousemove`,d+=` mouseup`));var p={},m={mouseout:function(e){var t=G._focused,n=ae.getRelatedTarget(e);if(t&&(!n||n.nodeName===`HTML`)){var r=ae.getOffset(e,t._element),a=r.x,o=Math.abs,c=o(a),l=c-(1<<25);r.x=o(l)<c?l*(a<0?-1:1):a,handleMouseMove(t,e,t.viewToProject(r))}},scroll:updateFocus};p[l]=function(e){var t=G._focused=getView(e);n||(n=!0,t._handleMouseEvent(`mousedown`,e))},m[u]=function(n){var r=G._focused;if(!o){var a=getView(n);a?r!==a&&(r&&handleMouseMove(r,n),e||(e=r),r=G._focused=t=a):t&&t===r&&(e&&!e.isInserted()&&(e=null),r=G._focused=e,e=null,updateFocus())}r&&handleMouseMove(r,n)},m[l]=function(){o=!0},m[d]=function(e){var t=G._focused;t&&n&&t._handleMouseEvent(`mouseup`,e),o=n=!1},ae.add(a,m),ae.add(r,{load:updateFocus});var h=!1,g=!1,_={doubleclick:`click`,mousedrag:`mousemove`},y=!1,b,x,S,C,w,T,E,D;function emitMouseEvent(e,t,n,r,a,o,c){var l=!1,u;function emit(e,n){if(e.responds(n)){if(u||(u=new q(n,r,a,t||e,o?a.subtract(o):null)),e.emit(n,u)&&(h=!0,u.prevented&&(g=!0),u.stopped))return l=!0}else{var c=_[n];if(c)return emit(e,c)}}for(;e&&e!==c&&!emit(e,n);)e=e._parent;return l}function emitMouseEvents(e,t,n,r,a,o){return e._project.removeOn(n),g=h=!1,w&&emitMouseEvent(w,null,n,r,a,o)||t&&t!==w&&!t.isDescendant(w)&&emitMouseEvent(t,null,n===`mousedrag`?`mousemove`:n,r,a,o,w)||emitMouseEvent(e,w||t||e,n,r,a,o)}var O={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:p,_handleMouseEvent:function(e,t,r){var a=this._itemEvents,o=a.native[e],c=e===`mousemove`,l=this._scope.tool,u=this;function responds(e){return a.virtual[e]||u.responds(e)||l&&l.responds(e)}c&&n&&responds(`mousedrag`)&&(e=`mousedrag`),r||(r=this.getEventPoint(t));var d=this.getBounds().contains(r),p=o&&d&&u._project.hitTest(r,{tolerance:0,fill:!0,stroke:!0}),m=p&&p.item||null,_=!1,O={};if(O[e.substr(5)]=!0,o&&m!==C&&(C&&emitMouseEvent(C,null,`mouseleave`,t,r),m&&emitMouseEvent(m,null,`mouseenter`,t,r),C=m),y^d&&(emitMouseEvent(this,null,d?`mouseenter`:`mouseleave`,t,r),_=!0),(d||O.drag)&&!r.equals(x)&&(emitMouseEvents(this,m,c?e:`mousemove`,t,r,x),_=!0),y=d,O.down&&d||O.up&&b){if(emitMouseEvents(this,m,e,t,r,b),O.down){if(D=m===T&&Date.now()-E<300,S=T=m,!g&&m){for(var k=m;k&&!k.responds(`mousedrag`);)k=k._parent;k&&(w=m)}b=r}else O.up&&(!g&&m===S&&(E=Date.now(),emitMouseEvents(this,m,D?`doubleclick`:`click`,t,r,b),D=!1),S=w=null);y=!1,_=!0}x=r,_&&l&&(h=l._handleMouseEvent(e,t,r,O)||h),t.cancelable!==!1&&(h&&!O.move||O.down&&responds(`mouseup`))&&t.preventDefault()},_handleKeyEvent:function(e,t,n,r){var a=this._scope,o=a.tool,c;function emit(o){o.responds(e)&&(X=a,o.emit(e,c||(c=new se(e,t,n,r))))}this.isVisible()&&(emit(this),o&&o.responds(e)&&emit(o))},_countItemEvent:function(e,t){var n=this._itemEvents,r=n.native,a=n.virtual;for(var o in O)r[o]=(r[o]||0)+(O[o][e]||0)*t;a[e]=(a[e]||0)+t},statics:{updateFocus,_resetState:function(){n=o=h=y=!1,e=t=b=x=S=C=w=T=E=D=null}}}}),K=G.extend({_class:`CanvasView`,initialize:function CanvasView(e,t){if(!(t instanceof r.HTMLCanvasElement)){var n=y.read(arguments,1);if(n.isZero())throw Error(`Cannot create CanvasView with the provided argument: `+o.slice(arguments,1));t=me.getCanvas(n)}var a=this._context=t.getContext(`2d`);a.save(),this._pixelRatio=1,/^off|false$/.test(l.getAttribute(t,`hidpi`))||(this._pixelRatio=(r.devicePixelRatio||1)/(ie.getPrefixed(a,`backingStorePixelRatio`)||1)),G.call(this,e,t),this._needsUpdate=!0},remove:function remove(){return this._context.restore(),remove.base.call(this)},_setElementSize:function _setElementSize(e,t){var n=this._pixelRatio;if(_setElementSize.base.call(this,e*n,t*n),n!==1){var r=this._element,a=this._context;if(!l.hasAttribute(r,`resize`)){var o=r.style;o.width=e+`px`,o.height=t+`px`}a.restore(),a.save(),a.scale(n,n)}},getContext:function(){return this._context},getPixelSize:function getPixelSize(e){var t=X.agent,n;if(t&&t.firefox)n=getPixelSize.base.call(this,e);else{var r=this._context,a=r.font;r.font=e+` serif`,n=parseFloat(r.font),r.font=a}return n},getTextWidth:function(e,t){var n=this._context,r=n.font,a=0;n.font=e;for(var o=0,c=t.length;o<c;o++)a=Math.max(a,n.measureText(t[o]).width);return n.font=r,a},update:function(){if(!this._needsUpdate)return!1;var e=this._project,t=this._context,n=this._viewSize;return t.clearRect(0,0,n.width+1,n.height+1),e&&e.draw(t,this._matrix,this._pixelRatio),this._needsUpdate=!1,!0}}),oe=o.extend({_class:`Event`,initialize:function Event(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 ce.modifiers}}),se=oe.extend({_class:`KeyEvent`,initialize:function KeyEvent(e,t,n,r){this.type=e,this.event=t,this.key=n,this.character=r},toString:function(){return`{ type: '`+this.type+`', key: '`+this.key+`', character: '`+this.character+`', modifiers: `+this.getModifiers()+` }`}}),ce=new function(){var e={" ":`tab`," ":`space`,"\b":`backspace`,"":`delete`,Spacebar:`space`,Del:`delete`,Win:`meta`,Esc:`escape`},t={tab:` `,space:` `,enter:`\r`},c={},l={},u,d,p=new o({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var e=X&&X.agent;return e&&e.mac?this.meta:this.control}}});function getKey(t){var r=t.key||t.keyIdentifier;return r=/^U\+/.test(r)?String.fromCharCode(parseInt(r.substr(2),16)):/^Arrow[A-Z]/.test(r)?r.substr(5):r===`Unidentified`||r===n?String.fromCharCode(t.keyCode):r,e[r]||(r.length>1?o.hyphenate(r):r.toLowerCase())}function handleKey(e,t,n,r){var a=G._focused,d;if(c[t]=e,e?l[t]=n:delete l[t],t.length>1&&(d=o.camelize(t))in p){p[d]=e;var m=X&&X.agent;if(d===`meta`&&m&&m.mac)if(e)u={};else{for(var h in u)h in l&&handleKey(!1,h,u[h],r);u=null}}else e&&u&&(u[t]=n);a&&a._handleKeyEvent(e?`keydown`:`keyup`,r,t,n)}return ae.add(a,{keydown:function(e){var n=getKey(e),r=X&&X.agent;n.length>1||r&&r.chrome&&(e.altKey||r.mac&&e.metaKey||!r.mac&&e.ctrlKey)?handleKey(!0,n,t[n]||(n.length>1?``:n),e):d=n},keypress:function(e){if(d){var t=getKey(e),n=e.charCode,r=n>=32?String.fromCharCode(n):t.length>1?``:t;t!==d&&(t=r.toLowerCase()),handleKey(!0,t,r,e),d=null}},keyup:function(e){var t=getKey(e);t in l&&handleKey(!1,t,l[t],e)}}),ae.add(r,{blur:function(e){for(var t in l)handleKey(!1,t,l[t],e)}}),{modifiers:p,isDown:function(e){return!!c[e]}}},q=oe.extend({_class:`MouseEvent`,initialize:function MouseEvent(e,t,n,r,a){this.type=e,this.event=t,this.point=n,this.target=r,this.delta=a},toString:function(){return`{ type: '`+this.type+`', point: `+this.point+`, target: `+this.target+(this.delta?`, delta: `+this.delta:``)+`, modifiers: `+this.getModifiers()+` }`}}),le=oe.extend({_class:`ToolEvent`,_item:null,initialize:function ToolEvent(e,t,n){this.tool=e,this.type=t,this.event=n},_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,n=t._parent;/^(Group|CompoundPath)$/.test(n._class);)t=n,n=n._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()+` }`}}),ue=u.extend({_class:`Tool`,_list:`tools`,_reference:`tool`,_events:[`onMouseDown`,`onMouseUp`,`onMouseDrag`,`onMouseMove`,`onActivate`,`onDeactivate`,`onEditOptions`,`onKeyDown`,`onKeyUp`],initialize:function Tool(e){u.call(this),this._moveCount=-1,this._downCount=-1,this.set(e)},getMinDistance:function(){return this._minDistance},setMinDistance:function(e){this._minDistance=e,e!=null&&this._maxDistance!=null&&e>this._maxDistance&&(this._maxDistance=e)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(e){this._maxDistance=e,this._minDistance!=null&&e!=null&&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,n,r){X=this._scope,r.drag&&!this.responds(e)&&(e=`mousemove`);var a=r.move||r.drag,o=this.responds(e),c=!1,l=this;function update(e,t){var o=n,c=a?l._point:l._downPoint||o;if(a){if(l._moveCount>=0&&o.equals(c))return!1;if(c&&(e!=null||t!=null)){var u=o.subtract(c),d=u.getLength();if(d<(e||0))return!1;t&&(o=c.add(u.normalize(Math.min(d,t))))}l._moveCount++}return l._point=o,l._lastPoint=c||o,r.down&&(l._moveCount=-1,l._downPoint=o,l._downCount++),!0}function emit(){o&&(c=l.emit(e,new le(l,e,t))||c)}if(r.down)update(),emit();else if(r.up)update(null,this._maxDistance),emit();else if(o)for(;update(this._minDistance,this._maxDistance);)emit();return c}}),de=o.extend(c,{_class:`Tween`,statics:{easings:new o({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:-1+2*(2-e)*e},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 Tween(e,t,n,r,a,o){this.object=e;var c=typeof a,l=c===`function`;this.type=l?c:c===`string`?a:`linear`,this.easing=l?a:Tween.easings[this.type],this.duration=r,this.running=!1,this._then=null,this._startTime=null;var u=t||n;this._keys=u?Object.keys(u):[],this._parsedKeys=this._parseKeys(this._keys),this._from=u&&this._getState(t),this._to=u&&this._getState(n),o!==!1&&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),n=this._keys,getValue=function(n){return typeof n==`function`?n(t,e):n},r=0,a=n&&n.length;r<a;r++){var c=n[r],l=getValue(this._from[c]),u=getValue(this._to[c]),d=l&&u&&l.__add&&u.__add?u.__subtract(l).__multiply(t).__add(l):(u-l)*t+l;this._setProperty(this._parsedKeys[c],d)}this.responds(`update`)&&this.emit(`update`,new o({progress:e,factor:t})),!this.running&&this._then&&this._then(this.object)}return this},_events:{onUpdate:{}},_handleFrame:function(e){var t=this._startTime,n=t?(e-t)/this.duration:0;t||(this._startTime=e),this.update(n)},_getState:function(e){for(var t=this._keys,n={},r=0,a=t.length;r<a;r++){var o=t[r],c=this._parsedKeys[o],l=this._getProperty(c),u;if(e){var d=this._resolveValue(l,e[o]);this._setProperty(c,d),u=this._getProperty(c),u=u&&u.clone?u.clone():u,this._setProperty(c,l)}else u=l&&l.clone?l.clone():l;n[o]=u}return n},_resolveValue:function(e,t){if(t){if(Array.isArray(t)&&t.length===2){var n=t[0];return n&&n.match&&n.match(/^[+\-\*\/]=/)?this._calculate(e,n[0],t[1]):t}else if(typeof t==`string`){var r=t.match(/^[+\-*/]=(.*)/);if(r){var a=JSON.parse(r[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,`"$2": `));return this._calculate(e,t[0],a)}}}return t},_calculate:function(e,t,n){return X.PaperScript.calculateBinary(e,t,n)},_parseKeys:function(e){for(var t={},n=0,r=e.length;n<r;n++){var a=e[n];t[a]=a.replace(/\.([^.]*)/g,`/$1`).replace(/\[['"]?([^'"\]]*)['"]?\]/g,`/$1`).split(`/`)}return t},_getProperty:function(e,t){for(var n=this.object,r=0,a=e.length-(t||0);r<a&&n;r++)n=n[e[r]];return n},_setProperty:function(e,t){var n=this._getProperty(e,1);n&&(n[e[e.length-1]]=t)}}),pe={request:function(t){var n=new e.XMLHttpRequest;return n.open((t.method||`get`).toUpperCase(),t.url,o.pick(t.async,!0)),t.mimeType&&n.overrideMimeType(t.mimeType),n.onload=function(){var e=n.status;e===0||e===200?t.onLoad&&t.onLoad.call(n,n.responseText):n.onerror()},n.onerror=function(){var e=n.status,r=`Could not load "`+t.url+`" (Status: `+e+`)`;if(t.onError)t.onError(r,e);else throw Error(r)},n.send(null)}},me=o.exports.CanvasProvider={canvases:[],getCanvas:function(e,t,n){if(!r)return null;var o,c=!0;typeof e==`object`&&(t=e.height,e=e.width),this.canvases.length?o=this.canvases.pop():(o=a.createElement(`canvas`),c=!1);var l=o.getContext(`2d`,n||{});if(!l)throw Error(`Canvas `+o+` is unable to provide a 2D context.`);return o.width===e&&o.height===t?c&&l.clearRect(0,0,e+1,t+1):(o.width=e,o.height=t),l.save(),o},getContext:function(e,t,n){var r=this.getCanvas(e,t,n);return r?r.getContext(`2d`,n||{}):null},release:function(e){var t=e&&e.canvas?e.canvas:e;t&&t.getContext&&(t.getContext(`2d`).restore(),this.canvases.push(t))}},he=new function(){var e=Math.min,t=Math.max,n=Math.abs,r,a,c,l,u,d,p,m,h,g,_;function getLum(e,t,n){return .2989*e+.587*t+.114*n}function setLum(n,r,a,o){var c=o-getLum(n,r,a);h=n+c,g=r+c,_=a+c;var o=getLum(h,g,_),l=e(h,g,_),u=t(h,g,_);if(l<0){var d=o-l;h=o+(h-o)*o/d,g=o+(g-o)*o/d,_=o+(_-o)*o/d}if(u>255){var p=255-o,m=u-o;h=o+(h-o)*p/m,g=o+(g-o)*p/m,_=o+(_-o)*p/m}}function getSat(n,r,a){return t(n,r,a)-e(n,r,a)}function setSat(n,r,a,o){var c=[n,r,a],l=t(n,r,a),u=e(n,r,a),d;u=u===n?0:u===r?1:2,l=l===n?0:l===r?1:2,d=e(u,l)===0?t(u,l)===1?2:1:0,c[l]>c[u]?(c[d]=(c[d]-c[u])*o/(c[l]-c[u]),c[l]=o):c[d]=c[l]=0,c[u]=0,h=c[0],g=c[1],_=c[2]}var y={multiply:function(){h=u*r/255,g=d*a/255,_=p*c/255},screen:function(){h=u+r-u*r/255,g=d+a-d*a/255,_=p+c-p*c/255},overlay:function(){h=u<128?2*u*r/255:255-2*(255-u)*(255-r)/255,g=d<128?2*d*a/255:255-2*(255-d)*(255-a)/255,_=p<128?2*p*c/255:255-2*(255-p)*(255-c)/255},"soft-light":function(){var e=r*u/255;h=e+u*(255-(255-u)*(255-r)/255-e)/255,e=a*d/255,g=e+d*(255-(255-d)*(255-a)/255-e)/255,e=c*p/255,_=e+p*(255-(255-p)*(255-c)/255-e)/255},"hard-light":function(){h=r<128?2*r*u/255:255-2*(255-r)*(255-u)/255,g=a<128?2*a*d/255:255-2*(255-a)*(255-d)/255,_=c<128?2*c*p/255:255-2*(255-c)*(255-p)/255},"color-dodge":function(){h=u===0?0:r===255?255:e(255,255*u/(255-r)),g=d===0?0:a===255?255:e(255,255*d/(255-a)),_=p===0?0:c===255?255:e(255,255*p/(255-c))},"color-burn":function(){h=u===255?255:r===0?0:t(0,255-(255-u)*255/r),g=d===255?255:a===0?0:t(0,255-(255-d)*255/a),_=p===255?255:c===0?0:t(0,255-(255-p)*255/c)},darken:function(){h=u<r?u:r,g=d<a?d:a,_=p<c?p:c},lighten:function(){h=u>r?u:r,g=d>a?d:a,_=p>c?p:c},difference:function(){h=u-r,h<0&&(h=-h),g=d-a,g<0&&(g=-g),_=p-c,_<0&&(_=-_)},exclusion:function(){h=u+r*(255-u-u)/255,g=d+a*(255-d-d)/255,_=p+c*(255-p-p)/255},hue:function(){setSat(r,a,c,getSat(u,d,p)),setLum(h,g,_,getLum(u,d,p))},saturation:function(){setSat(u,d,p,getSat(r,a,c)),setLum(h,g,_,getLum(u,d,p))},luminosity:function(){setLum(u,d,p,getLum(r,a,c))},color:function(){setLum(r,a,c,getLum(u,d,p))},add:function(){h=e(u+r,255),g=e(d+a,255),_=e(p+c,255)},subtract:function(){h=t(u-r,0),g=t(d-a,0),_=t(p-c,0)},average:function(){h=(u+r)/2,g=(d+a)/2,_=(p+c)/2},negation:function(){h=255-n(255-r-u),g=255-n(255-a-d),_=255-n(255-c-p)}},b=this.nativeModes=o.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},{}),x=me.getContext(1,1,{willReadFrequently:!0});x&&(o.each(y,function(e,t){var n=t===`darken`,r=!1;x.save();try{x.fillStyle=n?`#300`:`#a00`,x.fillRect(0,0,1,1),x.globalCompositeOperation=t,x.globalCompositeOperation===t&&(x.fillStyle=n?`#a00`:`#300`,x.fillRect(0,0,1,1),r=x.getImageData(0,0,1,1).data[0]===n?51:170)}catch{}x.restore(),b[t]=r}),me.release(x)),this.process=function(e,t,n,o,x){var S=t.canvas,C=e===`normal`;if(C||b[e])n.save(),n.setTransform(1,0,0,1,0,0),n.globalAlpha=o,C||(n.globalCompositeOperation=e),n.drawImage(S,x.x,x.y),n.restore();else{var w=y[e];if(!w)return;for(var T=n.getImageData(x.x,x.y,S.width,S.height),E=T.data,D=t.getImageData(0,0,S.width,S.height).data,O=0,k=E.length;O<k;O+=4){r=D[O],u=E[O],a=D[O+1],d=E[O+1],c=D[O+2],p=E[O+2],l=D[O+3],m=E[O+3],w();var A=l*o/255,j=1-A;E[O]=A*h+j*u,E[O+1]=A*g+j*d,E[O+2]=A*_+j*p,E[O+3]=l*o+j*m}n.putImageData(T,x.x,x.y)}}},J=new function(){var e=`http://www.w3.org/2000/svg`,t=`http://www.w3.org/2000/xmlns`,n=`http://www.w3.org/1999/xlink`,r={href:n,xlink:t,xmlns:t+`/`,"xmlns:xlink":t+`/`};function create(t,n,r){return set(a.createElementNS(e,t),n,r)}function get(e,t){var n=r[t],a=n?e.getAttributeNS(n,t):e.getAttribute(t);return a===`null`?null:a}function set(e,t,n){for(var a in t){var o=t[a],c=r[a];typeof o==`number`&&n&&(o=n.number(o)),c?e.setAttributeNS(c,a,o):e.setAttribute(a,o)}return e}return{svg:e,xmlns:t,xlink:n,create,get,set}},Y=o.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 ee||e instanceof k||e instanceof H)}],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 n=o.capitalize(t),r=e[2];this[t]={type:e[1],property:t,attribute:e[0],toSVG:r,fromSVG:r&&o.each(r,function(e,t){this[e]=t},{}),exportFilter:e[3],get:`get`+n,set:`set`+n}},{});new function(){var t;function getTransform(e,n,r){var a=new o,c=e.getTranslation();if(n){var l;e.isInvertible()?(e=e._shiftless(),l=e._inverseTransform(c),c=null):l=new g,a[r?`cx`:`x`]=l.x,a[r?`cy`:`y`]=l.y}if(!e.isIdentity()){var u=e.decompose();if(u){var d=[],p=u.rotation,h=u.scaling,_=u.skewing;c&&!c.isZero()&&d.push(`translate(`+t.point(c)+`)`),p&&d.push(`rotate(`+t.number(p)+`)`),(!m.isZero(h.x-1)||!m.isZero(h.y-1))&&d.push(`scale(`+t.point(h)+`)`),_.x&&d.push(`skewX(`+t.number(_.x)+`)`),_.y&&d.push(`skewY(`+t.number(_.y)+`)`),a.transform=d.join(` `)}else a.transform=`matrix(`+e.getValues().join(`,`)+`)`}return a}function exportGroup(e,n){for(var r=getTransform(e._matrix),a=e._children,o=J.create(`g`,r,t),c=0,l=a.length;c<l;c++){var u=a[c],d=exportSVG(u,n);if(d)if(u.isClipMask()){var p=J.create(`clipPath`);p.appendChild(d),setDefinition(u,p,`clip`),J.set(o,{"clip-path":`url(#`+p.id+`)`})}else o.appendChild(d)}return o}function exportRaster(e,n){var r=getTransform(e._matrix,!0),a=e.getSize(),o=e.getImage();return r.x-=a.width/2,r.y-=a.height/2,r.width=a.width,r.height=a.height,r.href=n.embedImages==0&&o&&o.src||e.toDataURL(),J.create(`image`,r,t)}function exportPath(e,n){var r=n.matchShapes;if(r){var a=e.toShape(!1);if(a)return exportShape(a,n)}var o=e._segments,c=o.length,l,u=getTransform(e._matrix);if(r&&c>=2&&!e.hasHandles())if(c>2){l=e._closed?`polygon`:`polyline`;for(var d=[],p=0;p<c;p++)d.push(t.point(o[p]._point));u.points=d.join(` `)}else{l=`line`;var m=o[0]._point,h=o[1]._point;u.set({x1:m.x,y1:m.y,x2:h.x,y2:h.y})}else l=`path`,u.d=e.getPathData(null,n.precision);return J.create(l,u,t)}function exportShape(e){var n=e._type,r=e._radius,a=getTransform(e._matrix,!0,n!==`rectangle`);if(n===`rectangle`){n=`rect`;var o=e._size,c=o.width,l=o.height;a.x-=c/2,a.y-=l/2,a.width=c,a.height=l,r.isZero()&&(r=null)}return r&&(n===`circle`?a.r=r:(a.rx=r.width,a.ry=r.height)),J.create(n,a,t)}function exportCompoundPath(e,n){var r=getTransform(e._matrix),a=e.getPathData(null,n.precision);return a&&(r.d=a),J.create(`path`,r,t)}function exportSymbolItem(e,n){var r=getTransform(e._matrix,!0),a=e._definition,o=getDefinition(a,`symbol`),c=a._item,l=c.getStrokeBounds();return o||(o=J.create(`symbol`,{viewBox:t.rectangle(l)}),o.appendChild(exportSVG(c,n)),setDefinition(a,o,`symbol`)),r.href=`#`+o.id,r.x+=l.x,r.y+=l.y,r.width=l.width,r.height=l.height,r.overflow=`visible`,J.create(`use`,r,t)}function exportGradient(e){var n=getDefinition(e,`color`);if(!n){var r=e.getGradient(),a=r._radial,o=e.getOrigin(),c=e.getDestination(),l;if(a){l={cx:o.x,cy:o.y,r:o.getDistance(c)};var u=e.getHighlight();u&&(l.fx=u.x,l.fy=u.y)}else l={x1:o.x,y1:o.y,x2:c.x,y2:c.y};l.gradientUnits=`userSpaceOnUse`,n=J.create((a?`radial`:`linear`)+`Gradient`,l,t);for(var d=r._stops,p=0,m=d.length;p<m;p++){var h=d[p],g=h._color,_=g.getAlpha();l={offset:h._offset??p/(m-1)},g&&(l[`stop-color`]=g.toCSS(!0)),_<1&&(l[`stop-opacity`]=_),n.appendChild(J.create(`stop`,l,t))}setDefinition(e,n,`color`)}return`url(#`+n.id+`)`}function exportText(e){var n=J.create(`text`,getTransform(e._matrix,!0),t);return n.textContent=e._content,n}var n={Group:exportGroup,Layer:exportGroup,Raster:exportRaster,Path:exportPath,Shape:exportShape,CompoundPath:exportCompoundPath,SymbolItem:exportSymbolItem,PointText:exportText};function applyStyle(e,n,r,a){var c={},l=!a&&e.getParent(),u=[];return e._name!=null&&(c.id=e._name),o.each(Y,function(t){var n=t.get,a=t.type,d=e[n]();if(t.exportFilter?t.exportFilter(e,d):r.reduceAttributes==0||!l||!o.equals(l[n](),d)){if(a===`color`&&d!=null){var p=d.getAlpha();p<1&&(c[t.attribute+`-opacity`]=p)}a===`style`?u.push(t.attribute+`: `+d):c[t.attribute]=d==null?`none`:a===`color`?d.gradient?exportGradient(d,e):d.toCSS(!0):a===`array`?d.join(`,`):a===`lookup`?t.toSVG[d]:d}}),u.length&&(c.style=u.join(`;`)),c.opacity===1&&delete c.opacity,e._visible||(c.visibility=`hidden`),J.set(n,c,t)}var r;function getDefinition(e,t){return r||(r={ids:{},svgs:{}}),e&&r.svgs[t+`-`+(e._id||e.__id||(e.__id=h.get(`svg`)))]}function setDefinition(e,t,n){r||getDefinition();var a=r.ids[n]=(r.ids[n]||0)+1;t.id=n+`-`+a,r.svgs[n+`-`+(e._id||e.__id)]=t}function exportDefinitions(t,n){var a=t,o=null;if(r){for(var c in a=t.nodeName.toLowerCase()===`svg`&&t,r.svgs)o||(o=(a||(a=J.create(`svg`),a.appendChild(t)),a.insertBefore(J.create(`defs`),a.firstChild))),o.appendChild(r.svgs[c]);r=null}return n.asString?new e.XMLSerializer().serializeToString(a):a}function exportSVG(e,t,r){var a=n[e._class],o=a&&a(e,t);if(o){var c=t.onExport;c&&(o=c(e,o,t)||o);var l=JSON.stringify(e._data);l&&l!==`{}`&&l!==`null`&&o.setAttribute(`data-paper-data`,l)}return o&&applyStyle(e,o,t,r)}function setOptions(e){return e||(e={}),t=new p(e.precision),e}E.inject({exportSVG:function(e){return e=setOptions(e),exportDefinitions(exportSVG(this,e,!0),e)}}),T.inject({exportSVG:function(e){e=setOptions(e);var n=this._children,r=this.getView(),a=o.pick(e.bounds,`view`),c=e.matrix||a===`view`&&r._matrix,l=c&&C.read([c]),u=a===`view`?new x([0,0],r.getViewSize()):a===`content`?E._getBounds(n,l,{stroke:!0}).rect:x.read([a],0,{readNull:!0}),d={version:`1.1`,xmlns:J.svg,"xmlns:xlink":J.xlink};u&&(d.width=u.width,d.height=u.height,(u.x||u.x===0||u.y||u.y===0)&&(d.viewBox=t.rectangle(u)));var p=J.create(`svg`,d,t),m=p;l&&!l.isIdentity()&&(m=p.appendChild(J.create(`g`,getTransform(l),t)));for(var h=0,g=n.length;h<g;h++)m.appendChild(exportSVG(n[h],e,!0));return exportDefinitions(p,e)}})},new function(){var t={},c;function getValue(e,t,n,r,a,o){var l=J.get(e,t)||o,u=l==null?r?null:n?``:0:n?l:parseFloat(l);return/%\s*$/.test(l)?u/100*(a?1:c[/x|^width/.test(t)?`width`:`height`]):u}function getPoint(e,t,n,r,a,o,c){return t=getValue(e,t||`x`,!1,r,a,o),n=getValue(e,n||`y`,!1,r,a,c),r&&(t==null||n==null)?null:new g(t,n)}function getSize(e,t,n,r,a){return t=getValue(e,t||`width`,!1,r,a),n=getValue(e,n||`height`,!1,r,a),r&&(t==null||n==null)?null:new y(t,n)}function convertValue(e,t,n){return e===`none`?null:t===`number`?parseFloat(e):t===`array`?e?e.split(/[\s,]+/g).map(parseFloat):[]:t===`color`?getDefinition(e)||e:t===`lookup`?n[e]:e}function importGroup(e,t,n,r){var a=e.childNodes,o=t===`clippath`,c=t===`defs`,l=new D,u=l._project,d=u._currentStyle,p=[];if(!o&&!c&&(l=applyAttributes(l,e,r),u._currentStyle=l._style.clone()),r)for(var m=e.querySelectorAll(`defs`),h=0,g=m.length;h<g;h++)importNode(m[h],n,!1);for(var h=0,g=a.length;h<g;h++){var _=a[h],y;_.nodeType===1&&!/^defs$/i.test(_.nodeName)&&(y=importNode(_,n,!1))&&!(y instanceof M)&&p.push(y)}return l.addChildren(p),o&&(l=applyAttributes(l.reduce(),e,r)),u._currentStyle=d,(o||c)&&(l.remove(),l=null),l}function importPoly(e,t){for(var n=e.getAttribute(`points`).match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),r=[],a=0,o=n.length;a<o;a+=2)r.push(new g(parseFloat(n[a]),parseFloat(n[a+1])));var c=new R(r);return t===`polygon`&&c.closePath(),c}function importPath(e){return ee.create(e.getAttribute(`d`))}function importGradient(e,n){var r=(getValue(e,`href`,!0)||``).substring(1),a=n===`radialgradient`,o;if(r)o=t[r].getGradient(),o._radial^a&&(o=o.clone(),o._radial=a);else{for(var c=e.childNodes,l=[],u=0,d=c.length;u<d;u++){var p=c[u];p.nodeType===1&&l.push(applyAttributes(new ne,p))}o=new W(l,a)}var m,h,g,_=getValue(e,`gradientUnits`,!0)!==`userSpaceOnUse`;a?(m=getPoint(e,`cx`,`cy`,!1,_,`50%`,`50%`),h=m.add(getValue(e,`r`,!1,!1,_,`50%`),0),g=getPoint(e,`fx`,`fy`,!0,_)):(m=getPoint(e,`x1`,`y1`,!1,_,`0%`,`0%`),h=getPoint(e,`x2`,`y2`,!1,_,`100%`,`0%`));var y=applyAttributes(new te(o,m,h,g),e);return y._scaleToBounds=_,null}var l={"#document":function(e,t,n,r){for(var a=e.childNodes,o=0,c=a.length;o<c;o++){var l=a[o];if(l.nodeType===1)return importNode(l,n,r)}},g:importGroup,svg:importGroup,clippath:importGroup,polygon:importPoly,polyline:importPoly,path:importPath,lineargradient:importGradient,radialgradient:importGradient,image:function(e){var t=new A(getValue(e,`href`,!0));return t.on(`load`,function(){var t=getSize(e);this.setSize(t);var n=getPoint(e).add(t.divide(2));this._matrix.append(new C().translate(n))}),t},symbol:function(e,t,n,r){return new M(importGroup(e,t,n,r),!0)},defs:importGroup,use:function(e){var n=(getValue(e,`href`,!0)||``).substring(1),r=t[n],a=getPoint(e);return r?r instanceof M?r.place(a):r.clone().translate(a):null},circle:function(e){return new k.Circle(getPoint(e,`cx`,`cy`),getValue(e,`r`))},ellipse:function(e){return new k.Ellipse({center:getPoint(e,`cx`,`cy`),radius:getSize(e,`rx`,`ry`)})},rect:function(e){return new k.Rectangle(new x(getPoint(e),getSize(e)),getSize(e,`rx`,`ry`))},line:function(e){return new R.Line(getPoint(e,`x1`,`y1`),getPoint(e,`x2`,`y2`))},text:function(e){var t=new U(getPoint(e).add(getPoint(e,`dx`,`dy`)));return t.setContent(e.textContent.trim()||``),t},switch:importGroup};function applyTransform(e,t,n,r){if(e.transform){for(var a=(r.getAttribute(n)||``).split(/\)\s*/g),o=new C,c=0,l=a.length;c<l;c++){var u=a[c];if(!u)break;for(var d=u.split(/\(\s*/),p=d[0].trim(),m=d[1].split(/[\s,]+/g),h=0,g=m.length;h<g;h++)m[h]=parseFloat(m[h]);switch(p){case`matrix`:o.append(new C(m[0],m[1],m[2],m[3],m[4],m[5]));break;case`rotate`:o.rotate(m[0],m[1]||0,m[2]||0);break;case`translate`:o.translate(m[0],m[1]||0);break;case`scale`:o.scale(m);break;case`skewX`:o.skew(m[0],0);break;case`skewY`:o.skew(0,m[0]);break}}e.transform(o)}}function applyOpacity(e,t,n){var r=n===`fill-opacity`?`getFillColor`:`getStrokeColor`,a=e[r]&&e[r]();a&&a.setAlpha(parseFloat(t))}var u=o.set(o.each(Y,function(e){this[e.attribute]=function(t,n){if(t[e.set]&&(t[e.set](convertValue(n,e.type,e.fromSVG)),e.type===`color`)){var r=t[e.get]();if(r&&r._scaleToBounds){var a=t.getBounds();r.transform(new C().translate(a.getPoint()).scale(a.getSize()))}}}},{}),{id:function(e,n){t[n]=e,e.setName&&e.setName(n)},"clip-path":function(e,t){var n=getDefinition(t);if(n)if(n=n.clone(),n.setClipMask(!0),e instanceof D)e.insertChild(0,n);else return new D(n,e)},gradientTransform:applyTransform,transform:applyTransform,"fill-opacity":applyOpacity,"stroke-opacity":applyOpacity,visibility:function(e,t){e.setVisible&&e.setVisible(t===`visible`)},display:function(e,t){e.setVisible&&e.setVisible(t!==null)},"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 n=t.match(/(.*)%$/);e.setOffset(n?n[1]/100:parseFloat(t))}},viewBox:function(e,t,n,r,a){var o=new x(convertValue(t,`array`)),c=getSize(r,null,null,!0),l,u;if(e instanceof D){var d=c?c.divide(o.getSize()):1,u=new C().scale(d).translate(o.getPoint().negate());l=e}else e instanceof M&&(c&&o.setSize(c),l=e._item);if(l){if(getAttribute(r,`overflow`,a)!==`visible`){var p=new k.Rectangle(o);p.setClipMask(!0),l.addChild(p)}u&&l.transform(u)}}});function getAttribute(e,t,r){var a=e.attributes[t],c=a&&a.value;if(!c&&e.style){var l=o.camelize(t);c=e.style[l],!c&&r.node[l]!==r.parent[l]&&(c=r.node[l])}return c?c===`none`?null:c:n}function applyAttributes(e,t,r){var a=t.parentNode,c={node:ie.getStyles(t)||{},parent:!r&&!/^defs$/i.test(a.tagName)&&ie.getStyles(a)||{}};return o.each(u,function(r,a){var o=getAttribute(t,a,c);e=o!==n&&r(e,o,a,t,c)||e}),e}function getDefinition(e){var n=e&&e.match(/\((?:["'#]*)([^"')]+)/),a=n&&n[1],o=a&&t[r?a.replace(r.location.href.split(`#`)[0]+`#`,``):a];return o&&o._scaleToBounds&&(o=o.clone(),o._scaleToBounds=!0),o}function importNode(e,n,r){var u=e.nodeName.toLowerCase(),d=u!==`#document`,p=a.body,m,h,g;r&&d&&(c=X.getView().getSize(),c=getSize(e,null,null,!0)||c,m=J.create(`svg`,{style:`stroke-width: 1px; stroke-miterlimit: 10`}),h=e.parentNode,g=e.nextSibling,m.appendChild(e),p.appendChild(m));var _=X.settings,y=_.applyMatrix,b=_.insertItems;_.applyMatrix=!1,_.insertItems=!1;var x=l[u],S=x&&x(e,u,n,r)||null;if(_.insertItems=b,_.applyMatrix=y,S){d&&!(S instanceof D)&&(S=applyAttributes(S,e,r));var C=n.onImport,w=d&&e.getAttribute(`data-paper-data`);C&&(S=C(e,S,n)||S),n.expandShapes&&S instanceof k&&(S.remove(),S=S.toPath()),w&&(S._data=JSON.parse(w))}return m&&(p.removeChild(m),h&&(g?h.insertBefore(e,g):h.appendChild(e))),r&&(t={},S&&o.pick(n.applyMatrix,y)&&S.matrix.apply(!0,!0)),S}function importSVG(t,r,o){if(!t)return null;r=typeof r==`function`?{onLoad:r}:r||{};var c=X,l=null;function onLoad(a){try{var u=typeof a==`object`?a:new e.DOMParser().parseFromString(a.trim(),`image/svg+xml`);if(!u.nodeName)throw u=null,Error(`Unsupported SVG source: `+t);X=c,l=importNode(u,r,!0),(!r||r.insert!==!1)&&o._insertItem(n,l);var d=r.onLoad;d&&d(l,a)}catch(e){onError(e)}}function onError(e,t){var n=r.onError;if(n)n(e,t);else throw Error(e)}if(typeof t==`string`&&!/^[\s\S]*</.test(t)){var u=a.getElementById(t);u?onLoad(u):pe.request({url:t,async:!0,onLoad,onError})}else if(typeof File<`u`&&t instanceof File){var d=new FileReader;return d.onload=function(){onLoad(d.result)},d.onerror=function(){onError(d.error)},d.readAsText(t)}else onLoad(t);return l}E.inject({importSVG:function(e,t){return importSVG(e,t,this)}}),T.inject({importSVG:function(e,t){return this.activate(),importSVG(e,t,this)}})},o.exports.PaperScript=function(){var t=this,n=t.acorn;if(!n&&fe!==void 0)try{n=Fn()}catch{}if(!n){var c,u;n=c=u={},(function(e,t){if(typeof c==`object`&&typeof u==`object`)return t(c);if(typeof define==`function`&&define.amd)return define([`exports`],t);t(e.acorn||(e.acorn={}))})(this,function(e){e.version=`0.5.0`;var t,n,r,a;e.parse=function(e,a){return n=String(e),r=n.length,setOptions(a),initTokenState(),parseTopLevel(t.program)};var o=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 setOptions(e){for(var n in t=e||{},o)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=o[n]);a=t.sourceFile||null}var c=e.getLineInfo=function(e,t){for(var n=1,r=0;;){We.lastIndex=r;var a=We.exec(e);if(a&&a.index<t)++n,r=a.index+a[0].length;else break}return{line:n,column:t-r}};e.tokenize=function(e,a){n=String(e),r=n.length,setOptions(a),initTokenState();var o={};function getToken(e){return S=d,readToken(e),o.start=u,o.end=d,o.startLoc=p,o.endLoc=m,o.type=h,o.value=g,o}return getToken.jumpTo=function(e,r){if(l=e,t.locations){y=1,b=We.lastIndex=0;for(var a;(a=We.exec(n))&&a.index<e;)++y,b=a.index+a[0].length}_=r,skipSpace()},getToken};var l,u,d,p,m,h,g,_,y,b,x,S,C,w,T,E;function raise(e,t){var r=c(n,e);t+=` (`+r.line+`:`+r.column+`)`;var a=SyntaxError(t);throw a.pos=e,a.loc=r,a.raisedAt=l,a}var D=[],O={type:`num`},k={type:`regexp`},A={type:`string`},j={type:`name`},M={type:`eof`},N={keyword:`break`},P={keyword:`case`,beforeExpr:!0},F={keyword:`catch`},I={keyword:`continue`},L={keyword:`debugger`},ee={keyword:`default`},R={keyword:`do`,isLoop:!0},z={keyword:`else`,beforeExpr:!0},B={keyword:`finally`},V={keyword:`for`,isLoop:!0},H={keyword:`function`},U={keyword:`if`},te={keyword:`return`,beforeExpr:!0},W={keyword:`switch`},ne={keyword:`throw`,beforeExpr:!0},re={keyword:`try`},ie={keyword:`var`},ae={keyword:`while`,isLoop:!0},G={keyword:`with`},K={keyword:`new`,beforeExpr:!0},oe={keyword:`this`},se={keyword:`null`,atomValue:null},ce={keyword:`true`,atomValue:!0},q={keyword:`false`,atomValue:!1},le={keyword:`in`,binop:7,beforeExpr:!0},ue={break:N,case:P,catch:F,continue:I,debugger:L,default:ee,do:R,else:z,finally:B,for:V,function:H,if:U,return:te,switch:W,throw:ne,try:re,var:ie,while:ae,with:G,null:se,true:ce,false:q,new:K,in:le,instanceof:{keyword:`instanceof`,binop:7,beforeExpr:!0},this:oe,typeof:{keyword:`typeof`,prefix:!0,beforeExpr:!0},void:{keyword:`void`,prefix:!0,beforeExpr:!0},delete:{keyword:`delete`,prefix:!0,beforeExpr:!0}},de={type:`[`,beforeExpr:!0},fe={type:`]`},pe={type:`{`,beforeExpr:!0},me={type:`}`},he={type:`(`,beforeExpr:!0},J={type:`)`},Y={type:`,`,beforeExpr:!0},X={type:`;`,beforeExpr:!0},Z={type:`:`,beforeExpr:!0},ge={type:`.`},_e={type:`?`,beforeExpr:!0},ve={binop:10,beforeExpr:!0},ye={isAssign:!0,beforeExpr:!0},be={isAssign:!0,beforeExpr:!0},xe={postfix:!0,prefix:!0,isUpdate:!0},Se={prefix:!0,beforeExpr:!0},Ce={binop:1,beforeExpr:!0},we={binop:2,beforeExpr:!0},Te={binop:3,beforeExpr:!0},Ee={binop:4,beforeExpr:!0},De={binop:5,beforeExpr:!0},Oe={binop:6,beforeExpr:!0},ke={binop:7,beforeExpr:!0},Ae={binop:8,beforeExpr:!0},je={binop:9,prefix:!0,beforeExpr:!0},Me={binop:10,beforeExpr:!0};for(var Ne in e.tokTypes={bracketL:de,bracketR:fe,braceL:pe,braceR:me,parenL:he,parenR:J,comma:Y,semi:X,colon:Z,dot:ge,question:_e,slash:ve,eq:ye,name:j,eof:M,num:O,regexp:k,string:A},ue)e.tokTypes[`_`+Ne]=ue[Ne];function makePredicate(e){e=e.split(` `);var t=``,n=[];out:for(var r=0;r<e.length;++r){for(var a=0;a<n.length;++a)if(n[a][0].length==e[r].length){n[a].push(e[r]);continue out}n.push([e[r]])}function compareTo(e){if(e.length==1)return t+=`return str === `+JSON.stringify(e[0])+`;`;t+=`switch(str){`;for(var n=0;n<e.length;++n)t+=`case `+JSON.stringify(e[n])+`:`;t+=`return true}return false;`}if(n.length>3){n.sort(function(e,t){return t.length-e.length}),t+=`switch(str.length){`;for(var r=0;r<n.length;++r){var o=n[r];t+=`case `+o[0].length+`:`,compareTo(o)}t+=`}`}else compareTo(e);return Function(`str`,t)}var Pe=makePredicate(`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`),Fe=makePredicate(`class enum extends super const export import`),Ie=makePredicate(`implements interface let package private protected public static yield`),Le=makePredicate(`eval arguments`),Re=makePredicate(`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]/,Be=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Ve=`̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_`,He=RegExp(`[`+Be+`]`),Ue=RegExp(`[`+Be+Ve+`]`),Q=/[\n\r\u2028\u2029]/,We=/\r\n|[\n\r\u2028\u2029]/g,Ge=e.isIdentifierStart=function(e){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e>=170&&He.test(String.fromCharCode(e))},Ke=e.isIdentifierChar=function(e){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e>=170&&Ue.test(String.fromCharCode(e))};function line_loc_t(){this.line=y,this.column=l-b}function initTokenState(){y=1,l=b=0,_=!0,skipSpace()}function finishToken(e,n){d=l,t.locations&&(m=new line_loc_t),h=e,skipSpace(),g=n,_=e.beforeExpr}function skipBlockComment(){var e=t.onComment&&t.locations&&new line_loc_t,r=l,a=n.indexOf(`*/`,l+=2);if(a===-1&&raise(l-2,`Unterminated comment`),l=a+2,t.locations){We.lastIndex=r;for(var o;(o=We.exec(n))&&o.index<l;)++y,b=o.index+o[0].length}t.onComment&&t.onComment(!0,n.slice(r+2,a),r,l,e,t.locations&&new line_loc_t)}function skipLineComment(){for(var e=l,a=t.onComment&&t.locations&&new line_loc_t,o=n.charCodeAt(l+=2);l<r&&o!==10&&o!==13&&o!==8232&&o!==8233;)++l,o=n.charCodeAt(l);t.onComment&&t.onComment(!1,n.slice(e+2,l),e,l,a,t.locations&&new line_loc_t)}function skipSpace(){for(;l<r;){var e=n.charCodeAt(l);if(e===32)++l;else if(e===13){++l;var a=n.charCodeAt(l);a===10&&++l,t.locations&&(++y,b=l)}else if(e===10||e===8232||e===8233)++l,t.locations&&(++y,b=l);else if(e>8&&e<14)++l;else if(e===47){var a=n.charCodeAt(l+1);if(a===42)skipBlockComment();else if(a===47)skipLineComment();else break}else if(e===160)++l;else if(e>=5760&&ze.test(String.fromCharCode(e)))++l;else break}}function readToken_dot(){var e=n.charCodeAt(l+1);return e>=48&&e<=57?readNumber(!0):(++l,finishToken(ge))}function readToken_slash(){var e=n.charCodeAt(l+1);return _?(++l,readRegexp()):e===61?finishOp(be,2):finishOp(ve,1)}function readToken_mult_modulo(){return n.charCodeAt(l+1)===61?finishOp(be,2):finishOp(Me,1)}function readToken_pipe_amp(e){var t=n.charCodeAt(l+1);return t===e?finishOp(e===124?Ce:we,2):t===61?finishOp(be,2):finishOp(e===124?Te:De,1)}function readToken_caret(){return n.charCodeAt(l+1)===61?finishOp(be,2):finishOp(Ee,1)}function readToken_plus_min(e){var t=n.charCodeAt(l+1);return t===e?t==45&&n.charCodeAt(l+2)==62&&Q.test(n.slice(S,l))?(l+=3,skipLineComment(),skipSpace(),readToken()):finishOp(xe,2):t===61?finishOp(be,2):finishOp(je,1)}function readToken_lt_gt(e){var t=n.charCodeAt(l+1),r=1;return t===e?(r=e===62&&n.charCodeAt(l+2)===62?3:2,n.charCodeAt(l+r)===61?finishOp(be,r+1):finishOp(Ae,r)):t==33&&e==60&&n.charCodeAt(l+2)==45&&n.charCodeAt(l+3)==45?(l+=4,skipLineComment(),skipSpace(),readToken()):(t===61&&(r=n.charCodeAt(l+2)===61?3:2),finishOp(ke,r))}function readToken_eq_excl(e){return n.charCodeAt(l+1)===61?finishOp(Oe,n.charCodeAt(l+2)===61?3:2):finishOp(e===61?ye:Se,1)}function getTokenFromCode(e){switch(e){case 46:return readToken_dot();case 40:return++l,finishToken(he);case 41:return++l,finishToken(J);case 59:return++l,finishToken(X);case 44:return++l,finishToken(Y);case 91:return++l,finishToken(de);case 93:return++l,finishToken(fe);case 123:return++l,finishToken(pe);case 125:return++l,finishToken(me);case 58:return++l,finishToken(Z);case 63:return++l,finishToken(_e);case 48:var t=n.charCodeAt(l+1);if(t===120||t===88)return readHexNumber();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return readNumber(!1);case 34:case 39:return readString(e);case 47:return readToken_slash(e);case 37:case 42:return readToken_mult_modulo();case 124:case 38:return readToken_pipe_amp(e);case 94:return readToken_caret();case 43:case 45:return readToken_plus_min(e);case 60:case 62:return readToken_lt_gt(e);case 61:case 33:return readToken_eq_excl(e);case 126:return finishOp(Se,1)}return!1}function readToken(e){if(e?l=u+1:u=l,t.locations&&(p=new line_loc_t),e)return readRegexp();if(l>=r)return finishToken(M);var a=n.charCodeAt(l);if(Ge(a)||a===92)return readWord();var o=getTokenFromCode(a);if(o===!1){var c=String.fromCharCode(a);if(c===`\\`||He.test(c))return readWord();raise(l,`Unexpected character '`+c+`'`)}return o}function finishOp(e,t){var r=n.slice(l,l+t);l+=t,finishToken(e,r)}function readRegexp(){for(var e=``,t,a,o=l;;){l>=r&&raise(o,`Unterminated regular expression`);var c=n.charAt(l);if(Q.test(c)&&raise(o,`Unterminated regular expression`),t)t=!1;else{if(c===`[`)a=!0;else if(c===`]`&&a)a=!1;else if(c===`/`&&!a)break;t=c===`\\`}++l}var e=n.slice(o,l);++l;var u=readWord1();u&&!/^[gmsiy]*$/.test(u)&&raise(o,`Invalid regexp flag`);try{var d=new RegExp(e,u)}catch(e){e instanceof SyntaxError&&raise(o,e.message),raise(e)}return finishToken(k,d)}function readInt(e,t){for(var r=l,a=0,o=0,c=t??1/0;o<c;++o){var u=n.charCodeAt(l),d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0;if(d>=e)break;++l,a=a*e+d}return l===r||t!=null&&l-r!==t?null:a}function readHexNumber(){l+=2;var e=readInt(16);return e??raise(u+2,`Expected hexadecimal number`),Ge(n.charCodeAt(l))&&raise(l,`Identifier directly after number`),finishToken(O,e)}function readNumber(e){var t=l,r=!1,a=n.charCodeAt(l)===48;!e&&readInt(10)===null&&raise(t,`Invalid number`),n.charCodeAt(l)===46&&(++l,readInt(10),r=!0);var o=n.charCodeAt(l);(o===69||o===101)&&(o=n.charCodeAt(++l),(o===43||o===45)&&++l,readInt(10)===null&&raise(t,`Invalid number`),r=!0),Ge(n.charCodeAt(l))&&raise(l,`Identifier directly after number`);var c=n.slice(t,l),u;return r?u=parseFloat(c):!a||c.length===1?u=parseInt(c,10):/[89]/.test(c)||E?raise(t,`Invalid number`):u=parseInt(c,8),finishToken(O,u)}function readString(e){l++;for(var a=``;;){l>=r&&raise(u,`Unterminated string constant`);var o=n.charCodeAt(l);if(o===e)return++l,finishToken(A,a);if(o===92){o=n.charCodeAt(++l);var c=/^[0-7]+/.exec(n.slice(l,l+3));for(c&&(c=c[0]);c&&parseInt(c,8)>255;)c=c.slice(0,-1);if(c===`0`&&(c=null),++l,c)E&&raise(l-2,`Octal literal in strict mode`),a+=String.fromCharCode(parseInt(c,8)),l+=c.length-1;else switch(o){case 110:a+=`
20
+ `;break;case 114:a+=`\r`;break;case 120:a+=String.fromCharCode(readHexChar(2));break;case 117:a+=String.fromCharCode(readHexChar(4));break;case 85:a+=String.fromCharCode(readHexChar(8));break;case 116:a+=` `;break;case 98:a+=`\b`;break;case 118:a+=`\v`;break;case 102:a+=`\f`;break;case 48:a+=`\0`;break;case 13:n.charCodeAt(l)===10&&++l;case 10:t.locations&&(b=l,++y);break;default:a+=String.fromCharCode(o);break}}else (o===13||o===10||o===8232||o===8233)&&raise(u,`Unterminated string constant`),a+=String.fromCharCode(o),++l}}function readHexChar(e){var t=readInt(16,e);return t===null&&raise(u,`Bad character escape sequence`),t}var qe;function readWord1(){qe=!1;for(var e,t=!0,r=l;;){var a=n.charCodeAt(l);if(Ke(a))qe&&(e+=n.charAt(l)),++l;else if(a===92){qe||(e=n.slice(r,l)),qe=!0,n.charCodeAt(++l)!=117&&raise(l,`Expecting Unicode escape sequence \\uXXXX`),++l;var o=readHexChar(4),c=String.fromCharCode(o);c||raise(l-1,`Invalid Unicode escape`),(t?Ge(o):Ke(o))||raise(l-4,`Invalid Unicode escape`),e+=c}else break;t=!1}return qe?e:n.slice(r,l)}function readWord(){var e=readWord1(),t=j;return!qe&&Re(e)&&(t=ue[e]),finishToken(t,e)}function next(){x=u,S=d,C=m,readToken()}function setStrict(e){if(E=e,l=u,t.locations)for(;l<b;)b=n.lastIndexOf(`
21
+ `,b-2)+1,--y;skipSpace(),readToken()}function node_t(){this.type=null,this.start=u,this.end=null}function node_loc_t(){this.start=p,this.end=null,a!==null&&(this.source=a)}function startNode(){var e=new node_t;return t.locations&&(e.loc=new node_loc_t),t.directSourceFile&&(e.sourceFile=t.directSourceFile),t.ranges&&(e.range=[u,0]),e}function startNodeFrom(e){var n=new node_t;return n.start=e.start,t.locations&&(n.loc=new node_loc_t,n.loc.start=e.loc.start),t.ranges&&(n.range=[e.range[0],0]),n}function finishNode(e,n){return e.type=n,e.end=S,t.locations&&(e.loc.end=C),t.ranges&&(e.range[1]=S),e}function isUseStrict(e){return t.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&e.expression.value===`use strict`}function eat(e){if(h===e)return next(),!0}function canInsertSemicolon(){return!t.strictSemicolons&&(h===M||h===me||Q.test(n.slice(S,u)))}function semicolon(){!eat(X)&&!canInsertSemicolon()&&unexpected()}function expect(e){h===e?next():unexpected()}function unexpected(){raise(u,`Unexpected token`)}function checkLVal(e){e.type!==`Identifier`&&e.type!==`MemberExpression`&&raise(e.start,`Assigning to rvalue`),E&&e.type===`Identifier`&&Le(e.name)&&raise(e.start,`Assigning to `+e.name+` in strict mode`)}function parseTopLevel(e){x=S=l,t.locations&&(C=new line_loc_t),w=E=null,T=[],readToken();var n=e||startNode(),r=!0;for(e||(n.body=[]);h!==M;){var a=parseStatement();n.body.push(a),r&&isUseStrict(a)&&setStrict(!0),r=!1}return finishNode(n,`Program`)}var Je={kind:`loop`},Ye={kind:`switch`};function parseStatement(){(h===ve||h===be&&g==`/=`)&&readToken(!0);var e=h,r=startNode();switch(e){case N:case I:next();var a=e===N;eat(X)||canInsertSemicolon()?r.label=null:h===j?(r.label=parseIdent(),semicolon()):unexpected();for(var o=0;o<T.length;++o){var c=T[o];if((r.label==null||c.name===r.label.name)&&(c.kind!=null&&(a||c.kind===`loop`)||r.label&&a))break}return o===T.length&&raise(r.start,`Unsyntactic `+e.keyword),finishNode(r,a?`BreakStatement`:`ContinueStatement`);case L:return next(),semicolon(),finishNode(r,`DebuggerStatement`);case R:return next(),T.push(Je),r.body=parseStatement(),T.pop(),expect(ae),r.test=parseParenExpression(),semicolon(),finishNode(r,`DoWhileStatement`);case V:if(next(),T.push(Je),expect(he),h===X)return parseFor(r,null);if(h===ie){var l=startNode();return next(),parseVar(l,!0),finishNode(l,`VariableDeclaration`),l.declarations.length===1&&eat(le)?parseForIn(r,l):parseFor(r,l)}var l=parseExpression(!1,!0);return eat(le)?(checkLVal(l),parseForIn(r,l)):parseFor(r,l);case H:return next(),parseFunction(r,!0);case U:return next(),r.test=parseParenExpression(),r.consequent=parseStatement(),r.alternate=eat(z)?parseStatement():null,finishNode(r,`IfStatement`);case te:return!w&&!t.allowReturnOutsideFunction&&raise(u,`'return' outside of function`),next(),eat(X)||canInsertSemicolon()?r.argument=null:(r.argument=parseExpression(),semicolon()),finishNode(r,`ReturnStatement`);case W:next(),r.discriminant=parseParenExpression(),r.cases=[],expect(pe),T.push(Ye);for(var d,p;h!=me;)if(h===P||h===ee){var m=h===P;d&&finishNode(d,`SwitchCase`),r.cases.push(d=startNode()),d.consequent=[],next(),m?d.test=parseExpression():(p&&raise(x,`Multiple default clauses`),p=!0,d.test=null),expect(Z)}else d||unexpected(),d.consequent.push(parseStatement());return d&&finishNode(d,`SwitchCase`),next(),T.pop(),finishNode(r,`SwitchStatement`);case ne:return next(),Q.test(n.slice(S,u))&&raise(S,`Illegal newline after throw`),r.argument=parseExpression(),semicolon(),finishNode(r,`ThrowStatement`);case re:if(next(),r.block=parseBlock(),r.handler=null,h===F){var _=startNode();next(),expect(he),_.param=parseIdent(),E&&Le(_.param.name)&&raise(_.param.start,`Binding `+_.param.name+` in strict mode`),expect(J),_.guard=null,_.body=parseBlock(),r.handler=finishNode(_,`CatchClause`)}return r.guardedHandlers=D,r.finalizer=eat(B)?parseBlock():null,!r.handler&&!r.finalizer&&raise(r.start,`Missing catch or finally clause`),finishNode(r,`TryStatement`);case ie:return next(),parseVar(r),semicolon(),finishNode(r,`VariableDeclaration`);case ae:return next(),r.test=parseParenExpression(),T.push(Je),r.body=parseStatement(),T.pop(),finishNode(r,`WhileStatement`);case G:return E&&raise(u,`'with' in strict mode`),next(),r.object=parseParenExpression(),r.body=parseStatement(),finishNode(r,`WithStatement`);case pe:return parseBlock();case X:return next(),finishNode(r,`EmptyStatement`);default:var y=g,b=parseExpression();if(e===j&&b.type===`Identifier`&&eat(Z)){for(var o=0;o<T.length;++o)T[o].name===y&&raise(b.start,`Label '`+y+`' is already declared`);var C=h.isLoop?`loop`:h===W?`switch`:null;return T.push({name:y,kind:C}),r.body=parseStatement(),T.pop(),r.label=b,finishNode(r,`LabeledStatement`)}else return r.expression=b,semicolon(),finishNode(r,`ExpressionStatement`)}}function parseParenExpression(){expect(he);var e=parseExpression();return expect(J),e}function parseBlock(e){var t=startNode(),n=!0,r=!1,a;for(t.body=[],expect(pe);!eat(me);){var o=parseStatement();t.body.push(o),n&&e&&isUseStrict(o)&&(a=r,setStrict(r=!0)),n=!1}return r&&!a&&setStrict(!1),finishNode(t,`BlockStatement`)}function parseFor(e,t){return e.init=t,expect(X),e.test=h===X?null:parseExpression(),expect(X),e.update=h===J?null:parseExpression(),expect(J),e.body=parseStatement(),T.pop(),finishNode(e,`ForStatement`)}function parseForIn(e,t){return e.left=t,e.right=parseExpression(),expect(J),e.body=parseStatement(),T.pop(),finishNode(e,`ForInStatement`)}function parseVar(e,t){for(e.declarations=[],e.kind=`var`;;){var n=startNode();if(n.id=parseIdent(),E&&Le(n.id.name)&&raise(n.id.start,`Binding `+n.id.name+` in strict mode`),n.init=eat(ye)?parseExpression(!0,t):null,e.declarations.push(finishNode(n,`VariableDeclarator`)),!eat(Y))break}return e}function parseExpression(e,t){var n=parseMaybeAssign(t);if(!e&&h===Y){var r=startNodeFrom(n);for(r.expressions=[n];eat(Y);)r.expressions.push(parseMaybeAssign(t));return finishNode(r,`SequenceExpression`)}return n}function parseMaybeAssign(e){var t=parseMaybeConditional(e);if(h.isAssign){var n=startNodeFrom(t);return n.operator=g,n.left=t,next(),n.right=parseMaybeAssign(e),checkLVal(t),finishNode(n,`AssignmentExpression`)}return t}function parseMaybeConditional(e){var t=parseExprOps(e);if(eat(_e)){var n=startNodeFrom(t);return n.test=t,n.consequent=parseExpression(!0),expect(Z),n.alternate=parseExpression(!0,e),finishNode(n,`ConditionalExpression`)}return t}function parseExprOps(e){return parseExprOp(parseMaybeUnary(),-1,e)}function parseExprOp(e,t,n){var r=h.binop;if(r!=null&&(!n||h!==le)&&r>t){var a=startNodeFrom(e);a.left=e,a.operator=g;var o=h;return next(),a.right=parseExprOp(parseMaybeUnary(),r,n),parseExprOp(finishNode(a,o===Ce||o===we?`LogicalExpression`:`BinaryExpression`),t,n)}return e}function parseMaybeUnary(){if(h.prefix){var e=startNode(),t=h.isUpdate;return e.operator=g,e.prefix=!0,_=!0,next(),e.argument=parseMaybeUnary(),t?checkLVal(e.argument):E&&e.operator===`delete`&&e.argument.type===`Identifier`&&raise(e.start,`Deleting local variable in strict mode`),finishNode(e,t?`UpdateExpression`:`UnaryExpression`)}for(var n=parseExprSubscripts();h.postfix&&!canInsertSemicolon();){var e=startNodeFrom(n);e.operator=g,e.prefix=!1,e.argument=n,checkLVal(n),next(),n=finishNode(e,`UpdateExpression`)}return n}function parseExprSubscripts(){return parseSubscripts(parseExprAtom())}function parseSubscripts(e,t){if(eat(ge)){var n=startNodeFrom(e);return n.object=e,n.property=parseIdent(!0),n.computed=!1,parseSubscripts(finishNode(n,`MemberExpression`),t)}else if(eat(de)){var n=startNodeFrom(e);return n.object=e,n.property=parseExpression(),n.computed=!0,expect(fe),parseSubscripts(finishNode(n,`MemberExpression`),t)}else if(!t&&eat(he)){var n=startNodeFrom(e);return n.callee=e,n.arguments=parseExprList(J,!1),parseSubscripts(finishNode(n,`CallExpression`),t)}else return e}function parseExprAtom(){switch(h){case oe:var e=startNode();return next(),finishNode(e,`ThisExpression`);case j:return parseIdent();case O:case A:case k:var e=startNode();return e.value=g,e.raw=n.slice(u,d),next(),finishNode(e,`Literal`);case se:case ce:case q:var e=startNode();return e.value=h.atomValue,e.raw=h.keyword,next(),finishNode(e,`Literal`);case he:var r=p,a=u;next();var o=parseExpression();return o.start=a,o.end=d,t.locations&&(o.loc.start=r,o.loc.end=m),t.ranges&&(o.range=[a,d]),expect(J),o;case de:var e=startNode();return next(),e.elements=parseExprList(fe,!0,!0),finishNode(e,`ArrayExpression`);case pe:return parseObj();case H:var e=startNode();return next(),parseFunction(e,!1);case K:return parseNew();default:unexpected()}}function parseNew(){var e=startNode();return next(),e.callee=parseSubscripts(parseExprAtom(),!0),eat(he)?e.arguments=parseExprList(J,!1):e.arguments=D,finishNode(e,`NewExpression`)}function parseObj(){var e=startNode(),n=!0,r=!1;for(e.properties=[],next();!eat(me);){if(n)n=!1;else if(expect(Y),t.allowTrailingCommas&&eat(me))break;var a={key:parsePropertyName()},o=!1,c;if(eat(Z)?(a.value=parseExpression(!0),c=a.kind=`init`):t.ecmaVersion>=5&&a.key.type===`Identifier`&&(a.key.name===`get`||a.key.name===`set`)?(o=r=!0,c=a.kind=a.key.name,a.key=parsePropertyName(),h!==he&&unexpected(),a.value=parseFunction(startNode(),!1)):unexpected(),a.key.type===`Identifier`&&(E||r))for(var l=0;l<e.properties.length;++l){var u=e.properties[l];if(u.key.name===a.key.name){var d=c==u.kind||o&&u.kind===`init`||c===`init`&&(u.kind===`get`||u.kind===`set`);d&&!E&&c===`init`&&u.kind===`init`&&(d=!1),d&&raise(a.key.start,`Redefinition of property`)}}e.properties.push(a)}return finishNode(e,`ObjectExpression`)}function parsePropertyName(){return h===O||h===A?parseExprAtom():parseIdent(!0)}function parseFunction(e,t){h===j?e.id=parseIdent():t?unexpected():e.id=null,e.params=[];var n=!0;for(expect(he);!eat(J);)n?n=!1:expect(Y),e.params.push(parseIdent());var r=w,a=T;if(w=!0,T=[],e.body=parseBlock(!0),w=r,T=a,E||e.body.body.length&&isUseStrict(e.body.body[0]))for(var o=e.id?-1:0;o<e.params.length;++o){var c=o<0?e.id:e.params[o];if((Ie(c.name)||Le(c.name))&&raise(c.start,`Defining '`+c.name+`' in strict mode`),o>=0)for(var l=0;l<o;++l)c.name===e.params[l].name&&raise(c.start,`Argument name clash in strict mode`)}return finishNode(e,t?`FunctionDeclaration`:`FunctionExpression`)}function parseExprList(e,n,r){for(var a=[],o=!0;!eat(e);){if(o)o=!1;else if(expect(Y),n&&t.allowTrailingCommas&&eat(e))break;r&&h===Y?a.push(null):a.push(parseExpression(!0))}return a}function parseIdent(e){var r=startNode();return e&&t.forbidReserved==`everywhere`&&(e=!1),h===j?(!e&&(t.forbidReserved&&(t.ecmaVersion===3?Pe:Fe)(g)||E&&Ie(g))&&n.slice(u,d).indexOf(`\\`)==-1&&raise(u,`The keyword '`+g+`' is reserved`),r.name=g):e&&h.keyword?r.name=h.keyword:unexpected(),_=!1,next(),finishNode(r,`Identifier`)}}),n.version||(n=null)}function parse(e,r){return(t.acorn||n).parse(e,r)}var d={"+":`__add`,"-":`__subtract`,"*":`__multiply`,"/":`__divide`,"%":`__modulo`,"==":`__equals`,"!=":`__equals`},p={"-":`__negate`,"+":`__self`},m=o.each([`add`,`subtract`,`multiply`,`divide`,`modulo`,`equals`,`negate`],function(e){this[`__`+e]=`#`+e},{__self:function(){return this}});g.inject(m),y.inject(m),te.inject(m);function __$__(e,t,n){var r=d[t];if(e&&e[r]){var a=e[r](n);return t===`!=`?!a:a}switch(t){case`+`:return e+n;case`-`:return e-n;case`*`:return e*n;case`/`:return e/n;case`%`:return e%n;case`==`:return e==n;case`!=`:return e!=n}}function $__(e,t){var n=p[e];if(t&&t[n])return t[n]();switch(e){case`+`:return+t;case`-`:return-t}}function compile(t,n){if(!t)return``;n||(n={});var o=[];function getOffset(e){for(var t=0,n=o.length;t<n;t++){var r=o[t];if(r[0]>=e)break;e+=r[1]}return e}function getCode(e){return t.substring(getOffset(e.range[0]),getOffset(e.range[1]))}function getBetween(e,n){return t.substring(getOffset(e.range[1]),getOffset(n.range[0]))}function replaceCode(e,n){for(var r=getOffset(e.range[0]),a=getOffset(e.range[1]),c=0,l=o.length-1;l>=0;l--)if(r>o[l][0]){c=l+1;break}o.splice(c,0,[r,n.length-a+r]),t=t.substring(0,r)+n+t.substring(a)}function handleOverloading(e,t){switch(e.type){case`UnaryExpression`:if(e.operator in p&&e.argument.type!==`Literal`){var n=getCode(e.argument);replaceCode(e,`$__("`+e.operator+`", `+n+`)`)}break;case`BinaryExpression`:if(e.operator in d&&e.left.type!==`Literal`){var r=getCode(e.left),a=getCode(e.right),o=getBetween(e.left,e.right),c=e.operator;replaceCode(e,`__$__(`+r+`,`+o.replace(RegExp(`\\`+c),`"`+c+`"`)+`, `+a+`)`)}break;case`UpdateExpression`:case`AssignmentExpression`:var l=t&&t.type;if(!(l===`ForStatement`||l===`BinaryExpression`&&/^[=!<>]/.test(t.operator)||l===`MemberExpression`&&t.computed)){if(e.type===`UpdateExpression`){var n=getCode(e.argument),u=`__$__(`+n+`, "`+e.operator[0]+`", 1)`,m=n+` = `+u;e.prefix?m=`(`+m+`)`:(l===`AssignmentExpression`||l===`VariableDeclarator`||l===`BinaryExpression`)&&(getCode(t.left||t.id)===n&&(m=u),m=n+`; `+m),replaceCode(e,m)}else if(/^.=$/.test(e.operator)&&e.left.type!==`Literal`){var r=getCode(e.left),a=getCode(e.right),u=r+` = __$__(`+r+`, "`+e.operator[0]+`", `+a+`)`;replaceCode(e,/^\(.*\)$/.test(getCode(e))?`(`+u+`)`:u)}}break}}function handleExports(e){switch(e.type){case`ExportDefaultDeclaration`:replaceCode({range:[e.start,e.declaration.start]},`module.exports = `);break;case`ExportNamedDeclaration`:var t=e.declaration,n=e.specifiers;if(t){var r=t.declarations;r&&(r.forEach(function(e){replaceCode(e,`module.exports.`+getCode(e))}),replaceCode({range:[e.start,t.start+t.kind.length]},``))}else if(n){var a=n.map(function(e){var t=getCode(e);return`module.exports.`+t+` = `+t+`; `}).join(``);a&&replaceCode(e,a)}break}}function walkAST(e,t,n){if(e){for(var r in e)if(r!==`range`&&r!==`loc`){var a=e[r];if(Array.isArray(a))for(var o=0,c=a.length;o<c;o++)walkAST(a[o],e,n);else a&&typeof a==`object`&&walkAST(a,e,n)}n.operatorOverloading!==!1&&handleOverloading(e,t),n.moduleExports!==!1&&handleExports(e)}}function encodeVLQ(e){var t=``,n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;for(e=(Math.abs(e)<<1)+(e<0?1:0);e||!t;){var r=e&31;e>>=5,e&&(r|=32),t+=n[r]}return t}var c=n.url||``,l=n.sourceMaps,u=n.paperFeatures||{},m=n.source||t,h=n.offset||0,g=X.agent,_=g.versionNumber,y=!1,b=/\r\n|\n|\r/gm,x;if(l&&(g.chrome&&_>=30||g.webkit&&_>=537.76||g.firefox&&_>=23||g.node)){if(g.node)h-=2;else if(r&&c&&!r.location.href.indexOf(c)){var S=a.getElementsByTagName(`html`)[0].innerHTML;h=S.substr(0,S.indexOf(t)+1).match(b).length+1}y=h>0&&!(g.chrome&&_>=36||g.safari&&_>=600||g.firefox&&_>=40||g.node);var C=[`AA`+encodeVLQ(y?0:h)+`A`];C.length=(t.match(b)||[]).length+1+(y?h:0),x={version:3,file:c,names:[],mappings:C.join(`;AACA`),sourceRoot:``,sources:[c],sourcesContent:[m]}}return(u.operatorOverloading!==!1||u.moduleExports!==!1)&&walkAST(parse(t,{ranges:!0,preserveParens:!0,sourceType:`module`}),null,u),x&&(y&&(t=Array(h+1).join(`
22
+ `)+t),/^(inline|both)$/.test(l)&&(t+=`
23
+ //# sourceMappingURL=data:application/json;base64,`+e.btoa(unescape(encodeURIComponent(JSON.stringify(x))))),t+=`
24
+ //# sourceURL=`+(c||`paperscript`)),{url:c,source:m,code:t,map:x}}function execute(e,t,n){X=t;var r=t.getView(),c=/\btool\.\w+|\s+on(?:Key|Mouse)(?:Up|Down|Move|Drag)\b/.test(e)&&!/\bnew\s+Tool\b/.test(e)?new ue:null,l=c?c._events:[],u=[`onFrame`,`onResize`].concat(l),d=[],p=[],m;e=(typeof e==`object`?e:compile(e,n)).code;function expose(t,n){for(var r in t)(n||!/^_/.test(r))&&RegExp(`([\\b\\s\\W]|^)`+r.replace(/\$/g,`\\$`)+`\\b`).test(e)&&(d.push(r),p.push(t[r]))}expose({__$__,$__,paper:t,tool:c},!0),expose(t),e=`var module = { exports: {} }; `+e;var h=o.each(u,function(t){RegExp(`\\s+`+t+`\\b`).test(e)&&(d.push(t),this.push(`module.exports.`+t+` = `+t+`;`))},[]).join(`
25
+ `);h&&(e+=`
26
+ `+h),e+=`
27
+ return module.exports;`;var _=X.agent;if(a&&(_.chrome||_.firefox&&_.versionNumber<40)){var y=a.createElement(`script`),b=a.head||a.getElementsByTagName(`head`)[0];_.firefox&&(e=`
28
+ `+e),y.appendChild(a.createTextNode(`document.__paperscript__ = function(`+d+`) {`+e+`
29
+ }`)),b.appendChild(y),m=a.__paperscript__,delete a.__paperscript__,b.removeChild(y)}else m=Function(d,e);var h=m&&m.apply(t,p),x=h||{};return o.each(l,function(e){var t=x[e];t&&(c[e]=t)}),r&&(x.onResize&&r.setOnResize(x.onResize),r.emit(`resize`,{size:r.size,delta:new g}),x.onFrame&&r.setOnFrame(x.onFrame),r.requestUpdate()),h}function loadScript(e){if(/^text\/(?:x-|)paperscript$/.test(e.type)&&l.getAttribute(e,`ignore`)!==`true`){var t=l.getAttribute(e,`canvas`),n=a.getElementById(t),r=e.src||e.getAttribute(`data-src`),o=l.hasAttribute(e,`async`),c=`data-paper-scope`;if(!n)throw Error(`Unable to find canvas with id "`+t+`"`);var u=l.get(n.getAttribute(c))||new l().setup(n);return n.setAttribute(c,u._id),r?pe.request({url:r,async:o,mimeType:`text/plain`,onLoad:function(e){execute(e,u,r)}}):execute(e.innerHTML,u,e.baseURI),e.setAttribute(`data-paper-ignore`,`true`),u}}function loadAll(){o.each(a&&a.getElementsByTagName(`script`),loadScript)}function load(e){return e?loadScript(e):loadAll()}return r&&(a.readyState===`complete`?setTimeout(loadAll):ae.add(r,{load:loadAll})),{compile,execute,load,parse,calculateBinary:__$__,calculateUnary:$__}}.call(this);var X=new(l.inject(o.exports,{Base:o,Numerical:m,Key:ce,DomEvent:ae,DomElement:ie,document:a,window:r,Symbol:M,PlacedSymbol:j}));return X.agent.node&&Pn()(X),typeof define==`function`&&define.amd?define(`paper`,X):typeof t==`object`&&t&&(t.exports=X),X}).call(e,typeof self==`object`?self:null)}))(),1),Ln=m({name:`CalculateSupplementaryAngle`,components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`CalculateSupplementaryAngle`),r=K(n),a=T(``),c=T(null),l=T();r.question.value=new Hn(e.data);let getBisectingPoint=(e,t,n,r,a,o,c=30)=>new e.Point(t/2+c*cos(n+(r+a)/2),o/2+c*sin(n+(r+a)/2));return A(async()=>{if(await u(),!c.value)return;l.value=new In.default.PaperScope,l.value.setup(c.value);let e=l.value,t=c.value.width,n=c.value.height,a=randomInt(0,360),o=t*cos(a),d=t*sin(a),p=new e.Path.Line({from:new e.Point(t/2+o,n/2+d),to:new e.Point(t/2-o,n/2-d)});p.strokeColor=new In.default.Color(`black`);let m=0,h=[];if(r.question.value)for(let o=0;o<r.question.value.angles.length;o++){let c=r.question.value.angles[o];m+=c,console.log(`drawing angle ${o}:
30
+ angle: ${c}
31
+ angleSum: ${m}
32
+ `);let l,u=m-c;l=o===r.question.value.angles.length-1?180:m;let d=new e.Point(t/2+30*cos(a+u),n/2+30*sin(a+u)),p=getBisectingPoint(e,t,a,u,l,n),g=new e.Point(t/2+30*cos(a+l),n/2+30*sin(a+l)),_=t*cos(a+m),y=t*sin(a+m),b=new e.Path.Line({from:new e.Point(t/2,n/2),to:new e.Point(t/2+_,n/2+y)});if(b.strokeColor=new In.default.Color(0,0,0),h.push(b),r.question.value.targetAngleIndex===o){console.log(`drawing targetAngle at i = ${o}:
33
+ baseAngle: ${a}
34
+ targetAngle: ${c}
35
+ sum: ${m}
36
+ nextAngle: ${l}
37
+ `);let r=new In.default.Color(.1,.5,.8,.35),u=new e.Path.Arc({from:d,through:p,to:g});u.strokeColor=new In.default.Color(.1,.5,.8,.75),u.strokeWidth=3,u.fillColor=r;let h=new e.Path;h.closed=!0,h.add(d),h.add(new In.default.Point(t/2,n/2)),h.add(g),h.fillColor=r}else{let r=new In.default.PointText(p);r.content=c.toString()+`°`;let o=!0,d=20;for(;o;)o=!1,r.bounds.center=getBisectingPoint(e,t,a,u,l,n,d),h.forEach(e=>{e.intersects(r)&&(o=!0)}),d+=7}}}),o(()=>{l.value=void 0}),{answer:a,canvasRef:c,...n,...r}}}),Rn={"data-viewable":`CalculateSupplementaryAngle`},zn={ref:`canvasRef`,width:`300`,height:`300`};function _sfc_render$13(e,t,n,o,c,u){let d=l(`user-input-number`);return a(),x(`div`,Rn,[t[1]||(t[1]=y(`h2`,null,`What is the measurement of the highlighted angle?`,-1)),y(`canvas`,zn,null,512),t[2]||(t[2]=y(`br`,null,null,-1)),r(d,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,[`modelValue`])])}__name(_sfc_render$13,`_sfc_render`);var Bn=Ne(Ln,[[`render`,_sfc_render$13],[`__scopeId`,`data-v-4f8ac466`]]),Vn=[{name:`AngleCount`,type:R.INT,validator:{instructions:`Must be 2 or 3.`,test:e=>e===`2`||e===`3`?{status:z.ok,msg:``}:{status:z.error,msg:`Must be 2 or 3.`}}}],Hn=(Se=class SupplementaryAngles extends N{constructor(e){var _super9=(...e)=>(super(...e),U(this,`angles`,[]),U(this,`targetAngleIndex`,void 0),U(this,`angleCount`,void 0),this);_super9(e),this.angleCount=e[0].AngleCount;let t=0;for(let e=0;e<=this.angleCount-2;e++){let e=randomInt(25,155-t);this.angles.push(e),t+=e}this.angles.push(180-t),this.targetAngleIndex=randomInt(0,this.angleCount-1)}isCorrect(e){return this.angles[this.targetAngleIndex]===e}dataShapes(){return SupplementaryAngles.dataShapes}views(){return SupplementaryAngles.views}},U(Se,`dataShapes`,[{name:H.MATH_SupplimentaryAngles,fields:Vn}]),U(Se,`views`,[Bn]),Se),Un=m({name:`VerbalAddition`,props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`VerbalAddition`),r=K(n),a=T([``,``,``,``,``]);r.question.value=new $n(e.data);let o=w(()=>r.question.value?r.question.value:new $n(e.data)),track=e=>{console.log(`change in ${e}!
38
+ userAnswer: ${a.value.toString()}\n
39
+ qAnswer: ${o.value?.answer.toString()}`),o.value&&o.value.answer[e].toString().length===a.value[e].length&&(parseInt(a.value[e])===o.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<a.value.length?document.getElementById(`input`+(e+1))?.focus():r.submitAnswer(a.value)):(document.getElementById(`input`+e)?.classList.add(`incorrect`),r.submitAnswer(a.value),console.log(`Wrong! ${a.value[e]} !== ${o.value.answer[e]}`)))};return A(()=>{console.log(`focusing...`),document.getElementById(`input0`)?.focus()}),{...n,...r,answer:a,question:o,track}}}),Wn={"data-viewable":`VerbalAddition`,class:`text-h5`},Gn={class:`text-h5`},Kn=[`value`],qn=[`id`,`onUpdate:modelValue`,`autofocus`,`onKeyup`],Jn={key:0};function _sfc_render$12(e,t,n,r,o,l){return a(),x(`div`,Wn,[y(`div`,Gn,[t[0]||(t[0]=p(` Count by `)),y(`strong`,null,h(e.question?.n),1),t[1]||(t[1]=p(`s: `))]),y(`input`,{type:`text`,disabled:``,class:`correct`,value:e.question.answer[0]-e.question.n},null,8,Kn),t[2]||(t[2]=p(`, `)),(a(!0),x(C,null,g(e.question.answer,(t,n)=>(a(),x(`span`,{key:n},[S(y(`input`,{id:`input${n}`,ref_for:!0,ref:`input${n}`,class:c(`input${t}${n}`),"onUpdate:modelValue":t=>e.answer[n]=t,type:`text`,autofocus:n===0,onKeyup:t=>e.track(n)},null,42,qn),[[E,e.answer[n]]]),n===e.question.answer.length-1?k(``,!0):(a(),x(`span`,Jn,`, `))]))),128))])}__name(_sfc_render$12,`_sfc_render`);var Yn=Ne(Un,[[`render`,_sfc_render$12],[`__scopeId`,`data-v-0452c3a5`]]),Xn=function(e){return e.LEFT=`LEFT`,e.RIGHT=`RIGHT`,e}(Xn||{}),Zn=[{name:`n`,type:R.INT},{name:`hand`,type:R.STRING,validator:{test:e=>e===Xn.LEFT||e===Xn.RIGHT?{status:z.ok,msg:``}:{status:z.error,msg:`Hand must be ${Xn.LEFT} or ${Xn.RIGHT}`}}}],Qn=__name(function(){let e=[];for(let t=2;t<=10;t++)e.push({n:t,hand:Xn.LEFT}),e.push({n:t,hand:Xn.RIGHT});return e},`data`);function asInt(e){return typeof e==`string`?parseInt(e):e}var $n=(Ce=class CountBy extends N{constructor(e){var _super10=(...e)=>(super(...e),U(this,`n`,void 0),U(this,`hand`,void 0),this);_super10(e),this.n=e[0].n,this.hand=e[0].hand}get answer(){let e=[],t=this.hand===Xn.LEFT?this.n:6*this.n;for(let n=0;n<5;n++)e.push(t+n*this.n);return e}isCorrect(e){console.log(`Solution: ${this.answer.toString()}`);for(let t=0;t<this.answer.length;t++)if(asInt(e[t])!==this.answer[t])return console.log(`answer[${t}] == ${e[t]} !== ${this.answer[t]}`),!1;return!0}dataShapes(){return CountBy.dataShapes}views(){return CountBy.views}},U(Ce,`dataShapes`,[{name:H.MATH_CountBy,fields:Zn}]),U(Ce,`views`,[Yn]),U(Ce,`seedData`,Qn()),U(Ce,`acceptsUserData`,!1),Ce),er=new CourseWare(`math`,[$t,ln,Jt,pn,Tn,Nn,Hn,$n]),tr=__toESM(__commonJSMin(((e,t)=>{(function(e){function WebMidi(){if(WebMidi.prototype._singleton)throw Error(`WebMidi is a singleton, it cannot be instantiated directly.`);(WebMidi.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 this.interface!==void 0}.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 n=new WebMidi;function Input(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 Output(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}}})}WebMidi.prototype.enable=function(e,t){this.enabled||(this.supported?navigator.requestMIDIAccess({sysex:t}).then(function(t){var n,r=[],a=[];this.interface=t,this._resetInterfaceUserHandlers(),this.interface.onstatechange=function(e){r.push(e)};for(var o=t.inputs.values(),c=o.next();c&&!c.done;c=o.next())a.push(c.value.open());for(var l=t.outputs.values(),u=l.next();u&&!u.done;u=l.next())a.push(u.value.open());function onPortsOpen(){clearTimeout(n),this._updateInputsAndOutputs(),this.interface.onstatechange=this._onInterfaceStateChange.bind(this),typeof e==`function`&&e.call(this),r.forEach(function(e){this._onInterfaceStateChange(e)}.bind(this))}n=setTimeout(onPortsOpen.bind(this),200),Promise&&Promise.all(a).catch(function(e){}).then(onPortsOpen.bind(this))}.bind(this),function(t){typeof e==`function`&&e.call(this,t)}.bind(this)):typeof e==`function`&&e(Error(`The Web MIDI API is not supported by your browser.`)))},WebMidi.prototype.disable=function(){if(!this.supported)throw 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()},WebMidi.prototype.addListener=function(e,t){if(!this.enabled)throw Error(`WebMidi must be enabled before adding event listeners.`);if(typeof t!=`function`)throw TypeError(`The 'listener' parameter must be a function.`);if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw TypeError(`The specified event type is not supported.`);return this._userHandlers[e].push(t),this},WebMidi.prototype.hasListener=function(e,t){if(!this.enabled)throw Error(`WebMidi must be enabled before checking event listeners.`);if(typeof t!=`function`)throw TypeError(`The 'listener' parameter must be a function.`);if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw TypeError(`The specified event type is not supported.`);for(var n=0;n<this._userHandlers[e].length;n++)if(this._userHandlers[e][n]===t)return!0;return!1},WebMidi.prototype.removeListener=function(e,t){if(!this.enabled)throw Error(`WebMidi must be enabled before removing event listeners.`);if(t!==void 0&&typeof t!=`function`)throw TypeError(`The 'listener' parameter must be a function.`);if(0<=this._midiInterfaceEvents.indexOf(e))if(t)for(var n=0;n<this._userHandlers[e].length;n++)this._userHandlers[e][n]===t&&this._userHandlers[e].splice(n,1);else this._userHandlers[e]=[];else{if(e!==void 0)throw TypeError(`The specified event type is not supported.`);this._resetInterfaceUserHandlers()}return this},WebMidi.prototype.toMIDIChannels=function(e){var t;if(e===`all`||e===void 0)t=[`all`];else{if(e===`none`)return t=[];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})},WebMidi.prototype.getInputById=function(e){if(!this.enabled)throw 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},WebMidi.prototype.getOutputById=function(e){if(!this.enabled)throw 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},WebMidi.prototype.getInputByName=function(e){if(!this.enabled)throw 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},WebMidi.prototype.getOctave=function(e){if(e!=null&&0<=e&&e<=127)return Math.floor(Math.floor(e)/12-1)+Math.floor(n.octaveOffset)},WebMidi.prototype.getOutputByName=function(e){if(!this.enabled)throw 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},WebMidi.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):(typeof e==`string`||e instanceof String)&&(t=this.noteNameToNumber(e)),!1===t)throw Error(`Invalid input value (`+e+`).`);return t},WebMidi.prototype.noteNameToNumber=function(e){typeof e!=`string`&&(e=``);var t=e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);if(!t)throw RangeError(`Invalid note name.`);var r=n._semitones[t[1].toUpperCase()],a=12*(parseInt(t[3])+1-Math.floor(n.octaveOffset))+r;if(-1<t[2].toLowerCase().indexOf(`b`)?a-=t[2].length:-1<t[2].toLowerCase().indexOf(`#`)&&(a+=t[2].length),a<0||127<a)throw RangeError(`Invalid note name or note outside valid range.`);return a},WebMidi.prototype._updateInputsAndOutputs=function(){this._updateInputs(),this._updateOutputs()},WebMidi.prototype._updateInputs=function(){for(var e=0;e<this._inputs.length;e++){for(var t=!0,n=this.interface.inputs.values(),r=n.next();r&&!r.done;r=n.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,n=0;n<this._inputs.length;n++)this._inputs[n]._midiInput===e&&(t=!1);t&&this._inputs.push(new Input(e))}.bind(this))},WebMidi.prototype._updateOutputs=function(){for(var e=0;e<this._outputs.length;e++){for(var t=!0,n=this.interface.outputs.values(),r=n.next();r&&!r.done;r=n.next())if(this._outputs[e]._midiOutput===r.value){t=!1;break}t&&this._outputs.splice(e,1)}this.interface&&this.interface.outputs.forEach(function(e){for(var t=!0,n=0;n<this._outputs.length;n++)this._outputs[n]._midiOutput===e&&(t=!1);t&&this._outputs.push(new Output(e))}.bind(this))},WebMidi.prototype._onInterfaceStateChange=function(e){this._updateInputsAndOutputs();var t={timestamp:e.timeStamp,type:e.port.state};this.interface&&e.port.state===`connected`?e.port.type===`output`?t.port=this.getOutputById(e.port.id):e.port.type===`input`&&(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)})},WebMidi.prototype._resetInterfaceUserHandlers=function(){for(var e=0;e<this._midiInterfaceEvents.length;e++)this._userHandlers[this._midiInterfaceEvents[e]]=[]},Input.prototype.on=Input.prototype.addListener=function(e,t,r){var a=this;if(t===void 0&&(t=`all`),Array.isArray(t)||(t=[t]),t.forEach(function(e){if(e!==`all`&&!(1<=e&&e<=16))throw RangeError(`The 'channel' parameter is invalid.`)}),typeof r!=`function`)throw TypeError(`The 'listener' parameter must be a function.`);if(n.MIDI_SYSTEM_MESSAGES[e]!==void 0)this._userHandlers.system[e]||(this._userHandlers.system[e]=[]),this._userHandlers.system[e].push(r);else{if(n.MIDI_CHANNEL_MESSAGES[e]===void 0)throw TypeError(`The specified event type is not supported.`);if(-1<t.indexOf(`all`)){t=[];for(var o=1;o<=16;o++)t.push(o)}this._userHandlers.channel[e]||(this._userHandlers.channel[e]=[]),t.forEach(function(t){a._userHandlers.channel[e][t]||(a._userHandlers.channel[e][t]=[]),a._userHandlers.channel[e][t].push(r)})}return this},Input.prototype.hasListener=function(e,t,r){var a=this;if(typeof r!=`function`)throw TypeError(`The 'listener' parameter must be a function.`);if(t===void 0&&(t=`all`),t.constructor!==Array&&(t=[t]),n.MIDI_SYSTEM_MESSAGES[e]!==void 0){for(var o=0;o<this._userHandlers.system[e].length;o++)if(this._userHandlers.system[e][o]===r)return!0}else if(n.MIDI_CHANNEL_MESSAGES[e]!==void 0){if(-1<t.indexOf(`all`)){t=[];for(var c=1;c<=16;c++)t.push(c)}return!!this._userHandlers.channel[e]&&t.every(function(t){var n=a._userHandlers.channel[e][t];return n&&-1<n.indexOf(r)})}return!1},Input.prototype.removeListener=function(e,t,r){var a=this;if(r!==void 0&&typeof r!=`function`)throw TypeError(`The 'listener' parameter must be a function.`);if(t===void 0&&(t=`all`),t.constructor!==Array&&(t=[t]),n.MIDI_SYSTEM_MESSAGES[e]!==void 0)if(r===void 0)this._userHandlers.system[e]=[];else for(var o=0;o<this._userHandlers.system[e].length;o++)this._userHandlers.system[e][o]===r&&this._userHandlers.system[e].splice(o,1);else if(n.MIDI_CHANNEL_MESSAGES[e]!==void 0){if(-1<t.indexOf(`all`)){t=[];for(var c=1;c<=16;c++)t.push(c)}if(!this._userHandlers.channel[e])return this;t.forEach(function(t){var n=a._userHandlers.channel[e][t];if(n)if(r===void 0)a._userHandlers.channel[e][t]=[];else for(var o=0;o<n.length;o++)n[o]===r&&n.splice(o,1)})}else{if(e!==void 0)throw TypeError(`The specified event type is not supported.`);this._initializeUserHandlers()}return this},Input.prototype._initializeUserHandlers=function(){for(var e in n.MIDI_CHANNEL_MESSAGES)Object.prototype.hasOwnProperty.call(n.MIDI_CHANNEL_MESSAGES,e)&&(this._userHandlers.channel[e]={});for(var t in n.MIDI_SYSTEM_MESSAGES)Object.prototype.hasOwnProperty.call(n.MIDI_SYSTEM_MESSAGES,t)&&(this._userHandlers.system[t]=[])},Input.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)},Input.prototype._parseNrpnEvent=function(e){var t,r,a=e.data[0]>>4,o=15&e.data[0],c=1+o;if(1<e.data.length&&(t=e.data[1],r=2<e.data.length?e.data[2]:void 0),n.nrpnEventsEnabled&&a===n.MIDI_CHANNEL_MESSAGES.controlchange&&(t>=n.MIDI_NRPN_MESSAGES.increment&&t<=n.MIDI_NRPN_MESSAGES.parammsb||t===n.MIDI_NRPN_MESSAGES.entrymsb||t===n.MIDI_NRPN_MESSAGES.entrylsb)){var l={target:this,type:`controlchange`,data:e.data,timestamp:e.timeStamp,channel:c,controller:{number:t,name:this.getCcNameByNumber(t)},value:r};if(l.controller.number===n.MIDI_NRPN_MESSAGES.parammsb&&l.value!=n.MIDI_NRPN_MESSAGES.nullactiveparameter)n._nrpnBuffer[o]=[],n._nrpnBuffer[o][0]=l;else if(n._nrpnBuffer[o].length===1&&l.controller.number===n.MIDI_NRPN_MESSAGES.paramlsb)n._nrpnBuffer[o].push(l);else if(n._nrpnBuffer[o].length!==2||l.controller.number!==n.MIDI_NRPN_MESSAGES.increment&&l.controller.number!==n.MIDI_NRPN_MESSAGES.decrement&&l.controller.number!==n.MIDI_NRPN_MESSAGES.entrymsb)if(n._nrpnBuffer[o].length===3&&n._nrpnBuffer[o][2].number===n.MIDI_NRPN_MESSAGES.entrymsb&&l.controller.number===n.MIDI_NRPN_MESSAGES.entrylsb)n._nrpnBuffer[o].push(l);else if(3<=n._nrpnBuffer[o].length&&n._nrpnBuffer[o].length<=4&&l.controller.number===n.MIDI_NRPN_MESSAGES.parammsb&&l.value===n.MIDI_NRPN_MESSAGES.nullactiveparameter)n._nrpnBuffer[o].push(l);else if(4<=n._nrpnBuffer[o].length&&n._nrpnBuffer[o].length<=5&&l.controller.number===n.MIDI_NRPN_MESSAGES.paramlsb&&l.value===n.MIDI_NRPN_MESSAGES.nullactiveparameter){n._nrpnBuffer[o].push(l);var u=[];n._nrpnBuffer[o].forEach(function(e){u.push(e.data)});var d=n._nrpnBuffer[o][0].value<<7|n._nrpnBuffer[o][1].value,p=n._nrpnBuffer[o][2].value;n._nrpnBuffer[o].length===6&&(p=n._nrpnBuffer[o][2].value<<7|n._nrpnBuffer[o][3].value);var m=``;switch(n._nrpnBuffer[o][2].controller.number){case n.MIDI_NRPN_MESSAGES.entrymsb:m=n._nrpnTypes[0];break;case n.MIDI_NRPN_MESSAGES.increment:m=n._nrpnTypes[1];break;case n.MIDI_NRPN_MESSAGES.decrement:m=n._nrpnTypes[2];break;default:throw Error(`The NPRN type was unidentifiable.`)}var h={timestamp:l.timestamp,channel:l.channel,type:`nrpn`,data:u,controller:{number:d,type:m,name:`Non-Registered Parameter `+d},value:p};n._nrpnBuffer[o]=[],this._userHandlers.channel[h.type]&&this._userHandlers.channel[h.type][h.channel]&&this._userHandlers.channel[h.type][h.channel].forEach(function(e){e(h)})}else n._nrpnBuffer[o]=[];else n._nrpnBuffer[o].push(l)}},Input.prototype._parseChannelEvent=function(e){var t,r,a=e.data[0]>>4,o=1+(15&e.data[0]);1<e.data.length&&(t=e.data[1],r=2<e.data.length?e.data[2]:void 0);var c={target:this,data:e.data,timestamp:e.timeStamp,channel:o};a===n.MIDI_CHANNEL_MESSAGES.noteoff||a===n.MIDI_CHANNEL_MESSAGES.noteon&&r===0?(c.type=`noteoff`,c.note={number:t,name:n._notes[t%12],octave:n.getOctave(t)},c.velocity=r/127,c.rawVelocity=r):a===n.MIDI_CHANNEL_MESSAGES.noteon?(c.type=`noteon`,c.note={number:t,name:n._notes[t%12],octave:n.getOctave(t)},c.velocity=r/127,c.rawVelocity=r):a===n.MIDI_CHANNEL_MESSAGES.keyaftertouch?(c.type=`keyaftertouch`,c.note={number:t,name:n._notes[t%12],octave:n.getOctave(t)},c.value=r/127):a===n.MIDI_CHANNEL_MESSAGES.controlchange&&0<=t&&t<=119?(c.type=`controlchange`,c.controller={number:t,name:this.getCcNameByNumber(t)},c.value=r):a===n.MIDI_CHANNEL_MESSAGES.channelmode&&120<=t&&t<=127?(c.type=`channelmode`,c.controller={number:t,name:this.getChannelModeByNumber(t)},c.value=r):a===n.MIDI_CHANNEL_MESSAGES.programchange?(c.type=`programchange`,c.value=t):a===n.MIDI_CHANNEL_MESSAGES.channelaftertouch?(c.type=`channelaftertouch`,c.value=t/127):a===n.MIDI_CHANNEL_MESSAGES.pitchbend?(c.type=`pitchbend`,c.value=((r<<7)+t-8192)/8192):c.type=`unknownchannelmessage`,this._userHandlers.channel[c.type]&&this._userHandlers.channel[c.type][o]&&this._userHandlers.channel[c.type][o].forEach(function(e){e(c)})},Input.prototype.getCcNameByNumber=function(e){if(!(0<=(e=Math.floor(e))&&e<=119))throw RangeError(`The control change number must be between 0 and 119.`);for(var t in n.MIDI_CONTROL_CHANGE_MESSAGES)if(Object.prototype.hasOwnProperty.call(n.MIDI_CONTROL_CHANGE_MESSAGES,t)&&e===n.MIDI_CONTROL_CHANGE_MESSAGES[t])return t},Input.prototype.getChannelModeByNumber=function(e){if(!(120<=(e=Math.floor(e))&&status<=127))throw RangeError(`The control change number must be between 120 and 127.`);for(var t in n.MIDI_CHANNEL_MODE_MESSAGES)if(Object.prototype.hasOwnProperty.call(n.MIDI_CHANNEL_MODE_MESSAGES,t)&&e===n.MIDI_CHANNEL_MODE_MESSAGES[t])return t},Input.prototype._parseSystemEvent=function(e){var t=e.data[0],r={target:this,data:e.data,timestamp:e.timeStamp};t===n.MIDI_SYSTEM_MESSAGES.sysex?r.type=`sysex`:t===n.MIDI_SYSTEM_MESSAGES.timecode?r.type=`timecode`:t===n.MIDI_SYSTEM_MESSAGES.songposition?r.type=`songposition`:t===n.MIDI_SYSTEM_MESSAGES.songselect?(r.type=`songselect`,r.song=e.data[1]):t===n.MIDI_SYSTEM_MESSAGES.tuningrequest?r.type=`tuningrequest`:t===n.MIDI_SYSTEM_MESSAGES.clock?r.type=`clock`:t===n.MIDI_SYSTEM_MESSAGES.start?r.type=`start`:t===n.MIDI_SYSTEM_MESSAGES.continue?r.type=`continue`:t===n.MIDI_SYSTEM_MESSAGES.stop?r.type=`stop`:t===n.MIDI_SYSTEM_MESSAGES.activesensing?r.type=`activesensing`:t===n.MIDI_SYSTEM_MESSAGES.reset?r.type=`reset`:r.type=`unknownsystemmessage`,this._userHandlers.system[r.type]&&this._userHandlers.system[r.type].forEach(function(e){e(r)})},Output.prototype.send=function(e,t,n){if(!(128<=e&&e<=255))throw RangeError(`The status byte must be an integer between 128 (0x80) and 255 (0xFF).`);t===void 0&&(t=[]),Array.isArray(t)||(t=[t]);var r=[];return t.forEach(function(e){var t=Math.floor(e);if(!(0<=t&&t<=255))throw RangeError(`Data bytes must be integers between 0 (0x00) and 255 (0xFF).`);r.push(t)}),this._midiOutput.send([e].concat(r),parseFloat(n)||0),this},Output.prototype.sendSysex=function(e,t,r){if(!n.sysexEnabled)throw Error(`Sysex message support must first be activated.`);return r||(r={}),e=[].concat(e),t.forEach(function(e){if(e<0||127<e)throw RangeError(`The data bytes of a sysex message must be integers between 0 (0x00) and 127 (0x7F).`)}),t=e.concat(t,n.MIDI_SYSTEM_MESSAGES.sysexend),this.send(n.MIDI_SYSTEM_MESSAGES.sysex,t,this._parseTimeParameter(r.time)),this},Output.prototype.sendTimecodeQuarterFrame=function(e,t){return t||(t={}),this.send(n.MIDI_SYSTEM_MESSAGES.timecode,e,this._parseTimeParameter(t.time)),this},Output.prototype.sendSongPosition=function(e,t){t||(t={});var r=(e=Math.floor(e)||0)>>7&127,a=127&e;return this.send(n.MIDI_SYSTEM_MESSAGES.songposition,[r,a],this._parseTimeParameter(t.time)),this},Output.prototype.sendSongSelect=function(e,t){if(t||(t={}),!(0<=(e=Math.floor(e))&&e<=127))throw RangeError(`The song number must be between 0 and 127.`);return this.send(n.MIDI_SYSTEM_MESSAGES.songselect,[e],this._parseTimeParameter(t.time)),this},Output.prototype.sendTuningRequest=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.tuningrequest,void 0,this._parseTimeParameter(e.time)),this},Output.prototype.sendClock=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.clock,void 0,this._parseTimeParameter(e.time)),this},Output.prototype.sendStart=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.start,void 0,this._parseTimeParameter(e.time)),this},Output.prototype.sendContinue=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.continue,void 0,this._parseTimeParameter(e.time)),this},Output.prototype.sendStop=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.stop,void 0,this._parseTimeParameter(e.time)),this},Output.prototype.sendActiveSensing=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.activesensing,[],this._parseTimeParameter(e.time)),this},Output.prototype.sendReset=function(e){return e||(e={}),this.send(n.MIDI_SYSTEM_MESSAGES.reset,void 0,this._parseTimeParameter(e.time)),this},Output.prototype.stopNote=function(e,t,r){if(e===`all`)return this.sendChannelMode(`allnotesoff`,0,t,r);var a=64;return(r||(r={})).rawVelocity?!isNaN(r.velocity)&&0<=r.velocity&&r.velocity<=127&&(a=r.velocity):!isNaN(r.velocity)&&0<=r.velocity&&r.velocity<=1&&(a=127*r.velocity),this._convertNoteToArray(e).forEach(function(e){n.toMIDIChannels(t).forEach(function(t){this.send((n.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(a)],this._parseTimeParameter(r.time))}.bind(this))}.bind(this)),this},Output.prototype.playNote=function(e,t,r){var a,o=64;if((r||(r={})).rawVelocity?!isNaN(r.velocity)&&0<=r.velocity&&r.velocity<=127&&(o=r.velocity):!isNaN(r.velocity)&&0<=r.velocity&&r.velocity<=1&&(o=127*r.velocity),a=this._parseTimeParameter(r.time),this._convertNoteToArray(e).forEach(function(e){n.toMIDIChannels(t).forEach(function(t){this.send((n.MIDI_CHANNEL_MESSAGES.noteon<<4)+(t-1),[e,Math.round(o)],a)}.bind(this))}.bind(this)),!isNaN(r.duration)){r.duration<=0&&(r.duration=0);var c=64;r.rawVelocity?!isNaN(r.release)&&0<=r.release&&r.release<=127&&(c=r.release):!isNaN(r.release)&&0<=r.release&&r.release<=1&&(c=127*r.release),this._convertNoteToArray(e).forEach(function(e){n.toMIDIChannels(t).forEach(function(t){this.send((n.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(c)],(a||n.time)+r.duration)}.bind(this))}.bind(this))}return this},Output.prototype.sendKeyAftertouch=function(e,t,r,a){var o=this;if(a||(a={}),t<1||16<t)throw RangeError(`The channel must be between 1 and 16.`);(isNaN(r)||r<0||1<r)&&(r=.5);var c=Math.round(127*r);return this._convertNoteToArray(e).forEach(function(e){n.toMIDIChannels(t).forEach(function(t){o.send((n.MIDI_CHANNEL_MESSAGES.keyaftertouch<<4)+(t-1),[e,c],o._parseTimeParameter(a.time))})}),this},Output.prototype.sendControlChange=function(e,t,r,a){if(a||(a={}),typeof e==`string`){if((e=n.MIDI_CONTROL_CHANGE_MESSAGES[e])===void 0)throw TypeError(`Invalid controller name.`)}else if(!(0<=(e=Math.floor(e))&&e<=119))throw RangeError(`Controller numbers must be between 0 and 119.`);if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw RangeError(`Controller value must be between 0 and 127.`);return n.toMIDIChannels(r).forEach(function(r){this.send((n.MIDI_CHANNEL_MESSAGES.controlchange<<4)+(r-1),[e,t],this._parseTimeParameter(a.time))}.bind(this)),this},Output.prototype._selectRegisteredParameter=function(e,t,r){var a=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw RangeError(`The control65 value must be between 0 and 127`);if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw RangeError(`The control64 value must be between 0 and 127`);return n.toMIDIChannels(t).forEach(function(){a.sendControlChange(101,e[0],t,{time:r}),a.sendControlChange(100,e[1],t,{time:r})}),this},Output.prototype._selectNonRegisteredParameter=function(e,t,r){var a=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw RangeError(`The control63 value must be between 0 and 127`);if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw RangeError(`The control62 value must be between 0 and 127`);return n.toMIDIChannels(t).forEach(function(){a.sendControlChange(99,e[0],t,{time:r}),a.sendControlChange(98,e[1],t,{time:r})}),this},Output.prototype._setCurrentRegisteredParameter=function(e,t,r){var a=this;if((e=[].concat(e))[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw RangeError(`The msb value must be between 0 and 127`);return n.toMIDIChannels(t).forEach(function(){a.sendControlChange(6,e[0],t,{time:r})}),e[1]=Math.floor(e[1]),0<=e[1]&&e[1]<=127&&n.toMIDIChannels(t).forEach(function(){a.sendControlChange(38,e[1],t,{time:r})}),this},Output.prototype._deselectRegisteredParameter=function(e,t){var r=this;return n.toMIDIChannels(e).forEach(function(){r.sendControlChange(101,127,e,{time:t}),r.sendControlChange(100,127,e,{time:t})}),this},Output.prototype.setRegisteredParameter=function(e,t,r,a){var o=this;if(a||(a={}),!Array.isArray(e)){if(!n.MIDI_REGISTERED_PARAMETER[e])throw Error(`The specified parameter is not available.`);e=n.MIDI_REGISTERED_PARAMETER[e]}return n.toMIDIChannels(r).forEach(function(){o._selectRegisteredParameter(e,r,a.time),o._setCurrentRegisteredParameter(t,r,a.time),o._deselectRegisteredParameter(r,a.time)}),this},Output.prototype.setNonRegisteredParameter=function(e,t,r,a){var o=this;if(a||(a={}),!(0<=e[0]&&e[0]<=127&&0<=e[1]&&e[1]<=127))throw Error(`Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.`);return t=[].concat(t),n.toMIDIChannels(r).forEach(function(){o._selectNonRegisteredParameter(e,r,a.time),o._setCurrentRegisteredParameter(t,r,a.time),o._deselectRegisteredParameter(r,a.time)}),this},Output.prototype.incrementRegisteredParameter=function(e,t,r){var a=this;if(r||(r={}),!Array.isArray(e)){if(!n.MIDI_REGISTERED_PARAMETER[e])throw Error(`The specified parameter is not available.`);e=n.MIDI_REGISTERED_PARAMETER[e]}return n.toMIDIChannels(t).forEach(function(){a._selectRegisteredParameter(e,t,r.time),a.sendControlChange(96,0,t,{time:r.time}),a._deselectRegisteredParameter(t,r.time)}),this},Output.prototype.decrementRegisteredParameter=function(e,t,r){if(r||(r={}),!Array.isArray(e)){if(!n.MIDI_REGISTERED_PARAMETER[e])throw TypeError(`The specified parameter is not available.`);e=n.MIDI_REGISTERED_PARAMETER[e]}return n.toMIDIChannels(t).forEach(function(){this._selectRegisteredParameter(e,t,r.time),this.sendControlChange(97,0,t,{time:r.time}),this._deselectRegisteredParameter(t,r.time)}.bind(this)),this},Output.prototype.setPitchBendRange=function(e,t,r,a){var o=this;if(a||(a={}),!(0<=(e=Math.floor(e)||0)&&e<=127))throw RangeError(`The semitones value must be between 0 and 127`);if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw RangeError(`The cents value must be between 0 and 127`);return n.toMIDIChannels(r).forEach(function(){o.setRegisteredParameter(`pitchbendrange`,[e,t],r,{time:a.time})}),this},Output.prototype.setModulationRange=function(e,t,r,a){var o=this;if(a||(a={}),!(0<=(e=Math.floor(e)||0)&&e<=127))throw RangeError(`The semitones value must be between 0 and 127`);if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw RangeError(`The cents value must be between 0 and 127`);return n.toMIDIChannels(r).forEach(function(){o.setRegisteredParameter(`modulationrange`,[e,t],r,{time:a.time})}),this},Output.prototype.setMasterTuning=function(e,t,r){var a=this;if(r||(r={}),(e=parseFloat(e)||0)<=-65||64<=e)throw RangeError(`The value must be a decimal number larger than -65 and smaller than 64.`);var o=Math.floor(e)+64,c=e-Math.floor(e),l=(c=Math.round((c+1)/2*16383))>>7&127,u=127&c;return n.toMIDIChannels(t).forEach(function(){a.setRegisteredParameter(`channelcoarsetuning`,o,t,{time:r.time}),a.setRegisteredParameter(`channelfinetuning`,[l,u],t,{time:r.time})}),this},Output.prototype.setTuningProgram=function(e,t,r){var a=this;if(r||(r={}),!(0<=(e=Math.floor(e))&&e<=127))throw RangeError(`The program value must be between 0 and 127`);return n.toMIDIChannels(t).forEach(function(){a.setRegisteredParameter(`tuningprogram`,e,t,{time:r.time})}),this},Output.prototype.setTuningBank=function(e,t,r){var a=this;if(r||(r={}),!(0<=(e=Math.floor(e)||0)&&e<=127))throw RangeError(`The bank value must be between 0 and 127`);return n.toMIDIChannels(t).forEach(function(){a.setRegisteredParameter(`tuningbank`,e,t,{time:r.time})}),this},Output.prototype.sendChannelMode=function(e,t,r,a){if(a||(a={}),typeof e==`string`){if(!(e=n.MIDI_CHANNEL_MODE_MESSAGES[e]))throw TypeError(`Invalid channel mode message name.`)}else if(!(120<=(e=Math.floor(e))&&e<=127))throw RangeError(`Channel mode numerical identifiers must be between 120 and 127.`);if((t=Math.floor(t)||0)<0||127<t)throw RangeError(`Value must be an integer between 0 and 127.`);return n.toMIDIChannels(r).forEach(function(r){this.send((n.MIDI_CHANNEL_MESSAGES.channelmode<<4)+(r-1),[e,t],this._parseTimeParameter(a.time))}.bind(this)),this},Output.prototype.sendProgramChange=function(e,t,r){var a=this;if(r||(r={}),e=Math.floor(e),isNaN(e)||e<0||127<e)throw RangeError(`Program numbers must be between 0 and 127.`);return n.toMIDIChannels(t).forEach(function(t){a.send((n.MIDI_CHANNEL_MESSAGES.programchange<<4)+(t-1),[e],a._parseTimeParameter(r.time))}),this},Output.prototype.sendChannelAftertouch=function(e,t,r){var a=this;r||(r={}),e=parseFloat(e),(isNaN(e)||e<0||1<e)&&(e=.5);var o=Math.round(127*e);return n.toMIDIChannels(t).forEach(function(e){a.send((n.MIDI_CHANNEL_MESSAGES.channelaftertouch<<4)+(e-1),[o],a._parseTimeParameter(r.time))}),this},Output.prototype.sendPitchBend=function(e,t,r){var a=this;if(r||(r={}),isNaN(e)||e<-1||1<e)throw RangeError(`Pitch bend value must be between -1 and 1.`);var o=Math.round((e+1)/2*16383),c=o>>7&127,l=127&o;return n.toMIDIChannels(t).forEach(function(e){a.send((n.MIDI_CHANNEL_MESSAGES.pitchbend<<4)+(e-1),[l,c],a._parseTimeParameter(r.time))}),this},Output.prototype._parseTimeParameter=function(e){var t,r=parseFloat(e);return typeof e==`string`&&e.substring(0,1)===`+`?r&&0<r&&(t=n.time+r):r>n.time&&(t=r),t},Output.prototype._convertNoteToArray=function(e){var t=[];return Array.isArray(e)||(e=[e]),e.forEach(function(e){t.push(n.guessNoteNumber(e))}),t},typeof define==`function`&&typeof define.amd==`object`?define([],function(){return n}):t!==void 0&&t.exports?t.exports=n:e.WebMidi||(e.WebMidi=n)})(e)}))(),1),fillStr=(e,t)=>Array(Math.abs(t)+1).join(e);function isNamed(e){return!!(typeof e==`object`&&e&&typeof e.name==`string`)}function isPitch(e){return!!(typeof e==`object`&&e&&typeof e.step==`number`&&typeof e.alt==`number`)}var nr=[0,2,4,-1,1,3,5],rr=nr.map(e=>Math.floor(e*7/12));function encode(e){let{step:t,alt:n,oct:r,dir:a=1}=e,o=nr[t]+7*n;if(r===void 0)return[a*o];let c=r-rr[t]-4*n;return[a*o,a*c]}var ir=[3,0,4,1,5,2,6];function decode(e){let[t,n,r]=e,a=ir[unaltered(t)],o=Math.floor((t+1)/7);return n===void 0?{step:a,alt:o,dir:r}:{step:a,alt:o,oct:n+4*o+rr[a],dir:r}}function unaltered(e){let t=(e+1)%7;return t<0?7+t:t}var ar={empty:!0,name:``,pc:``,acc:``},or=new Map,stepToLetter=e=>`CDEFGAB`.charAt(e),altToAcc=e=>e<0?fillStr(`b`,-e):fillStr(`#`,e),accToAlt=e=>e[0]===`b`?-e.length:e.length;function note(e){let t=or.get(e);if(t)return t;let n=typeof e==`string`?parse$1(e):isPitch(e)?note(pitchName(e)):isNamed(e)?note(e.name):ar;return or.set(e,n),n}var sr=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function tokenizeNote(e){let t=sr.exec(e);return[t[1].toUpperCase(),t[2].replace(/x/g,`##`),t[3],t[4]]}function coordToNote(e){return note(decode(e))}var mod=(e,t)=>(e%t+t)%t,cr=[0,2,4,5,7,9,11];function parse$1(e){let t=tokenizeNote(e);if(t[0]===``||t[3]!==``)return ar;let n=t[0],r=t[1],a=t[2],o=(n.charCodeAt(0)+3)%7,c=accToAlt(r),l=a.length?+a:void 0,u=encode({step:o,alt:c,oct:l}),d=n+r+a,p=n+r,m=(cr[o]+c+120)%12,h=l===void 0?mod(cr[o]+c,12)-1188:cr[o]+c+12*(l+1),g=h>=0&&h<=127?h:null;return{empty:!1,acc:r,alt:c,chroma:m,coord:u,freq:l===void 0?null:2**((h-69)/12)*440,height:h,letter:n,midi:g,name:d,oct:l,pc:p,step:o}}__name(parse$1,`parse`);function pitchName(e){let{step:t,alt:n,oct:r}=e,a=stepToLetter(t);if(!a)return``;let o=a+altToAcc(n);return r||r===0?o+r:o}var lr={empty:!0,name:``,acc:``},ur=RegExp(`^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$`);function tokenizeInterval(e){let t=ur.exec(`${e}`);return t===null?[``,``]:t[1]?[t[1],t[2]]:[t[4],t[3]]}var dr={};function interval(e){return typeof e==`string`?dr[e]||(dr[e]=parse$1$1(e)):isPitch(e)?interval(pitchName$1(e)):isNamed(e)?interval(e.name):lr}var fr=[0,2,4,5,7,9,11],pr=`PMMPPMM`;function parse$1$1(e){let t=tokenizeInterval(e);if(t[0]===``)return lr;let n=+t[0],r=t[1],a=(Math.abs(n)-1)%7,o=pr[a];if(o===`M`&&r===`P`)return lr;let c=o===`M`?`majorable`:`perfectable`,l=``+n+r,u=n<0?-1:1,d=n===8||n===-8?n:u*(a+1),p=qToAlt(c,r),m=Math.floor((Math.abs(n)-1)/7);return{empty:!1,name:l,num:n,q:r,step:a,alt:p,dir:u,type:c,simple:d,semitones:u*(fr[a]+p+12*m),chroma:(u*(fr[a]+p)%12+12)%12,coord:encode({step:a,alt:p,oct:m,dir:u}),oct:m}}__name(parse$1$1,`parse$1`);function coordToInterval(e){let[t,n=0]=e;return interval(decode(t*7+n*12<0?[-t,-n,-1]:[t,n,1]))}function qToAlt(e,t){return t===`M`&&e===`majorable`||t===`P`&&e===`perfectable`?0:t===`m`&&e===`majorable`?-1:/^A+$/.test(t)?t.length:/^d+$/.test(t)?-1*(e===`perfectable`?t.length:t.length+1):0}function pitchName$1(e){let{step:t,alt:n,oct:r=0,dir:a}=e;if(!a)return``;let o=t+1+7*r,c=a<0?`-`:``,l=pr[t]===`M`?`majorable`:`perfectable`;return c+o+altToQ(l,n)}function altToQ(e,t){return t===0?e===`majorable`?`M`:`P`:t===-1&&e===`majorable`?`m`:t>0?fillStr(`A`,t):fillStr(`d`,e===`perfectable`?t:t+1)}function transpose$2(e,t){let n=note(e),r=interval(t);if(n.empty||r.empty)return``;let a=n.coord,o=r.coord;return coordToNote(a.length===1?[a[0]+o[0]]:[a[0]+o[0],a[1]+o[1]]).name}__name(transpose$2,`transpose`);function distance$1(e,t){let n=note(e),r=note(t);if(n.empty||r.empty)return``;let a=n.coord,o=r.coord,c=o[0]-a[0];return coordToInterval([c,a.length===2&&o.length===2?o[1]-a[1]:-Math.floor(c*7/12)]).name}__name(distance$1,`distance`);function rotate(e,t){let n=t.length,r=(e%n+n)%n;return t.slice(r,n).concat(t.slice(0,r))}var mr={empty:!0,name:``,setNum:0,chroma:`000000000000`,normalized:`000000000000`,intervals:[]},setNumToChroma=e=>Number(e).toString(2),chromaToNumber=e=>parseInt(e,2),hr=/^[01]{12}$/;function isChroma(e){return hr.test(e)}var isPcsetNum=e=>typeof e==`number`&&e>=0&&e<=4095,isPcset=e=>e&&isChroma(e.chroma),gr={[mr.chroma]:mr};function get$8(e){let t=isChroma(e)?e:isPcsetNum(e)?setNumToChroma(e):Array.isArray(e)?listToChroma(e):isPcset(e)?e.chroma:mr.chroma;return gr[t]=gr[t]||chromaToPcset(t)}__name(get$8,`get`);var _r=[`1P`,`2m`,`2M`,`3m`,`3M`,`4P`,`5d`,`5P`,`6m`,`6M`,`7m`,`7M`];function chromaToIntervals(e){let t=[];for(let n=0;n<12;n++)e.charAt(n)===`1`&&t.push(_r[n]);return t}function chromaRotations(e){let t=e.split(``);return t.map((e,n)=>rotate(n,t).join(``))}function chromaToPcset(e){let t=chromaToNumber(e),n=chromaRotations(e).map(chromaToNumber).filter(e=>e>=2048).sort()[0];return{empty:!1,name:``,setNum:t,chroma:e,normalized:setNumToChroma(n),intervals:chromaToIntervals(e)}}function listToChroma(e){if(e.length===0)return mr.chroma;let t,n=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++)t=note(e[r]),t.empty&&(t=interval(e[r])),t.empty||(n[t.chroma]=1);return n.join(``)}var vr=[[`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`]],yr={...mr,name:``,quality:`Unknown`,intervals:[],aliases:[]},br=[],xr={};function get$7(e){return xr[e]||yr}__name(get$7,`get`);function all$2(){return br.slice()}__name(all$2,`all`);function add$3(e,t,n){let r=getQuality(e),a={...get$8(e),name:n||``,quality:r,intervals:e,aliases:t};br.push(a),a.name&&(xr[a.name]=a),xr[a.setNum]=a,xr[a.chroma]=a,a.aliases.forEach(e=>addAlias$1(a,e))}__name(add$3,`add`);function addAlias$1(e,t){xr[t]=e}__name(addAlias$1,`addAlias`);function getQuality(e){let has=t=>e.indexOf(t)!==-1;return has(`5A`)?`Augmented`:has(`3M`)?`Major`:has(`5d`)?`Diminished`:has(`3m`)?`Minor`:`Unknown`}vr.forEach(([e,t,n])=>add$3(e.split(` `),n.split(` `),t)),br.sort((e,t)=>e.setNum-t.setNum);var Sr=[[`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`]],Cr={...mr,intervals:[],aliases:[]},wr=[],Tr={};function get$6(e){return Tr[e]||Cr}__name(get$6,`get`);function all$1(){return wr.slice()}__name(all$1,`all`);function add$2(e,t,n=[]){let r={...get$8(e),name:t,intervals:e,aliases:n};return wr.push(r),Tr[r.name]=r,Tr[r.setNum]=r,Tr[r.chroma]=r,r.aliases.forEach(e=>addAlias(r,e)),r}__name(add$2,`add`);function addAlias(e,t){Tr[t]=e}Sr.forEach(([e,t,...n])=>add$2(e.split(` `),t,n));var Er={empty:!0,name:``,symbol:``,root:``,rootDegree:0,type:``,tonic:null,setNum:NaN,quality:`Unknown`,chroma:``,normalized:``,aliases:[],notes:[],intervals:[]},Dr=/^(6|64|7|9|11|13)$/;function tokenize$2(e){let[t,n,r,a]=tokenizeNote(e);return t===``?[``,e]:t===`A`&&a===`ug`?[``,`aug`]:!a&&(r===`4`||r===`5`)?[t+n,r]:Dr.test(r)?[t+n,r+a]:[t+n+r,a]}__name(tokenize$2,`tokenize`);function get$5(e){if(e===``)return Er;if(Array.isArray(e)&&e.length===2)return getChord(e[1],e[0]);{let[t,n]=tokenize$2(e),r=getChord(n,t);return r.empty?getChord(e):r}}__name(get$5,`get`);function getChord(e,t,n){let r=get$7(e),a=note(t||``),o=note(n||``);if(r.empty||t&&a.empty||n&&o.empty)return Er;let c=distance$1(a.pc,o.pc),l=r.intervals.indexOf(c)+1;if(!o.empty&&!l)return Er;let u=Array.from(r.intervals);for(let e=1;e<l;e++){let e=u[0][0],t=u[0][1],n=parseInt(e,10)+7;u.push(`${n}${t}`),u.shift()}let d=a.empty?[]:u.map(e=>transpose$2(a,e));e=r.aliases.indexOf(e)===-1?r.aliases[0]:e;let p=`${a.empty?``:a.pc}${e}${o.empty||l<=1?``:`/`+o.pc}`,m=`${t?a.pc+` `:``}${r.name}${l>1&&n?` over `+o.pc:``}`;return{...r,name:m,symbol:p,type:r.name,root:o.name,intervals:u,rootDegree:l,tonic:a.name,notes:d}}var Or=[[.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`]]],kr=[];Or.forEach(([e,t,n])=>add$1(e,t,n));function add$1(e,t,n){kr.push({empty:!1,dots:``,name:``,value:1/e,fraction:e<1?[1/e,1]:[1,e],shorthand:t,names:n})}__name(add$1,`add`);function names$1(){return`1P 2M 3M 4P 5P 6m 7m`.split(` `)}__name(names$1,`names`);var Ar=interval,jr=__name(e=>interval(e).name,`name`),semitones=e=>interval(e).semitones,quality=e=>interval(e).q,num=e=>interval(e).num;function simplify$1(e){let t=interval(e);return t.empty?``:t.simple+t.q}__name(simplify$1,`simplify`);function invert(e){let t=interval(e);return t.empty?``:interval({step:(7-t.step)%7,alt:t.type===`perfectable`?-t.alt:-(t.alt+1),oct:t.oct,dir:t.dir}).name}var Mr=[1,2,2,3,3,4,5,5,6,6,7,7],Nr=`P m M m M P d P m M m M`.split(` `);function fromSemitones(e){let t=e<0?-1:1,n=Math.abs(e),r=n%12,a=Math.floor(n/12);return t*(Mr[r]+7*a)+Nr[r]}var Pr=distance$1,Fr=combinator((e,t)=>[e[0]+t[0],e[1]+t[1]]),addTo=e=>t=>Fr(e,t),Ir={names:names$1,get:Ar,name:jr,num,semitones,quality,fromSemitones,distance:Pr,invert,simplify:simplify$1,add:Fr,addTo,substract:combinator((e,t)=>[e[0]-t[0],e[1]-t[1]])};function combinator(e){return(t,n)=>{let r=interval(t).coord,a=interval(n).coord;if(r&&a)return coordToInterval(e(r,a)).name}}var Lr=Math.log(2),Rr=Math.log(440);function freqToMidi(e){let t=12*(Math.log(e)-Rr)/Lr+69;return Math.round(t*100)/100}var zr=`C C# D D# E F F# G G# A A# B`.split(` `),Br=`C Db D Eb E F Gb G Ab A Bb B`.split(` `);function midiToNoteName(e,t={}){if(isNaN(e)||e===-1/0||e===1/0)return``;e=Math.round(e);let n=(t.sharps===!0?zr:Br)[e%12];return t.pitchClass?n:n+(Math.floor(e/12)-1)}var Vr=[`C`,`D`,`E`,`F`,`G`,`A`,`B`],toName=e=>e.name,onlyNotes=e=>e.map(note).filter(e=>!e.empty);function names(e){return e===void 0?Vr.slice():Array.isArray(e)?onlyNotes(e).map(toName):[]}var Hr=note,name=e=>Hr(e).name,pitchClass=e=>Hr(e).pc,accidentals=e=>Hr(e).acc,octave=e=>Hr(e).oct,midi=e=>Hr(e).midi,freq=e=>Hr(e).freq,chroma=e=>Hr(e).chroma;function fromMidi(e){return midiToNoteName(e)}function fromFreq(e){return midiToNoteName(freqToMidi(e))}function fromFreqSharps(e){return midiToNoteName(freqToMidi(e),{sharps:!0})}function fromMidiSharps(e){return midiToNoteName(e,{sharps:!0})}var Ur=transpose$2,Wr=transpose$2,transposeBy=e=>t=>Ur(t,e),Gr=transposeBy,transposeFrom=e=>t=>Ur(e,t),Kr=transposeFrom;function transposeFifths(e,t){let n=Hr(e);if(n.empty)return``;let[r,a]=n.coord;return coordToNote(a===void 0?[r+t]:[r+t,a]).name}var qr=transposeFifths,ascending=(e,t)=>e.height-t.height,descending=(e,t)=>t.height-e.height;function sortedNames(e,t){return t||(t=ascending),onlyNotes(e).sort(t).map(toName)}function sortedUniqNames(e){return sortedNames(e,ascending).filter((e,t,n)=>t===0||e!==n[t-1])}var Jr=nameBuilder(!0),Yr=nameBuilder(!1);function nameBuilder(e){return t=>{let n=Hr(t);if(n.empty)return``;let r=e?n.alt>0:n.alt<0,a=n.midi===null;return midiToNoteName(n.midi||n.chroma,{sharps:r,pitchClass:a})}}var Xr={names,get:Hr,name,pitchClass,accidentals,octave,midi,ascending,descending,sortedNames,sortedUniqNames,fromMidi,fromMidiSharps,freq,fromFreq,fromFreqSharps,chroma,transpose:Ur,tr:Wr,transposeBy,trBy:Gr,transposeFrom,trFrom:Kr,transposeFifths,trFifths:qr,simplify:Jr,enharmonic:Yr},Zr={empty:!0,name:``,chordType:``},Qr={};function get$2(e){return typeof e==`string`?Qr[e]||(Qr[e]=parse(e)):typeof e==`number`?get$2(ti[e]||``):isPitch(e)?fromPitch(e):isNamed(e)?get$2(e.name):Zr}__name(get$2,`get`);function fromPitch(e){return get$2(altToAcc(e.alt)+ti[e.step])}var $r=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function tokenize$1(e){return $r.exec(e)||[``,``,``,``]}__name(tokenize$1,`tokenize`);var ei=`I II III IV V VI VII`,ti=ei.split(` `);ei.toLowerCase().split(` `);function parse(e){let[t,n,r,a]=tokenize$1(e);if(!r)return Zr;let o=r.toUpperCase(),c=ti.indexOf(o),l=accToAlt(n);return{empty:!1,name:t,roman:r,interval:interval({step:c,alt:l,dir:1}).name,acc:n,chordType:a,alt:l,step:c,major:r===o,oct:0,dir:1}}var ni=[[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`]],ri={...mr,name:``,alt:0,modeNum:NaN,triad:``,seventh:``,aliases:[]},ii=ni.map(toMode),ai={};ii.forEach(e=>{ai[e.name]=e,e.aliases.forEach(t=>{ai[t]=e})});function get$1(e){return typeof e==`string`?ai[e.toLowerCase()]||ri:e&&e.name?get$1(e.name):ri}__name(get$1,`get`);function toMode(e){let[t,n,r,a,o,c,l]=e,u=l?[l]:[],d=Number(n).toString(2);return{empty:!1,intervals:chromaToIntervals(d),modeNum:t,chroma:d,normalized:d,name:a,setNum:n,alt:r,triad:o,seventh:c,aliases:u}}function transpose(e,t){let n={...e},r=Xr.transpose(e.note.name+e.note.octave,Ir.fromSemitones(t));return n.note={name:Xr.pitchClass(r),number:e.note.number+t,octave:Xr.octave(r)},n}function transposeSyllableSeq(e,t){return e.map(e=>transpose(e,t))}function eventsToSyllableSequence(e){let t=[];e=e.filter(e=>e.type===`noteon`).sort((e,t)=>e.timestamp-t.timestamp);for(let n=10;n>0;n--)for(let r=0;r<e.length-n+1;r++)try{t.push(new si(e.slice(r,r+n))),e.splice(r,n),r=-1}catch{}return new oi(t)}var oi=class SyllableSequence{append(e){if(this.syllables.length)try{let t=new si(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 si([e]))}else this.syllables.push(new si([e])),this.rootNote=e.note}constructor(e){U(this,`syllables`,void 0),U(this,`rootNote`,void 0),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})}grade(e){let t=[];for(let n=0;n<this.syllables.length;n++)t.push(this.syllables[n].grade(e.syllables[n]));return new SyllableSequence(t)}toString(){let e=``;return this.syllables.forEach((t,n)=>{e+=`Syllable ${n+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=>{t.isCorrect===!1?e=!1:t.notes.forEach(t=>{t.isCorrect===!1&&(e=!1)})}),e}},si=class Syllable{get timestamp(){let e=0;return this.notes.forEach(t=>{if(t.timestamp===0)return 0;e+=t.timestamp}),e/=this.notes.length,e}constructor(e){U(this,`notes`,void 0),U(this,`isCorrect`,void 0),e=e.filter(e=>e.type===`noteon`);let t=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t),n=e.reduce((e,t)=>e.timestamp>t.timestamp?e:t).timestamp-t.timestamp;if(Syllable.gracePeriod(e.length)<n)throw 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)}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 n=Xr.fromMidi(t.note.number),r=Xr.fromMidiSharps(t.note.number);n=Xr.pitchClass(n),r=Xr.pitchClass(r),t.isCorrect=this.notes.filter(e=>Xr.chroma(n)===Xr.chroma(e.note.name)||Xr.chroma(r)===Xr.chroma(e.note.name)).length>=1,t.isCorrect||(e.isCorrect=!1)}),this.notes.forEach(t=>{let n=Xr.fromMidi(t.note.number);n=Xr.pitchClass(n),e.notes.some(e=>Xr.chroma(e.note.name)===Xr.chroma(n))||e.notes.push({...t,isMissing:!0,isCorrect:!1})}),e}},ci=(we=class SkMidi{get state(){return this._state}constructor(e){U(this,`recording`,[]),U(this,`webmidi`,tr.default),U(this,`input`,void 0),U(this,`output`,void 0),U(this,`_noteonListeners`,[]),U(this,`_noteoffListeners`,[]),U(this,`midiAccess`,void 0),U(this,`_state`,`initializing`),U(this,`_userLookup`,void 0),this._userLookup=e??null}async init(){if(!this.midiAccess)try{navigator.requestMIDIAccess().then(e=>{this.midiAccess=e,this.midiAccess.onstatechange=e=>{P({text:`Midi device ${e.port.name} is ${e.port.state}`,status:e.port.state===`connected`?z.ok:z.error})}})}catch(e){console.log(`Webmidi not enabled: ${e}`),this._state=`notsupported`}try{this.webmidi.disable()}catch(e){console.log(`Webmidi not enabled: ${e}`),this._state=`notsupported`}return new Promise((e,t)=>{this.webmidi.enable(async n=>{n?(this._state=`notsupported`,console.log(`Webmidi not enabled: ${n}`),t(n)):(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||(SkMidi._initializedWithUserConfig=(await this.loadUserConfiguration(),!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){console.log(`User lookup function not provided - using default MIDI configuration`);return}let e=await this._userLookup();if(!e){console.log(`No user found, using default MIDI configuration`);return}let t=await e.getActiveCourses();for(let n of t){let t=await(await e.getCourseInterface(n.courseID)).getCourseSettings();if(t?.midiinput||t?.midioutput){t.midiinput&&this.webmidi.getInputById(t.midiinput.toString())&&(this.selectInput(t.midiinput.toString()),console.log(`Loaded saved MIDI input: ${t.midiinput}`)),t.midioutput&&this.webmidi.getOutputById(t.midioutput.toString())&&(this.selectOutput(t.midioutput.toString()),console.log(`Loaded saved MIDI output: ${t.midioutput}`));break}}}catch(e){console.error(`Failed to load user MIDI configuration:`,e)}}setStateChangeListener(e){if(this.midiAccess)this.midiAccess.onstatechange=t=>{this.init().then(()=>{console.log(`Midi state: ${this.state}`),e()}),P({text:`Midi device ${t.port.name} is ${t.port.state}`,status:t.port.state===`connected`?z.ok:z.error})};else try{navigator.requestMIDIAccess().then(t=>{this.midiAccess=t,this.midiAccess.onstatechange=t=>{this.init().then(()=>{console.log(`Midi state: ${this.state}`),e()}),P({text:`Midi device ${t.port.name} is ${t.port.state}`,status:t.port.state===`connected`?z.ok:z.error})}})}catch(e){console.log(`Webmidi not enabled: ${e}`),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(this.input===void 0)throw Error(`Midi input not configured!`);this.input.connection===`open`&&(this.stopRecording(),this.eraseRecording(),this.input.on(`noteon`,`all`,t=>{this.recording.length===0&&(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=>{this.recording.length===0&&(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=>{e.type===`noteon`?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?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){this.webmidi.getInputById(e)===!1?this.webmidi.getInputByName(e)!==!1&&(this.input=this.webmidi.getInputByName(e)):this.input=this.webmidi.getInputById(e)}selectOutput(e){this.webmidi.getOutputById(e)===!1?this.webmidi.getOutputByName(e)!==!1&&(this.output=this.webmidi.getOutputByName(e)):this.output=this.webmidi.getOutputById(e)}},U(we,`_instance`,void 0),U(we,`OFFSET`,5),U(we,`_initializedWithUserConfig`,!1),we),li=m({name:`SyllableSeqVis`,props:{seq:{type:Object,required:!0},lastTSsuggestion:{type:Number,required:!1,default:0}},setup(e){let t=T(0),n=T(0),r=T(0),a=T(500),sayNote=e=>{console.log(`${JSON.stringify(e)}`)},o=w(()=>{let t=e.seq.syllables[e.seq.syllables.length-1].timestamp;return Math.max(1,t,e.lastTSsuggestion)}),c=w(()=>{let t=0,n=500;return e.seq.syllables.forEach(e=>{e.notes.forEach(e=>{e.note.number>t&&(t=e.note.number),e.note.number<n&&(n=e.note.number)})}),Math.max(3*(t-n)+10,0)}),updateBounds=()=>{try{t.value=e.seq.syllables[0].timestamp;let r=e.seq.syllables[e.seq.syllables.length-1].timestamp,a=t.value+e.lastTSsuggestion;n.value=Math.max(r,a)}catch(e){console.log(`[SyllableSeqVis] Error updating bounds: ${e}`)}e.seq.syllables.forEach(e=>{e.notes.forEach(e=>{e.note.number>r.value&&(r.value=e.note.number),e.note.number<a.value&&(a.value=e.note.number)})})};return A(()=>{console.log(`SyllableSeqVis created w/ input: \n${e.seq}`),updateBounds()}),{firstTS:t,lastTS:n,high:r,low:a,sayNote,getLastTS:o,getHeight:c,updateBounds}}}),ui=[`height`],di=[`cx`,`cy`,`alt`,`fill`,`stroke`,`onMouseenter`];function _sfc_render$11(e,t,n,r,o,c){return a(),x(`div`,null,[(a(),x(`svg`,{width:510,height:Math.max(3*(e.high-e.low)+10,0)},[(a(!0),x(C,null,g(e.seq.syllables,t=>(a(),x(C,null,[(a(!0),x(C,null,g(t.notes,n=>(a(),x(`circle`,{key:t.timestamp+`-`+n.note.number,cx:(t.timestamp-e.firstTS)*500/(e.lastTS-e.firstTS)+4,cy:3*(e.high-n.note.number)+4,alt:n.note.name,r:`3`,fill:n.isCorrect?`black`:n.isMissing?`none`:`red`,stroke:n.isMissing?`red`:`none`,onMouseenter:t=>e.sayNote(n)},null,40,di))),128))],64))),256))],8,ui))])}__name(_sfc_render$11,`_sfc_render`);var fi=Ne(li,[[`render`,_sfc_render$11],[`__scopeId`,`data-v-2f79c080`]]),pi=m({name:`NoteDisplay`,props:{chroma:{type:Number,required:!0}},setup(e){let style=t=>{let n=`#ffffff`;return t===e.chroma?n=`#1976D2`:(t===1||t===3||t===6||t===8||t===10||t===-2)&&(n=`#000000`),{fill:n,"fill-opacity":1,stroke:`#000000`,"stroke-width":.79375,"stroke-miterlimit":4,"stroke-dasharray":`none`,"stroke-opacity":1}};return{style,white:-1,black:-2}}}),mi={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`},hi={id:`metadata5`},gi={id:`layer1`,transform:`translate(167.75219,-151.96011)`,"inkscape:groupmode":`layer`,"inkscape:label":`Layer 1`};function _sfc_render$10(e,n,o,c,u,m){let h=l(`sodipodi:namedview`),g=l(`dc:format`),_=l(`dc:type`),b=l(`dc:title`),S=l(`cc:Work`),C=l(`rdf:RDF`);return a(),x(`svg`,mi,[n[1]||(n[1]=y(`defs`,{id:`defs2`},null,-1)),r(h,{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`}),y(`metadata`,hi,[r(C,null,{default:t(()=>[r(S,{"rdf:about":``},{default:t(()=>[r(g,null,{default:t(()=>n[0]||(n[0]=[p(`image/svg+xml`)])),_:1}),r(_,{"rdf:resource":`http://purl.org/dc/dcmitype/StillImage`}),r(b)]),_:1})]),_:1})]),y(`g`,gi,[y(`rect`,{id:`rect845`,y:`152.19064`,x:`-150.12129`,height:`73.220116`,width:`17.486626`,style:d(e.style(0))},null,4),y(`rect`,{id:`rect845-9`,style:d(e.style(2)),width:`17.486626`,height:`73.220116`,x:`-132.63466`,y:`152.19064`},null,4),y(`rect`,{id:`rect845-6`,style:d(e.style(4)),width:`17.486626`,height:`73.220116`,x:`-115.14803`,y:`152.19064`},null,4),y(`rect`,{id:`rect845-4`,style:d(e.style(5)),width:`17.486626`,height:`73.220116`,x:`-97.661407`,y:`152.19064`},null,4),y(`rect`,{id:`rect845-92`,style:d(e.style(7)),width:`17.486626`,height:`73.220116`,x:`-80.174782`,y:`152.19064`},null,4),y(`rect`,{id:`rect845-3`,style:d(e.style(9)),width:`17.486626`,height:`73.220116`,x:`-62.688156`,y:`152.19064`},null,4),y(`rect`,{id:`rect845-0`,style:d(e.style(11)),width:`17.486626`,height:`73.220116`,x:`-45.20153`,y:`152.19064`},null,4),y(`rect`,{id:`rect845-30`,style:d(e.style(e.white)),width:`17.486626`,height:`73.220116`,x:`-27.714905`,y:`152.10745`},null,4),y(`rect`,{id:`rect898`,ry:`0`,y:`152.10744`,x:`-138.43532`,height:`54.415863`,width:`10.466455`,style:d(e.style(1))},null,4),y(`rect`,{id:`rect898-3`,style:d(e.style(3)),width:`10.466455`,height:`54.415863`,x:`-120.84978`,y:`152.10744`,ry:`0`},null,4),y(`rect`,{id:`rect898-7`,style:d(e.style(6)),width:`10.466455`,height:`54.415863`,x:`-85.678711`,y:`152.10744`,ry:`0`},null,4),y(`rect`,{id:`rect898-8`,style:d(e.style(8)),width:`10.466455`,height:`54.415863`,x:`-68.09317`,y:`152.10744`,ry:`0`},null,4),y(`rect`,{id:`rect898-1`,style:d(e.style(10)),width:`10.466455`,height:`54.415863`,x:`-50.507633`,y:`152.10744`,ry:`0`},null,4),y(`rect`,{id:`rect845-30-1`,y:`152.10745`,x:`-10.228278`,height:`73.220116`,width:`17.486626`,style:d(e.style(e.white))},null,4),y(`rect`,{id:`rect845-30-9`,y:`152.10744`,x:`-167.60791`,height:`73.220116`,width:`17.486626`,style:d(e.style(e.white))},null,4),y(`rect`,{id:`rect898-4`,style:d(e.style(e.black)),width:`10.466455`,height:`54.415863`,x:`-15.336554`,y:`152.10744`,ry:`0`},null,4),y(`rect`,{id:`rect898-74`,style:d(e.style(e.black)),width:`4.4679713`,height:`54.415863`,x:`-167.60791`,y:`152.10744`,ry:`0`},null,4),y(`rect`,{id:`rect898-10`,style:d(e.style(e.black)),width:`5.1863246`,height:`54.507248`,x:`2.2092075`,y:`152.06175`,ry:`0`},null,4)])])}__name(_sfc_render$10,`_sfc_render`);var _i=m({name:`Playback`,components:{SyllableSeqVis:fi,NoteDisplay:Ne(pi,[[`render`,_sfc_render$10]])},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`Playback`),r=K(n),a=T(),c=T(!1),l=T(`notSet`),u=T(!1),d=T(0),p=T(ee.utc()),m=T(0),h=T(0),g=T(eventsToSyllableSequence([])),_=T(!1),y=T(eventsToSyllableSequence([])),b=T(0),x=T(``),S=T(0),C=T(0),E=T(),D=T();r.question.value=new ki(e.data);let O=w(()=>new ki(e.data)),k=w(()=>eventsToSyllableSequence(O.value.midi).syllables[0].notes.length>1?`Lowest note of first chord:`:`First note:`),j=w(()=>c.value?eventsToSyllableSequence(O.value.midi).rootNote.number%12:0),init=()=>{l.value?l.value!==a.value?.state&&(c.value=!1,l.value=a.value?.state||`notSet`,c.value=!0):(l.value=a.value?.state||`notSet`,c.value=!0),n.logger.log(`Playback is running init with state: ${l.value}`),l.value===`ready`&&(m.value=O.value.duration,play())},runProgressBar=()=>{try{E.value&&(E.value.style.animationName=``,requestAnimationFrame(()=>{requestAnimationFrame(()=>{E.value&&(E.value.style.animationDuration=m.value+`ms`,E.value.style.animationName=`progress`)})}))}catch{setTimeout(runProgressBar,50)}},record=()=>{a.value?.record(),u.value=!0,a.value?.addNoteonListenter(e=>{S.value++,y.value.append(e),D.value?.updateBounds(),S.value+C.value>=O.value.midi.length&&submit()}),a.value?.addNoteoffListenter(()=>{C.value++,S.value+C.value>=O.value.midi.length&&submit()})},play=()=>{a.value?.stopRecording(),a.value?.eraseRecording(),p.value=ee.utc(),S.value=0,C.value=0,u.value=!1,d.value=0,runProgressBar(),a.value?.play(O.value.midi),setTimeout(()=>{n.logger.log(`done playback...`),record()},O.value.lastNoteOnTimestamp)},submit=()=>{if(!a.value?.recording)return!1;let e=eventsToSyllableSequence(O.value.midi),t=eventsToSyllableSequence(a.value.recording);return g.value=e.grade(t),y.value=eventsToSyllableSequence([]),r.submitAnswer(a.value.recording).isCorrect?!0:(h.value++,_.value=!0,h.value<r.maxAttemptsPerView.value&&play(),!1)},clearAttempt=()=>{S.value>0?submit():play()};return A(async()=>{try{a.value=await ci.instance(),a.value.setStateChangeListener(()=>{init()}),c.value=!0}catch(e){P({status:z.error,text:`Midi device not supported`}),x.value=JSON.stringify(e),l.value=`notsupported`,c.value=!0}init(),ie.addBinding([{hotkey:`space`,callback:clearAttempt,command:`Clear attempt or play again`}])}),o(()=>{ie.removeBinding(`space`)}),{...n,...r,initialized:c,state:l,recording:u,inputSeq:y,lastTSsuggestion:b,gradedSeq:g,graded:_,promptText:k,firstNoteChroma:j,progressBar:E,inputVisRef:D,clearAttempt,notesOn:S}}}),vi={key:0,"data-viewable":`Playback`},yi={key:0},bi={class:`text-h4`},xi={class:`text-h5`},Si={key:0},Ci={class:`progressContainer`},wi={id:`progress`,ref:`progressBar`},Ti={key:1},Ei={key:2};function _sfc_render$9(e,n,o,c,u,d){let m=l(`note-display`),g=l(`v-icon`),_=l(`v-btn`),b=l(`syllable-seq-vis`);return e.initialized?(a(),x(`div`,vi,[e.state===`ready`?(a(),x(`div`,yi,[y(`div`,bi,[p(h(e.promptText)+` `,1),r(m,{chroma:e.firstNoteChroma},null,8,[`chroma`])]),y(`div`,xi,[n[0]||(n[0]=p(`Listen...`)),e.recording?(a(),x(`span`,Si,` and Repeat`)):k(``,!0)]),y(`div`,Ci,[y(`div`,wi,null,512)]),r(_,{color:`primary`,autofocus:``,onClick:e.clearAttempt},{default:t(()=>[n[2]||(n[2]=p(` Play again `)),r(g,{end:``},{default:t(()=>n[1]||(n[1]=[p(`volume_up`)])),_:1})]),_:1},8,[`onClick`]),(a(),D(b,{key:0,ref:`inputVisRef`,seq:e.inputSeq,"last-t-ssuggestion":e.lastTSsuggestion},null,8,[`seq`,`last-t-ssuggestion`])),e.graded?(a(),D(b,{key:1,seq:e.gradedSeq},null,8,[`seq`])):k(``,!0)])):e.state===`nodevice`?(a(),x(`div`,Ti,`No midi device detected. Please attach one!`)):e.state===`notsupported`?(a(),x(`div`,Ei,n[3]||(n[3]=[y(`p`,null,`This exercise requires a midi input device, which is not supported by this browser ☹`,-1),y(`div`,null,[y(`p`,null,`Please try again with one of the following browsers:`),y(`ul`,null,[y(`li`,null,[y(`a`,{href:`https://www.google.com/chrome/`},`Google Chrome`)]),y(`li`,null,[y(`a`,{href:`https://www.microsoft.com/edge`},`Microsoft Edge`)]),y(`li`,null,[y(`a`,{href:`https://brave.com/`},`Brave`)])])],-1)]))):k(``,!0)])):k(``,!0)}__name(_sfc_render$9,`_sfc_render`);var Di=Ne(_i,[[`render`,_sfc_render$9]]),Oi=[{name:`Melody`,type:R.MIDI}],ki=(Te=class EchoQuestion extends N{constructor(e){var _super11=(...e)=>(super(...e),U(this,`midi`,void 0),this);_super11(e),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=>e.type===`noteon`).reduce((e,t)=>t.timestamp>e.timestamp?t:e).timestamp}isCorrect(e){let t=eventsToSyllableSequence(this.midi),n=eventsToSyllableSequence(e);try{return t.grade(n).isCorrect()}catch(e){return console.log(`ERROR grading this midi sequence!`,e),!1}}dataShapes(){return EchoQuestion.dataShapes}views(){return EchoQuestion.views}},U(Te,`dataShapes`,[{fields:Oi,name:H.PIANO_Echo}]),U(Te,`views`,[Di]),Te),Ai=m({name:`NotePlayback`,components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`NotePlayback`),r=K(n),a=T(),o=T(!1),c=T(!1),l=T(0),u=T(ee.utc()),d=T(0),p=T(eventsToSyllableSequence([])),m=T(!1),h=T(eventsToSyllableSequence([])),g=T(``);r.question.value=new Ri(e.data);let _=w(()=>new Ri(e.data)),record=()=>{a.value?.record(),c.value=!0,a.value?.addNoteonListenter(e=>{h.value.append(e)}),a.value?.addNoteoffListenter(()=>{a.value?.recording?.length&&a.value?.recording?.length>=2&&submit()})},play=()=>{a.value?.stopRecording(),a.value?.eraseRecording(),u.value=ee.utc(),c.value=!1,l.value=0,record()},submit=()=>a.value?.recording?(h.value=eventsToSyllableSequence([]),r.submitAnswer(a.value.recording).isCorrect?!0:(d.value++,m.value=!0,d.value<r.maxAttemptsPerView.value&&play(),!1)):!1;return A(async()=>{try{a.value=await ci.instance(),g.value=_.value.note,play(),o.value=!0}catch(e){n.logger.error(`Failed to initialize MIDI:`,e)}}),{...n,...r,initialized:o,recording:c,inputSeq:h,gradedSeq:p,graded:m,note:g,attempts:d}}}),ji={"data-viewable":`NotePlayback`},Mi={class:`text-h4`},Ni={class:`font-weight-bold`},Pi={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`},Fi={id:`metadata5`};function _sfc_render$8(e,n,o,c,u,d){let m=l(`sodipodi:namedview`),g=l(`dc:format`),_=l(`dc:type`),b=l(`dc:title`),S=l(`cc:Work`),C=l(`rdf:RDF`);return a(),x(`div`,ji,[y(`div`,Mi,[n[0]||(n[0]=p(` Play the note: `)),y(`span`,Ni,h(e.note),1)]),e.graded?(a(),x(`svg`,Pi,[n[2]||(n[2]=y(`defs`,{id:`defs2`},null,-1)),r(m,{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`}),y(`metadata`,Fi,[r(C,null,{default:t(()=>[r(S,{"rdf:about":``},{default:t(()=>[r(g,null,{default:t(()=>n[1]||(n[1]=[p(`image/svg+xml`)])),_:1}),r(_,{"rdf:resource":`http://purl.org/dc/dcmitype/StillImage`}),r(b)]),_:1})]),_:1})]),n[3]||(n[3]=y(`g`,{id:`layer1`,transform:`translate(167.75219,-151.96011)`,"inkscape:groupmode":`layer`,"inkscape:label":`Layer 1`},[y(`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`}}),y(`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`}),y(`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`}),y(`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`}),y(`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`}),y(`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`}),y(`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`}),y(`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`}),y(`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`}}),y(`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`}),y(`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`}),y(`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`}),y(`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`}),y(`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`}}),y(`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`}}),y(`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`}),y(`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`}),y(`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))])):k(``,!0)])}__name(_sfc_render$8,`_sfc_render`);var Ii=Ne(Ai,[[`render`,_sfc_render$8]]),Li=[{name:`Note`,type:R.STRING}],Ri=(Ee=class PlayNote extends N{constructor(e){var _super12=(...e)=>(super(...e),U(this,`note`,void 0),this);_super12(e),this.note=e[0].Note}isCorrect(e){return e[0].note.name===this.note}dataShapes(){return PlayNote.dataShapes}views(){return PlayNote.views}},U(Ee,`dataShapes`,[{fields:Li,name:H.PIANO_PlayNote}]),U(Ee,`seedData`,[`A`,`B`,`C`,`D`,`E`,`F`,`G`,`A♯`,`C♯`,`D♯`,`F♯`,`G♯`,`D♭`,`E♭`,`G♭`,`A♭`,`B♭`].map(e=>({Note:e}))),U(Ee,`views`,[Ii]),Ee),zi=new CourseWare(`piano`,[ki,Ri]),Bi=m({name:`IdentifyChroma`,components:{RadioMultipleChoice:F},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`IdentifyChroma`),r=K(n),a=T(``),o=T(new AudioContext);r.question.value=new Gi(e.data);let c=w(()=>r.question.value),octaves=e=>{let t=[],n=e/2;for(;n>100;)t.push(n),n/=2;t.push(e);let r=e*2;for(;r<5e3;)t.push(r),r*=2;return t},tone=e=>{let t=o.value.createOscillator();t.type=`sine`,t.frequency.value=e;let n=o.value.createGain();console.log(`Max Gain: `+n.gain.maxValue),n.gain.setValueAtTime(0,0),n.gain.linearRampToValueAtTime(.5,15),t.connect(n),n.connect(o.value.destination),t.start(0),t.stop(14)};A(()=>{octaves(295).forEach(e=>tone(e))});let submit=()=>{c.value&&c.value.isCorrect(a.value)};return{...n,...r,answer:a,question:c,submit}}}),Vi={"data-viewable":`IdentifyChroma`};function _sfc_render$7(e,t,n,o,c,u){let d=l(`radio-multiple-choice`);return a(),x(`div`,Vi,[e.question?(a(),x(C,{key:0},[t[0]||(t[0]=p(` What note is being played? `)),r(d,{"choice-list":e.question.choiceList},null,8,[`choice-list`])],64)):k(``,!0)])}__name(_sfc_render$7,`_sfc_render`);var Hi=Ne(Bi,[[`render`,_sfc_render$7]]),Ui=function(e){return e.A=`A`,e.B=`B`,e.C=`C`,e.D=`D`,e.E=`E`,e.F=`F`,e.G=`G`,e}(Ui||{}),Wi=[{name:`Chroma`,type:R.STRING,validator:{test:e=>Object.values(Ui).includes(e)?{status:z.ok,msg:``}:{status:z.error,msg:`That's not a chroma!`},instructions:`Enter a valid musical note (A-G)`}}],Gi=(De=class ChromaQuestion extends N{constructor(e){var _super13=(...e)=>(super(...e),U(this,`chroma`,void 0),this);_super13(e),this.chroma=e[0].Chroma}get baseFreq(){return this.chroma===`A`?440:this.chroma===`B`?440*2**(2/12):this.chroma===`C`?440*2**(3/12):440}get choiceList(){return shuffle([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}},U(De,`dataShapes`,[{fields:Wi,name:H.PITCH_chroma}]),U(De,`views`,[Hi]),De),Ki=new CourseWare(`pitch`,[Gi]),qi=__commonJSMin(((e,t)=>{t.exports=`6.4.4`})),Ji=__commonJSMin(((e,t)=>{var TimingCallbacks=function(e,t){var n=this;if(t||(t={}),n.qpm=t.qpm?parseInt(t.qpm,10):null,!n.qpm){var r=e.metaText?e.metaText.tempo:null;n.qpm=e.getBpm(r)}n.extraMeasuresAtBeginning=t.extraMeasuresAtBeginning?parseInt(t.extraMeasuresAtBeginning,10):0,n.beatCallback=t.beatCallback,n.eventCallback=t.eventCallback,n.lineEndCallback=t.lineEndCallback,n.lineEndAnticipation=t.lineEndAnticipation?parseInt(t.lineEndAnticipation,10):0,n.beatSubdivisions=t.beatSubdivisions?parseInt(t.beatSubdivisions,10):1,n.joggerTimer=null,n.replaceTarget=function(e){n.noteTimings=e.setTiming(n.qpm,n.extraMeasuresAtBeginning),e.noteTimings.length===0&&(n.noteTimings=e.setTiming(0,0)),n.lineEndCallback&&(n.lineEndTimings=getLineEndTimings(e.noteTimings,n.lineEndAnticipation)),n.startTime=null,n.currentBeat=0,n.currentEvent=0,n.currentLine=0,n.currentTime=0,n.isPaused=!1,n.isRunning=!1,n.pausedPercent=null,n.justUnpaused=!1,n.newSeekPercent=0,n.lastTimestamp=0,n.noteTimings.length!==0&&(n.millisecondsPerBeat=1e3/(n.qpm/60)/n.beatSubdivisions,n.lastMoment=n.noteTimings[n.noteTimings.length-1].milliseconds,n.totalBeats=Math.round(n.lastMoment/n.millisecondsPerBeat))},n.replaceTarget(e),n.doTiming=function(e){if(n.lastTimestamp!==e&&(n.lastTimestamp=e,n.startTime||(n.startTime=e),!n.isPaused&&n.isRunning)){for(n.currentTime=e-n.startTime,n.currentTime+=16;n.noteTimings.length>n.currentEvent&&n.noteTimings[n.currentEvent].milliseconds<n.currentTime;){if(n.eventCallback&&n.noteTimings[n.currentEvent].type===`event`){var t=n.startTime;n.eventCallback(n.noteTimings[n.currentEvent]),t!==n.startTime&&(n.currentTime=e-n.startTime)}n.currentEvent++}if(n.lineEndCallback&&n.lineEndTimings.length>n.currentLine&&n.lineEndTimings[n.currentLine].milliseconds<n.currentTime&&n.currentEvent<n.noteTimings.length){var r=n.noteTimings[n.currentEvent].milliseconds===n.currentTime?n.noteTimings[n.currentEvent]:n.noteTimings[n.currentEvent-1];n.lineEndCallback(n.lineEndTimings[n.currentLine],r,{line:n.currentLine,endTimings:n.lineEndTimings,currentTime:n.currentTime}),n.currentLine++}if(n.currentTime<n.lastMoment){if(requestAnimationFrame(n.doTiming),n.currentBeat*n.millisecondsPerBeat<n.currentTime){var a=n.doBeatCallback(e);a!==null&&(n.currentTime=a)}}else if(n.currentBeat<=n.totalBeats&&n.beatCallback){var o=n.doBeatCallback(e);o!==null&&(n.currentTime=o),requestAnimationFrame(n.doTiming)}if(n.currentTime>=n.lastMoment)if(n.eventCallback){var c=n.eventCallback(null);n.shouldStop(c).then(function(e){e&&n.stop()})}else n.stop()}},n.shouldStop=function(e){return new Promise(function(t){if(!e)return t(!0);if(e===`continue`)return t(!1);e.then&&e.then(function(e){t(e!==`continue`)})})},n.doBeatCallback=function(e){if(n.beatCallback){for(var t=n.currentEvent;t<n.noteTimings.length&&n.noteTimings[t].left===null;)t++;var r,a;if(t<n.noteTimings.length){for(r=n.noteTimings[t].milliseconds,t=Math.max(0,n.currentEvent-1);t>=0&&n.noteTimings[t].left===null;)t--;a=n.noteTimings[t]}var o={},c={};if(a){o.top=a.top,o.height=a.height;var l=Math.max(0,e-n.startTime-a.milliseconds),u=r-a.milliseconds,d=a.endX-a.left,p=u?l*d/u:0;o.left=a.left+p,n.currentEvent===0&&a.milliseconds>e-n.startTime&&(o.left=void 0),c={timestamp:e,startTime:n.startTime,ev:a,endMs:r,offMs:l,offPx:p,gapMs:u,gapPx:d}}else c={timestamp:e,startTime:n.startTime};var m=n.startTime;if(n.beatCallback(n.currentBeat/n.beatSubdivisions,n.totalBeats/n.beatSubdivisions,n.lastMoment,o,c),m!==n.startTime)return e-n.startTime;n.currentBeat++}return null};var a=60;n.animationJogger=function(){n.isRunning&&(n.doTiming(performance.now()),n.joggerTimer=setTimeout(n.animationJogger,a))},n.start=function(e,t){if(n.isRunning=!0,n.isPaused&&(n.isPaused=!1,e===void 0&&(n.justUnpaused=!0)),e)n.setProgress(e,t);else if(e===0)n.reset();else if(n.pausedPercent!==null){var r=performance.now();n.currentTime=n.lastMoment*n.pausedPercent,n.startTime=r-n.currentTime,n.pausedPercent=null,n.reportNext=!0}requestAnimationFrame(n.doTiming),n.joggerTimer=setTimeout(n.animationJogger,a)},n.pause=function(){n.isPaused=!0,n.pausedPercent=(performance.now()-n.startTime)/n.lastMoment,n.isRunning=!1,n.joggerTimer&&(n.joggerTimer=(clearTimeout(n.joggerTimer),null))},n.currentMillisecond=function(){return n.currentTime},n.reset=function(){n.currentBeat=0,n.currentEvent=0,n.currentLine=0,n.startTime=null,n.pausedPercent=null},n.stop=function(){n.pause(),n.reset()},n.setProgress=function(e,t){var r;switch(t){case`seconds`:n.currentTime=e*1e3,n.currentTime<0&&(n.currentTime=0),n.currentTime>n.lastMoment&&(n.currentTime=n.lastMoment),r=n.currentTime/n.lastMoment;break;case`beats`:n.currentTime=e*n.millisecondsPerBeat*n.beatSubdivisions,n.currentTime<0&&(n.currentTime=0),n.currentTime>n.lastMoment&&(n.currentTime=n.lastMoment),r=n.currentTime/n.lastMoment;break;default:r=e,r<0&&(r=0),r>1&&(r=1),n.currentTime=n.lastMoment*r;break}for(n.isRunning||(n.pausedPercent=r),n.startTime=performance.now()-n.currentTime,n.currentEvent,n.currentEvent=0;n.noteTimings.length>n.currentEvent&&n.noteTimings[n.currentEvent].milliseconds<n.currentTime;)n.currentEvent++;if(n.lineEndCallback)for(n.currentLine=0;n.lineEndTimings.length>n.currentLine&&n.lineEndTimings[n.currentLine].milliseconds+n.lineEndAnticipation<n.currentTime;)n.currentLine++;var o=n.currentBeat;n.currentBeat=Math.floor(n.currentTime/n.millisecondsPerBeat),n.beatCallback&&o!==n.currentBeat&&n.doBeatCallback(n.startTime+n.currentTime),n.eventCallback&&n.currentEvent>=0&&n.noteTimings[n.currentEvent].type===`event`&&n.eventCallback(n.noteTimings[n.currentEvent]),n.lineEndCallback&&n.lineEndCallback(n.lineEndTimings[n.currentLine],n.noteTimings[n.currentEvent],{line:n.currentLine,endTimings:n.lineEndTimings}),n.joggerTimer=setTimeout(n.animationJogger,a)}};function getLineEndTimings(e,t){for(var n=[],r=null,a=0;a<e.length;a++){var o=e[a];o.type!==`end`&&o.top!==r&&(n.push({measureNumber:o.measureNumber,milliseconds:o.milliseconds-t,top:o.top,bottom:o.top+o.height}),r=o.top)}return n}t.exports=TimingCallbacks})),Yi=__commonJSMin(((e,t)=>{var n=Ji(),r={};(function(){var e,t;r.startAnimation=function(r,a,o){e&&(e=(e.stop(),void 0)),o.showCursor&&(t=r.querySelector(`.abcjs-cursor`),t||(t=document.createElement(`DIV`),t.className=`abcjs-cursor cursor`,t.style.position=`absolute`,r.appendChild(t),r.style.position=`relative`));function hideMeasures(e){for(var t=0;t<e.length;t++){var n=e[t];n.classList.contains(`abcjs-bar`)||(n.style.display=`none`)}}var c;function disappearMeasuresAfter(e){c&&hideMeasures(r.querySelectorAll(c)),c=e}function disappearMeasuresBefore(e){hideMeasures(r.querySelectorAll(e))}function measureCallback(e){o.hideCurrentMeasure?disappearMeasuresBefore(e):o.hideFinishedMeasures&&disappearMeasuresAfter(e)}function getLineAndMeasure(e){return`.abcjs-l`+e.line+`.abcjs-m`+e.measureNumber}function setCursor(n){if(n){if(n.measureStart){var r=getLineAndMeasure(n);r&&measureCallback(r)}t&&(t.style.left=n.left+`px`,t.style.top=n.top+`px`,t.style.width=n.width+`px`,t.style.height=n.height+`px`)}else e.stop(),e=void 0}e=new n(a,{qpm:o.bpm,eventCallback:setCursor}),e.start()},r.pauseAnimation=function(t){e&&(t?e.pause():e.start())},r.stopAnimation=function(){e&&(e=(e.stop(),void 0))}})(),t.exports=r})),Xi=__commonJSMin(((e,t)=>{var n={};n.cloneArray=function(e){for(var t=[],n=0;n<e.length;n++)t.push(Object.assign({},e[n]));return t},n.cloneHashOfHash=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=Object.assign({},e[n]));return t},n.cloneHashOfArrayOfHash=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=n.cloneArray(e[r]));return t},n.strip=function(e){return e.replace(/^\s+/,``).replace(/\s+$/,``)},n.startsWith=function(e,t){return e.indexOf(t)===0},n.endsWith=function(e,t){var n=e.length-t.length;return n>=0&&e.lastIndexOf(t)===n},n.last=function(e){return e.length===0?null:e[e.length-1]},t.exports=n})),Zi=__commonJSMin(((e,t)=>{var n=Xi(),r={};(function(){var e,t,a,o,c;r.initialize=function(n,r,l,u,d){e=n,t=r,a=l,o=u,c=d,initializeFonts()};function initializeFonts(){a.annotationfont={face:`Helvetica`,size:12,weight:`normal`,style:`normal`,decoration:`none`},a.gchordfont={face:`Helvetica`,size:12,weight:`normal`,style:`normal`,decoration:`none`},a.historyfont={face:`"Times New Roman"`,size:16,weight:`normal`,style:`normal`,decoration:`none`},a.infofont={face:`"Times New Roman"`,size:14,weight:`normal`,style:`italic`,decoration:`none`},a.measurefont={face:`"Times New Roman"`,size:14,weight:`normal`,style:`italic`,decoration:`none`},a.partsfont={face:`"Times New Roman"`,size:15,weight:`normal`,style:`normal`,decoration:`none`},a.repeatfont={face:`"Times New Roman"`,size:13,weight:`normal`,style:`normal`,decoration:`none`},a.textfont={face:`"Times New Roman"`,size:16,weight:`normal`,style:`normal`,decoration:`none`},a.tripletfont={face:`Times`,size:11,weight:`normal`,style:`italic`,decoration:`none`},a.vocalfont={face:`"Times New Roman"`,size:13,weight:`bold`,style:`normal`,decoration:`none`},a.wordsfont={face:`"Times New Roman"`,size:16,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.composerfont={face:`"Times New Roman"`,size:14,weight:`normal`,style:`italic`,decoration:`none`},o.formatting.subtitlefont={face:`"Times New Roman"`,size:16,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.tempofont={face:`"Times New Roman"`,size:15,weight:`bold`,style:`normal`,decoration:`none`},o.formatting.titlefont={face:`"Times New Roman"`,size:20,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.footerfont={face:`"Times New Roman"`,size:12,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.headerfont={face:`"Times New Roman"`,size:12,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.voicefont={face:`"Times New Roman"`,size:13,weight:`bold`,style:`normal`,decoration:`none`},o.formatting.tablabelfont={face:`"Trebuchet MS"`,size:16,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.tabnumberfont={face:`"Arial"`,size:11,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.tabgracefont={face:`"Arial"`,size:8,weight:`normal`,style:`normal`,decoration:`none`},o.formatting.annotationfont=a.annotationfont,o.formatting.gchordfont=a.gchordfont,o.formatting.historyfont=a.historyfont,o.formatting.infofont=a.infofont,o.formatting.measurefont=a.measurefont,o.formatting.partsfont=a.partsfont,o.formatting.repeatfont=a.repeatfont,o.formatting.textfont=a.textfont,o.formatting.tripletfont=a.tripletfont,o.formatting.vocalfont=a.vocalfont,o.formatting.wordsfont=a.wordsfont}var l={gchordfont:!0,measurefont:!0,partsfont:!0,annotationfont:!0,composerfont:!0,historyfont:!0,infofont:!0,subtitlefont:!0,textfont:!0,titlefont:!0,voicefont:!0},fontTranslation=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}},getFontParameter=function(e,n,r,a,o){function processNumberOnly(){var c=parseInt(e[0].token);return e.shift(),n?e.length===0?{face:n.face,weight:n.weight,style:n.style,decoration:n.decoration,size:c}:e.length===1&&e[0].token===`box`&&l[o]?{face:n.face,weight:n.weight,style:n.style,decoration:n.decoration,size:c,box:!0}:(t(`Extra parameters in font definition.`,r,a),{face:n.face,weight:n.weight,style:n.style,decoration:n.decoration,size:c}):(t(`Can't set just the size of the font since there is no default value.`,r,a),{face:`"Times New Roman"`,weight:`normal`,style:`normal`,decoration:`none`,size:c})}if(e[0].token===`*`){if(e.shift(),e[0].type===`number`)return processNumberOnly();t(`Expected font size number after *.`,r,a)}if(e[0].type===`number`)return processNumberOnly();for(var c=[],u,d=`normal`,p=`normal`,m=`none`,h=!1,g=`face`,_=!1;e.length;){var y=e.shift(),b=y.token.toLowerCase();switch(g){case`face`:_||b!==`utf`&&y.type!==`number`&&b!==`bold`&&b!==`italic`&&b!==`underline`&&b!==`box`?c.length>0&&y.token===`-`?(_=!0,c[c.length-1]=c[c.length-1]+y.token):_?(_=!1,c[c.length-1]=c[c.length-1]+y.token):c.push(y.token):y.type===`number`?(u?t(`Font size specified twice in font definition.`,r,a):u=y.token,g=`modifier`):b===`bold`?d=`bold`:b===`italic`?p=`italic`:b===`underline`?m=`underline`:b===`box`?(l[o]?h=!0:t(`This font style doesn't support "box"`,r,a),g=`finished`):b===`utf`?(y=e.shift(),g=`size`):t(`Unknown parameter `+y.token+` in font definition.`,r,a);break;case`size`:y.type===`number`?u?t(`Font size specified twice in font definition.`,r,a):u=y.token:t(`Expected font size in font definition.`,r,a),g=`modifier`;break;case`modifier`:b===`bold`?d=`bold`:b===`italic`?p=`italic`:b===`underline`?m=`underline`:b===`box`?(l[o]?h=!0:t(`This font style doesn't support "box"`,r,a),g=`finished`):t(`Unknown parameter `+y.token+` in font definition.`,r,a);break;case`finished`:t(`Extra characters found after "box" in font definition.`,r,a);break}}u===void 0?n?u=n.size:(t(`Must specify the size of the font since there is no default value.`,r,a),u=12):u=parseFloat(u),c=c.join(` `),c===``&&(n?c=n.face:(t(`Must specify the name of the font since there is no default value.`,r,a),c=`sans-serif`));var x=fontTranslation(c),S={};return x?(S.face=x.face,S.weight=x.weight,S.style=x.style,S.decoration=x.decoration,S.size=u,h&&(S.box=!0),S):(S.face=c,S.weight=d,S.style=p,S.decoration=m,S.size=u,h&&(S.box=!0),S)},getChangingFont=function(e,t,n){return t.length===0?`Directive "`+e+`" requires a font as a parameter.`:(a[e]=getFontParameter(t,a[e],n,0,e),a.is_in_header&&(o.formatting[e]=a[e]),null)},getGlobalFont=function(e,t,n){return t.length===0?`Directive "`+e+`" requires a font as a parameter.`:(o.formatting[e]=getFontParameter(t,o.formatting[e],n,0,e),null)},setScale=function(e,t){var n=``;t.forEach(function(e){n+=e.token});var r=parseFloat(n);if(isNaN(r)||r===0)return`Directive "`+e+`" requires a number as a parameter.`;o.formatting.scale=r},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`.split(`.`),interpretPercMap=function(e){var t=e.split(/\s+/);if(t.length!==2&&t.length!==3)return{error:`Expected parameters "abc-note", "drum-sound", and optionally "note-head"`};var n=t[0],r=parseInt(t[1],10);if((isNaN(r)||r<35||r>81)&&t[1]&&(r=u.indexOf(t[1].toLowerCase())+35),isNaN(r)||r<35||r>81)return{error:`Expected drum name, received "`+t[1]+`"`};var a={sound:r};return t.length===3&&(a.noteHead=t[2]),{key:n,value:a}},getRequiredMeasurement=function(t,n){var r=e.getMeasurement(n);return r.used===0||n.length!==0?{error:`Directive "`+t+`" requires a measurement as a parameter.`}:r.value},oneParameterMeasurement=function(t,n){var r=e.getMeasurement(n);return r.used===0||n.length!==0?`Directive "`+t+`" requires a measurement as a parameter.`:(o.formatting[t]=r.value,null)},addMultilineVar=function(e,t,n,r,o){if(n.length!==1||n[0].type!==`number`)return`Directive "`+t+`" requires a number as a parameter.`;var c=n[0].intt;return r!==void 0&&c<r?`Directive "`+t+`" requires a number greater than or equal to `+r+` as a parameter.`:o!==void 0&&c>o?`Directive "`+t+`" requires a number less than or equal to `+o+` as a parameter.`:(a[e]=c,null)},addMultilineVarBool=function(e,t,n){if(n.length===1&&(n[0].token===`true`||n[0].token===`false`))return a[e]=n[0].token===`true`,null;var r=addMultilineVar(e,t,n,0,1);return r===null?(a[e]=a[e]===1,null):r},addMultilineVarOneParamChoice=function(e,t,n,r){if(n.length!==1)return`Directive "`+t+`" requires one of [ `+r.join(`, `)+` ] as a parameter.`;for(var o=n[0].token,c=!1,l=0;!c&&l<r.length;l++)r[l]===o&&(c=!0);return c?(a[e]=o,null):`Directive "`+t+`" requires one of [ `+r.join(`, `)+` ] as a parameter.`},d=[`nobarlines`,`barlines`,`beataccents`,`nobeataccents`,`droneon`,`droneoff`,`drumon`,`drumoff`,`fermatafixed`,`fermataproportional`,`gchordon`,`gchordoff`,`controlcombo`,`temperamentnormal`,`noportamento`],p=[`gchord`,`ptstress`,`beatstring`],m=[`bassvol`,`chordvol`,`c`,`channel`,`beatmod`,`deltaloudness`,`drumbars`,`gracedivider`,`makechordchannels`,`randomchordattack`,`chordattack`,`stressmodel`,`transpose`,`rtranspose`,`vol`,`volinc`,`gchordbars`],h=[`program`],g=[`ratio`,`snt`,`bendvelocity`,`pitchbend`,`control`,`temperamentlinear`],_=[`beat`],y=[`drone`],b=[`portamento`],x=[`expand`,`grace`,`trim`],S=[`drum`,`chordname`],C=[`bassprog`,`chordprog`],parseMidiCommand=function(e,n,r){var a=e.shift().token,o=[];if(d.indexOf(a)>=0)e.length!==0&&t(`Unexpected parameter in MIDI `+a,r,0);else if(p.indexOf(a)>=0)e.length===1?o.push(e[0].token):t(`Expected one parameter in MIDI `+a,r,0);else if(m.indexOf(a)>=0)e.length===1?e[0].type===`number`?o.push(e[0].intt):t(`Expected one integer parameter in MIDI `+a,r,0):t(`Expected one parameter in MIDI `+a,r,0);else if(h.indexOf(a)>=0)e.length!==1&&e.length!==2?t(`Expected one or two parameters in MIDI `+a,r,0):e[0].type===`number`?e.length===2&&e[1].type!==`number`?t(`Expected integer parameter in MIDI `+a,r,0):(o.push(e[0].intt),e.length===2&&o.push(e[1].intt)):t(`Expected integer parameter in MIDI `+a,r,0);else if(g.indexOf(a)>=0)e.length===2?e[0].type!==`number`||e[1].type!==`number`?t(`Expected two integer parameters in MIDI `+a,r,0):(o.push(e[0].intt),o.push(e[1].intt)):t(`Expected two parameters in MIDI `+a,r,0);else if(b.indexOf(a)>=0)e.length===2?e[0].type!==`alpha`||e[1].type!==`number`?t(`Expected one string and one integer parameters in MIDI `+a,r,0):(o.push(e[0].token),o.push(e[1].intt)):t(`Expected two parameters in MIDI `+a,r,0);else if(a===`drummap`)e.length===2&&e[0].type===`alpha`&&e[1].type===`number`?(n.formatting||(n.formatting={}),n.formatting.midi||(n.formatting.midi={}),n.formatting.midi.drummap||(n.formatting.midi.drummap={}),n.formatting.midi.drummap[e[0].token]=e[1].intt,o=n.formatting.midi.drummap):e.length===3&&e[0].type===`punct`&&e[1].type===`alpha`&&e[2].type===`number`?(n.formatting||(n.formatting={}),n.formatting.midi||(n.formatting.midi={}),n.formatting.midi.drummap||(n.formatting.midi.drummap={}),n.formatting.midi.drummap[e[0].token+e[1].token]=e[2].intt,o=n.formatting.midi.drummap):t(`Expected one note name and one integer parameter in MIDI `+a,r,0);else if(x.indexOf(a)>=0)e.length===3?e[0].type!==`number`||e[1].token!==`/`||e[2].type!==`number`?t(`Expected fraction parameter in MIDI `+a,r,0):(o.push(e[0].intt),o.push(e[2].intt)):t(`Expected fraction parameter in MIDI `+a,r,0);else if(_.indexOf(a)>=0)e.length===4?e[0].type!==`number`||e[1].type!==`number`||e[2].type!==`number`||e[3].type!==`number`?t(`Expected four integer parameters in MIDI `+a,r,0):(o.push(e[0].intt),o.push(e[1].intt),o.push(e[2].intt),o.push(e[3].intt)):t(`Expected four parameters in MIDI `+a,r,0);else if(y.indexOf(a)>=0)e.length===5?e[0].type!==`number`||e[1].type!==`number`||e[2].type!==`number`||e[3].type!==`number`||e[4].type!==`number`?t(`Expected five integer parameters in MIDI `+a,r,0):(o.push(e[0].intt),o.push(e[1].intt),o.push(e[2].intt),o.push(e[3].intt),o.push(e[4].intt)):t(`Expected five parameters in MIDI `+a,r,0);else if(h.indexOf(a)>=0)e.length!==1||e.length!==4?t(`Expected one or two parameters in MIDI `+a,r,0):e[0].type===`number`?e.length===4?(e[1].token!==`octave`&&t(`Expected octave parameter in MIDI `+a,r,0),e[2].token!==`=`&&t(`Expected octave parameter in MIDI `+a,r,0),e[3].type!==`number`&&t(`Expected integer parameter for octave in MIDI `+a,r,0)):(o.push(e[0].intt),e.length===4&&o.push(e[3].intt)):t(`Expected integer parameter in MIDI `+a,r,0);else if(S.indexOf(a)>=0)if(e.length<2)t(`Expected string parameter and at least one integer parameter in MIDI `+a,r,0);else if(e[0].type!==`alpha`)t(`Expected string parameter and at least one integer parameter in MIDI `+a,r,0);else{var l=e.shift();for(o.push(l.token);e.length>0;)l=e.shift(),l.type!==`number`&&t(`Expected integer parameter in MIDI `+a,r,0),o.push(l.intt)}else if(C.indexOf(a)>=0){if(e.length!==1&&e.length!==2)t(`Expected one or two parameters in MIDI `+a,r,0);else if(e[0].type!==`number`)t(`Expected integer parameter in MIDI `+a,r,0);else if(e.length===2&&e[1].type!==`alpha`)t(`Expected alpha parameter in MIDI `+a,r,0);else if(o.push(e[0].intt),e.length===2){var u=e[1].token;u.indexOf(`octave=`)==-1?t(`Expected octave= in MIDI`+a):(u=u.replace(`octave=`,``),u=parseInt(u),isNaN(u)?t(`Expected octave value in MIDI`+a):(u<-1&&(t(`Expected octave= in MIDI `+a+` to be >= -1 (recv:`+u+`)`),u=-1),u>3&&(t(`Expected octave= in MIDI `+a+` to be <= 3 (recv:`+u+`)`),u=3),o.push(u)))}}c.hasBeginMusic()?c.appendElement(`midi`,-1,-1,{cmd:a,params:o}):(n.formatting.midi===void 0&&(n.formatting.midi={}),n.formatting.midi[a]=o)};r.parseFontChangeLine=function(e){e=e.replace(/\$\$/g,``);var t=e.split(`$`);if(t.length>1&&a.setfont){var n=[];t[0]!==``&&n.push({text:t[0]});for(var r=1;r<t.length;r++)if(t[r][0]===`0`)n.push({text:t[r].substring(1).replace(/\x03/g,`$$`)});else{var o=parseInt(t[r][0],10);a.setfont[o]?n.push({font:a.setfont[o],text:t[r].substring(1).replace(/\x03/g,`$$`)}):n[n.length-1].text+=`$`+t[r].replace(/\x03/g,`$$`)}return n}return e.replace(/\x03/g,`$$`)};var w=[`auto`,`above`,`below`,`hidden`];r.addDirective=function(l){var u=e.tokenize(l,0,l.length);if(u.length===0||u[0].type!==`alpha`)return null;var d=l.substring(l.indexOf(u[0].token)+u[0].token.length);d=e.stripComment(d);var p=u.shift().token.toLowerCase(),m=``,h;switch(p){case`bagpipes`:o.formatting.bagpipes=!0;break;case`flatbeams`:o.formatting.flatbeams=!0;break;case`jazzchords`:o.formatting.jazzchords=!0;break;case`accentAbove`:o.formatting.accentAbove=!0;break;case`germanAlphabet`:o.formatting.germanAlphabet=!0;break;case`landscape`:a.landscape=!0;break;case`papersize`:a.papersize=d;break;case`graceslurs`:if(u.length!==1)return`Directive graceslurs requires one parameter: 0 or 1`;if(u[0].token===`0`||u[0].token===`false`)o.formatting.graceSlurs=!1;else if(u[0].token===`1`||u[0].token===`true`)o.formatting.graceSlurs=!0;else return`Directive graceslurs requires one parameter: 0 or 1 (received `+u[0].token+`)`;break;case`lineThickness`:var g=parseStretchLast(u);if(g.value!==void 0&&(o.formatting.lineThickness=g.value),g.error)return g.error;break;case`stretchlast`:var _=parseStretchLast(u);if(_.value!==void 0&&(o.formatting.stretchlast=_.value),_.error)return _.error;break;case`titlecaps`:a.titlecaps=!0;break;case`titleleft`:o.formatting.titleleft=!0;break;case`measurebox`:o.formatting.measurebox=!0;break;case`vocal`:return addMultilineVarOneParamChoice(`vocalPosition`,p,u,w);case`dynamic`:return addMultilineVarOneParamChoice(`dynamicPosition`,p,u,w);case`gchord`:return addMultilineVarOneParamChoice(`chordPosition`,p,u,w);case`ornament`:return addMultilineVarOneParamChoice(`ornamentPosition`,p,u,w);case`volume`:return addMultilineVarOneParamChoice(`volumePosition`,p,u,w);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 oneParameterMeasurement(p,u);case`voicescale`:if(u.length!==1||u[0].type!==`number`)return`voicescale requires one float as a parameter`;var y=u.shift();return a.currentVoice&&(a.currentVoice.scale=y.floatt,c.changeVoiceScale(a.currentVoice.scale)),null;case`voicecolor`:if(u.length!==1)return`voicecolor requires one string as a parameter`;var b=u.shift();return a.currentVoice&&(a.currentVoice.color=b.token,c.changeVoiceColor(a.currentVoice.color)),null;case`vskip`:var x=Math.round(getRequiredMeasurement(p,u));return x.error?x.error:(c.addSpacing(x),null);case`scale`:setScale(p,u);break;case`sep`:if(u.length===0)c.addSeparator(14,14,85,{startChar:a.iChar,endChar:a.iChar+5});else{var S=e.getMeasurement(u);if(S.used===0)return`Directive "`+p+`" requires 3 numbers: space above, space below, length of line`;var C=S.value;if(S=e.getMeasurement(u),S.used===0)return`Directive "`+p+`" requires 3 numbers: space above, space below, length of line`;var T=S.value;if(S=e.getMeasurement(u),S.used===0||u.length!==0)return`Directive "`+p+`" requires 3 numbers: space above, space below, length of line`;var E=S.value;c.addSeparator(C,T,E,{startChar:a.iChar,endChar:a.iChar+d.length})}break;case`barsperstaff`:if(m=addMultilineVar(`barsperstaff`,p,u),m!==null)return m;break;case`staffnonote`:if(u.length!==1)return`Directive staffnonote requires one parameter: 0 or 1`;if(u[0].token===`0`)a.staffnonote=!0;else if(u[0].token===`1`)a.staffnonote=!1;else return`Directive staffnonote requires one parameter: 0 or 1 (received `+u[0].token+`)`;break;case`printtempo`:if(m=addMultilineVarBool(`printTempo`,p,u),m!==null)return m;break;case`partsbox`:if(m=addMultilineVarBool(`partsBox`,p,u),m!==null)return m;a.partsfont.box=a.partsBox;break;case`freegchord`:if(m=addMultilineVarBool(`freegchord`,p,u),m!==null)return m;break;case`measurenb`:case`barnumbers`:if(m=addMultilineVar(`barNumbers`,p,u),m!==null)return m;break;case`setbarnb`:if(u.length!==1||u[0].type!==`number`)return`Directive setbarnb requires a number as a parameter.`;a.currBarNumber=c.setBarNumberImmediate(u[0].intt);break;case`begintext`:var D=``;for(h=e.nextLine();h&&h.indexOf(`%%endtext`)!==0;)n.startsWith(h,`%%`)?D+=h.substring(2)+`
40
+ `:D+=h+`
41
+ `,h=e.nextLine();c.addText(D,{startChar:a.iChar,endChar:a.iChar+D.length+7});break;case`continueall`:a.continueall=!0;break;case`beginps`:for(h=e.nextLine();h&&h.indexOf(`%%endps`)!==0;)e.nextLine();t(`Postscript ignored`,l,0);break;case`deco`:d.length>0&&a.ignoredDecorations.push(d.substring(0,d.indexOf(` `))),t(`Decoration redefinition ignored`,l,0);break;case`text`:var O=e.translateString(d);c.addText(r.parseFontChangeLine(O),{startChar:a.iChar,endChar:a.iChar+d.length+7});break;case`center`:var k=e.translateString(d);c.addCentered(r.parseFontChangeLine(k));break;case`font`:break;case`setfont`:var A=e.tokenize(d,0,d.length);if(A.length>=4&&A[0].token===`-`&&A[1].type===`number`){var j,M=parseInt(A[1].token);M>=1&&M<=9&&((j=a).setfont||(j.setfont=[]),A.shift(),A.shift(),a.setfont[M]=getFontParameter(A,a.setfont[M],l,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 getChangingFont(p,u,l);case`composerfont`:case`subtitlefont`:case`tempofont`:case`titlefont`:case`voicefont`:case`footerfont`:case`headerfont`:return getGlobalFont(p,u,l);case`barlabelfont`:case`barnumberfont`:case`barnumfont`:return getChangingFont(`measurefont`,u,l);case`staves`:case`score`:a.score_is_present=!0;for(var addVoice=function(e,t,r,o,c){(t||a.staves.length===0)&&a.staves.push({index:a.staves.length,numVoices:0});var l=n.last(a.staves);r!==void 0&&l.bracket===void 0&&(l.bracket=r),o!==void 0&&l.brace===void 0&&(l.brace=o),c&&(l.connectBarLines=`end`),a.voices[e]===void 0&&(a.voices[e]={staffNum:l.index,index:l.numVoices},l.numVoices++)},N=!1,P=!1,F=!1,I=!1,L=!1,ee=!1,R=!1,z,addContinueBar=function(){if(R=!0,z){var e=`start`;z.staffNum>0&&(a.staves[z.staffNum-1].connectBarLines===`start`||a.staves[z.staffNum-1].connectBarLines===`continue`)&&(e=`continue`),a.staves[z.staffNum].connectBarLines=e}};u.length;){var B=u.shift();switch(B.token){case`(`:N?t(`Can't nest parenthesis in %%score`,l,B.start):(N=!0,I=!0);break;case`)`:!N||I?t(`Unexpected close parenthesis in %%score`,l,B.start):N=!1;break;case`[`:P?t(`Can't nest brackets in %%score`,l,B.start):(P=!0,L=!0);break;case`]`:!P||L?t(`Unexpected close bracket in %%score`,l,B.start):(P=!1,a.staves[z.staffNum].bracket=`end`);break;case`{`:F?t(`Can't nest braces in %%score`,l,B.start):(F=!0,ee=!0);break;case`}`:!F||ee?t(`Unexpected close brace in %%score`,l,B.start):(F=!1,a.staves[z.staffNum].brace=`end`);break;case`|`:addContinueBar();break;default:for(var V=``;(B.type===`alpha`||B.type===`number`)&&(V+=B.token,B.continueId);)B=u.shift();addVoice(V,!N||I,L?`start`:P?`continue`:void 0,ee?`start`:F?`continue`:void 0,R),I=!1,L=!1,ee=!1,R=!1,z=a.voices[V],p===`staves`&&addContinueBar();break}}break;case`newpage`:var H=e.getInt(d);c.addNewPage(H.digits===0?-1:H.value);break;case`abc`:var U=d.split(` `);switch(U[0]){case`-copyright`:case`-creator`:case`-edited-by`:case`-version`:case`-charset`:var te=U.shift();c.addMetaText(p+te,U.join(` `),{startChar:a.iChar,endChar:a.iChar+d.length+5});break;default:return`Unknown directive: `+p+U[0]}break;case`header`:case`footer`:var W=e.getMeat(d,0,d.length);W=d.substring(W.start,W.end),W[0]===`"`&&W[W.length-1]===`"`&&(W=W.substring(1,W.length-1));var ne=W.split(` `),re={};re=ne.length===1?{left:``,center:ne[0],right:``}:ne.length===2?{left:ne[0],center:ne[1],right:``}:{left:ne[0],center:ne[1],right:ne[2]},ne.length>3&&t(`Too many tabs in `+p+`: `+ne.length+` found.`,d,0),c.addMetaTextObj(p,re,{startChar:a.iChar,endChar:a.iChar+l.length});break;case`midi`:var ie=e.tokenize(d,0,d.length,!0);ie.length>0&&ie[0].token===`=`&&ie.shift(),ie.length===0?t(`Expected midi command`,d,0):parseMidiCommand(ie,o,d);break;case`percmap`:var ae=interpretPercMap(d);ae.error?t(ae.error,l,8):(o.formatting.percmap||(o.formatting.percmap={}),o.formatting.percmap[ae.key]=ae.value);break;case`map`:case`playtempo`:case`auquality`:case`continuous`:case`nobarcheck`:o.formatting[p]=d;break;default:return`Unknown directive: `+p}return null},r.globalFormatting=function(n){for(var r in n)if(n.hasOwnProperty(r)){var c=``+n[r],l=e.tokenize(c,0,c.length),u;switch(r){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`:getChangingFont(r,l,c);break;case`scale`:setScale(r,l);break;case`partsbox`:u=addMultilineVarBool(`partsBox`,r,l),u!==null&&t(u),a.partsfont.box=a.partsBox;break;case`freegchord`:u=addMultilineVarBool(`freegchord`,r,l),u!==null&&t(u);break;case`fontboxpadding`:(l.length!==1||l[0].type!==`number`)&&t(`Directive "`+r+`" requires a number as a parameter.`),o.formatting.fontboxpadding=l[0].floatt;break;case`stafftopmargin`:(l.length!==1||l[0].type!==`number`)&&t(`Directive "`+r+`" requires a number as a parameter.`),o.formatting.stafftopmargin=l[0].floatt;break;case`stretchlast`:var d=parseStretchLast(l);if(d.value!==void 0&&(o.formatting.stretchlast=d.value),d.error)return d.error;break;default:t(`Formatting directive unrecognized: `,r,0)}}};function parseStretchLast(e){if(e.length===0)return{value:1};if(e.length===1){if(e[0].type===`number`){if(e[0].floatt>=0||e[0].floatt<=1)return{value:e[0].floatt}}else if(e[0].token===`false`)return{value:0};else if(e[0].token===`true`)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.exports=r})),Qi=__commonJSMin(((e,t)=>{var n={},r=`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'''`.split(`.`);n.pitchIndex=function(e){return r.indexOf(e)},n.noteName=function(e){return r[e]},t.exports=n})),$i=__commonJSMin(((e,t)=>{var n=[`C`,`C♯`,`D`,`D♯`,`E`,`F`,`F♯`,`G`,`G♯`,`A`,`A♯`,`B`],r=[`C`,`D♭`,`D`,`E♭`,`E`,`F`,`G♭`,`G`,`A♭`,`A`,`B♭`,`B`],a=[`C`,`C#`,`D`,`D#`,`E`,`F`,`F#`,`G`,`G#`,`A`,`A#`,`B`],o=[`C`,`Db`,`D`,`Eb`,`E`,`F`,`Gb`,`G`,`Ab`,`A`,`Bb`,`B`];function transposeChordName(e,t,c,l){if(!t||t%12==0)return e;for(;t<0;)t+=12;t>11&&(t%=12);var u=e.match(/^([A-G][b#♭♯]?)([^\/]+)?\/?([A-G][b#♭♯]?)?(.+)?/);if(!u)return e;var d=u[1],p=u[2],m=u[3],h=u[4],g=n.indexOf(d);if(g<0&&(g=r.indexOf(d)),g<0&&(g=a.indexOf(d)),g<0&&(g=o.indexOf(d)),g<0)return e;if(g+=t,g%=12,e=c?l?o[g]:r[g]:l?a[g]:n[g],p&&(e+=p),m){var g=n.indexOf(m);g<0&&(g=r.indexOf(m)),g<0&&(g=a.indexOf(m)),g<0&&(g=o.indexOf(m)),e+=`/`,g>=0?(g+=t,g%=12,c?l?e+=o[g]:e+=r[g]:l?e+=a[g]:e+=n[g]):e+=m}return h&&(e+=h),e}t.exports=transposeChordName})),ea=__commonJSMin(((e,t)=>{var n={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}},r=null;function createKeyReverse(){r={};for(var e=Object.keys(n),t=0;t<e.length;t++){var a=n[e[t]];r[e[t].toLowerCase()]=e[t];for(var o=0;o<a.modes.length;o++){var c=a.modes[o].toLowerCase();r[c]=e[t]}}}function relativeMajor(e){r||createKeyReverse();var t=e.toLowerCase().match(/([a-g][b#]?)(maj|min|mix|dor|phr|lyd|loc|m)?/);return!t||!t[2]?e:(t=t[1]+t[2],r[t]||e)}function relativeMode(e,t){var r=n[e];if(!r||t===``)return e;var a=t.toLowerCase().match(/^(maj|min|mix|dor|phr|lyd|loc|m)/);if(!a)return e;for(var o=a[1],c=0;c<r.modes.length;c++){var l=r.modes[c],u=l.toLowerCase().indexOf(o);if(u!==-1&&u===l.length-o.length)return l.substring(0,l.length-o.length)}return e}function transposeKey(e,t){var r=n[e];if(!r)return e;for(;t<0;)t+=12;for(var a=(r.stepsFromC+t)%12,o=0;o<Object.keys(n).length;o++){var c=Object.keys(n)[o];if(n[c].stepsFromC===a)return c}return e}t.exports={relativeMajor,relativeMode,transposeKey}})),ta=__commonJSMin(((e,t)=>{var{relativeMajor:n}=ea(),r={acc:`sharp`,note:`f`},a={acc:`sharp`,note:`c`},o={acc:`sharp`,note:`g`},c={acc:`sharp`,note:`d`},l={acc:`sharp`,note:`A`},u={acc:`sharp`,note:`e`},d={acc:`sharp`,note:`B`},p={acc:`flat`,note:`B`},m={acc:`flat`,note:`e`},h={acc:`flat`,note:`A`},g={acc:`flat`,note:`d`},_={acc:`flat`,note:`G`},y={acc:`flat`,note:`c`},b={acc:`flat`,note:`F`},x={"C#":[r,a,o,c,l,u,d],"F#":[r,a,o,c,l,u],B:[r,a,o,c,l],E:[r,a,o,c],A:[r,a,o],D:[r,a],G:[r],C:[],F:[p],Bb:[p,m],Eb:[p,m,h],Cm:[p,m,h],Ab:[p,m,h,g],Db:[p,m,h,g,_],Gb:[p,m,h,g,_,y],Cb:[p,m,h,g,_,y,b],"A#":[p,m],"B#":[],"D#":[p,m,h],"E#":[p],"G#":[p,m,h,g],none:[]};function keyAccidentals(e){var t=x[n(e)];return t?JSON.parse(JSON.stringify(t)):null}t.exports=keyAccidentals})),na=__commonJSMin(((e,t)=>{var n=Qi(),r=$i(),a=ta(),o={},c={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},l=[`C`,`Db`,`D`,`Eb`,`E`,`F`,`F#`,`G`,`Ab`,`A`,`Bb`,`B`],u=[`C`,`C#`,`D`,`D#`,`E`,`F`,`F#`,`G`,`G#`,`A`,`Bb`,`B`];o.keySignature=function(e,t,n,r,o){if(e.clef.type===`perc`||e.clef.type===`none`)return{accidentals:a(t),root:n,acc:r};o||(o=0),e.localTransposeVerticalMovement=0,e.localTransposePreferFlats=!1;var d=a(t);if(!d)return e.key;if(e.localTranspose=(e.globalTranspose?e.globalTranspose:0)+o,!e.localTranspose)return{accidentals:d,root:n,acc:r};if(e.globalTransposeOrigKeySig=d,e.localTranspose%12==0)return e.localTransposeVerticalMovement=e.localTranspose/12*7,{accidentals:d,root:n,acc:r};var p=t[0];t[1]===`b`||t[1]===`#`?(p+=t[1],t=t.substr(2)):t=t.substr(1);var m=c[p],h=m!==void 0;h||(m=0,p=`C`,t=``);for(var g=m+e.localTranspose;g<0;)g+=12;g>11&&(g%=12);var _=t[0]===`m`?u[g]:l[g],y=_+t,b=a(y);b.length>0&&b[0].acc===`flat`&&(e.localTransposePreferFlats=!0);var x=y.charCodeAt(0)-p.charCodeAt(0);return e.localTranspose>0?(x<0||x===0&&(p[1]===`#`||y[1]===`b`))&&(x+=7):e.localTranspose<0&&(x>0||x===0&&(p[1]===`b`||y[1]===`#`))&&(x-=7),e.localTranspose>0?e.localTransposeVerticalMovement=x+Math.floor(e.localTranspose/12)*7:e.localTransposeVerticalMovement=x+Math.ceil(e.localTranspose/12)*7,h?{accidentals:b,root:_[0],acc:_.length>1?_[1]:``}:{accidentals:[],root:n,acc:r}},o.chordName=function(e,t){return r(t,e.localTranspose,e.localTransposePreferFlats,e.freegchord)};var d=[`c`,`d`,`e`,`f`,`g`,`a`,`b`];function accidentalChange(e,t,n,r,a){for(var o=d[(e+49)%7],c=0,l=0;l<r.length;l++)r[l].note.toLowerCase()===o&&(c=p[r[l].acc]);for(var u=p[n]-c,m=d[(t+49)%7],h=0,g=0;g<a.accidentals.length;g++)a.accidentals[g].note.toLowerCase()===m&&(h=p[a.accidentals[g].acc]);var _=u+h;return _<-2&&(t--,_+=m===`c`||m===`f`?1:2),_>2&&(t++,_-=m===`b`||m===`e`?1:2),[t,_]}var p={dblflat:-2,flat:-1,natural:0,sharp:1,dblsharp:2},m={"-2":`dblflat`,"-1":`flat`,0:`natural`,1:`sharp`,2:`dblsharp`},h={"-2":`__`,"-1":`_`,0:`=`,1:`^`,2:`^^`};o.note=function(e,t){if(!(!e.localTranspose||e.clef.type===`perc`)){var r=t.pitch;if(e.localTransposeVerticalMovement&&(t.pitch+=e.localTransposeVerticalMovement,t.name)){var a=t.accidental?t.name.substring(1):t.name,o=t.accidental?t.name[0]:``,c=n.pitchIndex(a);t.name=o+n.noteName(c+e.localTransposeVerticalMovement)}if(t.accidental){var l=accidentalChange(r,t.pitch,t.accidental,e.globalTransposeOrigKeySig,e.targetKey);t.pitch=l[0],t.accidental=m[l[1]],t.name&&(t.name=h[l[1]]+t.name.replace(/[_^=]/g,``))}}},t.exports=o})),ra=__commonJSMin(((e,t)=>{var n=Zi(),r=na(),a={};(function(){var e,t,o,c;a.initialize=function(n,r,a,l,u){e=n,t=r,o=a,c=u},a.standardKey=function(e,t,n,a){return r.keySignature(o,e,t,n,a)};var l={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}},calcMiddle=function(e,t){var n=l[e];return(n?n.mid:0)+t};a.fixClef=function(e){var t=l[e.type];t&&(e.clefPos=t.pitch,e.type=t.clef)},a.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 u={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};a.addPosToKey=function(e,t){var n=e.verticalPos;t.accidentals.forEach(function(e){var t=u[e.note];t-=n,e.verticalPos=t}),t.impliedNaturals&&t.impliedNaturals.forEach(function(e){var t=u[e.note];t-=n,e.verticalPos=t}),n<-10?(t.accidentals.forEach(function(e){e.verticalPos-=7,(e.verticalPos>=11||e.verticalPos===10&&e.acc===`flat`)&&(e.verticalPos-=7),e.note===`A`&&e.acc===`sharp`&&(e.verticalPos-=7),(e.note===`G`||e.note===`F`)&&e.acc===`flat`&&(e.verticalPos-=7)}),t.impliedNaturals&&t.impliedNaturals.forEach(function(e){e.verticalPos-=7,(e.verticalPos>=11||e.verticalPos===10&&e.acc===`flat`)&&(e.verticalPos-=7),e.note===`A`&&e.acc===`sharp`&&(e.verticalPos-=7),(e.note===`G`||e.note===`F`)&&e.acc===`flat`&&(e.verticalPos-=7)})):n<-4?(t.accidentals.forEach(function(e){e.verticalPos-=7,n===-8&&(e.note===`f`||e.note===`g`)&&e.acc===`sharp`&&(e.verticalPos-=7)}),t.impliedNaturals&&t.impliedNaturals.forEach(function(e){e.verticalPos-=7,n===-8&&(e.note===`f`||e.note===`g`)&&e.acc===`sharp`&&(e.verticalPos-=7)})):n>=7&&(t.accidentals.forEach(function(e){e.verticalPos+=7}),t.impliedNaturals&&t.impliedNaturals.forEach(function(e){e.verticalPos+=7}))},a.fixKey=function(e,t){var n=Object.assign({},t);return a.addPosToKey(e,n),n};var parseMiddle=function(e){var t=0,n=e[t++];(n===`^`||n===`_`)&&(n=e[t++]);var r=u[n];for(r===void 0&&(r=6);t<e.length;t++)if(e[t]===`,`)r-=7;else if(e[t]===`'`)r+=7;else break;return{mid:r-6,str:e.substring(t)}},normalizeAccidentals=function(e){for(var t=0;t<e.length;t++)e[t].note===`b`?e[t].note=`B`:e[t].note===`a`?e[t].note=`A`:e[t].note===`F`?e[t].note=`f`:e[t].note===`E`?e[t].note=`e`:e[t].note===`D`?e[t].note=`d`:e[t].note===`C`?e[t].note=`c`:e[t].note===`G`&&e[t].acc===`sharp`?e[t].note=`g`:e[t].note===`g`&&e[t].acc===`flat`&&(e[t].note=`G`)};a.parseKey=function(r,c){r.length===0&&(r=`none`);var l=e.tokenize(r,0,r.length),u={};if(l.length===0)return t(`Must pass in key signature.`,r,0),u;switch(l[0].token){case`HP`:n.addDirective(`bagpipes`),o.key={root:`HP`,accidentals:[],acc:``,mode:``},u.foundKey=!0,l.shift();break;case`Hp`:n.addDirective(`bagpipes`),o.key={root:`Hp`,accidentals:[{acc:`natural`,note:`g`},{acc:`sharp`,note:`f`},{acc:`sharp`,note:`c`}],acc:``,mode:``},u.foundKey=!0,l.shift();break;case`none`:o.key={root:`none`,accidentals:[],acc:``,mode:``},u.foundKey=!0,l.shift();break;default:var d=e.getKeyPitch(l[0].token);if(d.len>0){u.foundKey=!0;var p=``,m=``;l[0].token.length>1?l[0].token=l[0].token.substring(1):l.shift();var h=d.token;if(l.length>0){var g=e.getSharpFlat(l[0].token);if(g.len>0&&(l[0].token.length>1?l[0].token=l[0].token.substring(1):l.shift(),h+=g.token,p=g.token),l.length>0){var _=e.getMode(l[0].token);_.len>0&&(l.shift(),h+=_.token,m=_.token)}if(a.standardKey(h,d.token,p,0)===void 0)return t(`Unsupported key signature: `+h,r,0),u}var y=a.deepCopyKey(o.key),b=!c&&o.globalTranspose?-o.globalTranspose:0,x;if(c&&(x=o.globalTransposeOrigKeySig),o.key=a.deepCopyKey(a.standardKey(h,d.token,p,b)),c&&(o.globalTransposeOrigKeySig=x),o.key.mode=m,y){for(var S,C=0;C<o.key.accidentals.length;C++)for(S=0;S<y.accidentals.length;S++)y.accidentals[S].note&&o.key.accidentals[C].note.toLowerCase()===y.accidentals[S].note.toLowerCase()&&(y.accidentals[S].note=null);for(S=0;S<y.accidentals.length;S++)y.accidentals[S].note&&(o.key.impliedNaturals||(o.key.impliedNaturals=[]),o.key.impliedNaturals.push({acc:`natural`,note:y.accidentals[S].note}))}}break}if(l.length===0||(l[0].token===`exp`&&l.shift(),l.length===0)||(l[0].token===`oct`&&l.shift(),l.length===0))return u;var w=e.getKeyAccidentals2(l);if(w.warn&&t(w.warn,r,0),w.accs){u.foundKey||(u.foundKey=!0,o.key={root:`none`,acc:``,mode:``,accidentals:[]}),normalizeAccidentals(w.accs);for(var T=0;T<w.accs.length;T++){for(var E=!1,D=0;D<o.key.accidentals.length&&!E;D++)o.key.accidentals[D].note===w.accs[T].note&&(E=!0,o.key.accidentals[D].acc!==w.accs[T].acc&&(o.key.accidentals[D].acc=w.accs[T].acc,o.key.explicitAccidentals||(o.key.explicitAccidentals=[]),o.key.explicitAccidentals.push(w.accs[T])));if(!E&&(o.key.explicitAccidentals||(o.key.explicitAccidentals=[]),o.key.explicitAccidentals.push(w.accs[T]),o.key.accidentals.push(w.accs[T]),o.key.impliedNaturals))for(var O=0;O<o.key.impliedNaturals.length;O++)o.key.impliedNaturals[O].note===w.accs[T].note&&o.key.impliedNaturals.splice(O,1)}}for(var k;l.length>0;)switch(l[0].token){case`m`:case`middle`:if(l.shift(),l.length===0)return t(`Expected = after middle`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after middle`,r,k.start);break}if(l.length===0)return t(`Expected parameter after middle=`,r,0),u;var A=e.getPitchFromTokens(l);A.warn&&t(A.warn,r,0),A.position&&(o.clef.verticalPos=A.position-6);break;case`transpose`:if(l.shift(),l.length===0)return t(`Expected = after transpose`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after transpose`,r,k.start);break}if(l.length===0)return t(`Expected parameter after transpose=`,r,0),u;if(l[0].type!==`number`){t(`Expected number after transpose`,r,l[0].start);break}o.clef.transpose=l[0].intt,l.shift();break;case`stafflines`:if(l.shift(),l.length===0)return t(`Expected = after stafflines`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after stafflines`,r,k.start);break}if(l.length===0)return t(`Expected parameter after stafflines=`,r,0),u;if(l[0].type!==`number`){t(`Expected number after stafflines`,r,l[0].start);break}o.clef.stafflines=l[0].intt,l.shift();break;case`staffscale`:if(l.shift(),l.length===0)return t(`Expected = after staffscale`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after staffscale`,r,k.start);break}if(l.length===0)return t(`Expected parameter after staffscale=`,r,0),u;if(l[0].type!==`number`){t(`Expected number after staffscale`,r,l[0].start);break}o.clef.staffscale=l[0].floatt,l.shift();break;case`octave`:if(l.shift(),l.length===0)return t(`Expected = after octave`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after octave`,r,k.start);break}if(l.length===0)return t(`Expected parameter after octave=`,r,0),u;if(l[0].type!==`number`){t(`Expected number after octave`,r,l[0].start);break}o.octave=l[0].intt,l.shift();break;case`style`:if(l.shift(),l.length===0)return t(`Expected = after style`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after style`,r,k.start);break}if(l.length===0)return t(`Expected parameter after style=`,r,0),u;switch(l[0].token){case`normal`:case`harmonic`:case`rhythm`:case`x`:case`triangle`:o.style=l[0].token,l.shift();break;default:t(`error parsing style element: `+l[0].token,r,l[0].start);break}break;case`clef`:if(l.shift(),l.length===0)return t(`Expected = after clef`,r,0),u;if(k=l.shift(),k.token!==`=`){t(`Expected = after clef`,r,k.start);break}if(l.length===0)return t(`Expected parameter after clef=`,r,0),u;case`treble`:case`bass`:case`alto`:case`tenor`:case`perc`:case`none`:var j=l.shift();switch(j.token){case`treble`:case`tenor`:case`alto`:case`bass`:case`perc`:case`none`:break;case`C`:j.token=`alto`;break;case`F`:j.token=`bass`;break;case`G`:j.token=`treble`;break;case`c`:j.token=`alto`;break;case`f`:j.token=`bass`;break;case`g`:j.token=`treble`;break;default:t(`Expected clef name. Found `+j.token,r,j.start);break}l.length>0&&l[0].type===`number`&&(j.token+=l[0].token,l.shift()),l.length>1&&(l[0].token===`-`||l[0].token===`+`||l[0].token===`^`||l[0].token===`_`)&&l[1].token===`8`&&(j.token+=l[0].token+l[1].token,l.shift(),l.shift()),o.clef={type:j.token,verticalPos:calcMiddle(j.token,0)},o.currentVoice&&o.currentVoice.transpose!==void 0&&(o.clef.transpose=o.currentVoice.transpose),u.foundClef=!0;break;default:t(`Unknown parameter: `+l[0].token,r,l[0].start),l.shift()}return u};var setCurrentVoice=function(e){var t=o.voices[e];if(!(o.currentVoice&&o.currentVoice.index===t.index&&o.currentVoice.staffNum===t.staffNum))return o.currentVoice=t,c.setCurrentVoice(t.staffNum,t.index,e)};a.parseVoice=function(n,r,a){var c=e.getMeat(n,r,a),l=c.start,u=c.end,d=e.getToken(n,l,u);if(d.length===0){t(`Expected a voice id`,n,l);return}var p=!1;o.voices[d]===void 0&&(o.voices[d]={},p=!0,o.score_is_present&&t(`Can't have an unknown V: id when the %score directive is present`,n,l)),l+=d.length,l+=e.eatWhiteSpace(n,l);for(var m={startStaff:p},addNextTokenToStaffInfo=function(r){var a=e.getVoiceToken(n,l,u);a.warn===void 0?a.err===void 0?a.token.length===0&&n[l]!==`"`?t(`Expected value for `+r+` in voice`,n,l):m[r]=a.token:t(`Expected value for `+r+` in voice: `+a.err,n,l):t(`Expected value for `+r+` in voice: `+a.warn,n,l),l+=a.len},addNextTokenToVoiceInfo=function(r,a,c){var d=e.getVoiceToken(n,l,u);d.warn===void 0?d.err===void 0?d.token.length===0&&n[l]!==`"`?t(`Expected value for `+a+` in voice`,n,l):(c===`number`&&(d.token=parseFloat(d.token)),o.voices[r][a]=d.token):t(`Expected value for `+a+` in voice: `+d.err,n,l):t(`Expected value for `+a+` in voice: `+d.warn,n,l),l+=d.len},getNextToken=function(r,a){var o=e.getVoiceToken(n,l,u);if(o.warn!==void 0)t(`Expected value for `+r+` in voice: `+o.warn,n,l);else if(o.err!==void 0)t(`Expected value for `+r+` in voice: `+o.err,n,l);else if(o.token.length===0&&n[l]!==`"`)t(`Expected value for `+r+` in voice`,n,l);else return a===`number`&&(o.token=parseFloat(o.token)),o.token;l+=o.len},addNextNoteTokenToVoiceInfo=function(r,a){var c={_B:2,_E:9,_b:-10,_e:-3},d=e.getVoiceToken(n,l,u);if(d.warn!==void 0)t(`Expected one of (_B, _E, _b, _e) for `+a+` in voice: `+d.warn,n,l);else if(d.token.length===0&&n[l]!==`"`)t(`Expected one of (_B, _E, _b, _e) for `+a+` in voice`,n,l);else{var p=c[d.token];p?o.voices[r][a]=p:t(`Expected one of (_B, _E, _b, _e) for `+a+` in voice`,n,l)}l+=d.len};l<u;){var h=e.getVoiceToken(n,l,u);if(l+=h.len,h.warn)t(`Error parsing voice: `+h.warn,n,l);else{var g=null;switch(h.token){case`clef`:case`cl`:addNextTokenToStaffInfo(`clef`);var _=0;m.clef!==void 0&&(m.clef=m.clef.replace(/[',]/g,``),m.clef.indexOf(`+16`)!==-1&&(_+=14,m.clef=m.clef.replace(`+16`,``)),m.verticalPos=calcMiddle(m.clef,_));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,,`:m.clef=h.token.replace(/[',]/g,``),m.verticalPos=calcMiddle(m.clef,0),o.voices[d].clef=h.token;break;case`staves`:case`stave`:case`stv`:addNextTokenToStaffInfo(`staves`);break;case`brace`:case`brc`:addNextTokenToStaffInfo(`brace`);break;case`bracket`:case`brk`:addNextTokenToStaffInfo(`bracket`);break;case`name`:case`nm`:addNextTokenToStaffInfo(`name`);break;case`subname`:case`sname`:case`snm`:addNextTokenToStaffInfo(`subname`);break;case`merge`:m.startStaff=!1;break;case`stem`:case`stems`:g=e.getVoiceToken(n,l,u),g.warn===void 0?g.err===void 0?g.token===`up`||g.token===`down`?o.voices[d].stem=g.token:t(`Expected up or down for voice stem`,n,l):t(`Expected value for stems in voice: `+g.err,n,l):t(`Expected value for stems in voice: `+g.warn,n,l),l+=g.len;break;case`up`:case`down`:o.voices[d].stem=h.token;break;case`middle`:case`m`:addNextTokenToStaffInfo(`verticalPos`),m.verticalPos=parseMiddle(m.verticalPos).mid;break;case`gchords`:case`gch`:o.voices[d].suppressChords=!0,g=e.getVoiceToken(n,l,u),g.token===`0`&&(l+=g.len);break;case`space`:case`spc`:addNextTokenToStaffInfo(`spacing`);break;case`scale`:addNextTokenToVoiceInfo(d,`scale`,`number`);break;case`score`:addNextNoteTokenToVoiceInfo(d,`scoreTranspose`);break;case`transpose`:addNextTokenToVoiceInfo(d,`transpose`,`number`);break;case`stafflines`:addNextTokenToVoiceInfo(d,`stafflines`,`number`);break;case`staffscale`:addNextTokenToVoiceInfo(d,`staffscale`,`number`);break;case`octave`:addNextTokenToVoiceInfo(d,`octave`,`number`);break;case`volume`:addNextTokenToVoiceInfo(d,`volume`,`number`);break;case`cue`:getNextToken(`cue`,`string`)===`on`?o.voices[d].scale=.6:o.voices[d].scale=1;break;case`style`:g=e.getVoiceToken(n,l,u),g.warn===void 0?g.err===void 0?g.token===`normal`||g.token===`harmonic`||g.token===`rhythm`||g.token===`x`||g.token===`triangle`?o.voices[d].style=g.token:t(`Expected one of [normal, harmonic, rhythm, x, triangle] for voice style`,n,l):t(`Expected value for style in voice: `+g.err,n,l):t(`Expected value for style in voice: `+g.warn,n,l),l+=g.len;break}}l+=e.eatWhiteSpace(n,l)}if((m.startStaff||o.staves.length===0)&&(o.staves.push({index:o.staves.length,meter:o.origMeter}),o.score_is_present||(o.staves[o.staves.length-1].numVoices=0)),o.voices[d].staffNum===void 0){o.voices[d].staffNum=o.staves.length-1;var y=0;for(var b in o.voices)o.voices.hasOwnProperty(b)&&o.voices[b].staffNum===o.voices[d].staffNum&&y++;o.voices[d].index=y-1}var x=o.staves[o.voices[d].staffNum];return o.score_is_present||x.numVoices++,m.clef&&(x.clef={type:m.clef,verticalPos:m.verticalPos}),m.spacing&&(x.spacing_below_offset=m.spacing),m.verticalPos&&(x.verticalPos=m.verticalPos),m.name&&(x.name?x.name.push(m.name):x.name=[m.name]),m.subname&&(x.subname?x.subname.push(m.subname):x.subname=[m.subname]),setCurrentVoice(d)}})(),t.exports=a})),ia=__commonJSMin(((e,t)=>{var n=Xi(),r=Zi(),a=ra(),ParseHeader=function(e,t,o,c,l){this.reset=function(e,t,n,o){a.initialize(e,t,n,o,l),r.initialize(e,t,n,o,l)},this.reset(e,t,o,c),this.setTitle=function(e,t){o.hasMainTitle?l.addSubtitle(e,{startChar:o.iChar,endChar:o.iChar+t+2}):(l.addMetaText(`title`,e,{startChar:o.iChar,endChar:o.iChar+t+2}),o.hasMainTitle=!0)},this.setMeter=function(n){if(n=e.stripComment(n),n===`C`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),{type:`common_time`};if(n===`C|`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),{type:`cut_time`};if(n===`o`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),{type:`tempus_perfectum`};if(n===`c`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),{type:`tempus_imperfectum`};if(n===`o.`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),{type:`tempus_perfectum_prolatio`};if(n===`c.`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),{type:`tempus_imperfectum_prolatio`};if(n.length===0||n.toLowerCase()===`none`)return o.havent_set_length===!0&&(o.default_length=.125,o.havent_set_length=!1),null;var r=e.tokenize(n,0,n.length);try{var parseNum=function(){var e={value:0,num:``},t=r.shift();for(t.token===`(`&&(t=r.shift());;){if(t.type!==`number`)throw`Expected top number of meter`;if(e.value+=parseInt(t.token),e.num+=t.token,r.length===0||r[0].token===`/`)return e;if(t=r.shift(),t.token===`)`){if(r.length===0||r[0].token===`/`)return e;throw`Unexpected paren in meter`}if(t.token!==`.`&&t.token!==`+`||(e.num+=t.token,r.length===0))throw`Expected top number of meter`;t=r.shift()}return e},parseFraction=function(){var e=parseNum();if(r.length===0)return e;var t=r.shift();if(t.token!==`/`)throw`Expected slash in meter`;if(t=r.shift(),t.type!==`number`)throw`Expected bottom number of meter`;return e.den=t.token,e.value/=parseInt(e.den),e};if(r.length===0)throw`Expected meter definition in M: line`;for(var a={type:`specified`,value:[]},c=0;;){var l=parseFraction();c+=l.value;var u={num:l.num};if(l.den!==void 0&&(u.den=l.den),a.value.push(u),r.length===0)break}return o.havent_set_length===!0&&(o.default_length=c<.75?.0625:.125,o.havent_set_length=!1),a}catch(e){t(e,n,0)}return null},this.calcTempo=function(e){var t=1/4;o.meter&&o.meter.type===`specified`?t=1/parseInt(o.meter.value[0].den):o.origMeter&&o.origMeter.type===`specified`&&(t=1/parseInt(o.origMeter.value[0].den));for(var n=0;n<e.duration;n++)e.duration[n]=t*e.duration[n];return e},this.resolveTempo=function(){o.tempo&&(this.calcTempo(o.tempo),c.metaText.tempo=o.tempo,delete o.tempo)},this.addUserDefinition=function(e,r,a){var c=e.indexOf(`=`,r);if(c===-1){t(`Need an = in a macro definition`,e,r);return}var l=n.strip(e.substring(r,c)),u=n.strip(e.substring(c+1));if(l.length!==1){t(`Macro definitions can only be one character`,e,r);return}if(`HIJKLMNOPQRSTUVWXYhijklmnopqrstuvw~`.indexOf(l)===-1){t(`Macro definitions must be H-Y, h-w, or tilde`,e,r);return}if(u.length===0){t(`Missing macro definition`,e,r);return}o.macros===void 0&&(o.macros={}),o.macros[l]=u},this.setDefaultLength=function(e,t,n){var r=e.substring(t,n).replace(/ /g,``).split(`/`);if(r.length===2){var a=parseInt(r[0]),c=parseInt(r[1]);c>0&&(o.default_length=a/c,o.havent_set_length=!1)}else r.length===1&&r[0]===`1`&&(o.default_length=1,o.havent_set_length=!1)};var u={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(n,r,a,c){try{var l=e.tokenize(n,r,a);if(l.length===0)throw`Missing parameter in Q: field`;var d={startChar:c+r-2,endChar:c+a},p=!0,m=l.shift();if(m.type===`quote`&&(d.preString=m.token,m=l.shift(),l.length===0))return u[d.preString.toLowerCase()]&&(d.bpm=u[d.preString.toLowerCase()],d.suppressBpm=!0),{type:`immediate`,tempo:d};if(m.type===`alpha`&&m.token===`C`){if(l.length===0)throw`Missing tempo after C in Q: field`;if(m=l.shift(),m.type===`punct`&&m.token===`=`){if(l.length===0)throw`Missing tempo after = in Q: field`;if(m=l.shift(),m.type!==`number`)throw`Expected number after = in Q: field`;d.duration=[1],d.bpm=parseInt(m.token)}else if(m.type===`number`){if(d.duration=[parseInt(m.token)],l.length===0)throw`Missing = after duration in Q: field`;if(m=l.shift(),m.type!==`punct`||m.token!==`=`)throw`Expected = after duration in Q: field`;if(l.length===0)throw`Missing tempo after = in Q: field`;if(m=l.shift(),m.type!==`number`)throw`Expected number after = in Q: field`;d.bpm=parseInt(m.token)}else throw`Expected number or equal after C in Q: field`}else if(m.type===`number`){var h=parseInt(m.token);if(l.length===0||l[0].type===`quote`)d.duration=[1],d.bpm=h;else{if(p=!1,m=l.shift(),m.type!==`punct`&&m.token!==`/`||(m=l.shift(),m.type!==`number`))throw`Expected fraction in Q: field`;var g=parseInt(m.token);for(d.duration=[h/g];l.length>0&&l[0].token!==`=`&&l[0].type!==`quote`;){if(m=l.shift(),m.type!==`number`||(h=parseInt(m.token),m=l.shift(),m.type!==`punct`&&m.token!==`/`)||(m=l.shift(),m.type!==`number`))throw`Expected fraction in Q: field`;g=parseInt(m.token),d.duration.push(h/g)}if(m=l.shift(),m.type!==`punct`&&m.token!==`=`)throw`Expected = in Q: field`;if(m=l.shift(),m.type!==`number`)throw`Expected tempo in Q: field`;d.bpm=parseInt(m.token)}}else throw`Unknown value in Q: field`;if(l.length!==0&&(m=l.shift(),m.type===`quote`&&(d.postString=m.token,m=l.shift()),l.length!==0))throw`Unexpected string at end of Q: field`;return o.printTempo===!1&&(d.suppress=!0),{type:p?`delaySet`:`immediate`,tempo:d}}catch(e){return t(e,n,r),{type:`none`}}},this.letter_to_inline_header=function(n,u,d){var p=!1,m=e.eatWhiteSpace(n,u);if(u+=m,n.length>=u+5&&n[u]===`[`&&n[u+2]===`:`){var h=n.indexOf(`]`,u),g=o.iChar+u,_=o.iChar+h+1;switch(n.substring(u,u+3)){case`[I:`:var y=r.addDirective(n.substring(u+3,h));return y&&t(y,n,u),[h-u+1+m];case`[M:`:var b=this.setMeter(n.substring(u+3,h));return l.hasBeginMusic()&&b?l.appendStartingElement(`meter`,g,_,b):o.meter=b,[h-u+1+m];case`[K:`:var x=a.parseKey(n.substring(u+3,h),!0);return x.foundClef&&l.hasBeginMusic()&&l.appendStartingElement(`clef`,g,_,o.clef),x.foundKey&&l.hasBeginMusic()&&l.appendStartingElement(`key`,g,_,a.fixKey(o.clef,o.key)),[h-u+1+m];case`[P:`:var S=r.parseFontChangeLine(n.substring(u+3,h));return d||c.lines.length<=c.lineNum?o.partForNextLine={title:S,startChar:g,endChar:_}:l.appendElement(`part`,g,_,{title:S}),[h-u+1+m];case`[L:`:return this.setDefaultLength(n,u+3,h),[h-u+1+m];case`[Q:`:if(h>0){var C=this.setTempo(n,u+3,h,o.iChar);return C.type===`delaySet`?l.hasBeginMusic()?l.appendElement(`tempo`,g,_,this.calcTempo(C.tempo)):o.tempoForNextLine=[`tempo`,g,_,this.calcTempo(C.tempo)]:C.type===`immediate`&&(!d&&l.hasBeginMusic()?l.appendElement(`tempo`,g,_,C.tempo):o.tempoForNextLine=[`tempo`,g,_,C.tempo]),[h-u+1+m,n[u+1],n.substring(u+3,h)]}break;case`[V:`:if(h>0)return p=a.parseVoice(n,u+3,h),[h-u+1+m,n[u+1],n.substring(u+3,h),p];break;case`[r:`:return[h-u+1+m];default:}}return[0]},this.letter_to_body_header=function(e,c){var u=!1;if(e.length>=c+3)switch(e.substring(c,c+2)){case`I:`:var d=r.addDirective(e.substring(c+2));return d&&t(d,e,c),[e.length];case`M:`:var p=this.setMeter(e.substring(c+2));return l.hasBeginMusic()&&p&&l.appendStartingElement(`meter`,o.iChar+c,o.iChar+e.length,p),[e.length];case`K:`:var m=a.parseKey(e.substring(c+2),l.hasBeginMusic());return m.foundClef&&l.hasBeginMusic()&&l.appendStartingElement(`clef`,o.iChar+c,o.iChar+e.length,o.clef),m.foundKey&&l.hasBeginMusic()&&l.appendStartingElement(`key`,o.iChar+c,o.iChar+e.length,a.fixKey(o.clef,o.key)),[e.length];case`P:`:return l.hasBeginMusic()&&l.appendElement(`part`,o.iChar+c,o.iChar+e.length,{title:e.substring(c+2)}),[e.length];case`L:`:return this.setDefaultLength(e,c+2,e.length),[e.length];case`Q:`:var h=e.indexOf(``,c+2);h===-1&&(h=e.length);var g=this.setTempo(e,c+2,h,o.iChar);return g.type===`delaySet`?l.appendElement(`tempo`,o.iChar+c,o.iChar+e.length,this.calcTempo(g.tempo)):g.type===`immediate`&&l.appendElement(`tempo`,o.iChar+c,o.iChar+e.length,g.tempo),[h,e[c],n.strip(e.substring(c+2))];case`V:`:return u=a.parseVoice(e,c+2,e.length),[e.length,e[c],n.strip(e.substring(c+2)),u];default:}return[0]};var d={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(n){var u=d[n[0]],p=n.length-2,m=e.translateString(e.stripComment(n.substring(2)));if(u===`unalignedWords`||u===`notes`)l.addMetaTextArray(u,r.parseFontChangeLine(m),{startChar:o.iChar,endChar:o.iChar+n.length});else if(u!==void 0)l.addMetaText(u,r.parseFontChangeLine(m),{startChar:o.iChar,endChar:o.iChar+n.length});else{var h=o.iChar,g=h+n.length;switch(n[0]){case`H`:for(l.addMetaTextArray(`history`,r.parseFontChangeLine(m),{startChar:o.iChar,endChar:o.iChar+n.length}),n=e.peekLine();n&&n[1]!==`:`;)e.nextLine(),l.addMetaTextArray(`history`,r.parseFontChangeLine(e.translateString(e.stripComment(n))),{startChar:o.iChar,endChar:o.iChar+n.length}),n=e.peekLine();break;case`K`:this.resolveTempo();var _=a.parseKey(n.substring(2),!1);!o.is_in_header&&l.hasBeginMusic()&&(_.foundClef&&l.appendStartingElement(`clef`,h,g,o.clef),_.foundKey&&l.appendStartingElement(`key`,h,g,a.fixKey(o.clef,o.key))),o.is_in_header=!1;break;case`L`:this.setDefaultLength(n,2,n.length);break;case`M`:o.origMeter=o.meter=this.setMeter(n.substring(2));break;case`P`:o.is_in_header?l.addMetaText(`partOrder`,r.parseFontChangeLine(m),{startChar:o.iChar,endChar:o.iChar+n.length}):o.partForNextLine={title:m,startChar:h,endChar:g};break;case`Q`:var y=this.setTempo(n,2,n.length,o.iChar);y.type===`delaySet`?o.tempo=y.tempo:y.type===`immediate`&&(c.metaText.tempo?o.tempoForNextLine=[`tempo`,h,g,y.tempo]:c.metaText.tempo=y.tempo);break;case`T`:o.titlecaps&&(m=m.toUpperCase()),this.setTitle(r.parseFontChangeLine(e.theReverser(m)),p);break;case`U`:this.addUserDefinition(n,2,n.length);break;case`V`:if(a.parseVoice(n,2,n.length),!o.is_in_header)return{newline:!0};break;case`s`:return{symbols:!0};case`w`:return{words:!0};case`X`:break;case`E`:case`m`:t(`Ignored header`,n,0);break;default:return{regular:!0}}}return{}}};t.exports=ParseHeader})),aa=__commonJSMin(((e,t)=>{t.exports.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`.split(`,`),t.exports.volumeDecorations=[`p`,`pp`,`f`,`ff`,`mf`,`mp`,`ppp`,`pppp`,`fff`,`ffff`,`sfz`],t.exports.dynamicDecorations=[`crescendo(`,`crescendo)`,`diminuendo(`,`diminuendo)`,`glissando(`,`glissando)`,`~(`,`~)`],t.exports.accentPseudonyms=[[`<`,`accent`],[`>`,`accent`],[`tr`,`trill`],[`plus`,`+`],[`emphasis`,`accent`],[`^`,`umarcato`],[`marcato`,`umarcato`]],t.exports.accentDynamicPseudonyms=[[`<(`,`crescendo(`],[`<)`,`crescendo)`],[`>(`,`diminuendo(`],[`>)`,`diminuendo)`]],t.exports.nonDecorations=`ABCDEFGabcdefgxyzZ[]|^_{`,t.exports.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],t.exports.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},t.exports.rests={x:`invisible`,X:`invisible-multimeasure`,y:`spacer`,z:`rest`,Z:`multimeasure`},t.exports.accMap={dblflat:`__`,flat:`_`,natural:`=`,sharp:`^`,dblsharp:`^^`,quarterflat:`_/`,quartersharp:`^/`},t.exports.tripletQ={2:3,3:2,4:3,5:2,6:2,7:2,8:3,9:2}})),oa=__commonJSMin(((e,t)=>{var n=ra(),r=na(),a,o,c,l,u,d,{legalAccents:p,volumeDecorations:m,dynamicDecorations:h,accentPseudonyms:g,accentDynamicPseudonyms:_,nonDecorations:y,durations:b,pitches:x,rests:S,accMap:C,tripletQ:w}=aa(),MusicParser=function(e,t,n,r,p,m){a=e,o=t,c=n,l=r,u=p,d=m,this.lineContinuation=!1},isInTie=function(e,t,n){if(e.inTie[t]===void 0)return!1;var r=e.currentVoice?e.currentVoice.staffNum*100+e.currentVoice.index:0;return!!(e.inTie[t][r]&&(n.pitches!==void 0||n.rest.type!==`spacer`))},T={};MusicParser.prototype.parseMusic=function(e){d.resolveTempo(),c.is_in_header=!1;for(var t=0,n=c.iChar;a.isWhiteSpace(e[t])&&t<e.length;)t++;if(!(t===e.length||e[t]===`%`)){var r=c.start_new_line;c.continueall===void 0?c.start_new_line=!0:c.start_new_line=!1;var p=0,m=d.letter_to_body_header(e,t);m[0]>0&&(t+=m[0],m[1]===`V`&&this.startNewLine());for(var h=0;t<e.length;){var g=t;if(e[t]===`%`)break;var _=d.letter_to_inline_header(e,t,r);if(_[0]>0)t+=_[0],_[1]===`V`&&(r=!0);else{(!u.hasBeginMusic()||r&&!this.lineContinuation)&&(this.startNewLine(),r=!1);for(var x;;)if(x=a.eatWhiteSpace(e,t),x>0&&(t+=x),t>0&&e[t-1]===``&&(x=d.letter_to_body_header(e,t),x[0]>0&&(x[1]===`V`&&this.startNewLine(),t=x[0],c.start_new_line=!1)),x=letter_to_spacer(e,t),x[0]>0&&(t+=x[0]),x=letter_to_chord(e,t),x[0]>0){var S;(S=T).chord||(S.chord=[]);var C=a.translateString(x[1]);C=C.replace(/;/g,`
42
+ `);for(var w=!1,E=0;E<T.chord.length;E++)T.chord[E].position===x[2]&&(w=!0,T.chord[E].name+=`
43
+ `+C);w===!1&&(x[2]===null&&x[3]?T.chord.push({name:C,rel_position:x[3]}):T.chord.push({name:C,position:x[2]})),t+=x[0];var D=a.skipWhiteSpace(e.substring(t));D>0&&(T.force_end_beam_last=!0),t+=D}else if(x=y.indexOf(e[t])===-1?letter_to_accent(e,t):[0],x[0]>0)x[1]===null?t+1<e.length&&this.startNewLine():x[1].length>0&&(x[1].indexOf(`style=`)===0?T.style=x[1].substr(6):(T.decoration===void 0&&(T.decoration=[]),x[1]===`beambr1`?T.beambr=1:x[1]===`beambr2`?T.beambr=2:T.decoration.push(x[1]))),t+=x[0];else if(x=letter_to_grace(e,t),x[0]>0)T.gracenotes=x[1],t+=x[0];else break;if(x=letter_to_bar(e,t),x[0]>0){h=0,T.gracenotes!==void 0&&(T.rest={type:`spacer`},T.duration=.125,c.addFormattingOptions(T,l.formatting,`note`),u.appendElement(`note`,n+t,n+t+x[0],T),c.measureNotEmpty=!0,T={});var O={type:x[1]};O.type.length===0?o(`Unknown bar type`,e,t):(c.inEnding&&O.type!==`bar_thin`&&(O.endEnding=!0,c.inEnding=!1),x[2]&&(O.startEnding=x[2],c.inEnding&&(O.endEnding=!0),c.inEnding=!0,x[1]===`bar_right_repeat`?c.restoreStartEndingHoldOvers():c.duplicateStartEndingHoldOvers()),T.decoration!==void 0&&(O.decoration=T.decoration),T.chord!==void 0&&(O.chord=T.chord),O.startEnding&&c.barFirstEndingNum===void 0?c.barFirstEndingNum=c.currBarNumber:O.startEnding&&O.endEnding&&c.barFirstEndingNum?c.currBarNumber=c.barFirstEndingNum:O.endEnding&&(c.barFirstEndingNum=void 0),O.type!==`bar_invisible`&&c.measureNotEmpty&&isFirstVoice()&&(c.currBarNumber++,c.barNumbers&&c.currBarNumber%c.barNumbers===0&&(O.barNumber=c.currBarNumber)),c.addFormattingOptions(T,l.formatting,`bar`),u.appendElement(`bar`,n+g,n+t+x[0],O),c.measureNotEmpty=!1,T={}),t+=x[0]}else if(e[t]===`&`)x=letter_to_overlay(e,t),x[0]>0&&(u.appendElement(`overlay`,n,n+1,{}),t+=1,h++);else{if(x=letter_to_open_slurs_and_triplets(e,t),x.consumed>0&&(x.startSlur!==void 0&&(T.startSlur=x.startSlur),x.dottedSlur&&(T.dottedSlur=!0),x.triplet!==void 0&&(p>0?o(`Can't nest triplets`,e,t):(T.startTriplet=x.triplet,T.tripletMultiplier=x.tripletQ/x.triplet,T.tripletR=x.num_notes,p=x.num_notes===void 0?x.triplet:x.num_notes)),t+=x.consumed),e[t]===`[`){t++;for(var k=null,A=!1,j=!1;!j;){var M=letter_to_accent(e,t);M[0]>0&&(t+=M[0]);var N=getCoreNote(e,t,{},!1);if(N!==null&&N.pitch!==void 0)M[0]>0&&M[1].indexOf(`style=`)!==0&&(T.decoration===void 0&&(T.decoration=[]),T.decoration.push(M[1])),N.end_beam&&(T.end_beam=!0,delete N.end_beam),T.pitches===void 0?(T.duration=N.duration,T.pitches=[N]):T.pitches.push(N),delete N.duration,M[0]>0&&M[1].indexOf(`style=`)===0&&(T.pitches[T.pitches.length-1].style=M[1].substr(6)),c.inTieChord[T.pitches.length]&&(N.endTie=!0,c.inTieChord[T.pitches.length]=void 0),N.startTie&&(c.inTieChord[T.pitches.length]=!0),t=N.endChar,delete N.endChar;else if(e[t]===` `)o(`Spaces are not allowed in chords`,e,t),t++;else{if(t<e.length&&e[t]===`]`){t++,c.next_note_duration!==0&&(T.duration*=c.next_note_duration,c.next_note_duration=0),isInTie(c,h,T)&&(T.pitches.forEach(function(e){e.endTie=!0}),setIsInTie(c,h,!1)),p>0&&!(T.rest&&T.rest.type===`spacer`)&&(p--,p===0&&(T.endTriplet=!0));for(var P=!1;t<e.length&&!P;){switch(e[t]){case` `:case` `:addEndBeam(T);break;case`)`:T.endSlur===void 0?T.endSlur=1:T.endSlur++;break;case`-`:T.pitches.forEach(function(e){e.startTie={}}),setIsInTie(c,h,!0);break;case`>`:case`<`:var F=getBrokenRhythm(e,t);t+=F[0]-1,c.next_note_duration=F[2],k?k*=F[1]:k=F[1];break;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:case`/`:var I=a.getFraction(e,t);k=I.value,t=I.index;var L=e[t];L===` `&&(A=!0),L===`-`||L===`)`||L===` `||L===`<`||L===`>`?t--:P=!0;break;case`0`:k=0;break;default:P=!0;break}P||t++}}else o(`Expected ']' to end the chords`,e,t);T.pitches!==void 0&&(k!==null&&(T.duration*=k,A&&addEndBeam(T)),c.addFormattingOptions(T,l.formatting,`note`),u.appendElement(`note`,n+g,n+t,T),c.measureNotEmpty=!0,T={}),j=!0}}}else{var ee={},R=getCoreNote(e,t,ee,!0);ee.endTie!==void 0&&setIsInTie(c,h,!0),R!==null&&(R.pitch===void 0?(T.rest=R.rest,R.rest.type===`multimeasure`&&isFirstVoice()&&(c.currBarNumber+=R.rest.text-1),R.endSlur!==void 0&&(T.endSlur=R.endSlur),R.endTie!==void 0&&(T.rest.endTie=R.endTie),R.startSlur!==void 0&&(T.startSlur=R.startSlur),R.startTie!==void 0&&(T.rest.startTie=R.startTie),T.startTie!==void 0&&(T.rest.startTie=T.startTie)):(T.pitches=[{}],R.accidental!==void 0&&(T.pitches[0].accidental=R.accidental),T.pitches[0].pitch=R.pitch,T.pitches[0].name=R.name,(R.midipitch||R.midipitch===0)&&(T.pitches[0].midipitch=R.midipitch),R.endSlur!==void 0&&(T.pitches[0].endSlur=R.endSlur),R.endTie!==void 0&&(T.pitches[0].endTie=R.endTie),R.startSlur!==void 0&&(T.pitches[0].startSlur=R.startSlur),T.startSlur!==void 0&&(T.pitches[0].startSlur=T.startSlur),T.dottedSlur!==void 0&&(T.pitches[0].dottedSlur=!0),R.startTie!==void 0&&(T.pitches[0].startTie=R.startTie),T.startTie!==void 0&&(T.pitches[0].startTie=T.startTie)),R.chord!==void 0&&(T.chord=R.chord),R.duration!==void 0&&(T.duration=R.duration),R.decoration!==void 0&&(T.decoration=R.decoration),R.graceNotes!==void 0&&(T.graceNotes=R.graceNotes),delete T.startSlur,delete T.dottedSlur,isInTie(c,h,T)&&(T.pitches===void 0?T.rest.type!==`spacer`&&(T.rest.endTie=!0):T.pitches[0].endTie=!0,setIsInTie(c,h,!1)),(R.startTie||T.startTie)&&setIsInTie(c,h,!0),t=R.endChar,p>0&&!(R.rest&&R.rest.type===`spacer`)&&(p--,p===0&&(T.endTriplet=!0)),R.end_beam&&addEndBeam(T),T.rest&&T.rest.type===`rest`&&T.duration===1&&durationOfMeasure(c)<=1&&(T.rest.type=`whole`,T.duration=durationOfMeasure(c)),T.duration<1&&b.indexOf(T.duration)===-1&&T.duration!==0&&(!T.rest||T.rest.type!==`spacer`)&&o(`Duration not representable: `+e.substring(g,t),e,t),c.addFormattingOptions(T,l.formatting,`note`),u.appendElement(`note`,n+g,n+t,T)||(this.startNewLine(),u.appendElement(`note`,n+g,n+t,T)),c.measureNotEmpty=!0,T={})}t===g&&(e[t]!==` `&&e[t]!=="`"&&o(`Unknown character ignored`,e,t),t++)}}}this.lineContinuation=e.indexOf(``)>=0||m[0]>0,this.lineContinuation||(T={})}};var setIsInTie=function(e,t,n){var r=e.currentVoice?e.currentVoice.staffNum*100+e.currentVoice.index:0;e.inTie[t]===void 0&&(e.inTie[t]=[]),e.inTie[t][r]=n},letter_to_chord=function(e,t){if(e[t]===`"`){var n=a.getBrackettedSubstring(e,t,5);if(n[2]||o(`Missing the closing quote while parsing the chord symbol`,e,t),n[0]>0&&n[1].length>0&&n[1][0]===`^`)n[1]=n[1].substring(1),n[2]=`above`;else if(n[0]>0&&n[1].length>0&&n[1][0]===`_`)n[1]=n[1].substring(1),n[2]=`below`;else if(n[0]>0&&n[1].length>0&&n[1][0]===`<`)n[1]=n[1].substring(1),n[2]=`left`;else if(n[0]>0&&n[1].length>0&&n[1][0]===`>`)n[1]=n[1].substring(1),n[2]=`right`;else if(n[0]>0&&n[1].length>0&&n[1][0]===`@`){n[1]=n[1].substring(1);var l=a.getFloat(n[1]);if(l.digits===0)return o(`Missing first position in absolutely positioned annotation.`,e,t),n[1]=n[1].replace(`@`,``),n[2]=`above`,n;if(n[1]=n[1].substring(l.digits),n[1][0]!==`,`)return o(`Missing comma absolutely positioned annotation.`,e,t),n[1]=n[1].replace(`@`,``),n[2]=`above`,n;n[1]=n[1].substring(1);var u=a.getFloat(n[1]);if(u.digits===0)return o(`Missing second position in absolutely positioned annotation.`,e,t),n[1]=n[1].replace(`@`,``),n[2]=`above`,n;n[1]=n[1].substring(u.digits);var d=a.skipWhiteSpace(n[1]);n[1]=n[1].substring(d),n[2]=null,n[3]={x:l.value,y:u.value}}else c.freegchord!==!0&&(n[1]=n[1].replace(/([ABCDEFG0-9])b/g,`$1♭`),n[1]=n[1].replace(/([ABCDEFG0-9])#/g,`$1♯`),n[1]=n[1].replace(/^([ABCDEFG])([♯♭]?)o([^A-Za-z])/g,`$1$2°$3`),n[1]=n[1].replace(/^([ABCDEFG])([♯♭]?)o$/g,`$1$2°`),n[1]=n[1].replace(/^([ABCDEFG])([♯♭]?)0([^A-Za-z])/g,`$1$2ø$3`),n[1]=n[1].replace(/^([ABCDEFG])([♯♭]?)\^([^A-Za-z])/g,`$1$2∆$3`)),n[2]=`default`,n[1]=r.chordName(c,n[1]);return n}return[0,``]},letter_to_grace=function(e,t){if(e[t]===`{`){var n=a.getBrackettedSubstring(e,t,1,`}`);n[2]||o(`Missing the closing '}' while parsing grace note`,e,t),e[t+n[0]]===`)`&&(n[0]++,n[1]+=`)`);for(var r=[],l=0,u=!1;l<n[1].length;){var d=!1;n[1][l]===`/`&&(d=!0,l++);var p=getCoreNote(n[1],l,{},!1);p===null?(n[1][l]===` `?r.length>0&&(r[r.length-1].endBeam=!0):o(`Unknown character '`+n[1][l]+`' while parsing grace note`,e,t),l++):(p.duration/=c.default_length*8,d&&(p.acciaccatura=!0),p.rest?o(`Rests not allowed as grace notes '`+n[1][l]+`' while parsing grace note`,e,t):r.push(p),u&&(u=(p.endTie=!0,!1)),p.startTie&&(u=!0),l=p.endChar,delete p.endChar,p.end_beam&&(p.endBeam=!0,delete p.end_beam))}if(r.length)return[n[0],r]}return[0]};function letter_to_overlay(e,t){if(e[t]===`&`){for(var n=t;e[t]&&e[t]!==`:`&&e[t]!==`|`;)t++;return[t-n,e.substring(n+1,t)]}return[0]}function durationOfMeasure(e){var t=e.origMeter;return!t||t.type!==`specified`||!t.value||t.value.length===0?1:parseInt(t.value[0].num,10)/parseInt(t.value[0].den,10)}var letter_to_accent=function(e,t){var n=c.macros[e[t]];if(n!==void 0)return(n[0]===`!`||n[0]===`+`)&&(n=n.substring(1)),(n[n.length-1]===`!`||n[n.length-1]===`+`)&&(n=n.substring(0,n.length-1)),p.includes(n)?[1,n]:m.includes(n)?(c.volumePosition===`hidden`&&(n=``),[1,n]):h.includes(n)?(c.dynamicPosition===`hidden`&&(n=``),[1,n]):(c.ignoredDecorations.includes(n)||o(`Unknown macro: `+n,e,t),[1,``]);switch(e[t]){case`.`:if(e[t+1]===`(`||e[t+1]===`-`)break;return[1,`staccato`];case`u`:return[1,`upbow`];case`v`:return[1,`downbow`];case`~`:return[1,`irishroll`];case`!`:case`+`:var r=a.getBrackettedSubstring(e,t,5);if(r[1].length>1&&(r[1][0]===`^`||r[1][0]===`_`)&&(r[1]=r[1].substring(1)),p.includes(r[1]))return r;if(m.includes(r[1]))return c.volumePosition===`hidden`&&(r[1]=``),r;if(h.includes(r[1]))return c.dynamicPosition===`hidden`&&(r[1]=``),r;var l=g.findIndex(function(e){return r[1]===e[0]});return l>=0?(r[1]=g[l][1],r):(l=_.findIndex(function(e){return r[1]===e[0]}),l>=0?(r[1]=_[l][1],c.dynamicPosition===`hidden`&&(r[1]=``),r):e[t]===`!`&&(r[0]===1||e[t+r[0]-1]!==`!`)?[1,null]:(o(`Unknown decoration: `+r[1],e,t),r[1]=``,r));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]},letter_to_spacer=function(e,t){for(var n=t;a.isWhiteSpace(e[t]);)t++;return[t-n]},letter_to_bar=function(e,t){var n=a.getBarLine(e,t);if(n.len===0)return[0,``];if(n.warn)return o(n.warn,e,t),[n.len,``];for(var r=0;r<e.length&&e[t+n.len+r]===` `;r++);var c=n.len;if(e[t+n.len+r]===`[`&&(n.len+=r+1),e[t+n.len]===`"`&&e[t+n.len-1]===`[`){var l=a.getBrackettedSubstring(e,t+n.len,5);return[n.len+l[0],n.token,l[1]]}var u=a.getTokenOf(e.substring(t+n.len),`1234567890-,`);return u.len===0||u.token[0]===`-`?[c,n.token]:[n.len+u.len,n.token,u.token]},letter_to_open_slurs_and_triplets=function(e,t){var n={},r=t;for(e[t]===`.`&&e[t+1]===`(`&&(n.dottedSlur=!0,t++);e[t]===`(`||a.isWhiteSpace(e[t]);)e[t]===`(`&&(t+1<e.length&&e[t+1]>=`2`&&e[t+1]<=`9`?(n.triplet===void 0?(n.triplet=e[t+1]-`0`,n.tripletQ=w[n.triplet],n.num_notes=n.triplet,t+2<e.length&&e[t+2]===`:`&&(t+3<e.length&&e[t+3]===`:`?t+4<e.length&&e[t+4]>=`1`&&e[t+4]<=`9`?(n.num_notes=e[t+4]-`0`,t+=3):o(`expected number after the two colons after the triplet to mark the duration`,e,t):t+3<e.length&&e[t+3]>=`1`&&e[t+3]<=`9`?(n.tripletQ=e[t+3]-`0`,t+4<e.length&&e[t+4]===`:`?t+5<e.length&&e[t+5]>=`1`&&e[t+5]<=`9`&&(n.num_notes=e[t+5]-`0`,t+=4):t+=2):o(`expected number after the triplet to mark the duration`,e,t))):o(`Can't nest triplets`,e,t),t++):n.startSlur===void 0?n.startSlur=1:n.startSlur++),t++;return n.consumed=t-r,n};MusicParser.prototype.startNewLine=function(){var e={startChar:-1,endChar:-1};c.partForNextLine.title&&(e.part=c.partForNextLine),e.clef=c.currentVoice&&c.staves[c.currentVoice.staffNum].clef!==void 0?Object.assign({},c.staves[c.currentVoice.staffNum].clef):Object.assign({},c.clef);var t=c.currentVoice?c.currentVoice.scoreTranspose:0;if(e.key=n.standardKey(c.key.root+c.key.acc+c.key.mode,c.key.root,c.key.acc,t),e.key.mode=c.key.mode,c.key.impliedNaturals&&(e.key.impliedNaturals=c.key.impliedNaturals),c.key.explicitAccidentals)for(var r=0;r<c.key.explicitAccidentals.length;r++){for(var a=!1,o=0;o<e.key.accidentals.length;o++)e.key.accidentals[o].note===c.key.explicitAccidentals[r].note&&(e.key.accidentals[o].acc=c.key.explicitAccidentals[r].acc,a=!0);a||e.key.accidentals.push(c.key.explicitAccidentals[r])}if(c.targetKey=e.key,e.key.explicitAccidentals&&delete e.key.explicitAccidentals,n.addPosToKey(e.clef,e.key),c.meter===null?c.currentVoice&&c.staves[c.currentVoice.staffNum].meter&&(e.meter=c.staves[c.currentVoice.staffNum].meter,c.staves[c.currentVoice.staffNum].meter=null):(c.currentVoice?(c.staves.forEach(function(e){e.meter=c.meter}),e.meter=c.staves[c.currentVoice.staffNum].meter,c.staves[c.currentVoice.staffNum].meter=null):e.meter=c.meter,c.meter=null),c.currentVoice&&c.currentVoice.name&&(e.name=c.currentVoice.name),c.vocalfont&&(e.vocalfont=c.vocalfont),c.tripletfont&&(e.tripletfont=c.tripletfont),c.gchordfont&&(e.gchordfont=c.gchordfont),c.style&&(e.style=c.style),c.currentVoice){var l=c.staves[c.currentVoice.staffNum];l.brace&&(e.brace=l.brace),l.bracket&&(e.bracket=l.bracket),l.connectBarLines&&(e.connectBarLines=l.connectBarLines),l.name&&(e.name=l.name[c.currentVoice.index]),l.subname&&(e.subname=l.subname[c.currentVoice.index]),c.currentVoice.stem&&(e.stem=c.currentVoice.stem),c.currentVoice.stafflines&&(e.stafflines=c.currentVoice.stafflines),c.currentVoice.staffscale&&(e.staffscale=c.currentVoice.staffscale),c.currentVoice.scale&&(e.scale=c.currentVoice.scale),c.currentVoice.color&&(e.color=c.currentVoice.color),c.currentVoice.style&&(e.style=c.currentVoice.style),c.currentVoice.transpose&&(e.clef.transpose=c.currentVoice.transpose),e.currentVoice=c.currentVoice;for(var d=Object.keys(c.voices),p=0;p<d.length;p++)e.currentVoice.staffNum===c.voices[d[p]].staffNum&&e.currentVoice.index===c.voices[d[p]].index&&(e.currentVoiceName=d[p])}c.barNumbers===0&&isFirstVoice()&&c.currBarNumber!==1&&(e.barNumber=c.currBarNumber),u.startNewLine(e),c.key.impliedNaturals&&delete c.key.impliedNaturals,c.partForNextLine={},c.tempoForNextLine.length===4&&u.appendElement(c.tempoForNextLine[0],c.tempoForNextLine[1],c.tempoForNextLine[2],c.tempoForNextLine[3]),c.tempoForNextLine=[]};var addEndBeam=function(e){return e.duration!==void 0&&e.duration<.25&&(e.end_beam=!0),e},getCoreNote=function(e,t,n,o){var isComplete=function(e){return e===`octave`||e===`duration`||e===`Zduration`||e===`broken_rhythm`||e===`end_slur`},d;e[t]===`.`&&e[t+1]===`-`&&(d=!0,t++);for(var p=`startSlur`,m=!1;;){switch(e[t]){case`(`:if(p===`startSlur`)n.startSlur===void 0?n.startSlur=1:n.startSlur++;else if(isComplete(p))return n.endChar=t,n;else return null;break;case`)`:if(isComplete(p))n.endSlur===void 0?n.endSlur=1:n.endSlur++;else return null;break;case`^`:if(p===`startSlur`)n.accidental=`sharp`,p=`sharp2`;else if(p===`sharp2`)n.accidental=`dblsharp`,p=`pitch`;else if(isComplete(p))return n.endChar=t,n;else return null;break;case`_`:if(p===`startSlur`)n.accidental=`flat`,p=`flat2`;else if(p===`flat2`)n.accidental=`dblflat`,p=`pitch`;else if(isComplete(p))return n.endChar=t,n;else return null;break;case`=`:if(p===`startSlur`)n.accidental=`natural`,p=`pitch`;else if(isComplete(p))return n.endChar=t,n;else return null;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(p===`startSlur`||p===`sharp2`||p===`flat2`||p===`pitch`){if(n.pitch=x[e[t]],n.pitch+=7*(c.currentVoice&&c.currentVoice.octave!==void 0?c.currentVoice.octave:c.octave),n.name=e[t],n.accidental&&(n.name=C[n.accidental]+n.name),r.note(c,n),p=`octave`,o&&c.next_note_duration!==0?(n.duration=c.default_length*c.next_note_duration,c.next_note_duration=0,m=!0):n.duration=c.default_length,c.clef&&c.clef.type===`perc`||c.currentVoice&&c.currentVoice.clef===`perc`){var h=e[t];n.accidental&&(h=C[n.accidental]+h),l.formatting&&l.formatting.midi&&l.formatting.midi.drummap&&(n.midipitch=l.formatting.midi.drummap[h])}}else if(isComplete(p))return n.endChar=t,n;else return null;break;case`,`:if(p===`octave`)n.pitch-=7,n.name+=`,`;else if(isComplete(p))return n.endChar=t,n;else return null;break;case`'`:if(p===`octave`)n.pitch+=7,n.name+=`'`;else if(isComplete(p))return n.endChar=t,n;else return null;break;case`x`:case`X`:case`y`:case`z`:case`Z`:if(p===`startSlur`)n.rest={type:S[e[t]]},delete n.accidental,delete n.startSlur,delete n.startTie,delete n.endSlur,delete n.endTie,delete n.end_beam,delete n.grace_notes,n.rest.type.indexOf(`multimeasure`)>=0?(n.duration=l.getBarLength(),n.rest.text=1,p=`Zduration`):(o&&c.next_note_duration!==0?(n.duration=c.default_length*c.next_note_duration,c.next_note_duration=0,m=!0):n.duration=c.default_length,p=`duration`);else if(isComplete(p))return n.endChar=t,n;else return null;break;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:case`0`:case`/`:if(p===`octave`||p===`duration`){var g=a.getFraction(e,t);for(n.duration*=g.value,n.endChar=g.index;g.index<e.length&&(a.isWhiteSpace(e[g.index])||e[g.index]===`-`);)e[g.index]===`-`?n.startTie={}:n=addEndBeam(n),g.index++;t=g.index-1,p=`broken_rhythm`}else if(p===`sharp2`)n.accidental=`quartersharp`,p=`pitch`;else if(p===`flat2`)n.accidental=`quarterflat`,p=`pitch`;else if(p===`Zduration`){var _=a.getNumber(e,t);return n.duration=_.num*l.getBarLength(),n.rest.text=_.num,n.endChar=_.index,n}else return null;break;case`-`:if(p===`startSlur`)u.addTieToLastNote(d),n.endTie=!0;else if(p===`octave`||p===`duration`||p===`end_slur`)if(n.startTie={},!m&&o)p=`broken_rhythm`;else return a.isWhiteSpace(e[t+1])&&addEndBeam(n),n.endChar=t+1,n;else if(p===`broken_rhythm`)return n.endChar=t,n;else return null;break;case` `:case` `:if(isComplete(p)){n.end_beam=!0,d=!1;do e[t]===`.`&&e[t+1]===`-`&&(d=!0,t++),e[t]===`-`&&(n.startTie={},d&&(n.startTie.style=`dotted`)),t++;while(t<e.length&&(a.isWhiteSpace(e[t])||e[t]===`-`)||e[t]===`.`&&e[t+1]===`-`);if(n.endChar=t,!m&&o&&(e[t]===`<`||e[t]===`>`))t--,p=`broken_rhythm`;else return n}else return null;break;case`>`:case`<`:if(isComplete(p))if(o){var y=getBrokenRhythm(e,t);t+=y[0]-1,c.next_note_duration=y[2],n.duration=y[1]*n.duration,p=`end_slur`}else return n.endChar=t,n;else return null;break;default:return isComplete(p)?(n.endChar=t,n):null}if(t++,t===e.length)return isComplete(p)?(n.endChar=t,n):null}return null},getBrokenRhythm=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 isFirstVoice(){return c.currentVoice===void 0||c.currentVoice.staffNum===0&&c.currentVoice.index===0}t.exports=MusicParser})),sa=__commonJSMin(((e,t)=>{var n=Xi(),Tokenizer=function(e,t){this.lineIndex=0,this.lines=e,this.multilineVars=t,this.skipWhiteSpace=function(e){for(var t=0;t<e.length;t++)if(!this.isWhiteSpace(e[t]))return t;return e.length};var finished=function(e,t){return t>=e.length};this.eatWhiteSpace=function(e,t){for(var n=t;n<e.length;n++)if(!this.isWhiteSpace(e[n]))return n-t;return n-t},this.getKeyPitch=function(e){var t=this.skipWhiteSpace(e);if(finished(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(e===`bass`)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 skipAlpha=function(e,t){for(;t<e.length&&(e[t]>=`a`&&e[t]<=`z`||e[t]>=`A`&&e[t]<=`Z`);)t++;return t},t=this.skipWhiteSpace(e);if(finished(e,t))return{len:0};var n=e.substring(t,t+3).toLowerCase();switch((n.length>1&&n[1]===` `||n[1]===`^`||n[1]===`_`||n[1]===`=`)&&(n=n[0]),n){case`mix`:return{len:skipAlpha(e,t),token:`Mix`};case`dor`:return{len:skipAlpha(e,t),token:`Dor`};case`phr`:return{len:skipAlpha(e,t),token:`Phr`};case`lyd`:return{len:skipAlpha(e,t),token:`Lyd`};case`loc`:return{len:skipAlpha(e,t),token:`Loc`};case`aeo`:return{len:skipAlpha(e,t),token:`m`};case`maj`:return{len:skipAlpha(e,t),token:``};case`ion`:return{len:skipAlpha(e,t),token:``};case`min`:return{len:skipAlpha(e,t),token:`m`};case`m`:return{len:skipAlpha(e,t),token:`m`}}return{len:0}},this.getClef=function(e,t){var r=e,a=this.skipWhiteSpace(e);if(finished(e,a))return{len:0};var o=!1,c=e.substring(a);if(n.startsWith(c,`clef=`)&&(o=!0,c=c.substring(5),a+=5),c.length===0&&o)return{len:a+5,warn:`No clef specified: `+r};var l=this.skipWhiteSpace(c);if(finished(c,l))return{len:0};l>0&&(a+=l,c=c.substring(l));var u=null;if(n.startsWith(c,`treble`))u=`treble`;else if(n.startsWith(c,`bass3`))u=`bass3`;else if(n.startsWith(c,`bass`))u=`bass`;else if(n.startsWith(c,`tenor`))u=`tenor`;else if(n.startsWith(c,`alto2`))u=`alto2`;else if(n.startsWith(c,`alto1`))u=`alto1`;else if(n.startsWith(c,`alto`))u=`alto`;else if(!t&&o&&n.startsWith(c,`none`))u=`none`;else if(n.startsWith(c,`perc`))u=`perc`;else if(!t&&o&&n.startsWith(c,`C`))u=`tenor`;else if(!t&&o&&n.startsWith(c,`F`))u=`bass`;else if(!t&&o&&n.startsWith(c,`G`))u=`treble`;else return{len:a+5,warn:`Unknown clef specified: `+r};return c=c.substring(u.length),l=this.isMatch(c,`+8`),l>0?u+=`+8`:(l=this.isMatch(c,`-8`),l>0&&(u+=`-8`)),{len:a+u.length,token:u,explicit:o}},this.getBarLine=function(e,t){switch(e[t]){case`]`:switch(++t,e[t]){case`|`:return{len:2,token:`bar_thick_thin`};case`[`:return++t,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`}}break;case`:`:switch(++t,e[t]){case`:`:return{len:2,token:`bar_dbl_repeat`};case`|`:switch(++t,e[t]){case`]`:switch(++t,e[t]){case`|`:return++t,e[t]===`:`?{len:5,token:`bar_dbl_repeat`}:{len:3,token:`bar_right_repeat`};default:return{len:3,token:`bar_right_repeat`}}break;case`|`:return++t,e[t]===`:`?{len:4,token:`bar_dbl_repeat`}:{len:3,token:`bar_right_repeat`};default:return{len:2,token:`bar_right_repeat`}}break;default:return{len:1,warn:`Unknown bar symbol`}}break;case`[`:if(++t,e[t]===`|`)switch(++t,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`}}else return e[t]>=`1`&&e[t]<=`9`||e[t]===`"`?{len:1,token:`bar_invisible`}:{len:0};break;case`|`:switch(++t,e[t]){case`]`:return{len:2,token:`bar_thin_thick`};case`|`:return++t,e[t]===`:`?{len:3,token:`bar_left_repeat`}:{len:2,token:`bar_thin_thin`};case`:`:for(var n=0;e[t+n]===`:`;)n++;return{len:1+n,token:`bar_left_repeat`};default:return{len:1,token:`bar_thin`}}break}return{len:0}},this.getTokenOf=function(e,t){for(var n=0;n<e.length;n++)if(t.indexOf(e[n])<0)return{len:n,token:e.substring(0,n)};return{len:n,token:e}},this.getToken=function(e,t,n){for(var r=t;r<n&&!this.isWhiteSpace(e[r]);)r++;return e.substring(t,r)},this.isMatch=function(e,t){var r=this.skipWhiteSpace(e);return finished(e,r)?0:n.startsWith(e.substring(r),t)?r+t.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],t.position===void 0)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 n;if(e[0].token===`^`){if(n=`sharp`,e.shift(),e.length===0)return{accs:t,warn:`Expected note name after `+n};switch(e[0].token){case`^`:n=`dblsharp`,e.shift();break;case`/`:n=`quartersharp`,e.shift();break}}else if(e[0].token===`=`)n=`natural`,e.shift();else if(e[0].token===`_`){if(n=`flat`,e.shift(),e.length===0)return{accs:t,warn:`Expected note name after `+n};switch(e[0].token){case`_`:n=`dblflat`,e.shift();break;case`/`:n=`quarterflat`,e.shift();break}}else return{accs:t};if(e.length===0)return{accs:t,warn:`Expected note name after `+n};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`:t===void 0&&(t=[]),t.push({acc:n,note:e[0].token[0]}),e[0].token.length===1?e.shift():e[0].token=e[0].token.substring(1);break;default:return{accs:t,warn:`Expected note name after `+n+` Found: `+e[0].token}}}return{accs:t}},this.getKeyAccidental=function(e){var t={"^":`sharp`,"^^":`dblsharp`,"=":`natural`,_:`flat`,__:`dblflat`,"_/":`quarterflat`,"^/":`quartersharp`},n=this.skipWhiteSpace(e);if(finished(e,n))return{len:0};var r=null;switch(e[n]){case`^`:case`_`:case`=`:r=e[n];break;default:return{len:0}}if(n++,finished(e,n))return{len:1,warn:`Expected note name after accidental`};switch(e[n]){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:n+1,token:{acc:t[r],note:e[n]}};case`^`:case`_`:case`/`:if(r+=e[n],n++,finished(e,n))return{len:2,warn:`Expected note name after accidental`};switch(e[n]){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:n+1,token:{acc:t[r],note:e[n]}};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===` `||e===` `||e===``},this.getMeat=function(e,t,n){var r=e.indexOf(`%`,t);for(r>=0&&r<n&&(n=r);t<n&&(e[t]===` `||e[t]===` `||e[t]===``);)t++;for(;t<n&&(e[n-1]===` `||e[n-1]===` `||e[n-1]===``);)n--;return{start:t,end:n}};var isLetter=function(e){return e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`},isNumber=function(e){return e>=`0`&&e<=`9`};this.tokenize=function(e,t,n,r){var a=this.getMeat(e,t,n);t=a.start,n=a.end;for(var o=[],c;t<n;){if(e[t]===`"`){for(c=t+1;c<n&&e[c]!==`"`;)c++;o.push({type:`quote`,token:e.substring(t+1,c),start:t+1,end:c}),c++}else if(isLetter(e[t])){if(c=t+1,r)for(;c<n&&!this.isWhiteSpace(e[c]);)c++;else for(;c<n&&isLetter(e[c]);)c++;o.push({type:`alpha`,token:e.substring(t,c),continueId:isNumber(e[c]),start:t,end:c}),t=c+1}else if(e[t]===`.`&&isNumber(e[c+1])){c=t+1;for(var l=null,u=null;c<n&&isNumber(e[c]);)c++;u=parseFloat(e.substring(t,c)),o.push({type:`number`,token:e.substring(t,c),intt:l,floatt:u,continueId:isLetter(e[c]),start:t,end:c}),t=c+1}else if(isNumber(e[t])||e[t]===`-`&&isNumber(e[c+1])){c=t+1;for(var d=null,p=null;c<n&&isNumber(e[c]);)c++;if(e[c]===`.`&&isNumber(e[c+1]))for(c++;c<n&&isNumber(e[c]);)c++;else d=parseInt(e.substring(t,c));p=parseFloat(e.substring(t,c)),o.push({type:`number`,token:e.substring(t,c),intt:d,floatt:p,continueId:isLetter(e[c]),start:t,end:c}),t=c+1}else e[t]===` `||e[t]===` `||o.push({type:`punct`,token:e[t],start:t,end:t+1}),c=t+1;t=c}return o},this.getVoiceToken=function(e,t,n){for(var r=t;r<n&&this.isWhiteSpace(e[r])||e[r]===`=`;)r++;if(e[r]===`"`){var a=e.indexOf(`"`,r+1);return a===-1||a>=n?{len:1,err:`Missing close quote`}:{len:a-t+1,token:this.translateString(e.substring(r+1,a))}}else{for(var o=r;o<n&&!this.isWhiteSpace(e[o])&&e[o]!==`=`;)o++;return{len:o-t+1,token:e.substring(r,o)}}};var r={"`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:`ž`},a={"#":`♯`,b:`♭`,"=":`♮`},o={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:`ù`};this.translateString=function(e){var t=e.split(`\\`);if(t.length===1)return e;var n=null;return t.forEach(function(e){if(n===null)n=e;else{var t=r[e.substring(0,2)];t===void 0?(t=o[e.substring(0,3)],t===void 0?(t=a[e.substring(0,1)],t===void 0?n+=`\\`+e:n+=t+e.substring(1)):n+=t+e.substring(3)):n+=t+e.substring(2)}}),n},this.getNumber=function(e,t){for(var n=0;t<e.length;)switch(e[t]){case`0`:n*=10,t++;break;case`1`:n=n*10+1,t++;break;case`2`:n=n*10+2,t++;break;case`3`:n=n*10+3,t++;break;case`4`:n=n*10+4,t++;break;case`5`:n=n*10+5,t++;break;case`6`:n=n*10+6,t++;break;case`7`:n=n*10+7,t++;break;case`8`:n=n*10+8,t++;break;case`9`:n=n*10+9,t++;break;default:return{num:n,index:t}}return{num:n,index:t}},this.getFraction=function(e,t){var n=1,r=1;if(e[t]!==`/`){var a=this.getNumber(e,t);n=a.num,t=a.index}if(e[t]===`/`)if(t++,e[t]===`/`){for(var o=.5;e[t++]===`/`;)o/=2;return{value:n*o,index:t-1}}else{var c=t,l=this.getNumber(e,t);l.num===0&&c===t&&(l.num=2),l.num!==0&&(r=l.num),t=l.index}return{value:n/r,index:t}};function getTitleNumber(e){let t=/^(\d+)\./.exec(e);return t?t[1]:null}var c=[{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<c.length;t++){var n=c[t],r=e.match(n.match);if(r){var a=getTitleNumber(e);a&&(e=e.replace(a+`.`,``),e=e.trim());var o=r[0].length,l=n.replace+e.substring(0,e.length-o);return a&&(l=a+`. `+l),l}}return e},this.stripComment=function(e){var t=e.indexOf(`%`);return t>=0?n.strip(e.substring(0,t)):n.strip(e)},this.getInt=function(e){var t=parseInt(e);if(isNaN(t))return{digits:0};var n=``+t;return{value:t,digits:e.indexOf(n)+n.length}},this.getFloat=function(e){var t=parseFloat(e);if(isNaN(t))return{digits:0};var n=``+t;return{value:t,digits:e.indexOf(n)+n.length}},this.getMeasurement=function(e){if(e.length===0)return{used:0};var t=1,n=``;if(e[0].token===`-`)e.shift(),n=`-`,t++;else if(e[0].type!==`number`)return{used:0};if(n+=e.shift().token,e.length===0)return{used:1,value:parseInt(n)};var r=e.shift();if(r.token===`.`){if(t++,e.length===0)return{used:t,value:parseInt(n)};if(e[0].type===`number`&&(r=e.shift(),n=n+`.`+r.token,t++,e.length===0))return{used:t,value:parseFloat(n)};r=e.shift()}switch(r.token){case`pt`:return{used:t+1,value:parseFloat(n)};case`px`:return{used:t+1,value:parseFloat(n)};case`cm`:return{used:t+1,value:parseFloat(n)/2.54*72};case`in`:return{used:t+1,value:parseFloat(n)*72};default:return e.unshift(r),{used:t,value:parseFloat(n)}}};var substInChord=function(e){return e=e.replace(/\\n/g,`
44
+ `),e=e.replace(/\\"/g,`"`),e};this.getBrackettedSubstring=function(e,t,n,r){for(var a=r||e[t],o=t+1,c=!1;o<e.length&&(c||e[o]!==a);)c=e[o]===`\\`,++o;return e[o]===a?[o-t+1,substInChord(e.substring(t+1,o)),!0]:(o=t+n,o>e.length-1&&(o=e.length-1),[o-t+1,substInChord(e.substring(t+1,o)),!1])}};Tokenizer.prototype.peekLine=function(){return this.lines[this.lineIndex]},Tokenizer.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},t.exports=Tokenizer})),ca=__commonJSMin(((e,t)=>{function wrapLines(e,t,n){if(!(!t||e.lines.length===0)){var r=e.deline({lineBreaks:!1}),a=findLineBreaks(r,t);e.lines=addLineBreaks(r,a,n),e.lineBreaks=a}}function addLineBreaks(e,t,n){for(var r=[],a=[],o=[],c=1,l=0;l<t.length;l++){var u=t[l];if(e[u.ogLine].staff){var d=e[u.ogLine].staff[u.staff];if(r[u.line]||(r[u.line]={staff:[]}),!r[u.line].staff[u.staff]){r[u.line].staff[u.staff]={voices:[]},n!==void 0&&u.staff===0&&u.line>0&&(r[u.line].staff[u.staff].barNumber=c);for(var p=Object.keys(d),m=0;m<p.length;m++){var h=p[m]===`voices`;p[m]===`meter`&&u.line!==0&&(h=!0),h||(r[u.line].staff[u.staff][p[m]]=d[p[m]])}a[u.staff]&&(r[u.line].staff[u.staff].key=a[u.staff])}r[u.line].staff[u.staff].voices[u.voice]||(r[u.line].staff[u.staff].voices[u.voice]=[]),r[u.line].staff[u.staff].voices[u.voice]=e[u.ogLine].staff[u.staff].voices[u.voice].slice(u.start,u.end+1),o[u.staff*10+u.voice]&&r[u.line].staff[u.staff].voices[u.voice].unshift({el_type:`stem`,direction:o[u.staff*10+u.voice].direction});for(var g=r[u.line].staff[u.staff].voices[u.voice],_=g.length-1;_>=0;_--)if(g[_].el_type===`key`){a[u.staff]={root:g[_].root,acc:g[_].acc,mode:g[_].mode,accidentals:g[_].accidentals.filter(function(e){return e.acc!==`natural`})};break}for(_=g.length-1;_>=0;_--)if(g[_].el_type===`stem`){o[u.staff*10+u.voice]={direction:g[_].direction};break}if(n!==void 0&&u.staff===0&&u.voice===0)for(_=0;_<g.length;_++)g[_].el_type===`bar`&&(c++,_===g.length-1?delete g[_].barNumber:g[_].barNumber=c)}else r[u.line]=e[u.ogLine]}for(var y=0;y<r.length;y++)r[y].staff&&(r[y].staff=r[y].staff.filter(function(e){return e!=null}));return r}function findLineBreaks(e,t){for(var n=[],r=0,a=0,o=0,c=0;c<e.length;c++){var l=e[c];if(l.staff){var u=a,d=t[r];r++;for(var p=0;p<l.staff.length;p++)for(var m=l.staff[p],h=0;h<m.voices.length;h++){o=u;for(var g=0,_=0,y=m.voices[h],b=0,x=0;x<y.length;x++)y[x].el_type===`bar`&&(d[_]===g&&(n.push({ogLine:c,line:o,staff:p,voice:h,start:b,end:x}),b=x+1,o++,a=Math.max(a,o),_++),g++);n.push({ogLine:c,line:o,staff:p,voice:h,start:b,end:y.length}),o++,a=Math.max(a,o)}}else n.push({ogLine:c,line:o}),o++,a=Math.max(a,o)}return n}function freeFormLineBreaks(e,t){for(var n=[],r=[],a=0,o=0;o<e.length;o++){var c=e[o],l=a+c;l<t?a=l:t-a<l-t&&a>0?(n.push(o-1),r.push(Math.round(a-c)),a=c):o<e.length-1&&(n.push(o),r.push(Math.round(a)),a=0)}return r.push(Math.round(a)),{lineBreaks:n,totals:r}}function clone(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}function oneTry(e,t,n,r,a,o,c,l,u,d,p){for(var m=d;m<e.length;m++){var h=e[m];n+=h,r+=h;var g=Math.abs(n-t[l]);if(Math.abs(g-o)<t[0]/10)if(g<o){var _=clone(a),y=clone(u);y.push(m-1),_.push(r-h),p.push({accumulator:n,lineAccumulator:h,lineWidths:_,lastVariance:Math.abs(n-t[l+1]),highestVariance:Math.max(c,o),currLine:l+1,lineBreaks:y,startIndex:m+1})}else g>o&&m<e.length-1&&(_=clone(a),y=clone(u),p.push({accumulator:n,lineAccumulator:r,lineWidths:_,lastVariance:g,highestVariance:Math.max(c,g),currLine:l,lineBreaks:y,startIndex:m+1}));g>o?(u.push(m-1),l++,c=Math.max(c,o),o=Math.abs(n-t[l]),a.push(r-h),r=h):o=g}a.push(r)}function optimizeLineWidths(e,t,n,r){for(var a=Math.ceil(e.total/t),o=Math.floor(e.total/a),c=[],l=0;l<a;l++)c.push(o*(l+1));var u=[];u.push({accumulator:0,lineAccumulator:0,lineWidths:[],lastVariance:999999,highestVariance:0,currLine:0,lineBreaks:[],startIndex:0});for(var d=0;d<u.length;)oneTry(e.measureWidths,c,u[d].accumulator,u[d].lineAccumulator,u[d].lineWidths,u[d].lastVariance,u[d].highestVariance,u[d].currLine,u[d].lineBreaks,u[d].startIndex,u),d++;for(l=0;l<u.length;l++){var p=u[l];p.variances=[],p.aveVariance=0;for(var m=0;m<p.lineWidths.length;m++){var h=p.lineWidths[m];p.variances.push(h-c[0]),p.aveVariance+=Math.abs(h-c[0])}p.aveVariance/=p.lineWidths.length,r.attempts.push({type:`optimizeLineWidths`,lineBreaks:p.lineBreaks,variances:p.variances,aveVariance:p.aveVariance,widths:e.measureWidths})}var g=9999999,_=-1;for(l=0;l<u.length;l++)p=u[l],p.aveVariance<g&&(g=p.aveVariance,_=l);return{failed:!1,lineBreaks:u[_].lineBreaks,variance:u[_].highestVariance}}function fixedMeasureLineBreaks(e,t,n){for(var r=[],a=[],o=0,c=!1,l=0;l<e.length;l++)o+=e[l],o>t&&(c=!0),l%n===n-1&&(l!==e.length-1&&r.push(l),a.push(Math.round(o)),o=0);return{failed:c,totals:a,lineBreaks:r}}function getRevisedTuneParams(e,t,n){var r={lineBreaks:e,staffwidth:t};for(var a in n)n.hasOwnProperty(a)&&a!==`wrap`&&a!==`staffwidth`&&(r[a]=n[a]);return{revisedParams:r}}function calcLineWraps(e,t,n){if(t.length===0||n.staffwidth<t[0].left)return{reParse:!1,explanation:`Staff width is narrower than the margin`,revisedParams:n};var r=n.scale?Math.max(n.scale,.1):1,a=n.wrap.minSpacing?Math.max(parseFloat(n.wrap.minSpacing),1):1,o=n.wrap.minSpacingLimit?Math.max(parseFloat(n.wrap.minSpacingLimit),1):a-.1,c=n.wrap.maxSpacing?Math.max(parseFloat(n.wrap.maxSpacing),1):void 0;n.wrap.lastLineLimit&&!c&&(c=Math.max(parseFloat(n.wrap.lastLineLimit),1));for(var l=n.wrap.preferredMeasuresPerLine?Math.max(parseInt(n.wrap.preferredMeasuresPerLine,10),0):void 0,u=[],d=[],p=0;p<t.length;p++){var m=t[p],h=n.staffwidth-m.left,g=h/a/r,_=h/c/r,y=h/o/r,b={widths:m,lineBreakPoint:g,minLineSize:_,attempts:[],staffWidth:n.staffwidth,minWidth:Math.round(y)},x=null;if(l){var S=fixedMeasureLineBreaks(m.measureWidths,g,l);b.attempts.push({type:`Fixed Measures Per Line`,preferredMeasuresPerLine:l,lineBreaks:S.lineBreaks,failed:S.failed,totals:S.totals}),S.failed||(x=S.lineBreaks)}if(!x){var C=freeFormLineBreaks(m.measureWidths,g);b.attempts.push({type:`Free Form`,lineBreaks:C.lineBreaks,totals:C.totals}),x=C.lineBreaks,x.length>0&&m.measureWidths.length<25&&(C=optimizeLineWidths(m,g,x,b),b.attempts.push({type:`Optimize`,failed:C.failed,reason:C.reason,lineBreaks:C.lineBreaks,totals:C.totals}),C.failed||(x=C.lineBreaks))}u.push(x),d.push(b)}var w=n.staffwidth,T=getRevisedTuneParams(u,w,n);return T.explanation=d,T.reParse=!0,T}t.exports={wrapLines,calcLineWraps}})),la=__commonJSMin(((e,t)=>{var n={};n.FONTEM=360,n.FONTSIZE=30,n.STEP=n.FONTSIZE*93/720,n.SPACE=10,n.TOPNOTE=15,n.STAVEHEIGHT=100,n.INDENT=50,t.exports=n})),ua=__commonJSMin(((e,t)=>{var sequence,n=Xi();(function(){var e=1,t=128;sequence=function(r,a){a||(a={});var o,c=a.program||0,l=a.midiTranspose||0;r.visualTranspose&&(l-=r.visualTranspose);var u=a.channel||0,d=!1,p=a.drum||``,m=a.drumBars||1,h=a.drumIntro||0,g=p!==``,_=!!a.drumOff,y=[],b=50;c=parseInt(c,10),l=parseInt(l,10),u=parseInt(u,10),u===10&&(c=t),p=p.split(` `),m=parseInt(m,10),h=parseInt(h,10);var x=r.formatting.bagpipes;x&&(c=71);var S=[];if(r.formatting.midi){var C=r.formatting.midi;C.program&&C.program.length>0&&(c=C.program[0],C.program.length>1&&(c=C.program[1],u=C.program[0]),d=!0),C.transpose&&(l=C.transpose[0]),C.channel&&(u=C.channel[0],d=!0),C.drum&&(p=C.drum),C.drumbars&&(m=C.drumbars[0]),C.drumon&&(g=!0),u===10&&(c=t),C.beat&&S.push({el_type:`beat`,beats:C.beat}),C.nobeataccents&&S.push({el_type:`beataccents`,value:!1})}o=a.qpm?parseInt(a.qpm,10):r.metaText.tempo?interpretTempo(r.metaText.tempo,r.getBeatLength()):a.defaultQpm?a.defaultQpm:180;var w=[];x&&w.push({el_type:`bagpipes`}),w.push({el_type:`instrument`,program:c}),u&&w.push({el_type:`channel`,channel:u}),l&&w.push({el_type:`transpose`,transpose:l}),w.push({el_type:`tempo`,qpm:o});for(var T=0;T<S.length;T++)w.push(S[T]);var E=[],D=[],O=[],k=[0],A={};A[0]={el_type:`tempo`,qpm:o,timing:0};for(var j,M=[],N=[],P=!1,F=r.lines,I=0;I<F.length;I++){var L=F[I];if(L.staff){for(var ee=L.staff,R=0,z=0;z<ee.length;z++){var B=ee[z];if(!(B.clef&&B.clef.type===`TAB`))for(var V=0;V<B.voices.length;V++){var H=B.voices[V];if(!E[R]){E[R]=[].concat(JSON.parse(JSON.stringify(w)));var U=getTrackTitle(L.staff,R);U&&E[R].unshift({el_type:`name`,trackName:U})}if(l&&B.clef.type===`perc`&&E[R].push({el_type:`transpose`,transpose:0}),B.clef&&B.clef.type===`perc`&&!d)for(var te=0;te<E[R].length;te++)E[R][te].el_type===`instrument`&&(E[R][te].program=t);else B.key&&addKey(E[R],B.key);B.meter&&addMeter(E[R],B.meter),!P&&g&&(E[R].push({el_type:`drum`,params:{pattern:p,bars:m,on:g,intro:h}}),P=!0),B.clef&&B.clef.type!==`perc`&&B.clef.transpose&&(B.clef.el_type=`clef`,E[R].push({el_type:`transpose`,transpose:B.clef.transpose})),B.clef&&B.clef.type&&(B.clef.type.indexOf(`-8`)>=0?E[R].push({el_type:`transpose`,transpose:-12}):B.clef.type.indexOf(`+8`)>=0&&E[R].push({el_type:`transpose`,transpose:12})),r.formatting.midi&&r.formatting.midi.drumoff&&(E[R].push({el_type:`bar`}),E[R].push({el_type:`drum`,params:{pattern:``,on:!1}}));var W=0,ne=0,re=0,ie=0;j=[105,95,85,1];for(var ae=0;ae<H.length;ae++){var G=H[ae];switch(G.el_type){case`note`:if(D[V]&&(j[0]+=D[V],j[1]+=D[V],j[2]+=D[V],E[R].push({el_type:`beat`,beats:j.slice(0)})),O[V]&&(j[0]+=O[V],j[1]+=O[V],j[2]+=O[V],E[R].push({el_type:`beat`,beats:j.slice(0)})),setDynamics(G),!G.rest||G.rest.type!==`spacer`){var K={elem:G,el_type:`note`,timing:k[R]};if(G.style?K.style=G.style:y[R]&&(K.style=y[R]),K.duration=G.duration===0?.25:G.duration,G.startTriplet){if(ne=G.tripletMultiplier,re=G.startTriplet*ne*G.duration,G.startTriplet!==G.tripletR&&ae+G.tripletR<=H.length){for(var oe=0,se=ae;se<ae+G.tripletR;se++)oe+=H[se].duration;re=ne*oe}K.duration*=ne,K.duration=Math.round(K.duration*1e6)/1e6,ie=K.duration}else ne&&(G.endTriplet?(ne=0,K.duration=Math.round((re-ie)*1e6)/1e6):(K.duration*=ne,K.duration=Math.round(K.duration*1e6)/1e6,ie+=K.duration));G.rest&&(K.rest=G.rest),G.decoration&&(K.decoration=G.decoration.slice(0)),G.pitches&&(K.pitches=n.cloneArray(G.pitches)),G.gracenotes&&(K.gracenotes=n.cloneArray(G.gracenotes)),G.chord&&(K.chord=n.cloneArray(G.chord)),E[R].push(K),G.style===`rhythm`&&chordVoiceOffThisBar(E),W++,k[R]+=K.duration}break;case`key`:case`keySignature`:addKey(E[R],G);break;case`meter`:addMeter(E[R],G);break;case`clef`:G.transpose&&E[R].push({el_type:`transpose`,transpose:G.transpose}),G.type&&(G.type.indexOf(`-8`)>=0?E[R].push({el_type:`transpose`,transpose:-12}):G.type.indexOf(`+8`)>=0&&E[R].push({el_type:`transpose`,transpose:12}));break;case`tempo`:o=interpretTempo(G,r.getBeatLength()),E[R].push({el_type:`tempo`,qpm:o,timing:k[R]}),A[``+k[R]]={el_type:`tempo`,qpm:o,timing:k[R]};break;case`bar`:W>0&&E[R].push({el_type:`bar`}),setDynamics(G),W=0;var ce=G.type===`bar_right_repeat`||G.type===`bar_dbl_repeat`,q=G.startEnding===`1`,le=G.type===`bar_left_repeat`||G.type===`bar_dbl_repeat`||G.type===`bar_right_repeat`;if(ce){var ue=M[R];ue||(ue=0);var de=N[R];de||(de=E[R].length);for(var fe=ue;fe<de;fe++){var pe=Object.assign({},E[R][fe]);pe.pitches&&(pe.pitches=n.cloneArray(pe.pitches)),E[R].push(pe)}N[R]=void 0,M[R]=void 0}q&&(N[R]=E[R].length),le&&(M[R]=E[R].length);break;case`style`:y[R]=G.head;break;case`timeSignature`:E[R].push(interpretMeter(G));break;case`part`:break;case`stem`:case`scale`:case`break`:case`font`:break;case`midi`:var me=!1;switch(G.cmd){case`drumon`:g=!0,me=!0;break;case`drumoff`:g=!1,me=!0;break;case`drum`:p=G.params,me=!0;break;case`drumbars`:m=G.params[0],me=!0;break;case`drummap`:break;case`channel`:G.params[0]===10&&E[R].push({el_type:`instrument`,program:t});break;case`program`:addIfDifferent(E[R],{el_type:`instrument`,program:G.params[0]}),d=!0;break;case`transpose`:E[R].push({el_type:`transpose`,transpose:G.params[0]});break;case`gchordoff`:E[R].push({el_type:`gchordOn`,tacet:!0});break;case`gchordon`:E[R].push({el_type:`gchordOn`,tacet:!1});break;case`beat`:E[R].push({el_type:`beat`,beats:G.params});break;case`nobeataccents`:E[R].push({el_type:`beataccents`,value:!1});break;case`beataccents`:E[R].push({el_type:`beataccents`,value:!0});break;case`vol`:case`volinc`:E[R].push({el_type:G.cmd,volume:G.params[0]});break;case`swing`:case`gchord`:case`bassvol`:case`chordvol`:E[R].push({el_type:G.cmd,param:G.params[0]});break;case`bassprog`:case`chordprog`:E[R].push({el_type:G.cmd,value:G.params[0],octaveShift:G.params[1]});break;case`gchordbars`:E[R].push({el_type:G.cmd,param:G.params[0]});break;default:console.log(`MIDI seq: midi cmd not handled: `,G.cmd,G)}me&&(E[0].push({el_type:`drum`,params:{pattern:p,bars:m,intro:h,on:g}}),P=!0);break;default:console.log(`MIDI: element type `+G.el_type+` not handled.`)}}R++,k[R]||(k[R]=0)}}function setDynamics(e){var t={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]},n;if(e.decoration)if(e.decoration.indexOf(`pppp`)>=0?n=`pppp`:e.decoration.indexOf(`ppp`)>=0?n=`ppp`:e.decoration.indexOf(`pp`)>=0?n=`pp`:e.decoration.indexOf(`p`)>=0?n=`p`:e.decoration.indexOf(`mp`)>=0?n=`mp`:e.decoration.indexOf(`mf`)>=0?n=`mf`:e.decoration.indexOf(`f`)>=0?n=`f`:e.decoration.indexOf(`ff`)>=0?n=`ff`:e.decoration.indexOf(`fff`)>=0?n=`fff`:e.decoration.indexOf(`ffff`)>=0&&(n=`ffff`),n&&(j=t[n].slice(0),E[R].push({el_type:`beat`,beats:j.slice(0)}),D[V]=!1,O[V]=!1),e.decoration.indexOf(`crescendo(`)>=0){var r=numNotesToDecoration(H,ae,`crescendo)`),a=Math.min(127,j[0]+b),o=endingVolume(H,ae+r+1,Object.keys(t));o&&(a=t[o][0]),r>0?D[V]=Math.floor((a-j[0])/r):D[V]=!1,O[V]=!1}else if(e.decoration.indexOf(`crescendo)`)>=0)D[V]=!1;else if(e.decoration.indexOf(`diminuendo(`)>=0){var c=numNotesToDecoration(H,ae,`diminuendo)`),l=Math.max(15,j[0]-b),u=endingVolume(H,ae+c+1,Object.keys(t));u&&(l=t[u][0]),D[V]=!1,c>0?O[V]=Math.floor((l-j[0])/c):O[V]=!1}else e.decoration.indexOf(`diminuendo)`)>=0&&(O[V]=!1)}}}if(insertTempoChanges(E,A),h)for(var he=r.getPickupLength(),J=0;J<E.length;J++){for(var Y=0;E[J][Y].el_type!==`note`&&E[J].length>Y;)Y++;if(E[J].length>Y){for(var se=0;se<h;se++)he===0||se<h-1?(E[J].splice(Y,0,{el_type:`note`,rest:{type:`rest`},duration:e},{el_type:`bar`}),Y+=2):E[J].splice(Y++,0,{el_type:`note`,rest:{type:`rest`},duration:e-he});_&&(_=(g=!1,E[J].splice(Y++,0,{el_type:`drum`,params:{pattern:p,bars:m,intro:h,on:g}}),!1))}}return E.length>0&&E[0].length>0&&(E[0][0].pickupLength=r.getPickupLength()),E};function numNotesToDecoration(e,t,n){for(var r=0,a=t+1;a<e.length;a++)if(e[a].el_type===`note`&&r++,e[a].decoration&&e[a].decoration.indexOf(n)>=0)return r;return r}function endingVolume(e,t,n){for(var r=Math.min(e.length,t+3),a=t;a<r;a++)if(e[a].el_type===`note`&&e[a].decoration){for(var o=0;o<e[a].decoration.length;o++)if(n.indexOf(e[a].decoration[o])>=0)return e[a].decoration[o]}return null}function insertTempoChanges(e,t){if(!(!t||t.length===0))for(var n=Object.keys(t),r=0;r<e.length;r++)for(var a=e[r],o=t[0]?t[0].qpm:0,c=0;c<a.length;c++){var l=a[c];l.el_type===`tempo`&&(o=l.qpm),n.indexOf(``+l.timing)>=0&&o!==t[``+l.timing].qpm&&(o=t[``+l.timing].qpm,l.el_type===`tempo`?(l.qpm=t[``+l.timing].qpm,c++):(e[r].splice(c,0,{el_type:`tempo`,qpm:t[``+l.timing].qpm,timing:l.timing}),c+=2))}}function chordVoiceOffThisBar(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=n.length-1;r>=0&&n[r].el_type!==`bar`;)n[r].noChordVoice=!0,r--}function getTrackTitle(e,t){if(!(!e||e.length<=t||!e[t].title))return e[t].title.join(` `)}function interpretTempo(e,t){var n=1/4;e.duration&&(n=e.duration[0]);var r=60;return e.bpm&&(r=e.bpm),n*r/t}function interpretMeter(t){var n;switch(t.type){case`common_time`:n={el_type:`meter`,num:4,den:4};break;case`cut_time`:n={el_type:`meter`,num:2,den:2};break;case`specified`:n={el_type:`meter`,num:t.value[0].num,den:t.value[0].den};break;default:n={el_type:`meter`}}return e=n.num/n.den,n}function removeNaturals(e){for(var t=[],n=0;n<e.length;n++)e[n].acc!==`natural`&&t.push(e[n]);return t}function addKey(e,t){addIfDifferent(e,t.root===`HP`?{el_type:`key`,accidentals:[{acc:`natural`,note:`g`},{acc:`sharp`,note:`f`},{acc:`sharp`,note:`c`}]}:{el_type:`key`,accidentals:removeNaturals(t.accidentals)})}function addMeter(e,t){addIfDifferent(e,interpretMeter(t))}function addIfDifferent(e,t){for(var n=e.length-1;n>=0;n--)if(e[n].el_type===t.el_type){JSON.stringify(e[n])!==JSON.stringify(t)&&e.push(t);return}e.push(t)}})(),t.exports=sequence})),da=__commonJSMin(((e,t)=>{var n=function ChordTrack(e,t,n,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=n.bassprog&&n.bassprog.length>=1?n.bassprog[0]:0,this.chordInstrument=n.chordprog&&n.chordprog.length>=1?n.chordprog[0]:0,this.bassOctaveShift=n.bassprog&&n.bassprog.length===2?n.bassprog[1]:0,this.chordOctaveShift=n.chordprog&&n.chordprog.length===2?n.chordprog[1]:0,this.boomVolume=n.bassvol&&n.bassvol.length===1?n.bassvol[0]:64,this.chickVolume=n.chordvol&&n.chordvol.length===1?n.chordvol[0]:48,n.gchord&&n.gchord.length>0?this.overridePattern=parseGChord(n.gchord[0]):this.overridePattern=void 0};n.prototype.setMeter=function(e){this.meter=e},n.prototype.setTempoChangeFactor=function(e){this.tempoChangeFactor=e},n.prototype.setLastBarTime=function(e){this.lastBarTime=e},n.prototype.setTranspose=function(e){this.transpose=e},n.prototype.setRhythmHead=function(e,t){this.hasRhythmHead=e;var n=[];if(e&&this.lastChord&&this.lastChord.chick)for(var r=0;r<this.lastChord.chick.length;r++){var a=Object.assign({},t.pitches[0]);a.actualPitch=this.lastChord.chick[r],n.push(a)}return n},n.prototype.barEnd=function(e){this.chordTrack.length>0&&!this.chordTrackFinished&&(this.resolveChords(this.lastBarTime,timeToRealTime(e.time)),this.currentChords=[]),this.chordLastBar=this.lastChord},n.prototype.gChordOn=function(e){this.chordsOff||(this.gChordTacet=e.tacet)},n.prototype.paramChange=function(e){switch(e.el_type){case`gchord`:e.param&&e.param.length>0?this.overridePattern=parseGChord(e.param):this.overridePattern=void 0;break;case`bassprog`:this.bassInstrument=e.value,e.octaveShift!=null&&e.octaveShift!=null?this.bassOctaveShift=e.octaveShift:this.bassOctaveShift=0;break;case`chordprog`:this.chordInstrument=e.value,e.octaveShift!=null&&e.octaveShift!=null?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)}},n.prototype.finish=function(){this.chordTrackEmpty()||(this.chordTrackFinished=!0)},n.prototype.addTrack=function(e){this.chordTrackEmpty()||e.push(this.chordTrack)},n.prototype.findChord=function(e){if(this.gChordTacet)return`break`;if(this.chordTrackFinished||!e.chord||e.chord.length===0)return null;for(var t=0;t<e.chord.length;t++){var n=e.chord[t];if(n.position===`default`)return n.name;if(this.breakSynonyms.indexOf(n.name.toLowerCase())>=0)return`break`}return null},n.prototype.interpretChord=function(e){if(e.length!==0){if(e===`break`)return{chick:[]};var t=e.substring(0,1);if(t===`(`){if(e=e.substring(1,e.length-2),e.length===0)return;t=e.substring(0,1)}var n=this.basses[t];if(n){for(var r=this.transpose;r<-8;)r+=12;for(;r>8;)r-=12;n+=r,n<33?n+=12:n>44&&(n-=12);var a=n;n+=this.bassOctaveShift*12;var o=n-5,c;e.length===1&&(c=this.chordNotes(n,``));var l=e.substring(1),u=l.substring(0,1);u===`b`||u===`♭`?(a--,n--,o--,l=l.substring(1)):(u===`#`||u===`♯`)&&(a++,n++,o++,l=l.substring(1));var d=l.split(`/`);if(c=this.chordNotes(a,d[0]),c.length>=3){var p=c[2]-c[0];o=o+p-7}if(d.length===2&&this.basses[d[1].substring(0,1)]){var m=d[1].substring(1),h={"#":1,"♯":1,b:-1,"♭":-1}[m]||0;n=this.basses[d[1].substring(0,1)]+h+r,n+=this.bassOctaveShift*12,o=n}return{boom:n,boom2:o,chick:c}}}},n.prototype.chordNotes=function(e,t){var n=this.chordIntervals[t];n||(n=t.slice(0,2).toLowerCase()===`ma`||t[0]===`M`?this.chordIntervals.M:t[0]===`m`||t[0]===`-`?this.chordIntervals.m:this.chordIntervals.M),e+=12,e+=this.chordOctaveShift*12;for(var r=[],a=0;a<n.length;a++)r.push(e+n[a]);return r},n.prototype.writeNote=function(e,t,n,r,a,o){e!==void 0&&this.chordTrack.push({cmd:`note`,pitch:e,volume:n,start:this.lastBarTime+r*durationRounded(t,this.tempoChangeFactor),duration:durationRounded(a,this.tempoChangeFactor),gap:0,instrument:o})},n.prototype.chordTrackEmpty=function(){for(var e=!0,t=0;t<this.chordTrack.length&&e;t++)this.chordTrack[t].cmd===`note`&&(e=!1);return e},n.prototype.resolveChords=function(e,t){if(!this.hasRhythmHead){var n=this.meter.num,r=this.meter.den,a=1/r,o=a/2,c=parseInt(n,10)/parseInt(r,10)-(t-e)/this.tempoChangeFactor;Math.abs(c)<1e-5&&(c=0),(this.currentChords.length===0||this.currentChords[0].beat!==0)&&this.currentChords.unshift({beat:0,chord:this.chordLastBar});var l=expandCurrentChords(this.currentChords,8*n/r,a),u=this.overridePattern?this.overridePattern:this.rhythmPatterns[n+`/`+r];if(c){u=[];for(var d=(t-e)/this.tempoChangeFactor*8,p=0;p<d/2;p+=2)u.push(`chick`),u.push(``)}if(!u){u=[];for(var p=0;p<8*n/r/2;p++)u.push(`chick`),u.push(``)}for(var m=!0,h=Math.min(u.length,l.length),p=0;p<h;p++){p>0&&l[p-1]&&l[p]&&l[p-1].boom!==l[p].boom&&(m=!0);var g=u[p],_=g.indexOf(`boom`)>=0,y=!_&&p!==0&&u[0].indexOf(`boom`)>=0&&(!l[p-1]||l[p-1].boom!==l[p].boom),b=resolvePitch(l[p],g,m,y);_&&(m=!1);for(var x=0;x<b.length;x++)this.writeNote(b[x],.125,_||y?this.boomVolume:this.chickVolume,p,o,_||y?this.bassInstrument:this.chordInstrument),y?y=!1:_=!1}}},n.prototype.processChord=function(e){if(!this.chordTrackFinished){var t=this.findChord(e);if(t){var n=this.interpretChord(t);if(n){this.chordTrack.length===0&&this.chordTrack.push({cmd:`program`,channel:this.chordChannel,instrument:this.chordInstrument}),this.lastChord=n;var r=calcBeat(this.lastBarTime,timeToRealTime(e.time));this.currentChords.push({chord:this.lastChord,beat:r,start:timeToRealTime(e.time)})}}}};function resolvePitch(e,t,n,r){var a=[];if(!e)return a;t.indexOf(`boom`)>=0?a.push(n?e.boom:e.boom2):r&&a.push(e.boom);var o=e.chick.length;if(t.indexOf(`chick`)>=0)for(var c=0;c<o;c++)a.push(e.chick[c]);switch(t){case`DO`:a.push(e.chick[0]);break;case`MI`:a.push(e.chick[1]);break;case`SOL`:a.push(extractNote(e,2));break;case`TI`:a.push(extractNote(e,3));break;case`TOP`:a.push(extractNote(e,4));break;case`do`:a.push(e.chick[0]+12);break;case`mi`:a.push(e.chick[1]+12);break;case`sol`:a.push(extractNote(e,2)+12);break;case`ti`:a.push(extractNote(e,3)+12);break;case`top`:a.push(extractNote(e,4)+12);break}return a}function extractNote(e,t){var n=Math.floor(t/e.chick.length);return e.chick[t%e.chick.length]+n*12}function parseGChord(e){for(var t=[],n=0;n<e.length;n++)switch(e[n]){case`z`:t.push(``);break;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`);break}return t}function expandCurrentChords(e,t,n){n*=8;var r=[];if(e.length===0)return r;for(var a=e[0].chord,o=1;o<e.length;o++){for(var c=e[o];r.length<c.beat;)r.push(a);a=c.chord}for(;r.length<t;)r.push(a);return r}function calcBeat(e,t){return(t-e)*8}n.prototype.breakSynonyms=[`break`,`(break)`,`no chord`,`n.c.`,`tacet`],n.prototype.basses={A:33,B:35,C:36,D:38,E:40,F:41,G:43},n.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]},n.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`]};function timeToRealTime(e){return e/1e6}function durationRounded(e,t){return Math.round(e*t*1e6)/1e6}t.exports=n})),fa=__commonJSMin(((e,t)=>{var n={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'`};function pitchesToPerc(e){return n[(e.accidental?e.accidental[0]:`x`)+e.verticalPos]}t.exports=pitchesToPerc})),pa=__commonJSMin(((e,t)=>{var flatten,n=da(),r=fa();(function(){var e,t,a,o,c,l,u=1,d,p,m,h,g,_,y={num:4,den:4},b=128,x,S=!0,C=105,w=95,T=85,E=.25,D,O,k=0,A,j={},M,N=0,P,F=0,I=-.001,L=.4;flatten=function(r,b,F,I){b||(b={}),I||(I={}),e=[],t=[0,0,0,0,0,0,0],o=[],c=b.qpm,l=void 0,u=1,d=void 0,p=void 0,m=void 0,h=void 0,g=0,P=F,y={num:4,den:4},S=!0,C=105,w=95,T=85,E=.25,D=void 0,O=void 0,k=0,A=[],j={},M=1,r.length>0&&r[0].length>0&&(N=r[0][0].pickupLength),b.bassprog!==void 0&&!I.bassprog&&(I.bassprog=[b.bassprog]),b.bassvol!==void 0&&!I.bassvol&&(I.bassvol=[b.bassvol]),b.chordprog!==void 0&&!I.chordprog&&(I.chordprog=[b.chordprog]),b.chordvol!==void 0&&!I.chordvol&&(I.chordvol=[b.chordvol]),b.gchord!==void 0&&!I.gchord&&(I.gchord=[b.gchord]),_=new n(r.length,b.chordsOff,I,y),preProcess(r,b);for(var L=0;L<r.length;L++){a=0,_.setTranspose(a);var ee=r[L];m=[{cmd:`program`,channel:L,instrument:d}],h=void 0,x=0,_.setLastBarTime(0);var R=!1;(b.voicesOff===!0||b.voicesOff&&b.voicesOff.length&&b.voicesOff.indexOf(L)>=0)&&(R=!0);for(var z=0;z<ee.length;z++){var B=ee[z];switch(B.el_type){case`name`:h={cmd:`text`,type:`name`,text:B.trackName};break;case`note`:writeNote(B,R);break;case`key`:t=setKeySignature(B);break;case`meter`:l||(l=B),y=B,_.setMeter(y),E=getBeatFraction(y),alignDrumToMeter();break;case`tempo`:c?u=B.qpm?c/B.qpm:1:c=B.qpm,_.setTempoChangeFactor(u);break;case`transpose`:a=B.transpose,_.setTranspose(a);break;case`bar`:_.barEnd(B),e=[],L===0&&writeDrum(r.length+1),_.setRhythmHead(!1),x=timeToRealTime(B.time),_.setLastBarTime(x);break;case`bagpipes`:break;case`instrument`:if(d===void 0&&(d=B.program),p=B.program,m.length>0&&m[m.length-1].cmd===`program`)m[m.length-1].instrument=B.program;else{var V;for(V=m.length-1;V>=0&&m[V].cmd!==`program`;V--);(V<0||m[V].instrument!==B.program)&&m.push({cmd:`program`,channel:0,instrument:B.program})}break;case`channel`:setChannel(B.channel);break;case`drum`:j=normalizeDrumDefinition(B.params),alignDrumToMeter();break;case`gchordOn`:_.gChordOn(B);break;case`beat`:C=B.beats[0],w=B.beats[1],T=B.beats[2];break;case`vol`:D=B.volume;break;case`volinc`:O=B.volume;break;case`beataccents`:S=B.value;break;case`gchord`:case`bassprog`:case`chordprog`:case`bassvol`:case`chordvol`:case`gchordbars`:_.paramChange(B);break;default:console.log(`MIDI creation. Unknown el_type: `+B.el_type+`
45
+ `);break}}m[0].instrument===void 0&&(m[0].instrument=d||0),h&&m.unshift(h),o.push(m),_.finish(),A.length}return b.detuneOctave&&findOctaves(o,parseInt(b.detuneOctave,10)),_.addTrack(o),A.length>0&&o.push(A),{tempo:c,instrument:d,tracks:o,totalDuration:g}};function setChannel(e){for(var t=m.length-1;t>=0;t--)if(m[t].cmd===`program`){m[t].channel=e;return}}function timeToRealTime(e){return e/1e6}function durationRounded(e){return Math.round(e*u*1e6)/1e6}function preProcess(e,t){for(var n=0;n<e.length;n++){for(var r=e[n],a={},o=t.qpm,c=0,l=1,u=0;u<r.length;u++){var d=r[u];if(d.el_type===`tempo`){o?l=d.qpm?o/d.qpm:1:o=d.qpm;continue}d.time=c;var p=d.duration?d.duration:0;if(c+=Math.round(p*l*1e6),d.pitches){for(var m=0;m<d.pitches.length;m++){var h=d.pitches[m];if(h){if(h.duration=d.duration,h.startTie)a[h.pitch]===void 0?a[h.pitch]={el:u,pitch:m}:(r[a[h.pitch].el].pitches[a[h.pitch].pitch].duration+=h.duration,d.pitches[m]=null);else if(h.endTie){var g=a[h.pitch];if(g){var _=h.duration;delete r[g.el].pitches[g.pitch].startTie,r[g.el].pitches[g.pitch].duration+=_,d.pitches[m]=null,delete a[h.pitch]}else delete h.endTie}}}delete d.duration}}for(var y in a)if(a.hasOwnProperty(y)){var b=a[y];delete r[b.el].pitches[b.pitch].startTie}}}function getBeatFraction(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 calcBeat(e,t,n){return(n-e)/t}function processVolume(e,t){if(t)return 0;var n;if(D!=null)n=D,D=void 0;else if(!S)n=w;else if(N>e)n=T;else{var r=calcBeat(x,getBeatFraction(y),e);n=r===0?C:parseInt(r,10)===r?w:T}return O&&(O=(n+=O,void 0)),n<0&&(n=0),n>127&&(n=127),t?0:n}function findNoteModifications(e,t){var n={};if(e.decoration)for(var r=0;r<e.decoration.length;r++)e.decoration[r]===`staccato`?n.thisBreakBetweenNotes=`staccato`:e.decoration[r]===`tenuto`?n.thisBreakBetweenNotes=`tenuto`:e.decoration[r]===`accent`?n.velocity=Math.min(127,t*1.5):e.decoration[r]===`trill`?n.noteModification=`trill`:e.decoration[r]===`lowermordent`?n.noteModification=`lowermordent`:e.decoration[r]===`uppermordent`||e.decoration[r]===`mordent`?n.noteModification=`mordent`:e.decoration[r]===`turn`?n.noteModification=`turn`:e.decoration[r]===`roll`&&(n.noteModification=`roll`);return n}function doModifiedNotes(e,t){var n=t.start,r=t.duration,a=durationRounded(1/32);switch(e){case`trill`:for(var o=2;r>0;)m.push({cmd:`note`,pitch:t.pitch+o,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),o=o===2?0:2,r-=a,n+=a;break;case`mordent`:m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),r-=a,n+=a,m.push({cmd:`note`,pitch:t.pitch+2,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),r-=a,n+=a,m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n,duration:r,gap:0,instrument:p});break;case`lowermordent`:m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),r-=a,n+=a,m.push({cmd:`note`,pitch:t.pitch-2,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),r-=a,n+=a,m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n,duration:r,gap:0,instrument:p});break;case`turn`:a=t.duration/4,m.push({cmd:`note`,pitch:t.pitch+2,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n+a,duration:a,gap:0,instrument:p,style:`decoration`}),m.push({cmd:`note`,pitch:t.pitch-1,volume:t.volume,start:n+a*2,duration:a,gap:0,instrument:p,style:`decoration`}),m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n+a*3,duration:a,gap:0,instrument:p,style:`decoration`});break;case`roll`:for(;r>0;)m.push({cmd:`note`,pitch:t.pitch,volume:t.volume,start:n,duration:a,gap:0,instrument:p,style:`decoration`}),r-=a*2,n+=a*2;break}}function writeNote(e,t){var n=processVolume(timeToRealTime(e.time),t);_.processChord(e);var a;if(e.gracenotes&&e.pitches&&e.pitches.length>0&&e.pitches[0]&&(a=processGraceNotes(e.gracenotes,e.pitches[0].duration),e.elem&&(e.elem.midiGraceNotePitches=writeGraceNotes(a,timeToRealTime(e.time),n*2/3,p))),e.elem){var o=timeToRealTime(e.time),l=o/E/c*60*1e3;if(e.elem.currentTrackMilliseconds===void 0)e.elem.currentTrackMilliseconds=l,e.elem.currentTrackWholeNotes=o;else if(e.elem.currentTrackMilliseconds.length===void 0)e.elem.currentTrackMilliseconds!==l&&(e.elem.currentTrackMilliseconds=[e.elem.currentTrackMilliseconds,l],e.elem.currentTrackWholeNotes=[e.elem.currentTrackWholeNotes,o]);else{for(var u=!1,d=0;d<e.elem.currentTrackMilliseconds.length;d++)e.elem.currentTrackMilliseconds[d]===l&&(u=!0);u||(e.elem.currentTrackMilliseconds.push(l),e.elem.currentTrackWholeNotes.push(o))}}if(e.pitches){var h=``,y=findNoteModifications(e,n);y.thisBreakBetweenNotes&&(h=y.thisBreakBetweenNotes),y.velocity&&(n=y.velocity);var x=e.pitches;e.style===`rhythm`&&(x=_.setRhythmHead(!0,e)),e.elem&&(e.elem.midiPitches=[]);for(var S=0;S<x.length;S++){var C=x[S];if(C){C.startSlur&&(k+=C.startSlur.length),C.endSlur&&(k-=C.endSlur.length);var w=C.actualPitch?C.actualPitch:adjustPitch(C);if(p===b&&P){var T=r(C);T&&P[T]&&(w=P[T].sound)}var D={cmd:`note`,pitch:w,volume:n,start:timeToRealTime(e.time),duration:durationRounded(C.duration),instrument:p,startChar:e.elem.startChar,endChar:e.elem.endChar};if(D=adjustForMicroTone(D),e.gracenotes&&(D.duration/=2,D.start+=D.duration),e.elem&&e.elem.midiPitches.push(D),y.noteModification)doModifiedNotes(y.noteModification,D);else{switch(k>0?D.endType=`tenuto`:h&&(D.endType=h),D.endType){case`tenuto`:D.gap=I;break;case`staccato`:var O=D.duration*L;D.gap=c/60*O;break;default:D.gap=F;break}m.push(D)}}}m.length-1}var A=getRealDuration(e);g=Math.max(g,timeToRealTime(e.time)+durationRounded(A))}function getRealDuration(e){return e.pitches&&e.pitches.length>0&&e.pitches[0]?e.pitches[0].duration:e.elem?e.elem.duration:e.duration}var ee=[0,2,4,5,7,9,11];function adjustPitch(n){if(n.midipitch!==void 0)return n.midipitch;var r=n.pitch;if(n.accidental)switch(n.accidental){case`sharp`:e[r]=1;break;case`flat`:e[r]=-1;break;case`natural`:e[r]=0;break;case`dblsharp`:e[r]=2;break;case`dblflat`:e[r]=-2;break;case`quartersharp`:e[r]=.25;break;case`quarterflat`:e[r]=-.25;break}var o=extractOctave(r)*12+ee[extractNote(r)]+60;return e[r]===void 0?o+=t[extractNote(r)]:o+=e[r],o+=a,o}function setKeySignature(e){var t=[0,0,0,0,0,0,0];if(!e.accidentals)return t;for(var n=0;n<e.accidentals.length;n++){var r=e.accidentals[n],a;switch(r.acc){case`flat`:a=-1;break;case`quarterflat`:a=-.25;break;case`sharp`:a=1;break;case`quartersharp`:a=.25;break;default:a=0;break}var o=extractNote(r.note.toLowerCase().charCodeAt(0)-99);t[o]+=a}return t}function processGraceNotes(e,t){for(var n=0,a=[],o,c=0;c<e.length;c++)o=e[c],n+=o.duration;var l=t/2/n;for(c=0;c<e.length;c++){o=e[c];var u=adjustPitch(o);if(p===b&&P){var d=r(o);d&&P[d]&&(u=P[d].sound)}var m={pitch:u,duration:o.duration*l};m=adjustForMicroTone(m),a.push(m)}return a}function writeGraceNotes(e,t,n,r){var a=[];n=Math.round(n);for(var o=0;o<e.length;o++){var c=e[o];m.push({cmd:`note`,pitch:c.pitch,volume:n,start:t,duration:c.duration,gap:0,instrument:r,style:`grace`}),a.push({pitch:c.pitch,durationInMeasures:c.duration,volume:n,instrument:r}),t+=c.duration}return a}function adjustForMicroTone(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 extractOctave(e){return Math.floor(e/7)}function extractNote(e){return e%=7,e<0&&(e+=7),e}function normalizeDrumDefinition(e){if(e.pattern.length===0||e.on===!1)return{on:!1};for(var t=e.pattern[0],n=[],r=``,a=0,o=0;o<t.length;o++)if(t[o]===`d`&&a++,t[o]===`d`||t[o]===`z`)r.length===0?r+=t[o]:(n.push(r),r=t[o]);else{if(r.length===0)return{on:!1};r+=t[o]}if(r.length!==0&&n.push(r),e.pattern.length!==a*2+1)return{on:!1};for(var c={on:!0,bars:e.bars,pattern:[]},l=getBeatFraction(y),u=0,d=0;d<n.length;d++){r=n[d];for(var p=1,m=!1,h=0,g=1;g<r.length;g++)switch(r[g]){case`/`:h!==0&&(p*=h),h=0,m=!0;break;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:h=h*10+r[g];break;default:return{on:!1}}m?(h===0&&(h=2),p/=h):h&&(p*=h),r[0]===`d`?(c.pattern.push({len:p*l,pitch:e.pattern[1+u],velocity:e.pattern[1+u+a]}),u++):c.pattern.push({len:p*l,pitch:null})}return M=e.bars?e.bars:1,c}function alignDrumToMeter(){if(!(!j||!j.pattern)){for(var e=j,t=0,n=y.num/y.den,r=0;r<e.pattern.length;r++)t+=e.pattern[r].len;var a=t/M/n;for(r=0;r<e.pattern.length;r++)e.pattern[r].len=e.pattern[r].len/a;j=e}}function writeDrum(e){if(!(A.length===0&&!j.on)){var t=y.num/y.den;if(A.length===0){if(g<t)return;A.push({cmd:`program`,channel:e,instrument:b})}if(j.on)for(var n=x,r=0;r<j.pattern.length;r++){var a=durationRounded(j.pattern[r].len);j.pattern[r].pitch&&A.push({cmd:`note`,pitch:j.pattern[r].pitch,volume:j.pattern[r].velocity,start:n,duration:a,gap:0,instrument:b}),n+=a}}}function findOctaves(e,t){for(var n={},r=0;r<e.length;r++)for(var a=0;a<e[r].length;a++){var o=e[r][a];o.cmd===`note`&&(n[o.start]===void 0&&(n[o.start]=[]),n[o.start].push({track:r,event:a,pitch:o.pitch}))}var c=Object.keys(n);for(r=0;r<c.length;r++){var l=n[c[r]];if(l.length>1){l=l.sort(function(e,t){return e.pitch-t.pitch});var u=l[l.length-1],d=u.pitch%12,p=!1;for(a=0;!p&&a<l.length-1;a++)l[a].pitch%12===d&&(p=!0);if(p){var m=e[u.track][u.event];m.cents||(m.cents=0),m.cents+=t}}}}})(),t.exports=flatten})),ma=__commonJSMin(((e,t)=>{function delineTune(e,t){t||(t={});for(var n=!!t.lineBreaks,r=[],a=!1,o=[],c=[],l=[],u=[],d=[],p=[],m=[],h=0;h<e.length;h++){var g=e[h];if(g.staff){if(a&&!g.vskip)for(var _=r[r.length-1],y=0;y<_.staff.length;y++){var b=g.staff[y],x=_.staff[y];if(b&&(objEqual(b.meter,o[y])||(addMeterToVoices(b.meter,b.voices),o[y]=b.meter,delete b.meter),objEqual(b.key,c[y])||(addKeyToVoices(b.key,b.voices),c[y]=b.key,delete b.key),b.title&&(x.abbrevTitle=b.title),objEqual(b.clef,l[y])||(addClefToVoices(b.clef,b.voices),l[y]=b.clef,delete b.clef),objEqual(b.vocalfont,u[y])||(addFontToVoices(b.vocalfont,b.voices,`vocalfont`),u[y]=b.vocalfont,delete b.vocalfont),objEqual(b.gchordfont,d[y])||(addFontToVoices(b.gchordfont,b.voices,`gchordfont`),d[y]=b.gchordfont,delete b.gchordfont),objEqual(b.tripletfont,p[y])||(addFontToVoices(b.tripletfont,b.voices,`tripletfont`),p[y]=b.tripletfont,delete b.tripletfont),objEqual(b.annotationfont,m[y])||(addFontToVoices(b.annotationfont,b.voices,`annotationfont`),m[y]=b.annotationfont,delete b.annotationfont)),b)for(var S=0;S<x.voices.length;S++){var C=x.voices[S],w=b.voices[S];n&&C.push({el_type:`break`}),w&&(x.voices[S]=C.concat(w))}}else{for(var T=0;T<g.staff.length;T++)c[T]=g.staff[T].key,o[T]=g.staff[T].meter,l[T]=g.staff[T].clef;r.push(cloneLine(g))}a=!0}else a=!1,r.push(g)}return r}function replacer(e,t){return e===`abselem`?`abselem`:t}function addMeterToVoices(e,t){e.el_type=`meter`,e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function addKeyToVoices(e,t){e.el_type=`key`,e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function addClefToVoices(e,t){e.el_type=`clef`,e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function addFontToVoices(e,t,n){e.el_type=`font`,e.type=n,e.startChar=-1,e.endChar=-1;for(var r=0;r<t.length;r++)t[r].unshift(e)}function objEqual(e,t){return e?JSON.stringify(e,replacer)===JSON.stringify(t,replacer):!0}function cloneLine(e){for(var t={},n=Object.keys(e),r=0;r<n.length;r++)if(n[r]!==`staff`)t[n[r]]=e[n[r]];else{t.staff=[];for(var a=0;a<e.staff.length;a++){for(var o={},c=Object.keys(e.staff[a]),l=0;l<c.length;l++)if(c[l]!==`voices`)o[c[l]]=e.staff[a][c[l]];else{o.voices=[];for(var u=0;u<e.staff[a].voices.length;u++)o.voices.push([].concat(e.staff[a].voices[u]))}t.staff.push(o)}}return t}t.exports=delineTune})),ha=__commonJSMin(((e,t)=>{var n=Xi(),r=la(),a=ua(),o=pa(),c=ma(),Tune=function(){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();function copy(e,t,n,r){for(var a=0;a<r.length;a++)e[n][r[a]]=t[n][r[a]]}this.copyTopInfo=function(e){var t=[`tempo`,`title`,`header`,`rhythm`,`origin`,`composer`,`author`,`partOrder`];copy(this,e,`metaText`,t),copy(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`];copy(this,e,`metaText`,t),copy(this,e,`metaTextInfo`,t)},this.getBeatLength=function(){var e=this.getMeterFraction(),t=1;return(e.num===6||e.num===9||e.num===12||e.num===3&&e.den===8)&&(t=3),t/e.den};function computePickupLength(e,t){for(var n=0,r=0;r<e.length;r++)if(e[r].staff)for(var a=0;a<e[r].staff.length;a++)for(var o=0;o<e[r].staff[a].voices.length;o++)for(var c=e[r].staff[a].voices[o],l=1,u=0;u<c.length;u++){var d=c[u].rest&&c[u].rest.type===`spacer`;if(c[u].startTriplet&&(l=c[u].tripletMultiplier),c[u].duration&&!d&&c[u].el_type!==`tempo`&&(n+=c[u].duration*l),c[u].endTriplet&&(l=1),n>=t&&(n-=t),c[u].el_type===`bar`)return n}return n}this.getPickupLength=function(){var e=this.getBarLength(),t=computePickupLength(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 n=this.metaText?this.metaText.tempo:null;t=this.getBpm(n)}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 n=0;n<t.staff.length;n++){var r=t.staff[n].meter;if(r)return r}}return{type:`common_time`}},this.getMeterFraction=function(){var e=this.getMeter(),t=4,n=4;return e&&(e.type===`specified`?(t=parseInt(e.value[0].num,10),n=parseInt(e.value[0].den,10)):e.type===`cut_time`?(t=2,n=2):e.type===`common_time`&&(t=4,n=4)),this.meter={num:t,den:n},this.meter},this.getKeySignature=function(){for(var e=0;e<this.lines.length;e++){var t=this.lines[e];if(t.staff){for(var n=0;n<t.staff.length;n++)if(t.staff[n].key)return t.staff[n].key}}return{}},this.getElementFromChar=function(e){for(var t=0;t<this.lines.length;t++){var n=this.lines[t];if(n.staff)for(var r=0;r<n.staff.length;r++)for(var a=n.staff[r],o=0;o<a.voices.length;o++)for(var c=a.voices[o],l=0;l<c.length;l++){var u=c[l];if(u.startChar&&u.endChar&&u.startChar<=e&&u.endChar>e)return u}}return null};function addVerticalInfo(e){for(var t,n,r,a,o=e.length-1;o>=0;o--){var c=e[o];c.type===`bar`?(c.top=r,c.nextTop=t,t=r,c.bottom=a,c.nextBottom=n,n=a):c.type===`event`&&(r=c.top,a=c.top+c.height)}}function makeSortedArray(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t=t.sort(function(e,t){var n=e.milliseconds-t.milliseconds;return n===0?e.type===`bar`?-1:1:n}),t}this.addElementToEvents=function(e,t,r,a,o,c,l,u,d,p){if(t.hint)return{isTiedState:void 0,duration:0};var m=t.durationClass?t.durationClass:t.duration;if(t.abcelem.rest&&t.abcelem.rest.type===`spacer`&&(m=0),m>0){for(var h=[],g=0;g<t.elemset.length;g++)t.elemset[g]!==null&&h.push(t.elemset[g]);var _=t.startTie;if(d!==void 0)e[`event`+d].elements.push(h),p&&(p=(e[`event`+r]||(e[`event`+r]={type:`event`,milliseconds:r,line:c,measureNumber:l,top:a,height:o,left:null,width:0,elements:[],startChar:null,endChar:null,startCharArray:[],endCharArray:[]}),e[`event`+r].measureStart=!0,!1)),_||(d=void 0);else{if(!e[`event`+r])e[`event`+r]={type:`event`,milliseconds:r,line:c,measureNumber:l,top:a,height:o,left:t.x,width:t.w,elements:[h],startChar:t.abcelem.startChar,endChar:t.abcelem.endChar,startCharArray:[t.abcelem.startChar],endCharArray:[t.abcelem.endChar],midiPitches:t.abcelem.midiPitches?n.cloneArray(t.abcelem.midiPitches):[]},t.abcelem.midiGraceNotePitches&&(e[`event`+r].midiGraceNotePitches=n.cloneArray(t.abcelem.midiGraceNotePitches));else{if(e[`event`+r].left?e[`event`+r].left=Math.min(e[`event`+r].left,t.x):e[`event`+r].left=t.x,e[`event`+r].elements.push(h),e[`event`+r].startCharArray.push(t.abcelem.startChar),e[`event`+r].endCharArray.push(t.abcelem.endChar),e[`event`+r].startChar===null&&(e[`event`+r].startChar=t.abcelem.startChar),e[`event`+r].endChar===null&&(e[`event`+r].endChar=t.abcelem.endChar),t.abcelem.midiPitches&&t.abcelem.midiPitches.length){e[`event`+r].midiPitches||(e[`event`+r].midiPitches=[]);for(var g=0;g<t.abcelem.midiPitches.length;g++)e[`event`+r].midiPitches.push(t.abcelem.midiPitches[g])}if(t.abcelem.midiGraceNotePitches&&t.abcelem.midiGraceNotePitches.length){e[`event`+r].midiGraceNotePitches||(e[`event`+r].midiGraceNotePitches=[]);for(var y=0;y<t.abcelem.midiGraceNotePitches.length;y++)e[`event`+r].midiGraceNotePitches.push(t.abcelem.midiGraceNotePitches[y])}}p&&(p=(e[`event`+r].measureStart=!0,!1))}}return{isTiedState:d,duration:m/u,nextIsBar:p||t.type===`bar`}},this.makeVoicesArray=function(){for(var e=[],t=[],n={},a=0;a<this.engraver.staffgroups.length;a++){var o=this.engraver.staffgroups[a];if(o&&o.staffs&&o.staffs.length>0){var c=o.staffs[0],l=c.absoluteY,u=l-c.top*r.STEP,d=o.staffs[o.staffs.length-1];l=d.absoluteY;for(var p=l-d.bottom*r.STEP-u,m=o.voices,h=0;h<m.length;h++)if(!(m[h].staff&&m[h].staff.isTabStaff)){var g=!1;e[h]||(e[h]=[]),t[h]===void 0&&(t[h]=0);for(var _=m[h].children,y=0;y<_.length;y++)_[y].type===`tempo`&&(n[t[h]]=this.getBpm(_[y].abcelem)),e[h].push({top:u,height:p,line:o.line,measureNumber:t[h],elem:_[y]}),_[y].type===`bar`&&g&&t[h]++,(_[y].type===`note`||_[y].type===`rest`)&&(g=!0)}}}return this.tempoLocations=n,e},this.setupEvents=function(e,t,n,r){r||(r=1);for(var a=[],o={},c=e,l,u=!0,d=this.makeVoicesArray(),p=0,m=0;m<d.length;m++){var h=c,g=Math.round(h*1e3),_=0,y=-1,b=d[m],x=n;t=this.getBeatLength()*x/60;for(var S=-1,C=0;C<b.length;C++){var w=b[C].measureNumber;S!==w&&this.tempoLocations[w]&&(x=this.tempoLocations[w],t=r*this.getBeatLength()*x/60,S=w);var T=b[C].elem,E=this.addElementToEvents(o,T,g,b[C].top,b[C].height,b[C].line,b[C].measureNumber,t,l,u);l=E.isTiedState,u=E.nextIsBar,h+=E.duration;var D;if(T.duration>0&&o[`event`+g]&&(D=`event`+g),g=Math.round(h*1e3),T.type===`bar`){var O=T.abcelem.type,k=O===`bar_right_repeat`||O===`bar_dbl_repeat`,A=T.abcelem.startEnding===`1`,j=O===`bar_left_repeat`||O===`bar_dbl_repeat`||O===`bar_right_repeat`;if(k){C>0&&(o[D].endX=T.x),y===-1&&(y=C);var M=0;S=-1;for(var N=_;N<y;N++){w=b[N].measureNumber,S!==w&&this.tempoLocations[w]&&(x=this.tempoLocations[w],t=r*this.getBeatLength()*x/60,S=w);var P=b[N].elem;E=this.addElementToEvents(o,P,g,b[N].top,b[N].height,b[N].line,b[N].measureNumber,t,l,u),l=E.isTiedState,u=E.nextIsBar,h+=E.duration,M=g,g=Math.round(h*1e3)}o[`event`+M]&&(o[`event`+M].endX=b[y].elem.x),u=!0,y=-1}A&&(y=C),j&&(_=C)}}p=Math.max(p,g)}return a=makeSortedArray(o),addVerticalInfo(a),addEndPoints(this.lines,a),a.push({type:`end`,milliseconds:p}),this.addUsefulCallbackInfo(a,x*r),a},this.addUsefulCallbackInfo=function(e,t){for(var n=this.millisecondsPerMeasure(t),r=0;r<e.length;r++){var a=e[r];a.millisecondsPerMeasure=n}};function skipTies(e,t){for(;t<e.length&&e[t].left===null;)t++;return e[t]}function addEndPoints(e,t){if(!(t.length<1)){for(var n=0;n<t.length-1;n++){var r=t[n],a=skipTies(t,n+1);if(r.left!==null){var o=a&&r.top===a.top?a.left:e[r.line].staffGroup.w;r.endX===void 0?r.endX=o:o>r.left&&(r.endX=Math.min(r.endX,o))}}var c=t[t.length-1];c.endX=e[c.line].staffGroup.w}}this.getBpm=function(e){var t;if(e||(e=this.metaText?this.metaText.tempo:null),e){t=e.bpm;var n=this.getBeatLength(),r=e.duration&&e.duration.length>0?e.duration[0]:n;t=t*r/n}if(!t){t=180;var a=this.getMeterFraction();a&&a.num!==3&&a.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 n=this.metaText?this.metaText.tempo:null,r=this.getBpm(n),a=1;e?n&&(a=e/r):e=r;var o=this.getBeatLength(),c=e/60,l=this.getBarLength()/o*t/c;l&&(l-=this.getPickupLength()/o/c);var u=o*c;return this.noteTimings=this.setupEvents(l,u,e,a),this.noteTimings.length>0?(this.totalTime=this.noteTimings[this.noteTimings.length-1].milliseconds/1e3,this.totalBeats=this.totalTime*c):(this.totalTime=void 0,this.totalBeats=void 0),this.noteTimings},this.setUpAudio=function(e){return e||(e={}),o(a(this,e),e,this.formatting.percmap,this.formatting.midi)},this.deline=function(e){return c(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:[]}};t.exports=Tune})),ga=__commonJSMin(((e,t)=>{var n=ra(),TuneBuilder=function(e){var t=this,r={},a=``;e.reset(),this.setVisualTranspose=function(t){t&&(e.visualTranspose=t)},this.cleanUp=function(t,r,a){closeLine(e),delete e.runningFonts,simplifyMetaText(e),e.metaText.tempo&&e.metaText.tempo.bpm&&!e.metaText.tempo.duration&&(e.metaText.tempo.duration=[e.getBeatLength()]);var o=!1,c,l,u;for(c=0;c<e.lines.length;c++)if(e.lines[c].staff!==void 0){var d=!1;for(l=0;l<e.lines[c].staff.length;l++)if(e.lines[c].staff[l]===void 0)o=!0,e.lines[c].staff[l]=null;else for(u=0;u<e.lines[c].staff[l].voices.length;u++)e.lines[c].staff[l].voices[u]===void 0?e.lines[c].staff[l].voices[u]=[]:containsNotes(e.lines[c].staff[l].voices[u])&&(d=!0);d||(e.lines[c]=null,o=!0)}if(o&&(e.lines=e.lines.filter(function(e){return!!e}),e.lines.forEach(function(e){e.staff&&(e.staff=e.staff.filter(function(e){return!!e}))})),t)for(;wrapMusicLines(e.lines,t););if(r){for(o=!1,c=0;c<e.lines.length;c++)if(e.lines[c].staff!==void 0)for(l=0;l<e.lines[c].staff.length;l++){var p=!1;for(u=0;u<e.lines[c].staff[l].voices.length;u++)containsNotesStrict(e.lines[c].staff[l].voices[u])&&(p=!0);p||(o=!0,e.lines[c].staff[l]=null)}o&&e.lines.forEach(function(e){e.staff&&(e.staff=e.staff.filter(function(e){return!!e}))})}for(fixTitles(e.lines),c=0;c<e.lines.length;c++)if(e.lines[c].staff)for(l=0;l<e.lines[c].staff.length;l++)delete e.lines[c].staff[l].workingClef;for(;resolveOverlays(e););for(var c=0;c<e.lines.length;c++){var m=e.lines[c].staff;if(m)for(e.staffNum=0;e.staffNum<m.length;e.staffNum++)for(m[e.staffNum].clef&&n.fixClef(m[e.staffNum].clef),e.voiceNum=0;e.voiceNum<m[e.staffNum].voices.length;e.voiceNum++){var h=m[e.staffNum].voices[e.voiceNum];cleanUpSlursInLine(h,e.staffNum,e.voiceNum,a);for(var g=0;g<h.length;g++)h[g].el_type===`clef`&&n.fixClef(h[g]);if(h.length>0&&h[h.length-1].barNumber){var _=getNextMusicLine(e.lines,c);_&&(_.staff[0].barNumber=h[h.length-1].barNumber),delete h[h.length-1].barNumber}}}return delete e.staffNum,delete e.voiceNum,delete e.lineNum,delete e.potentialStartBeam,delete e.potentialEndBeam,delete e.vskipPending,a},this.addTieToLastNote=function(t){var n=getLastNote(e);return n&&n.pitches&&n.pitches.length>0?(n.pitches[0].startTie={},t&&(n.pitches[0].startTie.style=`dotted`),!0):!1},this.appendElement=function(n,o,c,l){return l.el_type=n,o!==null&&(l.startChar=o),c!==null&&(l.endChar=c),n===`note`?getDuration(l)>=.25||l.force_end_beam_last&&e.potentialStartBeam!==void 0?endBeamLast(e):l.end_beam&&e.potentialStartBeam!==void 0?l.rest===void 0?endBeamHere(l,e):endBeamLast(e):l.rest===void 0&&(e.potentialStartBeam===void 0?l.end_beam||(e.potentialStartBeam=l,delete e.potentialEndBeam):e.potentialEndBeam=l):endBeamLast(e),delete l.end_beam,delete l.force_end_beam_last,l.rest&&l.rest.type===`invisible`&&delete l.decoration,e.lines.length<=e.lineNum||e.lines[e.lineNum].staff.length<=e.staffNum?!1:(pushNote(t,e,l,r,a),!0)},this.appendStartingElement=function(t,n,r,a){closeLine(e);var o;t===`key`&&(o=a.impliedNaturals,delete a.impliedNaturals,delete a.explicitAccidentals);var c=Object.assign({},a);if(e.lines[e.lineNum]){var l=e.lines[e.lineNum].staff;if(l){l.length<=e.staffNum&&(l[e.staffNum]={},l[e.staffNum].clef=Object.assign({},l[0].clef),l[e.staffNum].key=Object.assign({},l[0].key),l[0].meter&&(l[e.staffNum].meter=Object.assign({},l[0].meter)),l[e.staffNum].workingClef=Object.assign({},l[0].workingClef),l[e.staffNum].voices=[[]]),t===`clef`&&(l[e.staffNum].workingClef=c);for(var u=l[e.staffNum].voices[e.voiceNum],d=0;d<u.length;d++){if(u[d].el_type===`note`||u[d].el_type===`bar`){c.el_type=t,c.startChar=n,c.endChar=r,o&&(c.accidentals=o.concat(c.accidentals)),u.push(c);return}if(u[d].el_type===t){c.el_type=t,c.startChar=n,c.endChar=r,o&&(c.accidentals=o.concat(c.accidentals)),u[d]=c;return}}l[e.staffNum][t]=a}}},this.addSubtitle=function(t,n){pushLine(e,{subtitle:{text:t,startChar:n.startChar,endChar:n.endChar}})},this.addSpacing=function(t){e.vskipPending=t},this.addNewPage=function(t){pushLine(e,{newpage:t})},this.addSeparator=function(t,n,r,a){pushLine(e,{separator:{spaceAbove:Math.round(t),spaceBelow:Math.round(n),lineLength:Math.round(r),startChar:a.startChar,endChar:a.endChar}})},this.addText=function(t,n){pushLine(e,{text:{text:t,startChar:n.startChar,endChar:n.endChar}})},this.addCentered=function(t){pushLine(e,{text:[{text:t,center:!0}]})},this.changeVoiceScale=function(e){t.appendElement(`scale`,null,null,{size:e})},this.changeVoiceColor=function(e){t.appendElement(`color`,null,null,{color:e})},this.startNewLine=function(n){closeLine(e),n.currentVoiceName&&(a=n.currentVoiceName,r[n.currentVoiceName]=n),e.lines[e.lineNum]===void 0?createLine(t,e,n):e.lines[e.lineNum].staff===void 0?(e.lineNum++,this.startNewLine(n)):e.lines[e.lineNum].staff[e.staffNum]===void 0?createStaff(t,e,n):e.lines[e.lineNum].staff[e.staffNum].voices[e.voiceNum]===void 0?createVoice(t,e,n):containsNotes(e.lines[e.lineNum].staff[e.staffNum].voices[e.voiceNum])?(e.lineNum++,this.startNewLine(n)):n.part&&t.appendElement(`part`,n.part.startChar,n.part.endChar,{title:n.part.title})},this.setRunningFont=function(t,n){e.runningFonts[t]=n},this.setBarNumberImmediate=function(e){var t=this.getCurrentVoice();if(t&&t.length>0){var n=t[t.length-1];if(n.el_type===`bar`)n.barNumber!==void 0&&(n.barNumber=e);else return e-1}return e},this.hasBeginMusic=function(){for(var t=0;t<e.lines.length;t++)if(e.lines[t].staff)return!0;return!1},this.isFirstLine=function(t){for(var n=t-1;n>=0;n--)if(e.lines[n].staff!==void 0)return!1;return!0},this.getCurrentVoice=function(){var t=getPrevMusicLine(e.lines,e.lineNum);if(!t)return null;var n=t.staff[e.staffNum];return n?n.voices[e.voiceNum]===void 0?null:n.voices[e.voiceNum]:null},this.setCurrentVoice=function(t,n,r){e.staffNum=t,e.voiceNum=n,a=r;for(var o=0;o<e.lines.length;o++)if(e.lines[o].staff&&(e.lines[o].staff[t]===void 0||e.lines[o].staff[t].voices[n]===void 0||!containsNotes(e.lines[o].staff[t].voices[n])))return e.lineNum=o,!!(!e.lines[o].staff[t]||e.lines[o].staff[t].voices[n]);return e.lineNum=o,!1},this.addMetaText=function(t,n,r){e.metaText[t]===void 0?(e.metaText[t]=n,e.metaTextInfo[t]=r):(typeof e.metaText[t]==`string`&&typeof n==`string`?e.metaText[t]+=`
46
+ `+n:(e.metaText[t]===`string`&&(e.metaText[t]=[{text:e.metaText[t]}]),typeof n==`string`&&(n=[{text:n}]),e.metaText[t]=e.metaText[t].concat(n)),e.metaTextInfo[t].endChar=r.endChar)},this.addMetaTextArray=function(t,n,r){e.metaText[t]===void 0?(e.metaText[t]=[n],e.metaTextInfo[t]=r):(e.metaText[t].push(n),e.metaTextInfo[t].endChar=r.endChar)},this.addMetaTextObj=function(t,n,r){e.metaText[t]=n,e.metaTextInfo[t]=r}};function isArrayOfStrings(e){if(!e||typeof e==`string`)return!1;for(var t=0;t<e.length;t++)if(typeof e[t]!=`string`)return!1;return!0}function simplifyMetaText(e){isArrayOfStrings(e.metaText.notes)&&(e.metaText.notes=e.metaText.notes.join(`
47
+ `)),isArrayOfStrings(e.metaText.history)&&(e.metaText.history=e.metaText.history.join(`
48
+ `))}function resolveOverlays(e){for(var t=!1,n=[],r=0;r<e.lines.length;r++){var a=e.lines[r];if(a.staff)for(var o=0;o<a.staff.length;o++){for(var c=a.staff[o],l=[],u=0;u<c.voices.length;u++){var d=c.voices[u];l.push({hasOverlay:!1,voice:[],snip:[]}),n[r]=0;for(var p=0,m=!1,h=0,g=-1,_=0;_<d.length;_++){var y=d[_];if(y.el_type===`overlay`&&!m){t=!0,m=!0,g=_,l[u].hasOverlay=!0,h===0&&(h=n[r]);for(var b=0;b<r;b++)n[b]&&e.lines[b].staff&&c.voices.length>=e.lines[b].staff[0].voices.length&&e.lines[b].staff[0].voices.push([{el_type:`note`,duration:n[b],rest:{type:`invisible`},startChar:y.startChar,endChar:y.endChar}])}else y.el_type===`bar`?(m?(m=!1,l[u].snip.push({start:g,len:_-g}),l[u].voice.push(y)):(p>0&&l[u].voice.push({el_type:`note`,duration:p,rest:{type:`invisible`},startChar:y.startChar,endChar:y.endChar}),l[u].voice.push(y)),p=0):y.el_type===`note`?m?l[u].voice.push(y):(p+=y.duration,n[r]+=y.duration):(y.el_type===`scale`||y.el_type===`stem`||y.el_type===`overlay`||y.el_type===`style`||y.el_type===`transpose`||y.el_type===`color`)&&l[u].voice.push(y)}l[u].hasOverlay&&l[u].snip.length===0&&l[u].snip.push({start:g,len:d.length-g})}for(u=0;u<l.length;u++){var x=l[u];if(x.hasOverlay){x.voice.splice(0,0,{el_type:`stem`,direction:`down`}),c.voices.push(x.voice);for(var S=x.snip.length-1;S>=0;S--){var C=x.snip[S];c.voices[u].splice(C.start,C.len),c.voices[u].splice(C.start+1,0,{el_type:`stem`,direction:`auto`});var w=findLastBar(c.voices[u],C.start);c.voices[u].splice(w,0,{el_type:`stem`,direction:`up`})}for(S=0;S<c.voices[c.voices.length-1].length;S++){c.voices[c.voices.length-1][S]=Object.assign({},c.voices[c.voices.length-1][S]);var T=c.voices[c.voices.length-1][S];T.el_type===`bar`&&T.startEnding&&delete T.startEnding,T.el_type===`bar`&&T.endEnding&&delete T.endEnding}}}}}return t}function findLastBar(e,t){for(var n=t-1;n>0&&e[n].el_type!==`bar`;n--);return n}function fixTitles(e){for(var t=!0,n=0;n<e.length;n++){var r=e[n];if(r.staff){for(var a=0;a<r.staff.length;a++){var o=r.staff[a];if(o.title){for(var c=!1,l=0;l<o.title.length;l++)o.title[l]?(o.title[l]=t?o.title[l].name:o.title[l].subname,o.title[l]?c=!0:o.title[l]=``):o.title[l]=``;c||delete o.title}}t=!1}}}function cleanUpSlursInLine(e,t,n,r){r[t]||(r[t]=[]),r[t][n]||(r[t][n]=[]);for(var a,addEndSlur=function(e,o,c){if(r[t][n][c]===void 0){for(a=0;a<r[t][n].length;a++)if(r[t][n][a]!==void 0){c=a;break}if(r[t][n][c]===void 0){var l=c*100+1;e.endSlur.forEach(function(e){l===e&&--l}),r[t][n][c]=[l]}}for(var u,d=0;d<o;d++)u=r[t][n][c].pop(),e.endSlur.push(u);return r[t][n][c].length===0&&delete r[t][n][c],u},addStartSlur=function(e,a,o,c){e.startSlur=[],r[t][n][o]===void 0&&(r[t][n][o]=[]);for(var l=o*100+1,u=0;u<a;u++)c&&(c.forEach(function(e){l===e&&++l}),c.forEach(function(e){l===e&&++l}),c.forEach(function(e){l===e&&++l})),r[t][n][o].forEach(function(e){l===e&&++l}),r[t][n][o].forEach(function(e){l===e&&++l}),r[t][n][o].push(l),e.startSlur.push({label:l}),e.dottedSlur&&(e.startSlur[e.startSlur.length-1].style=`dotted`,delete e.dottedSlur),l++},o=0;o<e.length;o++){var c=e[o];if(c.el_type===`note`){if(c.gracenotes)for(var l=0;l<c.gracenotes.length;l++){if(c.gracenotes[l].endSlur){var u=c.gracenotes[l].endSlur;c.gracenotes[l].endSlur=[];for(var d=0;d<u;d++)addEndSlur(c.gracenotes[l],1,20)}c.gracenotes[l].startSlur&&(a=c.gracenotes[l].startSlur,addStartSlur(c.gracenotes[l],a,20))}if(c.endSlur&&(a=c.endSlur,c.endSlur=[],addEndSlur(c,a,0)),c.startSlur&&(a=c.startSlur,addStartSlur(c,a,0)),c.pitches){for(var p=[],m=0;m<c.pitches.length;m++)if(c.pitches[m].endSlur){var h=c.pitches[m].endSlur;c.pitches[m].endSlur=[];for(var g=0;g<h;g++){var _=addEndSlur(c.pitches[m],1,m+1);p.push(_)}}for(m=0;m<c.pitches.length;m++)c.pitches[m].startSlur&&(a=c.pitches[m].startSlur,addStartSlur(c.pitches[m],a,m+1,p));c.gracenotes&&c.pitches[0].endSlur&&c.pitches[0].endSlur[0]===100&&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],c.pitches[0].endSlur.length===1?delete c.pitches[0].endSlur:c.pitches[0].endSlur[0]===100?c.pitches[0].endSlur.shift():c.pitches[0].endSlur[c.pitches[0].endSlur.length-1]===100&&c.pitches[0].endSlur.pop(),r[t][n][1].length===1?delete r[t][n][1]:r[t][n][1].pop())}}}}function wrapMusicLines(e,t){for(i=0;i<e.length;i++)if(e[i].staff!==void 0)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(r[o].el_type===`bar`){if(a++,a>=t&&o<r.length-1){var c=getNextMusicLine(e,i);if(!c){var l=JSON.parse(JSON.stringify(e[i]));e.push(Object.assign({},l)),c=e[e.length-1];for(var u=0;u<c.staff.length;u++)for(var d=0;d<c.staff[u].voices.length;d++)c.staff[u].voices[d]=[]}var p=o+1,m=e[i].staff[s].voices[v].slice(p);return e[i].staff[s].voices[v]=e[i].staff[s].voices[v].slice(0,p),c.staff[s].voices[v]=n.concat(m.concat(c.staff[s].voices[v])),!0}}else r[o].duration||n.push(r[o])}return!1}function getPrevMusicLine(e,t){for(;t>=0;){if(e[t].staff)return e[t];t--}return null}function getNextMusicLine(e,t){for(t++;e.length>t;){if(e[t].staff)return e[t];t++}return null}function getLastNote(e){if(!e.lines[e.lineNum]||!e.lines[e.lineNum].staff||!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 n=t.length-1;n>=0;n--){var r=t[n];if(r.el_type===`note`)return r}return null}function getDuration(e){return e.duration?e.duration:0}function closeLine(e){e.potentialStartBeam&&e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function containsNotes(e){for(var t=0;t<e.length;t++)if(e[t].el_type===`note`||e[t].el_type===`bar`)return!0;return!1}function containsNotesStrict(e){for(var t=0;t<e.length;t++)if(e[t].el_type===`note`&&(e[t].rest===void 0||e[t].chord!==void 0))return!0;return!1}function pushLine(e,t){e.vskipPending&&(t.vskip=e.vskipPending,delete e.vskipPending),e.lines.push(t)}function pushNote(e,t,n,r,a){var o=t.lines[t.lineNum].staff[t.staffNum];if(n.pitches!==void 0){var c=o.workingClef.verticalPos;n.pitches.forEach(function(e){e.verticalPos=e.pitch-c})}if(n.gracenotes!==void 0){var l=o.workingClef.verticalPos;n.gracenotes.forEach(function(e){e.verticalPos=e.pitch-l})}o.voices.length<=t.voiceNum&&(r[a]||(r[a]={}),createVoice(e,t,r[a])),o.voices[t.voiceNum].push(n)}function endBeamHere(e,t){t.potentialStartBeam.startBeam=!0,e.endBeam=!0,delete t.potentialStartBeam,delete t.potentialEndBeam}function endBeamLast(e){e.potentialStartBeam!==void 0&&e.potentialEndBeam!==void 0&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function setLineFont(e,t,n){if(e.runningFonts[t]){for(var r=!1,a=Object.keys(n),o=0;o<a.length;o++)e.runningFonts[t][a[o]]!==n[a[o]]&&(r=!0);r&&(e.lines[e.lineNum].staff[e.staffNum][t]=n)}e.runningFonts[t]=n}function createVoice(e,t,n){var r=t.lines[t.lineNum].staff[t.staffNum];if(r.voices[t.voiceNum]=[],r.title||(r.title=[]),r.title[t.voiceNum]={name:n.name,subname:n.subname},n.style&&e.appendElement(`style`,null,null,{head:n.style}),n.stem)e.appendElement(`stem`,null,null,{direction:n.stem});else if(t.voiceNum>0){if(r.voices[0]!==void 0){for(var a=!1,o=0;o<r.voices[0].length;o++)r.voices[0].el_type===`stem`&&(a=!0);a||r.voices[0].splice(0,0,{el_type:`stem`,direction:`up`})}e.appendElement(`stem`,null,null,{direction:`down`})}n.scale&&e.appendElement(`scale`,null,null,{size:n.scale}),n.color&&e.appendElement(`color`,null,null,{color:n.color})}function createStaff(e,t,n){n.key&&n.key.impliedNaturals&&(n.key.accidentals=n.key.accidentals.concat(n.key.impliedNaturals),delete n.key.impliedNaturals),t.lines[t.lineNum].staff[t.staffNum]={voices:[],clef:n.clef,key:n.key,workingClef:n.clef};var r=t.lines[t.lineNum].staff[t.staffNum];n.stafflines!==void 0&&(r.clef.stafflines=n.stafflines,r.workingClef.stafflines=n.stafflines),n.staffscale&&(r.staffscale=n.staffscale),n.annotationfont&&setLineFont(t,`annotationfont`,n.annotationfont),n.gchordfont&&setLineFont(t,`gchordfont`,n.gchordfont),n.tripletfont&&setLineFont(t,`tripletfont`,n.tripletfont),n.vocalfont&&setLineFont(t,`vocalfont`,n.vocalfont),n.bracket&&(r.bracket=n.bracket),n.brace&&(r.brace=n.brace),n.connectBarLines&&(r.connectBarLines=n.connectBarLines),n.barNumber&&(r.barNumber=n.barNumber),createVoice(e,t,n),n.part&&e.appendElement(`part`,n.part.startChar,n.part.endChar,{title:n.part.title}),n.meter!==void 0&&(r.meter=n.meter),t.vskipPending&&(t.lines[t.lineNum].vskip=t.vskipPending,delete t.vskipPending)}function createLine(e,t,n){t.lines[t.lineNum]={staff:[]},createStaff(e,t,n)}t.exports=TuneBuilder})),_a=__commonJSMin(((e,t)=>{var n=Xi(),r=Zi(),a=ia(),o=oa(),c=sa(),l=ca(),u=ha(),d=ga(),Parse=function(){var e=new u,t=new d(e),p,m=``,h=``;this.getTune=function(){var t={formatting:e.formatting,lines:e.lines,media:e.media,metaText:e.metaText,metaTextInfo:e.metaTextInfo,version:e.version,addElementToEvents:e.addElementToEvents,addUsefulCallbackInfo:e.addUsefulCallbackInfo,getTotalTime:e.getTotalTime,getTotalBeats:e.getTotalBeats,getBarLength:e.getBarLength,getBeatLength:e.getBeatLength,getBeatsPerMeasure:e.getBeatsPerMeasure,getBpm:e.getBpm,getMeter:e.getMeter,getMeterFraction:e.getMeterFraction,getPickupLength:e.getPickupLength,getKeySignature:e.getKeySignature,getElementFromChar:e.getElementFromChar,makeVoicesArray:e.makeVoicesArray,millisecondsPerMeasure:e.millisecondsPerMeasure,setupEvents:e.setupEvents,setTiming:e.setTiming,setUpAudio:e.setUpAudio,deline:e.deline,findSelectableElement:e.findSelectableElement,getSelectableArray:e.getSelectableArray};return e.lineBreaks&&(t.lineBreaks=e.lineBreaks),e.visualTranspose&&(t.visualTranspose=e.visualTranspose),t};function addPositioning(e,t,n){e.positioning||(e.positioning={}),e.positioning[t]=n}function addFont(e,t,n){e.fonts||(e.fonts={}),e.fonts[t]=n}var g={reset:function(){for(var e in this)this.hasOwnProperty(e)&&typeof this[e]!=`function`&&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,n){n===`note`?(this.vocalPosition!==`auto`&&addPositioning(e,`vocalPosition`,this.vocalPosition),this.dynamicPosition!==`auto`&&addPositioning(e,`dynamicPosition`,this.dynamicPosition),this.chordPosition!==`auto`&&addPositioning(e,`chordPosition`,this.chordPosition),this.ornamentPosition!==`auto`&&addPositioning(e,`ornamentPosition`,this.ornamentPosition),this.volumePosition!==`auto`&&addPositioning(e,`volumePosition`,this.volumePosition),this.differentFont(`annotationfont`,t)&&addFont(e,`annotationfont`,this.annotationfont),this.differentFont(`gchordfont`,t)&&addFont(e,`gchordfont`,this.gchordfont),this.differentFont(`vocalfont`,t)&&addFont(e,`vocalfont`,this.vocalfont),this.differentFont(`tripletfont`,t)&&addFont(e,`tripletfont`,this.tripletfont)):n===`bar`&&(this.dynamicPosition!==`auto`&&addPositioning(e,`dynamicPosition`,this.dynamicPosition),this.chordPosition!==`auto`&&addPositioning(e,`chordPosition`,this.chordPosition),this.ornamentPosition!==`auto`&&addPositioning(e,`ornamentPosition`,this.ornamentPosition),this.volumePosition!==`auto`&&addPositioning(e,`volumePosition`,this.volumePosition),this.differentFont(`measurefont`,t)&&addFont(e,`measurefont`,this.measurefont),this.differentFont(`repeatfont`,t)&&addFont(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 n in this.inTieChord)this.inTieChord.hasOwnProperty(n)&&(this.endingHoldOver.inTieChord[n]=this.inTieChord[n])},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 n in this.endingHoldOver.inTieChord)this.endingHoldOver.inTieChord.hasOwnProperty(n)&&(this.inTieChord[n]=this.endingHoldOver.inTieChord[n])}}},addWarning=function(e){g.warnings||(g.warnings=[]),g.warnings.push(e)},addWarningObject=function(e){g.warningObjects||(g.warningObjects=[]),g.warningObjects.push(e)},encode=function(e){var t=e.replace(/\x12/g,` `);return t=t.replace(/&/g,`&amp;`),t=t.replace(/</g,`&lt;`),t.replace(/>/g,`&gt;`)},warn=function(e,t,n){t||(t=` `);var r=t[n];(r===` `||!r)&&(r=`SPACE`);var a=encode(t.substring(n-64,n))+`<span style="text-decoration:underline;font-size:1.3em;font-weight:bold;">`+r+`</span>`+encode(t.substring(n+1).substring(0,64));addWarning(`Music Line:`+p.lineIndex+`:`+(n+1)+`: `+e+`: `+a),addWarningObject({message:e,line:t,startChar:g.iChar+n,column:n})},_,y;this.getWarnings=function(){return g.warnings},this.getWarningObjects=function(){return g.warningObjects};var addWords=function(e,t){if(t.indexOf(``)>=0){m+=t;return}if(t=m+t,m=``,!e){warn(`Can't add words before the first line of music`,e,0);return}t=n.strip(t),t[t.length-1]!==`-`&&(t+=` `);for(var r=[],a=0,o=!1,addWord=function(e){var c=n.strip(t.substring(a,e));if(c=c.replace(/\\([-_*|~])/g,`$1`),a=e+1,c.length>0){o&&(c=c.replace(/~/g,` `));var l=t[e];return l!==`_`&&l!==`-`&&(l=` `),r.push({syllable:p.translateString(c),divider:l}),o=!1,!0}return!1},c=!1,l=0;l<t.length;l++){switch(t[l]){case` `:case``:addWord(l);break;case`-`:!c&&!addWord(l)&&r.length>0&&(n.last(r).divider=`-`,r.push({skip:!0,to:`next`}));break;case`_`:c||(addWord(l),r.push({skip:!0,to:`slur`}));break;case`*`:c||(addWord(l),r.push({skip:!0,to:`next`}));break;case`|`:c||(addWord(l),r.push({skip:!0,to:`bar`}));break;case`~`:c||(o=!0);break}c=t[l]===`\\`}var u=!1;e.forEach(function(e){if(r.length!==0){if(r[0].skip){switch(r[0].to){case`next`:e.el_type===`note`&&e.pitches!==null&&!u&&r.shift();break;case`slur`:e.el_type===`note`&&e.pitches!==null&&r.shift();break;case`bar`:e.el_type===`bar`&&r.shift();break}e.el_type!==`bar`&&(e.lyric===void 0?e.lyric=[{syllable:``,divider:` `}]:e.lyric.push({syllable:``,divider:` `}))}else if(e.el_type===`note`&&e.rest===void 0&&!u){var t=r.shift();t.syllable&&(t.syllable=t.syllable.replace(/ +/g,`\xA0`)),e.lyric===void 0?e.lyric=[t]:e.lyric.push(t)}}})},addSymbols=function(e,t){if(t.indexOf(``)>=0){h+=t;return}if(t=h+t,h=``,!e){warn(`Can't add symbols before the first line of music`,e,0);return}t=n.strip(t),t[t.length-1]!==`-`&&(t+=` `);for(var r=[],a=0,o=!1,addWord=function(e){var c=n.strip(t.substring(a,e));if(a=e+1,c.length>0){o&&(c=c.replace(/~/g,` `));var l=t[e];return l!==`_`&&l!==`-`&&(l=` `),r.push({syllable:p.translateString(c),divider:l}),o=!1,!0}return!1},c=0;c<t.length;c++)switch(t[c]){case` `:case``:addWord(c);break;case`-`:!addWord(c)&&r.length>0&&(n.last(r).divider=`-`,r.push({skip:!0,to:`next`}));break;case`_`:addWord(c),r.push({skip:!0,to:`slur`});break;case`*`:addWord(c),r.push({skip:!0,to:`next`});break;case`|`:addWord(c),r.push({skip:!0,to:`bar`});break;case`~`:o=!0;break}var l=!1;e.forEach(function(e){if(r.length!==0){if(r[0].skip)switch(r[0].to){case`next`:e.el_type===`note`&&e.pitches!==null&&!l&&r.shift();break;case`slur`:e.el_type===`note`&&e.pitches!==null&&r.shift();break;case`bar`:e.el_type===`bar`&&r.shift();break}else if(e.el_type===`note`&&e.rest===void 0&&!l){var t=r.shift();e.lyric===void 0?e.lyric=[t]:e.lyric.push(t)}}})},parseLine=function(e){if(n.startsWith(e,`%%`)){var a=r.addDirective(e.substring(2));a&&warn(a,e,2);return}var o=e.indexOf(`%`);if(o>=0&&(e=e.substring(0,o)),e=e.replace(/\s+$/,``),e.length!==0){if(m){addWords(t.getCurrentVoice(),e.substring(2));return}if(h){addSymbols(t.getCurrentVoice(),e.substring(2));return}if(e.length<2||e[1]!==`:`||y.lineContinuation){y.parseMusic(e);return}var c=_.parseHeader(e);c.regular&&y.parseMusic(e),c.newline&&y.startNewLine(),c.words&&addWords(t.getCurrentVoice(),e.substring(2)),c.symbols&&addSymbols(t.getCurrentVoice(),e.substring(2))}};function appendLastMeasure(e,t){e.push({el_type:`hint`});for(var n=0;n<t.length;n++){var r=t[n],a=Object.assign({},r);if(e.push(a),r.el_type===`bar`)return}}function addHintMeasure(e,t){for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(a)for(var o=0;o<a.voices.length;o++){var c=a.voices[o],l=r.voices[o];l&&appendLastMeasure(l,c)}}}function addHintMeasures(){for(var t=0;t<e.lines.length;t++){var n=e.lines[t].staff;if(n){for(var r=t+1;r<e.lines.length&&e.lines[r].staff===void 0;)r++;if(r<e.lines.length){var a=e.lines[r].staff;addHintMeasure(n,a)}}}}this.parse=function(u,d,b){d||(d={}),b||(b=0),e.reset(),u=u.replace(/\r\n?/g,`
49
+ `)+`
50
+ `;var x=u.split(`
51
+ \\`);if(x.length>1){for(var S=1;S<x.length;S++)for(;x[S].length>0&&x[S][0]!==`
52
+ `;)x[S]=x[S].substr(1),x[S-1]+=` `;u=x.join(` `)}u=u.replace(/\\([ \t]*)(%.*)*\n/g,function(e,t,n){var r=n?Array(n.length+1).join(` `):``;return t+``+r+`
53
+ `});var C=u.split(`
54
+ `);n.last(C).length===0&&C.pop(),p=new c(C,g),_=new a(p,warn,g,e,t),y=new o(p,warn,g,e,t,_),d.print&&(e.media=`print`),g.reset(),g.iChar=b,d.visualTranspose?(g.globalTranspose=parseInt(d.visualTranspose),g.globalTranspose===0?g.globalTranspose=void 0:t.setVisualTranspose(d.visualTranspose)):g.globalTranspose=void 0,d.lineBreaks&&(g.lineBreaks=d.lineBreaks),_.reset(p,warn,g,e);try{d.format&&r.globalFormatting(d.format);for(var w=p.nextLine();w;){if(d.header_only&&g.is_in_header===!1||d.stop_on_warning&&g.warnings)throw`normal_abort`;var T=g.is_in_header;parseLine(w),T&&!g.is_in_header&&(t.setRunningFont(`annotationfont`,g.annotationfont),t.setRunningFont(`gchordfont`,g.gchordfont),t.setRunningFont(`tripletfont`,g.tripletfont),t.setRunningFont(`vocalfont`,g.vocalfont)),w=p.nextLine()}m&&addWords(t.getCurrentVoice(),``),h&&addSymbols(t.getCurrentVoice(),``),g.openSlurs=t.cleanUp(g.barsperstaff,g.staffnonote,g.openSlurs)}catch(e){if(e!==`normal_abort`)throw e}var E=792,D=8.5*72;switch(g.papersize){case`legal`:E=1008,D=8.5*72;break;case`A4`:E=11.7*72,D=8.3*72;break}if(g.landscape){var O=E;E=D,D=O}e.formatting.pagewidth||(e.formatting.pagewidth=D),e.formatting.pageheight||(e.formatting.pageheight=E),d.hint_measures&&addHintMeasures(),l.wrapLines(e,g.lineBreaks,g.barNumbers)}};t.exports=Parse})),va=__commonJSMin(((e,t)=>{var n=Xi(),bookParser=function(e){var t=``,r=e.match(/(\s*)/);e=n.strip(e);for(var a=e.split(`
55
+ X:`),o=1;o<a.length;o++)a[o]=`X:`+a[o];var c=r?r[0].length:0,l=[];a.forEach(function(e){l.push({abc:e,startPos:c}),c+=e.length+1}),l.length>1&&!n.startsWith(l[0].abc,`X:`)&&l.shift().abc.split(`
56
+ `).forEach(function(e){n.startsWith(e,`%%`)&&(t+=e+`
57
+ `)});var u=t;return l.forEach(function(e){var r=e.abc.indexOf(`
58
+
59
+ `);r>0&&(e.abc=e.abc.substring(0,r)),e.pure=e.abc,e.abc=t+e.abc,e.title=``;var a=e.pure.split(`T:`);a.length>1&&(a=a[1].split(`
60
+ `),e.title=n.strip(a[0]));var o=e.pure.substring(2,e.pure.indexOf(`
61
+ `));e.id=n.strip(o)}),{header:u,tunes:l}};t.exports=bookParser})),ya=__commonJSMin(((e,t)=>{function StringTablature(e,t){this.numLines=e,this.lineSpace=t,this.verticalSize=this.numLines*this.lineSpace,this.bar={pitch:3,pitch2:t*e,height:5}}StringTablature.prototype.bypass=function(e){var t=e.staffGroup.voices;return!!(t.length>0&&t[0].isPercussion)},StringTablature.prototype.setRelative=function(e,t,n){switch(e.type){case`bar`:t.pitch=this.bar.pitch,t.pitch2=this.bar.pitch2,t.height=this.height;break;case`symbol`:var r=this.bar.pitch2/2;if(e.name==`dots.dot`)return n?(t.pitch=r,!1):(t.pitch=r+this.lineSpace,!0);break}return n},t.exports=StringTablature})),ba=__commonJSMin(((e,t)=>{var n=function VoiceElement(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}};n.prototype.addChild=function(e){if(e.type===`bar`){for(var t=!0,n=0;t&&n<this.children.length;n++)this.children[n].type.indexOf(`staff-extra`)<0&&this.children[n].type!==`tempo`&&(t=!1);t||(this.beams.push(`bar`),this.otherchildren.push(`bar`))}this.children[this.children.length]=e,this.setRange(e)},n.prototype.setLimit=function(e,t){var n=t.specialY;n||(n=t),n[e]&&(this.specialY[e]?this.specialY[e]=Math.max(this.specialY[e],n[e]):this.specialY[e]=n[e])},n.prototype.adjustRange=function(e){e.bottom!==void 0&&(this.bottom=Math.min(this.bottom,e.bottom)),e.top!==void 0&&(this.top=Math.max(this.top,e.top))},n.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)},n.prototype.addOther=function(e){this.otherchildren.push(e),this.setRange(e)},n.prototype.addBeam=function(e){this.beams.push(e)},n.prototype.setWidth=function(e){this.w=e},t.exports=n})),xa=__commonJSMin(((e,t)=>{var setClass=function(e,t,n,r){if(e)for(var a=0;a<e.length;a++){var o=e[a],c=o.getAttribute(`highlight`);c||(c=`fill`),o.setAttribute(c,r);var l=o.getAttribute(`class`);l||(l=``),l=l.replace(n,``),l=l.replace(t,``),t.length>0&&(l.length>0&&l[l.length-1]!==` `&&(l+=` `),l+=t),o.setAttribute(`class`,l)}};t.exports=setClass})),Sa=__commonJSMin(((e,t)=>{var n=xa(),highlight=function(e,t){e===void 0&&(e=`abcjs-note_selected`),t===void 0&&(t=`#ff0000`),n(this.elemset,e,``,t)};t.exports=highlight})),Ca=__commonJSMin(((e,t)=>{var n=xa(),unhighlight=function(e,t){e===void 0&&(e=`abcjs-note_selected`),t===void 0&&(t=`#000000`),n(this.elemset,``,e,t)};t.exports=unhighlight})),wa=__commonJSMin(((e,t)=>{var n=Sa(),r=Ca(),a=function AbsoluteElement(e,t,n,r,a,o){o||(o={}),this.tuneNumber=a,this.abcelem=e,this.duration=t,this.durationClass=o.durationClassOveride?o.durationClassOveride:this.duration,this.minspacing=n||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=r,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}};a.prototype.getFixedCoords=function(){return{x:this.x,w:this.fixed.w,t:this.fixed.t,b:this.fixed.b}},a.prototype.addExtra=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),this.fixed.t===void 0?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top),this.fixed.b===void 0?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)},a.prototype.addHead=function(e){e.dx<this.extraw&&(this.extraw=e.dx),this.heads[this.heads.length]=e,this.addRight(e)},a.prototype.addRight=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),e.top!==void 0&&(this.fixed.t===void 0?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top)),e.bottom!==void 0&&(this.fixed.b===void 0?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)},a.prototype.addFixed=function(e){this._addChild(e)},a.prototype.addFixedX=function(e){this._addChild(e)},a.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)},a.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])},a.prototype._addChild=function(e){var t=!0;this.abcelem.el_type==`clef`&&e.type==`barNumber`&&(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)},a.prototype.pushTop=function(e){e!==void 0&&(this.top===void 0?this.top=e:this.top=Math.max(e,this.top))},a.prototype.pushBottom=function(e){e!==void 0&&(this.bottom===void 0?this.bottom=e:this.bottom=Math.min(e,this.bottom))},a.prototype.setX=function(e){this.x=e;for(var t=0;t<this.children.length;t++)this.children[t].setX(e)},a.prototype.center=function(e,t){this.x=(t.x-e.x)/2+e.x-this.w/2;for(var n=0;n<this.children.length;n++)this.children[n].setX(this.x)},a.prototype.setHint=function(){this.hint=!0},a.prototype.highlight=function(e,t){n.bind(this)(e,t)},a.prototype.unhighlight=function(e,t){r.bind(this)(e,t)},t.exports=a})),Ta=__commonJSMin(((e,t)=>{var n=function RelativeElement(e,t,n,r,a){switch(a||(a={}),this.x=0,this.c=e,this.dx=t,this.w=n,this.pitch=r,this.scalex=a.scalex||1,this.scaley=a.scaley||1,this.type=a.type||`symbol`,this.pitch2=a.pitch2,this.linewidth=a.linewidth,this.klass=a.klass,this.anchor=a.anchor?a.anchor:`middle`,this.top=r,this.pitch2!==void 0&&this.pitch2>this.top&&(this.top=this.pitch2),this.bottom=r,this.pitch2!==void 0&&this.pitch2<this.bottom&&(this.bottom=this.pitch2),a.thickness&&(this.top+=a.thickness/2,this.bottom-=a.thickness/2),a.stemHeight&&(a.stemHeight>0?this.top+=a.stemHeight:this.bottom+=a.stemHeight),a.dim&&(this.dim=a.dim),a.position&&(this.position=a.position),this.height=a.height?a.height:4,a.top&&(this.top=a.top),a.bottom&&(this.bottom=a.bottom),a.name?this.name=a.name:this.c?this.name=this.c:this.name=this.type,a.realWidth?this.realWidth=a.realWidth:this.realWidth=this.w,this.centerVertically=!1,this.type){case`debug`:this.chordHeightAbove=this.height;break;case`lyric`:a.position&&a.position===`below`?this.lyricHeightBelow=this.height:this.lyricHeightAbove=this.height;break;case`chord`:a.position&&a.position===`below`?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height;break;case`text`:this.pitch===void 0?a.position&&a.position===`below`?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height:this.centerVertically=!0;break;case`part`:this.partHeightAbove=this.height;break}};n.prototype.getChordDim=function(){if(this.type===`debug`||!this.chordHeightAbove&&!this.chordHeightBelow)return null;var e=0,t=this.type===`chord`?this.realWidth/2:0,n=this.x-t-e;return{left:n,right:n+this.realWidth+e}},n.prototype.invertLane=function(e){this.lane===void 0&&(this.lane=0),this.lane=e-this.lane-1},n.prototype.putChordInLane=function(e){this.lane=e,this.chordHeightAbove?this.chordHeightAbove=this.height*1.25*this.lane:this.chordHeightBelow=this.height*1.25*this.lane},n.prototype.getLane=function(){return this.lane===void 0?0:this.lane},n.prototype.setX=function(e){this.x=e+this.dx},t.exports=n})),Ea=__commonJSMin(((e,t)=>{var n=wa(),r=Ta();function isObject(e){return e!=null&&e.constructor===Object}function cloneObject(e,t){for(var n in t)t.hasOwnProperty(n)&&(Array.isArray(t[n])||isObject(t[n])||(e[n]=t[n]))}function cloneAbsolute(e){var t=new n(``,0,0,``,0);return cloneObject(t,e),t.top=0,t.bottom=-1,e.abcelem&&(t.abcelem={},cloneObject(t.abcelem,e.abcelem),t.abcelem.el_type===`note`&&(t.abcelem.el_type=`tabNumber`)),e.cloned=t,t}function cloneAbsoluteAndRelatives(e,t){var n=cloneAbsolute(e);if(t)for(var a=e.children,o=!0,c=0;c<a.length;c++){var l=a[c],u=new r(``,0,0,0,``);cloneObject(u,l),o=t.tablature.setRelative(l,u,o),n.children.push(u)}return n}function buildTabAbsolute(e,t,a){var o=`tab.tiny`,c=7.5;e.isTabBig&&(o=`tab.big`,c=10);var l={el_type:`tab`,icon:o,Ypos:c};if(c+=e.tabSymbolOffset,!e.hideTabSymbol){var u=new n(l,0,0,`symbol`,0);u.x=t;var d=new r(o,0,0,7.5,`tab`);d.x=a,u.children.push(d),u.abcelem.el_type==`tab`&&(d.pitch=c)}return u}function lyricsDim(e){if(e.extra)for(var t=0;t<e.extra.length;t++){var n=e.extra[t];if(n.type==`lyric`)return{bottom:n.bottom,height:n.height}}return null}function TabAbsoluteElements(){this.accidentals=null}function getInitialStaffSize(e){for(var t=0,n=0;n<e.length;n++)e[n].tabNameInfos||t++;return t}function buildRelativeTabNote(e,t,n,a,o){var c=a.num;a.note.quarter!=null&&(c=c.toString(),c+=a.note.quarter);var l=e.semantics.stringToPitch(a.str);n.notes.push({num:c,str:a.str,pitch:a.note.emit()});var u=new r(c,0,0,l+.3,{type:`tabNumber`});return u.x=t,u.isGrace=o,u.isAltered=a.note.isAltered,u}function getXGrace(e,t){var n=0;if(e.extra){for(var r=0;r<e.extra.length;r++)if(e.extra[r].c.indexOf(`noteheads`)>=0){if(n===t)return e.extra[r].x+e.extra[r].w/2;n++}}return-1}function graceInRest(e){if(e.abcelem){var t=e.abcelem;if(t.rest)return t.gracenotes}return null}function convertToNumber(e,t,n){var r=e.semantics.notesToNumber(t,n);if(r.error)return e.setError(r.error),r;if(r.graces&&r.notes){var a=r.notes.length-1;r.notes[a].graces=r.graces}return r}function buildGraceRelativesForRest(e,t,n,r,a){for(var o=0;o<r.length;o++){var c={el_type:`note`,startChar:n.abcelem.startChar,endChar:n.abcelem.endChar,notes:[],grace:!0},l=getXGrace(n,o),u=r[o],d=buildRelativeTabNote(e,l,c,u,!0);t.children.push(d),a.push(c)}}TabAbsoluteElements.prototype.build=function(e,t,n,r,a,o,c){getInitialStaffSize(t);var l=t[a+r],u=t[c],d=null,p=null;l.children[0].abcelem.el_type!=`clef`&&o!=`none`&&l.children.splice(0,0,o);for(var m=0;m<l.children.length;m++){var h=l.children[m],g=h.x,_=g;switch(h.isClef&&(u.children.push(buildTabAbsolute(e,g,_)),h.abcelem.type.indexOf(`-8`)>=0&&(e.semantics.clefTranspose=-12),h.abcelem.type.indexOf(`+8`)>=0&&(e.semantics.clefTranspose=12)),h.type){case`staff-extra key-signature`:this.accidentals=h.abcelem.accidentals,e.semantics.accidentals=this.accidentals;break;case`bar`:e.semantics.measureAccidentals={};var y=!1;m===l.children.length-1&&(y=!0);var b=cloneAbsoluteAndRelatives(h,e);if(b.abcelem.barNumber){delete b.abcelem.barNumber;for(var x=0;x<b.children.length;x++)if(b.children[x].type===`barNumber`){b.children.splice(x,1);break}}b.abcelem.lastBar=y,u.children.push(b),n.push({el_type:h.abcelem.el_type,type:h.abcelem.type,endChar:h.abcelem.endChar,startChar:h.abcelem.startChar,abselem:b});break;case`rest`:var S=graceInRest(h);if(S){if(d=convertToNumber(e,null,S),d.error)return;A={el_type:`note`,startChar:h.abcelem.startChar,endChar:h.abcelem.endChar,notes:[],grace:!0},buildGraceRelativesForRest(e,C,h,d.graces,n)}break;case`note`:var C=cloneAbsolute(h);C.x=h.heads[0].x+h.heads[0].w/2,C.lyricDim=lyricsDim(h);var w=h.abcelem.pitches,T=h.abcelem.gracenotes;if(C.type=`tabNumber`,d=convertToNumber(e,w,T),d.error)return;if(d.graces){var E=d.notes.length-1;d.notes[E].graces=d.graces}p={el_type:`note`,startChar:h.abcelem.startChar,endChar:h.abcelem.endChar,notes:[]};for(var D=0;D<d.notes.length;D++){var O=d.notes[D];if(O.graces)for(var k=0;k<O.graces.length;k++){var A={el_type:`note`,startChar:h.abcelem.startChar,endChar:h.abcelem.endChar,notes:[],grace:!0},j=getXGrace(h,k),M=O.graces[k],N=buildRelativeTabNote(e,j,A,M,!0);C.children.push(N),n.push(A)}var P=buildRelativeTabNote(e,C.x+h.heads[D].dx,p,O,!1);C.children.push(P)}p.notes.length>0&&(p.abselem=C,n.push(p),u.children.push(C));break}}},t.exports=TabAbsoluteElements})),Da=__commonJSMin(((e,t)=>{var n=ba(),r=Ea(),a=la();function initSpecialY(){return{tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}}function getLyricHeight(e){for(var t=0,n=0;n<e.children.length;n++){var r=e.children[n];r.specialY&&r.specialY.lyricHeightBelow>t&&(t=r.specialY.lyricHeightBelow)}return t}function buildTabName(e,t,n){var r=e.semantics,a=t.controller.getTextSize,o=r.tabInfos(e),c=r.suppress(e),l=!0;if(c&&(l=!1),l){var u=a.calc(o,`tablabelfont`,`text instrumentname`);return n.tabNameInfos={textSize:{height:u.height,width:u.width},name:o},u.height}return 0}function islastTabInStaff(e,t){return t[e].isTabStaff?e===t.length-1?!0:!t[e+1].isTabStaff:!1}function getStaffNumbers(e){for(var t=0,n=0;n<e.length;n++)e[n].isTabStaff||t++;return t}function getParentStaffIndex(e,t){for(var n=t;n>=0;n--)if(!e[n].isTabStaff)return n;return-1}function linkStaffAndTabs(e){for(var t=0;t<e.length;t++)if(e[t].isTabStaff){var n=getParentStaffIndex(e,t);e[t].hasStaff=e[n],e[n].hasTab||(e[n].hasTab=[]),e[n].hasTab.push(e[t])}}function isMultiVoiceSingleStaff(e,t){return getStaffNumbers(e)===1&&t.voices.length>1}function getNextTabPos(e,t){for(var n=0,r=0,a=!0,o=0;a;){if(!t[n])return-1;if(t[n].isTabStaff||(o=t[n].voices.length),t[n].isTabStaff){if(r++,islastTabInStaff(n,t)&&r<o)return n+1}else if(r=0,n>=e&&(n+1==t.length||!t[n+1].isTabStaff))return n+1;if(n++,n>t.length)return-1}}function getLastStaff(e,t){for(var n=t;n>=0;n--)if(!e[n].isTabStaff)return e[n];return null}function checkVoiceKeySig(e,t){return e[t].children[0].abcelem.el_type===`clef`?null:t==0?`none`:e[t-1].children[0]}function tabRenderer(e,t,o,c){var l=new r,u={clef:{type:`TAB`}},d=e.linePitch*e.nbLines,p=o.staff;if(p){var m=p[0];if(m&&m.clef&&m.clef.stafflines==0){e.setError(`No tablatures when stafflines=0`);return}p.splice(p.length,0,u)}var h=o.staffGroup,g=h.voices,_=g[0],y=getLyricHeight(_),b=3,x=c,S=h.staffs[x],C=d+b-S.bottom-y;S.isTabStaff&&(C=S.top);var w={bottom:-1,isTabStaff:!0,specialY:initSpecialY(),lines:e.nbLines,linePitch:e.linePitch,dy:.15,top:C},T=getNextTabPos(c,h.staffs);if(T!==-1){w.parentIndex=T-1,h.staffs.splice(T,0,w),h.height+=d+b;var E=getLastStaff(h.staffs,T),D=1;isMultiVoiceSingleStaff(h.staffs,E)&&(D=E.voices.length),u.voices=[];for(var O=0;O<D;O++){var k=new n(0,0);O>0&&(k.duplicate=!0);var A=buildTabName(e,t,k)/a.STEP;A=Math.max(A,1),h.staffs[c].top+=1,h.height+=A,k.staff=w;var j=g.length;g.splice(g.length,0,k);var M=checkVoiceKeySig(g,O+c);u.voices[O]=[],l.build(e,g,u.voices[O],O,c,M,j)}linkStaffAndTabs(h.staffs)}}t.exports=tabRenderer})),Oa=__commonJSMin(((e,t)=>{var n={__:-2,_:-1,"_/":-.5,"=":0,"":0,"^/":.5,"^":1,"^^":2},r=[`C`,`-`,`D`,`-`,`E`,`F`,`-`,`G`,`-`,`A`,`-`,`B`,`c`,`-`,`d`,`-`,`e`,`f`,`-`,`g`,`-`,`a`,`-`,`b`];function noteToMidi(e){var t=e.match(/([_^\/]*)([ABCDEFGabcdefg])(,*)('*)/);if(t&&t.length===5){var a=n[t[1]],o=r.indexOf(t[2]),c=t[4].length-t[3].length;return 48+o+a+c*12}return 0}function midiToNote(e){e=parseInt(e,10);var t=Math.floor(e/12),n=e%12,a=r[n];if(a===`-`&&(a=`^`+r[n-1]),t>4)for(a=a.toLowerCase(),t-=5;t>0;)a+=`'`,t--;else for(;t<4;)a+=`,`,t++;return a}t.exports={noteToMidi,midiToNote}})),ka=__commonJSMin(((e,t)=>{var{noteToMidi:n,midiToNote:r}=Oa();function TabNote(e,t){var a=n(e);t&&(a+=t);var o=r(a),c=!1,l=!1,u=!1,d=null,p=null,m=!1,h=0;e.startsWith(`_`)?(c=!0,h=-1,e[1]==`/`?(c=!1,p=`v`,h=0):e[1]==`_`&&(m=!0,--h)):e.startsWith(`^`)?(l=!0,h=1,e[1]==`/`?(l=!1,p=`^`,h=0):e[1]==`^`&&(m=!0,h+=1)):e.startsWith(`=`)&&(d=!0,h=0),u=c||l||p!=null,(u||d)&&(o=p!=null||m?e.slice(2):e.slice(1));var g=(o.match(/,/g)||[]).length,_=(o.match(/'/g)||[]).length;this.pitch=a,this.pitchAltered=0,this.name=o,this.acc=h,this.isSharp=l,this.isKeySharp=!1,this.isDouble=m,this.isAltered=u,this.isFlat=c,this.isKeyFlat=!1,this.natural=d,this.quarter=p,this.isLower=this.name==this.name.toLowerCase(),this.name=this.name[0].toUpperCase(),this.hasComma=g,this.isQuoted=_}function cloneNote(e){var t=e.name,n=new TabNote(t);return n.pitch=e.pitch,n.hasComma=e.hasComma,n.isLower=e.isLower,n.isQuoted=e.isQuoted,n.isSharp=e.isSharp,n.isKeySharp=e.isKeySharp,n.isFlat=e.isFlat,n.isKeyFlat=e.isKeyFlat,n}TabNote.prototype.sameNoteAs=function(e){return e.pitch===this.pitch},TabNote.prototype.isLowerThan=function(e){return e.pitch>this.pitch},TabNote.prototype.checkKeyAccidentals=function(e,t){if(!(this.isAltered||this.natural)){if(t[this.name.toUpperCase()])switch(t[this.name.toUpperCase()]){case`__`:this.acc=-2,this.pitchAltered=-2;return;case`_`:this.acc=-1,this.pitchAltered=-1;return;case`=`:this.acc=0,this.pitchAltered=0;return;case`^`:this.acc=1,this.pitchAltered=1;return;case`^^`:this.acc=2,this.pitchAltered=2;return}else if(e)for(var n=this.name,r=0;r<e.length;r++){var a=e[r];n==a.note.toUpperCase()&&(a.acc==`flat`&&(this.acc=-1,this.isKeyFlat=!0,this.pitchAltered=-1),a.acc==`sharp`&&(this.acc=1,this.isKeySharp=!0,this.pitchAltered=1))}}},TabNote.prototype.getAccidentalEquiv=function(){var e=cloneNote(this);return e.isSharp||e.isKeySharp?(e=e.nextNote(),e.isFlat=!0,e.isSharp=!1,e.isKeySharp=!1):(e.isFlat||e.isKeyFlat)&&(e=e.prevNote(),e.isSharp=!0,e.isFlat=!1,e.isKeyFlat=!1),e},TabNote.prototype.nextNote=function(){return new TabNote(r(this.pitch+1+this.pitchAltered))},TabNote.prototype.prevNote=function(){return new TabNote(r(this.pitch-1+this.pitchAltered))},TabNote.prototype.emitNoAccidentals=function(){var e=this.name;this.isLower&&(e=e.toLowerCase());for(var t=0;t<this.isQuoted;t++)e+=`'`;for(var n=0;n<this.hasComma;n++)e+=`,`;return e},TabNote.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 n=1;n<=this.isQuoted;n++)e+=`'`}return e},t.exports=TabNote})),Aa=__commonJSMin(((e,t)=>{var n=ka(),r=[`A`,`B`,`C`,`D`,`E`,`F`,`G`];function tabNotes(e,t){var a=new n(e),o=new n(t);if(o.isLowerThan(a)){var c=a.emit();return{error:`Invalid string Instrument tuning : `+o.emit()+` string lower than `+c+` string`}}var l=[],u=r.indexOf(a.name),d=r.indexOf(o.name);if(u==-1||d==-1)return l;for(var p=!1;!p;)l.push(a.emit()),a=a.nextNote(),a.sameNoteAs(o)&&(p=!0);return l}t.exports=tabNotes})),ja=__commonJSMin(((e,t)=>{var{noteToMidi:n}=Oa(),r=ka(),a=Aa();function buildCapo(e){var t=null,n=e.tuning;if(e.capo>0){t=[];for(var a=0;a<n.length;a++){for(var o=new r(n[a]),c=0;c<e.capo;c++)o=o.nextNote();t[a]=o.emit()}}return t}function buildPatterns(e){var t=[],n=e.tuning;e.capo>0&&(n=e.capoTuning);for(var r=n.length-1,o=0;o<n.length;o++){var c=e.highestNote;o!=n.length-1&&(c=n[o+1]);var l=a(n[o],c);if(l.error)return l;t[r--]=l}return t}function buildSecond(e){var t=[];t[0]=[];for(var n=e.strings,r=1;r<n.length;r++)t[r]=n[r-1];return t}function sameString(e,t){for(var n=0;n<t.length-1;n++){var r=t[n],a=t[n+1];if(r.str==a.str){if(r.str==e.strings.length-1){r.num=`?`,a.num=`?`;return}a.num<r.num?(a.str++,a=noteToNumber(e,a.note,a.str,e.secondPos,e.strings[a.str].length)):(r.str++,r=noteToNumber(e,r.note,r.str,e.secondPos,e.strings[r.str].length)),t[n]=r,t[n+1]=a}}return null}function handleChordNotes(e,t){for(var n=[],a=0;a<t.length;a++)if(!t[a].endTie){var o=new r(t[a].name,e.clefTranspose);o.checkKeyAccidentals(e.accidentals,e.measureAccidentals);var c=toNumber(e,o);n.push(c)}return sameString(e,n),n}function noteToNumber(e,t,n,r,a){var o=e.strings;t.checkKeyAccidentals(e.accidentals,e.measureAccidentals),r&&(o=r);var c=t.emitNoAccidentals(),l=o[n].indexOf(c),u=t.acc;if(l!=-1){if(r&&(l+=a),(t.isFlat||t.acc==-1)&&l==0){var d=t.getAccidentalEquiv();n++,l=o[n].indexOf(d.emit()),u=0}return{num:l+u,str:n,note:t}}return null}function toNumber(e,t){if(t.isAltered||t.natural){var n;t.isFlat?n=t.isDouble?`__`:`_`:t.isSharp?n=t.isDouble?`^^`:`^`:t.natural&&(n=`=`),e.measureAccidentals[t.name.toUpperCase()]=n}for(var r=e.stringPitches.length-1;r>=0;r--)if(t.pitch+t.pitchAltered>=e.stringPitches[r]){var a=t.pitch+t.pitchAltered-e.stringPitches[r];return t.quarter===`^`?a-=.5:t.quarter===`v`&&(a+=.5),{num:Math.round(a),str:e.stringPitches.length-1-r,note:t}}return{num:`?`,str:e.stringPitches.length-1,note:t}}StringPatterns.prototype.stringToPitch=function(e){return 5.3+(this.strings.length-1-e)*this.linePitch};function invalidNumber(e,t){var n={num:`?`,str:0,note:t};e.push(n),e.error=t.emit()+`: unexpected note for instrument`}StringPatterns.prototype.notesToNumber=function(e,t){var n,a,o=null,c=null;if(e&&(c=[],e.length>1?(c=handleChordNotes(this,e),c.error&&(o=c.error)):e[0].endTie||(n=new r(e[0].name,this.clefTranspose),n.checkKeyAccidentals(this.accidentals,this.measureAccidentals),a=toNumber(this,n),a?c.push(a):(invalidNumber(c,n),o=c.error))),o)return c;var l=null;if(t){l=[];for(var u=0;u<t.length;u++)n=new r(t[u].name,this.clefTranspose),n.checkKeyAccidentals(this.accidentals,this.measureAccidentals),a=toNumber(this,n),a?l.push(a):(invalidNumber(l,n),o=c.error)}return{notes:c,graces:l,error:o}},StringPatterns.prototype.toString=function(){for(var e=[],t=0;t<this.tuning.length;t++){var n=this.tuning[t].replaceAll(`,`,``).replaceAll(`'`,``).toUpperCase();n[0]===`_`?n=n[1]+`b `:n[0]===`^`&&(n=n[1]+`# `),e.push(n)}return e.join(``)},StringPatterns.prototype.tabInfos=function(e){var t=e.params.label;if(t){var n=t.indexOf(`%T`),r=``;return n!=-1&&(r=this.toString(),e.capo>0&&(r+=` capo:`+e.capo),t=t.replace(`%T`,r)),t}return``},StringPatterns.prototype.suppress=function(e){return!!e.params.suppress};function StringPatterns(e){var t=e.tuning,r=e.capo,a=e.params.highestNote;this.linePitch=e.linePitch,this.highestNote=`a'`,a&&(this.highestNote=a),this.measureAccidentals={},this.capo=0,r&&(this.capo=parseInt(r,10)),this.transpose=e.transpose?e.transpose:0,this.tuning=t,this.stringPitches=[];for(var o=0;o<this.tuning.length;o++){var c=n(this.tuning[o])+this.capo;this.stringPitches.push(c)}if(this.capo>0&&(this.capoTuning=buildCapo(this)),this.strings=buildPatterns(this),this.strings.error){e.setError(this.strings.error),e.inError=!0;return}this.secondPos=buildSecond(this)}t.exports=StringPatterns})),Ma=__commonJSMin(((e,t)=>{var n=ya(),r=Da(),a=ja();Plugin.prototype.init=function(e,t,r,o){this.tune=e,this.params=r,this.tuneNumber=t,this.inError=!1,this.abcTune=e,this.linePitch=3,this.nbLines=o.defaultTuning.length,this.isTabBig=o.isTabBig,this.tabSymbolOffset=o.tabSymbolOffset,this.capo=r.capo,this.transpose=r.visualTranspose,this.hideTabSymbol=r.hideTabSymbol,this.tablature=new n(this.nbLines,this.linePitch);var c=r.tuning;c||(c=o.defaultTuning),this.tuning=c,this.semantics=new a(this)},Plugin.prototype.setError=function(e){e&&(this.error=e,this.inError=!0,this.tune.warnings?this.tune.warnings.push(e):this.tune.warnings=[e])},Plugin.prototype.render=function(e,t,n){this.inError||this.tablature.bypass(t)||r(this,e,t,n)};function Plugin(){}var AbcStringTab=function(){return{name:`StringTab`,tablature:Plugin}};t.exports=AbcStringTab})),Na=__commonJSMin(((e,t)=>{var n=Ma(),r={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}};t.exports={inited:!1,plugins:{},register:function(e){var t=e.name,n=e.tablature;this.plugins[t]=n},setError:function(e,t){e.warnings?e.warning.push(t):e.warnings=[t]},preparePlugins:function(e,t,a){this.inited||(this.inited=(this.register(new n),!0));var o=null,c=0;if(a.tablature){var l=a.tablature;o=[];for(var u=0;u<l.length;u++){var d=l[u],p=d.instrument;if(p==null)return this.setError(e,`tablature 'instrument' is missing`),o;var m=r[p],h=null;if(m&&(h=this.plugins[m.name]),h){a.visualTranspose!=0&&(d.visualTranspose=a.visualTranspose),d.abcSrc=a.tablature.abcSrc;var g={classz:h,tuneNumber:t,params:d,instance:null,tabType:m};o.push(g),c++}else if(p===``)o.push(null);else return this.setError(e,`Undefined tablature plugin: `+p),o}}return o},layoutTablatures:function layoutTablatures(e,t){var n=t.tablatures,r=0;if(n&&n.length>0)for(var a=n.length,o=0;o<a;++o)n[o]&&n[o].params.firstStaffOnly&&(n[o].params.suppress=!1);for(var c=0;c<t.lines.length;c++){var l=t.lines[c];if(l.staff&&r++,r>1&&n&&n.length>0)for(var a=n.length,o=0;o<a;++o)n[o].params.firstStaffOnly&&(n[o].params.suppress=!0);var u=l.staff;if(u){for(var d=u.length,p=0;p<u.length;p++)if(n[p]&&p<d){var m=n[p];m.instance??(m.instance=new m.classz,m.instance.init(t,m.tuneNumber,m.params,m.tabType)),m.instance.render(e,l,p)}}}}}})),Pa=__commonJSMin(((e,t)=>{var n=_a(),r=va(),a=Na(),o={};(function(){o.numberOfTunes=function(e){var t=e.split(`
62
+ X:`).length;return t===0&&(t=1),t};var e=o.TuneBook=function(e){var t=r(e);this.header=t.header,this.tunes=t.tunes};e.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},e.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},o.parseOnly=function(e,t){for(var n=o.numberOfTunes(e),r=[],a=0;a<n;a++)r.push(1);function callback(){}return o.renderEngine(callback,r,e,t)},o.renderEngine=function(t,r,o,c){var l=[],isArray=function(e){return e&&!e.propertyIsEnumerable(`length`)&&typeof e==`object`&&typeof e.length==`number`};if(!(r===void 0||o===void 0)){isArray(r)||(r=[r]),c===void 0&&(c={});for(var u=c.startingTune?parseInt(c.startingTune,10):0,d=new e(o),p=new n,m=0;m<r.length;m++){var h,g=r[m];if(g===`*`||typeof g==`string`&&(g=document.getElementById(g)),g)if(u>=0&&u<d.tunes.length){p.parse(d.tunes[u].abc,c,d.tunes[u].startPos-d.header.length);var _=p.getTune();c.tablature&&(_.tablatures=a.preparePlugins(_,u,c));var y=p.getWarnings();y&&(_.warnings=y);var b=t(g,_,m,d.tunes[u].abc);l.push(b||_)}else (h=g).innerHTML&&(h.innerHTML=``);u++}return l}},o.extractMeasures=function(t){for(var n=[],r=new e(t),a=0;a<r.tunes.length;a++){for(var c=r.tunes[a],l=c.abc.split(`K:`),u=l[1].split(`
63
+ `),d=l[0]+`K:`+u[0]+`
64
+ `,p=null,m=null,h=null,g=[],_=!1,y=o.parseOnly(c.abc)[0],b=y.getPickupLength()>0,x=0;x<y.lines.length;x++){var S=y.lines[x];if(S.staff)for(var C=0;C<1;C++)for(var w=S.staff[C],T=0;T<1;T++)for(var E=w.voices[T],D=0;D<E.length;D++){var O=E[D];if(h===null&&O.startChar>=0&&(h=O.startChar,m=O.chord===void 0?p:null),O.chord&&(p=O),O.el_type===`bar`){if(_){var k={abc:c.abc.substring(h,O.endChar)};p=m&&m.chord&&m.chord.length>0?m.chord[0].name:null,p&&(k.lastChord=p),O.startEnding&&(k.startEnding=O.startEnding),O.endEnding&&(k.endEnding=O.endEnding),g.push(k),h=null,_=!1}}else O.el_type===`note`&&(_=!0)}}n.push({header:d,measures:g,hasPickup:b})}return n}})(),t.exports=o})),Fa=__commonJSMin(((e,t)=>{var n=ta(),{relativeMajor:r,transposeKey:a,relativeMode:o}=ea(),c=$i(),strTranspose;(function(){strTranspose=function(e,t,l){if(t===`TEST`)return{keyAccidentals:n,relativeMajor:r,transposeKey:a,relativeMode:o,transposeChordName:c};l=parseInt(l,10);var u=[],d;for(d=0;d<t.length;d++)u=u.concat(transposeOneTune(e,t[d],l));u=u.sort(function(e,t){return t.start-e.start});var p=e.split(``);for(d=0;d<u.length;d++){var m=u[d];p.splice(m.start,m.end-m.start,m.note)}return p.join(``)};function transposeOneTune(e,t,n){var r=[],a=t.getKeySignature();if(a.root===`Hp`||a.root===`HP`)return r;r=r.concat(changeAllKeySigs(e,n));for(var o=0;o<t.lines.length;o++){var c=t.lines[o].staff;if(c)for(var l=0;l<c.length;l++){var u=c[l];u.clef.type!==`perc`&&(r=r.concat(transposeVoices(e,u.voices,u.key,n)))}}return r}function changeAllKeySigs(e,t){for(var n=[],r=e.split(`K:`),a=r[0].length,o=1;o<r.length;o++){var c=r[o],l=c.match(/^( *)([A-G])([#b]?)(\w*)/);if(l){var u=a+2+l[1].length,d=l[2]+l[3]+l[4],p=newKey({root:l[2],acc:l[3],mode:l[4]},t),m=p.root+p.acc+p.mode;n.push({start:u,end:u+d.length,note:m})}a+=c.length+2}return n}function transposeVoices(e,t,n,r){for(var a=[],o=newKey(n,r),c=0;c<t.length;c++)a=a.concat(transposeVoice(e,t[c],n.root,createKeyAccidentals(n),o,r));return a}function createKeyAccidentals(e){for(var t={},n=0;n<e.accidentals.length;n++){var r=e.accidentals[n];r.acc===`flat`?t[r.note.toUpperCase()]=`_`:r.acc===`sharp`&&(t[r.note.toUpperCase()]=`^`)}return t}function setLetterDistance(t,n,r){var a=e.indexOf(t.root)-e.indexOf(n);return n===`none`&&(a=e.indexOf(t.root)),a===0?r>2?a+=7:r===-12&&(a-=7):r>0&&a<0?a+=7:r<0&&a>0&&(a-=7),r>12?a+=7:r<-12&&(a-=7),a}function transposeVoice(e,t,n,r,a,o){for(var l=[],u=setLetterDistance(a,n,o),d={},p={},m=0;m<t.length;m++){var h=t[m];if(h.chord)for(var g=0;g<h.chord.length;g++){var _=h.chord[g];if(_.position===`default`){var y=a.accidentals.length&&a.accidentals[0].acc===`flat`,b=c(_.name,o,y,!0);b=b.replace(/♭/g,`b`).replace(/♯/g,`#`),b!==_.name&&l.push(replaceChord(e,h.startChar,h.endChar,b))}}if(h.el_type===`note`&&h.pitches){for(var x=0;x<h.pitches.length;x++){var S=parseNote(h.pitches[x].name,n,r,d);S.acc&&(d[S.name.toUpperCase()]=S.acc);var C=transposePitch(S,a,u,p);C.acc&&(p[C.upper]=C.acc),l.push(replaceNote(e,h.startChar,h.endChar,C.acc+C.name,x))}if(h.gracenotes)for(var w=0;w<h.gracenotes.length;w++){var T=parseNote(h.gracenotes[w].name,n,r,d);T.acc&&(d[T.name.toUpperCase()]=T.acc);var E=transposePitch(T,a,u,d);E.acc&&(p[E.upper]=E.acc),l.push(replaceGrace(e,h.startChar,h.endChar,E.acc+E.name,w))}}else h.el_type===`bar`?(d={},p={}):h.el_type===`keySignature`&&(n=h.root,r=createKeyAccidentals(h),a=newKey(h,o),u=setLetterDistance(a,n,o))}return l}var e=`CDEFGAB`,t=[`,,,,`,`,,,`,`,,`,`,`,``,`'`,`''`,`'''`,`''''`];function newKey(e,t){if(e.root===`none`)return{root:a(`C`,t),mode:``,acc:``,accidentals:[]};var c=a(r(e.root+e.acc+e.mode),t),l=o(c,e.mode),u=n(c);return{root:l[0],mode:e.mode,acc:l.length>1?l[1]:``,accidentals:u}}function transposePitch(t,n,r,a){for(var o=t.pitch,c=e.indexOf(t.name),l=(e.indexOf(n.root)+o)%7,u=c+r,d=t.oct;u>6;)d++,u-=7;for(;u<0;)d--,u+=7;for(var p=e[l],m=``,h=t.adj,g=`=`,_=0;_<n.accidentals.length;_++)if(n.accidentals[_].note.toLowerCase()===p.toLowerCase()){h+=n.accidentals[_].acc===`flat`?-1:1,g=n.accidentals[_].acc===`flat`?`_`:`^`;break}switch(h){case-2:m=`__`;break;case-1:m=`_`;break;case 0:m=`=`;break;case 1:m=`^`;break;case 2:m=`^^`;break;case-3:var y={};return y.pitch=t.pitch-1,y.oct=t.oct,y.name=e[e.indexOf(t.name)-1],y.name||(y.name=`B`,y.oct--),y.name===`B`||y.name===`E`?y.adj=t.adj+1:y.adj=t.adj+2,transposePitch(y,n,r+1,a);case 3:var y={};return y.pitch=t.pitch+1,y.oct=t.oct,y.name=e[e.indexOf(t.name)+1],y.name||(y.name=`C`,y.oct++),y.name===`C`||y.name===`F`?y.adj=t.adj-1:y.adj=t.adj-2,transposePitch(y,n,r+1,a)}switch((a[p]===m||!a[p]&&m===g)&&!t.courtesy&&(m=``),d){case 0:p+=`,,,`;break;case 1:p+=`,,`;break;case 2:p+=`,`;break;case 4:p=p.toLowerCase();break;case 5:p=p.toLowerCase()+`'`;break;case 6:p=p.toLowerCase()+`''`;break;case 7:p=p.toLowerCase()+`'''`;break;case 8:p=p.toLowerCase()+`''''`;break}return d>4&&(p=p.toLowerCase()),{acc:m,name:p,upper:p.toUpperCase()}}var l=/([_^=]*)([A-Ga-g])([,']*)/,u=/([_^=]*[A-Ga-g][,']*)(\d*\/*\d*)([\>\<\-\)\.\s\\]*)/,d=/([_^=]*[A-Ga-g][,']*)?(\d*\/*\d*)?([\>\<\-\)]*)?/,p=/(\s*)$/;function parseNote(n,r,a,o){var c=r===`none`?0:e.indexOf(r),u=n.match(l),d=u[2].toUpperCase(),p=e.indexOf(d)-c;p<0&&(p+=7);var m=t.indexOf(u[3]);d===u[2]&&m--;var h=o[d]||a[d]||`=`;return{acc:u[1],name:d,pitch:p,oct:m,adj:calcAdjustment(u[1],a[d],o[d]),courtesy:u[1]===h}}function replaceNote(e,t,n,r,a){var o=e.substring(t,n),c=o.match(new RegExp(u.source+p.source),``);if(c){var l=c[1].length,m=c[2].length+c[3].length+c[4].length,h=n-t-l-m;t+=h,n-=m}else if(c=o.match(RegExp(`([^\\[]*)\\[`+d.source+d.source+d.source+d.source+d.source+d.source+d.source+d.source+`\\-?](\\d*\\/*\\d*)?([\\>\\<\\-\\)]*)`+p.source)),c){for(var g=1+c[1].length,_=0;_<a;_++)c[_*3+2]&&(g+=c[_*3+2].length),c[_*3+3]&&(g+=c[_*3+3].length),c[_*3+4]&&(g+=c[_*3+4].length);t+=g;var y=c[a*3+2]?c[a*3+2].length:0;n=t+y}return{start:t,end:n,note:r}}function replaceGrace(e,t,n,r,a){var o=e.substring(t,n),c=/\{/,l=/\}/,u=/([^\{]*)/,p=/(\/*)/,m=o.match(new RegExp(u.source+c.source+p.source+d.source+p.source+d.source+p.source+d.source+p.source+d.source+p.source+d.source+p.source+d.source+p.source+d.source+p.source+d.source+l.source));if(m){for(var h=1+m[1].length,g=0;g<a;g++)m[g*3+2]&&(h+=m[g*3+2].length),m[g*3+3]&&(h+=m[g*3+3].length),m[g*3+4]&&(h+=m[g*3+4].length),m[g*3+5]&&(h+=m[g*3+5].length);m[a*3+2]&&(h+=m[g*3+2].length),t+=h;var _=m[a*3+3]?m[a*3+3].length:0;_+=m[a*3+4]?m[a*3+4].length:0,_+=m[a*3+5]?m[a*3+5].length:0,n=t+_}return{start:t,end:n,note:r}}function replaceChord(e,t,n,r){var a=e.substring(t,n).match(/([^"]+)?(".+")+/);return a[1]&&(t+=a[1].length),n=t+a[2].length,{start:t+1,end:n-1,note:r}}function calcAdjustment(e,t,n){if(!e&&n&&(e=n),!e)return 0;switch(t){case void 0:switch(e){case`__`:return-2;case`_`:return-1;case`=`:return 0;case`^`:return 1;case`^^`:return 2;default:return 0}case`_`:switch(e){case`__`:return-1;case`_`:return 0;case`=`:return 1;case`^`:return 2;case`^^`:return 3;default:return 0}case`^`:switch(e){case`__`:return-3;case`_`:return-2;case`=`:return-1;case`^`:return 0;case`^^`:return 1;default:return 0}}return 0}})(),t.exports=strTranspose})),Ia=__commonJSMin(((e,t)=>{var n=function BeamElem(e,t,n,r){this.type=`BeamElem`,this.isflat=!!n,this.isgrace=!!(t&&t===`grace`),this.forceup=!!(this.isgrace||t&&t===`up`),this.forcedown=!!(t&&t===`down`),this.elems=[],this.total=0,this.average=6,this.allrests=!0,this.stemHeight=e,this.beams=[],r&&r.duration?(this.duration=r.duration,r.startTriplet&&(this.duration*=r.tripletMultiplier),this.duration=Math.round(this.duration*1e3)/1e3):this.duration=0};n.prototype.setHint=function(){this.hint=!0},n.prototype.runningDirection=function(e){var t=e.averagepitch;t!==void 0&&(this.total=Math.round(this.total+t),this.count||(this.count=0),this.count++)},n.prototype.add=function(e){var t=e.abcelem.averagepitch;t!==void 0&&(e.abcelem.rest||(this.allrests=!1),e.beam=this,this.elems.push(e),this.total=Math.round(this.total+t),(this.min===void 0||e.abcelem.minpitch<this.min)&&(this.min=e.abcelem.minpitch),(this.max===void 0||e.abcelem.maxpitch>this.max)&&(this.max=e.abcelem.maxpitch))},n.prototype.addBeam=function(e){this.beams.push(e)},n.prototype.setStemDirection=function(){this.average=calcAverage(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},n.prototype.calcDir=function(){this.average=calcAverage(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`,t=0;t<this.elems.length;t++)for(var n=0;n<this.elems[t].heads.length;n++)this.elems[t].heads[n].stemDir=e};function calcAverage(e,t){return t?e/t:0}t.exports=n})),La=__commonJSMin(((e,t)=>{var n=function BraceElem(e,t){this.startVoice=e,this.type=t};n.prototype.setBottomStaff=function(e){this.endVoice=e,this.startVoice.header&&!this.endVoice.header&&(this.header=this.startVoice.header,delete this.startVoice.header)},n.prototype.continuing=function(e){this.lastContinuedVoice=e},n.prototype.getWidth=function(){return 10},n.prototype.isStartVoice=function(e){return!!(this.startVoice&&this.startVoice.staff&&this.startVoice.staff.voices.length>0&&this.startVoice.staff.voices[0]===e)},t.exports=n})),Ra=__commonJSMin(((e,t)=>{var n=la(),r={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}};r[`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},r[`noteheads.slash.quarter`]={d:[[`M`,9,-6],[`l`,0,4],[`l`,-9,9],[`l`,0,-4],[`z`]],w:9,h:9},r[`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},r[`noteheads.triangle.quarter`]={d:[[`M`,0,4],[`l`,9,0],[`l`,-4.5,-9],[`z`]],w:9,h:9};var pathClone=function(e){for(var t=[],n=0,r=e.length;n<r;n++){t[n]=[];for(var a=0,o=e[n].length;a<o;a++)t[n][a]=e[n][a]}return t},pathScale=function(e,t,n){for(var r=0,a=e.length;r<a;r++){var o=e[r],c,l;for(c=1,l=o.length;c<l;c++)o[c]*=c%2?t:n}};t.exports={printSymbol:function(e,t,n,a,o){if(!r[n])return null;var c=pathClone(r[n].d);c[0][1]+=e,c[0][2]+=t;for(var l=``,u=0;u<c.length;u++)l+=c[u].join(` `);return o.path=l,a.path(o)},getPathForSymbol:function(e,t,n,a,o){if(a||(a=1),o||(o=1),!r[n])return null;var c=pathClone(r[n].d);return(a!==1||o!==1)&&pathScale(c,a,o),c[0][1]+=e,c[0][2]+=t,c},getSymbolWidth:function(e){return r[e]?r[e].w:0},symbolHeightInPitches:function(e){return(r[e]?r[e].h:0)/n.STEP},getSymbolAlign:function(e){return e.substring(0,7)===`scripts`&&e!==`scripts.roll`?`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`+`:return-2;case`timesig.common`:case`timesig.cut`:return 0;case`flags.d32nd`:return-1;case`flags.d64th`:return-2;case`flags.u32nd`:return 1;case`flags.u64th`:return 3;case`rests.whole`:return 1;case`rests.half`:return-1;case`rests.8th`:return-1;case`rests.quarter`:return-1;case`rests.16th`:return-1;case`rests.32nd`:return-1;case`rests.64th`:return-1;case`f`:case`m`:case`p`:case`s`:case`z`:return-4;case`scripts.trill`:case`scripts.upbow`:case`scripts.downbow`:return-2;case`scripts.ufermata`:case`scripts.wedge`:case`scripts.roll`:case`scripts.shortphrase`:case`scripts.longphrase`:return-1;case`scripts.dfermata`:return 1;default:return 0}},setSymbol:function(e,t){r[e]=t}}})),za=__commonJSMin(((e,t)=>{var n=wa(),r=Ra(),a=Ta(),createClef=function(e,t){var o,c=0;e.el_type=`clef`;var l=new n(e,0,10,`staff-extra clef`,t);switch(l.isClef=!0,e.type){case`treble`:o=`clefs.G`;break;case`tenor`:o=`clefs.C`;break;case`alto`:o=`clefs.C`;break;case`bass`:o=`clefs.F`;break;case`treble+8`:o=`clefs.G`,c=1;break;case`tenor+8`:o=`clefs.C`,c=1;break;case`bass+8`:o=`clefs.F`,c=1;break;case`alto+8`:o=`clefs.C`,c=1;break;case`treble-8`:o=`clefs.G`,c=-1;break;case`tenor-8`:o=`clefs.C`,c=-1;break;case`bass-8`:o=`clefs.F`,c=-1;break;case`alto-8`:o=`clefs.C`,c=-1;break;case`none`:return null;case`perc`:o=`clefs.perc`;break;default:l.addFixed(new a(`clef=`+e.type,0,0,void 0,{type:`debug`}))}var u=5;if(o){var d=r.symbolHeightInPitches(o),p=clefOffsets(o);if(l.addRight(new a(o,u,r.getSymbolWidth(o),e.clefPos,{top:d+e.clefPos+p,bottom:e.clefPos+p})),c!==0){var m=2/3,h=(r.getSymbolWidth(o)-r.getSymbolWidth(`8`)*m)/2,g=c>0?l.top+3:l.bottom-1,_=c>0?l.top+3:l.bottom-3,y=_-2;e.type===`bass-8`&&(g=3,h=0),l.addRight(new a(`8`,u+h,r.getSymbolWidth(`8`)*m,g,{scalex:m,scaley:m,top:_,bottom:y}))}}return l};function clefOffsets(e){switch(e){case`clefs.G`:return-5;case`clefs.C`:return-4;case`clefs.F`:return-4;case`clefs.perc`:return-2;default:return 0}}t.exports=createClef})),Ba=__commonJSMin(((e,t)=>{var n=wa(),r=Ra(),a=Ta(),createKeySignature=function(e,t){if(e.el_type=`keySignature`,!e.accidentals||e.accidentals.length===0)return null;var o=new n(e,0,10,`staff-extra key-signature`,t);o.isKeySig=!0;var c=0;return e.accidentals.forEach(function(e){var t,n=0;switch(e.acc){case`sharp`:t=`accidentals.sharp`,n=-3;break;case`natural`:t=`accidentals.nat`;break;case`flat`:t=`accidentals.flat`,n=-1.2;break;case`quartersharp`:t=`accidentals.halfsharp`,n=-2.5;break;case`quarterflat`:t=`accidentals.halfflat`,n=-1.2;break;default:t=`accidentals.flat`}o.addRight(new a(t,c,r.getSymbolWidth(t),e.verticalPos,{thickness:r.symbolHeightInPitches(t),top:e.verticalPos+r.symbolHeightInPitches(t)+n,bottom:e.verticalPos+n})),c+=r.getSymbolWidth(t)+2},this),o};t.exports=createKeySignature})),Va=__commonJSMin(((e,t)=>{var n=Ra(),r=Ta(),createNoteHead=function(e,t,a,o){o||(o={});var c=o.dir===void 0?null:o.dir,l=o.headx===void 0?0:o.headx,u=o.extrax===void 0?0:o.extrax,d=o.flag===void 0?null:o.flag,p=o.dot===void 0?0:o.dot,m=o.dotshiftx===void 0?0:o.dotshiftx,h=o.scale===void 0?1:o.scale,g=o.accidentalSlot===void 0?[]:o.accidentalSlot,_=o.shouldExtendStem===void 0?!1:o.shouldExtendStem,y=o.printAccidentals===void 0?!0:o.printAccidentals,b=a.verticalPos,x,S=0,C=0,w=0;if(t===void 0)e.addFixed(new r(`pitch is undefined`,0,0,0,{type:`debug`}));else if(t===``)x=new r(null,0,0,b);else{var T=l;if(a.printer_shift){var E=a.printer_shift===`same`?1:0;T=c===`down`?-n.getSymbolWidth(t)*h+E:n.getSymbolWidth(t)*h-E}var D={scalex:h,scaley:h,thickness:n.symbolHeightInPitches(t)*h,name:a.name};if(x=new r(t,T,n.getSymbolWidth(t)*h,b,D),x.stemDir=c,d){var O=b+(c===`down`?-7:7)*h;_&&(c===`down`&&O>6&&(O=6),c===`up`&&O<6&&(O=6));var k=c===`down`?l:l+x.w-.6;e.addRight(new r(d,k,n.getSymbolWidth(d)*h,O,{scalex:h,scaley:h}))}for(C=x.w+m-2+5*p;p>0;p--){var A=1-Math.abs(b)%2;e.addRight(new r(`dots.dot`,x.w+m-2+5*p,n.getSymbolWidth(`dots.dot`),b+A))}}if(x&&(x.highestVert=a.highestVert),y&&a.accidental){var j;switch(a.accidental){case`quartersharp`:j=`accidentals.halfsharp`;break;case`dblsharp`:j=`accidentals.dblsharp`;break;case`sharp`:j=`accidentals.sharp`;break;case`quarterflat`:j=`accidentals.halfflat`;break;case`flat`:j=`accidentals.flat`;break;case`dblflat`:j=`accidentals.dblflat`;break;case`natural`:j=`accidentals.nat`}for(var M=!1,N=u,P=0;P<g.length;P++)if(b-g[P][0]>=6){g[P][0]=b,N=g[P][1],M=!0;break}M===!1&&(N-=n.getSymbolWidth(j)*h+2,g.push([b,N]),S=n.getSymbolWidth(j)*h+2);var F=n.symbolHeightInPitches(j);e.addExtra(new r(j,N,n.getSymbolWidth(j),b,{scalex:h,scaley:h,top:b+F/2,bottom:b-F/2})),w=n.getSymbolWidth(j)/2}return{notehead:x,accidentalshiftx:S,dotshiftx:C,extraLeft:w}};t.exports=createNoteHead})),Ha=__commonJSMin(((e,t)=>{var n=wa(),r=Ra(),a=Ta(),createTimeSignature=function(e,t){e.el_type=`timeSignature`;var o=new n(e,0,10,`staff-extra time-signature`,t);if(e.type===`specified`)for(var c=0,l=0;l<e.value.length;l++)if(l!==0&&(o.addRight(new a(`+`,c+1,r.getSymbolWidth(`+`),6,{thickness:r.symbolHeightInPitches(`+`)})),c+=r.getSymbolWidth(`+`)+2),e.value[l].den){for(var u=0,d=0;d<e.value[l].num.length;d++)u+=r.getSymbolWidth(e.value[l].num[d]);var p=0;for(d=0;d<e.value[l].num.length;d++)p+=r.getSymbolWidth(e.value[l].den[d]);var m=Math.max(u,p);o.addRight(new a(e.value[l].num,c+(m-u)/2,u,8,{thickness:r.symbolHeightInPitches(e.value[l].num[0])})),o.addRight(new a(e.value[l].den,c+(m-p)/2,p,4,{thickness:r.symbolHeightInPitches(e.value[l].den[0])})),c+=m}else{for(var h=0,g=0;g<e.value[l].num.length;g++)h+=r.getSymbolWidth(e.value[l].num[g]);o.addRight(new a(e.value[l].num,c,h,6,{thickness:r.symbolHeightInPitches(e.value[l].num[0])})),c+=h}else e.type===`common_time`?o.addRight(new a(`timesig.common`,0,r.getSymbolWidth(`timesig.common`),6,{thickness:r.symbolHeightInPitches(`timesig.common`)})):e.type===`cut_time`?o.addRight(new a(`timesig.cut`,0,r.getSymbolWidth(`timesig.cut`),6,{thickness:r.symbolHeightInPitches(`timesig.cut`)})):e.type===`tempus_imperfectum`?o.addRight(new a(`timesig.imperfectum`,0,r.getSymbolWidth(`timesig.imperfectum`),6,{thickness:r.symbolHeightInPitches(`timesig.imperfectum`)})):e.type===`tempus_imperfectum_prolatio`?o.addRight(new a(`timesig.imperfectum2`,0,r.getSymbolWidth(`timesig.imperfectum2`),6,{thickness:r.symbolHeightInPitches(`timesig.imperfectum2`)})):e.type===`tempus_perfectum`?o.addRight(new a(`timesig.perfectum`,0,r.getSymbolWidth(`timesig.perfectum`),6,{thickness:r.symbolHeightInPitches(`timesig.perfectum`)})):e.type===`tempus_perfectum_prolatio`?o.addRight(new a(`timesig.perfectum2`,0,r.getSymbolWidth(`timesig.perfectum2`),6,{thickness:r.symbolHeightInPitches(`timesig.perfectum2`)})):console.log(`time signature:`,e);return o};t.exports=createTimeSignature})),Ua=__commonJSMin(((e,t)=>{t.exports=function DynamicDecoration(e,t,n){this.type=`DynamicDecoration`,this.anchor=e,this.dec=t,n===`below`?this.volumeHeightBelow=6:this.volumeHeightAbove=6,this.pitch=void 0}})),Wa=__commonJSMin(((e,t)=>{t.exports=function CrescendoElem(e,t,n,r){this.type=`CrescendoElem`,this.anchor1=e,this.anchor2=t,this.dir=n,r===`above`?this.dynamicHeightAbove=6:this.dynamicHeightBelow=6,this.pitch=void 0}})),Ga=__commonJSMin(((e,t)=>{t.exports=function GlissandoElem(e,t){this.type=`GlissandoElem`,this.anchor1=e,this.anchor2=t}})),Ka=__commonJSMin(((e,t)=>{var n=function TieElem(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),e.voiceNumber!==void 0&&(this.voiceNumber=e.voiceNumber),e.style!==void 0&&(this.dotted=!0),this.internalNotes=[]};n.prototype.addInternalNote=function(e){this.internalNotes.push(e)},n.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)},n.prototype.setStartX=function(e){this.startLimitX=e},n.prototype.setEndX=function(e){this.endLimitX=e},n.prototype.setHint=function(){this.hint=!0},n.prototype.calcTieDirection=function(){if(this.isGrace)this.above=!1;else if(this.voiceNumber===0)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e=this.anchor1?this.anchor1.pitch:this.anchor2?this.anchor2.pitch:14;this.anchor1&&this.anchor1.stemDir===`down`&&this.anchor2&&this.anchor2.stemDir===`down`?this.above=!0:this.anchor1&&this.anchor1.stemDir===`up`&&this.anchor2&&this.anchor2.stemDir===`up`?this.above=!1:this.anchor1&&this.anchor2?this.above=e>=6:this.anchor1?this.above=this.anchor1.stemDir===`down`:this.anchor2?this.above=this.anchor2.stemDir===`down`:this.above=e>=6}},n.prototype.calcSlurDirection=function(){if(this.isGrace)this.above=!1;else if(this.voiceNumber===0)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e=!1;this.anchor1&&this.anchor1.stemDir===`down`&&(e=!0),this.anchor2&&this.anchor2.stemDir===`down`&&(e=!0);for(var t=0;t<this.internalNotes.length;t++)this.internalNotes[t].stemDir===`down`&&(e=!0);this.above=e}},n.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},n.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},n.prototype.calcSlurY=function(){if(this.anchor1&&this.anchor2){this.above&&this.anchor1.stemDir===`up`&&!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&&this.anchor2.stemDir===`up`&&!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,this.anchor1.scalex===1){var n=!!this.anchor1.parent.beam,r=!!this.anchor2.parent.beam;n&&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),r&&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)},n.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)}},n.prototype.getYBounds=function(){var e=10,t=1e3;this.isTie?(this.calcTieDirection(),this.calcX(e,t),this.calcTieY()):(this.calcSlurDirection(),this.calcX(e,t),this.calcSlurY());var n,r;return this.above?(r=Math.min(this.startY,this.endY),n=r+3):(n=Math.min(this.startY,this.endY),r=n-3),[n,r]},t.exports=n})),qa=__commonJSMin(((e,t)=>{var n=Ua(),r=Wa(),a=Ga(),o=Ra(),c=Ta(),l=Ka(),u=function Decoration(){this.startDiminuendoX=void 0,this.startCrescendoX=void 0,this.minTop=12,this.minBottom=0},closeDecoration=function(e,t,n,r,a,u,d,p,m){for(var h,g=0;g<t.length;g++){if(t[g]===`staccato`||t[g]===`tenuto`||t[g]===`accent`&&!m){var _=`scripts.`+t[g];if(t[g]===`accent`&&(_=`scripts.sforzato`),h=h===void 0?d===`down`?n+2:p-2:d===`down`?h+2:h-2,t[g]===`accent`)d===`up`?h--:h++;else switch(h){case 2:case 4:case 6:case 8:case 10:d===`up`?h--:h++;break}n>9&&h++;var y=r/2;o.getSymbolAlign(_)!==`center`&&(y-=o.getSymbolWidth(_)/2),a.addFixedX(new c(_,y,o.getSymbolWidth(_),h))}if(t[g]===`slide`&&a.heads[0]){var b=a.heads[0].pitch;b-=2;var x=new c(``,-u-15,0,b-1),S=new c(``,-u-5,0,b+1);a.addFixedX(x),a.addFixedX(S),e.addOther(new l({anchor1:x,anchor2:S,fixedY:!0}))}}return h===void 0&&(h=n),{above:h,below:a.bottom}},volumeDecoration=function(e,t,r,a){for(var o=0;o<t.length;o++)switch(t[o]){case`p`:case`mp`:case`pp`:case`ppp`:case`pppp`:case`f`:case`ff`:case`fff`:case`ffff`:case`sfz`:case`mf`:var c=new n(r,t[o],a);e.addOther(c)}},compoundDecoration=function(e,t,n,r,a){function highestPitch(){if(r.heads.length===0)return 10;for(var e=r.heads[0].pitch,t=1;t<r.heads.length;t++)e=Math.max(e,r.heads[t].pitch);return e}function lowestPitch(){if(r.heads.length===0)return 2;for(var e=r.heads[0].pitch,t=1;t<r.heads.length;t++)e=Math.min(e,r.heads[t].pitch);return e}function compoundDecoration(e,t){var l=a===`down`?lowestPitch()+1:highestPitch()+9;a!==`down`&&t===1&&l--;var u=n/2;u+=a===`down`?-5:3;for(var d=0;d<t;d++)--l,r.addFixedX(new c(e,u,o.getSymbolWidth(e),l))}for(var l=0;l<e.length;l++)switch(e[l]){case`/`:compoundDecoration(`flags.ugrace`,1);break;case`//`:compoundDecoration(`flags.ugrace`,2);break;case`///`:compoundDecoration(`flags.ugrace`,3);break;case`////`:compoundDecoration(`flags.ugrace`,4);break}},stackedDecoration=function(e,t,n,r,a,l,u,d){function incrementPlacement(e,t){e===`above`?r.above+=t:r.below-=t}function getPlacement(e){var t;return e===`above`?(t=r.above,t<l&&(t=l)):(t=r.below,t>u&&(t=u)),t}function textDecoration(e,r,a){var o=getPlacement(r);n.addFixedX(new c(e,t/2,0,o+2,{type:`decoration`,klass:`ornament`,thickness:3,anchor:a})),incrementPlacement(r,5)}function symbolDecoration(e,r){var a=t/2;o.getSymbolAlign(e)!==`center`&&(a-=o.getSymbolWidth(e)/2);var l=o.symbolHeightInPitches(e)+1,u=getPlacement(r);u=r===`above`?u+l/2:u-l/2,n.addFixedX(new c(e,a,o.getSymbolWidth(e),u,{klass:`ornament`,thickness:o.symbolHeightInPitches(e),position:r})),incrementPlacement(r,l)}for(var p={"+":`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=!1,h=0;h<e.length;h++)switch(e[h]){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`D.C.`:case`D.S.`:textDecoration(e[h],a,`middle`),m=!0;break;case`D.C.alcoda`:textDecoration(`D.C. al coda`,a,`end`),m=!0;break;case`D.C.alfine`:textDecoration(`D.C. al fine`,a,`end`),m=!0;break;case`D.S.alcoda`:textDecoration(`D.S. al coda`,a,`end`),m=!0;break;case`D.S.alfine`:textDecoration(`D.S. al fine`,a,`end`),m=!0;break;case`fine`:textDecoration(`FINE`,a,`middle`),m=!0;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`:symbolDecoration(p[e[h]],a),m=!0;break;case`invertedfermata`:symbolDecoration(p[e[h]],`below`),m=!0;break;case`mark`:n.klass=`mark`;break;case`accent`:d&&(symbolDecoration(`scripts.sforzato`,a),m=!0);break}return m};function leftDecoration(e,t,n){for(var r=0;r<e.length;r++)switch(e[r]){case`arpeggio`:for(var a=t.abcelem.minpitch-1;a<=t.abcelem.maxpitch;a+=2)t.addExtra(new c(`scripts.arpeggio`,-o.getSymbolWidth(`scripts.arpeggio`)*2-n,0,a+2,{klass:`ornament`,thickness:o.symbolHeightInPitches(`scripts.arpeggio`)}));break}}u.prototype.dynamicDecoration=function(e,t,n,o){for(var c,l,u,d=0;d<t.length;d++)switch(t[d]){case`diminuendo(`:this.startDiminuendoX=n,c=void 0;break;case`diminuendo)`:c={start:this.startDiminuendoX,stop:n},this.startDiminuendoX=void 0;break;case`crescendo(`:this.startCrescendoX=n,l=void 0;break;case`crescendo)`:l={start:this.startCrescendoX,stop:n},this.startCrescendoX=void 0;break;case`~(`:case`glissando(`:this.startGlissandoX=n,u=void 0;break;case`~)`:case`glissando)`:u={start:this.startGlissandoX,stop:n},this.startGlissandoX=void 0;break}c&&e.addOther(new r(c.start,c.stop,`>`,o)),l&&e.addOther(new r(l.start,l.stop,`<`,o)),u&&e.addOther(new a(u.start,u.stop))},u.prototype.createDecoration=function(e,t,n,r,a,o,c,l,u,d,p){u||(u={ornamentPosition:`above`,volumePosition:d?`above`:`below`,dynamicPosition:d?`above`:`below`}),volumeDecoration(e,t,a,u.volumePosition),this.dynamicDecoration(e,t,a,u.dynamicPosition),compoundDecoration(t,n,r,a,c);var m=closeDecoration(e,t,n,r,a,o,c,l,p);m.above=Math.max(m.above,this.minTop),m.below=Math.min(m.below,l),stackedDecoration(t,r,a,m,u.ornamentPosition,this.minTop,l,p),leftDecoration(t,a,o)},t.exports=u})),Ja=__commonJSMin(((e,t)=>{t.exports=function EndingElem(e,t,n){this.type=`EndingElem`,this.text=e,this.anchor1=t,this.anchor2=n,this.endingHeightAbove=5,this.pitch=void 0}})),Ya=__commonJSMin(((e,t)=>{var calcHeight=function(e){for(var t=0,n=0;n<e.voices.length;n++){var r=e.voices[n].staff;e.voices[n].duplicate||(t+=r.top,t+=-r.bottom)}return t};t.exports=calcHeight})),Xa=__commonJSMin(((e,t)=>{var n=Ya(),StaffGroupElement=function(e){this.getTextSize=e,this.voices=[],this.staffs=[],this.brace=void 0,this.bracket=void 0};StaffGroupElement.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])},StaffGroupElement.prototype.addVoice=function(e,t,n){var r=this.voices.length;this.voices[r]=e,this.staffs[t]?this.staffs[t].voices.push(r):this.staffs[this.staffs.length]={top:10,bottom:2,lines:n,voices:[r],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]},StaffGroupElement.prototype.setHeight=function(){this.height=n(this)},StaffGroupElement.prototype.setWidth=function(e){this.w=e;for(var t=0;t<this.voices.length;t++)this.voices[t].setWidth(e)},StaffGroupElement.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)},t.exports=StaffGroupElement})),Za=__commonJSMin(((e,t)=>{var n=wa(),r=Ta(),a=function TempoElement(e,t,n){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(n,e,t))};a.prototype.setX=function(e){this.x=e},a.prototype.createNote=function(e,t,a){var o=.75,c=t.duration[0],l=new n(t,c,1,`tempo`,a),u,d,p;c<=1/32?(p=`noteheads.quarter`,d=`flags.u32nd`,u=0):c<=1/16?(p=`noteheads.quarter`,d=`flags.u16th`,u=0):c<=3/32?(p=`noteheads.quarter`,d=`flags.u16nd`,u=1):c<=1/8?(p=`noteheads.quarter`,d=`flags.u8th`,u=0):c<=3/16?(p=`noteheads.quarter`,d=`flags.u8th`,u=1):c<=1/4?(p=`noteheads.quarter`,u=0):c<=3/8?(p=`noteheads.quarter`,u=1):c<=1/2?(p=`noteheads.half`,u=0):c<=3/4?(p=`noteheads.half`,u=1):c<=1?(p=`noteheads.whole`,u=0):c<=1.5?(p=`noteheads.whole`,u=1):c<=2?(p=`noteheads.dbl`,u=0):(p=`noteheads.dbl`,u=1);var m=e(l,p,{verticalPos:0},{dir:`up`,flag:d,dot:u,scale:o}).notehead;l.addHead(m);var h;if(p!==`noteheads.whole`&&p!==`noteheads.dbl`){var g=1/3*o,_=5*o;h=new r(null,m.dx+m.w,0,g,{type:`stem`,pitch2:_,linewidth:-.6}),l.addRight(h)}return l},t.exports=a})),Qa=__commonJSMin(((e,t)=>{var n=function TripletElem(e,t,n){this.type=`TripletElem`,this.anchor1=t,this.number=e,this.durationClass=(`d`+Math.round(t.parent.durationClass*1e3)/1e3).replace(/\./,`-`),this.middleElems=[],this.flatBeams=n.flatBeams};n.prototype.isClosed=function(){return!!this.anchor2},n.prototype.middleNote=function(e){this.middleElems.push(e)},n.prototype.setCloseAnchor=function(e){this.anchor2=e,(!this.anchor1.parent.beam||this.anchor1.stemDir===`up`)&&(this.endingHeightAbove=4)},t.exports=n})),$a=__commonJSMin(((e,t)=>{function germanNote(e){switch(e){case`B#`:return`H#`;case`B♯`:return`H♯`;case`B`:return`H`;case`Bb`:return`B`;case`B♭`:return`B`}return e}function translateChord(e,t,n){var r=e.split(`
65
+ `);for(let e=0;e<r.length;e++){let a=r[e].match(/^([ABCDEFG][♯♭]?)?([^\/]+)?(\/([ABCDEFG][#b♯♭]?))?/);if(!a)continue;let o=a[1]||``,c=a[2]||``,l=a[4]||``;n&&(o=germanNote(o),l=germanNote(l));let u=t?``:``,d=l?`/`+l:``;r[e]=[o,c,d].join(u)}return r.join(`
66
+ `)}t.exports=translateChord})),eo=__commonJSMin(((e,t)=>{var n=Ta(),r=la(),a=$a(),addChord=function(e,t,n,r,a,o,c,l){for(var u=0;u<n.chord.length;u++){var d=n.chord[u].position,p=n.chord[u].rel_position,m=d===`left`||d===`right`||d===`below`||d===`above`||!!p,h,g;m?(h=`annotationfont`,g=`abcjs-annotation`):(h=`gchordfont`,g=`abcjs-chord`);var _=e.attr(h,g),y=n.chord[u].name,b;if(typeof y==`string`)b=chordString(y,d,p,m,h,g,_,e,t,n,r,a,o,c,l),r=b.roomTaken,a=b.roomTakenRight;else for(var x=0;x<y.length;x++)b=chordString(y[x].text,d,p,m,h,g,_,e,t,n,r,a,o,c,l),r=b.roomTaken,a=b.roomTakenRight}return{roomTaken:r,roomTakenRight:a}};function chordString(e,t,o,c,l,u,d,p,m,h,g,_,y,b,x){for(var S=e.split(`
67
+ `),C=S.length-1;C>=0;C--){var w=S[C],T=0,E;c||(w=a(w,b,x));var D=p.calc(w,l,u),O=D.width,k=D.height/r.STEP;switch(t){case`left`:g+=O+7,T=-g,E=h.averagepitch,m.addExtra(new n(w,T,O+4,E,{type:`text`,height:k,dim:d,position:`left`}));break;case`right`:_+=4,T=_,E=h.averagepitch,m.addRight(new n(w,T,O+4,E,{type:`text`,height:k,dim:d,position:`right`}));break;case`below`:m.addRight(new n(w,0,0,void 0,{type:`text`,position:`below`,height:k,dim:d,realWidth:O}));break;case`above`:m.addRight(new n(w,0,0,void 0,{type:`text`,position:`above`,height:k,dim:d,realWidth:O}));break;default:if(o){var A=o.y+3*r.STEP;m.addRight(new n(w,T+o.x,0,h.minpitch+A/r.STEP,{position:`relative`,type:`text`,height:k,dim:d}))}else{var j=`above`;h.positioning&&h.positioning.chordPosition&&(j=h.positioning.chordPosition),j!==`hidden`&&m.addCentered(new n(w,y/2,O,void 0,{type:`chord`,position:j,height:k,dim:d,realWidth:O}))}}}return{roomTaken:g,roomTakenRight:_}}t.exports=addChord})),to=__commonJSMin(((e,t)=>{var n=wa(),r=Ia(),a=La(),o=za(),c=Ba(),l=Va(),u=Ha(),d=qa(),p=Ja(),m=Ra(),h=Ta(),g=la(),_=Xa(),y=Za(),b=Ka(),x=Qa(),S=ba(),C=eo(),w=fa(),T=Xi(),getDuration=function(e){var t=0;return e.duration&&(t=e.duration),t},E=!1,D={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`}},AbstractEngraver=function(e,t,n){this.decoration=new d,this.getTextSize=e,this.tuneNumber=t,this.isBagpipes=n.bagpipes,this.flatBeams=n.flatbeams,this.graceSlurs=n.graceSlurs,this.percmap=n.percmap,this.initialClef=n.initialClef,this.jazzchords=!!n.jazzchords,this.accentAbove=!!n.accentAbove,this.germanAlphabet=!!n.germanAlphabet,this.reset()};AbstractEngraver.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},AbstractEngraver.prototype.setStemHeight=function(e){this.stemHeight=Math.round(e*10/g.STEP)/10},AbstractEngraver.prototype.getCurrentVoiceId=function(e,t){return`s`+e+`v`+t},AbstractEngraver.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)},AbstractEngraver.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)],this.voiceScale===void 0&&(this.voiceScale=1),this.voiceColor=this.colorByVoice[this.getCurrentVoiceId(e,t)]},AbstractEngraver.prototype.containsLyrics=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e[t].voices.length;n++)for(var r=0;r<e[t].voices[n].length;r++){var a=e[t].voices[n][r];if(a.lyric){(!a.positioning||a.positioning.vocalPosition===`below`)&&(this.hasVocals=!0);return}}},AbstractEngraver.prototype.createABCLine=function(e,t,n){this.minY=2,this.containsLyrics(e);var r=new _(this.getTextSize);this.tempoSet=!1;for(var a=0;a<e.length;a++)E&&this.restoreState(),E=!1,this.createABCStaff(r,e[a],t,a,n);return r},AbstractEngraver.prototype.createABCStaff=function(e,t,n,r,l){e.getTextSize.updateFonts(t);for(var d=0;d<t.voices.length;d++){var p=new S(d,t.voices.length);d===0?(p.barfrom=t.connectBarLines===`start`||t.connectBarLines===`continue`,p.barto=t.connectBarLines===`continue`||t.connectBarLines===`end`):p.duplicate=!0,t.title&&t.title[d]&&(p.header=t.title[d].replace(/\\n/g,`
68
+ `),p.headerPosition=6+e.getTextSize.baselineToCenter(p.header,`voicefont`,`staff-extra voice-name`,d,t.voices.length)/g.STEP),t.clef&&t.clef.type===`perc`&&(p.isPercussion=!0);var m=(!this.initialClef||l===0)&&o(t.clef,this.tuneNumber);m&&(d===0&&t.barNumber&&this.addMeasureNumber(t.barNumber,m),p.addChild(m),this.startlimitelem=m);var h=c(t.key,this.tuneNumber);if(h&&(p.addChild(h),this.startlimitelem=h),t.meter){t.meter.type===`specified`?this.measureLength=t.meter.value[0].num/t.meter.value[0].den:this.measureLength=1;var _=u(t.meter,this.tuneNumber);p.addChild(_),this.startlimitelem=_}p.duplicate&&(p.children=[]);var y=t.clef.stafflines||t.clef.stafflines===0?t.clef.stafflines:5;e.addVoice(p,r,y);var b=y===1;this.createABCVoice(t.voices[d],n,r,d,b,p),e.setStaffLimits(p),d===0&&(t.brace===`start`||!e.brace&&t.brace?(e.brace||(e.brace=[]),e.brace.push(new a(p,`brace`))):t.brace===`end`&&e.brace?e.brace[e.brace.length-1].setBottomStaff(p):t.brace===`continue`&&e.brace&&e.brace[e.brace.length-1].continuing(p),t.bracket===`start`||!e.bracket&&t.bracket?(e.bracket||(e.bracket=[]),e.bracket.push(new a(p,`bracket`))):t.bracket===`end`&&e.bracket?e.bracket[e.bracket.length-1].setBottomStaff(p):t.bracket===`continue`&&e.bracket&&e.bracket[e.bracket.length-1].continuing(p))}};function getBeamGroup(e,t){var n=e[t];if(n.el_type!==`note`||!n.startBeam||n.endBeam)return{count:1,elem:n};for(var r=[];t<e.length&&e[t].el_type===`note`&&(r.push(e[t]),!e[t].endBeam);)t++;return{count:r.length,elem:r}}AbstractEngraver.prototype.createABCVoice=function(e,t,r,a,o,c){this.popCrossLineElems(r,a),this.stemdir=this.isBagpipes?`down`:null,this.abcline=e,this.partstartelem&&(this.partstartelem=new p(``,null,null),c.addOther(this.partstartelem));var u=c.voicetotal<2?-1:c.voicenumber;for(var d in this.slurs)this.slurs.hasOwnProperty(d)&&(this.slurs[d]=new b({force:this.slurs[d].force,voiceNumber:u,stemDir:this.slurs[d].stemDir,style:this.slurs[d].dotted}),E&&this.slurs[d].setHint(),c.addOther(this.slurs[d]));for(var m=0;m<this.ties.length;m++)this.ties[m]=new b({force:this.ties[m].force,stemDir:this.ties[m].stemDir,voiceNumber:u,style:this.ties[m].dotted}),E&&this.ties[m].setHint(),c.addOther(this.ties[m]);for(var h=0;h<this.abcline.length;h++)setAveragePitch(this.abcline[h]),this.minY=Math.min(this.abcline[h].minpitch,this.minY);for(var g=r===0,_=0;_<this.abcline.length;){var x=getBeamGroup(this.abcline,_),S=this.createABCElement(g,o,c,x.elem);if(S)for(m=0;m<S.length;m++){if(!this.tempoSet&&t&&!t.suppress){this.tempoSet=!0;var C=new n(t,0,0,`tempo`,this.tuneNumber,{});C.addFixedX(new y(t,this.tuneNumber,l)),c.addChild(C)}c.addChild(S[m])}_+=x.count}this.pushCrossLineElems(r,a)},AbstractEngraver.prototype.saveState=function(){this.tiesSave=T.cloneArray(this.ties),this.slursSave=T.cloneHashOfHash(this.slurs),this.slursbyvoiceSave=T.cloneHashOfHash(this.slursbyvoice),this.tiesbyvoiceSave=T.cloneHashOfArrayOfHash(this.tiesbyvoice)},AbstractEngraver.prototype.restoreState=function(){this.ties=T.cloneArray(this.tiesSave),this.slurs=T.cloneHashOfHash(this.slursSave),this.slursbyvoice=T.cloneHashOfHash(this.slursbyvoiceSave),this.tiesbyvoice=T.cloneHashOfArrayOfHash(this.tiesbyvoiceSave)},AbstractEngraver.prototype.createABCElement=function(e,t,r,a){var d=[];switch(a.el_type){case void 0:d=this.createBeam(t,r,a);break;case`note`:d[0]=this.createNote(a,!1,t,r),this.triplet&&this.triplet.isClosed()&&(r.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1);break;case`bar`:d[0]=this.createBarLine(r,a,e),r.duplicate&&d.length>0&&(d[0].invisible=!0);break;case`meter`:d[0]=u(a,this.tuneNumber),this.startlimitelem=d[0],r.duplicate&&d.length>0&&(d[0].invisible=!0);break;case`clef`:if(d[0]=o(a,this.tuneNumber),!d[0])return null;r.duplicate&&d.length>0&&(d[0].invisible=!0);break;case`key`:var p=c(a,this.tuneNumber);p&&(d[0]=p,this.startlimitelem=d[0]),r.duplicate&&d.length>0&&(d[0].invisible=!0);break;case`stem`:this.stemdir=a.direction===`auto`?void 0:a.direction;break;case`part`:var m=new n(a,0,0,`part`,this.tuneNumber),_=this.getTextSize.calc(a.title,`partsfont`,`part`);m.addFixedX(new h(a.title,0,0,void 0,{type:`part`,height:_.height/g.STEP})),d[0]=m;break;case`tempo`:var b=new n(a,0,0,`tempo`,this.tuneNumber);b.addFixedX(new y(a,this.tuneNumber,l)),d[0]=b;break;case`style`:a.head===`normal`?delete this.style:this.style=a.head;break;case`hint`:E=!0,this.saveState();break;case`midi`:break;case`scale`:this.voiceScale=a.size;break;case`color`:this.voiceColor=a.color,r.color=this.voiceColor;break;default:var x=new n(a,0,0,`unsupported`,this.tuneNumber);x.addFixed(new h(`element type `+a.el_type,0,0,void 0,{type:`debug`})),d[0]=x}return d};function setAveragePitch(e){if(e.pitches){sortPitch(e);for(var t=0,n=0;n<e.pitches.length;n++)t+=e.pitches[n].verticalPos;e.averagepitch=t/e.pitches.length,e.minpitch=e.pitches[0].verticalPos,e.maxpitch=e.pitches[e.pitches.length-1].verticalPos}}AbstractEngraver.prototype.createBeam=function(e,t,n){var a=[],o=new r(this.stemHeight*this.voiceScale,this.stemdir,this.flatBeams,n[0]);E&&o.setHint();for(var c=0;c<n.length;c++)o.runningDirection(n[c]);o.setStemDirection();var l=this.stemdir;for(this.stemdir=o.stemsUp?`up`:`down`,c=0;c<n.length;c++){var u=n[c],d=this.createNote(u,!0,e,t);a.push(d),o.add(d),this.triplet&&this.triplet.isClosed()&&(t.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1)}return o.calcDir(),t.addBeam(o),this.stemdir=l,a};var sortPitch=function(e){var t;do{t=!0;for(var n=0;n<e.pitches.length-1;n++)if(e.pitches[n].pitch>e.pitches[n+1].pitch){t=!1;var r=e.pitches[n];e.pitches[n]=e.pitches[n+1],e.pitches[n+1]=r}}while(!t)},ledgerLines=function(e,t,n,r,a,o,c,l,u){for(var d=n;d>11;d--)d%2==0&&!r&&e.addFixed(new h(null,l,(a+4)*u,d,{type:`ledger`}));for(d=t;d<1;d++)d%2==0&&!r&&e.addFixed(new h(null,l,(a+4)*u,d,{type:`ledger`}));for(d=0;d<o.length;d++){var p=a;c===`down`&&(p=-p),e.addFixed(new h(null,p+l,(a+4)*u,o[d],{type:`ledger`}))}};AbstractEngraver.prototype.addGraceNotes=function(e,t,n,a,o,c,u){var d=3/5;o=Math.round(3.5/5*o);var p=null,g;e.gracenotes.length>1&&(p=new r(o,`grace`,c),E&&p.setHint(),p.mainNote=n);var _,y=[];for(_=e.gracenotes.length-1;_>=0;_--)u+=10,y[_]=u,e.gracenotes[_].accidental&&(u+=7);for(_=0;_<e.gracenotes.length;_++){var x=e.gracenotes[_].verticalPos;g=p?null:D.uflags[c?5:3];var S=l(n,`noteheads.quarter`,e.gracenotes[_],{dir:`up`,headx:-y[_],extrax:-y[_],flag:g,scale:d*this.voiceScale,accidentalSlot:[]});S.notehead.highestVert=S.notehead.pitch+o;var C=S.notehead;if(this.addSlursAndTies(n,e.gracenotes[_],C,t,`up`,!0),n.addExtra(C),e.gracenotes[_].acciaccatura){var w=e.gracenotes[_].verticalPos+7*d,T=p?5:6;n.addRight(new h(`flags.ugrace`,-y[_]+T,0,w,{scalex:d,scaley:d}))}if(p){var O=e.gracenotes[_].duration/2;c&&(O/=2);var k={heads:[C],abcelem:{averagepitch:x,minpitch:x,maxpitch:x,duration:O}};p.add(k)}else{var A=x+1/3*d,j=x+7*d,M=C.dx+C.w;n.addExtra(new h(null,M,0,A,{type:`stem`,pitch2:j,linewidth:-.6}))}ledgerLines(n,x,x,!1,m.getSymbolWidth(`noteheads.quarter`),[],!0,C.dx-1,.6);var N=e.rest&&(e.rest.type===`spacer`||e.rest.type===`invisible`);_===0&&!c&&this.graceSlurs&&!N&&t.addOther(new b({anchor1:C,anchor2:a,isGrace:!0}))}return p&&(p.calcDir(),t.addBeam(p)),u};function addRestToAbsElement(e,t,n,r,a,o,c,u,d){var p,g=7,_,y,b;switch(a&&(o===`down`&&(g=3),o===`up`&&(g=11)),c&&(g=n<.5||n<1?7:5),t.rest.type){case`whole`:p=D.rest[0],t.averagepitch=g,t.minpitch=g,t.maxpitch=g,r=0;break;case`rest`:p=t.style===`rhythm`?D.rhythm[-u]:D.rest[-u],t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case`invisible`:case`invisible-multimeasure`:case`spacer`:p=``,t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case`multimeasure`:p=D.rest.multi,t.averagepitch=g,t.minpitch=g,t.maxpitch=g,r=0;var x=m.getSymbolWidth(p);e.addHead(new h(p,x,x*2,7));var S=new h(``+t.rest.text,x,x,16,{type:`multimeasure-text`});e.addExtra(S)}if(t.rest.type.indexOf(`multimeasure`)<0&&t.rest.type!==`invisible`){var C=l(e,p,{verticalPos:g},{dot:r,scale:d});_=C.notehead,_&&(e.addHead(_),y=C.accidentalshiftx,b=C.dotshiftx)}return{noteHead:_,roomTaken:y,roomTakenRight:b}}function addIfNotExist(e,t){for(var n=0;n<e.length;n++)if(JSON.stringify(e[n])===JSON.stringify(t))return;e.push(t)}AbstractEngraver.prototype.addNoteToAbcElement=function(e,t,n,r,a,o,c,u,d){var p=0,g,_=0,y=0,b,x,S=[],C=[],T=0,E=t.averagepitch>=6?`down`:`up`;r&&(E=r),a=t.style?t.style:a,(!a||a===`normal`)&&(a=`note`);var O=o?D[a].nostem:D[a][-c];O||console.log(`noteSymbol:`,a,c,o);var k;for(k=E===`down`?t.pitches.length-2:1;E===`down`?k>=0:k<t.pitches.length;k=E===`down`?k-1:k+1){var A=t.pitches[E===`down`?k+1:k-1],j=t.pitches[k],M=E===`down`?A.pitch-j.pitch:j.pitch-A.pitch;M<=1&&!A.printer_shift&&(j.printer_shift=M?`different`:`same`,(j.verticalPos>11||j.verticalPos<1)&&S.push(j.verticalPos-j.verticalPos%2),E===`down`?_=m.getSymbolWidth(O)+2:p=m.getSymbolWidth(O)+2)}var N=t.pitches.length;for(k=0;k<t.pitches.length;k++){if(!u)var P=E===`down`&&k!==0||E===`up`&&k!==N-1?null:D[E===`down`?`dflags`:`uflags`][-c];var F;if(t.pitches[k].style)F=D[t.pitches[k].style][-c];else if(d.isPercussion&&this.percmap){F=O;var I=this.percmap[w(t.pitches[k])];I&&I.noteHead&&D[I.noteHead]&&(F=D[I.noteHead][-c])}else F=O;t.pitches[k].highestVert=t.pitches[k].verticalPos;var L=(r===`up`||E===`up`)&&k===0,ee=(r===`down`||E===`down`)&&k===N-1;if(L||ee){if((t.startSlur||N===1)&&(t.pitches[k].highestVert=t.pitches[N-1].verticalPos,getDuration(t)<1&&(r===`up`||E===`up`)&&(t.pitches[k].highestVert+=6)),t.startSlur)for(t.pitches[k].startSlur||(t.pitches[k].startSlur=[]),x=0;x<t.startSlur.length;x++)addIfNotExist(t.pitches[k].startSlur,t.startSlur[x]);if(t.endSlur)for(t.pitches[k].highestVert=t.pitches[N-1].verticalPos,getDuration(t)<1&&(r===`up`||E===`up`)&&(t.pitches[k].highestVert+=6),t.pitches[k].endSlur||(t.pitches[k].endSlur=[]),x=0;x<t.endSlur.length;x++)addIfNotExist(t.pitches[k].endSlur,t.endSlur[x])}var R=!u&&c<=-1,z=l(e,F,t.pitches[k],{dir:E,extrax:-_,flag:P,dot:n,dotshiftx:p,scale:this.voiceScale,accidentalSlot:C,shouldExtendStem:!r,printAccidentals:!d.isPercussion});T=Math.max(m.getSymbolWidth(F),T),e.extraw-=z.extraLeft,g=z.notehead,g&&(this.addSlursAndTies(e,t.pitches[k],g,d,R?E:null,!1),t.gracenotes&&t.gracenotes.length>0&&--g.bottom,e.addHead(g)),_+=z.accidentalshiftx,y=Math.max(y,z.dotshiftx)}if(R){var B=Math.round(70*this.voiceScale)/10,V=E===`down`?t.minpitch-B:t.minpitch+1/3;V>6&&!r&&(V=6);var H=E===`down`?t.maxpitch-1/3:t.maxpitch+B;H<6&&!r&&(H=6);var U=E===`down`||e.heads.length===0?0:e.heads[0].w,te=E===`down`?1:-1;g&&g.c===`noteheads.slash.quarter`&&(E===`down`?--H:V+=1),g&&g.c===`noteheads.triangle.quarter`&&(E===`down`?H-=.7:V-=1.2),e.addRight(new h(null,U,0,V,{type:`stem`,pitch2:H,linewidth:te,bottom:V-1})),b=Math.min(V,H)}return{noteHead:g,roomTaken:_,roomTakenRight:y,min:b,additionalLedgers:S,dir:E,symbolWidth:T}},AbstractEngraver.prototype.addLyric=function(e,t){var n=``;t.lyric.forEach(function(e){var t=e.divider===` `?``:e.divider;n+=e.syllable+t+`
69
+ `});var r=this.getTextSize.calc(n,`vocalfont`,`lyric`),a=t.positioning?t.positioning.vocalPosition:`below`;e.addCentered(new h(n,0,r.width,void 0,{type:`lyric`,position:a,height:r.height/g.STEP,dim:this.getTextSize.attr(`vocalfont`,`lyric`)}))},AbstractEngraver.prototype.createNote=function(e,t,r,a){var o=null,c=0,l=0,u=0,d=[],p,m=getDuration(e),g=!1;m===0&&(g=!0,m=.25,t=!0);for(var _=Math.floor(Math.log(m)/Math.log(2)),y=0,b=2**_,S=b/2;b<m;y++,b+=S,S/=2);e.startTriplet&&(this.tripletmultiplier=e.tripletMultiplier);var w=m*this.tripletmultiplier;e.rest&&e.rest.type===`multimeasure`&&(w=1),e.rest&&e.rest.type===`invisible-multimeasure`&&(w=this.measureLength*e.rest.text);var T=e.rest?`rest`:`note`,D=new n(e,w,1,T,this.tuneNumber,{durationClassOveride:e.duration*this.tripletmultiplier});if(E&&D.setHint(),e.rest){this.measureLength===m&&e.rest.type!==`invisible`&&e.rest.type!==`spacer`&&e.rest.type.indexOf(`multimeasure`)<0&&(e.rest.type=`whole`);var O=addRestToAbsElement(D,e,m,y,a.voicetotal>1,this.stemdir,r,_,this.voiceScale);o=O.noteHead,c=O.roomTaken,l=O.roomTakenRight}else{var k=this.addNoteToAbcElement(D,e,y,this.stemdir,this.style,g,_,t,a);k.min!==void 0&&(this.minY=Math.min(k.min,this.minY)),o=k.noteHead,c=k.roomTaken,l=k.roomTakenRight,d=k.additionalLedgers,p=k.dir,u=k.symbolWidth}if(e.lyric!==void 0&&this.addLyric(D,e),e.gracenotes!==void 0&&(c+=this.addGraceNotes(e,a,D,o,this.stemHeight*this.voiceScale,this.isBagpipes,c)),e.decoration){var A=t&&p!==`up`?Math.min(-3,D.bottom-6):D.bottom;this.decoration.createDecoration(a,e.decoration,D.top,o?o.w:0,D,c,p,A,e.positioning,this.hasVocals,this.accentAbove)}if(e.barNumber&&D.addFixed(new h(e.barNumber,-10,0,0,{type:`barNumber`})),ledgerLines(D,e.minpitch,e.maxpitch,e.rest,u,d,p,-2,1),e.chord!==void 0){var j=C(this.getTextSize,D,e,c,l,u,this.jazzchords,this.germanAlphabet);c=j.roomTaken,l=j.roomTakenRight}return e.startTriplet&&(this.triplet=new x(e.startTriplet,o,{flatBeams:this.flatBeams})),e.endTriplet&&this.triplet&&this.triplet.setCloseAnchor(o),this.triplet&&!e.startTriplet&&!e.endTriplet&&!(e.rest&&e.rest.type===`spacer`)&&this.triplet.middleNote(o),D},AbstractEngraver.prototype.addSlursAndTies=function(e,t,n,r,a,o){if(t.endTie&&this.ties.length>0){for(var c=!1,l=0;l<this.ties.length;l++)if(this.ties[l].anchor1&&this.ties[l].anchor1.pitch===n.pitch){this.ties[l].setEndAnchor(n),r.setRange(this.ties[l]),this.ties.splice(l,1),c=!0;break}c||(this.ties[0].setEndAnchor(n),r.setRange(this.ties[0]),this.ties.splice(0,1))}var u=r.voicetotal<2?-1:r.voicenumber;if(t.startTie){var d=new b({anchor1:n,force:this.stemdir===`down`||this.stemdir===`up`,stemDir:this.stemdir,isGrace:o,voiceNumber:u,style:t.startTie.style});E&&d.setHint(),this.ties[this.ties.length]=d,r.addOther(d),e.startTie=!0}var p,m;if(t.endSlur)for(var h=0;h<t.endSlur.length;h++)m=t.endSlur[h],this.slurs[m]?(p=this.slurs[m],p.setEndAnchor(n),r.setRange(p),delete this.slurs[m]):(p=new b({anchor2:n,stemDir:this.stemdir,voiceNumber:u}),E&&p.setHint(),r.addOther(p)),this.startlimitelem&&p.setStartX(this.startlimitelem);else if(!o)for(var g in this.slurs)this.slurs.hasOwnProperty(g)&&this.slurs[g].addInternalNote(n);if(t.startSlur)for(h=0;h<t.startSlur.length;h++)m=t.startSlur[h].label,p=new b({anchor1:n,stemDir:this.stemdir,voiceNumber:u,style:t.startSlur[h].style}),E&&p.setHint(),this.slurs[m]=p,r.addOther(p)},AbstractEngraver.prototype.addMeasureNumber=function(e,t){var n=this.getTextSize.calc(e,`measurefont`,`bar-number`),r=0;t.isClef&&(r+=n.width/2);var a=n.width>10&&t.abcelem.type===`treble`?13.5:11;t.addFixed(new h(e,r,n.width,a+n.height/g.STEP,{type:`barNumber`,dim:this.getTextSize.attr(`measurefont`,`bar-number`)}))},AbstractEngraver.prototype.createBarLine=function(e,t,r){var a=new n(t,0,10,`bar`,this.tuneNumber),o=null,c=0;t.barNumber&&this.addMeasureNumber(t.barNumber,a);var l=t.type===`bar_right_repeat`||t.type===`bar_dbl_repeat`,u=t.type!==`bar_left_repeat`&&t.type!==`bar_thick_thin`&&t.type!==`bar_invisible`,d=t.type===`bar_right_repeat`||t.type===`bar_dbl_repeat`||t.type===`bar_left_repeat`||t.type===`bar_thin_thick`||t.type===`bar_thick_thin`,m=t.type===`bar_left_repeat`||t.type===`bar_thick_thin`||t.type===`bar_thin_thin`||t.type===`bar_dbl_repeat`,g=t.type===`bar_left_repeat`||t.type===`bar_dbl_repeat`;if(l||g){for(var _ in this.slurs)this.slurs.hasOwnProperty(_)&&this.slurs[_].setEndX(a);this.startlimitelem=a}if(l&&(a.addRight(new h(`dots.dot`,c,1,7)),a.addRight(new h(`dots.dot`,c,1,5)),c+=6),u&&(o=new h(null,c,1,2,{type:`bar`,pitch2:10,linewidth:.6}),a.addRight(o)),t.type===`bar_invisible`&&(o=new h(null,c,1,2,{type:`none`,pitch2:10,linewidth:.6}),a.addRight(o)),t.decoration&&this.decoration.createDecoration(e,t.decoration,12,d?3:1,a,0,`down`,2,t.positioning,this.hasVocals,this.accentAbove),d&&(c+=4,o=new h(null,c,4,2,{type:`bar`,pitch2:10,linewidth:4}),a.addRight(o),c+=5),this.partstartelem&&t.endEnding&&(this.partstartelem.anchor2=o,this.partstartelem=null),m&&(c+=3,o=new h(null,c,1,2,{type:`bar`,pitch2:10,linewidth:.6}),a.addRight(o)),g&&(c+=3,a.addRight(new h(`dots.dot`,c,1,7)),a.addRight(new h(`dots.dot`,c,1,5))),t.startEnding&&r){var y=this.getTextSize.calc(t.startEnding,`repeatfont`,``).width;a.minspacing+=y+10,this.partstartelem=new p(t.startEnding,o,null),e.addOther(this.partstartelem)}return a.extraw-=5,t.chord!==void 0&&C(this.getTextSize,a,t,0,0,0,!1,this.germanAlphabet),a},t.exports=AbstractEngraver})),no=__commonJSMin(((e,t)=>{var n=`http://www.w3.org/2000/svg`;function Svg(e){this.svg=createSvg(),this.currentGroup=[],e.appendChild(this.svg)}Svg.prototype.clear=function(){if(this.svg){var e=this.svg.parentNode;this.svg=createSvg(),this.currentGroup=[],e&&(e.innerHTML=``,e.appendChild(this.svg))}},Svg.prototype.setTitle=function(e){var t=document.createElement(`title`),n=document.createTextNode(e);t.appendChild(n),this.svg.insertBefore(t,this.svg.firstChild)},Svg.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 n=this.svg.parentNode.getAttribute(`class`);n?n.indexOf(`abcjs-container`)<0&&this.svg.parentNode.setAttribute(`class`,n+` 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 r=t/e*100;this.svg.parentNode.style[`padding-bottom`]=r+`%`,this.svg.parentNode.style[`vertical-align`]=`middle`,this.svg.parentNode.style.overflow=`hidden`}},Svg.prototype.setSize=function(e,t){this.svg.setAttribute(`width`,e),this.svg.setAttribute(`height`,t)},Svg.prototype.setAttribute=function(e,t){this.svg.setAttribute(e,t)},Svg.prototype.setScale=function(e){e===1?(this.svg.style.transform=``,this.svg.style[`-ms-transform`]=``,this.svg.style[`-webkit-transform`]=``):(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`)},Svg.prototype.insertStyles=function(e){var t=document.createElementNS(n,`style`);t.textContent=e,this.svg.insertBefore(t,this.svg.firstChild)},Svg.prototype.setParentStyles=function(e){for(var t in e)e.hasOwnProperty(t)&&this.svg.parentNode&&(this.svg.parentNode.style[t]=e[t]);this.dummySvg&&(this.dummySvg=(document.querySelector(`body`).removeChild(this.dummySvg),null))};function constructHLine(e,t,n){var r=n-e;return`M `+e+` `+t+` l `+r+` 0 l 0 1 l `+-r+` 0 z `}function constructVLine(e,t,n){var r=n-t;return`M `+e+` `+t+` l 0 `+r+` l 1 0 l 0 `+-r+` z `}Svg.prototype.rect=function(e){var t=[],n=e.x,r=e.y,a=e.x+e.width,o=e.y+e.height;return t.push(constructHLine(n,r,a)),t.push(constructHLine(n,o,a)),t.push(constructVLine(a,r,o)),t.push(constructVLine(n,o,r)),this.path({path:t.join(` `),stroke:`none`,"data-name":e[`data-name`]})},Svg.prototype.dottedLine=function(e){var t=document.createElementNS(n,`line`);t.setAttribute(`x1`,e.x1),t.setAttribute(`x2`,e.x2),t.setAttribute(`y1`,e.y1),t.setAttribute(`y2`,e.y2),t.setAttribute(`stroke`,e.stroke),t.setAttribute(`stroke-dasharray`,`5,5`),this.svg.insertBefore(t,this.svg.firstChild)},Svg.prototype.rectBeneath=function(e){var t=document.createElementNS(n,`rect`);t.setAttribute(`x`,e.x),t.setAttribute(`width`,e.width),t.setAttribute(`y`,e.y),t.setAttribute(`height`,e.height),e.stroke&&t.setAttribute(`stroke`,e.stroke),e[`stroke-opacity`]&&t.setAttribute(`stroke-opacity`,e[`stroke-opacity`]),e.fill&&t.setAttribute(`fill`,e.fill),e[`fill-opacity`]&&t.setAttribute(`fill-opacity`,e[`fill-opacity`]),this.svg.insertBefore(t,this.svg.firstChild)},Svg.prototype.text=function(e,t,r){var a=document.createElementNS(n,`text`);for(var o in a.setAttribute(`stroke`,`none`),t)t.hasOwnProperty(o)&&a.setAttribute(o,t[o]);for(var c=(``+e).split(`
70
+ `),l=0;l<c.length;l++){var u=document.createElementNS(n,`tspan`);if(u.setAttribute(`x`,t.x?t.x:0),l!==0&&u.setAttribute(`dy`,`1.2em`),c[l].indexOf(``)!==-1){var d=c[l].split(``);if(u.textContent=d[0],d[1]){var p=document.createElementNS(n,`tspan`);p.setAttribute(`dy`,`-0.3em`),p.setAttribute(`style`,`font-size:0.7em`),p.textContent=d[1],u.appendChild(p)}if(d[2]){var m=d[1]?`0.4em`:`0.1em`,h=document.createElementNS(n,`tspan`);h.setAttribute(`dy`,m),h.setAttribute(`style`,`font-size:0.7em`),h.textContent=d[2],u.appendChild(h)}}else u.textContent=c[l];a.appendChild(u)}return r?r.appendChild(a):this.append(a),a},Svg.prototype.richTextLine=function(e,t,r,a,o,c){var l=document.createElementNS(n,`text`);l.setAttribute(`stroke`,`none`),l.setAttribute(`class`,a),l.setAttribute(`x`,t),l.setAttribute(`y`,r),l.setAttribute(`text-anchor`,o),l.setAttribute(`dominant-baseline`,`middle`);for(var u=0;u<e.length;u++){for(var d=e[u],p=document.createElementNS(n,`tspan`),m=Object.keys(d.attrs),h=0;h<m.length;h++){var g=d.attrs[m[h]];g!==``&&p.setAttribute(m[h],g)}p.textContent=d.content,l.appendChild(p)}return c?c.appendChild(l):this.append(l),l},Svg.prototype.guessWidth=function(e,t){var n=this.createDummySvg(),r=this.text(e,t,n),a;try{a=r.getBBox(),a=isNaN(a.height)||!a.height?{width:t[`font-size`]/2,height:t[`font-size`]+2}:{width:a.width,height:a.height}}catch{a={width:t[`font-size`]/2,height:t[`font-size`]+2}}return n.removeChild(r),a},Svg.prototype.createDummySvg=function(){return this.dummySvg||(this.dummySvg=createSvg(),this.dummySvg.setAttribute(`style`,[`display: block !important;`,`height: 1px;`,`width: 1px;`,`position: absolute;`].join(``)),document.querySelector(`body`).appendChild(this.dummySvg)),this.dummySvg};var r={};Svg.prototype.getTextSize=function(e,t,n){if(typeof e==`number`&&(e=``+e),!e||e.match(/^\s+$/))return{width:0,height:0};var a;if(e.length<20&&(a=e+JSON.stringify(t),r[a]))return r[a];var o=!n;n||(n=this.text(e,t));var c;try{c=n.getBBox(),c=isNaN(c.height)||!c.height?this.guessWidth(e,t):{width:c.width,height:c.height}}catch{c=this.guessWidth(e,t)}return o&&(this.currentGroup.length>0?this.currentGroup[0].removeChild(n):this.svg.removeChild(n)),a&&(r[a]=c),c},Svg.prototype.openGroup=function(e){e||(e={});var t=document.createElementNS(n,`g`);return e.klass&&t.setAttribute(`class`,e.klass),e.fill&&t.setAttribute(`fill`,e.fill),e.stroke&&t.setAttribute(`stroke`,e.stroke),e[`data-name`]&&t.setAttribute(`data-name`,e[`data-name`]),e.prepend?this.prepend(t):this.append(t),this.currentGroup.unshift(t),t},Svg.prototype.closeGroup=function(){var e=this.currentGroup.shift();return e&&e.children.length===0?(e.parentElement.removeChild(e),null):e},Svg.prototype.path=function(e){var t=document.createElementNS(n,`path`);for(var r in e)e.hasOwnProperty(r)&&(r===`path`?t.setAttributeNS(null,`d`,e.path):r===`klass`?t.setAttributeNS(null,`class`,e[r]):e[r]!==void 0&&t.setAttributeNS(null,r,e[r]));return this.append(t),t},Svg.prototype.pathToBack=function(e){var t=document.createElementNS(n,`path`);for(var r in e)e.hasOwnProperty(r)&&(r===`path`?t.setAttributeNS(null,`d`,e.path):r===`klass`?t.setAttributeNS(null,`class`,e[r]):t.setAttributeNS(null,r,e[r]));return this.prepend(t),t},Svg.prototype.lineToBack=function(e){for(var t=document.createElementNS(n,`line`),r=Object.keys(e),a=0;a<r.length;a++)t.setAttribute(r[a],e[r[a]]);return this.prepend(t),t},Svg.prototype.append=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.appendChild(e)},Svg.prototype.prepend=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.insertBefore(e,this.svg.firstChild)},Svg.prototype.setAttributeOnElement=function(e,t){for(var n in t)t.hasOwnProperty(n)&&e.setAttributeNS(null,n,t[n])},Svg.prototype.moveElementToChild=function(e,t){e.appendChild(t)};function createSvg(){var e=document.createElementNS(n,`svg`);return e.setAttributeNS(`http://www.w3.org/2000/xmlns/`,`xmlns:xlink`,`http://www.w3.org/1999/xlink`),e.setAttribute(`role`,`img`),e.setAttribute(`fill`,`currentColor`),e.setAttribute(`stroke`,`currentColor`),e}t.exports=Svg})),ro=__commonJSMin(((e,t)=>{var n=la(),r=no(),Renderer=function(e){this.paper=new r(e),this.controller=null,this.space=3*n.SPACE,this.padding={},this.reset(),this.firefox112=navigator.userAgent.indexOf(`Firefox/112.0`)>=0};Renderer.prototype.reset=function(){this.paper.clear(),this.y=0,this.abctune=null,this.path=null,this.isPrint=!1,this.lineThickness=0,this.initVerticalSpace()},Renderer.prototype.newTune=function(e){this.abctune=e,this.setVerticalSpace(e.formatting),this.isPrint=e.media===`print`,this.setPadding(e)},Renderer.prototype.setLineThickness=function(e){this.lineThickness=e},Renderer.prototype.setPaddingOverride=function(e){this.paddingOverride={top:e.paddingtop,bottom:e.paddingbottom,right:e.paddingright,left:e.paddingleft}},Renderer.prototype.setPadding=function(e){function setPaddingVariable(t,n,r,a,o){e.formatting[r]===void 0?t.paddingOverride[n]===void 0?t.isPrint?t.padding[n]=a:t.padding[n]=o:t.padding[n]=t.paddingOverride[n]:t.padding[n]=e.formatting[r]}setPaddingVariable(this,`top`,`topmargin`,38,15),setPaddingVariable(this,`bottom`,`botmargin`,38,15),setPaddingVariable(this,`left`,`leftmargin`,68,15),setPaddingVariable(this,`right`,`rightmargin`,68,15)},Renderer.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},Renderer.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}},Renderer.prototype.setVerticalSpace=function(e){e.staffsep!==void 0&&(this.spacing.staffSeparation=e.staffsep*4/3),e.composerspace!==void 0&&(this.spacing.composer=e.composerspace*4/3),e.partsspace!==void 0&&(this.spacing.parts=e.partsspace*4/3),e.textspace!==void 0&&(this.spacing.text=e.textspace*4/3),e.musicspace!==void 0&&(this.spacing.music=e.musicspace*4/3),e.titlespace!==void 0&&(this.spacing.title=e.titlespace*4/3),e.sysstaffsep!==void 0&&(this.spacing.systemStaffSeparation=e.sysstaffsep*4/3),e.stafftopmargin!==void 0&&(this.spacing.staffTopMargin=e.stafftopmargin*4/3),e.subtitlespace!==void 0&&(this.spacing.subtitle=e.subtitlespace*4/3),e.topspace!==void 0&&(this.spacing.top=e.topspace*4/3),e.vocalspace!==void 0&&(this.spacing.vocal=e.vocalspace*4/3),e.wordsspace!==void 0&&(this.spacing.words=e.wordsspace*4/3)},Renderer.prototype.calcY=function(e){return this.y-e*n.STEP},Renderer.prototype.moveY=function(e,t){t===void 0&&(t=1),this.y+=e*t},Renderer.prototype.absolutemoveY=function(e){this.y=e},t.exports=Renderer})),io=__commonJSMin(((e,t)=>{function FreeText(e,t,n,r,a,o){var c=e.text;this.rows=[];var l;t&&this.rows.push({move:t});var u=n.calc(`textfont`,`defined-text`);if(c===``)this.rows.push({move:u.attr[`font-size`]*2});else if(typeof c==`string`)this.rows.push({move:u.attr[`font-size`]/2}),this.rows.push({left:r,text:c,font:`textfont`,klass:`defined-text`,anchor:`start`,startChar:e.startChar,endChar:e.endChar,absElemType:`freeText`,name:`free-text`}),l=o.calc(c,`textfont`,`defined-text`),this.rows.push({move:l.height});else if(c){for(var d=0,p=r,m=`textfont`,h=0;h<c.length;h++)m=c[h].font?c[h].font:`textfont`,this.rows.push({left:p,text:c[h].text,font:m,klass:`defined-text`,anchor:`start`,startChar:e.startChar,endChar:e.endChar,absElemType:`freeText`,name:`free-text`}),l=o.calc(c[h].text,n.calc(m,`defined-text`).font,`defined-text`),p+=l.width+l.height/2,d=Math.max(d,l.height);this.rows.push({move:d})}else if(e.length===1){var g=a/2;this.rows.push({left:g,text:e[0].text,font:`textfont`,klass:`defined-text`,anchor:`middle`,startChar:e.startChar,endChar:e.endChar,absElemType:`freeText`,name:`free-text`}),l=o.calc(e[0].text,`textfont`,`defined-text`),this.rows.push({move:l.height})}}t.exports=FreeText})),ao=__commonJSMin(((e,t)=>{function Separator(e,t,n){this.rows=[],e&&this.rows.push({move:e}),this.rows.push({separator:t,absElemType:`separator`}),n&&this.rows.push({move:n})}t.exports=Separator})),oo=__commonJSMin(((e,t)=>{function Subtitle(e,t,n,r,a,o){this.rows=[],e&&this.rows.push({move:e});var c=t.titleleft?`start`:`middle`,l=t.titleleft?a:r;this.rows.push({left:l,text:n.text,font:`subtitlefont`,klass:`text subtitle`,anchor:c,startChar:n.startChar,endChar:n.endChar,absElemType:`subtitle`,name:`subtitle`});var u=o.calc(n.text,`subtitlefont`,`text subtitle`);this.rows.push({move:u.height})}t.exports=Subtitle})),so=__commonJSMin(((e,t)=>{function addTextIf(e,t,n){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 r={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&&(r.absElemType=t.absElemType),!t.inGroup&&t.klass&&(r.klass=t.klass),t.name&&(r.name=t.name),e.push(r);var a=n.calc(`A`,t.font,t.klass),o=t.text.split(`
71
+ `).length;if(t.text[t.text.length-1]===`
72
+ `&&o--,!t.noMove){var c=a.height*1.1*o;e.push({move:Math.round(c)}),t.marginBottom&&e.push({move:t.marginBottom})}}}t.exports=addTextIf})),co=__commonJSMin(((e,t)=>{var n=so();function richText(e,t,r,a,o,c,l,u){var d=u.calc(`i`,r,a);if(t===``)e.push({move:d.height});else{if(typeof t==`string`){n(e,{marginLeft:c,text:t,font:r,klass:a,marginTop:l.marginTop,anchor:l.anchor,absElemType:l.absElemType,info:l.info,name:o},u);return}l.marginTop&&e.push({move:l.marginTop});var p=0,m={left:c,anchor:l.anchor,phrases:[]};a&&(m.klass=a),e.push(m);for(var h=0;h<t.length;h++){var g=t[h],_=g.font?g.font:u.attr(r,a).font,y={content:g.text};_&&(y.attrs={"font-family":u.getFamily(_.face),"font-size":_.size,"font-weight":_.weight,"font-style":_.style,"font-decoration":_.decoration}),m.phrases.push(y);var b=u.calc(g.text,_,a);p=Math.max(p,b.height),g.text[g.text.length-1]===` `&&d.width}e.push({move:p})}}t.exports=richText})),lo=__commonJSMin(((e,t)=>{var n=so(),r=co();function TopText(e,t,a,o,c,l,u,d,p,m){if(this.rows=[],e.header&&l){var h=m.calc(`X`,`headerfont`,`abcjs-header abcjs-meta-top`).height;n(this.rows,{marginLeft:u,text:e.header.left,font:`headerfont`,klass:`header meta-top`,marginTop:-h,info:t.header,name:`header`},m),n(this.rows,{marginLeft:u+c/2,text:e.header.center,font:`headerfont`,klass:`header meta-top`,marginTop:-h,anchor:`middle`,info:t.header,name:`header`},m),n(this.rows,{marginLeft:u+c,text:e.header.right,font:`headerfont`,klass:`header meta-top`,marginTop:-h,anchor:`end`,info:t.header,name:`header`},m)}l&&this.rows.push({move:d.top});var g=a.titleleft?`start`:`middle`,_=a.titleleft?u:u+c/2;if(e.title){var y=p?`abcjs-title`:``;r(this.rows,e.title,`titlefont`,y,`title`,_,{marginTop:d.title,anchor:g,absElemType:`title`,info:t.title},m)}if(o.length)for(var b=0;b<o.length&&o[b].subtitle;){var y=p?`abcjs-text abcjs-subtitle`:``;r(this.rows,o[b].subtitle.text,`subtitlefont`,y,`subtitle`,_,{marginTop:d.subtitle,anchor:g,absElemType:`subtitle`,info:o[b].subtitle},m),b++}if(e.rhythm||e.origin||e.composer){if(this.rows.push({move:d.composer}),e.rhythm&&e.rhythm.length>0){var x=!!(e.composer||e.origin),y=p?`abcjs-rhythm`:``;n(this.rows,{marginLeft:u,text:e.rhythm,font:`infofont`,klass:y,absElemType:`rhythm`,noMove:x,info:t.rhythm,name:`rhythm`},m)}e.composer&&e.composer,e.origin&&e.origin;var S=e.composer?e.composer:``;if(e.origin&&(typeof S==`string`&&typeof e.origin==`string`?S+=` (`+e.origin+`)`:typeof S==`string`&&typeof e.origin!=`string`?(S=[{text:S}],S.push({text:` (`}),S=S.concat(e.origin),S.push({text:`)`})):(S.push({text:` (`}),S=S.concat(e.origin),S.push({text:`)`}))),S){var y=p?`abcjs-composer`:``;r(this.rows,S,`composerfont`,y,`composer`,u+c,{anchor:`end`,absElemType:`composer`,info:t.composer,ingroup:!0},m)}}if(e.author&&e.author.length>0){var y=p?`abcjs-author`:``;r(this.rows,e.author,`composerfont`,y,`author`,u+c,{anchor:`end`,absElemType:`author`,info:t.author},m)}if(e.partOrder&&e.partOrder.length>0){var y=p?`abcjs-part-order`:``;r(this.rows,e.partOrder,`partsfont`,y,`part-order`,u,{absElemType:`partOrder`,info:t.partOrder,anchor:`start`},m)}}t.exports=TopText})),uo=__commonJSMin(((e,t)=>{var n=so(),r=co();function BottomText(e,t,n,r,a,o,c){this.rows=[],e.unalignedWords&&e.unalignedWords.length>0&&this.unalignedWords(e.unalignedWords,r,a,o,c),this.extraText(e,r,a,o,c),e.footer&&n&&this.footer(e.footer,t,r,c)}BottomText.prototype.unalignedWords=function(e,t,n,r,a){var o=r?`abcjs-unaligned-words`:``,c=`wordsfont`,l=a.calc(`i`,c,o);this.rows.push({move:n.words}),addMultiLine(this.rows,``,e,t,c,`unalignedWords`,`unalignedWords`,o,`unalignedWords`,n,r,a),this.rows.push({move:l.height})};function addSingleLine(e,t,n,a,o,c,l){n&&(t&&(n=typeof n==`string`?t+n:[{text:t}].concat(n)),o=c?`abcjs-extra-text `+o:``,r(e,n,`historyfont`,o,`description`,a,{absElemType:`extraText`,anchor:`start`},l))}function addMultiLine(e,t,a,o,c,l,u,d,p,m,h,g){if(a){d=h?`abcjs-extra-text `+d:``;var _=g.calc(`A`,c,d);if(typeof a==`string`)t&&(a=t+`
73
+ `+a),n(e,{marginLeft:o,text:a,font:c,absElemType:`extraText`,name:p,"dominant-baseline":`middle`,klass:d},g);else{e.push({startGroup:u,klass:d,name:p}),e.push({move:m.info}),t&&(n(e,{marginLeft:o,text:t,font:c,absElemType:`extraText`,name:p,"dominant-baseline":`middle`},g),e.push({move:_.height*3/4}));for(var y=0;y<a.length;y++)r(e,a[y],c,``,p,o,{anchor:`start`},g),y<a.length-1&&typeof a[y]==`string`&&typeof a[y+1]!=`string`&&e.push({move:_.height*3/4});e.push({endGroup:u,absElemType:l,startChar:-1,endChar:-1,name:p}),e.push({move:_.height})}}}BottomText.prototype.extraText=function(e,t,n,r,a){addSingleLine(this.rows,`Book: `,e.book,t,`abcjs-book`,r,a),addSingleLine(this.rows,`Source: `,e.source,t,`abcjs-source`,r,a),addSingleLine(this.rows,`Discography: `,e.discography,t,`abcjs-discography`,r,a),addMultiLine(this.rows,`Notes:`,e.notes,t,`historyfont`,`extraText`,`notes`,`abcjs-notes`,`description`,n,r,a),addSingleLine(this.rows,`Transcription: `,e.transcription,t,`abcjs-transcription`,r,a),addMultiLine(this.rows,`History:`,e.history,t,`historyfont`,`extraText`,`history`,`abcjs-history`,`description`,n,r,a),addSingleLine(this.rows,`Copyright: `,e[`abc-copyright`],t,`abcjs-copyright`,r,a),addSingleLine(this.rows,`Creator: `,e[`abc-creator`],t,`abcjs-creator`,r,a),addSingleLine(this.rows,`Edited By: `,e[`abc-edited-by`],t,`abcjs-edited-by`,r,a)},BottomText.prototype.footer=function(e,t,r,a){var o=`header meta-bottom`,c=`footerfont`;this.rows.push({startGroup:`footer`,klass:o}),n(this.rows,{marginLeft:r,text:e.left,font:c,klass:o,name:`footer`},a),n(this.rows,{marginLeft:r+t/2,text:e.center,font:c,klass:o,anchor:`middle`,name:`footer`},a),n(this.rows,{marginLeft:r+t,text:e.right,font:c,klass:o,anchor:`end`,name:`footer`},a)},t.exports=BottomText})),fo=__commonJSMin(((e,t)=>{function findNumber(e,t,n,r){if(e.indexOf(t)===0){var a=e.replace(t,``),o=parseInt(a,10);``+o===a&&(n[r]=o)}}function createAnalysis(e,t){var n=[];if(e.absEl.elemset){for(var r={},a=0;a<e.absEl.elemset.length;a++){var o=e.absEl.elemset[a];if(o)for(var c=o.getAttribute(`class`).split(` `),l=0;l<c.length;l++)r[c[l]]=!0}for(var u=0;u<Object.keys(r).length;u++)n.push(Object.keys(r)[u])}for(var d={},p=0;p<n.length;p++)findNumber(n[p],`abcjs-v`,d,`voice`),findNumber(n[p],`abcjs-l`,d,`line`),findNumber(n[p],`abcjs-m`,d,`measure`);e.staffPos&&(d.staffPos=e.staffPos);for(var m=t.target;m&&m.dataset&&!m.dataset.name&&m.tagName.toLowerCase()!==`svg`;)m=m.parentNode;for(var h=t.target;h&&h.dataset&&!h.dataset.index&&h.tagName.toLowerCase()!==`svg`;)h=h.parentNode;return h&&h.dataset&&(d.name=h.dataset.name,d.clickedName=m.dataset.name,d.parentClasses=h.classList),m&&m.classList&&(d.clickedClasses=m.classList),d.selectableElement=e.svgEl,{classes:n,analysis:d}}t.exports=createAnalysis})),po=__commonJSMin(((e,t)=>{var n=la(),r=fo();function setupSelection(e,t){if(e.rangeHighlight=rangeHighlight,e.dragging)for(var n=0;n<e.selectables.length;n++){var r=e.selectables[n];r.svgEl.getAttribute(`selectable`)===`true`&&(r.svgEl.setAttribute(`tabindex`,0),r.svgEl.setAttribute(`data-index`,n),r.svgEl.addEventListener(`keydown`,keyboardDown.bind(e)),r.svgEl.addEventListener(`keyup`,keyboardSelection.bind(e)),r.svgEl.addEventListener(`focus`,elementFocused.bind(e)))}for(var a=0;a<t.length;a++)t[a].addEventListener(`touchstart`,mouseDown.bind(e),{passive:!0}),t[a].addEventListener(`touchmove`,mouseMove.bind(e),{passive:!0}),t[a].addEventListener(`touchend`,mouseUp.bind(e),{passive:!0}),t[a].addEventListener(`mousedown`,mouseDown.bind(e)),t[a].addEventListener(`mousemove`,mouseMove.bind(e)),t[a].addEventListener(`mouseup`,mouseUp.bind(e))}function getCoord(e){var t=1,n=1,r=e.target.closest(`svg`),a=0;r&&r.viewBox&&r.viewBox.baseVal&&(r.viewBox.baseVal.width!==0&&(t=r.viewBox.baseVal.width/r.clientWidth),r.viewBox.baseVal.height!==0&&(n=r.viewBox.baseVal.height/r.clientHeight),a=r.viewBox.baseVal.y);var o=e.target&&e.target.tagName===`svg`,c,l;return o?(c=e.offsetX,l=e.offsetY):(c=e.layerX,l=e.layerY),c*=t,l*=n,[c,l+a]}function elementFocused(e){this.dragMechanism===`keyboard`&&this.dragYStep!==0&&this.dragTarget&&notifySelect.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,e),this.dragYStep=0}function keyboardDown(e){switch(e.keyCode){case 38:case 40:e.preventDefault()}}function keyboardSelection(e){var t=!1,r=e.target.dataset.index;switch(e.keyCode){case 13:case 32:t=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,this.dragMechanism=`keyboard`,mouseUp.bind(this)(e);break;case 38:t=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,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*n.STEP+`)`));break;case 40:t=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,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*n.STEP+`)`));break;case 9:this.dragYStep!==0&&mouseUp.bind(this)(e);break;default:break}t&&e.preventDefault()}function findElementInHistory(e,t){if(!t)return-1;for(var n=0;n<e.length;n++)if(t.dataset.index===e[n].svgEl.dataset.index)return n;return-1}function findElementByCoord(e,t,n){for(var r=9999999,a=-1,o=0;o<e.selectables.length&&r>0;o++){var c=e.selectables[o];if(e.getDim(c),c.dim.left<t&&c.dim.right>t&&c.dim.top<n&&c.dim.bottom>n)a=o,r=0;else if(c.dim.top<n&&c.dim.bottom>n){var l=Math.min(Math.abs(c.dim.left-t),Math.abs(c.dim.right-t));l<r&&(r=l,a=o)}else if(c.dim.left<t&&c.dim.right>t){var u=Math.min(Math.abs(c.dim.top-n),Math.abs(c.dim.bottom-n));u<r&&(r=u,a=o)}else{var d=Math.abs(t-c.dim.left)>Math.abs(t-c.dim.right)?Math.abs(t-c.dim.right):Math.abs(t-c.dim.left),p=Math.abs(n-c.dim.top)>Math.abs(n-c.dim.bottom)?Math.abs(n-c.dim.bottom):Math.abs(n-c.dim.top),m=Math.sqrt(d*d+p*p);m<r&&(r=m,a=o)}}return a>=0&&r<=12?a:-1}function getBestMatchCoordinates(e,t,n){return e.x<=t.offsetX&&e.x+e.width>=t.offsetX&&e.y<=t.offsetY&&e.y+e.height>=t.offsetY||Math.abs(t.layerY/n-t.offsetY)<3?[t.offsetX,t.offsetY]:[t.layerX,t.layerY]}function getTarget(e){if(!e)return null;if(e.tagName===`svg`)return e;if(!e.getAttribute)return null;for(var t=e.getAttribute(`selectable`);!t;)e.parentElement?(e=e.parentElement,t=e.tagName===`svg`?!0:e.getAttribute(`selectable`)):t=!0;return e}function getMousePosition(e,t){var n,r,a,o=findElementInHistory(e.selectables,getTarget(t.target));return o>=0?(a=getBestMatchCoordinates(e.selectables[o].svgEl.getBBox(),t,e.scale),n=a[0],r=a[1]):(a=getCoord(t),n=a[0],r=a[1],o=findElementByCoord(e,n,r)),{x:n,y:r,clickedOn:o}}function attachMissingTouchEventAttributes(e){if(!(!e||!e.target||!e.touches||e.touches.length<1)){var t=e.target.getBoundingClientRect(),n=e.touches[0].pageX-t.left,r=e.touches[0].pageY-t.top;e.touches[0].offsetX=n,e.touches[0].offsetY=r,e.touches[0].layerX=e.touches[0].pageX,e.touches[0].layerY=e.touches[0].pageY}}function mouseDown(e){var t=e;e.type===`touchstart`&&(attachMissingTouchEventAttributes(e),e.touches.length>0&&(t=e.touches[0]));var n=getMousePosition(this,t);n.clickedOn>=0&&(e.type===`touchstart`||e.button===0)&&this.selectables[n.clickedOn]&&(this.dragTarget=this.selectables[n.clickedOn],this.dragIndex=n.clickedOn,this.dragMechanism=`mouse`,this.dragMouseStart={x:n.x,y:n.y},this.dragging&&this.dragTarget.isDraggable&&(addGlobalClass(this.renderer.paper,`abcjs-dragging-in-progress`),this.dragTarget.absEl.highlight(void 0,this.dragColor)))}function mouseMove(e){var t=e;if(e.type===`touchmove`&&(attachMissingTouchEventAttributes(e),e.touches.length>0&&(t=e.touches[0])),this.lastTouchMove=e,!(!this.dragTarget||!this.dragging||!this.dragTarget.isDraggable||this.dragMechanism!==`mouse`||!this.dragMouseStart)){var r=getMousePosition(this,t),a=Math.round((r.y-this.dragMouseStart.y)/n.STEP);a!==this.dragYStep&&(this.dragYStep=a,this.dragTarget.svgEl.setAttribute(`transform`,`translate(0,`+a*n.STEP+`)`))}}function mouseUp(e){var t=e;e.type===`touchend`&&this.lastTouchMove&&(attachMissingTouchEventAttributes(this.lastTouchMove),this.lastTouchMove&&this.lastTouchMove.touches&&this.lastTouchMove.touches.length>0&&(t=this.lastTouchMove.touches[0])),this.dragTarget&&(clearSelection.bind(this)(),this.dragTarget.absEl&&this.dragTarget.absEl.highlight&&(this.selected=[this.dragTarget.absEl],this.dragTarget.absEl.highlight(void 0,this.selectionColor)),notifySelect.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),removeGlobalClass(this.renderer.svg,`abcjs-dragging-in-progress`))}function setSelection(e){e>=0&&e<this.selectables.length&&(this.dragTarget=this.selectables[e],this.dragIndex=e,this.dragMechanism=`keyboard`,mouseUp.bind(this)({target:this.dragTarget.svgEl}))}function notifySelect(e,t,n,a,o){for(var c=r(e,o),l=c.classes,u=c.analysis,d=0;d<this.listeners.length;d++)this.listeners[d](e.absEl.abcelem,e.absEl.tuneNumber,l.join(` `),u,{step:t,max:n,index:a,setSelection:setSelection.bind(this)},o)}function clearSelection(){for(var e=0;e<this.selected.length;e++)this.selected[e].unhighlight(void 0,this.renderer.foregroundColor);this.selected=[]}function rangeHighlight(e,t){clearSelection.bind(this)();for(var n=0;n<this.staffgroups.length;n++)for(var r=this.staffgroups[n].voices,a=0;a<r.length;a++)for(var o=r[a].children,c=0;c<o.length;c++){var l=o[c].abcelem.startChar,u=o[c].abcelem.endChar;(t>l&&e<u||t===e&&t===u)&&(this.selected[this.selected.length]=o[c],o[c].highlight(void 0,this.selectionColor))}}function getClassSet(e){var t=e.getAttribute(`class`);t||(t=``);for(var n=t.split(` `),r={},a=0;a<n.length;a++)r[n[a]]=!0;return r}function setClassSet(e,t){var n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(r);e.setAttribute(`class`,n.join(` `))}function addGlobalClass(e,t){if(e){var n=getClassSet(e.svg);n[t]=!0,setClassSet(e.svg,n)}}function removeGlobalClass(e,t){if(e){var n=getClassSet(e.svg);delete n[t],setClassSet(e.svg,n)}}t.exports=setupSelection})),mo=__commonJSMin(((e,t)=>{function getBarYAt(e,t,n,r,a){return t+(r-t)/(n-e)*(a-e)}t.exports=getBarYAt})),ho=__commonJSMin(((e,t)=>{var n=Ta(),r=la(),a=mo(),layoutBeam=function(e){if(!(e.elems.length===0||e.allrests)){var t=calcDy(e.stemsUp,e.isgrace),n=e.elems[0],r=e.elems[e.elems.length-1],a=0,o=e.stemsUp?n.abcelem.maxpitch:n.abcelem.minpitch;a=minStem(n,e.stemsUp,o,a),a=minStem(r,e.stemsUp,o,a),a=Math.max(e.stemHeight,a+3);var c=calcYPos(e.average,e.elems.length,a,e.stemsUp,n.abcelem.averagepitch,r.abcelem.averagepitch,e.isflat,e.min,e.max,e.isgrace),l=calcXPos(e.stemsUp,n,r);e.addBeam({startX:l[0],endX:l[1],startY:c[0],endY:c[1],dy:t});for(var u=createAdditionalBeams(e.elems,e.stemsUp,e.beams[0],e.isgrace,t),d=0;d<u.length;d++)e.addBeam(u[d]);createStems(e.elems,e.stemsUp,e.beams[0],t,e.mainNote)}},getDurlog=function(e){return e===void 0?0:Math.floor(Math.log(e)/Math.log(2))};function minStem(e,t,n,r){if(!e.children)return r;for(var a=0;a<e.children.length;a++){var o=e.children[a];t&&o.top!==void 0&&o.c===`flags.ugrace`?r=Math.max(r,o.top-n):!t&&o.bottom!==void 0&&o.c===`flags.ugrace`&&(r=Math.max(r,n-o.bottom+7))}return r}function calcSlant(e,t,n,r){if(r)return 0;var a=e-t,o=n/2;return a>o&&(a=o),a<-o&&(a=-o),a}function calcDy(e,t){var n=e?r.STEP:-r.STEP;return t&&(n*=.4),n}function calcXPos(e,t,n){var r=t.heads[e?0:t.heads.length-1],a=n.heads[e?0:n.heads.length-1],o=r.x;e&&(o+=r.w-.6);var c=a.x;return c+=e?a.w:.6,[o,c]}function calcYPos(e,t,n,r,a,o,c,l,u,d){var p=n-2,m=n-2,h=Math.round(r?Math.max(e+p,u+m):Math.min(e-p,l-m)),g=calcSlant(a,o,t,c),_=h+Math.floor(g/2),y=h+Math.floor(-g/2);return d||(r&&h<6||!r&&h>6)&&(_=6,y=6),[_,y]}function createStems(e,t,o,c,l){for(var u=0;u<e.length;u++){var d=e[u];if(!d.abcelem.rest){var p=!d.addExtra,m=p?l:d,h=d.heads[t?0:d.heads.length-1],g=1/5,_=h.pitch+(t?g:-g),y=t?h.w:0;p||(y+=h.dx);var b=h.x+y,x=a(o.startX,o.startY,o.endX,o.endY,b),S=t?-.6:.6;t||(x-=c/2/r.STEP),p&&(y+=d.heads[0].dx),h.c===`noteheads.slash.quarter`&&(t?_+=1:--_);var C=new n(null,y,0,_,{type:`stem`,pitch2:x,linewidth:S});C.setX(m.x),m.addRight(C)}}}function createAdditionalBeams(e,t,n,r,o){for(var c=[],l=[],u=0;u<e.length;u++){var d=e[u];if(!d.abcelem.rest){var p=d.heads[t?0:d.heads.length-1],m=p.x+(t?p.w:0),h=a(n.startX,n.startY,n.endX,n.endY,m),g=t?-1.5:1.5;r&&(g=g*2/3);var _=d.abcelem.duration;_===0&&(_=.25);for(var y=getDurlog(_);y<-3;y++){var b=-4-y;if(l[b]?l[b].single=!1:l[b]={x:m+(t?-.6:0),y:h+g*(b+1),durlog:y,single:!0},u>0&&d.abcelem.beambr&&d.abcelem.beambr<=b+1){l[b].split||(l[b].split=[l[b].x]);var x=calcXPos(t,e[u-1],d);l[b].split[l[b].split.length-1]>=x[0]&&(x[0]+=d.w),l[b].split.push(x[0]),l[b].split.push(x[1])}}for(var S=l.length-1;S>=0;S--)if(u===e.length-1||getDurlog(e[u+1].abcelem.duration)>-S-4){var C=m,w=h+g*(S+1);l[S].single&&(C=u===0?m+5:m-5,w=a(n.startX,n.startY,n.endX,n.endY,C)+g*(S+1));var T={startX:l[S].x,endX:C,startY:l[S].y,endY:w,dy:o};if(l[S].split!==void 0){var E=l[S].split;T.endX<=E[E.length-1]&&(E[E.length-1]-=d.w),E.push(T.endX),T.split=l[S].split}c.push(T),l=l.slice(0,S)}}}return c}t.exports=layoutBeam})),go=__commonJSMin(((e,t)=>{var n=mo();function layoutTriplet(e){if(e.anchor1&&e.anchor2){e.hasBeam=!!e.anchor1.parent.beam&&e.anchor1.parent.beam===e.anchor2.parent.beam;var t=e.anchor1.parent.beam;if(e.hasBeam&&(t.elems[0]!==e.anchor1.parent||t.elems[t.elems.length-1]!==e.anchor2.parent)&&(e.hasBeam=!1),e.hasBeam){var n=isAbove(t)?e.anchor1.x+e.anchor1.w:e.anchor1.x;e.yTextPos=heightAtMidpoint(n,e.anchor2.x,t),e.yTextPos+=isAbove(t)?3:-2,e.xTextPos=xAtMidpoint(n,e.anchor2.x),e.top=e.yTextPos+1,e.bottom=e.yTextPos-2,isAbove(t)&&(e.endingHeightAbove=4)}else{e.startNote=Math.max(e.anchor1.parent.top,9)+4,e.endNote=Math.max(e.anchor2.parent.top,9)+4,e.anchor1.parent.type===`rest`&&e.anchor2.parent.type!==`rest`?e.startNote=e.endNote:e.anchor2.parent.type===`rest`&&e.anchor1.parent.type!==`rest`&&(e.endNote=e.startNote);for(var r=0,a=0;a<e.middleElems.length;a++)r=Math.max(r,e.middleElems[a].top);r+=4,(r>e.startNote||r>e.endNote)&&(e.startNote=r,e.endNote=r),e.flatBeams&&(e.startNote=Math.max(e.startNote,e.endNote),e.endNote=Math.max(e.startNote,e.endNote)),e.yTextPos=e.startNote+(e.endNote-e.startNote)/2,e.xTextPos=e.anchor1.x+(e.anchor2.x+e.anchor2.w-e.anchor1.x)/2,e.top=e.yTextPos+1}}delete e.middleElems,delete e.flatBeams}function isAbove(e){return e.stemsUp}function heightAtMidpoint(e,t,r){if(r.beams.length===0)return 0;r=r.beams[0];var a=e+(t-e)/2;return n(r.startX,r.startY,r.endX,r.endY,a)}function xAtMidpoint(e,t){return e+(t-e)/2}t.exports=layoutTriplet})),_o=__commonJSMin(((e,t)=>{var n=ho(),r=mo(),a=go(),layoutVoice=function(e){for(var t=0;t<e.beams.length;t++)if(e.beams[t].type===`BeamElem`){n(e.beams[t]),moveDecorations(e.beams[t]);for(var r=0;r<e.beams[t].elems.length;r++)e.adjustRange(e.beams[t].elems[r])}for(e.staff.specialY.chordLines=setLaneForChord(e.children),t=0;t<e.otherchildren.length;t++){var o=e.otherchildren[t];o.type===`TripletElem`&&(a(o),e.adjustRange(o))}e.staff.top=Math.max(e.staff.top,e.top),e.staff.bottom=Math.min(e.staff.bottom,e.bottom)};function moveDecorations(e){for(var t=1.5,n=0;n<e.elems.length;n++){var r=e.elems[n];if(r.top)for(var a=yAtNote(r,e),o=0;o<r.children.length;o++){var c=r.children[o];if(c.klass===`ornament`&&c.position!==`below`&&c.bottom-t<a){var l=a-c.bottom+t;c.bottom+=l,c.top+=l,c.pitch+=l,a=r.top=c.top}}}}function placeInLane(e,t){var n=t.getChordDim();if(n){for(var r=0;r<e.length;r++)if(e[r]<n.left){r>0&&t.putChordInLane(r),e[r]=n.right;return}e.push(n.right),t.putChordInLane(e.length-1)}}function setLaneForChord(e){var t=[0],n=[0],r,a,o;for(r=0;r<e.length;r++){for(a=0;a<e[r].children.length;a++)o=e[r].children[a],o.chordHeightAbove&&placeInLane(t,o);for(a=e[r].children.length-1;a>=0;a--)o=e[r].children[a],o.chordHeightBelow&&placeInLane(n,o)}return(t.length>1||n.length>1)&&setLane(e,t.length,n.length),{above:t.length,below:n.length}}function numAnnotationsBelow(e){for(var t=0,n=0;n<e.children.length;n++)e.children[n].chordHeightBelow&&t++;return t}function setLane(e,t,n){for(var r=0;r<e.length;r++){numAnnotationsBelow(e[r]);for(var a=0;a<e[r].children.length;a++){var o=e[r].children[a];o.chordHeightAbove&&o.invertLane(t)}}}function yAtNote(e,t){return t=t.beams[0],r(t.startX,t.startY,t.endX,t.endY,e.x)}t.exports=layoutVoice})),vo=__commonJSMin(((e,t)=>{var n=la(),setUpperAndLowerElements=function(e,t){for(var a,o=0;o<t.staffs.length;o++){var c=t.staffs[o],l={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0};if(e.showDebug&&e.showDebug.indexOf(`box`)>=0&&(c.originalTop=c.top,c.originalBottom=c.bottom),incTop(c,l,`lyricHeightAbove`),incTop(c,l,`chordHeightAbove`,c.specialY.chordLines.above),c.specialY.endingHeightAbove&&(c.specialY.chordHeightAbove?c.top+=2:c.top+=c.specialY.endingHeightAbove+r,l.endingHeightAbove=c.top),c.specialY.dynamicHeightAbove&&c.specialY.volumeHeightAbove?(c.top+=Math.max(c.specialY.dynamicHeightAbove,c.specialY.volumeHeightAbove)+r,l.dynamicHeightAbove=c.top,l.volumeHeightAbove=c.top):(incTop(c,l,`dynamicHeightAbove`),incTop(c,l,`volumeHeightAbove`)),incTop(c,l,`partHeightAbove`),incTop(c,l,`tempoHeightAbove`),c.specialY.lyricHeightBelow&&(c.specialY.lyricHeightBelow+=e.spacing.vocal/n.STEP,l.lyricHeightBelow=c.bottom,c.bottom-=c.specialY.lyricHeightBelow+r),c.specialY.chordHeightBelow){l.chordHeightBelow=c.bottom;var u=c.specialY.chordHeightBelow;c.specialY.chordLines.below&&(u*=c.specialY.chordLines.below),c.bottom-=u+r}c.specialY.volumeHeightBelow&&c.specialY.dynamicHeightBelow?(l.volumeHeightBelow=c.bottom,l.dynamicHeightBelow=c.bottom,c.bottom-=Math.max(c.specialY.volumeHeightBelow,c.specialY.dynamicHeightBelow)+r):c.specialY.volumeHeightBelow?(l.volumeHeightBelow=c.bottom,c.bottom-=c.specialY.volumeHeightBelow+r):c.specialY.dynamicHeightBelow&&(l.dynamicHeightBelow=c.bottom,c.bottom-=c.specialY.dynamicHeightBelow+r),e.showDebug&&e.showDebug.indexOf(`box`)>=0&&(c.positionY=l);for(var d=0;d<c.voices.length;d++){var p=t.voices[c.voices[d]];setUpperAndLowerVoiceElements(l,p,e.spacing)}if(a!==void 0){var m=c.top-10,h=a+m,g=e.spacing.systemStaffSeparation/n.STEP-h;g>0&&(c.top+=g)}c.top+=e.spacing.staffTopMargin/n.STEP,a=2-c.bottom}},r=1;function incTop(e,t,n,a){if(e.specialY[n]){var o=e.specialY[n];a&&(o*=a),e.top+=o+r,t[n]=e.top}}function setUpperAndLowerVoiceElements(e,t,n){var r,a;for(r=0;r<t.children.length;r++)a=t.children[r],setUpperAndLowerAbsoluteElements(e,a,n);for(r=0;r<t.otherchildren.length;r++)switch(a=t.otherchildren[r],a.type){case`CrescendoElem`:setUpperAndLowerCrescendoElements(e,a);break;case`DynamicDecoration`:setUpperAndLowerDynamicElements(e,a);break;case`EndingElem`:setUpperAndLowerEndingElements(e,a);break;case`TieElem`:var o=a.getYBounds();t.staff.top=Math.max(t.staff.top,o[0]),t.staff.top=Math.max(t.staff.top,o[1]),t.staff.bottom=Math.min(t.staff.bottom,o[0]),t.staff.bottom=Math.min(t.staff.bottom,o[1]);break}}function setUpperAndLowerAbsoluteElements(e,t,n){for(var r=0;r<t.children.length;r++){var a=t.children[r];for(var o in t.specialY)t.specialY.hasOwnProperty(o)&&a[o]&&(a.pitch=e[o],a.top===void 0&&(a.type===`TempoElement`?setUpperAndLowerTempoElement(e,a):setUpperAndLowerRelativeElements(e,a,n),t.pushTop(a.top),t.pushBottom(a.bottom)))}}function setUpperAndLowerCrescendoElements(e,t){t.dynamicHeightAbove?t.pitch=e.dynamicHeightAbove:t.pitch=e.dynamicHeightBelow}function setUpperAndLowerDynamicElements(e,t){t.volumeHeightAbove?t.pitch=e.volumeHeightAbove:t.pitch=e.volumeHeightBelow}function setUpperAndLowerEndingElements(e,t){t.pitch=e.endingHeightAbove-2}function setUpperAndLowerTempoElement(e,t){if(t.pitch=e.tempoHeightAbove,t.top=e.tempoHeightAbove,t.bottom=e.tempoHeightAbove,t.note){var n=t.pitch-t.totalHeightInPitches+1;t.note.top=n,t.note.bottom=n;for(var r=0;r<t.note.children.length;r++){var a=t.note.children[r];a.top+=n,a.bottom+=n,a.pitch+=n,a.pitch2!==void 0&&(a.pitch2+=n)}}}function setUpperAndLowerRelativeElements(e,t,r){switch(t.type){case`part`:t.top=e.partHeightAbove+t.height,t.bottom=e.partHeightAbove;break;case`text`:case`chord`:t.chordHeightAbove?(t.top=e.chordHeightAbove,t.bottom=e.chordHeightAbove):(t.top=e.chordHeightBelow,t.bottom=e.chordHeightBelow);break;case`lyric`:t.lyricHeightAbove?(t.top=e.lyricHeightAbove,t.bottom=e.lyricHeightAbove):(t.top=e.lyricHeightBelow+r.vocal/n.STEP,t.bottom=e.lyricHeightBelow+r.vocal/n.STEP,t.pitch-=r.vocal/n.STEP);break;case`debug`:t.top=e.chordHeightAbove,t.bottom=e.chordHeightAbove;break}(t.pitch===void 0||t.top===void 0)&&console.error(`RelativeElement position not set.`,t.type,t.pitch,t.top,e)}t.exports=setUpperAndLowerElements})),yo=__commonJSMin(((e,t)=>{var n=function VoiceElements(){};n.beginLayout=function(e,t){t.i=0,t.durationindex=0,t.startx=e,t.minx=e,t.nextx=e,t.spacingduration=0},n.layoutEnded=function(e){return e.i>=e.children.length},n.getNextX=function(e){return Math.max(e.minx,e.nextx)},n.getSpacingUnits=function(e){return Math.sqrt(e.spacingduration*8)},n.layoutOneItem=function(e,t,n,r,a){var o=n.children[n.i];if(!o)return 0;var c=e-n.minx,l=n.durationindex+o.duration>0?r:0;if(o.abcelem.el_type===`note`&&!o.abcelem.rest&&n.voicenumber!==0&&a){var u=a.children[a.i],d=u&&(o.abcelem.maxpitch<=u.abcelem.maxpitch+1&&o.abcelem.maxpitch>=u.abcelem.minpitch-1||o.abcelem.minpitch<=u.abcelem.maxpitch+1&&o.abcelem.minpitch>=u.abcelem.minpitch-1);if(d&&o.abcelem.minpitch===u.abcelem.minpitch&&o.abcelem.maxpitch===u.abcelem.maxpitch&&u.heads&&u.heads.length>0&&o.heads&&o.heads.length>0&&u.heads[0].c===o.heads[0].c&&(d=!1),d){var p=u.heads&&u.heads.length>0?u.heads[0].realWidth:u.fixed.w;o.adjustedWidth||(o.adjustedWidth=p+o.w),o.w=o.adjustedWidth;for(var m=0;m<o.children.length;m++){var h=o.children[m];h.name.indexOf(`accidental`)<0&&(h.adjustedWidth||(h.adjustedWidth=h.dx+p),h.dx=h.adjustedWidth)}}}var g=getExtraWidth(o,l);return c<g&&(n.i===0||o.type!==`bar`||n.children[n.i-1].type!==`part`&&n.children[n.i-1].type!==`tempo`)&&(e+=g-c),o.setX(e),n.spacingduration=o.duration,n.minx=e+getMinWidth(o),n.i!==n.children.length-1&&(n.minx+=o.minspacing),this.updateNextX(e,t,n),e},n.shiftRight=function(e,t){var n=t.children[t.i];n&&(n.setX(n.x+e),t.minx+=e,t.nextx+=e)},n.updateNextX=function(e,t,n){n.nextx=e+t*this.getSpacingUnits(n)},n.updateIndices=function(e){this.layoutEnded(e)||(e.durationindex+=e.children[e.i].duration,e.children[e.i].type===`bar`&&(e.durationindex=Math.round(e.durationindex*64)/64),e.i++)};function getExtraWidth(e,t){var n=0;return(e.type===`note`||e.type===`bar`)&&(n=t),-e.extraw+n}function getMinWidth(e){return e.w}t.exports=n})),bo=__commonJSMin(((e,t)=>{var n=yo();function checkLastBarX(e){for(var t=0,n=0;n<e.length;n++){var r=e[n];if(r.children.length>0){var a=r.children.length-1,o=r.children[a];if(o.abcelem.el_type===`bar`){var c=o.children[0].x;c>t?t=c:o.children[0].x=t}}}}var layoutStaffGroup=function(e,t,r,a,o){var c=1e-7,l=0,u=1e3,d=o;a.startx=d;var p,m=0;for(r&&console.log(`init layout`,e),p=0;p<a.voices.length;p++)n.beginLayout(d,a.voices[p]);for(var h=0;!finished(a.voices);){for(m=null,p=0;p<a.voices.length;p++)!n.layoutEnded(a.voices[p])&&(!m||getDurationIndex(a.voices[p])<m)&&(m=getDurationIndex(a.voices[p]));var g=[],_=[];for(p=0;p<a.voices.length;p++)getDurationIndex(a.voices[p])-m>c?_.push(a.voices[p]):g.push(a.voices[p]);h=0;var y=0;for(p=0;p<g.length;p++)n.getNextX(g[p])>d&&(d=n.getNextX(g[p]),h=n.getSpacingUnits(g[p]),y=g[p].spacingduration);l+=h,u=Math.min(u,h),r&&console.log(`currentduration: `,m,l,u);var b=void 0;for(p=0;p<g.length;p++){var x=g[p];x.voicenumber===0&&(b=p);var S=b!==void 0&&g[b].voicenumber!==x.voicenumber?g[b]:void 0;isSameStaff(x,S)||(S=void 0);var C=n.layoutOneItem(d,e,x,t,S),w=C-d;if(w>0){d=C;for(var T=0;T<p;T++)n.shiftRight(w,g[T])}}for(p=0;p<_.length;p++)_[p].spacingduration-=y,n.updateNextX(d,e,_[p]);for(p=0;p<g.length;p++){var E=g[p];n.updateIndices(E)}}for(p=0;p<a.voices.length;p++)n.getNextX(a.voices[p])>d&&(d=n.getNextX(a.voices[p]),h=n.getSpacingUnits(a.voices[p]));return checkLastBarX(a.voices),l+=h,a.setWidth(d),{spacingUnits:l,minSpace:u}};function finished(e){for(var t=0;t<e.length;t++)if(!n.layoutEnded(e[t]))return!1;return!0}function getDurationIndex(e){return e.durationindex-(e.children[e.i]&&e.children[e.i].duration>0?0:5e-7)}function isSameStaff(e,t){return!e||!e.staff||!e.staff.voices||e.staff.voices.length===0||!t||!t.staff||!t.staff.voices||t.staff.voices.length===0?!1:e.staff.voices[0]===t.staff.voices[0]}t.exports=layoutStaffGroup})),xo=__commonJSMin(((e,t)=>{function getLeftEdgeOfStaff(e,t,n,r,a){var o=e.padding.left,c=0,l,u;for(l=0;l<n.length;l++)n[l].header&&(u=t.calc(n[l].header,`voicefont`,``),c=Math.max(c,u.width));if(c=addBraceSize(c,r,t),c=addBraceSize(c,a,t),c){var d=t.calc(`A`,`voicefont`,``);c+=d.width}o+=c;var p=0;return p=setBraceLocation(r,o,p),p=setBraceLocation(a,o,p),o+p}function addBraceSize(e,t,n){if(t){for(var r=0;r<t.length;r++)if(t[r].header){var a=n.calc(t[r].header,`voicefont`,``);e=Math.max(e,a.width)}}return e}function setBraceLocation(e,t,n){if(e)for(var r=0;r<e.length;r++)setLocation(t,e[r]),n=Math.max(n,e[r].getWidth());return n}function setLocation(e,t){t.x=e}t.exports=getLeftEdgeOfStaff})),So=__commonJSMin(((e,t)=>{var n=xo();function layoutInGrid(e,t,r){var a=n(e,t.getTextSize,t.voices,t.brace,t.bracket),o=getTotalDuration(t,r.minPadding),c=o.totalDuration,l=o.minSpacing*c;r.minWidth&&(l=Math.max(l,r.minWidth));var u=r.minPadding?r.minPadding/2:2;t.startx=a,t.w=l+a;for(var d=0;d<t.voices.length;d++){var p=t.voices[d];p.startx=a,p.w=l+a;for(var m=a,h=!1,g=0,_=0;_<p.children.length;_++){var y=p.children[_];h||(y.duration===0?(y.x=m,m+=y.w+y.minspacing):(h=!0,g=(l+a-m)/c,t.gridStart=m)),h&&(r.align===`center`?y.x=m+y.duration*g/2-y.w/2:y.duration===0?y.x=m+1-y.w:y.x=m+u-y.extraw,m+=y.duration*g);for(var b=0;b<y.children.length;b++){var x=y.children[b],S=x.dx?x.dx:0;x.x=y.x+S}}t.gridEnd=m}return l}function getTotalDuration(e,t){for(var n=0,r=0,a=0;a<e.voices.length;a++){for(var o=0,c=e.voices[a],l=0;l<c.children.length;l++){var u=c.children[l];if(o+=u.duration,u.duration){var d=(u.w+t)/u.duration;n=Math.max(n,d)}}r=Math.max(r,o)}return{totalDuration:r,minSpacing:n}}t.exports=layoutInGrid})),Co=__commonJSMin(((e,t)=>{var n=_o(),r=vo(),a=bo(),o=xo(),c=So(),layout=function(e,t,a,o,l,u){var d,p,m=a;for(d=0;d<t.lines.length;d++)if(p=t.lines[d],p.staff){var h=u===void 0?setXSpacing(e,m,o,p.staffGroup,t.formatting,d===t.lines.length-1,!1):c(e,p.staffGroup,u);Math.round(h)>Math.round(m)&&(m=h,l&&(d=-1))}for(d=0;d<t.lines.length;d++)if(p=t.lines[d],p.staffGroup&&p.staffGroup.voices){for(var g=0;g<p.staffGroup.voices.length;g++)n(p.staffGroup.voices[g]);r(e,p.staffGroup)}for(d=0;d<t.lines.length;d++)p=t.lines[d],p.staffGroup&&p.staffGroup.setHeight();return m},setXSpacing=function(e,t,n,r,c,l,u){for(var d=o(e,r.getTextSize,r.voices,r.brace,r.bracket),p=n,m=0;m<8;m++){var h=a(p,e.minPadding,u,r,d);if(p=calcHorizontalSpacing(l,c.stretchlast,t+e.padding.left,r.w,p,h.spacingUnits,h.minSpace,e.padding.left+e.padding.right),u&&console.log(`setXSpace`,m,r.w,p,r.minspace),p===null)break}return centerWholeRests(r.voices),r.w-d};function calcHorizontalSpacing(e,t,n,r,a,o,c,l){if(e){if(t===void 0){if(r/n<.66)return null}else if(!(1-(r+l)/n<t))return null}if(Math.abs(n-r)<2)return null;var u=r-o*a;return o>0?(a=(n-u)/o,a*c>50&&(a=50/c),a):null}function centerWholeRests(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=1;r<n.children.length-1;r++){var a=n.children[r];if(a.abcelem.rest&&(a.abcelem.rest.type===`whole`||a.abcelem.rest.type===`multimeasure`)){var o=n.children[r-1],c=n.children[r+1];a.center(o,c)}}}t.exports=layout})),wo=__commonJSMin(((e,t)=>{var n=function Classes(e){this.shouldAddClasses=e.shouldAddClasses,this.reset()};n.prototype.reset=function(){this.lineNumber=null,this.voiceNumber=null,this.measureNumber=null,this.measureTotalPerLine=[],this.noteNumber=null},n.prototype.incrLine=function(){this.lineNumber===null?this.lineNumber=0:this.lineNumber++,this.voiceNumber=null,this.measureNumber=null,this.noteNumber=null},n.prototype.incrVoice=function(){this.voiceNumber===null?this.voiceNumber=0:this.voiceNumber++,this.measureNumber=null,this.noteNumber=null},n.prototype.isInMeasure=function(){return this.measureNumber!==null},n.prototype.newMeasure=function(){this.measureNumber&&(this.measureTotalPerLine[this.lineNumber]=this.measureNumber),this.measureNumber=null,this.noteNumber=null},n.prototype.startMeasure=function(){this.measureNumber=0,this.noteNumber=0},n.prototype.incrMeasure=function(){this.measureNumber++,this.noteNumber=0},n.prototype.incrNote=function(){this.noteNumber++},n.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},n.prototype.getCurrent=function(e){return{line:this.lineNumber,measure:this.measureNumber,measureTotal:this.measureTotal(),voice:this.voiceNumber,note:this.noteNumber}},n.prototype.generate=function(e){if(!this.shouldAddClasses)return``;var t=[];if(e&&e.length>0&&t.push(e),e===`abcjs-tab-number`)return t.join(` `);if(e===`text instrument-name`)return`abcjs-text abcjs-instrument-name`;if(this.lineNumber!==null&&t.push(`l`+this.lineNumber),this.measureNumber!==null&&t.push(`m`+this.measureNumber),this.measureNumber!==null&&t.push(`mm`+this.measureTotal()),this.voiceNumber!==null&&t.push(`v`+this.voiceNumber),e&&(e.indexOf(`note`)>=0||e.indexOf(`rest`)>=0||e.indexOf(`lyric`)>=0)&&this.noteNumber!==null&&t.push(`n`+this.noteNumber),t.length>0){t=t.join(` `),t=t.split(` `);for(var n=0;n<t.length;n++)t[n].indexOf(`abcjs-`)!==0&&t[n].length>0&&(t[n]=`abcjs-`+t[n])}return t.join(` `)},t.exports=n})),To=__commonJSMin(((e,t)=>{var n=function GetFontAndAttr(e,t){this.formatting=e,this.classes=t};n.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)},n.prototype.getFamily=function(e){return e[0]===`"`&&e[e.length-1]===`"`?e.substring(1,e.length-1):e},n.prototype.calc=function(e,t){var n;typeof e==`string`?(n=this.formatting[e],n=n?{face:n.face,size:Math.round(n.size*4/3),decoration:n.decoration,style:n.style,weight:n.weight,box:n.box}:{face:`Arial`,size:16,decoration:`underline`,style:`normal`,weight:`normal`}):n={face:e.face,size:Math.round(e.size*4/3),decoration:e.decoration,style:e.style,weight:e.weight,box:e.box};var r=this.formatting.fontboxpadding?this.formatting.fontboxpadding:.1;n.padding=n.size*r;var a={"font-size":n.size,"font-style":n.style,"font-family":this.getFamily(n.face),"font-weight":n.weight,"text-decoration":n.decoration,class:this.classes.generate(t)};return{font:n,attr:a}},t.exports=n})),Eo=__commonJSMin(((e,t)=>{var n=function GetTextSize(e,t){this.getFontAndAttr=e,this.svg=t};n.prototype.updateFonts=function(e){this.getFontAndAttr.updateFonts(e)},n.prototype.attr=function(e,t){return this.getFontAndAttr.calc(e,t)},n.prototype.getFamily=function(e){return e[0]===`"`&&e[e.length-1]===`"`?e.substring(1,e.length-1):e},n.prototype.calc=function(e,t,n,r){var a=typeof t==`string`?this.attr(t,n):{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(n)}},o=this.svg.getTextSize(e,a.attr,r);return a.font.box?{height:o.height+a.font.padding*4,width:o.width+a.font.padding*4}:o},n.prototype.baselineToCenter=function(e,t,n,r,a){var o=this.calc(e,t,n).height,c=this.attr(t,n).font.size;return o*.5+(a-r-2)*c},t.exports=n})),Do=__commonJSMin(((e,t)=>{var sprintf=function(){for(var e=0,t,n=arguments[e++],r=[],a,o,c,l;n;){if(a=/^[^\x25]+/.exec(n))r.push(a[0]);else if(a=/^\x25{2}/.exec(n))r.push(`%`);else if(a=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(n)){if((t=arguments[a[1]||e++])==null||t==null)throw`Too few arguments.`;if(/[^s]/.test(a[7])&&typeof t!=`number`)throw`Expecting number but found `+typeof t;switch(a[7]){case`b`:t=t.toString(2);break;case`c`:t=String.fromCharCode(t);break;case`d`:t=parseInt(t);break;case`e`:t=a[6]?t.toExponential(a[6]):t.toExponential();break;case`f`:t=a[6]?parseFloat(t).toFixed(a[6]):parseFloat(t);break;case`o`:t=t.toString(8);break;case`s`:t=(t=String(t))&&a[6]?t.substring(0,a[6]):t;break;case`u`:t=Math.abs(t);break;case`x`:t=t.toString(16);break;case`X`:t=t.toString(16).toUpperCase();break}t=/[def]/.test(a[7])&&a[2]&&t>0?`+`+t:t,c=a[3]?a[3]==`0`?`0`:a[3][1]:` `,l=a[5]-String(t).length,o=a[5]?str_repeat(c,l):``,r.push(a[4]?t+o:o+t)}else throw`Huh ?!`;n=n.substring(a[0].length)}return r.join(``)};t.exports=sprintf})),Oo=__commonJSMin(((e,t)=>{function roundNumber(e){return parseFloat(e.toFixed(2))}t.exports=roundNumber})),ko=__commonJSMin(((e,t)=>{var n=Oo();function renderText(e,t,r){var a=t.y;if(t.phrases){var o=e.paper.richTextLine(t.phrases,t.x,t.y,t.klass,t.anchor);return o}if(t.lane){var c=t.dim.font.size*.25;a+=(t.dim.font.size+c)*t.lane}var l;t.dim?(l=t.dim,l.attr.class=t.klass):l=e.controller.getFontAndAttr.calc(t.type,t.klass),t.anchor&&(l.attr[`text-anchor`]=t.anchor),t[`dominant-baseline`]&&(l.attr[`dominant-baseline`]=t[`dominant-baseline`]),l.attr.x=t.x,l.attr.y=a,t.centerVertically||(l.attr.y+=l.font.size),t.type===`debugfont`&&(console.log(`Debug msg: `+t.text),l.attr.stroke=`#ff0000`),t.cursor&&(l.attr.cursor=t.cursor);var u=t.text.replace(/\n\n/g,`
74
+
75
+ `);u=u.replace(/^\n/,`\xA0
76
+ `),l.font.box&&(r||e.paper.openGroup({klass:l.attr.class,fill:e.foregroundColor,"data-name":t.name}),l.attr[`text-anchor`]===`end`?l.attr.x-=l.font.padding:l.attr[`text-anchor`]===`start`&&(l.attr.x+=l.font.padding),l.attr.y+=l.font.padding,delete l.attr.class),t.noClass&&delete l.attr.class,l.attr.x=n(l.attr.x),l.attr.y=n(l.attr.y),t.name&&(l.attr[`data-name`]=t.name);var o=e.paper.text(u,l.attr);if(l.font.box){var d=o.getBBox(),p=0;l.attr[`text-anchor`]===`middle`?p=d.width/2+l.font.padding:l.attr[`text-anchor`]===`end`&&(p=d.width+l.font.padding*2);var m=0;t.centerVertically&&(m=d.height-l.font.padding),e.paper.rect({"data-name":`box`,x:Math.round(t.x-p),y:Math.round(a-m),width:Math.round(d.width+l.font.padding*2),height:Math.round(d.height+l.font.padding*2)}),r||(o=e.paper.closeGroup())}return o}t.exports=renderText})),Ao=__commonJSMin(((e,t)=>{var n=Do(),r=la(),a=ko();function drawBrace(e,t,n){var a=t.startVoice.staff.absoluteY-r.STEP*10;return t.endVoice&&t.endVoice.staff?t.endY=t.endVoice.staff.absoluteY-r.STEP*2:t.lastContinuedVoice&&t.lastContinuedVoice.staff?t.endY=t.lastContinuedVoice.staff.absoluteY-r.STEP*2:t.endY=t.startVoice.staff.absoluteY-r.STEP*2,draw(e,t.x,a,t.endY,t.type,t.header,n)}function straightPath(e,t,a,o,c){t+=r.STEP;var l=r.STEP*.75,u=r.STEP*.75,d=o-a,p=n(`M %f %f l %f %f l %f %f l %f %f z`,t,a-u,0,d+u*2,l,0,0,-(d+u*2)),m=r.STEP*2,h=r.STEP;return p+=n(`M %f %f q %f %f %f %f q %f %f %f %f z`,t+l,a-u,m*.6,h*.2,m,-h,-m*.1,h*.3,-m,h+r.STEP),p+=n(`M %f %f q %f %f %f %f q %f %f %f %f z`,t+l,a+u+d,m*.6,-h*.2,m,h,-m*.1,-h*.3,-m,-h-r.STEP),e.paper.path({path:p,stroke:e.foregroundColor,fill:e.foregroundColor,class:e.controller.classes.generate(c),"data-name":c})}function curvyPath(e,t,n,r,a){var o=r-n,c=curve(t,n,[7.5,-8,21,0,18.5,-10.5,7.5],[0,o/5.5,o/3.14,o/2,o/2.93,o/4.88,0]);return c+=curve(t,n,[0,17.5,-7.5,6.6,-5,20,0],[o/2,o/1.46,o/1.22,o,o/1.19,o/1.42,o/2]),e.paper.path({path:c,stroke:e.foregroundColor,fill:e.foregroundColor,class:e.controller.classes.generate(a),"data-name":a})}function curve(e,t,r,a){return n(`M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z`,e+r[0],t+a[0],e+r[1],t+a[1],e+r[2],t+a[2],e+r[3],t+a[3],e+r[4],t+a[4],e+r[5],t+a[5],e+r[6],t+a[6])}var draw=function(e,t,n,r,o,c,l){var u;if(c){e.paper.openGroup({klass:e.controller.classes.generate(`staff-extra voice-name`),"data-name":o});var d=n+(r-n)/2;d-=e.controller.getTextSize.baselineToCenter(c,`voicefont`,`staff-extra voice-name`,0,1),a(e,{x:e.padding.left,y:d,text:c,type:`voicefont`,klass:`staff-extra voice-name`,anchor:`start`,centerVertically:!0})}return o===`brace`?u=curvyPath(e,t,n,r,o):o===`bracket`&&(u=straightPath(e,t,n,r,o)),c&&(u=e.paper.closeGroup()),l.wrapSvgEl({el_type:o,startChar:-1,endChar:-1},u),u};t.exports=drawBrace})),jo=__commonJSMin(((e,t)=>{function printPath(e,t,n){return e.paper.path(t)}t.exports=printPath})),Mo=__commonJSMin(((e,t)=>{var n=Do(),r=jo(),a=Oo();function drawGlissando(e,t,n){(!t.anchor1||!t.anchor2||!t.anchor1.heads||!t.anchor2.heads||t.anchor1.heads.length===0||t.anchor2.heads.length===0)&&window.console.error(`Glissando Element not set.`);var r=4,a=e.calcY(t.anchor1.heads[0].pitch),o=e.calcY(t.anchor2.heads[0].pitch),c=t.anchor1.x+t.anchor1.w/2,l=t.anchor2.x+t.anchor2.w/2,u=lineLength(c,a,l,o),d=t.anchor1.w/2+r,p=t.anchor2.w/2+r,m=slope(c,a,l,o),h=getY(a,m,d);getY(o,m,-p);var g=numSquigglies(u-d-p),_=drawSquiggly(e,c+d,h,g,m);return n.wrapSvgEl({el_type:`glissando`,startChar:-1,endChar:-1},_),[_]}function lineLength(e,t,n,r){var a=n-e,o=r-t;return Math.sqrt(a*a+o*o)}function slope(e,t,n,r){return(r-t)/(n-e)}function getY(e,t,n){return a(e+n*t)}function numSquigglies(e){return Math.max(2,Math.floor((e-10)/6))}var o=[[3.5,-4.8]],c=[[1.5,-1],[.3,-.3],[-3.5,3.8]],l=[[-1.5,2]],u=[[3,4],[3,-4]],d=[[-3,4],[-3,-4]];function segment(e,t){for(var n=``,r=0;r<e.length;r++)n+=`l`+e[r][0]+` `+getY(e[r][1],t,e[r][0]);return n}var drawSquiggly=function(e,t,a,p,m){var h=n(`M %f %f`,t,a);h+=segment(o,m);var g;for(g=0;g<p;g++)h+=segment(u,m);for(h+=segment(c,m),g=0;g<p;g++)h+=segment(d,m);return h+=segment(l,m)+`z`,r(e,{path:h,highlight:`stroke`,stroke:e.foregroundColor,class:e.controller.classes.generate(`decoration`),"data-name":`glissando`})};t.exports=drawGlissando})),No=__commonJSMin(((e,t)=>{var n=Do(),r=jo(),a=Oo();function drawCrescendo(e,t,n){t.pitch===void 0&&window.console.error(`Crescendo Element y-coordinate not set.`);var r=e.calcY(t.pitch)+4,a=8,o=t.anchor1?t.anchor1.x:0,c=t.anchor2?t.anchor2.x:800,l=t.dir===`<`?drawLine(e,r+a/2,r,r+a/2,r+a,o,c):drawLine(e,r,r+a/2,r+a,r+a/2,o,c);return n.wrapSvgEl({el_type:`dynamicDecoration`,startChar:-1,endChar:-1},l),[l]}var drawLine=function(e,t,o,c,l,u,d){return t=a(t),o=a(o),c=a(c),l=a(l),u=a(u),d=a(d),r(e,{path:n(`M %f %f L %f %f M %f %f L %f %f`,u,t,d,o,u,c,d,l),highlight:`stroke`,stroke:e.foregroundColor,class:e.controller.classes.generate(`dynamics decoration`),"data-name":`dynamics`})};t.exports=drawCrescendo})),Po=__commonJSMin(((e,t)=>{var n=Oo();function Group(){this.ingroup=!1}Group.prototype.beginGroup=function(e,t){this.paper=e,this.controller=t,this.path=[],this.lastM=[0,0],this.ingroup=!0,this.paper.openGroup()},Group.prototype.isInGroup=function(){return this.ingroup},Group.prototype.addPath=function(e){if(e||(e=[]),e.length!==0){e[0][0]=`m`,e[0][1]=n(e[0][1]-this.lastM[0]),e[0][2]=n(e[0][2]-this.lastM[1]),this.lastM[0]+=e[0][1],this.lastM[1]+=e[0][2],this.path.push(e[0]);for(var t=1,r=e.length;t<r;t++)e[t][0]===`m`&&(this.lastM[0]+=e[t][1],this.lastM[1]+=e[t][2]),this.path.push(e[t])}},Group.prototype.endGroup=function(e,t){this.ingroup=!1;for(var n=``,r=0;r<this.path.length;r++)n+=this.path[r].join(` `);this.path=[];var a=this.paper.closeGroup();return a&&(a.setAttribute(`class`,this.controller.classes.generate(e)),a.setAttribute(`fill`,this.controller.renderer.foregroundColor),a.setAttribute(`stroke`,`none`),a.setAttribute(`data-name`,t)),a},t.exports=new Group})),Fo=__commonJSMin(((e,t)=>{var n=ko(),r=Ra(),a=Po();function printSymbol(e,t,o,c,l){var u,d;if(!c)return null;if(c.length>1&&c.indexOf(`.`)<0){var p=a.isInGroup()?``:l.klass;e.paper.openGroup({"data-name":l.name,klass:p});for(var m=0,h=0;h<c.length;h++){var g=c[h];d=r.getYCorr(g),u=r.printSymbol(t+m,e.calcY(o+d),g,e.paper,{stroke:l.stroke,fill:l.fill}),u?h<c.length-1&&(m+=kernSymbols(g,c[h+1],r.getSymbolWidth(g))):n(e,{x:t,y:e.y,text:`no symbol:`+c,type:`debugfont`,klass:`debug-msg`,anchor:`start`},!1)}return e.paper.closeGroup()}else return d=r.getYCorr(c),u=a.isInGroup()?r.printSymbol(t,e.calcY(o+d),c,e.paper,{"data-name":l.name}):r.printSymbol(t,e.calcY(o+d),c,e.paper,{klass:l.klass,stroke:l.stroke,fill:l.fill,"data-name":l.name}),u||(n(e,{x:t,y:e.y,text:`no symbol:`+c,type:`debugfont`,klass:`debug-msg`,anchor:`start`},!1),null)}function kernSymbols(e,t,n){var r=n;return e===`f`&&t===`f`&&(r=r*2/3),e===`p`&&t===`p`&&(r=r*5/6),e===`f`&&t===`z`&&(r=r*5/8),r}t.exports=printSymbol})),Io=__commonJSMin(((e,t)=>{var n=Fo();function drawDynamics(e,t,r){t.pitch===void 0&&window.console.error(`Dynamic Element y-coordinate not set.`);var a=n(e,t.anchor.x,t.pitch,t.dec,{scalex:1,scaley:1,klass:e.controller.classes.generate(`decoration dynamics`),fill:e.foregroundColor,stroke:`none`,name:`dynamics`});return r.wrapSvgEl({el_type:`dynamicDecoration`,startChar:-1,endChar:-1,decoration:t.dec},a),[a]}t.exports=drawDynamics})),Lo=__commonJSMin(((e,t)=>{var n=Do(),r=ko(),a=jo(),o=Oo();function drawTriplet(e,t,n){e.paper.openGroup({klass:e.controller.classes.generate(`triplet `+t.durationClass),"data-name":`triplet`}),t.hasBeam||drawBracket(e,t.anchor1.x,t.startNote,t.anchor2.x+t.anchor2.w,t.endNote),r(e,{x:t.xTextPos,y:e.calcY(t.yTextPos-1),text:``+t.number,type:`tripletfont`,anchor:`middle`,centerVertically:!0,noClass:!0,name:``+t.number},!0);var a=e.paper.closeGroup();return n.wrapSvgEl({el_type:`triplet`,startChar:-1,endChar:-1},a),a}function drawLine(e,t,r,a){return n(`M %f %f L %f %f`,o(e),o(t),o(r),o(a))}function drawBracket(e,t,n,r,o){n=e.calcY(n),o=e.calcY(o);var c=5,l=``;l+=drawLine(t,n,t,n+c),l+=drawLine(r,o,r,o+c);var u=t+(r-t)/2,d=8,p=(o-n)/(r-t),m=u-d,h=n+(m-t)*p;l+=drawLine(t,n,m,h);var g=u+d,_=n+(g-t)*p;l+=drawLine(g,_,r,o),a(e,{path:l,stroke:e.foregroundColor,"data-name":`triplet-bracket`})}t.exports=drawTriplet})),Ro=__commonJSMin(((e,t)=>{var n=Do(),r=ko(),a=jo(),o=Oo();function drawEnding(e,t,c,l,u){t.pitch===void 0&&window.console.error(`Ending Element y-coordinate not set.`);var d=o(e.calcY(t.pitch)),p=20,m=``;t.anchor1&&(c=o(t.anchor1.x+t.anchor1.w),m+=n(`M %f %f L %f %f `,c,d,c,o(d+p))),t.anchor2&&(l=o(t.anchor2.x),m+=n(`M %f %f L %f %f `,l,d,l,o(d+p))),m+=n(`M %f %f L %f %f `,c,d,l,d),e.paper.openGroup({klass:e.controller.classes.generate(`ending`),"data-name":`ending`}),a(e,{path:m,stroke:e.foregroundColor,fill:e.foregroundColor,"data-name":`line`}),t.anchor1&&r(e,{x:o(c+5),y:o(e.calcY(t.pitch-.5)),text:t.text,type:`repeatfont`,klass:`ending`,anchor:`start`,noClass:!0,name:t.text});var h=e.paper.closeGroup();return u.wrapSvgEl({el_type:`ending`,startChar:-1,endChar:-1},h),[h]}t.exports=drawEnding})),zo=__commonJSMin(((e,t)=>{var n=Do(),r=Oo();function drawTie(e,t,n,r,a){layout(t,n,r);var o=``;t.anchor1?o+=`abcjs-start-m`+t.anchor1.parent.counters.measure+`-n`+t.anchor1.parent.counters.note:o+=`abcjs-start-edge`,t.anchor2?o+=` abcjs-end-m`+t.anchor2.parent.counters.measure+`-n`+t.anchor2.parent.counters.note:o+=` abcjs-end-edge`,t.hint&&(o=`abcjs-hint`);var c=t.fixedY?1.5:0,l=drawArc(e,t.startX,t.endX,t.startY+c,t.endY+c,t.above,o,t.isTie,t.dotted),u=-1;t.anchor1&&!t.isTie&&(u=t.anchor1.parent.abcelem.startChar-1);var d=-1;return t.anchor2&&!t.isTie&&(d=t.anchor2.parent.abcelem.endChar+1),a.wrapSvgEl({el_type:`slur`,startChar:u,endChar:d},l),[l]}var layout=function(e,t,n){!e.anchor1||!e.anchor2||e.anchor1.pitch===e.anchor2.pitch&&e.internalNotes.length===0?e.isTie=!0:e.isTie=!1,e.isTie?(e.calcTieDirection(),e.calcX(t,n),e.calcTieY()):(e.calcSlurDirection(),e.calcX(t,n),e.calcSlurY()),e.avoidCollisionAbove()},drawArc=function(e,t,a,o,c,l,u,d,p){var m=d?1.2:1.5;t=r(t+6),a=r(a+4),o+=l?m:-m,c+=l?m:-m;var h=r(e.calcY(o)),g=r(e.calcY(c)),_=a-t,y=g-h,b=Math.sqrt(_*_+y*y),x=_/b,S=y/b,C=b/3.5,w=d?10:25,T=(l?-1:1)*Math.min(w,Math.max(4,C)),E=r(t+C*x-T*S),D=r(h+C*S+T*x),O=r(a-C*x-T*S),k=r(g-C*S+T*x),A=2;u?u+=` slur`:u=`slur`,u+=d?` tie`:` legato`;var j;if(p){u+=` dotted`;var M=n(`M %f %f C %f %f %f %f %f %f`,t,h,E,D,O,k,a,g);j=e.paper.path({path:M,stroke:e.foregroundColor,fill:`none`,"stroke-dasharray":`5 5`,class:e.controller.classes.generate(u),"data-name":d?`tie`:`slur`})}else{var N=n(`M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z`,t,h,E,D,O,k,a,g,r(O-A*S),r(k+A*x),r(E-A*S),r(D+A*x),t,h);j=e.paper.path({path:N,stroke:`none`,fill:e.foregroundColor,class:e.controller.classes.generate(u),"data-name":d?`tie`:`slur`})}return j};t.exports=drawTie})),Bo=__commonJSMin(((e,t)=>{var n=jo(),r=Oo();function drawBeam(e,t){if(t.beams.length!==0){for(var r=``,a=0;a<t.beams.length;a++){var o=t.beams[a];if(o.split){for(var c=getSlope(e,o.startX,o.startY,o.endX,o.endY),l=[],u=0;u<o.split.length;u+=2)l.push([o.split[u],o.split[u+1]]);for(u=0;u<l.length;u++){var d=getY(o.startX,o.startY,c,l[u][0]),p=getY(o.startX,o.startY,c,l[u][1]);r+=draw(e,l[u][0],d,l[u][1],p,o.dy)}}else r+=draw(e,o.startX,o.startY,o.endX,o.endY,o.dy)}var m=(`abcjs-d`+t.duration).replace(/\./g,`-`),h=e.controller.classes.generate(`beam-elem `+m);return[n(e,{path:r,stroke:`none`,fill:e.foregroundColor,class:h})]}}function draw(e,t,n,a,o,c){n=r(e.calcY(n)),o=r(e.calcY(o)),t=r(t),a=r(a);var l=r(n+c),u=r(o+c);return`M`+t+` `+n+` L`+a+` `+o+`L`+a+` `+u+` L`+t+` `+l+`z`}function getSlope(e,t,n,r,a){return(a-n)/(r-t)}function getY(e,t,n,r){return t+(r-e)*n}t.exports=drawBeam})),Vo=__commonJSMin(((e,t)=>{var n=Po(),r=Oo();function printStem(e,t,a,o,c,l,u){if(a<0||o<c){var d=r(c);c=r(o),o=d}else o=r(o),c=r(c);t=r(t);var p=r(t+a);if(e.firefox112){t+=a/2;var m={x1:t,x2:t,y1:o,y2:c,stroke:e.foregroundColor,"stroke-width":Math.abs(a)};return l&&(m.class=l),u&&(m[`data-name`]=u),e.paper.lineToBack(m)}for(var h=[[`M`,t,o],[`L`,t,c],[`L`,p,c],[`L`,p,o],[`z`]],m={path:``},g=0;g<h.length;g++)m.path+=h[g].join(` `);return l&&(m.class=l),u&&(m[`data-name`]=u),n.isInGroup()||(m.stroke=`none`,m.fill=e.foregroundColor),e.paper.pathToBack(m)}t.exports=printStem})),Ho=__commonJSMin(((e,t)=>{var n=Do(),r=Oo();function printLine(e,t,a,o,c,l,u){var d=e.foregroundColor;t=r(t),a=r(a);var p=r(o-u),m=r(o+u);if(e.firefox112){o+=u/2;var h={x1:t,x2:a,y1:o,y2:o,stroke:e.foregroundColor,"stroke-width":Math.abs(u*2)};return c&&(h.class=c),l&&(h[`data-name`]=l),e.paper.lineToBack(h)}var g={path:n(`M %f %f L %f %f L %f %f L %f %f z`,t,p,a,p,a,m,t,m),stroke:`none`,fill:d};return l&&(g[`data-name`]=l),c&&(g.class=c),e.paper.pathToBack(g)}t.exports=printLine})),Uo=__commonJSMin(((e,t)=>{var n=Ho();function printStaffLine(e,t,r,a,o,c,l){return n(e,t,r,e.calcY(a),o,c,l)}t.exports=printStaffLine})),Wo=__commonJSMin(((e,t)=>{var n=ko(),r=Vo(),a=Uo(),o=Fo();function drawRelativeElement(e,t,c){t.pitch===void 0&&window.console.error(t.type+` Relative Element y-coordinate not set.`);var l=e.calcY(t.pitch);switch(t.type){case`symbol`:if(t.c===null)return null;var u=`symbol`;t.klass&&(u+=` `+t.klass),t.graphelem=o(e,t.x,t.pitch,t.c,{scalex:t.scalex,scaley:t.scaley,klass:e.controller.classes.generate(u),name:t.name});break;case`debug`:t.graphelem=n(e,{x:t.x,y:e.calcY(15),text:``+t.c,type:`debugfont`,klass:e.controller.classes.generate(`debug-msg`),anchor:`start`,centerVertically:!1,dim:t.dim},!1);break;case`tabNumber`:var d=`middle`,p=`tabnumberfont`,m=`abcjs-tab-number`;t.isGrace&&(p=`tabgracefont`,l+=2.5,m=`tab-grace`),t.graphelem=n(e,{x:t.x,y:l,text:``+t.c,type:p,klass:e.controller.classes.generate(m),anchor:d,centerVertically:!1,dim:t.dim,cursor:`default`},!1);break;case`barNumber`:t.graphelem=n(e,{x:t.x,y:l,text:``+t.c,type:`measurefont`,klass:e.controller.classes.generate(`bar-number`),anchor:`middle`,dim:t.dim,name:`bar-number`},!0);break;case`lyric`:t.graphelem=n(e,{x:t.x,y:l,text:t.c,type:`vocalfont`,klass:e.controller.classes.generate(`lyric`),anchor:`middle`,dim:t.dim,name:`lyric`},!1);break;case`chord`:t.graphelem=n(e,{x:t.x,y:l,text:t.c,type:`gchordfont`,klass:e.controller.classes.generate(`chord`),anchor:`middle`,dim:t.dim,lane:t.getLane(),name:`chord`},!1);break;case`decoration`:t.graphelem=n(e,{x:t.x,y:l+6,text:t.c,type:`annotationfont`,klass:e.controller.classes.generate(`annotation`),anchor:t.anchor,centerVertically:!0,dim:t.dim},!1);break;case`text`:t.graphelem=n(e,{x:t.x,y:l,text:t.c,type:`annotationfont`,klass:e.controller.classes.generate(`annotation`),anchor:`start`,centerVertically:t.centerVertically,dim:t.dim,lane:t.getLane(),name:`annotation`},!1);break;case`multimeasure-text`:t.graphelem=n(e,{x:t.x+t.w/2,y:l,text:t.c,type:`tempofont`,klass:e.controller.classes.generate(`rest`),anchor:`middle`,centerVertically:!1,dim:t.dim},!1);break;case`part`:t.graphelem=n(e,{x:t.x,y:l,text:t.c,type:`partsfont`,klass:e.controller.classes.generate(`part`),anchor:`start`,dim:t.dim,name:t.c},!0);break;case`bar`:t.graphelem=r(e,t.x,t.linewidth+e.lineThickness,l,c||e.calcY(t.pitch2),null,`bar`);break;case`stem`:var h=t.linewidth>0?t.linewidth+e.lineThickness:t.linewidth-e.lineThickness;t.graphelem=r(e,t.x,h,l,e.calcY(t.pitch2),`abcjs-stem`,`stem`);break;case`ledger`:t.graphelem=a(e,t.x,t.x+t.w,t.pitch,`abcjs-ledger`,`ledger`,.35+e.lineThickness);break}return t.scalex!==1&&t.graphelem&&scaleExistingElem(e.paper,t.graphelem,t.scalex,t.scaley,t.x,l),t.graphelem}function scaleExistingElem(e,t,n,r,a,o){e.setAttributeOnElement(t,{style:`transform:scale(`+n+`,`+r+`);transform-origin:`+a+`px `+o+`px;`})}t.exports=drawRelativeElement})),Go=__commonJSMin(((e,t)=>{var n=Wo(),r=ko();function drawTempo(e,t){var a=t.x;t.pitch===void 0&&window.console.error(`Tempo Element y-coordinate not set.`),t.tempo.el_type=`tempo`;var o=e.calcY(t.pitch)+2,c,l;if(t.tempo.preString){c=r(e,{x:a,y:o,text:t.tempo.preString,type:`tempofont`,klass:`abcjs-tempo`,anchor:`start`,noClass:!0,name:`pre`},!0),l=e.controller.getTextSize.calc(t.tempo.preString,`tempofont`,`tempo`,c);var u=l.width,d=u/t.tempo.preString.length;a+=u+d}if(t.note){t.note.setX(a);for(var p=0;p<t.note.children.length;p++)n(e,t.note.children[p],a);a+=t.note.w+5;var m=`= `+t.tempo.bpm;c=r(e,{x:a,y:o,text:m,type:`tempofont`,klass:`abcjs-tempo`,anchor:`start`,noClass:!0,name:`beats`}),l=e.controller.getTextSize.calc(m,`tempofont`,`tempo`,c);var h=l.width,g=h/m.length;a+=h+g}t.tempo.postString&&r(e,{x:a,y:o,text:t.tempo.postString,type:`tempofont`,klass:`abcjs-tempo`,anchor:`start`,noClass:!0,name:`post`},!0)}t.exports=drawTempo})),Ko=__commonJSMin(((e,t)=>{var n=Go(),r=Wo(),a=la(),o=xa(),c=Po();function drawAbsolute(e,t,l,u,d){if(!t.invisible){var p=t.children.length>0&&t.children[0].type===`TempoElement`;t.elemset=[],c.beginGroup(e.paper,e.controller);for(var m=0;m<t.children.length;m++){var h=t.children[m];switch(h.type){case`TempoElement`:n(e,h);break;default:var g=r(e,h,l);h.type===`symbol`&&h.c&&h.c.indexOf(`notehead`)>=0&&g.setAttribute(`class`,`abcjs-notehead`)}}var _=t.type;if((t.type===`note`||t.type===`rest`)&&(t.counters=e.controller.classes.getCurrent(),_+=` d`+Math.round(t.durationClass*1e3)/1e3,_=_.replace(/\./g,`-`),t.abcelem.pitches))for(var y=0;y<t.abcelem.pitches.length;y++)_+=` p`+t.abcelem.pitches[y].pitch;var b=c.endGroup(_,t.type);if(b){if(t.cloned&&(t.cloned.overrideClasses=b.className.baseVal),t.overrideClasses){var x=b.classList&&b.classList.length>0?b.classList[0]+` `:``;b.setAttribute(`class`,x+t.overrideClasses)}if(p)t.startChar=t.abcelem.startChar,t.endChar=t.abcelem.endChar,u.add(t,b,!1,d);else{t.elemset.push(b);var S=!1;(t.type===`note`||t.type===`tabNumber`)&&(S=!0),u.add(t,b,S,d)}}else t.elemset.length>0&&u.add(t,t.elemset[0],t.type===`note`,d);if(t.klass&&o(t.elemset,`mark`,``,`#00ff00`),t.hint&&o(t.elemset,`abcjs-hint`,``,null),t.abcelem.abselem=t,t.heads&&t.heads.length>0){t.notePositions=[];for(var C=0;C<t.heads.length;C++)t.notePositions.push({x:t.heads[C].x+t.heads[C].w/2,y:d.zero-t.heads[C].pitch*a.STEP})}}}t.exports=drawAbsolute})),qo=__commonJSMin(((e,t)=>{var n=Mo(),r=No(),a=Io(),o=Lo(),c=Ro(),l=zo(),u=Bo(),d=ko(),p=Ko();function drawVoice(e,t,m,h,g){var _=t.w-1;e.staffbottom=t.staff.bottom;var y=e.foregroundColor;if(t.color&&(e.foregroundColor=t.color),t.header){var b=d(e,{x:e.padding.left,y:e.calcY(t.headerPosition),text:t.header,type:`voicefont`,klass:`staff-extra voice-name`,anchor:`start`,centerVertically:!0,name:`voice-name`},!0);h.wrapSvgEl({el_type:`voiceName`,startChar:-1,endChar:-1,text:t.header},b)}var x,S,C=!1;for(x=0;x<t.children.length;x++){S=t.children[x],(S.type===`note`||S.type===`rest`)&&(C=!0);var w=!1;S.type!==`staff-extra`&&!e.controller.classes.isInMeasure()&&(e.controller.classes.startMeasure(),w=!0),t.staff.isTabStaff&&(S.invisible=!1,S.type==`bar`&&S.abcelem.lastBar&&(m=t.topLine)),p(e,S,t.barto||x===t.children.length-1?m:0,h,g),(S.type===`note`||isNonSpacerRest(S))&&e.controller.classes.incrNote(),S.type===`bar`&&!w&&C&&e.controller.classes.incrMeasure()}for(e.controller.classes.startMeasure(),x=0;x<t.beams.length;x++){var T=t.beams[x];T===`bar`?e.controller.classes.incrMeasure():u(e,T,h)}for(e.controller.classes.startMeasure(),x=0;x<t.otherchildren.length;x++)if(S=t.otherchildren[x],S===`bar`)e.controller.classes.incrMeasure();else switch(S.type){case`GlissandoElem`:S.elemset=n(e,S,h);break;case`CrescendoElem`:S.elemset=r(e,S,h);break;case`DynamicDecoration`:S.elemset=a(e,S,h);break;case`TripletElem`:o(e,S,h);break;case`EndingElem`:S.elemset=c(e,S,t.startx+10,_,h);break;case`TieElem`:S.elemset=l(e,S,t.startx+10,_,h);break;default:console.log(S),p(e,S,t.startx+10,_,h,g)}e.foregroundColor=y}function isNonSpacerRest(e){return e.type===`rest`?!!(e.abcelem&&e.abcelem.rest&&e.abcelem.rest.type!==`spacer`):!1}t.exports=drawVoice})),Jo=__commonJSMin(((e,t)=>{var n=Uo();function printStaff(e,t,r,a,o,c){var l=`abcjs-top-line`,u=2;o&&(u=o),e.paper.openGroup({prepend:!0,klass:e.controller.classes.generate(`abcjs-staff`)});var d=0,p=0;if(a===1)n(e,t,r,6,l,null,c+e.lineThickness),d=e.calcY(10),p=e.calcY(2);else for(var m=a-1;m>=0;m--){var h=(m+1)*u;p=e.calcY(h),d===0&&(d=p),n(e,t,r,h,l,null,c+e.lineThickness),l=void 0}return e.paper.closeGroup(),[d,p]}t.exports=printStaff})),Yo=__commonJSMin(((e,t)=>{function printDebugBox(e,t,n){var r=e.paper.rectBeneath(t);return n&&e.paper.text(n,{x:0,y:t.y+7,"text-anchor":`start`,"font-size":`14px`,fill:`rgba(0,0,255,.4)`,stroke:`rgba(0,0,255,.4)`}),r}t.exports=printDebugBox})),Xo=__commonJSMin(((e,t)=>{function drawSeparator(e,t){var n=`rgba(0,0,0,255)`,r=`rgba(0,0,0,0)`,a=Math.round(e.y),o=(e.controller.width-t)/2,c=o+t,l=`M `+o+` `+a+` L `+c+` `+a+` L `+c+` `+(a+1)+` L `+o+` `+(a+1)+` L `+o+` `+a+` z`;e.paper.pathToBack({path:l,stroke:r,fill:n,class:e.controller.classes.generate(`defined-text`)})}t.exports=drawSeparator})),Zo=__commonJSMin(((e,t)=>{var n=Xo(),r=ko();function nonMusic(e,t,a){for(var o=0;o<t.rows.length;o++){var c=t.rows[o];if(c.absmove)e.absolutemoveY(c.absmove);else if(c.move)e.moveY(c.move);else if(c.text||c.phrases){var l=r(e,{x:c.left?c.left:0,y:e.y,text:c.text,phrases:c.phrases,"dominant-baseline":c[`dominant-baseline`],type:c.font,klass:c.klass,name:c.name,anchor:c.anchor});c.absElemType&&a.wrapSvgEl({el_type:c.absElemType,name:c.name,startChar:c.startChar,endChar:c.endChar,text:c.text},l)}else if(c.separator)n(e,c.separator);else if(c.startGroup)e.paper.openGroup({klass:c.klass,"data-name":c.name});else if(c.endGroup){var u=e.paper.closeGroup();c.absElemType&&a.wrapSvgEl({el_type:c.absElemType,name:c.name,startChar:c.startChar,endChar:c.endChar,text:``},u)}}}t.exports=nonMusic})),Qo=__commonJSMin(((e,t)=>{var n=la(),r=Ao(),a=qo(),o=Jo(),c=Yo(),l=Vo(),u=Zo();function drawStaffGroup(e,t,r,d){for(var p,m=e.y,h=0;h<t.staffs.length;h++){var g=t.staffs[h];e.moveY(n.STEP,g.top),g.absoluteY=e.y,e.showDebug&&(e.showDebug.indexOf(`box`)>=0&&g.voices&&boxAllElements(e,t.voices,g.voices),e.showDebug.indexOf(`grid`)>=0&&(e.paper.dottedLine({x1:e.padding.left,x2:e.padding.left+e.controller.width,y1:m,y2:m,stroke:`#0000ff`}),c(e,{x:e.padding.left,y:e.calcY(g.originalTop),width:e.controller.width,height:e.calcY(g.originalBottom)-e.calcY(g.originalTop),fill:e.foregroundColor,stroke:e.foregroundColor,"fill-opacity":.1,"stroke-opacity":.1}),p=0,debugPrintGridItem(g,`chordHeightAbove`),debugPrintGridItem(g,`chordHeightBelow`),debugPrintGridItem(g,`dynamicHeightAbove`),debugPrintGridItem(g,`dynamicHeightBelow`),debugPrintGridItem(g,`endingHeightAbove`),debugPrintGridItem(g,`lyricHeightAbove`),debugPrintGridItem(g,`lyricHeightBelow`),debugPrintGridItem(g,`partHeightAbove`),debugPrintGridItem(g,`tempoHeightAbove`),debugPrintGridItem(g,`volumeHeightAbove`),debugPrintGridItem(g,`volumeHeightBelow`))),e.moveY(n.STEP,-g.bottom),e.showDebug&&e.showDebug.indexOf(`grid`)>=0&&e.paper.dottedLine({x1:e.padding.left,x2:e.padding.left+e.controller.width,y1:e.y,y2:e.y,stroke:`#0000aa`})}for(var _,y,b=2,x=0,S=0;S<t.voices.length;S++){var C=t.voices[S].staff,w=t.voices[S].tabNameInfos;if(e.y=C.absoluteY,e.controller.classes.incrVoice(),!t.voices[S].duplicate){if(_||(_=e.calcY(10)),y=e.calcY(b),C.lines!==0){C.linePitch&&(b=C.linePitch),e.controller.classes.newMeasure();var T=o(e,t.startx,t.w,C.lines,C.linePitch,.35);y=T[1],C.bottomLine=y,C.topLine=T[0],C.hasTab&&(x=C.topLine),C.hasStaff&&(x=C.hasStaff.topLine,t.voices[S].barto=!0,t.voices[S].topLine=_)}printBrace(e,C.absoluteY,t.brace,S,r),printBrace(e,C.absoluteY,t.bracket,S,r)}a(e,t.voices[S],x,r,{top:m,zero:e.y,height:t.height*n.STEP});var E=0;if(w){var D={rows:[]};D.rows.push({absmove:y+2}),D.rows.push({left:t.startx+8,text:w.name,font:`tablabelfont`,klass:`text instrument-name`,anchor:`start`}),D.rows.push({move:w.textSize.height}),u(e,D),E=w.textSize.height}e.controller.classes.newMeasure(),t.voices[S].duplicate||(x=e.calcY(2+E))}e.controller.classes.newMeasure();var O=t.staffs.length;O>1&&(_=t.staffs[0].topLine,y=t.staffs[O-1].bottomLine,l(e,t.startx,.6,_,y,null)),e.y=m;function debugPrintGridItem(t,r){var a=[`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(t.positionY&&t.positionY[r]){var o=t.specialY[r]*n.STEP;r===`chordHeightAbove`&&t.specialY.chordLines&&t.specialY.chordLines.above&&(o*=t.specialY.chordLines.above),r===`chordHeightBelow`&&t.specialY.chordLines&&t.specialY.chordLines.below&&(o*=t.specialY.chordLines.below),c(e,{x:e.padding.left,y:e.calcY(t.positionY[r]),width:e.controller.width,height:o,fill:a[p],stroke:a[p],"fill-opacity":.4,"stroke-opacity":.4},r.substr(0,4)),p+=1,p>6&&(p=0)}}}function printBrace(e,t,a,o,c){if(a)for(var l=0;l<a.length;l++)a[l].isStartVoice(o)&&(a[l].startY=t-n.STEP*10,a[l].elemset=r(e,a[l],c))}function boxAllElements(e,t,r){for(var a=0;a<r.length;a++)for(var o=t[r[a]].children,l=0;l<o.length;l++){var u=o[l],d=u.getFixedCoords();if(!(u.invisible||d.t===void 0||d.b===void 0)){var p=(d.t-d.b)*n.STEP;c(e,{x:d.x,y:e.calcY(d.t),width:d.w,height:p,fill:`#88e888`,"fill-opacity":.4,stroke:`#4aa93d`,"stroke-opacity":.8});for(var m=0;m<u.children.length;m++){var h=u.children[m],g=h.getChordDim();if(g){var _=e.calcY(h.pitch);_+=h.dim.font.size*h.getLane(),c(e,{x:g.left,y:_,width:g.right-g.left,height:h.dim.font.size,fill:`none`,stroke:`#4aa93d`,"stroke-opacity":.8})}}}}}t.exports=drawStaffGroup})),$o=__commonJSMin(((e,t)=>{function setPaperSize(e,t,n,r){var a=(t+e.padding.left+e.padding.right)*n,o=(e.y+e.padding.bottom)*n;if(e.isPrint&&(o=Math.max(o,1056)),e.ariaLabel!==``){var c=`Sheet Music`;e.abctune&&e.abctune.metaText&&e.abctune.metaText.title&&(c+=` for "`+e.abctune.metaText.title+`"`),e.paper.setTitle(c);var l=e.ariaLabel?e.ariaLabel:c;e.paper.setAttribute(`aria-label`,l)}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 u={overflow:`hidden`};r===`resize`?e.paper.setResponsiveWidth(a,o):(u.width=``,u.height=o+`px`,n<1?(u.width=a+`px`,e.paper.setSize(a/n,o/n)):e.paper.setSize(a,o)),e.paper.setScale(n),e.paper.setParentStyles(u)}t.exports=setPaperSize})),es=__commonJSMin(((e,t)=>{var n=Sa(),r=Ca();function Selectables(e,t,n){this.elements=[],this.paper=e,this.tuneNumber=n,this.selectTypes=t}Selectables.prototype.getElements=function(){return this.elements},Selectables.prototype.add=function(e,t,n,r){if(this.canSelect(e)){var a=this.selectTypes===void 0?{selectable:!1,"data-index":this.elements.length}:{selectable:!0,tabindex:0,"data-index":this.elements.length};this.paper.setAttributeOnElement(t,a);var o={absEl:e,svgEl:t,isDraggable:n};r!==void 0&&(o.staffPos=r),this.elements.push(o)}},Selectables.prototype.canSelect=function(e){return this.selectTypes===!1||!e||!e.abcelem?!1:this.selectTypes===!0?!0:this.selectTypes===void 0?e.abcelem.el_type===`note`||e.abcelem.el_type===`tabNumber`:this.selectTypes.indexOf(e.abcelem.el_type)>=0},Selectables.prototype.wrapSvgEl=function(e,t){var a={tuneNumber:this.tuneNumber,abcelem:e,elemset:[t],highlight:n,unhighlight:r};this.add(a,t,!1)},t.exports=Selectables})),ts=__commonJSMin(((e,t)=>{var n=Qo(),r=$o(),a=Zo(),o=la(),c=es();function draw(e,t,n,o,l,u,d,p,m,h){var g=new c(e.paper,p,m),_={};t.shouldAddClasses&&(_.klass=`abcjs-meta-top`),e.paper.openGroup(_),e.moveY(e.padding.top),a(e,n.topText,g),e.paper.closeGroup(),e.moveY(e.spacing.music);for(var y=[],b=0;b<n.lines.length;b++){t.incrLine();var x=n.lines[b];if(x.staff){t.shouldAddClasses&&(_.klass=`abcjs-staff-wrapper abcjs-l`+t.lineNumber),e.paper.openGroup(_),x.vskip&&e.moveY(x.vskip),y.length>=1&&addStaffPadding(e,e.spacing.staffSeparation,y[y.length-1],x.staffGroup);var S=engraveStaffLine(e,x.staffGroup,g,b);S.line=h+b,y.push(S),e.paper.closeGroup()}else x.nonMusic&&(t.shouldAddClasses&&(_.klass=`abcjs-non-music`),e.paper.openGroup(_),a(e,x.nonMusic,g),e.paper.closeGroup())}return t.reset(),n.bottomText&&n.bottomText.rows&&n.bottomText.rows.length>0&&(t.shouldAddClasses&&(_.klass=`abcjs-meta-bottom`),e.paper.openGroup(_),e.moveY(24),a(e,n.bottomText,g),e.paper.closeGroup()),r(e,l,d,u),{staffgroups:y,selectables:g.getElements()}}function engraveStaffLine(e,t,r,a){n(e,t,r,a);var c=t.height*o.STEP;return e.y+=c,t}function addStaffPadding(e,t,n,r){var a=-(n.staffs[n.staffs.length-1].bottom-2),c=(r.staffs[0].top-10+a)*o.STEP;c<t&&e.moveY(t-c)}t.exports=draw})),ns=__commonJSMin(((e,t)=>{var n=fo();function findSelectableElement(e){for(var t=e;t&&t.attributes&&t.tagName.toLowerCase()!==`svg`&&!t.attributes.selectable;)t=t.parentNode;if(t&&t.attributes&&t.attributes.selectable){var r=t.attributes[`data-index`].nodeValue;if(r&&(r=parseInt(r,10),r>=0&&r<this.selectables.length)){var a=this.selectables[r],o=n(a,e);return o.index=r,o.element=a,o}}return null}t.exports=findSelectableElement})),rs=__commonJSMin(((e,t)=>{var n=la(),r=to(),a=ro(),o=io(),c=ao(),l=oo(),u=lo(),d=uo(),p=po(),m=Co(),h=wo(),g=To(),_=Eo(),y=ts(),b=Na(),x=ns(),EngraverController=function(e,t){t||(t={}),this.findSelectableElement=x,this.oneSvgPerLine=t.oneSvgPerLine,this.selectionColor=t.selectionColor,this.dragColor=t.dragColor?t.dragColor:t.selectionColor,this.dragging=!!t.dragging,this.selectTypes=t.selectTypes,this.responsive=t.responsive,this.space=3*n.SPACE,this.initialClef=t.initialClef,this.timeBasedLayout=t.timeBasedLayout,this.expandToWidest=!!t.expandToWidest,this.scale=t.scale?parseFloat(t.scale):0,this.classes=new h({shouldAddClasses:t.add_classes}),this.scale>.1||(this.scale=void 0),t.staffwidth?(this.staffwidthScreen=t.staffwidth,this.staffwidthPrint=t.staffwidth):(this.staffwidthScreen=740,this.staffwidthPrint=680),this.listeners=[],t.clickListener&&this.addSelectListener(t.clickListener),this.renderer=new a(e),this.renderer.setPaddingOverride(t),t.showDebug&&(this.renderer.showDebug=t.showDebug),t.jazzchords&&(this.jazzchords=t.jazzchords),t.accentAbove&&(this.accentAbove=t.accentAbove),t.germanAlphabet&&(this.germanAlphabet=t.germanAlphabet),t.lineThickness&&(this.lineThickness=t.lineThickness),this.renderer.controller=this,this.renderer.foregroundColor=t.foregroundColor?t.foregroundColor:`currentColor`,t.ariaLabel!==void 0&&(this.renderer.ariaLabel=t.ariaLabel),this.renderer.minPadding=t.minPadding?t.minPadding:0,this.reset()};EngraverController.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)},EngraverController.prototype.engraveABC=function(e,t,n){e[0]===void 0&&(e=[e]),this.reset();for(var r=0;r<e.length;r++)t===void 0&&(t=r),this.getFontAndAttr=new g(e[r].formatting,this.classes),this.getTextSize=new _(this.getFontAndAttr,this.renderer.paper),this.engraveTune(e[r],t,n)},EngraverController.prototype.adjustNonScaledItems=function(e){this.width/=e,this.renderer.adjustNonScaledItems(e)},EngraverController.prototype.getMeasureWidths=function(e){this.reset(),this.getFontAndAttr=new g(e.formatting,this.classes),this.getTextSize=new _(this.getFontAndAttr,this.renderer.paper);var t=this.jazzchords;this.setupTune(e,0),this.constructTuneElements(e),m(this.renderer,e,0,this.space,this.timeBasedLayout);for(var n=[],r,a=!0,o=0;o<e.lines.length;o++){var c=e.lines[o];if(c.staff){if(a&&(a=(r={left:0,measureWidths:[],total:0},n.push(r),!1)),c.staffGroup.voices.length>0)for(var l=c.staffGroup.voices[0],u=!1,d=0,p=0;p<l.children.length;p++){var h=l.children[p];!u&&!h.isClef&&!h.isKeySig&&(u=!0,r.left=h.x,d=h.x),h.type===`bar`&&(r.measureWidths.push(h.x-d),r.total+=h.x-d,d=h.x)}}else a=!0}return this.jazzchords=t,n},EngraverController.prototype.setupTune=function(e,t){this.classes.reset(),e.formatting.jazzchords!==void 0&&(this.jazzchords=e.formatting.jazzchords),e.formatting.accentAbove!==void 0&&(this.accentAbove=e.formatting.accentAbove),this.renderer.newTune(e),this.engraver=new r(this.getTextSize,t,{bagpipes:e.formatting.bagpipes,flatbeams:e.formatting.flatbeams,graceSlurs:e.formatting.graceSlurs!==!1,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=e.formatting.staffwidth*1.33:this.width=this.renderer.isPrint?this.staffwidthPrint:this.staffwidthScreen;var n=e.formatting.scale?e.formatting.scale:this.scale;return this.responsive===`resize`&&(n=void 0),n===void 0&&(n=this.renderer.isPrint?.75:1),this.adjustNonScaledItems(n),n},EngraverController.prototype.constructTuneElements=function(e){e.topText=new u(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 t,n,r=!1,a=!1;for(t=0;t<e.lines.length;t++)if(n=e.lines[t],n.staff)a=!0,n.staffGroup=this.engraver.createABCLine(n.staff,r?null:e.metaText.tempo,t),r=!0;else if(n.subtitle){if(a){var p=this.width/2+this.renderer.padding.left;n.nonMusic=new l(this.renderer.spacing.subtitle,e.formatting,n.subtitle,p,this.renderer.padding.left,this.getTextSize)}}else n.text===void 0?n.separator!==void 0&&n.separator.lineLength&&(a=!0,n.nonMusic=new c(n.separator.spaceAbove,n.separator.lineLength,n.separator.spaceBelow)):(a=!0,n.nonMusic=new o(n.text,n.vskip,this.getFontAndAttr,this.renderer.padding.left,this.width,this.getTextSize));e.bottomText=new d(e.metaText,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize)},EngraverController.prototype.engraveTune=function(e,t,n){var r=this.jazzchords,a=this.setupTune(e,t);this.constructTuneElements(e);var o=m(this.renderer,e,this.width,this.space,this.expandToWidest,this.timeBasedLayout);if(this.expandToWidest&&o>this.width+1&&(e.topText=new u(e.metaText,e.metaTextInfo,e.formatting,e.lines,o,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize),e.lines&&e.lines.length>0))for(var c=e.lines.length,l=0;l<c;++l){var d=e.lines[l];if(d.nonMusic&&d.nonMusic.rows&&d.nonMusic.rows.length>0)for(var h=d.nonMusic.rows.length,g=0;g<h;++g){var _=d.nonMusic.rows[g];_.left&&(d.subtitle||d.text&&d.text.length>0&&d.text[0].center)&&(_.left=o/2+this.renderer.padding.left)}}e.tablatures&&b.layoutTablatures(this.renderer,e);var x=y(this.renderer,this.classes,e,this.width,o,this.responsive,a,this.selectTypes,t,n);if(this.staffgroups=x.staffgroups,this.selectables=x.selectables,this.oneSvgPerLine){var S=this.renderer.paper.svg.parentNode;this.svgs=splitSvgIntoLines(this.renderer,S,e.metaText.title,this.responsive,a)}else this.svgs=[this.renderer.paper.svg];p(this,this.svgs),this.jazzchords=r};function splitSvgIntoLines(e,t,n,r,a){n||(n=`Untitled`);var o=t.querySelector(`svg`);r===`resize`&&(t.style.paddingBottom=``);for(var c=o.querySelector(`style`),l=r===`resize`?o.viewBox.baseVal.width:o.getAttribute(`width`),u=t.querySelectorAll(`svg > g`),d=0,p=[],m=0;m<u.length;m++){var h=u[m],g=h.getBBox(),_=g.y-d,y=g.height+_,b=document.createElement(`div`),x=`overflow: hidden;`;r!==`resize`&&(x+=`height:`+y*a+`px;`),b.setAttribute(`style`,x);var S=duplicateSvg(o),C=`Sheet Music for "`+n+`" section `+(m+1);S.setAttribute(`aria-label`,C),r!==`resize`&&S.setAttribute(`height`,y),r===`resize`&&(S.style.position=``);var w=e.firefox112?y+1:y;S.setAttribute(`viewBox`,`0 `+d+` `+l+` `+w),S.appendChild(c.cloneNode(!0));var T=document.createElement(`title`);T.innerText=C,S.appendChild(T),S.appendChild(h),b.appendChild(S),p.push(S),t.appendChild(b),d=g.y+g.height}return t.removeChild(o),p}function duplicateSvg(e){for(var t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),n=0;n<e.attributes.length;n++){var r=e.attributes[n];r.name!==`height`&&r.name!=`aria-label`&&t.setAttribute(r.name,r.value)}return t}EngraverController.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},EngraverController.prototype.addSelectListener=function(e){this.listeners[this.listeners.length]=e},t.exports=EngraverController})),is=__commonJSMin(((e,t)=>{var n=Pa();ha();var r=rs(),a=_a(),o=ca(),c={};function resizeOuter(){var e=window.innerWidth;for(var t in c)if(c.hasOwnProperty(t)){var n=c[t],r=n.offsetLeft;e-=r*2,n.style.width=e+`px`}}try{window.addEventListener(`resize`,resizeOuter),window.addEventListener(`orientationChange`,resizeOuter)}catch{}function renderOne(e,t,n,a,o){n.viewportHorizontal?(e.innerHTML=`<div class="abcjs-inner"></div>`,n.scrollHorizontal?(e.style.overflowX=`auto`,e.style.overflowY=`hidden`):e.style.overflow=`hidden`,c[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 l=new r(e,n);if(l.engraveABC(t,a,o),t.engraver=l,n.viewportVertical||n.viewportHorizontal){var u=e.parentNode;u.style.width=e.style.width}}var renderAbc=function(e,t,r,a,o){var c={},l;if(r){for(l in r)r.hasOwnProperty(l)&&(c[l]=r[l]);c.warnings_id&&c.tablature&&(c.tablature.warning_id=c.warnings_id)}if(a)for(l in a)a.hasOwnProperty(l)&&(l===`listener`?a[l].highlight&&(c.clickListener=a[l].highlight):c[l]=a[l]);if(o)for(l in o)o.hasOwnProperty(l)&&(c[l]=o[l]);function callback(e,t,n,r){var a=!1;return e===`*`&&(a=!0,e=document.createElement(`div`),e.setAttribute(`style`,`visibility: hidden;`),document.body.appendChild(e)),!a&&c.wrap&&c.staffwidth?(t=doLineWrapping(e,t,n,r,c),t):(c.afterParsing&&c.afterParsing(t,n,r),renderOne(e,t,c,n,0),a&&e.parentNode.removeChild(e),null)}return n.renderEngine(callback,e,t,c)};function doLineWrapping(e,t,n,c,l){var u=new r(e,l).getMeasureWidths(t),d=o.calcLineWraps(t,u,l);if(d.reParse){var p=new a;p.parse(c,d.revisedParams),t=p.getTune();var m=p.getWarnings();m&&(t.warnings=m)}return l.afterParsing&&l.afterParsing(t,n,c),renderOne(e,t,d.revisedParams,n,0),t.explanation=d.explanation,t}t.exports=renderAbc})),as=__commonJSMin(((e,t)=>{var n=Pa(),r=rs(),tuneMetrics=function(e,t){function callback(e,n,a,o){e=document.createElement(`div`),e.setAttribute(`style`,`visibility: hidden;`),document.body.appendChild(e);var c=new r(e,t).getMeasureWidths(n);return e.parentNode.removeChild(e),{sections:c}}return n.renderEngine(callback,`*`,e,t)};t.exports=tuneMetrics})),os=__commonJSMin(((e,t)=>{t.exports={}})),ss=__commonJSMin(((e,t)=>{var n=os(),getNote=function(e,t,r,a){n[t]||(n[t]={});var o=n[t];return o[r]||(o[r]=new Promise(function(n,o){var c=new XMLHttpRequest;let l=e+t+`-mp3/`+r+`.mp3`;c.open(`GET`,l,!0),c.responseType=`arraybuffer`,c.onload=function(){if(c.status!==200){o(Error(`Can't load sound at `+l+` status=`+c.status));return}var noteDecoded=function(e){n({instrument:t,name:r,status:`loaded`,audioBuffer:e})},e=a.decodeAudioData(c.response,noteDecoded,function(){o(Error(`Can't decode sound at `+l))});e&&typeof e.catch==`function`&&e.catch(o)},c.onerror=function(){o(Error(`Can't load sound at `+l))},c.send()}).catch(e=>{throw console.error(`Didn't load note`,t,r,`:`,e.message),e})),o[r]};t.exports=getNote})),cs=__commonJSMin(((e,t)=>{t.exports=`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`.split(`.`)})),ls=__commonJSMin(((e,t)=>{var n=cs(),createNoteMap=function(e){for(var t=[],r=0;r<e.tracks.length;r++)t.push([]);var a=n[0];return e.tracks.forEach(function(e,r){e.forEach(function(e){switch(e.cmd){case`note`:var o=e.instrument===void 0?a:n[e.instrument];if(e.duration>0){var c=e.gap?e.gap:0,l=e.duration;c=Math.min(c,l*2/3);var u={pitch:e.pitch,instrument:o,start:Math.round(e.start*1e6)/1e6,end:Math.round((e.start+l-c)*1e6)/1e6,volume:e.volume};e.startChar&&(u.startChar=e.startChar),e.endChar&&(u.endChar=e.endChar),e.style&&(u.style=e.style),e.cents&&(u.cents=e.cents),t[r].push(u)}break;case`program`:a=n[e.instrument];break;case`text`:break;default:console.log(`Unhandled midi event`,e)}})}),t};t.exports=createNoteMap})),us=__commonJSMin(((e,t)=>{function registerAudioContext(e){if(e)window.abcjsAudioContext=e;else if(!window.abcjsAudioContext){var t=window.AudioContext||window.webkitAudioContext;if(t)window.abcjsAudioContext=new t;else return!1}return window.abcjsAudioContext.state!==`suspended`}t.exports=registerAudioContext})),ds=__commonJSMin(((e,t)=>{var n=us();function activeAudioContext(){return window.abcjsAudioContext||n(),window.abcjsAudioContext}t.exports=activeAudioContext})),fs=__commonJSMin(((e,t)=>{var n=ds();function supportsAudio(){if(!window.Promise||!window.AudioContext&&!window.webkitAudioContext&&!navigator.mozAudioContext&&!navigator.msAudioContext)return!1;var e=n();if(e)return e.resume!==void 0}t.exports=supportsAudio})),ps=__commonJSMin(((e,t)=>{t.exports={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`}})),ms=__commonJSMin(((e,t)=>{var downloadBuffer=function(e){return window.URL.createObjectURL(bufferToWave(e.audioBuffers))};function bufferToWave(e){var t=e[0],n=t.numberOfChannels,r=t.length*n*2+44,a=new ArrayBuffer(r),o=new DataView(a),c=[],l,u,d=0,p=0;for(setUint32(1179011410),setUint32(r-8),setUint32(1163280727),setUint32(544501094),setUint32(16),setUint16(1),setUint16(n),setUint32(t.sampleRate),setUint32(t.sampleRate*2*n),setUint16(n*2),setUint16(16),setUint32(1635017060),setUint32(r-p-4),l=0;l<n;l++)c.push(t.getChannelData(l));for(;p<r;){for(l=0;l<c.length;l++)u=Math.max(-1,Math.min(1,c[l][d])),u=(.5+u<0?u*32768:u*32767)|0,o.setInt16(p,u,!0),p+=2;d++}return new Blob([a],{type:`audio/wav`});function setUint16(e){o.setUint16(p,e,!0),p+=2}function setUint32(e){o.setUint32(p,e,!0),p+=4}}t.exports=downloadBuffer})),hs=__commonJSMin(((e,t)=>{function centsToFactor(e){return 2**(e/1200)}t.exports=centsToFactor})),gs=__commonJSMin(((e,t)=>{var n=os(),r=ps(),a=hs();function placeNote(e,t,o,c,l,u,d,p,m){var h=window.OfflineAudioContext||window.webkitOfflineAudioContext,g=o.len*o.tempoMultiplier;u&&(g+=u/1e3),g-=p,g<0&&(g=.005);var _=new h(2,Math.floor((g+d)*t),t),y=r[o.pitch];if(!n[o.instrument])return m&&m(`placeNote skipped (instrument empty): `+o.instrument+`:`+y),Promise.resolve();var b=n[o.instrument][y];return b?b.then(function(n){var r=_.createBufferSource();r.buffer=n.audioBuffer;var p=o.volume/96*l;r.gainNode=_.createGain(),o.pan&&_.createStereoPanner&&(r.panNode=_.createStereoPanner(),r.panNode.pan.setValueAtTime(o.pan,0)),r.gainNode.gain.value=p,r.gainNode.gain.linearRampToValueAtTime(r.gainNode.gain.value,g),r.gainNode.gain.linearRampToValueAtTime(0,g+d),o.cents&&(r.playbackRate.value=a(o.cents)),r.panNode?(r.panNode.connect(_.destination),r.gainNode.connect(r.panNode)):r.gainNode.connect(_.destination),r.connect(r.gainNode),r.start(0),r.noteOff?r.noteOff(g+d):r.stop(g+d);var h;return _.oncomplete=function(n){if(n.renderedBuffer&&n.renderedBuffer.getChannelData)for(var r=0;r<c.length;r++){var a=c[r]*o.tempoMultiplier;u&&(a-=u/1e3),a<0&&(a=0),a=Math.floor(a*t),copyToChannel(e,n.renderedBuffer,a)}m&&m(`placeNote: `+o.instrument+`:`+y),h()},_.startRendering(),new Promise(function(e){h=e})}).catch(function(e){return m&&m(`placeNote catch: `+e.message),Promise.resolve()}):(m&&m(`placeNote skipped: `+o.instrument+`:`+y),Promise.resolve())}var copyToChannel=function(e,t,n){for(var r=0;r<2;r++)for(var a=t.getChannelData(r),o=e.getChannelData(r),c=0;c<a.length;c++)o[c+n]+=a[c]};t.exports=placeNote})),_s=__commonJSMin(((e,t)=>{var n=ss(),r=ls(),a=us(),o=ds(),c=fs(),l=ps(),u=cs(),d=ms(),p=gs(),m=os(),h=`MIDI is not supported in this browser.`,g=`https://paulrosen.github.io/midi-js-soundfonts/abcjs/`,_=`https://paulrosen.github.io/midi-js-soundfonts/FluidR3_GM/`,y=`https://paulrosen.github.io/midi-js-soundfonts/MusyngKite/`;function CreateSynth(){var e=this;e.audioBufferPossible=void 0,e.directSource=[],e.startTimeSec=void 0,e.pausedTimeSec=void 0,e.audioBuffers=[],e.duration=void 0,e.isRunning=!1,e.options=void 0,e.pickupLength=0,e.init=function(t){t||(t={}),t.options&&(e.options=t.options),a(t.audioContext);var n=o().currentTime;if(e.debugCallback=t.debugCallback,e.debugCallback&&e.debugCallback(`init called`),e.audioBufferPossible=e._deviceCapable(),!e.audioBufferPossible)return Promise.reject({status:`NotSupported`,message:h});var r=t.options?t.options:{};e.soundFontUrl=r.soundFontUrl?r.soundFontUrl:_,e.soundFontUrl[e.soundFontUrl.length-1]!==`/`&&(e.soundFontUrl+=`/`),r.soundFontVolumeMultiplier||r.soundFontVolumeMultiplier===0?e.soundFontVolumeMultiplier=r.soundFontVolumeMultiplier:e.soundFontUrl===_||e.soundFontUrl===y?e.soundFontVolumeMultiplier=3:e.soundFontUrl===g?e.soundFontVolumeMultiplier=.4:e.soundFontVolumeMultiplier=1,r.programOffsets?e.programOffsets=r.programOffsets:e.soundFontUrl===g?e.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}:e.programOffsets={};var c=r.fadeLength===void 0?NaN:parseInt(r.fadeLength,10);if(e.fadeLength=isNaN(c)?200:c,c=r.noteEnd===void 0?NaN:parseInt(r.noteEnd,10),e.noteEnd=isNaN(c)?0:c,e.pan=r.pan,e.meterSize=1,t.visualObj)e.flattened=t.visualObj.setUpAudio(r),t.visualObj.getMeterFraction().den&&(e.meterSize=t.visualObj.getMeterFraction().num/t.visualObj.getMeterFraction().den),e.pickupLength=t.visualObj.getPickupLength();else if(t.sequence)e.flattened=t.sequence;else return Promise.reject(Error(`Must pass in either a visualObj or a sequence`));e.millisecondsPerMeasure=t.millisecondsPerMeasure?t.millisecondsPerMeasure:t.visualObj?t.visualObj.millisecondsPerMeasure(e.flattened.tempo):1e3,e.beatsPerMeasure=t.visualObj?t.visualObj.getBeatsPerMeasure():4,e.sequenceCallback=r.sequenceCallback,e.callbackContext=r.callbackContext,e.onEnded=r.onEnded,e.meterFraction=t.visualObj?t.visualObj.getMeterFraction():{den:1};var d={},p=[],b=[],x=u[0];e.flattened.tracks.forEach(function(e){e.forEach(function(e){if(e.cmd===`program`&&u[e.instrument]&&(x=u[e.instrument]),e.pitch!==void 0){var t=e.pitch,n=l[t],r=e.instrument===void 0?x:u[e.instrument];if(n)if(d[r]||(d[r]={}),!m[r]||!m[r][n])d[r][n]=!0;else{var a=r+`:`+n;p.indexOf(a)<0&&p.push(a)}else{var o=r+`:`+n;console.log(`Can't find note: `,t,o),b.indexOf(o)<0&&b.push(o)}}})}),e.debugCallback&&e.debugCallback(`note gathering time = `+Math.floor((o().currentTime-n)*1e3)+`ms`),n=o().currentTime;var S=[];Object.keys(d).forEach(function(e){Object.keys(d[e]).forEach(function(t){S.push({instrument:e,note:t})})}),e.debugCallback&&e.debugCallback(`notes `+JSON.stringify(S));for(var C=[],w=256,T=0;T<S.length;T+=w)C.push(S.slice(T,T+w));return new Promise(function(t,r){var a={cached:p,error:b,loaded:[]},c=0,next=function(){e.debugCallback&&e.debugCallback(`loadBatch idx=`+c+` len=`+C.length),c<C.length?e._loadBatch(C[c],e.soundFontUrl,n).then(function(t){e.debugCallback&&e.debugCallback(`loadBatch then`),n=o().currentTime,t&&(t.error&&(a.error=a.error.concat(t.error)),t.loaded&&(a.loaded=a.loaded.concat(t.loaded))),c++,next()},r):(e.debugCallback&&e.debugCallback(`resolve init`),t(a))};next()})},e._loadBatch=(function(t,r,a,c){var l=[];return t.forEach(function(t){e.debugCallback&&e.debugCallback(`getNote `+t.instrument+`:`+t.note),l.push(n(r,t.instrument,t.note,o()))}),Promise.all(l).then(function(n){e.debugCallback&&e.debugCallback(`mp3 load time = `+Math.floor((o().currentTime-a)*1e3)+`ms`);for(var l=[],u=[],d=[],p=[],m=0;m<n.length;m++){var h=n[m],g=h.instrument+`:`+h.name;h.status===`loaded`?l.push(g):h.status===`pending`?d.push(g):h.status===`cached`?u.push(g):p.push(g+` `+h.message)}if(d.length>0){if(e.debugCallback&&e.debugCallback(`pending `+JSON.stringify(d)),c?c*=2:c=50,c<9e4)return new Promise(function(t,n){setTimeout(function(){var o=[];for(m=0;m<d.length;m++)g=d[m].split(`:`),o.push({instrument:g[0],note:g[1]});e.debugCallback&&e.debugCallback(`retry `+JSON.stringify(o)),e._loadBatch(o,r,a,c).then(function(e){t(e)}).catch(function(e){n(e)})},c)});for(var _=[],y=0;y<t.length;y++)_.push(t[y].instrument+`/`+t[y].note);return e.debugCallback&&e.debugCallback(`loadBatch timeout`),Promise.reject(Error(`timeout attempting to load: `+_.join(`, `)))}else return e.debugCallback&&e.debugCallback(`loadBatch resolve`),Promise.resolve({loaded:l,cached:u,error:p})}).catch(function(t){e.debugCallback&&e.debugCallback(`loadBatch catch `+t.message)})}),e.prime=function(){var t=e.fadeLength/1e3;return e.isRunning=!1,e.audioBufferPossible?(e.debugCallback&&e.debugCallback(`prime called`),new Promise(function(n){var a=o().currentTime,c=e.millisecondsPerMeasure/1e3/e.meterSize;if(e.duration=e.flattened.totalDuration*c,e.duration<=0)return e.audioBuffers=[],n({status:`empty`,seconds:0});e.duration+=t;var l=Math.floor(o().sampleRate*e.duration);e.stop();var u=r(e.flattened);e.options.swing&&addSwing(u,e.options.swing,e.meterFraction,e.pickupLength),e.sequenceCallback&&e.sequenceCallback(u,e.callbackContext);var d=setPan(u.length,e.pan),m={};u.forEach(function(t,n){var r=d&&d.length>n?d[n]:0;t.forEach(function(t){var n=t.instrument+`:`+t.pitch+`:`+t.volume+`:`+Math.round((t.end-t.start)*1e3)/1e3+`:`+r+`:`+c+`:`+(t.cents?t.cents:0);e.debugCallback&&e.debugCallback(`noteMapTrack `+n),m[n]||(m[n]=[]),m[n].push(t.start)})});for(var h=[],g=o().createBuffer(2,l,o().sampleRate),_=0;_<Object.keys(m).length;_++){var y=Object.keys(m)[_],b=y.split(`:`),x=b[6]===void 0?0:parseFloat(b[6]);b={instrument:b[0],pitch:parseInt(b[1],10),volume:parseInt(b[2],10),len:parseFloat(b[3]),pan:parseFloat(b[4]),tempoMultiplier:parseFloat(b[5]),cents:x},h.push(p(g,o().sampleRate,b,m[y],e.soundFontVolumeMultiplier,e.programOffsets[b.instrument],t,e.noteEnd/1e3,e.debugCallback))}e.audioBuffers=[g],e.debugCallback&&(e.debugCallback(`sampleRate = `+o().sampleRate),e.debugCallback(`totalSamples = `+l),e.debugCallback(`creationTime = `+Math.floor((o().currentTime-a)*1e3)+`ms`));function resolveData(e){var t=e&&e.audioBuffers&&e.audioBuffers.length>0?e.audioBuffers[0].duration:0;return{status:o().state,duration:t}}Promise.all(h).then(function(){o().state===`suspended`?o().resume().then(function(){n(resolveData(e))}):o().state===`interrupted`?o().suspend().then(function(){o().resume().then(function(){n(resolveData(e))})}):n(resolveData(e))})})):Promise.reject(Error(h))};function setPan(e,t){if(t==null)return null;var n=[];if(t.length){for(var r=0;r<e;r++)if(r<t.length){var a=parseFloat(t[r]);a<-1?a=-1:a>1&&(a=1),n.push(a)}else n.push(0);return n}else{var o=parseFloat(t);if(o*(e-1)>2)return null;for(var c=e%2==0,l=c?0-o/2:0,u=l+o,d=0;d<e;d++)c=d%2==0,c?(n.push(l),l-=o):(n.push(u),u+=o);return n}return null}e.start=function(){if(!e.audioBufferPossible)throw Error(h);e.debugCallback&&e.debugCallback(`start called`);var t=e.pausedTimeSec?e.pausedTimeSec:0;e._kickOffSound(t),e.startTimeSec=o().currentTime-t,e.pausedTimeSec=void 0,e.debugCallback&&e.debugCallback(`MIDI STARTED`,e.startTimeSec)},e.pause=function(){if(!e.audioBufferPossible)throw Error(h);return e.debugCallback&&e.debugCallback(`pause called`),e.pausedTimeSec=e.stop(),e.pausedTimeSec},e.resume=function(){e.start()},e.seek=function(t,n){var r;switch(n){case`seconds`:r=t;break;case`beats`:r=t*e.millisecondsPerMeasure/e.beatsPerMeasure/1e3;break;default:r=(e.duration-e.fadeLength/1e3)*t;break}if(!e.audioBufferPossible)throw Error(h);e.debugCallback&&e.debugCallback(`seek called sec=`+r),e.isRunning?(e.stop(),e._kickOffSound(r)):e.pausedTimeSec=r,e.pausedTimeSec=r},e.stop=function(){return e.isRunning=!1,e.pausedTimeSec=void 0,e.directSource.forEach(function(e){try{e.stop()}catch(e){console.log(`direct source didn't stop:`,e)}}),e.directSource=[],o().currentTime-e.startTimeSec},e.finished=function(){e.startTimeSec=void 0,e.pausedTimeSec=void 0,e.isRunning=!1},e.download=function(){return d(e)},e.getAudioBuffer=function(){return e.audioBuffers[0]},e.getIsRunning=function(){return e.isRunning},e._deviceCapable=function(){return c()?!0:(console.warn(h),e.debugCallback&&e.debugCallback(h),!1)},e._kickOffSound=function(t){e.isRunning=!0,e.directSource=[],e.audioBuffers.forEach(function(t,n){e.directSource[n]=o().createBufferSource(),e.directSource[n].buffer=t,e.directSource[n].connect(o().destination)}),e.directSource.forEach(function(e){e.start(0,t)}),e.onEnded&&(e.directSource[0].onended=function(){e.onEnded(e.callbackContext)})};function addSwing(e,t,n,r){if(!(n.den!=4&&n.den!=8)&&(t=parseFloat(t),!(isNaN(t)||t<=50))){t>75&&(t=75),t=t/50-1;var a=0,o=.25;n.den===8&&(o/=2);for(var c=o/2,l=c*t,u=0;u<e.length;u++)for(var d=e[u],p=0;p<d.length;p++){var m=d[p];if((m.start-r)%c==0&&(m.start-r)%o!=0&&(p==0||d[p-1].start<=d[p].start-c)&&(p==d.length-1||d[p+1].start>=d[p].start+c)){var h=m.start;m.start+=l,m.volume*=1+a,p>0&&d[p-1].end==h&&(d[p-1].end=m.start,d[p-1].volume*=1-a)}}}}}t.exports=CreateSynth})),vs=__commonJSMin(((e,t)=>{var SynthSequence=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,n){e.tracks[t].push({channel:0,cmd:`program`,instrument:n}),e.currentInstrument[t]=n},e.appendNote=function(t,n,r,a,o){var c={cmd:`note`,duration:r,gap:0,instrument:e.currentInstrument[t],pitch:n,start:e.starts[t],volume:a};o&&(c.cents=o),e.tracks[t].push(c),e.starts[t]+=r,e.totalDuration=Math.max(e.totalDuration,e.starts[t])}};t.exports=SynthSequence})),ys=__commonJSMin(((e,t)=>{t.exports=`
77
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 700" preserveAspectRatio="xMidYMid meet">
78
+ <g transform="translate(0,700) scale(0.1,-0.1)" >
79
+ <path d="M3111 6981 c-20 -37 -90 -55 -364 -96 -120 -18 -190 -33 -244 -55
80
+ -42 -17 -124 -42 -182 -56 -78 -18 -119 -34 -157 -60 -28 -19 -86 -46 -128
81
+ -60 -43 -13 -107 -42 -144 -64 -37 -23 -84 -46 -106 -52 -21 -7 -56 -29 -79
82
+ -50 -22 -22 -61 -50 -86 -63 -26 -13 -67 -40 -91 -60 -24 -20 -65 -47 -90 -60
83
+ -25 -13 -53 -31 -61 -41 -8 -9 -32 -30 -54 -46 -75 -54 -486 -460 -512 -507
84
+ -15 -25 -48 -69 -75 -98 -26 -28 -48 -57 -48 -63 0 -6 -18 -29 -39 -53 -21
85
+ -23 -56 -71 -77 -107 -20 -36 -50 -80 -65 -97 -16 -18 -33 -52 -40 -75 -12
86
+ -47 -47 -115 -84 -166 -13 -18 -30 -56 -38 -83 -8 -27 -34 -80 -56 -118 -33
87
+ -53 -46 -91 -62 -167 -12 -63 -34 -127 -59 -179 -42 -84 -60 -166 -60 -270 0
88
+ -90 26 -122 125 -154 54 -17 96 -19 430 -20 305 -1 381 2 430 14 82 22 140 51
89
+ 153 78 6 12 22 47 37 77 14 30 38 77 54 103 15 27 34 73 40 103 7 30 28 78 48
90
+ 107 19 28 44 74 55 101 10 28 34 67 53 87 18 20 49 61 68 90 19 30 44 63 57
91
+ 74 13 11 36 40 52 65 59 94 232 270 306 313 20 11 57 37 82 58 25 20 70 52
92
+ 100 72 30 19 66 47 79 61 13 14 49 35 80 46 30 12 80 37 111 56 31 19 95 45
93
+ 143 58 48 12 110 37 139 55 63 40 127 55 323 76 83 9 208 28 279 41 156 29
94
+ 165 29 330 4 453 -71 514 -84 606 -130 31 -16 83 -36 116 -45 32 -9 84 -34
95
+ 115 -56 31 -21 82 -48 113 -60 32 -11 72 -33 89 -48 18 -16 59 -45 92 -65 33
96
+ -21 74 -51 90 -66 17 -15 49 -40 73 -54 52 -32 65 -61 50 -113 -8 -31 -61 -90
97
+ -277 -308 -300 -303 -361 -382 -369 -481 -2 -29 0 -66 6 -81 13 -40 88 -138
98
+ 115 -151 12 -6 54 -26 92 -44 l70 -33 945 -2 c520 -1 975 2 1012 7 64 8 191
99
+ 50 231 76 11 7 33 34 50 60 22 34 42 51 65 58 l32 9 0 1101 0 1102 -32 9 c-21
100
+ 7 -44 26 -64 55 -60 84 -77 97 -140 110 -44 9 -76 10 -127 2 -59 -9 -77 -17
101
+ -134 -62 -37 -28 -172 -155 -301 -281 -129 -127 -249 -237 -267 -245 -25 -10
102
+ -41 -11 -71 -2 -58 15 -112 45 -124 69 -6 11 -35 35 -64 54 -28 18 -58 41 -66
103
+ 50 -8 9 -41 35 -75 58 -33 22 -77 56 -99 75 -21 18 -64 46 -95 61 -31 14 -73
104
+ 39 -93 55 -20 15 -70 40 -110 55 -40 15 -97 44 -127 64 -29 21 -78 44 -107 53
105
+ -30 8 -77 31 -105 51 -42 28 -73 39 -173 60 -68 14 -154 39 -196 58 -95 43
106
+ -131 51 -343 76 -209 24 -242 32 -279 70 l-30 29 -328 0 c-312 0 -330 -1 -339
107
+ -19z"></path>
108
+ <path d="M254 2875 c-89 -16 -107 -26 -145 -78 -32 -44 -62 -66 -91 -67 -17 0
109
+ -18 -61 -18 -1140 l0 -1140 24 0 c16 0 41 -17 72 -50 40 -42 61 -55 117 -72
110
+ l69 -21 82 23 c44 12 96 30 114 39 18 9 148 132 290 272 141 141 267 261 279
111
+ 268 51 26 86 14 176 -61 32 -26 62 -48 66 -48 5 0 36 -25 70 -55 34 -30 74
112
+ -61 89 -69 15 -8 37 -28 50 -45 12 -17 50 -45 84 -62 34 -17 78 -44 98 -60 19
113
+ -16 61 -37 93 -48 32 -11 81 -37 107 -56 27 -20 76 -45 109 -56 33 -12 75 -31
114
+ 93 -44 62 -45 93 -58 191 -82 54 -12 130 -37 168 -54 68 -29 180 -58 226 -59
115
+ 62 0 183 -64 183 -96 0 -12 88 -14 639 -14 l639 0 12 30 c18 44 76 66 233 89
116
+ 89 14 160 30 200 47 34 15 106 42 159 60 54 18 112 44 130 57 47 35 85 52 146
117
+ 67 29 7 76 28 105 48 29 20 77 48 107 63 30 15 66 39 80 54 14 15 50 40 81 56
118
+ 31 15 78 46 104 69 26 22 61 46 79 54 17 7 43 26 56 42 14 16 41 41 60 56 64
119
+ 48 380 362 408 405 15 23 40 51 55 63 15 12 36 38 46 58 11 21 37 57 58 82 22
120
+ 25 49 62 62 83 13 20 38 56 57 78 19 23 50 74 69 113 19 39 46 86 59 104 14
121
+ 18 34 62 46 98 12 36 32 77 45 92 31 38 60 97 80 167 9 33 26 76 37 95 29 50
122
+ 47 103 68 206 10 52 32 117 51 155 29 56 33 74 34 140 0 94 -10 108 -101 138
123
+ -61 20 -83 21 -463 21 -226 0 -421 -4 -451 -10 -63 -12 -86 -30 -110 -85 -10
124
+ -22 -33 -63 -52 -92 -21 -31 -42 -80 -53 -123 -11 -44 -32 -93 -56 -128 -20
125
+ -32 -47 -83 -59 -115 -12 -32 -37 -77 -56 -100 -19 -23 -50 -65 -69 -94 -19
126
+ -29 -44 -57 -54 -63 -11 -5 -29 -27 -42 -47 -52 -85 -234 -277 -300 -315 -25
127
+ -15 -53 -38 -62 -51 -9 -14 -42 -39 -74 -57 -32 -18 -75 -48 -95 -66 -21 -18
128
+ -59 -44 -85 -58 -26 -13 -72 -40 -100 -59 -35 -24 -78 -41 -128 -52 -47 -11
129
+ -99 -31 -139 -56 -69 -42 -94 -49 -391 -110 -245 -51 -425 -66 -595 -50 -168
130
+ 16 -230 27 -330 61 -47 16 -123 35 -170 44 -98 17 -123 25 -172 58 -20 14 -71
131
+ 37 -114 53 -44 15 -95 40 -115 56 -20 16 -70 42 -110 59 -40 16 -88 45 -108
132
+ 63 -20 19 -55 46 -78 61 -24 14 -49 35 -55 47 -7 11 -34 33 -60 49 -50 31 -65
133
+ 61 -53 102 4 13 130 147 281 298 236 238 277 283 299 335 15 32 35 71 46 86
134
+ 12 18 19 44 19 76 0 42 -8 63 -53 138 -92 151 11 139 -1207 141 -798 2 -1030
135
+ 0 -1086 -11z"></path>
136
+ </g>
137
+ </svg>
138
+ `})),bs=__commonJSMin(((e,t)=>{t.exports=`
139
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-play-svg">
140
+ <g>
141
+ <polygon points="4 0 23 12.5 4 25"/>
142
+ </g>
143
+ </svg>
144
+ `})),xs=__commonJSMin(((e,t)=>{t.exports=`
145
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-pause-svg">
146
+ <g>
147
+ <rect width="8.23" height="25"/>
148
+ <rect width="8.23" height="25" x="17"/>
149
+ </g>
150
+ </svg>
151
+ `})),Ss=__commonJSMin(((e,t)=>{t.exports=`
152
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="abcjs-loading-svg">
153
+ <circle cx="50" cy="50" fill="none" stroke-width="20" r="35" stroke-dasharray="160 55"></circle>
154
+ </svg>
155
+ `})),Cs=__commonJSMin(((e,t)=>{t.exports=`
156
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">
157
+ <g>
158
+ <polygon points="5 12.5 24 0 24 25"/>
159
+ <rect width="3" height="25" x="0" y="0"/>
160
+ </g>
161
+ </svg>
162
+ `})),ws=__commonJSMin(((e,t)=>{var n=fs(),r=us(),a=ds(),o=ys(),c=bs(),l=xs(),u=Ss(),d=Cs();function CreateSynthControl(e,t){var n=this;if(typeof e==`string`){var o=e;if(e=document.querySelector(o),!e)throw Error(`Cannot find element "`+o+`" in the DOM.`)}else if(!(e instanceof HTMLElement))throw Error(`The first parameter must be a valid element or selector in the DOM.`);if(n.parent=e,n.options={},t&&(n.options=Object.assign({},t)),n.options.ac&&r(n.options.ac),buildDom(n.parent,n.options),attachListeners(n),n.disable=function(e){var t=n.parent.querySelector(`.abcjs-inline-audio`);e?t.classList.add(`abcjs-disabled`):t.classList.remove(`abcjs-disabled`)},n.setWarp=function(e,t){var r=n.parent.querySelector(`.abcjs-midi-tempo`);r.value=Math.round(t),n.setTempo(e)},n.setTempo=function(e){var t=n.parent.querySelector(`.abcjs-midi-current-tempo`);t&&(t.innerHTML=Math.round(e))},n.resetAll=function(){for(var e=n.parent.querySelectorAll(`.abcjs-pushed`),t=0;t<e.length;t++)e[t].classList.remove(`abcjs-pushed`)},n.pushPlay=function(e){var t=n.parent.querySelector(`.abcjs-midi-start`);t&&(e?t.classList.add(`abcjs-pushed`):t.classList.remove(`abcjs-pushed`))},n.pushLoop=function(e){var t=n.parent.querySelector(`.abcjs-midi-loop`);t&&(e?t.classList.add(`abcjs-pushed`):t.classList.remove(`abcjs-pushed`))},n.setProgress=function(e,t){var r=n.parent.querySelector(`.abcjs-midi-progress-background`),a=n.parent.querySelector(`.abcjs-midi-progress-indicator`);if(!(!r||!a)){var o=r.clientWidth*e;a.style.left=o+`px`;var c=n.parent.querySelector(`.abcjs-midi-clock`);if(c){var l=t*e/1e3,u=Math.floor(l/60),d=Math.floor(l%60),p=d<10?`0`+d:d;c.innerHTML=u+`:`+p}}},n.options.afterResume){var c=!1;n.options.ac?c=n.options.ac.state!==`suspended`:a()&&(c=a().state!==`suspended`),c&&n.options.afterResume()}}function buildDom(e,t){var n=!!t.loopHandler,r=!!t.restartHandler,a=!!t.playHandler||!!t.playPromiseHandler,p=!!t.progressHandler,m=!!t.warpHandler,h=t.hasClock!==!1,g=`<div class="abcjs-inline-audio">
163
+ `;if(n){var _=t.repeatTitle?t.repeatTitle:`Click to toggle play once/repeat.`,y=t.repeatAria?t.repeatAria:_;g+=`<button type="button" class="abcjs-midi-loop abcjs-btn" title="`+_+`" aria-label="`+y+`">`+o+`</button>
164
+ `}if(r){var b=t.restartTitle?t.restartTitle:`Click to go to beginning.`,x=t.restartAria?t.restartAria:b;g+=`<button type="button" class="abcjs-midi-reset abcjs-btn" title="`+b+`" aria-label="`+x+`">`+d+`</button>
165
+ `}if(a){var S=t.playTitle?t.playTitle:`Click to play/pause.`,C=t.playAria?t.playAria:S;g+=`<button type="button" class="abcjs-midi-start abcjs-btn" title="`+S+`" aria-label="`+C+`">`+c+l+u+`</button>
166
+ `}if(p){var w=t.randomTitle?t.randomTitle:`Click to change the playback position.`,T=t.randomAria?t.randomAria:w;g+=`<button type="button" class="abcjs-midi-progress-background" title="`+w+`" aria-label="`+T+`"><span class="abcjs-midi-progress-indicator"></span></button>
167
+ `}if(h&&(g+=`<span class="abcjs-midi-clock"></span>
168
+ `),m){var E=t.warpTitle?t.warpTitle:`Change the playback speed.`,D=t.warpAria?t.warpAria:E,O=t.bpm?t.bpm:`BPM`;g+=`<span class="abcjs-tempo-wrapper"><label><input class="abcjs-midi-tempo" type="number" min="1" max="300" value="100" title="`+E+`" aria-label="`+D+`">%</label><span>&nbsp;(<span class="abcjs-midi-current-tempo"></span> `+O+`)</span></span>
169
+ `}g+=`<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>`,g+=`</div>
170
+ `,e.innerHTML=g}function acResumerMiddleWare(e,t,o,c,l){var u=!0;if(a()?u=a().state===`suspended`:r(),!n())throw{status:`NotSupported`,message:`This browser does not support audio.`};(u||l)&&o&&o.classList.add(`abcjs-loading`),u?a().resume().then(function(){c?c().then(function(n){doNext(e,t,o,l)}):doNext(e,t,o,l)}):doNext(e,t,o,l)}function doNext(e,t,n,r){r?e(t).then(function(){n&&n.classList.remove(`abcjs-loading`)}):(e(t),n&&n.classList.remove(`abcjs-loading`))}function attachListeners(e){var t=!!e.options.loopHandler,n=!!e.options.restartHandler,r=!!e.options.playHandler||!!e.options.playPromiseHandler,a=!!e.options.progressHandler,o=!!e.options.warpHandler,c=e.parent.querySelector(`.abcjs-midi-start`);t&&e.parent.querySelector(`.abcjs-midi-loop`).addEventListener(`click`,function(t){acResumerMiddleWare(e.options.loopHandler,t,c,e.options.afterResume)}),n&&e.parent.querySelector(`.abcjs-midi-reset`).addEventListener(`click`,function(t){acResumerMiddleWare(e.options.restartHandler,t,c,e.options.afterResume)}),r&&c.addEventListener(`click`,function(t){acResumerMiddleWare(e.options.playPromiseHandler||e.options.playHandler,t,c,e.options.afterResume,!!e.options.playPromiseHandler)}),a&&e.parent.querySelector(`.abcjs-midi-progress-background`).addEventListener(`click`,function(t){acResumerMiddleWare(e.options.progressHandler,t,c,e.options.afterResume)}),o&&e.parent.querySelector(`.abcjs-midi-tempo`).addEventListener(`change`,function(t){acResumerMiddleWare(e.options.warpHandler,t,c,e.options.afterResume)})}t.exports=CreateSynthControl})),Ts=__commonJSMin(((e,t)=>{var n=vs(),r=_s(),a=ds();function playEvent(e,t,r,o,c){for(var l=new n,u=0;u<e.length;u++){var d=e[u],p=l.addTrack();if(l.setInstrument(p,d.instrument),u===0&&t)for(var m=0;m<t.length;m++){var h=t[m];l.appendNote(p,h.pitch,1/64,h.volume,h.cents)}l.appendNote(p,d.pitch,d.duration,d.volume,d.cents)}var g=a();return g.state===`suspended`?g.resume().then(function(){return doPlay(l,r,o,c)}):doPlay(l,r,o,c)}function doPlay(e,t,n,a){var o=new r;return o.init({sequence:e,millisecondsPerMeasure:t,options:{soundFontUrl:n},debugCallback:a}).then(function(){return o.prime()}).then(function(){return o.start(),Promise.resolve()})}t.exports=playEvent})),Es=__commonJSMin(((e,t)=>{var n=ws(),r=_s(),a=Ji(),o=ds();function SynthController(){var e=this;e.warp=100,e.cursorControl=null,e.visualObj=null,e.timer=null,e.midiBuffer=null,e.options=null,e.currentTempo=null,e.control=null,e.isLooping=!1,e.isStarted=!1,e.isLoaded=!1,e.isLoading=!1,e.load=function(t,r,a){a||(a={}),a.displayPlay===void 0&&(a.displayPlay=!0),a.displayProgress===void 0&&(a.displayProgress=!0),e.control=new n(t,{loopHandler:a.displayLoop?e.toggleLoop:void 0,restartHandler:a.displayRestart?e.restart:void 0,playPromiseHandler:a.displayPlay?e.play:void 0,progressHandler:a.displayProgress?e.randomAccess:void 0,warpHandler:a.displayWarp?e.onWarp:void 0,afterResume:e.init}),e.cursorControl=r,e.disable(!0)},e.disable=function(t){e.control&&e.control.disable(t)},e.setTune=function(t,n,r){return e.visualObj=t,e.disable(!1),e.options=r||{},e.control&&(e.pause(),e.setProgress(0,1),e.control.resetAll(),e.restart(),e.isStarted=!1),e.isLooping=!1,n?e.go():Promise.resolve({status:`no-audio-context`})},e.go=function(){e.isLoading=!0;var t=e.visualObj.millisecondsPerMeasure()*100/e.warp;e.currentTempo=Math.round(e.visualObj.getBeatsPerMeasure()/t*6e4),e.control&&e.control.setTempo(e.currentTempo),e.percent=0;var n;return e.midiBuffer||(e.midiBuffer=new r),o().resume().then(function(n){return e.midiBuffer.init({visualObj:e.visualObj,options:e.options,millisecondsPerMeasure:t})}).then(function(t){return n=t,e.midiBuffer.prime()}).then(function(){var t=16;return e.cursorControl&&e.cursorControl.beatSubdivisions!==void 0&&parseInt(e.cursorControl.beatSubdivisions,10)>=1&&parseInt(e.cursorControl.beatSubdivisions,10)<=64&&(t=parseInt(e.cursorControl.beatSubdivisions,10)),e.timer=new a(e.visualObj,{beatCallback:e.beatCallback,eventCallback:e.eventCallback,lineEndCallback:e.lineEndCallback,qpm:e.currentTempo,extraMeasuresAtBeginning:e.cursorControl?e.cursorControl.extraMeasuresAtBeginning:void 0,lineEndAnticipation:e.cursorControl?e.cursorControl.lineEndAnticipation:0,beatSubdivisions:t}),e.cursorControl&&e.cursorControl.onReady&&typeof e.cursorControl.onReady==`function`&&e.cursorControl.onReady(e),e.isLoaded=!0,e.isLoading=!1,Promise.resolve({status:`created`,notesStatus:n})})},e.destroy=function(){e.timer&&(e.timer=(e.timer.reset(),e.timer.stop(),null)),e.midiBuffer&&(e.midiBuffer=(e.midiBuffer.stop(),null)),e.setProgress(0,1),e.control&&e.control.resetAll()},e.play=function(){return e.runWhenReady(e._play,void 0)};function sleep(e){return new Promise(function(t){setTimeout(t,e)})}e.runWhenReady=function(t,n){return e.visualObj?e.isLoading?sleep(500).then(function(){return e.isLoading?e.runWhenReady(t,n):t(n)}):e.isLoaded?t(n):e.go().then(function(){return t(n)}):Promise.resolve({status:`loading`})},e._play=function(){return o().resume().then(function(){return e.isStarted=!e.isStarted,e.isStarted?(e.cursorControl&&e.cursorControl.onStart&&typeof e.cursorControl.onStart==`function`&&e.cursorControl.onStart(),e.midiBuffer.start(),e.timer.start(e.percent),e.control&&e.control.pushPlay(!0)):e.pause(),Promise.resolve({status:`ok`})})},e.pause=function(){e.timer&&(e.timer.pause(),e.midiBuffer.pause(),e.control&&e.control.pushPlay(!1))},e.toggleLoop=function(){e.isLooping=!e.isLooping,e.control&&e.control.pushLoop(e.isLooping)},e.restart=function(){e.timer&&(e.timer.setProgress(0),e.midiBuffer.seek(0))},e.randomAccess=function(t){return e.runWhenReady(e._randomAccess,t)},e._randomAccess=function(t){var n=t.target.classList.contains(`abcjs-midi-progress-indicator`)?t.target.parentNode:t.target,r=(t.x-n.getBoundingClientRect().left)/n.offsetWidth;return r<0&&(r=0),r>1&&(r=1),e.seek(r),Promise.resolve({status:`ok`})},e.seek=function(t,n){e.timer&&e.midiBuffer&&(e.timer.setProgress(t,n),e.midiBuffer.seek(t,n))},e.setWarp=function(t){if(parseInt(t,10)>0){e.warp=parseInt(t,10);var n=e.isStarted,r=e.percent;return e.destroy(),e.isStarted=!1,e.go().then(function(){return e.setProgress(r,e.midiBuffer.duration*1e3),e.control&&e.control.setWarp(e.currentTempo,e.warp),n?e.play().then(function(){return e.seek(r),Promise.resolve()}):(e.seek(r),Promise.resolve())})}return Promise.resolve()},e.onWarp=function(t){var n=t.target.value;return e.setWarp(n)},e.setProgress=function(t,n){e.percent=t,e.control&&e.control.setProgress(t,n)},e.finished=function(){if(e.timer.reset(),e.isLooping)return e.timer.start(0),e.midiBuffer.finished(),e.midiBuffer.start(),`continue`;e.timer.stop(),e.isStarted&&(e.control&&e.control.pushPlay(!1),e.isStarted=!1,e.midiBuffer.finished(),e.cursorControl&&e.cursorControl.onFinished&&typeof e.cursorControl.onFinished==`function`&&e.cursorControl.onFinished(),e.setProgress(0,1))},e.beatCallback=function(t,n,r,a){var o=t/n;e.setProgress(o,r),e.cursorControl&&e.cursorControl.onBeat&&typeof e.cursorControl.onBeat==`function`&&e.cursorControl.onBeat(t,n,r,a)},e.eventCallback=function(t){if(t)e.cursorControl&&e.cursorControl.onEvent&&typeof e.cursorControl.onEvent==`function`&&e.cursorControl.onEvent(t);else return e.finished()},e.lineEndCallback=function(t,n){e.cursorControl&&e.cursorControl.onLineEnd&&typeof e.cursorControl.onLineEnd==`function`&&e.cursorControl.onLineEnd(t,n)},e.getUrl=function(){return e.midiBuffer.download()},e.download=function(t){var n=e.getUrl(),r=document.createElement(`a`);document.body.appendChild(r),r.setAttribute(`style`,`display: none;`),r.href=n,r.download=t||`output.wav`,r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r)}}t.exports=SynthController})),Ds=__commonJSMin(((e,t)=>{var n=hs(),rendererFactory;(function(){function setAttributes(e,t){for(var n in t)t.hasOwnProperty(n)&&e.setAttribute(n,t[n]);return e}function Midi(){this.trackstrings=``,this.trackcount=0,this.noteOnAndChannel=`%90`,this.noteOffAndChannel=`%80`}Midi.prototype.setTempo=function(e){this.trackcount===0&&(this.startTrack(),this.track+=`%00%FF%51%03`+toHex(Math.round(6e7/e),6),this.endTrack())},Midi.prototype.setGlobalInfo=function(e,t,n,r){if(this.trackcount===0){this.startTrack();var a=Math.round(6e7/e);this.track+=`%00%FF%51%03`+toHex(a,6),n&&(this.track+=keySignature(n)),r&&(this.track+=timeSignature(r)),t&&(this.track+=encodeString(t,`%01`)),this.endTrack()}},Midi.prototype.startTrack=function(){this.noteWarped={},this.track=``,this.trackName=``,this.trackInstrument=``,this.silencelength=0,this.trackcount++,this.instrument&&this.setInstrument(this.instrument)},Midi.prototype.endTrack=function(){this.track=this.trackName+this.trackInstrument+this.track,this.track=`MTrk`+toHex(this.track.length/3+4,8)+this.track+`%00%FF%2F%00`,this.trackstrings+=this.track},Midi.prototype.setText=function(e,t){switch(e){case`name`:this.trackName=encodeString(t,`%03`);break}},Midi.prototype.setInstrument=function(e){this.trackInstrument=`%00%C0`+toHex(e,2),this.instrument=e},Midi.prototype.setChannel=function(e,t){this.channel=e;var n=`%00%B`+this.channel.toString(16);this.track+=n+`%79%00`,this.track+=n+`%40%00`,this.track+=n+`%5B%30`,t||(t=0),t=Math.round((t+1)*64),this.track+=n+`%0A`+toHex(t,2),this.track+=n+`%07%64`,this.noteOnAndChannel=`%9`+this.channel.toString(16),this.noteOffAndChannel=`%8`+this.channel.toString(16)};var e=4096;Midi.prototype.startNote=function(t,r,a){if(this.track+=toDurationHex(this.silencelength),this.silencelength=0,a){this.track+=`%e`+this.channel.toString(16);var o=Math.round(n(a)*e);this.track+=to7BitHex(8192+o),this.track+=toDurationHex(0),this.noteWarped[t]=!0}this.track+=this.noteOnAndChannel,this.track+=`%`+t.toString(16)+toHex(r,2)},Midi.prototype.endNote=function(e){this.track+=toDurationHex(this.silencelength),this.silencelength=0,this.noteWarped[e]&&(this.track+=`%e`+this.channel.toString(16),this.track+=to7BitHex(8192),this.track+=toDurationHex(0),this.noteWarped[e]=!1),this.track+=this.noteOffAndChannel,this.track+=`%`+e.toString(16)+`%00`},Midi.prototype.addRest=function(e){this.silencelength+=e,this.silencelength<0&&(this.silencelength=0)},Midi.prototype.getData=function(){return`data:audio/midi,MThd%00%00%00%06%00%01`+toHex(this.trackcount,4)+`%01%e0`+this.trackstrings},Midi.prototype.embed=function(e,t){var n=this.getData(),r=setAttributes(document.createElement(`a`),{href:n});if(r.innerHTML=`download midi`,e.insertBefore(r,e.firstChild),!t){var a=setAttributes(document.createElement(`embed`),{src:n,type:`video/quicktime`,controller:`true`,autoplay:`false`,loop:`false`,enablejavascript:`true`,style:`display:block; height: 20px;`});e.insertBefore(a,e.firstChild)}};function encodeString(e,t){for(var n=``,r=0;r<e.length;r++)n+=toHex(e.charCodeAt(r),2);return`%00%FF`+t+toHex(n.length/3,2)+n}function keySignature(e){if(!e||!e.accidentals)return``;for(var t=`%00%FF%59%02`,n=0,r=256,a=0;a<e.accidentals.length;a++)e.accidentals[a].acc===`sharp`?n++:e.accidentals[a].acc===`flat`&&r--;var o=toHex(r===256?n:r,2),c=e.mode===`m`?`%01`:`%00`;return t+o+c}function timeSignature(e){var t=`%00%FF%58%04`+toHex(e.num,2),n={1:0,2:1,4:2,8:3,16:4,32:5}[e.den];if(!n)return``;t+=toHex(n,2);var r;switch(e.num+`/`+e.den){case`2/4`:case`3/4`:case`4/4`:case`5/4`:r=24;break;case`6/4`:r=72;break;case`2/2`:case`3/2`:case`4/2`:r=48;break;case`3/8`:case`6/8`:case`9/8`:case`12/8`:r=36;break}return r?(t+=toHex(r,2),t+`%08`):``}function encodeHex(e){for(var t=``,n=0;n<e.length;n+=2)t+=`%`,t+=e.substr(n,2);return t}function toHex(e,t){var n=e.toString(16);for(n=n.split(`.`)[0];n.length<t;)n=`0`+n;return n.length>t&&(n=n.substring(0,t)),encodeHex(n)}function to7BitHex(e){e=Math.round(e);var t=e%128;return toHex((e-t)*2+t,4)}function toDurationHex(e){var t=0,n=[];for(e=Math.round(e);e!==0;)n.push(e&127),e>>=7;for(var r=n.length-1;r>=0;r--){t<<=8;var a=n[r];r!==0&&(a|=128),t|=a}var o=t.toString(16).length;return o+=o%2,toHex(t,o)}rendererFactory=function(){return new Midi}})(),t.exports=rendererFactory})),Os=__commonJSMin(((e,t)=>{var n=Ds(),r;(function(){var e=480*4;r=function create(t,r){r===void 0&&(r={});var a=t.setUpAudio(r),o=n(),c=t.metaText?t.metaText.title:void 0;c&&c.length>128&&(c=c.substring(0,124)+`...`);var l=t.getKeySignature(),u=t.getMeterFraction(),d=a.tempo,p=d/60;u.den==8&&(d=6e4/(t.millisecondsPerMeasure()/u.num)/2,p=d/60),o.setGlobalInfo(d,c,l,u);for(var m=0;m<a.tracks.length;m++){o.startTrack();for(var h={},g=0;g<a.tracks[m].length;g++){var _=a.tracks[m][g];switch(_.cmd){case`text`:o.setText(_.type,_.text);break;case`program`:var y=0;r.pan&&r.pan.length>m&&(y=r.pan[m]),_.instrument===128?(o.setChannel(9,y),o.setInstrument(0)):(o.setChannel(_.channel,y),o.setInstrument(_.instrument));break;case`note`:var b=_.gap*p,x=_.start,S=x+_.duration-b;h[x]||(h[x]=[]),h[x].push({pitch:_.pitch,volume:_.volume,cents:_.cents}),h[S]||(h[S]=[]),h[S].push({pitch:_.pitch,volume:0});break;default:console.log(`MIDI create Unknown: `+_.cmd)}}addNotes(o,h,e),o.endTrack()}return o.getData()};function addNotes(e,t,n){for(var r=Object.keys(t),a=0;a<r.length;a++)r[a]=parseFloat(r[a]);r.sort(function(e,t){return e-t});for(var o=0,c=0;c<r.length;c++){var l=t[r[c]];if(r[c]>o){var u=(r[c]-o)*n;e.addRest(u),o=r[c]}for(var d=0;d<l.length;d++){var p=l[d];p.volume?e.startNote(p.pitch,p.volume,p.cents):e.endNote(p.pitch)}}}})(),t.exports=r})),ks=__commonJSMin(((e,t)=>{var n=Pa(),r=Os(),getMidiFile=function(e,t){var a={};if(t)for(var o in t)t.hasOwnProperty(o)&&(a[o]=t[o]);a.generateInline=!1;function callback(e,t,n){var o=r(t,a);switch(a.midiOutputType){case`encoded`:return o;case`binary`:var c=o.replace(`data:audio/midi,`,``);c=c.replace(/MThd/g,`%4d%54%68%64`),c=c.replace(/MTrk/g,`%4d%54%72%6b`);for(var l=new ArrayBuffer(c.length/3),u=new Uint8Array(l),d=0;d<c.length/3;d++){var p=d*3+1;u[d]=parseInt(c.substring(p,p+2),16)}return u;default:return generateMidiDownloadLink(t,a,o,n)}}return typeof e==`string`?n.renderEngine(callback,`*`,e,a):callback(null,e,0)};function isFunction(e){return e&&{}.toString.call(e)===`[object Function]`}var generateMidiDownloadLink=function(e,t,n,r){var a=[`abcjs-download-midi`,`abcjs-midi-`+r];t.downloadClass&&a.push(t.downloadClass);var o=`<div class="`+a.join(` `)+`">`;t.preTextDownload&&(o+=t.preTextDownload);var c=e.metaText&&e.metaText.title?e.metaText.title:`Untitled`,l=t.downloadLabel&&isFunction(t.downloadLabel)?t.downloadLabel(e,r):t.downloadLabel?t.downloadLabel.replace(/%T/,c):`Download MIDI for "`+c+`"`;c=c.toLowerCase().replace(/'/g,``).replace(/\W/g,`_`).replace(/__/g,`_`);var u=t.fileName?t.fileName:c+`.midi`;return o+=`<a download="`+u+`" href="`+n+`">`+l+`</a>`,t.postTextDownload&&(o+=t.postTextDownload),o+`</div>`};t.exports=getMidiFile})),As=__commonJSMin(((e,t)=>{try{if(typeof window.CustomEvent!=`function`){var CustomEvent=function(e,t){t||(t={bubbles:!1,cancelable:!1,detail:void 0});var n=document.createEvent(`CustomEvent`);return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};CustomEvent.prototype=window.Event.prototype,window.CustomEvent=CustomEvent}}catch{}var EditArea=function(e){typeof e==`string`?this.textarea=document.getElementById(e):this.textarea=e,this.initialText=this.textarea.value,this.isDragging=!1};EditArea.prototype.addSelectionListener=function(e){this.textarea.onmousemove=function(t){this.isDragging&&e.fireSelectionChanged()}},EditArea.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()}},EditArea.prototype.getSelection=function(){return{start:this.textarea.selectionStart,end:this.textarea.selectionEnd}},EditArea.prototype.setSelection=function(e,t){if(this.textarea.setSelectionRange)this.textarea.setSelectionRange(e,t);else if(this.textarea.createTextRange){var n=this.textarea.createTextRange();n.collapse(!0),n.moveEnd(`character`,t),n.moveStart(`character`,e),n.select()}this.textarea.focus()},EditArea.prototype.getString=function(){return this.textarea.value},EditArea.prototype.setString=function(e){this.textarea.value=e,this.initialText=this.getString(),this.changelistener&&this.changelistener.fireChanged()},EditArea.prototype.getElem=function(){return this.textarea},t.exports=EditArea})),js=__commonJSMin(((e,t)=>{var n=Xi(),r=Es(),a=fs(),o=is(),c=As();function gatherAbcParams(e){var t={},n;if(e.abcjsParams)for(n in e.abcjsParams)e.abcjsParams.hasOwnProperty(n)&&(t[n]=e.abcjsParams[n]);if(e.midi_options)for(n in e.midi_options)e.midi_options.hasOwnProperty(n)&&(t[n]=e.midi_options[n]);if(e.parser_options)for(n in e.parser_options)e.parser_options.hasOwnProperty(n)&&(t[n]=e.parser_options[n]);if(e.render_options)for(n in e.render_options)e.render_options.hasOwnProperty(n)&&(t[n]=e.render_options[n]);return t.tablature&&e.warnings_id&&(t.tablature.warnings_id=e.warnings_id),t}var Editor=function(e,t){this.abcjsParams=gatherAbcParams(t),t.indicate_changed&&(this.indicate_changed=!0),typeof e==`string`?this.editarea=new c(e):this.editarea=e,this.editarea.addSelectionListener(this),this.editarea.addChangeListener(this),t.canvas_id?this.div=t.canvas_id:t.paper_id?this.div=t.paper_id:(this.div=document.createElement(`DIV`),this.editarea.getElem().parentNode.insertBefore(this.div,this.editarea.getElem())),typeof this.div==`string`&&(this.div=document.getElementById(this.div)),t.selectionChangeCallback&&(this.selectionChangeCallback=t.selectionChangeCallback),this.clientClickListener=this.abcjsParams.clickListener,this.abcjsParams.clickListener=this.highlight.bind(this),t.synth&&a()&&(this.synth={el:t.synth.el,cursorControl:t.synth.cursorControl,options:t.synth.options}),t.generate_midi&&(this.generate_midi=t.generate_midi,this.abcjsParams.generateDownload&&(typeof t.midi_download_id==`string`?this.downloadMidi=document.getElementById(t.midi_download_id):t.midi_download_id&&(this.downloadMidi=t.midi_download_id)),this.abcjsParams.generateInline!==!1&&(typeof t.midi_id==`string`?this.inlineMidi=document.getElementById(t.midi_id):t.midi_id&&(this.inlineMidi=t.midi_id))),t.warnings_id?typeof t.warnings_id==`string`?this.warningsdiv=document.getElementById(t.warnings_id):this.warningsdiv=t.warnings_id:t.generate_warnings&&(this.warningsdiv=document.createElement(`div`),this.div.parentNode.insertBefore(this.warningsdiv,this.div)),this.onchangeCallback=t.onchange,this.currentAbc=``,this.tunes=[],this.bReentry=!1,this.parseABC(),this.modelChanged(),this.addClassName=function(e,t){var hasClassName=function(e,t){var n=e.className;return n.length>0&&(n===t||RegExp(`(^|\\s)`+t+`(\\s|$)`).test(n))};return hasClassName(e,t)||(e.className+=(e.className?` `:``)+t),e},this.removeClassName=function(e,t){return e.className=n.strip(e.className.replace(RegExp(`(^|\\s+)`+t+`(\\s+|$)`),` `)),e},this.setReadOnly=function(e){var t=`abc_textarea_readonly`,n=this.editarea.getElem();e?(n.setAttribute(`readonly`,`yes`),this.addClassName(n,t)):(n.removeAttribute(`readonly`),this.removeClassName(n,t))}};Editor.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 t=this.synth.synthControl;this.synth.synthControl||(this.synth.synthControl=new r,this.synth.synthControl.load(this.synth.el,this.synth.cursorControl,this.synth.options)),this.synth.synthControl.setTune(this.tunes[0],t,this.synth.options)}},Editor.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=o(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}},Editor.prototype.paramChanged=function(e){if(e)for(var t in e)e.hasOwnProperty(t)&&(this.abcjsParams[t]=e[t]);this.currentAbc=``,this.fireChanged()},Editor.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()}},Editor.prototype.parseABC=function(){var e=this.editarea.getString();return e===this.currentAbc?(this.updateSelection(),!1):(this.currentAbc=e,!0)},Editor.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{}this.selectionChangeCallback&&this.selectionChangeCallback(e.start,e.end)},Editor.prototype.fireSelectionChanged=function(){this.updateSelection()},Editor.prototype.setDirtyStyle=function(e){if(this.indicate_changed!==void 0){var addClassName=function(e,t){var hasClassName=function(e,t){var n=e.className;return n.length>0&&(n===t||RegExp(`(^|\\s)`+t+`(\\s|$)`).test(n))};return hasClassName(e,t)||(e.className+=(e.className?` `:``)+t),e},removeClassName=function(e,t){return e.className=n.strip(e.className.replace(RegExp(`(^|\\s+)`+t+`(\\s+|$)`),` `)),e},t=`abc_textarea_dirty`,r=this.editarea.getElem();e?addClassName(r,t):removeClassName(r,t)}},Editor.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)}},Editor.prototype.setNotDirty=function(){this.editarea.initialText=this.editarea.getString(),this.wasDirty=!1,this.setDirtyStyle(!1)},Editor.prototype.isDirty=function(){return this.indicate_changed===void 0?!1:this.editarea.initialText!==this.editarea.getString()},Editor.prototype.highlight=function(e,t,n,r,a,o){this.editarea.setSelection(e.startChar,e.endChar),this.selectionChangeCallback&&this.selectionChangeCallback(e.startChar,e.endChar),this.clientClickListener&&this.clientClickListener(e,t,n,r,a,o)},Editor.prototype.pause=function(e){this.bIsPaused=e,e||this.fireChanged()},Editor.prototype.millisecondsPerMeasure=function(){return!this.synth||!this.synth.synthControl||!this.synth.synthControl.visualObj?0:this.synth.synthControl.visualObj.millisecondsPerMeasure()},Editor.prototype.pauseMidi=function(e){this.midiPause=e,e||this.redrawMidi()},t.exports=Editor})),Ms=__toESM(__commonJSMin(((e,t)=>{var n=qi(),r=Yi(),a=Pa(),o=ua(),c=Fa(),l={};l.signature=`abcjs-basic v`+n,Object.keys(r).forEach(function(e){l[e]=r[e]}),Object.keys(a).forEach(function(e){l[e]=a[e]}),l.renderAbc=is(),l.tuneMetrics=as(),l.TimingCallbacks=Ji(),l.setGlyph=Ra().setSymbol,l.strTranspose=c;var u=_s(),d=cs(),p=ps(),m=vs(),h=ws(),g=us(),_=ds(),y=fs(),b=Ts();l.synth={CreateSynth:u,instrumentIndexToName:d,pitchToNoteName:p,SynthController:Es(),SynthSequence:m,CreateSynthControl:h,registerAudioContext:g,activeAudioContext:_,supportsAudio:y,playEvent:b,getMidiFile:ks(),sequence:o,midiRenderer:Ds()},l.Editor=js(),l.EditArea=As(),t.exports=l}))(),1),Ns=m({name:`MusicScoreRenderer`,props:{abcString:{type:String,required:!0}},mounted(){Ms.default.renderAbc(`abc`,this.abcString)}}),Ps={id:`abc`};function _sfc_render$6(e,t,n,r,o,c){return a(),x(`div`,Ps)}__name(_sfc_render$6,`_sfc_render`);var Fs=Ne(Ns,[[`render`,_sfc_render$6]]);function fiveRandomKeys(){let e=[];for(let t=0;t<5;t++)e.push(zs[Math.floor(Math.random()*zs.length)]);return e}var Is=m({name:`IdentifyKeyView`,components:{RadioMultipleChoice:F,MusicScoreRenderer:Fs},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`IdentifyKeyView`),r=K(n),a=T(``);r.question.value=new Bs(e.data);let o=w(()=>r.question.value),c=w(()=>{let e=fiveRandomKeys();return e.includes(o.value?.key||``)||(e[Math.floor(Math.random()*e.length)]=o.value?.key||``),e}),submit=()=>{};return{...n,...r,answer:a,question:o,choices:c,submit}}}),Ls={"data-viewable":`IdentifyKeyView`};function _sfc_render$5(e,t,n,o,c,u){let d=l(`MusicScoreRenderer`),m=l(`RadioMultipleChoice`);return a(),x(`div`,Ls,[e.question?(a(),x(C,{key:0},[r(d,{"key-signature":`X:1\nK:${e.question.key}\n||`,"abc-string":`''`},null,8,[`key-signature`]),t[0]||(t[0]=p(` This signature is for the major key: _____ `)),r(m,{"choice-list":e.choices},null,8,[`choice-list`])],64)):k(``,!0)])}__name(_sfc_render$5,`_sfc_render`);var Rs=Ne(Is,[[`render`,_sfc_render$5]]),zs=[`C`,`G`,`D`,`A`,`E`,`B`,`F#`,`C#`,`F`,`Bb`,`Eb`,`Ab`,`Db`,`Gb`,`Cb`],Bs=(Oe=class IdentifyKeyQuestion extends N{static getKey(e){return zs[e]}constructor(e){var _super14=(...e)=>(super(...e),U(this,`key`,void 0),this);_super14(e),this.key=IdentifyKeyQuestion.getKey(e[0].key)}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}},U(Oe,`dataShapes`,[{name:H.SIGHTSING_IdentifyKey,fields:[{name:`key`,type:R.NUMBER,validator:{test:e=>{let t=parseInt(e);return t>=0&&t<=zs.length?{msg:``,status:z.ok}:{msg:`Please enter a number between 0 and 11`,status:z.error}}}}]}]),U(Oe,`views`,[Rs]),Oe),Vs=new CourseWare(`sightSing`,[Bs]),Hs=m({name:`LetterQuestionView`,props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let r=W(e,t,`LetterQuestionView`),a=K(r),o=T(null);a.question.value=new Ks(e.data);let c=w(()=>a.question.value),handleKeyPress=e=>{if(!c.value)return;let t=e.key.toLowerCase(),n=c.value.letter.toLowerCase();if(t===n){o.value?.classList.add(`pressed`);let handleKeyUp=e=>{e.key.toLowerCase()===n&&(o.value?.classList.remove(`pressed`),a.submitAnswer(t),window.removeEventListener(`keyup`,handleKeyUp))};window.addEventListener(`keyup`,handleKeyUp)}else a.submitAnswer(t)};return A(()=>{window.addEventListener(`keypress`,handleKeyPress)}),n(()=>{window.removeEventListener(`keypress`,handleKeyPress)}),{...a,...r,letterDisplay:o,question:c}}}),Us={"data-viewable":`LetterQuestionView`};function _sfc_render$4(e,t,n,r,o,c){return a(),x(`div`,Us,[e.question?(a(),x(C,{key:0},[t[0]||(t[0]=y(`p`,{class:`text-h5`},`Type this letter!`,-1)),y(`div`,{ref:`letterDisplay`,class:`letter-display`},h(e.question.letter),513)],64)):k(``,!0)])}__name(_sfc_render$4,`_sfc_render`);var Ws=Ne(Hs,[[`render`,_sfc_render$4],[`__scopeId`,`data-v-4ae4db54`]]),Gs=__name(function(){let e=[];for(let t=0;t<26;t++)e.push({letter:String.fromCharCode(65+t)});return e},`data`),Ks=(ke=class TypeLetterQuestion extends N{constructor(e){var _super15=(...e)=>(super(...e),U(this,`letter`,void 0),this);_super15(e),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;{let e=1-(t-3e3)/7e3*.75;return Math.max(.25,e)}}return 0}dataShapes(){return TypeLetterQuestion.dataShapes}views(){return TypeLetterQuestion.views}isCorrect(e){let t=e.toLowerCase()===this.letter.toLowerCase();return console.log(`singleLetter Q isCorrect: ${t}`),t}},U(ke,`dataShapes`,[{name:H.TYPING_singleLetter,fields:[{name:`letter`,type:R.STRING,validator:{instructions:`Enter a single letter`,test:function(e){return!e||e.length!==1||!/[a-zA-Z]/.test(e)?{status:z.error,msg:`Input must be a single letter`}:{status:z.ok,msg:``}}}}]}]),U(ke,`views`,[Ws]),U(ke,`acceptsUserData`,!0),U(ke,`seedData`,Gs()),ke),data=function(){return[{gameLength:30,initialSpeed:2,acceleration:.1,spawnInterval:1}]},qs=(Ae=class FallingLettersQuestion extends N{constructor(e){var _super16=(...e)=>(super(...e),U(this,`gameLength`,void 0),U(this,`initialSpeed`,void 0),U(this,`acceleration`,void 0),U(this,`spawnInterval`,void 0),this);_super16(e),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}},U(Ae,`dataShapes`,[{name:H.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=>typeof e==`string`?parseFloat(e)>0?{status:z.ok,msg:``}:{status:z.error,msg:`Must be greater than 0`}:{status:z.error,msg:`Unexpected non-string input.`},placeholder:`1`}}]}]),U(Ae,`views`,[]),U(Ae,`acceptsUserData`,!0),U(Ae,`seedData`,data()),Ae),Js=m({name:`FallingLettersView`,emits:[`emitResponse`],props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let r=W(e,t,`FallingLettersView`),a=K(r),o=T(null),c=T([]),l=T(!1),u=T(``),d=T(30),p=T(0),m=T([]),h=T([]),g=T({currentSpeed:2,letterId:0,gameLoop:null,lastSpawn:0,lastUpdate:0,spawnInterval:1e3}),generateTrees=()=>{m.value=Array.from({length:7},(e,t)=>({id:t,left:20+t*Math.random()*30-10,height:100+Math.random()*120,scale:1+Math.random()*2}))},spawnLetter=()=>{if(!o.value)return;let e={id:g.value.letterId++,char:String.fromCharCode(65+Math.floor(Math.random()*26)),x:Math.random()*(o.value.clientWidth-30),y:-30};c.value.push(e)},win=()=>{l.value=!0,u.value=`You Win!`,a.submitAnswer({lettersTyped:p.value,win:!0,percentage:1})},lose=()=>{l.value=!0,u.value=`Game Over!`,a.submitAnswer({lettersTyped:p.value,percentage:d.value/(a.question.value?.gameLength||30),win:!1})},update=e=>{if(l.value)return;let t=(e-g.value.lastUpdate)/1e3;if(g.value.lastUpdate=e,d.value-=t,a.question.value&&(g.value.currentSpeed+=a.question.value.acceleration*t),d.value<=0){win();return}e-g.value.lastSpawn>=g.value.spawnInterval&&(spawnLetter(),g.value.lastSpawn=e,g.value.spawnInterval=Math.max(500,g.value.spawnInterval-10)),o.value&&(c.value=c.value.filter(e=>(e.y+=g.value.currentSpeed,e.y>o.value.clientHeight?(lose(),!1):!0))),g.value.gameLoop=requestAnimationFrame(update)},handleKeyPress=e=>{if(l.value)return;let t=e.key.toUpperCase(),n=c.value.findIndex(e=>e.char===t);n!==-1&&(h.value.push({id:Date.now(),x:c.value[n].x,y:c.value[n].y}),setTimeout(()=>{h.value=h.value.filter(e=>e.id!==h.value[h.value.length-1].id)},300),c.value.splice(n,1),p.value++)},startGame=()=>{if(!a.question.value){r.logger.error(`Question not initialized`);return}d.value=a.question.value.gameLength,p.value=0,c.value=[],l.value=!1,u.value=``,g.value={currentSpeed:a.question.value.initialSpeed,letterId:0,gameLoop:null,lastSpawn:performance.now(),lastUpdate:performance.now(),spawnInterval:a.question.value.spawnInterval*1e3},g.value.gameLoop=requestAnimationFrame(update)};return A(()=>{try{a.question.value=new qs(e.data),a.maxAttemptsPerView.value=1,window.addEventListener(`keypress`,handleKeyPress),generateTrees(),startGame()}catch(e){r.logger.error(`Error initializing game:`,e)}}),n(()=>{window.removeEventListener(`keypress`,handleKeyPress),g.value.gameLoop&&cancelAnimationFrame(g.value.gameLoop)}),{...a,gameArea:o,letters:c,gameOver:l,gameOverMessage:u,timeLeft:d,score:p,treePositions:m,explosions:h}}}),Ys={class:`game-container`},Xs={class:`stats`},Zs={class:`time`},Qs={class:`score`},$s={ref:`gameArea`,class:`game-area`},ec={class:`letter-text`},tc={class:`trees`},nc={key:0,class:`game-over`};function _sfc_render$3(e,t,n,r,o,c){return a(),x(`div`,Ys,[y(`div`,Xs,[y(`div`,Zs,`Time: `+h(e.timeLeft.toFixed(1))+`s`,1),y(`div`,Qs,`Score: `+h(e.score),1)]),y(`div`,$s,[(a(!0),x(C,null,g(e.letters,e=>(a(),x(`div`,{key:e.id,class:`falling-letter`,style:d({left:e.x+`px`,top:e.y+`px`})},[t[0]||(t[0]=y(`div`,{class:`meteor-effect`},null,-1)),y(`span`,ec,h(e.char),1)],4))),128)),(a(!0),x(C,null,g(e.explosions,e=>(a(),x(`div`,{key:e.id,class:`explosion`,style:d({left:e.x+`px`,top:e.y+`px`})},[(a(),x(C,null,g(12,e=>y(`div`,{key:e,class:`particle`})),64))],4))),128)),t[2]||(t[2]=y(`div`,{class:`grass-container`},[y(`div`,{class:`grass`}),y(`div`,{class:`grass-overlay`})],-1)),y(`div`,tc,[(a(!0),x(C,null,g(e.treePositions,e=>(a(),x(`div`,{key:e.id,class:`tree`,style:d({left:`${e.left}%`,height:`${e.height}px`,transform:`scale(${e.scale})`})},t[1]||(t[1]=[y(`div`,{class:`tree-crown`},null,-1),y(`div`,{class:`tree-trunk`},null,-1)]),4))),128))])],512),e.gameOver?(a(),x(`div`,nc,h(e.gameOverMessage),1)):k(``,!0)])}__name(_sfc_render$3,`_sfc_render`),qs.views=[Ne(Js,[[`render`,_sfc_render$3],[`__scopeId`,`data-v-41b85e8b`]])];var rc=new CourseWare(`typing`,[Ks,qs]),ic=m({name:`IdentifyVocab`,components:{AudioAutoPlayer:te,UserInputString:G},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){let n=W(e,t,`IdentifyVocab`),r=K(n),a=T(``);r.question.value=new lc(e.data);let o=w(()=>r.question.value),submit=()=>{o.value&&r.submitAnswer(a.value)};return{...n,...r,answer:a,question:o,submit}}}),ac={"data-viewable":`IdentifyVocab`},oc={key:0,class:`text-h6`};function _sfc_render$2(e,n,o,c,u,d){let p=l(`UserInputString`),m=l(`center`),g=l(`audio-auto-player`);return a(),x(`div`,ac,[e.question?(a(),x(C,{key:0},[n[1]||(n[1]=y(`span`,{class:`text-h5`},` Spell the word: `,-1)),r(p,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,[`modelValue`]),r(m,null,{default:t(()=>[e.priorAttempts?(a(),x(`span`,oc,h(e.question.word),1)):k(``,!0)]),_:1}),r(m,null,{default:t(()=>[r(g,{src:[e.getURL(`WordAudio`),e.getURL(`SentenceAudio`),e.getURL(`WordAudio`)]},null,8,[`src`])]),_:1})],64)):k(``,!0)])}__name(_sfc_render$2,`_sfc_render`);var sc=Ne(ic,[[`render`,_sfc_render$2]]),cc=[{name:`Word`,type:R.STRING,validator:B.NonEmptyString},{name:`ExampleSentence`,type:R.STRING},{name:`WordAudio`,type:R.AUDIO},{name:`SentenceAudio`,type:R.AUDIO}],lc=(je=class SpellingQuestion extends N{constructor(e){var _super17=(...e)=>(super(...e),U(this,`word`,void 0),U(this,`sentence`,void 0),U(this,`audio_word`,void 0),U(this,`audio_sentence`,void 0),this);_super17(e),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}},U(je,`dataShapes`,[{fields:cc,name:H.WORDWORK_Spelling}]),U(je,`views`,[sc]),je),uc=new CourseWare(`wordWork`,[lc]),dc=m({name:`PianoRangeVisualizer`,props:{lowestNote:{type:Number,required:!0},highestNote:{type:Number,required:!0},maxWidth:{type:Number,default:1e3}},setup(e){let t=T(null),n=T(800),r=w(()=>{let e=0;for(let t=21;t<=108;t++)isWhiteKey(t)&&e++;return e}),a=w(()=>Math.min(22,n.value/Math.max(25,r.value))),o=w(()=>a.value*.6),c=w(()=>Math.min(e.maxWidth,a.value*r.value+10)),isWhiteKey=e=>{let t=e%12;return[0,2,4,5,7,9,11].includes(t)},getKeyPosition=e=>{let t=0;for(let n=21;n<e;n++)isWhiteKey(n)&&t++;return isWhiteKey(e)?t*a.value:t*a.value-o.value/2},getNoteLabel=e=>{let t=[`C`,`C#`,`D`,`D#`,`E`,`F`,`F#`,`G`,`G#`,`A`,`A#`,`B`],n=e%12,r=Math.floor(e/12)-1;return`${t[n]}${r}`};return A(()=>{t.value&&(n.value=t.value.clientWidth,new ResizeObserver(e=>{for(let t of e)n.value=t.contentRect.width}).observe(t.value))}),{pianoWrapper:t,keyHeight:100,blackKeyHeight:60,whiteKeyWidth:a,blackKeyWidth:o,svgWidth:c,isWhiteKey,getKeyPosition,getNoteLabel}}}),fc={class:`piano-range-container`},pc={class:`piano-wrapper`,ref:`pianoWrapper`},mc=[`width`,`height`],hc={class:`background-keys`,opacity:`0.15`},gc=[`x`,`width`,`height`],_c=[`x`,`width`,`height`],vc={class:`selected-range`},yc=[`x`,`width`,`height`],bc=[`x`,`width`,`height`],xc={class:`range-markers`},Sc=[`x`,`height`],Cc=[`x`,`height`],wc=[`x`,`y`],Tc=[`x`,`y`];function _sfc_render$1(e,t,n,r,o,c){return a(),x(`div`,fc,[y(`div`,pc,[(a(),x(`svg`,{width:e.svgWidth,height:e.keyHeight+20,class:`piano-svg`},[y(`g`,hc,[(a(),x(C,null,g(88,t=>(a(),x(C,{key:`bg-${t}`},[e.isWhiteKey(t+20)?(a(),x(`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,gc)):k(``,!0)],64))),64)),(a(),x(C,null,g(88,t=>(a(),x(C,{key:`bg-black-${t}`},[e.isWhiteKey(t+20)?k(``,!0):(a(),x(`rect`,{key:0,x:e.getKeyPosition(t+20),y:`0`,width:e.blackKeyWidth,height:e.blackKeyHeight,class:`black-key`},null,8,_c))],64))),64))]),y(`g`,vc,[(a(),x(C,null,g(128,t=>(a(),x(C,{key:`white-${t}`},[e.isWhiteKey(t)&&t>=e.lowestNote&&t<=e.highestNote?(a(),x(`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,yc)):k(``,!0)],64))),64)),(a(),x(C,null,g(128,t=>(a(),x(C,{key:`black-${t}`},[!e.isWhiteKey(t)&&t>=e.lowestNote&&t<=e.highestNote?(a(),x(`rect`,{key:0,x:e.getKeyPosition(t),y:`0`,width:e.blackKeyWidth,height:e.blackKeyHeight,class:`black-key active`},null,8,bc)):k(``,!0)],64))),64))]),y(`g`,xc,[y(`rect`,{x:e.getKeyPosition(e.lowestNote)-2,y:`0`,width:4,height:e.keyHeight+5,class:`range-marker start`},null,8,Sc),y(`rect`,{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-2,y:`0`,width:4,height:e.keyHeight+5,class:`range-marker end`},null,8,Cc)]),y(`text`,{x:e.getKeyPosition(e.lowestNote)+3,y:e.keyHeight+12,class:`note-label`},h(e.getNoteLabel(e.lowestNote)),9,wc),y(`text`,{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-3,y:e.keyHeight+12,"text-anchor":`end`,class:`note-label`},h(e.getNoteLabel(e.highestNote)),9,Tc)],8,mc))],512)])}__name(_sfc_render$1,`_sfc_render`);var Ec=m({name:`MidiConfig`,components:{PianoRangeVisualizer:Ne(dc,[[`render`,_sfc_render$1],[`__scopeId`,`data-v-4b232a8b`]])},props:{_id:{type:String,required:!0},user:{type:Object,required:!0}},setup(e){let t=T(),n=T(!0),r=T([]),a=T([]),o=T(``),c=T(``),l=T(!1),u=T(``),d=T(``),p=T(!1),m=T(`full-88`),h=T(21),g=T(108),y=T(``),b=T(0),x=T(0),S=T([]),initNoteOptions=()=>{let e=[`C`,`C#`,`D`,`D#`,`E`,`F`,`F#`,`G`,`G#`,`A`,`A#`,`B`],t=[];for(let n=0;n<=127;n++){let r=Math.floor(n/12)-1,a=e[n%12];t.push({title:`${a}${r} (${n})`,value:n})}S.value=t},C=T([{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`}]),checkConfigChanged=()=>{p.value=o.value!==u.value||c.value!==d.value||m.value!==y.value||m.value===`custom`&&(h.value!==b.value||g.value!==x.value)},updateCustomRangeFromPreset=()=>{switch(m.value){case`full-88`:h.value=21,g.value=108;break;case`76-key`:h.value=28,g.value=103;break;case`61-key`:h.value=36,g.value=96;break;case`49-key`:h.value=48,g.value=96;break;case`37-key`:h.value=48,g.value=84;break;case`25-key`:h.value=60,g.value=84;break}checkConfigChanged()},updateRangeAndCheckChanges=()=>{h.value>=g.value&&(g.value=h.value+12),checkConfigChanged()},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}])},indicateHeardNotes=e=>{P({text:`I hear a ${e.note.name}!`,status:z.ok})};_(o,()=>{t.value?.selectInput(o.value),checkConfigChanged()}),_(c,()=>{t.value?.selectOutput(c.value),checkConfigChanged()});let retrieveSettings=async()=>{let t=await(await e.user.getCourseInterface(e._id)).getCourseSettings();if(t?.midiinput){let e=t.midiinput.toString();r.value.some(t=>t.value===e)&&(o.value=e,u.value=e)}if(t?.midioutput){let e=t.midioutput.toString();a.value.some(t=>t.value===e)&&(c.value=e,d.value=e)}t?.keyboardRange&&(y.value=t.keyboardRange.toString(),m.value=y.value),t?.lowestNote&&(b.value=parseInt(t.lowestNote.toString()),h.value=b.value),t?.highestNote&&(x.value=parseInt(t.highestNote.toString()),g.value=x.value),t?.lowestNote&&t?.highestNote&&!t?.keyboardRange&&(m.value=`custom`),p.value=!1},saveSettings=async()=>{l.value=!0,(await oe().getUserDB().getCourseInterface(e._id)).updateCourseSettings([{key:`midiinput`,value:o.value},{key:`midioutput`,value:c.value},{key:`keyboardRange`,value:m.value},{key:`lowestNote`,value:h.value},{key:`highestNote`,value:g.value}]),u.value=o.value,d.value=c.value,y.value=m.value,b.value=h.value,x.value=g.value,p.value=!1,l.value=!1,P({text:`Settings updated.`,status:z.ok})};return A(async()=>{initNoteOptions();try{t.value=await ci.instance(),n.value=t.value.state===`ready`||t.value.state===`nodevice`}catch(e){console.log(`Error on midi Init: ${e}`),n.value=!1}n.value&&(t.value?.addNoteonListenter(indicateHeardNotes),t.value?(r.value=t.value.inputs.filter(e=>e.state===`connected`).map(e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id})),a.value=t.value?.outputs.filter(e=>e.state===`connected`).map(e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id}))):(r.value=[{title:`No inputs available`,value:``}],a.value=[{title:`No outputs available`,value:``}]),await retrieveSettings(),!o.value&&r.value.length>0&&(o.value=r.value[0].value),!c.value&&a.value.length>0&&(c.value=a.value[0].value))}),{midiSupported:n,inputs:r,outputs:a,selectedInput:o,selectedOutput:c,updatePending:l,playSound,saveSettings,configChanged:p,lowestNote:h,highestNote:g,keyboardRangeOptions:C,selectedKeyboardRange:m,noteOptions:S,updateCustomRangeFromPreset,updateRangeAndCheckChanges}}}),Dc={key:0,class:`custom-range-inputs d-flex gap-4`},Oc={class:`d-flex justify-space-between mt-3`},kc={key:1};function _sfc_render(e,n,o,c,u,d){let m=l(`v-toolbar-title`),h=l(`v-toolbar`),g=l(`v-select`),_=l(`v-divider`),b=l(`piano-range-visualizer`),S=l(`v-btn`),C=l(`v-form`),w=l(`v-card-text`),T=l(`v-card`);return a(),D(T,null,{default:t(()=>[r(h,{dense:``},{default:t(()=>[r(m,null,{default:t(()=>n[5]||(n[5]=[p(`Configure Midi Device`)])),_:1})]),_:1}),r(w,null,{default:t(()=>[e.midiSupported?(a(),D(C,{key:0,onsubmit:`return false;`},{default:t(()=>[r(g,{modelValue:e.selectedInput,"onUpdate:modelValue":n[0]||(n[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`]),r(g,{modelValue:e.selectedOutput,"onUpdate:modelValue":n[1]||(n[1]=t=>e.selectedOutput=t),items:e.outputs,label:`Select Output`},null,8,[`modelValue`,`items`]),r(_,{class:`my-4`}),n[8]||(n[8]=y(`h3`,{class:`text-subtitle-1 mb-2`},`Keyboard Range`,-1)),r(g,{modelValue:e.selectedKeyboardRange,"onUpdate:modelValue":[n[2]||(n[2]=t=>e.selectedKeyboardRange=t),e.updateCustomRangeFromPreset],items:e.keyboardRangeOptions,label:`Select Keyboard Range`},null,8,[`modelValue`,`items`,`onUpdate:modelValue`]),e.selectedKeyboardRange===`custom`?(a(),x(`div`,Dc,[r(g,{modelValue:e.lowestNote,"onUpdate:modelValue":[n[3]||(n[3]=t=>e.lowestNote=t),e.updateRangeAndCheckChanges],items:e.noteOptions,label:`Lowest Note`},null,8,[`modelValue`,`items`,`onUpdate:modelValue`]),r(g,{modelValue:e.highestNote,"onUpdate:modelValue":[n[4]||(n[4]=t=>e.highestNote=t),e.updateRangeAndCheckChanges],items:e.noteOptions,label:`Highest Note`},null,8,[`modelValue`,`items`,`onUpdate:modelValue`])])):k(``,!0),r(b,{"lowest-note":e.lowestNote,"highest-note":e.highestNote},null,8,[`lowest-note`,`highest-note`]),y(`div`,Oc,[r(S,{color:`primary`,onClick:e.playSound},{default:t(()=>n[6]||(n[6]=[p(`Test midi output`)])),_:1},8,[`onClick`]),r(S,{loading:e.updatePending,disabled:!e.configChanged&&!e.updatePending,color:`info`,class:`save-button`,onClick:e.saveSettings},{default:t(()=>n[7]||(n[7]=[p(` Save these settings `)])),_:1},8,[`loading`,`disabled`,`onClick`])])]),_:1})):(a(),x(`div`,kc,n[9]||(n[9]=[y(`p`,null,`This quilt requires a midi input device, which is not supported by this browser.`,-1),y(`div`,null,[y(`p`,null,`Try one of the following browsers:`),y(`ul`,null,[y(`li`,null,[y(`a`,{href:`https://www.google.com/chrome/`},`Google Chrome`)]),y(`li`,null,[y(`a`,{href:`https://www.microsoft.com/edge`},`Microsoft Edge`)]),y(`li`,null,[y(`a`,{href:`https://brave.com/`},`Brave`)])])],-1)])))]),_:1})]),_:1})}var Ac=Ne(Ec,[[`render`,_sfc_render],[`__scopeId`,`data-v-6ee9020f`]]),AllCourseWare=class{get courses(){return this.courseWareList}constructor(e){U(this,`courseWareList`,void 0),U(this,`cachedRawViews`,null),this.courseWareList=e}getCourseWare(e){return this.courseWareList.find(t=>t.name===e)}allViewsRaw(){if(!this.cachedRawViews){let e=this.allViews();this.cachedRawViews=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,b(t)]))}return this.cachedRawViews}allViews(){let e={};return this.courseWareList.forEach(t=>{Object.assign(e,t.allViewsMap)}),e}getView(e){let t;t=typeof e==`string`?L.getViewDescriptor(e):e;let n=this.getCourseWare(t.course);if(n){let e=n.getQuestion(t.questionType);if(e){let r=e.views.find(e=>e.name===t.view);if(r)return r;throw console.error(`QuestionView ${t.view} not found in course ${t.course}
171
+
172
+ descriptor: ${JSON.stringify(t)}
173
+
174
+ course: ${n.name}
175
+ question: ${e.name}
176
+ views: ${e.views.map(e=>e.name).join(`, `)}
177
+ `),Error(`view ${t.view} does not exist.`)}else throw console.error(`Question ${t.questionType} not found in course ${t.course}
178
+
179
+ descriptor: ${JSON.stringify(t)}
180
+
181
+ course: ${n.name}
182
+ questions: ${n.questions.map(e=>e.name).join(`, `)}
183
+ `),Error(`question ${t.questionType} does not exist.`)}else throw console.error(`Course ${t.course} not found.
184
+
185
+ descriptor: ${JSON.stringify(t)}`),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(){let e=[];return this.courseWareList.forEach(t=>{t.questions.forEach(t=>{t.dataShapes.forEach(t=>{e.includes(t)||e.push(t)})})}),e}allDataShapes(){let e=[];return this.courseWareList.forEach(t=>{t.questions.forEach(n=>{n.dataShapes.forEach(r=>{e.findIndex(e=>e.course===t.name&&e.dataShape===r.name)===-1&&e.push({course:t.name,dataShape:r.name,displayable:n})})})}),e}getDataShape(e){let t;if(this.getCourseWare(e.course).questions.forEach(n=>{n.dataShapes.forEach(n=>{n.name===e.dataShape&&(t=n)})}),t)return t;throw Error(`DataShape ${L.getDataShapeString(e)} not found`)}},jc=new AllCourseWare([er,uc,Bt,Be,zi,Ki,Vs,At,rc]);export{Ki as _,oi as a,pe as b,Bt as c,ze as d,gradeSpellingAttempt as f,jc as g,transposeSyllableSeq as h,uc as i,Ac as l,At as m,CourseWare as n,fi as o,er as p,rc as r,zi as s,AllCourseWare as t,eventsToSyllableSequence as u,Vs as v,ci as y};
186
+ //# sourceMappingURL=dist-BlP52QF6.js.map