@vue-skuilder/edit-ui 0.1.1
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.
- package/dist/assets/index.css +1 -0
- package/dist/edit-ui.es.js +71090 -0
- package/dist/edit-ui.es.js.map +1 -0
- package/dist/edit-ui.umd.js +83 -0
- package/dist/edit-ui.umd.js.map +1 -0
- package/package.json +67 -0
- package/src/components/BulkImport/CardPreviewList.vue +345 -0
- package/src/components/BulkImportView.vue +633 -0
- package/src/components/CourseEditor.vue +164 -0
- package/src/components/ViewableDataInputForm/DataInputForm.vue +533 -0
- package/src/components/ViewableDataInputForm/FieldInput.types.ts +33 -0
- package/src/components/ViewableDataInputForm/FieldInputs/AudioInput.vue +188 -0
- package/src/components/ViewableDataInputForm/FieldInputs/ChessPuzzleInput.vue +79 -0
- package/src/components/ViewableDataInputForm/FieldInputs/FieldInput.css +12 -0
- package/src/components/ViewableDataInputForm/FieldInputs/ImageInput.vue +231 -0
- package/src/components/ViewableDataInputForm/FieldInputs/IntegerInput.vue +49 -0
- package/src/components/ViewableDataInputForm/FieldInputs/MarkdownInput.vue +34 -0
- package/src/components/ViewableDataInputForm/FieldInputs/MediaDragDropUploader.vue +246 -0
- package/src/components/ViewableDataInputForm/FieldInputs/MidiInput.vue +113 -0
- package/src/components/ViewableDataInputForm/FieldInputs/NumberInput.vue +49 -0
- package/src/components/ViewableDataInputForm/FieldInputs/OptionsFieldInput.ts +161 -0
- package/src/components/ViewableDataInputForm/FieldInputs/StringInput.vue +49 -0
- package/src/components/ViewableDataInputForm/FieldInputs/typeValidators.ts +49 -0
- package/src/components/index.ts +21 -0
- package/src/index.ts +6 -0
- package/src/stores/useDataInputFormStore.ts +49 -0
- package/src/stores/useFieldInputStore.ts +191 -0
- package/src/vue-shims.d.ts +5 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@vue-skuilder/common-ui"),require("@vue-skuilder/common"),require("@vue-skuilder/db"),require("pinia")):"function"==typeof define&&define.amd?define(["exports","vue","@vue-skuilder/common-ui","@vue-skuilder/common","@vue-skuilder/db","pinia"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueSkuilderEditUI={},e.Vue,e.VueSkuilderCommonUI,e.VueSkuilderCommon,e.VueSkuilderDb,e.Pinia)}(this,(function(e,t,n,r,a,o){"use strict";var c=document.createElement("style");c.textContent=".ok[data-v-e86645b6]{box-shadow:2px 2px 2px #383}.warn[data-v-e86645b6]{box-shadow:2px 2px 2px #ff0}.error[data-v-e86645b6]{box-shadow:2px 2px 2px red}input[data-v-e86645b6]{margin:3px}.drop-zone[data-v-e86645b6]{border:2px dashed #ccc;border-radius:4px;padding:20px;text-align:center;transition:all .3s ease}.drop-zone--over[data-v-e86645b6]{border-color:#000;background-color:#0000001a}.thumbnail[data-v-e86645b6]{max-width:100px;max-height:100px;margin-right:10px}.media-item[data-v-e86645b6]{display:flex;align-items:center;margin-bottom:10px}.card-preview-list[data-v-41613480]{width:100%}.card-content[data-v-41613480]{min-height:150px;background-color:#f8f9fa}.markdown-content[data-v-41613480]{white-space:pre-wrap;word-break:break-word;line-height:1.5;font-family:var(--v-font-family)}.gap-1[data-v-41613480]{gap:4px}.lime-lighten-5[data-v-3689f51b]{background-color:#f9fbe7!important}.red-lighten-5[data-v-3689f51b]{background-color:#ffebee!important}pre[data-v-3689f51b]{white-space:pre-wrap;word-wrap:break-word;background-color:#f5f5f5;padding:10px;border-radius:4px;margin-top:5px}.force-dark-text[data-v-3689f51b]{color:#000000de!important}.force-dark-text .v-list-item-subtitle[data-v-3689f51b],.force-dark-text .v-list-item-title[data-v-3689f51b],.force-dark-text div[data-v-3689f51b],.force-dark-text summary[data-v-3689f51b]{color:#000000de!important}.card-preview-container[data-v-3689f51b]{border-radius:4px;max-width:100%}@media (min-width: 960px){.card-preview-container[data-v-3689f51b]{max-width:65%}}div[data-v-e17c0876]{margin-top:15px}\n/*$vite$:1*/",document.head.appendChild(c);var l=Object.defineProperty,u=(e,t,n)=>((e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function f(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var p,m={exports:{}};
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Lodash <https://lodash.com/>
|
|
5
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
6
|
+
* Released under MIT license <https://lodash.com/license>
|
|
7
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
8
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
9
|
+
*/var g,y,b=(p||(p=1,g=m,y=m.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",i=32,a=128,s=256,o=1/0,c=9007199254740991,l=NaN,u=4294967295,d=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",s]],f="[object Arguments]",p="[object Array]",m="[object Boolean]",v="[object Date]",b="[object Error]",_="[object Function]",w="[object GeneratorFunction]",x="[object Map]",k="[object Number]",C="[object Object]",S="[object Promise]",E="[object RegExp]",M="[object Set]",T="[object String]",N="[object Symbol]",A="[object WeakMap]",P="[object ArrayBuffer]",I="[object DataView]",D="[object Float32Array]",B="[object Float64Array]",O="[object Int8Array]",L="[object Int16Array]",V="[object Int32Array]",R="[object Uint8Array]",F="[object Uint8ClampedArray]",z="[object Uint16Array]",j="[object Uint32Array]",q=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,Y=RegExp(G.source),$=RegExp(W.source),K=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,be=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Ce="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ee="\\ufe0e\\ufe0f",Me="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Te="['’]",Ne="["+we+"]",Ae="["+Me+"]",Pe="["+xe+"]",Ie="\\d+",De="["+ke+"]",Be="["+Ce+"]",Oe="[^"+we+Me+Ie+ke+Ce+Se+"]",Le="\\ud83c[\\udffb-\\udfff]",Ve="[^"+we+"]",Re="(?:\\ud83c[\\udde6-\\uddff]){2}",Fe="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",je="\\u200d",qe="(?:"+Be+"|"+Oe+")",He="(?:"+ze+"|"+Oe+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",Ge="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Pe+"|"+Le+")?",Ye="["+Ee+"]?",$e=Ye+We+"(?:"+je+"(?:"+[Ve,Re,Fe].join("|")+")"+Ye+We+")*",Ke="(?:"+[De,Re,Fe].join("|")+")"+$e,Qe="(?:"+[Ve+Pe+"?",Pe,Re,Fe,Ne].join("|")+")",Xe=RegExp(Te,"g"),Ze=RegExp(Pe,"g"),Je=RegExp(Le+"(?="+Le+")|"+Qe+$e,"g"),et=RegExp([ze+"?"+Be+"+"+Ue+"(?="+[Ae,ze,"$"].join("|")+")",He+"+"+Ge+"(?="+[Ae,ze+qe,"$"].join("|")+")",ze+"?"+qe+"+"+Ue,ze+"+"+Ge,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,Ke].join("|"),"g"),tt=RegExp("["+je+we+xe+Ee+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],it=-1,at={};at[D]=at[B]=at[O]=at[L]=at[V]=at[R]=at[F]=at[z]=at[j]=!0,at[f]=at[p]=at[P]=at[m]=at[I]=at[v]=at[b]=at[_]=at[x]=at[k]=at[C]=at[E]=at[M]=at[T]=at[A]=!1;var st={};st[f]=st[p]=st[P]=st[I]=st[m]=st[v]=st[D]=st[B]=st[O]=st[L]=st[V]=st[x]=st[k]=st[C]=st[E]=st[M]=st[T]=st[N]=st[R]=st[F]=st[z]=st[j]=!0,st[b]=st[_]=st[A]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ct=parseFloat,lt=parseInt,ut="object"==typeof h&&h&&h.Object===Object&&h,ht="object"==typeof self&&self&&self.Object===Object&&self,dt=ut||ht||Function("return this")(),ft=y&&!y.nodeType&&y,pt=ft&&g&&!g.nodeType&&g,mt=pt&&pt.exports===ft,gt=mt&&ut.process,vt=function(){try{var e=pt&&pt.require&&pt.require("util").types;return e||gt&>.binding&>.binding("util")}catch(t){}}(),yt=vt&&vt.isArrayBuffer,bt=vt&&vt.isDate,_t=vt&&vt.isMap,wt=vt&&vt.isRegExp,xt=vt&&vt.isSet,kt=vt&&vt.isTypedArray;function Ct(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var s=e[i];t(r,s,n(s),e)}return r}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Mt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Tt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[i++]=s)}return a}function At(e,t){return!(null==e||!e.length)&&zt(e,t,0)>-1}function Pt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function It(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Dt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Bt(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Ot(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Vt=Ut("length");function Rt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function Ft(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function zt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Ft(e,qt,n)}function jt(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function qt(e){return e!=e}function Ht(e,t){var n=null==e?0:e.length;return n?Yt(e,t)/n:l}function Ut(t){return function(n){return null==n?e:n[t]}}function Gt(t){return function(n){return null==t?e:t[n]}}function Wt(e,t,n,r,i){return i(e,(function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)})),n}function Yt(t,n){for(var r,i=-1,a=t.length;++i<a;){var s=n(t[i]);s!==e&&(r=r===e?s:r+s)}return r}function $t(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Kt(e){return e?e.slice(0,dn(e)+1).replace(re,""):e}function Qt(e){return function(t){return e(t)}}function Xt(e,t){return It(t,(function(t){return e[t]}))}function Zt(e,t){return e.has(t)}function Jt(e,t){for(var n=-1,r=e.length;++n<r&&zt(t,e[n],0)>-1;);return n}function en(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var tn=Gt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=Gt({"&":"&","<":"<",">":">",'"':""","'":"'"});function rn(e){return"\\"+ot[e]}function an(e){return tt.test(e)}function sn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function on(e,t){return function(n){return e(t(n))}}function cn(e,t){for(var n=-1,i=e.length,a=0,s=[];++n<i;){var o=e[n];o!==t&&o!==r||(e[n]=r,s[a++]=n)}return s}function ln(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function un(e){return an(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):Vt(e)}function hn(e){return an(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var fn=Gt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),pn=function h(g){var y,ie=(g=null==g?dt:pn.defaults(dt.Object(),g,pn.pick(dt,rt))).Array,we=g.Date,xe=g.Error,ke=g.Function,Ce=g.Math,Se=g.Object,Ee=g.RegExp,Me=g.String,Te=g.TypeError,Ne=ie.prototype,Ae=ke.prototype,Pe=Se.prototype,Ie=g["__core-js_shared__"],De=Ae.toString,Be=Pe.hasOwnProperty,Oe=0,Le=(y=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+y:"",Ve=Pe.toString,Re=De.call(Se),Fe=dt._,ze=Ee("^"+De.call(Be).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=mt?g.Buffer:e,qe=g.Symbol,He=g.Uint8Array,Ue=je?je.allocUnsafe:e,Ge=on(Se.getPrototypeOf,Se),We=Se.create,Ye=Pe.propertyIsEnumerable,$e=Ne.splice,Ke=qe?qe.isConcatSpreadable:e,Qe=qe?qe.iterator:e,Je=qe?qe.toStringTag:e,tt=function(){try{var e=la(Se,"defineProperty");return e({},"",{}),e}catch(t){}}(),ot=g.clearTimeout!==dt.clearTimeout&&g.clearTimeout,ut=we&&we.now!==dt.Date.now&&we.now,ht=g.setTimeout!==dt.setTimeout&&g.setTimeout,ft=Ce.ceil,pt=Ce.floor,gt=Se.getOwnPropertySymbols,vt=je?je.isBuffer:e,Vt=g.isFinite,Gt=Ne.join,mn=on(Se.keys,Se),gn=Ce.max,vn=Ce.min,yn=we.now,bn=g.parseInt,_n=Ce.random,wn=Ne.reverse,xn=la(g,"DataView"),kn=la(g,"Map"),Cn=la(g,"Promise"),Sn=la(g,"Set"),En=la(g,"WeakMap"),Mn=la(Se,"create"),Tn=En&&new En,Nn={},An=Ra(xn),Pn=Ra(kn),In=Ra(Cn),Dn=Ra(Sn),Bn=Ra(En),On=qe?qe.prototype:e,Ln=On?On.valueOf:e,Vn=On?On.toString:e;function Rn(e){if(to(e)&&!Us(e)&&!(e instanceof qn)){if(e instanceof jn)return e;if(Be.call(e,"__wrapped__"))return Fa(e)}return new jn(e)}var Fn=function(){function t(){}return function(n){if(!eo(n))return{};if(We)return We(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function zn(){}function jn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function qn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=u,this.__views__=[]}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Gn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Un(e);this.size=t.size}function $n(e,t){var n=Us(e),r=!n&&Hs(e),i=!n&&!r&&$s(e),a=!n&&!r&&!i&&lo(e),s=n||r||i||a,o=s?$t(e.length,Me):[],c=o.length;for(var l in e)!t&&!Be.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ga(l,c))||o.push(l);return o}function Kn(t){var n=t.length;return n?t[Wr(0,n-1)]:e}function Qn(e,t){return Ia(Mi(e),ar(t,0,e.length))}function Xn(e){return Ia(Mi(e))}function Zn(t,n,r){(r!==e&&!zs(t[n],r)||r===e&&!(n in t))&&rr(t,n,r)}function Jn(t,n,r){var i=t[n];Be.call(t,n)&&zs(i,r)&&(r!==e||n in t)||rr(t,n,r)}function er(e,t){for(var n=e.length;n--;)if(zs(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,(function(e,i,a){t(r,e,n(e),a)})),r}function nr(e,t){return e&&Ti(t,Io(t),e)}function rr(e,t,n){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(t,n){for(var r=-1,i=n.length,a=ie(i),s=null==t;++r<i;)a[r]=s?e:Mo(t,n[r]);return a}function ar(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function sr(t,n,r,i,a,s){var o,c=1&n,l=2&n,u=4&n;if(r&&(o=a?r(t,i,a,s):r(t)),o!==e)return o;if(!eo(t))return t;var h=Us(t);if(h){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!c)return Mi(t,o)}else{var d=da(t),p=d==_||d==w;if($s(t))return wi(t,c);if(d==C||d==f||p&&!a){if(o=l||p?{}:pa(t),!c)return l?function(e,t){return Ti(e,ha(e),t)}(t,function(e,t){return e&&Ti(t,Do(t),e)}(o,t)):function(e,t){return Ti(e,ua(e),t)}(t,nr(o,t))}else{if(!st[d])return a?t:{};o=function(e,t,n){var r,i=e.constructor;switch(t){case P:return xi(e);case m:case v:return new i(+e);case I:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case D:case B:case O:case L:case V:case R:case F:case z:case j:return ki(e,n);case x:return new i;case k:case T:return new i(e);case E:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return new i;case N:return r=e,Ln?Se(Ln.call(r)):{}}}(t,d,c)}}s||(s=new Yn);var g=s.get(t);if(g)return g;s.set(t,o),so(t)?t.forEach((function(e){o.add(sr(e,n,r,e,t,s))})):no(t)&&t.forEach((function(e,i){o.set(i,sr(e,n,r,i,t,s))}));var y=h?e:(u?l?na:ta:l?Do:Io)(t);return Et(y||t,(function(e,i){y&&(e=t[i=e]),Jn(o,i,sr(e,n,r,i,t,s))})),o}function or(t,n,r){var i=r.length;if(null==t)return!i;for(t=Se(t);i--;){var a=r[i],s=n[a],o=t[a];if(o===e&&!(a in t)||!s(o))return!1}return!0}function cr(n,r,i){if("function"!=typeof n)throw new Te(t);return Ta((function(){n.apply(e,i)}),r)}function lr(e,t,n,r){var i=-1,a=At,s=!0,o=e.length,c=[],l=t.length;if(!o)return c;n&&(t=It(t,Qt(n))),r?(a=Pt,s=!1):t.length>=200&&(a=Zt,s=!1,t=new Wn(t));e:for(;++i<o;){var u=e[i],h=null==n?u:n(u);if(u=r||0!==u?u:0,s&&h==h){for(var d=l;d--;)if(t[d]===h)continue e;c.push(u)}else a(t,h,r)||c.push(u)}return c}Rn.templateSettings={escape:K,evaluate:Q,interpolate:X,variable:"",imports:{_:Rn}},Rn.prototype=zn.prototype,Rn.prototype.constructor=Rn,jn.prototype=Fn(zn.prototype),jn.prototype.constructor=jn,qn.prototype=Fn(zn.prototype),qn.prototype.constructor=qn,Hn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Hn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hn.prototype.get=function(t){var r=this.__data__;if(Mn){var i=r[t];return i===n?e:i}return Be.call(r,t)?r[t]:e},Hn.prototype.has=function(t){var n=this.__data__;return Mn?n[t]!==e:Be.call(n,t)},Hn.prototype.set=function(t,r){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Mn&&r===e?n:r,this},Un.prototype.clear=function(){this.__data__=[],this.size=0},Un.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():$e.call(t,n,1),--this.size,0))},Un.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},Un.prototype.has=function(e){return er(this.__data__,e)>-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new Hn,map:new(kn||Un),string:new Hn}},Gn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Gn.prototype.get=function(e){return oa(this,e).get(e)},Gn.prototype.has=function(e){return oa(this,e).has(e)},Gn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,n),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Un,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!kn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gn(r)}return n.set(e,t),this.size=n.size,this};var ur=Pi(yr),hr=Pi(br,!0);function dr(e,t){var n=!0;return ur(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function fr(t,n,r){for(var i=-1,a=t.length;++i<a;){var s=t[i],o=n(s);if(null!=o&&(c===e?o==o&&!co(o):r(o,c)))var c=o,l=s}return l}function pr(e,t){var n=[];return ur(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function mr(e,t,n,r,i){var a=-1,s=e.length;for(n||(n=ma),i||(i=[]);++a<s;){var o=e[a];t>0&&n(o)?t>1?mr(o,t-1,n,r,i):Dt(i,o):r||(i[i.length]=o)}return i}var gr=Ii(),vr=Ii(!0);function yr(e,t){return e&&gr(e,t,Io)}function br(e,t){return e&&vr(e,t,Io)}function _r(e,t){return Nt(t,(function(t){return Xs(e[t])}))}function wr(t,n){for(var r=0,i=(n=vi(n,t)).length;null!=t&&r<i;)t=t[Va(n[r++])];return r&&r==i?t:e}function xr(e,t,n){var r=t(e);return Us(e)?r:Dt(r,n(e))}function kr(t){return null==t?t===e?"[object Undefined]":"[object Null]":Je&&Je in Se(t)?function(t){var n=Be.call(t,Je),r=t[Je];try{t[Je]=e;var i=!0}catch(s){}var a=Ve.call(t);return i&&(n?t[Je]=r:delete t[Je]),a}(t):function(e){return Ve.call(e)}(t)}function Cr(e,t){return e>t}function Sr(e,t){return null!=e&&Be.call(e,t)}function Er(e,t){return null!=e&&t in Se(e)}function Mr(t,n,r){for(var i=r?Pt:At,a=t[0].length,s=t.length,o=s,c=ie(s),l=1/0,u=[];o--;){var h=t[o];o&&n&&(h=It(h,Qt(n))),l=vn(h.length,l),c[o]=!r&&(n||a>=120&&h.length>=120)?new Wn(o&&h):e}h=t[0];var d=-1,f=c[0];e:for(;++d<a&&u.length<l;){var p=h[d],m=n?n(p):p;if(p=r||0!==p?p:0,!(f?Zt(f,m):i(u,m,r))){for(o=s;--o;){var g=c[o];if(!(g?Zt(g,m):i(t[o],m,r)))continue e}f&&f.push(m),u.push(p)}}return u}function Tr(t,n,r){var i=null==(t=Sa(t,n=vi(n,t)))?t:t[Va(Qa(n))];return null==i?e:Ct(i,t,r)}function Nr(e){return to(e)&&kr(e)==f}function Ar(t,n,r,i,a){return t===n||(null==t||null==n||!to(t)&&!to(n)?t!=t&&n!=n:function(t,n,r,i,a,s){var o=Us(t),c=Us(n),l=o?p:da(t),u=c?p:da(n),h=(l=l==f?C:l)==C,d=(u=u==f?C:u)==C,g=l==u;if(g&&$s(t)){if(!$s(n))return!1;o=!0,h=!1}if(g&&!h)return s||(s=new Yn),o||lo(t)?Ji(t,n,r,i,a,s):function(e,t,n,r,i,a,s){switch(n){case I:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case P:return!(e.byteLength!=t.byteLength||!a(new He(e),new He(t)));case m:case v:case k:return zs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case E:case T:return e==t+"";case x:var o=sn;case M:var c=1&r;if(o||(o=ln),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var u=Ji(o(e),o(t),r,i,a,s);return s.delete(e),u;case N:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(t,n,l,r,i,a,s);if(!(1&r)){var y=h&&Be.call(t,"__wrapped__"),_=d&&Be.call(n,"__wrapped__");if(y||_){var w=y?t.value():t,S=_?n.value():n;return s||(s=new Yn),a(w,S,r,i,s)}}return!!g&&(s||(s=new Yn),function(t,n,r,i,a,s){var o=1&r,c=ta(t),l=c.length,u=ta(n),h=u.length;if(l!=h&&!o)return!1;for(var d=l;d--;){var f=c[d];if(!(o?f in n:Be.call(n,f)))return!1}var p=s.get(t),m=s.get(n);if(p&&m)return p==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var v=o;++d<l;){var y=t[f=c[d]],b=n[f];if(i)var _=o?i(b,y,f,n,t,s):i(y,b,f,t,n,s);if(!(_===e?y===b||a(y,b,r,i,s):_)){g=!1;break}v||(v="constructor"==f)}if(g&&!v){var w=t.constructor,x=n.constructor;w==x||!("constructor"in t)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(t),s.delete(n),g}(t,n,r,i,a,s))}(t,n,r,i,Ar,a))}function Pr(t,n,r,i){var a=r.length,s=a,o=!i;if(null==t)return!s;for(t=Se(t);a--;){var c=r[a];if(o&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var l=(c=r[a])[0],u=t[l],h=c[1];if(o&&c[2]){if(u===e&&!(l in t))return!1}else{var d=new Yn;if(i)var f=i(u,h,l,t,n,d);if(!(f===e?Ar(h,u,3,i,d):f))return!1}}return!0}function Ir(e){return!(!eo(e)||(t=e,Le&&Le in t))&&(Xs(e)?ze:me).test(Ra(e));var t}function Dr(e){return"function"==typeof e?e:null==e?ic:"object"==typeof e?Us(e)?Fr(e[0],e[1]):Rr(e):fc(e)}function Br(e){if(!wa(e))return mn(e);var t=[];for(var n in Se(e))Be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Or(e){if(!eo(e))return function(e){var t=[];if(null!=e)for(var n in Se(e))t.push(n);return t}(e);var t=wa(e),n=[];for(var r in e)("constructor"!=r||!t&&Be.call(e,r))&&n.push(r);return n}function Lr(e,t){return e<t}function Vr(e,t){var n=-1,r=Ws(e)?ie(e.length):[];return ur(e,(function(e,i,a){r[++n]=t(e,i,a)})),r}function Rr(e){var t=ca(e);return 1==t.length&&t[0][2]?ka(t[0][0],t[0][1]):function(n){return n===e||Pr(n,e,t)}}function Fr(t,n){return ya(t)&&xa(n)?ka(Va(t),n):function(r){var i=Mo(r,t);return i===e&&i===n?To(r,t):Ar(n,i,3)}}function zr(t,n,r,i,a){t!==n&&gr(n,(function(s,o){if(a||(a=new Yn),eo(s))!function(t,n,r,i,a,s,o){var c=Ea(t,r),l=Ea(n,r),u=o.get(l);if(u)Zn(t,r,u);else{var h=s?s(c,l,r+"",t,n,o):e,d=h===e;if(d){var f=Us(l),p=!f&&$s(l),m=!f&&!p&&lo(l);h=l,f||p||m?Us(c)?h=c:Ys(c)?h=Mi(c):p?(d=!1,h=wi(l,!0)):m?(d=!1,h=ki(l,!0)):h=[]:io(l)||Hs(l)?(h=c,Hs(c)?h=yo(c):eo(c)&&!Xs(c)||(h=pa(l))):d=!1}d&&(o.set(l,h),a(h,l,i,s,o),o.delete(l)),Zn(t,r,h)}}(t,n,o,r,zr,i,a);else{var c=i?i(Ea(t,o),s,o+"",t,n,a):e;c===e&&(c=s),Zn(t,o,c)}}),Do)}function jr(t,n){var r=t.length;if(r)return ga(n+=n<0?r:0,r)?t[n]:e}function qr(e,t,n){t=t.length?It(t,(function(e){return Us(e)?function(t){return wr(t,1===e.length?e[0]:e)}:e})):[ic];var r=-1;return t=It(t,Qt(sa())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Vr(e,(function(e,n,i){return{criteria:It(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,s=i.length,o=n.length;++r<s;){var c=Ci(i[r],a[r]);if(c)return r>=o?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Hr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var s=t[r],o=wr(e,s);n(o,s)&&Xr(a,vi(s,e),o)}return a}function Ur(e,t,n,r){var i=r?jt:zt,a=-1,s=t.length,o=e;for(e===t&&(t=Mi(t)),n&&(o=It(e,Qt(n)));++a<s;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(o,u,c,r))>-1;)o!==e&&$e.call(o,c,1),$e.call(e,c,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ga(i)?$e.call(e,i,1):li(e,i)}}return e}function Wr(e,t){return e+pt(_n()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=pt(t/2))&&(e+=e)}while(t);return n}function $r(e,t){return Na(Ca(e,t,ic),e+"")}function Kr(e){return Kn(jo(e))}function Qr(e,t){var n=jo(e);return Ia(n,ar(t,0,n.length))}function Xr(t,n,r,i){if(!eo(t))return t;for(var a=-1,s=(n=vi(n,t)).length,o=s-1,c=t;null!=c&&++a<s;){var l=Va(n[a]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(a!=o){var h=c[l];(u=i?i(h,l,c):e)===e&&(u=eo(h)?h:ga(n[a+1])?[]:{})}Jn(c,l,u),c=c[l]}return t}var Zr=Tn?function(e,t){return Tn.set(e,t),e}:ic,Jr=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:ic;function ei(e){return Ia(jo(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=ie(i);++r<i;)a[r]=e[r+t];return a}function ni(e,t){var n;return ur(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,s=e[a];null!==s&&!co(s)&&(n?s<=t:s<t)?r=a+1:i=a}return i}return ii(e,t,ic,n)}function ii(t,n,r,i){var a=0,s=null==t?0:t.length;if(0===s)return 0;for(var o=(n=r(n))!=n,c=null===n,l=co(n),u=n===e;a<s;){var h=pt((a+s)/2),d=r(t[h]),f=d!==e,p=null===d,m=d==d,g=co(d);if(o)var v=i||m;else v=u?m&&(i||f):c?m&&f&&(i||!p):l?m&&f&&!p&&(i||!g):!p&&!g&&(i?d<=n:d<n);v?a=h+1:s=h}return vn(s,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n],o=t?t(s):s;if(!n||!zs(o,c)){var c=o;a[i++]=0===s?0:s}}return a}function si(e){return"number"==typeof e?e:co(e)?l:+e}function oi(e){if("string"==typeof e)return e;if(Us(e))return It(e,oi)+"";if(co(e))return Vn?Vn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=At,a=e.length,s=!0,o=[],c=o;if(n)s=!1,i=Pt;else if(a>=200){var l=t?null:Yi(e);if(l)return ln(l);s=!1,i=Zt,c=new Wn}else c=t?[]:o;e:for(;++r<a;){var u=e[r],h=t?t(u):u;if(u=n||0!==u?u:0,s&&h==h){for(var d=c.length;d--;)if(c[d]===h)continue e;t&&c.push(h),o.push(u)}else i(c,h,n)||(c!==o&&c.push(h),o.push(u))}return o}function li(e,t){return null==(e=Sa(e,t=vi(t,e)))||delete e[Va(Qa(t))]}function ui(e,t,n,r){return Xr(e,t,n(wr(e,t)),r)}function hi(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?ti(e,r?0:a,r?a+1:i):ti(e,r?a+1:0,r?i:a)}function di(e,t){var n=e;return n instanceof qn&&(n=n.value()),Bt(t,(function(e,t){return t.func.apply(t.thisArg,Dt([e],t.args))}),n)}function fi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,a=ie(r);++i<r;)for(var s=e[i],o=-1;++o<r;)o!=i&&(a[i]=lr(a[i]||s,e[o],t,n));return ci(mr(a,1),t,n)}function pi(t,n,r){for(var i=-1,a=t.length,s=n.length,o={};++i<a;){var c=i<s?n[i]:e;r(o,t[i],c)}return o}function mi(e){return Ys(e)?e:[]}function gi(e){return"function"==typeof e?e:ic}function vi(e,t){return Us(e)?e:ya(e,t)?[e]:La(bo(e))}var yi=$r;function bi(t,n,r){var i=t.length;return r=r===e?i:r,!n&&r>=i?t:ti(t,n,r)}var _i=ot||function(e){return dt.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function ki(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ci(t,n){if(t!==n){var r=t!==e,i=null===t,a=t==t,s=co(t),o=n!==e,c=null===n,l=n==n,u=co(n);if(!c&&!u&&!s&&t>n||s&&o&&l&&!c&&!u||i&&o&&l||!r&&l||!a)return 1;if(!i&&!s&&!u&&t<n||u&&r&&a&&!i&&!s||c&&r&&a||!o&&a||!l)return-1}return 0}function Si(e,t,n,r){for(var i=-1,a=e.length,s=n.length,o=-1,c=t.length,l=gn(a-s,0),u=ie(c+l),h=!r;++o<c;)u[o]=t[o];for(;++i<s;)(h||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[o++]=e[i++];return u}function Ei(e,t,n,r){for(var i=-1,a=e.length,s=-1,o=n.length,c=-1,l=t.length,u=gn(a-o,0),h=ie(u+l),d=!r;++i<u;)h[i]=e[i];for(var f=i;++c<l;)h[f+c]=t[c];for(;++s<o;)(d||i<a)&&(h[f+n[s]]=e[i++]);return h}function Mi(e,t){var n=-1,r=e.length;for(t||(t=ie(r));++n<r;)t[n]=e[n];return t}function Ti(t,n,r,i){var a=!r;r||(r={});for(var s=-1,o=n.length;++s<o;){var c=n[s],l=i?i(r[c],t[c],c,r,t):e;l===e&&(l=t[c]),a?rr(r,c,l):Jn(r,c,l)}return r}function Ni(e,t){return function(n,r){var i=Us(n)?St:tr,a=t?t():{};return i(n,e,sa(r,2),a)}}function Ai(t){return $r((function(n,r){var i=-1,a=r.length,s=a>1?r[a-1]:e,o=a>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(a--,s):e,o&&va(r[0],r[1],o)&&(s=a<3?e:s,a=1),n=Se(n);++i<a;){var c=r[i];c&&t(n,c,i,s)}return n}))}function Pi(e,t){return function(n,r){if(null==n)return n;if(!Ws(n))return e(n,r);for(var i=n.length,a=t?i:-1,s=Se(n);(t?a--:++a<i)&&!1!==r(s[a],a,s););return n}}function Ii(e){return function(t,n,r){for(var i=-1,a=Se(t),s=r(t),o=s.length;o--;){var c=s[e?o:++i];if(!1===n(a[c],c,a))break}return t}}function Di(t){return function(n){var r=an(n=bo(n))?hn(n):e,i=r?r[0]:n.charAt(0),a=r?bi(r,1).join(""):n.slice(1);return i[t]()+a}}function Bi(e){return function(t){return Bt(Zo(Uo(t).replace(Xe,"")),e,"")}}function Oi(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Fn(e.prototype),r=e.apply(n,t);return eo(r)?r:n}}function Li(t){return function(n,r,i){var a=Se(n);if(!Ws(n)){var s=sa(r,3);n=Io(n),r=function(e){return s(a[e],e,a)}}var o=t(n,r,i);return o>-1?a[s?n[o]:o]:e}}function Vi(n){return ea((function(r){var i=r.length,a=i,s=jn.prototype.thru;for(n&&r.reverse();a--;){var o=r[a];if("function"!=typeof o)throw new Te(t);if(s&&!c&&"wrapper"==ia(o))var c=new jn([],!0)}for(a=c?a:i;++a<i;){var l=ia(o=r[a]),u="wrapper"==l?ra(o):e;c=u&&ba(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ia(u[0])].apply(c,u[3]):1==o.length&&ba(o)?c[l]():c.thru(o)}return function(){var e=arguments,t=e[0];if(c&&1==e.length&&Us(t))return c.plant(t).value();for(var n=0,a=i?r[n].apply(this,e):t;++n<i;)a=r[n].call(this,a);return a}}))}function Ri(t,n,r,i,s,o,c,l,u,h){var d=n&a,f=1&n,p=2&n,m=24&n,g=512&n,v=p?e:Oi(t);return function a(){for(var y=arguments.length,b=ie(y),_=y;_--;)b[_]=arguments[_];if(m)var w=aa(a),x=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,w);if(i&&(b=Si(b,i,s,m)),o&&(b=Ei(b,o,c,m)),y-=x,m&&y<h){var k=cn(b,w);return Gi(t,n,Ri,a.placeholder,r,b,k,l,u,h-y)}var C=f?r:this,S=p?C[t]:t;return y=b.length,l?b=function(t,n){for(var r=t.length,i=vn(n.length,r),a=Mi(t);i--;){var s=n[i];t[i]=ga(s,r)?a[s]:e}return t}(b,l):g&&y>1&&b.reverse(),d&&u<y&&(b.length=u),this&&this!==dt&&this instanceof a&&(S=v||Oi(S)),S.apply(C,b)}}function Fi(e,t){return function(n,r){return function(e,t,n,r){return yr(e,(function(e,i,a){t(r,n(e),i,a)})),r}(n,e,t(r),{})}}function zi(t,n){return function(r,i){var a;if(r===e&&i===e)return n;if(r!==e&&(a=r),i!==e){if(a===e)return i;"string"==typeof r||"string"==typeof i?(r=oi(r),i=oi(i)):(r=si(r),i=si(i)),a=t(r,i)}return a}}function ji(e){return ea((function(t){return t=It(t,Qt(sa())),$r((function(n){var r=this;return e(t,(function(e){return Ct(e,r,n)}))}))}))}function qi(t,n){var r=(n=n===e?" ":oi(n)).length;if(r<2)return r?Yr(n,t):n;var i=Yr(n,ft(t/un(n)));return an(n)?bi(hn(i),0,t).join(""):i.slice(0,t)}function Hi(t){return function(n,r,i){return i&&"number"!=typeof i&&va(n,r,i)&&(r=i=e),n=po(n),r===e?(r=n,n=0):r=po(r),function(e,t,n,r){for(var i=-1,a=gn(ft((t-e)/(n||1)),0),s=ie(a);a--;)s[r?a:++i]=e,e+=n;return s}(n,r,i=i===e?n<r?1:-1:po(i),t)}}function Ui(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=vo(t),n=vo(n)),e(t,n)}}function Gi(t,n,r,a,s,o,c,l,u,h){var d=8&n;n|=d?i:64,4&(n&=~(d?64:i))||(n&=-4);var f=[t,n,s,d?o:e,d?c:e,d?e:o,d?e:c,l,u,h],p=r.apply(e,f);return ba(t)&&Ma(p,f),p.placeholder=a,Aa(p,t,n)}function Wi(e){var t=Ce[e];return function(e,n){if(e=vo(e),(n=null==n?0:vn(mo(n),292))&&Vt(e)){var r=(bo(e)+"e").split("e");return+((r=(bo(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yi=Sn&&1/ln(new Sn([,-0]))[1]==o?function(e){return new Sn(e)}:lc;function $i(e){return function(t){var n=da(t);return n==x?sn(t):n==M?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return It(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ki(n,o,c,l,u,h,d,f){var p=2&o;if(!p&&"function"!=typeof n)throw new Te(t);var m=l?l.length:0;if(m||(o&=-97,l=u=e),d=d===e?d:gn(mo(d),0),f=f===e?f:mo(f),m-=u?u.length:0,64&o){var g=l,v=u;l=u=e}var y=p?e:ra(n),b=[n,o,c,l,u,g,v,h,d,f];if(y&&function(e,t){var n=e[1],i=t[1],o=n|i,c=o<131,l=i==a&&8==n||i==a&&n==s&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n;if(!c&&!l)return e;1&i&&(e[2]=t[2],o|=1&n?0:4);var u=t[3];if(u){var h=e[3];e[3]=h?Si(h,u,t[4]):u,e[4]=h?cn(e[3],r):t[4]}(u=t[5])&&(h=e[5],e[5]=h?Ei(h,u,t[6]):u,e[6]=h?cn(e[5],r):t[6]),(u=t[7])&&(e[7]=u),i&a&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(b,y),n=b[0],o=b[1],c=b[2],l=b[3],u=b[4],!(f=b[9]=b[9]===e?p?0:n.length:gn(b[9]-m,0))&&24&o&&(o&=-25),o&&1!=o)_=8==o||16==o?function(t,n,r){var i=Oi(t);return function a(){for(var s=arguments.length,o=ie(s),c=s,l=aa(a);c--;)o[c]=arguments[c];var u=s<3&&o[0]!==l&&o[s-1]!==l?[]:cn(o,l);return(s-=u.length)<r?Gi(t,n,Ri,a.placeholder,e,o,u,e,e,r-s):Ct(this&&this!==dt&&this instanceof a?i:t,this,o)}}(n,o,f):o!=i&&33!=o||u.length?Ri.apply(e,b):function(e,t,n,r){var i=1&t,a=Oi(e);return function t(){for(var s=-1,o=arguments.length,c=-1,l=r.length,u=ie(l+o),h=this&&this!==dt&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;o--;)u[c++]=arguments[++s];return Ct(h,i?n:this,u)}}(n,o,c,l);else var _=function(e,t,n){var r=1&t,i=Oi(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(n,o,c);return Aa((y?Zr:Ma)(_,b),n,o)}function Qi(t,n,r,i){return t===e||zs(t,Pe[r])&&!Be.call(i,r)?n:t}function Xi(t,n,r,i,a,s){return eo(t)&&eo(n)&&(s.set(n,t),zr(t,n,e,Xi,s),s.delete(n)),t}function Zi(t){return io(t)?e:t}function Ji(t,n,r,i,a,s){var o=1&r,c=t.length,l=n.length;if(c!=l&&!(o&&l>c))return!1;var u=s.get(t),h=s.get(n);if(u&&h)return u==n&&h==t;var d=-1,f=!0,p=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++d<c;){var m=t[d],g=n[d];if(i)var v=o?i(g,m,d,n,t,s):i(m,g,d,t,n,s);if(v!==e){if(v)continue;f=!1;break}if(p){if(!Lt(n,(function(e,t){if(!Zt(p,t)&&(m===e||a(m,e,r,i,s)))return p.push(t)}))){f=!1;break}}else if(m!==g&&!a(m,g,r,i,s)){f=!1;break}}return s.delete(t),s.delete(n),f}function ea(t){return Na(Ca(t,e,Ga),t+"")}function ta(e){return xr(e,Io,ua)}function na(e){return xr(e,Do,ha)}var ra=Tn?function(e){return Tn.get(e)}:lc;function ia(e){for(var t=e.name+"",n=Nn[t],r=Be.call(Nn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function aa(e){return(Be.call(Rn,"placeholder")?Rn:e).placeholder}function sa(){var e=Rn.iteratee||ac;return e=e===ac?Dr:e,arguments.length?e(arguments[0],arguments[1]):e}function oa(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function ca(e){for(var t=Io(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,xa(i)]}return t}function la(t,n){var r=function(t,n){return null==t?e:t[n]}(t,n);return Ir(r)?r:e}var ua=gt?function(e){return null==e?[]:(e=Se(e),Nt(gt(e),(function(t){return Ye.call(e,t)})))}:gc,ha=gt?function(e){for(var t=[];e;)Dt(t,ua(e)),e=Ge(e);return t}:gc,da=kr;function fa(e,t,n){for(var r=-1,i=(t=vi(t,e)).length,a=!1;++r<i;){var s=Va(t[r]);if(!(a=null!=e&&n(e,s)))break;e=e[s]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&Js(i)&&ga(s,i)&&(Us(e)||Hs(e))}function pa(e){return"function"!=typeof e.constructor||wa(e)?{}:Fn(Ge(e))}function ma(e){return Us(e)||Hs(e)||!!(Ke&&e&&e[Ke])}function ga(e,t){var n=typeof e;return!!(t=null==t?c:t)&&("number"==n||"symbol"!=n&&ve.test(e))&&e>-1&&e%1==0&&e<t}function va(e,t,n){if(!eo(n))return!1;var r=typeof t;return!!("number"==r?Ws(n)&&ga(t,n.length):"string"==r&&t in n)&&zs(n[t],e)}function ya(e,t){if(Us(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!co(e))||J.test(e)||!Z.test(e)||null!=t&&e in Se(t)}function ba(e){var t=ia(e),n=Rn[t];if("function"!=typeof n||!(t in qn.prototype))return!1;if(e===n)return!0;var r=ra(n);return!!r&&e===r[0]}(xn&&da(new xn(new ArrayBuffer(1)))!=I||kn&&da(new kn)!=x||Cn&&da(Cn.resolve())!=S||Sn&&da(new Sn)!=M||En&&da(new En)!=A)&&(da=function(t){var n=kr(t),r=n==C?t.constructor:e,i=r?Ra(r):"";if(i)switch(i){case An:return I;case Pn:return x;case In:return S;case Dn:return M;case Bn:return A}return n});var _a=Ie?Xs:vc;function wa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pe)}function xa(e){return e==e&&!eo(e)}function ka(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in Se(r))}}function Ca(t,n,r){return n=gn(n===e?t.length-1:n,0),function(){for(var e=arguments,i=-1,a=gn(e.length-n,0),s=ie(a);++i<a;)s[i]=e[n+i];i=-1;for(var o=ie(n+1);++i<n;)o[i]=e[i];return o[n]=r(s),Ct(t,this,o)}}function Sa(e,t){return t.length<2?e:wr(e,ti(t,0,-1))}function Ea(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ma=Pa(Zr),Ta=ht||function(e,t){return dt.setTimeout(e,t)},Na=Pa(Jr);function Aa(e,t,n){var r=t+"";return Na(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Et(d,(function(n){var r="_."+n[0];t&n[1]&&!At(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(oe):[]}(r),n)))}function Pa(t){var n=0,r=0;return function(){var i=yn(),a=16-(i-r);if(r=i,a>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Ia(t,n){var r=-1,i=t.length,a=i-1;for(n=n===e?i:n;++r<n;){var s=Wr(r,a),o=t[s];t[s]=t[r],t[r]=o}return t.length=n,t}var Da,Ba,Oa,La=(Da=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,n,r,i){t.push(r?i.replace(ue,"$1"):n||e)})),t},Ba=Bs(Da,(function(e){return 500===Oa.size&&Oa.clear(),e})),Oa=Ba.cache,Ba);function Va(e){if("string"==typeof e||co(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ra(e){if(null!=e){try{return De.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Fa(e){if(e instanceof qn)return e.clone();var t=new jn(e.__wrapped__,e.__chain__);return t.__actions__=Mi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var za=$r((function(e,t){return Ys(e)?lr(e,mr(t,1,Ys,!0)):[]})),ja=$r((function(t,n){var r=Qa(n);return Ys(r)&&(r=e),Ys(t)?lr(t,mr(n,1,Ys,!0),sa(r,2)):[]})),qa=$r((function(t,n){var r=Qa(n);return Ys(r)&&(r=e),Ys(t)?lr(t,mr(n,1,Ys,!0),e,r):[]}));function Ha(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:mo(n);return i<0&&(i=gn(r+i,0)),Ft(e,sa(t,3),i)}function Ua(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var a=i-1;return r!==e&&(a=mo(r),a=r<0?gn(i+a,0):vn(a,i-1)),Ft(t,sa(n,3),a,!0)}function Ga(e){return null!=e&&e.length?mr(e,1):[]}function Wa(t){return t&&t.length?t[0]:e}var Ya=$r((function(e){var t=It(e,mi);return t.length&&t[0]===e[0]?Mr(t):[]})),$a=$r((function(t){var n=Qa(t),r=It(t,mi);return n===Qa(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Mr(r,sa(n,2)):[]})),Ka=$r((function(t){var n=Qa(t),r=It(t,mi);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Mr(r,e,n):[]}));function Qa(t){var n=null==t?0:t.length;return n?t[n-1]:e}var Xa=$r(Za);function Za(e,t){return e&&e.length&&t&&t.length?Ur(e,t):e}var Ja=ea((function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Gr(e,It(t,(function(e){return ga(e,n)?+e:e})).sort(Ci)),r}));function es(e){return null==e?e:wn.call(e)}var ts=$r((function(e){return ci(mr(e,1,Ys,!0))})),ns=$r((function(t){var n=Qa(t);return Ys(n)&&(n=e),ci(mr(t,1,Ys,!0),sa(n,2))})),rs=$r((function(t){var n=Qa(t);return n="function"==typeof n?n:e,ci(mr(t,1,Ys,!0),e,n)}));function is(e){if(!e||!e.length)return[];var t=0;return e=Nt(e,(function(e){if(Ys(e))return t=gn(e.length,t),!0})),$t(t,(function(t){return It(e,Ut(t))}))}function as(t,n){if(!t||!t.length)return[];var r=is(t);return null==n?r:It(r,(function(t){return Ct(n,e,t)}))}var ss=$r((function(e,t){return Ys(e)?lr(e,t):[]})),os=$r((function(e){return fi(Nt(e,Ys))})),cs=$r((function(t){var n=Qa(t);return Ys(n)&&(n=e),fi(Nt(t,Ys),sa(n,2))})),ls=$r((function(t){var n=Qa(t);return n="function"==typeof n?n:e,fi(Nt(t,Ys),e,n)})),us=$r(is),hs=$r((function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,as(t,r)}));function ds(e){var t=Rn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ps=ea((function(t){var n=t.length,r=n?t[0]:0,i=this.__wrapped__,a=function(e){return ir(e,t)};return!(n>1||this.__actions__.length)&&i instanceof qn&&ga(r)?((i=i.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[a],thisArg:e}),new jn(i,this.__chain__).thru((function(t){return n&&!t.length&&t.push(e),t}))):this.thru(a)})),ms=Ni((function(e,t,n){Be.call(e,n)?++e[n]:rr(e,n,1)})),gs=Li(Ha),vs=Li(Ua);function ys(e,t){return(Us(e)?Et:ur)(e,sa(t,3))}function bs(e,t){return(Us(e)?Mt:hr)(e,sa(t,3))}var _s=Ni((function(e,t,n){Be.call(e,n)?e[n].push(t):rr(e,n,[t])})),ws=$r((function(e,t,n){var r=-1,i="function"==typeof t,a=Ws(e)?ie(e.length):[];return ur(e,(function(e){a[++r]=i?Ct(t,e,n):Tr(e,t,n)})),a})),xs=Ni((function(e,t,n){rr(e,n,t)}));function ks(e,t){return(Us(e)?It:Vr)(e,sa(t,3))}var Cs=Ni((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Ss=$r((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),qr(e,mr(t,1),[])})),Es=ut||function(){return dt.Date.now()};function Ms(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Ki(t,a,e,e,e,e,n)}function Ts(n,r){var i;if("function"!=typeof r)throw new Te(t);return n=mo(n),function(){return--n>0&&(i=r.apply(this,arguments)),n<=1&&(r=e),i}}var Ns=$r((function(e,t,n){var r=1;if(n.length){var a=cn(n,aa(Ns));r|=i}return Ki(e,r,t,n,a)})),As=$r((function(e,t,n){var r=3;if(n.length){var a=cn(n,aa(As));r|=i}return Ki(t,r,e,n,a)}));function Ps(n,r,i){var a,s,o,c,l,u,h=0,d=!1,f=!1,p=!0;if("function"!=typeof n)throw new Te(t);function m(t){var r=a,i=s;return a=s=e,h=t,c=n.apply(i,r)}function g(t){var n=t-u;return u===e||n>=r||n<0||f&&t-h>=o}function v(){var e=Es();if(g(e))return y(e);l=Ta(v,function(e){var t=r-(e-u);return f?vn(t,o-(e-h)):t}(e))}function y(t){return l=e,p&&a?m(t):(a=s=e,c)}function b(){var t=Es(),n=g(t);if(a=arguments,s=this,u=t,n){if(l===e)return function(e){return h=e,l=Ta(v,r),d?m(e):c}(u);if(f)return _i(l),l=Ta(v,r),m(u)}return l===e&&(l=Ta(v,r)),c}return r=vo(r)||0,eo(i)&&(d=!!i.leading,o=(f="maxWait"in i)?gn(vo(i.maxWait)||0,r):o,p="trailing"in i?!!i.trailing:p),b.cancel=function(){l!==e&&_i(l),h=0,a=u=s=l=e},b.flush=function(){return l===e?c:y(Es())},b}var Is=$r((function(e,t){return cr(e,1,t)})),Ds=$r((function(e,t,n){return cr(e,vo(t)||0,n)}));function Bs(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Te(t);var r=function(){var t=arguments,i=n?n.apply(this,t):t[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,t);return r.cache=a.set(i,s)||a,s};return r.cache=new(Bs.Cache||Gn),r}function Os(e){if("function"!=typeof e)throw new Te(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Bs.Cache=Gn;var Ls=yi((function(e,t){var n=(t=1==t.length&&Us(t[0])?It(t[0],Qt(sa())):It(mr(t,1),Qt(sa()))).length;return $r((function(r){for(var i=-1,a=vn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return Ct(e,this,r)}))})),Vs=$r((function(t,n){var r=cn(n,aa(Vs));return Ki(t,i,e,n,r)})),Rs=$r((function(t,n){var r=cn(n,aa(Rs));return Ki(t,64,e,n,r)})),Fs=ea((function(t,n){return Ki(t,s,e,e,e,n)}));function zs(e,t){return e===t||e!=e&&t!=t}var js=Ui(Cr),qs=Ui((function(e,t){return e>=t})),Hs=Nr(function(){return arguments}())?Nr:function(e){return to(e)&&Be.call(e,"callee")&&!Ye.call(e,"callee")},Us=ie.isArray,Gs=yt?Qt(yt):function(e){return to(e)&&kr(e)==P};function Ws(e){return null!=e&&Js(e.length)&&!Xs(e)}function Ys(e){return to(e)&&Ws(e)}var $s=vt||vc,Ks=bt?Qt(bt):function(e){return to(e)&&kr(e)==v};function Qs(e){if(!to(e))return!1;var t=kr(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!io(e)}function Xs(e){if(!eo(e))return!1;var t=kr(e);return t==_||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zs(e){return"number"==typeof e&&e==mo(e)}function Js(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function eo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function to(e){return null!=e&&"object"==typeof e}var no=_t?Qt(_t):function(e){return to(e)&&da(e)==x};function ro(e){return"number"==typeof e||to(e)&&kr(e)==k}function io(e){if(!to(e)||kr(e)!=C)return!1;var t=Ge(e);if(null===t)return!0;var n=Be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==Re}var ao=wt?Qt(wt):function(e){return to(e)&&kr(e)==E},so=xt?Qt(xt):function(e){return to(e)&&da(e)==M};function oo(e){return"string"==typeof e||!Us(e)&&to(e)&&kr(e)==T}function co(e){return"symbol"==typeof e||to(e)&&kr(e)==N}var lo=kt?Qt(kt):function(e){return to(e)&&Js(e.length)&&!!at[kr(e)]},uo=Ui(Lr),ho=Ui((function(e,t){return e<=t}));function fo(e){if(!e)return[];if(Ws(e))return oo(e)?hn(e):Mi(e);if(Qe&&e[Qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Qe]());var t=da(e);return(t==x?sn:t==M?ln:jo)(e)}function po(e){return e?(e=vo(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function mo(e){var t=po(e),n=t%1;return t==t?n?t-n:t:0}function go(e){return e?ar(mo(e),0,u):0}function vo(e){if("number"==typeof e)return e;if(co(e))return l;if(eo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=eo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=pe.test(e);return n||ge.test(e)?lt(e.slice(2),n?2:8):fe.test(e)?l:+e}function yo(e){return Ti(e,Do(e))}function bo(e){return null==e?"":oi(e)}var _o=Ai((function(e,t){if(wa(t)||Ws(t))Ti(t,Io(t),e);else for(var n in t)Be.call(t,n)&&Jn(e,n,t[n])})),wo=Ai((function(e,t){Ti(t,Do(t),e)})),xo=Ai((function(e,t,n,r){Ti(t,Do(t),e,r)})),ko=Ai((function(e,t,n,r){Ti(t,Io(t),e,r)})),Co=ea(ir),So=$r((function(t,n){t=Se(t);var r=-1,i=n.length,a=i>2?n[2]:e;for(a&&va(n[0],n[1],a)&&(i=1);++r<i;)for(var s=n[r],o=Do(s),c=-1,l=o.length;++c<l;){var u=o[c],h=t[u];(h===e||zs(h,Pe[u])&&!Be.call(t,u))&&(t[u]=s[u])}return t})),Eo=$r((function(t){return t.push(e,Xi),Ct(Oo,e,t)}));function Mo(t,n,r){var i=null==t?e:wr(t,n);return i===e?r:i}function To(e,t){return null!=e&&fa(e,t,Er)}var No=Fi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ve.call(t)),e[t]=n}),tc(ic)),Ao=Fi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ve.call(t)),Be.call(e,t)?e[t].push(n):e[t]=[n]}),sa),Po=$r(Tr);function Io(e){return Ws(e)?$n(e):Br(e)}function Do(e){return Ws(e)?$n(e,!0):Or(e)}var Bo=Ai((function(e,t,n){zr(e,t,n)})),Oo=Ai((function(e,t,n,r){zr(e,t,n,r)})),Lo=ea((function(e,t){var n={};if(null==e)return n;var r=!1;t=It(t,(function(t){return t=vi(t,e),r||(r=t.length>1),t})),Ti(e,na(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Vo=ea((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return To(e,n)}))}(e,t)}));function Ro(e,t){if(null==e)return{};var n=It(na(e),(function(e){return[e]}));return t=sa(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Fo=$i(Io),zo=$i(Do);function jo(e){return null==e?[]:Xt(e,Io(e))}var qo=Bi((function(e,t,n){return t=t.toLowerCase(),e+(n?Ho(t):t)}));function Ho(e){return Xo(bo(e).toLowerCase())}function Uo(e){return(e=bo(e))&&e.replace(ye,tn).replace(Ze,"")}var Go=Bi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Wo=Bi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Yo=Di("toLowerCase"),$o=Bi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ko=Bi((function(e,t,n){return e+(n?" ":"")+Xo(t)})),Qo=Bi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xo=Di("toUpperCase");function Zo(t,n,r){return t=bo(t),(n=r?e:n)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(et)||[]}(t):function(e){return e.match(ce)||[]}(t):t.match(n)||[]}var Jo=$r((function(t,n){try{return Ct(t,e,n)}catch(r){return Qs(r)?r:new xe(r)}})),ec=ea((function(e,t){return Et(t,(function(t){t=Va(t),rr(e,t,Ns(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Vi(),rc=Vi(!0);function ic(e){return e}function ac(e){return Dr("function"==typeof e?e:sr(e,1))}var sc=$r((function(e,t){return function(n){return Tr(n,e,t)}})),oc=$r((function(e,t){return function(n){return Tr(e,n,t)}}));function cc(e,t,n){var r=Io(t),i=_r(t,r);null!=n||eo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,Io(t)));var a=!(eo(n)&&"chain"in n&&!n.chain),s=Xs(e);return Et(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Dt([this.value()],arguments))})})),e}function lc(){}var uc=ji(It),hc=ji(Tt),dc=ji(Lt);function fc(e){return ya(e)?Ut(Va(e)):function(e){return function(t){return wr(t,e)}}(e)}var pc=Hi(),mc=Hi(!0);function gc(){return[]}function vc(){return!1}var yc,bc=zi((function(e,t){return e+t}),0),_c=Wi("ceil"),wc=zi((function(e,t){return e/t}),1),xc=Wi("floor"),kc=zi((function(e,t){return e*t}),1),Cc=Wi("round"),Sc=zi((function(e,t){return e-t}),0);return Rn.after=function(e,n){if("function"!=typeof n)throw new Te(t);return e=mo(e),function(){if(--e<1)return n.apply(this,arguments)}},Rn.ary=Ms,Rn.assign=_o,Rn.assignIn=wo,Rn.assignInWith=xo,Rn.assignWith=ko,Rn.at=Co,Rn.before=Ts,Rn.bind=Ns,Rn.bindAll=ec,Rn.bindKey=As,Rn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(e)?e:[e]},Rn.chain=ds,Rn.chunk=function(t,n,r){n=(r?va(t,n,r):n===e)?1:gn(mo(n),0);var i=null==t?0:t.length;if(!i||n<1)return[];for(var a=0,s=0,o=ie(ft(i/n));a<i;)o[s++]=ti(t,a,a+=n);return o},Rn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Rn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ie(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Dt(Us(n)?Mi(n):[n],mr(t,1))},Rn.cond=function(e){var n=null==e?0:e.length,r=sa();return e=n?It(e,(function(e){if("function"!=typeof e[1])throw new Te(t);return[r(e[0]),e[1]]})):[],$r((function(t){for(var r=-1;++r<n;){var i=e[r];if(Ct(i[0],this,t))return Ct(i[1],this,t)}}))},Rn.conforms=function(e){return function(e){var t=Io(e);return function(n){return or(n,e,t)}}(sr(e,1))},Rn.constant=tc,Rn.countBy=ms,Rn.create=function(e,t){var n=Fn(e);return null==t?n:nr(n,t)},Rn.curry=function t(n,r,i){var a=Ki(n,8,e,e,e,e,e,r=i?e:r);return a.placeholder=t.placeholder,a},Rn.curryRight=function t(n,r,i){var a=Ki(n,16,e,e,e,e,e,r=i?e:r);return a.placeholder=t.placeholder,a},Rn.debounce=Ps,Rn.defaults=So,Rn.defaultsDeep=Eo,Rn.defer=Is,Rn.delay=Ds,Rn.difference=za,Rn.differenceBy=ja,Rn.differenceWith=qa,Rn.drop=function(t,n,r){var i=null==t?0:t.length;return i?ti(t,(n=r||n===e?1:mo(n))<0?0:n,i):[]},Rn.dropRight=function(t,n,r){var i=null==t?0:t.length;return i?ti(t,0,(n=i-(n=r||n===e?1:mo(n)))<0?0:n):[]},Rn.dropRightWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!0,!0):[]},Rn.dropWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!0):[]},Rn.fill=function(t,n,r,i){var a=null==t?0:t.length;return a?(r&&"number"!=typeof r&&va(t,n,r)&&(r=0,i=a),function(t,n,r,i){var a=t.length;for((r=mo(r))<0&&(r=-r>a?0:a+r),(i=i===e||i>a?a:mo(i))<0&&(i+=a),i=r>i?0:go(i);r<i;)t[r++]=n;return t}(t,n,r,i)):[]},Rn.filter=function(e,t){return(Us(e)?Nt:pr)(e,sa(t,3))},Rn.flatMap=function(e,t){return mr(ks(e,t),1)},Rn.flatMapDeep=function(e,t){return mr(ks(e,t),o)},Rn.flatMapDepth=function(t,n,r){return r=r===e?1:mo(r),mr(ks(t,n),r)},Rn.flatten=Ga,Rn.flattenDeep=function(e){return null!=e&&e.length?mr(e,o):[]},Rn.flattenDepth=function(t,n){return null!=t&&t.length?mr(t,n=n===e?1:mo(n)):[]},Rn.flip=function(e){return Ki(e,512)},Rn.flow=nc,Rn.flowRight=rc,Rn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Rn.functions=function(e){return null==e?[]:_r(e,Io(e))},Rn.functionsIn=function(e){return null==e?[]:_r(e,Do(e))},Rn.groupBy=_s,Rn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Rn.intersection=Ya,Rn.intersectionBy=$a,Rn.intersectionWith=Ka,Rn.invert=No,Rn.invertBy=Ao,Rn.invokeMap=ws,Rn.iteratee=ac,Rn.keyBy=xs,Rn.keys=Io,Rn.keysIn=Do,Rn.map=ks,Rn.mapKeys=function(e,t){var n={};return t=sa(t,3),yr(e,(function(e,r,i){rr(n,t(e,r,i),e)})),n},Rn.mapValues=function(e,t){var n={};return t=sa(t,3),yr(e,(function(e,r,i){rr(n,r,t(e,r,i))})),n},Rn.matches=function(e){return Rr(sr(e,1))},Rn.matchesProperty=function(e,t){return Fr(e,sr(t,1))},Rn.memoize=Bs,Rn.merge=Bo,Rn.mergeWith=Oo,Rn.method=sc,Rn.methodOf=oc,Rn.mixin=cc,Rn.negate=Os,Rn.nthArg=function(e){return e=mo(e),$r((function(t){return jr(t,e)}))},Rn.omit=Lo,Rn.omitBy=function(e,t){return Ro(e,Os(sa(t)))},Rn.once=function(e){return Ts(2,e)},Rn.orderBy=function(t,n,r,i){return null==t?[]:(Us(n)||(n=null==n?[]:[n]),Us(r=i?e:r)||(r=null==r?[]:[r]),qr(t,n,r))},Rn.over=uc,Rn.overArgs=Ls,Rn.overEvery=hc,Rn.overSome=dc,Rn.partial=Vs,Rn.partialRight=Rs,Rn.partition=Cs,Rn.pick=Vo,Rn.pickBy=Ro,Rn.property=fc,Rn.propertyOf=function(t){return function(n){return null==t?e:wr(t,n)}},Rn.pull=Xa,Rn.pullAll=Za,Rn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ur(e,t,sa(n,2)):e},Rn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?Ur(t,n,e,r):t},Rn.pullAt=Ja,Rn.range=pc,Rn.rangeRight=mc,Rn.rearg=Fs,Rn.reject=function(e,t){return(Us(e)?Nt:pr)(e,Os(sa(t,3)))},Rn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=sa(t,3);++r<a;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return Gr(e,i),n},Rn.rest=function(n,r){if("function"!=typeof n)throw new Te(t);return $r(n,r=r===e?r:mo(r))},Rn.reverse=es,Rn.sampleSize=function(t,n,r){return n=(r?va(t,n,r):n===e)?1:mo(n),(Us(t)?Qn:Qr)(t,n)},Rn.set=function(e,t,n){return null==e?e:Xr(e,t,n)},Rn.setWith=function(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:Xr(t,n,r,i)},Rn.shuffle=function(e){return(Us(e)?Xn:ei)(e)},Rn.slice=function(t,n,r){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&va(t,n,r)?(n=0,r=i):(n=null==n?0:mo(n),r=r===e?i:mo(r)),ti(t,n,r)):[]},Rn.sortBy=Ss,Rn.sortedUniq=function(e){return e&&e.length?ai(e):[]},Rn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,sa(t,2)):[]},Rn.split=function(t,n,r){return r&&"number"!=typeof r&&va(t,n,r)&&(n=r=e),(r=r===e?u:r>>>0)?(t=bo(t))&&("string"==typeof n||null!=n&&!ao(n))&&!(n=oi(n))&&an(t)?bi(hn(t),0,r):t.split(n,r):[]},Rn.spread=function(e,n){if("function"!=typeof e)throw new Te(t);return n=null==n?0:gn(mo(n),0),$r((function(t){var r=t[n],i=bi(t,0,n);return r&&Dt(i,r),Ct(e,this,i)}))},Rn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Rn.take=function(t,n,r){return t&&t.length?ti(t,0,(n=r||n===e?1:mo(n))<0?0:n):[]},Rn.takeRight=function(t,n,r){var i=null==t?0:t.length;return i?ti(t,(n=i-(n=r||n===e?1:mo(n)))<0?0:n,i):[]},Rn.takeRightWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!1,!0):[]},Rn.takeWhile=function(e,t){return e&&e.length?hi(e,sa(t,3)):[]},Rn.tap=function(e,t){return t(e),e},Rn.throttle=function(e,n,r){var i=!0,a=!0;if("function"!=typeof e)throw new Te(t);return eo(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),Ps(e,n,{leading:i,maxWait:n,trailing:a})},Rn.thru=fs,Rn.toArray=fo,Rn.toPairs=Fo,Rn.toPairsIn=zo,Rn.toPath=function(e){return Us(e)?It(e,Va):co(e)?[e]:Mi(La(bo(e)))},Rn.toPlainObject=yo,Rn.transform=function(e,t,n){var r=Us(e),i=r||$s(e)||lo(e);if(t=sa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:eo(e)&&Xs(a)?Fn(Ge(e)):{}}return(i?Et:yr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Rn.unary=function(e){return Ms(e,1)},Rn.union=ts,Rn.unionBy=ns,Rn.unionWith=rs,Rn.uniq=function(e){return e&&e.length?ci(e):[]},Rn.uniqBy=function(e,t){return e&&e.length?ci(e,sa(t,2)):[]},Rn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?ci(t,e,n):[]},Rn.unset=function(e,t){return null==e||li(e,t)},Rn.unzip=is,Rn.unzipWith=as,Rn.update=function(e,t,n){return null==e?e:ui(e,t,gi(n))},Rn.updateWith=function(t,n,r,i){return i="function"==typeof i?i:e,null==t?t:ui(t,n,gi(r),i)},Rn.values=jo,Rn.valuesIn=function(e){return null==e?[]:Xt(e,Do(e))},Rn.without=ss,Rn.words=Zo,Rn.wrap=function(e,t){return Vs(gi(t),e)},Rn.xor=os,Rn.xorBy=cs,Rn.xorWith=ls,Rn.zip=us,Rn.zipObject=function(e,t){return pi(e||[],t||[],Jn)},Rn.zipObjectDeep=function(e,t){return pi(e||[],t||[],Xr)},Rn.zipWith=hs,Rn.entries=Fo,Rn.entriesIn=zo,Rn.extend=wo,Rn.extendWith=xo,cc(Rn,Rn),Rn.add=bc,Rn.attempt=Jo,Rn.camelCase=qo,Rn.capitalize=Ho,Rn.ceil=_c,Rn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=vo(r))==r?r:0),n!==e&&(n=(n=vo(n))==n?n:0),ar(vo(t),n,r)},Rn.clone=function(e){return sr(e,4)},Rn.cloneDeep=function(e){return sr(e,5)},Rn.cloneDeepWith=function(t,n){return sr(t,5,n="function"==typeof n?n:e)},Rn.cloneWith=function(t,n){return sr(t,4,n="function"==typeof n?n:e)},Rn.conformsTo=function(e,t){return null==t||or(e,t,Io(t))},Rn.deburr=Uo,Rn.defaultTo=function(e,t){return null==e||e!=e?t:e},Rn.divide=wc,Rn.endsWith=function(t,n,r){t=bo(t),n=oi(n);var i=t.length,a=r=r===e?i:ar(mo(r),0,i);return(r-=n.length)>=0&&t.slice(r,a)==n},Rn.eq=zs,Rn.escape=function(e){return(e=bo(e))&&$.test(e)?e.replace(W,nn):e},Rn.escapeRegExp=function(e){return(e=bo(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Rn.every=function(t,n,r){var i=Us(t)?Tt:dr;return r&&va(t,n,r)&&(n=e),i(t,sa(n,3))},Rn.find=gs,Rn.findIndex=Ha,Rn.findKey=function(e,t){return Rt(e,sa(t,3),yr)},Rn.findLast=vs,Rn.findLastIndex=Ua,Rn.findLastKey=function(e,t){return Rt(e,sa(t,3),br)},Rn.floor=xc,Rn.forEach=ys,Rn.forEachRight=bs,Rn.forIn=function(e,t){return null==e?e:gr(e,sa(t,3),Do)},Rn.forInRight=function(e,t){return null==e?e:vr(e,sa(t,3),Do)},Rn.forOwn=function(e,t){return e&&yr(e,sa(t,3))},Rn.forOwnRight=function(e,t){return e&&br(e,sa(t,3))},Rn.get=Mo,Rn.gt=js,Rn.gte=qs,Rn.has=function(e,t){return null!=e&&fa(e,t,Sr)},Rn.hasIn=To,Rn.head=Wa,Rn.identity=ic,Rn.includes=function(e,t,n,r){e=Ws(e)?e:jo(e),n=n&&!r?mo(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),oo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Rn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:mo(n);return i<0&&(i=gn(r+i,0)),zt(e,t,i)},Rn.inRange=function(t,n,r){return n=po(n),r===e?(r=n,n=0):r=po(r),function(e,t,n){return e>=vn(t,n)&&e<gn(t,n)}(t=vo(t),n,r)},Rn.invoke=Po,Rn.isArguments=Hs,Rn.isArray=Us,Rn.isArrayBuffer=Gs,Rn.isArrayLike=Ws,Rn.isArrayLikeObject=Ys,Rn.isBoolean=function(e){return!0===e||!1===e||to(e)&&kr(e)==m},Rn.isBuffer=$s,Rn.isDate=Ks,Rn.isElement=function(e){return to(e)&&1===e.nodeType&&!io(e)},Rn.isEmpty=function(e){if(null==e)return!0;if(Ws(e)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||$s(e)||lo(e)||Hs(e)))return!e.length;var t=da(e);if(t==x||t==M)return!e.size;if(wa(e))return!Br(e).length;for(var n in e)if(Be.call(e,n))return!1;return!0},Rn.isEqual=function(e,t){return Ar(e,t)},Rn.isEqualWith=function(t,n,r){var i=(r="function"==typeof r?r:e)?r(t,n):e;return i===e?Ar(t,n,e,r):!!i},Rn.isError=Qs,Rn.isFinite=function(e){return"number"==typeof e&&Vt(e)},Rn.isFunction=Xs,Rn.isInteger=Zs,Rn.isLength=Js,Rn.isMap=no,Rn.isMatch=function(e,t){return e===t||Pr(e,t,ca(t))},Rn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Pr(t,n,ca(n),r)},Rn.isNaN=function(e){return ro(e)&&e!=+e},Rn.isNative=function(e){if(_a(e))throw new xe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ir(e)},Rn.isNil=function(e){return null==e},Rn.isNull=function(e){return null===e},Rn.isNumber=ro,Rn.isObject=eo,Rn.isObjectLike=to,Rn.isPlainObject=io,Rn.isRegExp=ao,Rn.isSafeInteger=function(e){return Zs(e)&&e>=-9007199254740991&&e<=c},Rn.isSet=so,Rn.isString=oo,Rn.isSymbol=co,Rn.isTypedArray=lo,Rn.isUndefined=function(t){return t===e},Rn.isWeakMap=function(e){return to(e)&&da(e)==A},Rn.isWeakSet=function(e){return to(e)&&"[object WeakSet]"==kr(e)},Rn.join=function(e,t){return null==e?"":Gt.call(e,t)},Rn.kebabCase=Go,Rn.last=Qa,Rn.lastIndexOf=function(t,n,r){var i=null==t?0:t.length;if(!i)return-1;var a=i;return r!==e&&(a=(a=mo(r))<0?gn(i+a,0):vn(a,i-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,a):Ft(t,qt,a,!0)},Rn.lowerCase=Wo,Rn.lowerFirst=Yo,Rn.lt=uo,Rn.lte=ho,Rn.max=function(t){return t&&t.length?fr(t,ic,Cr):e},Rn.maxBy=function(t,n){return t&&t.length?fr(t,sa(n,2),Cr):e},Rn.mean=function(e){return Ht(e,ic)},Rn.meanBy=function(e,t){return Ht(e,sa(t,2))},Rn.min=function(t){return t&&t.length?fr(t,ic,Lr):e},Rn.minBy=function(t,n){return t&&t.length?fr(t,sa(n,2),Lr):e},Rn.stubArray=gc,Rn.stubFalse=vc,Rn.stubObject=function(){return{}},Rn.stubString=function(){return""},Rn.stubTrue=function(){return!0},Rn.multiply=kc,Rn.nth=function(t,n){return t&&t.length?jr(t,mo(n)):e},Rn.noConflict=function(){return dt._===this&&(dt._=Fe),this},Rn.noop=lc,Rn.now=Es,Rn.pad=function(e,t,n){e=bo(e);var r=(t=mo(t))?un(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return qi(pt(i),n)+e+qi(ft(i),n)},Rn.padEnd=function(e,t,n){e=bo(e);var r=(t=mo(t))?un(e):0;return t&&r<t?e+qi(t-r,n):e},Rn.padStart=function(e,t,n){e=bo(e);var r=(t=mo(t))?un(e):0;return t&&r<t?qi(t-r,n)+e:e},Rn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),bn(bo(e).replace(re,""),t||0)},Rn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&va(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=po(t),n===e?(n=t,t=0):n=po(n)),t>n){var i=t;t=n,n=i}if(r||t%1||n%1){var a=_n();return vn(t+a*(n-t+ct("1e-"+((a+"").length-1))),n)}return Wr(t,n)},Rn.reduce=function(e,t,n){var r=Us(e)?Bt:Wt,i=arguments.length<3;return r(e,sa(t,4),n,i,ur)},Rn.reduceRight=function(e,t,n){var r=Us(e)?Ot:Wt,i=arguments.length<3;return r(e,sa(t,4),n,i,hr)},Rn.repeat=function(t,n,r){return n=(r?va(t,n,r):n===e)?1:mo(n),Yr(bo(t),n)},Rn.replace=function(){var e=arguments,t=bo(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Rn.result=function(t,n,r){var i=-1,a=(n=vi(n,t)).length;for(a||(a=1,t=e);++i<a;){var s=null==t?e:t[Va(n[i])];s===e&&(i=a,s=r),t=Xs(s)?s.call(t):s}return t},Rn.round=Cc,Rn.runInContext=h,Rn.sample=function(e){return(Us(e)?Kn:Kr)(e)},Rn.size=function(e){if(null==e)return 0;if(Ws(e))return oo(e)?un(e):e.length;var t=da(e);return t==x||t==M?e.size:Br(e).length},Rn.snakeCase=$o,Rn.some=function(t,n,r){var i=Us(t)?Lt:ni;return r&&va(t,n,r)&&(n=e),i(t,sa(n,3))},Rn.sortedIndex=function(e,t){return ri(e,t)},Rn.sortedIndexBy=function(e,t,n){return ii(e,t,sa(n,2))},Rn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&zs(e[r],t))return r}return-1},Rn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Rn.sortedLastIndexBy=function(e,t,n){return ii(e,t,sa(n,2),!0)},Rn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(zs(e[n],t))return n}return-1},Rn.startCase=Ko,Rn.startsWith=function(e,t,n){return e=bo(e),n=null==n?0:ar(mo(n),0,e.length),t=oi(t),e.slice(n,n+t.length)==t},Rn.subtract=Sc,Rn.sum=function(e){return e&&e.length?Yt(e,ic):0},Rn.sumBy=function(e,t){return e&&e.length?Yt(e,sa(t,2)):0},Rn.template=function(t,n,r){var i=Rn.templateSettings;r&&va(t,n,r)&&(n=e),t=bo(t),n=xo({},n,i,Qi);var a,s,o=xo({},n.imports,i.imports,Qi),c=Io(o),l=Xt(o,c),u=0,h=n.interpolate||be,d="__p += '",f=Ee((n.escape||be).source+"|"+h.source+"|"+(h===X?he:be).source+"|"+(n.evaluate||be).source+"|$","g"),p="//# sourceURL="+(Be.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++it+"]")+"\n";t.replace(f,(function(e,n,r,i,o,c){return r||(r=i),d+=t.slice(u,c).replace(_e,rn),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),o&&(s=!0,d+="';\n"+o+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),d+="';\n";var m=Be.call(n,"variable")&&n.variable;if(m){if(le.test(m))throw new xe("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(q,""):d).replace(H,"$1").replace(U,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Jo((function(){return ke(c,p+"return "+d).apply(e,l)}));if(g.source=d,Qs(g))throw g;return g},Rn.times=function(e,t){if((e=mo(e))<1||e>c)return[];var n=u,r=vn(e,u);t=sa(t),e-=u;for(var i=$t(r,t);++n<e;)t(n);return i},Rn.toFinite=po,Rn.toInteger=mo,Rn.toLength=go,Rn.toLower=function(e){return bo(e).toLowerCase()},Rn.toNumber=vo,Rn.toSafeInteger=function(e){return e?ar(mo(e),-9007199254740991,c):0===e?e:0},Rn.toString=bo,Rn.toUpper=function(e){return bo(e).toUpperCase()},Rn.trim=function(t,n,r){if((t=bo(t))&&(r||n===e))return Kt(t);if(!t||!(n=oi(n)))return t;var i=hn(t),a=hn(n);return bi(i,Jt(i,a),en(i,a)+1).join("")},Rn.trimEnd=function(t,n,r){if((t=bo(t))&&(r||n===e))return t.slice(0,dn(t)+1);if(!t||!(n=oi(n)))return t;var i=hn(t);return bi(i,0,en(i,hn(n))+1).join("")},Rn.trimStart=function(t,n,r){if((t=bo(t))&&(r||n===e))return t.replace(re,"");if(!t||!(n=oi(n)))return t;var i=hn(t);return bi(i,Jt(i,hn(n))).join("")},Rn.truncate=function(t,n){var r=30,i="...";if(eo(n)){var a="separator"in n?n.separator:a;r="length"in n?mo(n.length):r,i="omission"in n?oi(n.omission):i}var s=(t=bo(t)).length;if(an(t)){var o=hn(t);s=o.length}if(r>=s)return t;var c=r-un(i);if(c<1)return i;var l=o?bi(o,0,c).join(""):t.slice(0,c);if(a===e)return l+i;if(o&&(c+=l.length-c),ao(a)){if(t.slice(c).search(a)){var u,h=l;for(a.global||(a=Ee(a.source,bo(de.exec(a))+"g")),a.lastIndex=0;u=a.exec(h);)var d=u.index;l=l.slice(0,d===e?c:d)}}else if(t.indexOf(oi(a),c)!=c){var f=l.lastIndexOf(a);f>-1&&(l=l.slice(0,f))}return l+i},Rn.unescape=function(e){return(e=bo(e))&&Y.test(e)?e.replace(G,fn):e},Rn.uniqueId=function(e){var t=++Oe;return bo(e)+t},Rn.upperCase=Qo,Rn.upperFirst=Xo,Rn.each=ys,Rn.eachRight=bs,Rn.first=Wa,cc(Rn,(yc={},yr(Rn,(function(e,t){Be.call(Rn.prototype,t)||(yc[t]=e)})),yc),{chain:!1}),Rn.VERSION="4.17.21",Et(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Rn[e].placeholder=Rn})),Et(["drop","take"],(function(t,n){qn.prototype[t]=function(r){r=r===e?1:gn(mo(r),0);var i=this.__filtered__&&!n?new qn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(r,i.__takeCount__):i.__views__.push({size:vn(r,u),type:t+(i.__dir__<0?"Right":"")}),i},qn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Et(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;qn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:sa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Et(["head","last"],(function(e,t){var n="take"+(t?"Right":"");qn.prototype[e]=function(){return this[n](1).value()[0]}})),Et(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");qn.prototype[e]=function(){return this.__filtered__?new qn(this):this[n](1)}})),qn.prototype.compact=function(){return this.filter(ic)},qn.prototype.find=function(e){return this.filter(e).head()},qn.prototype.findLast=function(e){return this.reverse().find(e)},qn.prototype.invokeMap=$r((function(e,t){return"function"==typeof e?new qn(this):this.map((function(n){return Tr(n,e,t)}))})),qn.prototype.reject=function(e){return this.filter(Os(sa(e)))},qn.prototype.slice=function(t,n){t=mo(t);var r=this;return r.__filtered__&&(t>0||n<0)?new qn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=mo(n))<0?r.dropRight(-n):r.take(n-t)),r)},qn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},qn.prototype.toArray=function(){return this.take(u)},yr(qn.prototype,(function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),a=Rn[i?"take"+("last"==n?"Right":""):n],s=i||/^find/.test(n);a&&(Rn.prototype[n]=function(){var n=this.__wrapped__,o=i?[1]:arguments,c=n instanceof qn,l=o[0],u=c||Us(n),h=function(e){var t=a.apply(Rn,Dt([e],o));return i&&d?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var d=this.__chain__,f=!!this.__actions__.length,p=s&&!d,m=c&&!f;if(!s&&u){n=m?n:new qn(this);var g=t.apply(n,o);return g.__actions__.push({func:fs,args:[h],thisArg:e}),new jn(g,d)}return p&&m?t.apply(this,o):(g=this.thru(h),p?i?g.value()[0]:g.value():g)})})),Et(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ne[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Rn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Us(i)?i:[],e)}return this[n]((function(n){return t.apply(Us(n)?n:[],e)}))}})),yr(qn.prototype,(function(e,t){var n=Rn[t];if(n){var r=n.name+"";Be.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[Ri(e,2).name]=[{name:"wrapper",func:e}],qn.prototype.clone=function(){var e=new qn(this.__wrapped__);return e.__actions__=Mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Mi(this.__views__),e},qn.prototype.reverse=function(){if(this.__filtered__){var e=new qn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},qn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Us(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],s=a.size;switch(a.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=vn(t,e+s);break;case"takeRight":e=gn(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=a.start,o=a.end,c=o-s,l=r?o:s-1,u=this.__iteratees__,h=u.length,d=0,f=vn(c,this.__takeCount__);if(!n||!r&&i==c&&f==c)return di(e,this.__actions__);var p=[];e:for(;c--&&d<f;){for(var m=-1,g=e[l+=t];++m<h;){var v=u[m],y=v.iteratee,b=v.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue e;break e}}p[d++]=g}return p},Rn.prototype.at=ps,Rn.prototype.chain=function(){return ds(this)},Rn.prototype.commit=function(){return new jn(this.value(),this.__chain__)},Rn.prototype.next=function(){this.__values__===e&&(this.__values__=fo(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Rn.prototype.plant=function(t){for(var n,r=this;r instanceof zn;){var i=Fa(r);i.__index__=0,i.__values__=e,n?a.__wrapped__=i:n=i;var a=i;r=r.__wrapped__}return a.__wrapped__=t,n},Rn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof qn){var n=t;return this.__actions__.length&&(n=new qn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[es],thisArg:e}),new jn(n,this.__chain__)}return this.thru(es)},Rn.prototype.toJSON=Rn.prototype.valueOf=Rn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Rn.prototype.first=Rn.prototype.head,Qe&&(Rn.prototype[Qe]=function(){return this}),Rn}();pt?((pt.exports=pn)._=pn,ft._=pn):dt._=pn}.call(m.exports)),m.exports);const _=d(b);function w(e,t){return Math.floor(Math.random()*(t-e+1))+e}function x(e){return Math.cos(C(e))}function k(e){return Math.sin(C(e))}function C(e){return e/360*2*Math.PI}const S=t.defineComponent({name:"FillInView",components:{MarkdownRenderer:t.defineAsyncComponent((()=>import("@vue-skuilder/common-ui").then((e=>e.MarkdownRenderer)))),RadioMultipleChoice:n.RadioMultipleChoice,AudioAutoPlayer:n.AudioAutoPlayer},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"FillInView"),a=n.useQuestionView(i);a.question.value=new O(e.data);const s=t.ref(),o=t.computed((()=>{if(!a.question.value)throw i.logger.error("Question not initialized"),new Error("Question not initialized");return a.question.value}));t.onMounted((()=>{try{if(a.question.value||(a.question.value=new O(e.data)),a.question.value.options){const e=v();s.value=_.shuffle(e)}}catch(t){i.logger.error("Failed to initialize question:",t)}})),t.onUnmounted((()=>{a.question.value=void 0}));const c=t.computed((()=>s.value)),l=t.computed((()=>!!e.data[0]["image-1"])),u=t.computed((()=>{if(!l.value)return[""];const t=[];let n=1;for(;e.data[0][`image-${n}`];)t.push(URL.createObjectURL(e.data[0][`image-${n}`])),n++;return t})),h=t.computed((()=>!!e.data[0]["audio-1"])),d=t.computed((()=>{var e;return(null==(e=o.value)?void 0:e.mdText)||""})),f=t.computed((()=>{if(!h.value)return[""];const t=[];let n=1;for(;e.data[0][`audio-${n}`];)t.push(URL.createObjectURL(e.data[0][`audio-${n}`])),n++;return t})),p=t.computed((()=>{if(o.value.answers)return o.value.answers[Math.floor(o.value.answers.length*Math.random())];throw new Error("No answers provided")})),m=t.computed((()=>{var e;const t=p.value;if(console.log(`Prior answers: ${a.priorAnswers.value}`),t&&(null==(e=a.priorAnswers.value[0])?void 0:e[0])&&"UserInputString"===a.priorAnswers.value[0][1])return function(e,t){const n=new 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 i=0;i<t.length;i++)i<r.length&&r[i]===t[i]&&(n[i]=r[i],r[i]="");for(let i=t.length-1;i>=0;i--)if("_"===n[i]){const e=r.findIndex((e=>e===t[i]));-1!==e&&(n[i]=t[i],r[e]="")}return console.log(n.join(" ")),n.join(" ")}(a.priorAnswers.value[0][0],t);if(console.log("found no UserInputString"),p.value){let e="";for(let t=0;t<p.value.length;t++)e+="_ ";return e}return""})),g=t.computed((()=>!!(o.value.answers&&o.value.answers.length>0))),v=()=>{var t;if(!(null==(t=o.value)?void 0:t.options))return;if(o.value.options.length<=6)return o.value.options;const n=[];n.push(o.value.answers[Math.floor(Math.random()*o.value.answers.length)]);let r=_.shuffle(o.value.options.filter((e=>{var t;return-1===(null==(t=o.value.answers)?void 0:t.indexOf(e))})));return e.modifyDifficulty&&(console.log(`Modifying difficulty: ${e.modifyDifficulty}`),r=e.modifyDifficulty<-200?r.slice(0,1):e.modifyDifficulty<-150?r.slice(0,2):e.modifyDifficulty<-100?r.slice(0,3):e.modifyDifficulty<-50?r.slice(0,4):r.slice(0,5)),n.push(...r.slice(0,5)),n};return t.watch((()=>e.data),(e=>{var t;try{if(a.question.value=new O(e),null==(t=a.question.value)?void 0:t.options){const e=v();s.value=_.shuffle(e)}}catch(n){i.logger.error("Failed to initialize/update question:",n)}}),{deep:!0}),{...i,...a,question:o,truncatedOptions:c,hasImage:l,imageURLs:u,hasAudio:h,audioURL:f,obscuredAnswer:m,someAnswer:p,isQuestion:g,handleNext:()=>{a.submitAnswer("")},markdownText:d}}}),E=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},M={"data-viewable":"FillInView"},T=["src"],N={key:4,class:"text-center text-h6"},A={key:5,class:"text-center text-h6"};const P=E(S,[["render",function(e,n,r,i,a,s){var o;const c=t.resolveComponent("audio-auto-player"),l=t.resolveComponent("markdown-renderer"),u=t.resolveComponent("radio-multiple-choice"),h=t.resolveComponent("v-spacer"),d=t.resolveComponent("v-btn"),f=t.resolveComponent("v-card-actions");return t.openBlock(),t.createElementBlock("div",M,[e.hasAudio?(t.openBlock(),t.createBlock(c,{key:0,src:e.audioURL},null,8,["src"])):t.createCommentVNode("",!0),e.hasImage?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.imageURLs,((e,n)=>(t.openBlock(),t.createElementBlock("img",{key:n,src:e},null,8,T)))),128)):t.createCommentVNode("",!0),e.markdownText?(t.openBlock(),t.createBlock(l,{key:2,md:e.markdownText},null,8,["md"])):t.createCommentVNode("",!0),(null==(o=e.question)?void 0:o.options)?(t.openBlock(),t.createBlock(u,{key:3,"choice-list":e.truncatedOptions},null,8,["choice-list"])):1==e.priorAttempts?(t.openBlock(),t.createElementBlock("div",N,[t.createElementVNode("span",null,t.toDisplayString(e.obscuredAnswer),1)])):2==e.priorAttempts?(t.openBlock(),t.createElementBlock("div",A,[t.createElementVNode("span",null,t.toDisplayString(e.someAnswer),1)])):t.createCommentVNode("",!0),e.isQuestion?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(f,{key:6},{default:t.withCtx((()=>[t.createVNode(h),t.createVNode(d,{color:"primary",autofocus:"autofocus",onClick:e.handleNext},{default:t.withCtx((()=>n[0]||(n[0]=[t.createTextVNode(" Next ")]))),_:1},8,["onClick"])])),_:1}))])}],["__scopeId","data-v-23c3a587"]]),I=[{name:r.DataShapeName.Blanks,fields:[{name:"Input",type:r.FieldType.MARKDOWN},{name:"Uploads",type:r.FieldType.MEDIA_UPLOADS}]}];function D(e,t,n){const r=e.split(t),i=r[0],a=r[1].split(n);return{left:i,middle:a[0],right:a[1]}}const B=class _BlanksCard2 extends n.Question{constructor(e){var t;super(e),u(this,"mdText",""),u(this,"answers",null),u(this,"options",null),this.mdText=e[0].Input,void 0===this.mdText&&(this.mdText="");const r=n.splitByDelimiters(this.mdText,"{{","}}"),i=[];for(let n=0;n<r.length;n++)try{const e=this.optionsFromString(r[n]);this.answers=e.answers,this.options=e.options,(null==(t=this.options)?void 0:t.length)?i.push("{{ || }}"):i.push("{{ }}")}catch{i.push(r[n])}this.mdText=i.join("")}splitTextToken(e){if(n.containsComponent(e)){const t=D(e.text,"{{","}}"),n=D(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}return[e]}optionsFromString(e){if(!e.startsWith("{{")||!e.endsWith("}}"))throw new Error(`string ${e} is not fill-in text - must look like "{{someText}}"`);const t=(e=e.substring(2,e.length-2)).split("||");if(t.length>1){const e=t[0].split("|").map((e=>e.trim())),n=t[1].split("|").map((e=>e.trim())).filter((t=>!e.includes(t)));return n.push(e[w(0,e.length-1)]),{answers:e,options:_.shuffle(n)}}return{answers:[e.trim()],options:null}}isCorrect(e){if(console.log(`answers:${this.answers}\nuser answer: ${JSON.stringify(e)}`),"string"==typeof e){if(this.answers)return this.answers.includes(e);if(""===e)return!0;throw new Error("Question has no configured answers!")}if(Array.isArray(e)){if(this.answers)return e.every((e=>this.answers.includes(e)));throw new Error("Question has no configured answers!")}return this.isCorrectRadio(e)}dataShapes(){return _BlanksCard2.dataShapes}views(){return _BlanksCard2.views}isCorrectRadio(e){return!!this.answers&&this.answers.includes(e.choiceList[e.selection])}};u(B,"dataShapes",I),u(B,"views",[P]);let O=B;class Course{constructor(e,t){u(this,"name"),u(this,"questionList"),this.name=e,this.questionList=t,this.questionList=this.questionList.concat(this.getBaseQTypes())}get questions(){return this.questionList}get allViews(){const e=new Array;return this.questionList.forEach((t=>{t.views.forEach((t=>{e.push(t)}))})),e}get allViewsMap(){const e={};return this.allViews.forEach((t=>{if(!t.name)throw new Error("View has no name");e[t.name]=t})),e}getQuestion(e){return this.questionList.find((t=>{const 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[O]}}const L=new Course("default",[O]),V=["cg-white","cg-black"],R=["a","b","c","d","e","f","g","h"],F=["1","2","3","4","5","6","7","8"],z=[...F].reverse(),j=Array.prototype.concat(...R.map((e=>F.map((t=>e+t))))),q=e=>j[8*e[0]+e[1]],H=e=>[e.charCodeAt(0)-97,e.charCodeAt(1)-49],U=j.map(H);const G=()=>{let e;return{start(){e=performance.now()},cancel(){e=void 0},stop(){if(!e)return 0;const t=performance.now()-e;return e=void 0,t}}},W=e=>"cg-white"===e?"cg-black":"cg-white",Y=(e,t)=>{const n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},$=(e,t)=>e.role===t.role&&e.color===t.color,K=e=>(t,n)=>[(n?t[0]:7-t[0])*e.width/8,(n?7-t[1]:t[1])*e.height/8],Q=(e,t)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px)`},X=(e,t,n=1)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px) scale(${n})`},Z=(e,t)=>{e.style.visibility=t?"visible":"hidden"},J=e=>{var t;return e.clientX||0===e.clientX?[e.clientX,e.clientY]:(null==(t=e.targetTouches)?void 0:t[0])?[e.targetTouches[0].clientX,e.targetTouches[0].clientY]:void 0},ee=e=>2===e.button,te=(e,t)=>{const n=document.createElement(e);return t&&(n.className=t),n};function ne(e,t,n){const r=H(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]}const re=(e,t)=>Math.abs(e-t),ie=(e,t,n,r)=>{const i=re(e,n),a=re(t,r);return 1===i&&2===a||2===i&&1===a},ae=(e,t,n,r)=>re(e,n)===re(t,r),se=(e,t,n,r)=>e===n||t===r,oe=(e,t,n,r)=>ae(e,t,n,r)||se(e,t,n,r);function ce(e,t,n){const r=e.get(t);if(!r)return[];const i=H(t),a=r.role,s="pawn"===a?(o=r.color,(e,t,n,r)=>re(e,n)<2&&("cg-white"===o?r===t+1||t<=1&&r===t+2&&e===n:r===t-1||t>=6&&r===t-2&&e===n)):"knight"===a?ie:"bishop"===a?ae:"rook"===a?se:"queen"===a?oe:((e,t,n)=>(r,i,a,s)=>re(r,a)<2&&re(i,s)<2||n&&i===s&&i===("cg-white"===e?0:7)&&(4===r&&(2===a&&t.includes(0)||6===a&&t.includes(7))||t.includes(a)))(r.color,function(e,t){const n="cg-white"===t?"1":"8",r=[];for(const[i,a]of e)i[1]===n&&a.color===t&&"rook"===a.role&&r.push(H(i)[0]);return r}(e,r.color),n);var o;return U.filter((e=>(i[0]!==e[0]||i[1]!==e[1])&&s(i[0],i[1],e[0],e[1]))).map(q)}function le(e,...t){e&&setTimeout((()=>e(...t)),1)}function ue(e){e.premovable.current&&(e.premovable.current=void 0,le(e.premovable.events.unset))}function he(e){const t=e.predroppable;t.current&&(t.current=void 0,le(t.events.unset))}function de(e,t,n){const r=e.pieces.get(t),i=e.pieces.get(n);if(t===n||!r)return!1;const a=i&&i.color!==r.color?i:void 0;return n===e.selected&&be(e),le(e.events.move,t,n,a),function(e,t,n){if(!e.autoCastle)return!1;const r=e.pieces.get(t);if(!r||"king"!==r.role)return!1;const i=H(t),a=H(n);if(0!==i[1]&&7!==i[1]||i[1]!==a[1])return!1;4!==i[0]||e.pieces.has(n)||(6===a[0]?n=q([7,a[1]]):2===a[0]&&(n=q([0,a[1]])));const s=e.pieces.get(n);return!(!s||s.color!==r.color||"rook"!==s.role||(e.pieces.delete(t),e.pieces.delete(n),i[0]<a[0]?(e.pieces.set(q([6,a[1]]),r),e.pieces.set(q([5,a[1]]),s)):(e.pieces.set(q([2,a[1]]),r),e.pieces.set(q([3,a[1]]),s)),0))}(e,t,n)||(e.pieces.set(n,r),e.pieces.delete(t)),e.lastMove=[t,n],e.check=void 0,le(e.events.change),a||!0}function fe(e,t,n,r){if(e.pieces.has(n)){if(!r)return!1;e.pieces.delete(n)}return le(e.events.dropNewPiece,t,n),e.pieces.set(n,t),e.lastMove=[n],e.check=void 0,le(e.events.change),e.movable.dests=void 0,e.turnColor=W(e.turnColor),!0}function pe(e,t,n){const r=de(e,t,n);return r&&(e.movable.dests=void 0,e.turnColor=W(e.turnColor),e.animation.current=void 0),r}function me(e,t,n){if(we(e,t,n)){const r=pe(e,t,n);if(r){const i=e.hold.stop();be(e);const a={premove:!1,ctrlKey:e.stats.ctrlKey,holdTime:i};return!0!==r&&(a.captured=r),le(e.movable.events.after,t,n,a),!0}}else if(function(e,t,n){var r;const i=(null==(r=e.premovable.customDests)?void 0:r.get(t))??ce(e.pieces,t,e.premovable.castle);return t!==n&&xe(e,t)&&i.includes(n)}(e,t,n))return function(e,t,n,r){he(e),e.premovable.current=[t,n],le(e.premovable.events.set,t,n,r)}(e,t,n,{ctrlKey:e.stats.ctrlKey}),be(e),!0;return be(e),!1}function ge(e,t,n,r){const i=e.pieces.get(t);i&&(function(e,t,n){const r=e.pieces.get(t);return!(!r||t!==n&&e.pieces.has(n)||"both"!==e.movable.color&&(e.movable.color!==r.color||e.turnColor!==r.color))}(e,t,n)||r)?(e.pieces.delete(t),fe(e,i,n,r),le(e.movable.events.afterNewPiece,i.role,n,{premove:!1,predrop:!1})):i&&function(e,t,n){const r=e.pieces.get(t),i=e.pieces.get(n);return!!r&&(!i||i.color!==e.movable.color)&&e.predroppable.enabled&&("pawn"!==r.role||"1"!==n[1]&&"8"!==n[1])&&e.movable.color===r.color&&e.turnColor!==r.color}(e,t,n)?function(e,t,n){ue(e),e.predroppable.current={role:t,key:n},le(e.predroppable.events.set,t,n)}(e,i.role,n):(ue(e),he(e)),e.pieces.delete(t),be(e)}function ve(e,t,n){if(le(e.events.select,t),e.selected){if(e.selected===t&&!e.draggable.enabled)return be(e),void e.hold.cancel();if((e.selectable.enabled||n)&&e.selected!==t&&me(e,e.selected,t))return void(e.stats.dragged=!1)}(e.selectable.enabled||e.draggable.enabled)&&(_e(e,t)||xe(e,t))&&(ye(e,t),e.hold.start())}function ye(e,t){e.selected=t,xe(e,t)?e.premovable.customDests||(e.premovable.dests=ce(e.pieces,t,e.premovable.castle)):e.premovable.dests=void 0}function be(e){e.selected=void 0,e.premovable.dests=void 0,e.hold.cancel()}function _e(e,t){const n=e.pieces.get(t);return!!n&&("both"===e.movable.color||e.movable.color===n.color&&e.turnColor===n.color)}const we=(e,t,n)=>{var r,i;return t!==n&&_e(e,t)&&(e.movable.free||!!(null==(i=null==(r=e.movable.dests)?void 0:r.get(t))?void 0:i.includes(n)))};function xe(e,t){const n=e.pieces.get(t);return!!n&&e.premovable.enabled&&e.movable.color===n.color&&e.turnColor!==n.color}function ke(e){const t=e.premovable.current;if(!t)return!1;const n=t[0],r=t[1];let i=!1;if(we(e,n,r)){const t=pe(e,n,r);if(t){const a={premove:!0};!0!==t&&(a.captured=t),le(e.movable.events.after,n,r,a),i=!0}}return ue(e),i}function Ce(e){ue(e),he(e),be(e)}function Se(e){e.movable.color=e.movable.dests=e.animation.current=void 0,Ce(e)}function Ee(e,t,n){let r=Math.floor(8*(e[0]-n.left)/n.width);t||(r=7-r);let i=7-Math.floor(8*(e[1]-n.top)/n.height);return t||(i=7-i),r>=0&&r<8&&i>=0&&i<8?q([r,i]):void 0}const Me=e=>"cg-white"===e.orientation,Te="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",Ne={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},Ae={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};function Pe(e){"start"===e&&(e=Te);const t=new Map;let n=7,r=0;for(const i of e)switch(i){case" ":case"[":return t;case"/":if(--n,n<0)return t;r=0;break;case"~":{const e=t.get(q([r-1,n]));e&&(e.promoted=!0);break}default:{const e=i.charCodeAt(0);if(e<57)r+=e-48;else{const e=i.toLowerCase();t.set(q([r,n]),{role:Ne[e],color:i===e?"cg-black":"cg-white"}),++r}}}return t}function Ie(e,t){t.animation&&(Be(e.animation,t.animation),(e.animation.duration||0)<70&&(e.animation.enabled=!1))}function De(e,t){var n,r,i;if((null==(n=t.movable)?void 0:n.dests)&&(e.movable.dests=void 0),(null==(r=t.drawable)?void 0:r.autoShapes)&&(e.drawable.autoShapes=[]),Be(e,t),t.fen&&(e.pieces=Pe(t.fen),e.drawable.shapes=(null==(i=t.drawable)?void 0:i.shapes)||[]),"check"in t&&function(e,t){if(e.check=void 0,!0===t&&(t=e.turnColor),t)for(const[n,r]of e.pieces)"king"===r.role&&r.color===t&&(e.check=n)}(e,t.check||!1),"lastMove"in t&&!t.lastMove?e.lastMove=void 0:t.lastMove&&(e.lastMove=t.lastMove),e.selected&&ye(e,e.selected),Ie(e,t),!e.movable.rookCastle&&e.movable.dests){const t="cg-white"===e.movable.color?"1":"8",n="e"+t,r=e.movable.dests.get(n),i=e.pieces.get(n);if(!r||!i||"king"!==i.role)return;e.movable.dests.set(n,r.filter((e=>!(e==="a"+t&&r.includes("c"+t)||e==="h"+t&&r.includes("g"+t)))))}}function Be(e,t){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)&&Oe(e[n])&&Oe(t[n])?Be(e[n],t[n]):e[n]=t[n])}function Oe(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Le=(e,t)=>t.animation.enabled?function(e,t){const n=new Map(t.pieces),r=e(t),i=function(e,t){const n=new Map,r=[],i=new Map,a=[],s=[],o=new Map;let c,l,u;for(const[h,d]of e)o.set(h,Re(h,d));for(const h of j)c=t.pieces.get(h),l=o.get(h),c?l?$(c,l.piece)||(a.push(l),s.push(Re(h,c))):s.push(Re(h,c)):l&&a.push(l);for(const h of s)l=Fe(h,a.filter((e=>$(h.piece,e.piece)))),l&&(u=[l.pos[0]-h.pos[0],l.pos[1]-h.pos[1]],n.set(h.key,u.concat(u)),r.push(l.key));for(const h of a)r.includes(h.key)||i.set(h.key,h.piece);return{anims:n,fadings:i}}(n,t);if(i.anims.size||i.fadings.size){const e=t.animation.current&&t.animation.current.start;t.animation.current={start:performance.now(),frequency:1/t.animation.duration,plan:i},e||ze(t,performance.now())}else t.dom.redraw();return r}(e,t):Ve(e,t);function Ve(e,t){const n=e(t);return t.dom.redraw(),n}const Re=(e,t)=>({key:e,pos:H(e),piece:t}),Fe=(e,t)=>t.sort(((t,n)=>Y(e.pos,t.pos)-Y(e.pos,n.pos)))[0];function ze(e,t){const n=e.animation.current;if(void 0===n)return void(e.dom.destroyed||e.dom.redrawNow());const r=1-(t-n.start)*n.frequency;if(r<=0)e.animation.current=void 0,e.dom.redrawNow();else{const t=je(r);for(const e of n.plan.anims.values())e[2]=e[0]*t,e[3]=e[1]*t;e.dom.redrawNow(!0),requestAnimationFrame(((t=performance.now())=>ze(e,t)))}}const je=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,qe=["green","red","blue","yellow"];function He(e,t){if(t.touches&&t.touches.length>1)return;t.stopPropagation(),t.preventDefault(),t.ctrlKey?be(e):Ce(e);const n=J(t),r=Ee(n,Me(e),e.dom.bounds());r&&(e.drawable.current={orig:r,pos:n,brush:$e(t),snapToValidMove:e.drawable.defaultSnapToValidMove},Ue(e))}function Ue(e){requestAnimationFrame((()=>{const t=e.drawable.current;if(t){const n=Ee(t.pos,Me(e),e.dom.bounds());n||(t.snapToValidMove=!1);const r=t.snapToValidMove?function(e,t,n,r){const i=H(e),a=U.filter((e=>oe(i[0],i[1],e[0],e[1])||ie(i[0],i[1],e[0],e[1]))),s=a.map((e=>ne(q(e),n,r))).map((e=>Y(t,e))),[,o]=s.reduce(((e,t,n)=>e[0]<t?e:[t,n]),[s[0],0]);return q(a[o])}(t.orig,t.pos,Me(e),e.dom.bounds()):n;r!==t.mouseSq&&(t.mouseSq=r,t.dest=r!==t.orig?r:void 0,e.dom.redrawNow()),Ue(e)}}))}function Ge(e,t){e.drawable.current&&(e.drawable.current.pos=J(t))}function We(e){const t=e.drawable.current;t&&(t.mouseSq&&function(e,t){const n=e=>e.orig===t.orig&&e.dest===t.dest,r=e.shapes.find(n);r&&(e.shapes=e.shapes.filter((e=>!n(e))));r&&r.brush===t.brush||e.shapes.push({orig:t.orig,dest:t.dest,brush:t.brush});Ke(e)}(e.drawable,t),Ye(e))}function Ye(e){e.drawable.current&&(e.drawable.current=void 0,e.dom.redraw())}function $e(e){var t;const n=(e.shiftKey||e.ctrlKey)&&ee(e),r=e.altKey||e.metaKey||(null==(t=e.getModifierState)?void 0:t.call(e,"AltGraph"));return qe[(n?1:0)+(r?2:0)]}function Ke(e){e.onChange&&e.onChange(e.shapes)}function Qe(e,t){if(!e.trustAllEvents&&!t.isTrusted)return;if(void 0!==t.buttons&&t.buttons>1)return;if(t.touches&&t.touches.length>1)return;const n=e.dom.bounds(),r=J(t),i=Ee(r,Me(e),n);if(!i)return;const a=e.pieces.get(i),s=e.selected;var o;if(s||!e.drawable.enabled||!e.drawable.eraseOnClick&&a&&a.color===e.turnColor||(o=e).drawable.shapes.length&&(o.drawable.shapes=[],o.dom.redraw(),Ke(o.drawable)),!1!==t.cancelable&&(!t.touches||e.blockTouchScroll||a||s||function(e,t){const n=Me(e),r=e.dom.bounds(),i=Math.pow(r.width/8,2);for(const a of e.pieces.keys()){const e=ne(a,n,r);if(Y(e,t)<=i)return!0}return!1}(e,r)))t.preventDefault();else if(t.touches)return;const c=!!e.premovable.current,l=!!e.predroppable.current;e.stats.ctrlKey=t.ctrlKey,e.selected&&we(e,e.selected,i)?Le((e=>ve(e,i)),e):ve(e,i);const u=e.selected===i,h=nt(e,i);if(a&&h&&u&&function(e,t){const n=e.pieces.get(t);return!!n&&e.draggable.enabled&&("both"===e.movable.color||e.movable.color===n.color&&(e.turnColor===n.color||e.premovable.enabled))}(e,i)){e.draggable.current={orig:i,piece:a,origPos:r,pos:r,started:e.draggable.autoDistance&&e.stats.dragged,element:h,previouslySelected:s,originTarget:t.target,keyHasChanged:!1},h.cgDragging=!0,h.classList.add("dragging");const o=e.dom.elements.ghost;o&&(o.className=`ghost ${a.color} ${a.role}`,Q(o,K(n)(H(i),Me(e))),Z(o,!0)),Xe(e)}else c&&ue(e),l&&he(e);e.dom.redraw()}function Xe(e){requestAnimationFrame((()=>{var t;const n=e.draggable.current;if(!n)return;(null==(t=e.animation.current)?void 0:t.plan.anims.has(n.orig))&&(e.animation.current=void 0);const r=e.pieces.get(n.orig);if(r&&$(r,n.piece)){if(!n.started&&Y(n.pos,n.origPos)>=Math.pow(e.draggable.distance,2)&&(n.started=!0),n.started){if("function"==typeof n.element){const e=n.element();if(!e)return;e.cgDragging=!0,e.classList.add("dragging"),n.element=e}const t=e.dom.bounds();Q(n.element,[n.pos[0]-t.left-t.width/16,n.pos[1]-t.top-t.height/16]),n.keyHasChanged=n.keyHasChanged||n.orig!==Ee(n.pos,Me(e),t)}}else et(e);Xe(e)}))}function Ze(e,t){e.draggable.current&&(!t.touches||t.touches.length<2)&&(e.draggable.current.pos=J(t))}function Je(e,t){const n=e.draggable.current;if(!n)return;if("touchend"===t.type&&!1!==t.cancelable&&t.preventDefault(),"touchend"===t.type&&n.originTarget!==t.target&&!n.newPiece)return void(e.draggable.current=void 0);ue(e),he(e);const r=Ee(J(t)||n.pos,Me(e),e.dom.bounds());r&&n.started&&n.orig!==r?n.newPiece?ge(e,n.orig,r,n.force):(e.stats.ctrlKey=t.ctrlKey,me(e,n.orig,r)&&(e.stats.dragged=!0)):n.newPiece?e.pieces.delete(n.orig):e.draggable.deleteOnDropOff&&!r&&(e.pieces.delete(n.orig),le(e.events.change)),(n.orig!==n.previouslySelected&&!n.keyHasChanged||n.orig!==r&&r)&&e.selectable.enabled||be(e),tt(e),e.draggable.current=void 0,e.dom.redraw()}function et(e){const t=e.draggable.current;t&&(t.newPiece&&e.pieces.delete(t.orig),e.draggable.current=void 0,be(e),tt(e),e.dom.redraw())}function tt(e){const t=e.dom.elements;t.ghost&&Z(t.ghost,!1)}function nt(e,t){let n=e.dom.elements.board.firstChild;for(;n;){if(n.cgKey===t&&"PIECE"===n.tagName)return n;n=n.nextSibling}}function rt(e,t){e.exploding&&(t?e.exploding.stage=t:e.exploding=void 0,e.dom.redraw())}function it(e,t){function n(){!function(e){e.orientation=W(e.orientation),e.animation.current=e.draggable.current=e.selected=void 0}(e),t()}return{set(t){t.orientation&&t.orientation!==e.orientation&&n(),Ie(e,t),(t.fen?Le:Ve)((e=>De(e,t)),e)},state:e,getFen:()=>{return t=e.pieces,z.map((e=>R.map((n=>{const r=t.get(n+e);if(r){let e=Ae[r.role];return"cg-white"===r.color&&(e=e.toUpperCase()),r.promoted&&(e+="~"),e}return"1"})).join(""))).join("/").replace(/1{2,}/g,(e=>e.length.toString()));var t},toggleOrientation:n,setPieces(t){Le((e=>function(e,t){for(const[n,r]of t)r?e.pieces.set(n,r):e.pieces.delete(n)}(e,t)),e)},selectSquare(t,n){t?Le((e=>ve(e,t,n)),e):e.selected&&(be(e),e.dom.redraw())},move(t,n){Le((e=>de(e,t,n)),e)},newPiece(t,n){Le((e=>fe(e,t,n)),e)},playPremove(){if(e.premovable.current){if(Le(ke,e))return!0;e.dom.redraw()}return!1},playPredrop(t){if(e.predroppable.current){const n=function(e,t){const n=e.predroppable.current;let r=!1;if(!n)return!1;t(n)&&fe(e,{role:n.role,color:e.movable.color},n.key)&&(le(e.movable.events.afterNewPiece,n.role,n.key,{premove:!1,predrop:!0}),r=!0);return he(e),r}(e,t);return e.dom.redraw(),n}return!1},cancelPremove(){Ve(ue,e)},cancelPredrop(){Ve(he,e)},cancelMove(){Ve((e=>{Ce(e),et(e)}),e)},stop(){Ve((e=>{Se(e),et(e)}),e)},explode(t){!function(e,t){e.exploding={stage:1,keys:t},e.dom.redraw(),setTimeout((()=>{rt(e,2),setTimeout((()=>rt(e,void 0)),120)}),120)}(e,t)},setAutoShapes(t){Ve((e=>e.drawable.autoShapes=t),e)},setShapes(t){Ve((e=>e.drawable.shapes=t),e)},getKeyAtDomPos:t=>Ee(t,Me(e),e.dom.bounds()),redrawAll:t,dragNewPiece(t,n,r){!function(e,t,n,r){const i="a0";e.pieces.set(i,t),e.dom.redraw();const a=J(n);e.draggable.current={orig:i,piece:t,origPos:a,pos:a,started:!0,element:()=>nt(e,i),originTarget:n.target,newPiece:!0,force:!!r,keyHasChanged:!1},Xe(e)}(e,t,n,r)},destroy(){Se(e),e.dom.unbind&&e.dom.unbind(),e.dom.destroyed=!0}}}const at={hilitePrimary:{key:"hilitePrimary",color:"#3291ff",opacity:1,lineWidth:1},hiliteWhite:{key:"hiliteWhite",color:"#ffffff",opacity:1,lineWidth:1}};function st(e,t,n){const r=e.drawable,i=r.current,a=i&&i.mouseSq?i:void 0,s=new Map,o=e.dom.bounds(),c=r.autoShapes.filter((e=>!e.piece));for(const d of r.shapes.concat(c).concat(a?[a]:[])){if(!d.dest)continue;const t=s.get(d.dest)??new Set,n=_t(ft(H(d.orig),e.orientation),o),r=_t(ft(H(d.dest),e.orientation),o);t.add(wt(n,r)),s.set(d.dest,t)}const l=r.shapes.concat(c).map((e=>({shape:e,current:!1,hash:ot(e,pt(e.dest,s),!1,o)})));a&&l.push({shape:a,current:!0,hash:ot(a,pt(a.dest,s),!0,o)});const u=l.map((e=>e.hash)).join(";");if(u===e.drawable.prevSvgHash)return;e.drawable.prevSvgHash=u;const h=t.querySelector("defs");!function(e,t,n){var r;const i=new Map;let a;for(const c of t.filter((e=>e.shape.dest&&e.shape.brush)))a=vt(e.brushes[c.shape.brush],c.shape.modifiers),(null==(r=c.shape.modifiers)?void 0:r.hilite)&&i.set(ut(a).key,ut(a)),i.set(a.key,a);const s=new Set;let o=n.firstElementChild;for(;o;)s.add(o.getAttribute("cgKey")),o=o.nextElementSibling;for(const[c,l]of i.entries())s.has(c)||n.appendChild(ht(l))}(r,l,h),function(e,t,n,r){const i=new Map;for(const a of e)i.set(a.hash,!1);for(const a of[t,n]){const e=[];let t,n=a.firstElementChild;for(;n;)t=n.getAttribute("cgHash"),i.has(t)?i.set(t,!0):e.push(n),n=n.nextElementSibling;for(const r of e)a.removeChild(r)}for(const a of e.filter((e=>!i.get(e.hash))))for(const e of r(a))e.isCustom?n.appendChild(e.el):t.appendChild(e.el)}(l,t.querySelector("g"),n.querySelector("g"),(t=>function(e,{shape:t,current:n,hash:r},i,a,s){const o=_t(ft(H(t.orig),e.orientation),s),c=t.dest?_t(ft(H(t.dest),e.orientation),s):o,l=t.brush&&vt(i[t.brush],t.modifiers),u=a.get(t.dest),h=[];if(l){const e=gt(mt("g"),{cgHash:r});h.push({el:e}),o[0]!==c[0]||o[1]!==c[1]?e.appendChild(function(e,t,n,r,i,a){var s;function o(s){var o;const c=function(e){return(e?20:10)/64}(a&&!i),l=r[0]-n[0],u=r[1]-n[1],h=Math.atan2(u,l),d=Math.cos(h)*c,f=Math.sin(h)*c;return gt(mt("line"),{stroke:s?ut(t).color:t.color,"stroke-width":yt(t,i)+(s?.04:0),"stroke-linecap":"round","marker-end":`url(#arrowhead-${s?ut(t).key:t.key})`,opacity:(null==(o=e.modifiers)?void 0:o.hilite)?1:bt(t,i),x1:n[0],y1:n[1],x2:r[0]-d,y2:r[1]-f})}if(!(null==(s=e.modifiers)?void 0:s.hilite))return o(!1);const c=mt("g"),l=gt(mt("g"),{filter:"url(#cg-filter-blur)"});return l.appendChild(function(e,t){const 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 gt(mt("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"})}(n,r)),l.appendChild(o(!0)),c.appendChild(l),c.appendChild(o(!1)),c}(t,l,o,c,n,pt(t.dest,a))):e.appendChild(function(e,t,n,r){const i=[3/64,4/64],a=(r.width+r.height)/(4*Math.max(r.width,r.height));return gt(mt("circle"),{stroke:e.color,"stroke-width":i[n?0:1],fill:"none",opacity:bt(e,n),cx:t[0],cy:t[1],r:a-i[1]/2})}(i[t.brush],o,n,s))}if(t.label){const e=t.label;e.fill||t.brush&&i[t.brush]&&(e.fill=i[t.brush].color);const n=t.brush?void 0:"tr";h.push({el:dt(e,r,o,c,u,n),isCustom:!0})}if(t.customSvg){const e=t.customSvg.center??"orig",[n,i]="label"===e?xt(o,c,u).map((e=>e-.5)):"dest"===e?c:o,a=gt(mt("g"),{transform:`translate(${n},${i})`,cgHash:r});a.innerHTML=`<svg width="1" height="1" viewBox="0 0 100 100">${t.customSvg.html}</svg>`,h.push({el:a,isCustom:!0})}return h}(e,t,r.brushes,s,o)))}function ot({orig:e,dest:t,brush:n,piece:r,modifiers:i,customSvg:a,label:s},o,c,l){var u,h;return[l.width,l.height,c,e,t,n,o&&"-",r&&ct(r),i&&(h=i,[h.lineWidth,h.hilite&&"*"].filter((e=>e)).join(",")),a&&`custom-${lt(a.html)},${(null==(u=a.center)?void 0:u[0])??"o"}`,s&&`label-${lt(s.text)}`].filter((e=>e)).join(",")}function ct(e){return[e.color,e.role,e.scale].filter((e=>e)).join(",")}function lt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)>>>0;return t.toString()}function ut(e){return["#ffffff","#fff","white"].includes(e.color)?at.hilitePrimary:at.hiliteWhite}function ht(e){const t=gt(mt("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(gt(mt("path"),{d:"M0,0 V4 L3,2 Z",fill:e.color})),t.setAttribute("cgKey",e.key),t}function dt(e,t,n,r,i,a){const s=.4*.75**e.text.length,o=xt(n,r,i),c="tr"===a?.4:0,l=gt(mt("g"),{transform:`translate(${o[0]+c},${o[1]-c})`,cgHash:t});l.appendChild(gt(mt("circle"),{r:.2,"fill-opacity":a?1:.8,"stroke-opacity":a?1:.7,"stroke-width":.03,fill:e.fill??"#666",stroke:"white"}));const u=gt(mt("text"),{"font-size":s,"font-family":"Noto Sans","text-anchor":"middle",fill:"white",y:.13*.75**e.text.length});return u.innerHTML=e.text,l.appendChild(u),l}function ft(e,t){return"cg-white"===t?e:[7-e[0],7-e[1]]}function pt(e,t){return!0===(e&&t.has(e)&&t.get(e).size>1)}function mt(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function gt(e,t){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.setAttribute(n,t[n]);return e}function vt(e,t){return t?{color:e.color,opacity:Math.round(10*e.opacity)/10,lineWidth:Math.round(t.lineWidth||e.lineWidth),key:[e.key,t.lineWidth].filter((e=>e)).join("")}:e}function yt(e,t){return(e.lineWidth||10)*(t?.85:1)/64}function bt(e,t){return(e.opacity||1)*(t?.9:1)}function _t(e,t){const 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 wt(e,t,n=!0){const r=Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI;return n?(Math.round(8*r/Math.PI)+16)%16:r}function xt(e,t,n){let r=function(e,t){return Math.sqrt([e[0]-t[0],e[1]-t[1]].reduce(((e,t)=>e+t*t),0))}(e,t);const i=wt(e,t,!1);if(n&&(r-=33/64,n.size>1)){r-=10/64;const i=wt(e,t);(n.has((i+1)%16)||n.has((i+15)%16))&&1&i&&(r-=.4)}return[e[0]-Math.cos(i)*r,e[1]-Math.sin(i)*r].map((e=>e+.5))}function kt(e,t){e.innerHTML="",e.classList.add("cg-wrap");for(const c of V)e.classList.toggle("orientation-"+c,t.orientation===c);e.classList.toggle("manipulable",!t.viewOnly);const n=te("cg-container");e.appendChild(n);const r=te("cg-board");let i,a,s,o;if(n.appendChild(r),t.drawable.visible&&(i=gt(mt("svg"),{class:"cg-shapes",viewBox:"-4 -4 8 8",preserveAspectRatio:"xMidYMid slice"}),i.appendChild(function(){const e=mt("defs"),t=gt(mt("filter"),{id:"cg-filter-blur"});return t.appendChild(gt(mt("feGaussianBlur"),{stdDeviation:"0.019"})),e.appendChild(t),e}()),i.appendChild(mt("g")),a=gt(mt("svg"),{class:"cg-custom-svgs",viewBox:"-3.5 -3.5 8 8",preserveAspectRatio:"xMidYMid slice"}),a.appendChild(mt("g")),s=te("cg-auto-pieces"),n.appendChild(i),n.appendChild(a),n.appendChild(s)),t.coordinates){const e="cg-black"===t.orientation?" black":"",r="left"===t.ranksPosition?" left":"";if(t.coordinatesOnSquares){const i="cg-white"===t.orientation?e=>e+1:e=>8-e;R.forEach(((t,a)=>n.appendChild(Ct(F.map((e=>t+e)),"squares rank"+i(a)+e+r))))}else n.appendChild(Ct(F,"ranks"+e+r)),n.appendChild(Ct(R,"files"+e))}return t.draggable.enabled&&t.draggable.showGhost&&(o=te("piece","ghost"),Z(o,!1),n.appendChild(o)),{board:r,container:n,wrap:e,ghost:o,svg:i,customSvg:a,autoPieces:s}}function Ct(e,t){const n=te("coords",t);let r;for(const i of e)r=te("coord"),r.textContent=i,n.appendChild(r);return n}function St(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const Et=e=>t=>{e.draggable.current?et(e):e.drawable.current?Ye(e):t.shiftKey||ee(t)?e.drawable.enabled&&He(e,t):e.viewOnly||(e.dropmode.active?function(e,t){if(!e.dropmode.active)return;ue(e),he(e);const n=e.dropmode.piece;if(n){e.pieces.set("a0",n);const r=J(t),i=r&&Ee(r,Me(e),e.dom.bounds());i&&ge(e,"a0",i)}e.dom.redraw()}(e,t):Qe(e,t))},Mt=(e,t,n)=>r=>{e.drawable.current?e.drawable.enabled&&n(e,r):e.viewOnly||t(e,r)};function Tt(e){const t=Me(e),n=K(e.dom.bounds()),r=e.dom.elements.board,i=e.pieces,a=e.animation.current,s=a?a.plan.anims:new Map,o=a?a.plan.fadings:new Map,c=e.draggable.current,l=function(e){var t,n;const r=new Map;if(e.lastMove&&e.highlight.lastMove)for(const s of e.lastMove)Ot(r,s,"last-move");e.check&&e.highlight.check&&Ot(r,e.check,"check");if(e.selected&&(Ot(r,e.selected,"selected"),e.movable.showDests)){const i=null==(t=e.movable.dests)?void 0:t.get(e.selected);if(i)for(const t of i)Ot(r,t,"move-dest"+(e.pieces.has(t)?" oc":""));const a=(null==(n=e.premovable.customDests)?void 0:n.get(e.selected))??e.premovable.dests;if(a)for(const t of a)Ot(r,t,"premove-dest"+(e.pieces.has(t)?" oc":""))}const i=e.premovable.current;if(i)for(const s of i)Ot(r,s,"current-premove");else e.predroppable.current&&Ot(r,e.predroppable.current.key,"current-premove");const a=e.exploding;if(a)for(const s of a.keys)Ot(r,s,"exploding"+a.stage);e.highlight.custom&&e.highlight.custom.forEach(((e,t)=>{Ot(r,t,e)}));return r}(e),u=new Set,h=new Set,d=new Map,f=new Map;let p,m,g,v,y,b,_,w,x,k;for(m=r.firstChild;m;){if(p=m.cgKey,At(m))if(g=i.get(p),y=s.get(p),b=o.get(p),v=m.cgPiece,!m.cgDragging||c&&c.orig===p||(m.classList.remove("dragging"),Q(m,n(H(p),t)),m.cgDragging=!1),!b&&m.cgFading&&(m.cgFading=!1,m.classList.remove("fading")),g){if(y&&m.cgAnimating&&v===Bt(g)){const e=H(p);e[0]+=y[2],e[1]+=y[3],m.classList.add("anim"),Q(m,n(e,t))}else m.cgAnimating&&(m.cgAnimating=!1,m.classList.remove("anim"),Q(m,n(H(p),t)),e.addPieceZIndex&&(m.style.zIndex=Dt(H(p),t)));v!==Bt(g)||b&&m.cgFading?b&&v===Bt(b)?(m.classList.add("fading"),m.cgFading=!0):Lt(d,v,m):u.add(p)}else Lt(d,v,m);else if(Pt(m)){const e=m.className;l.get(p)===e?h.add(p):Lt(f,e,m)}m=m.nextSibling}for(const[C,S]of l)if(!h.has(C)){x=f.get(S),k=x&&x.pop();const e=n(H(C),t);if(k)k.cgKey=C,Q(k,e);else{const t=te("square",S);t.cgKey=C,Q(t,e),r.insertBefore(t,r.firstChild)}}for(const[C,S]of i)if(y=s.get(C),!u.has(C))if(_=d.get(Bt(S)),w=_&&_.pop(),w){w.cgKey=C,w.cgFading&&(w.classList.remove("fading"),w.cgFading=!1);const r=H(C);e.addPieceZIndex&&(w.style.zIndex=Dt(r,t)),y&&(w.cgAnimating=!0,w.classList.add("anim"),r[0]+=y[2],r[1]+=y[3]),Q(w,n(r,t))}else{const i=Bt(S),a=te("piece",i),s=H(C);a.cgPiece=i,a.cgKey=C,y&&(a.cgAnimating=!0,s[0]+=y[2],s[1]+=y[3]),Q(a,n(s,t)),e.addPieceZIndex&&(a.style.zIndex=Dt(s,t)),r.appendChild(a)}for(const C of d.values())It(e,C);for(const C of f.values())It(e,C)}function Nt(e){var t,n;const r=e.dom.elements.wrap.getBoundingClientRect(),i=e.dom.elements.container,a=r.height/r.width,s=8*Math.floor(r.width*window.devicePixelRatio/8)/window.devicePixelRatio,o=s*a;i.style.width=s+"px",i.style.height=o+"px",e.dom.bounds.clear(),null==(t=e.addDimensionsCssVarsTo)||t.style.setProperty("---cg-width",s+"px"),null==(n=e.addDimensionsCssVarsTo)||n.style.setProperty("---cg-height",o+"px")}const At=e=>"PIECE"===e.tagName,Pt=e=>"SQUARE"===e.tagName;function It(e,t){for(const n of t)e.dom.elements.board.removeChild(n)}function Dt(e,t){const n=e[1];return`${t?10-n:3+n}`}const Bt=e=>`${e.color} ${e.role}`;function Ot(e,t,n){const r=e.get(t);r?e.set(t,`${r} ${n}`):e.set(t,n)}function Lt(e,t,n){const r=e.get(t);r?r.push(n):e.set(t,[n])}function Vt(e,t){!function(e,t,n){const r=new Map,i=[];for(const o of e)r.set(o.hash,!1);let a,s=t.firstElementChild;for(;s;)a=s.getAttribute("cgHash"),r.has(a)?r.set(a,!0):i.push(s),s=s.nextElementSibling;for(const o of i)t.removeChild(o);for(const o of e)r.get(o.hash)||t.appendChild(n(o))}(e.drawable.autoShapes.filter((e=>e.piece)).map((e=>({shape:e,hash:Rt(e),current:!1}))),t,(t=>function(e,{shape:t,hash:n},r){var i,a,s;const o=t.orig,c=null==(i=t.piece)?void 0:i.role,l=null==(a=t.piece)?void 0:a.color,u=null==(s=t.piece)?void 0:s.scale,h=te("piece",`${c} ${l}`);return h.setAttribute("cgHash",n),h.cgKey=o,h.cgScale=u,X(h,K(r)(H(o),Me(e)),u),h}(e,t,e.dom.bounds())))}const Rt=e=>{var t,n,r;return[e.orig,null==(t=e.piece)?void 0:t.role,null==(n=e.piece)?void 0:n.color,null==(r=e.piece)?void 0:r.scale].join(",")};function Ft(e,t){const n={pieces:Pe(Te),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:G()};function r(){const t="dom"in n?n.dom.unbind:void 0,r=kt(e,n),i=function(e){let t;const n=()=>(void 0===t&&(t=e()),t);return n.clear=()=>{t=void 0},n}((()=>r.board.getBoundingClientRect())),a=e=>{Tt(s),r.autoPieces&&Vt(s,r.autoPieces),!e&&r.svg&&st(s,r.svg,r.customSvg)},s=n;return s.dom={elements:r,bounds:i,redraw:zt(a),redrawNow:a,unbind:t},s.drawable.prevSvgHash="",Nt(s),a(!1),function(e){const t=e.dom.elements.board;if((e.disableContextMenu||e.drawable.enabled)&&t.addEventListener("contextmenu",(e=>e.preventDefault())),e.viewOnly)return;const n=Et(e);t.addEventListener("touchstart",n,{passive:!1}),t.addEventListener("mousedown",n,{passive:!1})}(s),t||(s.dom.unbind=function(e,t){const n=[];if("ResizeObserver"in window||n.push(St(document.body,"chessground.resize",t)),!e.viewOnly){const t=Mt(e,Ze,Ge),r=Mt(e,Je,We);for(const e of["touchmove","mousemove"])n.push(St(document,e,t));for(const e of["touchend","mouseup"])n.push(St(document,e,r));const i=()=>e.dom.bounds.clear();n.push(St(document,"scroll",i,{capture:!0,passive:!0})),n.push(St(window,"resize",i,{passive:!0}))}return()=>n.forEach((e=>e()))}(s,(()=>{Nt(s),function(e){const t=Me(e),n=K(e.dom.bounds());let r=e.dom.elements.board.firstChild;for(;r;)(At(r)&&!r.cgAnimating||Pt(r))&&Q(r,n(H(r.cgKey),t)),r=r.nextSibling}(s),r.autoPieces&&function(e){var t;const n=Me(e),r=K(e.dom.bounds());let i=null==(t=e.dom.elements.autoPieces)?void 0:t.firstChild;for(;i;)X(i,r(H(i.cgKey),n),i.cgScale),i=i.nextSibling}(s)}))),s.events.insert&&s.events.insert(r),s}return De(n,t||{}),it(r(),r)}function zt(e){let t=!1;return()=>{t||(t=!0,requestAnimationFrame((()=>{e(),t=!1})))}}
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright (c) 2025, Jeff Hlywa (jhlywa@gmail.com)
|
|
13
|
+
* All rights reserved.
|
|
14
|
+
*
|
|
15
|
+
* Redistribution and use in source and binary forms, with or without
|
|
16
|
+
* modification, are permitted provided that the following conditions are met:
|
|
17
|
+
*
|
|
18
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
|
19
|
+
* this list of conditions and the following disclaimer.
|
|
20
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
21
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
22
|
+
* and/or other materials provided with the distribution.
|
|
23
|
+
*
|
|
24
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
27
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
28
|
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
29
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
30
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
31
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
32
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
33
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
34
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
*/const jt="w",qt="b",Ht="p",Ut="b",Gt="r",Wt="q",Yt="k",$t="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";class Move{constructor(e,t){u(this,"color"),u(this,"from"),u(this,"to"),u(this,"piece"),u(this,"captured"),u(this,"promotion"),u(this,"flags"),u(this,"san"),u(this,"lan"),u(this,"before"),u(this,"after");const{color:n,piece:r,from:i,to:a,flags:s,captured:o,promotion:c}=t,l=pn(i),h=pn(a);this.color=n,this.piece=r,this.from=l,this.to=h,this.san=e._moveToSan(t,e._moves({legal:!0})),this.lan=l+h,this.before=e.fen(),e._makeMove(t),this.after=e.fen(),e._undoMove(),this.flags="";for(const u in Zt)Zt[u]&s&&(this.flags+=Qt[u]);o&&(this.captured=o),c&&(this.promotion=c,this.lan+=c)}isCapture(){return this.flags.indexOf(Qt.CAPTURE)>-1}isPromotion(){return this.flags.indexOf(Qt.PROMOTION)>-1}isEnPassant(){return this.flags.indexOf(Qt.EP_CAPTURE)>-1}isKingsideCastle(){return this.flags.indexOf(Qt.KSIDE_CASTLE)>-1}isQueensideCastle(){return this.flags.indexOf(Qt.QSIDE_CASTLE)>-1}isBigPawn(){return this.flags.indexOf(Qt.BIG_PAWN)>-1}}const Kt=-1,Qt={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},Xt=["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"],Zt={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},Jt={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},en={b:[16,32,17,15],w:[-16,-32,-17,-15]},tn={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]},nn=[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],rn=[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],an={p:1,n:2,b:4,r:8,q:16,k:32},sn=["n",Ut,Gt,Wt],on={[Yt]:Zt.KSIDE_CASTLE,[Wt]:Zt.QSIDE_CASTLE},cn={w:[{square:Jt.a1,flag:Zt.QSIDE_CASTLE},{square:Jt.h1,flag:Zt.KSIDE_CASTLE}],b:[{square:Jt.a8,flag:Zt.QSIDE_CASTLE},{square:Jt.h8,flag:Zt.KSIDE_CASTLE}]},ln={b:1,w:6},un=["1-0","0-1","1/2-1/2","*"];function hn(e){return e>>4}function dn(e){return 15&e}function fn(e){return-1!=="0123456789".indexOf(e)}function pn(e){const t=dn(e),n=hn(e);return"abcdefgh".substring(t,t+1)+"87654321".substring(n,n+1)}function mn(e){return e===jt?qt:jt}function gn(e,t,n,r,i,a=void 0,s=Zt.NORMAL){const o=hn(r);if(i!==Ht||7!==o&&0!==o)e.push({color:t,from:n,to:r,piece:i,captured:a,flags:s});else for(let c=0;c<sn.length;c++){const o=sn[c];e.push({color:t,from:n,to:r,piece:i,captured:a,promotion:o,flags:s|Zt.PROMOTION})}}function vn(e){let t=e.charAt(0);if(t>="a"&&t<="h"){if(e.match(/[a-h]\d.*[a-h]\d/))return;return Ht}return t=t.toLowerCase(),"o"===t?Yt:t}function yn(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function bn(e){return e.split(" ").slice(0,4).join(" ")}class Chess{constructor(e=$t,{skipValidation:t=!1}={}){u(this,"_board",new Array(128)),u(this,"_turn",jt),u(this,"_header",{}),u(this,"_kings",{w:Kt,b:Kt}),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=new Array(128),this._kings={w:Kt,b:Kt},this._turn=jt,this._castling={w:0,b:0},this._epSquare=Kt,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){const t=["-","-","0","1"];e=r.concat(t.slice(-(6-r.length))).join(" ")}if(r=e.split(/\s+/),!t){const{ok:t,error:n}=function(e){const t=e.split(/\s+/);if(6!==t.length)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};const n=parseInt(t[5],10);if(isNaN(n)||n<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};const 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"};const i=t[0].split("/");if(8!==i.length)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let s=0;s<i.length;s++){let e=0,t=!1;for(let n=0;n<i[s].length;n++)if(fn(i[s][n])){if(t)return{ok:!1,error:"Invalid FEN: piece data is invalid (consecutive number)"};e+=parseInt(i[s][n],10),t=!0}else{if(!/^[prnbqkPRNBQK]$/.test(i[s][n]))return{ok:!1,error:"Invalid FEN: piece data is invalid (invalid piece)"};e+=1,t=!1}if(8!==e)return{ok:!1,error:"Invalid FEN: piece data is invalid (too many squares in rank)"}}if("3"==t[3][1]&&"w"==t[1]||"6"==t[3][1]&&"b"==t[1])return{ok:!1,error:"Invalid FEN: illegal en-passant square"};const a=[{color:"white",regex:/K/g},{color:"black",regex:/k/g}];for(const{color:s,regex:o}of a){if(!o.test(t[0]))return{ok:!1,error:`Invalid FEN: missing ${s} king`};if((t[0].match(o)||[]).length>1)return{ok:!1,error:`Invalid FEN: too many ${s} kings`}}return Array.from(i[0]+i[7]).some((e=>"P"===e.toUpperCase()))?{ok:!1,error:"Invalid FEN: some pawns are on the edge rows"}:{ok:!0}}(e);if(!t)throw new Error(n)}const i=r[0];let a=0;this.clear({preserveHeaders:n});for(let s=0;s<i.length;s++){const e=i.charAt(s);if("/"===e)a+=8;else if(fn(e))a+=parseInt(e,10);else{const t=e<"a"?jt:qt;this._put({type:e.toLowerCase(),color:t},pn(a)),a++}}this._turn=r[1],r[2].indexOf("K")>-1&&(this._castling.w|=Zt.KSIDE_CASTLE),r[2].indexOf("Q")>-1&&(this._castling.w|=Zt.QSIDE_CASTLE),r[2].indexOf("k")>-1&&(this._castling.b|=Zt.KSIDE_CASTLE),r[2].indexOf("q")>-1&&(this._castling.b|=Zt.QSIDE_CASTLE),this._epSquare="-"===r[3]?Kt:Jt[r[3]],this._halfMoves=parseInt(r[4],10),this._moveNumber=parseInt(r[5],10),this._updateSetup(e),this._incPositionCount(e)}fen(){var e,t;let n=0,r="";for(let s=Jt.a8;s<=Jt.h1;s++){if(this._board[s]){n>0&&(r+=n,n=0);const{color:e,type:t}=this._board[s];r+=e===jt?t.toUpperCase():t.toLowerCase()}else n++;s+1&136&&(n>0&&(r+=n),s!==Jt.h1&&(r+="/"),n=0,s+=8)}let i="";this._castling[jt]&Zt.KSIDE_CASTLE&&(i+="K"),this._castling[jt]&Zt.QSIDE_CASTLE&&(i+="Q"),this._castling[qt]&Zt.KSIDE_CASTLE&&(i+="k"),this._castling[qt]&Zt.QSIDE_CASTLE&&(i+="q"),i=i||"-";let a="-";if(this._epSquare!==Kt){const n=this._epSquare+(this._turn===jt?16:-16),r=[n+1,n-1];for(const i of r){if(136&i)continue;const n=this._turn;if((null==(e=this._board[i])?void 0:e.color)===n&&(null==(t=this._board[i])?void 0:t.type)===Ht){this._makeMove({color:n,from:i,to:this._epSquare,piece:Ht,captured:Ht,flags:Zt.EP_CAPTURE});const e=!this._isKingAttacked(n);if(this._undoMove(),e){a=pn(this._epSquare);break}}}}return[r,this._turn,i,a,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(e){this._history.length>0||(e!==$t?(this._header.SetUp="1",this._header.FEN=e):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load($t)}get(e){return this._board[Jt[e]]}put({type:e,color:t},n){return!!this._put({type:e,color:t},n)&&(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0)}_put({type:e,color:t},n){if(-1==="pnbrqkPNBRQK".indexOf(e.toLowerCase()))return!1;if(!(n in Jt))return!1;const r=Jt[n];if(e==Yt&&this._kings[t]!=Kt&&this._kings[t]!=r)return!1;const i=this._board[r];return i&&i.type===Yt&&(this._kings[i.color]=Kt),this._board[r]={type:e,color:t},e===Yt&&(this._kings[t]=r),!0}remove(e){const t=this.get(e);return delete this._board[Jt[e]],t&&t.type===Yt&&(this._kings[t.color]=Kt),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),t}_updateCastlingRights(){var e,t,n,r,i,a,s,o,c,l,u,h;const d=(null==(e=this._board[Jt.e1])?void 0:e.type)===Yt&&(null==(t=this._board[Jt.e1])?void 0:t.color)===jt,f=(null==(n=this._board[Jt.e8])?void 0:n.type)===Yt&&(null==(r=this._board[Jt.e8])?void 0:r.color)===qt;d&&(null==(i=this._board[Jt.a1])?void 0:i.type)===Gt&&(null==(a=this._board[Jt.a1])?void 0:a.color)===jt||(this._castling.w&=-65),d&&(null==(s=this._board[Jt.h1])?void 0:s.type)===Gt&&(null==(o=this._board[Jt.h1])?void 0:o.color)===jt||(this._castling.w&=-33),f&&(null==(c=this._board[Jt.a8])?void 0:c.type)===Gt&&(null==(l=this._board[Jt.a8])?void 0:l.color)===qt||(this._castling.b&=-65),f&&(null==(u=this._board[Jt.h8])?void 0:u.type)===Gt&&(null==(h=this._board[Jt.h8])?void 0:h.color)===qt||(this._castling.b&=-33)}_updateEnPassantSquare(){var e,t;if(this._epSquare===Kt)return;const n=this._epSquare+(this._turn===jt?-16:16),r=this._epSquare+(this._turn===jt?16:-16),i=[r+1,r-1];if(null!==this._board[n]||null!==this._board[this._epSquare]||(null==(e=this._board[r])?void 0:e.color)!==mn(this._turn)||(null==(t=this._board[r])?void 0:t.type)!==Ht)return void(this._epSquare=Kt);i.some((e=>{var t,n;return!(136&e)&&(null==(t=this._board[e])?void 0:t.color)===this._turn&&(null==(n=this._board[e])?void 0:n.type)===Ht}))||(this._epSquare=Kt)}_attacked(e,t,n){const r=[];for(let i=Jt.a8;i<=Jt.h1;i++){if(136&i){i+=7;continue}if(void 0===this._board[i]||this._board[i].color!==e)continue;const a=this._board[i],s=i-t;if(0===s)continue;const o=s+119;if(nn[o]&an[a.type]){if(a.type===Ht){if(s>0&&a.color===jt||s<=0&&a.color===qt){if(!n)return!0;r.push(pn(i))}continue}if("n"===a.type||"k"===a.type){if(n){r.push(pn(i));continue}return!0}const e=rn[o];let c=i+e,l=!1;for(;c!==t;){if(null!=this._board[c]){l=!0;break}c+=e}if(!l){if(n){r.push(pn(i));continue}return!0}}}return!!n&&r}attackers(e,t){return t?this._attacked(t,Jt[e],!0):this._attacked(this._turn,Jt[e],!0)}_isKingAttacked(e){const t=this._kings[e];return-1!==t&&this._attacked(mn(e),t)}isAttacked(e,t){return this._attacked(t,Jt[e])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&0===this._moves().length}isStalemate(){return!this.isCheck()&&0===this._moves().length}isInsufficientMaterial(){const e={b:0,n:0,r:0,q:0,k:0,p:0},t=[];let n=0,r=0;for(let i=Jt.a8;i<=Jt.h1;i++){if(r=(r+1)%2,136&i){i+=7;continue}const a=this._board[i];a&&(e[a.type]=a.type in e?e[a.type]+1:1,a.type===Ut&&t.push(r),n++)}if(2===n)return!0;if(3===n&&(1===e[Ut]||1===e.n))return!0;if(n===e[Ut]+2){let e=0;const n=t.length;for(let r=0;r<n;r++)e+=t[r];if(0===e||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,piece:n}={}){const 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,square:n}={}){var r;const i=n?n.toLowerCase():void 0,a=null==t?void 0:t.toLowerCase(),s=[],o=this._turn,c=mn(o);let l=Jt.a8,u=Jt.h1,h=!1;if(i){if(!(i in Jt))return[];l=u=Jt[i],h=!0}for(let f=l;f<=u;f++){if(136&f){f+=7;continue}if(!this._board[f]||this._board[f].color===c)continue;const{type:e}=this._board[f];let t;if(e===Ht){if(a&&a!==e)continue;t=f+en[o][0],this._board[t]||(gn(s,o,f,t,Ht),t=f+en[o][1],ln[o]!==hn(f)||this._board[t]||gn(s,o,f,t,Ht,void 0,Zt.BIG_PAWN));for(let e=2;e<4;e++)t=f+en[o][e],136&t||((null==(r=this._board[t])?void 0:r.color)===c?gn(s,o,f,t,Ht,this._board[t].type,Zt.CAPTURE):t===this._epSquare&&gn(s,o,f,t,Ht,Ht,Zt.EP_CAPTURE))}else{if(a&&a!==e)continue;for(let n=0,r=tn[e].length;n<r;n++){const r=tn[e][n];for(t=f;t+=r,!(136&t);){if(this._board[t]){if(this._board[t].color===o)break;gn(s,o,f,t,e,this._board[t].type,Zt.CAPTURE);break}if(gn(s,o,f,t,e),"n"===e||e===Yt)break}}}}if(!(void 0!==a&&a!==Yt||h&&u!==this._kings[o])){if(this._castling[o]&Zt.KSIDE_CASTLE){const e=this._kings[o],t=e+2;this._board[e+1]||this._board[t]||this._attacked(c,this._kings[o])||this._attacked(c,e+1)||this._attacked(c,t)||gn(s,o,this._kings[o],t,Yt,void 0,Zt.KSIDE_CASTLE)}if(this._castling[o]&Zt.QSIDE_CASTLE){const e=this._kings[o],t=e-2;this._board[e-1]||this._board[e-2]||this._board[e-3]||this._attacked(c,this._kings[o])||this._attacked(c,e-1)||this._attacked(c,t)||gn(s,o,this._kings[o],t,Yt,void 0,Zt.QSIDE_CASTLE)}}if(!e||-1===this._kings[o])return s;const d=[];for(let f=0,p=s.length;f<p;f++)this._makeMove(s[f]),this._isKingAttacked(o)||d.push(s[f]),this._undoMove();return d}move(e,{strict:t=!1}={}){let n=null;if("string"==typeof e)n=this._moveFromSan(e,t);else if("object"==typeof e){const t=this._moves();for(let r=0,i=t.length;r<i;r++)if(e.from===pn(t[r].from)&&e.to===pn(t[r].to)&&(!("promotion"in t[r])||e.promotion===t[r].promotion)){n=t[r];break}}if(!n)throw"string"==typeof e?new Error(`Invalid move: ${e}`):new Error(`Invalid move: ${JSON.stringify(e)}`);const 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){const t=this._turn,n=mn(t);if(this._push(e),this._board[e.to]=this._board[e.from],delete this._board[e.from],e.flags&Zt.EP_CAPTURE&&(this._turn===qt?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===Yt){if(this._kings[t]=e.to,e.flags&Zt.KSIDE_CASTLE){const t=e.to-1,n=e.to+1;this._board[t]=this._board[n],delete this._board[n]}else if(e.flags&Zt.QSIDE_CASTLE){const 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 r=0,i=cn[t].length;r<i;r++)if(e.from===cn[t][r].square&&this._castling[t]&cn[t][r].flag){this._castling[t]^=cn[t][r].flag;break}if(this._castling[n])for(let r=0,i=cn[n].length;r<i;r++)if(e.to===cn[n][r].square&&this._castling[n]&cn[n][r].flag){this._castling[n]^=cn[n][r].flag;break}e.flags&Zt.BIG_PAWN?this._epSquare=t===qt?e.to-16:e.to+16:this._epSquare=Kt,e.piece===Ht||e.flags&(Zt.CAPTURE|Zt.EP_CAPTURE)?this._halfMoves=0:this._halfMoves++,t===qt&&this._moveNumber++,this._turn=n}undo(){const e=this._undoMove();if(e){const t=new Move(this,e);return this._decPositionCount(t.after),t}return null}_undoMove(){const e=this._history.pop();if(void 0===e)return null;const t=e.move;this._kings=e.kings,this._turn=e.turn,this._castling=e.castling,this._epSquare=e.epSquare,this._halfMoves=e.halfMoves,this._moveNumber=e.moveNumber;const n=this._turn,r=mn(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&Zt.EP_CAPTURE){let e;e=n===qt?t.to-16:t.to+16,this._board[e]={type:Ht,color:r}}else this._board[t.to]={type:t.captured,color:r};if(t.flags&(Zt.KSIDE_CASTLE|Zt.QSIDE_CASTLE)){let e,n;t.flags&Zt.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="\n",maxWidth:t=0}={}){const n=[];let r=!1;for(const h in this._header)n.push("["+h+' "'+this._header[h]+'"]'+e),r=!0;r&&this._history.length&&n.push(e);const i=e=>{const t=this._comments[this.fen()];if(void 0!==t){e=`${e}${e.length>0?" ":""}{${t}}`}return e},a=[];for(;this._history.length>0;)a.push(this._undoMove());const s=[];let o="";for(0===a.length&&s.push(i(""));a.length>0;){o=i(o);const e=a.pop();if(!e)break;if(this._history.length||"b"!==e.color)"w"===e.color&&(o.length&&s.push(o),o=this._moveNumber+".");else{const e=`${this._moveNumber}. ...`;o=o?`${o} ${e}`:e}o=o+" "+this._moveToSan(e,this._moves({legal:!0})),this._makeMove(e)}if(o.length&&s.push(i(o)),void 0!==this._header.Result&&s.push(this._header.Result),0===t)return n.join("")+s.join(" ");const c=function(){return n.length>0&&" "===n[n.length-1]&&(n.pop(),!0)},l=function(r,i){for(const a of i.split(" "))if(a){if(r+a.length>t){for(;c();)r--;n.push(e),r=0}n.push(a),r+=a.length,n.push(" "),r++}return c()&&r--,r};let u=0;for(let h=0;h<s.length;h++)u+s[h].length>t&&s[h].includes("{")?u=l(u,s[h]):(u+s[h].length>t&&0!==h?(" "===n[n.length-1]&&n.pop(),n.push(e),u=0):0!==h&&(n.push(" "),u++),n.push(s[h]),u+=s[h].length);return n.join("")}header(...e){for(let t=0;t<e.length;t+=2)"string"==typeof e[t]&&"string"==typeof e[t+1]&&(this._header[e[t]]=e[t+1]);return this._header}setHeader(e,t){return this._header[e]=t,this._header}removeHeader(e){return e in this._header&&(delete this._header[e],!0)}getHeaders(){return this._header}loadPgn(e,{strict:t=!1,newlineChar:n="\r?\n"}={}){function r(e){return e.replace(/\\/g,"\\")}e=e.trim();const i=new RegExp("^(\\[((?:"+r(n)+")|.)*\\])((?:\\s*"+r(n)+"){2}|(?:\\s*"+r(n)+")*$)").exec(e),a=i&&i.length>=2?i[1]:"";this.reset();const s=function(e){const t={},i=e.split(new RegExp(r(n)));let a="",s="";for(let n=0;n<i.length;n++){const e=/^\s*\[\s*([A-Za-z]+)\s*"(.*)"\s*\]\s*$/;a=i[n].replace(e,"$1"),s=i[n].replace(e,"$2"),a.trim().length>0&&(t[a]=s)}return t}(a);let o="";for(const p in s)"fen"===p.toLowerCase()&&(o=s[p]),this.header(p,s[p]);if(t){if("1"===s.SetUp){if(!("FEN"in s))throw new Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(s.FEN,{preserveHeaders:!0})}}else o&&this.load(o,{preserveHeaders:!0});const c=function(e){return`{${function(e){return Array.from(e).map((function(e){return e.charCodeAt(0)<128?e.charCodeAt(0).toString(16):encodeURIComponent(e).replace(/%/g,"").toLowerCase()})).join("")}((e=e.replace(new RegExp(r(n),"g")," ")).slice(1,e.length-1))}}`},l=function(e){if(e.startsWith("{")&&e.endsWith("}"))return function(e){return 0==e.length?"":decodeURIComponent("%"+(e.match(/.{1,2}/g)||[]).join("%"))}(e.slice(1,e.length-1))};let u=e.replace(a,"").replace(new RegExp(`({[^}]*})+?|;([^${r(n)}]*)`,"g"),(function(e,t,n){return void 0!==t?c(t):" "+c(`{${n.slice(1)}}`)})).replace(new RegExp(r(n),"g")," ");const h=/(\([^()]+\))+?/g;for(;h.test(u);)u=u.replace(h,"");u=u.replace(/\d+\.(\.\.)?/g,""),u=u.replace(/\.\.\./g,""),u=u.replace(/\$\d+/g,"");let d=u.trim().split(new RegExp(/\s+/));d=d.filter((e=>""!==e));let f="";for(let p=0;p<d.length;p++){const e=l(d[p]);if(void 0!==e){this._comments[this.fen()]=e;continue}const n=this._moveFromSan(d[p],t);if(null==n){if(!(un.indexOf(d[p])>-1))throw new Error(`Invalid move in PGN: ${d[p]}`);f=d[p]}else f="",this._makeMove(n),this._incPositionCount(this.fen())}f&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",f)}_moveToSan(e,t){let n="";if(e.flags&Zt.KSIDE_CASTLE)n="O-O";else if(e.flags&Zt.QSIDE_CASTLE)n="O-O-O";else{if(e.piece!==Ht){const r=function(e,t){const n=e.from,r=e.to,i=e.piece;let a=0,s=0,o=0;for(let c=0,l=t.length;c<l;c++){const e=t[c].from,l=t[c].to;i===t[c].piece&&n!==e&&r===l&&(a++,hn(n)===hn(e)&&s++,dn(n)===dn(e)&&o++)}return a>0?s>0&&o>0?pn(n):o>0?pn(n).charAt(1):pn(n).charAt(0):""}(e,t);n+=e.piece.toUpperCase()+r}e.flags&(Zt.CAPTURE|Zt.EP_CAPTURE)&&(e.piece===Ht&&(n+=pn(e.from)[0]),n+="x"),n+=pn(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){const n=yn(e);let r,i,a,s,o,c=vn(n),l=this._moves({legal:!0,piece:c});for(let h=0,d=l.length;h<d;h++)if(n===yn(this._moveToSan(l[h],l)))return l[h];if(t)return null;let u=!1;if(i=n.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/),i?(r=i[1],a=i[2],s=i[3],o=i[4],1==a.length&&(u=!0)):(i=n.match(/([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/),i&&(r=i[1],a=i[2],s=i[3],o=i[4],1==a.length&&(u=!0))),c=vn(n),l=this._moves({legal:!0,piece:r||c}),!s)return null;for(let h=0,d=l.length;h<d;h++)if(a){if(!(r&&r.toLowerCase()!=l[h].piece||Jt[a]!=l[h].from||Jt[s]!=l[h].to||o&&o.toLowerCase()!=l[h].promotion))return l[h];if(u){const e=pn(l[h].from);if(!(r&&r.toLowerCase()!=l[h].piece||Jt[s]!=l[h].to||a!=e[0]&&a!=e[1]||o&&o.toLowerCase()!=l[h].promotion))return l[h]}}else if(n===yn(this._moveToSan(l[h],l)).replace("x",""))return l[h];return null}ascii(){let e=" +------------------------+\n";for(let t=Jt.a8;t<=Jt.h1;t++){if(0===dn(t)&&(e+=" "+"87654321"[hn(t)]+" |"),this._board[t]){const n=this._board[t].type;e+=" "+(this._board[t].color===jt?n.toUpperCase():n.toLowerCase())+" "}else e+=" . ";t+1&136&&(e+="|\n",t+=8)}return e+=" +------------------------+\n",e+=" a b c d e f g h",e}perft(e){const t=this._moves({legal:!1});let n=0;const r=this._turn;for(let i=0,a=t.length;i<a;i++)this._makeMove(t[i]),this._isKingAttacked(r)||(e-1>0?n+=this.perft(e-1):n++),this._undoMove();return n}turn(){return this._turn}board(){const e=[];let t=[];for(let n=Jt.a8;n<=Jt.h1;n++)null==this._board[n]?t.push(null):t.push({square:pn(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 Jt){const t=Jt[e];return(hn(t)+dn(t))%2==0?"light":"dark"}return null}history({verbose:e=!1}={}){const t=[],n=[];for(;this._history.length>0;)t.push(this._undoMove());for(;;){const 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){const t=bn(e);return this._positionCount[t]||0}_incPositionCount(e){const t=bn(e);void 0===this._positionCount[t]&&(this._positionCount[t]=0),this._positionCount[t]+=1}_decPositionCount(e){const t=bn(e);1===this._positionCount[t]?delete this._positionCount[t]:this._positionCount[t]-=1}_pruneComments(){const e=[],t={},n=e=>{e in this._comments&&(t[e]=this._comments[e])};for(;this._history.length>0;)e.push(this._undoMove());for(n(this.fen());;){const t=e.pop();if(!t)break;this._makeMove(t),n(this.fen())}this._comments=t}getComment(){return this._comments[this.fen()]}setComment(e){this._comments[this.fen()]=e.replace("{","[").replace("}","]")}deleteComment(){return this.removeComment()}removeComment(){const e=this._comments[this.fen()];return delete this._comments[this.fen()],e}getComments(){return this._pruneComments(),Object.keys(this._comments).map((e=>({fen:e,comment:this._comments[e]})))}deleteComments(){return this.removeComments()}removeComments(){return this._pruneComments(),Object.keys(this._comments).map((e=>{const t=this._comments[e];return delete this._comments[e],{fen:e,comment:t}}))}setCastlingRights(e,t){for(const r of[Yt,Wt])void 0!==t[r]&&(t[r]?this._castling[e]|=on[r]:this._castling[e]&=~on[r]);this._updateCastlingRights();const n=this.getCastlingRights(e);return!(void 0!==t[Yt]&&t[Yt]!==n[Yt]||void 0!==t[Wt]&&t[Wt]!==n[Wt])}getCastlingRights(e){return{[Yt]:!!(this._castling[e]&on[Yt]),[Wt]:!!(this._castling[e]&on[Wt])}}moveNumber(){return this._moveNumber}}const _n=e=>{const t=new Map;return Xt.forEach((n=>{const r=e.moves({square:n,verbose:!0});r.length&&t.set(n,r.map((e=>e.to)))})),t},wn=e=>"w"===e.turn()?"cg-white":"cg-black",xn=t.defineComponent({name:"PuzzleView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"PuzzleView"),a=n.useQuestionView(i),s=t.ref(null),o=t.ref(),c=t.ref(),l=t.ref("cg-white"),u=t.ref(!1),h=t.ref(null),d=t.computed((()=>{const e=["a","b","c","d","e","f","g","h"];return"cg-white"===l.value?e:e.reverse()})),f=e=>!!e&&["q","r","b","n"].includes(e),p=()=>{o.value&&c.value&&c.value.set({fen:o.value.fen(),turnColor:wn(o.value),movable:{color:wn(o.value),dests:_n(o.value)}})},m=(e,t,n)=>{var r,i,s,c,l;if(!(null==(r=a.question.value)?void 0:r.moves.length))throw new Error("No moves");if(((e,t,n)=>{var r;if(f(n))return!1;const i=null==(r=o.value)?void 0:r.get(e);return"p"===(null==i?void 0:i.type)&&("8"===t[1]||"1"===t[1])})(e,t,n))return h.value={from:e,to:t},void(u.value=!0);a.question.value.moves[0]===(f(n)?`${e}${t}${n}`:`${e}${t}`)?(null==(i=o.value)||i.move({from:e,to:t,promotion:f(n)?n:void 0}),p(),a.question.value.moves.shift(),0===a.question.value.moves.length?a.submitAnswer(""):window.setTimeout((()=>{var e;if(!a.question.value)return;const t=(e=>{if(e.length<4||e.length>5)throw new Error(`Invalid UCI move format: ${e}`);return{from:e.substring(0,2),to:e.substring(2,4),promotion:5===e.length?e[4]:void 0}})(a.question.value.moves.shift());null==(e=o.value)||e.move(t),p()}),300)):(null==(s=o.value)||s.move({from:e,to:t,promotion:n}),(null==(c=o.value)?void 0:c.isCheckmate())?a.submitAnswer(Bn.CHECKMATE):null==(l=o.value)||l.undo(),a.submitAnswer(e+t+n),p())};return t.onMounted((()=>{if(!s.value)return;a.question.value=new Bn(e.data),o.value=new Chess(a.question.value.fen),l.value="cg-white"===wn(o.value)?"cg-black":"cg-white",c.value=Ft(s.value,{movable:{free:!1,showDests:!0,dests:_n(o.value),events:{after:m}},draggable:{showGhost:!0},fen:o.value.fen(),orientation:l.value,coordinates:!1,animation:{duration:300,enabled:!0}});const t=a.question.value.moves.shift();c.value.move(t.substring(0,2),t.substring(2)),o.value.move({from:t.substring(0,2),to:t.substring(2)}),p()})),t.onUnmounted((()=>{var e;null==(e=c.value)||e.destroy(),o.value=void 0})),{boardElement:s,playerColor:l,files:d,showPromotionDialog:u,promotionPieces:[{value:"q",name:"Queen",whiteSymbol:"♕",blackSymbol:"♛"},{value:"r",name:"Rook",whiteSymbol:"♖",blackSymbol:"♜"},{value:"b",name:"Bishop",whiteSymbol:"♗",blackSymbol:"♝"},{value:"n",name:"Knight",whiteSymbol:"♘",blackSymbol:"♞"}],handlePromotion:e=>{"q"===e||"r"===e||"b"===e||"n"===e?h.value&&(i.logger.log(`promoting to ${e}`),u.value=!1,m(h.value.from,h.value.to,e)):i.logger.error(`Invalid promotion piece: ${e}`)},...i,...a}}}),kn={"data-viewable":"PuzzleView"},Cn={class:"text-h5"},Sn={class:"puzzle-board-wrapper"},En={class:"puzzle-ranks-labels"},Mn={class:"puzzle-board-and-files"},Tn={id:"cg",ref:"boardElement"},Nn={class:"puzzle-files-labels"},An={key:0,class:"puzzle-promotion-dialog"},Pn=["onClick"];const In=E(xn,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",kn,[t.createElementVNode("p",Cn," Make the best move for "+t.toDisplayString("cg-white"===e.playerColor?"White ♖♘♗♕♔♗♘♖":"Black ♜♞♝♚♛♝♞♜")+": ",1),t.createElementVNode("div",Sn,[t.createElementVNode("div",En,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(8,(n=>t.createElementVNode("div",{key:n},t.toDisplayString("cg-white"===e.playerColor?9-n:n),1))),64))]),t.createElementVNode("div",Mn,[t.createElementVNode("div",Tn,null,512),t.createElementVNode("div",Nn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.files,(e=>(t.openBlock(),t.createElementBlock("div",{key:e},t.toDisplayString(e),1)))),128))])])]),e.showPromotionDialog?(t.openBlock(),t.createElementBlock("div",An,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.promotionPieces,(n=>(t.openBlock(),t.createElementBlock("button",{key:n.value,onClick:t=>e.handlePromotion(n.value)},t.toDisplayString("cg-white"===e.playerColor?n.whiteSymbol:n.blackSymbol)+" "+t.toDisplayString(n.name),9,Pn)))),128))])):t.createCommentVNode("",!0)])}]]),Dn=class _ChessPuzzle2 extends n.Question{constructor(e){super(e),u(this,"fen"),u(this,"id"),u(this,"moves"),u(this,"rating"),u(this,"themes"),u(this,"checkMove",((e,t)=>(alert("checkMove"),console.log("checkMove",e,t),console.log("this.moves[0]",this.moves[0]),this.moves[0]===t)));const[t,n,r,i,,,,a]=e[0].puzzleData.split(",");this.id=t,this.fen=n,this.moves=r.split(" "),this.rating=parseInt(i,10),this.themes=a.split(" ")}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}displayedSkill(e,t){return this.isCorrect(e)?t<5e3?1:1-Math.min(1,(t-5e3)/1e4):0}dataShapes(){return _ChessPuzzle2.dataShapes}views(){return _ChessPuzzle2.views}isCorrect(e){const t=0===this.moves.length;return e===_ChessPuzzle2.CHECKMATE||t}};u(Dn,"dataShapes",[{name:r.DataShapeName.CHESS_puzzle,fields:[{name:"puzzleData",type:r.FieldType.CHESS_PUZZLE,validator:{instructions:"insert a valid fen string",test:function(e){if(console.log(`running puzzle validator on ${e}`),!e)return{status:r.Status.error,msg:"no defined input"};return 10!=e.split(",").length?{status:r.Status.error,msg:"puzzleData must have 8 comma-separated fields"}:{status:r.Status.ok,msg:""}}},tagger:()=>["test"]}]}]),u(Dn,"views",[In]),u(Dn,"acceptsUserData",!0),u(Dn,"CHECKMATE","CHECKMATE");let Bn=Dn;const On=new Course("chess",[Bn]),Ln=t.defineComponent({name:"AudioParseView",components:{AudioAutoPlayer:n.AudioAutoPlayer},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"AudioParseView"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new zn(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{o.value}}}}),Vn={"data-viewable":"AudioParseView"};const Rn=E(Ln,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("AudioAutoPlayer");return t.openBlock(),t.createElementBlock("div",Vn,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(o,{src:e.getURL("audio")},null,8,["src"]),n[0]||(n[0]=t.createElementVNode("br",null,null,-1)),n[1]||(n[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" "+t.toDisplayString(e.question.text),1)],64)):t.createCommentVNode("",!0)])}]]),Fn=class _AudioParsingQuestion2 extends n.Question{constructor(e){super(e),u(this,"audio"),u(this,"text"),this.audio=e[0].audio,this.text=e[0].text}isCorrect(e){throw new Error(`isCorrect() not implemented - cannor parse ${e}`)}dataShapes(){return _AudioParsingQuestion2.dataShapes}views(){return _AudioParsingQuestion2.views}};u(Fn,"dataShapes",[{name:r.DataShapeName.FRENCH_AudioParse,fields:[{name:"audio",type:r.FieldType.IMAGE},{name:"text",type:r.FieldType.STRING,validator:{test:e=>{const t=e.length<45;return{msg:t?"":"It's too long!",status:t?r.Status.ok:r.Status.error}}}}]}]),u(Fn,"views",[Rn]);let zn=Fn;const jn=t.defineComponent({name:"IdentifyVocab",components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"IdentifyVocab"),a=n.useQuestionView(i);a.question.value=new Wn(e.data);const s=t.computed((()=>a.question.value));return{...i,...a,question:s}}}),qn={"data-viewable":"IdentifyVocab"};const Hn=E(jn,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",qn,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(" This is a vocabulary question. ")],64)):t.createCommentVNode("",!0)])}]]),Un=[{name:"word",type:r.FieldType.STRING,validator:r.Validators.NonEmptyString},{name:"image",type:r.FieldType.IMAGE},{name:"audio",type:r.FieldType.AUDIO}],Gn=class _VocabQuestion2 extends n.Question{isCorrect(e){throw new Error(`isCorrect() not implemented. Cannot parse ${e}`)}dataShapes(){return _VocabQuestion2.dataShapes}views(){return _VocabQuestion2.views}};u(Gn,"dataShapes",[{fields:Un,name:r.DataShapeName.FRENCH_Vocab}]),u(Gn,"views",[Hn]);let Wn=Gn;const Yn=new Course("french",[zn,Wn]),$n=t.defineComponent({name:"AdditionHorizontal",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"AdditionHorizontal"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new nr(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{if(o.value){const e=o.value.isCorrect(parseInt(s.value,10));alert(e)}}}}}),Kn={"data-viewable":"AdditionHorizontal"};const Qn=E($n,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputNumber");return t.openBlock(),t.createElementBlock("div",Kn,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(e.question.a)+" + "+t.toDisplayString(e.question.b)+" = ",1),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):t.createCommentVNode("",!0)])}]]),Xn=t.defineComponent({name:"VerbalAddition",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"VerbalAddition"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new nr(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{if(o.value){const e=o.value.isCorrect(parseInt(s.value,10));alert(e)}}}}}),Zn={"data-viewable":"VerbalAddition"};const Jn=E(Xn,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputNumber");return t.openBlock(),t.createElementBlock("div",Zn,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(e.question.a)+" plus "+t.toDisplayString(e.question.b)+" is ",1),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):t.createCommentVNode("",!0)])}]]),er=[{name:"a",type:r.FieldType.INT},{name:"b",type:r.FieldType.INT}],tr=class _SingleDigitAdditionQuestion2 extends n.Question{constructor(e){super(e),u(this,"a"),u(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return 1*this.a+this.b===e}dataShapes(){return _SingleDigitAdditionQuestion2.dataShapes}views(){return _SingleDigitAdditionQuestion2.views}};u(tr,"dataShapes",[{name:r.DataShapeName.MATH_SingleDigitAddition,fields:er}]),u(tr,"views",[Qn,Jn]),u(tr,"seedData",function(){const e=[];for(let t=0;t<10;t++)for(let n=0;n<10;n++)e.push({a:t,b:n});return e}()),u(tr,"acceptsUserData",!1);let nr=tr;const rr=t.defineComponent({name:"DivisionHorizontal",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"DivisionHorizontal"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new cr(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{if(o.value){const e=o.value.isCorrect(parseInt(s.value,10));alert(e)}}}}}),ir={"data-viewable":"DivisionHorizontal"};const ar=E(rr,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputNumber");return t.openBlock(),t.createElementBlock("div",ir,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(e.question.a*e.question.b)+" ÷ "+t.toDisplayString(e.question.b)+" = ",1),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):t.createCommentVNode("",!0)])}]]),sr=[{name:"a",type:r.FieldType.INT},{name:"b",type:r.FieldType.INT,validator:{instructions:"An integer between 1 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<t&&t<11?{status:r.Status.ok,msg:""}:0===t?{status:r.Status.error,msg:"Thou shalt not divide by zero."}:{status:r.Status.error,msg:"Single digit division problem divisors must be between 1 and 10, inclusive."}}}}],or=class _SingleDigitDivisionQuestion2 extends n.Question{constructor(e){super(e),u(this,"a"),u(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a*this.b===e}dataShapes(){return _SingleDigitDivisionQuestion2.dataShapes}views(){return _SingleDigitDivisionQuestion2.views}};u(or,"dataShapes",[{name:r.DataShapeName.MATH_SingleDigitDivision,fields:sr}]),u(or,"views",[ar]);let cr=or;const lr=t.defineComponent({name:"MultiplicationHorizontal",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"MultiplicationHorizontal"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new yr(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{if(o.value){const e=o.value.isCorrect(parseInt(s.value,10));alert(e)}}}}}),ur={"data-viewable":"MultiplicationHorizontal"};const hr=E(lr,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputNumber");return t.openBlock(),t.createElementBlock("div",ur,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(e.question.a)+" × "+t.toDisplayString(e.question.b)+" = ",1),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):t.createCommentVNode("",!0)])}]]),dr=t.defineComponent({name:"VerbalMultiplication",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"VerbalMultiplication"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new yr(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{if(o.value){const e=o.value.isCorrect(parseInt(s.value,10));alert(e)}}}}}),fr={"data-viewable":"VerbalMultiplication"};const pr=E(dr,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputNumber");return t.openBlock(),t.createElementBlock("div",fr,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(e.question.a)+" times "+t.toDisplayString(e.question.b)+" is ",1),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):t.createCommentVNode("",!0)])}]]),mr={instructions:"An integer between 0 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<=t&&t<=10?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Single digit multiplication problem inputs must be between 0 and 10, inclusive."}}},gr=[{name:"a",type:r.FieldType.INT,validator:mr},{name:"b",type:r.FieldType.INT,validator:mr}],vr=class _SingleDigitMultiplicationQuestion2 extends n.Question{constructor(e){super(e),u(this,"a"),u(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a*this.b===e}dataShapes(){return _SingleDigitMultiplicationQuestion2.dataShapes}views(){return _SingleDigitMultiplicationQuestion2.views}};u(vr,"dataShapes",[{name:r.DataShapeName.MATH_SingleDigitMultiplication,fields:gr}]),u(vr,"views",[pr,hr]);let yr=vr;const br=t.defineComponent({name:"TrueFalse",components:{TFSelect:n.TFSelect},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"TrueFalse");n.useQuestionView(i).question.value=new Cr(e.data);const a=t.computed((()=>new Cr(e.data)));return{question:a,submit:e=>{alert(a.value.isCorrect(0===e))}}}}),_r={"data-viewable":"TrueFalse"};const wr=E(br,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("TFSelect");return t.openBlock(),t.createElementBlock("div",_r,[t.createTextVNode(t.toDisplayString(e.question.a)+" = "+t.toDisplayString(e.question.b)+" ",1),t.createVNode(o,{submit:e.submit},null,8,["submit"])])}]]),xr=[{name:"a",type:r.FieldType.STRING},{name:"b",type:r.FieldType.STRING}],kr=class _EqualityTest2 extends n.Question{constructor(e){super(e),u(this,"a"),u(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a===this.b===e}dataShapes(){return _EqualityTest2.dataShapes}views(){return _EqualityTest2.views}};u(kr,"dataShapes",[{name:r.DataShapeName.MATH_EqualityTest,fields:xr}]),u(kr,"views",[wr]);let Cr=kr;const Sr=t.defineComponent({name:"SolveView",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"Solve"),a=n.useQuestionView(i),s=t.ref(""),o=["a","b","d","A","z","B","d","y"],c=t.ref(o[w(0,o.length)]);a.question.value=new Vr(e.data);const l=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:l,variable:c,submit:()=>{if(l.value){const e=l.value.isCorrect(parseInt(s.value,10));alert(e)}}}}}),Er={"data-viewable":"Solve"},Mr={key:0},Tr={key:1},Nr={key:2},Ar={key:3},Pr={key:4};const Ir=E(Sr,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputNumber");return t.openBlock(),t.createElementBlock("div",Er,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[n[1]||(n[1]=t.createElementVNode("h4",null,"Solve the Equation",-1)),n[2]||(n[2]=t.createElementVNode("br",null,null,-1)),n[3]||(n[3]=t.createElementVNode("br",null,null,-1)),"ADDITION"===e.question.operation.valueOf()?(t.openBlock(),t.createElementBlock("div",Mr,t.toDisplayString(e.variable)+" - "+t.toDisplayString(e.question.a)+" = "+t.toDisplayString(e.question.b),1)):"SUBTRACTION"===e.question.operation.valueOf()?(t.openBlock(),t.createElementBlock("div",Tr,t.toDisplayString(e.variable)+" + "+t.toDisplayString(e.question.a)+" = "+t.toDisplayString(e.question.b),1)):"MULTIPLICATION"===e.question.operation.valueOf()?(t.openBlock(),t.createElementBlock("div",Nr,t.toDisplayString(e.variable)+" ÷ "+t.toDisplayString(e.question.a)+" = "+t.toDisplayString(e.question.b),1)):"DIVISION"===e.question.operation.valueOf()?(t.openBlock(),t.createElementBlock("div",Ar,t.toDisplayString(e.variable)+" * "+t.toDisplayString(e.question.a)+" = "+t.toDisplayString(e.question.b*e.question.a),1)):(t.openBlock(),t.createElementBlock("div",Pr,"No operation!? (This should never show)")),n[4]||(n[4]=t.createElementVNode("br",null,null,-1)),n[5]||(n[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" "+t.toDisplayString(e.variable)+" = ",1),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):t.createCommentVNode("",!0)])}]]),Dr={instructions:"An integer between 0 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<=t&&t<=100?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Single-step equation problem inputs must be between 0 and 100, inclusive."}}},Br={test:e=>"ADDITION"===e||"SUBTRACTION"===e||"MULTIPLICATION"===e||"DIVISION"===e?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Operation must be ADDITION, SUBTRACTION, MULTIPLICATION, or DIVISION"}},Or=[{name:"a",type:r.FieldType.INT,validator:Dr},{name:"b",type:r.FieldType.INT,validator:Dr},{name:"operation",type:r.FieldType.STRING,validator:Br}],Lr=class _OneStepEquation2 extends n.Question{constructor(e){super(e),u(this,"a"),u(this,"b"),u(this,"operation"),this.a=e[0].a,this.b=e[0].b,this.operation=e[0].operation}answer(){let e=0;return"ADDITION"===this.operation?e=this.a+this.b:"SUBTRACTION"===this.operation?e=this.b-this.a:"MULTIPLICATION"===this.operation?e=this.a*this.b:"DIVISION"===this.operation&&(e=this.b),r.log(`The answer is ${e}\nThe operation is ${this.operation.valueOf()}\nthis.a = ${this.a}\nthis.b = ${this.b}\n`),e}isCorrect(e){return e===this.answer()}dataShapes(){return _OneStepEquation2.dataShapes}views(){return _OneStepEquation2.views}};u(Lr,"dataShapes",[{name:r.DataShapeName.MATH_OneStepEquation,fields:Or}]),u(Lr,"views",[Ir]);let Vr=Lr;const Rr=t.defineComponent({name:"AngleCategorizeV",components:{RadioMultipleChoice:n.RadioMultipleChoice},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"AngleCategorizeV"),a=n.useQuestionView(i),s=t.ref(null);a.question.value=new Wr(e.data);const o=t.computed((()=>a.question.value)),c=t.computed((()=>{if(!o.value)return 0;const e=o.value.angleCategory;if(e===Hr.ACUTE)return w(10,83);if(e===Hr.RIGHT)return 90;if(e===Hr.OBTUSE)return w(97,173);if(e===Hr.STRAIGHT)return 180;if(e===Hr.REFLEX)return w(190,350);throw new Error("Unknown Angle type on AngleCategorize question")}));return t.onMounted((()=>{if(!s.value)return;const e=s.value.width,t=s.value.height,n=s.value.getContext("2d");if(!n)return;const r=w(0,360),i=r+c.value;n.moveTo(e/2,t/2);const a=e/2+e*Math.cos(r/360*2*Math.PI),o=t/2+e*Math.sin(r/360*2*Math.PI);n.lineTo(a,o),n.stroke(),n.moveTo(e/2,t/2);const l=e/2+e*Math.cos(i/360*2*Math.PI),u=t/2+e*Math.sin(i/360*2*Math.PI);n.lineTo(l,u),n.stroke(),n.moveTo(e/2,t/2),n.beginPath(),n.arc(e/2,t/2,25,r/360*2*Math.PI,i/360*2*Math.PI),n.stroke()})),{...i,...a,canvasRef:s,question:o}}}),Fr={"data-viewable":"AngleCategorizeV"},zr={ref:"canvasRef",width:"300",height:"300"};const jr=E(Rr,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("radio-multiple-choice");return t.openBlock(),t.createElementBlock("div",Fr,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[n[0]||(n[0]=t.createElementVNode("h2",null,"What kind of angle is this?",-1)),t.createElementVNode("canvas",zr,null,512),t.createVNode(o,{"choice-list":e.question.answers},null,8,["choice-list"])],64)):t.createCommentVNode("",!0)])}],["__scopeId","data-v-57f16e4a"]]),qr={instructions:'Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".',test:e=>"ACUTE"===e||"OBTUSE"===e||"REFLEX"===e||"RIGHT"===e||"STRAIGHT"===e?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:'Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".'}};var Hr=(e=>(e.ACUTE="ACUTE",e.RIGHT="RIGHT",e.OBTUSE="OBTUSE",e.STRAIGHT="STRAIGHT",e.REFLEX="REFLEX",e))(Hr||{});const Ur=[{name:"Category",type:r.FieldType.STRING,validator:qr}],Gr=class _AngleCategorize2 extends n.Question{constructor(e){super(e),u(this,"angleCategory"),u(this,"answers"),this.angleCategory=e[0].Category,this.answers=_.shuffle(["ACUTE","OBTUSE","REFLEX","RIGHT","STRAIGHT"])}isCorrect(e){return this.angleCategory.valueOf()===e.choiceList[e.selection]}dataShapes(){return _AngleCategorize2.dataShapes}views(){return _AngleCategorize2.views}};u(Gr,"dataShapes",[{name:r.DataShapeName.MATH_AngleCategorize,fields:Ur}]),u(Gr,"views",[jr]);let Wr=Gr;function Yr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $r={exports:{}};const Kr=f(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Qr,Xr={exports:{}};function Zr(){return Qr||(Qr=1,function(e,t){!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_・",i="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",a={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},s="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",o={5:s,"5module":s+" export import",6:s+" const class extends export import super"},c=/^in(stanceof)?$/,l=new RegExp("["+i+"]"),u=new RegExp("["+i+r+"]");function h(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}return!1}function d(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==t&&h(e,n)))}function f(e,r){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&u.test(String.fromCharCode(e)):!1!==r&&(h(e,n)||h(e,t)))))}var p=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function m(e,t){return new p(e,{beforeExpr:!0,binop:t})}var g={beforeExpr:!0},v={startsExpr:!0},y={};function b(e,t){return void 0===t&&(t={}),t.keyword=e,y[e]=new p(e,t)}var _={num:new p("num",v),regexp:new p("regexp",v),string:new p("string",v),name:new p("name",v),privateId:new p("privateId",v),eof:new p("eof"),bracketL:new p("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new p("]"),braceL:new p("{",{beforeExpr:!0,startsExpr:!0}),braceR:new p("}"),parenL:new p("(",{beforeExpr:!0,startsExpr:!0}),parenR:new p(")"),comma:new p(",",g),semi:new p(";",g),colon:new p(":",g),dot:new p("."),question:new p("?",g),questionDot:new p("?."),arrow:new p("=>",g),template:new p("template"),invalidTemplate:new p("invalidTemplate"),ellipsis:new p("...",g),backQuote:new p("`",v),dollarBraceL:new p("${",{beforeExpr:!0,startsExpr:!0}),eq:new p("=",{beforeExpr:!0,isAssign:!0}),assign:new p("_=",{beforeExpr:!0,isAssign:!0}),incDec:new p("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new p("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:m("||",1),logicalAND:m("&&",2),bitwiseOR:m("|",3),bitwiseXOR:m("^",4),bitwiseAND:m("&",5),equality:m("==/!=/===/!==",6),relational:m("</>/<=/>=",7),bitShift:m("<</>>/>>>",8),plusMin:new p("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:m("%",10),star:m("*",10),slash:m("/",10),starstar:new p("**",{beforeExpr:!0}),coalesce:m("??",1),_break:b("break"),_case:b("case",g),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",g),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",g),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",v),_if:b("if"),_return:b("return",g),_switch:b("switch"),_throw:b("throw",g),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",v),_super:b("super",v),_class:b("class",v),_extends:b("extends",g),_export:b("export"),_import:b("import",v),_null:b("null",v),_true:b("true",v),_false:b("false",v),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},w=/\r\n?|\n|\u2028|\u2029/,x=new RegExp(w.source,"g");function k(e){return 10===e||13===e||8232===e||8233===e}function C(e,t,n){void 0===n&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(k(i))return r<n-1&&13===i&&10===e.charCodeAt(r+1)?r+2:r+1}return-1}var S=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,E=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,M=Object.prototype,T=M.hasOwnProperty,N=M.toString,A=Object.hasOwn||function(e,t){return T.call(e,t)},P=Array.isArray||function(e){return"[object Array]"===N.call(e)},I=Object.create(null);function D(e){return I[e]||(I[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function B(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var O=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,L=function(e,t){this.line=e,this.column=t};L.prototype.offset=function(e){return new L(this.line,this.column+e)};var V=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)};function R(e,t){for(var n=1,r=0;;){var i=C(e,r,t);if(i<0)return new L(n,t-r);++n,r=i}}var F={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},z=!1;function j(e){var t={};for(var n in F)t[n]=e&&A(e,n)?e[n]:F[n];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!z&&"object"==typeof console&&console.warn&&(z=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),P(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return P(t.onComment)&&(t.onComment=q(t,t.onComment)),t}function q(e,t){return function(n,r,i,a,s,o){var c={type:n?"Block":"Line",value:r,start:i,end:a};e.locations&&(c.loc=new V(this,s,o)),e.ranges&&(c.range=[i,a]),t.push(c)}}var H=1,U=2,G=4,W=8,Y=16,$=32,K=64,Q=128,X=256,Z=H|U|X;function J(e,t){return U|(e?G:0)|(t?W:0)}var ee=0,te=1,ne=2,re=3,ie=4,ae=5,se=function(e,t,n){this.options=e=j(e),this.sourceFile=e.sourceFile,this.keywords=D(o[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var r="";!0!==e.allowReserved&&(r=a[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(r+=" await")),this.reservedWords=D(r);var i=(r?r+" ":"")+a.strict;this.reservedWordsStrict=D(i),this.reservedWordsStrictBind=D(i+" "+a.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(w).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=_.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(H),this.regexpState=null,this.privateNameStack=[]},oe={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}};se.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},oe.inFunction.get=function(){return(this.currentVarScope().flags&U)>0},oe.inGenerator.get=function(){return(this.currentVarScope().flags&W)>0&&!this.currentVarScope().inClassFieldInit},oe.inAsync.get=function(){return(this.currentVarScope().flags&G)>0&&!this.currentVarScope().inClassFieldInit},oe.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&X)return!1;if(t.flags&U)return(t.flags&G)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},oe.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(t&K)>0||n||this.options.allowSuperOutsideMethod},oe.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Q)>0},oe.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},oe.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(t&(U|X))>0||n},oe.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&X)>0},se.extend=function(){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},se.parse=function(e,t){return new this(t,e).parse()},se.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},se.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(se.prototype,oe);var ce=se.prototype,le=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ce.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){E.lastIndex=e,e+=E.exec(this.input)[0].length;var t=le.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){E.lastIndex=e+t[0].length;var n=E.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return";"===i||"}"===i||w.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(r+1))}e+=t[0].length,E.lastIndex=e,e+=E.exec(this.input)[0].length,";"===this.input[e]&&e++}},ce.eat=function(e){return this.type===e&&(this.next(),!0)},ce.isContextual=function(e){return this.type===_.name&&this.value===e&&!this.containsEsc},ce.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},ce.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ce.canInsertSemicolon=function(){return this.type===_.eof||this.type===_.braceR||w.test(this.input.slice(this.lastTokEnd,this.start))},ce.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ce.semicolon=function(){this.eat(_.semi)||this.insertSemicolon()||this.unexpected()},ce.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ce.expect=function(e){this.eat(e)||this.unexpected()},ce.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var ue=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ce.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")}},ce.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")},ce.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")},ce.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var he=se.prototype;he.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==_.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var de={kind:"loop"},fe={kind:"switch"};he.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;E.lastIndex=this.pos;var t=E.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(91===r||92===r)return!0;if(e)return!1;if(123===r||r>55295&&r<56320)return!0;if(d(r,!0)){for(var i=n+1;f(r=this.input.charCodeAt(i),!0);)++i;if(92===r||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!c.test(a))return!0}return!1},he.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;E.lastIndex=this.pos;var e,t=E.exec(this.input),n=this.pos+t[0].length;return!(w.test(this.input.slice(this.pos,n))||"function"!==this.input.slice(n,n+8)||n+8!==this.input.length&&(f(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},he.parseStatement=function(e,t,n){var r,i=this.type,a=this.startNode();switch(this.isLet(e)&&(i=_._var,r="let"),i){case _._break:case _._continue:return this.parseBreakContinueStatement(a,i.keyword);case _._debugger:return this.parseDebuggerStatement(a);case _._do:return this.parseDoStatement(a);case _._for:return this.parseForStatement(a);case _._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case _._class:return e&&this.unexpected(),this.parseClass(a,!0);case _._if:return this.parseIfStatement(a);case _._return:return this.parseReturnStatement(a);case _._switch:return this.parseSwitchStatement(a);case _._throw:return this.parseThrowStatement(a);case _._try:return this.parseTryStatement(a);case _._const:case _._var:return r=r||this.value,e&&"var"!==r&&this.unexpected(),this.parseVarStatement(a,r);case _._while:return this.parseWhileStatement(a);case _._with:return this.parseWithStatement(a);case _.braceL:return this.parseBlock(!0,a);case _.semi:return this.parseEmptyStatement(a);case _._export:case _._import:if(this.options.ecmaVersion>10&&i===_._import){E.lastIndex=this.pos;var s=E.exec(this.input),o=this.pos+s[0].length,c=this.input.charCodeAt(o);if(40===c||46===c)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'")),i===_._import?this.parseImport(a):this.parseExport(a,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var l=this.value,u=this.parseExpression();return i===_.name&&"Identifier"===u.type&&this.eat(_.colon)?this.parseLabeledStatement(a,l,u,e):this.parseExpressionStatement(a,u)}},he.parseBreakContinueStatement=function(e,t){var n="break"===t;this.next(),this.eat(_.semi)||this.insertSemicolon()?e.label=null:this.type!==_.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if(null==e.label||i.name===e.label.name){if(null!=i.kind&&(n||"loop"===i.kind))break;if(e.label&&n)break}}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,n?"BreakStatement":"ContinueStatement")},he.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},he.parseDoStatement=function(e){return this.next(),this.labels.push(de),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(_._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(_.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},he.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(de),this.enterScope(0),this.expect(_.parenL),this.type===_.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===_._var||this.type===_._const||n){var r=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,"VariableDeclaration"),(this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===r.declarations.length?(this.options.ecmaVersion>=9&&(this.type===_._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var a=this.isContextual("let"),s=!1,o=this.containsEsc,c=new ue,l=this.start,u=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===_._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===_._in&&this.unexpected(t),e.await=!0):s&&this.options.ecmaVersion>=8&&(u.start!==l||o||"Identifier"!==u.type||"async"!==u.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),a&&s&&this.raise(u.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(u,!1,c),this.checkLValPattern(u),this.parseForIn(e,u)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,u))},he.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,me|(n?0:ge),!1,t)},he.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(_._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},he.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(_.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},he.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(_.braceL),this.labels.push(fe),this.enterScope(0);for(var n=!1;this.type!==_.braceR;)if(this.type===_._case||this.type===_._default){var r=this.type===_._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(_.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")},he.parseThrowStatement=function(e){return this.next(),w.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 pe=[];he.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?$:0),this.checkLValPattern(e,t?ie:ne),this.expect(_.parenR),e},he.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===_._catch){var t=this.startNode();this.next(),this.eat(_.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(_._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},he.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,"VariableDeclaration")},he.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(de),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},he.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")},he.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},he.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,"Label '"+t+"' is already declared");for(var s=this.type.isLoop?"loop":this.type===_._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var c=this.labels[o];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=s}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(r?-1===r.indexOf("label")?r+"label":r:"label"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},he.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},he.parseBlock=function(e,t,n){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(_.braceL),e&&this.enterScope(0);this.type!==_.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},he.parseFor=function(e,t){return e.init=t,this.expect(_.semi),e.test=this.type===_.semi?null:this.parseExpression(),this.expect(_.semi),e.update=this.type===_.parenR?null:this.parseExpression(),this.expect(_.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},he.parseForIn=function(e,t){var n=this.type===_._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!n||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&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(_.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,n?"ForInStatement":"ForOfStatement")},he.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(_.eq)?i.init=this.parseMaybeAssign(t):r||"const"!==n||this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of")?r||"Identifier"===i.id.type||t&&(this.type===_._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(_.comma))break}return e},he.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?te:ne,!1)};var me=1,ge=2,ve=4;function ye(e,t){var n=t.key.name,r=e[n],i="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(i=(t.static?"s":"i")+t.kind),"iget"===r&&"iset"===i||"iset"===r&&"iget"===i||"sget"===r&&"sset"===i||"sset"===r&&"sget"===i?(e[n]="true",!1):!!r||(e[n]=i,!1)}function be(e,t){var n=e.computed,r=e.key;return!n&&("Identifier"===r.type&&r.name===t||"Literal"===r.type&&r.value===t)}he.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===_.star&&t&ge&&this.unexpected(),e.generator=this.eat(_.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&me&&(e.id=t&ve&&this.type!==_.name?null:this.parseIdent(),!e.id||t&ge||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?te:ne:re));var a=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(J(e.async,e.generator)),t&me||(e.id=this.type===_.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(e,t&me?"FunctionDeclaration":"FunctionExpression")},he.parseFunctionParams=function(e){this.expect(_.parenL),e.params=this.parseBindingList(_.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},he.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(_.braceL);this.type!==_.braceR;){var s=this.parseClassElement(null!==e.superClass);s&&(i.body.push(s),"MethodDefinition"===s.type&&"constructor"===s.kind?(a&&this.raiseRecoverable(s.start,"Duplicate constructor in the same class"),a=!0):s.key&&"PrivateIdentifier"===s.key.type&&ye(r,s)&&this.raiseRecoverable(s.key.start,"Identifier '#"+s.key.name+"' has already been declared"))}return this.strict=n,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},he.parseClassElement=function(e){if(this.eat(_.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r="",i=!1,a=!1,s="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(_.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===_.star?o=!0:r="static"}if(n.static=o,!r&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==_.star||this.canInsertSemicolon()?r="async":a=!0),!r&&(t>=9||!a)&&this.eat(_.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?s=c:r=c)}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===_.parenL||"method"!==s||i||a){var l=!n.static&&be(n,"constructor"),u=l&&e;l&&"method"!==s&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=l?"constructor":s,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},he.isClassElementNameStart=function(){return this.type===_.name||this.type===_.privateId||this.type===_.num||this.type===_.string||this.type===_.bracketL||this.type.keyword},he.parseClassElementName=function(e){this.type===_.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},he.parseClassMethod=function(e,t,n,r){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),n&&this.raise(i.start,"Constructor can't be an async method")):e.static&&be(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,n,r);return"get"===e.kind&&0!==a.params.length&&this.raiseRecoverable(a.start,"getter should have no params"),"set"===e.kind&&1!==a.params.length&&this.raiseRecoverable(a.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===a.params[0].type&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},he.parseClassField=function(e){if(be(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&be(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(_.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")},he.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(X|K);this.type!==_.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},he.parseClassId=function(e,t){this.type===_.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,ne,!1)):(!0===t&&this.unexpected(),e.id=null)},he.parseClassSuper=function(e){e.superClass=this.eat(_._extends)?this.parseExprSubscripts(null,!1):null},he.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},he.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=0===r?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var s=n[a];A(t,s.name)||(i?i.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}},he.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!==_.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},he.parseExport=function(e,t){if(this.next(),this.eat(_.star))return this.parseExportAllDeclaration(e,t);if(this.eat(_._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==_.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 i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),"Literal"===i.local.type&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},he.parseExportDeclaration=function(e){return this.parseStatement(null)},he.parseExportDefaultDeclaration=function(){var e;if(this.type===_._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,me|ve,!1,e)}if(this.type===_._class){var n=this.startNode();return this.parseClass(n,"nullableID")}var r=this.parseMaybeAssign();return this.semicolon(),r},he.checkExport=function(e,t,n){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),A(e,t)&&this.raiseRecoverable(n,"Duplicate export '"+t+"'"),e[t]=!0)},he.checkPatternExport=function(e,t){var n=t.type;if("Identifier"===n)this.checkExport(e,t,t.start);else if("ObjectPattern"===n)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if("ArrayPattern"===n)for(var s=0,o=t.elements;s<o.length;s+=1){var c=o[s];c&&this.checkPatternExport(e,c)}else"Property"===n?this.checkPatternExport(e,t.value):"AssignmentPattern"===n?this.checkPatternExport(e,t.left):"RestElement"===n&&this.checkPatternExport(e,t.argument)},he.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},he.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},he.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")},he.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(_.braceL);!this.eat(_.braceR);){if(n)n=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;t.push(this.parseExportSpecifier(e))}return t},he.parseImport=function(e){return this.next(),this.type===_.string?(e.specifiers=pe,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===_.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},he.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")},he.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,ne),this.finishNode(e,"ImportDefaultSpecifier")},he.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")},he.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===_.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(_.comma)))return e;if(this.type===_.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(_.braceL);!this.eat(_.braceR);){if(t)t=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;e.push(this.parseImportSpecifier())}return e},he.parseWithClause=function(){var e=[];if(!this.eat(_._with))return e;this.expect(_.braceL);for(var t={},n=!0;!this.eat(_.braceR);){if(n)n=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;var r=this.parseImportAttribute(),i="Identifier"===r.key.type?r.key.name:r.key.value;A(t,i)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(r)}return e},he.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===_.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(_.colon),this.type!==_.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},he.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===_.string){var e=this.parseLiteral(this.value);return O.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},he.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)},he.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var _e=se.prototype;_e.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),"RestElement"!==a.type||"ArrayPattern"!==a.argument.type&&"ObjectPattern"!==a.argument.type||this.raise(a.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,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},_e.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];6===this.options.ecmaVersion&&t&&a&&"RestElement"===a.type&&"Identifier"!==a.argument.type&&this.unexpected(a.argument.start)}return e},_e.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},_e.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==_.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},_e.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case _.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(_.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case _.braceL:return this.parseObj(!0)}return this.parseIdent()},_e.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(_.comma),t&&this.type===_.comma)i.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===_.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),i.push(s),this.type===_.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}i.push(this.parseAssignableListItem(r))}return i},_e.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},_e.parseBindingListItem=function(e){return e},_e.parseMaybeDefault=function(e,t,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(_.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},_e.checkLValSimple=function(e,t,n){void 0===t&&(t=ee);var r=t!==ee;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&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),n&&(A(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")}},_e.checkLValPattern=function(e,t,n){switch(void 0===t&&(t=ee),e.type){case"ObjectPattern":for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case"ArrayPattern":for(var s=0,o=e.elements;s<o.length;s+=1){var c=o[s];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},_e.checkLValInnerPattern=function(e,t,n){switch(void 0===t&&(t=ee),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 we=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},xe={b_stat:new we("{",!1),b_expr:new we("{",!0),b_tmpl:new we("${",!1),p_stat:new we("(",!1),p_expr:new we("(",!0),q_tmpl:new we("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new we("function",!1),f_expr:new we("function",!0),f_expr_gen:new we("function",!0,!1,null,!0),f_gen:new we("function",!1,!1,null,!0)},ke=se.prototype;ke.initialContext=function(){return[xe.b_stat]},ke.curContext=function(){return this.context[this.context.length-1]},ke.braceIsBlock=function(e){var t=this.curContext();return t===xe.f_expr||t===xe.f_stat||(e!==_.colon||t!==xe.b_stat&&t!==xe.b_expr?e===_._return||e===_.name&&this.exprAllowed?w.test(this.input.slice(this.lastTokEnd,this.start)):e===_._else||e===_.semi||e===_.eof||e===_.parenR||e===_.arrow||(e===_.braceL?t===xe.b_stat:e!==_._var&&e!==_._const&&e!==_.name&&!this.exprAllowed):!t.isExpr)},ke.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},ke.updateContext=function(e){var t,n=this.type;n.keyword&&e===_.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},ke.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},_.parenR.updateContext=_.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===xe.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},_.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?xe.b_stat:xe.b_expr),this.exprAllowed=!0},_.dollarBraceL.updateContext=function(){this.context.push(xe.b_tmpl),this.exprAllowed=!0},_.parenL.updateContext=function(e){var t=e===_._if||e===_._for||e===_._with||e===_._while;this.context.push(t?xe.p_stat:xe.p_expr),this.exprAllowed=!0},_.incDec.updateContext=function(){},_._function.updateContext=_._class.updateContext=function(e){!e.beforeExpr||e===_._else||e===_.semi&&this.curContext()!==xe.p_stat||e===_._return&&w.test(this.input.slice(this.lastTokEnd,this.start))||(e===_.colon||e===_.braceL)&&this.curContext()===xe.b_stat?this.context.push(xe.f_stat):this.context.push(xe.f_expr),this.exprAllowed=!1},_.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},_.backQuote.updateContext=function(){this.curContext()===xe.q_tmpl?this.context.pop():this.context.push(xe.q_tmpl),this.exprAllowed=!1},_.star.updateContext=function(e){if(e===_._function){var t=this.context.length-1;this.context[t]===xe.f_expr?this.context[t]=xe.f_expr_gen:this.context[t]=xe.f_gen}this.exprAllowed=!0},_.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==_.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Ce=se.prototype;function Se(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&Se(e.expression)}function Ee(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&Ee(e.expression)||"ParenthesizedExpression"===e.type&&Ee(e.expression)}Ce.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r,i=e.key;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===r&&"init"===a&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0);else{var s=t[r="$"+r];s?("init"===a?this.strict&&s.init||s.get||s.set:s.init||s[a])&&this.raiseRecoverable(i.start,"Redefinition of property"):s=t[r]={init:!1,get:!1,set:!1},s[a]=!0}}},Ce.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===_.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(_.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return i},Ce.parseMaybeAssign=function(e,t,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,s=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,s=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ue,r=!0);var o=this.start,c=this.startLoc;this.type!==_.parenL&&this.type!==_.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,o,c)),this.type.isAssign){var u=this.startNodeAt(o,c);return u.operator=this.value,this.type===_.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===_.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),s>-1&&(t.doubleProto=s),this.finishNode(u,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},Ce.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(_.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(_.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return i},Ce.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,e)},Ce.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(null!=a&&(!i||this.type!==_._in)&&a>r){var s=this.type===_.logicalOR||this.type===_.logicalAND,o=this.type===_.coalesce;o&&(a=_.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,h=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),d=this.buildBinary(t,n,e,h,c,s||o);return(s&&this.type===_.coalesce||o&&(this.type===_.logicalOR||this.type===_.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,n,r,i)}return e},Ce.buildBinary=function(e,t,n,r,i,a){"PrivateIdentifier"===r.type&&this.raise(r.start,"Private identifier can only be left side of binary expression");var s=this.startNodeAt(e,t);return s.left=n,s.operator=i,s.right=r,this.finishNode(s,a?"LogicalExpression":"BinaryExpression")},Ce.parseMaybeUnary=function(e,t,n,r){var i,a=this.start,s=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===_.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&Se(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&Ee(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==_.privateId){if(i=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(a,s);l.operator=this.value,l.prefix=!1,l.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(l,"UpdateExpression")}}else(r||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==_._in&&this.unexpected();return n||!this.eat(_.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(a,s,i,this.parseMaybeUnary(null,!1,!1,r),"**",!1)},Ce.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&"MemberExpression"===a.type&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},Ce.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.potentialArrowAt===e.start,s=!1;;){var o=this.parseSubscript(e,t,n,r,a,s,i);if(o.optional&&(s=!0),o===e||"ArrowFunctionExpression"===o.type){if(s){var c=this.startNodeAt(t,n);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},Ce.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(_.arrow)},Ce.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},Ce.parseSubscript=function(e,t,n,r,i,a,s){var o=this.options.ecmaVersion>=11,c=o&&this.eat(_.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(_.bracketL);if(l||c&&this.type!==_.parenL&&this.type!==_.backQuote||this.eat(_.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(_.bracketR)):this.type===_.privateId&&"Super"!==e.type?u.property=this.parsePrivateIdent():u.property=this.parseIdent("never"!==this.options.allowReserved),u.computed=!!l,o&&(u.optional=c),e=this.finishNode(u,"MemberExpression")}else if(!r&&this.eat(_.parenL)){var h=new ue,d=this.yieldPos,f=this.awaitPos,p=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(_.parenR,this.options.ecmaVersion>=8,!1,h);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=p,this.parseSubscriptAsyncArrow(t,n,m,s);this.checkExpressionErrors(h,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=p||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=m,o&&(g.optional=c),e=this.finishNode(g,"CallExpression")}else if(this.type===_.backQuote){(c||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(t,n);v.tag=e,v.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(v,"TaggedTemplateExpression")}return e},Ce.parseExprAtom=function(e,t,n){this.type===_.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case _._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type!==_.parenL||this.allowDirectSuper||this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==_.dot&&this.type!==_.bracketL&&this.type!==_.parenL&&this.unexpected(),this.finishNode(r,"Super");case _._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case _.name:var a=this.start,s=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(_._function))return this.overrideContext(xe.f_expr),this.parseFunction(this.startNodeAt(a,s),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(_.arrow))return this.parseArrowExpression(this.startNodeAt(a,s),[c],!1,t);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===_.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(_.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,s),[c],!0,t)}return c;case _.regexp:var l=this.value;return(r=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},r;case _.num:case _.string:return this.parseLiteral(this.value);case _._null:case _._true:case _._false:return(r=this.startNode()).value=this.type===_._null?null:this.type===_._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case _.parenL:var u=this.start,h=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(h)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),h;case _.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(_.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case _.braceL:return this.overrideContext(xe.b_expr),this.parseObj(!1,e);case _._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case _._class:return this.parseClass(this.startNode(),!1);case _._new:return this.parseNew();case _.backQuote:return this.parseTemplate();case _._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},Ce.parseExprAtomDefault=function(){this.unexpected()},Ce.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===_.parenL&&!e)return this.parseDynamicImport(t);if(this.type===_.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)}this.unexpected()},Ce.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(_.parenR)?e.options=null:(this.expect(_.comma),this.afterTrailingComma(_.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(_.parenR)||(this.expect(_.comma),this.afterTrailingComma(_.parenR)||this.unexpected())));else if(!this.eat(_.parenR)){var t=this.start;this.eat(_.comma)&&this.eat(_.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},Ce.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},Ce.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},Ce.parseParenExpression=function(){this.expect(_.parenL);var e=this.parseExpression();return this.expect(_.parenR),e},Ce.shouldParseArrow=function(e){return!this.canInsertSemicolon()},Ce.parseParenAndDistinguishExpression=function(e,t){var n,r=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s,o=this.start,c=this.startLoc,l=[],u=!0,h=!1,d=new ue,f=this.yieldPos,p=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==_.parenR;){if(u?u=!1:this.expect(_.comma),a&&this.afterTrailingComma(_.parenR,!0)){h=!0;break}if(this.type===_.ellipsis){s=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===_.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(_.parenR),e&&this.shouldParseArrow(l)&&this.eat(_.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(r,i,l,t);l.length&&!h||this.unexpected(this.lastTokStart),s&&this.unexpected(s),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,l.length>1?((n=this.startNodeAt(o,c)).expressions=l,this.finishNodeAt(n,"SequenceExpression",m,g)):n=l[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(r,i);return v.expression=n,this.finishNode(v,"ParenthesizedExpression")}return n},Ce.parseParenItem=function(e){return e},Ce.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var Me=[];Ce.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===_.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),"target"!==e.property.name&&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,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(_.parenL)?e.arguments=this.parseExprList(_.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Me,this.finishNode(e,"NewExpression")},Ce.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===_.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===_.backQuote,this.finishNode(n,"TemplateElement")},Ce.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===_.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(_.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(_.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,"TemplateLiteral")},Ce.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===_.name||this.type===_.num||this.type===_.string||this.type===_.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===_.star)&&!w.test(this.input.slice(this.lastTokEnd,this.start))},Ce.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(_.braceR);){if(r)r=!1;else if(this.expect(_.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(_.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?"ObjectPattern":"ObjectExpression")},Ce.parseProperty=function(e,t){var n,r,i,a,s=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(_.ellipsis))return e?(s.argument=this.parseIdent(!1),this.type===_.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(s,"RestElement")):(s.argument=this.parseMaybeAssign(!1,t),this.type===_.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=!1,s.shorthand=!1,(e||t)&&(i=this.start,a=this.startLoc),e||(n=this.eat(_.star)));var o=this.containsEsc;return this.parsePropertyName(s),!e&&!o&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(s)?(r=!0,n=this.options.ecmaVersion>=9&&this.eat(_.star),this.parsePropertyName(s)):r=!1,this.parsePropertyValue(s,e,n,r,i,a,t,o),this.finishNode(s,"Property")},Ce.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t="get"===e.kind?0:1;if(e.value.params.length!==t){var n=e.value.start;"get"===e.kind?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},Ce.parsePropertyValue=function(e,t,n,r,i,a,s,o){(n||r)&&this.type===_.colon&&this.unexpected(),this.eat(_.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===_.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,r)):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===_.comma||this.type===_.braceR||this.type===_.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=i),e.kind="init",t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===_.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected():((n||r)&&this.unexpected(),this.parseGetterSetter(e))},Ce.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(_.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(_.bracketR),e.key;e.computed=!1}return e.key=this.type===_.num||this.type===_.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},Ce.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Ce.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,s=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(J(t,r.generator)|K|(n?Q:0)),this.expect(_.parenL),r.params=this.parseBindingList(_.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(r,"FunctionExpression")},Ce.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(J(n,!1)|Y),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=i,this.awaitPos=a,this.awaitIdentPos=s,this.finishNode(e,"ArrowFunctionExpression")},Ce.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==_.braceL,a=this.strict,s=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);a&&!o||(s=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var c=this.labels;this.labels=[],s&&(this.strict=!0),this.checkParams(e,!a&&!s&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,ae),e.body=this.parseBlock(!1,void 0,s&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},Ce.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if("Identifier"!==n[t].type)return!1;return!0},Ce.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,te,t?null:n)}},Ce.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(_.comma),t&&this.afterTrailingComma(e))break;var s=void 0;n&&this.type===_.comma?s=null:this.type===_.ellipsis?(s=this.parseSpread(r),r&&this.type===_.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):s=this.parseMaybeAssign(!1,r),i.push(s)}return i},Ce.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&"yield"===r&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===r&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===r&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==r&&"await"!==r||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&&-1!==this.input.slice(t,n).indexOf("\\")||(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(this.inAsync||"await"!==r||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))},Ce.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"!==t.name||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},Ce.parseIdentNode=function(){var e=this.startNode();return this.type===_.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,"class"!==e.name&&"function"!==e.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=_.name):this.unexpected(),e},Ce.parsePrivateIdent=function(){var e=this.startNode();return this.type===_.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},Ce.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===_.semi||this.canInsertSemicolon()||this.type!==_.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(_.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},Ce.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 Te=se.prototype;Te.raise=function(e,t){var n=R(this.input,e);t+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},Te.raiseRecoverable=Te.raise,Te.curPosition=function(){if(this.options.locations)return new L(this.curLine,this.pos-this.lineStart)};var Ne=se.prototype,Ae=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ne.enterScope=function(e){this.scopeStack.push(new Ae(e))},Ne.exitScope=function(){this.scopeStack.pop()},Ne.treatFunctionsAsVarInScope=function(e){return e.flags&U||!this.inModule&&e.flags&H},Ne.declareName=function(e,t,n){var r=!1;if(t===ne){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&H&&delete this.undefinedExports[e]}else if(t===ie)this.currentScope().lexical.push(e);else if(t===re){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var s=this.scopeStack.length-1;s>=0;--s){var o=this.scopeStack[s];if(o.lexical.indexOf(e)>-1&&!(o.flags&$&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){r=!0;break}if(o.var.push(e),this.inModule&&o.flags&H&&delete this.undefinedExports[e],o.flags&Z)break}r&&this.raiseRecoverable(n,"Identifier '"+e+"' has already been declared")},Ne.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},Ne.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ne.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Z)return t}},Ne.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Z&&!(t.flags&Y))return t}};var Pe=function(e,t,n){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new V(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Ie=se.prototype;function De(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}Ie.startNode=function(){return new Pe(this,this.start,this.startLoc)},Ie.startNodeAt=function(e,t){return new Pe(this,e,t)},Ie.finishNode=function(e,t){return De.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Ie.finishNodeAt=function(e,t,n,r){return De.call(this,e,t,n,r)},Ie.copyNode=function(e){var t=new Pe(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var Be="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Oe=Be+" Extended_Pictographic",Le=Oe+" EBase EComp EMod EPres ExtPict",Ve={9:Be,10:Oe,11:Oe,12:Le,13:Le,14:Le},Re={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},Fe="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",ze="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",je=ze+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",qe=je+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",He=qe+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ue=He+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ge={9:ze,10:je,11:qe,12:He,13:Ue,14:Ue+" 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"},We={};function Ye(e){var t=We[e]={binary:D(Ve[e]+" "+Fe),binaryOfStrings:D(Re[e]),nonBinary:{General_Category:D(Fe),Script:D(Ge[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 $e=0,Ke=[9,10,11,12,13,14];$e<Ke.length;$e+=1)Ye(Ke[$e]);var Qe=se.prototype,Xe=function(e,t){this.parent=e,this.base=t||this};Xe.prototype.separatedFrom=function(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},Xe.prototype.sibling=function(){return new Xe(this.parent,this.base)};var Ze=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=We[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function Je(e){for(var t in e)return!0;return!1}function et(e){return 105===e||109===e||115===e}function tt(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function nt(e){return d(e,!0)||36===e||95===e}function rt(e){return f(e,!0)||36===e||95===e||8204===e||8205===e}function it(e){return e>=65&&e<=90||e>=97&&e<=122}function at(e){return e>=0&&e<=1114111}Ze.prototype.reset=function(e,t,n){var r=-1!==n.indexOf("v"),i=-1!==n.indexOf("u");this.start=0|e,this.source=t+"",this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Ze.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},Ze.prototype.at=function(e,t){void 0===t&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Ze.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i,a=n.charCodeAt(e);return!t&&!this.switchU||a<=55295||a>=57344||e+1>=r||(i=n.charCodeAt(e+1))<56320||i>57343?e+1:e+2},Ze.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},Ze.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Ze.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Ze.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Ze.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],s=this.at(n,t);if(-1===s||s!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},Qe.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var s=n.charAt(a);-1===t.indexOf(s)&&this.raise(e.start,"Invalid regular expression flag"),n.indexOf(s,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===s&&(r=!0),"v"===s&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,"Invalid regular expression flag")},Qe.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Je(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},Qe.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")}},Qe.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Xe(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")},Qe.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},Qe.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)},Qe.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},Qe.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},Qe.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},Qe.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=n}return!1},Qe.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)},Qe.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},Qe.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 i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var s=this.regexp_eatModifiers(e);n||s||58!==e.current()||e.raise("Invalid regular expression modifiers");for(var o=0;o<s.length;o++){var c=s.charAt(o);(s.indexOf(c,o+1)>-1||n.indexOf(c)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},Qe.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},Qe.regexp_eatModifiers=function(e){for(var t="",n=0;-1!==(n=e.current())&&et(n);)t+=B(n),e.advance();return t},Qe.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)},Qe.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},Qe.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!tt(t)&&(e.lastIntValue=t,e.advance(),!0)},Qe.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;-1!==(n=e.current())&&!tt(n);)e.advance();return e.pos!==t},Qe.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t||(e.advance(),0))},Qe.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,i=n;r<i.length;r+=1)i[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}},Qe.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},Qe.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=B(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=B(e.lastIntValue);return!0}return!1},Qe.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),nt(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},Qe.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),92===r&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),rt(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},Qe.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},Qe.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},Qe.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},Qe.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)},Qe.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},Qe.regexp_eatZero=function(e){return 48===e.current()&&!mt(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},Qe.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},Qe.regexp_eatControlLetter=function(e){var t=e.current();return!!it(t)&&(e.lastIntValue=t%32,e.advance(),!0)},Qe.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(s>=56320&&s<=57343)return e.lastIntValue=1024*(i-55296)+(s-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&at(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=n}return!1},Qe.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t||(e.lastIntValue=t,e.advance(),0))},Qe.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 st=0,ot=1,ct=2;function lt(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function ut(e){return it(e)||95===e}function ht(e){return ut(e)||mt(e)}function dt(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}function ft(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function pt(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}function mt(e){return e>=48&&e<=57}function gt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function vt(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function yt(e){return e>=48&&e<=55}Qe.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(lt(t))return e.lastIntValue=-1,e.advance(),ot;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=80===t)||112===t)){var r;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===ct&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return st},Qe.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),ot}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return st},Qe.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){A(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(n)||e.raise("Invalid property value")},Qe.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?ot:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?ct:void e.raise("Invalid property name")},Qe.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";ut(t=e.current());)e.lastStringValue+=B(t),e.advance();return""!==e.lastStringValue},Qe.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";ht(t=e.current());)e.lastStringValue+=B(t),e.advance();return""!==e.lastStringValue},Qe.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},Qe.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===ct&&e.raise("Negated character class may contain strings"),!0}return!1},Qe.regexp_classContents=function(e){return 93===e.current()?ot:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),ot)},Qe.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||-1!==t&&-1!==n||e.raise("Invalid character class"),-1!==t&&-1!==n&&t>n&&e.raise("Range out of order in character class")}}},Qe.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();(99===n||yt(n))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return 93!==r&&(e.lastIntValue=r,e.advance(),!0)},Qe.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)},Qe.regexp_classSetExpression=function(e){var t,n=ot;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){t===ct&&(n=ct);for(var r=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==ct&&(n=ot):e.raise("Invalid character in character class");if(r!==e.pos)return n;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return n}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return n;t===ct&&(n=ct)}},Qe.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-1!==n&&-1!==r&&n>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},Qe.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?ot:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},Qe.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===ct&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},Qe.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},Qe.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ct&&(t=ct);return t},Qe.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?ot:ct},Qe.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e)&&(e.eat(98)?(e.lastIntValue=8,0):(e.pos=t,1)));var n=e.current();return!(n<0||n===e.lookahead()&&dt(n)||ft(n)||(e.advance(),e.lastIntValue=n,0))},Qe.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!pt(t)&&(e.lastIntValue=t,e.advance(),!0)},Qe.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!mt(t)&&95!==t||(e.lastIntValue=t%32,e.advance(),0))},Qe.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},Qe.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;mt(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},Qe.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;gt(n=e.current());)e.lastIntValue=16*e.lastIntValue+vt(n),e.advance();return e.pos!==t},Qe.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=64*t+8*n+e.lastIntValue:e.lastIntValue=8*t+n}else e.lastIntValue=t;return!0}return!1},Qe.regexp_eatOctalDigit=function(e){var t=e.current();return yt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},Qe.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!gt(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+vt(i),e.advance()}return!0};var bt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new V(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},_t=se.prototype;function wt(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function xt(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}_t.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 bt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},_t.getToken=function(){return this.next(),new bt(this)},"undefined"!=typeof Symbol&&(_t[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===_.eof,value:t}}}}),_t.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(_.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},_t.readToken=function(e){return d(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},_t.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},_t.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=C(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},_t.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&&!k(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())},_t.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&S.test(String.fromCharCode(e))))break e;++this.pos}}},_t.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)},_t.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(_.ellipsis)):(++this.pos,this.finishToken(_.dot))},_t.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(_.assign,2):this.finishOp(_.slash,1)},_t.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=42===e?_.star:_.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++n,r=_.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(_.assign,n+1):this.finishOp(r,n)},_t.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(_.assign,3):this.finishOp(124===e?_.logicalOR:_.logicalAND,2):61===t?this.finishOp(_.assign,2):this.finishOp(124===e?_.bitwiseOR:_.bitwiseAND,1)},_t.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(_.assign,2):this.finishOp(_.bitwiseXOR,1)},_t.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!w.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(_.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(_.assign,2):this.finishOp(_.plusMin,1)},_t.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(_.assign,n+1):this.finishOp(_.bitShift,n)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(_.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},_t.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(_.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(_.arrow)):this.finishOp(61===e?_.eq:_.prefix,1)},_t.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(_.questionDot,2)}if(63===t)return e>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(_.assign,3):this.finishOp(_.coalesce,2)}return this.finishOp(_.question,1)},_t.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,d(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(_.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+B(e)+"'")},_t.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(_.parenL);case 41:return++this.pos,this.finishToken(_.parenR);case 59:return++this.pos,this.finishToken(_.semi);case 44:return++this.pos,this.finishToken(_.comma);case 91:return++this.pos,this.finishToken(_.bracketL);case 93:return++this.pos,this.finishToken(_.bracketR);case 123:return++this.pos,this.finishToken(_.braceL);case 125:return++this.pos,this.finishToken(_.braceR);case 58:return++this.pos,this.finishToken(_.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(_.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(_.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+B(e)+"'")},_t.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},_t.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(w.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 i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new Ze(this));o.reset(n,i,s),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(i,s)}catch(l){}return this.finishToken(_.regexp,{pattern:i,flags:s,value:c})},_t.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&void 0===t,i=n&&48===this.input.charCodeAt(this.pos),a=this.pos,s=0,o=0,c=0,l=null==t?1/0:t;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),h=void 0;if(r&&95===u)i&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===c&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=u;else{if((h=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0)>=e)break;o=u,s=s*e+h}}return r&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||null!=t&&this.pos-a!==t?null:s},_t.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return null==n&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(n=xt(this.input.slice(t,this.pos)),++this.pos):d(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(_.num,n)},_t.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var n=this.pos-t>=2&&48===this.input.charCodeAt(t);n&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&110===r){var i=xt(this.input.slice(t,this.pos));return++this.pos,d(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(_.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),46!==r||n||(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),69!==r&&101!==r||n||(43!==(r=this.input.charCodeAt(++this.pos))&&45!==r||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),d(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=wt(this.input.slice(t,this.pos),n);return this.finishToken(_.num,a)},_t.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},_t.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;92===r?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):8232===r||8233===r?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(k(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(_.string,t)};var kt={};_t.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==kt)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},_t.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw kt;this.raise(e,t)},_t.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(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==_.template&&this.type!==_.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(_.template,e)):36===n?(this.pos+=2,this.finishToken(_.dollarBraceL)):(++this.pos,this.finishToken(_.backQuote));if(92===n)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(k(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},_t.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(_.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},_t.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return B(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var 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],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),"0"===r&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return k(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},_t.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},_t.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(f(i,r))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var s=this.readCodePoint();(t?d:f)(s,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=B(s),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},_t.readWord=function(){var e=this.readWord1(),t=_.name;return this.keywords.test(e)&&(t=y[e]),this.finishToken(t,e)};var Ct="8.14.0";function St(e,t){return se.parse(e,t)}function Et(e,t,n){return se.parseExpressionAt(e,t,n)}function Mt(e,t){return se.tokenizer(e,t)}se.acorn={Parser:se,version:Ct,defaultOptions:F,Position:L,SourceLocation:V,getLineInfo:R,Node:Pe,TokenType:p,tokTypes:_,keywordTypes:y,TokContext:we,tokContexts:xe,isIdentifierChar:f,isIdentifierStart:d,Token:bt,isNewLine:k,lineBreak:w,lineBreakG:x,nonASCIIwhitespace:S},e.Node=Pe,e.Parser=se,e.Position=L,e.SourceLocation=V,e.TokContext=we,e.Token=bt,e.TokenType=p,e.defaultOptions=F,e.getLineInfo=R,e.isIdentifierChar=f,e.isIdentifierStart=d,e.isNewLine=k,e.keywordTypes=y,e.lineBreak=w,e.lineBreakG=x,e.nonASCIIwhitespace=S,e.parse=St,e.parseExpressionAt=Et,e.tokContexts=xe,e.tokTypes=_,e.tokenizer=Mt,e.version=Ct}(t)}(0,Xr.exports)),Xr.exports}
|
|
36
|
+
/*!
|
|
37
|
+
* Paper.js v0.12.18 - The Swiss Army Knife of Vector Graphics Scripting.
|
|
38
|
+
* http://paperjs.org/
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
|
|
41
|
+
* http://juerglehni.com/ & https://puckey.studio/
|
|
42
|
+
*
|
|
43
|
+
* Distributed under the MIT license. See LICENSE file for details.
|
|
44
|
+
*
|
|
45
|
+
* All rights reserved.
|
|
46
|
+
*
|
|
47
|
+
* Date: Wed Jul 17 14:57:24 2024 +0200
|
|
48
|
+
*
|
|
49
|
+
***
|
|
50
|
+
*
|
|
51
|
+
* Straps.js - Class inheritance library with support for bean-style accessors
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) 2006 - 2020 Jürg Lehni
|
|
54
|
+
* http://juerglehni.com/
|
|
55
|
+
*
|
|
56
|
+
* Distributed under the MIT license.
|
|
57
|
+
*
|
|
58
|
+
***
|
|
59
|
+
*
|
|
60
|
+
* Acorn.js
|
|
61
|
+
* https://marijnhaverbeke.nl/acorn/
|
|
62
|
+
*
|
|
63
|
+
* Acorn is a tiny, fast JavaScript parser written in JavaScript,
|
|
64
|
+
* created by Marijn Haverbeke and released under an MIT license.
|
|
65
|
+
*
|
|
66
|
+
*/var Jr,ei=$r.exports;var ti=(Jr||(Jr=1,function(e){(function(t,n){var r=(t=t||Kr).window,i=t.document,a=new function(){var e=/^(statics|enumerable|beans|preserve)$/,t=[],r=t.slice,i=Object.create,a=Object.getOwnPropertyDescriptor,s=Object.defineProperty,o=t.forEach||function(e,t){for(var n=0,r=this.length;n<r;n++)e.call(t,this[n],n,this)},c=function(e,t){for(var n in this)this.hasOwnProperty(n)&&e.call(t,this[n],n,this)},l=Object.assign||function(e){for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}return e},u=function(e,t,n){if(e){var r=a(e,"length");(r&&"number"==typeof r.value?o:c).call(e,t,n=n||e)}return n};function h(t,n,r,i,o){var c={};function l(e,l){"string"==typeof(l=l||(l=a(n,e))&&(l.get?l:l.value))&&"#"===l[0]&&(l=t[l.substring(1)]||l);var u,h="function"==typeof l,f=l,p=o||h&&!l.base?l&&l.get?e in t:t[e]:null;o&&p||(h&&p&&(l.base=p),h&&!1!==i&&(u=e.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(c[u[3].toLowerCase()+u[4]]=u[2]),f&&!h&&f.get&&"function"==typeof f.get&&d.isPlainObject(f)||(f={value:f,writable:!0}),(a(t,e)||{configurable:!0}).configurable&&(f.configurable=!0,f.enumerable=null!=r?r:!u),s(t,e,f))}if(n){for(var u in n)n.hasOwnProperty(u)&&!e.test(u)&&l(u);for(var u in c){var h=c[u],f=t["set"+h],p=t["get"+h]||f&&t["is"+h];!p||!0!==i&&0!==p.length||l(u,{get:p,set:f})}}return t}function d(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];n&&l(this,n)}return this}return h(d,{inject:function(e){if(e){var t=!0===e.statics?e:e.statics,n=e.beans,r=e.preserve;t!==e&&h(this.prototype,e,e.enumerable,n,r),h(this,t,null,n,r)}for(var i=1,a=arguments.length;i<a;i++)this.inject(arguments[i]);return this},extend:function(){for(var e,t,n,r=this,a=0,o=arguments.length;a<o&&(!e||!t);a++)n=arguments[a],e=e||n.initialize,t=t||n.prototype;return e=e||function(){r.apply(this,arguments)},t=e.prototype=t||i(this.prototype),s(t,"constructor",{value:e,writable:!0,configurable:!0}),h(e,this),arguments.length&&this.inject.apply(e,arguments),e.base=r,e}}).inject({enumerable:!1,initialize:d,set:d,inject:function(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];n&&h(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var e=i(this);return e.inject.apply(e,arguments)},each:function(e,t){return u(this,e,t)},clone:function(){return new this.constructor(this)},statics:{set:l,each:u,create:i,define:s,describe:a,clone:function(e){return l(new e.constructor,e)},isPlainObject:function(e){var t=null!=e&&e.constructor;return t&&(t===Object||t===d||"Object"===t.name)},pick:function(e,t){return e!==n?e:t},slice:function(e,t,n){return r.call(e,t,n)}}})};e.exports=a,a.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+a.each(this,(function(e,t){if(!/^_/.test(t)){var n=typeof e;this.push(t+": "+("number"===n?u.instance.number(e):"string"===n?"'"+e+"'":e))}}),[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(e){return a.importJSON(e,this)},exportJSON:function(e){return a.exportJSON(this,e)},toJSON:function(){return a.serialize(this)},set:function(e,t){return e&&a.filter(this,e,t,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function e(){var t=e.base.apply(this,arguments),n=t.prototype._class;return n&&!a.exports[n]&&(a.exports[n]=t),t},equals:function(e,t){if(e===t)return!0;if(e&&e.equals)return e.equals(t);if(t&&t.equals)return t.equals(e);if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)&&Array.isArray(t)){if((n=e.length)!==t.length)return!1;for(;n--;)if(!a.equals(e[n],t[n]))return!1}else{var n,r=Object.keys(e);if((n=r.length)!==Object.keys(t).length)return!1;for(;n--;){var i=r[n];if(!t.hasOwnProperty(i)||!a.equals(e[i],t[i]))return!1}}return!0}return!1},read:function(e,t,r,i){if(this===a){var s=this.peek(e,t);return e.__index++,s}var o=this.prototype,c=o._readIndex,l=t||c&&e.__index||0,u=e.length,h=e[l];if(i=i||u-l,h instanceof this||r&&r.readNull&&null==h&&i<=1)return c&&(e.__index=l+1),h&&r&&r.clone?h.clone():h;if(h=a.create(o),c&&(h.__read=!0),h=h.initialize.apply(h,l>0||l+i<u?a.slice(e,l,l+i):e)||h,c){e.__index=l+h.__read;var d=h.__filtered;d&&(e.__filtered=d,h.__filtered=n),h.__read=n}return h},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 i,a=[],s=t||0,o=r?s+r:e.length,c=s;c<o;c++)a.push(Array.isArray(i=e[c])?this.read(i,0,n):this.read(e,c,n,1));return a},readNamed:function(e,t,r,i,s){var o=this.getNamed(e,t),c=o!==n;if(c){var l=e.__filtered;if(!l){var u=this.getSource(e);(l=e.__filtered=a.create(u)).__unfiltered=u}l[t]=n}return this.read(c?[o]:e,r,i,s)},readSupported:function(e,t){var r=this.getSource(e),i=this,a=!1;return r&&Object.keys(r).forEach((function(r){if(r in t){var s=i.readNamed(e,r);s!==n&&(t[r]=s),a=!0}})),a},getSource:function(e){var t=e.__source;if(t===n){var r=1===e.length&&e[0];t=e.__source=r&&a.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,i){var a;function s(i){if(!(r&&i in r||a&&i in a)){var s=t[i];s!==n&&(e[i]=s)}}if(i){for(var o,c={},l=0,u=i.length;l<u;l++)(o=i[l])in t&&(s(o),c[o]=!0);a=c}return Object.keys(t.__unfiltered||t).forEach(s),e},isPlainValue:function(e,t){return a.isPlainObject(e)||Array.isArray(e)||t&&"string"==typeof e},serialize:function(e,t,n,r){t=t||{};var i,s=!r;if(s&&(t.formatter=new u(t.precision),r={length:0,definitions:{},references:{},add:function(e,t){var n="#"+e._id,r=this.references[n];if(!r){this.length++;var i=t.call(e),a=e._class;a&&i[0]!==a&&i.unshift(a),this.definitions[n]=i,r=this.references[n]=[n]}return r}}),e&&e._serialize){i=e._serialize(t,r);var o=e._class;!o||e._compactSerialize||!s&&n||i[0]===o||i.unshift(o)}else if(Array.isArray(e)){i=[];for(var c=0,l=e.length;c<l;c++)i[c]=a.serialize(e[c],t,n,r)}else if(a.isPlainObject(e)){i={};var h=Object.keys(e);for(c=0,l=h.length;c<l;c++){var d=h[c];i[d]=a.serialize(e[d],t,n,r)}}else i="number"==typeof e?t.formatter.number(e,t.precision):e;return s&&r.length>0?[["dictionary",r.definitions],i]:i},deserialize:function(e,t,n,r,i){var s=e,o=!n,c=o&&e&&e.length&&"dictionary"===e[0][0];if(n=n||{},Array.isArray(e)){var l=e[0],u="dictionary"===l;if(1==e.length&&/^#/.test(l))return n.dictionary[l];s=[];for(var h=(l=a.exports[l])?1:0,d=e.length;h<d;h++)s.push(a.deserialize(e[h],t,n,u,c));if(l){var f=s;s=t?t(l,f,o||i):new l(f)}}else if(a.isPlainObject(e))for(var p in s={},r&&(n.dictionary=s),e)s[p]=a.deserialize(e[p],t,n);return c?s[1]:s},exportJSON:function(e,t){var n=a.serialize(e,t);return t&&0==t.asString?n:JSON.stringify(n)},importJSON:function(e,t){return a.deserialize("string"==typeof e?JSON.parse(e):e,(function(e,n,r){var i=r&&t&&t.constructor===e,s=i?t:a.create(e.prototype);if(1===n.length&&s instanceof x&&(i||!(s instanceof C))){var o=n[0];a.isPlainObject(o)&&(o.insert=!1,i&&(n=n.concat([x.INSERT])))}return(i?s.set:e).apply(s,n),i&&(t=null),s}))},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 i=0;i<n;i++)e[r+i]=t[i]}return e},splice:function(e,t,r,i){var s=t&&t.length,o=r===n;(r=o?e.length:r)>e.length&&(r=e.length);for(var c=0;c<s;c++)t[c]._index=r+c;if(o)return a.push(e,t),[];var l=[r,i];t&&a.push(l,t);for(var u=e.splice.apply(e,l),h=(c=0,u.length);c<h;c++)u[c]._index=n;for(c=r+s,h=e.length;c<h;c++)e[c]._index=c;return u},capitalize:function(e){return e.replace(/\b[a-z]/g,(function(e){return e.toUpperCase()}))},camelize:function(e){return e.replace(/-(.)/g,(function(e,t){return t.toUpperCase()}))},hyphenate:function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}}});var s={on:function(e,t){if("string"!=typeof e)a.each(e,(function(e,t){this.on(t,e)}),this);else{var n=this._eventTypes,r=n&&n[e],i=this._callbacks=this._callbacks||{};-1===(i=i[e]=i[e]||[]).indexOf(t)&&(i.push(t),r&&r.install&&1===i.length&&r.install.call(this,e))}return this},off:function(e,t){if("string"==typeof e){var n,r=this._eventTypes,i=r&&r[e],s=this._callbacks&&this._callbacks[e];return s&&(!t||-1!==(n=s.indexOf(t))&&1===s.length?(i&&i.uninstall&&i.uninstall.call(this,e),delete this._callbacks[e]):-1!==n&&s.splice(n,1)),this}a.each(e,(function(e,t){this.off(t,e)}),this)},once:function(e,t){return this.on(e,(function n(){t.apply(this,arguments),this.off(e,n)}))},emit:function(e,t){var n=this._callbacks&&this._callbacks[e];if(!n)return!1;var r=a.slice(arguments,1),i=t&&t.target&&!t.currentTarget;n=n.slice(),i&&(t.currentTarget=this);for(var s=0,o=n.length;s<o;s++)if(0==n[s].apply(this,r)){t&&t.stop&&t.stop();break}return i&&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 i in n)if(n[i].length>0){var a=t[i],s=a&&a[r];s&&s.call(this,i)}},statics:{inject:function e(t){var n=t._events;if(n){var r={};a.each(n,(function(e,n){var i="string"==typeof e,s=i?e:n,o=a.capitalize(s),c=s.substring(2).toLowerCase();r[c]=i?{}:e,s="_"+s,t["get"+o]=function(){return this[s]},t["set"+o]=function(e){var t=this[s];t&&this.off(c,t),e&&this.on(c,e),this[s]=e}})),t._eventTypes=r}return e.base.apply(this,arguments)}}},o=a.extend({_class:"PaperScope",initialize:function e(){oe=this,this.settings=new a({applyMatrix:!0,insertItems:!0,handleSize:4,hitTolerance:0}),this.project=null,this.projects=[],this.tools=[],this._id=e._id++,e._scopes[this._id]=this;var n=e.prototype;if(!this.support){var r=re.getContext(1,1)||{};n.support={nativeDash:"setLineDash"in r||"mozDash"in r,nativeBlendModes:ie.nativeModes},re.release(r)}if(!this.agent){var i=t.navigator.userAgent.toLowerCase(),s=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(i)||[])[0],o="darwin"===s?"mac":s,c=n.agent=n.browser={platform:o};o&&(c[o]=!0),i.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,(function(e,t,n,r,i){if(!c.chrome){var a="opera"===t?r:/^(node|trident)$/.test(t)?i:n;c.version=a,c.versionNumber=parseFloat(a),t={trident:"msie",jsdom:"node"}[t]||t,c.name=t,c[t]=!0}})),c.chrome&&delete c.webkit,c.atom&&delete c.chrome}},version:"0.12.18",getView:function(){var e=this.project;return e&&e._view},getPaper:function(){return this},execute:function(e,t){var n=oe.PaperScript.execute(e,this,t);return Y.updateFocus(),n},install:function(e){var t=this;for(var n in a.each(["project","view","tool"],(function(n){a.define(e,n,{configurable:!0,get:function(){return t[n]}})})),this)!/^_/.test(n)&&this[n]&&(e[n]=this[n])},setup:function(e){return oe=this,this.project=new w(e),this},createCanvas:function(e,t){return re.getCanvas(e,t)},activate:function(){oe=this},clear:function(){for(var e=this.projects,t=this.tools,n=e.length-1;n>=0;n--)e[n].remove();for(n=t.length-1;n>=0;n--)t[n].remove()},remove:function(){this.clear(),delete o._scopes[this._id]},statics:new function(){function e(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:e("get"),hasAttribute:e("has")}}}),c=a.extend(s,{initialize:function(e){this._scope=oe,this._index=this._scope[this._list].push(this)-1,!e&&this._scope[this._reference]||this.activate()},activate:function(){if(!this._scope)return!1;var e=this._scope[this._reference];return e&&e!==this&&e.emit("deactivate"),this._scope[this._reference]=this,this.emit("activate",e),!0},isActive:function(){return this._scope[this._reference]===this},remove:function(){return null!=this._index&&(a.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()}}),l={findItemBoundsCollisions:function(e,t,n){function r(e){for(var t=new 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 i=r(e),a=t&&t!==e?r(t):i;return this.findBoundsCollisions(i,a,n||0)},findCurveBoundsCollisions:function(e,t,n,r){function i(e){for(var t=Math.min,n=Math.max,r=new Array(e.length),i=0;i<e.length;i++){var a=e[i];r[i]=[t(a[0],a[2],a[4],a[6]),t(a[1],a[3],a[5],a[7]),n(a[0],a[2],a[4],a[6]),n(a[1],a[3],a[5],a[7])]}return r}var a=i(e),s=t&&t!==e?i(t):a;if(r){for(var o=this.findBoundsCollisions(a,s,n||0,!1,!0),c=this.findBoundsCollisions(a,s,n||0,!0,!0),l=[],u=0,h=o.length;u<h;u++)l[u]={hor:o[u],ver:c[u]};return l}return this.findBoundsCollisions(a,s,n||0)},findBoundsCollisions:function(e,t,n,r,i){var a=!t||e===t,s=a?e:e.concat(t),o=e.length,c=s.length;function l(e,t,n){for(var r=0,i=e.length;r<i;){var a=i+r>>>1;s[e[a]][t]<n?r=a+1:i=a}return r-1}for(var u=r?1:0,h=u+2,d=r?0:1,f=d+2,p=new Array(c),m=0;m<c;m++)p[m]=m;p.sort((function(e,t){return s[e][u]-s[t][u]}));var g=[],v=new Array(o);for(m=0;m<c;m++){var y=p[m],b=s[y],_=a?y:y-o,w=y<o,x=a||!w,k=w?[]:null;if(g.length){var C=l(g,h,b[u]-n)+1;if(g.splice(0,C),a&&i){k=k.concat(g);for(var S=0;S<g.length;S++)v[T=g[S]].push(_)}else{var E=b[f],M=b[d];for(S=0;S<g.length;S++){var T=g[S],N=s[T],A=T<o,P=a||T>=o;(i||(w&&P||x&&A)&&E>=N[d]-n&&M<=N[f]+n)&&(w&&P&&k.push(a?T:T-o),x&&A&&v[T].push(_))}}}if(w&&(e===t&&k.push(y),v[y]=k),g.length){var I=l(g,h,b[h]);g.splice(I+1,0,y)}else g.push(y)}for(m=0;m<v.length;m++){var D=v[m];D&&D.sort((function(e,t){return e-t}))}return v}},u=a.extend({initialize:function(e){this.precision=a.pick(e,5),this.multiplier=Math.pow(10,this.precision)},number:function(e){return this.precision<16?Math.round(e*this.multiplier)/this.multiplier:e},pair:function(e,t,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)}});u.instance=new u;var h=new function(){var e=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],t=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],n=Math.abs,r=Math.sqrt,i=Math.pow,a=Math.log2||function(e){return Math.log(e)*Math.LOG2E},s=1e-12,o=112e-18;function c(e,t,n){return e<t?t:e>n?n:e}function l(e,t,r){function i(e){var t=134217729*e,n=e-t+t;return[n,e-n]}var a=t*t-e*r,s=t*t+e*r;if(3*n(a)<s){var o=i(e),c=i(t),l=i(r),u=t*t,h=e*r;a=u-h+(c[0]*c[0]-u+2*c[0]*c[1]+c[1]*c[1]-(o[0]*l[0]-h+o[0]*l[1]+o[1]*l[0]+o[1]*l[1]))}return a}function u(){var e=Math.max.apply(Math,arguments);return e&&(e<1e-8||e>1e8)?i(2,-Math.round(a(e))):0}return{EPSILON:s,MACHINE_EPSILON:o,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>=-1e-12&&e<=s},isMachineZero:function(e){return e>=-112e-18&&e<=o},clamp:c,integrate:function(n,r,i,a){for(var s=e[a-2],o=t[a-2],c=.5*(i-r),l=c+r,u=0,h=a+1>>1,d=1&a?o[u++]*n(l):0;u<h;){var f=c*s[u];d+=o[u++]*(n(l+f)+n(l-f))}return c*d},findRoot:function(e,t,r,i,a,s,o){for(var l=0;l<s;l++){var u=e(r),h=u/t(r),d=r-h;if(n(h)<o){r=d;break}u>0?(a=r,r=d<=i?.5*(i+a):d):(i=r,r=d>=a?.5*(i+a):d)}return c(r,i,a)},solveQuadratic:function(e,t,i,a,h,d){var f,p=1/0;if(n(e)<s){if(n(t)<s)return n(i)<s?-1:0;f=-i/t}else{var m=l(e,t*=-.5,i);if(m&&n(m)<o){var g=u(n(e),n(t),n(i));g&&(m=l(e*=g,t*=g,i*=g))}if(m>=-112e-18){var v=m<0?0:r(m),y=t+(t<0?-v:v);0===y?p=-(f=i/e):(f=y/e,p=i/y)}}var b=0,_=null==h,w=h-s,x=d+s;return isFinite(f)&&(_||f>w&&f<x)&&(a[b++]=_?f:c(f,h,d)),p!==f&&isFinite(p)&&(_||p>w&&p<x)&&(a[b++]=_?p:c(p,h,d)),b},solveCubic:function(e,t,a,l,d,f,p){var m,g,v,y,b,_=u(n(e),n(t),n(a),n(l));function w(n){var r=e*(m=n);y=(r+(g=r+t))*m+(v=g*m+a),b=v*m+l}if(_&&(e*=_,t*=_,a*=_,l*=_),n(e)<s)e=t,g=a,v=l,m=1/0;else if(n(l)<s)g=t,v=a,m=0;else{w(-t/e/3);var x=b/e,k=i(n(x),1/3),C=x<0?-1:1,S=-y/e,E=S>0?1.324717957244746*Math.max(k,r(S)):k,M=m-C*E;if(M!==m){do{w(M),M=0===y?m:m-b/y/(1+o)}while(C*M>C*m);n(e)*m*m>n(l/m)&&(g=((v=-l/m)-a)/m)}}var T=h.solveQuadratic(e,g,v,d,f,p),N=null==f;return isFinite(m)&&(0===T||T>0&&m!==d[0]&&m!==d[1])&&(N||m>f-s&&m<p+s)&&(d[T++]=N?m:c(m,f,p)),T}}},d={_id:1,_pools:{},get:function(e){if(e){var t=this._pools[e];return t||(t=this._pools[e]={_id:1}),t._id++}return this._id++}},f=a.extend({_class:"Point",_readIndex:!0,initialize:function(e,t){var n=typeof e,r=this.__read,i=0;if("number"===n){var a="number"==typeof t;this._set(e,a?t:e),r&&(i=a?2:1)}else if("undefined"===n||null===e)this._set(0,0),r&&(i=null===e?1:0);else{var s="string"===n?e.split(/[\s,]+/)||[]:e;i=1,Array.isArray(s)?this._set(+s[0],+(s.length>1?s[1]:s[0])):"x"in s?this._set(s.x||0,s.y||0):"width"in s?this._set(s.width||0,s.height||0):"angle"in s?(this._set(s.length||0,0),this.setAngle(s.angle||0)):(this._set(0,0),i=0)}return r&&(this.__read=i),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 f(this.x,this.y)},toString:function(){var e=u.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();h.isZero(n)&&this.getAngle(),this._set(this.x*n,this.y*n)}},getAngle:function(){return 180*this.getAngleInRadians.apply(this,arguments)/Math.PI},setAngle:function(e){this.setAngleInRadians.call(this,e*Math.PI/180)},getAngleInDegrees:"#getAngle",setAngleInDegrees:"#setAngle",getAngleInRadians:function(){if(arguments.length){var e=f.read(arguments),t=this.getLength()*e.getLength();if(h.isZero(t))return NaN;var n=this.dot(e)/t;return Math.acos(n<-1?-1:n>1?1:n)}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=f.read(arguments);return 180*Math.atan2(this.cross(e),this.dot(e))/Math.PI},getDistance:function(){var e=arguments,t=f.read(e),n=t.x-this.x,r=t.y-this.y,i=n*n+r*r;return a.read(e)?i:Math.sqrt(i)},normalize:function(e){e===n&&(e=1);var t=this.getLength(),r=0!==t?e/t:0,i=new f(this.x*r,this.y*r);return r>=0&&(i._angle=this._angle),i},rotate:function(e,t){if(0===e)return this.clone();e=e*Math.PI/180;var n=t?this.subtract(t):this,r=Math.sin(e),i=Math.cos(e);return n=new f(n.x*i-n.y*r,n.x*r+n.y*i),t?n.add(t):n},transform:function(e){return e?e._transformPoint(this):this},add:function(){var e=f.read(arguments);return new f(this.x+e.x,this.y+e.y)},subtract:function(){var e=f.read(arguments);return new f(this.x-e.x,this.y-e.y)},multiply:function(){var e=f.read(arguments);return new f(this.x*e.x,this.y*e.y)},divide:function(){var e=f.read(arguments);return new f(this.x/e.x,this.y/e.y)},modulo:function(){var e=f.read(arguments);return new f(this.x%e.x,this.y%e.y)},negate:function(){return new f(-this.x,-this.y)},isInside:function(){return v.read(arguments).contains(this)},isClose:function(){var e=arguments,t=f.read(e),n=a.read(e);return this.getDistance(t)<=n},isCollinear:function(){var e=f.read(arguments);return f.isCollinear(this.x,this.y,e.x,e.y)},isColinear:"#isCollinear",isOrthogonal:function(){var e=f.read(arguments);return f.isOrthogonal(this.x,this.y,e.x,e.y)},isZero:function(){var e=h.isZero;return e(this.x)&&e(this.y)},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},isInQuadrant:function(e){return this.x*(e>1&&e<4?-1:1)>=0&&this.y*(e>2?-1:1)>=0},dot:function(){var e=f.read(arguments);return this.x*e.x+this.y*e.y},cross:function(){var e=f.read(arguments);return this.x*e.y-this.y*e.x},project:function(){var e=f.read(arguments),t=e.isZero()?0:this.dot(e)/e.dot(e);return new f(e.x*t,e.y*t)},statics:{min:function(){var e=arguments,t=f.read(e),n=f.read(e);return new f(Math.min(t.x,n.x),Math.min(t.y,n.y))},max:function(){var e=arguments,t=f.read(e),n=f.read(e);return new f(Math.max(t.x,n.x),Math.max(t.y,n.y))},random:function(){return new f(Math.random(),Math.random())},isCollinear:function(e,t,n,r){return Math.abs(e*r-t*n)<=1e-8*Math.sqrt((e*e+t*t)*(n*n+r*r))},isOrthogonal:function(e,t,n,r){return Math.abs(e*n+t*r)<=1e-8*Math.sqrt((e*e+t*t)*(n*n+r*r))}}},a.each(["round","ceil","floor","abs"],(function(e){var t=Math[e];this[e]=function(){return new f(t(this.x),t(this.y))}}),{})),p=f.extend({initialize:function(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"setPosition"===this._setter?4:0}}),m=a.extend({_class:"Size",_readIndex:!0,initialize:function(e,t){var n=typeof e,r=this.__read,i=0;if("number"===n){var a="number"==typeof t;this._set(e,a?t:e),r&&(i=a?2:1)}else if("undefined"===n||null===e)this._set(0,0),r&&(i=null===e?1:0);else{var s="string"===n?e.split(/[\s,]+/)||[]:e;i=1,Array.isArray(s)?this._set(+s[0],+(s.length>1?s[1]:s[0])):"width"in s?this._set(s.width||0,s.height||0):"x"in s?this._set(s.x||0,s.y||0):(this._set(0,0),i=0)}return r&&(this.__read=i),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 m(this.width,this.height)},toString:function(){var e=u.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=m.read(arguments);return new m(this.width+e.width,this.height+e.height)},subtract:function(){var e=m.read(arguments);return new m(this.width-e.width,this.height-e.height)},multiply:function(){var e=m.read(arguments);return new m(this.width*e.width,this.height*e.height)},divide:function(){var e=m.read(arguments);return new m(this.width/e.width,this.height/e.height)},modulo:function(){var e=m.read(arguments);return new m(this.width%e.width,this.height%e.height)},negate:function(){return new m(-this.width,-this.height)},isZero:function(){var e=h.isZero;return e(this.width)&&e(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(e,t){return new m(Math.min(e.width,t.width),Math.min(e.height,t.height))},max:function(e,t){return new m(Math.max(e.width,t.width),Math.max(e.height,t.height))},random:function(){return new m(Math.random(),Math.random())}}},a.each(["round","ceil","floor","abs"],(function(e){var t=Math[e];this[e]=function(){return new m(t(this.width),t(this.height))}}),{})),g=m.extend({initialize:function(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)}}),v=a.extend({_class:"Rectangle",_readIndex:!0,beans:!0,initialize:function(e,t,r,i){var s,o=arguments,c=typeof e;if("number"===c?(this._set(e,t,r,i),s=4):"undefined"===c||null===e?(this._set(0,0,0,0),s=null===e?1:0):1===o.length&&(Array.isArray(e)?(this._set.apply(this,e),s=1):e.x!==n||e.width!==n?(this._set(e.x||0,e.y||0,e.width||0,e.height||0),s=1):e.from===n&&e.to===n&&(this._set(0,0,0,0),a.readSupported(o,this)&&(s=1))),s===n){var l,u,h=f.readNamed(o,"from"),d=a.peek(o),p=h.x,g=h.y;if(d&&d.x!==n||a.hasNamed(o,"to")){var v=f.readNamed(o,"to");l=v.x-p,u=v.y-g,l<0&&(p=v.x,l=-l),u<0&&(g=v.y,u=-u)}else{var y=m.read(o);l=y.width,u=y.height}this._set(p,g,l,u),s=o.__index}var b=o.__filtered;return b&&(this.__filtered=b),this.__read&&(this.__read=s),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 v(this.x,this.y,this.width,this.height)},equals:function(e){var t=a.isPlainValue(e)?v.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=u.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?f:p)(this.x,this.y,this,"setPoint")},setPoint:function(){var e=f.read(arguments);this.x=e.x,this.y=e.y},getSize:function(e){return new(e?m:g)(this.width,this.height,this,"setSize")},_fw:1,_fh:1,setSize:function(){var e=m.read(arguments),t=this._sx,n=this._sy,r=e.width,i=e.height;t&&(this.x+=(this.width-r)*t),n&&(this.y+=(this.height-i)*n),this.width=r,this.height=i,this._fw=this._fh=1},getLeft:function(){return this.x},setLeft:function(e){if(!this._fw){var t=e-this.x;this.width-=.5===this._sx?2*t:t}this.x=e,this._sx=this._fw=0},getTop:function(){return this.y},setTop:function(e){if(!this._fh){var t=e-this.y;this.height-=.5===this._sy?2*t:t}this.y=e,this._sy=this._fh=0},getRight:function(){return this.x+this.width},setRight:function(e){if(!this._fw){var t=e-this.x;this.width=.5===this._sx?2*t:t}this.x=e-this.width,this._sx=1,this._fw=0},getBottom:function(){return this.y+this.height},setBottom:function(e){if(!this._fh){var t=e-this.y;this.height=.5===this._sy?2*t:t}this.y=e-this.height,this._sy=1,this._fh=0},getCenterX:function(){return this.x+this.width/2},setCenterX:function(e){this._fw||.5===this._sx?this.x=e-this.width/2:(this._sx&&(this.x+=2*(e-this.x)*this._sx),this.width=2*(e-this.x)),this._sx=.5,this._fw=0},getCenterY:function(){return this.y+this.height/2},setCenterY:function(e){this._fh||.5===this._sy?this.y=e-this.height/2:(this._sy&&(this.y+=2*(e-this.y)*this._sy),this.height=2*(e-this.y)),this._sy=.5,this._fh=0},getCenter:function(e){return new(e?f:p)(this.getCenterX(),this.getCenterY(),this,"setCenter")},setCenter:function(){var e=f.read(arguments);return this.setCenterX(e.x),this.setCenterY(e.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return 0===this.width||0===this.height},contains:function(e){return e&&e.width!==n||4===(Array.isArray(e)?e:arguments).length?this._containsRectangle(v.read(arguments)):this._containsPoint(f.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=v.read(arguments),t=a.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=v.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),i=Math.min(this.y+this.height,e.y+e.height);return new v(t,n,r-t,i-n)},unite:function(){var e=v.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),i=Math.max(this.y+this.height,e.y+e.height);return new v(t,n,r-t,i-n)},include:function(){var e=f.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),i=Math.max(this.y+this.height,e.y);return new v(t,n,r-t,i-n)},expand:function(){var e=m.read(arguments),t=e.width,n=e.height;return new v(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)}},a.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 i=e[r?0:1],a=e[r?1:0],s="get"+i,o="get"+a,c="set"+i,l="set"+a,u="set"+n;this["get"+n]=function(e){return new(e?f:p)(this[s](),this[o](),this,u)},this[u]=function(){var e=f.read(arguments);this[c](e.x),this[l](e.y)}}),{beans:!0})),y=v.extend({initialize:function(e,t,n,r,i,a){this._set(e,t,n,r,!0),this._owner=i,this._setter=a},_set:function(e,t,n,r,i){return this._x=e,this._y=t,this._width=n,this._height=r,i||this._owner[this._setter](this),this}},new function(){var e=v.prototype;return a.each(["x","y","width","height"],(function(e){var t=a.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)}}),a.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!!(2&this._owner._selection)},setSelected:function(e){var t=this._owner;t._changeSelection&&t._changeSelection(2,e)}}))}),b=a.extend({_class:"Matrix",initialize:function e(t,n){var r=arguments,i=r.length,a=!0;if(i>=6?this._set.apply(this,r):1===i||2===i?t instanceof e?this._set(t._a,t._b,t._c,t._d,t._tx,t._ty,n):Array.isArray(t)?this._set.apply(this,n?t.concat([n]):t):a=!1:i?a=!1:this.reset(),!a)throw new Error("Unsupported matrix parameters");return this},set:"#initialize",_set:function(e,t,n,r,i,a,s){return this._a=e,this._b=t,this._c=n,this._d=r,this._tx=i,this._ty=a,s||this._changed(),this},_serialize:function(e,t){return a.serialize(this.getValues(),e,!0,t)},_changed:function(){var e=this._owner;e&&(e._applyMatrix?e.transform(null,!0):e._changed(25))},clone:function(){return new b(this._a,this._b,this._c,this._d,this._tx,this._ty)},equals:function(e){return e===this||e&&this._a===e._a&&this._b===e._b&&this._c===e._c&&this._d===e._d&&this._tx===e._tx&&this._ty===e._ty},toString:function(){var e=u.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,a.pick(e,!0),t),this.isIdentity())},translate:function(){var e=f.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=f.read(e),n=f.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=f.read(arguments,1),n=t.x,r=t.y,i=Math.cos(e),a=Math.sin(e),s=n-n*i+r*a,o=r-n*a-r*i,c=this._a,l=this._b,u=this._c,h=this._d;return this._a=i*c+a*u,this._b=i*l+a*h,this._c=-a*c+i*u,this._d=-a*l+i*h,this._tx+=s*c+o*u,this._ty+=s*l+o*h,this._changed(),this},shear:function(){var e=arguments,t=f.read(e),n=f.read(e,0,{readNull:!0});n&&this.translate(n);var r=this._a,i=this._b;return this._a+=t.y*this._c,this._b+=t.y*this._d,this._c+=t.x*r,this._d+=t.x*i,n&&this.translate(n.negate()),this._changed(),this},skew:function(){var e=arguments,t=f.read(e),n=f.read(e,0,{readNull:!0}),r=Math.PI/180,i=new f(Math.tan(t.x*r),Math.tan(t.y*r));return this.shear(i,n)},append:function(e,t){if(e){var n=this._a,r=this._b,i=this._c,a=this._d,s=e._a,o=e._c,c=e._b,l=e._d,u=e._tx,h=e._ty;this._a=s*n+c*i,this._c=o*n+l*i,this._b=s*r+c*a,this._d=o*r+l*a,this._tx+=u*n+h*i,this._ty+=u*r+h*a,t||this._changed()}return this},prepend:function(e,t){if(e){var n=this._a,r=this._b,i=this._c,a=this._d,s=this._tx,o=this._ty,c=e._a,l=e._c,u=e._b,h=e._d,d=e._tx,f=e._ty;this._a=c*n+l*r,this._c=c*i+l*a,this._b=u*n+h*r,this._d=u*i+h*a,this._tx=c*s+l*o+d,this._ty=u*s+h*o+f,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,i=this._tx,a=this._ty,s=e*r-t*n,o=null;return s&&!isNaN(s)&&isFinite(i)&&isFinite(a)&&(this._a=r/s,this._b=-t/s,this._c=-n/s,this._d=e/s,this._tx=(n*a-r*i)/s,this._ty=(t*i-e*a)/s,o=this),o},inverted:function(){return this.clone().invert()},concatenate:"#append",preConcatenate:"#prepend",chain:"#appended",_shiftless:function(){return new b(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return 1===this._a&&0===this._b&&0===this._c&&1===this._d&&0===this._tx&&0===this._ty},isInvertible:function(){var e=this._a*this._d-this._c*this._b;return e&&!isNaN(e)&&isFinite(this._tx)&&isFinite(this._ty)},isSingular:function(){return!this.isInvertible()},transform:function(e,t,n){return arguments.length<3?this._transformPoint(f.read(arguments)):this._transformCoordinates(e,t,n)},_transformPoint:function(e,t,n){var r=e.x,i=e.y;return t||(t=new f),t._set(r*this._a+i*this._c+this._tx,r*this._b+i*this._d+this._ty,n)},_transformCoordinates:function(e,t,n){for(var r=0,i=2*n;r<i;r+=2){var a=e[r],s=e[r+1];t[r]=a*this._a+s*this._c+this._tx,t[r+1]=a*this._b+s*this._d+this._ty}return t},_transformCorners:function(e){var t=e.x,n=e.y,r=t+e.width,i=n+e.height,a=[t,n,r,n,r,i,t,i];return this._transformCoordinates(a,a,4)},_transformBounds:function(e,t,n){for(var r=this._transformCorners(e),i=r.slice(0,2),a=i.slice(),s=2;s<8;s++){var o=r[s],c=1&s;o<i[c]?i[c]=o:o>a[c]&&(a[c]=o)}return t||(t=new v),t._set(i[0],i[1],a[0]-i[0],a[1]-i[1],n)},inverseTransform:function(){return this._inverseTransform(f.read(arguments))},_inverseTransform:function(e,t,n){var r=this._a,i=this._b,a=this._c,s=this._d,o=this._tx,c=this._ty,l=r*s-i*a,u=null;if(l&&!isNaN(l)&&isFinite(o)&&isFinite(c)){var h=e.x-this._tx,d=e.y-this._ty;t||(t=new f),u=t._set((h*s-d*a)/l,(d*r-h*i)/l,n)}return u},decompose:function(){var e,t,n,r=this._a,i=this._b,a=this._c,s=this._d,o=r*s-i*a,c=Math.sqrt,l=Math.atan2,u=180/Math.PI;if(0!==r||0!==i){var h=c(r*r+i*i);e=Math.acos(r/h)*(i>0?1:-1),t=[h,o/h],n=[l(r*a+i*s,h*h),0]}else if(0!==a||0!==s){var d=c(a*a+s*s);e=Math.asin(a/d)*(s>0?1:-1),t=[o/d,d],n=[0,l(r*a+i*s,d*d)]}else e=0,n=t=[0,0];return{translation:this.getTranslation(),rotation:e*u,scaling:new f(t),skewing:new f(n[0]*u,n[1]*u)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new f(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)}},a.each(["a","b","c","d","tx","ty"],(function(e){var t=a.capitalize(e),n="_"+e;this["get"+t]=function(){return this[n]},this["set"+t]=function(e){this[n]=e,this._changed()}}),{})),_=a.extend({_class:"Line",initialize:function(e,t,n,r,i){var a=!1;arguments.length>=4?(this._px=e,this._py=t,this._vx=n,this._vy=r,a=i):(this._px=e.x,this._py=e.y,this._vx=t.x,this._vy=t.y,a=n),a||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new f(this._px,this._py)},getVector:function(){return new f(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(e,t){return _.intersect(this._px,this._py,this._vx,this._vy,e._px,e._py,e._vx,e._vy,!0,t)},getSide:function(e,t){return _.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 _.getSignedDistance(this._px,this._py,this._vx,this._vy,e.x,e.y,!0)},isCollinear:function(e){return f.isCollinear(this._vx,this._vy,e._vx,e._vy)},isOrthogonal:function(e){return f.isOrthogonal(this._vx,this._vy,e._vx,e._vy)},statics:{intersect:function(e,t,n,r,i,a,s,o,c,l){c||(n-=e,r-=t,s-=i,o-=a);var u=n*o-r*s;if(!h.isMachineZero(u)){var d=e-i,p=t-a,m=(s*p-o*d)/u,g=(n*p-r*d)/u,v=-1e-12,y=1+1e-12;if(l||v<m&&m<y&&v<g&&g<y)return l||(m=m<=0?0:m>=1?1:m),new f(e+m*n,t+m*r)}},getSide:function(e,t,n,r,i,a,s,o){s||(n-=e,r-=t);var c=i-e,l=c*r-(a-t)*n;return!o&&h.isMachineZero(l)&&(l=(c*n+c*n)/(n*n+r*r))>=0&&l<=1&&(l=0),l<0?-1:l>0?1:0},getSignedDistance:function(e,t,n,r,i,a,s){return s||(n-=e,r-=t),0===n?r>0?i-e:e-i:0===r?n<0?a-t:t-a:((i-e)*r-(a-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,i,a,s){return Math.abs(_.getSignedDistance(e,t,n,r,i,a,s))}}}),w=c.extend({_class:"Project",_list:"projects",_reference:"project",_compactSerialize:!0,initialize:function(e){c.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new U(null,null,this),this._view=Y.create(this,e||re.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(e,t){return a.serialize(this._children,e,!0,t)},_changed:function(e,t){if(1&e){var n=this._view;n&&(n._needsUpdate=!0,!n._requested&&n._autoUpdate&&n.requestUpdate())}var r=this._changes;if(r&&t){var i=this._changesById,a=t._id,s=i[a];s?s.flags|=e:r.push(i[a]={item:t,flags:e})}},clear:function(){for(var e=this._children,t=e.length-1;t>=0;t--)e[t].remove()},isEmpty:function(){return!this._children.length},remove:function e(){return!!e.base.call(this)&&(this._view&&this._view.remove(),!0)},getView:function(){return this._view},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(e){this._currentStyle.set(e)},getIndex:function(){return this._index},getOptions:function(){return this._scope.settings},getLayers:function(){return this._children},getActiveLayer:function(){return this._activeLayer||new C({project:this,insert:!0})},getSymbolDefinitions:function(){var e=[],t={};return this.getItems({class:M,match:function(n){var r=n._definition,i=r._id;return t[i]||(t[i]=!0,e.push(r)),!1}}),e},getSymbols:"getSymbolDefinitions",getSelectedItems:function(){var e=this._selectionItems,t=[];for(var n in e){var r=e[n],i=r._selection;1&i&&r.isInserted()?t.push(r):i||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 C){t._remove(!1,!0),a.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 C(x.NO_INSERT),!0)).insertChild(e,t),r&&t.activate&&t.activate(),t},getItems:function(e){return x._getItems(this,e)},getItem:function(e){return x._getItems(this,e,null,null,!0)[0]||null},importJSON:function(e){this.activate();var t=this._activeLayer;return a.importJSON(e,t&&t.isEmpty()&&t)},removeOn:function(e){var t=this._removeSets;if(t){"mouseup"===e&&(t.mousedrag=null);var n=t[e];if(n){for(var r in n){var i=n[r];for(var a in t){var s=t[a];s&&s!=n&&delete s[i._id]}i.remove()}t[e]=null}}},draw:function(e,t,n){this._updateVersion++,e.save(),t.applyToContext(e);for(var r=this._children,i=new a({offset:new f(0,0),pixelRatio:n,viewMatrix:t.isIdentity()?null:t,matrices:[new b],updateMatrix:!0}),s=0,o=r.length;s<o;s++)r[s].draw(e,i);if(e.restore(),this._selectionCount>0){e.save(),e.strokeWidth=1;var c=this._selectionItems,l=this._scope.settings.handleSize,u=this._updateVersion;for(var h in c)c[h]._drawSelection(e,t,l,c,u);e.restore()}}}),x=a.extend(s,{statics:{extend:function e(t){return t._serializeFields&&(t._serializeFields=a.set({},this.prototype._serializeFields,t._serializeFields)),e.base.apply(this,arguments)},INSERT:{insert:!0},NO_INSERT:{insert:!1}},_class:"Item",_name:null,_applyMatrix:!0,_canApplyMatrix:!0,_canScaleStroke:!1,_pivot:null,_visible:!0,_blendMode:"normal",_opacity:1,_locked:!1,_guide:!1,_clipMask:!1,_selection:0,_selectBounds:!0,_selectChildren:!1,_serializeFields:{name:null,applyMatrix:null,matrix:new b,pivot:null,visible:!0,blendMode:"normal",opacity:1,locked:!1,guide:!1,clipMask:!1,selected:!1,data:{}},_prioritize:["applyMatrix"]},new function(){var e=["onMouseDown","onMouseUp","onMouseDrag","onClick","onDoubleClick","onMouseMove","onMouseEnter","onMouseLeave"];return a.each(e,(function(e){this._events[e]={install:function(e){this.getView()._countItemEvent(e,1)},uninstall:function(e){this.getView()._countItemEvent(e,-1)}}}),{_events:{onFrame:{install:function(){this.getView()._animateItem(this,!0)},uninstall:function(){this.getView()._animateItem(this,!1)}},onLoad:{},onError:{}},statics:{_itemHandlers:e}})},{initialize:function(){},_initialize:function(e,t){var r=e&&a.isPlainObject(e),i=r&&!0===e.internal,s=this._matrix=new b,o=r&&e.project||oe.project,c=oe.settings;return this._id=i?null:d.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&c.applyMatrix,t&&s.translate(t),s._owner=this,this._style=new U(o._currentStyle,this,o),i||r&&0==e.insert||!c.insertItems&&(!r||1!=e.insert)?this._setProject(o):(r&&e.parent||o)._insertItem(n,this,!0),r&&e!==x.NO_INSERT&&e!==x.INSERT&&this.set(e,{internal:!0,insert:!0,project:!0,parent:!0}),r},_serialize:function(e,t){var n={},r=this;function i(i){for(var s in i){var o=r[s];a.equals(o,"leading"===s?1.2*i.fontSize:i[s])||(n[s]=a.serialize(o,e,"data"!==s,t))}}return i(this._serializeFields),this instanceof k||i(this._style._defaults),[this._class,n]},_changed:function(e){var t=this._symbol,r=this._parent||t,i=this._project;8&e&&(this._bounds=this._position=this._decomposed=n),16&e&&(this._globalMatrix=n),r&&72&e&&x._clearBoundsCache(r),2&e&&x._clearBoundsCache(this),i&&i._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 new Error("Names consisting only of numbers are not supported.");var t=this._getOwner();if(e&&t){var r=t._children,i=t._namedChildren;(i[e]=i[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)}},a.each(["locked","visible","blendMode","opacity","guide"],(function(e){var t=a.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!!(1&this._selection)},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=!!(1&this._selection);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?f:p,n=this._position||(this._position=this._getPositionFromBounds());return new t(n.x,n.y,this,"setPosition")},setPosition:function(){this.translate(f.read(arguments).subtract(this.getPosition(!0)))},_getPositionFromBounds:function(e){return this._pivot?this._matrix._transformPoint(this._pivot):(e||this.getBounds()).getCenter(!0)},getPivot:function(){var e=this._pivot;return e?new p(e.x,e.y,this,"setPivot"):null},setPivot:function(){this._pivot=f.read(arguments,0,{clone:!0,readNull:!0}),this._position=n}},a.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 b,r=a.set({},n?t:e,this._boundsOptions);r.stroke&&!this.getStrokeScaling()||(r.cacheItem=this);var i=this._getCachedBounds(n&&e,r).rect;return arguments.length?i:new y(i.x,i.y,i.width,i.height,this,"setBounds")},setBounds:function(){var e=v.read(arguments),t=this.getBounds(),n=this._matrix,r=new b,i=e.getCenter();r.translate(i),e.width==t.width&&e.height==t.height||(n.isInvertible()||(n.set(n._backup||(new b).translate(n.getTranslation())),t=this.getBounds()),r.scale(0!==t.width?e.width/t.width:0,0!==t.height?e.height/t.height:0)),i=t.getCenter(),r.translate(-i.x,-i.y),this.transform(r)},_getBounds:function(e,t){var n=this._children;return n&&n.length?(x._updateBoundsCache(this,t.cacheItem),x._getBounds(n,e,t)):new v},_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,i=t.cacheItem,a=r?null:this._matrix._orNullIfIdentity(),s=i&&(!e||e.equals(a))&&this._getBoundsCacheKey(t,r),o=this._bounds;if(x._updateBoundsCache(this._parent||this._symbol,i),s&&o&&s in o)return{rect:(d=o[s]).rect.clone(),nonscaling:d.nonscaling};var c=this._getBounds(e||a,t),l=c.rect||c,u=this._style,h=c.nonscaling||u.hasStroke()&&!u.getStrokeScaling();if(s){o||(this._bounds=o={});var d=o[s]={rect:l.clone(),nonscaling:h,internal:r}}return{rect:l,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,i=t.list,a=i.length;r<a;r++){var s=i[r];s!==e&&(s._bounds=s._position=n,s._boundsCache&&x._clearBoundsCache(s))}}},_getBounds:function(e,t,n){var r=1/0,i=-r,a=r,s=i,o=!1;n=n||{};for(var c=0,l=e.length;c<l;c++){var u=e[c];if(u._visible&&!u.isEmpty(!0)){var h=u._getCachedBounds(t&&t.appended(u._matrix),n,!0),d=h.rect;r=Math.min(d.x,r),a=Math.min(d.y,a),i=Math.max(d.x+d.width,i),s=Math.max(d.y+d.height,s),h.nonscaling&&(o=!0)}}return{rect:isFinite(r)?new v(r,a,i-r,s-a):new v,nonscaling:o}}}}),{beans:!0,_decompose:function(){return this._applyMatrix?null:this._decomposed||(this._decomposed=this._matrix.decompose())},getRotation:function(){var e=this._decompose();return e?e.rotation:0},setRotation:function(e){var t=this.getRotation();if(null!=t&&null!=e){var 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 p(t?t.x:1,t?t.y:1,this,"setScaling")},setScaling:function(){var e=this.getScaling(),t=f.read(arguments,0,{clone:!0,readNull:!0});if(e&&t&&!e.equals(t)){var n=this.getRotation(),r=this._decomposed,i=new b,a=h.isZero;if(a(e.x)||a(e.y))i.translate(r.translation),n&&i.rotate(n),i.scale(t.x,t.y),this._matrix.set(i);else{var s=this.getPosition(!0);i.translate(s),n&&i.rotate(n),i.scale(t.x/e.x,t.y/e.y),n&&i.rotate(-n),i.translate(s.negate()),this.transform(i)}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 i=0,a=r.length;i<a;i++)r[i]._globalMatrix=null;break}r.push(n),n=n._parent}return t||(t=this._globalMatrix=this._matrix.clone(),(n=this._parent)&&t.prepend(n.getGlobalMatrix(!0))),e?t:t.clone()},getViewMatrix:function(){return this.getGlobalMatrix().prepend(this.getView()._matrix)},getApplyMatrix:function(){return this._applyMatrix},setApplyMatrix:function(e){(this._applyMatrix=this._canApplyMatrix&&!!e)&&this.transform(null,!0)},getTransformContent:"#getApplyMatrix",setTransformContent:"#setApplyMatrix"},{getProject:function(){return this._project},_setProject:function(e,t){if(this._project!==e){this._project&&this._installEvents(!1),this._project=e;for(var n=this._children,r=0,i=n&&n.length;r<i;r++)n[r]._setProject(e);t=!0}t&&this._installEvents(!0)},getView:function(){return this._project._view},_installEvents:function e(t){e.base.call(this,t);for(var n=this._children,r=0,i=n&&n.length;r<i;r++)n[r]._installEvents(t)},getLayer:function(){for(var e=this;e=e._parent;)if(e instanceof C)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 a.equals(this._children,e._children)},clone:function(e){var t=new this.constructor(x.NO_INSERT),r=this._children,i=a.pick(e?e.insert:n,e===n||!0===e),s=a.pick(e?e.deep:n,!0);r&&t.copyAttributes(this),r&&!s||t.copyContent(this),r||t.copyAttributes(this),i&&t.insertAbove(this);var o=this._name,c=this._parent;if(o&&c){r=c._children;for(var l=o,u=1;r[o];)o=l+" "+u++;o!==l&&t.setName(o)}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,i=n.length;r<i;r++){var s=n[r];e.hasOwnProperty(s)&&(this[s]=e[s])}t||this._matrix.set(e._matrix,!0),this.setApplyMatrix(e._applyMatrix),this.setPivot(e._pivot),this.setSelection(e._selection);var o=e._data,c=e._name;this._data=o?a.clone(o):null,c&&this.setName(c)},rasterize:function(e,t){var r,i,s;a.isPlainObject(e)?(r=e.resolution,i=e.insert,s=e.raster):(r=e,i=t),s||(s=new E(x.NO_INSERT));var o=this.getStrokeBounds(),c=(r||this.getView().getResolution())/72,l=o.getTopLeft().floor(),u=o.getBottomRight().ceil(),h=new m(u.subtract(l)),d=h.multiply(c);if(s.setSize(d,!0),!d.isZero()){var f=s.getContext(!0),p=(new b).scale(c).translate(l.negate());f.save(),p.applyToContext(f),this.draw(f,new a({matrices:[p]})),f.restore()}return s._matrix.set((new b).translate(l.add(h.divide(2))).scale(1/c)),(i===n||i)&&s.insertAbove(this),s},contains:function(){var e=this._matrix;return e.isInvertible()&&!!this._contains(e._inverseTransform(f.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 v.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new O.Rectangle({rectangle:this.getInternalBounds(),matrix:this._matrix,insert:!1})},intersects:function(e,t){return e instanceof x&&this._asPathItem().getIntersections(e._asPathItem(),null,t,!0).length>0}},new function(){function e(){var e=arguments;return this._hitTest(f.read(e),N.getOptions(e))}function t(){var e=arguments,t=f.read(e),n=N.getOptions(e),r=[];return this._hitTest(t,new a({all:r},n)),r}function n(e,t,n,r){var i=this._children;if(i)for(var a=i.length-1;a>=0;a--){var s=i[a],o=s!==r&&s._hitTest(e,t,n);if(o&&!t.all)return o}return null}return w.inject({hitTest:e,hitTestAll:t,_hitTest:n}),{hitTest:e,hitTestAll:t,_hitTestChildren:n}},{_hitTest:function(e,t,n){if(this._locked||!this._visible||this._guide&&!t.guides||this.isEmpty())return null;var r=this._matrix,i=n?n.appended(r):this.getGlobalMatrix().prepend(this.getView()._matrix),s=Math.max(t.tolerance,1e-12),o=t._tolerancePadding=new m(O._getStrokePadding(s,r._shiftless().invert()));if(!(e=r._inverseTransform(e))||!this._children&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(o.multiply(2))._containsPoint(e))return null;var c,l,u=!(t.guides&&!this._guide||t.selected&&!this.isSelected()||t.type&&t.type!==a.hyphenate(this._class)||t.class&&!(this instanceof t.class)),h=t.match,d=this;function f(e){return e&&h&&!h(e)&&(e=null),e&&t.all&&t.all.push(e),e}function p(t,n){var r=n?c["get"+n]():d.getPosition();if(e.subtract(r).divide(o).length<=1)return new N(t,d,{name:n?a.hyphenate(n):t,point:r})}var g=t.position,v=t.center,y=t.bounds;if(u&&this._parent&&(g||v||y)){if((v||y)&&(c=this.getInternalBounds()),!(l=g&&p("position")||v&&p("center","Center"))&&y)for(var b=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],_=0;_<8&&!l;_++)l=p("bounds",b[_]);l=f(l)}return l||(l=this._hitTestChildren(e,t,i)||u&&f(this._hitTestSelf(e,t,i,this.getStrokeScaling()?null:i._shiftless().invert()))||null),l&&l.point&&(l.point=r.transform(l.point)),l},_hitTestSelf:function(e,t){if(t.fill&&this.hasFill()&&this._contains(e))return new N("fill",this)},matches:function(e,t){var n=typeof e;if("object"===n){for(var r in e)if(e.hasOwnProperty(r)&&!this.matches(r,e[r]))return!1;return!0}if("function"===n)return e(this);if("match"===e)return t(this);var i=/^(empty|editable)$/.test(e)?this["is"+a.capitalize(e)]():"type"===e?a.hyphenate(this._class):this[e];if("class"===e){if("function"==typeof t)return this instanceof t;i=this._class}if("function"==typeof t)return!!t(i);if(t){if(t.test)return t.test(i);if(a.isPlainObject(t))return function e(t,n){for(var r in t)if(t.hasOwnProperty(r)){var i=t[r],s=n[r];if(a.isPlainObject(i)&&a.isPlainObject(s)){if(!e(i,s))return!1}else if(!a.equals(i,s))return!1}return!0}(t,i)}return a.equals(i,t)},getItems:function(e){return x._getItems(this,e,this._matrix)},getItem:function(e){return x._getItems(this,e,this._matrix,null,!0)[0]||null},statics:{_getItems:function e(t,n,r,i,s){if(!i){var o="object"==typeof n&&n,c=o&&o.overlapping,l=o&&o.inside,u=(_=c||l)&&v.read([_]);i={items:[],recursive:o&&!1!==o.recursive,inside:!!l,overlapping:!!c,rect:u,path:c&&new O.Rectangle({rectangle:u,insert:!1})},o&&(n=a.filter({},n,{recursive:!0,inside:!0,overlapping:!0}))}var h=t._children,d=i.items;r=(u=i.rect)&&(r||new b);for(var f=0,p=h&&h.length;f<p;f++){var m=h[f],g=r&&r.appended(m._matrix),y=!0;if(u){var _=m.getBounds(g);if(!u.intersects(_))continue;u.contains(_)||i.overlapping&&(_.contains(u)||i.path.intersects(m,g))||(y=!1)}if(y&&m.matches(n)&&(d.push(m),s))break;if(!1!==i.recursive&&e(m,n,g,i,s),s&&d.length>0)break}return d}}},{importJSON:function(e){var t=a.importJSON(e,this);return t!==this?this.addChild(t):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){for(var r={},i=(t=a.slice(t)).length-1;i>=0;i--){var s=(u=t[i])&&u._id;!u||r[s]?t.splice(i,1):(u._remove(!1,!0),r[s]=!0)}a.splice(n,t,e,0);for(var o=this._project,c=o._changes,l=(i=0,t.length);i<l;i++){var u,h=(u=t[i])._name;u._parent=this,u._setProject(o,!0),h&&u.setName(h),c&&u._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&&1===t.length){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,i=n[r],a=i?i.indexOf(this):-1;-1!==a&&(t[r]==this&&delete t[r],i.splice(a,1),i.length?t[r]=i[0]:delete n[r])}},_remove:function(e,t){var n=this._getOwner(),r=this._project,i=this._index;return this._style&&this._style._dispose(),!!n&&(this._name&&this._removeNamed(),null!=i&&(r._activeLayer===this&&(r._activeLayer=this.getNextSibling()||this.getPreviousSibling()),a.splice(n._children,null,i,1)),this._installEvents(!1),e&&r._changes&&this._changed(5),t&&n._changed(11,this),this._parent=null,!0)},remove:function(){return this._remove(!0,!0)},replaceWith:function(e){var t=e&&e.insertBelow(this);return t&&this.remove(),t},removeChildren:function(e,t){if(!this._children)return null;e=e||0,t=a.pick(t,this._children.length);for(var n=a.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 t(e){var t=[];do{t.unshift(e)}while(e=e._parent);return t}for(var n=t(this),r=t(e),i=0,a=Math.min(n.length,r.length);i<a;i++)if(n[i]!=r[i])return n[i]._index<r[i]._index?1:-1;return 0},hasChildren:function(){return this._children&&this._children.length>0},isInserted:function(){return!!this._parent&&this._parent.isInserted()},isAbove:function(e){return-1===this._getOrder(e)},isBelow:function(e){return 1===this._getOrder(e)},isParent:function(e){return this._parent===e},isChild:function(e){return e&&e._parent===this},isDescendant:function(e){for(var t=this;t=t._parent;)if(t===e)return!0;return!1},isAncestor:function(e){return!!e&&e.isDescendant(this)},isSibling:function(e){return this._parent===e._parent},isGroupedWith:function(e){for(var t=this._parent;t;){if(t._parent&&/^(Group|Layer|CompoundPath)$/.test(t._class)&&e.isDescendant(t))return!0;t=t._parent}return!1}},a.each(["rotate","scale","shear","skew"],(function(e){var t="rotate"===e;this[e]=function(){var n=arguments,r=(t?a:f).read(n),i=f.read(n,0,{readNull:!0});return this.transform((new b)[e](r,i||this.getPosition(!0)))}}),{translate:function(){var e=new b;return this.transform(e.translate.apply(e,arguments))},transform:function(e,t,n){var r=this._matrix,i=e&&!e.isIdentity(),a=n&&this._canApplyMatrix||this._applyMatrix&&(i||!r.isIdentity()||t&&this._children);if(!i&&!a)return this;if(i){!e.isInvertible()&&r.isInvertible()&&(r._backup=r.getValues()),r.prepend(e,!0);var s=this._style,o=s.getFillColor(!0),c=s.getStrokeColor(!0);o&&o.transform(e),c&&c.transform(e)}if(a&&(a=this._transformContent(r,t,n))){var l=this._pivot;l&&r._transformPoint(l,l,!0),r.reset(!0),n&&this._canApplyMatrix&&(this._applyMatrix=!0)}var u=this._bounds,h=this._position;(i||a)&&this._changed(25);var d=i&&u&&e.decompose();if(d&&d.skewing.isZero()&&d.rotation%90==0){for(var f in u){var p=u[f];if(p.nonscaling)delete u[f];else if(a||!p.internal){var m=p.rect;e._transformBounds(m,m)}}this._bounds=u;var g=u[this._getBoundsCacheKey(this._boundsOptions||{})];g&&(this._position=this._getPositionFromBounds(g.rect))}else i&&h&&this._pivot&&(this._position=e._transformPoint(h,h));return this},_transformContent:function(e,t,n){var r=this._children;if(r){for(var i=0,a=r.length;i<a;i++)r[i].transform(e,t,n);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(f.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(f.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(f.read(arguments))},localToParent:function(){return this._matrix._transformPoint(f.read(arguments))},fitBounds:function(e,t){e=v.read(arguments);var n=this.getBounds(),r=n.height/n.width,i=e.height/e.width,a=(t?r>i:r<i)?e.width/n.width:e.height/n.height,s=new v(new f,new m(n.width*a,n.height*a));s.setCenter(e.getCenter()),this.setBounds(s)}}),{_setStyles:function(e,t,n){var r=this._style,i=this._matrix;if(r.hasFill()&&(e.fillStyle=r.getFillColor().toCanvasStyle(e,i)),r.hasStroke()){e.strokeStyle=r.getStrokeColor().toCanvasStyle(e,i),e.lineWidth=r.getStrokeWidth();var a=r.getStrokeJoin(),s=r.getStrokeCap(),o=r.getMiterLimit();if(a&&(e.lineJoin=a),s&&(e.lineCap=s),o&&(e.miterLimit=o),oe.support.nativeDash){var c=r.getDashArray(),l=r.getDashOffset();c&&c.length&&("setLineDash"in e?(e.setLineDash(c),e.lineDashOffset=l):(e.mozDash=c,e.mozDashOffset=l))}}if(r.hasShadow()){var u=t.pixelRatio||1,h=n._shiftless().prepend((new b).scale(u,u)),d=h.transform(new f(r.getShadowBlur(),0)),p=h.transform(this.getShadowOffset());e.shadowColor=r.getShadowColor().toCanvasStyle(e),e.shadowBlur=d.getLength(),e.shadowOffsetX=p.x,e.shadowOffsetY=p.y}},draw:function(e,t,n){if(this._updateVersion=this._project._updateVersion,this._visible&&0!==this._opacity){var r=t.matrices,i=t.viewMatrix,a=this._matrix,s=r[r.length-1].appended(a);if(s.isInvertible()){i=i?i.appended(s):s,r.push(s),t.updateMatrix&&(this._globalMatrix=s);var o,c,l,u=this._blendMode,d=h.clamp(this._opacity,0,1),f="normal"===u,p=ie.nativeModes[u],m=f&&1===d||t.dontStart||t.clip||(p||f&&d<1)&&this._canComposite(),g=t.pixelRatio||1;if(!m){var v=this.getStrokeBounds(i);if(!v.width||!v.height)return void r.pop();l=t.offset,c=t.offset=v.getTopLeft().floor(),o=e,e=re.getContext(v.getSize().ceil().add(1).multiply(g)),1!==g&&e.scale(g,g)}e.save();var y=n?n.appended(a):this._canScaleStroke&&!this.getStrokeScaling(!0)&&i,b=!m&&t.clipItem,_=!y||b;if(m?(e.globalAlpha=d,p&&(e.globalCompositeOperation=u)):_&&e.translate(-c.x,-c.y),_&&(m?a:i).applyToContext(e),b&&t.clipItem.draw(e,t.extend({clip:!0})),y){e.setTransform(g,0,0,g,0,0);var w=t.offset;w&&e.translate(-w.x,-w.y)}this._draw(e,t,i,y),e.restore(),r.pop(),t.clip&&!t.dontFinish&&e.clip(this.getFillRule()),m||(ie.process(u,e,o,d,c.subtract(l).multiply(g)),re.release(e),t.offset=l)}}},_isUpdated:function(e){var t=this._parent;if(t instanceof L)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,i){var a=this._selection,s=1&a,o=2&a||s&&this._selectBounds,c=4&a;if(this._drawSelected||(s=!1),(s||o||c)&&this._isUpdated(i)){var l,u=this.getSelectedColor(!0)||(l=this.getLayer())&&l.getSelectedColor(!0),h=t.appended(this.getGlobalMatrix(!0)),d=n/2;if(e.strokeStyle=e.fillStyle=u?u.toCanvasStyle(e):"#009dec",s&&this._drawSelected(e,h,r),c){var f=this.getPosition(!0),p=this._parent,m=p?p.localToGlobal(f):f,g=m.x,v=m.y;e.beginPath(),e.arc(g,v,d,0,2*Math.PI,!0),e.stroke();for(var y=[[0,-1],[1,0],[0,1],[-1,0]],b=d,_=n+1,w=0;w<4;w++){var x=y[w],k=x[0],C=x[1];e.moveTo(g+k*b,v+C*b),e.lineTo(g+k*_,v+C*_),e.stroke()}}if(o){var S=h._transformCorners(this.getInternalBounds());for(e.beginPath(),w=0;w<8;w++)e[w?"lineTo":"moveTo"](S[w],S[++w]);for(e.closePath(),e.stroke(),w=0;w<8;w++)e.fillRect(S[w]-d,S[++w]-d,n,n)}}},_canComposite:function(){return!1}},a.each(["down","drag","up","move"],(function(e){this["removeOn"+a.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,i=r._removeSets=r._removeSets||{};i[n]=i[n]||{},i[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,i=n&&n.start,a=null!=n&&("number"==typeof n?n:n.duration),s=new te(this,e,t,a,r,i);return a&&this.on("frame",(function e(t){s._handleFrame(1e3*t.time),s.running||this.off("frame",e)})),s},tweenTo:function(e,t){return this.tween(null,e,t)},tweenFrom:function(e,t){return this.tween(e,null,t)}}),k=x.extend({_class:"Group",_selectBounds:!1,_selectChildren:!0,_serializeFields:{children:[]},initialize:function(e){this._children=[],this._namedChildren={},this._initialize(e)||this.addChildren(Array.isArray(e)?e:arguments)},_changed:function e(t){e.base.call(this,t),2050&t&&(this._clipItem=n)},_getClipItem:function(){var e=this._clipItem;if(e===n){e=null;for(var t=this._children,r=0,i=t.length;r<i;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 e(t,n){var r=this._getClipItem();return r?r._getCachedBounds(r._matrix.prepended(t),a.set({},n,{stroke:!1})):e.base.call(this,t,n)},_hitTestChildren:function e(t,n,r){var i=this._getClipItem();return(!i||i.contains(t))&&e.base.call(this,t,n,r,i)},_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 i=this._children,a=0,s=i.length;a<s;a++){var o=i[a];o!==r&&o.draw(e,t)}}}),C=k.extend({_class:"Layer",initialize:function(){k.apply(this,arguments)},_getOwner:function(){return this._parent||null!=this._index&&this._project},isInserted:function e(){return this._parent?e.base.call(this):null!=this._index},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),S=x.extend({_class:"Shape",_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},initialize:function(e,t){this._initialize(e,t)},_equals:function(e){return this._type===e._type&&this._size.equals(e._size)&&a.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 g(e.width,e.height,this,"setSize")},setSize:function(){var e=m.read(arguments);if(this._size){if(!this._size.equals(e)){var t=this._type,n=e.width,r=e.height;"rectangle"===t?this._radius.set(m.min(this._radius,e.divide(2).abs())):"circle"===t?(n=r=(n+r)/2,this._radius=n/2):"ellipse"===t&&this._radius._set(n/2,r/2),this._size._set(n,r),this._changed(9)}}else this._size=e.clone()},getRadius:function(){var e=this._radius;return"circle"===this._type?e:new g(e.width,e.height,this,"setRadius")},setRadius:function(e){var t=this._type;if("circle"===t){if(e===this._radius)return;var n=2*e;this._radius=e,this._size._set(n,n)}else if(e=m.read(arguments),this._radius){if(this._radius.equals(e))return;this._radius.set(e),"rectangle"===t?(n=m.max(this._size,e.multiply(2)),this._size.set(n)):"ellipse"===t&&this._size._set(2*e.width,2*e.height)}else this._radius=e.clone();this._changed(9)},isEmpty:function(){return!1},toPath:function(e){var t=new(O[a.capitalize(this._type)])({center:new f,size:this._size,radius:this._radius,insert:!1});return t.copyAttributes(this),oe.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 i=this._style,a=i.hasFill(),s=i.hasStroke(),o=t.dontFinish||t.clip,c=!r;if(a||s||o){var l=this._type,u=this._radius,h="circle"===l;if(t.dontStart||e.beginPath(),c&&h)e.arc(0,0,u,0,2*Math.PI,!0);else{var d=h?u:u.width,f=h?u:u.height,p=this._size,m=p.width,g=p.height;if(c&&"rectangle"===l&&0===d&&0===f)e.rect(-m/2,-g/2,m,g);else{var v=m/2,y=g/2,b=.44771525016920644,_=d*b,w=f*b,x=[-v,-y+f,-v,-y+w,-v+_,-y,-v+d,-y,v-d,-y,v-_,-y,v,-y+w,v,-y+f,v,y-f,v,y-w,v-_,y,v-d,y,-v+d,y,-v+_,y,-v,y-w,-v,y-f];r&&r.transform(x,x,32),e.moveTo(x[0],x[1]),e.bezierCurveTo(x[2],x[3],x[4],x[5],x[6],x[7]),v!==d&&e.lineTo(x[8],x[9]),e.bezierCurveTo(x[10],x[11],x[12],x[13],x[14],x[15]),y!==f&&e.lineTo(x[16],x[17]),e.bezierCurveTo(x[18],x[19],x[20],x[21],x[22],x[23]),v!==d&&e.lineTo(x[24],x[25]),e.bezierCurveTo(x[26],x[27],x[28],x[29],x[30],x[31])}}e.closePath()}o||!a&&!s||(this._setStyles(e,t,n),a&&(e.fill(i.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),s&&e.stroke())},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(e,t){var n=new v(this._size).setCenter(0,0),r=this._style,i=t.stroke&&r.hasStroke()&&r.getStrokeWidth();return e&&(n=e._transformBounds(n)),i?n.expand(O._getStrokePadding(i,this._getStrokeMatrix(e,t))):n}},new function(){function e(e,t,n){var r=e._radius;if(!r.isZero())for(var i=e._size.divide(2),a=1;a<=4;a++){var s=new f(a>1&&a<4?-1:1,a>2?-1:1),o=s.multiply(i),c=o.subtract(s.multiply(r));if(new v(n?o.add(s.multiply(n)):o,c).contains(t))return{point:c,quadrant:a}}}function t(e,t,n,r){var i=e.divide(t);return(!r||i.isInQuadrant(r))&&i.subtract(i.normalize()).multiply(t).divide(n).length<=1}return{_contains:function t(n){if("rectangle"===this._type){var r=e(this,n);return r?n.subtract(r.point).divide(this._radius).getLength()<=1:t.base.call(this,n)}return n.divide(this.size).getLength()<=.5},_hitTestSelf:function n(r,i,a,s){var o=!1,c=this._style,l=i.stroke&&c.hasStroke(),u=i.fill&&c.hasFill();if(l||u){var h=this._type,d=this._radius,f=l?c.getStrokeWidth()/2:0,p=i._tolerancePadding.add(O._getStrokePadding(f,!c.getStrokeScaling()&&s));if("rectangle"===h){var m=p.multiply(2),g=e(this,r,m);if(g)o=t(r.subtract(g.point),d,p,g.quadrant);else{var y=new v(this._size).setCenter(0,0),b=y.expand(m),_=y.expand(m.negate());o=b._containsPoint(r)&&!_._containsPoint(r)}}else o=t(r,d,p)}return o?new N(l?"stroke":"fill",this):n.base.apply(this,arguments)}}},{statics:new function(){function e(e,t,n,r,i){var s=a.create(S.prototype);return s._type=e,s._size=n,s._radius=r,s._initialize(a.getNamed(i),t),s}return{Circle:function(){var t=arguments,n=f.readNamed(t,"center"),r=a.readNamed(t,"radius");return e("circle",n,new m(2*r),r,t)},Rectangle:function(){var t=arguments,n=v.readNamed(t,"rectangle"),r=m.min(m.readNamed(t,"radius"),n.getSize(!0).divide(2));return e("rectangle",n.getCenter(!0),n.getSize(!0),r,t)},Ellipse:function(){var t=arguments,n=S._readEllipse(t),r=n.radius;return e("ellipse",n.center,r.multiply(2),r,t)},_readEllipse:function(e){var t,n;if(a.hasNamed(e,"radius"))t=f.readNamed(e,"center"),n=m.readNamed(e,"radius");else{var r=v.readNamed(e,"rectangle");t=r.getCenter(!0),n=r.getSize(!0).divide(2)}return{center:t,radius:n}}}}}),E=x.extend({_class:"Raster",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!1,handle:!1},_serializeFields:{crossOrigin:null,source:null},_prioritize:["crossOrigin"],_smoothing:"low",beans:!0,initialize:function(e,t){if(!this._initialize(e,t!==n&&f.read(arguments))){var r,a=typeof e,s="string"===a?i.getElementById(e):"object"===a?e:null;if(s&&s!==x.NO_INSERT)if(s.getContext||null!=s.naturalHeight)r=s;else if(s){var o=m.read(arguments);o.isZero()||(r=re.getCanvas(o))}r?this.setImage(r):this.setSource(e)}this._size||(this._size=new m,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=re.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 g(e?e.width:0,e?e.height:0,this,"setSize")},setSize:function(e,t){var n=m.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(re.getCanvas(n)),r&&this.getContext(!0).drawImage(r,0,0,n.width,n.height)}else this._canvas&&re.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||0===e.width&&0===e.height},getResolution:function(){var e=this._matrix,t=new f(0,0).transform(e),n=new f(1,0).transform(e).subtract(t),r=new f(0,1).transform(e).subtract(t);return new m(72/n.getLength(),72/r.getLength())},getPpi:"#getResolution",getImage:function(){return this._image},setImage:function(e){var t=this;function n(e){var n=t.getView(),r=e&&e.type||"load";n&&t.responds(r)&&(oe=n._scope,t.emit(r,new K(e)))}this._setImage(e),this._loaded?setTimeout(n,0):e&&W.add(e,{load:function(r){t._setImage(e),n(r)},error:n})},_setImage:function(e){this._canvas&&re.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 m(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=re.getContext(this._size);try{this._image&&e.drawImage(this._image,0,0),this._canvas=e.canvas}catch(t){re.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(e){var n=new t.Image,r=this._crossOrigin;r&&(n.crossOrigin=r),e&&(n.src=e),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="string"==typeof e?e:e?"low":"off",this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var e=v.read(arguments),t=re.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=v.read(arguments),t=new E(x.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=f.read(arguments,1);this.getContext(!0).drawImage(e,t.x,t.y)},getAverageColor:function(e){var t,n;if(e?e instanceof B?(n=e,t=e.getBounds()):"object"==typeof e&&("width"in e?t=new v(e):"x"in e&&(t=new v(e.x-.5,e.y-.5,1,1))):t=this.getBounds(),!t)return null;var r=Math.min(t.width,32),i=Math.min(t.height,32),s=E._sampleContext;s?s.clearRect(0,0,33,33):s=E._sampleContext=re.getContext(new m(32)),s.save();var o=(new b).scale(r/t.width,i/t.height).translate(-t.x,-t.y);o.applyToContext(s),n&&n.draw(s,new a({clip:!0,matrices:[o]})),this._matrix.applyToContext(s);var c=this.getElement(),l=this._size;c&&s.drawImage(c,-l.width/2,-l.height/2),s.restore();for(var u=s.getImageData(.5,.5,Math.ceil(r),Math.ceil(i)).data,h=[0,0,0],d=0,f=0,p=u.length;f<p;f+=4){var g=u[f+3];d+=g,g/=255,h[0]+=u[f]*g,h[1]+=u[f+1]*g,h[2]+=u[f+2]*g}for(f=0;f<3;f++)h[f]/=d;return d?j.read(h):null},getPixel:function(){var e=f.read(arguments),t=this.getContext().getImageData(e.x,e.y,1,1).data;return new j("rgb",[t[0]/255,t[1]/255,t[2]/255],t[3]/255)},setPixel:function(){var e=arguments,t=f.read(e),n=j.read(e),r=n._convert("rgb"),i=n._alpha,a=this.getContext(!0),s=a.createImageData(1,1),o=s.data;o[0]=255*r[0],o[1]=255*r[1],o[2]=255*r[2],o[3]=null!=i?255*i:255,a.putImageData(s,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=m.read(arguments);return this.getContext().createImageData(e.width,e.height)},getImageData:function(){var e=v.read(arguments);return e.isEmpty()&&(e=new v(this._size)),this.getContext().getImageData(e.x,e.y,e.width,e.height)},putImageData:function(e){var t=f.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 v(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=h.clamp(this._opacity,0,1),this._setStyles(e,t,n);var i=this._smoothing,a="off"===i;G.setPrefixed(e,a?"imageSmoothingEnabled":"imageSmoothingQuality",!a&&i),e.drawImage(r,-this._size.width/2,-this._size.height/2)}},_canComposite:function(){return!0}}),M=x.extend({_class:"SymbolItem",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function(e,t){this._initialize(e,t!==n&&f.read(arguments,1))||this.setDefinition(e instanceof T?e:new T(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}),i=this._definition._item._hitTest(e,r,n);return i&&(i.item=this),i},_draw:function(e,t){this._definition._item.draw(e,t)}}),T=a.extend({_class:"SymbolDefinition",initialize:function(e,t){this._id=d.get(),this.project=oe.project,e&&this.setItem(e,t)},_serialize:function(e,t){return t.add(this,(function(){return a.serialize([this._class,this._item],e,!1,t)}))},_changed:function(e){8&e&&x._clearBoundsCache(this),1&e&&this.project._changed(e)},getItem:function(){return this._item},setItem:function(e,t){e._symbol&&(e=e.clone()),this._item&&(this._item._symbol=null),this._item=e,e.remove(),e.setSelected(!1),t||e.setPosition(new f),e._symbol=this,this._changed(9)},getDefinition:"#getItem",setDefinition:"#setItem",place:function(e){return new M(this,e)},clone:function(){return new T(this._item.clone(!1))},equals:function(e){return e===this||e&&this._item.equals(e._item)||!1}}),N=a.extend({_class:"HitResult",initialize:function(e,t,n){this.type=e,this.item=t,n&&this.inject(n)},statics:{getOptions:function(e){var t=e&&a.read(e);return new a({type:null,tolerance:oe.settings.hitTolerance,fill:!t,stroke:!t,segments:!t,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},t)}}}),A=a.extend({_class:"Segment",beans:!0,_selection:0,initialize:function(e,t,r,i,a,s){var o,c,l,u,h=arguments.length;h>0&&(null==e||"object"==typeof e?1===h&&e&&"point"in e?(o=e.point,c=e.handleIn,l=e.handleOut,u=e.selection):(o=e,c=t,l=r,u=i):(o=[e,t],c=r!==n?[r,i]:null,l=a!==n?[a,s]:null)),new P(o,this,"_point"),new P(c,this,"_handleIn"),new P(l,this,"_handleOut"),u&&this.setSelection(u)},_serialize:function(e,t){var n=this._point,r=this._selection,i=r||this.hasHandles()?[n,this._handleIn,this._handleOut]:n;return r&&i.push(r),a.serialize(i,e,!0,t)},_changed:function(e){var t=this._path;if(t){var n,r=t._curves,i=this._index;r&&(e&&e!==this._point&&e!==this._handleIn||!(n=i>0?r[i-1]:t._closed?r[r.length-1]:null)||n._changed(),e&&e!==this._point&&e!==this._handleOut||!(n=r[i])||n._changed()),t._changed(41)}},getPoint:function(){return this._point},setPoint:function(){this._point.set(f.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(f.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(f.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!!(7&this._selection)},setSelected:function(e){this._changeSelection(7,e)},getIndex:function(){return this._index!==n?this._index:null},getPath:function(){return this._path||null},getCurve:function(){var e=this._path,t=this._index;return e?(t>0&&!e._closed&&t===e._segments.length-1&&t--,e.getCurves()[t]||null):null},getLocation:function(){var e=this.getCurve();return e?new D(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 i=e||{},a=i.type,s=i.factor,o=this.getPrevious(),c=this.getNext(),l=(o||this)._point,u=this._point,h=(c||this)._point,d=l.getDistance(u),p=u.getDistance(h);if(a&&"catmull-rom"!==a){if("geometric"!==a)throw new Error("Smoothing method '"+a+"' not supported.");if(o&&c){var m=l.subtract(h),g=s===n?.4:s,v=g*d/(d+p);t||this.setHandleIn(m.multiply(v)),r||this.setHandleOut(m.multiply(v-g))}}else{var y=s===n?.5:s,b=Math.pow(d,y),_=b*b,w=Math.pow(p,y),x=w*w;if(!t&&o){var k=2*x+3*w*b+_,C=3*w*(w+b);this.setHandleIn(0!==C?new f((x*l._x+k*u._x-_*h._x)/C-u._x,(x*l._y+k*u._y-_*h._y)/C-u._y):new f)}!r&&c&&(k=2*_+3*b*w+x,C=3*b*(b+w),this.setHandleOut(0!==C?new f((_*h._x+k*u._x-x*l._x)/C-u._x,(_*h._y+k*u._y-x*l._y)/C-u._y):new f))}},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 A(this._point,this._handleOut,this._handleIn)},remove:function(){return!!this._path&&!!this._path.removeSegment(this._index)},clone:function(){return new A(this._point,this._handleIn,this._handleOut)},equals:function(e){return e===this||e&&this._class===e._class&&this._point.equals(e._point)&&this._handleIn.equals(e._handleIn)&&this._handleOut.equals(e._handleOut)||!1},toString:function(){var e=["point: "+this._point];return this._handleIn.isZero()||e.push("handleIn: "+this._handleIn),this._handleOut.isZero()||e.push("handleOut: "+this._handleOut),"{ "+e.join(", ")+" }"},transform:function(e){this._transformCoordinates(e,new Array(6),!0),this._changed()},interpolate:function(e,t,n){var r=1-n,i=n,a=e._point,s=t._point,o=e._handleIn,c=t._handleIn,l=t._handleOut,u=e._handleOut;this._point._set(r*a._x+i*s._x,r*a._y+i*s._y,!0),this._handleIn._set(r*o._x+i*c._x,r*o._y+i*c._y,!0),this._handleOut._set(r*u._x+i*l._x,r*u._y+i*l._y,!0),this._changed()},_transformCoordinates:function(e,t,n){var r=this._point,i=n&&this._handleIn.isZero()?null:this._handleIn,a=n&&this._handleOut.isZero()?null:this._handleOut,s=r._x,o=r._y,c=2;return t[0]=s,t[1]=o,i&&(t[c++]=i._x+s,t[c++]=i._y+o),a&&(t[c++]=a._x+s,t[c++]=a._y+o),e&&(e._transformCoordinates(t,t,c/2),s=t[0],o=t[1],n?(r._x=s,r._y=o,c=2,i&&(i._x=t[c++]-s,i._y=t[c++]-o),a&&(a._x=t[c++]-s,a._y=t[c++]-o)):(i||(t[c++]=s,t[c++]=o),a||(t[c++]=s,t[c++]=o))),t}}),P=f.extend({initialize:function(e,t,r){var i,a,s;if(e)if((i=e[0])!==n)a=e[1];else{var o=e;(i=o.x)===n&&(i=(o=f.read(arguments)).x),a=o.y,s=o.selected}else i=a=0;this._x=i,this._y=a,this._owner=t,t[r]=this,s&&this.setSelected(!0)},_set:function(e,t){return this._x=e,this._y=t,this._owner._changed(this),this},getX:function(){return this._x},setX:function(e){this._x=e,this._owner._changed(this)},getY:function(){return this._y},setY:function(e){this._y=e,this._owner._changed(this)},isZero:function(){var e=h.isZero;return e(this._x)&&e(this._y)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(e){this._owner._changeSelection(this._getSelection(),e)},_getSelection:function(){var e=this._owner;return this===e._point?1:this===e._handleIn?2:this===e._handleOut?4:0}}),I=a.extend({_class:"Curve",beans:!0,initialize:function(e,t,n,r,i,a,s,o){var c,l,u,h,d,f,p=arguments.length;3===p?(this._path=e,c=t,l=n):p?1===p?"segment1"in e?(c=new A(e.segment1),l=new A(e.segment2)):"point1"in e?(u=e.point1,d=e.handle1,f=e.handle2,h=e.point2):Array.isArray(e)&&(u=[e[0],e[1]],h=[e[6],e[7]],d=[e[2]-e[0],e[3]-e[1]],f=[e[4]-e[6],e[5]-e[7]]):2===p?(c=new A(e),l=new A(t)):4===p?(u=e,d=t,f=n,h=r):8===p&&(u=[e,t],h=[s,o],d=[n-e,r-t],f=[i-s,a-o]):(c=new A,l=new A),this._segment1=c||new A(u,null,d),this._segment2=l||new A(h,f,null)},_serialize:function(e,t){return a.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())&&this._segment1._handleOut.set(n)}return e},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(f.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(f.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(f.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(f.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 f(e[n],e[n+1]));return t}},{getLength:function(){return null==this._length&&(this._length=I.getLength(this.getValues(),0,1)),this._length},getArea:function(){return I.getArea(this.getValues())},getLine:function(){return new _(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=null;if(e>=1e-8&&e<=.99999999){var r=I.subdivide(this.getValues(),e),i=r[0],a=r[1],s=t||this.hasHandles(),o=this._segment1,c=this._segment2,l=this._path;s&&(o._handleOut._set(i[2]-i[0],i[3]-i[1]),c._handleIn._set(a[4]-a[6],a[5]-a[7]));var u=i[6],h=i[7],d=new A(new f(u,h),s&&new f(i[4]-u,i[5]-h),s&&new f(a[2]-u,a[3]-h));l?(l.insert(o._index+1,d),n=this.getNext()):(this._segment2=d,this._changed(),n=new I(d,c))}return n},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 i=e._point,a=e._handleOut,s=t._handleIn,o=t._point,c=i.x,l=i.y,u=o.x,h=o.y,d=r?[c,l,c,l,u,h,u,h]:[c,l,c+a._x,l+a._y,u+s._x,h+s._y,u,h];return n&&n._transformCoordinates(d,d,4),d},subdivide:function(e,t){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],c=e[5],l=e[6],u=e[7];t===n&&(t=.5);var h=1-t,d=h*r+t*a,f=h*i+t*s,p=h*a+t*o,m=h*s+t*c,g=h*o+t*l,v=h*c+t*u,y=h*d+t*p,b=h*f+t*m,_=h*p+t*g,w=h*m+t*v,x=h*y+t*_,k=h*b+t*w;return[[r,i,d,f,y,b,x,k],[x,k,_,w,g,v,l,u]]},getMonoCurves:function(e,t){var n=[],r=t?0:1,i=e[r+0],a=e[r+2],s=e[r+4],o=e[r+6];if(i>=a==a>=s&&a>=s==s>=o||I.isStraight(e))n.push(e);else{var c=3*(a-s)-i+o,l=2*(i+s)-4*a,u=a-i,d=[],f=h.solveQuadratic(c,l,u,d,1e-8,.99999999);if(f){d.sort();var p=d[0],m=I.subdivide(e,p);n.push(m[0]),f>1&&(p=(d[1]-p)/(1-p),m=I.subdivide(m[1],p),n.push(m[0])),n.push(m[1])}else n.push(e)}return n},solveCubic:function(e,t,n,r,i,a){var s=e[t],o=e[t+2],c=e[t+4],l=e[t+6],u=0;if(!(s<n&&l<n&&o<n&&c<n||s>n&&l>n&&o>n&&c>n)){var d=3*(o-s),f=3*(c-o)-d,p=l-s-d-f;u=h.solveCubic(p,f,d,s-n,r,i,a)}return u},getTimeOf:function(e,t){var n=new f(e[0],e[1]),r=new f(e[6],e[7]),i=1e-7;if(null===(t.isClose(n,1e-12)?0:t.isClose(r,1e-12)?1:null))for(var a=[t.x,t.y],s=[],o=0;o<2;o++)for(var c=I.solveCubic(e,o,a[o],s,0,1),l=0;l<c;l++){var u=s[l];if(t.isClose(I.getPoint(e,u),i))return u}return t.isClose(n,i)?0:t.isClose(r,i)?1:null},getNearestTime:function(e,t){if(I.isStraight(e)){var n=e[0],r=e[1],i=e[6]-n,a=e[7]-r,s=i*i+a*a;if(0===s)return 0;var o=((t.x-n)*i+(t.y-r)*a)/s;return o<1e-12?0:o>.999999999999?1:I.getTimeOf(e,new f(n+o*i,r+o*a))}var c=1/0,l=0;function u(n){if(n>=0&&n<=1){var r=t.getDistance(I.getPoint(e,n),!0);if(r<c)return c=r,l=n,!0}}for(var h=0;h<=100;h++)u(h/100);for(var d=.005;d>1e-8;)u(l-d)||u(l+d)||(d/=2);return l},getPart:function(e,t,n){var r=t>n;if(r){var i=t;t=n,n=i}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],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=3*i-2*n-c,h=3*a-2*r-l,d=3*s-2*c-n,f=3*o-2*l-r;return Math.max(u*u,d*d)+Math.max(h*h,f*f)<=16*t*t},getArea:function(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],c=e[7];return 3*((c-n)*(r+a)-(o-t)*(i+s)+i*(t-a)-r*(n-s)+c*(a+t/3)-o*(s+n/3))/20},getBounds:function(e){for(var t=e.slice(0,2),n=t.slice(),r=[0,0],i=0;i<2;i++)I._addBounds(e[i],e[i+2],e[i+4],e[i+6],i,0,t,n,r);return new v(t[0],t[1],n[0]-t[0],n[1]-t[1])},_addBounds:function(e,t,n,r,i,a,s,o,c){function l(e,t){var n=e-t,r=e+t;n<s[i]&&(s[i]=n),r>o[i]&&(o[i]=r)}a/=2;var u=s[i]+a,d=o[i]-a;if(e<u||t<u||n<u||r<u||e>d||t>d||n>d||r>d)if(t<e!=t<r&&n<e!=n<r)l(e,0),l(r,0);else{var f=3*(t-n)-e+r,p=2*(e+n)-4*t,m=t-e,g=h.solveQuadratic(f,p,m,c);l(r,0);for(var v=0;v<g;v++){var y=c[v],b=1-y;1e-8<=y&&y<=.99999999&&l(b*b*b*e+3*b*b*y*t+3*b*y*y*n+y*y*y*r,a)}}}}},a.each(["getBounds","getStrokeBounds","getHandleBounds"],(function(e){this[e]=function(){this._bounds||(this._bounds={});var t=this._bounds[e];return t||(t=this._bounds[e]=O[e]([this._segment1,this._segment2],!1,this._path)),t.clone()}}),{}),a.each({isStraight:function(e,t,n,r){if(t.isZero()&&n.isZero())return!0;var i=r.subtract(e);if(i.isZero())return!1;if(i.isCollinear(t)&&i.isCollinear(n)){var a=new _(e,r);if(a.getDistance(e.add(t))<1e-7&&a.getDistance(r.add(n))<1e-7){var s=i.dot(i),o=i.dot(t)/s,c=i.dot(n)/s;return o>=0&&o<=1&&c<=0&&c>=-1}}return!1},isLinear:function(e,t,n,r){var i=r.subtract(e).divide(3);return t.equals(i)&&n.negate().equals(i)}},(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],i=t[1],a=t[6],s=t[7];return e(new f(r,i),new f(t[2]-r,t[3]-i),new f(t[4]-a,t[5]-s),new f(a,s),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 null!=e&&e>=0&&e<=1?new D(this,e):null},getTimeAt:function(e,t){return I.getTimeAt(this.getValues(),e,t)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var e=f.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(f.read(arguments)))},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getTimeOf:function(){return I.getTimeOf(this.getValues(),f.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var e=f.read(arguments),t=this.getValues(),n=I.getNearestTime(t,e),r=I.getPoint(t,n);return new D(this,n,r,null,e.getDistance(r))},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e?e.getPoint():e}},new function(){var e=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return a.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 e(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],c=e[7],l=9*(r-a)+3*(o-t),u=6*(t+a)-12*r,h=3*(r-t),d=9*(i-s)+3*(c-n),f=6*(n+s)-12*i,p=3*(i-n);return function(e){var t=(l*e+u)*e+h,n=(d*e+f)*e+p;return Math.sqrt(t*t+n*n)}}function t(e,t){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(t-e))))}function r(e,t,n,r){if(null==t||t<0||t>1)return null;var i=e[0],a=e[1],s=e[2],o=e[3],c=e[4],l=e[5],u=e[6],d=e[7],p=h.isZero;p(s-i)&&p(o-a)&&(s=i,o=a),p(c-u)&&p(l-d)&&(c=u,l=d);var m,g,v=3*(s-i),y=3*(c-s)-v,b=u-i-v-y,_=3*(o-a),w=3*(l-o)-_,x=d-a-_-w;if(0===n)m=0===t?i:1===t?u:((b*t+y)*t+v)*t+i,g=0===t?a:1===t?d:((x*t+w)*t+_)*t+a;else{var k=1e-8,C=1-k;if(t<k?(m=v,g=_):t>C?(m=3*(u-c),g=3*(d-l)):(m=(3*b*t+2*y)*t+v,g=(3*x*t+2*w)*t+_),r){0===m&&0===g&&(t<k||t>C)&&(m=c-s,g=l-o);var S=Math.sqrt(m*m+g*g);S&&(m/=S,g/=S)}if(3===n){c=6*b*t+2*y,l=6*x*t+2*w;var E=Math.pow(m*m+g*g,1.5);m=0!==E?(m*l-g*c)/E:0,g=0}}return 2===n?new f(g,-m):new f(m,g)}return{statics:{classify:function(e){var t=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=i*(r-l)+a*(c-t)+t*l-r*c,d=3*(s*(a-r)+o*(t-i)+i*r-a*t),f=d-u,p=f-u+(t*(l-o)+r*(s-c)+c*o-l*s),m=Math.sqrt(p*p+f*f+d*d),g=0!==m?1/m:0,v=h.isZero,y="serpentine";function b(e,t,r){var i=t!==n,a=i&&t>0&&t<1,s=i&&r>0&&r<1;return!i||(a||s)&&("loop"!==e||a&&s)||(e="arch",a=s=!1),{type:e,roots:a||s?a&&s?t<r?[t,r]:[r,t]:[a?t:r]:null}}if(f*=g,d*=g,v(p*=g))return v(f)?b(v(d)?"line":"quadratic"):b(y,d/(3*f));var _=3*f*f-4*p*d;if(v(_))return b("cusp",f/(2*p));var w=_>0?Math.sqrt(_/3):Math.sqrt(-_),x=2*p;return b(_>0?y:"loop",(f+w)/x,(f-w)/x)},getLength:function(r,i,a,s){if(i===n&&(i=0),a===n&&(a=1),I.isStraight(r)){var o=r;a<1&&(o=I.subdivide(o,a)[0],i/=a),i>0&&(o=I.subdivide(o,i)[1]);var c=o[6]-o[0],l=o[7]-o[1];return Math.sqrt(c*c+l*l)}return h.integrate(s||e(r),i,a,t(i,a))},getTimeAt:function(r,i,a){if(a===n&&(a=i<0?1:0),0===i)return a;var s=Math.abs,o=i>0,c=o?a:0,l=o?1:a,u=e(r),d=I.getLength(r,c,l,u),f=s(i)-d;if(s(f)<1e-12)return o?l:c;if(f>1e-12)return null;var p=i/d,m=0;return h.findRoot((function(e){return m+=h.integrate(u,a,e,t(a,e)),a=e,m-i}),u,a+p,c,l,32,1e-12)},getPoint:function(e,t){return r(e,t,0,!1)},getTangent:function(e,t){return r(e,t,1,!0)},getWeightedTangent:function(e,t){return r(e,t,1,!1)},getNormal:function(e,t){return r(e,t,2,!0)},getWeightedNormal:function(e,t){return r(e,t,2,!1)},getCurvature:function(e,t){return r(e,t,3,!1).x},getPeaks:function(e){var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=3*r-t-3*a+e[6],c=3*t-6*r+3*a,l=-3*t+3*r,u=3*i-n-3*s+e[7],d=3*n-6*i+3*s,f=-3*n+3*i,p=[];return h.solveCubic(9*(o*o+u*u),9*(o*c+d*u),2*(c*c+d*d)+3*(l*o+f*u),l*c+d*f,p,1e-8,.99999999),p.sort()}}}},new function(){function e(e,t,n,r,i,a,s){var o=!s&&n.getPrevious()===i,c=!s&&n!==i&&n.getNext()===i,l=1e-8,u=1-l;if(null!==r&&r>=(o?l:0)&&r<=(c?u:1)&&null!==a&&a>=(c?l:0)&&a<=(o?u:1)){var h=new D(n,r,null,s),d=new D(i,a,null,s);h._intersection=d,d._intersection=h,t&&!t(h)||D.insert(e,h,!0)}}function t(r,i,a,s,o,c,l,u,h,d,f,p,m){if(++h>=4096||++u>=40)return h;var g,v,y=i[0],b=i[1],w=i[6],x=i[7],k=_.getSignedDistance,C=k(y,b,w,x,i[2],i[3]),S=k(y,b,w,x,i[4],i[5]),E=C*S>0?3/4:4/9,M=E*Math.min(0,C,S),T=E*Math.max(0,C,S),N=k(y,b,w,x,r[0],r[1]),A=k(y,b,w,x,r[2],r[3]),P=k(y,b,w,x,r[4],r[5]),D=k(y,b,w,x,r[6],r[7]),B=function(e,t,n,r){var i,a=[0,e],s=[1/3,t],o=[2/3,n],c=[1,r],l=t-(2*e+r)/3,u=n-(e+2*r)/3;if(l*u<0)i=[[a,s,c],[a,o,c]];else{var h=l/u;i=[h>=2?[a,s,c]:h<=.5?[a,o,c]:[a,s,o,c],[a,c]]}return(l||u)<0?i.reverse():i}(N,A,P,D),O=B[0],L=B[1];if(0===C&&0===S&&0===N&&0===A&&0===P&&0===D||null==(g=n(O,L,M,T))||null==(v=n(O.reverse(),L.reverse(),M,T)))return h;var V=d+(f-d)*g,R=d+(f-d)*v;if(Math.max(m-p,R-V)<1e-9){var F=(V+R)/2,z=(p+m)/2;e(o,c,l?s:a,l?z:F,l?a:s,l?F:z)}else{r=I.getPart(r,g,v);var j=m-p;if(v-g>.8)if(R-V>j)F=(V+R)/2,h=t(i,(q=I.subdivide(r,.5))[0],s,a,o,c,!l,u,h,p,m,V,F),h=t(i,q[1],s,a,o,c,!l,u,h,p,m,F,R);else{var q;z=(p+m)/2,h=t((q=I.subdivide(i,.5))[0],r,s,a,o,c,!l,u,h,p,z,V,R),h=t(q[1],r,s,a,o,c,!l,u,h,z,m,V,R)}else h=0===j||j>=1e-9?t(i,r,s,a,o,c,!l,u,h,p,m,V,R):t(r,i,a,s,o,c,l,u,h,V,R,p,m)}return h}function n(e,t,n,i){return e[0][1]<n?r(e,!0,n):t[0][1]>i?r(t,!1,i):e[0][0]}function r(e,t,n){for(var r=e[0][0],i=e[0][1],a=1,s=e.length;a<s;a++){var o=e[a][0],c=e[a][1];if(t?c>=n:c<=n)return c===n?o:r+(n-i)*(o-r)/(c-i);r=o,i=c}return null}function i(e,t,n,r,i){var a=h.isZero;if(a(r)&&a(i)){var s=I.getTimeOf(e,new f(t,n));return null===s?[]:[s]}for(var o=Math.atan2(-i,r),c=Math.sin(o),l=Math.cos(o),u=[],d=[],p=0;p<8;p+=2){var m=e[p]-t,g=e[p+1]-n;u.push(m*l-g*c,m*c+g*l)}return I.solveCubic(u,1,0,d,0,1),d}function a(t,n,r,a,s,o,c){for(var l=n[0],u=n[1],h=i(t,l,u,n[6]-l,n[7]-u),d=0,f=h.length;d<f;d++){var p=h[d],m=I.getPoint(t,p),g=I.getTimeOf(n,m);null!==g&&e(s,o,c?a:r,c?g:p,c?r:a,c?p:g)}}function s(t,n,r,i,a,s){var o=_.intersect(t[0],t[1],t[6],t[7],n[0],n[1],n[6],n[7]);o&&e(a,s,r,I.getTimeOf(t,o),i,I.getTimeOf(n,o))}function o(n,r,i,o,c,l){var h=1e-12,d=Math.min,p=Math.max;if(p(n[0],n[2],n[4],n[6])+h>d(r[0],r[2],r[4],r[6])&&d(n[0],n[2],n[4],n[6])-h<p(r[0],r[2],r[4],r[6])&&p(n[1],n[3],n[5],n[7])+h>d(r[1],r[3],r[5],r[7])&&d(n[1],n[3],n[5],n[7])-h<p(r[1],r[3],r[5],r[7])){var m=u(n,r);if(m)for(var g=0;g<2;g++){var v=m[g];e(c,l,i,v[0],o,v[1],!0)}else{var y=I.isStraight(n),b=I.isStraight(r),_=y&&b,w=y&&!b,x=c.length;if((_?s:y||b?a:t)(w?r:n,w?n:r,w?o:i,w?i:o,c,l,w,0,0,0,1,0,1),!_||c.length===x)for(g=0;g<4;g++){var k=g>>1,C=1&g,S=6*k,E=6*C,M=new f(n[S],n[S+1]),T=new f(r[E],r[E+1]);M.isClose(T,h)&&e(c,l,i,k,o,C)}}}return c}function c(t,n,r,i){var a=I.classify(t);if("loop"===a.type){var s=a.roots;e(r,i,n,s[0],n,s[1])}return r}function u(e,t){function n(e){var t=e[6]-e[0],n=e[7]-e[1];return t*t+n*n}var r=Math.abs,i=_.getDistance,a=1e-7,s=I.isStraight(e),o=I.isStraight(t),c=s&&o,l=n(e)<n(t),u=l?t:e,h=l?e:t,d=u[0],p=u[1],m=u[6]-d,g=u[7]-p;if(i(d,p,m,g,h[0],h[1],!0)<a&&i(d,p,m,g,h[6],h[7],!0)<a)!c&&i(d,p,m,g,u[2],u[3],!0)<a&&i(d,p,m,g,u[4],u[5],!0)<a&&i(d,p,m,g,h[2],h[3],!0)<a&&i(d,p,m,g,h[4],h[5],!0)<a&&(s=o=c=!0);else if(c)return null;if(s^o)return null;for(var v=[e,t],y=[],b=0;b<4&&y.length<2;b++){var w=1&b,x=1^w,k=b>>1,C=I.getTimeOf(v[w],new f(v[x][k?6:0],v[x][k?7:1]));if(null!=C){var S=w?[k,C]:[C,k];(!y.length||r(S[0]-y[0][0])>1e-8&&r(S[1]-y[0][1])>1e-8)&&y.push(S)}if(b>2&&!y.length)break}if(2!==y.length)y=null;else if(!c){var E=I.getPart(e,y[0][0],y[1][0]),M=I.getPart(t,y[0][1],y[1][1]);(r(M[2]-E[2])>a||r(M[3]-E[3])>a||r(M[4]-E[4])>a||r(M[5]-E[5])>a)&&(y=null)}return y}return{getIntersections:function(e){var t=this.getValues(),n=e&&e!==this&&e.getValues();return n?o(t,n,this,e,[]):c(t,this,[])},statics:{getOverlaps:u,getIntersections:function(e,t,n,r,i,a){var s=!t;s&&(t=e);for(var u=e.length,h=t.length,d=new Array(u),f=s?d:new Array(h),p=[],m=0;m<u;m++)d[m]=e[m].getValues(r);if(!s)for(m=0;m<h;m++)f[m]=t[m].getValues(i);for(var g=l.findCurveBoundsCollisions(d,f,1e-7),v=0;v<u;v++){var y=e[v],b=d[v];s&&c(b,y,p,n);var _=g[v];if(_)for(var w=0;w<_.length;w++){if(a&&p.length)return p;var x=_[w];if(!s||x>v){var k=t[x];o(b,f[x],y,k,p,n)}}}return p},getCurveLineIntersections:i,getTimesWithTangent:function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=t.normalize(),d=u.x,f=u.y,p=3*c-9*s+9*i-3*n,m=3*l-9*o+9*a-3*r,g=6*s-12*i+6*n,v=6*o-12*a+6*r,y=3*i-3*n,b=3*a-3*r,_=2*p*f-2*m*d,w=[];if(Math.abs(_)<h.CURVETIME_EPSILON){if(0!=(_=p*v-m*g)){var x=-(p*b-m*y)/_;x>=0&&x<=1&&w.push(x)}}else{var k=(g*g-4*p*y)*f*f+(-2*g*v+4*m*y+4*p*b)*d*f+(v*v-4*m*b)*d*d,C=g*f-v*d;if(k>=0&&0!=_){var S=Math.sqrt(k),E=-(C+S)/_,M=(-C+S)/_;E>=0&&E<=1&&w.push(E),M>=0&&M<=1&&w.push(M)}}return w}}}}),D=a.extend({_class:"CurveLocation",initialize:function(e,t,n,r,i){if(t>=.99999999){var a=e.getNext();a&&(t=0,e=a)}this._setCurve(e),this._time=t,this._point=n||e.getPointAtTime(t),this._overlap=r,this._distance=i,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();0===n?e=t._segment1:1===n?e=t._segment2:null!=n&&(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;function n(e){var n=e&&e.getCurve();if(n&&null!=(t._time=n.getTimeOf(t._point)))return t._setCurve(n),n}return e&&e._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null),this._curve||n(this._segment)||n(this._segment1)||n(this._segment2.getPrevious())},getPath:function(){var e=this.getCurve();return e&&e._path},getIndex:function(){var e=this.getCurve();return e&&e.getIndex()},getTime:function(){var e=this.getCurve(),t=this._time;return e&&null==t?this._time=e.getTimeOf(this._point):t},getParameter:"#getTime",getPoint:function(){return this._point},getOffset:function(){var e=this._offset;if(null==e){e=0;var t=this.getPath(),n=this.getIndex();if(t&&null!=n)for(var r=t.getCurves(),i=0;i<n;i++)e+=r[i].getLength();this._offset=e+=this.getCurveOffset()}return e},getCurveOffset:function(){var e=this._curveOffset;if(null==e){var t=this.getCurve(),n=this.getTime();this._curveOffset=e=null!=n&&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 D){var r=this.getCurve(),i=e.getCurve(),a=r._path;if(a===i._path){var s=Math.abs,o=s(this.getOffset()-e.getOffset()),c=!t&&this._intersection,l=!t&&e._intersection;n=(o<1e-7||a&&s(a.getLength()-o)<1e-7)&&(!c&&!l||c&&l&&c.equals(l,!0))}}return n},toString:function(){var e=[],t=this.getPoint(),n=u.instance;t&&e.push("point: "+t);var r=this.getIndex();null!=r&&e.push("index: "+r);var i=this.getTime();return null!=i&&e.push("time: "+n.number(i)),null!=this._distance&&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,i=1-r,a=t>=r&&t<=i,s=n>=r&&n<=i;if(a&&s)return!this.isTouching();var o=this.getCurve(),c=o&&t<r?o.getPrevious():o,l=e.getCurve(),u=l&&n<r?l.getPrevious():l;if(t>i&&(o=o.getNext()),n>i&&(l=l.getNext()),!(c&&o&&u&&l))return!1;var h=[];function d(e,t){var n=e.getValues(),r=I.classify(n).roots||I.getPeaks(n),i=r.length,a=I.getLength(n,t&&i?r[i-1]:0,!t&&i?r[0]:1);h.push(i?a:a/32)}function f(e,t,n){return t<n?e>t&&e<n:e>t||e<n}a||(d(c,!0),d(o,!1)),s||(d(u,!0),d(l,!1));var p=this.getPoint(),m=Math.min.apply(Math,h),g=a?o.getTangentAtTime(t):o.getPointAt(m).subtract(p),v=a?g.negate():c.getPointAt(-m).subtract(p),y=s?l.getTangentAtTime(n):l.getPointAt(m).subtract(p),b=s?y.negate():u.getPointAt(-m).subtract(p),_=v.getAngle(),w=g.getAngle(),x=b.getAngle(),k=y.getAngle();return!!(a?f(_,x,k)^f(w,x,k)&&f(_,k,x)^f(w,k,x):f(x,_,w)^f(k,_,w)&&f(x,w,_)^f(k,w,_))},hasOverlap:function(){return!!this._overlap}},a.each(I._evaluateMethods,(function(e){var t=e+"At";this[e]=function(){var e=this.getCurve(),n=this.getTime();return null!=n&&e&&e[t](n,!0)}}),{preserve:!0}),new function(){function e(e,t,n){var r=e.length,i=0,a=r-1;function s(n,i){for(var a=n+i;a>=-1&&a<=r;a+=i){var s=e[(a%r+r)%r];if(!t.getPoint().isClose(s.getPoint(),1e-7))break;if(t.equals(s))return s}return null}for(;i<=a;){var o,c=i+a>>>1,l=e[c];if(n&&(o=t.equals(l)?l:s(c,-1)||s(c,1)))return t._overlap&&(o._overlap=o._intersection._overlap=!0),o;var u=t.getPath(),h=l.getPath();(u!==h?u._id-h._id:t.getIndex()+t.getTime()-(l.getIndex()+l.getTime()))<0?a=c-1:i=c+1}return e.splice(i,0,t),t}return{statics:{insert:e,expand:function(t){for(var n=t.slice(),r=t.length-1;r>=0;r--)e(n,t[r]._intersection,!1);return n}}}}),B=x.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},statics:{create:function(e){var t,n,r;if(a.isPlainObject(e)?(n=e.segments,t=e.pathData):Array.isArray(e)?n=e:"string"==typeof e&&(t=e),n){var i=n[0];r=i&&Array.isArray(i[0])}else t&&(r=(t.match(/m/gi)||[]).length>1||/z\s*\S+/i.test(t));return new(r?L:O)(e)}},_asPathItem:function(){return this},isClockwise:function(){return this.getArea()>=0},setClockwise:function(e){this.isClockwise()!=(e=!!e)&&this.reverse()},setPathData:function(e){var t,n,r,i=e&&e.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),a=!1,s=new f,o=new f;function c(e,n){var r=+t[e];return a&&(r+=s[n]),r}function l(e){return new f(c(e,"x"),c(e+1,"y"))}this.clear();for(var u=0,h=i&&i.length;u<h;u++){var d=i[u],p=d[0],g=p.toLowerCase(),v=(t=d.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))&&t.length;switch(a=p===g,"z"!==n||/[mz]/.test(g)||this.moveTo(s),g){case"m":case"l":for(var y="m"===g,b=0;b<v;b+=2)this[y?"moveTo":"lineTo"](s=l(b)),y&&(o=s,y=!1);r=s;break;case"h":case"v":var _="h"===g?"x":"y";for(s=s.clone(),b=0;b<v;b++)s[_]=c(b,_),this.lineTo(s);r=s;break;case"c":for(b=0;b<v;b+=6)this.cubicCurveTo(l(b),r=l(b+2),s=l(b+4));break;case"s":for(b=0;b<v;b+=4)this.cubicCurveTo(/[cs]/.test(n)?s.multiply(2).subtract(r):s,r=l(b),s=l(b+2)),n=g;break;case"q":for(b=0;b<v;b+=4)this.quadraticCurveTo(r=l(b),s=l(b+2));break;case"t":for(b=0;b<v;b+=2)this.quadraticCurveTo(r=/[qt]/.test(n)?s.multiply(2).subtract(r):s,s=l(b)),n=g;break;case"a":for(b=0;b<v;b+=7)this.arcTo(s=l(b+5),new m(+t[b],+t[b+1]),+t[b+2],+t[b+4],+t[b+3]);break;case"z":this.closePath(1e-12),s=o}n=g}},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_contains:function(e){var t=e.isInside(this.getBounds({internal:!0,handle:!0}))?this._getWinding(e):{};return t.onPath||!!("evenodd"===this.getFillRule()?1&t.windingL||1&t.windingR:t.winding)},getIntersections:function(e,t,n,r){var i=this===e||!e,a=this._matrix._orNullIfIdentity(),s=i?a:(n||e._matrix)._orNullIfIdentity();return i||this.getBounds(a).intersects(e.getBounds(s),1e-12)?I.getIntersections(this.getCurves(),!i&&e.getCurves(),t,a,s,r):[]},getCrossings:function(e){return this.getIntersections(e,(function(e){return e.isCrossing()}))},getNearestLocation:function(){for(var e=f.read(arguments),t=this.getCurves(),n=1/0,r=null,i=0,a=t.length;i<a;i++){var s=t[i].getNearestLocation(e);s._distance<n&&(n=s._distance,r=s)}return r},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e?e.getPoint():e},interpolate:function(e,t,n){var r=!this._children,i=r?"_segments":"_children",a=e[i],s=t[i],o=this[i];if(!a||!s||a.length!==s.length)throw new Error("Invalid operands in interpolate() call: "+e+", "+t);var c=o.length,l=s.length;if(c<l)for(var u=r?A:O,h=c;h<l;h++)this.add(new u);else c>l&&this[r?"removeSegments":"removeChildren"](l,c);for(h=0;h<l;h++)o[h].interpolate(a[h],s[h],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],i=n.length,a=r.length,s=[],o=0;t=!0;for(var c=l.findItemBoundsCollisions(n,r,h.GEOMETRIC_EPSILON),u=i-1;u>=0&&t;u--){var d=n[u];t=!1;var f=c[u];if(f)for(var p=f.length-1;p>=0&&!t;p--)d.compare(r[f[p]])&&(s[f[p]]||(s[f[p]]=!0,o++),t=!0)}t=t&&o===a}return t}}),O=B.extend({_class:"Path",_serializeFields:{segments:[],closed:!1},initialize:function(e){this._closed=!1,this._segments=[],this._version=0;var t=arguments,r=Array.isArray(e)?"object"==typeof e[0]?e:t:!e||e.size!==n||e.x===n&&e.point===n?null:t;r&&r.length>0?this.setSegments(r):(this._curves=n,this._segmentSelection=0,r||"string"!=typeof e||(this.setPathData(e),e=null)),this._initialize(!r&&e)},_equals:function(e){return this._closed===e._closed&&a.equals(this._segments,e._segments)},copyContent:function(e){this.setSegments(e._segments),this._closed=e._closed},_changed:function e(t){if(e.base.call(this,t),8&t){if(this._length=this._area=n,32&t)this._version++;else if(this._curves)for(var r=0,i=this._curves.length;r<i;r++)this._curves[r]._changed()}else 64&t&&(this._bounds=n)},getStyle:function(){var e=this._parent;return(e instanceof L?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 i=e[r-1];"boolean"==typeof i&&(this.setClosed(i),r--),this._add(A.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=new 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,r,i,a,s,o,c,l,h=this._segments,d=h.length,f=new u(t),p=new Array(6),m=!0,g=[];function v(t,u){if(t._transformCoordinates(e,p),n=p[0],r=p[1],m)g.push("M"+f.pair(n,r)),m=!1;else if(s=p[2],o=p[3],s===n&&o===r&&c===i&&l===a){if(!u){var h=n-i,d=r-a;g.push(0===h?"v"+f.number(d):0===d?"h"+f.number(h):"l"+f.pair(h,d))}}else g.push("c"+f.pair(c-i,l-a)+" "+f.pair(s-i,o-a)+" "+f.pair(n-i,r-a));i=n,a=r,c=p[4],l=p[5]}if(!d)return"";for(var y=0;y<d;y++)v(h[y]);return this._closed&&d>0&&(v(h[0],!0),g.push("z")),g.join("")},isEmpty:function(){return!this._segments.length},_transformContent:function(e){for(var t=this._segments,n=new Array(6),r=0,i=t.length;r<i;r++)t[r]._transformCoordinates(e,n,!0);return!0},_add:function(e,t){for(var n=this._segments,r=this._curves,i=e.length,s=null==t,o=(t=s?n.length:t,0);o<i;o++){var c=e[o];c._path&&(c=e[o]=c.clone()),c._path=this,c._index=t+o,c._selection&&this._updateSelection(c,0,c._selection)}if(s)a.push(n,e);else{n.splice.apply(n,[t,0].concat(e)),o=t+i;for(var l=n.length;o<l;o++)n[o]._index=o}if(r){var u=this._countCurves(),h=t>0&&t+i-1===u?t-1:t,d=h,f=Math.min(h+i,u);for(e._curves&&(r.splice.apply(r,[h,0].concat(e._curves)),d+=e._curves.length),o=d;o<f;o++)r.splice(o,0,new I(this,null,null));this._adjustCurves(h,f)}return this._changed(41),e},_adjustCurves:function(e,t){for(var n,r=this._segments,i=this._curves,a=e;a<t;a++)(n=i[a])._path=this,n._segment1=r[a],n._segment2=r[a+1]||r[0],n._changed();(n=i[this._closed&&!e?r.length-1:e-1])&&(n._segment2=r[e]||r[0],n._changed()),(n=i[t])&&(n._segment1=r[t],n._changed())},_countCurves:function(){var e=this._segments.length;return!this._closed&&e>0?e-1:e},add:function(e){var t=arguments;return t.length>1&&"number"!=typeof e?this._add(A.readList(t)):this._add([A.read(t)])[0]},insert:function(e,t){var n=arguments;return n.length>2&&"number"!=typeof t?this._add(A.readList(n,1),e):this._add([A.read(n,1)],e)[0]},addSegment:function(){return this._add([A.read(arguments)])[0]},insertSegment:function(e){return this._add([A.read(arguments,1)],e)[0]},addSegments:function(e){return this._add(A.readList(e))},insertSegments:function(e,t){return this._add(A.readList(t),e)},removeSegment:function(e){return this.removeSegments(e,e+1)[0]||null},removeSegments:function(e,t,n){e=e||0,t=a.pick(t,this._segments.length);var r=this._segments,i=this._curves,s=r.length,o=r.splice(e,t-e),c=o.length;if(!c)return o;for(var l=0;l<c;l++){var u=o[l];u._selection&&this._updateSelection(u,u._selection,0),u._index=u._path=null}l=e;for(var h=r.length;l<h;l++)r[l]._index=l;if(i){var d=e>0&&t===s+(this._closed?1:0)?e-1:e;for(l=(i=i.splice(d,c)).length-1;l>=0;l--)i[l]._path=null;n&&(o._curves=i.slice(1)),this._adjustCurves(d,d)}return this._changed(41),o},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(null==this._length){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(null==e){var t=this._segments,n=this._closed;e=0;for(var r=0,i=t.length;r<i;r++){var a=r+1===i;e+=I.getArea(I.getValues(t[r],t[a?0:r+1],null,a&&!n))}this._area=e}return e},isFullySelected:function(){var e=this._segments.length;return this.isSelected()&&e>0&&this._segmentSelection===7*e},setFullySelected:function(e){e&&this._selectSegments(!0),this.setSelected(e)},setSelection:function e(t){1&t||this._selectSegments(!1),e.base.call(this,t)},_selectSegments:function(e){var t=this._segments,n=t.length,r=e?7:0;this._segmentSelection=r*n;for(var i=0;i<n;i++)t[i]._selection=r},_updateSelection:function(e,t,n){e._selection=n,(this._segmentSelection+=n-t)>0&&this.setSelected(!0)},divideAt:function(e){var t,n=this.getLocationAt(e);return n&&(t=n.getCurve().divideAt(n.getCurveOffset()))?t._segment1:null},splitAt:function(e){var t=this.getLocationAt(e),n=t&&t.index,r=t&&t.time;r>.99999999&&(n++,r=0);var i=this.getCurves();if(n>=0&&n<i.length){r>=1e-8&&i[n++].divideAtTime(r);var a,s=this.removeSegments(n,this._segments.length,!0);return this._closed?(this.setClosed(!1),a=this):((a=new O(x.NO_INSERT)).insertAbove(this),a.copyAttributes(this)),a._add(s,0),this.addSegment(s[0]),a}return null},split:function(e,t){var r,i=t===n?e:(r=this.getCurves()[e])&&r.getLocationAtTime(t);return null!=i?this.splitAt(i):null},join:function(e,t){var n=t||0;if(e&&e!==this){var r=e._segments,i=this.getLastSegment(),a=e.getLastSegment();if(!a)return this;i&&i._point.isClose(a._point,n)&&e.reverse();var s=e.getFirstSegment();if(i&&i._point.isClose(s._point,n))i.setHandleOut(s._handleOut),this._add(r.slice(1));else{var o=this.getFirstSegment();o&&o._point.isClose(s._point,n)&&e.reverse(),a=e.getLastSegment(),o&&o._point.isClose(a._point,n)?(o.setHandleIn(a._handleIn),this._add(r.slice(0,r.length-1),0)):this._add(r.slice())}e._closed&&this._add([r[0]]),e.remove()}var c=this.getFirstSegment(),l=this.getLastSegment();return c!==l&&c._point.isClose(l._point,n)&&(c.setHandleIn(l._handleIn),l.remove(),this.setClosed(!0)),this},reduce:function(e){for(var t=this.getCurves(),n=e&&e.simplify,r=n?1e-7:0,i=t.length-1;i>=0;i--){var a=t[i];!a.hasHandles()&&(!a.hasLength(r)||n&&a.isCollinear(a.getNext()))&&a.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 V(this,e||.25,256,!0).parts,n=t.length,r=[],i=0;i<n;i++)r.push(new A(t[i].curve.slice(0,2)));!this._closed&&n>0&&r.push(new A(t[n-1].curve.slice(6))),this.setSegments(r)},simplify:function(e){var t=new R(this).fit(e||2.5);return t&&this.setSegments(t),!!t},smooth:function(e){var t=this,r=e||{},i=r.type||"asymmetric",a=this._segments,s=a.length,o=this._closed;function c(e,n){var r=e&&e.index;if(null!=r){var i=e.path;if(i&&i!==t)throw new Error(e._class+" "+r+" of "+i+" is not part of "+t);n&&e instanceof I&&r++}else r="number"==typeof e?e:n;return Math.min(r<0&&o?r%s:r<0?r+s:r,s-1)}var l=o&&r.from===n&&r.to===n,u=c(r.from,0),h=c(r.to,s-1);if(u>h)if(o)u-=s;else{var d=u;u=h,h=d}if(/^(?:asymmetric|continuous)$/.test(i)){var f="asymmetric"===i,p=Math.min,m=h-u+1,g=m-1,v=l?p(m,4):1,y=v,b=v,_=[];if(o||(y=p(1,u),b=p(1,s-h-1)),(g+=y+b)<=1)return;for(var w=0,x=u-y;w<=g;w++,x++)_[w]=a[(x<0?x+s:x)%s]._point;var k=_[0]._x+2*_[1]._x,C=_[0]._y+2*_[1]._y,S=2,E=g-1,M=[k],T=[C],N=[S],A=[],P=[];for(w=1;w<g;w++){var D=w<E,B=D?4:f?2:7,O=D?4:f?3:8,L=D?2:f?0:1,V=(D||f?1:2)/S;S=N[w]=B-V,k=M[w]=O*_[w]._x+L*_[w+1]._x-V*k,C=T[w]=O*_[w]._y+L*_[w+1]._y-V*C}for(A[E]=M[E]/N[E],P[E]=T[E]/N[E],w=g-2;w>=0;w--)A[w]=(M[w]-A[w+1])/N[w],P[w]=(T[w]-P[w+1])/N[w];A[g]=(3*_[g]._x-A[E])/2,P[g]=(3*_[g]._y-P[E])/2,w=y;var R=g-b;for(x=u;w<=R;w++,x++){var F=a[x<0?x+s:x],z=F._point,j=A[w]-z._x,q=P[w]-z._y;(l||w<R)&&F.setHandleOut(j,q),(l||w>y)&&F.setHandleIn(-j,-q)}}else for(w=u;w<=h;w++)a[w<0?w+s:w].smooth(r,!l&&w===u,!l&&w===h)},toShape:function(e){if(!this._closed)return null;var t,r,i,a,s,o,c,l=this._segments;function u(e,t){var n=l[e],r=n.getNext(),i=l[t],a=i.getNext();return n._handleOut.isZero()&&r._handleIn.isZero()&&i._handleOut.isZero()&&a._handleIn.isZero()&&r._point.subtract(n._point).isCollinear(a._point.subtract(i._point))}function d(e){var t=l[e],n=t.getNext(),r=t._handleOut,i=n._handleIn,a=.5522847498307936;if(r.isOrthogonal(i)){var s=t._point,o=n._point,c=new _(s,r,!0).intersect(new _(o,i,!0),!0);return c&&h.isZero(r.getLength()/c.subtract(s).getLength()-a)&&h.isZero(i.getLength()/c.subtract(o).getLength()-a)}return!1}function f(e,t){return l[e]._point.getDistance(l[t]._point)}if(!this.hasHandles()&&4===l.length&&u(0,2)&&u(1,3)&&(s=l[1],o=s.getPrevious(),c=s.getNext(),o._handleOut.isZero()&&s._handleIn.isZero()&&s._handleOut.isZero()&&c._handleIn.isZero()&&s._point.subtract(o._point).isOrthogonal(c._point.subtract(s._point)))?(t=S.Rectangle,r=new m(f(0,3),f(0,1)),a=l[1]._point.add(l[2]._point).divide(2)):8===l.length&&d(0)&&d(2)&&d(4)&&d(6)&&u(1,5)&&u(3,7)?(t=S.Rectangle,i=(r=new m(f(1,6),f(0,3))).subtract(new m(f(0,7),f(1,2))).divide(2),a=l[3]._point.add(l[4]._point).divide(2)):4===l.length&&d(0)&&d(1)&&d(2)&&d(3)&&(h.isZero(f(0,2)-f(1,3))?(t=S.Circle,i=f(0,2)/2):(t=S.Ellipse,i=new m(f(2,0)/2,f(3,1)/2)),a=l[1]._point),t){var p=this.getPosition(!0),g=new t({center:p,size:r,radius:i,insert:!1});return g.copyAttributes(this,!0),g._matrix.prepend(this._matrix),g.rotate(a.subtract(p).getAngle()+90),(e===n||e)&&g.insertAbove(this),g}return null},toPath:"#clone",compare:function e(t){if(!t||t instanceof L)return e.base.call(this,t);var n=this.getCurves(),r=t.getCurves(),i=n.length,a=r.length;if(!i||!a)return i==a;for(var s,o,c=n[0].getValues(),l=[],u=0,h=0,d=0;d<a;d++){var f=r[d].getValues();if(l.push(f),g=I.getOverlaps(c,f)){s=!d&&g[0][0]>0?a-1:d,o=g[0][1];break}}var p,m=Math.abs;for(f=l[s];c&&f;){var g;if((g=I.getOverlaps(c,f))&&m(g[0][0]-h)<1e-8){1===(h=g[1][0])&&(c=++u<i?n[u].getValues():null,h=0);var v=g[0][1];if(m(v-o)<1e-8){if(p||(p=[s,v]),1===(o=g[1][1])&&(++s>=a&&(s=0),f=l[s]||r[s].getValues(),o=0),!c)return p[0]===s&&p[1]===o;continue}}break}return!1},_hitTestSelf:function(e,t,n,r){var i,a,s,o,c,l,u=this,h=this.getStyle(),d=this._segments,f=d.length,p=this._closed,m=t._tolerancePadding,g=m,v=t.stroke&&h.hasStroke(),y=t.fill&&h.hasFill(),b=t.curves,_=v?h.getStrokeWidth()/2:y&&t.tolerance>0||b?0:null;function w(t,n){return e.subtract(t).divide(n).length<=1}function x(e,n,r){if(!t.selected||n.isSelected()){var i=e._point;if(n!==i&&(n=n.add(i)),w(n,g))return new N(r,u,{segment:e,point:n})}}function k(e,n){return(n||t.segments)&&x(e,e._point,"segment")||!n&&t.handles&&(x(e,e._handleIn,"handle-in")||x(e,e._handleOut,"handle-out"))}function C(e){o.add(e)}function S(t){var n,c=p||t._index>0&&t._index<f-1;return"round"===(c?i:a)?w(t._point,g):(o=new O({internal:!0,closed:!0}),c?t.isSmooth()||O._addBevelJoin(t,i,_,s,null,r,C,!0):"square"===a&&O._addSquareCap(t,a,_,null,r,C,!0),o.isEmpty()?void 0:o.contains(e)||(n=o.getNearestLocation(e))&&w(n.getPoint(),m))}if(null!==_&&(_>0?(i=h.getStrokeJoin(),a=h.getStrokeCap(),s=h.getMiterLimit(),g=g.add(O._getStrokePadding(_,r))):i=a="round"),!t.ends||t.segments||p){if(t.segments||t.handles)for(var E=0;E<f;E++)if(l=k(d[E]))return l}else if(l=k(d[0],!0)||k(d[f-1],!0))return l;if(null!==_){if(c=this.getNearestLocation(e)){var M=c.getTime();0===M||1===M&&f>1?S(c.getSegment())||(c=null):w(c.getPoint(),g)||(c=null)}if(!c&&"miter"===i&&f>1)for(E=0;E<f;E++){var T=d[E];if(e.getDistance(T._point)<=s*_&&S(T)){c=T.getLocation();break}}}return!c&&y&&this._contains(e)||c&&!v&&!b?new N("fill",this):c?new N(v?"stroke":"curve",this,{location:c,point:c.getPoint()}):null}},a.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=f.read(arguments),t=this.getCurves(),n=0,r=t.length;n<r;n++){var i=t[n].getLocationOf(e);if(i)return i}return null},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getLocationAt:function(e){if("number"==typeof e){for(var t=this.getCurves(),n=0,r=0,i=t.length;r<i;r++){var a=n,s=t[r];if((n+=s.getLength())>e)return s.getLocationAt(e-a)}if(t.length>0&&e<=this.getLength())return new D(t[t.length-1],1)}else if(e&&e.getPath&&e.getPath()===this)return e;return null},getOffsetsWithTangent:function(){var e=f.read(arguments);if(e.isZero())return[];for(var t=[],n=0,r=this.getCurves(),i=0,a=r.length;i<a;i++){for(var s=r[i],o=s.getTimesWithTangent(e),c=0,l=o.length;c<l;c++){var u=n+s.getOffsetAtTime(o[c]);t.indexOf(u)<0&&t.push(u)}n+=s.length}return t}}),new function(){function e(e,t,n){var r,i,a,s,o,c,l,u,h=t._segments,d=h.length,f=new Array(6),p=!0;function m(t){if(n)t._transformCoordinates(n,f),r=f[0],i=f[1];else{var h=t._point;r=h._x,i=h._y}if(p)e.moveTo(r,i),p=!1;else{if(n)o=f[2],c=f[3];else{var d=t._handleIn;o=r+d._x,c=i+d._y}o===r&&c===i&&l===a&&u===s?e.lineTo(r,i):e.bezierCurveTo(l,u,o,c,r,i)}a=r,s=i,n?(l=f[4],u=f[5]):(d=t._handleOut,l=a+d._x,u=s+d._y)}for(var g=0;g<d;g++)m(h[g]);t._closed&&d>0&&m(h[0])}return{_draw:function(t,n,r,i){var a=n.dontStart,s=n.dontFinish||n.clip,o=this.getStyle(),c=o.hasFill(),l=o.hasStroke(),u=o.getDashArray(),h=!oe.support.nativeDash&&l&&u&&u.length;function d(e){return u[(e%h+h)%h]}if(a||t.beginPath(),(c||l&&!h||s)&&(e(t,this,i),this._closed&&t.closePath()),!s&&(c||l)&&(this._setStyles(t,n,r),c&&(t.fill(o.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),l)){if(h){a||t.beginPath();for(var f,p=new V(this,.25,32,!1,i),m=p.length,g=-o.getDashOffset(),v=0;g>0;)g-=d(v--)+d(v--);for(;g<m;)f=g+d(v++),(g>0||f>0)&&p.drawPart(t,Math.max(g,0),Math.max(f,0)),g=f+d(v++)}t.stroke()}},_drawSelected:function(t,n){t.beginPath(),e(t,this,n),t.stroke(),function(e,t,n,r){if(!(r<=0))for(var i,a,s=r/2,o=r-2,c=s-1,l=new Array(6),u=0,h=t.length;u<h;u++){var d=t[u],f=d._selection;if(d._transformCoordinates(n,l),i=l[0],a=l[1],2&f&&m(2),4&f&&m(4),e.fillRect(i-s,a-s,r,r),o>0&&!(1&f)){var p=e.fillStyle;e.fillStyle="#ffffff",e.fillRect(i-c,a-c,o,o),e.fillStyle=p}}function m(t){var n=l[t],r=l[t+1];i==n&&a==r||(e.beginPath(),e.moveTo(i,a),e.lineTo(n,r),e.stroke(),e.beginPath(),e.arc(n,r,s,0,2*Math.PI,!0),e.fill())}}(t,this._segments,n,oe.settings.handleSize)}}},new function(){function e(e){var t=e._segments;if(!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return{moveTo:function(){var e=this._segments;1===e.length&&this.removeSegment(0),e.length||this._add([new A(f.read(arguments))])},moveBy:function(){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(){this._add([new A(f.read(arguments))])},cubicCurveTo:function(){var t=arguments,n=f.read(t),r=f.read(t),i=f.read(t),a=e(this);a.setHandleOut(n.subtract(a._point)),this._add([new A(i,r.subtract(i))])},quadraticCurveTo:function(){var t=arguments,n=f.read(t),r=f.read(t),i=e(this)._point;this.cubicCurveTo(n.add(i.subtract(n).multiply(1/3)),n.add(r.subtract(n).multiply(1/3)),r)},curveTo:function(){var t=arguments,n=f.read(t),r=f.read(t),i=a.pick(a.read(t),.5),s=1-i,o=e(this)._point,c=n.subtract(o.multiply(s*s)).subtract(r.multiply(i*i)).divide(2*i*s);if(c.isNaN())throw new Error("Cannot put a curve through points with parameter = "+i);this.quadraticCurveTo(c,r)},arcTo:function(){var t,n,r,i,s=arguments,o=Math.abs,c=Math.sqrt,l=e(this),u=l._point,d=f.read(s),p=a.peek(s);if("boolean"==typeof(x=a.pick(p,!0)))var g=(C=u.add(d).divide(2)).add(C.subtract(u).rotate(x?-90:90));else if(a.remain(s)<=2)g=d,d=f.read(s);else if(!u.equals(d)){var v=m.read(s),y=h.isZero;if(y(v.width)||y(v.height))return this.lineTo(d);var w=a.read(s),x=!!a.read(s),k=!!a.read(s),C=u.add(d).divide(2),S=(Y=u.subtract(C).rotate(-w)).x,E=Y.y,M=o(v.width),T=o(v.height),N=M*M,P=T*T,I=S*S,D=E*E,B=c(I/N+D/P);if(B>1&&(N=(M*=B)*M,P=(T*=B)*T),o(B=(N*P-N*D-P*I)/(N*D+P*I))<1e-12&&(B=0),B<0)throw new Error("Cannot create an arc with the given arguments");t=new f(M*E/T,-T*S/M).multiply((k===x?-1:1)*c(B)).rotate(w).add(C),n=(r=(i=(new b).translate(t).rotate(w).scale(M,T))._inverseTransform(u)).getDirectedAngle(i._inverseTransform(d)),!x&&n>0?n-=360:x&&n<0&&(n+=360)}if(g){var O=new _(u.add(g).divide(2),g.subtract(u).rotate(90),!0),L=new _(g.add(d).divide(2),d.subtract(g).rotate(90),!0),V=new _(u,d),R=V.getSide(g);if(!(t=O.intersect(L,!0))){if(!R)return this.lineTo(d);throw new Error("Cannot create an arc with the given arguments")}n=(r=u.subtract(t)).getDirectedAngle(d.subtract(t));var F=V.getSide(t,!0);0===F?n=R*o(n):R===F&&(n+=n<0?360:-360)}if(n){for(var z=o(n),j=z>=360?4:Math.ceil((z-1e-5)/90),q=n/j,H=q*Math.PI/360,U=4/3*Math.sin(H)/(1+Math.cos(H)),G=[],W=0;W<=j;W++){var Y=d,$=null;if(W<j&&($=r.rotate(90).multiply(U),i?(Y=i._transformPoint(r),$=i._transformPoint(r.add($)).subtract(Y)):Y=t.add(r)),W){var K=r.rotate(-90).multiply(U);i&&(K=i._transformPoint(r.add(K)).subtract(Y)),G.push(new A(Y,K,$))}else l.setHandleOut($);r=r.rotate(q)}this._add(G)}},lineBy:function(){var t=f.read(arguments),n=e(this)._point;this.lineTo(n.add(t))},curveBy:function(){var t=arguments,n=f.read(t),r=f.read(t),i=a.read(t),s=e(this)._point;this.curveTo(s.add(n),s.add(r),i)},cubicCurveBy:function(){var t=arguments,n=f.read(t),r=f.read(t),i=f.read(t),a=e(this)._point;this.cubicCurveTo(a.add(n),a.add(r),a.add(i))},quadraticCurveBy:function(){var t=arguments,n=f.read(t),r=f.read(t),i=e(this)._point;this.quadraticCurveTo(i.add(n),i.add(r))},arcBy:function(){var t=arguments,n=e(this)._point,r=n.add(f.read(t)),i=a.pick(a.peek(t),!0);"boolean"==typeof i?this.arcTo(r,i):this.arcTo(r,n.add(f.read(t)))},closePath:function(e){this.setClosed(!0),this.join(this,e)}}},{_getBounds:function(e,t){var n=t.handle?"getHandleBounds":t.stroke?"getStrokeBounds":"getBounds";return O[n](this._segments,this._closed,this,e,t)},statics:{getBounds:function(e,t,n,r,i,a){var s=e[0];if(!s)return new v;var o=new Array(6),c=s._transformCoordinates(r,new Array(6)),l=c.slice(0,2),u=l.slice(),h=new Array(2);function d(e){e._transformCoordinates(r,o);for(var t=0;t<2;t++)I._addBounds(c[t],c[t+4],o[t+2],o[t],t,a?a[t]:0,l,u,h);var n=c;c=o,o=n}for(var f=1,p=e.length;f<p;f++)d(e[f]);return t&&d(s),new v(l[0],l[1],u[0]-l[0],u[1]-l[1])},getStrokeBounds:function(e,t,n,r,i){var a=n.getStyle(),s=a.hasStroke(),o=a.getStrokeWidth(),c=s&&n._getStrokeMatrix(r,i),l=s&&O._getStrokePadding(o,c),u=O.getBounds(e,t,n,r,i,l);if(!s)return u;var h=o/2,d=a.getStrokeJoin(),f=a.getStrokeCap(),p=a.getMiterLimit(),g=new v(new m(l));function y(e){u=u.include(e)}function b(e){u=u.unite(g.setCenter(e._point.transform(r)))}function _(e,t){"round"===t||e.isSmooth()?b(e):O._addBevelJoin(e,t,h,p,r,c,y)}function w(e,t){"round"===t?b(e):O._addSquareCap(e,t,h,r,c,y)}var x=e.length-(t?0:1);if(x>0){for(var k=1;k<x;k++)_(e[k],d);t?_(e[0],d):(w(e[0],f),w(e[e.length-1],f))}return u},_getStrokePadding:function(e,t){if(!t)return[e,e];var n=new f(e,0).transform(t),r=new f(0,e).transform(t),i=n.getAngleInRadians(),a=n.getLength(),s=r.getLength(),o=Math.sin(i),c=Math.cos(i),l=Math.tan(i),u=Math.atan2(s*l,a),h=Math.atan2(s,l*a);return[Math.abs(a*Math.cos(u)*c+s*Math.sin(u)*o),Math.abs(s*Math.sin(h)*c+a*Math.cos(h)*o)]},_addBevelJoin:function(e,t,n,r,i,a,s,o){var c=e.getCurve(),l=c.getPrevious(),u=c.getPoint1().transform(i),h=l.getNormalAtTime(1).multiply(n).transform(a),d=c.getNormalAtTime(0).multiply(n).transform(a),p=h.getDirectedAngle(d);if((p<0||p>=180)&&(h=h.negate(),d=d.negate()),o&&s(u),s(u.add(h)),"miter"===t){var m=new _(u.add(h),new f(-h.y,h.x),!0).intersect(new _(u.add(d),new f(-d.y,d.x),!0),!0);m&&u.getDistance(m)<=r*n&&s(m)}s(u.add(d))},_addSquareCap:function(e,t,n,r,i,a,s){var o=e._point.transform(r),c=e.getLocation(),l=c.getNormal().multiply(0===c.getTime()?n:-n).transform(i);"square"===t&&(s&&(a(o.subtract(l)),a(o.add(l))),o=o.add(l.rotate(-90))),a(o.add(l)),a(o.subtract(l))},getHandleBounds:function(e,t,n,r,i){var a,s,o=n.getStyle();if(i.stroke&&o.hasStroke()){var c=n._getStrokeMatrix(r,i),l=o.getStrokeWidth()/2,u=l;"miter"===o.getStrokeJoin()&&(u=l*o.getMiterLimit()),"square"===o.getStrokeCap()&&(u=Math.max(u,l*Math.SQRT2)),a=O._getStrokePadding(l,c),s=O._getStrokePadding(u,c)}for(var h=new Array(6),d=1/0,f=-d,p=d,m=f,g=0,y=e.length;g<y;g++){e[g]._transformCoordinates(r,h);for(var b=0;b<6;b+=2){var _=b?a:s,w=_?_[0]:0,x=_?_[1]:0,k=h[b],C=h[b+1],S=k-w,E=k+w,M=C-x,T=C+x;S<d&&(d=S),E>f&&(f=E),M<p&&(p=M),T>m&&(m=T)}}return new v(d,p,f-d,m-p)}}});O.inject({statics:new function(){var e=.5522847498307936,t=[new A([-1,0],[0,e],[0,-.5522847498307936]),new A([0,-1],[-.5522847498307936,0],[e,0]),new A([1,0],[0,-.5522847498307936],[0,e]),new A([0,1],[e,0],[-.5522847498307936,0])];function n(e,t,n){var r=a.getNamed(n),i=new O(r&&(1==r.insert?x.INSERT:0==r.insert?x.NO_INSERT:null));return i._add(e),i._closed=t,i.set(r,x.INSERT)}function r(e,r,i){for(var a=new Array(4),s=0;s<4;s++){var o=t[s];a[s]=new A(o._point.multiply(r).add(e),o._handleIn.multiply(r),o._handleOut.multiply(r))}return n(a,!0,i)}return{Line:function(){var e=arguments;return n([new A(f.readNamed(e,"from")),new A(f.readNamed(e,"to"))],!1,e)},Circle:function(){var e=arguments,t=f.readNamed(e,"center"),n=a.readNamed(e,"radius");return r(t,new m(n),e)},Rectangle:function(){var t,r=arguments,i=v.readNamed(r,"rectangle"),a=m.readNamed(r,"radius",0,{readNull:!0}),s=i.getBottomLeft(!0),o=i.getTopLeft(!0),c=i.getTopRight(!0),l=i.getBottomRight(!0);if(!a||a.isZero())t=[new A(s),new A(o),new A(c),new A(l)];else{var u=(a=m.min(a,i.getSize(!0).divide(2))).width,h=a.height,d=u*e,f=h*e;t=[new A(s.add(u,0),null,[-d,0]),new A(s.subtract(0,h),[0,f]),new A(o.add(0,h),null,[0,-f]),new A(o.add(u,0),[-d,0],null),new A(c.subtract(u,0),null,[d,0]),new A(c.add(0,h),[0,-f],null),new A(l.subtract(0,h),null,[0,f]),new A(l.subtract(u,0),[d,0])]}return n(t,!0,r)},RoundRectangle:"#Rectangle",Ellipse:function(){var e=arguments,t=S._readEllipse(e);return r(t.center,t.radius,e)},Oval:"#Ellipse",Arc:function(){var e=arguments,t=f.readNamed(e,"from"),n=f.readNamed(e,"through"),r=f.readNamed(e,"to"),i=a.getNamed(e),s=new O(i&&0==i.insert&&x.NO_INSERT);return s.moveTo(t),s.arcTo(n,r),s.set(i)},RegularPolygon:function(){for(var e=arguments,t=f.readNamed(e,"center"),r=a.readNamed(e,"sides"),i=a.readNamed(e,"radius"),s=360/r,o=r%3==0,c=new f(0,o?-i:i),l=o?-1:.5,u=new Array(r),h=0;h<r;h++)u[h]=new A(t.add(c.rotate((h+l)*s)));return n(u,!0,e)},Star:function(){for(var e=arguments,t=f.readNamed(e,"center"),r=2*a.readNamed(e,"points"),i=a.readNamed(e,"radius1"),s=a.readNamed(e,"radius2"),o=360/r,c=new f(0,-1),l=new Array(r),u=0;u<r;u++)l[u]=new A(t.add(c.rotate(o*u).multiply(u%2?s:i)));return n(l,!0,e)}}}});var L=B.extend({_class:"CompoundPath",_serializeFields:{children:[]},beans:!0,initialize:function(e){this._children=[],this._namedChildren={},this._initialize(e)||("string"==typeof e?this.setPathData(e):this.addChildren(Array.isArray(e)?e:arguments))},insertChildren:function e(t,n){var r=n,i=r[0];i&&"number"==typeof i[0]&&(r=[r]);for(var s=n.length-1;s>=0;s--){var o=r[s];r!==n||o instanceof O||(r=a.slice(r)),Array.isArray(o)?r[s]=new O({segments:o,insert:!1}):o instanceof L&&(r.splice.apply(r,[s,1].concat(o.removeChildren())),o.remove())}return e.base.call(this,t,r)},reduce:function e(t){for(var n=this._children,r=n.length-1;r>=0;r--){var i;(i=n[r].reduce(t)).isEmpty()&&i.remove()}return n.length?e.base.call(this):((i=new O(x.NO_INSERT)).copyAttributes(this),i.insertAbove(this),this.remove(),i)},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++)a.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=[],i=0,a=n.length;i<a;i++){var s=n[i],o=s._matrix;r.push(s.getPathData(e&&!o.isIdentity()?e.appended(o):e,t))}return r.join("")},_hitTestChildren:function e(t,n,r){return e.base.call(this,t,n.class===O||"path"===n.type?n:a.set({},n,{fill:!1}),r)},_draw:function(e,t,n,r){var i=this._children;if(i.length){t=t.extend({dontStart:!0,dontFinish:!0}),e.beginPath();for(var a=0,s=i.length;a<s;a++)i[a].draw(e,t,r);if(!t.clip){this._setStyles(e,t,n);var o=this._style;o.hasFill()&&(e.fill(o.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),o.hasStroke()&&e.stroke()}}},_drawSelected:function(e,t,n){for(var r=this._children,i=0,a=r.length;i<a;i++){var s=r[i],o=s._matrix;n[s._id]||s._drawSelected(e,o.isIdentity()?t:t.appended(o))}}},new function(){function e(e,t){var n=e._children;if(t&&!n.length)throw new Error("Use a moveTo() command first");return n[n.length-1]}return a.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","cubicCurveBy","quadraticCurveBy","curveBy","arcBy"],(function(t){this[t]=function(){var n=e(this,!0);n[t].apply(n,arguments)}}),{moveTo:function(){var t=e(this),n=t&&t.isEmpty()?t:new O(x.NO_INSERT);n!==t&&this.addChild(n),n.moveTo.apply(n,arguments)},moveBy:function(){var t=e(this,!0),n=t&&t.getLastSegment(),r=f.read(arguments);this.moveTo(n?r.add(n._point):r)},closePath:function(t){e(this,!0).closePath(t)}})},a.each(["reverse","flatten","simplify","smooth"],(function(e){this[e]=function(t){for(var n,r=this._children,i=0,a=r.length;i<a;i++)n=r[i][e](t)||n;return n}}),{}));B.inject(new function(){var e=Math.min,t=Math.max,r=Math.abs,i={unite:{1:!0,2:!0},intersect:{2:!0},subtract:{1:!0},exclude:{1:!0,"-1":!0}};function s(e){return e._children||[e]}function o(e,t){var n=e.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);if(t){for(var r=s(n),i=0,a=r.length;i<a;i++)(e=r[i])._closed||e.isEmpty()||(e.closePath(1e-12),e.getFirstSegment().setHandleIn(0,0),e.getLastSegment().setHandleOut(0,0));n=n.resolveCrossings().reorient("nonzero"===n.getFillRule(),!0)}return n}function c(e,t,n,r,i){var a=new L(x.NO_INSERT);return a.addChildren(e,!0),a=a.reduce({simplify:t}),i&&0==i.insert||a.insertAbove(r&&n.isSibling(r)&&n.getIndex()<r.getIndex()?r:n),a.copyAttributes(n,!0),a}function u(e){return e.hasOverlap()||e.isCrossing()}function d(e,t,n,r){if(r&&(0==r.trace||r.stroke)&&/^(subtract|intersect)$/.test(n))return f(e,t,n);var h=o(e,!0),d=t&&e!==t&&o(t,!0),p=i[n];p[n]=!0,d&&(p.subtract||p.exclude)^d.isClockwise()^h.isClockwise()&&d.reverse();var m,y=v(D.expand(h.getIntersections(d,u))),w=s(h),x=d&&s(d),k=[],C=[];function S(e){for(var t=0,n=e.length;t<n;t++){var r=e[t];a.push(k,r._segments),a.push(C,r.getCurves()),r._overlapsOnly=!0}}function E(e){for(var t=[],n=0,r=e&&e.length;n<r;n++)t.push(C[e[n]]);return t}if(y.length){S(w),x&&S(x);for(var M=new Array(C.length),T=0,N=C.length;T<N;T++)M[T]=C[T].getValues();var A=l.findCurveBoundsCollisions(M,M,0,!0),P={};for(T=0;T<C.length;T++){var I=C[T],B=I._path._id;(P[B]=P[B]||{})[I.getIndex()]={hor:E(A[T].hor),ver:E(A[T].ver)}}for(T=0,N=y.length;T<N;T++)b(y[T]._segment,h,d,P,p);for(T=0,N=k.length;T<N;T++){var O=k[T],L=O._intersection;O._winding||b(O,h,d,P,p),L&&L._overlap||(O._path._overlapsOnly=!1)}m=_(k,p)}else m=g(x?w.concat(x):w.slice(),(function(e){return!!p[e]}));return c(m,!0,e,t,r)}function f(e,t,n){var r=o(e),i=o(t),a=r.getIntersections(i,u),s="subtract"===n,l="divide"===n,h={},d=[];function f(e){if(!h[e._id]&&(l||i.contains(e.getPointAt(e.getLength()/2))^s))return d.unshift(e),h[e._id]=!0}for(var p=a.length-1;p>=0;p--){var m=a[p].split();m&&(f(m)&&m.getFirstSegment().setHandleIn(0,0),r.getLastSegment().setHandleOut(0,0))}return f(r),c(d,!1,e,t)}function p(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 m(e){for(var t=e.length-1;t>=0;t--)e[t].clearHandles()}function g(e,t,n){var i=e&&e.length;if(i){var s=a.each(e,(function(e,t){this[e._id]={container:null,winding:e.isClockwise()?1:-1,index:t}}),{}),o=e.slice().sort((function(e,t){return r(t.getArea())-r(e.getArea())})),c=o[0],u=l.findItemBoundsCollisions(o,null,h.GEOMETRIC_EPSILON);null==n&&(n=c.isClockwise());for(var d=0;d<i;d++){var f=o[d],p=s[f._id],m=0,g=u[d];if(g)for(var v=null,y=g.length-1;y>=0;y--)if(g[y]<d){v=v||f.getInteriorPoint();var b=o[g[y]];if(b.contains(v)){var _=s[b._id];m=_.winding,p.winding+=m,p.container=_.exclude?_.container:b;break}}if(t(p.winding)===t(m))p.exclude=!0,e[p.index]=null;else{var w=p.container;f.setClockwise(w?!w.isClockwise():n)}}}return e}function v(e,t,n){var r,i,a,s=t&&[],o=1e-8,c=1-o,l=!1,u=n||[],h=n&&{};function d(e){return e._path._id+"."+e._segment1._index}for(var f=(n&&n.length)-1;f>=0;f--)(g=n[f])._path&&(h[d(g)]=!0);for(f=e.length-1;f>=0;f--){var g,v,y=e[f],b=y._time,_=b,w=t&&!t(y);if((g=y._curve)&&(g!==i?(l=!g.hasHandles()||h&&h[d(g)],r=[],a=null,i=g):a>=o&&(b/=a)),w)r&&r.push(y);else{if(t&&s.unshift(y),a=_,b<o)v=g._segment1;else if(b>c)v=g._segment2;else{var x=g.divideAtTime(b,!0);l&&u.push(g,x),v=x._segment1;for(var k=r.length-1;k>=0;k--){var C=r[k];C._time=(C._time-b)/(1-b)}}y._setSegment(v);var S=v._intersection,E=y._intersection;if(S){p(S,E);for(var M=S;M;)p(M._intersection,S),M=M._next}else v._intersection=E}}return n||m(u),s||e}function y(n,i,a,s,o){var c,l,u=Array.isArray(i)?i:i[a?"hor":"ver"],h=a?1:0,d=1^h,f=[n.x,n.y],p=f[h],m=f[d],g=1e-6,v=p-1e-9,b=p+1e-9,_=0,w=0,x=0,k=0,C=!1,S=!1,E=1,M=[];function T(r){var l=r[d+0],u=r[d+6];if(!(m<e(l,u)||m>t(l,u))){var f=r[h+0],_=r[h+2],w=r[h+4],S=r[h+6];if(l!==u){var T=m===l?0:m===u||v>t(f,_,w,S)||b<e(f,_,w,S)?1:I.solveCubic(r,d,m,M,0,1)>0?M[0]:1,N=0===T?f:1===T?S:I.getPoint(r,T)[a?"y":"x"],A=l>u?1:-1,P=c[d]>c[d+6]?1:-1,D=c[h+6];return m!==l?(N<v?x+=A:N>b?k+=A:C=!0,N>p-g&&N<p+g&&(E/=2)):(A!==P?f<v?x+=A:f>b&&(k+=A):f!=D&&(D<b&&N>b?(k+=A,C=!0):D>v&&N<v&&(x+=A,C=!0)),E/=4),c=r,!o&&N>v&&N<b&&0===I.getTangent(r,T)[a?"x":"y"]&&y(n,i,!a,s,!0)}(f<b&&S>v||S<b&&f>v)&&(C=!0)}}function N(n){var r=n[d+0],i=n[d+2],s=n[d+4],o=n[d+6];if(m<=t(r,i,s,o)&&m>=e(r,i,s,o))for(var c,l=n[h+0],u=n[h+2],f=n[h+4],p=n[h+6],g=v>t(l,u,f,p)||b<e(l,u,f,p)?[n]:I.getMonoCurves(n,a),y=0,_=g.length;y<_;y++)if(c=T(g[y]))return c}for(var A=0,P=u.length;A<P;A++){var D,B=u[A],O=B._path,L=B.getValues();if(!(A&&u[A-1]._path===O||(c=null,O._closed||(l=I.getValues(O.getLastCurve().getSegment2(),B.getSegment1(),null,!s))[d]!==l[d+6]&&(c=l),c))){c=L;for(var V=O.getLastCurve();V&&V!==B;){var R=V.getValues();if(R[d]!==R[d+6]){c=R;break}V=V.getPrevious()}}if(D=N(L))return D;if(A+1===P||u[A+1]._path!==O){if(l&&(D=N(l)))return D;!C||x||k||(x=k=O.isClockwise(s)^a?1:-1),_+=x,w+=k,x=k=0,C&&(S=!0,C=!1),l=null}}return _=r(_),w=r(w),{winding:t(_,w),windingL:_,windingR:w,quality:E,onPath:S}}function b(e,t,n,i,a){var s=[],o=e,c=0;do{if(b=e.getCurve()){var l=b.getLength();s.push({segment:e,curve:b,length:l}),c+=l}e=e.getNext()}while(e&&!e._intersection&&e!==o);for(var u=[.5,.25,.75],d={winding:0,quality:-1},f=0;f<u.length&&d.quality<.5;f++){l=c*u[f];for(var p=0,m=s.length;p<m;p++){var g=s[p],v=g.length;if(l<=v){var b,_=(b=g.curve)._path,w=_._parent,x=w instanceof L?w:_,k=h.clamp(b.getTimeAt(l),.001,.999),C=b.getPointAtTime(k),S=r(b.getTangentAtTime(k).y)<Math.SQRT1_2,E=null;if(a.subtract&&n){var M=(x===t?n:t)._getWinding(C,S,!0);if(x===t&&M.winding||x===n&&!M.winding){if(M.quality<1)continue;E={winding:0,quality:1}}}(E=E||y(C,i[_._id][b.getIndex()],S,!0)).quality>d.quality&&(d=E);break}l-=v}}for(p=s.length-1;p>=0;p--)s[p].segment._winding=d}function _(e,t){var n,r=[];function i(e){var n;return!(!e||e._visited||t&&(!t[(n=e._winding||{}).winding]||t.unite&&2===n.winding&&n.windingL&&n.windingR))}function a(e){if(e)for(var t=0,r=n.length;t<r;t++)if(e===n[t])return!0;return!1}function s(e){for(var t=e._segments,n=0,r=t.length;n<r;n++)t[n]._visited=!0}function o(e,t){var r=e._intersection,s=r,o=[];function c(r,s){for(;r&&r!==s;){var c=r._segment,l=c&&c._path;if(l){var u=c.getNext()||l.getFirstSegment(),h=u._intersection;c!==e&&(a(c)||a(u)||u&&i(c)&&(i(u)||h&&i(h._segment)))&&o.push(c),t&&n.push(c)}r=r._next}}if(t&&(n=[e]),r){for(c(r);r&&r._previous;)r=r._previous;c(r,s)}return o}e.sort((function(e,t){var n=e._intersection,r=t._intersection,i=!(!n||!n._overlap),a=!(!r||!r._overlap),s=e._path,o=t._path;return i^a?i?1:-1:!n^!r?n?1:-1:s!==o?s._id-o._id:e._index-t._index}));for(var c=0,l=e.length;c<l;c++){var u,h,d,f=e[c],p=i(f),m=null,g=!1,v=!0,y=[];if(p&&f._path._overlapsOnly){var b=f._path,_=f._intersection._segment._path;b.compare(_)&&(b.getArea()&&r.push(b.clone(!1)),s(b),s(_),p=!1)}for(;p;){var w=!m,k=o(f,w),C=k.shift(),S=!(g=!w&&(a(f)||a(C)))&&C;if(w&&(m=new O(x.NO_INSERT),u=null),g){(f.isFirst()||f.isLast())&&(v=f._path._closed),f._visited=!0;break}if(S&&u&&(y.push(u),u=null),u||(S&&k.push(f),u={start:m._segments.length,crossings:k,visited:h=[],handleIn:d}),S&&(f=C),!i(f)){m.removeSegments(u.start);for(var E=0,M=h.length;E<M;E++)h[E]._visited=!1;h.length=0;do{(f=u&&u.crossings.shift())&&f._path||(f=null,(u=y.pop())&&(h=u.visited,d=u.handleIn))}while(u&&!i(f));if(!f)break}var T=f.getNext();m.add(new A(f._point,d,T&&f._handleOut)),f._visited=!0,h.push(f),f=T||f._path.getFirstSegment(),d=T&&T._handleIn}g&&(v&&(m.getFirstSegment().setHandleIn(d),m.setClosed(v)),0!==m.getArea()&&r.push(m))}return r}return{_getWinding:function(e,t,n){return y(e,this.getCurves(),t,n)},unite:function(e,t){return d(this,e,"unite",t)},intersect:function(e,t){return d(this,e,"intersect",t)},subtract:function(e,t){return d(this,e,"subtract",t)},exclude:function(e,t){return d(this,e,"exclude",t)},divide:function(e,t){return t&&(0==t.trace||t.stroke)?f(this,e,"divide"):c([this.subtract(e,t),this.intersect(e,t)],!0,this,e,t)},resolveCrossings:function(){var e=this._children,t=e||[this];function n(e,t){var n=e&&e._intersection;return n&&n._overlap&&n._path===t}var r=!1,i=!1,s=this.getIntersections(null,(function(e){return e.hasOverlap()&&(r=!0)||e.isCrossing()&&(i=!0)})),o=r&&i&&[];if(s=D.expand(s),r)for(var c=v(s,(function(e){return e.hasOverlap()}),o),l=c.length-1;l>=0;l--){var u=c[l],h=u._path,d=u._segment,f=d.getPrevious(),p=d.getNext();n(f,h)&&n(p,h)&&(d.remove(),f._handleOut._set(0,0),p._handleIn._set(0,0),f===d||f.getCurve().hasLength()||(p._handleIn.set(f._handleIn),f.remove()))}i&&(v(s,r&&function(e){var t=e.getCurve(),n=e.getSegment(),r=e._intersection,i=r._curve,a=r._segment;if(t&&i&&t._path&&i._path)return!0;n&&(n._intersection=null),a&&(a._intersection=null)},o),o&&m(o),t=_(a.each(t,(function(e){a.push(this,e._segments)}),[])));var g,y=t.length;return y>1&&e?(t!==e&&this.setChildren(t),g=this):1!==y||e||(t[0]!==this&&this.setSegments(t[0].removeSegments()),g=this),g||((g=new L(x.NO_INSERT)).addChildren(t),(g=g.reduce()).copyAttributes(this),this.replaceWith(g)),g},reorient:function(e,t){var r=this._children;return r&&r.length?this.setChildren(g(this.removeChildren(),(function(t){return!!(e?t:1&t)}),t)):t!==n&&this.setClockwise(t),this},getInteriorPoint:function(){var n=this.getBounds().getCenter(!0);if(!this.contains(n)){for(var r=this.getCurves(),i=n.y,a=[],s=[],o=0,c=r.length;o<c;o++){var l=r[o].getValues(),u=l[1],h=l[3],d=l[5],f=l[7];if(i>=e(u,h,d,f)&&i<=t(u,h,d,f))for(var p=I.getMonoCurves(l),m=0,g=p.length;m<g;m++){var v=p[m],y=v[1],b=v[7];if(y!==b&&(i>=y&&i<=b||i>=b&&i<=y)){var _=i===y?v[0]:i===b?v[6]:1===I.solveCubic(v,1,i,s,0,1)?I.getPoint(v,s[0]).x:(v[0]+v[6])/2;a.push(_)}}}a.length>1&&(a.sort((function(e,t){return e-t})),n.x=(a[0]+a[1])/2)}return n}}});var V=a.extend({_class:"PathFlattener",initialize:function(e,t,n,r,i){var a,s=[],o=[],c=0,l=1/(n||32),u=e._segments,h=u[0];function d(e,t){var n=I.getValues(e,t,i);s.push(n),f(n,e._index,0,1)}function f(e,n,i,a){if(!(a-i>l)||r&&I.isStraight(e)||I.isFlatEnough(e,t||.25)){var s=e[6]-e[0],u=e[7]-e[1],h=Math.sqrt(s*s+u*u);h>0&&(c+=h,o.push({offset:c,curve:e,index:n,time:a}))}else{var d=I.subdivide(e,.5),p=(i+a)/2;f(d[0],n,i,p),f(d[1],n,p,a)}}for(var p=1,m=u.length;p<m;p++)d(h,a=u[p]),h=a;e._closed&&d(a||h,u[0]),this.curves=s,this.parts=o,this.length=c,this.index=0},_get:function(e){for(var t,n=this.parts,r=n.length,i=this.index;t=i,i&&!(n[--i].offset<e););for(;t<r;t++){var a=n[t];if(a.offset>=e){this.index=t;var s=n[t-1],o=s&&s.index===a.index?s.time:0,c=s?s.offset:0;return{index:a.index,time:o+(a.time-o)*(e-c)/(a.offset-c)}}}return{index:n[r-1].index,time:1}},drawPart:function(e,t,n){for(var r=this._get(t),i=this._get(n),a=r.index,s=i.index;a<=s;a++){var o=I.getPart(this.curves[a],a===r.index?r.time:0,a===i.index?i.time:1);a===r.index&&e.moveTo(o[0],o[1]),e.bezierCurveTo.apply(e,o.slice(2))}}},a.each(I._evaluateMethods,(function(e){this[e+"At"]=function(t){var n=this._get(t);return I[e](this.curves[n.index],n.time)}}),{})),R=a.extend({initialize:function(e){for(var t,n=this.points=[],r=e._segments,i=e._closed,a=0,s=r.length;a<s;a++){var o=r[a].point;t&&t.equals(o)||n.push(t=o.clone())}i&&(n.unshift(n[n.length-1]),n.push(n[1])),this.closed=i},fit:function(e){var t=this.points,n=t.length,r=null;return n>0&&(r=[new A(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,i,a){var s=this.points;if(r-n!=1){for(var o,c=this.chordLengthParameterize(n,r),l=Math.max(t,t*t),u=!0,h=0;h<=4;h++){var d=this.generateBezier(n,r,c,i,a),f=this.findMaxError(n,r,d,c);if(f.error<t&&u)return void this.addCurve(e,d);if(o=f.index,f.error>=l)break;u=this.reparameterize(n,r,c,d),l=f.error}var p=s[o-1].subtract(s[o+1]);this.fitCubic(e,t,n,o,i,p),this.fitCubic(e,t,o,r,p.negate(),a)}else{var m=s[n],g=s[r],v=m.getDistance(g)/3;this.addCurve(e,[m,m.add(i.normalize(v)),g.add(a.normalize(v)),g])}},addCurve:function(e,t){e[e.length-1].setHandleOut(t[1].subtract(t[0])),e.push(new A(t[3],t[2].subtract(t[3])))},generateBezier:function(e,t,n,r,i){for(var a=1e-12,s=Math.abs,o=this.points,c=o[e],l=o[t],u=[[0,0],[0,0]],h=[0,0],d=0,f=t-e+1;d<f;d++){var p=n[d],m=1-p,g=3*p*m,v=m*m*m,y=g*m,b=g*p,_=p*p*p,w=r.normalize(y),x=i.normalize(b),k=o[e+d].subtract(c.multiply(v+y)).subtract(l.multiply(b+_));u[0][0]+=w.dot(w),u[0][1]+=w.dot(x),u[1][0]=u[0][1],u[1][1]+=x.dot(x),h[0]+=w.dot(k),h[1]+=x.dot(k)}var C,S,E=u[0][0]*u[1][1]-u[1][0]*u[0][1];if(s(E)>a){var M=u[0][0]*h[1]-u[1][0]*h[0];C=(h[0]*u[1][1]-h[1]*u[0][1])/E,S=M/E}else{var T=u[0][0]+u[0][1],N=u[1][0]+u[1][1];C=S=s(T)>a?h[0]/T:s(N)>a?h[1]/N:0}var A,P,I=l.getDistance(c),D=a*I;if(C<D||S<D)C=S=I/3;else{var B=l.subtract(c);A=r.normalize(C),P=i.normalize(S),A.dot(B)-P.dot(B)>I*I&&(C=S=I/3,A=P=null)}return[c,c.add(A||r.normalize(C)),l.add(P||i.normalize(S)),l]},reparameterize:function(e,t,n,r){for(var i=e;i<=t;i++)n[i-e]=this.findRoot(r,this.points[i],n[i-e]);i=1;for(var a=n.length;i<a;i++)if(n[i]<=n[i-1])return!1;return!0},findRoot:function(e,t,n){for(var r=[],i=[],a=0;a<=2;a++)r[a]=e[a+1].subtract(e[a]).multiply(3);for(a=0;a<=1;a++)i[a]=r[a+1].subtract(r[a]).multiply(2);var s=this.evaluate(3,e,n),o=this.evaluate(2,r,n),c=this.evaluate(1,i,n),l=s.subtract(t),u=o.dot(o)+l.dot(c);return h.isMachineZero(u)?n:n-l.dot(o)/u},evaluate:function(e,t,n){for(var r=t.slice(),i=1;i<=e;i++)for(var a=0;a<=e-i;a++)r[a]=r[a].multiply(1-n).add(r[a+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]);r=1;for(var i=t-e;r<=i;r++)n[r]/=n[i];return n},findMaxError:function(e,t,n,r){for(var i=Math.floor((t-e+1)/2),a=0,s=e+1;s<t;s++){var o=this.evaluate(3,n,r[s-e]).subtract(this.points[s]),c=o.x*o.x+o.y*o.y;c>=a&&(a=c,i=s)}return{error:a,index:i}}}),F=x.extend({_class:"TextItem",_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null},_boundsOptions:{stroke:!1,handle:!1},initialize:function(e){this._content="",this._lines=[];var t=e&&a.isPlainObject(e)&&e.x===n&&e.y===n;this._initialize(t&&e,!t&&f.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"}),z=F.extend({_class:"PointText",initialize:function(){F.apply(this,arguments)},getPoint:function(){var e=this._matrix.getTranslation();return new p(e.x,e.y,this,"setPoint")},setPoint:function(){var e=f.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,i=this._style,a=i.hasFill(),s=i.hasStroke(),o=i.getLeading(),c=e.shadowColor;e.font=i.getFontStyle(),e.textAlign=i.getJustification();for(var l=0,u=r.length;l<u;l++){e.shadowColor=c;var h=r[l];a&&(e.fillText(h,0,0),e.shadowColor="rgba(0,0,0,0)"),s&&e.strokeText(h,0,0),e.translate(0,o)}}},_getBounds:function(e,t){var n=this._style,r=this._lines,i=r.length,a=n.getJustification(),s=n.getLeading(),o=this.getView().getTextWidth(n.getFontStyle(),r),c=0;"left"!==a&&(c-=o/("center"===a?2:1));var l=new v(c,i?-.75*s:0,o,i*s);return e?e._transformBounds(l,l):l}}),j=a.extend(new function(){var e,t={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"],gradient:["gradient","origin","destination","highlight"]},n={},i={transparent:[0,0,0,0]},s=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],o={"rgb-hsb":function(e,t,n){var r=Math.max(e,t,n),i=r-Math.min(e,t,n);return[0===i?0:60*(r==e?(t-n)/i+(t<n?6:0):r==t?(n-e)/i+2:(e-t)/i+4),0===r?0:i/r,r]},"hsb-rgb":function(e,t,n){var r,i=(e=(e/60%6+6)%6)-(r=Math.floor(e)),a=[n,n*(1-t),n*(1-t*i),n*(1-t*(1-i))];return[a[(r=s[r])[0]],a[r[1]],a[r[2]]]},"rgb-hsl":function(e,t,n){var r=Math.max(e,t,n),i=Math.min(e,t,n),a=r-i,s=0===a,o=(r+i)/2;return[s?0:60*(r==e?(t-n)/a+(t<n?6:0):r==t?(n-e)/a+2:(e-t)/a+4),s?0:o<.5?a/(r+i):a/(2-r-i),o]},"hsl-rgb":function(e,t,n){if(0===t)return[n,n,n];for(var r=[(e=(e/360%1+1)%1)+1/3,e,e-1/3],i=n<.5?n*(1+t):n+t-n*t,a=2*n-i,s=[],o=0;o<3;o++){var c=r[o];c<0&&(c+=1),c>1&&(c-=1),s[o]=6*c<1?a+6*(i-a)*c:2*c<1?i:3*c<2?a+(i-a)*(2/3-c)*6:a}return s},"rgb-gray":function(e,t,n){return[.2989*e+.587*t+.114*n]},"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 a.each(t,(function(e,r){n[r]=[],a.each(e,(function(e,i){var s=a.capitalize(e),o=/^(hue|saturation)$/.test(e),c=n[r][i]="gradient"===r?"gradient"===e?function(e){var t=this._components[0];return t!==(e=q.read(Array.isArray(e)?e:arguments,0,{readNull:!0}))&&(t&&t._removeOwner(this),e&&e._addOwner(this)),e}:function(){return f.read(arguments,0,{readNull:"highlight"===e,clone:!0})}:function(e){return null==e||isNaN(e)?0:+e};this["get"+s]=function(){return this._type===r||o&&/^hs[bl]$/.test(this._type)?this._components[i]:this._convert(r)[i]},this["set"+s]=function(e){this._type===r||o&&/^hs[bl]$/.test(this._type)||(this._components=this._convert(r),this._properties=t[r],this._type=r),this._components[i]=c.call(this,e),this._changed()}}),this)}),{_class:"Color",_readIndex:!0,initialize:function s(o){var c,l,u,h,d=arguments,f=this.__read,p=0;Array.isArray(o)&&(o=(d=o)[0]);var m=null!=o&&typeof o;if("string"===m&&o in t&&(c=o,o=d[1],Array.isArray(o)?(l=o,u=d[2]):(f&&(p=1),d=a.slice(d,1),m=typeof o)),!l){if(h="number"===m?d:"object"===m&&null!=o.length?o:null){c||(c=h.length>=3?"rgb":"gray");var g=t[c].length;u=h[g],f&&(p+=h===arguments?g+(null!=u?1:0):1),h.length>g&&(h=a.slice(h,0,g))}else if("string"===m){var v=function(t){var n,a=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),s="rgb";if(a){var o=a[4]?4:3;n=new Array(o);for(var c=0;c<o;c++){var l=a[c+1];n[c]=parseInt(1==l.length?l+l:l,16)/255}}else if(a=t.match(/^(rgb|hsl)a?\((.*)\)$/)){s=a[1],n=a[2].trim().split(/[,\s]+/g);for(var u="hsl"===s,h=(c=0,Math.min(n.length,4));c<h;c++){var d=n[c];if(l=parseFloat(d),u)if(0===c){var f=d.match(/([a-z]*)$/)[1];l*={turn:360,rad:180/Math.PI,grad:.9}[f]||1}else c<3&&(l/=100);else c<3&&(l/=/%$/.test(d)?100:255);n[c]=l}}else{var p=i[t];if(!p)if(r){e||((e=re.getContext(1,1,{willReadFrequently:!0})).globalCompositeOperation="copy"),e.fillStyle="rgba(0,0,0,0)",e.fillStyle=t,e.fillRect(0,0,1,1);var m=e.getImageData(0,0,1,1).data;p=i[t]=[m[0]/255,m[1]/255,m[2]/255]}else p=[0,0,0];n=p.slice()}return[s,n]}(o);c=v[0],4===(l=v[1]).length&&(u=l[3],l.length--)}else if("object"===m)if(o.constructor===s){if(c=o._type,l=o._components.slice(),u=o._alpha,"gradient"===c)for(var y=1,b=l.length;y<b;y++){var _=l[y];_&&(l[y]=_.clone())}}else if(o.constructor===q)c="gradient",h=d;else{var w=t[c="hue"in o?"lightness"in o?"hsl":"hsb":"gradient"in o||"stops"in o||"radial"in o?"gradient":"gray"in o?"gray":"rgb"],x=n[c];for(this._components=l=[],y=0,b=w.length;y<b;y++)null==(k=o[w[y]])&&!y&&"gradient"===c&&"stops"in o&&(k={stops:o.stops,radial:o.radial}),null!=(k=x[y].call(this,k))&&(l[y]=k);u=o.alpha}f&&c&&(p=1)}if(this._type=c||"rgb",!l)for(this._components=l=[],y=0,b=(x=n[this._type]).length;y<b;y++){var k;null!=(k=x[y].call(this,h&&h[y]))&&(l[y]=k)}return this._components=l,this._properties=t[this._type],this._alpha=u,f&&(this.__read=p),this},set:"#initialize",_serialize:function(e,t){var n=this.getComponents();return a.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=o[this._type+"-"+e])?t.apply(this,this._components):o["rgb-"+e].apply(this,o[this._type+"-rgb"].apply(this,this._components))},convert:function(e){return new j(e,this._convert(e),this._alpha)},getType:function(){return this._type},setType:function(e){this._components=this._convert(e),this._properties=t[e],this._type=e},getComponents:function(){var e=this._components.slice();return null!=this._alpha&&e.push(this._alpha),e},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(e){this._alpha=null==e?null:Math.min(Math.max(e,0),1),this._changed()},hasAlpha:function(){return null!=this._alpha},equals:function(e){var t=a.isPlainValue(e,!0)?j.read(arguments):e;return t===this||t&&this._class===t._class&&this._type===t._type&&this.getAlpha()===t.getAlpha()&&a.equals(this._components,t._components)||!1},toString:function(){for(var e=this._properties,t=[],n="gradient"===this._type,r=u.instance,i=0,a=e.length;i<a;i++){var s=this._components[i];null!=s&&t.push(e[i]+": "+(n?s:r.number(s)))}return null!=this._alpha&&t.push("alpha: "+r.number(this._alpha)),"{ "+t.join(", ")+" }"},toCSS:function(e){var t=this._convert("rgb"),n=e||null==this._alpha?1:this._alpha;function r(e){return Math.round(255*(e<0?0:e>1?1:e))}return t=[r(t[0]),r(t[1]),r(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):(4==t.length?"rgba(":"rgb(")+t.join(",")+")"},toCanvasStyle:function(e,t){if(this._canvasStyle)return this._canvasStyle;if("gradient"!==this._type)return this._canvasStyle=this.toCSS();var n,r=this._components,i=r[0],a=i._stops,s=r[1],o=r[2],c=r[3],l=t&&t.inverted();if(l&&(s=l._transformPoint(s),o=l._transformPoint(o),c&&(c=l._transformPoint(c))),i._radial){var u=o.getDistance(s);if(c){var h=c.subtract(s);h.getLength()>u&&(c=s.add(h.normalize(u-.1)))}var d=c||s;n=e.createRadialGradient(d.x,d.y,0,s.x,s.y,u)}else n=e.createLinearGradient(s.x,s.y,o.x,o.y);for(var f=0,p=a.length;f<p;f++){var m=a[f],g=m._offset;n.addColorStop(null==g?f/(p-1):g,m._color.toCanvasStyle())}return this._canvasStyle=n},transform:function(e){if("gradient"===this._type){for(var t=this._components,n=1,r=t.length;n<r;n++){var i=t[n];e._transformPoint(i,i,!0)}this._changed()}},statics:{_types:t,random:function(){var e=Math.random;return new j(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 a.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=j.read(arguments);for(var n=this._type,r=this._components,i=t._convert(n),a=0,s=r.length;a<s;a++)i[a]=e(r[a],i[a]);return new j(n,i,null!=this._alpha?e(this._alpha,t.getAlpha()):null)}}),{})}),q=a.extend({_class:"Gradient",initialize:function(e,t){this._id=d.get(),e&&a.isPlainObject(e)&&(this.set(e),e=t=null),null==this._stops&&this.setStops(e||["white","black"]),null==this._radial&&this.setRadial("string"==typeof t&&"radial"===t||t||!1)},_serialize:function(e,t){return t.add(this,(function(){return a.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;-1!=t&&(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 q(e,this._radial)},getStops:function(){return this._stops},setStops:function(e){if(e.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");var t=this._stops;if(t)for(var r=0,i=t.length;r<i;r++)t[r]._owner=n;for(r=0,i=(t=this._stops=H.readList(e,0,{clone:!0})).length;r<i;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 i=0;i<r;i++)if(!t[i].equals(n[i]))return!1;return!0}}return!1}}),H=a.extend({_class:"GradientStop",initialize:function(e,t){var r=e,i=t;"object"==typeof e&&t===n&&(Array.isArray(e)&&"number"!=typeof e[0]?(r=e[0],i=e[1]):("color"in e||"offset"in e||"rampPoint"in e)&&(r=e.color,i=e.offset||e.rampPoint||0)),this.setColor(r),this.setOffset(i)},clone:function(){return new H(this._color.clone(),this._offset)},_serialize:function(e,t){var n=this._color,r=this._offset;return a.serialize(null==r?[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(){j._setOwner(this._color,null),this._color=j._setOwner(j.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}}),U=a.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 f,selectedColor:null},t=a.set({},e,{fontFamily:"sans-serif",fontWeight:"normal",fontSize:12,leading:null,justification:"left"}),r=a.set({},t,{fillColor:new j}),i={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,justification:9},s={beans:!0},o={_class:"Style",beans:!0,initialize:function(n,i,a){this._values={},this._owner=i,this._project=i&&i._project||a||oe.project,this._defaults=!i||i instanceof k?t:i instanceof F?r:e,n&&this.set(n)}};return a.each(t,(function(e,t){var r=/Color$/.test(t),c="shadowOffset"===t,l=a.capitalize(t),u=i[t],h="set"+l,d="get"+l;o[h]=function(e){var n=this._owner,i=n&&n._children,a=i&&i.length>0&&!(n instanceof L);if(a)for(var s=0,o=i.length;s<o;s++)i[s]._style[h](e);if(("selectedColor"===t||!a)&&t in this._defaults){var c=this._values[t];c!==e&&(r&&(c&&(j._setOwner(c,null),c._canvasStyle=null),e&&e.constructor===j&&(e=j._setOwner(e,n,a&&h))),this._values[t]=e,n&&n._changed(u||129))}},o[d]=function(e){var i=this._owner,s=i&&i._children,o=s&&s.length>0&&!(i instanceof L);if(o&&!e)for(var l=0,u=s.length;l<u;l++){var p=s[l]._style[d]();if(l){if(!a.equals(m,p))return n}else m=p}else if(t in this._defaults){var m;if((m=this._values[t])===n)(m=this._defaults[t])&&m.clone&&(m=m.clone());else{var g=r?j:c?f:null;!g||m&&m.constructor===g||(this._values[t]=m=g.read([m],0,{readNull:!0,clone:!0}))}}return m&&r&&(m=j._setOwner(m,i,o&&h)),m},s[d]=function(e){return this._style[d](e)},s[h]=function(e){this._style[h](e)}})),a.each({Font:"FontFamily",WindingRule:"FillRule"},(function(e,t){var n="get"+t,r="set"+t;o[n]=s[n]="#get"+e,o[r]=s[r]="#set"+e})),x.inject(s),o},{set:function(e){var t=e instanceof U,n=t?e._values:e;if(n)for(var r in n)if(r in this._defaults){var i=n[r];this[r]=i&&t&&i.clone?i.clone():i}},equals:function(e){function t(e,t,r){var i=e._values,s=t._values,o=t._defaults;for(var c in i){var l=i[c],u=s[c];if(!(r&&c in s||a.equals(l,u===n?o[c]:u)))return!1}return!0}return e===this||e&&this._class===e._class&&t(this,e)&&t(e,this,!0)||!1},_dispose:function(){var e;(e=this.getFillColor())&&(e._canvasStyle=null),(e=this.getStrokeColor())&&(e._canvasStyle=null),(e=this.getShadowColor())&&(e._canvasStyle=null)},hasFill:function(){var e=this.getFillColor();return!!e&&e.alpha>0},hasStroke:function(){var e=this.getStrokeColor();return!!e&&e.alpha>0&&this.getStrokeWidth()>0},hasShadow:function(){var e=this.getShadowColor();return!!e&&e.alpha>0&&(this.getShadowBlur()>0||!this.getShadowOffset().isZero())},getView:function(){return this._project._view},getFontStyle:function(){var e=this.getFontSize();return this.getFontWeight()+" "+e+(/[a-z]/i.test(e+"")?" ":"px ")+this.getFontFamily()},getFont:"#getFontFamily",setFont:"#setFontFamily",getLeading:function e(){var t=e.base.call(this),n=this.getFontSize();return/pt|em|%|px/.test(n)&&(n=this.getView().getPixelSize(n)),null!=t?t:1.2*n}}),G=new function(){function e(e,t,n,r){for(var i=["","webkit","moz","Moz","ms","o"],a=t[0].toUpperCase()+t.substring(1),s=0;s<6;s++){var o=i[s],c=o?o+a:t;if(c in e){if(!n)return e[c];e[c]=r;break}}}return{getStyles:function(e){var t=e&&9!==e.nodeType?e.ownerDocument:e,n=t&&t.defaultView;return n&&n.getComputedStyle(e,"")},getBounds:function(e,t){var n,r=e.ownerDocument,i=r.body,a=r.documentElement;try{n=e.getBoundingClientRect()}catch(l){n={left:0,top:0,width:0,height:0}}var s=n.left-(a.clientLeft||i.clientLeft||0),o=n.top-(a.clientTop||i.clientTop||0);if(!t){var c=r.defaultView;s+=c.pageXOffset||a.scrollLeft||i.scrollLeft,o+=c.pageYOffset||a.scrollTop||i.scrollTop}return new v(s,o,n.width,n.height)},getViewportBounds:function(e){var t=e.ownerDocument,n=t.defaultView,r=t.documentElement;return new v(0,0,n.innerWidth||r.clientWidth,n.innerHeight||r.clientHeight)},getOffset:function(e,t){return G.getBounds(e,t).getPoint()},getSize:function(e){return G.getBounds(e,!0).getSize()},isInvisible:function(e){return G.getSize(e).equals(new m(0,0))},isInView:function(e){return!G.isInvisible(e)&&G.getViewportBounds(e).intersects(G.getBounds(e,!0))},isInserted:function(e){return i.body.contains(e)},getPrefixed:function(t,n){return t&&e(t,n)},setPrefixed:function(t,n,r){if("object"==typeof n)for(var i in n)e(t,i,!0,n[i]);else e(t,n,!0,r)}}},W={add:function(e,t){if(e)for(var n in t)for(var r=t[n],a=n.split(/[\s,]+/g),s=0,o=a.length;s<o;s++){var c=a[s],l=e===i&&("touchstart"===c||"touchmove"===c)&&{passive:!1};e.addEventListener(c,r,l)}},remove:function(e,t){if(e)for(var n in t)for(var r=t[n],i=n.split(/[\s,]+/g),a=0,s=i.length;a<s;a++)e.removeEventListener(i[a],r,!1)},getPoint:function(e){var t=e.targetTouches?e.targetTouches.length?e.targetTouches[0]:e.changedTouches[0]:e;return new f(t.pageX||t.clientX+i.documentElement.scrollLeft,t.pageY||t.clientY+i.documentElement.scrollTop)},getTarget:function(e){return e.target||e.srcElement},getRelatedTarget:function(e){return e.relatedTarget||e.toElement},getOffset:function(e,t){return W.getPoint(e).subtract(G.getOffset(t||W.getTarget(e)))}};W.requestAnimationFrame=new function(){var e,t=G.getPrefixed(r,"requestAnimationFrame"),n=!1,i=[];function a(){var e=i;i=[];for(var r=0,s=e.length;r<s;r++)e[r]();(n=t&&i.length)&&t(a)}return function(r){i.push(r),t?n||(t(a),n=!0):e||(e=setInterval(a,1e3/60))}};var Y=a.extend(s,{_class:"View",initialize:function e(t,n){function a(e){return n[e]||parseInt(n.getAttribute(e),10)}function s(){var e=G.getSize(n);return e.isNaN()||e.isZero()?new m(a("width"),a("height")):e}var c;if(r&&n){this._id=n.getAttribute("id"),null==this._id&&n.setAttribute("id",this._id="paper-view-"+e._id++),W.add(n,this._viewEvents);var l="none";if(G.setPrefixed(n.style,{userDrag:l,userSelect:l,touchCallout:l,contentZooming:l,tapHighlightColor:"rgba(0,0,0,0)"}),o.hasAttribute(n,"resize")){var u=this;W.add(r,this._windowEvents={resize:function(){u.setViewSize(s())}})}if(c=s(),o.hasAttribute(n,"stats")&&"undefined"!=typeof Stats){this._stats=new Stats;var h=this._stats.domElement,d=h.style,f=G.getOffset(n);d.position="absolute",d.left=f.x+"px",d.top=f.y+"px",i.body.appendChild(h)}}else c=new m(n),n=null;this._project=t,this._scope=t._scope,this._element=n,this._pixelRatio||(this._pixelRatio=r&&r.devicePixelRatio||1),this._setElementSize(c.width,c.height),this._viewSize=c,e._views.push(this),e._viewsById[this._id]=this,(this._matrix=new b)._owner=this,e._focused||(e._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!oe.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;Y._focused===this&&(Y._focused=null),Y._views.splice(Y._views.indexOf(this),1),delete Y._viewsById[this._id];var e=this._project;return e._view===this&&(e._view=null),W.remove(this._element,this._viewEvents),W.remove(r,this._windowEvents),this._element=this._project=null,this.off("frame"),this._animate=!1,this._frameItems={},!0},_events:a.each(x._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;W.requestAnimationFrame((function(){if(e._requested=!1,e._animate){e.requestUpdate();var t=e._element;G.getPrefixed(i,"hidden")&&"true"!==o.getAttribute(t,"keepalive")||!G.isInView(t)||e._handleFrame()}e._autoUpdate&&e.update()})),this._requested=!0}},play:function(){this._animate=!0,this.requestUpdate()},pause:function(){this._animate=!1},_handleFrame:function(){oe=this._scope;var e=Date.now()/1e3,t=this._last?e-this._last:0;this._last=e,this.emit("frame",new a({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},1==++this._frameItemCount&&this.on("frame",this._handleFrameItems)):(delete n[e._id],0==--this._frameItemCount&&this.off("frame",this._handleFrameItems))},_handleFrameItems:function(e){for(var t in this._frameItems){var n=this._frameItems[t];n.item.emit("frame",new a(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 72*this._pixelRatio},getViewSize:function(){var e=this._viewSize;return new g(e.width,e.height,this,"setViewSize")},setViewSize:function(){var e=m.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 v(new f,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return G.isInView(this._element)},isInserted:function(){return G.isInserted(this._element)},getPixelSize:function(e){var t,n=this._element;if(n){var r=n.parentNode,a=i.createElement("div");a.style.fontSize=e,r.appendChild(a),t=parseFloat(G.getStyles(a).fontSize),r.removeChild(a)}else t=parseFloat(t);return t},getTextWidth:function(e,t){return 0}},a.each(["rotate","scale","shear","skew"],(function(e){var t="rotate"===e;this[e]=function(){var n=arguments,r=(t?a:f).read(n),i=f.read(n,0,{readNull:!0});return this.transform((new b)[e](r,i||this.getCenter(!0)))}}),{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var e=new b;return this.transform(e.translate.apply(e,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var e=f.read(arguments);this.translate(this.getCenter().subtract(e))},getZoom:function(){var e=this._decompose().scaling;return(e.x+e.y)/2},setZoom:function(e){this.transform((new b).scale(e/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(e){var t=this.getRotation();null!=t&&null!=e&&this.rotate(e-t)},getScaling:function(){var e=this._decompose().scaling;return new p(e.x,e.y,this,"setScaling")},setScaling:function(){var e=this.getScaling(),t=f.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(f.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(f.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(f.read(arguments))},getEventPoint:function(e){return this.viewToProject(W.getOffset(e,this._element))}},{statics:{_views:[],_viewsById:{},_id:0,create:function(e,t){return i&&"string"==typeof t&&(t=i.getElementById(t)),new(r?$:Y)(e,t)}}},new function(){if(r){var e,t,n,a,s,o=!1,c=!1,l=r.navigator;l.pointerEnabled||l.msPointerEnabled?(n="pointerdown MSPointerDown",a="pointermove MSPointerMove",s="pointerup pointercancel MSPointerUp MSPointerCancel"):(n="touchstart",a="touchmove",s="touchend touchcancel","ontouchstart"in r&&l.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(n+=" mousedown",a+=" mousemove",s+=" mouseup"));var u={},h={mouseout:function(e){var t=Y._focused,n=W.getRelatedTarget(e);if(t&&(!n||"HTML"===n.nodeName)){var r=W.getOffset(e,t._element),i=r.x,a=Math.abs,s=a(i),o=s-(1<<25);r.x=a(o)<s?o*(i<0?-1:1):i,M(t,e,t.viewToProject(r))}},scroll:E};u[n]=function(e){var t=Y._focused=S(e);o||(o=!0,t._handleMouseEvent("mousedown",e))},h[a]=function(n){var r=Y._focused;if(!c){var i=S(n);i?r!==i&&(r&&M(r,n),e||(e=r),r=Y._focused=t=i):t&&t===r&&(e&&!e.isInserted()&&(e=null),r=Y._focused=e,e=null,E())}r&&M(r,n)},h[n]=function(){c=!0},h[s]=function(e){var t=Y._focused;t&&o&&t._handleMouseEvent("mouseup",e),c=o=!1},W.add(i,h),W.add(r,{load:E});var d,f,p,m,g,v,y,b,_=!1,w=!1,x={doubleclick:"click",mousedrag:"mousemove"},k=!1,C={mousedown:{mousedown:1,mousedrag:1,click:1,doubleclick:1},mouseup:{mouseup:1,mousedrag:1,click:1,doubleclick:1},mousemove:{mousedrag:1,mousemove:1,mouseenter:1,mouseleave:1}};return{_viewEvents:u,_handleMouseEvent:function(e,t,n){var r=this._itemEvents,i=r.native[e],a="mousemove"===e,s=this._scope.tool,c=this;function l(e){return r.virtual[e]||c.responds(e)||s&&s.responds(e)}a&&o&&l("mousedrag")&&(e="mousedrag"),n||(n=this.getEventPoint(t));var u=this.getBounds().contains(n),h=i&&u&&c._project.hitTest(n,{tolerance:0,fill:!0,stroke:!0}),x=h&&h.item||null,C=!1,S={};if(S[e.substr(5)]=!0,i&&x!==m&&(m&&T(m,null,"mouseleave",t,n),x&&T(x,null,"mouseenter",t,n),m=x),k^u&&(T(this,null,u?"mouseenter":"mouseleave",t,n),C=!0),!u&&!S.drag||n.equals(f)||(N(this,x,a?e:"mousemove",t,n,f),C=!0),k=u,S.down&&u||S.up&&d){if(N(this,x,e,t,n,d),S.down){if(b=x===v&&Date.now()-y<300,p=v=x,!w&&x){for(var E=x;E&&!E.responds("mousedrag");)E=E._parent;E&&(g=x)}d=n}else S.up&&(w||x!==p||(y=Date.now(),N(this,x,b?"doubleclick":"click",t,n,d),b=!1),p=g=null);k=!1,C=!0}f=n,C&&s&&(_=s._handleMouseEvent(e,t,n,S)||_),!1!==t.cancelable&&(_&&!S.move||S.down&&l("mouseup"))&&t.preventDefault()},_handleKeyEvent:function(e,t,n,r){var i,a=this._scope,s=a.tool;function o(s){s.responds(e)&&(oe=a,s.emit(e,i=i||new Q(e,t,n,r)))}this.isVisible()&&(o(this),s&&s.responds(e)&&o(s))},_countItemEvent:function(e,t){var n=this._itemEvents,r=n.native,i=n.virtual;for(var a in C)r[a]=(r[a]||0)+(C[a][e]||0)*t;i[e]=(i[e]||0)+t},statics:{updateFocus:E,_resetState:function(){o=c=_=k=!1,e=t=d=f=p=m=g=v=y=b=null}}}}function S(e){var t=W.getTarget(e);return t.getAttribute&&Y._viewsById[t.getAttribute("id")]}function E(){var e=Y._focused;if(!e||!e.isVisible())for(var n=0,r=Y._views.length;n<r;n++)if((e=Y._views[n]).isVisible()){Y._focused=t=e;break}}function M(e,t,n){e._handleMouseEvent("mousemove",t,n)}function T(e,t,n,r,i,a,s){var o,c=!1;function l(e,n){if(e.responds(n)){if(o||(o=new Z(n,r,i,t||e,a?i.subtract(a):null)),e.emit(n,o)&&(_=!0,o.prevented&&(w=!0),o.stopped))return c=!0}else{var s=x[n];if(s)return l(e,s)}}for(;e&&e!==s&&!l(e,n);)e=e._parent;return c}function N(e,t,n,r,i,a){return e._project.removeOn(n),w=_=!1,g&&T(g,null,n,r,i,a)||t&&t!==g&&!t.isDescendant(g)&&T(t,null,"mousedrag"===n?"mousemove":n,r,i,a,g)||T(e,g||t||e,n,r,i,a)}}),$=Y.extend({_class:"CanvasView",initialize:function(e,t){if(!(t instanceof r.HTMLCanvasElement)){var n=m.read(arguments,1);if(n.isZero())throw new Error("Cannot create CanvasView with the provided argument: "+a.slice(arguments,1));t=re.getCanvas(n)}var i=this._context=t.getContext("2d");if(i.save(),this._pixelRatio=1,!/^off|false$/.test(o.getAttribute(t,"hidpi"))){var s=r.devicePixelRatio||1,c=G.getPrefixed(i,"backingStorePixelRatio")||1;this._pixelRatio=s/c}Y.call(this,e,t),this._needsUpdate=!0},remove:function e(){return this._context.restore(),e.base.call(this)},_setElementSize:function e(t,n){var r=this._pixelRatio;if(e.base.call(this,t*r,n*r),1!==r){var i=this._element,a=this._context;if(!o.hasAttribute(i,"resize")){var s=i.style;s.width=t+"px",s.height=n+"px"}a.restore(),a.save(),a.scale(r,r)}},getContext:function(){return this._context},getPixelSize:function e(t){var n,r=oe.agent;if(r&&r.firefox)n=e.base.call(this,t);else{var i=this._context,a=i.font;i.font=t+" serif",n=parseFloat(i.font),i.font=a}return n},getTextWidth:function(e,t){var n=this._context,r=n.font,i=0;n.font=e;for(var a=0,s=t.length;a<s;a++)i=Math.max(i,n.measureText(t[a]).width);return n.font=r,i},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}}),K=a.extend({_class:"Event",initialize:function(e){this.event=e,this.type=e&&e.type},prevented:!1,stopped:!1,preventDefault:function(){this.prevented=!0,this.event.preventDefault()},stopPropagation:function(){this.stopped=!0,this.event.stopPropagation()},stop:function(){this.stopPropagation(),this.preventDefault()},getTimeStamp:function(){return this.event.timeStamp},getModifiers:function(){return X.modifiers}}),Q=K.extend({_class:"KeyEvent",initialize:function(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()+" }"}}),X=new function(){var e,t,s={"\t":"tab"," ":"space","\b":"backspace","":"delete",Spacebar:"space",Del:"delete",Win:"meta",Esc:"escape"},o={tab:"\t",space:" ",enter:"\r"},c={},l={},u=new a({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var e=oe&&oe.agent;return e&&e.mac?this.meta:this.control}}});function h(e){var t=e.key||e.keyIdentifier;return t=/^U\+/.test(t)?String.fromCharCode(parseInt(t.substr(2),16)):/^Arrow[A-Z]/.test(t)?t.substr(5):"Unidentified"===t||t===n?String.fromCharCode(e.keyCode):t,s[t]||(t.length>1?a.hyphenate(t):t.toLowerCase())}function d(t,n,r,i){var s,o=Y._focused;if(c[n]=t,t?l[n]=r:delete l[n],n.length>1&&(s=a.camelize(n))in u){u[s]=t;var h=oe&&oe.agent;if("meta"===s&&h&&h.mac)if(t)e={};else{for(var f in e)f in l&&d(!1,f,e[f],i);e=null}}else t&&e&&(e[n]=r);o&&o._handleKeyEvent(t?"keydown":"keyup",i,n,r)}return W.add(i,{keydown:function(e){var n=h(e),r=oe&&oe.agent;n.length>1||r&&r.chrome&&(e.altKey||r.mac&&e.metaKey||!r.mac&&e.ctrlKey)?d(!0,n,o[n]||(n.length>1?"":n),e):t=n},keypress:function(e){if(t){var n=h(e),r=e.charCode,i=r>=32?String.fromCharCode(r):n.length>1?"":n;n!==t&&(n=i.toLowerCase()),d(!0,n,i,e),t=null}},keyup:function(e){var t=h(e);t in l&&d(!1,t,l[t],e)}}),W.add(r,{blur:function(e){for(var t in l)d(!1,t,l[t],e)}}),{modifiers:u,isDown:function(e){return!!c[e]}}},Z=K.extend({_class:"MouseEvent",initialize:function(e,t,n,r,i){this.type=e,this.event=t,this.point=n,this.target=r,this.delta=i},toString:function(){return"{ type: '"+this.type+"', point: "+this.point+", target: "+this.target+(this.delta?", delta: "+this.delta:"")+", modifiers: "+this.getModifiers()+" }"}}),J=K.extend({_class:"ToolEvent",_item:null,initialize:function(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()+" }"}}),ee=c.extend({_class:"Tool",_list:"tools",_reference:"tool",_events:["onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onActivate","onDeactivate","onEditOptions","onKeyDown","onKeyUp"],initialize:function(e){c.call(this),this._moveCount=-1,this._downCount=-1,this.set(e)},getMinDistance:function(){return this._minDistance},setMinDistance:function(e){this._minDistance=e,null!=e&&null!=this._maxDistance&&e>this._maxDistance&&(this._maxDistance=e)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(e){this._maxDistance=e,null!=this._minDistance&&null!=e&&e<this._minDistance&&(this._minDistance=e)},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(e){this._minDistance=this._maxDistance=e},_handleMouseEvent:function(e,t,n,r){oe=this._scope,r.drag&&!this.responds(e)&&(e="mousemove");var i=r.move||r.drag,a=this.responds(e),s=!1,o=this;function c(e,t){var a=n,s=i?o._point:o._downPoint||a;if(i){if(o._moveCount>=0&&a.equals(s))return!1;if(s&&(null!=e||null!=t)){var c=a.subtract(s),l=c.getLength();if(l<(e||0))return!1;t&&(a=s.add(c.normalize(Math.min(l,t))))}o._moveCount++}return o._point=a,o._lastPoint=s||a,r.down&&(o._moveCount=-1,o._downPoint=a,o._downCount++),!0}function l(){a&&(s=o.emit(e,new J(o,e,t))||s)}if(r.down)c(),l();else if(r.up)c(null,this._maxDistance),l();else if(a)for(;c(this._minDistance,this._maxDistance);)l();return s}}),te=a.extend(s,{_class:"Tween",statics:{easings:new a({linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:2*(2-e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}})},initialize:function e(t,n,r,i,a,s){this.object=t;var o=typeof a,c="function"===o;this.type=c?o:"string"===o?a:"linear",this.easing=c?a:e.easings[this.type],this.duration=i,this.running=!1,this._then=null,this._startTime=null;var l=n||r;this._keys=l?Object.keys(l):[],this._parsedKeys=this._parseKeys(this._keys),this._from=l&&this._getState(n),this._to=l&&this._getState(r),!1!==s&&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,r=function(n){return"function"==typeof n?n(t,e):n},i=0,s=n&&n.length;i<s;i++){var o=n[i],c=r(this._from[o]),l=r(this._to[o]),u=c&&l&&c.__add&&l.__add?l.__subtract(c).__multiply(t).__add(c):(l-c)*t+c;this._setProperty(this._parsedKeys[o],u)}this.responds("update")&&this.emit("update",new a({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,i=t.length;r<i;r++){var a,s=t[r],o=this._parsedKeys[s],c=this._getProperty(o);if(e){var l=this._resolveValue(c,e[s]);this._setProperty(o,l),a=(a=this._getProperty(o))&&a.clone?a.clone():a,this._setProperty(o,c)}else a=c&&c.clone?c.clone():c;n[s]=a}return n},_resolveValue:function(e,t){if(t){if(Array.isArray(t)&&2===t.length){var n=t[0];return n&&n.match&&n.match(/^[+\-\*\/]=/)?this._calculate(e,n[0],t[1]):t}if("string"==typeof t){var r=t.match(/^[+\-*/]=(.*)/);if(r){var i=JSON.parse(r[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": '));return this._calculate(e,t[0],i)}}}return t},_calculate:function(e,t,n){return oe.PaperScript.calculateBinary(e,t,n)},_parseKeys:function(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n],a=i.replace(/\.([^.]*)/g,"/$1").replace(/\[['"]?([^'"\]]*)['"]?\]/g,"/$1");t[i]=a.split("/")}return t},_getProperty:function(e,t){for(var n=this.object,r=0,i=e.length-(t||0);r<i&&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)}}),ne=function(e){var n=new t.XMLHttpRequest;return n.open((e.method||"get").toUpperCase(),e.url,a.pick(e.async,!0)),e.mimeType&&n.overrideMimeType(e.mimeType),n.onload=function(){var t=n.status;0===t||200===t?e.onLoad&&e.onLoad.call(n,n.responseText):n.onerror()},n.onerror=function(){var t=n.status,r='Could not load "'+e.url+'" (Status: '+t+")";if(!e.onError)throw new Error(r);e.onError(r,t)},n.send(null)},re=a.exports.CanvasProvider={canvases:[],getCanvas:function(e,t,n){if(!r)return null;var a,s=!0;"object"==typeof e&&(t=e.height,e=e.width),this.canvases.length?a=this.canvases.pop():(a=i.createElement("canvas"),s=!1);var o=a.getContext("2d",n||{});if(!o)throw new Error("Canvas "+a+" is unable to provide a 2D context.");return a.width===e&&a.height===t?s&&o.clearRect(0,0,e+1,t+1):(a.width=e,a.height=t),o.save(),a},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))}},ie=new function(){var e,t,n,r,i,s,o,c,l,u,h,d=Math.min,f=Math.max,p=Math.abs;function m(e,t,n){return.2989*e+.587*t+.114*n}function g(e,t,n,r){var i=r-m(e,t,n),a=(r=m(l=e+i,u=t+i,h=n+i),d(l,u,h)),s=f(l,u,h);if(a<0){var o=r-a;l=r+(l-r)*r/o,u=r+(u-r)*r/o,h=r+(h-r)*r/o}if(s>255){var c=255-r,p=s-r;l=r+(l-r)*c/p,u=r+(u-r)*c/p,h=r+(h-r)*c/p}}function v(e,t,n){return f(e,t,n)-d(e,t,n)}function y(e,t,n,r){var i,a=[e,t,n],s=f(e,t,n),o=d(e,t,n);i=0===d(o=o===e?0:o===t?1:2,s=s===e?0:s===t?1:2)?1===f(o,s)?2:1:0,a[s]>a[o]?(a[i]=(a[i]-a[o])*r/(a[s]-a[o]),a[s]=r):a[i]=a[s]=0,a[o]=0,l=a[0],u=a[1],h=a[2]}var b={multiply:function(){l=i*e/255,u=s*t/255,h=o*n/255},screen:function(){l=i+e-i*e/255,u=s+t-s*t/255,h=o+n-o*n/255},overlay:function(){l=i<128?2*i*e/255:255-2*(255-i)*(255-e)/255,u=s<128?2*s*t/255:255-2*(255-s)*(255-t)/255,h=o<128?2*o*n/255:255-2*(255-o)*(255-n)/255},"soft-light":function(){var r=e*i/255;l=r+i*(255-(255-i)*(255-e)/255-r)/255,u=(r=t*s/255)+s*(255-(255-s)*(255-t)/255-r)/255,h=(r=n*o/255)+o*(255-(255-o)*(255-n)/255-r)/255},"hard-light":function(){l=e<128?2*e*i/255:255-2*(255-e)*(255-i)/255,u=t<128?2*t*s/255:255-2*(255-t)*(255-s)/255,h=n<128?2*n*o/255:255-2*(255-n)*(255-o)/255},"color-dodge":function(){l=0===i?0:255===e?255:d(255,255*i/(255-e)),u=0===s?0:255===t?255:d(255,255*s/(255-t)),h=0===o?0:255===n?255:d(255,255*o/(255-n))},"color-burn":function(){l=255===i?255:0===e?0:f(0,255-255*(255-i)/e),u=255===s?255:0===t?0:f(0,255-255*(255-s)/t),h=255===o?255:0===n?0:f(0,255-255*(255-o)/n)},darken:function(){l=i<e?i:e,u=s<t?s:t,h=o<n?o:n},lighten:function(){l=i>e?i:e,u=s>t?s:t,h=o>n?o:n},difference:function(){(l=i-e)<0&&(l=-l),(u=s-t)<0&&(u=-u),(h=o-n)<0&&(h=-h)},exclusion:function(){l=i+e*(255-i-i)/255,u=s+t*(255-s-s)/255,h=o+n*(255-o-o)/255},hue:function(){y(e,t,n,v(i,s,o)),g(l,u,h,m(i,s,o))},saturation:function(){y(i,s,o,v(e,t,n)),g(l,u,h,m(i,s,o))},luminosity:function(){g(i,s,o,m(e,t,n))},color:function(){g(e,t,n,m(i,s,o))},add:function(){l=d(i+e,255),u=d(s+t,255),h=d(o+n,255)},subtract:function(){l=f(i-e,0),u=f(s-t,0),h=f(o-n,0)},average:function(){l=(i+e)/2,u=(s+t)/2,h=(o+n)/2},negation:function(){l=255-p(255-e-i),u=255-p(255-t-s),h=255-p(255-n-o)}},_=this.nativeModes=a.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","darker","copy","xor"],(function(e){this[e]=!0}),{}),w=re.getContext(1,1,{willReadFrequently:!0});w&&(a.each(b,(function(e,t){var n="darken"===t,r=!1;w.save();try{w.fillStyle=n?"#300":"#a00",w.fillRect(0,0,1,1),w.globalCompositeOperation=t,w.globalCompositeOperation===t&&(w.fillStyle=n?"#a00":"#300",w.fillRect(0,0,1,1),r=w.getImageData(0,0,1,1).data[0]!==n?170:51)}catch(i){}w.restore(),_[t]=r})),re.release(w)),this.process=function(a,d,f,p,m){var g=d.canvas,v="normal"===a;if(v||_[a])f.save(),f.setTransform(1,0,0,1,0,0),f.globalAlpha=p,v||(f.globalCompositeOperation=a),f.drawImage(g,m.x,m.y),f.restore();else{var y=b[a];if(!y)return;for(var w=f.getImageData(m.x,m.y,g.width,g.height),x=w.data,k=d.getImageData(0,0,g.width,g.height).data,C=0,S=x.length;C<S;C+=4){e=k[C],i=x[C],t=k[C+1],s=x[C+1],n=k[C+2],o=x[C+2],r=k[C+3],c=x[C+3],y();var E=r*p/255,M=1-E;x[C]=E*l+M*i,x[C+1]=E*u+M*s,x[C+2]=E*h+M*o,x[C+3]=r*p+M*c}f.putImageData(w,m.x,m.y)}}},ae=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 a(e,t,n){for(var i in t){var a=t[i],s=r[i];"number"==typeof a&&n&&(a=n.number(a)),s?e.setAttributeNS(s,i,a):e.setAttribute(i,a)}return e}return{svg:e,xmlns:t,xlink:n,create:function(t,n,r){return a(i.createElementNS(e,t),n,r)},get:function(e,t){var n=r[t],i=n?e.getAttributeNS(n,t):e.getAttribute(t);return"null"===i?null:i},set:a}},se=a.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 B||e instanceof S||e instanceof F)}],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=a.capitalize(t),r=e[2];this[t]={type:e[1],property:t,attribute:e[0],toSVG:r,fromSVG:r&&a.each(r,(function(e,t){this[e]=t}),{}),exportFilter:e[3],get:"get"+n,set:"set"+n}}),{});new function(){var e;function n(t,n,r){var i,s=new a,o=t.getTranslation();if(n&&(t.isInvertible()?(i=(t=t._shiftless())._inverseTransform(o),o=null):i=new f,s[r?"cx":"x"]=i.x,s[r?"cy":"y"]=i.y),!t.isIdentity()){var c=t.decompose();if(c){var l=[],u=c.rotation,d=c.scaling,p=c.skewing;o&&!o.isZero()&&l.push("translate("+e.point(o)+")"),u&&l.push("rotate("+e.number(u)+")"),h.isZero(d.x-1)&&h.isZero(d.y-1)||l.push("scale("+e.point(d)+")"),p.x&&l.push("skewX("+e.number(p.x)+")"),p.y&&l.push("skewY("+e.number(p.y)+")"),s.transform=l.join(" ")}else s.transform="matrix("+t.getValues().join(",")+")"}return s}function r(t,r){for(var i=n(t._matrix),a=t._children,s=ae.create("g",i,e),o=0,c=a.length;o<c;o++){var l=a[o],u=g(l,r);if(u)if(l.isClipMask()){var h=ae.create("clipPath");h.appendChild(u),p(l,h,"clip"),ae.set(s,{"clip-path":"url(#"+h.id+")"})}else s.appendChild(u)}return s}function i(t){var r=t._type,i=t._radius,a=n(t._matrix,!0,"rectangle"!==r);if("rectangle"===r){r="rect";var s=t._size,o=s.width,c=s.height;a.x-=o/2,a.y-=c/2,a.width=o,a.height=c,i.isZero()&&(i=null)}return i&&("circle"===r?a.r=i:(a.rx=i.width,a.ry=i.height)),ae.create(r,a,e)}var s,o={Group:r,Layer:r,Raster:function(t,r){var i=n(t._matrix,!0),a=t.getSize(),s=t.getImage();return i.x-=a.width/2,i.y-=a.height/2,i.width=a.width,i.height=a.height,i.href=0==r.embedImages&&s&&s.src||t.toDataURL(),ae.create("image",i,e)},Path:function(t,r){var a=r.matchShapes;if(a){var s=t.toShape(!1);if(s)return i(s)}var o,c=t._segments,l=c.length,u=n(t._matrix);if(a&&l>=2&&!t.hasHandles())if(l>2){o=t._closed?"polygon":"polyline";for(var h=[],d=0;d<l;d++)h.push(e.point(c[d]._point));u.points=h.join(" ")}else{o="line";var f=c[0]._point,p=c[1]._point;u.set({x1:f.x,y1:f.y,x2:p.x,y2:p.y})}else o="path",u.d=t.getPathData(null,r.precision);return ae.create(o,u,e)},Shape:i,CompoundPath:function(t,r){var i=n(t._matrix),a=t.getPathData(null,r.precision);return a&&(i.d=a),ae.create("path",i,e)},SymbolItem:function(t,r){var i=n(t._matrix,!0),a=t._definition,s=l(a,"symbol"),o=a._item,c=o.getStrokeBounds();return s||((s=ae.create("symbol",{viewBox:e.rectangle(c)})).appendChild(g(o,r)),p(a,s,"symbol")),i.href="#"+s.id,i.x+=c.x,i.y+=c.y,i.width=c.width,i.height=c.height,i.overflow="visible",ae.create("use",i,e)},PointText:function(t){var r=ae.create("text",n(t._matrix,!0),e);return r.textContent=t._content,r}};function c(t,n,r,i){var s={},o=!i&&t.getParent(),c=[];return null!=t._name&&(s.id=t._name),a.each(se,(function(n){var i=n.get,u=n.type,h=t[i]();if(n.exportFilter?n.exportFilter(t,h):0==r.reduceAttributes||!o||!a.equals(o[i](),h)){if("color"===u&&null!=h){var d=h.getAlpha();d<1&&(s[n.attribute+"-opacity"]=d)}"style"===u?c.push(n.attribute+": "+h):s[n.attribute]=null==h?"none":"color"===u?h.gradient?function(t){var n=l(t,"color");if(!n){var r,i=t.getGradient(),a=i._radial,s=t.getOrigin(),o=t.getDestination();if(a){r={cx:s.x,cy:s.y,r:s.getDistance(o)};var c=t.getHighlight();c&&(r.fx=c.x,r.fy=c.y)}else r={x1:s.x,y1:s.y,x2:o.x,y2:o.y};r.gradientUnits="userSpaceOnUse",n=ae.create((a?"radial":"linear")+"Gradient",r,e);for(var u=i._stops,h=0,d=u.length;h<d;h++){var f=u[h],m=f._color,g=m.getAlpha(),v=f._offset;r={offset:null==v?h/(d-1):v},m&&(r["stop-color"]=m.toCSS(!0)),g<1&&(r["stop-opacity"]=g),n.appendChild(ae.create("stop",r,e))}p(t,n,"color")}return"url(#"+n.id+")"}(h):h.toCSS(!0):"array"===u?h.join(","):"lookup"===u?n.toSVG[h]:h}})),c.length&&(s.style=c.join(";")),1===s.opacity&&delete s.opacity,t._visible||(s.visibility="hidden"),ae.set(n,s,e)}function l(e,t){return s||(s={ids:{},svgs:{}}),e&&s.svgs[t+"-"+(e._id||e.__id||(e.__id=d.get("svg")))]}function p(e,t,n){s||l();var r=s.ids[n]=(s.ids[n]||0)+1;t.id=n+"-"+r,s.svgs[n+"-"+(e._id||e.__id)]=t}function m(e,n){var r=e,i=null;if(s){for(var a in r="svg"===e.nodeName.toLowerCase()&&e,s.svgs)i||(r||(r=ae.create("svg")).appendChild(e),i=r.insertBefore(ae.create("defs"),r.firstChild)),i.appendChild(s.svgs[a]);s=null}return n.asString?(new t.XMLSerializer).serializeToString(r):r}function g(e,t,n){var r=o[e._class],i=r&&r(e,t);if(i){var a=t.onExport;a&&(i=a(e,i,t)||i);var s=JSON.stringify(e._data);s&&"{}"!==s&&"null"!==s&&i.setAttribute("data-paper-data",s)}return i&&c(e,i,t,n)}function y(t){return t||(t={}),e=new u(t.precision),t}x.inject({exportSVG:function(e){return m(g(this,e=y(e),!0),e)}}),w.inject({exportSVG:function(t){t=y(t);var r=this._children,i=this.getView(),s=a.pick(t.bounds,"view"),o=t.matrix||"view"===s&&i._matrix,c=o&&b.read([o]),l="view"===s?new v([0,0],i.getViewSize()):"content"===s?x._getBounds(r,c,{stroke:!0}).rect:v.read([s],0,{readNull:!0}),u={version:"1.1",xmlns:ae.svg,"xmlns:xlink":ae.xlink};l&&(u.width=l.width,u.height=l.height,(l.x||0===l.x||l.y||0===l.y)&&(u.viewBox=e.rectangle(l)));var h=ae.create("svg",u,e),d=h;c&&!c.isIdentity()&&(d=h.appendChild(ae.create("g",n(c),e)));for(var f=0,p=r.length;f<p;f++)d.appendChild(g(r[f],t,!0));return m(h,t)}})},new function(){var e,s={};function o(t,n,r,i,a,s){var o=ae.get(t,n)||s,c=null==o?i?null:r?"":0:r?o:parseFloat(o);return/%\s*$/.test(o)?c/100*(a?1:e[/x|^width/.test(n)?"width":"height"]):c}function c(e,t,n,r,i,a,s){return t=o(e,t||"x",!1,r,i,a),n=o(e,n||"y",!1,r,i,s),!r||null!=t&&null!=n?new f(t,n):null}function l(e,t,n,r,i){return t=o(e,t||"width",!1,r,i),n=o(e,n||"height",!1,r,i),!r||null!=t&&null!=n?new m(t,n):null}function u(e,t,n){return"none"===e?null:"number"===t?parseFloat(e):"array"===t?e?e.split(/[\s,]+/g).map(parseFloat):[]:"color"===t?A(e)||e:"lookup"===t?n[e]:e}function h(e,t,n,r){var i=e.childNodes,a="clippath"===t,s="defs"===t,o=new k,c=o._project,l=c._currentStyle,u=[];if(a||s||(o=N(o,e,r),c._currentStyle=o._style.clone()),r)for(var h=e.querySelectorAll("defs"),d=0,f=h.length;d<f;d++)P(h[d],n,!1);for(d=0,f=i.length;d<f;d++){var p,m=i[d];1!==m.nodeType||/^defs$/i.test(m.nodeName)||!(p=P(m,n,!1))||p instanceof T||u.push(p)}return o.addChildren(u),a&&(o=N(o.reduce(),e,r)),c._currentStyle=l,(a||s)&&(o.remove(),o=null),o}function d(e,t){for(var n=e.getAttribute("points").match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),r=[],i=0,a=n.length;i<a;i+=2)r.push(new f(parseFloat(n[i]),parseFloat(n[i+1])));var s=new O(r);return"polygon"===t&&s.closePath(),s}function p(e,t){var n,r=(o(e,"href",!0)||"").substring(1),i="radialgradient"===t;if(r)(n=s[r].getGradient())._radial^i&&((n=n.clone())._radial=i);else{for(var a=e.childNodes,l=[],u=0,h=a.length;u<h;u++){var d=a[u];1===d.nodeType&&l.push(N(new H,d))}n=new q(l,i)}var f,p,m,g="userSpaceOnUse"!==o(e,"gradientUnits",!0);return i?(p=(f=c(e,"cx","cy",!1,g,"50%","50%")).add(o(e,"r",!1,!1,g,"50%"),0),m=c(e,"fx","fy",!0,g)):(f=c(e,"x1","y1",!1,g,"0%","0%"),p=c(e,"x2","y2",!1,g,"100%","0%")),N(new j(n,f,p,m),e)._scaleToBounds=g,null}var g={"#document":function(e,t,n,r){for(var i=e.childNodes,a=0,s=i.length;a<s;a++){var o=i[a];if(1===o.nodeType)return P(o,n,r)}},g:h,svg:h,clippath:h,polygon:d,polyline:d,path:function(e){return B.create(e.getAttribute("d"))},lineargradient:p,radialgradient:p,image:function(e){var t=new E(o(e,"href",!0));return t.on("load",(function(){var t=l(e);this.setSize(t);var n=c(e).add(t.divide(2));this._matrix.append((new b).translate(n))})),t},symbol:function(e,t,n,r){return new T(h(e,t,n,r),!0)},defs:h,use:function(e){var t=(o(e,"href",!0)||"").substring(1),n=s[t],r=c(e);return n?n instanceof T?n.place(r):n.clone().translate(r):null},circle:function(e){return new S.Circle(c(e,"cx","cy"),o(e,"r"))},ellipse:function(e){return new S.Ellipse({center:c(e,"cx","cy"),radius:l(e,"rx","ry")})},rect:function(e){return new S.Rectangle(new v(c(e),l(e)),l(e,"rx","ry"))},line:function(e){return new O.Line(c(e,"x1","y1"),c(e,"x2","y2"))},text:function(e){var t=new z(c(e).add(c(e,"dx","dy")));return t.setContent(e.textContent.trim()||""),t},switch:h};function y(e,t,n,r){if(e.transform){for(var i=(r.getAttribute(n)||"").split(/\)\s*/g),a=new b,s=0,o=i.length;s<o;s++){var c=i[s];if(!c)break;for(var l=c.split(/\(\s*/),u=l[0].trim(),h=l[1].split(/[\s,]+/g),d=0,f=h.length;d<f;d++)h[d]=parseFloat(h[d]);switch(u){case"matrix":a.append(new b(h[0],h[1],h[2],h[3],h[4],h[5]));break;case"rotate":a.rotate(h[0],h[1]||0,h[2]||0);break;case"translate":a.translate(h[0],h[1]||0);break;case"scale":a.scale(h);break;case"skewX":a.skew(h[0],0);break;case"skewY":a.skew(0,h[0])}}e.transform(a)}}function _(e,t,n){var r="fill-opacity"===n?"getFillColor":"getStrokeColor",i=e[r]&&e[r]();i&&i.setAlpha(parseFloat(t))}var C=a.set(a.each(se,(function(e){this[e.attribute]=function(t,n){if(t[e.set]&&(t[e.set](u(n,e.type,e.fromSVG)),"color"===e.type)){var r=t[e.get]();if(r&&r._scaleToBounds){var i=t.getBounds();r.transform((new b).translate(i.getPoint()).scale(i.getSize()))}}}}),{}),{id:function(e,t){s[t]=e,e.setName&&e.setName(t)},"clip-path":function(e,t){var n=A(t);if(n){if((n=n.clone()).setClipMask(!0),!(e instanceof k))return new k(n,e);e.insertChild(0,n)}},gradientTransform:y,transform:y,"fill-opacity":_,"stroke-opacity":_,visibility:function(e,t){e.setVisible&&e.setVisible("visible"===t)},display:function(e,t){e.setVisible&&e.setVisible(null!==t)},"stop-color":function(e,t){e.setColor&&e.setColor(t)},"stop-opacity":function(e,t){e._color&&e._color.setAlpha(parseFloat(t))},offset:function(e,t){if(e.setOffset){var n=t.match(/(.*)%$/);e.setOffset(n?n[1]/100:parseFloat(t))}},viewBox:function(e,t,n,r,i){var a,s=new v(u(t,"array")),o=l(r,null,null,!0);if(e instanceof k){var c=o?o.divide(s.getSize()):1,h=(new b).scale(c).translate(s.getPoint().negate());a=e}else e instanceof T&&(o&&s.setSize(o),a=e._item);if(a){if("visible"!==M(r,"overflow",i)){var d=new S.Rectangle(s);d.setClipMask(!0),a.addChild(d)}h&&a.transform(h)}}});function M(e,t,r){var i=e.attributes[t],s=i&&i.value;if(!s&&e.style){var o=a.camelize(t);(s=e.style[o])||r.node[o]===r.parent[o]||(s=r.node[o])}return s?"none"===s?null:s:n}function N(e,t,r){var i=t.parentNode,s={node:G.getStyles(t)||{},parent:!r&&!/^defs$/i.test(i.tagName)&&G.getStyles(i)||{}};return a.each(C,(function(r,i){var a=M(t,i,s);e=a!==n&&r(e,a,i,t,s)||e})),e}function A(e){var t=e&&e.match(/\((?:["'#]*)([^"')]+)/),n=t&&t[1],i=n&&s[r?n.replace(r.location.href.split("#")[0]+"#",""):n];return i&&i._scaleToBounds&&((i=i.clone())._scaleToBounds=!0),i}function P(t,n,r){var o,c,u,h=t.nodeName.toLowerCase(),d="#document"!==h,f=i.body;r&&d&&(e=oe.getView().getSize(),e=l(t,null,null,!0)||e,o=ae.create("svg",{style:"stroke-width: 1px; stroke-miterlimit: 10"}),c=t.parentNode,u=t.nextSibling,o.appendChild(t),f.appendChild(o));var p=oe.settings,m=p.applyMatrix,v=p.insertItems;p.applyMatrix=!1,p.insertItems=!1;var y=g[h],b=y&&y(t,h,n,r)||null;if(p.insertItems=v,p.applyMatrix=m,b){!d||b instanceof k||(b=N(b,t,r));var _=n.onImport,w=d&&t.getAttribute("data-paper-data");_&&(b=_(t,b,n)||b),n.expandShapes&&b instanceof S&&(b.remove(),b=b.toPath()),w&&(b._data=JSON.parse(w))}return o&&(f.removeChild(o),c&&(u?c.insertBefore(t,u):c.appendChild(t))),r&&(s={},b&&a.pick(n.applyMatrix,m)&&b.matrix.apply(!0,!0)),b}function I(e,r,a){if(!e)return null;r="function"==typeof r?{onLoad:r}:r||{};var s=oe,o=null;function c(i){try{var c="object"==typeof i?i:(new t.DOMParser).parseFromString(i.trim(),"image/svg+xml");if(!c.nodeName)throw c=null,new Error("Unsupported SVG source: "+e);oe=s,o=P(c,r,!0),r&&!1===r.insert||a._insertItem(n,o);var u=r.onLoad;u&&u(o,i)}catch(h){l(h)}}function l(e,t){var n=r.onError;if(!n)throw new Error(e);n(e,t)}if("string"!=typeof e||/^[\s\S]*</.test(e)){if("undefined"!=typeof File&&e instanceof File){var u=new FileReader;return u.onload=function(){c(u.result)},u.onerror=function(){l(u.error)},u.readAsText(e)}c(e)}else{var h=i.getElementById(e);h?c(h):ne({url:e,async:!0,onLoad:c,onError:l})}return o}x.inject({importSVG:function(e,t){return I(e,t,this)}}),w.inject({importSVG:function(e,t){return this.activate(),I(e,t,this)}})},a.exports.PaperScript=function(){var e,n=this,s=n.acorn;if(!s&&void 0!==Yr)try{s=Zr()}catch(_){}function c(e,t){return(n.acorn||s).parse(e,t)}s||(s=e={},function(e){var t,n,r,i;e.version="0.5.0",e.parse=function(e,i){return n=String(e),r=n.length,s(i),Ye(),function(e){v=y=o,t.locations&&(b=new We),w=k=null,x=[],Je();var n=e||ht(),r=!0;for(e||(n.body=[]);d!==P;){var i=kt();n.body.push(i),r&&pt(i)&&ct(!0),r=!1}return ft(n,"Program")}(t.program)};var a=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 s(e){for(var n in t=e||{},a)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=a[n]);i=t.sourceFile||null}var o,c,l,u,h,d,f,p,m,g,v,y,b,w,x,k,C=e.getLineInfo=function(e,t){for(var n=1,r=0;;){He.lastIndex=r;var i=He.exec(e);if(!(i&&i.index<t))break;++n,r=i.index+i[0].length}return{line:n,column:t-r}};function S(e,t){var r=C(n,e);t+=" ("+r.line+":"+r.column+")";var i=new SyntaxError(t);throw i.pos=e,i.loc=r,i.raisedAt=o,i}e.tokenize=function(e,i){n=String(e),r=n.length,s(i),Ye();var a={};function v(e){return y=l,Je(e),a.start=c,a.end=l,a.startLoc=u,a.endLoc=h,a.type=d,a.value=f,a}return v.jumpTo=function(e,r){var i;if(o=e,t.locations)for(m=1,g=He.lastIndex=0;(i=He.exec(n))&&i.index<e;)++m,g=i.index+i[0].length;p=r,Xe()},v};var E=[],M={type:"num"},T={type:"regexp"},N={type:"string"},A={type:"name"},P={type:"eof"},I={keyword:"break"},D={keyword:"case",beforeExpr:!0},B={keyword:"catch"},O={keyword:"continue"},L={keyword:"debugger"},V={keyword:"default"},R={keyword:"do",isLoop:!0},F={keyword:"else",beforeExpr:!0},z={keyword:"finally"},j={keyword:"for",isLoop:!0},q={keyword:"function"},H={keyword:"if"},U={keyword:"return",beforeExpr:!0},G={keyword:"switch"},W={keyword:"throw",beforeExpr:!0},Y={keyword:"try"},$={keyword:"var"},K={keyword:"while",isLoop:!0},Q={keyword:"with"},X={keyword:"new",beforeExpr:!0},Z={keyword:"this"},J={keyword:"null",atomValue:null},ee={keyword:"true",atomValue:!0},te={keyword:"false",atomValue:!1},ne={keyword:"in",binop:7,beforeExpr:!0},re={break:I,case:D,catch:B,continue:O,debugger:L,default:V,do:R,else:F,finally:z,for:j,function:q,if:H,return:U,switch:G,throw:W,try:Y,var:$,while:K,with:Q,null:J,true:ee,false:te,new:X,in:ne,instanceof:{keyword:"instanceof",binop:7,beforeExpr:!0},this:Z,typeof:{keyword:"typeof",prefix:!0,beforeExpr:!0},void:{keyword:"void",prefix:!0,beforeExpr:!0},delete:{keyword:"delete",prefix:!0,beforeExpr:!0}},ie={type:"[",beforeExpr:!0},ae={type:"]"},se={type:"{",beforeExpr:!0},oe={type:"}"},ce={type:"(",beforeExpr:!0},le={type:")"},ue={type:",",beforeExpr:!0},he={type:";",beforeExpr:!0},de={type:":",beforeExpr:!0},fe={type:"."},pe={type:"?",beforeExpr:!0},me={binop:10,beforeExpr:!0},ge={isAssign:!0,beforeExpr:!0},ve={isAssign:!0,beforeExpr:!0},ye={postfix:!0,prefix:!0,isUpdate:!0},be={prefix:!0,beforeExpr:!0},_e={binop:1,beforeExpr:!0},we={binop:2,beforeExpr:!0},xe={binop:3,beforeExpr:!0},ke={binop:4,beforeExpr:!0},Ce={binop:5,beforeExpr:!0},Se={binop:6,beforeExpr:!0},Ee={binop:7,beforeExpr:!0},Me={binop:8,beforeExpr:!0},Te={binop:9,prefix:!0,beforeExpr:!0},Ne={binop:10,beforeExpr:!0};for(var Ae in e.tokTypes={bracketL:ie,bracketR:ae,braceL:se,braceR:oe,parenL:ce,parenR:le,comma:ue,semi:he,colon:de,dot:fe,question:pe,slash:me,eq:ge,name:A,eof:P,num:M,regexp:T,string:N},re)e.tokTypes["_"+Ae]=re[Ae];function Pe(e){e=e.split(" ");var t="",n=[];e:for(var r=0;r<e.length;++r){for(var i=0;i<n.length;++i)if(n[i][0].length==e[r].length){n[i].push(e[r]);continue e}n.push([e[r]])}function a(e){if(1==e.length)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){for(n.sort((function(e,t){return t.length-e.length})),t+="switch(str.length){",r=0;r<n.length;++r){var s=n[r];t+="case "+s[0].length+":",a(s)}t+="}"}else a(e);return new Function("str",t)}var Ie,De=Pe("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"),Be=Pe("class enum extends super const export import"),Oe=Pe("implements interface let package private protected public static yield"),Le=Pe("eval arguments"),Ve=Pe("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"),Re=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Fe="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",ze=new RegExp("["+Fe+"]"),je=new RegExp("["+Fe+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_]"),qe=/[\n\r\u2028\u2029]/,He=/\r\n|[\n\r\u2028\u2029]/g,Ue=e.isIdentifierStart=function(e){return e<65?36===e:e<91||(e<97?95===e:e<123||e>=170&&ze.test(String.fromCharCode(e)))},Ge=e.isIdentifierChar=function(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||e>=170&&je.test(String.fromCharCode(e))))};function We(){this.line=m,this.column=o-g}function Ye(){m=1,o=g=0,p=!0,Xe()}function $e(e,n){l=o,t.locations&&(h=new We),d=e,Xe(),f=n,p=e.beforeExpr}function Ke(){var e,r=t.onComment&&t.locations&&new We,i=o,a=n.indexOf("*/",o+=2);if(-1===a&&S(o-2,"Unterminated comment"),o=a+2,t.locations)for(He.lastIndex=i;(e=He.exec(n))&&e.index<o;)++m,g=e.index+e[0].length;t.onComment&&t.onComment(!0,n.slice(i+2,a),i,o,r,t.locations&&new We)}function Qe(){for(var e=o,i=t.onComment&&t.locations&&new We,a=n.charCodeAt(o+=2);o<r&&10!==a&&13!==a&&8232!==a&&8233!==a;)++o,a=n.charCodeAt(o);t.onComment&&t.onComment(!1,n.slice(e+2,o),e,o,i,t.locations&&new We)}function Xe(){for(;o<r;){var e=n.charCodeAt(o);if(32===e)++o;else if(13===e)++o,10===(i=n.charCodeAt(o))&&++o,t.locations&&(++m,g=o);else if(10===e||8232===e||8233===e)++o,t.locations&&(++m,g=o);else if(e>8&&e<14)++o;else if(47===e){var i;if(42===(i=n.charCodeAt(o+1)))Ke();else{if(47!==i)break;Qe()}}else if(160===e)++o;else{if(!(e>=5760&&Re.test(String.fromCharCode(e))))break;++o}}}function Ze(e){switch(e){case 46:return function(){var e=n.charCodeAt(o+1);return e>=48&&e<=57?rt(!0):(++o,$e(fe))}();case 40:return++o,$e(ce);case 41:return++o,$e(le);case 59:return++o,$e(he);case 44:return++o,$e(ue);case 91:return++o,$e(ie);case 93:return++o,$e(ae);case 123:return++o,$e(se);case 125:return++o,$e(oe);case 58:return++o,$e(de);case 63:return++o,$e(pe);case 48:var i=n.charCodeAt(o+1);if(120===i||88===i)return function(){o+=2;var e=nt(16);return null==e&&S(c+2,"Expected hexadecimal number"),Ue(n.charCodeAt(o))&&S(o,"Identifier directly after number"),$e(M,e)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return rt(!1);case 34:case 39:return function(e){o++;for(var i="";;){o>=r&&S(c,"Unterminated string constant");var a=n.charCodeAt(o);if(a===e)return++o,$e(N,i);if(92===a){a=n.charCodeAt(++o);var s=/^[0-7]+/.exec(n.slice(o,o+3));for(s&&(s=s[0]);s&&parseInt(s,8)>255;)s=s.slice(0,-1);if("0"===s&&(s=null),++o,s)k&&S(o-2,"Octal literal in strict mode"),i+=String.fromCharCode(parseInt(s,8)),o+=s.length-1;else switch(a){case 110:i+="\n";break;case 114:i+="\r";break;case 120:i+=String.fromCharCode(it(2));break;case 117:i+=String.fromCharCode(it(4));break;case 85:i+=String.fromCharCode(it(8));break;case 116:i+="\t";break;case 98:i+="\b";break;case 118:i+="\v";break;case 102:i+="\f";break;case 48:i+="\0";break;case 13:10===n.charCodeAt(o)&&++o;case 10:t.locations&&(g=o,++m);break;default:i+=String.fromCharCode(a)}}else 13!==a&&10!==a&&8232!==a&&8233!==a||S(c,"Unterminated string constant"),i+=String.fromCharCode(a),++o}}(e);case 47:return function(){var e=n.charCodeAt(o+1);return p?(++o,tt()):61===e?et(ve,2):et(me,1)}();case 37:case 42:return 61===n.charCodeAt(o+1)?et(ve,2):et(Ne,1);case 124:case 38:return function(e){var t=n.charCodeAt(o+1);return t===e?et(124===e?_e:we,2):61===t?et(ve,2):et(124===e?xe:Ce,1)}(e);case 94:return 61===n.charCodeAt(o+1)?et(ve,2):et(ke,1);case 43:case 45:return function(e){var t=n.charCodeAt(o+1);return t===e?45==t&&62==n.charCodeAt(o+2)&&qe.test(n.slice(y,o))?(o+=3,Qe(),Xe(),Je()):et(ye,2):61===t?et(ve,2):et(Te,1)}(e);case 60:case 62:return function(e){var t=n.charCodeAt(o+1),r=1;return t===e?(r=62===e&&62===n.charCodeAt(o+2)?3:2,61===n.charCodeAt(o+r)?et(ve,r+1):et(Me,r)):33==t&&60==e&&45==n.charCodeAt(o+2)&&45==n.charCodeAt(o+3)?(o+=4,Qe(),Xe(),Je()):(61===t&&(r=61===n.charCodeAt(o+2)?3:2),et(Ee,r))}(e);case 61:case 33:return function(e){return 61===n.charCodeAt(o+1)?et(Se,61===n.charCodeAt(o+2)?3:2):et(61===e?ge:be,1)}(e);case 126:return et(be,1)}return!1}function Je(e){if(e?o=c+1:c=o,t.locations&&(u=new We),e)return tt();if(o>=r)return $e(P);var i=n.charCodeAt(o);if(Ue(i)||92===i)return st();var a=Ze(i);if(!1===a){var s=String.fromCharCode(i);if("\\"===s||ze.test(s))return st();S(o,"Unexpected character '"+s+"'")}return a}function et(e,t){var r=n.slice(o,o+t);o+=t,$e(e,r)}function tt(){for(var e,t,i=o;;){o>=r&&S(i,"Unterminated regular expression");var a=n.charAt(o);if(qe.test(a)&&S(i,"Unterminated regular expression"),e)e=!1;else{if("["===a)t=!0;else if("]"===a&&t)t=!1;else if("/"===a&&!t)break;e="\\"===a}++o}var s=n.slice(i,o);++o;var c=at();c&&!/^[gmsiy]*$/.test(c)&&S(i,"Invalid regexp flag");try{var l=new RegExp(s,c)}catch(_){_ instanceof SyntaxError&&S(i,_.message),S(_)}return $e(T,l)}function nt(e,t){for(var r=o,i=0,a=0,s=null==t?1/0:t;a<s;++a){var c,l=n.charCodeAt(o);if((c=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=e)break;++o,i=i*e+c}return o===r||null!=t&&o-r!==t?null:i}function rt(e){var t=o,r=!1,i=48===n.charCodeAt(o);e||null!==nt(10)||S(t,"Invalid number"),46===n.charCodeAt(o)&&(++o,nt(10),r=!0);var a=n.charCodeAt(o);69!==a&&101!==a||(43!==(a=n.charCodeAt(++o))&&45!==a||++o,null===nt(10)&&S(t,"Invalid number"),r=!0),Ue(n.charCodeAt(o))&&S(o,"Identifier directly after number");var s,c=n.slice(t,o);return r?s=parseFloat(c):i&&1!==c.length?/[89]/.test(c)||k?S(t,"Invalid number"):s=parseInt(c,8):s=parseInt(c,10),$e(M,s)}function it(e){var t=nt(16,e);return null===t&&S(c,"Bad character escape sequence"),t}function at(){Ie=!1;for(var e,t=!0,r=o;;){var i=n.charCodeAt(o);if(Ge(i))Ie&&(e+=n.charAt(o)),++o;else{if(92!==i)break;Ie||(e=n.slice(r,o)),Ie=!0,117!=n.charCodeAt(++o)&&S(o,"Expecting Unicode escape sequence \\uXXXX"),++o;var a=it(4),s=String.fromCharCode(a);s||S(o-1,"Invalid Unicode escape"),(t?Ue(a):Ge(a))||S(o-4,"Invalid Unicode escape"),e+=s}t=!1}return Ie?e:n.slice(r,o)}function st(){var e=at(),t=A;return!Ie&&Ve(e)&&(t=re[e]),$e(t,e)}function ot(){v=c,y=l,b=h,Je()}function ct(e){if(k=e,o=c,t.locations)for(;o<g;)g=n.lastIndexOf("\n",g-2)+1,--m;Xe(),Je()}function lt(){this.type=null,this.start=c,this.end=null}function ut(){this.start=u,this.end=null,null!==i&&(this.source=i)}function ht(){var e=new lt;return t.locations&&(e.loc=new ut),t.directSourceFile&&(e.sourceFile=t.directSourceFile),t.ranges&&(e.range=[c,0]),e}function dt(e){var n=new lt;return n.start=e.start,t.locations&&(n.loc=new ut,n.loc.start=e.loc.start),t.ranges&&(n.range=[e.range[0],0]),n}function ft(e,n){return e.type=n,e.end=y,t.locations&&(e.loc.end=b),t.ranges&&(e.range[1]=y),e}function pt(e){return t.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.value}function mt(e){if(d===e)return ot(),!0}function gt(){return!t.strictSemicolons&&(d===P||d===oe||qe.test(n.slice(y,c)))}function vt(){mt(he)||gt()||bt()}function yt(e){d===e?ot():bt()}function bt(){S(c,"Unexpected token")}function _t(e){"Identifier"!==e.type&&"MemberExpression"!==e.type&&S(e.start,"Assigning to rvalue"),k&&"Identifier"===e.type&&Le(e.name)&&S(e.start,"Assigning to "+e.name+" in strict mode")}var wt={kind:"loop"},xt={kind:"switch"};function kt(){(d===me||d===ve&&"/="==f)&&Je(!0);var e=d,r=ht();switch(e){case I:case O:ot();var i=e===I;mt(he)||gt()?r.label=null:d!==A?bt():(r.label=Rt(),vt());for(var a=0;a<x.length;++a){var s=x[a];if(null==r.label||s.name===r.label.name){if(null!=s.kind&&(i||"loop"===s.kind))break;if(r.label&&i)break}}return a===x.length&&S(r.start,"Unsyntactic "+e.keyword),ft(r,i?"BreakStatement":"ContinueStatement");case L:return ot(),vt(),ft(r,"DebuggerStatement");case R:return ot(),x.push(wt),r.body=kt(),x.pop(),yt(K),r.test=Ct(),vt(),ft(r,"DoWhileStatement");case j:if(ot(),x.push(wt),yt(ce),d===he)return Et(r,null);if(d===$){var o=ht();return ot(),Tt(o,!0),ft(o,"VariableDeclaration"),1===o.declarations.length&&mt(ne)?Mt(r,o):Et(r,o)}return o=Nt(!1,!0),mt(ne)?(_t(o),Mt(r,o)):Et(r,o);case q:return ot(),Lt(r,!0);case H:return ot(),r.test=Ct(),r.consequent=kt(),r.alternate=mt(F)?kt():null,ft(r,"IfStatement");case U:return w||t.allowReturnOutsideFunction||S(c,"'return' outside of function"),ot(),mt(he)||gt()?r.argument=null:(r.argument=Nt(),vt()),ft(r,"ReturnStatement");case G:ot(),r.discriminant=Ct(),r.cases=[],yt(se),x.push(xt);for(var l,u;d!=oe;)if(d===D||d===V){var h=d===D;l&&ft(l,"SwitchCase"),r.cases.push(l=ht()),l.consequent=[],ot(),h?l.test=Nt():(u&&S(v,"Multiple default clauses"),u=!0,l.test=null),yt(de)}else l||bt(),l.consequent.push(kt());return l&&ft(l,"SwitchCase"),ot(),x.pop(),ft(r,"SwitchStatement");case W:return ot(),qe.test(n.slice(y,c))&&S(y,"Illegal newline after throw"),r.argument=Nt(),vt(),ft(r,"ThrowStatement");case Y:if(ot(),r.block=St(),r.handler=null,d===B){var p=ht();ot(),yt(ce),p.param=Rt(),k&&Le(p.param.name)&&S(p.param.start,"Binding "+p.param.name+" in strict mode"),yt(le),p.guard=null,p.body=St(),r.handler=ft(p,"CatchClause")}return r.guardedHandlers=E,r.finalizer=mt(z)?St():null,r.handler||r.finalizer||S(r.start,"Missing catch or finally clause"),ft(r,"TryStatement");case $:return ot(),Tt(r),vt(),ft(r,"VariableDeclaration");case K:return ot(),r.test=Ct(),x.push(wt),r.body=kt(),x.pop(),ft(r,"WhileStatement");case Q:return k&&S(c,"'with' in strict mode"),ot(),r.object=Ct(),r.body=kt(),ft(r,"WithStatement");case se:return St();case he:return ot(),ft(r,"EmptyStatement");default:var m=f,g=Nt();if(e===A&&"Identifier"===g.type&&mt(de)){for(a=0;a<x.length;++a)x[a].name===m&&S(g.start,"Label '"+m+"' is already declared");var b=d.isLoop?"loop":d===G?"switch":null;return x.push({name:m,kind:b}),r.body=kt(),x.pop(),r.label=g,ft(r,"LabeledStatement")}return r.expression=g,vt(),ft(r,"ExpressionStatement")}}function Ct(){yt(ce);var e=Nt();return yt(le),e}function St(e){var t,n=ht(),r=!0,i=!1;for(n.body=[],yt(se);!mt(oe);){var a=kt();n.body.push(a),r&&e&&pt(a)&&(t=i,ct(i=!0)),r=!1}return i&&!t&&ct(!1),ft(n,"BlockStatement")}function Et(e,t){return e.init=t,yt(he),e.test=d===he?null:Nt(),yt(he),e.update=d===le?null:Nt(),yt(le),e.body=kt(),x.pop(),ft(e,"ForStatement")}function Mt(e,t){return e.left=t,e.right=Nt(),yt(le),e.body=kt(),x.pop(),ft(e,"ForInStatement")}function Tt(e,t){for(e.declarations=[],e.kind="var";;){var n=ht();if(n.id=Rt(),k&&Le(n.id.name)&&S(n.id.start,"Binding "+n.id.name+" in strict mode"),n.init=mt(ge)?Nt(!0,t):null,e.declarations.push(ft(n,"VariableDeclarator")),!mt(ue))break}return e}function Nt(e,t){var n=At(t);if(!e&&d===ue){var r=dt(n);for(r.expressions=[n];mt(ue);)r.expressions.push(At(t));return ft(r,"SequenceExpression")}return n}function At(e){var t=function(e){var t=function(e){return Pt(It(),-1,e)}(e);if(mt(pe)){var n=dt(t);return n.test=t,n.consequent=Nt(!0),yt(de),n.alternate=Nt(!0,e),ft(n,"ConditionalExpression")}return t}(e);if(d.isAssign){var n=dt(t);return n.operator=f,n.left=t,ot(),n.right=At(e),_t(t),ft(n,"AssignmentExpression")}return t}function Pt(e,t,n){var r=d.binop;if(null!=r&&(!n||d!==ne)&&r>t){var i=dt(e);i.left=e,i.operator=f;var a=d;return ot(),i.right=Pt(It(),r,n),Pt(ft(i,a===_e||a===we?"LogicalExpression":"BinaryExpression"),t,n)}return e}function It(){if(d.prefix){var e=ht(),t=d.isUpdate;return e.operator=f,e.prefix=!0,p=!0,ot(),e.argument=It(),t?_t(e.argument):k&&"delete"===e.operator&&"Identifier"===e.argument.type&&S(e.start,"Deleting local variable in strict mode"),ft(e,t?"UpdateExpression":"UnaryExpression")}for(var n=Dt(Bt());d.postfix&&!gt();)(e=dt(n)).operator=f,e.prefix=!1,e.argument=n,_t(n),ot(),n=ft(e,"UpdateExpression");return n}function Dt(e,t){var n;return mt(fe)?((n=dt(e)).object=e,n.property=Rt(!0),n.computed=!1,Dt(ft(n,"MemberExpression"),t)):mt(ie)?((n=dt(e)).object=e,n.property=Nt(),n.computed=!0,yt(ae),Dt(ft(n,"MemberExpression"),t)):!t&&mt(ce)?((n=dt(e)).callee=e,n.arguments=Vt(le,!1),Dt(ft(n,"CallExpression"),t)):e}function Bt(){switch(d){case Z:var e=ht();return ot(),ft(e,"ThisExpression");case A:return Rt();case M:case N:case T:return(e=ht()).value=f,e.raw=n.slice(c,l),ot(),ft(e,"Literal");case J:case ee:case te:return(e=ht()).value=d.atomValue,e.raw=d.keyword,ot(),ft(e,"Literal");case ce:var r=u,i=c;ot();var a=Nt();return a.start=i,a.end=l,t.locations&&(a.loc.start=r,a.loc.end=h),t.ranges&&(a.range=[i,l]),yt(le),a;case ie:return e=ht(),ot(),e.elements=Vt(ae,!0,!0),ft(e,"ArrayExpression");case se:return function(){var e=ht(),n=!0,r=!1;for(e.properties=[],ot();!mt(oe);){if(n)n=!1;else if(yt(ue),t.allowTrailingCommas&&mt(oe))break;var i,a={key:Ot()},s=!1;if(mt(de)?(a.value=Nt(!0),i=a.kind="init"):t.ecmaVersion>=5&&"Identifier"===a.key.type&&("get"===a.key.name||"set"===a.key.name)?(s=r=!0,i=a.kind=a.key.name,a.key=Ot(),d!==ce&&bt(),a.value=Lt(ht(),!1)):bt(),"Identifier"===a.key.type&&(k||r))for(var o=0;o<e.properties.length;++o){var c=e.properties[o];if(c.key.name===a.key.name){var l=i==c.kind||s&&"init"===c.kind||"init"===i&&("get"===c.kind||"set"===c.kind);l&&!k&&"init"===i&&"init"===c.kind&&(l=!1),l&&S(a.key.start,"Redefinition of property")}}e.properties.push(a)}return ft(e,"ObjectExpression")}();case q:return e=ht(),ot(),Lt(e,!1);case X:return function(){var e=ht();return ot(),e.callee=Dt(Bt(),!0),mt(ce)?e.arguments=Vt(le,!1):e.arguments=E,ft(e,"NewExpression")}();default:bt()}}function Ot(){return d===M||d===N?Bt():Rt(!0)}function Lt(e,t){d===A?e.id=Rt():t?bt():e.id=null,e.params=[];var n=!0;for(yt(ce);!mt(le);)n?n=!1:yt(ue),e.params.push(Rt());var r=w,i=x;if(w=!0,x=[],e.body=St(!0),w=r,x=i,k||e.body.body.length&&pt(e.body.body[0]))for(var a=e.id?-1:0;a<e.params.length;++a){var s=a<0?e.id:e.params[a];if((Oe(s.name)||Le(s.name))&&S(s.start,"Defining '"+s.name+"' in strict mode"),a>=0)for(var o=0;o<a;++o)s.name===e.params[o].name&&S(s.start,"Argument name clash in strict mode")}return ft(e,t?"FunctionDeclaration":"FunctionExpression")}function Vt(e,n,r){for(var i=[],a=!0;!mt(e);){if(a)a=!1;else if(yt(ue),n&&t.allowTrailingCommas&&mt(e))break;r&&d===ue?i.push(null):i.push(Nt(!0))}return i}function Rt(e){var r=ht();return e&&"everywhere"==t.forbidReserved&&(e=!1),d===A?(!e&&(t.forbidReserved&&(3===t.ecmaVersion?De:Be)(f)||k&&Oe(f))&&-1==n.slice(c,l).indexOf("\\")&&S(c,"The keyword '"+f+"' is reserved"),r.name=f):e&&d.keyword?r.name=d.keyword:bt(),p=!1,ot(),ft(r,"Identifier")}}(e),s.version||(s=null));var l={"+":"__add","-":"__subtract","*":"__multiply","/":"__divide","%":"__modulo","==":"__equals","!=":"__equals"},u={"-":"__negate","+":"__self"},h=a.each(["add","subtract","multiply","divide","modulo","equals","negate"],(function(e){this["__"+e]="#"+e}),{__self:function(){return this}});function d(e,t,n){var r=l[t];if(e&&e[r]){var i=e[r](n);return"!="===t?!i:i}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 p(e,t){var n=u[e];if(t&&t[n])return t[n]();switch(e){case"+":return+t;case"-":return-t}}function g(e,n){if(!e)return"";var a=[];function s(e){for(var t=0,n=a.length;t<n;t++){var r=a[t];if(r[0]>=e)break;e+=r[1]}return e}function o(t){return e.substring(s(t.range[0]),s(t.range[1]))}function h(t,n){for(var r=s(t.range[0]),i=s(t.range[1]),o=0,c=a.length-1;c>=0;c--)if(r>a[c][0]){o=c+1;break}a.splice(o,0,[r,n.length-i+r]),e=e.substring(0,r)+n+e.substring(i)}function d(t,n){switch(t.type){case"UnaryExpression":if(t.operator in u&&"Literal"!==t.argument.type){var r=o(t.argument);h(t,'$__("'+t.operator+'", '+r+")")}break;case"BinaryExpression":if(t.operator in l&&"Literal"!==t.left.type){var i=o(t.left),a=o(t.right),c=function(t,n){return e.substring(s(t.range[1]),s(n.range[0]))}(t.left,t.right),d=t.operator;h(t,"__$__("+i+","+c.replace(new RegExp("\\"+d),'"'+d+'"')+", "+a+")")}break;case"UpdateExpression":case"AssignmentExpression":var f=n&&n.type;if(!("ForStatement"===f||"BinaryExpression"===f&&/^[=!<>]/.test(n.operator)||"MemberExpression"===f&&n.computed))if("UpdateExpression"===t.type){var p=(r=o(t.argument))+" = "+(m="__$__("+r+', "'+t.operator[0]+'", 1)');t.prefix?p="("+p+")":"AssignmentExpression"!==f&&"VariableDeclarator"!==f&&"BinaryExpression"!==f||(o(n.left||n.id)===r&&(p=m),p=r+"; "+p),h(t,p)}else if(/^.=$/.test(t.operator)&&"Literal"!==t.left.type){i=o(t.left),a=o(t.right);var m=i+" = __$__("+i+', "'+t.operator[0]+'", '+a+")";h(t,/^\(.*\)$/.test(o(t))?"("+m+")":m)}}}var f,p=(n=n||{}).url||"",m=n.sourceMaps,g=n.paperFeatures||{},v=n.source||e,y=n.offset||0,b=oe.agent,_=b.versionNumber,w=!1,x=/\r\n|\n|\r/gm;if(m&&(b.chrome&&_>=30||b.webkit&&_>=537.76||b.firefox&&_>=23||b.node)){if(b.node)y-=2;else if(r&&p&&!r.location.href.indexOf(p)){var k=i.getElementsByTagName("html")[0].innerHTML;y=k.substr(0,k.indexOf(e)+1).match(x).length+1}var C=["AA"+function(e){var t="";for(e=(Math.abs(e)<<1)+(e<0?1:0);e||!t;){var n=31&e;(e>>=5)&&(n|=32),t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}return t}((w=y>0&&!(b.chrome&&_>=36||b.safari&&_>=600||b.firefox&&_>=40||b.node))?0:y)+"A"];C.length=(e.match(x)||[]).length+1+(w?y:0),f={version:3,file:p,names:[],mappings:C.join(";AACA"),sourceRoot:"",sources:[p],sourcesContent:[v]}}return!1===g.operatorOverloading&&!1===g.moduleExports||function e(t,n,r){if(t){for(var i in t)if("range"!==i&&"loc"!==i){var a=t[i];if(Array.isArray(a))for(var s=0,c=a.length;s<c;s++)e(a[s],t,r);else a&&"object"==typeof a&&e(a,t,r)}!1!==r.operatorOverloading&&d(t,n),!1!==r.moduleExports&&function(e){switch(e.type){case"ExportDefaultDeclaration":h({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){h(e,"module.exports."+o(e))})),h({range:[e.start,t.start+t.kind.length]},""))}else if(n){var i=n.map((function(e){var t=o(e);return"module.exports."+t+" = "+t+"; "})).join("");i&&h(e,i)}}}(t)}}(c(e,{ranges:!0,preserveParens:!0,sourceType:"module"}),null,g),f&&(w&&(e=new Array(y+1).join("\n")+e),/^(inline|both)$/.test(m)&&(e+="\n//# sourceMappingURL=data:application/json;base64,"+t.btoa(unescape(encodeURIComponent(JSON.stringify(f))))),e+="\n//# sourceURL="+(p||"paperscript")),{url:p,source:v,code:e,map:f}}function v(e,t,n){oe=t;var r,s=t.getView(),o=/\btool\.\w+|\s+on(?:Key|Mouse)(?:Up|Down|Move|Drag)\b/.test(e)&&!/\bnew\s+Tool\b/.test(e)?new ee:null,c=o?o._events:[],l=["onFrame","onResize"].concat(c),u=[],h=[],m="object"==typeof e?e:g(e,n);function v(t,n){for(var r in t)!n&&/^_/.test(r)||!new RegExp("([\\b\\s\\W]|^)"+r.replace(/\$/g,"\\$")+"\\b").test(e)||(u.push(r),h.push(t[r]))}e=m.code,v({__$__:d,$__:p,paper:t,tool:o},!0),v(t),e="var module = { exports: {} }; "+e,(w=a.each(l,(function(t){new RegExp("\\s+"+t+"\\b").test(e)&&(u.push(t),this.push("module.exports."+t+" = "+t+";"))}),[]).join("\n"))&&(e+="\n"+w),e+="\nreturn module.exports;";var y=oe.agent;if(i&&(y.chrome||y.firefox&&y.versionNumber<40)){var b=i.createElement("script"),_=i.head||i.getElementsByTagName("head")[0];y.firefox&&(e="\n"+e),b.appendChild(i.createTextNode("document.__paperscript__ = function("+u+") {"+e+"\n}")),_.appendChild(b),r=i.__paperscript__,delete i.__paperscript__,_.removeChild(b)}else r=Function(u,e);var w,x=(w=r&&r.apply(t,h))||{};return a.each(c,(function(e){var t=x[e];t&&(o[e]=t)})),s&&(x.onResize&&s.setOnResize(x.onResize),s.emit("resize",{size:s.size,delta:new f}),x.onFrame&&s.setOnFrame(x.onFrame),s.requestUpdate()),w}function y(e){if(/^text\/(?:x-|)paperscript$/.test(e.type)&&"true"!==o.getAttribute(e,"ignore")){var t=o.getAttribute(e,"canvas"),n=i.getElementById(t),r=e.src||e.getAttribute("data-src"),a=o.hasAttribute(e,"async"),s="data-paper-scope";if(!n)throw new Error('Unable to find canvas with id "'+t+'"');var c=o.get(n.getAttribute(s))||(new o).setup(n);return n.setAttribute(s,c._id),r?ne({url:r,async:a,mimeType:"text/plain",onLoad:function(e){v(e,c,r)}}):v(e.innerHTML,c,e.baseURI),e.setAttribute("data-paper-ignore","true"),c}}function b(){a.each(i&&i.getElementsByTagName("script"),y)}return f.inject(h),m.inject(h),j.inject(h),r&&("complete"===i.readyState?setTimeout(b):W.add(r,{load:b})),{compile:g,execute:v,load:function(e){return e?y(e):b()},parse:c,calculateBinary:d,calculateUnary:p}}.call(this);var oe=new(o.inject(a.exports,{Base:a,Numerical:h,Key:X,DomEvent:W,DomElement:G,document:i,window:r,Symbol:T,PlacedSymbol:M}));return oe.agent.node&&Kr(oe),"function"==typeof n&&n.amd?n("paper",oe):e&&(e.exports=oe),oe}).call(ei,"object"==typeof self?self:null)}($r)),$r.exports);const ni=d(ti),ri=t.defineComponent({name:"CalculateSupplementaryAngle",components:{UserInputNumber:n.UserInputNumber},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"CalculateSupplementaryAngle"),a=n.useQuestionView(i),s=t.ref(""),o=t.ref(null),c=t.ref();a.question.value=new ui(e.data);const l=(e,t,n,r,i,a,s=30)=>new e.Point(t/2+s*x(n+(r+i)/2),a/2+s*k(n+(r+i)/2));return t.onMounted((async()=>{if(await t.nextTick(),!o.value)return;c.value=new ni.PaperScope,c.value.setup(o.value);const e=c.value,n=o.value.width,r=o.value.height,i=w(0,360),s=n*x(i),u=n*k(i);new e.Path.Line({from:new e.Point(n/2+s,r/2+u),to:new e.Point(n/2-s,r/2-u)}).strokeColor=new ni.Color("black");let h=0;const d=[];if(a.question.value)for(let t=0;t<a.question.value.angles.length;t++){const s=a.question.value.angles[t];let o;h+=s,console.log(`drawing angle ${t}:\n angle: ${s}\n angleSum: ${h}\n `);const c=h-s;o=t===a.question.value.angles.length-1?180:h;const u=new e.Point(n/2+30*x(i+c),r/2+30*k(i+c)),f=l(e,n,i,c,o,r),p=new e.Point(n/2+30*x(i+o),r/2+30*k(i+o)),m=n*x(i+h),g=n*k(i+h),v=new e.Path.Line({from:new e.Point(n/2,r/2),to:new e.Point(n/2+m,r/2+g)});if(v.strokeColor=new ni.Color(0,0,0),d.push(v),a.question.value.targetAngleIndex===t){console.log(`drawing targetAngle at i = ${t}:\n baseAngle: ${i}\n targetAngle: ${s}\n sum: ${h}\n nextAngle: ${o}\n `);const a=new ni.Color(.1,.5,.8,.35),c=new e.Path.Arc({from:u,through:f,to:p});c.strokeColor=new ni.Color(.1,.5,.8,.75),c.strokeWidth=3,c.fillColor=a;const l=new e.Path;l.closed=!0,l.add(u),l.add(new ni.Point(n/2,r/2)),l.add(p),l.fillColor=a}else{const t=new ni.PointText(f);t.content=s.toString()+"°";let a=!0,u=20;for(;a;)a=!1,t.bounds.center=l(e,n,i,c,o,r,u),d.forEach((e=>{e.intersects(t)&&(a=!0)})),u+=7}}})),t.onBeforeUnmount((()=>{c.value=void 0})),{answer:s,canvasRef:o,...i,...a}}}),ii={"data-viewable":"CalculateSupplementaryAngle"},ai={ref:"canvasRef",width:"300",height:"300"};const si=E(ri,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("user-input-number");return t.openBlock(),t.createElementBlock("div",ii,[n[1]||(n[1]=t.createElementVNode("h2",null,"What is the measurement of the highlighted angle?",-1)),t.createElementVNode("canvas",ai,null,512),n[2]||(n[2]=t.createElementVNode("br",null,null,-1)),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"])])}],["__scopeId","data-v-4f8ac466"]]),oi={instructions:"Must be 2 or 3.",test:e=>"2"===e||"3"===e?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Must be 2 or 3."}},ci=[{name:"AngleCount",type:r.FieldType.INT,validator:oi}],li=class _SupplementaryAngles2 extends n.Question{constructor(e){super(e),u(this,"angles",[]),u(this,"targetAngleIndex"),u(this,"angleCount"),this.angleCount=e[0].AngleCount;let t=0;for(let n=0;n<=this.angleCount-2;n++){const e=w(25,155-t);this.angles.push(e),t+=e}this.angles.push(180-t),this.targetAngleIndex=w(0,this.angleCount-1)}isCorrect(e){return this.angles[this.targetAngleIndex]===e}dataShapes(){return _SupplementaryAngles2.dataShapes}views(){return _SupplementaryAngles2.views}};u(li,"dataShapes",[{name:r.DataShapeName.MATH_SupplimentaryAngles,fields:ci}]),u(li,"views",[si]);let ui=li;const hi=t.defineComponent({name:"VerbalAddition",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"VerbalAddition"),a=n.useQuestionView(i),s=t.ref(["","","","",""]);a.question.value=new _i(e.data);const o=t.computed((()=>a.question.value?a.question.value:new _i(e.data)));return t.onMounted((()=>{var e;console.log("focusing..."),null==(e=document.getElementById("input0"))||e.focus()})),{...i,...a,answer:s,question:o,track:e=>{var t,n,r,i,c,l;console.log(`change in ${e}!\n userAnswer: ${s.value.toString()}\n\n qAnswer: ${null==(t=o.value)?void 0:t.answer.toString()}`),o.value&&o.value.answer[e].toString().length===s.value[e].length&&(parseInt(s.value[e])===o.value.answer[e]?(null==(n=document.getElementById("input"+e))||n.classList.add("correct"),null==(r=document.getElementById("input"+e))||r.classList.remove("incorrect"),null==(i=document.getElementById("input"+e))||i.setAttribute("disabled","true"),e+1<s.value.length?null==(c=document.getElementById("input"+(e+1)))||c.focus():a.submitAnswer(s.value)):(null==(l=document.getElementById("input"+e))||l.classList.add("incorrect"),a.submitAnswer(s.value),console.log(`Wrong! ${s.value[e]} !== ${o.value.answer[e]}`)))}}}}),di={"data-viewable":"VerbalAddition",class:"text-h5"},fi={class:"text-h5"},pi=["value"],mi=["id","onUpdate:modelValue","autofocus","onKeyup"],gi={key:0};const vi=E(hi,[["render",function(e,n,r,i,a,s){var o;return t.openBlock(),t.createElementBlock("div",di,[t.createElementVNode("div",fi,[n[0]||(n[0]=t.createTextVNode(" Count by ")),t.createElementVNode("strong",null,t.toDisplayString(null==(o=e.question)?void 0:o.n),1),n[1]||(n[1]=t.createTextVNode("s: "))]),t.createElementVNode("input",{type:"text",disabled:"",class:"correct",value:e.question.answer[0]-e.question.n},null,8,pi),n[2]||(n[2]=t.createTextVNode(", ")),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.answer,((n,r)=>(t.openBlock(),t.createElementBlock("span",{key:r},[t.withDirectives(t.createElementVNode("input",{id:`input${r}`,ref_for:!0,ref:`input${r}`,class:t.normalizeClass(`input${n}${r}`),"onUpdate:modelValue":t=>e.answer[r]=t,type:"text",autofocus:0===r,onKeyup:t=>e.track(r)},null,42,mi),[[t.vModelText,e.answer[r]]]),r!==e.question.answer.length-1?(t.openBlock(),t.createElementBlock("span",gi,", ")):t.createCommentVNode("",!0)])))),128))])}],["__scopeId","data-v-0452c3a5"]]),yi=[{name:"n",type:r.FieldType.INT},{name:"hand",type:r.FieldType.STRING,validator:{test:e=>"LEFT"===e||"RIGHT"===e?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Hand must be LEFT or RIGHT"}}}];const bi=class _CountBy2 extends n.Question{constructor(e){super(e),u(this,"n"),u(this,"hand"),this.n=e[0].n,this.hand=e[0].hand}get answer(){const e=[],t="LEFT"===this.hand?this.n:6*this.n;for(let n=0;n<5;n++)e.push(t+n*this.n);return e}isCorrect(e){console.log(`Solution: ${this.answer.toString()}`);for(let n=0;n<this.answer.length;n++)if(("string"==typeof(t=e[n])?parseInt(t):t)!==this.answer[n])return console.log(`answer[${n}] == ${e[n]} !== ${this.answer[n]}`),!1;var t;return!0}dataShapes(){return _CountBy2.dataShapes}views(){return _CountBy2.views}};u(bi,"dataShapes",[{name:r.DataShapeName.MATH_CountBy,fields:yi}]),u(bi,"views",[vi]),u(bi,"seedData",function(){const e=[];for(let t=2;t<=10;t++)e.push({n:t,hand:"LEFT"}),e.push({n:t,hand:"RIGHT"});return e}()),u(bi,"acceptsUserData",!1);let _i=bi;const wi=new Course("math",[cr,yr,nr,Cr,Vr,Wr,ui,_i]);var xi,ki={exports:{}},Ci=ki.exports;var Si=(xi||(xi=1,function(e){!function(t){function n(){if(n.prototype._singleton)throw new Error("WebMidi is a singleton, it cannot be instantiated directly.");(n.prototype._singleton=this)._inputs=[],this._outputs=[],this._userHandlers={},this._stateChangeQueue=[],this._processingStateChange=!1,this._midiInterfaceEvents=["connected","disconnected"],this._nrpnBuffer=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],this._nrpnEventsEnabled=!0,this._nrpnTypes=["entry","increment","decrement"],this._notes=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],this._semitones={C:0,D:2,E:4,F:5,G:7,A:9,B:11},Object.defineProperties(this,{MIDI_SYSTEM_MESSAGES:{value:{sysex:240,timecode:241,songposition:242,songselect:243,tuningrequest:246,sysexend:247,clock:248,start:250,continue:251,stop:252,activesensing:254,reset:255,midimessage:0,unknownsystemmessage:-1},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MESSAGES:{value:{noteoff:8,noteon:9,keyaftertouch:10,controlchange:11,channelmode:11,nrpn:11,programchange:12,channelaftertouch:13,pitchbend:14},writable:!1,enumerable:!0,configurable:!1},MIDI_REGISTERED_PARAMETER:{value:{pitchbendrange:[0,0],channelfinetuning:[0,1],channelcoarsetuning:[0,2],tuningprogram:[0,3],tuningbank:[0,4],modulationrange:[0,5],azimuthangle:[61,0],elevationangle:[61,1],gain:[61,2],distanceratio:[61,3],maximumdistance:[61,4],maximumdistancegain:[61,5],referencedistanceratio:[61,6],panspreadangle:[61,7],rollangle:[61,8]},writable:!1,enumerable:!0,configurable:!1},MIDI_CONTROL_CHANGE_MESSAGES:{value:{bankselectcoarse:0,modulationwheelcoarse:1,breathcontrollercoarse:2,footcontrollercoarse:4,portamentotimecoarse:5,dataentrycoarse:6,volumecoarse:7,balancecoarse:8,pancoarse:10,expressioncoarse:11,effectcontrol1coarse:12,effectcontrol2coarse:13,generalpurposeslider1:16,generalpurposeslider2:17,generalpurposeslider3:18,generalpurposeslider4:19,bankselectfine:32,modulationwheelfine:33,breathcontrollerfine:34,footcontrollerfine:36,portamentotimefine:37,dataentryfine:38,volumefine:39,balancefine:40,panfine:42,expressionfine:43,effectcontrol1fine:44,effectcontrol2fine:45,holdpedal:64,portamento:65,sustenutopedal:66,softpedal:67,legatopedal:68,hold2pedal:69,soundvariation:70,resonance:71,soundreleasetime:72,soundattacktime:73,brightness:74,soundcontrol6:75,soundcontrol7:76,soundcontrol8:77,soundcontrol9:78,soundcontrol10:79,generalpurposebutton1:80,generalpurposebutton2:81,generalpurposebutton3:82,generalpurposebutton4:83,reverblevel:91,tremololevel:92,choruslevel:93,celestelevel:94,phaserlevel:95,databuttonincrement:96,databuttondecrement:97,nonregisteredparametercoarse:98,nonregisteredparameterfine:99,registeredparametercoarse:100,registeredparameterfine:101},writable:!1,enumerable:!0,configurable:!1},MIDI_NRPN_MESSAGES:{value:{entrymsb:6,entrylsb:38,increment:96,decrement:97,paramlsb:98,parammsb:99,nullactiveparameter:127},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MODE_MESSAGES:{value:{allsoundoff:120,resetallcontrollers:121,localcontrol:122,allnotesoff:123,omnimodeoff:124,omnimodeon:125,monomodeon:126,polymodeon:127},writable:!1,enumerable:!0,configurable:!1},octaveOffset:{value:0,writable:!0,enumerable:!0,configurable:!1}}),Object.defineProperties(this,{supported:{enumerable:!0,get:function(){return"requestMIDIAccess"in navigator}},enabled:{enumerable:!0,get:function(){return void 0!==this.interface}.bind(this)},inputs:{enumerable:!0,get:function(){return this._inputs}.bind(this)},outputs:{enumerable:!0,get:function(){return this._outputs}.bind(this)},sysexEnabled:{enumerable:!0,get:function(){return!(!this.interface||!this.interface.sysexEnabled)}.bind(this)},nrpnEventsEnabled:{enumerable:!0,get:function(){return!!this._nrpnEventsEnabled}.bind(this),set:function(e){return this._nrpnEventsEnabled=e,this._nrpnEventsEnabled}},nrpnTypes:{enumerable:!0,get:function(){return this._nrpnTypes}.bind(this)},time:{enumerable:!0,get:function(){return performance.now()}}})}var r=new n;function i(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 a(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}}})}n.prototype.enable=function(e,t){this.enabled||(this.supported?navigator.requestMIDIAccess({sysex:t}).then(function(t){var n,r=[],i=[];this.interface=t,this._resetInterfaceUserHandlers(),this.interface.onstatechange=function(e){r.push(e)};for(var a=t.inputs.values(),s=a.next();s&&!s.done;s=a.next())i.push(s.value.open());for(var o=t.outputs.values(),c=o.next();c&&!c.done;c=o.next())i.push(c.value.open());function l(){clearTimeout(n),this._updateInputsAndOutputs(),this.interface.onstatechange=this._onInterfaceStateChange.bind(this),"function"==typeof e&&e.call(this),r.forEach(function(e){this._onInterfaceStateChange(e)}.bind(this))}n=setTimeout(l.bind(this),200),Promise&&Promise.all(i).catch((function(e){})).then(l.bind(this))}.bind(this),function(t){"function"==typeof e&&e.call(this,t)}.bind(this)):"function"==typeof e&&e(new Error("The Web MIDI API is not supported by your browser.")))},n.prototype.disable=function(){if(!this.supported)throw new Error("The Web MIDI API is not supported by your browser.");this.enabled&&(this.removeListener(),this.inputs.forEach((function(e){e.removeListener()}))),this.interface&&(this.interface.onstatechange=void 0),this.interface=void 0,this._inputs=[],this._outputs=[],this._nrpnEventsEnabled=!0,this._resetInterfaceUserHandlers()},n.prototype.addListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before adding event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw new TypeError("The specified event type is not supported.");return this._userHandlers[e].push(t),this},n.prototype.hasListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before checking event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw new TypeError("The specified event type is not supported.");for(var n=0;n<this._userHandlers[e].length;n++)if(this._userHandlers[e][n]===t)return!0;return!1},n.prototype.removeListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before removing event listeners.");if(void 0!==t&&"function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(0<=this._midiInterfaceEvents.indexOf(e))if(t)for(var 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(void 0!==e)throw new TypeError("The specified event type is not supported.");this._resetInterfaceUserHandlers()}return this},n.prototype.toMIDIChannels=function(e){var t;if("all"===e||void 0===e)t=["all"];else{if("none"===e)return[];t=Array.isArray(e)?e:[e]}return-1<t.indexOf("all")&&(t=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),t.map((function(e){return parseInt(e)})).filter((function(e){return 1<=e&&e<=16}))},n.prototype.getInputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");e=String(e);for(var t=0;t<this.inputs.length;t++)if(this.inputs[t].id===e)return this.inputs[t];return!1},n.prototype.getOutputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");e=String(e);for(var t=0;t<this.outputs.length;t++)if(this.outputs[t].id===e)return this.outputs[t];return!1},n.prototype.getInputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.inputs.length;t++)if(~this.inputs[t].name.indexOf(e))return this.inputs[t];return!1},n.prototype.getOctave=function(e){if(null!=e&&0<=e&&e<=127)return Math.floor(Math.floor(e)/12-1)+Math.floor(r.octaveOffset)},n.prototype.getOutputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.outputs.length;t++)if(~this.outputs[t].name.indexOf(e))return this.outputs[t];return!1},n.prototype.guessNoteNumber=function(e){var t=!1;if(e&&e.toFixed&&0<=e&&e<=127?t=Math.round(e):0<=parseInt(e)&&parseInt(e)<=127?t=parseInt(e):("string"==typeof e||e instanceof String)&&(t=this.noteNameToNumber(e)),!1===t)throw new Error("Invalid input value ("+e+").");return t},n.prototype.noteNameToNumber=function(e){"string"!=typeof e&&(e="");var t=e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);if(!t)throw new RangeError("Invalid note name.");var n=r._semitones[t[1].toUpperCase()],i=12*(parseInt(t[3])+1-Math.floor(r.octaveOffset))+n;if(-1<t[2].toLowerCase().indexOf("b")?i-=t[2].length:-1<t[2].toLowerCase().indexOf("#")&&(i+=t[2].length),i<0||127<i)throw new RangeError("Invalid note name or note outside valid range.");return i},n.prototype._updateInputsAndOutputs=function(){this._updateInputs(),this._updateOutputs()},n.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 i(e))}.bind(this))},n.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 a(e))}.bind(this))},n.prototype._onInterfaceStateChange=function(e){this._updateInputsAndOutputs();var t={timestamp:e.timeStamp,type:e.port.state};this.interface&&"connected"===e.port.state?"output"===e.port.type?t.port=this.getOutputById(e.port.id):"input"===e.port.type&&(t.port=this.getInputById(e.port.id)):t.port={connection:"closed",id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this._userHandlers[e.port.state].forEach((function(e){e(t)}))},n.prototype._resetInterfaceUserHandlers=function(){for(var e=0;e<this._midiInterfaceEvents.length;e++)this._userHandlers[this._midiInterfaceEvents[e]]=[]},i.prototype.on=i.prototype.addListener=function(e,t,n){var i=this;if(void 0===t&&(t="all"),Array.isArray(t)||(t=[t]),t.forEach((function(e){if("all"!==e&&!(1<=e&&e<=16))throw new RangeError("The 'channel' parameter is invalid.")})),"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0!==r.MIDI_SYSTEM_MESSAGES[e])this._userHandlers.system[e]||(this._userHandlers.system[e]=[]),this._userHandlers.system[e].push(n);else{if(void 0===r.MIDI_CHANNEL_MESSAGES[e])throw new TypeError("The specified event type is not supported.");if(-1<t.indexOf("all")){t=[];for(var a=1;a<=16;a++)t.push(a)}this._userHandlers.channel[e]||(this._userHandlers.channel[e]=[]),t.forEach((function(t){i._userHandlers.channel[e][t]||(i._userHandlers.channel[e][t]=[]),i._userHandlers.channel[e][t].push(n)}))}return this},i.prototype.hasListener=function(e,t,n){var i=this;if("function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==r.MIDI_SYSTEM_MESSAGES[e]){for(var a=0;a<this._userHandlers.system[e].length;a++)if(this._userHandlers.system[e][a]===n)return!0}else if(void 0!==r.MIDI_CHANNEL_MESSAGES[e]){if(-1<t.indexOf("all")){t=[];for(var s=1;s<=16;s++)t.push(s)}return!!this._userHandlers.channel[e]&&t.every((function(t){var r=i._userHandlers.channel[e][t];return r&&-1<r.indexOf(n)}))}return!1},i.prototype.removeListener=function(e,t,n){var i=this;if(void 0!==n&&"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==r.MIDI_SYSTEM_MESSAGES[e])if(void 0===n)this._userHandlers.system[e]=[];else for(var a=0;a<this._userHandlers.system[e].length;a++)this._userHandlers.system[e][a]===n&&this._userHandlers.system[e].splice(a,1);else if(void 0!==r.MIDI_CHANNEL_MESSAGES[e]){if(-1<t.indexOf("all")){t=[];for(var s=1;s<=16;s++)t.push(s)}if(!this._userHandlers.channel[e])return this;t.forEach((function(t){var r=i._userHandlers.channel[e][t];if(r)if(void 0===n)i._userHandlers.channel[e][t]=[];else for(var a=0;a<r.length;a++)r[a]===n&&r.splice(a,1)}))}else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._initializeUserHandlers()}return this},i.prototype._initializeUserHandlers=function(){for(var e in r.MIDI_CHANNEL_MESSAGES)Object.prototype.hasOwnProperty.call(r.MIDI_CHANNEL_MESSAGES,e)&&(this._userHandlers.channel[e]={});for(var t in r.MIDI_SYSTEM_MESSAGES)Object.prototype.hasOwnProperty.call(r.MIDI_SYSTEM_MESSAGES,t)&&(this._userHandlers.system[t]=[])},i.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)},i.prototype._parseNrpnEvent=function(e){var t,n,i=e.data[0]>>4,a=15&e.data[0],s=1+a;if(1<e.data.length&&(t=e.data[1],n=2<e.data.length?e.data[2]:void 0),r.nrpnEventsEnabled&&i===r.MIDI_CHANNEL_MESSAGES.controlchange&&(t>=r.MIDI_NRPN_MESSAGES.increment&&t<=r.MIDI_NRPN_MESSAGES.parammsb||t===r.MIDI_NRPN_MESSAGES.entrymsb||t===r.MIDI_NRPN_MESSAGES.entrylsb)){var o={target:this,type:"controlchange",data:e.data,timestamp:e.timeStamp,channel:s,controller:{number:t,name:this.getCcNameByNumber(t)},value:n};if(o.controller.number===r.MIDI_NRPN_MESSAGES.parammsb&&o.value!=r.MIDI_NRPN_MESSAGES.nullactiveparameter)r._nrpnBuffer[a]=[],r._nrpnBuffer[a][0]=o;else if(1===r._nrpnBuffer[a].length&&o.controller.number===r.MIDI_NRPN_MESSAGES.paramlsb)r._nrpnBuffer[a].push(o);else if(2!==r._nrpnBuffer[a].length||o.controller.number!==r.MIDI_NRPN_MESSAGES.increment&&o.controller.number!==r.MIDI_NRPN_MESSAGES.decrement&&o.controller.number!==r.MIDI_NRPN_MESSAGES.entrymsb)if(3===r._nrpnBuffer[a].length&&r._nrpnBuffer[a][2].number===r.MIDI_NRPN_MESSAGES.entrymsb&&o.controller.number===r.MIDI_NRPN_MESSAGES.entrylsb)r._nrpnBuffer[a].push(o);else if(3<=r._nrpnBuffer[a].length&&r._nrpnBuffer[a].length<=4&&o.controller.number===r.MIDI_NRPN_MESSAGES.parammsb&&o.value===r.MIDI_NRPN_MESSAGES.nullactiveparameter)r._nrpnBuffer[a].push(o);else if(4<=r._nrpnBuffer[a].length&&r._nrpnBuffer[a].length<=5&&o.controller.number===r.MIDI_NRPN_MESSAGES.paramlsb&&o.value===r.MIDI_NRPN_MESSAGES.nullactiveparameter){r._nrpnBuffer[a].push(o);var c=[];r._nrpnBuffer[a].forEach((function(e){c.push(e.data)}));var l=r._nrpnBuffer[a][0].value<<7|r._nrpnBuffer[a][1].value,u=r._nrpnBuffer[a][2].value;6===r._nrpnBuffer[a].length&&(u=r._nrpnBuffer[a][2].value<<7|r._nrpnBuffer[a][3].value);var h="";switch(r._nrpnBuffer[a][2].controller.number){case r.MIDI_NRPN_MESSAGES.entrymsb:h=r._nrpnTypes[0];break;case r.MIDI_NRPN_MESSAGES.increment:h=r._nrpnTypes[1];break;case r.MIDI_NRPN_MESSAGES.decrement:h=r._nrpnTypes[2];break;default:throw new Error("The NPRN type was unidentifiable.")}var d={timestamp:o.timestamp,channel:o.channel,type:"nrpn",data:c,controller:{number:l,type:h,name:"Non-Registered Parameter "+l},value:u};r._nrpnBuffer[a]=[],this._userHandlers.channel[d.type]&&this._userHandlers.channel[d.type][d.channel]&&this._userHandlers.channel[d.type][d.channel].forEach((function(e){e(d)}))}else r._nrpnBuffer[a]=[];else r._nrpnBuffer[a].push(o)}},i.prototype._parseChannelEvent=function(e){var t,n,i=e.data[0]>>4,a=1+(15&e.data[0]);1<e.data.length&&(t=e.data[1],n=2<e.data.length?e.data[2]:void 0);var s={target:this,data:e.data,timestamp:e.timeStamp,channel:a};i===r.MIDI_CHANNEL_MESSAGES.noteoff||i===r.MIDI_CHANNEL_MESSAGES.noteon&&0===n?(s.type="noteoff",s.note={number:t,name:r._notes[t%12],octave:r.getOctave(t)},s.velocity=n/127,s.rawVelocity=n):i===r.MIDI_CHANNEL_MESSAGES.noteon?(s.type="noteon",s.note={number:t,name:r._notes[t%12],octave:r.getOctave(t)},s.velocity=n/127,s.rawVelocity=n):i===r.MIDI_CHANNEL_MESSAGES.keyaftertouch?(s.type="keyaftertouch",s.note={number:t,name:r._notes[t%12],octave:r.getOctave(t)},s.value=n/127):i===r.MIDI_CHANNEL_MESSAGES.controlchange&&0<=t&&t<=119?(s.type="controlchange",s.controller={number:t,name:this.getCcNameByNumber(t)},s.value=n):i===r.MIDI_CHANNEL_MESSAGES.channelmode&&120<=t&&t<=127?(s.type="channelmode",s.controller={number:t,name:this.getChannelModeByNumber(t)},s.value=n):i===r.MIDI_CHANNEL_MESSAGES.programchange?(s.type="programchange",s.value=t):i===r.MIDI_CHANNEL_MESSAGES.channelaftertouch?(s.type="channelaftertouch",s.value=t/127):i===r.MIDI_CHANNEL_MESSAGES.pitchbend?(s.type="pitchbend",s.value=((n<<7)+t-8192)/8192):s.type="unknownchannelmessage",this._userHandlers.channel[s.type]&&this._userHandlers.channel[s.type][a]&&this._userHandlers.channel[s.type][a].forEach((function(e){e(s)}))},i.prototype.getCcNameByNumber=function(e){if(!(0<=(e=Math.floor(e))&&e<=119))throw new RangeError("The control change number must be between 0 and 119.");for(var t in r.MIDI_CONTROL_CHANGE_MESSAGES)if(Object.prototype.hasOwnProperty.call(r.MIDI_CONTROL_CHANGE_MESSAGES,t)&&e===r.MIDI_CONTROL_CHANGE_MESSAGES[t])return t},i.prototype.getChannelModeByNumber=function(e){if(!(120<=(e=Math.floor(e))&&status<=127))throw new RangeError("The control change number must be between 120 and 127.");for(var t in r.MIDI_CHANNEL_MODE_MESSAGES)if(Object.prototype.hasOwnProperty.call(r.MIDI_CHANNEL_MODE_MESSAGES,t)&&e===r.MIDI_CHANNEL_MODE_MESSAGES[t])return t},i.prototype._parseSystemEvent=function(e){var t=e.data[0],n={target:this,data:e.data,timestamp:e.timeStamp};t===r.MIDI_SYSTEM_MESSAGES.sysex?n.type="sysex":t===r.MIDI_SYSTEM_MESSAGES.timecode?n.type="timecode":t===r.MIDI_SYSTEM_MESSAGES.songposition?n.type="songposition":t===r.MIDI_SYSTEM_MESSAGES.songselect?(n.type="songselect",n.song=e.data[1]):t===r.MIDI_SYSTEM_MESSAGES.tuningrequest?n.type="tuningrequest":t===r.MIDI_SYSTEM_MESSAGES.clock?n.type="clock":t===r.MIDI_SYSTEM_MESSAGES.start?n.type="start":t===r.MIDI_SYSTEM_MESSAGES.continue?n.type="continue":t===r.MIDI_SYSTEM_MESSAGES.stop?n.type="stop":t===r.MIDI_SYSTEM_MESSAGES.activesensing?n.type="activesensing":t===r.MIDI_SYSTEM_MESSAGES.reset?n.type="reset":n.type="unknownsystemmessage",this._userHandlers.system[n.type]&&this._userHandlers.system[n.type].forEach((function(e){e(n)}))},a.prototype.send=function(e,t,n){if(!(128<=e&&e<=255))throw new RangeError("The status byte must be an integer between 128 (0x80) and 255 (0xFF).");void 0===t&&(t=[]),Array.isArray(t)||(t=[t]);var r=[];return t.forEach((function(e){var t=Math.floor(e);if(!(0<=t&&t<=255))throw new RangeError("Data bytes must be integers between 0 (0x00) and 255 (0xFF).");r.push(t)})),this._midiOutput.send([e].concat(r),parseFloat(n)||0),this},a.prototype.sendSysex=function(e,t,n){if(!r.sysexEnabled)throw new Error("Sysex message support must first be activated.");return n=n||{},e=[].concat(e),t.forEach((function(e){if(e<0||127<e)throw new RangeError("The data bytes of a sysex message must be integers between 0 (0x00) and 127 (0x7F).")})),t=e.concat(t,r.MIDI_SYSTEM_MESSAGES.sysexend),this.send(r.MIDI_SYSTEM_MESSAGES.sysex,t,this._parseTimeParameter(n.time)),this},a.prototype.sendTimecodeQuarterFrame=function(e,t){return t=t||{},this.send(r.MIDI_SYSTEM_MESSAGES.timecode,e,this._parseTimeParameter(t.time)),this},a.prototype.sendSongPosition=function(e,t){t=t||{};var n=(e=Math.floor(e)||0)>>7&127,i=127&e;return this.send(r.MIDI_SYSTEM_MESSAGES.songposition,[n,i],this._parseTimeParameter(t.time)),this},a.prototype.sendSongSelect=function(e,t){if(t=t||{},!(0<=(e=Math.floor(e))&&e<=127))throw new RangeError("The song number must be between 0 and 127.");return this.send(r.MIDI_SYSTEM_MESSAGES.songselect,[e],this._parseTimeParameter(t.time)),this},a.prototype.sendTuningRequest=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.tuningrequest,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendClock=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.clock,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendStart=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.start,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendContinue=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.continue,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendStop=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.stop,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendActiveSensing=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.activesensing,[],this._parseTimeParameter(e.time)),this},a.prototype.sendReset=function(e){return e=e||{},this.send(r.MIDI_SYSTEM_MESSAGES.reset,void 0,this._parseTimeParameter(e.time)),this},a.prototype.stopNote=function(e,t,n){if("all"===e)return this.sendChannelMode("allnotesoff",0,t,n);var i=64;return(n=n||{}).rawVelocity?!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=127&&(i=n.velocity):!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=1&&(i=127*n.velocity),this._convertNoteToArray(e).forEach(function(e){r.toMIDIChannels(t).forEach(function(t){this.send((r.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(i)],this._parseTimeParameter(n.time))}.bind(this))}.bind(this)),this},a.prototype.playNote=function(e,t,n){var i,a=64;if((n=n||{}).rawVelocity?!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=127&&(a=n.velocity):!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=1&&(a=127*n.velocity),i=this._parseTimeParameter(n.time),this._convertNoteToArray(e).forEach(function(e){r.toMIDIChannels(t).forEach(function(t){this.send((r.MIDI_CHANNEL_MESSAGES.noteon<<4)+(t-1),[e,Math.round(a)],i)}.bind(this))}.bind(this)),!isNaN(n.duration)){n.duration<=0&&(n.duration=0);var s=64;n.rawVelocity?!isNaN(n.release)&&0<=n.release&&n.release<=127&&(s=n.release):!isNaN(n.release)&&0<=n.release&&n.release<=1&&(s=127*n.release),this._convertNoteToArray(e).forEach(function(e){r.toMIDIChannels(t).forEach(function(t){this.send((r.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(s)],(i||r.time)+n.duration)}.bind(this))}.bind(this))}return this},a.prototype.sendKeyAftertouch=function(e,t,n,i){var a=this;if(i=i||{},t<1||16<t)throw new RangeError("The channel must be between 1 and 16.");(isNaN(n)||n<0||1<n)&&(n=.5);var s=Math.round(127*n);return this._convertNoteToArray(e).forEach((function(e){r.toMIDIChannels(t).forEach((function(t){a.send((r.MIDI_CHANNEL_MESSAGES.keyaftertouch<<4)+(t-1),[e,s],a._parseTimeParameter(i.time))}))})),this},a.prototype.sendControlChange=function(e,t,n,i){if(i=i||{},"string"==typeof e){if(void 0===(e=r.MIDI_CONTROL_CHANGE_MESSAGES[e]))throw new TypeError("Invalid controller name.")}else if(!(0<=(e=Math.floor(e))&&e<=119))throw new RangeError("Controller numbers must be between 0 and 119.");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("Controller value must be between 0 and 127.");return r.toMIDIChannels(n).forEach(function(n){this.send((r.MIDI_CHANNEL_MESSAGES.controlchange<<4)+(n-1),[e,t],this._parseTimeParameter(i.time))}.bind(this)),this},a.prototype._selectRegisteredParameter=function(e,t,n){var i=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The control65 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw new RangeError("The control64 value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.sendControlChange(101,e[0],t,{time:n}),i.sendControlChange(100,e[1],t,{time:n})})),this},a.prototype._selectNonRegisteredParameter=function(e,t,n){var i=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The control63 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw new RangeError("The control62 value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.sendControlChange(99,e[0],t,{time:n}),i.sendControlChange(98,e[1],t,{time:n})})),this},a.prototype._setCurrentRegisteredParameter=function(e,t,n){var i=this;if((e=[].concat(e))[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The msb value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.sendControlChange(6,e[0],t,{time:n})})),e[1]=Math.floor(e[1]),0<=e[1]&&e[1]<=127&&r.toMIDIChannels(t).forEach((function(){i.sendControlChange(38,e[1],t,{time:n})})),this},a.prototype._deselectRegisteredParameter=function(e,t){var n=this;return r.toMIDIChannels(e).forEach((function(){n.sendControlChange(101,127,e,{time:t}),n.sendControlChange(100,127,e,{time:t})})),this},a.prototype.setRegisteredParameter=function(e,t,n,i){var a=this;if(i=i||{},!Array.isArray(e)){if(!r.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=r.MIDI_REGISTERED_PARAMETER[e]}return r.toMIDIChannels(n).forEach((function(){a._selectRegisteredParameter(e,n,i.time),a._setCurrentRegisteredParameter(t,n,i.time),a._deselectRegisteredParameter(n,i.time)})),this},a.prototype.setNonRegisteredParameter=function(e,t,n,i){var a=this;if(i=i||{},!(0<=e[0]&&e[0]<=127&&0<=e[1]&&e[1]<=127))throw new Error("Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.");return t=[].concat(t),r.toMIDIChannels(n).forEach((function(){a._selectNonRegisteredParameter(e,n,i.time),a._setCurrentRegisteredParameter(t,n,i.time),a._deselectRegisteredParameter(n,i.time)})),this},a.prototype.incrementRegisteredParameter=function(e,t,n){var i=this;if(n=n||{},!Array.isArray(e)){if(!r.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=r.MIDI_REGISTERED_PARAMETER[e]}return r.toMIDIChannels(t).forEach((function(){i._selectRegisteredParameter(e,t,n.time),i.sendControlChange(96,0,t,{time:n.time}),i._deselectRegisteredParameter(t,n.time)})),this},a.prototype.decrementRegisteredParameter=function(e,t,n){if(n=n||{},!Array.isArray(e)){if(!r.MIDI_REGISTERED_PARAMETER[e])throw new TypeError("The specified parameter is not available.");e=r.MIDI_REGISTERED_PARAMETER[e]}return r.toMIDIChannels(t).forEach(function(){this._selectRegisteredParameter(e,t,n.time),this.sendControlChange(97,0,t,{time:n.time}),this._deselectRegisteredParameter(t,n.time)}.bind(this)),this},a.prototype.setPitchBendRange=function(e,t,n,i){var a=this;if(i=i||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The semitones value must be between 0 and 127");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("The cents value must be between 0 and 127");return r.toMIDIChannels(n).forEach((function(){a.setRegisteredParameter("pitchbendrange",[e,t],n,{time:i.time})})),this},a.prototype.setModulationRange=function(e,t,n,i){var a=this;if(i=i||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The semitones value must be between 0 and 127");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("The cents value must be between 0 and 127");return r.toMIDIChannels(n).forEach((function(){a.setRegisteredParameter("modulationrange",[e,t],n,{time:i.time})})),this},a.prototype.setMasterTuning=function(e,t,n){var i=this;if(n=n||{},(e=parseFloat(e)||0)<=-65||64<=e)throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");var a=Math.floor(e)+64,s=e-Math.floor(e),o=(s=Math.round((s+1)/2*16383))>>7&127,c=127&s;return r.toMIDIChannels(t).forEach((function(){i.setRegisteredParameter("channelcoarsetuning",a,t,{time:n.time}),i.setRegisteredParameter("channelfinetuning",[o,c],t,{time:n.time})})),this},a.prototype.setTuningProgram=function(e,t,n){var i=this;if(n=n||{},!(0<=(e=Math.floor(e))&&e<=127))throw new RangeError("The program value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.setRegisteredParameter("tuningprogram",e,t,{time:n.time})})),this},a.prototype.setTuningBank=function(e,t,n){var i=this;if(n=n||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The bank value must be between 0 and 127");return r.toMIDIChannels(t).forEach((function(){i.setRegisteredParameter("tuningbank",e,t,{time:n.time})})),this},a.prototype.sendChannelMode=function(e,t,n,i){if(i=i||{},"string"==typeof e){if(!(e=r.MIDI_CHANNEL_MODE_MESSAGES[e]))throw new TypeError("Invalid channel mode message name.")}else if(!(120<=(e=Math.floor(e))&&e<=127))throw new RangeError("Channel mode numerical identifiers must be between 120 and 127.");if((t=Math.floor(t)||0)<0||127<t)throw new RangeError("Value must be an integer between 0 and 127.");return r.toMIDIChannels(n).forEach(function(n){this.send((r.MIDI_CHANNEL_MESSAGES.channelmode<<4)+(n-1),[e,t],this._parseTimeParameter(i.time))}.bind(this)),this},a.prototype.sendProgramChange=function(e,t,n){var i=this;if(n=n||{},e=Math.floor(e),isNaN(e)||e<0||127<e)throw new RangeError("Program numbers must be between 0 and 127.");return r.toMIDIChannels(t).forEach((function(t){i.send((r.MIDI_CHANNEL_MESSAGES.programchange<<4)+(t-1),[e],i._parseTimeParameter(n.time))})),this},a.prototype.sendChannelAftertouch=function(e,t,n){var i=this;n=n||{},e=parseFloat(e),(isNaN(e)||e<0||1<e)&&(e=.5);var a=Math.round(127*e);return r.toMIDIChannels(t).forEach((function(e){i.send((r.MIDI_CHANNEL_MESSAGES.channelaftertouch<<4)+(e-1),[a],i._parseTimeParameter(n.time))})),this},a.prototype.sendPitchBend=function(e,t,n){var i=this;if(n=n||{},isNaN(e)||e<-1||1<e)throw new RangeError("Pitch bend value must be between -1 and 1.");var a=Math.round((e+1)/2*16383),s=a>>7&127,o=127&a;return r.toMIDIChannels(t).forEach((function(e){i.send((r.MIDI_CHANNEL_MESSAGES.pitchbend<<4)+(e-1),[o,s],i._parseTimeParameter(n.time))})),this},a.prototype._parseTimeParameter=function(e){var t,n=parseFloat(e);return"string"==typeof e&&"+"===e.substring(0,1)?n&&0<n&&(t=r.time+n):n>r.time&&(t=n),t},a.prototype._convertNoteToArray=function(e){var t=[];return Array.isArray(e)||(e=[e]),e.forEach((function(e){t.push(r.guessNoteNumber(e))})),t},e.exports?e.exports=r:t.WebMidi||(t.WebMidi=r)}(Ci)}(ki)),ki.exports);const Ei=d(Si),Mi=(e,t)=>Array(Math.abs(t)+1).join(e);function Ti(e){return null!==e&&"object"==typeof e&&"string"==typeof e.name}function Ni(e){return null!==e&&"object"==typeof e&&"number"==typeof e.step&&"number"==typeof e.alt}const Ai=[0,2,4,-1,1,3,5],Pi=Ai.map((e=>Math.floor(7*e/12)));function Ii(e){const{step:t,alt:n,oct:r,dir:i=1}=e,a=Ai[t]+7*n;if(void 0===r)return[i*a];return[i*a,i*(r-Pi[t]-4*n)]}const Di=[3,0,4,1,5,2,6];function Bi(e){const[t,n,r]=e,i=Di[function(e){const t=(e+1)%7;return t<0?7+t:t}(t)],a=Math.floor((t+1)/7);if(void 0===n)return{step:i,alt:a,dir:r};return{step:i,alt:a,oct:n+4*a+Pi[i],dir:r}}const Oi={empty:!0,name:"",pc:"",acc:""},Li=new Map;function Vi(e){const t=Li.get(e);if(t)return t;const n="string"==typeof e?function(e){const t=function(e){const t=Ri.exec(e);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}(e);if(""===t[0]||""!==t[3])return Oi;const n=t[0],r=t[1],i=t[2],a=(n.charCodeAt(0)+3)%7,s=(e=>"b"===e[0]?-e.length:e.length)(r),o=i.length?+i:void 0,c=Ii({step:a,alt:s,oct:o}),l=n+r+i,u=n+r,h=(ji[a]+s+120)%12,d=void 0===o?zi(ji[a]+s,12)-1188:ji[a]+s+12*(o+1),f=d>=0&&d<=127?d:null,p=void 0===o?null:440*Math.pow(2,(d-69)/12);return{empty:!1,acc:r,alt:s,chroma:h,coord:c,freq:p,height:d,letter:n,midi:f,name:l,oct:o,pc:u,step:a}}(e):Ni(e)?Vi(function(e){const{step:t,alt:n,oct:r}=e,i=(e=>"CDEFGAB".charAt(e))(t);if(!i)return"";const a=i+(e=>e<0?Mi("b",-e):Mi("#",e))(n);return r||0===r?a+r:a}(e)):Ti(e)?Vi(e.name):Oi;return Li.set(e,n),n}const Ri=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function Fi(e){return Vi(Bi(e))}const zi=(e,t)=>(e%t+t)%t,ji=[0,2,4,5,7,9,11];const qi={empty:!0,name:"",acc:""},Hi=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$");const Ui={};function Gi(e){return"string"==typeof e?Ui[e]||(Ui[e]=function(e){const t=function(e){const t=Hi.exec(`${e}`);return null===t?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}(e);if(""===t[0])return qi;const n=+t[0],r=t[1],i=(Math.abs(n)-1)%7,a=Yi[i];if("M"===a&&"P"===r)return qi;const s="M"===a?"majorable":"perfectable",o=""+n+r,c=n<0?-1:1,l=8===n||-8===n?n:c*(i+1),u=function(e,t){return"M"===t&&"majorable"===e||"P"===t&&"perfectable"===e?0:"m"===t&&"majorable"===e?-1:/^A+$/.test(t)?t.length:/^d+$/.test(t)?-1*("perfectable"===e?t.length:t.length+1):0}(s,r),h=Math.floor((Math.abs(n)-1)/7),d=c*(Wi[i]+u+12*h),f=(c*(Wi[i]+u)%12+12)%12,p=Ii({step:i,alt:u,oct:h,dir:c});return{empty:!1,name:o,num:n,q:r,step:i,alt:u,dir:c,type:s,simple:l,semitones:d,chroma:f,coord:p,oct:h}}(e)):Ni(e)?Gi(function(e){const{step:t,alt:n,oct:r=0,dir:i}=e;if(!i)return"";const a=t+1+7*r,s=i<0?"-":"",o="M"===Yi[t]?"majorable":"perfectable";return s+a+function(e,t){return 0===t?"majorable"===e?"M":"P":-1===t&&"majorable"===e?"m":t>0?Mi("A",t):Mi("d","perfectable"===e?t:t+1)}(o,n)}(e)):Ti(e)?Gi(e.name):qi}const Wi=[0,2,4,5,7,9,11],Yi="PMMPPMM";function $i(e){const[t,n=0]=e;return Gi(Bi(7*t+12*n<0?[-t,-n,-1]:[t,n,1]))}function Ki(e,t){const n=Vi(e),r=Gi(t);if(n.empty||r.empty)return"";const i=n.coord,a=r.coord;return Fi(1===i.length?[i[0]+a[0]]:[i[0]+a[0],i[1]+a[1]]).name}const Qi={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},Xi=e=>Number(e).toString(2),Zi=e=>parseInt(e,2),Ji=/^[01]{12}$/;function ea(e){return Ji.test(e)}const ta={[Qi.chroma]:Qi};function na(e){const t=ea(e)?e:"number"==typeof(n=e)&&n>=0&&n<=4095?Xi(e):Array.isArray(e)?function(e){if(0===e.length)return Qi.chroma;let t;const n=[0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++)t=Vi(e[r]),t.empty&&(t=Gi(e[r])),t.empty||(n[t.chroma]=1);return n.join("")}(e):(e=>e&&ea(e.chroma))(e)?e.chroma:Qi.chroma;var n;return ta[t]=ta[t]||function(e){const t=Zi(e),n=function(e){const t=e.split("");return t.map(((e,n)=>function(e,t){const n=t.length,r=(e%n+n)%n;return t.slice(r,n).concat(t.slice(0,r))}(n,t).join("")))}(e).map(Zi).filter((e=>e>=2048)).sort()[0],r=Xi(n),i=ia(e);return{empty:!1,name:"",setNum:t,chroma:e,normalized:r,intervals:i}}(t)}const ra=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function ia(e){const t=[];for(let n=0;n<12;n++)"1"===e.charAt(n)&&t.push(ra[n]);return t}let aa=[],sa={};function oa(e,t,n){const r=function(e){const t=t=>-1!==e.indexOf(t);return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}(e),i={...na(e),name:n||"",quality:r,intervals:e,aliases:t};aa.push(i),i.name&&(sa[i.name]=i),sa[i.setNum]=i,sa[i.chroma]=i,i.aliases.forEach((e=>function(e,t){sa[t]=e}(i,e)))}[["1P 3M 5P","major","M ^ "],["1P 3M 5P 7M","major seventh","maj7 Δ ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 Δ9 ^9"],["1P 3M 5P 7M 9M 13M","major thirteenth","maj13 Maj13 ^13"],["1P 3M 5P 6M","sixth","6 add6 add13 M6"],["1P 3M 5P 6M 9M","sixth/ninth","6/9 69 M69"],["1P 3M 6m 7M","major seventh flat sixth","M7b6 ^7b6"],["1P 3M 5P 7M 11A","major seventh sharp eleventh","maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11"],["1P 3m 5P","minor","m min -"],["1P 3m 5P 7m","minor seventh","m7 min7 mi7 -7"],["1P 3m 5P 7M","minor/major seventh","m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7"],["1P 3m 5P 6M","minor sixth","m6 -6"],["1P 3m 5P 7m 9M","minor ninth","m9 -9"],["1P 3m 5P 7M 9M","minor/major ninth","mM9 mMaj9 -^9"],["1P 3m 5P 7m 9M 11P","minor eleventh","m11 -11"],["1P 3m 5P 7m 9M 13M","minor thirteenth","m13 -13"],["1P 3m 5d","diminished","dim ° o"],["1P 3m 5d 7d","diminished seventh","dim7 °7 o7"],["1P 3m 5d 7m","half-diminished","m7b5 ø -7b5 h7 h"],["1P 3M 5P 7m","dominant seventh","7 dom"],["1P 3M 5P 7m 9M","dominant ninth","9"],["1P 3M 5P 7m 9M 13M","dominant thirteenth","13"],["1P 3M 5P 7m 11A","lydian dominant seventh","7#11 7#4"],["1P 3M 5P 7m 9m","dominant flat ninth","7b9"],["1P 3M 5P 7m 9A","dominant sharp ninth","7#9"],["1P 3M 7m 9m","altered","alt7"],["1P 4P 5P","suspended fourth","sus4 sus"],["1P 2M 5P","suspended second","sus2"],["1P 4P 5P 7m","suspended fourth seventh","7sus4 7sus"],["1P 5P 7m 9M 11P","eleventh","11"],["1P 4P 5P 7m 9m","suspended fourth flat ninth","b9sus phryg 7b9sus 7b9sus4"],["1P 5P","fifth","5"],["1P 3M 5A","augmented","aug + +5 ^#5"],["1P 3m 5A","minor augmented","m#5 -#5 m+"],["1P 3M 5A 7M","augmented seventh","maj7#5 maj7+5 +maj7 ^7#5"],["1P 3M 5P 7M 9M 11A","major sharp eleventh (lydian)","maj9#11 Δ9#11 ^9#11"],["1P 2M 4P 5P","","sus24 sus4add9"],["1P 3M 5A 7M 9M","","maj9#5 Maj9#5"],["1P 3M 5A 7m","","7#5 +7 7+ 7aug aug7"],["1P 3M 5A 7m 9A","","7#5#9 7#9#5 7alt"],["1P 3M 5A 7m 9M","","9#5 9+"],["1P 3M 5A 7m 9M 11A","","9#5#11"],["1P 3M 5A 7m 9m","","7#5b9 7b9#5"],["1P 3M 5A 7m 9m 11A","","7#5b9#11"],["1P 3M 5A 9A","","+add#9"],["1P 3M 5A 9M","","M#5add9 +add9"],["1P 3M 5P 6M 11A","","M6#11 M6b5 6#11 6b5"],["1P 3M 5P 6M 7M 9M","","M7add13"],["1P 3M 5P 6M 9M 11A","","69#11"],["1P 3m 5P 6M 9M","","m69 -69"],["1P 3M 5P 6m 7m","","7b6"],["1P 3M 5P 7M 9A 11A","","maj7#9#11"],["1P 3M 5P 7M 9M 11A 13M","","M13#11 maj13#11 M13+4 M13#4"],["1P 3M 5P 7M 9m","","M7b9"],["1P 3M 5P 7m 11A 13m","","7#11b13 7b5b13"],["1P 3M 5P 7m 13M","","7add6 67 7add13"],["1P 3M 5P 7m 9A 11A","","7#9#11 7b5#9 7#9b5"],["1P 3M 5P 7m 9A 11A 13M","","13#9#11"],["1P 3M 5P 7m 9A 11A 13m","","7#9#11b13"],["1P 3M 5P 7m 9A 13M","","13#9"],["1P 3M 5P 7m 9A 13m","","7#9b13"],["1P 3M 5P 7m 9M 11A","","9#11 9+4 9#4"],["1P 3M 5P 7m 9M 11A 13M","","13#11 13+4 13#4"],["1P 3M 5P 7m 9M 11A 13m","","9#11b13 9b5b13"],["1P 3M 5P 7m 9m 11A","","7b9#11 7b5b9 7b9b5"],["1P 3M 5P 7m 9m 11A 13M","","13b9#11"],["1P 3M 5P 7m 9m 11A 13m","","7b9b13#11 7b9#11b13 7b5b9b13"],["1P 3M 5P 7m 9m 13M","","13b9"],["1P 3M 5P 7m 9m 13m","","7b9b13"],["1P 3M 5P 7m 9m 9A","","7b9#9"],["1P 3M 5P 9M","","Madd9 2 add9 add2"],["1P 3M 5P 9m","","Maddb9"],["1P 3M 5d","","Mb5"],["1P 3M 5d 6M 7m 9M","","13b5"],["1P 3M 5d 7M","","M7b5"],["1P 3M 5d 7M 9M","","M9b5"],["1P 3M 5d 7m","","7b5"],["1P 3M 5d 7m 9M","","9b5"],["1P 3M 7m","","7no5"],["1P 3M 7m 13m","","7b13"],["1P 3M 7m 9M","","9no5"],["1P 3M 7m 9M 13M","","13no5"],["1P 3M 7m 9M 13m","","9b13"],["1P 3m 4P 5P","","madd4"],["1P 3m 5P 6m 7M","","mMaj7b6"],["1P 3m 5P 6m 7M 9M","","mMaj9b6"],["1P 3m 5P 7m 11P","","m7add11 m7add4"],["1P 3m 5P 9M","","madd9"],["1P 3m 5d 6M 7M","","o7M7"],["1P 3m 5d 7M","","oM7"],["1P 3m 6m 7M","","mb6M7"],["1P 3m 6m 7m","","m7#5"],["1P 3m 6m 7m 9M","","m9#5"],["1P 3m 5A 7m 9M 11P","","m11A"],["1P 3m 6m 9m","","mb6b9"],["1P 2M 3m 5d 7m","","m9b5"],["1P 4P 5A 7M","","M7#5sus4"],["1P 4P 5A 7M 9M","","M9#5sus4"],["1P 4P 5A 7m","","7#5sus4"],["1P 4P 5P 7M","","M7sus4"],["1P 4P 5P 7M 9M","","M9sus4"],["1P 4P 5P 7m 9M","","9sus4 9sus"],["1P 4P 5P 7m 9M 13M","","13sus4 13sus"],["1P 4P 5P 7m 9m 13m","","7sus4b9b13 7b9b13sus4"],["1P 4P 7m 10m","","4 quartal"],["1P 5P 7m 9m 11P","","11b9"]].forEach((([e,t,n])=>oa(e.split(" "),n.split(" "),t))),aa.sort(((e,t)=>e.setNum-t.setNum));let ca={};function la(e,t,n=[]){const r={...na(e),name:t,intervals:e,aliases:n};return ca[r.name]=r,ca[r.setNum]=r,ca[r.chroma]=r,r.aliases.forEach((e=>function(e,t){ca[t]=e}(r,e))),r}[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 3m 4d 5d 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","·superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 5d 5P 6M 7m","romanian minor"],["1P 2M 3m 4A 5P 6M 7m","dorian #4"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]].forEach((([e,t,...n])=>la(e.split(" "),t,n)));[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]].forEach((([e,t,n])=>{}));const ua=Gi;const ha=[1,2,2,3,3,4,5,5,6,6,7,7],da="P m M m M P d P m M m M".split(" ");const fa=function(e,t){const n=Vi(e),r=Vi(t);if(n.empty||r.empty)return"";const i=n.coord,a=r.coord,s=a[0]-i[0];return $i([s,2===i.length&&2===a.length?a[1]-i[1]:-Math.floor(7*s/12)]).name},pa=va(((e,t)=>[e[0]+t[0],e[1]+t[1]])),ma=va(((e,t)=>[e[0]-t[0],e[1]-t[1]]));var ga={names:function(){return"1P 2M 3M 4P 5P 6m 7m".split(" ")},get:ua,name:e=>Gi(e).name,num:e=>Gi(e).num,semitones:e=>Gi(e).semitones,quality:e=>Gi(e).q,fromSemitones:function(e){const t=e<0?-1:1,n=Math.abs(e),r=n%12,i=Math.floor(n/12);return t*(ha[r]+7*i)+da[r]},distance:fa,invert:function(e){const t=Gi(e);return t.empty?"":Gi({step:(7-t.step)%7,alt:"perfectable"===t.type?-t.alt:-(t.alt+1),oct:t.oct,dir:t.dir}).name},simplify:function(e){const t=Gi(e);return t.empty?"":t.simple+t.q},add:pa,addTo:e=>t=>pa(e,t),substract:ma};function va(e){return(t,n)=>{const r=Gi(t).coord,i=Gi(n).coord;if(r&&i){return $i(e(r,i)).name}}}const ya=Math.log(2),ba=Math.log(440);function _a(e){const t=12*(Math.log(e)-ba)/ya+69;return Math.round(100*t)/100}const wa="C C# D D# E F F# G G# A A# B".split(" "),xa="C Db D Eb E F Gb G Ab A Bb B".split(" ");function ka(e,t={}){if(isNaN(e)||e===-1/0||e===1/0)return"";e=Math.round(e);const n=(!0===t.sharps?wa:xa)[e%12];if(t.pitchClass)return n;return n+(Math.floor(e/12)-1)}const Ca=["C","D","E","F","G","A","B"],Sa=e=>e.name,Ea=e=>e.map(Vi).filter((e=>!e.empty));const Ma=Vi;const Ta=Ki,Na=Ki,Aa=e=>t=>Ta(t,e),Pa=Aa,Ia=e=>t=>Ta(e,t),Da=Ia;function Ba(e,t){const n=Ma(e);if(n.empty)return"";const[r,i]=n.coord;return Fi(void 0===i?[r+t]:[r+t,i]).name}const Oa=Ba,La=(e,t)=>e.height-t.height;function Va(e,t){return t=t||La,Ea(e).sort(t).map(Sa)}const Ra=za(!0),Fa=za(!1);function za(e){return t=>{const n=Ma(t);if(n.empty)return"";const r=e?n.alt>0:n.alt<0,i=null===n.midi;return ka(n.midi||n.chroma,{sharps:r,pitchClass:i})}}var ja={names:function(e){return void 0===e?Ca.slice():Array.isArray(e)?Ea(e).map(Sa):[]},get:Ma,name:e=>Ma(e).name,pitchClass:e=>Ma(e).pc,accidentals:e=>Ma(e).acc,octave:e=>Ma(e).oct,midi:e=>Ma(e).midi,ascending:La,descending:(e,t)=>t.height-e.height,sortedNames:Va,sortedUniqNames:function(e){return Va(e,La).filter(((e,t,n)=>0===t||e!==n[t-1]))},fromMidi:function(e){return ka(e)},fromMidiSharps:function(e){return ka(e,{sharps:!0})},freq:e=>Ma(e).freq,fromFreq:function(e){return ka(_a(e))},fromFreqSharps:function(e){return ka(_a(e),{sharps:!0})},chroma:e=>Ma(e).chroma,transpose:Ta,tr:Na,transposeBy:Aa,trBy:Pa,transposeFrom:Ia,trFrom:Da,transposeFifths:Ba,trFifths:Oa,simplify:Ra,enharmonic:Fa};const qa=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]].map((function(e){const[t,n,r,i,a,s,o]=e,c=o?[o]:[],l=Number(n).toString(2);return{empty:!1,intervals:ia(l),modeNum:t,chroma:l,normalized:l,name:i,setNum:n,alt:r,triad:a,seventh:s,aliases:c}})),Ha={};function Ua(e,t){return e.map((e=>function(e,t){const n={...e},r=ja.transpose(e.note.name+e.note.octave,ga.fromSemitones(t));return n.note={name:ja.pitchClass(r),number:e.note.number+t,octave:ja.octave(r)},n}(e,t)))}function Ga(e){const t=[];e=e.filter((e=>"noteon"===e.type)).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 Syllable(e.slice(r,r+n))),e.splice(r,n),r=-1}catch{}return new SyllableSequence(t)}qa.forEach((e=>{Ha[e.name]=e,e.aliases.forEach((t=>{Ha[t]=e}))}));class SyllableSequence{constructor(e){u(this,"syllables"),u(this,"rootNote"),e.length>0?(this.syllables=e.sort(((e,t)=>e.timestamp-t.timestamp)),this.rootNote=this.syllables[0].notes.reduce(((e,t)=>t.note.number<e.note.number?t:e)).note):(this.syllables=[],this.rootNote={name:"C",octave:4,number:0})}append(e){if(this.syllables.length)try{const t=new Syllable(this.syllables[this.syllables.length-1].notes.map((e=>({note:e.note,timestamp:e.timestamp,type:e.type,velocity:e.velocity}))).concat(e));this.syllables.splice(this.syllables.length-1,1,t)}catch{this.syllables.push(new Syllable([e]))}else this.syllables.push(new Syllable([e])),this.rootNote=e.note}grade(e){const t=[];for(let 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=>{!1===t.isCorrect?e=!1:t.notes.forEach((t=>{!1===t.isCorrect&&(e=!1)}))})),e}}class Syllable{constructor(e){u(this,"notes"),u(this,"isCorrect");const t=(e=e.filter((e=>"noteon"===e.type))).reduce(((e,t)=>e.timestamp<t.timestamp?e:t)),n=e.reduce(((e,t)=>e.timestamp>t.timestamp?e:t)).timestamp-t.timestamp;if(Syllable.gracePeriod(e.length)<n)throw new Error(`Notes ${e.toString()} are not close enough together to be a syllable`);this.notes=e.map((e=>({...e,isCorrect:!0,isMissing:!1}))).sort(((e,t)=>e.note.number-t.note.number))}get timestamp(){let e=0;return this.notes.forEach((t=>{if(0===t.timestamp)return 0;e+=t.timestamp})),e/=this.notes.length,e}static gracePeriod(e){return 1.3*12*e}grade(e){return this.notes.length!==e.notes.length&&(e.isCorrect=!1),e.notes.forEach((t=>{let n=ja.fromMidi(t.note.number),r=ja.fromMidiSharps(t.note.number);n=ja.pitchClass(n),r=ja.pitchClass(r),t.isCorrect=this.notes.filter((e=>ja.chroma(n)===ja.chroma(e.note.name)||ja.chroma(r)===ja.chroma(e.note.name))).length>=1,t.isCorrect||(e.isCorrect=!1)})),this.notes.forEach((t=>{let n=ja.fromMidi(t.note.number);n=ja.pitchClass(n),e.notes.some((e=>ja.chroma(e.note.name)===ja.chroma(n)))||e.notes.push({...t,isMissing:!0,isCorrect:!1})})),e}}const Wa=class _SkMidi2{constructor(e){u(this,"recording",[]),u(this,"webmidi",Ei),u(this,"input"),u(this,"output"),u(this,"_noteonListeners",[]),u(this,"_noteoffListeners",[]),u(this,"midiAccess"),u(this,"_state","initializing"),u(this,"_userLookup"),this._userLookup=e??null}get state(){return this._state}async init(){if(!this.midiAccess)try{navigator.requestMIDIAccess().then((e=>{this.midiAccess=e,this.midiAccess.onstatechange=e=>{n.alertUser({text:`Midi device ${e.port.name} is ${e.port.state}`,status:"connected"===e.port.state?r.Status.ok:r.Status.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],_SkMidi2._initializedWithUserConfig||(await this.loadUserConfiguration(),_SkMidi2._initializedWithUserConfig=!0),this.input&&this.output?(console.log("midi init state: ready"),this._state="ready",this.attachListeners()):(console.log("midi init state: nodevice"),this._state="nodevice"),e(!0))}))}))}async loadUserConfiguration(){try{if(!this._userLookup)return void console.log("User lookup function not provided - using default MIDI configuration");const e=await this._userLookup();if(!e)return void console.log("No user found, using default MIDI configuration");const t=await e.getActiveCourses();for(const n of t){const t=await e.getCourseInterface(n.courseID),r=await t.getCourseSettings();if((null==r?void 0:r.midiinput)||(null==r?void 0:r.midioutput)){r.midiinput&&this.webmidi.getInputById(r.midiinput.toString())&&(this.selectInput(r.midiinput.toString()),console.log(`Loaded saved MIDI input: ${r.midiinput}`)),r.midioutput&&this.webmidi.getOutputById(r.midioutput.toString())&&(this.selectOutput(r.midioutput.toString()),console.log(`Loaded saved MIDI output: ${r.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()})),n.alertUser({text:`Midi device ${t.port.name} is ${t.port.state}`,status:"connected"===t.port.state?r.Status.ok:r.Status.error})};else try{navigator.requestMIDIAccess().then((t=>{this.midiAccess=t,this.midiAccess.onstatechange=t=>{this.init().then((()=>{console.log(`Midi state: ${this.state}`),e()})),n.alertUser({text:`Midi device ${t.port.name} is ${t.port.state}`,status:"connected"===t.port.state?r.Status.ok:r.Status.error})}}))}catch(t){console.log(`Webmidi not enabled: ${t}`),this._state="notsupported"}}attachListeners(){this.input&&(this._noteonListeners.forEach((e=>{var t;null==(t=this.input)||t.on("noteon","all",e)})),this._noteoffListeners.forEach((e=>{var t;null==(t=this.input)||t.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(){var e;null==(e=this.input)||e.removeListener()}record(){let e=0;if(void 0===this.input)throw new Error("Midi input not configured!");"open"===this.input.connection&&(this.stopRecording(),this.eraseRecording(),this.input.on("noteon","all",(t=>{0===this.recording.length&&(e=t.timestamp),this.recording.push({note:t.note,type:t.type,velocity:t.velocity,timestamp:t.timestamp-e})})),this.input.on("noteoff","all",(t=>{0===this.recording.length&&(e=t.timestamp),this.recording.push({note:t.note,velocity:t.velocity,type:t.type,timestamp:t.timestamp-e})})))}addNoteonListenter(e){this._noteonListeners.push(e),this.input&&this.input.on("noteon","all",e)}addNoteoffListenter(e){this._noteoffListeners.push(e),this.input&&this.input.on("noteoff","all",e)}play(e){let t=e||this.recording;t=t.map((e=>({...e,timestamp:e.timestamp+_SkMidi2.OFFSET}))),t.forEach((e=>{var t,n;"noteon"===e.type?null==(t=this.output)||t.playNote(e.note.name+e.note.octave,1,{velocity:e.velocity,time:`+${e.timestamp}`,rawVelocity:!1}):null==(n=this.output)||n.stopNote(e.note.name+e.note.octave,1,{velocity:e.velocity,time:`+${e.timestamp}`,rawVelocity:!1})}))}static async instance(){return _SkMidi2._instance||(console.log("Buzz, whirr, Midi instance factory is at work"),_SkMidi2._instance=new _SkMidi2,await _SkMidi2._instance.init()),_SkMidi2._instance}get inputs(){return this.webmidi.inputs}get outputs(){return this.webmidi.outputs}selectInput(e){!1!==this.webmidi.getInputById(e)?this.input=this.webmidi.getInputById(e):!1!==this.webmidi.getInputByName(e)&&(this.input=this.webmidi.getInputByName(e))}selectOutput(e){!1!==this.webmidi.getOutputById(e)?this.output=this.webmidi.getOutputById(e):!1!==this.webmidi.getOutputByName(e)&&(this.output=this.webmidi.getOutputByName(e))}};u(Wa,"_instance"),u(Wa,"OFFSET",5),u(Wa,"_initializedWithUserConfig",!1);let Ya=Wa;
|
|
67
|
+
//! moment.js
|
|
68
|
+
//! version : 2.30.1
|
|
69
|
+
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
70
|
+
//! license : MIT
|
|
71
|
+
//! momentjs.com
|
|
72
|
+
var $a,Ka;function Qa(){return $a.apply(null,arguments)}function Xa(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function Za(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function Ja(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function es(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(Ja(e,t))return!1;return!0}function ts(e){return void 0===e}function ns(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function rs(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function is(e,t){var n,r=[],i=e.length;for(n=0;n<i;++n)r.push(t(e[n],n));return r}function as(e,t){for(var n in t)Ja(t,n)&&(e[n]=t[n]);return Ja(t,"toString")&&(e.toString=t.toString),Ja(t,"valueOf")&&(e.valueOf=t.valueOf),e}function ss(e,t,n,r){return Mc(e,t,n,r,!0).utc()}function os(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function cs(e){var t=null,n=!1,r=e._d&&!isNaN(e._d.getTime());return r&&(t=os(e),n=Ka.call(t.parsedDateParts,(function(e){return null!=e})),r=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(r=r&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e)?r:(e._isValid=r,e._isValid)}function ls(e){var t=ss(NaN);return null!=e?as(os(t),e):os(t).userInvalidated=!0,t}Ka=Array.prototype.some?Array.prototype.some:function(e){var t,n=Object(this),r=n.length>>>0;for(t=0;t<r;t++)if(t in n&&e.call(this,n[t],t,n))return!0;return!1};var us=Qa.momentProperties=[],hs=!1;function ds(e,t){var n,r,i,a=us.length;if(ts(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),ts(t._i)||(e._i=t._i),ts(t._f)||(e._f=t._f),ts(t._l)||(e._l=t._l),ts(t._strict)||(e._strict=t._strict),ts(t._tzm)||(e._tzm=t._tzm),ts(t._isUTC)||(e._isUTC=t._isUTC),ts(t._offset)||(e._offset=t._offset),ts(t._pf)||(e._pf=os(t)),ts(t._locale)||(e._locale=t._locale),a>0)for(n=0;n<a;n++)ts(i=t[r=us[n]])||(e[r]=i);return e}function fs(e){ds(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===hs&&(hs=!0,Qa.updateOffset(this),hs=!1)}function ps(e){return e instanceof fs||null!=e&&null!=e._isAMomentObject}function ms(e){!1===Qa.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function gs(e,t){var n=!0;return as((function(){if(null!=Qa.deprecationHandler&&Qa.deprecationHandler(null,e),n){var r,i,a,s=[],o=arguments.length;for(i=0;i<o;i++){if(r="","object"==typeof arguments[i]){for(a in r+="\n["+i+"] ",arguments[0])Ja(arguments[0],a)&&(r+=a+": "+arguments[0][a]+", ");r=r.slice(0,-2)}else r=arguments[i];s.push(r)}ms(e+"\nArguments: "+Array.prototype.slice.call(s).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)}),t)}var vs,ys={};function bs(e,t){null!=Qa.deprecationHandler&&Qa.deprecationHandler(e,t),ys[e]||(ms(t),ys[e]=!0)}function _s(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function ws(e,t){var n,r=as({},e);for(n in t)Ja(t,n)&&(Za(e[n])&&Za(t[n])?(r[n]={},as(r[n],e[n]),as(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);for(n in e)Ja(e,n)&&!Ja(t,n)&&Za(e[n])&&(r[n]=as({},r[n]));return r}function xs(e){null!=e&&this.set(e)}Qa.suppressDeprecationWarnings=!1,Qa.deprecationHandler=null,vs=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)Ja(e,t)&&n.push(t);return n};function ks(e,t,n){var r=""+Math.abs(e),i=t-r.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var Cs=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Ss=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Es={},Ms={};function Ts(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&(Ms[e]=i),t&&(Ms[t[0]]=function(){return ks(i.apply(this,arguments),t[1],t[2])}),n&&(Ms[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function Ns(e,t){return e.isValid()?(t=As(t,e.localeData()),Es[t]=Es[t]||function(e){var t,n,r,i=e.match(Cs);for(t=0,n=i.length;t<n;t++)Ms[i[t]]?i[t]=Ms[i[t]]:i[t]=(r=i[t]).match(/\[[\s\S]/)?r.replace(/^\[|\]$/g,""):r.replace(/\\/g,"");return function(t){var r,a="";for(r=0;r<n;r++)a+=_s(i[r])?i[r].call(t,e):i[r];return a}}(t),Es[t](e)):e.localeData().invalidDate()}function As(e,t){var n=5;function r(e){return t.longDateFormat(e)||e}for(Ss.lastIndex=0;n>=0&&Ss.test(e);)e=e.replace(Ss,r),Ss.lastIndex=0,n-=1;return e}var Ps={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Is(e){return"string"==typeof e?Ps[e]||Ps[e.toLowerCase()]:void 0}function Ds(e){var t,n,r={};for(n in e)Ja(e,n)&&(t=Is(n))&&(r[t]=e[n]);return r}var Bs={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};var Os,Ls=/\d/,Vs=/\d\d/,Rs=/\d{3}/,Fs=/\d{4}/,zs=/[+-]?\d{6}/,js=/\d\d?/,qs=/\d\d\d\d?/,Hs=/\d\d\d\d\d\d?/,Us=/\d{1,3}/,Gs=/\d{1,4}/,Ws=/[+-]?\d{1,6}/,Ys=/\d+/,$s=/[+-]?\d+/,Ks=/Z|[+-]\d\d:?\d\d/gi,Qs=/Z|[+-]\d\d(?::?\d\d)?/gi,Xs=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Zs=/^[1-9]\d?/,Js=/^([1-9]\d|\d)/;function eo(e,t,n){Os[e]=_s(t)?t:function(e,r){return e&&n?n:t}}function to(e,t){return Ja(Os,e)?Os[e](t._strict,t._locale):new RegExp(no(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,r,i){return t||n||r||i}))))}function no(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ro(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function io(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=ro(t)),n}Os={};var ao={};function so(e,t){var n,r,i=t;for("string"==typeof e&&(e=[e]),ns(t)&&(i=function(e,n){n[t]=io(e)}),r=e.length,n=0;n<r;n++)ao[e[n]]=i}function oo(e,t){so(e,(function(e,n,r,i){r._w=r._w||{},t(e,r._w,r,i)}))}function co(e,t,n){null!=t&&Ja(ao,e)&&ao[e](t,n._a,n,e)}function lo(e){return e%4==0&&e%100!=0||e%400==0}var uo=0,ho=1,fo=2,po=3,mo=4,go=5,vo=6,yo=7,bo=8;function _o(e){return lo(e)?366:365}Ts("Y",0,0,(function(){var e=this.year();return e<=9999?ks(e,4):"+"+e})),Ts(0,["YY",2],0,(function(){return this.year()%100})),Ts(0,["YYYY",4],0,"year"),Ts(0,["YYYYY",5],0,"year"),Ts(0,["YYYYYY",6,!0],0,"year"),eo("Y",$s),eo("YY",js,Vs),eo("YYYY",Gs,Fs),eo("YYYYY",Ws,zs),eo("YYYYYY",Ws,zs),so(["YYYYY","YYYYYY"],uo),so("YYYY",(function(e,t){t[uo]=2===e.length?Qa.parseTwoDigitYear(e):io(e)})),so("YY",(function(e,t){t[uo]=Qa.parseTwoDigitYear(e)})),so("Y",(function(e,t){t[uo]=parseInt(e,10)})),Qa.parseTwoDigitYear=function(e){return io(e)+(io(e)>68?1900:2e3)};var wo,xo=ko("FullYear",!0);function ko(e,t){return function(n){return null!=n?(So(this,e,n),Qa.updateOffset(this,t),this):Co(this,e)}}function Co(e,t){if(!e.isValid())return NaN;var n=e._d,r=e._isUTC;switch(t){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function So(e,t,n){var r,i,a,s,o;if(e.isValid()&&!isNaN(n)){switch(r=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}a=n,s=e.month(),o=29!==(o=e.date())||1!==s||lo(a)?o:28,i?r.setUTCFullYear(a,s,o):r.setFullYear(a,s,o)}}function Eo(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,r=(t%(n=12)+n)%n;return e+=(t-r)/12,1===r?lo(e)?29:28:31-r%7%2}wo=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},Ts("M",["MM",2],"Mo",(function(){return this.month()+1})),Ts("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),Ts("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),eo("M",js,Zs),eo("MM",js,Vs),eo("MMM",(function(e,t){return t.monthsShortRegex(e)})),eo("MMMM",(function(e,t){return t.monthsRegex(e)})),so(["M","MM"],(function(e,t){t[ho]=io(e)-1})),so(["MMM","MMMM"],(function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);null!=i?t[ho]=i:os(n).invalidMonth=e}));var Mo="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),To="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),No=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ao=Xs,Po=Xs;function Io(e,t,n){var r,i,a,s=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)a=ss([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(a,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=wo.call(this._shortMonthsParse,s))?i:null:-1!==(i=wo.call(this._longMonthsParse,s))?i:null:"MMM"===t?-1!==(i=wo.call(this._shortMonthsParse,s))||-1!==(i=wo.call(this._longMonthsParse,s))?i:null:-1!==(i=wo.call(this._longMonthsParse,s))||-1!==(i=wo.call(this._shortMonthsParse,s))?i:null}function Do(e,t){if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=io(t);else if(!ns(t=e.localeData().monthsParse(t)))return e;var n=t,r=e.date();return r=r<29?r:Math.min(r,Eo(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,r):e._d.setMonth(n,r),e}function Bo(e){return null!=e?(Do(this,e),Qa.updateOffset(this,!0),this):Co(this,"Month")}function Oo(){function e(e,t){return t.length-e.length}var t,n,r,i,a=[],s=[],o=[];for(t=0;t<12;t++)n=ss([2e3,t]),r=no(this.monthsShort(n,"")),i=no(this.months(n,"")),a.push(r),s.push(i),o.push(i),o.push(r);a.sort(e),s.sort(e),o.sort(e),this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Lo(e,t,n,r,i,a,s){var o;return e<100&&e>=0?(o=new Date(e+400,t,n,r,i,a,s),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,r,i,a,s),o}function Vo(e){var t,n;return e<100&&e>=0?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ro(e,t,n){var r=7+t-n;return-((7+Vo(e,0,r).getUTCDay()-t)%7)+r-1}function Fo(e,t,n,r,i){var a,s,o=1+7*(t-1)+(7+n-r)%7+Ro(e,r,i);return o<=0?s=_o(a=e-1)+o:o>_o(e)?(a=e+1,s=o-_o(e)):(a=e,s=o),{year:a,dayOfYear:s}}function zo(e,t,n){var r,i,a=Ro(e.year(),t,n),s=Math.floor((e.dayOfYear()-a-1)/7)+1;return s<1?r=s+jo(i=e.year()-1,t,n):s>jo(e.year(),t,n)?(r=s-jo(e.year(),t,n),i=e.year()+1):(i=e.year(),r=s),{week:r,year:i}}function jo(e,t,n){var r=Ro(e,t,n),i=Ro(e+1,t,n);return(_o(e)-r+i)/7}Ts("w",["ww",2],"wo","week"),Ts("W",["WW",2],"Wo","isoWeek"),eo("w",js,Zs),eo("ww",js,Vs),eo("W",js,Zs),eo("WW",js,Vs),oo(["w","ww","W","WW"],(function(e,t,n,r){t[r.substr(0,1)]=io(e)}));function qo(e,t){return e.slice(t,7).concat(e.slice(0,t))}Ts("d",0,"do","day"),Ts("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),Ts("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),Ts("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),Ts("e",0,0,"weekday"),Ts("E",0,0,"isoWeekday"),eo("d",js),eo("e",js),eo("E",js),eo("dd",(function(e,t){return t.weekdaysMinRegex(e)})),eo("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),eo("dddd",(function(e,t){return t.weekdaysRegex(e)})),oo(["dd","ddd","dddd"],(function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:os(n).invalidWeekday=e})),oo(["d","e","E"],(function(e,t,n,r){t[r]=io(e)}));var Ho="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Uo="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Go="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Wo=Xs,Yo=Xs,$o=Xs;function Ko(e,t,n){var r,i,a,s=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)a=ss([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(a,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=wo.call(this._weekdaysParse,s))?i:null:"ddd"===t?-1!==(i=wo.call(this._shortWeekdaysParse,s))?i:null:-1!==(i=wo.call(this._minWeekdaysParse,s))?i:null:"dddd"===t?-1!==(i=wo.call(this._weekdaysParse,s))||-1!==(i=wo.call(this._shortWeekdaysParse,s))||-1!==(i=wo.call(this._minWeekdaysParse,s))?i:null:"ddd"===t?-1!==(i=wo.call(this._shortWeekdaysParse,s))||-1!==(i=wo.call(this._weekdaysParse,s))||-1!==(i=wo.call(this._minWeekdaysParse,s))?i:null:-1!==(i=wo.call(this._minWeekdaysParse,s))||-1!==(i=wo.call(this._weekdaysParse,s))||-1!==(i=wo.call(this._shortWeekdaysParse,s))?i:null}function Qo(){function e(e,t){return t.length-e.length}var t,n,r,i,a,s=[],o=[],c=[],l=[];for(t=0;t<7;t++)n=ss([2e3,1]).day(t),r=no(this.weekdaysMin(n,"")),i=no(this.weekdaysShort(n,"")),a=no(this.weekdays(n,"")),s.push(r),o.push(i),c.push(a),l.push(r),l.push(i),l.push(a);s.sort(e),o.sort(e),c.sort(e),l.sort(e),this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Xo(){return this.hours()%12||12}function Zo(e,t){Ts(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function Jo(e,t){return t._meridiemParse}Ts("H",["HH",2],0,"hour"),Ts("h",["hh",2],0,Xo),Ts("k",["kk",2],0,(function(){return this.hours()||24})),Ts("hmm",0,0,(function(){return""+Xo.apply(this)+ks(this.minutes(),2)})),Ts("hmmss",0,0,(function(){return""+Xo.apply(this)+ks(this.minutes(),2)+ks(this.seconds(),2)})),Ts("Hmm",0,0,(function(){return""+this.hours()+ks(this.minutes(),2)})),Ts("Hmmss",0,0,(function(){return""+this.hours()+ks(this.minutes(),2)+ks(this.seconds(),2)})),Zo("a",!0),Zo("A",!1),eo("a",Jo),eo("A",Jo),eo("H",js,Js),eo("h",js,Zs),eo("k",js,Zs),eo("HH",js,Vs),eo("hh",js,Vs),eo("kk",js,Vs),eo("hmm",qs),eo("hmmss",Hs),eo("Hmm",qs),eo("Hmmss",Hs),so(["H","HH"],po),so(["k","kk"],(function(e,t,n){var r=io(e);t[po]=24===r?0:r})),so(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),so(["h","hh"],(function(e,t,n){t[po]=io(e),os(n).bigHour=!0})),so("hmm",(function(e,t,n){var r=e.length-2;t[po]=io(e.substr(0,r)),t[mo]=io(e.substr(r)),os(n).bigHour=!0})),so("hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[po]=io(e.substr(0,r)),t[mo]=io(e.substr(r,2)),t[go]=io(e.substr(i)),os(n).bigHour=!0})),so("Hmm",(function(e,t,n){var r=e.length-2;t[po]=io(e.substr(0,r)),t[mo]=io(e.substr(r))})),so("Hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[po]=io(e.substr(0,r)),t[mo]=io(e.substr(r,2)),t[go]=io(e.substr(i))}));var ec=ko("Hours",!0);var tc,nc={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Mo,monthsShort:To,week:{dow:0,doy:6},weekdays:Ho,weekdaysMin:Go,weekdaysShort:Uo,meridiemParse:/[ap]\.?m?\.?/i},rc={},ic={};function ac(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;n+=1)if(e[n]!==t[n])return n;return r}function sc(e){return e?e.toLowerCase().replace("_","-"):e}function oc(e){var t=null;if(void 0===rc[e]&&"undefined"!=typeof module&&module&&module.exports&&function(e){return!(!e||!e.match("^[^/\\\\]*$"))}(e))try{t=tc._abbr,require("./locale/"+e),cc(t)}catch(n){rc[e]=null}return rc[e]}function cc(e,t){var n;return e&&((n=ts(t)?uc(e):lc(e,t))?tc=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),tc._abbr}function lc(e,t){if(null!==t){var n,r=nc;if(t.abbr=e,null!=rc[e])bs("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=rc[e]._config;else if(null!=t.parentLocale)if(null!=rc[t.parentLocale])r=rc[t.parentLocale]._config;else{if(null==(n=oc(t.parentLocale)))return ic[t.parentLocale]||(ic[t.parentLocale]=[]),ic[t.parentLocale].push({name:e,config:t}),null;r=n._config}return rc[e]=new xs(ws(r,t)),ic[e]&&ic[e].forEach((function(e){lc(e.name,e.config)})),cc(e),rc[e]}return delete rc[e],null}function uc(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return tc;if(!Xa(e)){if(t=oc(e))return t;e=[e]}return function(e){for(var t,n,r,i,a=0;a<e.length;){for(t=(i=sc(e[a]).split("-")).length,n=(n=sc(e[a+1]))?n.split("-"):null;t>0;){if(r=oc(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&ac(i,n)>=t-1)break;t--}a++}return tc}(e)}function hc(e){var t,n=e._a;return n&&-2===os(e).overflow&&(t=n[ho]<0||n[ho]>11?ho:n[fo]<1||n[fo]>Eo(n[uo],n[ho])?fo:n[po]<0||n[po]>24||24===n[po]&&(0!==n[mo]||0!==n[go]||0!==n[vo])?po:n[mo]<0||n[mo]>59?mo:n[go]<0||n[go]>59?go:n[vo]<0||n[vo]>999?vo:-1,os(e)._overflowDayOfYear&&(t<uo||t>fo)&&(t=fo),os(e)._overflowWeeks&&-1===t&&(t=yo),os(e)._overflowWeekday&&-1===t&&(t=bo),os(e).overflow=t),e}var dc=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,fc=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,pc=/Z|[+-]\d\d(?::?\d\d)?/,mc=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],gc=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],vc=/^\/?Date\((-?\d+)/i,yc=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,bc={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _c(e){var t,n,r,i,a,s,o=e._i,c=dc.exec(o)||fc.exec(o),l=mc.length,u=gc.length;if(c){for(os(e).iso=!0,t=0,n=l;t<n;t++)if(mc[t][1].exec(c[1])){i=mc[t][0],r=!1!==mc[t][2];break}if(null==i)return void(e._isValid=!1);if(c[3]){for(t=0,n=u;t<n;t++)if(gc[t][1].exec(c[3])){a=(c[2]||" ")+gc[t][0];break}if(null==a)return void(e._isValid=!1)}if(!r&&null!=a)return void(e._isValid=!1);if(c[4]){if(!pc.exec(c[4]))return void(e._isValid=!1);s="Z"}e._f=i+(a||"")+(s||""),Sc(e)}else e._isValid=!1}function wc(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function xc(e){var t,n,r,i,a,s,o,c,l=yc.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(l){if(n=l[4],r=l[3],i=l[2],a=l[5],s=l[6],o=l[7],c=[wc(n),To.indexOf(r),parseInt(i,10),parseInt(a,10),parseInt(s,10)],o&&c.push(parseInt(o,10)),t=c,!function(e,t,n){return!e||Uo.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(os(n).weekdayMismatch=!0,n._isValid=!1,!1)}(l[1],t,e))return;e._a=t,e._tzm=function(e,t,n){if(e)return bc[e];if(t)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}(l[8],l[9],l[10]),e._d=Vo.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),os(e).rfc2822=!0}else e._isValid=!1}function kc(e,t,n){return null!=e?e:null!=t?t:n}function Cc(e){var t,n,r,i,a,s=[];if(!e._d){for(r=function(e){var t=new Date(Qa.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[fo]&&null==e._a[ho]&&function(e){var t,n,r,i,a,s,o,c,l;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(a=1,s=4,n=kc(t.GG,e._a[uo],zo(Tc(),1,4).year),r=kc(t.W,1),((i=kc(t.E,1))<1||i>7)&&(c=!0)):(a=e._locale._week.dow,s=e._locale._week.doy,l=zo(Tc(),a,s),n=kc(t.gg,e._a[uo],l.year),r=kc(t.w,l.week),null!=t.d?((i=t.d)<0||i>6)&&(c=!0):null!=t.e?(i=t.e+a,(t.e<0||t.e>6)&&(c=!0)):i=a);r<1||r>jo(n,a,s)?os(e)._overflowWeeks=!0:null!=c?os(e)._overflowWeekday=!0:(o=Fo(n,r,i,a,s),e._a[uo]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(a=kc(e._a[uo],r[uo]),(e._dayOfYear>_o(a)||0===e._dayOfYear)&&(os(e)._overflowDayOfYear=!0),n=Vo(a,0,e._dayOfYear),e._a[ho]=n.getUTCMonth(),e._a[fo]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=r[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[po]&&0===e._a[mo]&&0===e._a[go]&&0===e._a[vo]&&(e._nextDay=!0,e._a[po]=0),e._d=(e._useUTC?Vo:Lo).apply(null,s),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[po]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(os(e).weekdayMismatch=!0)}}function Sc(e){if(e._f!==Qa.ISO_8601)if(e._f!==Qa.RFC_2822){e._a=[],os(e).empty=!0;var t,n,r,i,a,s,o,c=""+e._i,l=c.length,u=0;for(o=(r=As(e._f,e._locale).match(Cs)||[]).length,t=0;t<o;t++)i=r[t],(n=(c.match(to(i,e))||[])[0])&&((a=c.substr(0,c.indexOf(n))).length>0&&os(e).unusedInput.push(a),c=c.slice(c.indexOf(n)+n.length),u+=n.length),Ms[i]?(n?os(e).empty=!1:os(e).unusedTokens.push(i),co(i,n,e)):e._strict&&!n&&os(e).unusedTokens.push(i);os(e).charsLeftOver=l-u,c.length>0&&os(e).unusedInput.push(c),e._a[po]<=12&&!0===os(e).bigHour&&e._a[po]>0&&(os(e).bigHour=void 0),os(e).parsedDateParts=e._a.slice(0),os(e).meridiem=e._meridiem,e._a[po]=function(e,t,n){var r;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((r=e.isPM(n))&&t<12&&(t+=12),r||12!==t||(t=0),t):t}(e._locale,e._a[po],e._meridiem),null!==(s=os(e).era)&&(e._a[uo]=e._locale.erasConvertYear(s,e._a[uo])),Cc(e),hc(e)}else xc(e);else _c(e)}function Ec(e){var t=e._i,n=e._f;return e._locale=e._locale||uc(e._l),null===t||void 0===n&&""===t?ls({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),ps(t)?new fs(hc(t)):(rs(t)?e._d=t:Xa(n)?function(e){var t,n,r,i,a,s,o=!1,c=e._f.length;if(0===c)return os(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;i<c;i++)a=0,s=!1,t=ds({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Sc(t),cs(t)&&(s=!0),a+=os(t).charsLeftOver,a+=10*os(t).unusedTokens.length,os(t).score=a,o?a<r&&(r=a,n=t):(null==r||a<r||s)&&(r=a,n=t,s&&(o=!0));as(e,n||t)}(e):n?Sc(e):function(e){var t=e._i;ts(t)?e._d=new Date(Qa.now()):rs(t)?e._d=new Date(t.valueOf()):"string"==typeof t?function(e){var t=vc.exec(e._i);null===t?(_c(e),!1===e._isValid&&(delete e._isValid,xc(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:Qa.createFromInputFallback(e)))):e._d=new Date(+t[1])}(e):Xa(t)?(e._a=is(t.slice(0),(function(e){return parseInt(e,10)})),Cc(e)):Za(t)?function(e){if(!e._d){var t=Ds(e._i),n=void 0===t.day?t.date:t.day;e._a=is([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),Cc(e)}}(e):ns(t)?e._d=new Date(t):Qa.createFromInputFallback(e)}(e),cs(e)||(e._d=null),e))}function Mc(e,t,n,r,i){var a,s={};return!0!==t&&!1!==t||(r=t,t=void 0),!0!==n&&!1!==n||(r=n,n=void 0),(Za(e)&&es(e)||Xa(e)&&0===e.length)&&(e=void 0),s._isAMomentObject=!0,s._useUTC=s._isUTC=i,s._l=n,s._i=e,s._f=t,s._strict=r,(a=new fs(hc(Ec(s))))._nextDay&&(a.add(1,"d"),a._nextDay=void 0),a}function Tc(e,t,n,r){return Mc(e,t,n,r,!1)}Qa.createFromInputFallback=gs("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))})),Qa.ISO_8601=function(){},Qa.RFC_2822=function(){};var Nc=gs("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Tc.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:ls()})),Ac=gs("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Tc.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:ls()}));function Pc(e,t){var n,r;if(1===t.length&&Xa(t[0])&&(t=t[0]),!t.length)return Tc();for(n=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](n)||(n=t[r]);return n}var Ic=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Dc(e){var t=Ds(e),n=t.year||0,r=t.quarter||0,i=t.month||0,a=t.week||t.isoWeek||0,s=t.day||0,o=t.hour||0,c=t.minute||0,l=t.second||0,u=t.millisecond||0;this._isValid=function(e){var t,n,r=!1,i=Ic.length;for(t in e)if(Ja(e,t)&&(-1===wo.call(Ic,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[Ic[n]]){if(r)return!1;parseFloat(e[Ic[n]])!==io(e[Ic[n]])&&(r=!0)}return!0}(t),this._milliseconds=+u+1e3*l+6e4*c+1e3*o*60*60,this._days=+s+7*a,this._months=+i+3*r+12*n,this._data={},this._locale=uc(),this._bubble()}function Bc(e){return e instanceof Dc}function Oc(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Lc(e,t){Ts(e,0,0,(function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+ks(~~(e/60),2)+t+ks(~~e%60,2)}))}Lc("Z",":"),Lc("ZZ",""),eo("Z",Qs),eo("ZZ",Qs),so(["Z","ZZ"],(function(e,t,n){n._useUTC=!0,n._tzm=Rc(Qs,e)}));var Vc=/([\+\-]|\d\d)/gi;function Rc(e,t){var n,r,i=(t||"").match(e);return null===i?null:0===(r=60*(n=((i[i.length-1]||[])+"").match(Vc)||["-",0,0])[1]+io(n[2]))?0:"+"===n[0]?r:-r}function Fc(e,t){var n,r;return t._isUTC?(n=t.clone(),r=(ps(e)||rs(e)?e.valueOf():Tc(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),Qa.updateOffset(n,!1),n):Tc(e).local()}function zc(e){return-Math.round(e._d.getTimezoneOffset())}function jc(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}Qa.updateOffset=function(){};var qc=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Hc=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Uc(e,t){var n,r,i,a=e,s=null;return Bc(e)?a={ms:e._milliseconds,d:e._days,M:e._months}:ns(e)||!isNaN(+e)?(a={},t?a[t]=+e:a.milliseconds=+e):(s=qc.exec(e))?(n="-"===s[1]?-1:1,a={y:0,d:io(s[fo])*n,h:io(s[po])*n,m:io(s[mo])*n,s:io(s[go])*n,ms:io(Oc(1e3*s[vo]))*n}):(s=Hc.exec(e))?(n="-"===s[1]?-1:1,a={y:Gc(s[2],n),M:Gc(s[3],n),w:Gc(s[4],n),d:Gc(s[5],n),h:Gc(s[6],n),m:Gc(s[7],n),s:Gc(s[8],n)}):null==a?a={}:"object"==typeof a&&("from"in a||"to"in a)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Fc(t,e),e.isBefore(t)?n=Wc(e,t):((n=Wc(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Tc(a.from),Tc(a.to)),(a={}).ms=i.milliseconds,a.M=i.months),r=new Dc(a),Bc(e)&&Ja(e,"_locale")&&(r._locale=e._locale),Bc(e)&&Ja(e,"_isValid")&&(r._isValid=e._isValid),r}function Gc(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Wc(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Yc(e,t){return function(n,r){var i;return null===r||isNaN(+r)||(bs(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=r,r=i),$c(this,Uc(n,r),e),this}}function $c(e,t,n,r){var i=t._milliseconds,a=Oc(t._days),s=Oc(t._months);e.isValid()&&(r=null==r||r,s&&Do(e,Co(e,"Month")+s*n),a&&So(e,"Date",Co(e,"Date")+a*n),i&&e._d.setTime(e._d.valueOf()+i*n),r&&Qa.updateOffset(e,a||s))}Uc.fn=Dc.prototype,Uc.invalid=function(){return Uc(NaN)};var Kc=Yc(1,"add"),Qc=Yc(-1,"subtract");function Xc(e){return"string"==typeof e||e instanceof String}function Zc(e){return ps(e)||rs(e)||Xc(e)||ns(e)||function(e){var t=Xa(e),n=!1;t&&(n=0===e.filter((function(t){return!ns(t)&&Xc(e)})).length);return t&&n}(e)||function(e){var t,n,r=Za(e)&&!es(e),i=!1,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s=a.length;for(t=0;t<s;t+=1)n=a[t],i=i||Ja(e,n);return r&&i}(e)||null==e}function Jc(e,t){if(e.date()<t.date())return-Jc(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),r=e.clone().add(n,"months");return-(n+(t-r<0?(t-r)/(r-e.clone().add(n-1,"months")):(t-r)/(e.clone().add(n+1,"months")-r)))||0}function el(e){var t;return void 0===e?this._locale._abbr:(null!=(t=uc(e))&&(this._locale=t),this)}Qa.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",Qa.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tl=gs("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function nl(){return this._locale}var rl=1e3,il=6e4,al=36e5,sl=126227808e5;function ol(e,t){return(e%t+t)%t}function cl(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-sl:new Date(e,t,n).valueOf()}function ll(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-sl:Date.UTC(e,t,n)}function ul(e,t){return t.erasAbbrRegex(e)}function hl(){var e,t,n,r,i,a=[],s=[],o=[],c=[],l=this.eras();for(e=0,t=l.length;e<t;++e)n=no(l[e].name),r=no(l[e].abbr),i=no(l[e].narrow),s.push(n),a.push(r),o.push(i),c.push(n),c.push(r),c.push(i);this._erasRegex=new RegExp("^("+c.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+s.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+a.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+o.join("|")+")","i")}function dl(e,t){Ts(0,[e,e.length],0,t)}function fl(e,t,n,r,i){var a;return null==e?zo(this,r,i).year:(t>(a=jo(e,r,i))&&(t=a),pl.call(this,e,t,n,r,i))}function pl(e,t,n,r,i){var a=Fo(e,t,n,r,i),s=Vo(a.year,0,a.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}Ts("N",0,0,"eraAbbr"),Ts("NN",0,0,"eraAbbr"),Ts("NNN",0,0,"eraAbbr"),Ts("NNNN",0,0,"eraName"),Ts("NNNNN",0,0,"eraNarrow"),Ts("y",["y",1],"yo","eraYear"),Ts("y",["yy",2],0,"eraYear"),Ts("y",["yyy",3],0,"eraYear"),Ts("y",["yyyy",4],0,"eraYear"),eo("N",ul),eo("NN",ul),eo("NNN",ul),eo("NNNN",(function(e,t){return t.erasNameRegex(e)})),eo("NNNNN",(function(e,t){return t.erasNarrowRegex(e)})),so(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,n,r){var i=n._locale.erasParse(e,r,n._strict);i?os(n).era=i:os(n).invalidEra=e})),eo("y",Ys),eo("yy",Ys),eo("yyy",Ys),eo("yyyy",Ys),eo("yo",(function(e,t){return t._eraYearOrdinalRegex||Ys})),so(["y","yy","yyy","yyyy"],uo),so(["yo"],(function(e,t,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[uo]=n._locale.eraYearOrdinalParse(e,i):t[uo]=parseInt(e,10)})),Ts(0,["gg",2],0,(function(){return this.weekYear()%100})),Ts(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),dl("gggg","weekYear"),dl("ggggg","weekYear"),dl("GGGG","isoWeekYear"),dl("GGGGG","isoWeekYear"),eo("G",$s),eo("g",$s),eo("GG",js,Vs),eo("gg",js,Vs),eo("GGGG",Gs,Fs),eo("gggg",Gs,Fs),eo("GGGGG",Ws,zs),eo("ggggg",Ws,zs),oo(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,r){t[r.substr(0,2)]=io(e)})),oo(["gg","GG"],(function(e,t,n,r){t[r]=Qa.parseTwoDigitYear(e)})),Ts("Q",0,"Qo","quarter"),eo("Q",Ls),so("Q",(function(e,t){t[ho]=3*(io(e)-1)})),Ts("D",["DD",2],"Do","date"),eo("D",js,Zs),eo("DD",js,Vs),eo("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),so(["D","DD"],fo),so("Do",(function(e,t){t[fo]=io(e.match(js)[0])}));var ml=ko("Date",!0);Ts("DDD",["DDDD",3],"DDDo","dayOfYear"),eo("DDD",Us),eo("DDDD",Rs),so(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=io(e)})),Ts("m",["mm",2],0,"minute"),eo("m",js,Js),eo("mm",js,Vs),so(["m","mm"],mo);var gl=ko("Minutes",!1);Ts("s",["ss",2],0,"second"),eo("s",js,Js),eo("ss",js,Vs),so(["s","ss"],go);var vl,yl,bl=ko("Seconds",!1);for(Ts("S",0,0,(function(){return~~(this.millisecond()/100)})),Ts(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),Ts(0,["SSS",3],0,"millisecond"),Ts(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),Ts(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),Ts(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),Ts(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),Ts(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),Ts(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),eo("S",Us,Ls),eo("SS",Us,Vs),eo("SSS",Us,Rs),vl="SSSS";vl.length<=9;vl+="S")eo(vl,Ys);function _l(e,t){t[vo]=io(1e3*("0."+e))}for(vl="S";vl.length<=9;vl+="S")so(vl,_l);yl=ko("Milliseconds",!1),Ts("z",0,0,"zoneAbbr"),Ts("zz",0,0,"zoneName");var wl=fs.prototype;function xl(e){return e}wl.add=Kc,wl.calendar=function(e,t){1===arguments.length&&(arguments[0]?Zc(arguments[0])?(e=arguments[0],t=void 0):function(e){var t,n=Za(e)&&!es(e),r=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<i.length;t+=1)r=r||Ja(e,i[t]);return n&&r}(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||Tc(),r=Fc(n,this).startOf("day"),i=Qa.calendarFormat(this,r)||"sameElse",a=t&&(_s(t[i])?t[i].call(this,n):t[i]);return this.format(a||this.localeData().calendar(i,this,Tc(n)))},wl.clone=function(){return new fs(this)},wl.diff=function(e,t,n){var r,i,a;if(!this.isValid())return NaN;if(!(r=Fc(e,this)).isValid())return NaN;switch(i=6e4*(r.utcOffset()-this.utcOffset()),t=Is(t)){case"year":a=Jc(this,r)/12;break;case"month":a=Jc(this,r);break;case"quarter":a=Jc(this,r)/3;break;case"second":a=(this-r)/1e3;break;case"minute":a=(this-r)/6e4;break;case"hour":a=(this-r)/36e5;break;case"day":a=(this-r-i)/864e5;break;case"week":a=(this-r-i)/6048e5;break;default:a=this-r}return n?a:ro(a)},wl.endOf=function(e){var t,n;if(void 0===(e=Is(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?ll:cl,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=al-ol(t+(this._isUTC?0:this.utcOffset()*il),al)-1;break;case"minute":t=this._d.valueOf(),t+=il-ol(t,il)-1;break;case"second":t=this._d.valueOf(),t+=rl-ol(t,rl)-1}return this._d.setTime(t),Qa.updateOffset(this,!0),this},wl.format=function(e){e||(e=this.isUtc()?Qa.defaultFormatUtc:Qa.defaultFormat);var t=Ns(this,e);return this.localeData().postformat(t)},wl.from=function(e,t){return this.isValid()&&(ps(e)&&e.isValid()||Tc(e).isValid())?Uc({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},wl.fromNow=function(e){return this.from(Tc(),e)},wl.to=function(e,t){return this.isValid()&&(ps(e)&&e.isValid()||Tc(e).isValid())?Uc({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},wl.toNow=function(e){return this.to(Tc(),e)},wl.get=function(e){return _s(this[e=Is(e)])?this[e]():this},wl.invalidAt=function(){return os(this).overflow},wl.isAfter=function(e,t){var n=ps(e)?e:Tc(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=Is(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},wl.isBefore=function(e,t){var n=ps(e)?e:Tc(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=Is(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},wl.isBetween=function(e,t,n,r){var i=ps(e)?e:Tc(e),a=ps(t)?t:Tc(t);return!!(this.isValid()&&i.isValid()&&a.isValid())&&(("("===(r=r||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===r[1]?this.isBefore(a,n):!this.isAfter(a,n)))},wl.isSame=function(e,t){var n,r=ps(e)?e:Tc(e);return!(!this.isValid()||!r.isValid())&&("millisecond"===(t=Is(t)||"millisecond")?this.valueOf()===r.valueOf():(n=r.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},wl.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},wl.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},wl.isValid=function(){return cs(this)},wl.lang=tl,wl.locale=el,wl.localeData=nl,wl.max=Ac,wl.min=Nc,wl.parsingFlags=function(){return as({},os(this))},wl.set=function(e,t){if("object"==typeof e){var n,r=function(e){var t,n=[];for(t in e)Ja(e,t)&&n.push({unit:t,priority:Bs[t]});return n.sort((function(e,t){return e.priority-t.priority})),n}(e=Ds(e)),i=r.length;for(n=0;n<i;n++)this[r[n].unit](e[r[n].unit])}else if(_s(this[e=Is(e)]))return this[e](t);return this},wl.startOf=function(e){var t,n;if(void 0===(e=Is(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?ll:cl,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ol(t+(this._isUTC?0:this.utcOffset()*il),al);break;case"minute":t=this._d.valueOf(),t-=ol(t,il);break;case"second":t=this._d.valueOf(),t-=ol(t,rl)}return this._d.setTime(t),Qa.updateOffset(this,!0),this},wl.subtract=Qc,wl.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},wl.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},wl.toDate=function(){return new Date(this.valueOf())},wl.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?Ns(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):_s(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",Ns(n,"Z")):Ns(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},wl.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,r="moment",i="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+r+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(wl[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),wl.toJSON=function(){return this.isValid()?this.toISOString():null},wl.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},wl.unix=function(){return Math.floor(this.valueOf()/1e3)},wl.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},wl.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},wl.eraName=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].name;if(r[e].until<=n&&n<=r[e].since)return r[e].name}return""},wl.eraNarrow=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].narrow;if(r[e].until<=n&&n<=r[e].since)return r[e].narrow}return""},wl.eraAbbr=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].abbr;if(r[e].until<=n&&n<=r[e].since)return r[e].abbr}return""},wl.eraYear=function(){var e,t,n,r,i=this.localeData().eras();for(e=0,t=i.length;e<t;++e)if(n=i[e].since<=i[e].until?1:-1,r=this.clone().startOf("day").valueOf(),i[e].since<=r&&r<=i[e].until||i[e].until<=r&&r<=i[e].since)return(this.year()-Qa(i[e].since).year())*n+i[e].offset;return this.year()},wl.year=xo,wl.isLeapYear=function(){return lo(this.year())},wl.weekYear=function(e){return fl.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},wl.isoWeekYear=function(e){return fl.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},wl.quarter=wl.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},wl.month=Bo,wl.daysInMonth=function(){return Eo(this.year(),this.month())},wl.week=wl.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},wl.isoWeek=wl.isoWeeks=function(e){var t=zo(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},wl.weeksInYear=function(){var e=this.localeData()._week;return jo(this.year(),e.dow,e.doy)},wl.weeksInWeekYear=function(){var e=this.localeData()._week;return jo(this.weekYear(),e.dow,e.doy)},wl.isoWeeksInYear=function(){return jo(this.year(),1,4)},wl.isoWeeksInISOWeekYear=function(){return jo(this.isoWeekYear(),1,4)},wl.date=ml,wl.day=wl.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=Co(this,"Day");return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},wl.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},wl.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},wl.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},wl.hour=wl.hours=ec,wl.minute=wl.minutes=gl,wl.second=wl.seconds=bl,wl.millisecond=wl.milliseconds=yl,wl.utcOffset=function(e,t,n){var r,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=Rc(Qs,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(r=zc(this)),this._offset=e,this._isUTC=!0,null!=r&&this.add(r,"m"),i!==e&&(!t||this._changeInProgress?$c(this,Uc(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,Qa.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?i:zc(this)},wl.utc=function(e){return this.utcOffset(0,e)},wl.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(zc(this),"m")),this},wl.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Rc(Ks,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},wl.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Tc(e).utcOffset():0,(this.utcOffset()-e)%60==0)},wl.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},wl.isLocal=function(){return!!this.isValid()&&!this._isUTC},wl.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},wl.isUtc=jc,wl.isUTC=jc,wl.zoneAbbr=function(){return this._isUTC?"UTC":""},wl.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},wl.dates=gs("dates accessor is deprecated. Use date instead.",ml),wl.months=gs("months accessor is deprecated. Use month instead",Bo),wl.years=gs("years accessor is deprecated. Use year instead",xo),wl.zone=gs("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),wl.isDSTShifted=gs("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!ts(this._isDSTShifted))return this._isDSTShifted;var e,t={};return ds(t,this),(t=Ec(t))._a?(e=t._isUTC?ss(t._a):Tc(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var n,r=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),a=0;for(n=0;n<r;n++)io(e[n])!==io(t[n])&&a++;return a+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}));var kl=xs.prototype;function Cl(e,t,n,r){var i=uc(),a=ss().set(r,t);return i[n](a,e)}function Sl(e,t,n){if(ns(e)&&(t=e,e=void 0),e=e||"",null!=t)return Cl(e,t,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Cl(e,r,n,"month");return i}function El(e,t,n,r){"boolean"==typeof e?(ns(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,ns(t)&&(n=t,t=void 0),t=t||"");var i,a=uc(),s=e?a._week.dow:0,o=[];if(null!=n)return Cl(t,(n+s)%7,r,"day");for(i=0;i<7;i++)o[i]=Cl(t,(i+s)%7,r,"day");return o}kl.calendar=function(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return _s(r)?r.call(t,n):r},kl.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(Cs).map((function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])},kl.invalidDate=function(){return this._invalidDate},kl.ordinal=function(e){return this._ordinal.replace("%d",e)},kl.preparse=xl,kl.postformat=xl,kl.relativeTime=function(e,t,n,r){var i=this._relativeTime[n];return _s(i)?i(e,t,n,r):i.replace(/%d/i,e)},kl.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return _s(n)?n(t):n.replace(/%s/i,t)},kl.set=function(e){var t,n;for(n in e)Ja(e,n)&&(_s(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},kl.eras=function(e,t){var n,r,i,a=this._eras||uc("en")._eras;for(n=0,r=a.length;n<r;++n){if("string"==typeof a[n].since)i=Qa(a[n].since).startOf("day"),a[n].since=i.valueOf();switch(typeof a[n].until){case"undefined":a[n].until=1/0;break;case"string":i=Qa(a[n].until).startOf("day").valueOf(),a[n].until=i.valueOf()}}return a},kl.erasParse=function(e,t,n){var r,i,a,s,o,c=this.eras();for(e=e.toUpperCase(),r=0,i=c.length;r<i;++r)if(a=c[r].name.toUpperCase(),s=c[r].abbr.toUpperCase(),o=c[r].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(s===e)return c[r];break;case"NNNN":if(a===e)return c[r];break;case"NNNNN":if(o===e)return c[r]}else if([a,s,o].indexOf(e)>=0)return c[r]},kl.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?Qa(e.since).year():Qa(e.since).year()+(t-e.offset)*n},kl.erasAbbrRegex=function(e){return Ja(this,"_erasAbbrRegex")||hl.call(this),e?this._erasAbbrRegex:this._erasRegex},kl.erasNameRegex=function(e){return Ja(this,"_erasNameRegex")||hl.call(this),e?this._erasNameRegex:this._erasRegex},kl.erasNarrowRegex=function(e){return Ja(this,"_erasNarrowRegex")||hl.call(this),e?this._erasNarrowRegex:this._erasRegex},kl.months=function(e,t){return e?Xa(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||No).test(t)?"format":"standalone"][e.month()]:Xa(this._months)?this._months:this._months.standalone},kl.monthsShort=function(e,t){return e?Xa(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[No.test(t)?"format":"standalone"][e.month()]:Xa(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},kl.monthsParse=function(e,t,n){var r,i,a;if(this._monthsParseExact)return Io.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=ss([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(a="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(a.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}},kl.monthsRegex=function(e){return this._monthsParseExact?(Ja(this,"_monthsRegex")||Oo.call(this),e?this._monthsStrictRegex:this._monthsRegex):(Ja(this,"_monthsRegex")||(this._monthsRegex=Po),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},kl.monthsShortRegex=function(e){return this._monthsParseExact?(Ja(this,"_monthsRegex")||Oo.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(Ja(this,"_monthsShortRegex")||(this._monthsShortRegex=Ao),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},kl.week=function(e){return zo(e,this._week.dow,this._week.doy).week},kl.firstDayOfYear=function(){return this._week.doy},kl.firstDayOfWeek=function(){return this._week.dow},kl.weekdays=function(e,t){var n=Xa(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?qo(n,this._week.dow):e?n[e.day()]:n},kl.weekdaysMin=function(e){return!0===e?qo(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},kl.weekdaysShort=function(e){return!0===e?qo(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},kl.weekdaysParse=function(e,t,n){var r,i,a;if(this._weekdaysParseExact)return Ko.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=ss([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(a="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(a.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}},kl.weekdaysRegex=function(e){return this._weekdaysParseExact?(Ja(this,"_weekdaysRegex")||Qo.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(Ja(this,"_weekdaysRegex")||(this._weekdaysRegex=Wo),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},kl.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(Ja(this,"_weekdaysRegex")||Qo.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Ja(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Yo),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},kl.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(Ja(this,"_weekdaysRegex")||Qo.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Ja(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=$o),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},kl.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},kl.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},cc("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===io(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),Qa.lang=gs("moment.lang is deprecated. Use moment.locale instead.",cc),Qa.langData=gs("moment.langData is deprecated. Use moment.localeData instead.",uc);var Ml=Math.abs;function Tl(e,t,n,r){var i=Uc(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Nl(e){return e<0?Math.floor(e):Math.ceil(e)}function Al(e){return 4800*e/146097}function Pl(e){return 146097*e/4800}function Il(e){return function(){return this.as(e)}}var Dl=Il("ms"),Bl=Il("s"),Ol=Il("m"),Ll=Il("h"),Vl=Il("d"),Rl=Il("w"),Fl=Il("M"),zl=Il("Q"),jl=Il("y"),ql=Dl;function Hl(e){return function(){return this.isValid()?this._data[e]:NaN}}var Ul=Hl("milliseconds"),Gl=Hl("seconds"),Wl=Hl("minutes"),Yl=Hl("hours"),$l=Hl("days"),Kl=Hl("months"),Ql=Hl("years");var Xl=Math.round,Zl={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Jl(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}var eu=Math.abs;function tu(e){return(e>0)-(e<0)||+e}function nu(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,r,i,a,s,o,c=eu(this._milliseconds)/1e3,l=eu(this._days),u=eu(this._months),h=this.asSeconds();return h?(e=ro(c/60),t=ro(e/60),c%=60,e%=60,n=ro(u/12),u%=12,r=c?c.toFixed(3).replace(/\.?0+$/,""):"",i=h<0?"-":"",a=tu(this._months)!==tu(h)?"-":"",s=tu(this._days)!==tu(h)?"-":"",o=tu(this._milliseconds)!==tu(h)?"-":"",i+"P"+(n?a+n+"Y":"")+(u?a+u+"M":"")+(l?s+l+"D":"")+(t||e||c?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(c?o+r+"S":"")):"P0D"}var ru=Dc.prototype;ru.isValid=function(){return this._isValid},ru.abs=function(){var e=this._data;return this._milliseconds=Ml(this._milliseconds),this._days=Ml(this._days),this._months=Ml(this._months),e.milliseconds=Ml(e.milliseconds),e.seconds=Ml(e.seconds),e.minutes=Ml(e.minutes),e.hours=Ml(e.hours),e.months=Ml(e.months),e.years=Ml(e.years),this},ru.add=function(e,t){return Tl(this,e,t,1)},ru.subtract=function(e,t){return Tl(this,e,t,-1)},ru.as=function(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if("month"===(e=Is(e))||"quarter"===e||"year"===e)switch(t=this._days+r/864e5,n=this._months+Al(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Pl(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}},ru.asMilliseconds=Dl,ru.asSeconds=Bl,ru.asMinutes=Ol,ru.asHours=Ll,ru.asDays=Vl,ru.asWeeks=Rl,ru.asMonths=Fl,ru.asQuarters=zl,ru.asYears=jl,ru.valueOf=ql,ru._bubble=function(){var e,t,n,r,i,a=this._milliseconds,s=this._days,o=this._months,c=this._data;return a>=0&&s>=0&&o>=0||a<=0&&s<=0&&o<=0||(a+=864e5*Nl(Pl(o)+s),s=0,o=0),c.milliseconds=a%1e3,e=ro(a/1e3),c.seconds=e%60,t=ro(e/60),c.minutes=t%60,n=ro(t/60),c.hours=n%24,s+=ro(n/24),o+=i=ro(Al(s)),s-=Nl(Pl(i)),r=ro(o/12),o%=12,c.days=s,c.months=o,c.years=r,this},ru.clone=function(){return Uc(this)},ru.get=function(e){return e=Is(e),this.isValid()?this[e+"s"]():NaN},ru.milliseconds=Ul,ru.seconds=Gl,ru.minutes=Wl,ru.hours=Yl,ru.days=$l,ru.weeks=function(){return ro(this.days()/7)},ru.months=Kl,ru.years=Ql,ru.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,a=Zl;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(a=Object.assign({},Zl,t),null!=t.s&&null==t.ss&&(a.ss=t.s-1)),r=function(e,t,n,r){var i=Uc(e).abs(),a=Xl(i.as("s")),s=Xl(i.as("m")),o=Xl(i.as("h")),c=Xl(i.as("d")),l=Xl(i.as("M")),u=Xl(i.as("w")),h=Xl(i.as("y")),d=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||s<=1&&["m"]||s<n.m&&["mm",s]||o<=1&&["h"]||o<n.h&&["hh",o]||c<=1&&["d"]||c<n.d&&["dd",c];return null!=n.w&&(d=d||u<=1&&["w"]||u<n.w&&["ww",u]),(d=d||l<=1&&["M"]||l<n.M&&["MM",l]||h<=1&&["y"]||["yy",h])[2]=t,d[3]=+e>0,d[4]=r,Jl.apply(null,d)}(this,!i,a,n=this.localeData()),i&&(r=n.pastFuture(+this,r)),n.postformat(r)},ru.toISOString=nu,ru.toString=nu,ru.toJSON=nu,ru.locale=el,ru.localeData=nl,ru.toIsoString=gs("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nu),ru.lang=tl,Ts("X",0,0,"unix"),Ts("x",0,0,"valueOf"),eo("x",$s),eo("X",/[+-]?\d+(\.\d{1,3})?/),so("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e))})),so("x",(function(e,t,n){n._d=new Date(io(e))})),
|
|
73
|
+
//! moment.js
|
|
74
|
+
Qa.version="2.30.1",$a=Tc,Qa.fn=wl,Qa.min=function(){return Pc("isBefore",[].slice.call(arguments,0))},Qa.max=function(){return Pc("isAfter",[].slice.call(arguments,0))},Qa.now=function(){return Date.now?Date.now():+new Date},Qa.utc=ss,Qa.unix=function(e){return Tc(1e3*e)},Qa.months=function(e,t){return Sl(e,t,"months")},Qa.isDate=rs,Qa.locale=cc,Qa.invalid=ls,Qa.duration=Uc,Qa.isMoment=ps,Qa.weekdays=function(e,t,n){return El(e,t,n,"weekdays")},Qa.parseZone=function(){return Tc.apply(null,arguments).parseZone()},Qa.localeData=uc,Qa.isDuration=Bc,Qa.monthsShort=function(e,t){return Sl(e,t,"monthsShort")},Qa.weekdaysMin=function(e,t,n){return El(e,t,n,"weekdaysMin")},Qa.defineLocale=lc,Qa.updateLocale=function(e,t){if(null!=t){var n,r,i=nc;null!=rc[e]&&null!=rc[e].parentLocale?rc[e].set(ws(rc[e]._config,t)):(null!=(r=oc(e))&&(i=r._config),t=ws(i,t),null==r&&(t.abbr=e),(n=new xs(t)).parentLocale=rc[e],rc[e]=n),cc(e)}else null!=rc[e]&&(null!=rc[e].parentLocale?(rc[e]=rc[e].parentLocale,e===cc()&&cc(e)):null!=rc[e]&&delete rc[e]);return rc[e]},Qa.locales=function(){return vs(rc)},Qa.weekdaysShort=function(e,t,n){return El(e,t,n,"weekdaysShort")},Qa.normalizeUnits=Is,Qa.relativeTimeRounding=function(e){return void 0===e?Xl:"function"==typeof e&&(Xl=e,!0)},Qa.relativeTimeThreshold=function(e,t){return void 0!==Zl[e]&&(void 0===t?Zl[e]:(Zl[e]=t,"s"===e&&(Zl.ss=t-1),!0))},Qa.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},Qa.prototype=wl,Qa.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const iu=t.defineComponent({name:"SyllableSeqVis",props:{seq:{type:Object,required:!0},lastTSsuggestion:{type:Number,required:!1,default:0}},setup(e){const n=t.ref(0),r=t.ref(0),i=t.ref(0),a=t.ref(500),s=t.computed((()=>{const t=e.seq.syllables[e.seq.syllables.length-1].timestamp;return Math.max(1,t,e.lastTSsuggestion)})),o=t.computed((()=>{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)})),c=()=>{try{n.value=e.seq.syllables[0].timestamp;const t=e.seq.syllables[e.seq.syllables.length-1].timestamp,i=n.value+e.lastTSsuggestion;r.value=Math.max(t,i)}catch(t){console.log(`[SyllableSeqVis] Error updating bounds: ${t}`)}e.seq.syllables.forEach((e=>{e.notes.forEach((e=>{e.note.number>i.value&&(i.value=e.note.number),e.note.number<a.value&&(a.value=e.note.number)}))}))};return t.onMounted((()=>{console.log(`SyllableSeqVis created w/ input: \n${e.seq}`),c()})),{firstTS:n,lastTS:r,high:i,low:a,sayNote:e=>{console.log(`${JSON.stringify(e)}`)},getLastTS:s,getHeight:o,updateBounds:c}}}),au=["height"],su=["cx","cy","alt","fill","stroke","onMouseenter"];const ou=E(iu,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",null,[(t.openBlock(),t.createElementBlock("svg",{width:510,height:Math.max(3*(e.high-e.low)+10,0)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.seq.syllables,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.notes,(r=>(t.openBlock(),t.createElementBlock("circle",{key:n.timestamp+"-"+r.note.number,cx:500*(n.timestamp-e.firstTS)/(e.lastTS-e.firstTS)+4,cy:3*(e.high-r.note.number)+4,alt:r.note.name,r:"3",fill:r.isCorrect?"black":r.isMissing?"none":"red",stroke:r.isMissing?"red":"none",onMouseenter:t=>e.sayNote(r)},null,40,su)))),128))],64)))),256))],8,au))])}],["__scopeId","data-v-2f79c080"]]),cu=t.defineComponent({name:"NoteDisplay",props:{chroma:{type:Number,required:!0}},setup:e=>({style:t=>{let n="#ffffff";return t===e.chroma?n="#1976D2":1!==t&&3!==t&&6!==t&&8!==t&&10!==t&&-2!==t||(n="#000000"),{fill:n,"fill-opacity":1,stroke:"#000000","stroke-width":.79375,"stroke-miterlimit":4,"stroke-dasharray":"none","stroke-opacity":1}},white:-1,black:-2})}),lu={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"},uu={id:"metadata5"},hu={id:"layer1",transform:"translate(167.75219,-151.96011)","inkscape:groupmode":"layer","inkscape:label":"Layer 1"};const du=E(cu,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("sodipodi:namedview"),c=t.resolveComponent("dc:format"),l=t.resolveComponent("dc:type"),u=t.resolveComponent("dc:title"),h=t.resolveComponent("cc:Work"),d=t.resolveComponent("rdf:RDF");return t.openBlock(),t.createElementBlock("svg",lu,[n[1]||(n[1]=t.createElementVNode("defs",{id:"defs2"},null,-1)),t.createVNode(o,{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"}),t.createElementVNode("metadata",uu,[t.createVNode(d,null,{default:t.withCtx((()=>[t.createVNode(h,{"rdf:about":""},{default:t.withCtx((()=>[t.createVNode(c,null,{default:t.withCtx((()=>n[0]||(n[0]=[t.createTextVNode("image/svg+xml")]))),_:1}),t.createVNode(l,{"rdf:resource":"http://purl.org/dc/dcmitype/StillImage"}),t.createVNode(u)])),_:1})])),_:1})]),t.createElementVNode("g",hu,[t.createElementVNode("rect",{id:"rect845",y:"152.19064",x:"-150.12129",height:"73.220116",width:"17.486626",style:t.normalizeStyle(e.style(0))},null,4),t.createElementVNode("rect",{id:"rect845-9",style:t.normalizeStyle(e.style(2)),width:"17.486626",height:"73.220116",x:"-132.63466",y:"152.19064"},null,4),t.createElementVNode("rect",{id:"rect845-6",style:t.normalizeStyle(e.style(4)),width:"17.486626",height:"73.220116",x:"-115.14803",y:"152.19064"},null,4),t.createElementVNode("rect",{id:"rect845-4",style:t.normalizeStyle(e.style(5)),width:"17.486626",height:"73.220116",x:"-97.661407",y:"152.19064"},null,4),t.createElementVNode("rect",{id:"rect845-92",style:t.normalizeStyle(e.style(7)),width:"17.486626",height:"73.220116",x:"-80.174782",y:"152.19064"},null,4),t.createElementVNode("rect",{id:"rect845-3",style:t.normalizeStyle(e.style(9)),width:"17.486626",height:"73.220116",x:"-62.688156",y:"152.19064"},null,4),t.createElementVNode("rect",{id:"rect845-0",style:t.normalizeStyle(e.style(11)),width:"17.486626",height:"73.220116",x:"-45.20153",y:"152.19064"},null,4),t.createElementVNode("rect",{id:"rect845-30",style:t.normalizeStyle(e.style(e.white)),width:"17.486626",height:"73.220116",x:"-27.714905",y:"152.10745"},null,4),t.createElementVNode("rect",{id:"rect898",ry:"0",y:"152.10744",x:"-138.43532",height:"54.415863",width:"10.466455",style:t.normalizeStyle(e.style(1))},null,4),t.createElementVNode("rect",{id:"rect898-3",style:t.normalizeStyle(e.style(3)),width:"10.466455",height:"54.415863",x:"-120.84978",y:"152.10744",ry:"0"},null,4),t.createElementVNode("rect",{id:"rect898-7",style:t.normalizeStyle(e.style(6)),width:"10.466455",height:"54.415863",x:"-85.678711",y:"152.10744",ry:"0"},null,4),t.createElementVNode("rect",{id:"rect898-8",style:t.normalizeStyle(e.style(8)),width:"10.466455",height:"54.415863",x:"-68.09317",y:"152.10744",ry:"0"},null,4),t.createElementVNode("rect",{id:"rect898-1",style:t.normalizeStyle(e.style(10)),width:"10.466455",height:"54.415863",x:"-50.507633",y:"152.10744",ry:"0"},null,4),t.createElementVNode("rect",{id:"rect845-30-1",y:"152.10745",x:"-10.228278",height:"73.220116",width:"17.486626",style:t.normalizeStyle(e.style(e.white))},null,4),t.createElementVNode("rect",{id:"rect845-30-9",y:"152.10744",x:"-167.60791",height:"73.220116",width:"17.486626",style:t.normalizeStyle(e.style(e.white))},null,4),t.createElementVNode("rect",{id:"rect898-4",style:t.normalizeStyle(e.style(e.black)),width:"10.466455",height:"54.415863",x:"-15.336554",y:"152.10744",ry:"0"},null,4),t.createElementVNode("rect",{id:"rect898-74",style:t.normalizeStyle(e.style(e.black)),width:"4.4679713",height:"54.415863",x:"-167.60791",y:"152.10744",ry:"0"},null,4),t.createElementVNode("rect",{id:"rect898-10",style:t.normalizeStyle(e.style(e.black)),width:"5.1863246",height:"54.507248",x:"2.2092075",y:"152.06175",ry:"0"},null,4)])])}]]),fu=t.defineComponent({name:"Playback",components:{SyllableSeqVis:ou,NoteDisplay:du},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:i}){const a=n.useViewable(e,i,"Playback"),s=n.useQuestionView(a),o=t.ref(),c=t.ref(!1),l=t.ref("notSet"),u=t.ref(!1),h=t.ref(0),d=t.ref(Qa.utc()),f=t.ref(0),p=t.ref(0),m=t.ref(Ga([])),g=t.ref(!1),v=t.ref(Ga([])),y=t.ref(0),b=t.ref(""),_=t.ref(0),w=t.ref(0),x=t.ref(),k=t.ref();s.question.value=new Eu(e.data);const C=t.computed((()=>new Eu(e.data))),S=t.computed((()=>Ga(C.value.midi).syllables[0].notes.length>1?"Lowest note of first chord:":"First note:")),E=t.computed((()=>c.value?Ga(C.value.midi).rootNote.number%12:0)),M=()=>{var e,t,n;l.value?l.value!==(null==(e=o.value)?void 0:e.state)&&(c.value=!1,l.value=(null==(t=o.value)?void 0:t.state)||"notSet",c.value=!0):(l.value=(null==(n=o.value)?void 0:n.state)||"notSet",c.value=!0),a.logger.log(`Playback is running init with state: ${l.value}`),"ready"===l.value&&(f.value=C.value.duration,N())},T=()=>{try{x.value&&(x.value.style.animationName="",requestAnimationFrame((()=>{requestAnimationFrame((()=>{x.value&&(x.value.style.animationDuration=f.value+"ms",x.value.style.animationName="progress")}))})))}catch{setTimeout(T,50)}},N=()=>{var e,t,n;null==(e=o.value)||e.stopRecording(),null==(t=o.value)||t.eraseRecording(),d.value=Qa.utc(),_.value=0,w.value=0,u.value=!1,h.value=0,T(),null==(n=o.value)||n.play(C.value.midi),setTimeout((()=>{a.logger.log("done playback..."),(()=>{var e,t,n;null==(e=o.value)||e.record(),u.value=!0,null==(t=o.value)||t.addNoteonListenter((e=>{var t;_.value++,v.value.append(e),null==(t=k.value)||t.updateBounds(),_.value+w.value>=C.value.midi.length&&A()})),null==(n=o.value)||n.addNoteoffListenter((()=>{w.value++,_.value+w.value>=C.value.midi.length&&A()}))})()}),C.value.lastNoteOnTimestamp)},A=()=>{var e;if(!(null==(e=o.value)?void 0:e.recording))return!1;const t=Ga(C.value.midi),n=Ga(o.value.recording);return m.value=t.grade(n),v.value=Ga([]),!!s.submitAnswer(o.value.recording).isCorrect||(p.value++,g.value=!0,p.value<s.maxAttemptsPerView.value&&N(),!1)},P=()=>{_.value>0?A():N()};return t.onMounted((async()=>{try{o.value=await Ya.instance(),o.value.setStateChangeListener((()=>{M()})),c.value=!0}catch(e){n.alertUser({status:r.Status.error,text:"Midi device not supported"}),b.value=JSON.stringify(e),l.value="notsupported",c.value=!0}M(),n.SkldrMouseTrap.addBinding([{hotkey:"space",callback:P,command:"Clear attempt or play again"}])})),t.onBeforeUnmount((()=>{n.SkldrMouseTrap.removeBinding("space")})),{...a,...s,initialized:c,state:l,recording:u,inputSeq:v,lastTSsuggestion:y,gradedSeq:m,graded:g,promptText:S,firstNoteChroma:E,progressBar:x,inputVisRef:k,clearAttempt:P,notesOn:_}}}),pu={key:0,"data-viewable":"Playback"},mu={key:0},gu={class:"text-h4"},vu={class:"text-h5"},yu={key:0},bu={class:"progressContainer"},_u={id:"progress",ref:"progressBar"},wu={key:1},xu={key:2};const ku=E(fu,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("note-display"),c=t.resolveComponent("v-icon"),l=t.resolveComponent("v-btn"),u=t.resolveComponent("syllable-seq-vis");return e.initialized?(t.openBlock(),t.createElementBlock("div",pu,["ready"===e.state?(t.openBlock(),t.createElementBlock("div",mu,[t.createElementVNode("div",gu,[t.createTextVNode(t.toDisplayString(e.promptText)+" ",1),t.createVNode(o,{chroma:e.firstNoteChroma},null,8,["chroma"])]),t.createElementVNode("div",vu,[n[0]||(n[0]=t.createTextVNode("Listen...")),e.recording?(t.openBlock(),t.createElementBlock("span",yu," and Repeat")):t.createCommentVNode("",!0)]),t.createElementVNode("div",bu,[t.createElementVNode("div",_u,null,512)]),t.createVNode(l,{color:"primary",autofocus:"",onClick:e.clearAttempt},{default:t.withCtx((()=>[n[2]||(n[2]=t.createTextVNode(" Play again ")),t.createVNode(c,{end:""},{default:t.withCtx((()=>n[1]||(n[1]=[t.createTextVNode("volume_up")]))),_:1})])),_:1},8,["onClick"]),(t.openBlock(),t.createBlock(u,{key:0,ref:"inputVisRef",seq:e.inputSeq,"last-t-ssuggestion":e.lastTSsuggestion},null,8,["seq","last-t-ssuggestion"])),e.graded?(t.openBlock(),t.createBlock(u,{key:1,seq:e.gradedSeq},null,8,["seq"])):t.createCommentVNode("",!0)])):"nodevice"===e.state?(t.openBlock(),t.createElementBlock("div",wu,"No midi device detected. Please attach one!")):"notsupported"===e.state?(t.openBlock(),t.createElementBlock("div",xu,n[3]||(n[3]=[t.createElementVNode("p",null,"This exercise requires a midi input device, which is not supported by this browser ☹",-1),t.createElementVNode("div",null,[t.createElementVNode("p",null,"Please try again with one of the following browsers:"),t.createElementVNode("ul",null,[t.createElementVNode("li",null,[t.createElementVNode("a",{href:"https://www.google.com/chrome/"},"Google Chrome")]),t.createElementVNode("li",null,[t.createElementVNode("a",{href:"https://www.microsoft.com/edge"},"Microsoft Edge")]),t.createElementVNode("li",null,[t.createElementVNode("a",{href:"https://brave.com/"},"Brave")])])],-1)]))):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)}]]),Cu=[{name:"Melody",type:r.FieldType.MIDI}],Su=class _EchoQuestion2 extends n.Question{constructor(e){super(e),u(this,"midi"),this.midi=e[0].Melody}get duration(){return this.midi.reduce(((e,t)=>t.timestamp>e.timestamp?t:e)).timestamp}get lastNoteOnTimestamp(){return this.midi.filter((e=>"noteon"===e.type)).reduce(((e,t)=>t.timestamp>e.timestamp?t:e)).timestamp}isCorrect(e){const t=Ga(this.midi),n=Ga(e);try{return t.grade(n).isCorrect()}catch(r){return console.log("ERROR grading this midi sequence!",r),!1}}dataShapes(){return _EchoQuestion2.dataShapes}views(){return _EchoQuestion2.views}};u(Su,"dataShapes",[{fields:Cu,name:r.DataShapeName.PIANO_Echo}]),u(Su,"views",[ku]);let Eu=Su;const Mu=t.defineComponent({name:"NotePlayback",components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"NotePlayback"),a=n.useQuestionView(i),s=t.ref(),o=t.ref(!1),c=t.ref(!1),l=t.ref(0),u=t.ref(Qa.utc()),h=t.ref(0),d=t.ref(Ga([])),f=t.ref(!1),p=t.ref(Ga([])),m=t.ref("");a.question.value=new Lu(e.data);const g=t.computed((()=>new Lu(e.data))),v=()=>{var e,t;null==(e=s.value)||e.stopRecording(),null==(t=s.value)||t.eraseRecording(),u.value=Qa.utc(),c.value=!1,l.value=0,(()=>{var e,t,n;null==(e=s.value)||e.record(),c.value=!0,null==(t=s.value)||t.addNoteonListenter((e=>{p.value.append(e)})),null==(n=s.value)||n.addNoteoffListenter((()=>{var e,t,n,r;(null==(t=null==(e=s.value)?void 0:e.recording)?void 0:t.length)&&(null==(r=null==(n=s.value)?void 0:n.recording)?void 0:r.length)>=2&&y()}))})()},y=()=>{var e;return!!(null==(e=s.value)?void 0:e.recording)&&(p.value=Ga([]),!!a.submitAnswer(s.value.recording).isCorrect||(h.value++,f.value=!0,h.value<a.maxAttemptsPerView.value&&v(),!1))};return t.onMounted((async()=>{try{s.value=await Ya.instance(),m.value=g.value.note,v(),o.value=!0}catch(e){i.logger.error("Failed to initialize MIDI:",e)}})),{...i,...a,initialized:o,recording:c,inputSeq:p,gradedSeq:d,graded:f,note:m,attempts:h}}}),Tu={"data-viewable":"NotePlayback"},Nu={class:"text-h4"},Au={class:"font-weight-bold"},Pu={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"},Iu={id:"metadata5"};const Du=E(Mu,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("sodipodi:namedview"),c=t.resolveComponent("dc:format"),l=t.resolveComponent("dc:type"),u=t.resolveComponent("dc:title"),h=t.resolveComponent("cc:Work"),d=t.resolveComponent("rdf:RDF");return t.openBlock(),t.createElementBlock("div",Tu,[t.createElementVNode("div",Nu,[n[0]||(n[0]=t.createTextVNode(" Play the note: ")),t.createElementVNode("span",Au,t.toDisplayString(e.note),1)]),e.graded?(t.openBlock(),t.createElementBlock("svg",Pu,[n[2]||(n[2]=t.createElementVNode("defs",{id:"defs2"},null,-1)),t.createVNode(o,{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"}),t.createElementVNode("metadata",Iu,[t.createVNode(d,null,{default:t.withCtx((()=>[t.createVNode(h,{"rdf:about":""},{default:t.withCtx((()=>[t.createVNode(c,null,{default:t.withCtx((()=>n[1]||(n[1]=[t.createTextVNode("image/svg+xml")]))),_:1}),t.createVNode(l,{"rdf:resource":"http://purl.org/dc/dcmitype/StillImage"}),t.createVNode(u)])),_:1})])),_:1})]),n[3]||(n[3]=t.createElementVNode("g",{id:"layer1",transform:"translate(167.75219,-151.96011)","inkscape:groupmode":"layer","inkscape:label":"Layer 1"},[t.createElementVNode("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"}}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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"}}),t.createElementVNode("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"}}),t.createElementVNode("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"}),t.createElementVNode("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"}),t.createElementVNode("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))])):t.createCommentVNode("",!0)])}]]),Bu=[{name:"Note",type:r.FieldType.STRING}],Ou=class _PlayNote2 extends n.Question{constructor(e){super(e),u(this,"note"),this.note=e[0].Note}isCorrect(e){return e[0].note.name===this.note}dataShapes(){return _PlayNote2.dataShapes}views(){return _PlayNote2.views}};u(Ou,"dataShapes",[{fields:Bu,name:r.DataShapeName.PIANO_PlayNote}]),u(Ou,"seedData",["A","B","C","D","E","F","G","A♯","C♯","D♯","F♯","G♯","D♭","E♭","G♭","A♭","B♭"].map((e=>({Note:e})))),u(Ou,"views",[Du]);let Lu=Ou;const Vu=new Course("piano",[Eu,Lu]),Ru=t.defineComponent({name:"IdentifyChroma",components:{RadioMultipleChoice:n.RadioMultipleChoice},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"IdentifyChroma"),a=n.useQuestionView(i),s=t.ref(""),o=t.ref(new AudioContext);a.question.value=new Uu(e.data);const c=t.computed((()=>a.question.value));t.onMounted((()=>{(e=>{const t=[];let n=e/2;for(;n>100;)t.push(n),n/=2;t.push(e);let r=2*e;for(;r<5e3;)t.push(r),r*=2;return t})(295).forEach((e=>(e=>{const t=o.value.createOscillator();t.type="sine",t.frequency.value=e;const 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)})(e)))}));return{...i,...a,answer:s,question:c,submit:()=>{c.value&&c.value.isCorrect(s.value)}}}}),Fu={"data-viewable":"IdentifyChroma"};const zu=E(Ru,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("radio-multiple-choice");return t.openBlock(),t.createElementBlock("div",Fu,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[n[0]||(n[0]=t.createTextVNode(" What note is being played? ")),t.createVNode(o,{"choice-list":e.question.choiceList},null,8,["choice-list"])],64)):t.createCommentVNode("",!0)])}]]);var ju=(e=>(e.A="A",e.B="B",e.C="C",e.D="D",e.E="E",e.F="F",e.G="G",e))(ju||{});const qu=[{name:"Chroma",type:r.FieldType.STRING,validator:{test:e=>Object.values(ju).includes(e)?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"That's not a chroma!"},instructions:"Enter a valid musical note (A-G)"}}],Hu=class _ChromaQuestion2 extends n.Question{constructor(e){super(e),u(this,"chroma"),this.chroma=e[0].Chroma}get baseFreq(){const e=440;return"A"===this.chroma?e:"B"===this.chroma?e*Math.pow(2,2/12):"C"===this.chroma?e*Math.pow(2,.25):e}get choiceList(){return _.shuffle([this.chroma.toString(),"test","options","are","fun"])}isCorrect(e){return e.choiceList[e.selection]===this.chroma.toString()}dataShapes(){return _ChromaQuestion2.dataShapes}views(){return _ChromaQuestion2.views}};u(Hu,"dataShapes",[{fields:qu,name:r.DataShapeName.PITCH_chroma}]),u(Hu,"views",[zu]);let Uu=Hu;const Gu=new Course("pitch",[Uu]);var Wu,Yu,$u,Ku,Qu,Xu,Zu,Ju,eh,th,nh,rh,ih,ah,sh,oh,ch,lh,uh,hh,dh,fh,ph,mh;function gh(){if(Ku)return $u;Ku=1;return $u=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),0===e.noteTimings.length&&(n.noteTimings=e.setTiming(0,0)),n.lineEndCallback&&(n.lineEndTimings=function(e,t){for(var n=[],r=null,i=0;i<e.length;i++){var a=e[i];"end"!==a.type&&a.top!==r&&(n.push({measureNumber:a.measureNumber,milliseconds:a.milliseconds-t,top:a.top,bottom:a.top+a.height}),r=a.top)}return n}(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,0!==n.noteTimings.length&&(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&&"event"===n.noteTimings[n.currentEvent].type){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 i=n.doBeatCallback(e);null!==i&&(n.currentTime=i)}}else if(n.currentBeat<=n.totalBeats&&n.beatCallback){var a=n.doBeatCallback(e);null!==a&&(n.currentTime=a),requestAnimationFrame(n.doTiming)}if(n.currentTime>=n.lastMoment)if(n.eventCallback){var s=n.eventCallback(null);n.shouldStop(s).then((function(e){e&&n.stop()}))}else n.stop()}},n.shouldStop=function(e){return new Promise((function(t){return e?"continue"===e?t(!1):void(e.then&&e.then((function(e){t("continue"!==e)}))):t(!0)}))},n.doBeatCallback=function(e){if(n.beatCallback){for(var t,r,i=n.currentEvent;i<n.noteTimings.length&&null===n.noteTimings[i].left;)i++;if(i<n.noteTimings.length){for(t=n.noteTimings[i].milliseconds,i=Math.max(0,n.currentEvent-1);i>=0&&null===n.noteTimings[i].left;)i--;r=n.noteTimings[i]}var a={},s={};if(r){a.top=r.top,a.height=r.height;var o=Math.max(0,e-n.startTime-r.milliseconds),c=t-r.milliseconds,l=r.endX-r.left,u=c?o*l/c:0;a.left=r.left+u,0===n.currentEvent&&r.milliseconds>e-n.startTime&&(a.left=void 0),s={timestamp:e,startTime:n.startTime,ev:r,endMs:t,offMs:o,offPx:u,gapMs:c,gapPx:l}}else s={timestamp:e,startTime:n.startTime};var h=n.startTime;if(n.beatCallback(n.currentBeat/n.beatSubdivisions,n.totalBeats/n.beatSubdivisions,n.lastMoment,a,s),h!==n.startTime)return e-n.startTime;n.currentBeat++}return null};n.animationJogger=function(){n.isRunning&&(n.doTiming(performance.now()),n.joggerTimer=setTimeout(n.animationJogger,60))},n.start=function(e,t){if(n.isRunning=!0,n.isPaused&&(n.isPaused=!1,void 0===e&&(n.justUnpaused=!0)),e)n.setProgress(e,t);else if(0===e)n.reset();else if(null!==n.pausedPercent){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,60)},n.pause=function(){n.isPaused=!0;var e=performance.now();n.pausedPercent=(e-n.startTime)/n.lastMoment,n.isRunning=!1,n.joggerTimer&&(clearTimeout(n.joggerTimer),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=1e3*e,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)<0&&(r=0),r>1&&(r=1),n.currentTime=n.lastMoment*r}n.isRunning||(n.pausedPercent=r);var i=performance.now();for(n.startTime=i-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 a=n.currentBeat;n.currentBeat=Math.floor(n.currentTime/n.millisecondsPerBeat),n.beatCallback&&a!==n.currentBeat&&n.doBeatCallback(n.startTime+n.currentTime),n.eventCallback&&n.currentEvent>=0&&"event"===n.noteTimings[n.currentEvent].type&&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,60)}}}function vh(){if(Xu)return Qu;Xu=1;var e,t,n=gh(),r={};return r.startAnimation=function(r,i,a){function s(e){for(var t=0;t<e.length;t++){var n=e[t];n.classList.contains("abcjs-bar")||(n.style.display="none")}}var o;function c(e){a.hideCurrentMeasure?function(e){s(r.querySelectorAll(e))}(e):a.hideFinishedMeasures&&function(e){o&&s(r.querySelectorAll(o)),o=e}(e)}e&&(e.stop(),e=void 0),a.showCursor&&((t=r.querySelector(".abcjs-cursor"))||((t=document.createElement("DIV")).className="abcjs-cursor cursor",t.style.position="absolute",r.appendChild(t),r.style.position="relative")),(e=new n(i,{qpm:a.bpm,eventCallback:function(n){if(n){if(n.measureStart){var r=".abcjs-l"+(i=n).line+".abcjs-m"+i.measureNumber;r&&c(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;var i}})).start()},r.pauseAnimation=function(t){e&&(t?e.pause():e.start())},r.stopAnimation=function(){e&&(e.stop(),e=void 0)},Qu=r}function yh(){if(Ju)return Zu;Ju=1;var e={cloneArray:function(e){for(var t=[],n=0;n<e.length;n++)t.push(Object.assign({},e[n]));return t},cloneHashOfHash:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=Object.assign({},e[n]));return t},cloneHashOfArrayOfHash:function(t){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e.cloneArray(t[r]));return n},strip:function(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")},startsWith:function(e,t){return 0===e.indexOf(t)},endsWith:function(e,t){var n=e.length-t.length;return n>=0&&e.lastIndexOf(t)===n},last:function(e){return 0===e.length?null:e[e.length-1]}};return Zu=e}function bh(){if(th)return eh;th=1;var e=yh(),t={};return function(){var n,r,i,a,s;t.initialize=function(e,t,o,c,l){n=e,r=t,a=c,s=l,(i=o).annotationfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},i.gchordfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},i.historyfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},i.infofont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},i.measurefont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},i.partsfont={face:'"Times New Roman"',size:15,weight:"normal",style:"normal",decoration:"none"},i.repeatfont={face:'"Times New Roman"',size:13,weight:"normal",style:"normal",decoration:"none"},i.textfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},i.tripletfont={face:"Times",size:11,weight:"normal",style:"italic",decoration:"none"},i.vocalfont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},i.wordsfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},a.formatting.composerfont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},a.formatting.subtitlefont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},a.formatting.tempofont={face:'"Times New Roman"',size:15,weight:"bold",style:"normal",decoration:"none"},a.formatting.titlefont={face:'"Times New Roman"',size:20,weight:"normal",style:"normal",decoration:"none"},a.formatting.footerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},a.formatting.headerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},a.formatting.voicefont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},a.formatting.tablabelfont={face:'"Trebuchet MS"',size:16,weight:"normal",style:"normal",decoration:"none"},a.formatting.tabnumberfont={face:'"Arial"',size:11,weight:"normal",style:"normal",decoration:"none"},a.formatting.tabgracefont={face:'"Arial"',size:8,weight:"normal",style:"normal",decoration:"none"},a.formatting.annotationfont=i.annotationfont,a.formatting.gchordfont=i.gchordfont,a.formatting.historyfont=i.historyfont,a.formatting.infofont=i.infofont,a.formatting.measurefont=i.measurefont,a.formatting.partsfont=i.partsfont,a.formatting.repeatfont=i.repeatfont,a.formatting.textfont=i.textfont,a.formatting.tripletfont=i.tripletfont,a.formatting.vocalfont=i.vocalfont,a.formatting.wordsfont=i.wordsfont};var o={gchordfont:!0,measurefont:!0,partsfont:!0,annotationfont:!0,composerfont:!0,historyfont:!0,infofont:!0,subtitlefont:!0,textfont:!0,titlefont:!0,voicefont:!0},c=function(e,t,n,i,a){function s(){var s=parseInt(e[0].token);return e.shift(),t?0===e.length?{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:s}:1===e.length&&"box"===e[0].token&&o[a]?{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:s,box:!0}:(r("Extra parameters in font definition.",n,i),{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:s}):(r("Can't set just the size of the font since there is no default value.",n,i),{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none",size:s})}if("*"===e[0].token){if(e.shift(),"number"===e[0].type)return s();r("Expected font size number after *.",n,i)}if("number"===e[0].type)return s();for(var c,l=[],u="normal",h="normal",d="none",f=!1,p="face",m=!1;e.length;){var g=e.shift(),v=g.token.toLowerCase();switch(p){case"face":m||"utf"!==v&&"number"!==g.type&&"bold"!==v&&"italic"!==v&&"underline"!==v&&"box"!==v?l.length>0&&"-"===g.token?(m=!0,l[l.length-1]=l[l.length-1]+g.token):m?(m=!1,l[l.length-1]=l[l.length-1]+g.token):l.push(g.token):"number"===g.type?(c?r("Font size specified twice in font definition.",n,i):c=g.token,p="modifier"):"bold"===v?u="bold":"italic"===v?h="italic":"underline"===v?d="underline":"box"===v?(o[a]?f=!0:r('This font style doesn\'t support "box"',n,i),p="finished"):"utf"===v?(g=e.shift(),p="size"):r("Unknown parameter "+g.token+" in font definition.",n,i);break;case"size":"number"===g.type?c?r("Font size specified twice in font definition.",n,i):c=g.token:r("Expected font size in font definition.",n,i),p="modifier";break;case"modifier":"bold"===v?u="bold":"italic"===v?h="italic":"underline"===v?d="underline":"box"===v?(o[a]?f=!0:r('This font style doesn\'t support "box"',n,i),p="finished"):r("Unknown parameter "+g.token+" in font definition.",n,i);break;case"finished":r('Extra characters found after "box" in font definition.',n,i)}}void 0===c?t?c=t.size:(r("Must specify the size of the font since there is no default value.",n,i),c=12):c=parseFloat(c),""===(l=l.join(" "))&&(t?l=t.face:(r("Must specify the name of the font since there is no default value.",n,i),l="sans-serif"));var y=function(e){switch(e){case"Arial-Italic":return{face:"Arial",weight:"normal",style:"italic",decoration:"none"};case"Arial-Bold":return{face:"Arial",weight:"bold",style:"normal",decoration:"none"};case"Bookman-Demi":return{face:"Bookman,serif",weight:"bold",style:"normal",decoration:"none"};case"Bookman-DemiItalic":return{face:"Bookman,serif",weight:"bold",style:"italic",decoration:"none"};case"Bookman-Light":return{face:"Bookman,serif",weight:"normal",style:"normal",decoration:"none"};case"Bookman-LightItalic":return{face:"Bookman,serif",weight:"normal",style:"italic",decoration:"none"};case"Courier":return{face:'"Courier New"',weight:"normal",style:"normal",decoration:"none"};case"Courier-Oblique":return{face:'"Courier New"',weight:"normal",style:"italic",decoration:"none"};case"Courier-Bold":return{face:'"Courier New"',weight:"bold",style:"normal",decoration:"none"};case"Courier-BoldOblique":return{face:'"Courier New"',weight:"bold",style:"italic",decoration:"none"};case"AvantGarde-Book":return{face:"AvantGarde,Arial",weight:"normal",style:"normal",decoration:"none"};case"AvantGarde-BookOblique":return{face:"AvantGarde,Arial",weight:"normal",style:"italic",decoration:"none"};case"AvantGarde-Demi":case"Avant-Garde-Demi":return{face:"AvantGarde,Arial",weight:"bold",style:"normal",decoration:"none"};case"AvantGarde-DemiOblique":return{face:"AvantGarde,Arial",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Oblique":return{face:"Helvetica",weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Bold":return{face:"Helvetica",weight:"bold",style:"normal",decoration:"none"};case"Helvetica-BoldOblique":return{face:"Helvetica",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Narrow":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"normal",decoration:"none"};case"Helvetica-Narrow-Oblique":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Narrow-Bold":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"normal",decoration:"none"};case"Helvetica-Narrow-BoldOblique":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"italic",decoration:"none"};case"Palatino-Roman":return{face:"Palatino",weight:"normal",style:"normal",decoration:"none"};case"Palatino-Italic":return{face:"Palatino",weight:"normal",style:"italic",decoration:"none"};case"Palatino-Bold":return{face:"Palatino",weight:"bold",style:"normal",decoration:"none"};case"Palatino-BoldItalic":return{face:"Palatino",weight:"bold",style:"italic",decoration:"none"};case"NewCenturySchlbk-Roman":return{face:'"New Century",serif',weight:"normal",style:"normal",decoration:"none"};case"NewCenturySchlbk-Italic":return{face:'"New Century",serif',weight:"normal",style:"italic",decoration:"none"};case"NewCenturySchlbk-Bold":return{face:'"New Century",serif',weight:"bold",style:"normal",decoration:"none"};case"NewCenturySchlbk-BoldItalic":return{face:'"New Century",serif',weight:"bold",style:"italic",decoration:"none"};case"Times":case"Times-Roman":case"Times-Narrow":case"Times-Courier":case"Times-New-Roman":return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none"};case"Times-Italic":case"Times-Italics":return{face:'"Times New Roman"',weight:"normal",style:"italic",decoration:"none"};case"Times-Bold":return{face:'"Times New Roman"',weight:"bold",style:"normal",decoration:"none"};case"Times-BoldItalic":return{face:'"Times New Roman"',weight:"bold",style:"italic",decoration:"none"};case"ZapfChancery-MediumItalic":return{face:'"Zapf Chancery",cursive,serif',weight:"normal",style:"normal",decoration:"none"};default:return null}}(l),b={};return y?(b.face=y.face,b.weight=y.weight,b.style=y.style,b.decoration=y.decoration,b.size=c,f&&(b.box=!0),b):(b.face=l,b.weight=u,b.style=h,b.decoration=d,b.size=c,f&&(b.box=!0),b)},l=function(e,t,n){return 0===t.length?'Directive "'+e+'" requires a font as a parameter.':(i[e]=c(t,i[e],n,0,e),i.is_in_header&&(a.formatting[e]=i[e]),null)},u=function(e,t){var n="";t.forEach((function(e){n+=e.token}));var r=parseFloat(n);if(isNaN(r)||0===r)return'Directive "'+e+'" requires a number as a parameter.';a.formatting.scale=r},h=["acoustic-bass-drum","bass-drum-1","side-stick","acoustic-snare","hand-clap","electric-snare","low-floor-tom","closed-hi-hat","high-floor-tom","pedal-hi-hat","low-tom","open-hi-hat","low-mid-tom","hi-mid-tom","crash-cymbal-1","high-tom","ride-cymbal-1","chinese-cymbal","ride-bell","tambourine","splash-cymbal","cowbell","crash-cymbal-2","vibraslap","ride-cymbal-2","hi-bongo","low-bongo","mute-hi-conga","open-hi-conga","low-conga","high-timbale","low-timbale","high-agogo","low-agogo","cabasa","maracas","short-whistle","long-whistle","short-guiro","long-guiro","claves","hi-wood-block","low-wood-block","mute-cuica","open-cuica","mute-triangle","open-triangle"],d=function(e,t,n,r,a){if(1!==n.length||"number"!==n[0].type)return'Directive "'+t+'" requires a number as a parameter.';var s=n[0].intt;return void 0!==r&&s<r?'Directive "'+t+'" requires a number greater than or equal to '+r+" as a parameter.":void 0!==a&&s>a?'Directive "'+t+'" requires a number less than or equal to '+a+" as a parameter.":(i[e]=s,null)},f=function(e,t,n){if(1===n.length&&("true"===n[0].token||"false"===n[0].token))return i[e]="true"===n[0].token,null;var r=d(e,t,n,0,1);return null!==r?r:(i[e]=1===i[e],null)},p=function(e,t,n,r){if(1!==n.length)return'Directive "'+t+'" requires one of [ '+r.join(", ")+" ] as a parameter.";for(var a=n[0].token,s=!1,o=0;!s&&o<r.length;o++)r[o]===a&&(s=!0);return s?(i[e]=a,null):'Directive "'+t+'" requires one of [ '+r.join(", ")+" ] as a parameter."},m=["nobarlines","barlines","beataccents","nobeataccents","droneon","droneoff","drumon","drumoff","fermatafixed","fermataproportional","gchordon","gchordoff","controlcombo","temperamentnormal","noportamento"],g=["gchord","ptstress","beatstring"],v=["bassvol","chordvol","c","channel","beatmod","deltaloudness","drumbars","gracedivider","makechordchannels","randomchordattack","chordattack","stressmodel","transpose","rtranspose","vol","volinc","gchordbars"],y=["program"],b=["ratio","snt","bendvelocity","pitchbend","control","temperamentlinear"],_=["beat"],w=["drone"],x=["portamento"],k=["expand","grace","trim"],C=["drum","chordname"],S=["bassprog","chordprog"];t.parseFontChangeLine=function(e){var t=(e=e.replace(/\$\$/g,"")).split("$");if(t.length>1&&i.setfont){var n=[];""!==t[0]&&n.push({text:t[0]});for(var r=1;r<t.length;r++)if("0"===t[r][0])n.push({text:t[r].substring(1).replace(/\x03/g,"$$")});else{var a=parseInt(t[r][0],10);i.setfont[a]?n.push({font:i.setfont[a],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 E=["auto","above","below","hidden"];function M(e){if(0===e.length)return{value:1};if(1===e.length)if("number"===e[0].type){if(e[0].floatt>=0||e[0].floatt<=1)return{value:e[0].floatt}}else{if("false"===e[0].token)return{value:0};if("true"===e[0].token)return{value:1}}return{error:"Directive stretchlast requires zero or one parameter: false, true, or number between 0 and 1 (received "+e[0].token+")"}}t.addDirective=function(o){var T=n.tokenize(o,0,o.length);if(0===T.length||"alpha"!==T[0].type)return null;var N=o.substring(o.indexOf(T[0].token)+T[0].token.length);N=n.stripComment(N);var A,P=T.shift().token.toLowerCase(),I="";switch(P){case"bagpipes":a.formatting.bagpipes=!0;break;case"flatbeams":a.formatting.flatbeams=!0;break;case"jazzchords":a.formatting.jazzchords=!0;break;case"accentAbove":a.formatting.accentAbove=!0;break;case"germanAlphabet":a.formatting.germanAlphabet=!0;break;case"landscape":i.landscape=!0;break;case"papersize":i.papersize=N;break;case"graceslurs":if(1!==T.length)return"Directive graceslurs requires one parameter: 0 or 1";if("0"===T[0].token||"false"===T[0].token)a.formatting.graceSlurs=!1;else{if("1"!==T[0].token&&"true"!==T[0].token)return"Directive graceslurs requires one parameter: 0 or 1 (received "+T[0].token+")";a.formatting.graceSlurs=!0}break;case"lineThickness":var D=M(T);if(void 0!==D.value&&(a.formatting.lineThickness=D.value),D.error)return D.error;break;case"stretchlast":var B=M(T);if(void 0!==B.value&&(a.formatting.stretchlast=B.value),B.error)return B.error;break;case"titlecaps":i.titlecaps=!0;break;case"titleleft":a.formatting.titleleft=!0;break;case"measurebox":a.formatting.measurebox=!0;break;case"vocal":return p("vocalPosition",P,T,E);case"dynamic":return p("dynamicPosition",P,T,E);case"gchord":return p("chordPosition",P,T,E);case"ornament":return p("ornamentPosition",P,T,E);case"volume":return p("volumePosition",P,T,E);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 function(e,t){var r=n.getMeasurement(t);return 0===r.used||0!==t.length?'Directive "'+e+'" requires a measurement as a parameter.':(a.formatting[e]=r.value,null)}(P,T);case"voicescale":if(1!==T.length||"number"!==T[0].type)return"voicescale requires one float as a parameter";var O=T.shift();return i.currentVoice&&(i.currentVoice.scale=O.floatt,s.changeVoiceScale(i.currentVoice.scale)),null;case"voicecolor":if(1!==T.length)return"voicecolor requires one string as a parameter";var L=T.shift();return i.currentVoice&&(i.currentVoice.color=L.token,s.changeVoiceColor(i.currentVoice.color)),null;case"vskip":var V=Math.round(function(e,t){var r=n.getMeasurement(t);return 0===r.used||0!==t.length?{error:'Directive "'+e+'" requires a measurement as a parameter.'}:r.value}(P,T));return V.error?V.error:(s.addSpacing(V),null);case"scale":u(P,T);break;case"sep":if(0===T.length)s.addSeparator(14,14,85,{startChar:i.iChar,endChar:i.iChar+5});else{var R=n.getMeasurement(T);if(0===R.used)return'Directive "'+P+'" requires 3 numbers: space above, space below, length of line';var F=R.value;if(0===(R=n.getMeasurement(T)).used)return'Directive "'+P+'" requires 3 numbers: space above, space below, length of line';var z=R.value;if(0===(R=n.getMeasurement(T)).used||0!==T.length)return'Directive "'+P+'" requires 3 numbers: space above, space below, length of line';var j=R.value;s.addSeparator(F,z,j,{startChar:i.iChar,endChar:i.iChar+N.length})}break;case"barsperstaff":if(null!==(I=d("barsperstaff",P,T)))return I;break;case"staffnonote":if(1!==T.length)return"Directive staffnonote requires one parameter: 0 or 1";if("0"===T[0].token)i.staffnonote=!0;else{if("1"!==T[0].token)return"Directive staffnonote requires one parameter: 0 or 1 (received "+T[0].token+")";i.staffnonote=!1}break;case"printtempo":if(null!==(I=f("printTempo",P,T)))return I;break;case"partsbox":if(null!==(I=f("partsBox",P,T)))return I;i.partsfont.box=i.partsBox;break;case"freegchord":if(null!==(I=f("freegchord",P,T)))return I;break;case"measurenb":case"barnumbers":if(null!==(I=d("barNumbers",P,T)))return I;break;case"setbarnb":if(1!==T.length||"number"!==T[0].type)return"Directive setbarnb requires a number as a parameter.";i.currBarNumber=s.setBarNumberImmediate(T[0].intt);break;case"begintext":var q="";for(A=n.nextLine();A&&0!==A.indexOf("%%endtext");)e.startsWith(A,"%%")?q+=A.substring(2)+"\n":q+=A+"\n",A=n.nextLine();s.addText(q,{startChar:i.iChar,endChar:i.iChar+q.length+7});break;case"continueall":i.continueall=!0;break;case"beginps":for(A=n.nextLine();A&&0!==A.indexOf("%%endps");)n.nextLine();r("Postscript ignored",o,0);break;case"deco":N.length>0&&i.ignoredDecorations.push(N.substring(0,N.indexOf(" "))),r("Decoration redefinition ignored",o,0);break;case"text":var H=n.translateString(N);s.addText(t.parseFontChangeLine(H),{startChar:i.iChar,endChar:i.iChar+N.length+7});break;case"center":var U=n.translateString(N);s.addCentered(t.parseFontChangeLine(U));break;case"font":break;case"setfont":var G=n.tokenize(N,0,N.length);if(G.length>=4&&"-"===G[0].token&&"number"===G[1].type){var W=parseInt(G[1].token);W>=1&&W<=9&&(i.setfont||(i.setfont=[]),G.shift(),G.shift(),i.setfont[W]=c(G,i.setfont[W],o,0,"setfont"))}break;case"gchordfont":case"partsfont":case"tripletfont":case"vocalfont":case"textfont":case"annotationfont":case"historyfont":case"infofont":case"measurefont":case"repeatfont":case"wordsfont":return l(P,T,o);case"composerfont":case"subtitlefont":case"tempofont":case"titlefont":case"voicefont":case"footerfont":case"headerfont":return function(e,t,n){return 0===t.length?'Directive "'+e+'" requires a font as a parameter.':(a.formatting[e]=c(t,a.formatting[e],n,0,e),null)}(P,T,o);case"barlabelfont":case"barnumberfont":case"barnumfont":return l("measurefont",T,o);case"staves":case"score":i.score_is_present=!0;for(var Y,$=function(t,n,r,a,s){(n||0===i.staves.length)&&i.staves.push({index:i.staves.length,numVoices:0});var o=e.last(i.staves);void 0!==r&&void 0===o.bracket&&(o.bracket=r),void 0!==a&&void 0===o.brace&&(o.brace=a),s&&(o.connectBarLines="end"),void 0===i.voices[t]&&(i.voices[t]={staffNum:o.index,index:o.numVoices},o.numVoices++)},K=!1,Q=!1,X=!1,Z=!1,J=!1,ee=!1,te=!1,ne=function(){if(te=!0,Y){var e="start";Y.staffNum>0&&("start"!==i.staves[Y.staffNum-1].connectBarLines&&"continue"!==i.staves[Y.staffNum-1].connectBarLines||(e="continue")),i.staves[Y.staffNum].connectBarLines=e}};T.length;){var re=T.shift();switch(re.token){case"(":K?r("Can't nest parenthesis in %%score",o,re.start):(K=!0,Z=!0);break;case")":!K||Z?r("Unexpected close parenthesis in %%score",o,re.start):K=!1;break;case"[":Q?r("Can't nest brackets in %%score",o,re.start):(Q=!0,J=!0);break;case"]":!Q||J?r("Unexpected close bracket in %%score",o,re.start):(Q=!1,i.staves[Y.staffNum].bracket="end");break;case"{":X?r("Can't nest braces in %%score",o,re.start):(X=!0,ee=!0);break;case"}":!X||ee?r("Unexpected close brace in %%score",o,re.start):(X=!1,i.staves[Y.staffNum].brace="end");break;case"|":ne();break;default:for(var ie="";("alpha"===re.type||"number"===re.type)&&(ie+=re.token,re.continueId);)re=T.shift();$(ie,!K||Z,J?"start":Q?"continue":void 0,ee?"start":X?"continue":void 0,te),Z=!1,J=!1,ee=!1,te=!1,Y=i.voices[ie],"staves"===P&&ne()}}break;case"newpage":var ae=n.getInt(N);s.addNewPage(0===ae.digits?-1:ae.value);break;case"abc":var se=N.split(" ");switch(se[0]){case"-copyright":case"-creator":case"-edited-by":case"-version":case"-charset":var oe=se.shift();s.addMetaText(P+oe,se.join(" "),{startChar:i.iChar,endChar:i.iChar+N.length+5});break;default:return"Unknown directive: "+P+se[0]}break;case"header":case"footer":var ce=n.getMeat(N,0,N.length);'"'===(ce=N.substring(ce.start,ce.end))[0]&&'"'===ce[ce.length-1]&&(ce=ce.substring(1,ce.length-1));var le=ce.split("\t"),ue={};ue=1===le.length?{left:"",center:le[0],right:""}:2===le.length?{left:le[0],center:le[1],right:""}:{left:le[0],center:le[1],right:le[2]},le.length>3&&r("Too many tabs in "+P+": "+le.length+" found.",N,0),s.addMetaTextObj(P,ue,{startChar:i.iChar,endChar:i.iChar+o.length});break;case"midi":var he=n.tokenize(N,0,N.length,!0);he.length>0&&"="===he[0].token&&he.shift(),0===he.length?r("Expected midi command",N,0):function(e,t,n){var i=e.shift().token,a=[];if(m.indexOf(i)>=0)0!==e.length&&r("Unexpected parameter in MIDI "+i,n,0);else if(g.indexOf(i)>=0)1!==e.length?r("Expected one parameter in MIDI "+i,n,0):a.push(e[0].token);else if(v.indexOf(i)>=0)1!==e.length?r("Expected one parameter in MIDI "+i,n,0):"number"!==e[0].type?r("Expected one integer parameter in MIDI "+i,n,0):a.push(e[0].intt);else if(y.indexOf(i)>=0)1!==e.length&&2!==e.length?r("Expected one or two parameters in MIDI "+i,n,0):"number"!==e[0].type||2===e.length&&"number"!==e[1].type?r("Expected integer parameter in MIDI "+i,n,0):(a.push(e[0].intt),2===e.length&&a.push(e[1].intt));else if(b.indexOf(i)>=0)2!==e.length?r("Expected two parameters in MIDI "+i,n,0):"number"!==e[0].type||"number"!==e[1].type?r("Expected two integer parameters in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[1].intt));else if(x.indexOf(i)>=0)2!==e.length?r("Expected two parameters in MIDI "+i,n,0):"alpha"!==e[0].type||"number"!==e[1].type?r("Expected one string and one integer parameters in MIDI "+i,n,0):(a.push(e[0].token),a.push(e[1].intt));else if("drummap"===i)2===e.length&&"alpha"===e[0].type&&"number"===e[1].type?(t.formatting||(t.formatting={}),t.formatting.midi||(t.formatting.midi={}),t.formatting.midi.drummap||(t.formatting.midi.drummap={}),t.formatting.midi.drummap[e[0].token]=e[1].intt,a=t.formatting.midi.drummap):3===e.length&&"punct"===e[0].type&&"alpha"===e[1].type&&"number"===e[2].type?(t.formatting||(t.formatting={}),t.formatting.midi||(t.formatting.midi={}),t.formatting.midi.drummap||(t.formatting.midi.drummap={}),t.formatting.midi.drummap[e[0].token+e[1].token]=e[2].intt,a=t.formatting.midi.drummap):r("Expected one note name and one integer parameter in MIDI "+i,n,0);else if(k.indexOf(i)>=0)3!==e.length||"number"!==e[0].type||"/"!==e[1].token||"number"!==e[2].type?r("Expected fraction parameter in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[2].intt));else if(_.indexOf(i)>=0)4!==e.length?r("Expected four parameters in MIDI "+i,n,0):"number"!==e[0].type||"number"!==e[1].type||"number"!==e[2].type||"number"!==e[3].type?r("Expected four integer parameters in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[1].intt),a.push(e[2].intt),a.push(e[3].intt));else if(w.indexOf(i)>=0)5!==e.length?r("Expected five parameters in MIDI "+i,n,0):"number"!==e[0].type||"number"!==e[1].type||"number"!==e[2].type||"number"!==e[3].type||"number"!==e[4].type?r("Expected five integer parameters in MIDI "+i,n,0):(a.push(e[0].intt),a.push(e[1].intt),a.push(e[2].intt),a.push(e[3].intt),a.push(e[4].intt));else if(y.indexOf(i)>=0)1!==e.length||4!==e.length?r("Expected one or two parameters in MIDI "+i,n,0):"number"!==e[0].type?r("Expected integer parameter in MIDI "+i,n,0):4===e.length?("octave"!==e[1].token&&r("Expected octave parameter in MIDI "+i,n,0),"="!==e[2].token&&r("Expected octave parameter in MIDI "+i,n,0),"number"!==e[3].type&&r("Expected integer parameter for octave in MIDI "+i,n,0)):(a.push(e[0].intt),4===e.length&&a.push(e[3].intt));else if(C.indexOf(i)>=0)if(e.length<2)r("Expected string parameter and at least one integer parameter in MIDI "+i,n,0);else if("alpha"!==e[0].type)r("Expected string parameter and at least one integer parameter in MIDI "+i,n,0);else{var o=e.shift();for(a.push(o.token);e.length>0;)"number"!==(o=e.shift()).type&&r("Expected integer parameter in MIDI "+i,n,0),a.push(o.intt)}else if(S.indexOf(i)>=0)if(1!==e.length&&2!==e.length)r("Expected one or two parameters in MIDI "+i,n,0);else if("number"!==e[0].type)r("Expected integer parameter in MIDI "+i,n,0);else if(2===e.length&&"alpha"!==e[1].type)r("Expected alpha parameter in MIDI "+i,n,0);else if(a.push(e[0].intt),2===e.length){var c=e[1].token;-1!=c.indexOf("octave=")?(c=c.replace("octave=",""),c=parseInt(c),isNaN(c)?r("Expected octave value in MIDI"+i):(c<-1&&(r("Expected octave= in MIDI "+i+" to be >= -1 (recv:"+c+")"),c=-1),c>3&&(r("Expected octave= in MIDI "+i+" to be <= 3 (recv:"+c+")"),c=3),a.push(c))):r("Expected octave= in MIDI"+i)}s.hasBeginMusic()?s.appendElement("midi",-1,-1,{cmd:i,params:a}):(void 0===t.formatting.midi&&(t.formatting.midi={}),t.formatting.midi[i]=a)}(he,a,N);break;case"percmap":var de=function(e){var t=e.split(/\s+/);if(2!==t.length&&3!==t.length)return{error:'Expected parameters "abc-note", "drum-sound", and optionally "note-head"'};var n=t[0],r=parseInt(t[1],10);if((isNaN(r)||r<35||r>81)&&t[1]&&(r=h.indexOf(t[1].toLowerCase())+35),isNaN(r)||r<35||r>81)return{error:'Expected drum name, received "'+t[1]+'"'};var i={sound:r};return 3===t.length&&(i.noteHead=t[2]),{key:n,value:i}}(N);de.error?r(de.error,o,8):(a.formatting.percmap||(a.formatting.percmap={}),a.formatting.percmap[de.key]=de.value);break;case"map":case"playtempo":case"auquality":case"continuous":case"nobarcheck":a.formatting[P]=N;break;default:return"Unknown directive: "+P}return null},t.globalFormatting=function(e){for(var t in e)if(e.hasOwnProperty(t)){var s,o=""+e[t],c=n.tokenize(o,0,o.length);switch(t){case"titlefont":case"gchordfont":case"composerfont":case"footerfont":case"headerfont":case"historyfont":case"infofont":case"measurefont":case"partsfont":case"repeatfont":case"subtitlefont":case"tempofont":case"textfont":case"voicefont":case"tripletfont":case"vocalfont":case"wordsfont":case"annotationfont":case"tablabelfont":case"tabnumberfont":case"tabgracefont":l(t,c,o);break;case"scale":u(t,c);break;case"partsbox":null!==(s=f("partsBox",t,c))&&r(s),i.partsfont.box=i.partsBox;break;case"freegchord":null!==(s=f("freegchord",t,c))&&r(s);break;case"fontboxpadding":1===c.length&&"number"===c[0].type||r('Directive "'+t+'" requires a number as a parameter.'),a.formatting.fontboxpadding=c[0].floatt;break;case"stafftopmargin":1===c.length&&"number"===c[0].type||r('Directive "'+t+'" requires a number as a parameter.'),a.formatting.stafftopmargin=c[0].floatt;break;case"stretchlast":var h=M(c);if(void 0!==h.value&&(a.formatting.stretchlast=h.value),h.error)return h.error;break;default:r("Formatting directive unrecognized: ",t,0)}}}}(),eh=t}function _h(){if(ah)return ih;ah=1;var e=["C","C♯","D","D♯","E","F","F♯","G","G♯","A","A♯","B"],t=["C","D♭","D","E♭","E","F","G♭","G","A♭","A","B♭","B"],n=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],r=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"];return ih=function(i,a,s,o){if(!a||a%12==0)return i;for(;a<0;)a+=12;a>11&&(a%=12);var c=i.match(/^([A-G][b#♭♯]?)([^\/]+)?\/?([A-G][b#♭♯]?)?(.+)?/);if(!c)return i;var l,u=c[1],h=c[2],d=c[3],f=c[4];return(l=e.indexOf(u))<0&&(l=t.indexOf(u)),l<0&&(l=n.indexOf(u)),l<0&&(l=r.indexOf(u)),l<0||(l+=a,l%=12,i=s?o?r[l]:t[l]:o?n[l]:e[l],h&&(i+=h),d&&((l=e.indexOf(d))<0&&(l=t.indexOf(d)),l<0&&(l=n.indexOf(d)),l<0&&(l=r.indexOf(d)),i+="/",l>=0?(l+=a,l%=12,i+=s?o?r[l]:t[l]:o?n[l]:e[l]):i+=d),f&&(i+=f)),i}}function wh(){if(oh)return sh;oh=1;var e={C:{modes:["CMaj","Amin","Am","GMix","DDor","EPhr","FLyd","BLoc"],stepsFromC:0},Db:{modes:["DbMaj","Bbmin","Bbm","AbMix","EbDor","FPhr","GbLyd","CLoc"],stepsFromC:1},D:{modes:["DMaj","Bmin","Bm","AMix","EDor","F#Phr","GLyd","C#Loc"],stepsFromC:2},Eb:{modes:["EbMaj","Cmin","Cm","BbMix","FDor","GPhr","AbLyd","DLoc"],stepsFromC:3},E:{modes:["EMaj","C#min","C#m","BMix","F#Dor","G#Phr","ALyd","D#Loc"],stepsFromC:4},F:{modes:["FMaj","Dmin","Dm","CMix","GDor","APhr","BbLyd","ELoc"],stepsFromC:5},Gb:{modes:["GbMaj","Ebmin","Ebm","DbMix","AbDor","BbPhr","CbLyd","FLoc"],stepsFromC:6},G:{modes:["GMaj","Emin","Em","DMix","ADor","BPhr","CLyd","F#Loc"],stepsFromC:7},Ab:{modes:["AbMaj","Fmin","Fm","EbMix","BbDor","CPhr","DbLyd","GLoc"],stepsFromC:8},A:{modes:["AMaj","F#min","F#m","EMix","BDor","C#Phr","DLyd","G#Loc"],stepsFromC:9},Bb:{modes:["BbMaj","Gmin","Gm","FMix","CDor","DPhr","EbLyd","ALoc"],stepsFromC:10},B:{modes:["BMaj","G#min","G#m","F#Mix","C#Dor","D#Phr","ELyd","A#Loc"],stepsFromC:11},"C#":{modes:["C#Maj","A#min","A#m","G#Mix","D#Dor","E#Phr","F#Lyd","B#Loc"],stepsFromC:1},"F#":{modes:["F#Maj","D#min","D#m","C#Mix","G#Dor","A#Phr","BLyd","E#Loc"],stepsFromC:6},Cb:{modes:["CbMaj","Abmin","Abm","GbMix","DbDor","EbPhr","FbLyd","BbLoc"],stepsFromC:11}},t=null;return sh={relativeMajor:function(n){t||function(){t={};for(var n=Object.keys(e),r=0;r<n.length;r++){var i=e[n[r]];t[n[r].toLowerCase()]=n[r];for(var a=0;a<i.modes.length;a++){var s=i.modes[a].toLowerCase();t[s]=n[r]}}}();var r=n.toLowerCase().match(/([a-g][b#]?)(maj|min|mix|dor|phr|lyd|loc|m)?/);if(!r||!r[2])return n;r=r[1]+r[2];var i=t[r];return i||n},relativeMode:function(t,n){var r=e[t];if(!r)return t;if(""===n)return t;var i=n.toLowerCase().match(/^(maj|min|mix|dor|phr|lyd|loc|m)/);if(!i)return t;for(var a=i[1],s=0;s<r.modes.length;s++){var o=r.modes[s],c=o.toLowerCase().indexOf(a);if(-1!==c&&c===o.length-a.length)return o.substring(0,o.length-a.length)}return t},transposeKey:function(t,n){var r=e[t];if(!r)return t;for(;n<0;)n+=12;for(var i=(r.stepsFromC+n)%12,a=0;a<Object.keys(e).length;a++){var s=Object.keys(e)[a];if(e[s].stepsFromC===i)return s}return t}}}function xh(){if(lh)return ch;lh=1;var{relativeMajor:e}=wh(),t={acc:"sharp",note:"f"},n={acc:"sharp",note:"c"},r={acc:"sharp",note:"g"},i={acc:"sharp",note:"d"},a={acc:"sharp",note:"A"},s={acc:"sharp",note:"e"},o={acc:"flat",note:"B"},c={acc:"flat",note:"e"},l={acc:"flat",note:"A"},u={acc:"flat",note:"d"},h={acc:"flat",note:"G"},d={acc:"flat",note:"c"},f={"C#":[t,n,r,i,a,s,{acc:"sharp",note:"B"}],"F#":[t,n,r,i,a,s],B:[t,n,r,i,a],E:[t,n,r,i],A:[t,n,r],D:[t,n],G:[t],C:[],F:[o],Bb:[o,c],Eb:[o,c,l],Cm:[o,c,l],Ab:[o,c,l,u],Db:[o,c,l,u,h],Gb:[o,c,l,u,h,d],Cb:[o,c,l,u,h,d,{acc:"flat",note:"F"}],"A#":[o,c],"B#":[],"D#":[o,c,l],"E#":[o],"G#":[o,c,l,u],none:[]};return ch=function(t){var n=f[e(t)];return n?JSON.parse(JSON.stringify(n)):null}}function kh(){if(hh)return uh;hh=1;var e=function(){if(rh)return nh;rh=1;var e={};const t=["C,,,","D,,,","E,,,","F,,,","G,,,","A,,,","B,,,","C,,","D,,","E,,","F,,","G,,","A,,","B,,","C,","D,","E,","F,","G,","A,","B,","C","D","E","F","G","A","B","c","d","e","f","g","a","b","c'","d'","e'","f'","g'","a'","b'","c''","d''","e''","f''","g''","a''","b''","c'''","d'''","e'''","f'''","g'''","a'''","b'''"];return e.pitchIndex=function(e){return t.indexOf(e)},e.noteName=function(e){return t[e]},nh=e}(),t=_h(),n=xh(),r={},i={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},a=["C","Db","D","Eb","E","F","F#","G","Ab","A","Bb","B"],s=["C","C#","D","D#","E","F","F#","G","G#","A","Bb","B"];r.keySignature=function(e,t,r,o,c){if("perc"===e.clef.type||"none"===e.clef.type)return{accidentals:n(t),root:r,acc:o};c||(c=0),e.localTransposeVerticalMovement=0,e.localTransposePreferFlats=!1;var l=n(t);if(!l)return e.key;if(e.localTranspose=(e.globalTranspose?e.globalTranspose:0)+c,!e.localTranspose)return{accidentals:l,root:r,acc:o};if(e.globalTransposeOrigKeySig=l,e.localTranspose%12==0)return e.localTransposeVerticalMovement=e.localTranspose/12*7,{accidentals:l,root:r,acc:o};var u=t[0];"b"===t[1]||"#"===t[1]?(u+=t[1],t=t.substr(2)):t=t.substr(1);var h=i[u],d=void 0!==h;d||(h=0,u="C",t="");for(var f=h+e.localTranspose;f<0;)f+=12;f>11&&(f%=12);var p="m"===t[0]?s[f]:a[f],m=p+t,g=n(m);g.length>0&&"flat"===g[0].acc&&(e.localTransposePreferFlats=!0);var v=m.charCodeAt(0)-u.charCodeAt(0);return e.localTranspose>0?v<0?v+=7:0===v&&("#"!==u[1]&&"b"!==m[1]||(v+=7)):e.localTranspose<0&&(v>0?v-=7:0===v&&("b"!==u[1]&&"#"!==m[1]||(v-=7))),e.localTranspose>0?e.localTransposeVerticalMovement=v+7*Math.floor(e.localTranspose/12):e.localTransposeVerticalMovement=v+7*Math.ceil(e.localTranspose/12),d?{accidentals:g,root:p[0],acc:p.length>1?p[1]:""}:{accidentals:[],root:r,acc:o}},r.chordName=function(e,n){return t(n,e.localTranspose,e.localTransposePreferFlats,e.freegchord)};var o=["c","d","e","f","g","a","b"];var c={dblflat:-2,flat:-1,natural:0,sharp:1,dblsharp:2},l={"-2":"dblflat","-1":"flat",0:"natural",1:"sharp",2:"dblsharp"},u={"-2":"__","-1":"_",0:"=",1:"^",2:"^^"};return r.note=function(t,n){if(t.localTranspose&&"perc"!==t.clef.type){var r=n.pitch;if(t.localTransposeVerticalMovement&&(n.pitch=n.pitch+t.localTransposeVerticalMovement,n.name)){var i=n.accidental?n.name.substring(1):n.name,a=n.accidental?n.name[0]:"",s=e.pitchIndex(i);n.name=a+e.noteName(s+t.localTransposeVerticalMovement)}if(n.accidental){var h=function(e,t,n,r,i){for(var a=o[(e+49)%7],s=0,l=0;l<r.length;l++)r[l].note.toLowerCase()===a&&(s=c[r[l].acc]);for(var u=c[n]-s,h=o[(t+49)%7],d=0,f=0;f<i.accidentals.length;f++)i.accidentals[f].note.toLowerCase()===h&&(d=c[i.accidentals[f].acc]);var p=u+d;return p<-2&&(t--,p+="c"===h||"f"===h?1:2),p>2&&(t++,p-="b"===h||"e"===h?1:2),[t,p]}(r,n.pitch,n.accidental,t.globalTransposeOrigKeySig,t.targetKey);n.pitch=h[0],n.accidental=l[h[1]],n.name&&(n.name=u[h[1]]+n.name.replace(/[_^=]/g,""))}}},uh=r}function Ch(){if(fh)return dh;fh=1;var e=bh(),t=kh(),n={};return function(){var r,i,a,s;n.initialize=function(e,t,n,o,c){r=e,i=t,a=n,s=c},n.standardKey=function(e,n,r,i){return t.keySignature(a,e,n,r,i)};var o={treble:{clef:"treble",pitch:4,mid:0},"treble+8":{clef:"treble+8",pitch:4,mid:0},"treble-8":{clef:"treble-8",pitch:4,mid:0},"treble^8":{clef:"treble+8",pitch:4,mid:0},treble_8:{clef:"treble-8",pitch:4,mid:0},treble1:{clef:"treble",pitch:2,mid:2},treble2:{clef:"treble",pitch:4,mid:0},treble3:{clef:"treble",pitch:6,mid:-2},treble4:{clef:"treble",pitch:8,mid:-4},treble5:{clef:"treble",pitch:10,mid:-6},perc:{clef:"perc",pitch:6,mid:0},none:{clef:"none",mid:0},bass:{clef:"bass",pitch:8,mid:-12},"bass+8":{clef:"bass+8",pitch:8,mid:-12},"bass-8":{clef:"bass-8",pitch:8,mid:-12},"bass^8":{clef:"bass+8",pitch:8,mid:-12},bass_8:{clef:"bass-8",pitch:8,mid:-12},"bass+16":{clef:"bass",pitch:8,mid:-12},"bass-16":{clef:"bass",pitch:8,mid:-12},"bass^16":{clef:"bass",pitch:8,mid:-12},bass_16:{clef:"bass",pitch:8,mid:-12},bass1:{clef:"bass",pitch:2,mid:-6},bass2:{clef:"bass",pitch:4,mid:-8},bass3:{clef:"bass",pitch:6,mid:-10},bass4:{clef:"bass",pitch:8,mid:-12},bass5:{clef:"bass",pitch:10,mid:-14},tenor:{clef:"alto",pitch:8,mid:-8},tenor1:{clef:"alto",pitch:2,mid:-2},tenor2:{clef:"alto",pitch:4,mid:-4},tenor3:{clef:"alto",pitch:6,mid:-6},tenor4:{clef:"alto",pitch:8,mid:-8},tenor5:{clef:"alto",pitch:10,mid:-10},alto:{clef:"alto",pitch:6,mid:-6},alto1:{clef:"alto",pitch:2,mid:-2},alto2:{clef:"alto",pitch:4,mid:-4},alto3:{clef:"alto",pitch:6,mid:-6},alto4:{clef:"alto",pitch:8,mid:-8},alto5:{clef:"alto",pitch:10,mid:-10},"alto+8":{clef:"alto+8",pitch:6,mid:-6},"alto-8":{clef:"alto-8",pitch:6,mid:-6},"alto^8":{clef:"alto+8",pitch:6,mid:-6},alto_8:{clef:"alto-8",pitch:6,mid:-6}},c=function(e,t){var n=o[e];return(n?n.mid:0)+t};n.fixClef=function(e){var t=o[e.type];t&&(e.clefPos=t.pitch,e.type=t.clef)},n.deepCopyKey=function(e){var t={accidentals:[],root:e.root,acc:e.acc,mode:e.mode};return e.accidentals.forEach((function(e){t.accidentals.push(Object.assign({},e))})),t};var l={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11};n.addPosToKey=function(e,t){var n=e.verticalPos;t.accidentals.forEach((function(e){var t=l[e.note];t-=n,e.verticalPos=t})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){var t=l[e.note];t-=n,e.verticalPos=t})),n<-10?(t.accidentals.forEach((function(e){e.verticalPos-=7,(e.verticalPos>=11||10===e.verticalPos&&"flat"===e.acc)&&(e.verticalPos-=7),"A"===e.note&&"sharp"===e.acc&&(e.verticalPos-=7),"G"!==e.note&&"F"!==e.note||"flat"!==e.acc||(e.verticalPos-=7)})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos-=7,(e.verticalPos>=11||10===e.verticalPos&&"flat"===e.acc)&&(e.verticalPos-=7),"A"===e.note&&"sharp"===e.acc&&(e.verticalPos-=7),"G"!==e.note&&"F"!==e.note||"flat"!==e.acc||(e.verticalPos-=7)}))):n<-4?(t.accidentals.forEach((function(e){e.verticalPos-=7,-8!==n||"f"!==e.note&&"g"!==e.note||"sharp"!==e.acc||(e.verticalPos-=7)})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos-=7,-8!==n||"f"!==e.note&&"g"!==e.note||"sharp"!==e.acc||(e.verticalPos-=7)}))):n>=7&&(t.accidentals.forEach((function(e){e.verticalPos+=7})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos+=7})))},n.fixKey=function(e,t){var r=Object.assign({},t);return n.addPosToKey(e,r),r};var u=function(e){var t=0,n=e[t++];"^"!==n&&"_"!==n||(n=e[t++]);var r=l[n];for(void 0===r&&(r=6);t<e.length;t++)if(","===e[t])r-=7;else{if("'"!==e[t])break;r+=7}return{mid:r-6,str:e.substring(t)}};n.parseKey=function(t,s){0===t.length&&(t="none");var o=r.tokenize(t,0,t.length),l={};if(0===o.length)return i("Must pass in key signature.",t,0),l;switch(o[0].token){case"HP":e.addDirective("bagpipes"),a.key={root:"HP",accidentals:[],acc:"",mode:""},l.foundKey=!0,o.shift();break;case"Hp":e.addDirective("bagpipes"),a.key={root:"Hp",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}],acc:"",mode:""},l.foundKey=!0,o.shift();break;case"none":a.key={root:"none",accidentals:[],acc:"",mode:""},l.foundKey=!0,o.shift();break;default:var u=r.getKeyPitch(o[0].token);if(u.len>0){l.foundKey=!0;var h="",d="";o[0].token.length>1?o[0].token=o[0].token.substring(1):o.shift();var f=u.token;if(o.length>0){var p=r.getSharpFlat(o[0].token);if(p.len>0&&(o[0].token.length>1?o[0].token=o[0].token.substring(1):o.shift(),f+=p.token,h=p.token),o.length>0){var m=r.getMode(o[0].token);m.len>0&&(o.shift(),f+=m.token,d=m.token)}if(void 0===n.standardKey(f,u.token,h,0))return i("Unsupported key signature: "+f,t,0),l}var g,v=n.deepCopyKey(a.key),y=!s&&a.globalTranspose?-a.globalTranspose:0;if(s&&(g=a.globalTransposeOrigKeySig),a.key=n.deepCopyKey(n.standardKey(f,u.token,h,y)),s&&(a.globalTransposeOrigKeySig=g),a.key.mode=d,v){for(var b,_=0;_<a.key.accidentals.length;_++)for(b=0;b<v.accidentals.length;b++)v.accidentals[b].note&&a.key.accidentals[_].note.toLowerCase()===v.accidentals[b].note.toLowerCase()&&(v.accidentals[b].note=null);for(b=0;b<v.accidentals.length;b++)v.accidentals[b].note&&(a.key.impliedNaturals||(a.key.impliedNaturals=[]),a.key.impliedNaturals.push({acc:"natural",note:v.accidentals[b].note}))}}}if(0===o.length)return l;if("exp"===o[0].token&&o.shift(),0===o.length)return l;if("oct"===o[0].token&&o.shift(),0===o.length)return l;var w,x=r.getKeyAccidentals2(o);if(x.warn&&i(x.warn,t,0),x.accs){l.foundKey||(l.foundKey=!0,a.key={root:"none",acc:"",mode:"",accidentals:[]}),function(e){for(var t=0;t<e.length;t++)"b"===e[t].note?e[t].note="B":"a"===e[t].note?e[t].note="A":"F"===e[t].note?e[t].note="f":"E"===e[t].note?e[t].note="e":"D"===e[t].note?e[t].note="d":"C"===e[t].note?e[t].note="c":"G"===e[t].note&&"sharp"===e[t].acc?e[t].note="g":"g"===e[t].note&&"flat"===e[t].acc&&(e[t].note="G")}(x.accs);for(var k=0;k<x.accs.length;k++){for(var C=!1,S=0;S<a.key.accidentals.length&&!C;S++)a.key.accidentals[S].note===x.accs[k].note&&(C=!0,a.key.accidentals[S].acc!==x.accs[k].acc&&(a.key.accidentals[S].acc=x.accs[k].acc,a.key.explicitAccidentals||(a.key.explicitAccidentals=[]),a.key.explicitAccidentals.push(x.accs[k])));if(!C&&(a.key.explicitAccidentals||(a.key.explicitAccidentals=[]),a.key.explicitAccidentals.push(x.accs[k]),a.key.accidentals.push(x.accs[k]),a.key.impliedNaturals))for(var E=0;E<a.key.impliedNaturals.length;E++)a.key.impliedNaturals[E].note===x.accs[k].note&&a.key.impliedNaturals.splice(E,1)}}for(;o.length>0;)switch(o[0].token){case"m":case"middle":if(o.shift(),0===o.length)return i("Expected = after middle",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after middle",t,w.start);break}if(0===o.length)return i("Expected parameter after middle=",t,0),l;var M=r.getPitchFromTokens(o);M.warn&&i(M.warn,t,0),M.position&&(a.clef.verticalPos=M.position-6);break;case"transpose":if(o.shift(),0===o.length)return i("Expected = after transpose",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after transpose",t,w.start);break}if(0===o.length)return i("Expected parameter after transpose=",t,0),l;if("number"!==o[0].type){i("Expected number after transpose",t,o[0].start);break}a.clef.transpose=o[0].intt,o.shift();break;case"stafflines":if(o.shift(),0===o.length)return i("Expected = after stafflines",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after stafflines",t,w.start);break}if(0===o.length)return i("Expected parameter after stafflines=",t,0),l;if("number"!==o[0].type){i("Expected number after stafflines",t,o[0].start);break}a.clef.stafflines=o[0].intt,o.shift();break;case"staffscale":if(o.shift(),0===o.length)return i("Expected = after staffscale",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after staffscale",t,w.start);break}if(0===o.length)return i("Expected parameter after staffscale=",t,0),l;if("number"!==o[0].type){i("Expected number after staffscale",t,o[0].start);break}a.clef.staffscale=o[0].floatt,o.shift();break;case"octave":if(o.shift(),0===o.length)return i("Expected = after octave",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after octave",t,w.start);break}if(0===o.length)return i("Expected parameter after octave=",t,0),l;if("number"!==o[0].type){i("Expected number after octave",t,o[0].start);break}a.octave=o[0].intt,o.shift();break;case"style":if(o.shift(),0===o.length)return i("Expected = after style",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after style",t,w.start);break}if(0===o.length)return i("Expected parameter after style=",t,0),l;switch(o[0].token){case"normal":case"harmonic":case"rhythm":case"x":case"triangle":a.style=o[0].token,o.shift();break;default:i("error parsing style element: "+o[0].token,t,o[0].start)}break;case"clef":if(o.shift(),0===o.length)return i("Expected = after clef",t,0),l;if("="!==(w=o.shift()).token){i("Expected = after clef",t,w.start);break}if(0===o.length)return i("Expected parameter after clef=",t,0),l;case"treble":case"bass":case"alto":case"tenor":case"perc":case"none":var T=o.shift();switch(T.token){case"treble":case"tenor":case"alto":case"bass":case"perc":case"none":break;case"C":case"c":T.token="alto";break;case"F":case"f":T.token="bass";break;case"G":case"g":T.token="treble";break;default:i("Expected clef name. Found "+T.token,t,T.start)}o.length>0&&"number"===o[0].type&&(T.token+=o[0].token,o.shift()),o.length>1&&("-"===o[0].token||"+"===o[0].token||"^"===o[0].token||"_"===o[0].token)&&"8"===o[1].token&&(T.token+=o[0].token+o[1].token,o.shift(),o.shift()),a.clef={type:T.token,verticalPos:c(T.token,0)},a.currentVoice&&void 0!==a.currentVoice.transpose&&(a.clef.transpose=a.currentVoice.transpose),l.foundClef=!0;break;default:i("Unknown parameter: "+o[0].token,t,o[0].start),o.shift()}return l};n.parseVoice=function(e,t,n){var o=r.getMeat(e,t,n),l=o.start,h=o.end,d=r.getToken(e,l,h);if(0!==d.length){var f=!1;void 0===a.voices[d]&&(a.voices[d]={},f=!0,a.score_is_present&&i("Can't have an unknown V: id when the %score directive is present",e,l)),l+=d.length,l+=r.eatWhiteSpace(e,l);for(var p={startStaff:f},m=function(t){var n=r.getVoiceToken(e,l,h);void 0!==n.warn?i("Expected value for "+t+" in voice: "+n.warn,e,l):void 0!==n.err?i("Expected value for "+t+" in voice: "+n.err,e,l):0===n.token.length&&'"'!==e[l]?i("Expected value for "+t+" in voice",e,l):p[t]=n.token,l+=n.len},g=function(t,n,s){var o=r.getVoiceToken(e,l,h);void 0!==o.warn?i("Expected value for "+n+" in voice: "+o.warn,e,l):void 0!==o.err?i("Expected value for "+n+" in voice: "+o.err,e,l):0===o.token.length&&'"'!==e[l]?i("Expected value for "+n+" in voice",e,l):(o.token=parseFloat(o.token),a.voices[t][n]=o.token),l+=o.len},v=function(t,n){var a=r.getVoiceToken(e,l,h);if(void 0!==a.warn)i("Expected value for "+t+" in voice: "+a.warn,e,l);else if(void 0!==a.err)i("Expected value for "+t+" in voice: "+a.err,e,l);else{if(0!==a.token.length||'"'===e[l])return a.token;i("Expected value for "+t+" in voice",e,l)}l+=a.len},y=function(t,n){var s=r.getVoiceToken(e,l,h);if(void 0!==s.warn)i("Expected one of (_B, _E, _b, _e) for "+n+" in voice: "+s.warn,e,l);else if(0===s.token.length&&'"'!==e[l])i("Expected one of (_B, _E, _b, _e) for "+n+" in voice",e,l);else{var o={_B:2,_E:9,_b:-10,_e:-3}[s.token];o?a.voices[t][n]=o:i("Expected one of (_B, _E, _b, _e) for "+n+" in voice",e,l)}l+=s.len};l<h;){var b=r.getVoiceToken(e,l,h);if(l+=b.len,b.warn)i("Error parsing voice: "+b.warn,e,l);else{var _=null;switch(b.token){case"clef":case"cl":m("clef");var w=0;void 0!==p.clef&&(p.clef=p.clef.replace(/[',]/g,""),-1!==p.clef.indexOf("+16")&&(w+=14,p.clef=p.clef.replace("+16","")),p.verticalPos=c(p.clef,w));break;case"treble":case"bass":case"tenor":case"alto":case"perc":case"none":case"treble'":case"bass'":case"tenor'":case"alto'":case"none'":case"treble''":case"bass''":case"tenor''":case"alto''":case"none''":case"treble,":case"bass,":case"tenor,":case"alto,":case"none,":case"treble,,":case"bass,,":case"tenor,,":case"alto,,":case"none,,":p.clef=b.token.replace(/[',]/g,""),p.verticalPos=c(p.clef,0),a.voices[d].clef=b.token;break;case"staves":case"stave":case"stv":m("staves");break;case"brace":case"brc":m("brace");break;case"bracket":case"brk":m("bracket");break;case"name":case"nm":m("name");break;case"subname":case"sname":case"snm":m("subname");break;case"merge":p.startStaff=!1;break;case"stem":case"stems":void 0!==(_=r.getVoiceToken(e,l,h)).warn?i("Expected value for stems in voice: "+_.warn,e,l):void 0!==_.err?i("Expected value for stems in voice: "+_.err,e,l):"up"===_.token||"down"===_.token?a.voices[d].stem=_.token:i("Expected up or down for voice stem",e,l),l+=_.len;break;case"up":case"down":a.voices[d].stem=b.token;break;case"middle":case"m":m("verticalPos"),p.verticalPos=u(p.verticalPos).mid;break;case"gchords":case"gch":a.voices[d].suppressChords=!0,"0"===(_=r.getVoiceToken(e,l,h)).token&&(l+=_.len);break;case"space":case"spc":m("spacing");break;case"scale":g(d,"scale");break;case"score":y(d,"scoreTranspose");break;case"transpose":g(d,"transpose");break;case"stafflines":g(d,"stafflines");break;case"staffscale":g(d,"staffscale");break;case"octave":g(d,"octave");break;case"volume":g(d,"volume");break;case"cue":var x=v("cue");a.voices[d].scale="on"===x?.6:1;break;case"style":void 0!==(_=r.getVoiceToken(e,l,h)).warn?i("Expected value for style in voice: "+_.warn,e,l):void 0!==_.err?i("Expected value for style in voice: "+_.err,e,l):"normal"===_.token||"harmonic"===_.token||"rhythm"===_.token||"x"===_.token||"triangle"===_.token?a.voices[d].style=_.token:i("Expected one of [normal, harmonic, rhythm, x, triangle] for voice style",e,l),l+=_.len}}l+=r.eatWhiteSpace(e,l)}if((p.startStaff||0===a.staves.length)&&(a.staves.push({index:a.staves.length,meter:a.origMeter}),a.score_is_present||(a.staves[a.staves.length-1].numVoices=0)),void 0===a.voices[d].staffNum){a.voices[d].staffNum=a.staves.length-1;var k=0;for(var C in a.voices)a.voices.hasOwnProperty(C)&&a.voices[C].staffNum===a.voices[d].staffNum&&k++;a.voices[d].index=k-1}var S=a.staves[a.voices[d].staffNum];return a.score_is_present||S.numVoices++,p.clef&&(S.clef={type:p.clef,verticalPos:p.verticalPos}),p.spacing&&(S.spacing_below_offset=p.spacing),p.verticalPos&&(S.verticalPos=p.verticalPos),p.name&&(S.name?S.name.push(p.name):S.name=[p.name]),p.subname&&(S.subname?S.subname.push(p.subname):S.subname=[p.subname]),function(e){var t=a.voices[e];if(!a.currentVoice||a.currentVoice.index!==t.index||a.currentVoice.staffNum!==t.staffNum)return a.currentVoice=t,s.setCurrentVoice(t.staffNum,t.index,e)}(d)}i("Expected a voice id",e,l)}}(),dh=n}function Sh(){if(mh)return ph;mh=1;var e=yh(),t=bh(),n=Ch();return ph=function(r,i,a,s,o){this.reset=function(e,r,i,a){n.initialize(e,r,i,a,o),t.initialize(e,r,i,a,o)},this.reset(r,i,a,s),this.setTitle=function(e,t){a.hasMainTitle?o.addSubtitle(e,{startChar:a.iChar,endChar:a.iChar+t+2}):(o.addMetaText("title",e,{startChar:a.iChar,endChar:a.iChar+t+2}),a.hasMainTitle=!0)},this.setMeter=function(e){if("C"===(e=r.stripComment(e)))return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"common_time"};if("C|"===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"cut_time"};if("o"===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_perfectum"};if("c"===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_imperfectum"};if("o."===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_perfectum_prolatio"};if("c."===e)return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),{type:"tempus_imperfectum_prolatio"};if(0===e.length||"none"===e.toLowerCase())return!0===a.havent_set_length&&(a.default_length=.125,a.havent_set_length=!1),null;var t=r.tokenize(e,0,e.length);try{var n=function(){var e=function(){var e={value:0,num:""},n=t.shift();for("("===n.token&&(n=t.shift());;){if("number"!==n.type)throw"Expected top number of meter";if(e.value+=parseInt(n.token),e.num+=n.token,0===t.length||"/"===t[0].token)return e;if(")"===(n=t.shift()).token){if(0===t.length||"/"===t[0].token)return e;throw"Unexpected paren in meter"}if("."!==n.token&&"+"!==n.token)throw"Expected top number of meter";if(e.num+=n.token,0===t.length)throw"Expected top number of meter";n=t.shift()}return e}();if(0===t.length)return e;var n=t.shift();if("/"!==n.token)throw"Expected slash in meter";if("number"!==(n=t.shift()).type)throw"Expected bottom number of meter";return e.den=n.token,e.value=e.value/parseInt(e.den),e};if(0===t.length)throw"Expected meter definition in M: line";for(var s={type:"specified",value:[]},o=0;;){var c=n();o+=c.value;var l={num:c.num};if(void 0!==c.den&&(l.den=c.den),s.value.push(l),0===t.length)break}return!0===a.havent_set_length&&(a.default_length=o<.75?.0625:.125,a.havent_set_length=!1),s}catch(u){i(u,e,0)}return null},this.calcTempo=function(e){var t=1/4;a.meter&&"specified"===a.meter.type?t=1/parseInt(a.meter.value[0].den):a.origMeter&&"specified"===a.origMeter.type&&(t=1/parseInt(a.origMeter.value[0].den));for(var n=0;n<e.duration;n++)e.duration[n]=t*e.duration[n];return e},this.resolveTempo=function(){a.tempo&&(this.calcTempo(a.tempo),s.metaText.tempo=a.tempo,delete a.tempo)},this.addUserDefinition=function(t,n,r){var s=t.indexOf("=",n);if(-1!==s){var o=e.strip(t.substring(n,s)),c=e.strip(t.substring(s+1));if(1===o.length){-1!=="HIJKLMNOPQRSTUVWXYhijklmnopqrstuvw~".indexOf(o)?0!==c.length?(void 0===a.macros&&(a.macros={}),a.macros[o]=c):i("Missing macro definition",t,n):i("Macro definitions must be H-Y, h-w, or tilde",t,n)}else i("Macro definitions can only be one character",t,n)}else i("Need an = in a macro definition",t,n)},this.setDefaultLength=function(e,t,n){var r=e.substring(t,n).replace(/ /g,"").split("/");if(2===r.length){var i=parseInt(r[0]),s=parseInt(r[1]);s>0&&(a.default_length=i/s,a.havent_set_length=!1)}else 1===r.length&&"1"===r[0]&&(a.default_length=1,a.havent_set_length=!1)};var c={larghissimo:20,adagissimo:24,sostenuto:28,grave:32,largo:40,lento:50,larghetto:60,adagio:68,adagietto:74,andante:80,andantino:88,"marcia moderato":84,"andante moderato":100,moderato:112,allegretto:116,"allegro moderato":120,allegro:126,animato:132,agitato:140,veloce:148,"mosso vivo":156,vivace:164,vivacissimo:172,allegrissimo:176,presto:184,prestissimo:210};this.setTempo=function(e,t,n,s){try{var o=r.tokenize(e,t,n);if(0===o.length)throw"Missing parameter in Q: field";var l={startChar:s+t-2,endChar:s+n},u=!0,h=o.shift();if("quote"===h.type&&(l.preString=h.token,h=o.shift(),0===o.length))return c[l.preString.toLowerCase()]&&(l.bpm=c[l.preString.toLowerCase()],l.suppressBpm=!0),{type:"immediate",tempo:l};if("alpha"===h.type&&"C"===h.token){if(0===o.length)throw"Missing tempo after C in Q: field";if("punct"===(h=o.shift()).type&&"="===h.token){if(0===o.length)throw"Missing tempo after = in Q: field";if("number"!==(h=o.shift()).type)throw"Expected number after = in Q: field";l.duration=[1],l.bpm=parseInt(h.token)}else{if("number"!==h.type)throw"Expected number or equal after C in Q: field";if(l.duration=[parseInt(h.token)],0===o.length)throw"Missing = after duration in Q: field";if("punct"!==(h=o.shift()).type||"="!==h.token)throw"Expected = after duration in Q: field";if(0===o.length)throw"Missing tempo after = in Q: field";if("number"!==(h=o.shift()).type)throw"Expected number after = in Q: field";l.bpm=parseInt(h.token)}}else{if("number"!==h.type)throw"Unknown value in Q: field";var d=parseInt(h.token);if(0===o.length||"quote"===o[0].type)l.duration=[1],l.bpm=d;else{if(u=!1,"punct"!==(h=o.shift()).type&&"/"!==h.token)throw"Expected fraction in Q: field";if("number"!==(h=o.shift()).type)throw"Expected fraction in Q: field";var f=parseInt(h.token);for(l.duration=[d/f];o.length>0&&"="!==o[0].token&&"quote"!==o[0].type;){if("number"!==(h=o.shift()).type)throw"Expected fraction in Q: field";if(d=parseInt(h.token),"punct"!==(h=o.shift()).type&&"/"!==h.token)throw"Expected fraction in Q: field";if("number"!==(h=o.shift()).type)throw"Expected fraction in Q: field";f=parseInt(h.token),l.duration.push(d/f)}if("punct"!==(h=o.shift()).type&&"="!==h.token)throw"Expected = in Q: field";if("number"!==(h=o.shift()).type)throw"Expected tempo in Q: field";l.bpm=parseInt(h.token)}}if(0!==o.length&&("quote"===(h=o.shift()).type&&(l.postString=h.token,h=o.shift()),0!==o.length))throw"Unexpected string at end of Q: field";return!1===a.printTempo&&(l.suppress=!0),{type:u?"delaySet":"immediate",tempo:l}}catch(p){return i(p,e,t),{type:"none"}}},this.letter_to_inline_header=function(e,c,l){var u=!1,h=r.eatWhiteSpace(e,c);if(c+=h,e.length>=c+5&&"["===e[c]&&":"===e[c+2]){var d=e.indexOf("]",c),f=a.iChar+c,p=a.iChar+d+1;switch(e.substring(c,c+3)){case"[I:":var m=t.addDirective(e.substring(c+3,d));return m&&i(m,e,c),[d-c+1+h];case"[M:":var g=this.setMeter(e.substring(c+3,d));return o.hasBeginMusic()&&g?o.appendStartingElement("meter",f,p,g):a.meter=g,[d-c+1+h];case"[K:":var v=n.parseKey(e.substring(c+3,d),!0);return v.foundClef&&o.hasBeginMusic()&&o.appendStartingElement("clef",f,p,a.clef),v.foundKey&&o.hasBeginMusic()&&o.appendStartingElement("key",f,p,n.fixKey(a.clef,a.key)),[d-c+1+h];case"[P:":var y=t.parseFontChangeLine(e.substring(c+3,d));return l||s.lines.length<=s.lineNum?a.partForNextLine={title:y,startChar:f,endChar:p}:o.appendElement("part",f,p,{title:y}),[d-c+1+h];case"[L:":return this.setDefaultLength(e,c+3,d),[d-c+1+h];case"[Q:":if(d>0){var b=this.setTempo(e,c+3,d,a.iChar);return"delaySet"===b.type?o.hasBeginMusic()?o.appendElement("tempo",f,p,this.calcTempo(b.tempo)):a.tempoForNextLine=["tempo",f,p,this.calcTempo(b.tempo)]:"immediate"===b.type&&(!l&&o.hasBeginMusic()?o.appendElement("tempo",f,p,b.tempo):a.tempoForNextLine=["tempo",f,p,b.tempo]),[d-c+1+h,e[c+1],e.substring(c+3,d)]}break;case"[V:":if(d>0)return u=n.parseVoice(e,c+3,d),[d-c+1+h,e[c+1],e.substring(c+3,d),u];break;case"[r:":return[d-c+1+h]}}return[0]},this.letter_to_body_header=function(r,s){var c=!1;if(r.length>=s+3)switch(r.substring(s,s+2)){case"I:":var l=t.addDirective(r.substring(s+2));return l&&i(l,r,s),[r.length];case"M:":var u=this.setMeter(r.substring(s+2));return o.hasBeginMusic()&&u&&o.appendStartingElement("meter",a.iChar+s,a.iChar+r.length,u),[r.length];case"K:":var h=n.parseKey(r.substring(s+2),o.hasBeginMusic());return h.foundClef&&o.hasBeginMusic()&&o.appendStartingElement("clef",a.iChar+s,a.iChar+r.length,a.clef),h.foundKey&&o.hasBeginMusic()&&o.appendStartingElement("key",a.iChar+s,a.iChar+r.length,n.fixKey(a.clef,a.key)),[r.length];case"P:":return o.hasBeginMusic()&&o.appendElement("part",a.iChar+s,a.iChar+r.length,{title:r.substring(s+2)}),[r.length];case"L:":return this.setDefaultLength(r,s+2,r.length),[r.length];case"Q:":var d=r.indexOf("",s+2);-1===d&&(d=r.length);var f=this.setTempo(r,s+2,d,a.iChar);return"delaySet"===f.type?o.appendElement("tempo",a.iChar+s,a.iChar+r.length,this.calcTempo(f.tempo)):"immediate"===f.type&&o.appendElement("tempo",a.iChar+s,a.iChar+r.length,f.tempo),[d,r[s],e.strip(r.substring(s+2))];case"V:":return c=n.parseVoice(r,s+2,r.length),[r.length,r[s],e.strip(r.substring(s+2)),c]}return[0]};var l={A:"author",B:"book",C:"composer",D:"discography",F:"url",G:"group",I:"instruction",N:"notes",O:"origin",R:"rhythm",S:"source",W:"unalignedWords",Z:"transcription"};this.parseHeader=function(e){var c=l[e[0]],u=e.length-2,h=r.translateString(r.stripComment(e.substring(2)));if("unalignedWords"===c||"notes"===c)o.addMetaTextArray(c,t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length});else if(void 0!==c)o.addMetaText(c,t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length});else{var d=a.iChar,f=d+e.length;switch(e[0]){case"H":for(o.addMetaTextArray("history",t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length}),e=r.peekLine();e&&":"!==e[1];)r.nextLine(),o.addMetaTextArray("history",t.parseFontChangeLine(r.translateString(r.stripComment(e))),{startChar:a.iChar,endChar:a.iChar+e.length}),e=r.peekLine();break;case"K":this.resolveTempo();var p=n.parseKey(e.substring(2),!1);!a.is_in_header&&o.hasBeginMusic()&&(p.foundClef&&o.appendStartingElement("clef",d,f,a.clef),p.foundKey&&o.appendStartingElement("key",d,f,n.fixKey(a.clef,a.key))),a.is_in_header=!1;break;case"L":this.setDefaultLength(e,2,e.length);break;case"M":a.origMeter=a.meter=this.setMeter(e.substring(2));break;case"P":a.is_in_header?o.addMetaText("partOrder",t.parseFontChangeLine(h),{startChar:a.iChar,endChar:a.iChar+e.length}):a.partForNextLine={title:h,startChar:d,endChar:f};break;case"Q":var m=this.setTempo(e,2,e.length,a.iChar);"delaySet"===m.type?a.tempo=m.tempo:"immediate"===m.type&&(s.metaText.tempo?a.tempoForNextLine=["tempo",d,f,m.tempo]:s.metaText.tempo=m.tempo);break;case"T":a.titlecaps&&(h=h.toUpperCase()),this.setTitle(t.parseFontChangeLine(r.theReverser(h)),u);break;case"U":this.addUserDefinition(e,2,e.length);break;case"V":if(n.parseVoice(e,2,e.length),!a.is_in_header)return{newline:!0};break;case"s":return{symbols:!0};case"w":return{words:!0};case"X":break;case"E":case"m":i("Ignored header",e,0);break;default:return{regular:!0}}}return{}}}}var Eh,Mh,Th,Nh,Ah,Ph,Ih,Dh,Bh,Oh,Lh,Vh,Rh,Fh,zh,jh,qh,Hh,Uh,Gh,Wh,Yh,$h,Kh,Qh,Xh,Zh,Jh,ed,td,nd,rd,id,ad,sd,od,cd,ld,ud,hd,dd,fd,pd,md,gd,vd,yd,bd,_d,wd,xd,kd,Cd,Sd,Ed,Md,Td,Nd,Ad,Pd,Id,Dd,Bd,Od,Ld,Vd,Rd,Fd,zd,jd,qd,Hd,Ud,Gd,Wd,Yd,$d,Kd,Qd,Xd,Zd,Jd,ef,tf,nf,rf,af,sf,of,cf,lf,uf,hf,df,ff,pf,mf,gf,vf,yf,bf,_f,wf,xf,kf,Cf,Sf,Ef,Mf,Tf,Nf,Af,Pf,If,Df,Bf,Of,Lf,Vf,Rf,Ff,zf,jf,qf,Hf,Uf,Gf,Wf,Yf,$f,Kf,Qf,Xf,Zf,Jf,ep,tp,np,rp,ip,ap,sp,op,cp,lp,up,hp,dp,fp,pp,mp,gp,vp,yp,bp,_p,wp,xp,kp,Cp,Sp,Ep,Mp,Tp,Np,Ap,Pp,Ip,Dp,Bp,Op,Lp,Vp,Rp,Fp,zp,jp,qp,Hp,Up,Gp,Wp,Yp,$p,Kp,Qp,Xp,Zp,Jp,em,tm,nm,rm,im,am,sm,om,cm,lm,um,hm,dm,fm,pm,mm,gm,vm,ym,bm,_m,wm,xm,km,Cm,Sm,Em,Mm,Tm,Nm,Am,Pm,Im,Dm,Bm,Om,Lm,Vm,Rm,Fm,zm,jm,qm,Hm,Um,Gm,Wm,Ym,$m,Km,Qm,Xm,Zm,Jm,eg,tg,ng,rg,ig,ag,sg,og,cg,lg,ug,hg,dg,fg,pg,mg,gg,vg,yg,bg,_g,wg,xg,kg,Cg,Sg,Eg={};function Mg(){if(Th)return Mh;Th=1;var e,t,n,r,i,a,s=Ch(),o=kh(),{legalAccents:c,volumeDecorations:l,dynamicDecorations:u,accentPseudonyms:h,accentDynamicPseudonyms:d,nonDecorations:f,durations:p,pitches:m,rests:g,accMap:v,tripletQ:y}=(Eh||(Eh=1,Eg.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"],Eg.volumeDecorations=["p","pp","f","ff","mf","mp","ppp","pppp","fff","ffff","sfz"],Eg.dynamicDecorations=["crescendo(","crescendo)","diminuendo(","diminuendo)","glissando(","glissando)","~(","~)"],Eg.accentPseudonyms=[["<","accent"],[">","accent"],["tr","trill"],["plus","+"],["emphasis","accent"],["^","umarcato"],["marcato","umarcato"]],Eg.accentDynamicPseudonyms=[["<(","crescendo("],["<)","crescendo)"],[">(","diminuendo("],[">)","diminuendo)"]],Eg.nonDecorations="ABCDEFGabcdefgxyzZ[]|^_{",Eg.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],Eg.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},Eg.rests={x:"invisible",X:"invisible-multimeasure",y:"spacer",z:"rest",Z:"multimeasure"},Eg.accMap={dblflat:"__",flat:"_",natural:"=",sharp:"^",dblsharp:"^^",quarterflat:"_/",quartersharp:"^/"},Eg.tripletQ={2:3,3:2,4:3,5:2,6:2,7:2,8:3,9:2}),Eg),b=function(s,o,c,l,u,h){e=s,t=o,n=c,r=l,i=u,a=h,this.lineContinuation=!1},_=function(e,t,n){if(void 0===e.inTie[t])return!1;var r=e.currentVoice?100*e.currentVoice.staffNum+e.currentVoice.index:0;return!(!e.inTie[t][r]||void 0===n.pitches&&"spacer"===n.rest.type)},w={};b.prototype.parseMusic=function(s){a.resolveTempo(),n.is_in_header=!1;for(var o=0,c=n.iChar;e.isWhiteSpace(s[o])&&o<s.length;)o++;if(o!==s.length&&"%"!==s[o]){var l=n.start_new_line;void 0===n.continueall?n.start_new_line=!0:n.start_new_line=!1;var u=0,h=a.letter_to_body_header(s,o);h[0]>0&&(o+=h[0],"V"===h[1]&&this.startNewLine());for(var d=0;o<s.length;){var m=o;if("%"===s[o])break;var g=a.letter_to_inline_header(s,o,l);if(g[0]>0)o+=g[0],"V"===g[1]&&(l=!0);else{var v;for((!i.hasBeginMusic()||l&&!this.lineContinuation)&&(this.startNewLine(),l=!1);;)if((v=e.eatWhiteSpace(s,o))>0&&(o+=v),o>0&&""===s[o-1]&&(v=a.letter_to_body_header(s,o))[0]>0&&("V"===v[1]&&this.startNewLine(),o=v[0],n.start_new_line=!1),(v=T(s,o))[0]>0&&(o+=v[0]),(v=k(s,o))[0]>0){w.chord||(w.chord=[]);var y=e.translateString(v[1]);y=y.replace(/;/g,"\n");for(var b=!1,O=0;O<w.chord.length;O++)w.chord[O].position===v[2]&&(b=!0,w.chord[O].name+="\n"+y);!1===b&&(null===v[2]&&v[3]?w.chord.push({name:y,rel_position:v[3]}):w.chord.push({name:y,position:v[2]})),o+=v[0];var L=e.skipWhiteSpace(s.substring(o));L>0&&(w.force_end_beam_last=!0),o+=L}else if((v=-1===f.indexOf(s[o])?M(s,o):[0])[0]>0)null===v[1]?o+1<s.length&&this.startNewLine():v[1].length>0&&(0===v[1].indexOf("style=")?w.style=v[1].substr(6):(void 0===w.decoration&&(w.decoration=[]),"beambr1"===v[1]?w.beambr=1:"beambr2"===v[1]?w.beambr=2:w.decoration.push(v[1]))),o+=v[0];else{if(!((v=C(s,o))[0]>0))break;w.gracenotes=v[1],o+=v[0]}if((v=N(s,o))[0]>0){d=0,void 0!==w.gracenotes&&(w.rest={type:"spacer"},w.duration=.125,n.addFormattingOptions(w,r.formatting,"note"),i.appendElement("note",c+o,c+o+v[0],w),n.measureNotEmpty=!0,w={});var V={type:v[1]};0===V.type.length?t("Unknown bar type",s,o):(n.inEnding&&"bar_thin"!==V.type&&(V.endEnding=!0,n.inEnding=!1),v[2]&&(V.startEnding=v[2],n.inEnding&&(V.endEnding=!0),n.inEnding=!0,"bar_right_repeat"===v[1]?n.restoreStartEndingHoldOvers():n.duplicateStartEndingHoldOvers()),void 0!==w.decoration&&(V.decoration=w.decoration),void 0!==w.chord&&(V.chord=w.chord),V.startEnding&&void 0===n.barFirstEndingNum?n.barFirstEndingNum=n.currBarNumber:V.startEnding&&V.endEnding&&n.barFirstEndingNum?n.currBarNumber=n.barFirstEndingNum:V.endEnding&&(n.barFirstEndingNum=void 0),"bar_invisible"!==V.type&&n.measureNotEmpty&&B()&&(n.currBarNumber++,n.barNumbers&&n.currBarNumber%n.barNumbers==0&&(V.barNumber=n.currBarNumber)),n.addFormattingOptions(w,r.formatting,"bar"),i.appendElement("bar",c+m,c+o+v[0],V),n.measureNotEmpty=!1,w={}),o+=v[0]}else if("&"===s[o])(v=S(s,o))[0]>0&&(i.appendElement("overlay",c,c+1,{}),o+=1,d++);else{if((v=A(s,o)).consumed>0&&(void 0!==v.startSlur&&(w.startSlur=v.startSlur),v.dottedSlur&&(w.dottedSlur=!0),void 0!==v.triplet&&(u>0?t("Can't nest triplets",s,o):(w.startTriplet=v.triplet,w.tripletMultiplier=v.tripletQ/v.triplet,w.tripletR=v.num_notes,u=void 0===v.num_notes?v.triplet:v.num_notes)),o+=v.consumed),"["===s[o]){o++;for(var R=null,F=!1,z=!1;!z;){var j=M(s,o);j[0]>0&&(o+=j[0]);var q=I(s,o,{},!1);if(null!==q&&void 0!==q.pitch)j[0]>0&&0!==j[1].indexOf("style=")&&(void 0===w.decoration&&(w.decoration=[]),w.decoration.push(j[1])),q.end_beam&&(w.end_beam=!0,delete q.end_beam),void 0===w.pitches?(w.duration=q.duration,w.pitches=[q]):w.pitches.push(q),delete q.duration,j[0]>0&&0===j[1].indexOf("style=")&&(w.pitches[w.pitches.length-1].style=j[1].substr(6)),n.inTieChord[w.pitches.length]&&(q.endTie=!0,n.inTieChord[w.pitches.length]=void 0),q.startTie&&(n.inTieChord[w.pitches.length]=!0),o=q.endChar,delete q.endChar;else if(" "===s[o])t("Spaces are not allowed in chords",s,o),o++;else{if(o<s.length&&"]"===s[o]){o++,0!==n.next_note_duration&&(w.duration=w.duration*n.next_note_duration,n.next_note_duration=0),_(n,d,w)&&(w.pitches.forEach((function(e){e.endTie=!0})),x(n,d,!1)),u>0&&(!w.rest||"spacer"!==w.rest.type)&&0===--u&&(w.endTriplet=!0);for(var H=!1;o<s.length&&!H;){switch(s[o]){case" ":case"\t":P(w);break;case")":void 0===w.endSlur?w.endSlur=1:w.endSlur++;break;case"-":w.pitches.forEach((function(e){e.startTie={}})),x(n,d,!0);break;case">":case"<":var U=D(s,o);o+=U[0]-1,n.next_note_duration=U[2],R?R*=U[1]:R=U[1];break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"/":var G=e.getFraction(s,o);R=G.value;var W=s[o=G.index];" "===W&&(F=!0),"-"===W||")"===W||" "===W||"<"===W||">"===W?o--:H=!0;break;case"0":R=0;break;default:H=!0}H||o++}}else t("Expected ']' to end the chords",s,o);void 0!==w.pitches&&(null!==R&&(w.duration=w.duration*R,F&&P(w)),n.addFormattingOptions(w,r.formatting,"note"),i.appendElement("note",c+m,c+o,w),n.measureNotEmpty=!0,w={}),z=!0}}}else{var Y={},$=I(s,o,Y,!0);if(void 0!==Y.endTie&&x(n,d,!0),null!==$)void 0!==$.pitch?(w.pitches=[{}],void 0!==$.accidental&&(w.pitches[0].accidental=$.accidental),w.pitches[0].pitch=$.pitch,w.pitches[0].name=$.name,($.midipitch||0===$.midipitch)&&(w.pitches[0].midipitch=$.midipitch),void 0!==$.endSlur&&(w.pitches[0].endSlur=$.endSlur),void 0!==$.endTie&&(w.pitches[0].endTie=$.endTie),void 0!==$.startSlur&&(w.pitches[0].startSlur=$.startSlur),void 0!==w.startSlur&&(w.pitches[0].startSlur=w.startSlur),void 0!==w.dottedSlur&&(w.pitches[0].dottedSlur=!0),void 0!==$.startTie&&(w.pitches[0].startTie=$.startTie),void 0!==w.startTie&&(w.pitches[0].startTie=w.startTie)):(w.rest=$.rest,"multimeasure"===$.rest.type&&B()&&(n.currBarNumber+=$.rest.text-1),void 0!==$.endSlur&&(w.endSlur=$.endSlur),void 0!==$.endTie&&(w.rest.endTie=$.endTie),void 0!==$.startSlur&&(w.startSlur=$.startSlur),void 0!==$.startTie&&(w.rest.startTie=$.startTie),void 0!==w.startTie&&(w.rest.startTie=w.startTie)),void 0!==$.chord&&(w.chord=$.chord),void 0!==$.duration&&(w.duration=$.duration),void 0!==$.decoration&&(w.decoration=$.decoration),void 0!==$.graceNotes&&(w.graceNotes=$.graceNotes),delete w.startSlur,delete w.dottedSlur,_(n,d,w)&&(void 0!==w.pitches?w.pitches[0].endTie=!0:"spacer"!==w.rest.type&&(w.rest.endTie=!0),x(n,d,!1)),($.startTie||w.startTie)&&x(n,d,!0),o=$.endChar,u>0&&(!$.rest||"spacer"!==$.rest.type)&&0===--u&&(w.endTriplet=!0),$.end_beam&&P(w),w.rest&&"rest"===w.rest.type&&1===w.duration&&E(n)<=1&&(w.rest.type="whole",w.duration=E(n)),w.duration<1&&-1===p.indexOf(w.duration)&&0!==w.duration&&(w.rest&&"spacer"===w.rest.type||t("Duration not representable: "+s.substring(m,o),s,o)),n.addFormattingOptions(w,r.formatting,"note"),i.appendElement("note",c+m,c+o,w)||(this.startNewLine(),i.appendElement("note",c+m,c+o,w)),n.measureNotEmpty=!0,w={}}o===m&&(" "!==s[o]&&"`"!==s[o]&&t("Unknown character ignored",s,o),o++)}}}this.lineContinuation=s.indexOf("")>=0||h[0]>0,this.lineContinuation||(w={})}};var x=function(e,t,n){var r=e.currentVoice?100*e.currentVoice.staffNum+e.currentVoice.index:0;void 0===e.inTie[t]&&(e.inTie[t]=[]),e.inTie[t][r]=n},k=function(r,i){if('"'===r[i]){var a=e.getBrackettedSubstring(r,i,5);if(a[2]||t("Missing the closing quote while parsing the chord symbol",r,i),a[0]>0&&a[1].length>0&&"^"===a[1][0])a[1]=a[1].substring(1),a[2]="above";else if(a[0]>0&&a[1].length>0&&"_"===a[1][0])a[1]=a[1].substring(1),a[2]="below";else if(a[0]>0&&a[1].length>0&&"<"===a[1][0])a[1]=a[1].substring(1),a[2]="left";else if(a[0]>0&&a[1].length>0&&">"===a[1][0])a[1]=a[1].substring(1),a[2]="right";else if(a[0]>0&&a[1].length>0&&"@"===a[1][0]){a[1]=a[1].substring(1);var s=e.getFloat(a[1]);if(0===s.digits)return t("Missing first position in absolutely positioned annotation.",r,i),a[1]=a[1].replace("@",""),a[2]="above",a;if(a[1]=a[1].substring(s.digits),","!==a[1][0])return t("Missing comma absolutely positioned annotation.",r,i),a[1]=a[1].replace("@",""),a[2]="above",a;a[1]=a[1].substring(1);var c=e.getFloat(a[1]);if(0===c.digits)return t("Missing second position in absolutely positioned annotation.",r,i),a[1]=a[1].replace("@",""),a[2]="above",a;a[1]=a[1].substring(c.digits);var l=e.skipWhiteSpace(a[1]);a[1]=a[1].substring(l),a[2]=null,a[3]={x:s.value,y:c.value}}else!0!==n.freegchord&&(a[1]=a[1].replace(/([ABCDEFG0-9])b/g,"$1♭"),a[1]=a[1].replace(/([ABCDEFG0-9])#/g,"$1♯"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)o([^A-Za-z])/g,"$1$2°$3"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)o$/g,"$1$2°"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)0([^A-Za-z])/g,"$1$2ø$3"),a[1]=a[1].replace(/^([ABCDEFG])([♯♭]?)\^([^A-Za-z])/g,"$1$2∆$3")),a[2]="default",a[1]=o.chordName(n,a[1]);return a}return[0,""]},C=function(r,i){if("{"===r[i]){var a=e.getBrackettedSubstring(r,i,1,"}");a[2]||t("Missing the closing '}' while parsing grace note",r,i),")"===r[i+a[0]]&&(a[0]++,a[1]+=")");for(var s=[],o=0,c=!1;o<a[1].length;){var l=!1;"/"===a[1][o]&&(l=!0,o++);var u=I(a[1],o,{},!1);null!==u?(u.duration=u.duration/(8*n.default_length),l&&(u.acciaccatura=!0),u.rest?t("Rests not allowed as grace notes '"+a[1][o]+"' while parsing grace note",r,i):s.push(u),c&&(u.endTie=!0,c=!1),u.startTie&&(c=!0),o=u.endChar,delete u.endChar,u.end_beam&&(u.endBeam=!0,delete u.end_beam)):(" "===a[1][o]?s.length>0&&(s[s.length-1].endBeam=!0):t("Unknown character '"+a[1][o]+"' while parsing grace note",r,i),o++)}if(s.length)return[a[0],s]}return[0]};function S(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 E(e){var t=e.origMeter;return t&&"specified"===t.type&&t.value&&0!==t.value.length?parseInt(t.value[0].num,10)/parseInt(t.value[0].den,10):1}var M=function(r,i){var a=n.macros[r[i]];if(void 0!==a)return"!"!==a[0]&&"+"!==a[0]||(a=a.substring(1)),"!"!==a[a.length-1]&&"+"!==a[a.length-1]||(a=a.substring(0,a.length-1)),c.includes(a)?[1,a]:l.includes(a)?("hidden"===n.volumePosition&&(a=""),[1,a]):u.includes(a)?("hidden"===n.dynamicPosition&&(a=""),[1,a]):(n.ignoredDecorations.includes(a)||t("Unknown macro: "+a,r,i),[1,""]);switch(r[i]){case".":if("("===r[i+1]||"-"===r[i+1])break;return[1,"staccato"];case"u":return[1,"upbow"];case"v":return[1,"downbow"];case"~":return[1,"irishroll"];case"!":case"+":var s=e.getBrackettedSubstring(r,i,5);if(s[1].length>1&&("^"===s[1][0]||"_"===s[1][0])&&(s[1]=s[1].substring(1)),c.includes(s[1]))return s;if(l.includes(s[1]))return"hidden"===n.volumePosition&&(s[1]=""),s;if(u.includes(s[1]))return"hidden"===n.dynamicPosition&&(s[1]=""),s;var o=h.findIndex((function(e){return s[1]===e[0]}));return o>=0?(s[1]=h[o][1],s):(o=d.findIndex((function(e){return s[1]===e[0]})))>=0?(s[1]=d[o][1],"hidden"===n.dynamicPosition&&(s[1]=""),s):"!"!==r[i]||1!==s[0]&&"!"===r[i+s[0]-1]?(t("Unknown decoration: "+s[1],r,i),s[1]="",s):[1,null];case"H":return[1,"fermata"];case"J":return[1,"slide"];case"L":return[1,"accent"];case"M":return[1,"mordent"];case"O":return[1,"coda"];case"P":return[1,"pralltriller"];case"R":return[1,"roll"];case"S":return[1,"segno"];case"T":return[1,"trill"]}return[0,0]},T=function(t,n){for(var r=n;e.isWhiteSpace(t[n]);)n++;return[n-r]},N=function(n,r){var i=e.getBarLine(n,r);if(0===i.len)return[0,""];if(i.warn)return t(i.warn,n,r),[i.len,""];for(var a=0;a<n.length&&" "===n[r+i.len+a];a++);var s=i.len;if("["===n[r+i.len+a]&&(i.len+=a+1),'"'===n[r+i.len]&&"["===n[r+i.len-1]){var o=e.getBrackettedSubstring(n,r+i.len,5);return[i.len+o[0],i.token,o[1]]}var c=e.getTokenOf(n.substring(r+i.len),"1234567890-,");return 0===c.len||"-"===c.token[0]?[s,i.token]:[i.len+c.len,i.token,c.token]},A=function(n,r){var i={},a=r;for("."===n[r]&&"("===n[r+1]&&(i.dottedSlur=!0,r++);"("===n[r]||e.isWhiteSpace(n[r]);)"("===n[r]&&(r+1<n.length&&n[r+1]>="2"&&n[r+1]<="9"?(void 0!==i.triplet?t("Can't nest triplets",n,r):(i.triplet=n[r+1]-"0",i.tripletQ=y[i.triplet],i.num_notes=i.triplet,r+2<n.length&&":"===n[r+2]&&(r+3<n.length&&":"===n[r+3]?r+4<n.length&&n[r+4]>="1"&&n[r+4]<="9"?(i.num_notes=n[r+4]-"0",r+=3):t("expected number after the two colons after the triplet to mark the duration",n,r):r+3<n.length&&n[r+3]>="1"&&n[r+3]<="9"?(i.tripletQ=n[r+3]-"0",r+4<n.length&&":"===n[r+4]?r+5<n.length&&n[r+5]>="1"&&n[r+5]<="9"&&(i.num_notes=n[r+5]-"0",r+=4):r+=2):t("expected number after the triplet to mark the duration",n,r))),r++):void 0===i.startSlur?i.startSlur=1:i.startSlur++),r++;return i.consumed=r-a,i};b.prototype.startNewLine=function(){var e={startChar:-1,endChar:-1};n.partForNextLine.title&&(e.part=n.partForNextLine),e.clef=n.currentVoice&&void 0!==n.staves[n.currentVoice.staffNum].clef?Object.assign({},n.staves[n.currentVoice.staffNum].clef):Object.assign({},n.clef);var t=n.currentVoice?n.currentVoice.scoreTranspose:0;if(e.key=s.standardKey(n.key.root+n.key.acc+n.key.mode,n.key.root,n.key.acc,t),e.key.mode=n.key.mode,n.key.impliedNaturals&&(e.key.impliedNaturals=n.key.impliedNaturals),n.key.explicitAccidentals)for(var r=0;r<n.key.explicitAccidentals.length;r++){for(var a=!1,o=0;o<e.key.accidentals.length;o++)e.key.accidentals[o].note===n.key.explicitAccidentals[r].note&&(e.key.accidentals[o].acc=n.key.explicitAccidentals[r].acc,a=!0);a||e.key.accidentals.push(n.key.explicitAccidentals[r])}if(n.targetKey=e.key,e.key.explicitAccidentals&&delete e.key.explicitAccidentals,s.addPosToKey(e.clef,e.key),null!==n.meter?(n.currentVoice?(n.staves.forEach((function(e){e.meter=n.meter})),e.meter=n.staves[n.currentVoice.staffNum].meter,n.staves[n.currentVoice.staffNum].meter=null):e.meter=n.meter,n.meter=null):n.currentVoice&&n.staves[n.currentVoice.staffNum].meter&&(e.meter=n.staves[n.currentVoice.staffNum].meter,n.staves[n.currentVoice.staffNum].meter=null),n.currentVoice&&n.currentVoice.name&&(e.name=n.currentVoice.name),n.vocalfont&&(e.vocalfont=n.vocalfont),n.tripletfont&&(e.tripletfont=n.tripletfont),n.gchordfont&&(e.gchordfont=n.gchordfont),n.style&&(e.style=n.style),n.currentVoice){var c=n.staves[n.currentVoice.staffNum];c.brace&&(e.brace=c.brace),c.bracket&&(e.bracket=c.bracket),c.connectBarLines&&(e.connectBarLines=c.connectBarLines),c.name&&(e.name=c.name[n.currentVoice.index]),c.subname&&(e.subname=c.subname[n.currentVoice.index]),n.currentVoice.stem&&(e.stem=n.currentVoice.stem),n.currentVoice.stafflines&&(e.stafflines=n.currentVoice.stafflines),n.currentVoice.staffscale&&(e.staffscale=n.currentVoice.staffscale),n.currentVoice.scale&&(e.scale=n.currentVoice.scale),n.currentVoice.color&&(e.color=n.currentVoice.color),n.currentVoice.style&&(e.style=n.currentVoice.style),n.currentVoice.transpose&&(e.clef.transpose=n.currentVoice.transpose),e.currentVoice=n.currentVoice;for(var l=Object.keys(n.voices),u=0;u<l.length;u++)e.currentVoice.staffNum===n.voices[l[u]].staffNum&&e.currentVoice.index===n.voices[l[u]].index&&(e.currentVoiceName=l[u])}0===n.barNumbers&&B()&&1!==n.currBarNumber&&(e.barNumber=n.currBarNumber),i.startNewLine(e),n.key.impliedNaturals&&delete n.key.impliedNaturals,n.partForNextLine={},4===n.tempoForNextLine.length&&i.appendElement(n.tempoForNextLine[0],n.tempoForNextLine[1],n.tempoForNextLine[2],n.tempoForNextLine[3]),n.tempoForNextLine=[]};var P=function(e){return void 0!==e.duration&&e.duration<.25&&(e.end_beam=!0),e},I=function(t,a,s,c){var l,u=function(e){return"octave"===e||"duration"===e||"Zduration"===e||"broken_rhythm"===e||"end_slur"===e};"."===t[a]&&"-"===t[a+1]&&(l=!0,a++);for(var h="startSlur",d=!1;;){switch(t[a]){case"(":if("startSlur"!==h)return u(h)?(s.endChar=a,s):null;void 0===s.startSlur?s.startSlur=1:s.startSlur++;break;case")":if(!u(h))return null;void 0===s.endSlur?s.endSlur=1:s.endSlur++;break;case"^":if("startSlur"===h)s.accidental="sharp",h="sharp2";else{if("sharp2"!==h)return u(h)?(s.endChar=a,s):null;s.accidental="dblsharp",h="pitch"}break;case"_":if("startSlur"===h)s.accidental="flat",h="flat2";else{if("flat2"!==h)return u(h)?(s.endChar=a,s):null;s.accidental="dblflat",h="pitch"}break;case"=":if("startSlur"!==h)return u(h)?(s.endChar=a,s):null;s.accidental="natural",h="pitch";break;case"A":case"B":case"C":case"D":case"E":case"F":case"G":case"a":case"b":case"c":case"d":case"e":case"f":case"g":if("startSlur"!==h&&"sharp2"!==h&&"flat2"!==h&&"pitch"!==h)return u(h)?(s.endChar=a,s):null;if(s.pitch=m[t[a]],s.pitch+=7*(n.currentVoice&&void 0!==n.currentVoice.octave?n.currentVoice.octave:n.octave),s.name=t[a],s.accidental&&(s.name=v[s.accidental]+s.name),o.note(n,s),h="octave",c&&0!==n.next_note_duration?(s.duration=n.default_length*n.next_note_duration,n.next_note_duration=0,d=!0):s.duration=n.default_length,n.clef&&"perc"===n.clef.type||n.currentVoice&&"perc"===n.currentVoice.clef){var f=t[a];s.accidental&&(f=v[s.accidental]+f),r.formatting&&r.formatting.midi&&r.formatting.midi.drummap&&(s.midipitch=r.formatting.midi.drummap[f])}break;case",":if("octave"!==h)return u(h)?(s.endChar=a,s):null;s.pitch-=7,s.name+=",";break;case"'":if("octave"!==h)return u(h)?(s.endChar=a,s):null;s.pitch+=7,s.name+="'";break;case"x":case"X":case"y":case"z":case"Z":if("startSlur"!==h)return u(h)?(s.endChar=a,s):null;s.rest={type:g[t[a]]},delete s.accidental,delete s.startSlur,delete s.startTie,delete s.endSlur,delete s.endTie,delete s.end_beam,delete s.grace_notes,s.rest.type.indexOf("multimeasure")>=0?(s.duration=r.getBarLength(),s.rest.text=1,h="Zduration"):(c&&0!==n.next_note_duration?(s.duration=n.default_length*n.next_note_duration,n.next_note_duration=0,d=!0):s.duration=n.default_length,h="duration");break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"0":case"/":if("octave"===h||"duration"===h){var p=e.getFraction(t,a);for(s.duration=s.duration*p.value,s.endChar=p.index;p.index<t.length&&(e.isWhiteSpace(t[p.index])||"-"===t[p.index]);)"-"===t[p.index]?s.startTie={}:s=P(s),p.index++;a=p.index-1,h="broken_rhythm"}else if("sharp2"===h)s.accidental="quartersharp",h="pitch";else{if("flat2"!==h){if("Zduration"===h){var y=e.getNumber(t,a);return s.duration=y.num*r.getBarLength(),s.rest.text=y.num,s.endChar=y.index,s}return null}s.accidental="quarterflat",h="pitch"}break;case"-":if("startSlur"===h)i.addTieToLastNote(l),s.endTie=!0;else{if("octave"!==h&&"duration"!==h&&"end_slur"!==h)return"broken_rhythm"===h?(s.endChar=a,s):null;if(s.startTie={},d||!c)return e.isWhiteSpace(t[a+1])&&P(s),s.endChar=a+1,s;h="broken_rhythm"}break;case" ":case"\t":if(!u(h))return null;s.end_beam=!0,l=!1;do{"."===t[a]&&"-"===t[a+1]&&(l=!0,a++),"-"===t[a]&&(s.startTie={},l&&(s.startTie.style="dotted")),a++}while(a<t.length&&(e.isWhiteSpace(t[a])||"-"===t[a])||"."===t[a]&&"-"===t[a+1]);if(s.endChar=a,d||!c||"<"!==t[a]&&">"!==t[a])return s;a--,h="broken_rhythm";break;case">":case"<":if(!u(h))return null;if(!c)return s.endChar=a,s;var b=D(t,a);a+=b[0]-1,n.next_note_duration=b[2],s.duration=b[1]*s.duration,h="end_slur";break;default:return u(h)?(s.endChar=a,s):null}if(++a===t.length)return u(h)?(s.endChar=a,s):null}return null},D=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 B(){return void 0===n.currentVoice||0===n.currentVoice.staffNum&&0===n.currentVoice.index}return Mh=b}function Tg(){if(Ih)return Ph;function e(e,t){for(var n=[],r=[],i=0,a=0;a<e.length;a++){var s=e[a],o=i+s;if(o<t)i=o;else t-i<o-t&&i>0?(n.push(a-1),r.push(Math.round(i-s)),i=s):a<e.length-1&&(n.push(a),r.push(Math.round(i)),i=0)}return r.push(Math.round(i)),{lineBreaks:n,totals:r}}function t(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}function n(e,n,r,i,a,s,o,c,l,u,h){for(var d=u;d<e.length;d++){var f=e[d];r+=f,i+=f;var p=Math.abs(r-n[c]);if(Math.abs(p-s)<n[0]/10)if(p<s){var m=t(a),g=t(l);g.push(d-1),m.push(i-f),h.push({accumulator:r,lineAccumulator:f,lineWidths:m,lastVariance:Math.abs(r-n[c+1]),highestVariance:Math.max(o,s),currLine:c+1,lineBreaks:g,startIndex:d+1})}else p>s&&d<e.length-1&&(m=t(a),g=t(l),h.push({accumulator:r,lineAccumulator:i,lineWidths:m,lastVariance:p,highestVariance:Math.max(o,p),currLine:c,lineBreaks:g,startIndex:d+1}));p>s?(l.push(d-1),c++,o=Math.max(o,s),s=Math.abs(r-n[c]),a.push(i-f),i=f):s=p}a.push(i)}function r(e,t,r,i){for(var a=Math.ceil(e.total/t),s=Math.floor(e.total/a),o=[],c=0;c<a;c++)o.push(s*(c+1));var l=[];l.push({accumulator:0,lineAccumulator:0,lineWidths:[],lastVariance:999999,highestVariance:0,currLine:0,lineBreaks:[],startIndex:0});for(var u=0;u<l.length;)n(e.measureWidths,o,l[u].accumulator,l[u].lineAccumulator,l[u].lineWidths,l[u].lastVariance,l[u].highestVariance,l[u].currLine,l[u].lineBreaks,l[u].startIndex,l),u++;for(c=0;c<l.length;c++){var h=l[c];h.variances=[],h.aveVariance=0;for(var d=0;d<h.lineWidths.length;d++){var f=h.lineWidths[d];h.variances.push(f-o[0]),h.aveVariance+=Math.abs(f-o[0])}h.aveVariance=h.aveVariance/h.lineWidths.length,i.attempts.push({type:"optimizeLineWidths",lineBreaks:h.lineBreaks,variances:h.variances,aveVariance:h.aveVariance,widths:e.measureWidths})}var p=9999999,m=-1;for(c=0;c<l.length;c++)(h=l[c]).aveVariance<p&&(p=h.aveVariance,m=c);return{failed:!1,lineBreaks:l[m].lineBreaks,variance:l[m].highestVariance}}function i(e,t,n){for(var r=[],i=[],a=0,s=!1,o=0;o<e.length;o++)(a+=e[o])>t&&(s=!0),o%n==n-1&&(o!==e.length-1&&r.push(o),i.push(Math.round(a)),a=0);return{failed:s,totals:i,lineBreaks:r}}return Ih=1,Ph={wrapLines:function(e,t,n){if(t&&0!==e.lines.length){var r=e.deline({lineBreaks:!1}),i=function(e,t){for(var n=[],r=0,i=0,a=0,s=0;s<e.length;s++){var o=e[s];if(o.staff){var c=i,l=t[r];r++;for(var u=0;u<o.staff.length;u++)for(var h=o.staff[u],d=0;d<h.voices.length;d++){a=c;for(var f=0,p=0,m=h.voices[d],g=0,v=0;v<m.length;v++){"bar"===m[v].el_type&&(l[p]===f&&(n.push({ogLine:s,line:a,staff:u,voice:d,start:g,end:v}),g=v+1,a++,i=Math.max(i,a),p++),f++)}n.push({ogLine:s,line:a,staff:u,voice:d,start:g,end:m.length}),a++,i=Math.max(i,a)}}else n.push({ogLine:s,line:a}),a++,i=Math.max(i,a)}return n}(r,t);e.lines=function(e,t,n){for(var r=[],i=[],a=[],s=1,o=0;o<t.length;o++){var c=t[o];if(e[c.ogLine].staff){var l=e[c.ogLine].staff[c.staff];if(r[c.line]||(r[c.line]={staff:[]}),!r[c.line].staff[c.staff]){r[c.line].staff[c.staff]={voices:[]},void 0!==n&&0===c.staff&&c.line>0&&(r[c.line].staff[c.staff].barNumber=s);for(var u=Object.keys(l),h=0;h<u.length;h++){var d="voices"===u[h];"meter"===u[h]&&0!==c.line&&(d=!0),d||(r[c.line].staff[c.staff][u[h]]=l[u[h]])}i[c.staff]&&(r[c.line].staff[c.staff].key=i[c.staff])}r[c.line].staff[c.staff].voices[c.voice]||(r[c.line].staff[c.staff].voices[c.voice]=[]),r[c.line].staff[c.staff].voices[c.voice]=e[c.ogLine].staff[c.staff].voices[c.voice].slice(c.start,c.end+1),a[10*c.staff+c.voice]&&r[c.line].staff[c.staff].voices[c.voice].unshift({el_type:"stem",direction:a[10*c.staff+c.voice].direction});for(var f=r[c.line].staff[c.staff].voices[c.voice],p=f.length-1;p>=0;p--)if("key"===f[p].el_type){i[c.staff]={root:f[p].root,acc:f[p].acc,mode:f[p].mode,accidentals:f[p].accidentals.filter((function(e){return"natural"!==e.acc}))};break}for(p=f.length-1;p>=0;p--)if("stem"===f[p].el_type){a[10*c.staff+c.voice]={direction:f[p].direction};break}if(void 0!==n&&0===c.staff&&0===c.voice)for(p=0;p<f.length;p++)"bar"===f[p].el_type&&(s++,p===f.length-1?delete f[p].barNumber:f[p].barNumber=s)}else r[c.line]=e[c.ogLine]}for(var m=0;m<r.length;m++)r[m].staff&&(r[m].staff=r[m].staff.filter((function(e){return null!=e})));return r}(r,i,n),e.lineBreaks=i}},calcLineWraps:function(t,n,a){if(0===n.length||a.staffwidth<n[0].left)return{reParse:!1,explanation:"Staff width is narrower than the margin",revisedParams:a};var s=a.scale?Math.max(a.scale,.1):1,o=a.wrap.minSpacing?Math.max(parseFloat(a.wrap.minSpacing),1):1,c=a.wrap.minSpacingLimit?Math.max(parseFloat(a.wrap.minSpacingLimit),1):o-.1,l=a.wrap.maxSpacing?Math.max(parseFloat(a.wrap.maxSpacing),1):void 0;a.wrap.lastLineLimit&&!l&&(l=Math.max(parseFloat(a.wrap.lastLineLimit),1));for(var u=a.wrap.preferredMeasuresPerLine?Math.max(parseInt(a.wrap.preferredMeasuresPerLine,10),0):void 0,h=[],d=[],f=0;f<n.length;f++){var p=n[f],m=a.staffwidth-p.left,g=m/o/s,v=m/c/s,y={widths:p,lineBreakPoint:g,minLineSize:m/l/s,attempts:[],staffWidth:a.staffwidth,minWidth:Math.round(v)},b=null;if(u){var _=i(p.measureWidths,g,u);y.attempts.push({type:"Fixed Measures Per Line",preferredMeasuresPerLine:u,lineBreaks:_.lineBreaks,failed:_.failed,totals:_.totals}),_.failed||(b=_.lineBreaks)}if(!b){var w=e(p.measureWidths,g);y.attempts.push({type:"Free Form",lineBreaks:w.lineBreaks,totals:w.totals}),(b=w.lineBreaks).length>0&&p.measureWidths.length<25&&(w=r(p,g,0,y),y.attempts.push({type:"Optimize",failed:w.failed,reason:w.reason,lineBreaks:w.lineBreaks,totals:w.totals}),w.failed||(b=w.lineBreaks))}h.push(b),d.push(y)}var x=function(e,t,n){var r={lineBreaks:e,staffwidth:t};for(var i in n)n.hasOwnProperty(i)&&"wrap"!==i&&"staffwidth"!==i&&(r[i]=n[i]);return{revisedParams:r}}(h,a.staffwidth,a);return x.explanation=d,x.reParse=!0,x}}}function Ng(){if(Bh)return Dh;Bh=1;var e={FONTEM:360,FONTSIZE:30};return e.STEP=93*e.FONTSIZE/720,e.SPACE=10,e.TOPNOTE=15,e.STAVEHEIGHT=100,e.INDENT=50,Dh=e}function Ag(){if(Lh)return Oh;var e;Lh=1;var t=yh();return function(){var n=1,r=128;function i(e,t,n){for(var r=0,i=t+1;i<e.length;i++)if("note"===e[i].el_type&&r++,e[i].decoration&&e[i].decoration.indexOf(n)>=0)return r;return r}function a(e,t,n){for(var r=Math.min(e.length,t+3),i=t;i<r;i++)if("note"===e[i].el_type&&e[i].decoration)for(var a=0;a<e[i].decoration.length;a++)if(n.indexOf(e[i].decoration[a])>=0)return e[i].decoration[a];return null}function s(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=n.length-1;r>=0&&"bar"!==n[r].el_type;)n[r].noChordVoice=!0,r--}function o(e,t){if(e&&!(e.length<=t)&&e[t].title)return e[t].title.join(" ")}function c(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 l(e){var t;switch(e.type){case"common_time":t={el_type:"meter",num:4,den:4};break;case"cut_time":t={el_type:"meter",num:2,den:2};break;case"specified":t={el_type:"meter",num:e.value[0].num,den:e.value[0].den};break;default:t={el_type:"meter"}}return n=t.num/t.den,t}function u(e){for(var t=[],n=0;n<e.length;n++)"natural"!==e[n].acc&&t.push(e[n]);return t}function h(e,t){f(e,"HP"===t.root?{el_type:"key",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}]}:{el_type:"key",accidentals:u(t.accidentals)})}function d(e,t){f(e,l(t))}function f(e,t){for(var n=e.length-1;n>=0;n--)if(e[n].el_type===t.el_type)return void(JSON.stringify(e[n])!==JSON.stringify(t)&&e.push(t));e.push(t)}e=function(e,u){var p,m=(u=u||{}).program||0,g=u.midiTranspose||0;e.visualTranspose&&(g-=e.visualTranspose);var v=u.channel||0,y=!1,b=u.drum||"",_=u.drumBars||1,w=u.drumIntro||0,x=""!==b,k=!!u.drumOff,C=[];m=parseInt(m,10),g=parseInt(g,10),10===(v=parseInt(v,10))&&(m=r),b=b.split(" "),_=parseInt(_,10),w=parseInt(w,10);var S=e.formatting.bagpipes;S&&(m=71);var E=[];if(e.formatting.midi){var M=e.formatting.midi;M.program&&M.program.length>0&&(m=M.program[0],M.program.length>1&&(m=M.program[1],v=M.program[0]),y=!0),M.transpose&&(g=M.transpose[0]),M.channel&&(v=M.channel[0],y=!0),M.drum&&(b=M.drum),M.drumbars&&(_=M.drumbars[0]),M.drumon&&(x=!0),10===v&&(m=r),M.beat&&E.push({el_type:"beat",beats:M.beat}),M.nobeataccents&&E.push({el_type:"beataccents",value:!1})}p=u.qpm?parseInt(u.qpm,10):e.metaText.tempo?c(e.metaText.tempo,e.getBeatLength()):u.defaultQpm?u.defaultQpm:180;var T=[];S&&T.push({el_type:"bagpipes"}),T.push({el_type:"instrument",program:m}),v&&T.push({el_type:"channel",channel:v}),g&&T.push({el_type:"transpose",transpose:g}),T.push({el_type:"tempo",qpm:p});for(var N=0;N<E.length;N++)T.push(E[N]);var A,P=[],I=[],D=[],B=[0],O={};O[0]={el_type:"tempo",qpm:p,timing:0};for(var L=[],V=[],R=!1,F=e.lines,z=0;z<F.length;z++){var j=F[z];if(j.staff){let n=function(e){var t,n={pppp:[15,10,5,1],ppp:[30,20,10,1],pp:[45,35,20,1],p:[60,50,35,1],mp:[75,65,50,1],mf:[90,80,65,1],f:[105,95,80,1],ff:[120,110,95,1],fff:[127,125,110,1],ffff:[127,125,110,1]};if(e.decoration)if(e.decoration.indexOf("pppp")>=0?t="pppp":e.decoration.indexOf("ppp")>=0?t="ppp":e.decoration.indexOf("pp")>=0?t="pp":e.decoration.indexOf("p")>=0?t="p":e.decoration.indexOf("mp")>=0?t="mp":e.decoration.indexOf("mf")>=0?t="mf":e.decoration.indexOf("f")>=0?t="f":e.decoration.indexOf("ff")>=0?t="ff":e.decoration.indexOf("fff")>=0?t="fff":e.decoration.indexOf("ffff")>=0&&(t="ffff"),t&&(A=n[t].slice(0),P[H].push({el_type:"beat",beats:A.slice(0)}),I[W]=!1,D[W]=!1),e.decoration.indexOf("crescendo(")>=0){var r=i(Y,ee,"crescendo)"),s=Math.min(127,A[0]+50),o=a(Y,ee+r+1,Object.keys(n));o&&(s=n[o][0]),I[W]=r>0&&Math.floor((s-A[0])/r),D[W]=!1}else if(e.decoration.indexOf("crescendo)")>=0)I[W]=!1;else if(e.decoration.indexOf("diminuendo(")>=0){var c=i(Y,ee,"diminuendo)"),l=Math.max(15,A[0]-50),u=a(Y,ee+c+1,Object.keys(n));u&&(l=n[u][0]),I[W]=!1,D[W]=c>0&&Math.floor((l-A[0])/c)}else e.decoration.indexOf("diminuendo)")>=0&&(D[W]=!1)};for(var q=j.staff,H=0,U=0;U<q.length;U++){var G=q[U];if(!G.clef||"TAB"!==G.clef.type)for(var W=0;W<G.voices.length;W++){var Y=G.voices[W];if(!P[H]){P[H]=[].concat(JSON.parse(JSON.stringify(T)));var $=o(j.staff,H);$&&P[H].unshift({el_type:"name",trackName:$})}if(g&&"perc"===G.clef.type&&P[H].push({el_type:"transpose",transpose:0}),G.clef&&"perc"===G.clef.type&&!y)for(var K=0;K<P[H].length;K++)"instrument"===P[H][K].el_type&&(P[H][K].program=r);else G.key&&h(P[H],G.key);G.meter&&d(P[H],G.meter),!R&&x&&(P[H].push({el_type:"drum",params:{pattern:b,bars:_,on:x,intro:w}}),R=!0),G.clef&&"perc"!==G.clef.type&&G.clef.transpose&&(G.clef.el_type="clef",P[H].push({el_type:"transpose",transpose:G.clef.transpose})),G.clef&&G.clef.type&&(G.clef.type.indexOf("-8")>=0?P[H].push({el_type:"transpose",transpose:-12}):G.clef.type.indexOf("+8")>=0&&P[H].push({el_type:"transpose",transpose:12})),e.formatting.midi&&e.formatting.midi.drumoff&&(P[H].push({el_type:"bar"}),P[H].push({el_type:"drum",params:{pattern:"",on:!1}}));var Q=0,X=0,Z=0,J=0;A=[105,95,85,1];for(var ee=0;ee<Y.length;ee++){var te=Y[ee];switch(te.el_type){case"note":if(I[W]&&(A[0]+=I[W],A[1]+=I[W],A[2]+=I[W],P[H].push({el_type:"beat",beats:A.slice(0)})),D[W]&&(A[0]+=D[W],A[1]+=D[W],A[2]+=D[W],P[H].push({el_type:"beat",beats:A.slice(0)})),n(te),!te.rest||"spacer"!==te.rest.type){var ne={elem:te,el_type:"note",timing:B[H]};if(te.style?ne.style=te.style:C[H]&&(ne.style=C[H]),ne.duration=0===te.duration?.25:te.duration,te.startTriplet){if(X=te.tripletMultiplier,Z=te.startTriplet*X*te.duration,te.startTriplet!==te.tripletR&&ee+te.tripletR<=Y.length){for(var re=0,ie=ee;ie<ee+te.tripletR;ie++)re+=Y[ie].duration;Z=X*re}ne.duration=ne.duration*X,ne.duration=Math.round(1e6*ne.duration)/1e6,J=ne.duration}else X&&(te.endTriplet?(X=0,ne.duration=Math.round(1e6*(Z-J))/1e6):(ne.duration=ne.duration*X,ne.duration=Math.round(1e6*ne.duration)/1e6,J+=ne.duration));te.rest&&(ne.rest=te.rest),te.decoration&&(ne.decoration=te.decoration.slice(0)),te.pitches&&(ne.pitches=t.cloneArray(te.pitches)),te.gracenotes&&(ne.gracenotes=t.cloneArray(te.gracenotes)),te.chord&&(ne.chord=t.cloneArray(te.chord)),P[H].push(ne),"rhythm"===te.style&&s(P),Q++,B[H]+=ne.duration}break;case"key":case"keySignature":h(P[H],te);break;case"meter":d(P[H],te);break;case"clef":te.transpose&&P[H].push({el_type:"transpose",transpose:te.transpose}),te.type&&(te.type.indexOf("-8")>=0?P[H].push({el_type:"transpose",transpose:-12}):te.type.indexOf("+8")>=0&&P[H].push({el_type:"transpose",transpose:12}));break;case"tempo":p=c(te,e.getBeatLength()),P[H].push({el_type:"tempo",qpm:p,timing:B[H]}),O[""+B[H]]={el_type:"tempo",qpm:p,timing:B[H]};break;case"bar":Q>0&&P[H].push({el_type:"bar"}),n(te),Q=0;var ae="bar_right_repeat"===te.type||"bar_dbl_repeat"===te.type,se="1"===te.startEnding,oe="bar_left_repeat"===te.type||"bar_dbl_repeat"===te.type||"bar_right_repeat"===te.type;if(ae){var ce=L[H];ce||(ce=0);var le=V[H];le||(le=P[H].length);for(var ue=ce;ue<le;ue++){var he=Object.assign({},P[H][ue]);he.pitches&&(he.pitches=t.cloneArray(he.pitches)),P[H].push(he)}V[H]=void 0,L[H]=void 0}se&&(V[H]=P[H].length),oe&&(L[H]=P[H].length);break;case"style":C[H]=te.head;break;case"timeSignature":P[H].push(l(te));break;case"part":case"stem":case"scale":case"break":case"font":break;case"midi":var de=!1;switch(te.cmd){case"drumon":x=!0,de=!0;break;case"drumoff":x=!1,de=!0;break;case"drum":b=te.params,de=!0;break;case"drumbars":_=te.params[0],de=!0;break;case"drummap":break;case"channel":10===te.params[0]&&P[H].push({el_type:"instrument",program:r});break;case"program":f(P[H],{el_type:"instrument",program:te.params[0]}),y=!0;break;case"transpose":P[H].push({el_type:"transpose",transpose:te.params[0]});break;case"gchordoff":P[H].push({el_type:"gchordOn",tacet:!0});break;case"gchordon":P[H].push({el_type:"gchordOn",tacet:!1});break;case"beat":P[H].push({el_type:"beat",beats:te.params});break;case"nobeataccents":P[H].push({el_type:"beataccents",value:!1});break;case"beataccents":P[H].push({el_type:"beataccents",value:!0});break;case"vol":case"volinc":P[H].push({el_type:te.cmd,volume:te.params[0]});break;case"swing":case"gchord":case"bassvol":case"chordvol":case"gchordbars":P[H].push({el_type:te.cmd,param:te.params[0]});break;case"bassprog":case"chordprog":P[H].push({el_type:te.cmd,value:te.params[0],octaveShift:te.params[1]});break;default:console.log("MIDI seq: midi cmd not handled: ",te.cmd,te)}de&&(P[0].push({el_type:"drum",params:{pattern:b,bars:_,intro:w,on:x}}),R=!0);break;default:console.log("MIDI: element type "+te.el_type+" not handled.")}}B[++H]||(B[H]=0)}}}}if(function(e,t){if(!t||0===t.length)return;for(var n=Object.keys(t),r=0;r<e.length;r++)for(var i=e[r],a=t[0]?t[0].qpm:0,s=0;s<i.length;s++){var o=i[s];"tempo"===o.el_type&&(a=o.qpm),n.indexOf(""+o.timing)>=0&&a!==t[""+o.timing].qpm&&(a=t[""+o.timing].qpm,"tempo"===o.el_type?(o.qpm=t[""+o.timing].qpm,s++):(e[r].splice(s,0,{el_type:"tempo",qpm:t[""+o.timing].qpm,timing:o.timing}),s+=2))}}(P,O),w)for(var fe=e.getPickupLength(),pe=0;pe<P.length;pe++){for(var me=0;"note"!==P[pe][me].el_type&&P[pe].length>me;)me++;if(P[pe].length>me){for(ie=0;ie<w;ie++)0===fe||ie<w-1?(P[pe].splice(me,0,{el_type:"note",rest:{type:"rest"},duration:n},{el_type:"bar"}),me+=2):P[pe].splice(me++,0,{el_type:"note",rest:{type:"rest"},duration:n-fe});k&&(x=!1,P[pe].splice(me++,0,{el_type:"drum",params:{pattern:b,bars:_,intro:w,on:x}}),k=!1)}}return P.length>0&&P[0].length>0&&(P[0][0].pickupLength=e.getPickupLength()),P}}(),Oh=e}function Pg(){if(zh)return Fh;zh=1;var e={f0:"_C",n0:"=C",s0:"^C",x0:"C",f1:"_D",n1:"=D",s1:"^D",x1:"D",f2:"_E",n2:"=E",s2:"^E",x2:"E",f3:"_F",n3:"=F",s3:"^F",x3:"F",f4:"_G",n4:"=G",s4:"^G",x4:"G",f5:"_A",n5:"=A",s5:"^A",x5:"A",f6:"_B",n6:"=B",s6:"^B",x6:"B",f7:"_c",n7:"=c",s7:"^c",x7:"c",f8:"_d",n8:"=d",s8:"^d",x8:"d",f9:"_e",n9:"=e",s9:"^e",x9:"e",f10:"_f",n10:"=f",s10:"^f",x10:"f",f11:"_g",n11:"=g",s11:"^g",x11:"g",f12:"_a",n12:"=a",s12:"^a",x12:"a",f13:"_b",n13:"=b",s13:"^b",x13:"b",f14:"_c'",n14:"=c'",s14:"^c'",x14:"c'",f15:"_d'",n15:"=d'",s15:"^d'",x15:"d'",f16:"_e'",n16:"=e'",s16:"^e'",x16:"e'"};return Fh=function(t){var n=(t.accidental?t.accidental[0]:"x")+t.verticalPos;return e[n]}}function Ig(){if(qh)return jh;var e;qh=1;var t=function(){if(Rh)return Vh;Rh=1;var e=function(e,t,n,i){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=i,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&&2===n.bassprog.length?n.bassprog[1]:0,this.chordOctaveShift=n.chordprog&&2===n.chordprog.length?n.chordprog[1]:0,this.boomVolume=n.bassvol&&1===n.bassvol.length?n.bassvol[0]:64,this.chickVolume=n.chordvol&&1===n.chordvol.length?n.chordvol[0]:48,n.gchord&&n.gchord.length>0?this.overridePattern=r(n.gchord[0]):this.overridePattern=void 0};function t(e,t,r,i){var a=[];if(!e)return a;t.indexOf("boom")>=0?a.push(r?e.boom:e.boom2):i&&a.push(e.boom);var s=e.chick.length;if(t.indexOf("chick")>=0)for(var o=0;o<s;o++)a.push(e.chick[o]);switch(t){case"DO":a.push(e.chick[0]);break;case"MI":a.push(e.chick[1]);break;case"SOL":a.push(n(e,2));break;case"TI":a.push(n(e,3));break;case"TOP":a.push(n(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(n(e,2)+12);break;case"ti":a.push(n(e,3)+12);break;case"top":a.push(n(e,4)+12)}return a}function n(e,t){var n=Math.floor(t/e.chick.length);return e.chick[t%e.chick.length]+12*n}function r(e){for(var t=[],n=0;n<e.length;n++)switch(e[n]){case"z":case"2":t.push("");break;case"c":t.push("chick");break;case"b":t.push("boom&chick");break;case"f":t.push("boom");break;case"G":t.push("DO");break;case"H":t.push("MI");break;case"I":t.push("SOL");break;case"J":t.push("TI");break;case"K":t.push("TOP");break;case"g":t.push("do");break;case"h":t.push("mi");break;case"i":t.push("sol");break;case"j":t.push("ti");break;case"k":t.push("top")}return t}function i(e){return e/1e6}function a(e,t){return Math.round(e*t*1e6)/1e6}return e.prototype.setMeter=function(e){this.meter=e},e.prototype.setTempoChangeFactor=function(e){this.tempoChangeFactor=e},e.prototype.setLastBarTime=function(e){this.lastBarTime=e},e.prototype.setTranspose=function(e){this.transpose=e},e.prototype.setRhythmHead=function(e,t){this.hasRhythmHead=e;var n=[];if(e&&this.lastChord&&this.lastChord.chick)for(var r=0;r<this.lastChord.chick.length;r++){var i=Object.assign({},t.pitches[0]);i.actualPitch=this.lastChord.chick[r],n.push(i)}return n},e.prototype.barEnd=function(e){this.chordTrack.length>0&&!this.chordTrackFinished&&(this.resolveChords(this.lastBarTime,i(e.time)),this.currentChords=[]),this.chordLastBar=this.lastChord},e.prototype.gChordOn=function(e){this.chordsOff||(this.gChordTacet=e.tacet)},e.prototype.paramChange=function(e){switch(e.el_type){case"gchord":e.param&&e.param.length>0?this.overridePattern=r(e.param):this.overridePattern=void 0;break;case"bassprog":this.bassInstrument=e.value,null!=e.octaveShift&&null!=e.octaveShift?this.bassOctaveShift=e.octaveShift:this.bassOctaveShift=0;break;case"chordprog":this.chordInstrument=e.value,null!=e.octaveShift&&null!=e.octaveShift?this.chordOctaveShift=e.octaveShift:this.chordOctaveShift=0;break;case"bassvol":this.boomVolume=e.param;break;case"chordvol":this.chickVolume=e.param;break;default:console.log("unhandled midi param",e)}},e.prototype.finish=function(){this.chordTrackEmpty()||(this.chordTrackFinished=!0)},e.prototype.addTrack=function(e){this.chordTrackEmpty()||e.push(this.chordTrack)},e.prototype.findChord=function(e){if(this.gChordTacet)return"break";if(this.chordTrackFinished||!e.chord||0===e.chord.length)return null;for(var t=0;t<e.chord.length;t++){var n=e.chord[t];if("default"===n.position)return n.name;if(this.breakSynonyms.indexOf(n.name.toLowerCase())>=0)return"break"}return null},e.prototype.interpretChord=function(e){if(0!==e.length){if("break"===e)return{chick:[]};var t=e.substring(0,1);if("("===t){if(0===(e=e.substring(1,e.length-2)).length)return;t=e.substring(0,1)}var n=this.basses[t];if(n){for(var r=this.transpose;r<-8;)r+=12;for(;r>8;)r-=12;(n+=r)<33?n+=12:n>44&&(n-=12);var i,a=n,s=(n+=12*this.bassOctaveShift)-5;1===e.length&&(i=this.chordNotes(n,""));var o=e.substring(1),c=o.substring(0,1);"b"===c||"♭"===c?(a--,n--,s--,o=o.substring(1)):"#"!==c&&"♯"!==c||(a++,n++,s++,o=o.substring(1));var l=o.split("/");if((i=this.chordNotes(a,l[0])).length>=3&&(s=s+(i[2]-i[0])-7),2===l.length&&this.basses[l[1].substring(0,1)]){var u={"#":1,"♯":1,b:-1,"♭":-1}[l[1].substring(1)]||0;n=this.basses[l[1].substring(0,1)]+u+r,s=n+=12*this.bassOctaveShift}return{boom:n,boom2:s,chick:i}}}},e.prototype.chordNotes=function(e,t){var n=this.chordIntervals[t];n||(n="ma"===t.slice(0,2).toLowerCase()||"M"===t[0]?this.chordIntervals.M:"m"===t[0]||"-"===t[0]?this.chordIntervals.m:this.chordIntervals.M),e+=12,e+=12*this.chordOctaveShift;for(var r=[],i=0;i<n.length;i++)r.push(e+n[i]);return r},e.prototype.writeNote=function(e,t,n,r,i,s){void 0!==e&&this.chordTrack.push({cmd:"note",pitch:e,volume:n,start:this.lastBarTime+r*a(t,this.tempoChangeFactor),duration:a(i,this.tempoChangeFactor),gap:0,instrument:s})},e.prototype.chordTrackEmpty=function(){for(var e=!0,t=0;t<this.chordTrack.length&&e;t++)"note"===this.chordTrack[t].cmd&&(e=!1);return e},e.prototype.resolveChords=function(e,n){if(!this.hasRhythmHead){var r=this.meter.num,i=this.meter.den,a=1/i/2,s=parseInt(r,10)/parseInt(i,10)-(n-e)/this.tempoChangeFactor;Math.abs(s)<1e-5&&(s=0),0!==this.currentChords.length&&0===this.currentChords[0].beat||this.currentChords.unshift({beat:0,chord:this.chordLastBar});var o=function(e,t){var n=[];if(0===e.length)return n;for(var r=e[0].chord,i=1;i<e.length;i++){for(var a=e[i];n.length<a.beat;)n.push(r);r=a.chord}for(;n.length<t;)n.push(r);return n}(this.currentChords,8*r/i),c=this.overridePattern?this.overridePattern:this.rhythmPatterns[r+"/"+i];if(s){c=[];for(var l=(n-e)/this.tempoChangeFactor*8,u=0;u<l/2;u+=2)c.push("chick"),c.push("")}if(!c)for(c=[],u=0;u<8*r/i/2;u++)c.push("chick"),c.push("");var h=!0,d=Math.min(c.length,o.length);for(u=0;u<d;u++){u>0&&o[u-1]&&o[u]&&o[u-1].boom!==o[u].boom&&(h=!0);var f=c[u],p=f.indexOf("boom")>=0,m=!p&&0!==u&&c[0].indexOf("boom")>=0&&(!o[u-1]||o[u-1].boom!==o[u].boom),g=t(o[u],f,h,m);p&&(h=!1);for(var v=0;v<g.length;v++)this.writeNote(g[v],.125,p||m?this.boomVolume:this.chickVolume,u,a,p||m?this.bassInstrument:this.chordInstrument),m?m=!1:p=!1}}},e.prototype.processChord=function(e){if(!this.chordTrackFinished){var t,n=this.findChord(e);if(n){var r=this.interpretChord(n);if(r){0===this.chordTrack.length&&this.chordTrack.push({cmd:"program",channel:this.chordChannel,instrument:this.chordInstrument}),this.lastChord=r;var a=(t=this.lastBarTime,8*(i(e.time)-t));this.currentChords.push({chord:this.lastChord,beat:a,start:i(e.time)})}}}},e.prototype.breakSynonyms=["break","(break)","no chord","n.c.","tacet"],e.prototype.basses={A:33,B:35,C:36,D:38,E:40,F:41,G:43},e.prototype.chordIntervals={dim:[0,3,6],"°":[0,3,6],"˚":[0,3,6],dim7:[0,3,6,9],"°7":[0,3,6,9],"˚7":[0,3,6,9],"ø7":[0,3,6,10],"m7(b5)":[0,3,6,10],m7b5:[0,3,6,10],"m7♭5":[0,3,6,10],"-7(b5)":[0,3,6,10],"-7b5":[0,3,6,10],"7b5":[0,4,6,10],"7(b5)":[0,4,6,10],"7♭5":[0,4,6,10],"7(b9,b5)":[0,4,6,10,13],"7b9,b5":[0,4,6,10,13],"7(#9,b5)":[0,4,6,10,15],"7#9b5":[0,4,6,10,15],"maj7(b5)":[0,4,6,11],maj7b5:[0,4,6,11],"13(b5)":[0,4,6,10,14,21],"13b5":[0,4,6,10,14,21],m:[0,3,7],"-":[0,3,7],m6:[0,3,7,9],"-6":[0,3,7,9],m7:[0,3,7,10],"-7":[0,3,7,10],"-(b6)":[0,3,7,8],"-b6":[0,3,7,8],"-6/9":[0,3,7,9,14],"-7(b9)":[0,3,7,10,13],"-7b9":[0,3,7,10,13],"-maj7":[0,3,7,11],"-9+7":[0,3,7,11,13],"-11":[0,3,7,11,14,17],m11:[0,3,7,11,14,17],"-maj9":[0,3,7,11,14],"-∆9":[0,3,7,11,14],mM9:[0,3,7,11,14],M:[0,4,7],6:[0,4,7,9],"6/9":[0,4,7,9,14],"6add9":[0,4,7,9,14],69:[0,4,7,9,14],7:[0,4,7,10],9:[0,4,7,10,14],11:[0,7,10,14,17],13:[0,4,7,10,14,21],"7b9":[0,4,7,10,13],"7♭9":[0,4,7,10,13],"7(b9)":[0,4,7,10,13],"7(#9)":[0,4,7,10,15],"7#9":[0,4,7,10,15],"(13)":[0,4,7,10,14,21],"7(9,13)":[0,4,7,10,14,21],"7(#9,b13)":[0,4,7,10,15,20],"7(#11)":[0,4,7,10,14,18],"7#11":[0,4,7,10,14,18],"7(b13)":[0,4,7,10,20],"7b13":[0,4,7,10,20],"9(#11)":[0,4,7,10,14,18],"9#11":[0,4,7,10,14,18],"13(#11)":[0,4,7,10,18,21],"13#11":[0,4,7,10,18,21],maj7:[0,4,7,11],"∆7":[0,4,7,11],"Δ7":[0,4,7,11],maj9:[0,4,7,11,14],"maj7(9)":[0,4,7,11,14],"maj7(11)":[0,4,7,11,17],"maj7(#11)":[0,4,7,11,18],"maj7(13)":[0,4,7,14,21],"maj7(9,13)":[0,4,7,11,14,21],"7sus4":[0,5,7,10],m7sus4:[0,3,7,10,17],sus4:[0,5,7],sus2:[0,2,7],"7sus2":[0,2,7,10],"9sus4":[0,5,7,10,14],"13sus4":[0,5,7,10,14,21],aug7:[0,4,8,10],"+7":[0,4,8,10],"+":[0,4,8],"7#5":[0,4,8,10],"7♯5":[0,4,8,10],"7+5":[0,4,8,10],"9#5":[0,4,8,10,14],"9♯5":[0,4,8,10,14],"9+5":[0,4,8,10,14],"-7(#5)":[0,3,8,10],"-7#5":[0,3,8,10],"7(#5)":[0,4,8,10],"7(b9,#5)":[0,4,8,10,13],"7b9#5":[0,4,8,10,13],"maj7(#5)":[0,4,8,11],"maj7#5":[0,4,8,11],"maj7(#5,#11)":[0,4,8,11,18],"maj7#5#11":[0,4,8,11,18],"9(#5)":[0,4,8,10,14],"13(#5)":[0,4,8,10,14,21],"13#5":[0,4,8,10,14,21],5:[0,7],"5(8)":[0,7,12],"5add8":[0,7,12]},e.prototype.rhythmPatterns={"2/2":["boom","","","","chick","","",""],"3/2":["boom","","","","chick","","","","chick","","",""],"4/2":["boom","","","","chick","","","","boom","","","","chick","","",""],"2/4":["boom","","chick",""],"3/4":["boom","","chick","","chick",""],"4/4":["boom","","chick","","boom","","chick",""],"5/4":["boom","","chick","","chick","","boom","","chick",""],"6/4":["boom","","chick","","boom","","chick","","boom","","chick",""],"3/8":["boom","","chick"],"5/8":["boom","chick","chick","boom","chick"],"6/8":["boom","","chick","boom","","chick"],"7/8":["boom","chick","chick","boom","chick","boom","chick"],"9/8":["boom","","chick","boom","","chick","boom","","chick"],"10/8":["boom","chick","chick","boom","chick","chick","boom","chick","boom","chick"],"11/8":["boom","chick","chick","boom","chick","chick","boom","chick","boom","chick","chick"],"12/8":["boom","","chick","boom","","chick","boom","","chick","boom","","chick"]},Vh=e}(),n=Pg();return function(){var r,i,a,s,o,c,l,u,h,d,f,p,m,g,v,y,b,_=1,w={num:4,den:4},x=128,k=!0,C=105,S=95,E=85,M=.25,T=0,N={},A=0;function P(e){for(var t=u.length-1;t>=0;t--)if("program"===u[t].cmd)return void(u[t].channel=e)}function I(e){return e/1e6}function D(e){return Math.round(e*_*1e6)/1e6}function B(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 O(e,t){var n=t.start,r=t.duration,i=D(1/32);switch(e){case"trill":for(var a=2;r>0;)u.push({cmd:"note",pitch:t.pitch+a,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),a=2===a?0:2,r-=i,n+=i;break;case"mordent":u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch+2,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:r,gap:0,instrument:l});break;case"lowermordent":u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch-2,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=i,n+=i,u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:r,gap:0,instrument:l});break;case"turn":i=t.duration/4,u.push({cmd:"note",pitch:t.pitch+2,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n+i,duration:i,gap:0,instrument:l,style:"decoration"}),u.push({cmd:"note",pitch:t.pitch-1,volume:t.volume,start:n+2*i,duration:i,gap:0,instrument:l,style:"decoration"}),u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n+3*i,duration:i,gap:0,instrument:l,style:"decoration"});break;case"roll":for(;r>0;)u.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:n,duration:i,gap:0,instrument:l,style:"decoration"}),r-=2*i,n+=2*i}}function L(e,t){var r,i=function(e,t){if(t)return 0;var n;if(null!=m)n=m,m=void 0;else if(k)if(A>e)n=E;else{var r=(e-p)/B(w);n=0===r?C:parseInt(r,10)===r?S:E}else n=S;return g&&(n+=g,g=void 0),n<0&&(n=0),n>127&&(n=127),t?0:n}(I(e.time),t);if(f.processChord(e),e.gracenotes&&e.pitches&&e.pitches.length>0&&e.pitches[0]&&(r=function(e,t){for(var r,i=0,a=[],s=0;s<e.length;s++)i+=(r=e[s]).duration;var o=t/2/i;for(s=0;s<e.length;s++){var c=R(r=e[s]);if(l===x&&b){var u=n(r);u&&b[u]&&(c=b[u].sound)}var h={pitch:c,duration:r.duration*o};h=z(h),a.push(h)}return a}(e.gracenotes,e.pitches[0].duration),e.elem&&(e.elem.midiGraceNotePitches=function(e,t,n,r){var i=[];n=Math.round(n);for(var a=0;a<e.length;a++){var s=e[a];u.push({cmd:"note",pitch:s.pitch,volume:n,start:t,duration:s.duration,gap:0,instrument:r,style:"grace"}),i.push({pitch:s.pitch,durationInMeasures:s.duration,volume:n,instrument:r}),t+=s.duration}return i}(r,I(e.time),2*i/3,l))),e.elem){var a=I(e.time),s=a/M/o*60*1e3;if(void 0===e.elem.currentTrackMilliseconds)e.elem.currentTrackMilliseconds=s,e.elem.currentTrackWholeNotes=a;else if(void 0===e.elem.currentTrackMilliseconds.length)e.elem.currentTrackMilliseconds!==s&&(e.elem.currentTrackMilliseconds=[e.elem.currentTrackMilliseconds,s],e.elem.currentTrackWholeNotes=[e.elem.currentTrackWholeNotes,a]);else{for(var c=!1,h=0;h<e.elem.currentTrackMilliseconds.length;h++)e.elem.currentTrackMilliseconds[h]===s&&(c=!0);c||(e.elem.currentTrackMilliseconds.push(s),e.elem.currentTrackWholeNotes.push(a))}}if(e.pitches){var v="",y=function(e,t){var n={};if(e.decoration)for(var r=0;r<e.decoration.length;r++)"staccato"===e.decoration[r]?n.thisBreakBetweenNotes="staccato":"tenuto"===e.decoration[r]?n.thisBreakBetweenNotes="tenuto":"accent"===e.decoration[r]?n.velocity=Math.min(127,1.5*t):"trill"===e.decoration[r]?n.noteModification="trill":"lowermordent"===e.decoration[r]?n.noteModification="lowermordent":"uppermordent"===e.decoration[r]||"mordent"===e.decoration[r]?n.noteModification="mordent":"turn"===e.decoration[r]?n.noteModification="turn":"roll"===e.decoration[r]&&(n.noteModification="roll");return n}(e,i);y.thisBreakBetweenNotes&&(v=y.thisBreakBetweenNotes),y.velocity&&(i=y.velocity);var _=e.pitches;"rhythm"===e.style&&(_=f.setRhythmHead(!0,e)),e.elem&&(e.elem.midiPitches=[]);for(var N=0;N<_.length;N++){var P=_[N];if(P){P.startSlur&&(T+=P.startSlur.length),P.endSlur&&(T-=P.endSlur.length);var L=P.actualPitch?P.actualPitch:R(P);if(l===x&&b){var V=n(P);V&&b[V]&&(L=b[V].sound)}var F={cmd:"note",pitch:L,volume:i,start:I(e.time),duration:D(P.duration),instrument:l,startChar:e.elem.startChar,endChar:e.elem.endChar};if(F=z(F),e.gracenotes&&(F.duration=F.duration/2,F.start=F.start+F.duration),e.elem&&e.elem.midiPitches.push(F),y.noteModification)O(y.noteModification,F);else{switch(T>0?F.endType="tenuto":v&&(F.endType=v),F.endType){case"tenuto":F.gap=-.001;break;case"staccato":var j=.4*F.duration;F.gap=o/60*j;break;default:F.gap=0}u.push(F)}}}u.length}var q=function(e){return e.pitches&&e.pitches.length>0&&e.pitches[0]?e.pitches[0].duration:e.elem?e.elem.duration:e.duration}(e);d=Math.max(d,I(e.time)+D(q))}e=function(e,n,x,D){n||(n={}),D||(D={}),r=[],i=[0,0,0,0,0,0,0],s=[],o=n.qpm,_=1,c=void 0,l=void 0,u=void 0,h=void 0,d=0,b=x,w={num:4,den:4},k=!0,C=105,S=95,E=85,M=.25,m=void 0,g=void 0,T=0,v=[],N={},y=1,e.length>0&&e[0].length>0&&(A=e[0][0].pickupLength),void 0===n.bassprog||D.bassprog||(D.bassprog=[n.bassprog]),void 0===n.bassvol||D.bassvol||(D.bassvol=[n.bassvol]),void 0===n.chordprog||D.chordprog||(D.chordprog=[n.chordprog]),void 0===n.chordvol||D.chordvol||(D.chordvol=[n.chordvol]),void 0===n.gchord||D.gchord||(D.gchord=[n.gchord]),f=new t(e.length,n.chordsOff,D,w),function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n],i={},a=t.qpm,s=0,o=1,c=0;c<r.length;c++){var l=r[c];if("tempo"!==l.el_type){l.time=s;var u=l.duration?l.duration:0;if(s+=Math.round(u*o*1e6),l.pitches){for(var h=0;h<l.pitches.length;h++){var d=l.pitches[h];if(d)if(d.duration=l.duration,d.startTie)void 0===i[d.pitch]?i[d.pitch]={el:c,pitch:h}:(r[i[d.pitch].el].pitches[i[d.pitch].pitch].duration+=d.duration,l.pitches[h]=null);else if(d.endTie){var f=i[d.pitch];if(f){var p=d.duration;delete r[f.el].pitches[f.pitch].startTie,r[f.el].pitches[f.pitch].duration+=p,l.pitches[h]=null,delete i[d.pitch]}else delete d.endTie}}delete l.duration}}else a?o=l.qpm?a/l.qpm:1:a=l.qpm}for(var m in i)if(i.hasOwnProperty(m)){var g=i[m];delete r[g.el].pitches[g.pitch].startTie}}}(e,n);for(var O=0;O<e.length;O++){a=0,f.setTranspose(a);var V=e[O];u=[{cmd:"program",channel:O,instrument:c}],h=void 0,p=0,f.setLastBarTime(0);var R=!1;(!0===n.voicesOff||n.voicesOff&&n.voicesOff.length&&n.voicesOff.indexOf(O)>=0)&&(R=!0);for(var z=0;z<V.length;z++){var j=V[z];switch(j.el_type){case"name":h={cmd:"text",type:"name",text:j.trackName};break;case"note":L(j,R);break;case"key":i=F(j);break;case"meter":w=j,f.setMeter(w),M=B(w),H();break;case"tempo":o?_=j.qpm?o/j.qpm:1:o=j.qpm,f.setTempoChangeFactor(_);break;case"transpose":a=j.transpose,f.setTranspose(a);break;case"bar":f.barEnd(j),r=[],0===O&&U(e.length+1),f.setRhythmHead(!1),p=I(j.time),f.setLastBarTime(p);break;case"bagpipes":break;case"instrument":if(void 0===c&&(c=j.program),l=j.program,u.length>0&&"program"===u[u.length-1].cmd)u[u.length-1].instrument=j.program;else{var G;for(G=u.length-1;G>=0&&"program"!==u[G].cmd;G--);(G<0||u[G].instrument!==j.program)&&u.push({cmd:"program",channel:0,instrument:j.program})}break;case"channel":P(j.channel);break;case"drum":N=q(j.params),H();break;case"gchordOn":f.gChordOn(j);break;case"beat":C=j.beats[0],S=j.beats[1],E=j.beats[2];break;case"vol":m=j.volume;break;case"volinc":g=j.volume;break;case"beataccents":k=j.value;break;case"gchord":case"bassprog":case"chordprog":case"bassvol":case"chordvol":case"gchordbars":f.paramChange(j);break;default:console.log("MIDI creation. Unknown el_type: "+j.el_type+"\n")}}void 0===u[0].instrument&&(u[0].instrument=c||0),h&&u.unshift(h),s.push(u),f.finish(),v.length}return n.detuneOctave&&function(e,t){for(var n={},r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){var a=e[r][i];"note"===a.cmd&&(void 0===n[a.start]&&(n[a.start]=[]),n[a.start].push({track:r,event:i,pitch:a.pitch}))}var s=Object.keys(n);for(r=0;r<s.length;r++){var o=n[s[r]];if(o.length>1){var c=(o=o.sort((function(e,t){return e.pitch-t.pitch})))[o.length-1],l=c.pitch%12,u=!1;for(i=0;!u&&i<o.length-1;i++)o[i].pitch%12===l&&(u=!0);if(u){var h=e[c.track][c.event];h.cents||(h.cents=0),h.cents+=t}}}}(s,parseInt(n.detuneOctave,10)),f.addTrack(s),v.length>0&&s.push(v),{tempo:o,instrument:c,tracks:s,totalDuration:d}};var V=[0,2,4,5,7,9,11];function R(e){if(void 0!==e.midipitch)return e.midipitch;var t=e.pitch;if(e.accidental)switch(e.accidental){case"sharp":r[t]=1;break;case"flat":r[t]=-1;break;case"natural":r[t]=0;break;case"dblsharp":r[t]=2;break;case"dblflat":r[t]=-2;break;case"quartersharp":r[t]=.25;break;case"quarterflat":r[t]=-.25}var n=12*function(e){return Math.floor(e/7)}(t)+V[j(t)]+60;return void 0!==r[t]?n+=r[t]:n+=i[j(t)],n+=a}function F(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,i=e.accidentals[n];switch(i.acc){case"flat":r=-1;break;case"quarterflat":r=-.25;break;case"sharp":r=1;break;case"quartersharp":r=.25;break;default:r=0}t[j(i.note.toLowerCase().charCodeAt(0)-"c".charCodeAt(0))]+=r}return t}function z(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 j(e){return(e%=7)<0&&(e+=7),e}function q(e){if(0===e.pattern.length||!1===e.on)return{on:!1};for(var t=e.pattern[0],n=[],r="",i=0,a=0;a<t.length;a++)if("d"===t[a]&&i++,"d"===t[a]||"z"===t[a])0!==r.length?(n.push(r),r=t[a]):r+=t[a];else{if(0===r.length)return{on:!1};r+=t[a]}if(0!==r.length&&n.push(r),e.pattern.length!==2*i+1)return{on:!1};for(var s={on:!0,bars:e.bars,pattern:[]},o=B(w),c=0,l=0;l<n.length;l++){r=n[l];for(var u=1,h=!1,d=0,f=1;f<r.length;f++)switch(r[f]){case"/":0!==d&&(u*=d),d=0,h=!0;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":d=10*d+r[f];break;default:return{on:!1}}h?(0===d&&(d=2),u/=d):d&&(u*=d),"d"===r[0]?(s.pattern.push({len:u*o,pitch:e.pattern[1+c],velocity:e.pattern[1+c+i]}),c++):s.pattern.push({len:u*o,pitch:null})}return y=e.bars?e.bars:1,s}function H(){if(N&&N.pattern){for(var e=N,t=0,n=w.num/w.den,r=0;r<e.pattern.length;r++)t+=e.pattern[r].len;var i=t/y/n;for(r=0;r<e.pattern.length;r++)e.pattern[r].len=e.pattern[r].len/i;N=e}}function U(e){if(0!==v.length||N.on){var t=w.num/w.den;if(0===v.length){if(d<t)return;v.push({cmd:"program",channel:e,instrument:x})}if(N.on)for(var n=p,r=0;r<N.pattern.length;r++){var i=D(N.pattern[r].len);N.pattern[r].pitch&&v.push({cmd:"note",pitch:N.pattern[r].pitch,volume:N.pattern[r].velocity,start:n,duration:i,gap:0,instrument:x}),n+=i}}}}(),jh=e}function Dg(){if(Wh)return Gh;Wh=1;var e=yh(),t=Ng(),n=Ag(),r=Ig(),i=function(){if(Uh)return Hh;function e(e,t){return"abselem"===e?"abselem":t}function t(e,t){e.el_type="meter",e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function n(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 r(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 i(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 a(t,n){return!t||JSON.stringify(t,e)===JSON.stringify(n,e)}function s(e){for(var t={},n=Object.keys(e),r=0;r<n.length;r++)if("staff"!==n[r])t[n[r]]=e[n[r]];else{t.staff=[];for(var i=0;i<e.staff.length;i++){for(var a={},s=Object.keys(e.staff[i]),o=0;o<s.length;o++)if("voices"!==s[o])a[s[o]]=e.staff[i][s[o]];else{a.voices=[];for(var c=0;c<e.staff[i].voices.length;c++)a.voices.push([].concat(e.staff[i].voices[c]))}t.staff.push(a)}}return t}return Uh=1,Hh=function(e,o){o||(o={});for(var c=!!o.lineBreaks,l=[],u=!1,h=[],d=[],f=[],p=[],m=[],g=[],v=[],y=0;y<e.length;y++){var b=e[y];if(b.staff){if(u&&!b.vskip)for(var _=l[l.length-1],w=0;w<_.staff.length;w++){var x=b.staff[w],k=_.staff[w];if(x&&(a(x.meter,h[w])||(t(x.meter,x.voices),h[w]=x.meter,delete x.meter),a(x.key,d[w])||(n(x.key,x.voices),d[w]=x.key,delete x.key),x.title&&(k.abbrevTitle=x.title),a(x.clef,f[w])||(r(x.clef,x.voices),f[w]=x.clef,delete x.clef),a(x.vocalfont,p[w])||(i(x.vocalfont,x.voices,"vocalfont"),p[w]=x.vocalfont,delete x.vocalfont),a(x.gchordfont,m[w])||(i(x.gchordfont,x.voices,"gchordfont"),m[w]=x.gchordfont,delete x.gchordfont),a(x.tripletfont,g[w])||(i(x.tripletfont,x.voices,"tripletfont"),g[w]=x.tripletfont,delete x.tripletfont),a(x.annotationfont,v[w])||(i(x.annotationfont,x.voices,"annotationfont"),v[w]=x.annotationfont,delete x.annotationfont)),x)for(var C=0;C<k.voices.length;C++){var S=k.voices[C],E=x.voices[C];c&&S.push({el_type:"break"}),E&&(k.voices[C]=S.concat(E))}}else{for(var M=0;M<b.staff.length;M++)d[M]=b.staff[M].key,h[M]=b.staff[M].meter,f[M]=b.staff[M].clef;l.push(s(b))}u=!0}else u=!1,l.push(b)}return l}}();return Gh=function(){function a(e,t,n,r){for(var i=0;i<r.length;i++)e[n][r[i]]=t[n][r[i]]}function s(e,t){for(;t<e.length&&null===e[t].left;)t++;return e[t]}this.reset=function(){this.version="1.1.0",this.media="screen",this.metaText={},this.metaTextInfo={},this.formatting={},this.lines=[],this.staffNum=0,this.voiceNum=0,this.lineNum=0,this.runningFonts={},delete this.visualTranspose},this.reset(),this.copyTopInfo=function(e){var t=["tempo","title","header","rhythm","origin","composer","author","partOrder"];a(this,e,"metaText",t),a(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"];a(this,e,"metaText",t),a(this,e,"metaTextInfo",t)},this.getBeatLength=function(){var e=this.getMeterFraction(),t=1;return(6===e.num||9===e.num||12===e.num||3===e.num&&8===e.den)&&(t=3),t/e.den},this.getPickupLength=function(){var e=this.getBarLength(),t=function(e,t){for(var n=0,r=0;r<e.length;r++)if(e[r].staff)for(var i=0;i<e[r].staff.length;i++)for(var a=0;a<e[r].staff[i].voices.length;a++)for(var s=e[r].staff[i].voices[a],o=1,c=0;c<s.length;c++){var l=s[c].rest&&"spacer"===s[c].rest.type;if(s[c].startTriplet&&(o=s[c].tripletMultiplier),s[c].duration&&!l&&"tempo"!==s[c].el_type&&(n+=s[c].duration*o),s[c].endTriplet&&(o=1),n>=t&&(n-=t),"bar"===s[c].el_type)return n}return n}(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),6e4*(this.getBeatsPerMeasure()/t)},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&&("specified"===e.type?(t=parseInt(e.value[0].num,10),n=parseInt(e.value[0].den,10)):"cut_time"===e.type?(t=2,n=2):"common_time"===e.type&&(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 i=n.staff[r],a=0;a<i.voices.length;a++)for(var s=i.voices[a],o=0;o<s.length;o++){var c=s[o];if(c.startChar&&c.endChar&&c.startChar<=e&&c.endChar>e)return c}}return null},this.addElementToEvents=function(t,n,r,i,a,s,o,c,l,u){if(n.hint)return{isTiedState:void 0,duration:0};var h=n.durationClass?n.durationClass:n.duration;if(n.abcelem.rest&&"spacer"===n.abcelem.rest.type&&(h=0),h>0){for(var d=[],f=0;f<n.elemset.length;f++)null!==n.elemset[f]&&d.push(n.elemset[f]);var p=n.startTie;if(void 0!==l)t["event"+l].elements.push(d),u&&(t["event"+r]||(t["event"+r]={type:"event",milliseconds:r,line:s,measureNumber:o,top:i,height:a,left:null,width:0,elements:[],startChar:null,endChar:null,startCharArray:[],endCharArray:[]}),t["event"+r].measureStart=!0,u=!1),p||(l=void 0);else{if(t["event"+r]){if(t["event"+r].left?t["event"+r].left=Math.min(t["event"+r].left,n.x):t["event"+r].left=n.x,t["event"+r].elements.push(d),t["event"+r].startCharArray.push(n.abcelem.startChar),t["event"+r].endCharArray.push(n.abcelem.endChar),null===t["event"+r].startChar&&(t["event"+r].startChar=n.abcelem.startChar),null===t["event"+r].endChar&&(t["event"+r].endChar=n.abcelem.endChar),n.abcelem.midiPitches&&n.abcelem.midiPitches.length){t["event"+r].midiPitches||(t["event"+r].midiPitches=[]);for(f=0;f<n.abcelem.midiPitches.length;f++)t["event"+r].midiPitches.push(n.abcelem.midiPitches[f])}if(n.abcelem.midiGraceNotePitches&&n.abcelem.midiGraceNotePitches.length){t["event"+r].midiGraceNotePitches||(t["event"+r].midiGraceNotePitches=[]);for(var m=0;m<n.abcelem.midiGraceNotePitches.length;m++)t["event"+r].midiGraceNotePitches.push(n.abcelem.midiGraceNotePitches[m])}}else t["event"+r]={type:"event",milliseconds:r,line:s,measureNumber:o,top:i,height:a,left:n.x,width:n.w,elements:[d],startChar:n.abcelem.startChar,endChar:n.abcelem.endChar,startCharArray:[n.abcelem.startChar],endCharArray:[n.abcelem.endChar],midiPitches:n.abcelem.midiPitches?e.cloneArray(n.abcelem.midiPitches):[]},n.abcelem.midiGraceNotePitches&&(t["event"+r].midiGraceNotePitches=e.cloneArray(n.abcelem.midiGraceNotePitches));u&&(t["event"+r].measureStart=!0,u=!1)}}return{isTiedState:l,duration:h/c,nextIsBar:u||"bar"===n.type}},this.makeVoicesArray=function(){for(var e=[],n=[],r={},i=0;i<this.engraver.staffgroups.length;i++){var a=this.engraver.staffgroups[i];if(a&&a.staffs&&a.staffs.length>0)for(var s=a.staffs[0],o=s.absoluteY,c=o-s.top*t.STEP,l=a.staffs[a.staffs.length-1],u=(o=l.absoluteY)-l.bottom*t.STEP-c,h=a.voices,d=0;d<h.length;d++)if(!h[d].staff||!h[d].staff.isTabStaff){var f=!1;e[d]||(e[d]=[]),void 0===n[d]&&(n[d]=0);for(var p=h[d].children,m=0;m<p.length;m++)"tempo"===p[m].type&&(r[n[d]]=this.getBpm(p[m].abcelem)),e[d].push({top:c,height:u,line:a.line,measureNumber:n[d],elem:p[m]}),"bar"===p[m].type&&f&&n[d]++,"note"!==p[m].type&&"rest"!==p[m].type||(f=!0)}}return this.tempoLocations=r,e},this.setupEvents=function(e,t,n,r){r||(r=1);for(var i,a=[],o={},c=e,l=!0,u=this.makeVoicesArray(),h=0,d=0;d<u.length;d++){var f=c,p=Math.round(1e3*f),m=0,g=-1,v=u[d],y=n;t=this.getBeatLength()*y/60;for(var b=-1,_=0;_<v.length;_++){var w=v[_].measureNumber;b!==w&&this.tempoLocations[w]&&(y=this.tempoLocations[w],t=r*this.getBeatLength()*y/60,b=w);var x,k=v[_].elem,C=this.addElementToEvents(o,k,p,v[_].top,v[_].height,v[_].line,v[_].measureNumber,t,i,l);if(i=C.isTiedState,l=C.nextIsBar,f+=C.duration,k.duration>0&&o["event"+p]&&(x="event"+p),p=Math.round(1e3*f),"bar"===k.type){var S=k.abcelem.type,E="bar_right_repeat"===S||"bar_dbl_repeat"===S,M="1"===k.abcelem.startEnding,T="bar_left_repeat"===S||"bar_dbl_repeat"===S||"bar_right_repeat"===S;if(E){_>0&&(o[x].endX=k.x),-1===g&&(g=_);var N=0;b=-1;for(var A=m;A<g;A++){b!==(w=v[A].measureNumber)&&this.tempoLocations[w]&&(y=this.tempoLocations[w],t=r*this.getBeatLength()*y/60,b=w);var P=v[A].elem;i=(C=this.addElementToEvents(o,P,p,v[A].top,v[A].height,v[A].line,v[A].measureNumber,t,i,l)).isTiedState,l=C.nextIsBar,f+=C.duration,N=p,p=Math.round(1e3*f)}o["event"+N]&&(o["event"+N].endX=v[g].elem.x),l=!0,g=-1}M&&(g=_),T&&(m=_)}}h=Math.max(h,p)}return function(e){for(var t,n,r,i,a=e.length-1;a>=0;a--){var s=e[a];"bar"===s.type?(s.top=r,s.nextTop=t,t=r,s.bottom=i,s.nextBottom=n,n=i):"event"===s.type&&(r=s.top,i=s.top+s.height)}}(a=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t.sort((function(e,t){var n=e.milliseconds-t.milliseconds;return 0!==n?n:"bar"===e.type?-1:1}))}(o)),function(e,t){if(t.length<1)return;for(var n=0;n<t.length-1;n++){var r=t[n],i=s(t,n+1);if(null!==r.left){var a=i&&r.top===i.top?i.left:e[r.line].staffGroup.w;void 0!==r.endX?a>r.left&&(r.endX=Math.min(r.endX,a)):r.endX=a}}var o=t[t.length-1];o.endX=e[o.line].staffGroup.w}(this.lines,a),a.push({type:"end",milliseconds:h}),this.addUsefulCallbackInfo(a,y*r),a},this.addUsefulCallbackInfo=function(e,t){for(var n=this.millisecondsPerMeasure(t),r=0;r<e.length;r++){e[r].millisecondsPerMeasure=n}},this.getBpm=function(e){var t;if(e||(e=this.metaText?this.metaText.tempo:null),e){t=e.bpm;var n=this.getBeatLength();t=t*(e.duration&&e.duration.length>0?e.duration[0]:n)/n}if(!t){t=180;var r=this.getMeterFraction();r&&3!==r.num&&r.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),i=1;e?n&&(i=e/r):e=r;var a=this.getBeatLength(),s=e/60,o=this.getBarLength()/a*t/s;o&&(o-=this.getPickupLength()/a/s);var c=a*s;return this.noteTimings=this.setupEvents(o,c,e,i),this.noteTimings.length>0?(this.totalTime=this.noteTimings[this.noteTimings.length-1].milliseconds/1e3,this.totalBeats=this.totalTime*s):(this.totalTime=void 0,this.totalBeats=void 0),this.noteTimings},this.setUpAudio=function(e){e||(e={});var t=n(this,e);return r(t,e,this.formatting.percmap,this.formatting.midi)},this.deline=function(e){return i(this.lines,e)},this.findSelectableElement=function(e){return this.engraver&&this.engraver.selectables?this.engraver.findSelectableElement(e):null},this.getSelectableArray=function(){return this.engraver&&this.engraver.selectables?this.engraver.selectables:[]}}}function Bg(){if($h)return Yh;$h=1;var e=Ch();function t(e){if(!e)return!1;if("string"==typeof e)return!1;for(var t=0;t<e.length;t++)if("string"!=typeof e[t])return!1;return!0}function n(e){for(var t=!1,n=[],i=0;i<e.lines.length;i++){var a=e.lines[i];if(a.staff)for(var s=0;s<a.staff.length;s++){for(var o=a.staff[s],c=[],l=0;l<o.voices.length;l++){var u=o.voices[l];c.push({hasOverlay:!1,voice:[],snip:[]}),n[i]=0;for(var h=0,d=!1,f=-1,p=0;p<u.length;p++){var m=u[p];if("overlay"!==m.el_type||d)"bar"===m.el_type?(d?(d=!1,c[l].snip.push({start:f,len:p-f}),c[l].voice.push(m)):(h>0&&c[l].voice.push({el_type:"note",duration:h,rest:{type:"invisible"},startChar:m.startChar,endChar:m.endChar}),c[l].voice.push(m)),h=0):"note"===m.el_type?d?c[l].voice.push(m):(h+=m.duration,n[i]+=m.duration):"scale"!==m.el_type&&"stem"!==m.el_type&&"overlay"!==m.el_type&&"style"!==m.el_type&&"transpose"!==m.el_type&&"color"!==m.el_type||c[l].voice.push(m);else{t=!0,d=!0,f=p,c[l].hasOverlay=!0;for(var g=0;g<i;g++)n[g]&&e.lines[g].staff&&o.voices.length>=e.lines[g].staff[0].voices.length&&e.lines[g].staff[0].voices.push([{el_type:"note",duration:n[g],rest:{type:"invisible"},startChar:m.startChar,endChar:m.endChar}])}}c[l].hasOverlay&&0===c[l].snip.length&&c[l].snip.push({start:f,len:u.length-f})}for(l=0;l<c.length;l++){var v=c[l];if(v.hasOverlay){v.voice.splice(0,0,{el_type:"stem",direction:"down"}),o.voices.push(v.voice);for(var y=v.snip.length-1;y>=0;y--){var b=v.snip[y];o.voices[l].splice(b.start,b.len),o.voices[l].splice(b.start+1,0,{el_type:"stem",direction:"auto"});var _=r(o.voices[l],b.start);o.voices[l].splice(_,0,{el_type:"stem",direction:"up"})}for(y=0;y<o.voices[o.voices.length-1].length;y++){o.voices[o.voices.length-1][y]=Object.assign({},o.voices[o.voices.length-1][y]);var w=o.voices[o.voices.length-1][y];"bar"===w.el_type&&w.startEnding&&delete w.startEnding,"bar"===w.el_type&&w.endEnding&&delete w.endEnding}}}}}return t}function r(e,t){for(var n=t-1;n>0&&"bar"!==e[n].el_type;n--);return n}function a(e,t,n,r){var i;r[t]||(r[t]=[]),r[t][n]||(r[t][n]=[]);for(var a=function(e,a,s){if(void 0===r[t][n][s]){for(i=0;i<r[t][n].length;i++)if(void 0!==r[t][n][i]){s=i;break}if(void 0===r[t][n][s]){var o=100*s+1;e.endSlur.forEach((function(e){o===e&&--o})),r[t][n][s]=[o]}}for(var c,l=0;l<a;l++)c=r[t][n][s].pop(),e.endSlur.push(c);return 0===r[t][n][s].length&&delete r[t][n][s],c},s=function(e,i,a,s){e.startSlur=[],void 0===r[t][n][a]&&(r[t][n][a]=[]);for(var o=100*a+1,c=0;c<i;c++)s&&(s.forEach((function(e){o===e&&++o})),s.forEach((function(e){o===e&&++o})),s.forEach((function(e){o===e&&++o}))),r[t][n][a].forEach((function(e){o===e&&++o})),r[t][n][a].forEach((function(e){o===e&&++o})),r[t][n][a].push(o),e.startSlur.push({label:o}),e.dottedSlur&&(e.startSlur[e.startSlur.length-1].style="dotted",delete e.dottedSlur),o++},o=0;o<e.length;o++){var c=e[o];if("note"===c.el_type){if(c.gracenotes)for(var l=0;l<c.gracenotes.length;l++){if(c.gracenotes[l].endSlur){var u=c.gracenotes[l].endSlur;c.gracenotes[l].endSlur=[];for(var h=0;h<u;h++)a(c.gracenotes[l],1,20)}c.gracenotes[l].startSlur&&(i=c.gracenotes[l].startSlur,s(c.gracenotes[l],i,20))}if(c.endSlur&&(i=c.endSlur,c.endSlur=[],a(c,i,0)),c.startSlur&&s(c,i=c.startSlur,0),c.pitches){for(var d=[],f=0;f<c.pitches.length;f++)if(c.pitches[f].endSlur){var p=c.pitches[f].endSlur;c.pitches[f].endSlur=[];for(var m=0;m<p;m++){var g=a(c.pitches[f],1,f+1);d.push(g)}}for(f=0;f<c.pitches.length;f++)c.pitches[f].startSlur&&(i=c.pitches[f].startSlur,s(c.pitches[f],i,f+1,d));c.gracenotes&&c.pitches[0].endSlur&&100===c.pitches[0].endSlur[0]&&c.pitches[0].startSlur&&(c.gracenotes[0].endSlur?c.gracenotes[0].endSlur.push(c.pitches[0].startSlur[0].label):c.gracenotes[0].endSlur=[c.pitches[0].startSlur[0].label],1===c.pitches[0].endSlur.length?delete c.pitches[0].endSlur:100===c.pitches[0].endSlur[0]?c.pitches[0].endSlur.shift():100===c.pitches[0].endSlur[c.pitches[0].endSlur.length-1]&&c.pitches[0].endSlur.pop(),1===r[t][n][1].length?delete r[t][n][1]:r[t][n][1].pop())}}}}function o(e,t){for(i=0;i<e.length;i++)if(void 0!==e[i].staff)for(s=0;s<e[i].staff.length;s++){var n=[];for(v=0;v<e[i].staff[s].voices.length;v++)for(var r=e[i].staff[s].voices[v],a=0,o=0;o<r.length;o++)if("bar"===r[o].el_type){if(++a>=t&&o<r.length-1){var l=c(e,i);if(!l){var u=JSON.parse(JSON.stringify(e[i]));e.push(Object.assign({},u)),l=e[e.length-1];for(var h=0;h<l.staff.length;h++)for(var d=0;d<l.staff[h].voices.length;d++)l.staff[h].voices[d]=[]}var f=o+1,p=e[i].staff[s].voices[v].slice(f);return e[i].staff[s].voices[v]=e[i].staff[s].voices[v].slice(0,f),l.staff[s].voices[v]=n.concat(p.concat(l.staff[s].voices[v])),!0}}else r[o].duration||n.push(r[o])}return!1}function c(e,t){for(t++;e.length>t;){if(e[t].staff)return e[t];t++}return null}function l(e){e.potentialStartBeam&&e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function u(e){for(var t=0;t<e.length;t++)if("note"===e[t].el_type||"bar"===e[t].el_type)return!0;return!1}function h(e){for(var t=0;t<e.length;t++)if("note"===e[t].el_type&&(void 0===e[t].rest||void 0!==e[t].chord))return!0;return!1}function d(e,t){e.vskipPending&&(t.vskip=e.vskipPending,delete e.vskipPending),e.lines.push(t)}function f(e){void 0!==e.potentialStartBeam&&void 0!==e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function p(e,t,n){if(e.runningFonts[t]){for(var r=!1,i=Object.keys(n),a=0;a<i.length;a++)e.runningFonts[t][i[a]]!==n[i[a]]&&(r=!0);r&&(e.lines[e.lineNum].staff[e.staffNum][t]=n)}e.runningFonts[t]=n}function m(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(void 0!==r.voices[0]){for(var i=!1,a=0;a<r.voices[0].length;a++)"stem"===r.voices[0].el_type&&(i=!0);if(!i){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 g(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];void 0!==n.stafflines&&(r.clef.stafflines=n.stafflines,r.workingClef.stafflines=n.stafflines),n.staffscale&&(r.staffscale=n.staffscale),n.annotationfont&&p(t,"annotationfont",n.annotationfont),n.gchordfont&&p(t,"gchordfont",n.gchordfont),n.tripletfont&&p(t,"tripletfont",n.tripletfont),n.vocalfont&&p(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),m(e,t,n),n.part&&e.appendElement("part",n.part.startChar,n.part.endChar,{title:n.part.title}),void 0!==n.meter&&(r.meter=n.meter),t.vskipPending&&(t.lines[t.lineNum].vskip=t.vskipPending,delete t.vskipPending)}return Yh=function(r){var i=this,s={},p="";r.reset(),this.setVisualTranspose=function(e){e&&(r.visualTranspose=e)},this.cleanUp=function(i,s,d){l(r),delete r.runningFonts,function(e){t(e.metaText.notes)&&(e.metaText.notes=e.metaText.notes.join("\n"));t(e.metaText.history)&&(e.metaText.history=e.metaText.history.join("\n"))}(r),r.metaText.tempo&&r.metaText.tempo.bpm&&!r.metaText.tempo.duration&&(r.metaText.tempo.duration=[r.getBeatLength()]);var f,p,m=!1;for(y=0;y<r.lines.length;y++)if(void 0!==r.lines[y].staff){var g=!1;for(f=0;f<r.lines[y].staff.length;f++)if(void 0===r.lines[y].staff[f])m=!0,r.lines[y].staff[f]=null;else for(p=0;p<r.lines[y].staff[f].voices.length;p++)void 0===r.lines[y].staff[f].voices[p]?r.lines[y].staff[f].voices[p]=[]:u(r.lines[y].staff[f].voices[p])&&(g=!0);g||(r.lines[y]=null,m=!0)}if(m&&(r.lines=r.lines.filter((function(e){return!!e})),r.lines.forEach((function(e){e.staff&&(e.staff=e.staff.filter((function(e){return!!e})))}))),i)for(;o(r.lines,i););if(s){for(m=!1,y=0;y<r.lines.length;y++)if(void 0!==r.lines[y].staff)for(f=0;f<r.lines[y].staff.length;f++){var v=!1;for(p=0;p<r.lines[y].staff[f].voices.length;p++)h(r.lines[y].staff[f].voices[p])&&(v=!0);v||(m=!0,r.lines[y].staff[f]=null)}m&&r.lines.forEach((function(e){e.staff&&(e.staff=e.staff.filter((function(e){return!!e})))}))}for(function(e){for(var t=!0,n=0;n<e.length;n++){var r=e[n];if(r.staff){for(var i=0;i<r.staff.length;i++){var a=r.staff[i];if(a.title){for(var s=!1,o=0;o<a.title.length;o++)a.title[o]?(a.title[o]=t?a.title[o].name:a.title[o].subname,a.title[o]?s=!0:a.title[o]=""):a.title[o]="";s||delete a.title}}t=!1}}}(r.lines),y=0;y<r.lines.length;y++)if(r.lines[y].staff)for(f=0;f<r.lines[y].staff.length;f++)delete r.lines[y].staff[f].workingClef;for(;n(r););for(var y=0;y<r.lines.length;y++){var b=r.lines[y].staff;if(b)for(r.staffNum=0;r.staffNum<b.length;r.staffNum++)for(b[r.staffNum].clef&&e.fixClef(b[r.staffNum].clef),r.voiceNum=0;r.voiceNum<b[r.staffNum].voices.length;r.voiceNum++){var _=b[r.staffNum].voices[r.voiceNum];a(_,r.staffNum,r.voiceNum,d);for(var w=0;w<_.length;w++)"clef"===_[w].el_type&&e.fixClef(_[w]);if(_.length>0&&_[_.length-1].barNumber){var x=c(r.lines,y);x&&(x.staff[0].barNumber=_[_.length-1].barNumber),delete _[_.length-1].barNumber}}}return delete r.staffNum,delete r.voiceNum,delete r.lineNum,delete r.potentialStartBeam,delete r.potentialEndBeam,delete r.vskipPending,d},this.addTieToLastNote=function(e){var t=function(e){if(!e.lines[e.lineNum])return null;if(!e.lines[e.lineNum].staff)return null;if(!e.lines[e.lineNum].staff[e.staffNum])return null;var t=e.lines[e.lineNum].staff[e.staffNum].voices[e.voiceNum];if(!t)return null;for(var n=t.length-1;n>=0;n--){var r=t[n];if("note"===r.el_type)return r}return null}(r);return!!(t&&t.pitches&&t.pitches.length>0)&&(t.pitches[0].startTie={},e&&(t.pitches[0].startTie.style="dotted"),!0)},this.appendElement=function(e,t,n,a){var o;(a.el_type=e,null!==t&&(a.startChar=t),null!==n&&(a.endChar=n),"note"===e)?((o=a).duration?o.duration:0)>=.25||a.force_end_beam_last&&void 0!==r.potentialStartBeam?f(r):a.end_beam&&void 0!==r.potentialStartBeam?void 0===a.rest?function(e,t){t.potentialStartBeam.startBeam=!0,e.endBeam=!0,delete t.potentialStartBeam,delete t.potentialEndBeam}(a,r):f(r):void 0===a.rest&&(void 0===r.potentialStartBeam?a.end_beam||(r.potentialStartBeam=a,delete r.potentialEndBeam):r.potentialEndBeam=a):f(r);return delete a.end_beam,delete a.force_end_beam_last,a.rest&&"invisible"===a.rest.type&&delete a.decoration,!(r.lines.length<=r.lineNum||r.lines[r.lineNum].staff.length<=r.staffNum)&&(function(e,t,n,r,i){var a=t.lines[t.lineNum].staff[t.staffNum];if(void 0!==n.pitches){var s=a.workingClef.verticalPos;n.pitches.forEach((function(e){e.verticalPos=e.pitch-s}))}if(void 0!==n.gracenotes){var o=a.workingClef.verticalPos;n.gracenotes.forEach((function(e){e.verticalPos=e.pitch-o}))}a.voices.length<=t.voiceNum&&(r[i]||(r[i]={}),m(e,t,r[i]));a.voices[t.voiceNum].push(n)}(i,r,a,s,p),!0)},this.appendStartingElement=function(e,t,n,i){var a;l(r),"key"===e&&(a=i.impliedNaturals,delete i.impliedNaturals,delete i.explicitAccidentals);var s=Object.assign({},i);if(r.lines[r.lineNum]){var o=r.lines[r.lineNum].staff;if(o){o.length<=r.staffNum&&(o[r.staffNum]={},o[r.staffNum].clef=Object.assign({},o[0].clef),o[r.staffNum].key=Object.assign({},o[0].key),o[0].meter&&(o[r.staffNum].meter=Object.assign({},o[0].meter)),o[r.staffNum].workingClef=Object.assign({},o[0].workingClef),o[r.staffNum].voices=[[]]),"clef"===e&&(o[r.staffNum].workingClef=s);for(var c=o[r.staffNum].voices[r.voiceNum],u=0;u<c.length;u++){if("note"===c[u].el_type||"bar"===c[u].el_type)return s.el_type=e,s.startChar=t,s.endChar=n,a&&(s.accidentals=a.concat(s.accidentals)),void c.push(s);if(c[u].el_type===e)return s.el_type=e,s.startChar=t,s.endChar=n,a&&(s.accidentals=a.concat(s.accidentals)),void(c[u]=s)}o[r.staffNum][e]=i}}},this.addSubtitle=function(e,t){d(r,{subtitle:{text:e,startChar:t.startChar,endChar:t.endChar}})},this.addSpacing=function(e){r.vskipPending=e},this.addNewPage=function(e){d(r,{newpage:e})},this.addSeparator=function(e,t,n,i){d(r,{separator:{spaceAbove:Math.round(e),spaceBelow:Math.round(t),lineLength:Math.round(n),startChar:i.startChar,endChar:i.endChar}})},this.addText=function(e,t){d(r,{text:{text:e,startChar:t.startChar,endChar:t.endChar}})},this.addCentered=function(e){d(r,{text:[{text:e,center:!0}]})},this.changeVoiceScale=function(e){i.appendElement("scale",null,null,{size:e})},this.changeVoiceColor=function(e){i.appendElement("color",null,null,{color:e})},this.startNewLine=function(e){l(r),e.currentVoiceName&&(p=e.currentVoiceName,s[e.currentVoiceName]=e),void 0===r.lines[r.lineNum]?function(e,t,n){t.lines[t.lineNum]={staff:[]},g(e,t,n)}(i,r,e):void 0===r.lines[r.lineNum].staff?(r.lineNum++,this.startNewLine(e)):void 0===r.lines[r.lineNum].staff[r.staffNum]?g(i,r,e):void 0===r.lines[r.lineNum].staff[r.staffNum].voices[r.voiceNum]?m(i,r,e):u(r.lines[r.lineNum].staff[r.staffNum].voices[r.voiceNum])?(r.lineNum++,this.startNewLine(e)):e.part&&i.appendElement("part",e.part.startChar,e.part.endChar,{title:e.part.title})},this.setRunningFont=function(e,t){r.runningFonts[e]=t},this.setBarNumberImmediate=function(e){var t=this.getCurrentVoice();if(t&&t.length>0){var n=t[t.length-1];if("bar"!==n.el_type)return e-1;void 0!==n.barNumber&&(n.barNumber=e)}return e},this.hasBeginMusic=function(){for(var e=0;e<r.lines.length;e++)if(r.lines[e].staff)return!0;return!1},this.isFirstLine=function(e){for(var t=e-1;t>=0;t--)if(void 0!==r.lines[t].staff)return!1;return!0},this.getCurrentVoice=function(){var e=function(e,t){for(;t>=0;){if(e[t].staff)return e[t];t--}return null}(r.lines,r.lineNum);if(!e)return null;var t=e.staff[r.staffNum];return t&&void 0!==t.voices[r.voiceNum]?t.voices[r.voiceNum]:null},this.setCurrentVoice=function(e,t,n){r.staffNum=e,r.voiceNum=t,p=n;for(var i=0;i<r.lines.length;i++)if(r.lines[i].staff&&(void 0===r.lines[i].staff[e]||void 0===r.lines[i].staff[e].voices[t]||!u(r.lines[i].staff[e].voices[t])))return r.lineNum=i,!(r.lines[i].staff[e]&&!r.lines[i].staff[e].voices[t]);return r.lineNum=i,!1},this.addMetaText=function(e,t,n){void 0===r.metaText[e]?(r.metaText[e]=t,r.metaTextInfo[e]=n):("string"==typeof r.metaText[e]&&"string"==typeof t?r.metaText[e]+="\n"+t:("string"===r.metaText[e]&&(r.metaText[e]=[{text:r.metaText[e]}]),"string"==typeof t&&(t=[{text:t}]),r.metaText[e]=r.metaText[e].concat(t)),r.metaTextInfo[e].endChar=n.endChar)},this.addMetaTextArray=function(e,t,n){void 0===r.metaText[e]?(r.metaText[e]=[t],r.metaTextInfo[e]=n):(r.metaText[e].push(t),r.metaTextInfo[e].endChar=n.endChar)},this.addMetaTextObj=function(e,t,n){r.metaText[e]=t,r.metaTextInfo[e]=n}}}function Og(){if(Qh)return Kh;Qh=1;var e=yh(),t=bh(),n=Sh(),r=Mg(),i=function(){if(Ah)return Nh;Ah=1;var e=yh(),t=function(t,n){this.lineIndex=0,this.lines=t,this.multilineVars=n,this.skipWhiteSpace=function(e){for(var t=0;t<e.length;t++)if(!this.isWhiteSpace(e[t]))return t;return e.length};var r=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(r(e,t))return{len:0};switch(e[t]){case"A":return{len:t+1,token:"A"};case"B":return{len:t+1,token:"B"};case"C":return{len:t+1,token:"C"};case"D":return{len:t+1,token:"D"};case"E":return{len:t+1,token:"E"};case"F":return{len:t+1,token:"F"};case"G":return{len:t+1,token:"G"}}return{len:0}},this.getSharpFlat=function(e){if("bass"===e)return{len:0};switch(e[0]){case"#":return{len:1,token:"#"};case"b":return{len:1,token:"b"}}return{len:0}},this.getMode=function(e){var t=function(e,t){for(;t<e.length&&(e[t]>="a"&&e[t]<="z"||e[t]>="A"&&e[t]<="Z");)t++;return t},n=this.skipWhiteSpace(e);if(r(e,n))return{len:0};var i=e.substring(n,n+3).toLowerCase();switch((i.length>1&&" "===i[1]||"^"===i[1]||"_"===i[1]||"="===i[1])&&(i=i[0]),i){case"mix":return{len:t(e,n),token:"Mix"};case"dor":return{len:t(e,n),token:"Dor"};case"phr":return{len:t(e,n),token:"Phr"};case"lyd":return{len:t(e,n),token:"Lyd"};case"loc":return{len:t(e,n),token:"Loc"};case"aeo":case"min":case"m":return{len:t(e,n),token:"m"};case"maj":case"ion":return{len:t(e,n),token:""}}return{len:0}},this.getClef=function(t,n){var i=t,a=this.skipWhiteSpace(t);if(r(t,a))return{len:0};var s=!1,o=t.substring(a);if(e.startsWith(o,"clef=")&&(s=!0,o=o.substring(5),a+=5),0===o.length&&s)return{len:a+5,warn:"No clef specified: "+i};var c=this.skipWhiteSpace(o);if(r(o,c))return{len:0};c>0&&(a+=c,o=o.substring(c));var l=null;if(e.startsWith(o,"treble"))l="treble";else if(e.startsWith(o,"bass3"))l="bass3";else if(e.startsWith(o,"bass"))l="bass";else if(e.startsWith(o,"tenor"))l="tenor";else if(e.startsWith(o,"alto2"))l="alto2";else if(e.startsWith(o,"alto1"))l="alto1";else if(e.startsWith(o,"alto"))l="alto";else if(!n&&s&&e.startsWith(o,"none"))l="none";else if(e.startsWith(o,"perc"))l="perc";else if(!n&&s&&e.startsWith(o,"C"))l="tenor";else if(!n&&s&&e.startsWith(o,"F"))l="bass";else{if(n||!s||!e.startsWith(o,"G"))return{len:a+5,warn:"Unknown clef specified: "+i};l="treble"}return o=o.substring(l.length),(c=this.isMatch(o,"+8"))>0?l+="+8":(c=this.isMatch(o,"-8"))>0&&(l+="-8"),{len:a+l.length,token:l,explicit:s}},this.getBarLine=function(e,t){switch(e[t]){case"]":switch(e[++t]){case"|":return{len:2,token:"bar_thick_thin"};case"[":return e[++t]>="1"&&e[t]<="9"||'"'===e[t]?{len:2,token:"bar_invisible"}:{len:1,warn:"Unknown bar symbol"};default:return{len:1,token:"bar_invisible"}}case":":switch(e[++t]){case":":return{len:2,token:"bar_dbl_repeat"};case"|":switch(e[++t]){case"]":return"|"===e[++t]&&":"===e[++t]?{len:5,token:"bar_dbl_repeat"}:{len:3,token:"bar_right_repeat"};case"|":return":"===e[++t]?{len:4,token:"bar_dbl_repeat"}:{len:3,token:"bar_right_repeat"};default:return{len:2,token:"bar_right_repeat"}}default:return{len:1,warn:"Unknown bar symbol"}}case"[":if("|"!==e[++t])return e[t]>="1"&&e[t]<="9"||'"'===e[t]?{len:1,token:"bar_invisible"}:{len:0};switch(e[++t]){case":":return{len:3,token:"bar_left_repeat"};case"]":return{len:3,token:"bar_invisible"};default:return{len:2,token:"bar_thick_thin"}}case"|":switch(e[++t]){case"]":return{len:2,token:"bar_thin_thick"};case"|":return":"===e[++t]?{len:3,token:"bar_left_repeat"}:{len:2,token:"bar_thin_thin"};case":":for(var n=0;":"===e[t+n];)n++;return{len:1+n,token:"bar_left_repeat"};default:return{len:1,token:"bar_thin"}}}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(t,n){var i=this.skipWhiteSpace(t);return r(t,i)?0:e.startsWith(t.substring(i),n)?i+n.length:0},this.getPitchFromTokens=function(e){var t={};if(t.position={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11}[e[0].token],void 0===t.position)return{warn:"Pitch expected. Found: "+e[0].token};for(e.shift();e.length;)switch(e[0].token){case",":t.position-=7,e.shift();break;case"'":t.position+=7,e.shift();break;default:return t}return t},this.getKeyAccidentals2=function(e){for(var t;e.length>0;){var n;if("^"===e[0].token){if(n="sharp",e.shift(),0===e.length)return{accs:t,warn:"Expected note name after "+n};switch(e[0].token){case"^":n="dblsharp",e.shift();break;case"/":n="quartersharp",e.shift()}}else if("="===e[0].token)n="natural",e.shift();else{if("_"!==e[0].token)return{accs:t};if(n="flat",e.shift(),0===e.length)return{accs:t,warn:"Expected note name after "+n};switch(e[0].token){case"_":n="dblflat",e.shift();break;case"/":n="quarterflat",e.shift()}}if(0===e.length)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":void 0===t&&(t=[]),t.push({acc:n,note:e[0].token[0]}),1===e[0].token.length?e.shift():e[0].token=e[0].token.substring(1);break;default:return{accs:t,warn:"Expected note name after "+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(r(e,n))return{len:0};var i=null;switch(e[n]){case"^":case"_":case"=":i=e[n];break;default:return{len:0}}if(n++,r(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[i],note:e[n]}};case"^":case"_":case"/":if(i+=e[n],n++,r(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[i],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||"\t"===e||""===e},this.getMeat=function(e,t,n){var r=e.indexOf("%",t);for(r>=0&&r<n&&(n=r);t<n&&(" "===e[t]||"\t"===e[t]||""===e[t]);)t++;for(;t<n&&(" "===e[n-1]||"\t"===e[n-1]||""===e[n-1]);)n--;return{start:t,end:n}};var i=function(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"},a=function(e){return e>="0"&&e<="9"};this.tokenize=function(e,t,n,r){var s=this.getMeat(e,t,n);t=s.start,n=s.end;for(var o,c=[];t<n;){if('"'===e[t]){for(o=t+1;o<n&&'"'!==e[o];)o++;c.push({type:"quote",token:e.substring(t+1,o),start:t+1,end:o}),o++}else if(i(e[t])){if(o=t+1,r)for(;o<n&&!this.isWhiteSpace(e[o]);)o++;else for(;o<n&&i(e[o]);)o++;c.push({type:"alpha",token:e.substring(t,o),continueId:a(e[o]),start:t,end:o}),t=o+1}else if("."===e[t]&&a(e[o+1])){o=t+1;for(var l;o<n&&a(e[o]);)o++;l=parseFloat(e.substring(t,o)),c.push({type:"number",token:e.substring(t,o),intt:null,floatt:l,continueId:i(e[o]),start:t,end:o}),t=o+1}else if(a(e[t])||"-"===e[t]&&a(e[o+1])){o=t+1;for(var u,h=null;o<n&&a(e[o]);)o++;if("."===e[o]&&a(e[o+1]))for(o++;o<n&&a(e[o]);)o++;else h=parseInt(e.substring(t,o));u=parseFloat(e.substring(t,o)),c.push({type:"number",token:e.substring(t,o),intt:h,floatt:u,continueId:i(e[o]),start:t,end:o}),t=o+1}else" "===e[t]||"\t"===e[t]||c.push({type:"punct",token:e[t],start:t,end:t+1}),o=t+1;t=o}return c},this.getVoiceToken=function(e,t,n){for(var r=t;r<n&&this.isWhiteSpace(e[r])||"="===e[r];)r++;if('"'===e[r]){var i=e.indexOf('"',r+1);return-1===i||i>=n?{len:1,err:"Missing close quote"}:{len:i-t+1,token:this.translateString(e.substring(r+1,i))}}for(var a=r;a<n&&!this.isWhiteSpace(e[a])&&"="!==e[a];)a++;return{len:a-t+1,token:e.substring(r,a)}};var s={"`a":"à","'a":"á","^a":"â","~a":"ã",'"a':"ä",oa:"å",aa:"å","=a":"ā",ua:"ă",";a":"ą","`e":"è","'e":"é","^e":"ê",'"e':"ë","=e":"ē",ue:"ĕ",";e":"ę",".e":"ė","`i":"ì","'i":"í","^i":"î",'"i':"ï","=i":"ī",ui:"ĭ",";i":"į","`o":"ò","'o":"ó","^o":"ô","~o":"õ",'"o':"ö","=o":"ō",uo:"ŏ","/o":"ø","`u":"ù","'u":"ú","^u":"û","~u":"ũ",'"u':"ü",ou:"ů","=u":"ū",uu:"ŭ",";u":"ų","`A":"À","'A":"Á","^A":"Â","~A":"Ã",'"A':"Ä",oA:"Å",AA:"Å","=A":"Ā",uA:"Ă",";A":"Ą","`E":"È","'E":"É","^E":"Ê",'"E':"Ë","=E":"Ē",uE:"Ĕ",";E":"Ę",".E":"Ė","`I":"Ì","'I":"Í","^I":"Î","~I":"Ĩ",'"I':"Ï","=I":"Ī",uI:"Ĭ",";I":"Į",".I":"İ","`O":"Ò","'O":"Ó","^O":"Ô","~O":"Õ",'"O':"Ö","=O":"Ō",uO:"Ŏ","/O":"Ø","`U":"Ù","'U":"Ú","^U":"Û","~U":"Ũ",'"U':"Ü",oU:"Ů","=U":"Ū",uU:"Ŭ",";U":"Ų",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",ss:"ß","'c":"ć","^c":"ĉ",uc:"č",cc:"ç",".c":"ċ",cC:"Ç","'C":"Ć","^C":"Ĉ",uC:"Č",".C":"Ċ","~N":"Ñ","~n":"ñ","=s":"š",vs:"š",DH:"Ð",dh:"ð",HO:"Ő",Ho:"ő",HU:"Ű",Hu:"ű","'Y":"Ý","'y":"ý","^Y":"Ŷ","^y":"ŷ",'"Y':"Ÿ",'"y':"ÿ",vS:"Š",vZ:"Ž",vz:"ž"},o={"#":"♯",b:"♭","=":"♮"},c={201:"♯",202:"♭",203:"♮",241:"¡",242:"¢",252:"a",262:"2",272:"o",302:"Â",312:"Ê",322:"Ò",332:"Ú",342:"â",352:"ê",362:"ò",372:"ú",243:"£",253:"«",263:"3",273:"»",303:"Ã",313:"Ë",323:"Ó",333:"Û",343:"ã",353:"ë",363:"ó",373:"û",244:"¤",254:"¬",264:" ́",274:"1⁄4",304:"Ä",314:"Ì",324:"Ô",334:"Ü",344:"ä",354:"ì",364:"ô",374:"ü",245:"¥",255:"-",265:"μ",275:"1⁄2",305:"Å",315:"Í",325:"Õ",335:"Ý",345:"å",355:"í",365:"õ",375:"ý",246:"¦",256:"®",266:"¶",276:"3⁄4",306:"Æ",316:"Î",326:"Ö",336:"Þ",346:"æ",356:"î",366:"ö",376:"þ",247:"§",257:" ̄",267:"·",277:"¿",307:"Ç",317:"Ï",327:"×",337:"ß",347:"ç",357:"ï",367:"÷",377:"ÿ",250:" ̈",260:"°",270:" ̧",300:"À",310:"È",320:"Ð",330:"Ø",340:"à",350:"è",360:"ð",370:"ø",251:"©",261:"±",271:"1",301:"Á",311:"É",321:"Ñ",331:"Ù",341:"á",351:"é",361:"ñ",371:"ù"};function l(e){const t=/^(\d+)\./.exec(e);return t?t[1]:null}this.translateString=function(e){var t=e.split("\\");if(1===t.length)return e;var n=null;return t.forEach((function(e){if(null===n)n=e;else{var t=s[e.substring(0,2)];void 0!==t?n+=t+e.substring(2):void 0!==(t=c[e.substring(0,3)])?n+=t+e.substring(3):(t=o[e.substring(0,1)],n+=void 0!==t?t+e.substring(1):"\\"+e)}})),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=10*n+1,t++;break;case"2":n=10*n+2,t++;break;case"3":n=10*n+3,t++;break;case"4":n=10*n+4,t++;break;case"5":n=10*n+5,t++;break;case"6":n=10*n+6,t++;break;case"7":n=10*n+7,t++;break;case"8":n=10*n+8,t++;break;case"9":n=10*n+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 i=this.getNumber(e,t);n=i.num,t=i.index}if("/"===e[t]){if("/"===e[++t]){for(var a=.5;"/"===e[t++];)a/=2;return{value:n*a,index:t-1}}var s=t,o=this.getNumber(e,t);0===o.num&&s===t&&(o.num=2),0!==o.num&&(r=o.num),t=o.index}return{value:n/r,index:t}};var u=[{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<u.length;t++){var n=u[t],r=e.match(n.match);if(r){var i=l(e);i&&(e=(e=e.replace(i+".","")).trim());var a=r[0].length,s=n.replace+e.substring(0,e.length-a);return i&&(s=i+". "+s),s}}return e},this.stripComment=function(t){var n=t.indexOf("%");return n>=0?e.strip(t.substring(0,n)):e.strip(t)},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(0===e.length)return{used:0};var t=1,n="";if("-"===e[0].token)e.shift(),n="-",t++;else if("number"!==e[0].type)return{used:0};if(n+=e.shift().token,0===e.length)return{used:1,value:parseInt(n)};var r=e.shift();if("."===r.token){if(t++,0===e.length)return{used:t,value:parseInt(n)};if("number"===e[0].type&&(n=n+"."+(r=e.shift()).token,t++,0===e.length))return{used:t,value:parseFloat(n)};r=e.shift()}switch(r.token){case"pt":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:72*parseFloat(n)};default:return e.unshift(r),{used:t,value:parseFloat(n)}}};var h=function(e){return(e=e.replace(/\\n/g,"\n")).replace(/\\"/g,'"')};this.getBrackettedSubstring=function(e,t,n,r){for(var i=r||e[t],a=t+1,s=!1;a<e.length&&(s||e[a]!==i);)s="\\"===e[a],++a;return e[a]===i?[a-t+1,h(e.substring(t+1,a)),!0]:((a=t+n)>e.length-1&&(a=e.length-1),[a-t+1,h(e.substring(t+1,a)),!1])}};return t.prototype.peekLine=function(){return this.lines[this.lineIndex]},t.prototype.nextLine=function(){if(this.lineIndex>0&&(this.multilineVars.iChar+=this.lines[this.lineIndex-1].length+1),this.lineIndex<this.lines.length){var e=this.lines[this.lineIndex];return this.lineIndex++,e}return null},Nh=t}(),a=Tg(),s=Dg(),o=Bg();return Kh=function(){var c,l=new s,u=new o(l),h="",d="";function f(e,t,n){e.positioning||(e.positioning={}),e.positioning[t]=n}function p(e,t,n){e.fonts||(e.fonts={}),e.fonts[t]=n}this.getTune=function(){var e={formatting:l.formatting,lines:l.lines,media:l.media,metaText:l.metaText,metaTextInfo:l.metaTextInfo,version:l.version,addElementToEvents:l.addElementToEvents,addUsefulCallbackInfo:l.addUsefulCallbackInfo,getTotalTime:l.getTotalTime,getTotalBeats:l.getTotalBeats,getBarLength:l.getBarLength,getBeatLength:l.getBeatLength,getBeatsPerMeasure:l.getBeatsPerMeasure,getBpm:l.getBpm,getMeter:l.getMeter,getMeterFraction:l.getMeterFraction,getPickupLength:l.getPickupLength,getKeySignature:l.getKeySignature,getElementFromChar:l.getElementFromChar,makeVoicesArray:l.makeVoicesArray,millisecondsPerMeasure:l.millisecondsPerMeasure,setupEvents:l.setupEvents,setTiming:l.setTiming,setUpAudio:l.setUpAudio,deline:l.deline,findSelectableElement:l.findSelectableElement,getSelectableArray:l.getSelectableArray};return l.lineBreaks&&(e.lineBreaks=l.lineBreaks),l.visualTranspose&&(e.visualTranspose=l.visualTranspose),e};var m,g,v={reset:function(){for(var e in this)this.hasOwnProperty(e)&&"function"!=typeof this[e]&&delete this[e];this.iChar=0,this.key={accidentals:[],root:"none",acc:"",mode:""},this.meter=null,this.origMeter=null,this.hasMainTitle=!1,this.default_length=.125,this.clef={type:"treble",verticalPos:0},this.octave=0,this.next_note_duration=0,this.start_new_line=!0,this.is_in_header=!0,this.partForNextLine={},this.tempoForNextLine=[],this.havent_set_length=!0,this.voices={},this.staves=[],this.macros={},this.currBarNumber=1,this.barCounter={},this.ignoredDecorations=[],this.score_is_present=!1,this.inEnding=!1,this.inTie=[],this.inTieChord={},this.vocalPosition="auto",this.dynamicPosition="auto",this.chordPosition="auto",this.ornamentPosition="auto",this.volumePosition="auto",this.openSlurs=[],this.freegchord=!1,this.endingHoldOver={}},differentFont:function(e,t){return this[e].decoration!==t[e].decoration||(this[e].face!==t[e].face||(this[e].size!==t[e].size||(this[e].style!==t[e].style||this[e].weight!==t[e].weight)))},addFormattingOptions:function(e,t,n){"note"===n?("auto"!==this.vocalPosition&&f(e,"vocalPosition",this.vocalPosition),"auto"!==this.dynamicPosition&&f(e,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&f(e,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&f(e,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&f(e,"volumePosition",this.volumePosition),this.differentFont("annotationfont",t)&&p(e,"annotationfont",this.annotationfont),this.differentFont("gchordfont",t)&&p(e,"gchordfont",this.gchordfont),this.differentFont("vocalfont",t)&&p(e,"vocalfont",this.vocalfont),this.differentFont("tripletfont",t)&&p(e,"tripletfont",this.tripletfont)):"bar"===n&&("auto"!==this.dynamicPosition&&f(e,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&f(e,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&f(e,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&f(e,"volumePosition",this.volumePosition),this.differentFont("measurefont",t)&&p(e,"measurefont",this.measurefont),this.differentFont("repeatfont",t)&&p(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])}}},y=function(e){var t=e.replace(/\x12/g," ");return(t=(t=t.replace(/&/g,"&")).replace(/</g,"<")).replace(/>/g,">")},b=function(e,t,n){t||(t=" ");var r=t[n];" "!==r&&r||(r="SPACE");var i,a=y(t.substring(n-64,n))+'<span style="text-decoration:underline;font-size:1.3em;font-weight:bold;">'+r+"</span>"+y(t.substring(n+1).substring(0,64));!function(e){v.warnings||(v.warnings=[]),v.warnings.push(e)}("Music Line:"+c.lineIndex+":"+(n+1)+": "+e+": "+a),i={message:e,line:t,startChar:v.iChar+n,column:n},v.warningObjects||(v.warningObjects=[]),v.warningObjects.push(i)};this.getWarnings=function(){return v.warnings},this.getWarningObjects=function(){return v.warningObjects};var _=function(t,n){if(n.indexOf("")>=0)h+=n;else if(n=h+n,h="",t){"-"!==(n=e.strip(n))[n.length-1]&&(n+=" ");for(var r=[],i=0,a=!1,s=function(t){var s=e.strip(n.substring(i,t));if(s=s.replace(/\\([-_*|~])/g,"$1"),i=t+1,s.length>0){a&&(s=s.replace(/~/g," "));var o=n[t];return"_"!==o&&"-"!==o&&(o=" "),r.push({syllable:c.translateString(s),divider:o}),a=!1,!0}return!1},o=!1,l=0;l<n.length;l++){switch(n[l]){case" ":case"":s(l);break;case"-":!o&&!s(l)&&r.length>0&&(e.last(r).divider="-",r.push({skip:!0,to:"next"}));break;case"_":o||(s(l),r.push({skip:!0,to:"slur"}));break;case"*":o||(s(l),r.push({skip:!0,to:"next"}));break;case"|":o||(s(l),r.push({skip:!0,to:"bar"}));break;case"~":o||(a=!0)}o="\\"===n[l]}t.forEach((function(e){if(0!==r.length)if(r[0].skip){switch(r[0].to){case"next":case"slur":"note"===e.el_type&&null!==e.pitches&&r.shift();break;case"bar":"bar"===e.el_type&&r.shift()}"bar"!==e.el_type&&(void 0===e.lyric?e.lyric=[{syllable:"",divider:" "}]:e.lyric.push({syllable:"",divider:" "}))}else if("note"===e.el_type&&void 0===e.rest){var t=r.shift();t.syllable&&(t.syllable=t.syllable.replace(/ +/g," ")),void 0===e.lyric?e.lyric=[t]:e.lyric.push(t)}}))}else b("Can't add words before the first line of music",t,0)},w=function(t,n){if(n.indexOf("")>=0)d+=n;else if(n=d+n,d="",t){"-"!==(n=e.strip(n))[n.length-1]&&(n+=" ");for(var r=[],i=0,a=!1,s=function(t){var s=e.strip(n.substring(i,t));if(i=t+1,s.length>0){a&&(s=s.replace(/~/g," "));var o=n[t];return"_"!==o&&"-"!==o&&(o=" "),r.push({syllable:c.translateString(s),divider:o}),a=!1,!0}return!1},o=0;o<n.length;o++)switch(n[o]){case" ":case"":s(o);break;case"-":!s(o)&&r.length>0&&(e.last(r).divider="-",r.push({skip:!0,to:"next"}));break;case"_":s(o),r.push({skip:!0,to:"slur"});break;case"*":s(o),r.push({skip:!0,to:"next"});break;case"|":s(o),r.push({skip:!0,to:"bar"});break;case"~":a=!0}t.forEach((function(e){if(0!==r.length)if(r[0].skip)switch(r[0].to){case"next":case"slur":"note"===e.el_type&&null!==e.pitches&&r.shift();break;case"bar":"bar"===e.el_type&&r.shift()}else if("note"===e.el_type&&void 0===e.rest){var t=r.shift();void 0===e.lyric?e.lyric=[t]:e.lyric.push(t)}}))}else b("Can't add symbols before the first line of music",t,0)},x=function(n){if(e.startsWith(n,"%%")){var r=t.addDirective(n.substring(2));r&&b(r,n,2)}else{var i=n.indexOf("%");if(i>=0&&(n=n.substring(0,i)),0!==(n=n.replace(/\s+$/,"")).length)if(h)_(u.getCurrentVoice(),n.substring(2));else if(d)w(u.getCurrentVoice(),n.substring(2));else if(n.length<2||":"!==n[1]||g.lineContinuation)g.parseMusic(n);else{var a=m.parseHeader(n);a.regular&&g.parseMusic(n),a.newline&&g.startNewLine(),a.words&&_(u.getCurrentVoice(),n.substring(2)),a.symbols&&w(u.getCurrentVoice(),n.substring(2))}}};function k(e,t){e.push({el_type:"hint"});for(var n=0;n<t.length;n++){var r=t[n],i=Object.assign({},r);if(e.push(i),"bar"===r.el_type)return}}function C(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(i)for(var a=0;a<i.voices.length;a++){var s=i.voices[a],o=r.voices[a];o&&k(o,s)}}}this.parse=function(s,o,f){o||(o={}),f||(f=0),l.reset();var p=(s=s.replace(/\r\n?/g,"\n")+"\n").split("\n\\");if(p.length>1){for(var y=1;y<p.length;y++)for(;p[y].length>0&&"\n"!==p[y][0];)p[y]=p[y].substr(1),p[y-1]+=" ";s=p.join(" ")}var k=(s=s.replace(/\\([ \t]*)(%.*)*\n/g,(function(e,t,n){return t+""+(n?Array(n.length+1).join(" "):"")+"\n"}))).split("\n");0===e.last(k).length&&k.pop(),c=new i(k,v),m=new n(c,b,v,l,u),g=new r(c,b,v,l,u,m),o.print&&(l.media="print"),v.reset(),v.iChar=f,o.visualTranspose?(v.globalTranspose=parseInt(o.visualTranspose),0===v.globalTranspose?v.globalTranspose=void 0:u.setVisualTranspose(o.visualTranspose)):v.globalTranspose=void 0,o.lineBreaks&&(v.lineBreaks=o.lineBreaks),m.reset(c,b,v,l);try{o.format&&t.globalFormatting(o.format);for(var S=c.nextLine();S;){if(o.header_only&&!1===v.is_in_header)throw"normal_abort";if(o.stop_on_warning&&v.warnings)throw"normal_abort";var E=v.is_in_header;x(S),E&&!v.is_in_header&&(u.setRunningFont("annotationfont",v.annotationfont),u.setRunningFont("gchordfont",v.gchordfont),u.setRunningFont("tripletfont",v.tripletfont),u.setRunningFont("vocalfont",v.vocalfont)),S=c.nextLine()}h&&_(u.getCurrentVoice(),""),d&&w(u.getCurrentVoice(),""),v.openSlurs=u.cleanUp(v.barsperstaff,v.staffnonote,v.openSlurs)}catch(A){if("normal_abort"!==A)throw A}var M=792,T=612;switch(v.papersize){case"legal":M=1008,T=612;break;case"A4":M=842.4,T=597.6}if(v.landscape){var N=M;M=T,T=N}l.formatting.pagewidth||(l.formatting.pagewidth=T),l.formatting.pageheight||(l.formatting.pageheight=M),o.hint_measures&&function(){for(var e=0;e<l.lines.length;e++){var t=l.lines[e].staff;if(t){for(var n=e+1;n<l.lines.length&&void 0===l.lines[n].staff;)n++;n<l.lines.length&&C(t,l.lines[n].staff)}}}(),a.wrapLines(l,v.lineBreaks,v.barNumbers)}}}function Lg(){if(nd)return td;nd=1;var e=function(e,t){this.children=[],this.beams=[],this.otherchildren=[],this.w=0,this.duplicate=!1,this.voicenumber=e,this.voicetotal=t,this.bottom=7,this.top=7,this.specialY={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}};return e.prototype.addChild=function(e){if("bar"===e.type){for(var t=!0,n=0;t&&n<this.children.length;n++)this.children[n].type.indexOf("staff-extra")<0&&"tempo"!==this.children[n].type&&(t=!1);t||(this.beams.push("bar"),this.otherchildren.push("bar"))}this.children[this.children.length]=e,this.setRange(e)},e.prototype.setLimit=function(e,t){var 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])},e.prototype.adjustRange=function(e){void 0!==e.bottom&&(this.bottom=Math.min(this.bottom,e.bottom)),void 0!==e.top&&(this.top=Math.max(this.top,e.top))},e.prototype.setRange=function(e){this.adjustRange(e),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},e.prototype.addOther=function(e){this.otherchildren.push(e),this.setRange(e)},e.prototype.addBeam=function(e){this.beams.push(e)},e.prototype.setWidth=function(e){this.w=e},td=e}function Vg(){if(id)return rd;id=1;return rd=function(e,t,n,r){if(e)for(var i=0;i<e.length;i++){var a=e[i],s=a.getAttribute("highlight");s||(s="fill"),a.setAttribute(s,r);var o=a.getAttribute("class");o||(o=""),o=(o=o.replace(n,"")).replace(t,""),t.length>0&&(o.length>0&&" "!==o[o.length-1]&&(o+=" "),o+=t),a.setAttribute("class",o)}}}function Rg(){if(sd)return ad;sd=1;var e=Vg();return ad=function(t,n){void 0===t&&(t="abcjs-note_selected"),void 0===n&&(n="#ff0000"),e(this.elemset,t,"",n)}}function Fg(){if(cd)return od;cd=1;var e=Vg();return od=function(t,n){void 0===t&&(t="abcjs-note_selected"),void 0===n&&(n="#000000"),e(this.elemset,"",t,n)}}function zg(){if(ud)return ld;ud=1;var e=Rg(),t=Fg(),n=function(e,t,n,r,i,a){a||(a={}),this.tuneNumber=i,this.abcelem=e,this.duration=t,this.durationClass=a.durationClassOveride?a.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}};return n.prototype.getFixedCoords=function(){return{x:this.x,w:this.fixed.w,t:this.fixed.t,b:this.fixed.b}},n.prototype.addExtra=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),void 0===this.fixed.t?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top),void 0===this.fixed.b?this.fixed.b=e.bottom:this.fixed.b=Math.min(this.fixed.b,e.bottom),e.dx<this.extraw&&(this.extraw=e.dx),this.extra[this.extra.length]=e,this._addChild(e)},n.prototype.addHead=function(e){e.dx<this.extraw&&(this.extraw=e.dx),this.heads[this.heads.length]=e,this.addRight(e)},n.prototype.addRight=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),void 0!==e.top&&(void 0===this.fixed.t?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top)),void 0!==e.bottom&&(void 0===this.fixed.b?this.fixed.b=e.bottom:this.fixed.b=Math.min(this.fixed.b,e.bottom)),e.dx+e.w>this.w&&(this.w=e.dx+e.w),this.right[this.right.length]=e,this._addChild(e)},n.prototype.addFixed=function(e){this._addChild(e)},n.prototype.addFixedX=function(e){this._addChild(e)},n.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)},n.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])},n.prototype._addChild=function(e){var t=!0;"clef"==this.abcelem.el_type&&"barNumber"==e.type&&(t=!1),e.parent=this,this.children[this.children.length]=e,t&&this.pushTop(e.top),this.pushBottom(e.bottom),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},n.prototype.pushTop=function(e){void 0!==e&&(void 0===this.top?this.top=e:this.top=Math.max(e,this.top))},n.prototype.pushBottom=function(e){void 0!==e&&(void 0===this.bottom?this.bottom=e:this.bottom=Math.min(e,this.bottom))},n.prototype.setX=function(e){this.x=e;for(var t=0;t<this.children.length;t++)this.children[t].setX(e)},n.prototype.center=function(e,t){var n=(t.x-e.x)/2+e.x;this.x=n-this.w/2;for(var r=0;r<this.children.length;r++)this.children[r].setX(this.x)},n.prototype.setHint=function(){this.hint=!0},n.prototype.highlight=function(t,n){e.bind(this)(t,n)},n.prototype.unhighlight=function(e,n){t.bind(this)(e,n)},ld=n}function jg(){if(dd)return hd;dd=1;var e=function(e,t,n,r,i){switch(i=i||{},this.x=0,this.c=e,this.dx=t,this.w=n,this.pitch=r,this.scalex=i.scalex||1,this.scaley=i.scaley||1,this.type=i.type||"symbol",this.pitch2=i.pitch2,this.linewidth=i.linewidth,this.klass=i.klass,this.anchor=i.anchor?i.anchor:"middle",this.top=r,void 0!==this.pitch2&&this.pitch2>this.top&&(this.top=this.pitch2),this.bottom=r,void 0!==this.pitch2&&this.pitch2<this.bottom&&(this.bottom=this.pitch2),i.thickness&&(this.top+=i.thickness/2,this.bottom-=i.thickness/2),i.stemHeight&&(i.stemHeight>0?this.top+=i.stemHeight:this.bottom+=i.stemHeight),i.dim&&(this.dim=i.dim),i.position&&(this.position=i.position),this.height=i.height?i.height:4,i.top&&(this.top=i.top),i.bottom&&(this.bottom=i.bottom),i.name?this.name=i.name:this.c?this.name=this.c:this.name=this.type,i.realWidth?this.realWidth=i.realWidth:this.realWidth=this.w,this.centerVertically=!1,this.type){case"debug":this.chordHeightAbove=this.height;break;case"lyric":i.position&&"below"===i.position?this.lyricHeightBelow=this.height:this.lyricHeightAbove=this.height;break;case"chord":i.position&&"below"===i.position?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height;break;case"text":void 0===this.pitch?i.position&&"below"===i.position?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height:this.centerVertically=!0;break;case"part":this.partHeightAbove=this.height}};return e.prototype.getChordDim=function(){if("debug"===this.type)return null;if(!this.chordHeightAbove&&!this.chordHeightBelow)return null;var e="chord"===this.type?this.realWidth/2:0,t=this.x-e-0;return{left:t,right:t+this.realWidth+0}},e.prototype.invertLane=function(e){void 0===this.lane&&(this.lane=0),this.lane=e-this.lane-1},e.prototype.putChordInLane=function(e){this.lane=e,this.chordHeightAbove?this.chordHeightAbove=1.25*this.height*this.lane:this.chordHeightBelow=1.25*this.height*this.lane},e.prototype.getLane=function(){return void 0===this.lane?0:this.lane},e.prototype.setX=function(e){this.x=e+this.dx},hd=e}function qg(){if(gd)return md;gd=1;var e=Lg(),t=function(){if(pd)return fd;pd=1;var e=zg(),t=jg();function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(Array.isArray(t[n])||null!=(r=t[n])&&r.constructor===Object||(e[n]=t[n]));var r}function r(t){var r=new e("",0,0,"",0);return n(r,t),r.top=0,r.bottom=-1,t.abcelem&&(r.abcelem={},n(r.abcelem,t.abcelem),"note"===r.abcelem.el_type&&(r.abcelem.el_type="tabNumber")),t.cloned=r,r}function i(e,i){var a=r(e);if(i)for(var s=e.children,o=!0,c=0;c<s.length;c++){var l=s[c],u=new t("",0,0,0,"");n(u,l),o=i.tablature.setRelative(l,u,o),a.children.push(u)}return a}function a(n,r,i){var a="tab.tiny",s=7.5;n.isTabBig&&(a="tab.big",s=10);var o={el_type:"tab",icon:a,Ypos:s};if(s+=n.tabSymbolOffset,!n.hideTabSymbol){var c=new e(o,0,0,"symbol",0);c.x=r;var l=new t(a,0,0,7.5,"tab");l.x=i,c.children.push(l),"tab"==c.abcelem.el_type&&(l.pitch=s)}return c}function s(e){if(e.extra)for(var t=0;t<e.extra.length;t++){var n=e.extra[t];if("lyric"==n.type)return{bottom:n.bottom,height:n.height}}return null}function o(){this.accidentals=null}function c(e,n,r,i,a){var s=i.num;null!=i.note.quarter&&(s=s.toString(),s+=i.note.quarter);var o=e.semantics.stringToPitch(i.str);r.notes.push({num:s,str:i.str,pitch:i.note.emit()});var c=new t(s,0,0,o+.3,{type:"tabNumber"});return c.x=n,c.isGrace=a,c.isAltered=i.note.isAltered,c}function l(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 u(e){if(e.abcelem){var t=e.abcelem;if(t.rest)return t.gracenotes}return null}function h(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 i=r.notes.length-1;r.notes[i].graces=r.graces}return r}function d(e,t,n,r,i){for(var a=0;a<r.length;a++){var s={el_type:"note",startChar:n.abcelem.startChar,endChar:n.abcelem.endChar,notes:[],grace:!0},o=c(e,l(n,a),s,r[a],!0);t.children.push(o),i.push(s)}}return o.prototype.build=function(e,t,n,o,f,p,m){!function(e){for(var t=0;t<e.length;t++)e[t].tabNameInfos||0}(t);var g=t[f+o],v=t[m],y=null,b=null;"clef"!=g.children[0].abcelem.el_type&&"none"!=p&&g.children.splice(0,0,p);for(var _=0;_<g.children.length;_++){var w=g.children[_],x=w.x,k=x;switch(w.isClef&&(v.children.push(a(e,x,k)),w.abcelem.type.indexOf("-8")>=0&&(e.semantics.clefTranspose=-12),w.abcelem.type.indexOf("+8")>=0&&(e.semantics.clefTranspose=12)),w.type){case"staff-extra key-signature":this.accidentals=w.abcelem.accidentals,e.semantics.accidentals=this.accidentals;break;case"bar":e.semantics.measureAccidentals={};var C=!1;_===g.children.length-1&&(C=!0);var S=i(w,e);if(S.abcelem.barNumber){delete S.abcelem.barNumber;for(var E=0;E<S.children.length;E++)if("barNumber"===S.children[E].type){S.children.splice(E,1);break}}S.abcelem.lastBar=C,v.children.push(S),n.push({el_type:w.abcelem.el_type,type:w.abcelem.type,endChar:w.abcelem.endChar,startChar:w.abcelem.startChar,abselem:S});break;case"rest":var M=u(w);if(M){if((y=h(e,null,M)).error)return;O={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[],grace:!0},d(e,T,w,y.graces,n)}break;case"note":var T=r(w);T.x=w.heads[0].x+w.heads[0].w/2,T.lyricDim=s(w);var N=w.abcelem.pitches,A=w.abcelem.gracenotes;if(T.type="tabNumber",(y=h(e,N,A)).error)return;if(y.graces){var P=y.notes.length-1;y.notes[P].graces=y.graces}b={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[]};for(var I=0;I<y.notes.length;I++){var D=y.notes[I];if(D.graces)for(var B=0;B<D.graces.length;B++){var O={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[],grace:!0},L=c(e,l(w,B),O,D.graces[B],!0);T.children.push(L),n.push(O)}var V=c(e,T.x+w.heads[I].dx,b,D,!1);T.children.push(V)}b.notes.length>0&&(b.abselem=T,n.push(b),v.children.push(T))}}},fd=o}(),n=Ng();function r(e,t,n){var r=e.semantics,i=t.controller.getTextSize,a=r.tabInfos(e),s=!0;if(r.suppress(e)&&(s=!1),s){var o=i.calc(a,"tablabelfont","text instrumentname");return n.tabNameInfos={textSize:{height:o.height,width:o.width},name:a},o.height}return 0}function i(e,t){return!!t[e].isTabStaff&&(e===t.length-1||!t[e+1].isTabStaff)}function a(e,t){for(var n=t;n>=0;n--)if(!e[n].isTabStaff)return n;return-1}function s(e,t){return"clef"===e[t].children[0].abcelem.el_type?null:0==t?"none":e[t-1].children[0]}return md=function(o,c,l,u){var h=new t,d={clef:{type:"TAB"}},f=o.linePitch*o.nbLines,p=l.staff;if(p){var m=p[0];if(m&&m.clef&&0==m.clef.stafflines)return void o.setError("No tablatures when stafflines=0");p.splice(p.length,0,d)}var g=l.staffGroup,v=g.voices,y=function(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}(v[0]),b=u,_=g.staffs[b],w=f+3-_.bottom-y;_.isTabStaff&&(w=_.top);var x={bottom:-1,isTabStaff:!0,specialY:{tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0},lines:o.nbLines,linePitch:o.linePitch,dy:.15,top:w},k=function(e,t){for(var n=0,r=0,a=0;;){if(!t[n])return-1;if(t[n].isTabStaff||(a=t[n].voices.length),t[n].isTabStaff){if(r++,i(n,t)&&r<a)return n+1}else if(r=0,n>=e){if(n+1==t.length)return n+1;if(!t[n+1].isTabStaff)return n+1}if(++n>t.length)return-1}}(u,g.staffs);if(-1!==k){x.parentIndex=k-1,g.staffs.splice(k,0,x),g.height+=f+3;var C=function(e,t){for(var n=t;n>=0;n--)if(!e[n].isTabStaff)return e[n];return null}(g.staffs,k),S=1;(function(e,t){return 1===function(e){for(var t=0,n=0;n<e.length;n++)e[n].isTabStaff||t++;return t}(e)&&t.voices.length>1})(g.staffs,C)&&(S=C.voices.length),d.voices=[];for(var E=0;E<S;E++){var M=new e(0,0);E>0&&(M.duplicate=!0);var T=r(o,c,M)/n.STEP;T=Math.max(T,1),g.staffs[u].top+=1,g.height+=T,M.staff=x;var N=v.length;v.splice(v.length,0,M);var A=s(v,E+u);d.voices[E]=[],h.build(o,v,d.voices[E],E,u,A,N)}!function(e){for(var t=0;t<e.length;t++)if(e[t].isTabStaff){var n=a(e,t);e[t].hasStaff=e[n],e[n].hasTab||(e[n].hasTab=[]),e[n].hasTab.push(e[t])}}(g.staffs)}}}function Hg(){if(yd)return vd;yd=1;var e={__:-2,_:-1,"_/":-.5,"=":0,"":0,"^/":.5,"^":1,"^^":2},t=["C","-","D","-","E","F","-","G","-","A","-","B","c","-","d","-","e","f","-","g","-","a","-","b"];return vd={noteToMidi:function(n){var r=n.match(/([_^\/]*)([ABCDEFGabcdefg])(,*)('*)/);if(r&&5===r.length){var i=e[r[1]];return 48+t.indexOf(r[2])+i+12*(r[4].length-r[3].length)}return 0},midiToNote:function(e){e=parseInt(e,10);var n=Math.floor(e/12),r=e%12,i=t[r];if("-"===i&&(i="^"+t[r-1]),n>4)for(i=i.toLowerCase(),n-=5;n>0;)i+="'",n--;else for(;n<4;)i+=",",n++;return i}}}function Ug(){if(_d)return bd;_d=1;var{noteToMidi:e,midiToNote:t}=Hg();function n(n,r){var i=e(n);r&&(i+=r);var a,s=t(i),o=!1,c=!1,l=null,u=null,h=!1,d=0;n.startsWith("_")?(o=!0,d=-1,"/"==n[1]?(o=!1,u="v",d=0):"_"==n[1]&&(h=!0,d-=1)):n.startsWith("^")?(c=!0,d=1,"/"==n[1]?(c=!1,u="^",d=0):"^"==n[1]&&(h=!0,d+=1)):n.startsWith("=")&&(l=!0,d=0),((a=o||c||null!=u)||l)&&(s=null!=u||h?n.slice(2):n.slice(1));var f=(s.match(/,/g)||[]).length,p=(s.match(/'/g)||[]).length;this.pitch=i,this.pitchAltered=0,this.name=s,this.acc=d,this.isSharp=c,this.isKeySharp=!1,this.isDouble=h,this.isAltered=a,this.isFlat=o,this.isKeyFlat=!1,this.natural=l,this.quarter=u,this.isLower=this.name==this.name.toLowerCase(),this.name=this.name[0].toUpperCase(),this.hasComma=f,this.isQuoted=p}return n.prototype.sameNoteAs=function(e){return e.pitch===this.pitch},n.prototype.isLowerThan=function(e){return e.pitch>this.pitch},n.prototype.checkKeyAccidentals=function(e,t){if(!this.isAltered&&!this.natural)if(t[this.name.toUpperCase()])switch(t[this.name.toUpperCase()]){case"__":return this.acc=-2,void(this.pitchAltered=-2);case"_":return this.acc=-1,void(this.pitchAltered=-1);case"=":return this.acc=0,void(this.pitchAltered=0);case"^":return this.acc=1,void(this.pitchAltered=1);case"^^":return this.acc=2,void(this.pitchAltered=2)}else if(e)for(var n=this.name,r=0;r<e.length;r++){var i=e[r];n==i.note.toUpperCase()&&("flat"==i.acc&&(this.acc=-1,this.isKeyFlat=!0,this.pitchAltered=-1),"sharp"==i.acc&&(this.acc=1,this.isKeySharp=!0,this.pitchAltered=1))}},n.prototype.getAccidentalEquiv=function(){var e,t,r=((t=new n((e=this).name)).pitch=e.pitch,t.hasComma=e.hasComma,t.isLower=e.isLower,t.isQuoted=e.isQuoted,t.isSharp=e.isSharp,t.isKeySharp=e.isKeySharp,t.isFlat=e.isFlat,t.isKeyFlat=e.isKeyFlat,t);return r.isSharp||r.isKeySharp?((r=r.nextNote()).isFlat=!0,r.isSharp=!1,r.isKeySharp=!1):(r.isFlat||r.isKeyFlat)&&((r=r.prevNote()).isSharp=!0,r.isFlat=!1,r.isKeyFlat=!1),r},n.prototype.nextNote=function(){return new n(t(this.pitch+1+this.pitchAltered))},n.prototype.prevNote=function(){return new n(t(this.pitch-1+this.pitchAltered))},n.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},n.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},bd=n}function Gg(){if(Cd)return kd;Cd=1;const{noteToMidi:e}=Hg();var t=Ug(),n=function(){if(xd)return wd;xd=1;var e=Ug(),t=["A","B","C","D","E","F","G"];return wd=function(n,r){var i=new e(n),a=new e(r);if(a.isLowerThan(i)){var s=i.emit();return{error:"Invalid string Instrument tuning : "+a.emit()+" string lower than "+s+" string"}}var o=[],c=t.indexOf(i.name),l=t.indexOf(a.name);if(-1==c||-1==l)return o;for(var u=!1;!u;)o.push(i.emit()),(i=i.nextNote()).sameNoteAs(a)&&(u=!0);return o}}();function r(e,n){for(var r=[],s=0;s<n.length;s++)if(!n[s].endTie){var o=new t(n[s].name,e.clefTranspose);o.checkKeyAccidentals(e.accidentals,e.measureAccidentals);var c=a(e,o);r.push(c)}return function(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)return r.num="?",void(a.num="?");a.num<r.num?(a.str++,a=i(e,a.note,a.str,e.secondPos,e.strings[a.str].length)):(r.str++,r=i(e,r.note,r.str,e.secondPos,e.strings[r.str].length)),t[n]=r,t[n+1]=a}}}(e,r),r}function i(e,t,n,r,i){var a=e.strings;t.checkKeyAccidentals(e.accidentals,e.measureAccidentals),r&&(a=r);var s=t.emitNoAccidentals(),o=a[n].indexOf(s),c=t.acc;if(-1!=o){if(r&&(o+=i),(t.isFlat||-1==t.acc)&&0==o){var l=t.getAccidentalEquiv();o=a[++n].indexOf(l.emit()),c=0}return{num:o+c,str:n,note:t}}return null}function a(e,t){var n;(t.isAltered||t.natural)&&(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 i=t.pitch+t.pitchAltered-e.stringPitches[r];return"^"===t.quarter?i-=.5:"v"===t.quarter&&(i+=.5),{num:Math.round(i),str:e.stringPitches.length-1-r,note:t}}return{num:"?",str:e.stringPitches.length-1,note:t}}function s(e,t){var n={num:"?",str:0,note:t};e.push(n),e.error=t.emit()+": unexpected note for instrument"}function o(r){var i=r.tuning,a=r.capo,s=r.params.highestNote;this.linePitch=r.linePitch,this.highestNote="a'",s&&(this.highestNote=s),this.measureAccidentals={},this.capo=0,a&&(this.capo=parseInt(a,10)),this.transpose=r.transpose?r.transpose:0,this.tuning=i,this.stringPitches=[];for(var o=0;o<this.tuning.length;o++){var c=e(this.tuning[o])+this.capo;this.stringPitches.push(c)}if(this.capo>0&&(this.capoTuning=function(e){var n=null,r=e.tuning;if(e.capo>0){n=[];for(var i=0;i<r.length;i++){for(var a=new t(r[i]),s=0;s<e.capo;s++)a=a.nextNote();n[i]=a.emit()}}return n}(this)),this.strings=function(e){var t=[],r=e.tuning;e.capo>0&&(r=e.capoTuning);for(var i=r.length-1,a=0;a<r.length;a++){var s=e.highestNote;a!=r.length-1&&(s=r[a+1]);var o=n(r[a],s);if(o.error)return o;t[i--]=o}return t}(this),this.strings.error)return r.setError(this.strings.error),void(r.inError=!0);this.secondPos=function(e){var t=[];t[0]=[];for(var n=e.strings,r=1;r<n.length;r++)t[r]=n[r-1];return t}(this)}return o.prototype.stringToPitch=function(e){return 5.3+(this.strings.length-1-e)*this.linePitch},o.prototype.notesToNumber=function(e,n){var i,o,c=null,l=null;if(e&&(l=[],e.length>1?(l=r(this,e)).error&&(c=l.error):e[0].endTie||((i=new t(e[0].name,this.clefTranspose)).checkKeyAccidentals(this.accidentals,this.measureAccidentals),(o=a(this,i))?l.push(o):(s(l,i),c=l.error))),c)return l;var u=null;if(n){u=[];for(var h=0;h<n.length;h++)(i=new t(n[h].name,this.clefTranspose)).checkKeyAccidentals(this.accidentals,this.measureAccidentals),(o=a(this,i))?u.push(o):(s(u,i),c=l.error)}return{notes:l,graces:u,error:c}},o.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("")},o.prototype.tabInfos=function(e){var t=e.params.label;if(t){var n="";return-1!=t.indexOf("%T")&&(n=this.toString(),e.capo>0&&(n+=" capo:"+e.capo),t=t.replace("%T",n)),t}return""},o.prototype.suppress=function(e){return!!e.params.suppress},kd=o}function Wg(){if(Ed)return Sd;Ed=1;var e=function(){if(ed)return Jh;function e(e,t){this.numLines=e,this.lineSpace=t,this.verticalSize=this.numLines*this.lineSpace,this.bar={pitch:3,pitch2:t*e,height:5}}return ed=1,e.prototype.bypass=function(e){var t=e.staffGroup.voices;return!!(t.length>0&&t[0].isPercussion)},e.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("dots.dot"==e.name)return n?(t.pitch=r,!1):(t.pitch=r+this.lineSpace,!0)}return n},Jh=e}(),t=qg(),n=Gg();function r(){}r.prototype.init=function(t,r,i,a){this.tune=t,this.params=i,this.tuneNumber=r,this.inError=!1,this.abcTune=t,this.linePitch=3,this.nbLines=a.defaultTuning.length,this.isTabBig=a.isTabBig,this.tabSymbolOffset=a.tabSymbolOffset,this.capo=i.capo,this.transpose=i.visualTranspose,this.hideTabSymbol=i.hideTabSymbol,this.tablature=new e(this.nbLines,this.linePitch);var s=i.tuning;s||(s=a.defaultTuning),this.tuning=s,this.semantics=new n(this)},r.prototype.setError=function(e){e&&(this.error=e,this.inError=!0,this.tune.warnings?this.tune.warnings.push(e):this.tune.warnings=[e])},r.prototype.render=function(e,n,r){this.inError||this.tablature.bypass(n)||t(this,e,n,r)};return Sd=function(){return{name:"StringTab",tablature:r}}}function Yg(){if(Td)return Md;Td=1;var e=Wg(),t={violin:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},fiddle:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},mandolin:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},guitar:{name:"StringTab",defaultTuning:["E,","A,","D","G","B","e"],isTabBig:!0,tabSymbolOffset:0},fiveString:{name:"StringTab",defaultTuning:["C,","G,","D","A","e"],isTabBig:!1,tabSymbolOffset:-.95}};return Md={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(n,r,i){this.inited||(this.register(new e),this.inited=!0);var a=null;if(i.tablature){var s=i.tablature;a=[];for(var o=0;o<s.length;o++){var c=s[o],l=c.instrument;if(null==l)return this.setError(n,"tablature 'instrument' is missing"),a;var u=t[l],h=null;if(u&&(h=this.plugins[u.name]),h){0!=i.visualTranspose&&(c.visualTranspose=i.visualTranspose),c.abcSrc=i.tablature.abcSrc;var d={classz:h,tuneNumber:r,params:c,instance:null,tabType:u};a.push(d)}else{if(""!==l)return this.setError(n,"Undefined tablature plugin: "+l),a;a.push(null)}}}return a},layoutTablatures:function(e,t){var n=t.tablatures,r=0;if(n&&n.length>0)for(var i=n.length,a=0;a<i;++a)n[a]&&n[a].params.firstStaffOnly&&(n[a].params.suppress=!1);for(var s=0;s<t.lines.length;s++){var o=t.lines[s];if(o.staff&&r++,r>1&&n&&n.length>0)for(i=n.length,a=0;a<i;++a)n[a].params.firstStaffOnly&&(n[a].params.suppress=!0);var c=o.staff;if(c)for(var l=c.length,u=0;u<c.length;u++)if(n[u]&&u<l){var h=n[u];null==h.instance&&(h.instance=new h.classz,h.instance.init(t,h.tuneNumber,h.params,h.tabType)),h.instance.render(e,o,u)}}}}}function $g(){if(Ad)return Nd;Ad=1;var e=Og(),t=function(){if(Zh)return Xh;Zh=1;var e=yh();return Xh=function(t){for(var n="",r=t.match(/(\s*)/),i=(t=e.strip(t)).split("\nX:"),a=1;a<i.length;a++)i[a]="X:"+i[a];var s=r?r[0].length:0,o=[];i.forEach((function(e){o.push({abc:e,startPos:s}),s+=e.length+1})),o.length>1&&!e.startsWith(o[0].abc,"X:")&&o.shift().abc.split("\n").forEach((function(t){e.startsWith(t,"%%")&&(n+=t+"\n")}));var c=n;return o.forEach((function(t){var r=t.abc.indexOf("\n\n");r>0&&(t.abc=t.abc.substring(0,r)),t.pure=t.abc,t.abc=n+t.abc,t.title="";var i=t.pure.split("T:");i.length>1&&(i=i[1].split("\n"),t.title=e.strip(i[0]));var a=t.pure.substring(2,t.pure.indexOf("\n"));t.id=e.strip(a)})),{header:c,tunes:o}}}(),n=Yg(),r={};return function(){r.numberOfTunes=function(e){var t=e.split("\nX:").length;return 0===t&&(t=1),t};var i=r.TuneBook=function(e){var n=t(e);this.header=n.header,this.tunes=n.tunes};i.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},i.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},r.parseOnly=function(e,t){for(var n=r.numberOfTunes(e),i=[],a=0;a<n;a++)i.push(1);return r.renderEngine((function(){}),i,e,t)},r.renderEngine=function(t,r,a,s){var o=[];if(void 0!==r&&void 0!==a){var c;(!(c=r)||c.propertyIsEnumerable("length")||"object"!=typeof c||"number"!=typeof c.length)&&(r=[r]),void 0===s&&(s={});for(var l=s.startingTune?parseInt(s.startingTune,10):0,u=new i(a),h=new e,d=0;d<r.length;d++){var f=r[d];if("*"===f||"string"==typeof f&&(f=document.getElementById(f)),f)if(l>=0&&l<u.tunes.length){h.parse(u.tunes[l].abc,s,u.tunes[l].startPos-u.header.length);var p=h.getTune();s.tablature&&(p.tablatures=n.preparePlugins(p,l,s));var m=h.getWarnings();m&&(p.warnings=m);var g=t(f,p,d,u.tunes[l].abc);o.push(g||p)}else f.innerHTML&&(f.innerHTML="");l++}return o}},r.extractMeasures=function(e){for(var t=[],n=new i(e),a=0;a<n.tunes.length;a++){for(var s=n.tunes[a],o=s.abc.split("K:"),c=o[1].split("\n"),l=o[0]+"K:"+c[0]+"\n",u=null,h=null,d=null,f=[],p=!1,m=r.parseOnly(s.abc)[0],g=m.getPickupLength()>0,v=0;v<m.lines.length;v++){var y=m.lines[v];if(y.staff)for(var b=0;b<1;b++)for(var _=y.staff[b],w=0;w<1;w++)for(var x=_.voices[w],k=0;k<x.length;k++){var C=x[k];if(null===d&&C.startChar>=0&&(d=C.startChar,h=void 0===C.chord?u:null),C.chord&&(u=C),"bar"===C.el_type){if(p){var S={abc:s.abc.substring(d,C.endChar)};(u=h&&h.chord&&h.chord.length>0?h.chord[0].name:null)&&(S.lastChord=u),C.startEnding&&(S.startEnding=C.startEnding),C.endEnding&&(S.endEnding=C.endEnding),f.push(S),d=null,p=!1}}else"note"===C.el_type&&(p=!0)}}t.push({header:l,measures:f,hasPickup:g})}return t}}(),Nd=r}function Kg(){if(Id)return Pd;Id=1;var e,t=xh(),{relativeMajor:n,transposeKey:r,relativeMode:i}=wh(),a=_h();return function(){function s(e,t,n){var r=[],i=t.getKeySignature();if("Hp"===i.root||"HP"===i.root)return r;r=r.concat(function(e,t){for(var n=[],r=e.split("K:"),i=r[0].length,a=1;a<r.length;a++){var s=r[a],o=s.match(/^( *)([A-G])([#b]?)(\w*)/);if(o){var c=i+2+o[1].length,l=o[2]+o[3]+o[4],u=f({root:o[2],acc:o[3],mode:o[4]},t),h=u.root+u.acc+u.mode;n.push({start:c,end:c+l.length,note:h})}i+=s.length+2}return n}(e,n));for(var a=0;a<t.lines.length;a++){var s=t.lines[a].staff;if(s)for(var c=0;c<s.length;c++){var l=s[c];"perc"!==l.clef.type&&(r=r.concat(o(e,l.voices,l.key,n)))}}return r}function o(e,t,n,r){for(var i=[],a=f(n,r),s=0;s<t.length;s++)i=i.concat(u(e,t[s],n.root,c(n),a,r));return i}function c(e){for(var t={},n=0;n<e.accidentals.length;n++){var r=e.accidentals[n];"flat"===r.acc?t[r.note.toUpperCase()]="_":"sharp"===r.acc&&(t[r.note.toUpperCase()]="^")}return t}function l(e,t,n){var r=h.indexOf(e.root)-h.indexOf(t);return"none"===t&&(r=h.indexOf(e.root)),0===r?n>2?r+=7:-12===n&&(r-=7):n>0&&r<0?r+=7:n<0&&r>0&&(r-=7),n>12?r+=7:n<-12&&(r-=7),r}function u(e,t,n,r,i,s){for(var o=[],u=l(i,n,s),h={},d={},m=0;m<t.length;m++){var g=t[m];if(g.chord)for(var v=0;v<g.chord.length;v++){var y=g.chord[v];if("default"===y.position){var k=i.accidentals.length&&"flat"===i.accidentals[0].acc,C=a(y.name,s,k,!0);(C=C.replace(/♭/g,"b").replace(/♯/g,"#"))!==y.name&&o.push(x(e,g.startChar,g.endChar,C))}}if("note"===g.el_type&&g.pitches){for(var S=0;S<g.pitches.length;S++){var E=b(g.pitches[S].name,n,r,h);E.acc&&(h[E.name.toUpperCase()]=E.acc);var M=p(E,i,u,d);M.acc&&(d[M.upper]=M.acc),o.push(_(e,g.startChar,g.endChar,M.acc+M.name,S))}if(g.gracenotes)for(var T=0;T<g.gracenotes.length;T++){var N=b(g.gracenotes[T].name,n,r,h);N.acc&&(h[N.name.toUpperCase()]=N.acc);var A=p(N,i,u,h);A.acc&&(d[A.upper]=A.acc),o.push(w(e,g.startChar,g.endChar,A.acc+A.name,T))}}else"bar"===g.el_type?(h={},d={}):"keySignature"===g.el_type&&(n=g.root,r=c(g),u=l(i=f(g,s),n,s))}return o}e=function(e,o,c){if("TEST"===o)return{keyAccidentals:t,relativeMajor:n,transposeKey:r,relativeMode:i,transposeChordName:a};c=parseInt(c,10);var l,u=[];for(l=0;l<o.length;l++)u=u.concat(s(e,o[l],c));u=u.sort((function(e,t){return t.start-e.start}));var h=e.split("");for(l=0;l<u.length;l++){var d=u[l];h.splice(d.start,d.end-d.start,d.note)}return h.join("")};var h="CDEFGAB",d=[",,,,",",,,",",,",",","","'","''","'''","''''"];function f(e,a){if("none"===e.root)return{root:r("C",a),mode:"",acc:"",accidentals:[]};var s=n(e.root+e.acc+e.mode),o=r(s,a),c=i(o,e.mode),l=t(o);return{root:c[0],mode:e.mode,acc:c.length>1?c[1]:"",accidentals:l}}function p(e,t,n,r){for(var i=e.pitch,a=h.indexOf(e.name),s=(h.indexOf(t.root)+i)%7,o=a+n,c=e.oct;o>6;)c++,o-=7;for(;o<0;)c--,o+=7;for(var l=h[s],u="",d=e.adj,f="=",m=0;m<t.accidentals.length;m++)if(t.accidentals[m].note.toLowerCase()===l.toLowerCase()){d+="flat"===t.accidentals[m].acc?-1:1,f="flat"===t.accidentals[m].acc?"_":"^";break}switch(d){case-2:u="__";break;case-1:u="_";break;case 0:u="=";break;case 1:u="^";break;case 2:u="^^";break;case-3:return(g={}).pitch=e.pitch-1,g.oct=e.oct,g.name=h[h.indexOf(e.name)-1],g.name||(g.name="B",g.oct--),"B"===g.name||"E"===g.name?g.adj=e.adj+1:g.adj=e.adj+2,p(g,t,n+1,r);case 3:var g;return(g={}).pitch=e.pitch+1,g.oct=e.oct,g.name=h[h.indexOf(e.name)+1],g.name||(g.name="C",g.oct++),"C"===g.name||"F"===g.name?g.adj=e.adj-1:g.adj=e.adj-2,p(g,t,n+1,r)}switch(r[l]!==u&&(r[l]||u!==f)||e.courtesy||(u=""),c){case 0:l+=",,,";break;case 1:l+=",,";break;case 2:l+=",";break;case 4:l=l.toLowerCase();break;case 5:l=l.toLowerCase()+"'";break;case 6:l=l.toLowerCase()+"''";break;case 7:l=l.toLowerCase()+"'''";break;case 8:l=l.toLowerCase()+"''''"}return c>4&&(l=l.toLowerCase()),{acc:u,name:l,upper:l.toUpperCase()}}var m=/([_^=]*)([A-Ga-g])([,']*)/,g=/([_^=]*[A-Ga-g][,']*)(\d*\/*\d*)([\>\<\-\)\.\s\\]*)/,v=/([_^=]*[A-Ga-g][,']*)?(\d*\/*\d*)?([\>\<\-\)]*)?/,y=/(\s*)$/;function b(e,t,n,r){var i="none"===t?0:h.indexOf(t),a=e.match(m),s=a[2].toUpperCase(),o=h.indexOf(s)-i;o<0&&(o+=7);var c=d.indexOf(a[3]);s===a[2]&&c--;var l=r[s]||n[s]||"=";return{acc:a[1],name:s,pitch:o,oct:c,adj:k(a[1],n[s],r[s]),courtesy:a[1]===l}}function _(e,t,n,r,i){var a=e.substring(t,n),s=a.match(new RegExp(g.source+y.source),"");if(s){var o=s[1].length,c=s[2].length+s[3].length+s[4].length;t+=n-t-o-c,n-=c}else{if(s=a.match(new RegExp(/([^\[]*)/.source+/\[/.source+v.source+v.source+v.source+v.source+v.source+v.source+v.source+v.source+/\-?](\d*\/*\d*)?([\>\<\-\)]*)/.source+y.source))){for(var l=1+s[1].length,u=0;u<i;u++)s[3*u+2]&&(l+=s[3*u+2].length),s[3*u+3]&&(l+=s[3*u+3].length),s[3*u+4]&&(l+=s[3*u+4].length);n=(t+=l)+(s[3*i+2]?s[3*i+2].length:0)}}return{start:t,end:n,note:r}}function w(e,t,n,r,i){var a=/(\/*)/,s=e.substring(t,n).match(new RegExp(/([^\{]*)/.source+/\{/.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+a.source+v.source+/\}/.source));if(s){for(var o=1+s[1].length,c=0;c<i;c++)s[3*c+2]&&(o+=s[3*c+2].length),s[3*c+3]&&(o+=s[3*c+3].length),s[3*c+4]&&(o+=s[3*c+4].length),s[3*c+5]&&(o+=s[3*c+5].length);s[3*i+2]&&(o+=s[3*c+2].length),t+=o;var l=s[3*i+3]?s[3*i+3].length:0;l+=s[3*i+4]?s[3*i+4].length:0,n=t+(l+=s[3*i+5]?s[3*i+5].length:0)}return{start:t,end:n,note:r}}function x(e,t,n,r){var i=e.substring(t,n).match(/([^"]+)?(".+")+/);return i[1]&&(t+=i[1].length),{start:t+1,end:(n=t+i[2].length)-1,note:r}}function k(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"=":default:return 0;case"^":return 1;case"^^":return 2}case"_":switch(e){case"__":return-1;case"_":default:return 0;case"=":return 1;case"^":return 2;case"^^":return 3}case"^":switch(e){case"__":return-3;case"_":return-2;case"=":return-1;case"^":default:return 0;case"^^":return 1}}return 0}}(),Pd=e}function Qg(){if(Rd)return Vd;Rd=1;var e=Ng(),t={0:{d:[["M",4.83,-14.97],["c",.33,-.03,1.11,0,1.47,.06],["c",1.68,.36,2.97,1.59,3.78,3.6],["c",1.2,2.97,.81,6.96,-.9,9.27],["c",-.78,1.08,-1.71,1.71,-2.91,1.95],["c",-.45,.09,-1.32,.09,-1.77,0],["c",-.81,-.18,-1.47,-.51,-2.07,-1.02],["c",-2.34,-2.07,-3.15,-6.72,-1.74,-10.2],["c",.87,-2.16,2.28,-3.42,4.14,-3.66],["z"],["m",1.11,.87],["c",-.21,-.06,-.69,-.09,-.87,-.06],["c",-.54,.12,-.87,.42,-1.17,.99],["c",-.36,.66,-.51,1.56,-.6,3],["c",-.03,.75,-.03,4.59,0,5.31],["c",.09,1.5,.27,2.4,.6,3.06],["c",.24,.48,.57,.78,.96,.9],["c",.27,.09,.78,.09,1.05,0],["c",.39,-.12,.72,-.42,.96,-.9],["c",.33,-.66,.51,-1.56,.6,-3.06],["c",.03,-.72,.03,-4.56,0,-5.31],["c",-.09,-1.47,-.27,-2.37,-.6,-3.03],["c",-.24,-.48,-.54,-.78,-.93,-.9],["z"]],w:10.78,h:14.959},1:{d:[["M",3.3,-15.06],["c",.06,-.06,.21,-.03,.66,.15],["c",.81,.39,1.08,.39,1.83,.03],["c",.21,-.09,.39,-.15,.42,-.15],["c",.12,0,.21,.09,.27,.21],["c",.06,.12,.06,.33,.06,5.94],["c",0,3.93,0,5.85,.03,6.03],["c",.06,.36,.15,.69,.27,.96],["c",.36,.75,.93,1.17,1.68,1.26],["c",.3,.03,.39,.09,.39,.3],["c",0,.15,-.03,.18,-.09,.24],["c",-.06,.06,-.09,.06,-.48,.06],["c",-.42,0,-.69,-.03,-2.1,-.24],["c",-.9,-.15,-1.77,-.15,-2.67,0],["c",-1.41,.21,-1.68,.24,-2.1,.24],["c",-.39,0,-.42,0,-.48,-.06],["c",-.06,-.06,-.06,-.09,-.06,-.24],["c",0,-.21,.06,-.27,.36,-.3],["c",.75,-.09,1.32,-.51,1.68,-1.26],["c",.12,-.27,.21,-.6,.27,-.96],["c",.03,-.18,.03,-1.59,.03,-4.29],["c",0,-3.87,0,-4.05,-.06,-4.14],["c",-.09,-.15,-.18,-.24,-.39,-.24],["c",-.12,0,-.15,.03,-.21,.06],["c",-.03,.06,-.45,.99,-.96,2.13],["c",-.48,1.14,-.9,2.1,-.93,2.16],["c",-.06,.15,-.21,.24,-.33,.24],["c",-.24,0,-.42,-.18,-.42,-.39],["c",0,-.06,3.27,-7.62,3.33,-7.74],["z"]],w:8.94,h:15.058},2:{d:[["M",4.23,-14.97],["c",.57,-.06,1.68,0,2.34,.18],["c",.69,.18,1.5,.54,2.01,.9],["c",1.35,.96,1.95,2.25,1.77,3.81],["c",-.15,1.35,-.66,2.34,-1.68,3.15],["c",-.6,.48,-1.44,.93,-3.12,1.65],["c",-1.32,.57,-1.8,.81,-2.37,1.14],["c",-.57,.33,-.57,.33,-.24,.27],["c",.39,-.09,1.26,-.09,1.68,0],["c",.72,.15,1.41,.45,2.1,.9],["c",.99,.63,1.86,.87,2.55,.75],["c",.24,-.06,.42,-.15,.57,-.3],["c",.12,-.09,.3,-.42,.3,-.51],["c",0,-.09,.12,-.21,.24,-.24],["c",.18,-.03,.39,.12,.39,.3],["c",0,.12,-.15,.57,-.3,.87],["c",-.54,1.02,-1.56,1.74,-2.79,2.01],["c",-.42,.09,-1.23,.09,-1.62,.03],["c",-.81,-.18,-1.32,-.45,-2.01,-1.11],["c",-.45,-.45,-.63,-.57,-.96,-.69],["c",-.84,-.27,-1.89,.12,-2.25,.9],["c",-.12,.21,-.21,.54,-.21,.72],["c",0,.12,-.12,.21,-.27,.24],["c",-.15,0,-.27,-.03,-.33,-.15],["c",-.09,-.21,.09,-1.08,.33,-1.71],["c",.24,-.66,.66,-1.26,1.29,-1.89],["c",.45,-.45,.9,-.81,1.92,-1.56],["c",1.29,-.93,1.89,-1.44,2.34,-1.98],["c",.87,-1.05,1.26,-2.19,1.2,-3.63],["c",-.06,-1.29,-.39,-2.31,-.96,-2.91],["c",-.36,-.33,-.72,-.51,-1.17,-.54],["c",-.84,-.03,-1.53,.42,-1.59,1.05],["c",-.03,.33,.12,.6,.57,1.14],["c",.45,.54,.54,.87,.42,1.41],["c",-.15,.63,-.54,1.11,-1.08,1.38],["c",-.63,.33,-1.2,.33,-1.83,0],["c",-.24,-.12,-.33,-.18,-.54,-.39],["c",-.18,-.18,-.27,-.3,-.36,-.51],["c",-.24,-.45,-.27,-.84,-.21,-1.38],["c",.12,-.75,.45,-1.41,1.02,-1.98],["c",.72,-.72,1.74,-1.17,2.85,-1.32],["z"]],w:10.764,h:14.97},3:{d:[["M",3.78,-14.97],["c",.3,-.03,1.41,0,1.83,.06],["c",2.22,.3,3.51,1.32,3.72,2.91],["c",.03,.33,.03,1.26,-.03,1.65],["c",-.12,.84,-.48,1.47,-1.05,1.77],["c",-.27,.15,-.36,.24,-.45,.39],["c",-.09,.21,-.09,.36,0,.57],["c",.09,.15,.18,.24,.51,.39],["c",.75,.42,1.23,1.14,1.41,2.13],["c",.06,.42,.06,1.35,0,1.71],["c",-.18,.81,-.48,1.38,-1.02,1.95],["c",-.75,.72,-1.8,1.2,-3.18,1.38],["c",-.42,.06,-1.56,.06,-1.95,0],["c",-1.89,-.33,-3.18,-1.29,-3.51,-2.64],["c",-.03,-.12,-.03,-.33,-.03,-.6],["c",0,-.36,0,-.42,.06,-.63],["c",.12,-.3,.27,-.51,.51,-.75],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.36,.33,.57,.75,.6,1.2],["c",0,.21,0,.27,-.06,.42],["c",-.09,.18,-.12,.24,-.54,.54],["c",-.51,.36,-.63,.54,-.6,.87],["c",.06,.54,.54,.9,1.38,.99],["c",.36,.06,.72,.03,.96,-.06],["c",.81,-.27,1.29,-1.23,1.44,-2.79],["c",.03,-.45,.03,-1.95,-.03,-2.37],["c",-.09,-.75,-.33,-1.23,-.75,-1.44],["c",-.33,-.18,-.45,-.18,-1.98,-.18],["c",-1.35,0,-1.41,0,-1.5,-.06],["c",-.18,-.12,-.24,-.39,-.12,-.6],["c",.12,-.15,.15,-.15,1.68,-.15],["c",1.5,0,1.62,0,1.89,-.15],["c",.18,-.09,.42,-.36,.54,-.57],["c",.18,-.42,.27,-.9,.3,-1.95],["c",.03,-1.2,-.06,-1.8,-.36,-2.37],["c",-.24,-.48,-.63,-.81,-1.14,-.96],["c",-.3,-.06,-1.08,-.06,-1.38,.03],["c",-.6,.15,-.9,.42,-.96,.84],["c",-.03,.3,.06,.45,.63,.84],["c",.33,.24,.42,.39,.45,.63],["c",.03,.72,-.57,1.5,-1.32,1.65],["c",-1.05,.27,-2.1,-.57,-2.1,-1.65],["c",0,-.45,.15,-.96,.39,-1.38],["c",.12,-.21,.54,-.63,.81,-.81],["c",.57,-.42,1.38,-.69,2.25,-.81],["z"]],w:9.735,h:14.967},4:{d:[["M",8.64,-14.94],["c",.27,-.09,.42,-.12,.54,-.03],["c",.09,.06,.15,.21,.15,.3],["c",-.03,.06,-1.92,2.31,-4.23,5.04],["c",-2.31,2.73,-4.23,4.98,-4.26,5.01],["c",-.03,.06,.12,.06,2.55,.06],["l",2.61,0],["l",0,-2.37],["c",0,-2.19,.03,-2.37,.06,-2.46],["c",.03,-.06,.21,-.18,.57,-.42],["c",1.08,-.72,1.38,-1.08,1.86,-2.16],["c",.12,-.3,.24,-.54,.27,-.57],["c",.12,-.12,.39,-.06,.45,.12],["c",.06,.09,.06,.57,.06,3.96],["l",0,3.9],["l",1.08,0],["c",1.05,0,1.11,0,1.2,.06],["c",.24,.15,.24,.54,0,.69],["c",-.09,.06,-.15,.06,-1.2,.06],["l",-1.08,0],["l",0,.33],["c",0,.57,.09,1.11,.3,1.53],["c",.36,.75,.93,1.17,1.68,1.26],["c",.3,.03,.39,.09,.39,.3],["c",0,.15,-.03,.18,-.09,.24],["c",-.06,.06,-.09,.06,-.48,.06],["c",-.42,0,-.69,-.03,-2.1,-.24],["c",-.9,-.15,-1.77,-.15,-2.67,0],["c",-1.41,.21,-1.68,.24,-2.1,.24],["c",-.39,0,-.42,0,-.48,-.06],["c",-.06,-.06,-.06,-.09,-.06,-.24],["c",0,-.21,.06,-.27,.36,-.3],["c",.75,-.09,1.32,-.51,1.68,-1.26],["c",.21,-.42,.3,-.96,.3,-1.53],["l",0,-.33],["l",-2.7,0],["c",-2.91,0,-2.85,0,-3.09,-.15],["c",-.18,-.12,-.3,-.39,-.27,-.54],["c",.03,-.06,.18,-.24,.33,-.45],["c",.75,-.9,1.59,-2.07,2.13,-3.03],["c",.33,-.54,.84,-1.62,1.05,-2.16],["c",.57,-1.41,.84,-2.64,.9,-4.05],["c",.03,-.63,.06,-.72,.24,-.81],["l",.12,-.06],["l",.45,.12],["c",.66,.18,1.02,.24,1.47,.27],["c",.6,.03,1.23,-.09,2.01,-.33],["z"]],w:11.795,h:14.994},5:{d:[["M",1.02,-14.94],["c",.12,-.09,.03,-.09,1.08,.06],["c",2.49,.36,4.35,.36,6.96,-.06],["c",.57,-.09,.66,-.06,.81,.06],["c",.15,.18,.12,.24,-.15,.51],["c",-1.29,1.26,-3.24,2.04,-5.58,2.31],["c",-.6,.09,-1.2,.12,-1.71,.12],["c",-.39,0,-.45,0,-.57,.06],["c",-.09,.06,-.15,.12,-.21,.21],["l",-.06,.12],["l",0,1.65],["l",0,1.65],["l",.21,-.21],["c",.66,-.57,1.41,-.96,2.19,-1.14],["c",.33,-.06,1.41,-.06,1.95,0],["c",2.61,.36,4.02,1.74,4.26,4.14],["c",.03,.45,.03,1.08,-.03,1.44],["c",-.18,1.02,-.78,2.01,-1.59,2.7],["c",-.72,.57,-1.62,1.02,-2.49,1.2],["c",-1.38,.27,-3.03,.06,-4.2,-.54],["c",-1.08,-.54,-1.71,-1.32,-1.86,-2.28],["c",-.09,-.69,.09,-1.29,.57,-1.74],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.36,.33,.57,.75,.6,1.2],["c",0,.21,0,.27,-.06,.42],["c",-.09,.18,-.12,.24,-.54,.54],["c",-.18,.12,-.36,.3,-.42,.33],["c",-.36,.42,-.18,.99,.36,1.26],["c",.51,.27,1.47,.36,2.01,.27],["c",.93,-.21,1.47,-1.17,1.65,-2.91],["c",.06,-.45,.06,-1.89,0,-2.31],["c",-.15,-1.2,-.51,-2.1,-1.05,-2.55],["c",-.21,-.18,-.54,-.36,-.81,-.39],["c",-.3,-.06,-.84,-.03,-1.26,.06],["c",-.93,.18,-1.65,.6,-2.16,1.2],["c",-.15,.21,-.27,.3,-.39,.3],["c",-.15,0,-.3,-.09,-.36,-.18],["c",-.06,-.09,-.06,-.15,-.06,-3.66],["c",0,-3.39,0,-3.57,.06,-3.66],["c",.03,-.06,.09,-.15,.15,-.18],["z"]],w:10.212,h:14.997},6:{d:[["M",4.98,-14.97],["c",.36,-.03,1.2,0,1.59,.06],["c",.9,.15,1.68,.51,2.25,1.05],["c",.57,.51,.87,1.23,.84,1.98],["c",-.03,.51,-.21,.9,-.6,1.26],["c",-.24,.24,-.45,.39,-.75,.51],["c",-.21,.06,-.27,.06,-.6,.06],["c",-.33,0,-.39,0,-.6,-.06],["c",-.3,-.12,-.51,-.27,-.75,-.51],["c",-.39,-.36,-.57,-.78,-.57,-1.26],["c",0,-.27,0,-.3,.09,-.42],["c",.03,-.09,.18,-.21,.3,-.3],["c",.12,-.09,.3,-.21,.39,-.27],["c",.09,-.06,.21,-.18,.27,-.24],["c",.06,-.12,.09,-.15,.09,-.33],["c",0,-.18,-.03,-.24,-.09,-.36],["c",-.24,-.39,-.75,-.6,-1.38,-.57],["c",-.54,.03,-.9,.18,-1.23,.48],["c",-.81,.72,-1.08,2.16,-.96,5.37],["l",0,.63],["l",.3,-.12],["c",.78,-.27,1.29,-.33,2.1,-.27],["c",1.47,.12,2.49,.54,3.27,1.29],["c",.48,.51,.81,1.11,.96,1.89],["c",.06,.27,.06,.42,.06,.93],["c",0,.54,0,.69,-.06,.96],["c",-.15,.78,-.48,1.38,-.96,1.89],["c",-.54,.51,-1.17,.87,-1.98,1.08],["c",-1.14,.3,-2.4,.33,-3.24,.03],["c",-1.5,-.48,-2.64,-1.89,-3.27,-4.02],["c",-.36,-1.23,-.51,-2.82,-.42,-4.08],["c",.3,-3.66,2.28,-6.3,4.95,-6.66],["z"],["m",.66,7.41],["c",-.27,-.09,-.81,-.12,-1.08,-.06],["c",-.72,.18,-1.08,.69,-1.23,1.71],["c",-.06,.54,-.06,3,0,3.54],["c",.18,1.26,.72,1.77,1.8,1.74],["c",.39,-.03,.63,-.09,.9,-.27],["c",.66,-.42,.9,-1.32,.9,-3.24],["c",0,-2.22,-.36,-3.12,-1.29,-3.42],["z"]],w:9.956,h:14.982},7:{d:[["M",.21,-14.97],["c",.21,-.06,.45,0,.54,.15],["c",.06,.09,.06,.15,.06,.39],["c",0,.24,0,.33,.06,.42],["c",.06,.12,.21,.24,.27,.24],["c",.03,0,.12,-.12,.24,-.21],["c",.96,-1.2,2.58,-1.35,3.99,-.42],["c",.15,.12,.42,.3,.54,.45],["c",.48,.39,.81,.57,1.29,.6],["c",.69,.03,1.5,-.3,2.13,-.87],["c",.09,-.09,.27,-.3,.39,-.45],["c",.12,-.15,.24,-.27,.3,-.3],["c",.18,-.06,.39,.03,.51,.21],["c",.06,.18,.06,.24,-.27,.72],["c",-.18,.24,-.54,.78,-.78,1.17],["c",-2.37,3.54,-3.54,6.27,-3.87,9],["c",-.03,.33,-.03,.66,-.03,1.26],["c",0,.9,0,1.08,.15,1.89],["c",.06,.45,.06,.48,.03,.6],["c",-.06,.09,-.21,.21,-.3,.21],["c",-.03,0,-.27,-.06,-.54,-.15],["c",-.84,-.27,-1.11,-.3,-1.65,-.3],["c",-.57,0,-.84,.03,-1.56,.27],["c",-.6,.18,-.69,.21,-.81,.15],["c",-.12,-.06,-.21,-.18,-.21,-.3],["c",0,-.15,.6,-1.44,1.2,-2.61],["c",1.14,-2.22,2.73,-4.68,5.1,-8.01],["c",.21,-.27,.36,-.48,.33,-.48],["c",0,0,-.12,.06,-.27,.12],["c",-.54,.3,-.99,.39,-1.56,.39],["c",-.75,.03,-1.2,-.18,-1.83,-.75],["c",-.99,-.9,-1.83,-1.17,-2.31,-.72],["c",-.18,.15,-.36,.51,-.45,.84],["c",-.06,.24,-.06,.33,-.09,1.98],["c",0,1.62,-.03,1.74,-.06,1.8],["c",-.15,.24,-.54,.24,-.69,0],["c",-.06,-.09,-.06,-.15,-.06,-3.57],["c",0,-3.42,0,-3.48,.06,-3.57],["c",.03,-.06,.09,-.12,.15,-.15],["z"]],w:10.561,h:15.093},8:{d:[["M",4.98,-14.97],["c",.33,-.03,1.02,-.03,1.32,0],["c",1.32,.12,2.49,.6,3.21,1.32],["c",.39,.39,.66,.81,.78,1.29],["c",.09,.36,.09,1.08,0,1.44],["c",-.21,.84,-.66,1.59,-1.59,2.55],["l",-.3,.3],["l",.27,.18],["c",1.47,.93,2.31,2.31,2.25,3.75],["c",-.03,.75,-.24,1.35,-.63,1.95],["c",-.45,.66,-1.02,1.14,-1.83,1.53],["c",-1.8,.87,-4.2,.87,-6,.03],["c",-1.62,-.78,-2.52,-2.16,-2.46,-3.66],["c",.06,-.99,.54,-1.77,1.8,-2.97],["c",.54,-.51,.54,-.54,.48,-.57],["c",-.39,-.27,-.96,-.78,-1.2,-1.14],["c",-.75,-1.11,-.87,-2.4,-.3,-3.6],["c",.69,-1.35,2.25,-2.25,4.2,-2.4],["z"],["m",1.53,.69],["c",-.42,-.09,-1.11,-.12,-1.38,-.06],["c",-.3,.06,-.6,.18,-.81,.3],["c",-.21,.12,-.6,.51,-.72,.72],["c",-.51,.87,-.42,1.89,.21,2.52],["c",.21,.21,.36,.3,1.95,1.23],["c",.96,.54,1.74,.99,1.77,1.02],["c",.09,0,.63,-.6,.99,-1.11],["c",.21,-.36,.48,-.87,.57,-1.23],["c",.06,-.24,.06,-.36,.06,-.72],["c",0,-.45,-.03,-.66,-.15,-.99],["c",-.39,-.81,-1.29,-1.44,-2.49,-1.68],["z"],["m",-1.44,8.07],["l",-1.89,-1.08],["c",-.03,0,-.18,.15,-.39,.33],["c",-1.2,1.08,-1.65,1.95,-1.59,3],["c",.09,1.59,1.35,2.85,3.21,3.24],["c",.33,.06,.45,.06,.93,.06],["c",.63,0,.81,-.03,1.29,-.27],["c",.9,-.42,1.47,-1.41,1.41,-2.4],["c",-.06,-.66,-.39,-1.29,-.9,-1.65],["c",-.12,-.09,-1.05,-.63,-2.07,-1.23],["z"]],w:10.926,h:14.989},9:{d:[["M",4.23,-14.97],["c",.42,-.03,1.29,0,1.62,.06],["c",.51,.12,.93,.3,1.38,.57],["c",1.53,1.02,2.52,3.24,2.73,5.94],["c",.18,2.55,-.48,4.98,-1.83,6.57],["c",-1.05,1.26,-2.4,1.89,-3.93,1.83],["c",-1.23,-.06,-2.31,-.45,-3.03,-1.14],["c",-.57,-.51,-.87,-1.23,-.84,-1.98],["c",.03,-.51,.21,-.9,.6,-1.26],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.39,.36,.57,.78,.57,1.26],["c",0,.27,0,.3,-.09,.42],["c",-.03,.09,-.18,.21,-.3,.3],["c",-.12,.09,-.3,.21,-.39,.27],["c",-.09,.06,-.21,.18,-.27,.24],["c",-.06,.12,-.06,.15,-.06,.33],["c",0,.18,0,.24,.06,.36],["c",.24,.39,.75,.6,1.38,.57],["c",.54,-.03,.9,-.18,1.23,-.48],["c",.81,-.72,1.08,-2.16,.96,-5.37],["l",0,-.63],["l",-.3,.12],["c",-.78,.27,-1.29,.33,-2.1,.27],["c",-1.47,-.12,-2.49,-.54,-3.27,-1.29],["c",-.48,-.51,-.81,-1.11,-.96,-1.89],["c",-.06,-.27,-.06,-.42,-.06,-.96],["c",0,-.51,0,-.66,.06,-.93],["c",.15,-.78,.48,-1.38,.96,-1.89],["c",.15,-.12,.33,-.27,.42,-.36],["c",.69,-.51,1.62,-.81,2.76,-.93],["z"],["m",1.17,.66],["c",-.21,-.06,-.57,-.06,-.81,-.03],["c",-.78,.12,-1.26,.69,-1.41,1.74],["c",-.12,.63,-.15,1.95,-.09,2.79],["c",.12,1.71,.63,2.4,1.77,2.46],["c",1.08,.03,1.62,-.48,1.8,-1.74],["c",.06,-.54,.06,-3,0,-3.54],["c",-.15,-1.05,-.51,-1.53,-1.26,-1.68],["z"]],w:9.959,h:14.986},"rests.multimeasure":{d:[["M",0,-4],["l",0,16],["l",1,0],["l",0,-5],["l",40,0],["l",0,5],["l",1,0],["l",0,-16],["l",-1,0],["l",0,5],["l",-40,0],["l",0,-5],["z"]],w:42,h:18},"rests.whole":{d:[["M",.06,.03],["l",.09,-.06],["l",5.46,0],["l",5.49,0],["l",.09,.06],["l",.06,.09],["l",0,2.19],["l",0,2.19],["l",-.06,.09],["l",-.09,.06],["l",-5.49,0],["l",-5.46,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-2.19],["l",0,-2.19],["z"]],w:11.25,h:4.68},"rests.half":{d:[["M",.06,-4.62],["l",.09,-.06],["l",5.46,0],["l",5.49,0],["l",.09,.06],["l",.06,.09],["l",0,2.19],["l",0,2.19],["l",-.06,.09],["l",-.09,.06],["l",-5.49,0],["l",-5.46,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-2.19],["l",0,-2.19],["z"]],w:11.25,h:4.68},"rests.quarter":{d:[["M",1.89,-11.82],["c",.12,-.06,.24,-.06,.36,-.03],["c",.09,.06,4.74,5.58,4.86,5.82],["c",.21,.39,.15,.78,-.15,1.26],["c",-.24,.33,-.72,.81,-1.62,1.56],["c",-.45,.36,-.87,.75,-.96,.84],["c",-.93,.99,-1.14,2.49,-.6,3.63],["c",.18,.39,.27,.48,1.32,1.68],["c",1.92,2.25,1.83,2.16,1.83,2.34],["c",0,.18,-.18,.36,-.36,.39],["c",-.15,0,-.27,-.06,-.48,-.27],["c",-.75,-.75,-2.46,-1.29,-3.39,-1.08],["c",-.45,.09,-.69,.27,-.9,.69],["c",-.12,.3,-.21,.66,-.24,1.14],["c",-.03,.66,.09,1.35,.3,2.01],["c",.15,.42,.24,.66,.45,.96],["c",.18,.24,.18,.33,.03,.42],["c",-.12,.06,-.18,.03,-.45,-.3],["c",-1.08,-1.38,-2.07,-3.36,-2.4,-4.83],["c",-.27,-1.05,-.15,-1.77,.27,-2.07],["c",.21,-.12,.42,-.15,.87,-.15],["c",.87,.06,2.1,.39,3.3,.9],["l",.39,.18],["l",-1.65,-1.95],["c",-2.52,-2.97,-2.61,-3.09,-2.7,-3.27],["c",-.09,-.24,-.12,-.48,-.03,-.75],["c",.15,-.48,.57,-.96,1.83,-2.01],["c",.45,-.36,.84,-.72,.93,-.78],["c",.69,-.75,1.02,-1.8,.9,-2.79],["c",-.06,-.33,-.21,-.84,-.39,-1.11],["c",-.09,-.15,-.45,-.6,-.81,-1.05],["c",-.36,-.42,-.69,-.81,-.72,-.87],["c",-.09,-.18,0,-.42,.21,-.51],["z"]],w:7.888,h:21.435},"rests.8th":{d:[["M",1.68,-6.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.12,0,.18,0,.33,-.09],["c",.39,-.18,1.32,-1.29,1.68,-1.98],["c",.09,-.21,.24,-.3,.39,-.3],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.27,1.11,-1.86,6.42],["c",-1.02,3.48,-1.89,6.39,-1.92,6.42],["c",0,.03,-.12,.12,-.24,.15],["c",-.18,.09,-.21,.09,-.45,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.15,-.57,1.68,-4.92],["c",.96,-2.67,1.74,-4.89,1.71,-4.89],["l",-.51,.15],["c",-1.08,.36,-1.74,.48,-2.55,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:7.534,h:13.883},"rests.16th":{d:[["M",3.33,-6.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.15,.39,.57,.57,.87,.42],["c",.39,-.18,1.2,-1.23,1.62,-2.07],["c",.06,-.15,.24,-.24,.36,-.24],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.45,1.86,-2.67,10.17],["c",-1.5,5.55,-2.73,10.14,-2.76,10.17],["c",-.03,.03,-.12,.12,-.24,.15],["c",-.18,.09,-.21,.09,-.45,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.12,-.57,1.44,-4.92],["c",.81,-2.67,1.47,-4.86,1.47,-4.89],["c",-.03,0,-.27,.06,-.54,.15],["c",-1.08,.36,-1.77,.48,-2.58,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.09,.09,.27,.18,.45,.21],["c",.12,0,.18,0,.33,-.09],["c",.33,-.15,1.02,-.93,1.41,-1.59],["c",.12,-.21,.18,-.39,.39,-1.08],["c",.66,-2.1,1.17,-3.84,1.17,-3.87],["c",0,0,-.21,.06,-.42,.15],["c",-.51,.15,-1.2,.33,-1.68,.42],["c",-.33,.06,-.51,.06,-.96,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:9.724,h:21.383},"rests.32nd":{d:[["M",4.23,-13.62],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.12,0,.18,0,.27,-.06],["c",.33,-.21,.99,-1.11,1.44,-1.98],["c",.09,-.24,.21,-.33,.39,-.33],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.57,2.67,-3.21,13.89],["c",-1.8,7.62,-3.3,13.89,-3.3,13.92],["c",-.03,.06,-.12,.12,-.24,.18],["c",-.21,.09,-.24,.09,-.48,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.09,-.57,1.23,-4.92],["c",.69,-2.67,1.26,-4.86,1.29,-4.89],["c",0,-.03,-.12,-.03,-.48,.12],["c",-1.17,.39,-2.22,.57,-3,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.12,.09,.3,.18,.48,.21],["c",.12,0,.18,0,.3,-.09],["c",.42,-.21,1.29,-1.29,1.56,-1.89],["c",.03,-.12,1.23,-4.59,1.23,-4.65],["c",0,-.03,-.18,.03,-.39,.12],["c",-.63,.18,-1.2,.36,-1.74,.45],["c",-.39,.06,-.54,.06,-1.02,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.18,.18,.51,.27,.72,.15],["c",.3,-.12,.69,-.57,1.08,-1.17],["c",.42,-.6,.39,-.51,1.05,-3.03],["c",.33,-1.26,.6,-2.31,.6,-2.34],["c",0,0,-.21,.03,-.45,.12],["c",-.57,.18,-1.14,.33,-1.62,.42],["c",-.33,.06,-.51,.06,-.96,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:11.373,h:28.883},"rests.64th":{d:[["M",5.13,-13.62],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.21,.54,.3,.75,.18],["c",.24,-.12,.63,-.66,1.08,-1.56],["c",.33,-.66,.39,-.72,.6,-.72],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.69,3.66,-3.54,17.64],["c",-1.95,9.66,-3.57,17.61,-3.57,17.64],["c",-.03,.06,-.12,.12,-.24,.18],["c",-.21,.09,-.24,.09,-.48,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.06,-.57,1.05,-4.95],["c",.6,-2.7,1.08,-4.89,1.08,-4.92],["c",0,0,-.24,.06,-.51,.15],["c",-.66,.24,-1.2,.36,-1.77,.48],["c",-.42,.06,-.57,.06,-1.05,.06],["c",-.69,0,-.87,-.03,-1.35,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.09,.09,.27,.18,.45,.21],["c",.21,.03,.39,-.09,.72,-.42],["c",.45,-.45,1.02,-1.26,1.17,-1.65],["c",.03,-.09,.27,-1.14,.54,-2.34],["c",.27,-1.2,.48,-2.19,.51,-2.22],["c",0,-.03,-.09,-.03,-.48,.12],["c",-1.17,.39,-2.22,.57,-3,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.15,.39,.57,.57,.9,.42],["c",.36,-.18,1.2,-1.26,1.47,-1.89],["c",.03,-.09,.3,-1.2,.57,-2.43],["l",.51,-2.28],["l",-.54,.18],["c",-1.11,.36,-1.8,.48,-2.61,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.21,.21,.54,.3,.75,.18],["c",.36,-.18,.93,-.93,1.29,-1.68],["c",.12,-.24,.18,-.48,.63,-2.55],["l",.51,-2.31],["c",0,-.03,-.18,.03,-.39,.12],["c",-1.14,.36,-2.1,.54,-2.82,.51],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:12.453,h:36.383},"rests.128th":{d:[["M",6.03,-21.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.21,0,.33,-.06,.54,-.36],["c",.15,-.21,.54,-.93,.78,-1.47],["c",.15,-.33,.18,-.39,.3,-.48],["c",.18,-.09,.45,0,.51,.15],["c",.03,.09,-7.11,42.75,-7.17,42.84],["c",-.03,.03,-.15,.09,-.24,.15],["c",-.18,.06,-.24,.06,-.45,.06],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.03,-.57,.84,-4.98],["c",.51,-2.7,.93,-4.92,.9,-4.92],["c",0,0,-.15,.06,-.36,.12],["c",-.78,.27,-1.62,.48,-2.31,.57],["c",-.15,.03,-.54,.03,-.81,.03],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.63,.48],["c",.12,0,.18,0,.3,-.09],["c",.42,-.21,1.14,-1.11,1.5,-1.83],["c",.12,-.27,.12,-.27,.54,-2.52],["c",.24,-1.23,.42,-2.25,.39,-2.25],["c",0,0,-.24,.06,-.51,.18],["c",-1.26,.39,-2.25,.57,-3.06,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.21,.51,.3,.75,.18],["c",.36,-.15,1.05,-.99,1.41,-1.77],["l",.15,-.3],["l",.42,-2.25],["c",.21,-1.26,.42,-2.28,.39,-2.28],["l",-.51,.15],["c",-1.11,.39,-1.89,.51,-2.7,.51],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.18,.48,.27,.72,.21],["c",.33,-.12,1.14,-1.26,1.41,-1.95],["c",0,-.09,.21,-1.11,.45,-2.34],["c",.21,-1.2,.39,-2.22,.39,-2.28],["c",.03,-.03,0,-.03,-.45,.12],["c",-.57,.18,-1.2,.33,-1.71,.42],["c",-.3,.06,-.51,.06,-.93,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.18,0,.36,-.09,.57,-.33],["c",.33,-.36,.78,-1.14,.93,-1.56],["c",.03,-.12,.24,-1.2,.45,-2.4],["c",.24,-1.2,.42,-2.22,.42,-2.28],["c",.03,-.03,0,-.03,-.39,.09],["c",-1.05,.36,-1.8,.48,-2.58,.48],["c",-.63,0,-.84,-.03,-1.29,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:12.992,h:43.883},"accidentals.sharp":{d:[["M",5.73,-11.19],["c",.21,-.12,.54,-.03,.66,.24],["c",.06,.12,.06,.21,.06,2.31],["c",0,1.23,0,2.22,.03,2.22],["c",0,0,.27,-.12,.6,-.24],["c",.69,-.27,.78,-.3,.96,-.15],["c",.21,.15,.21,.18,.21,1.38],["c",0,1.02,0,1.11,-.06,1.2],["c",-.03,.06,-.09,.12,-.12,.15],["c",-.06,.03,-.42,.21,-.84,.36],["l",-.75,.33],["l",-.03,2.43],["c",0,1.32,0,2.43,.03,2.43],["c",0,0,.27,-.12,.6,-.24],["c",.69,-.27,.78,-.3,.96,-.15],["c",.21,.15,.21,.18,.21,1.38],["c",0,1.02,0,1.11,-.06,1.2],["c",-.03,.06,-.09,.12,-.12,.15],["c",-.06,.03,-.42,.21,-.84,.36],["l",-.75,.33],["l",-.03,2.52],["c",0,2.28,-.03,2.55,-.06,2.64],["c",-.21,.36,-.72,.36,-.93,0],["c",-.03,-.09,-.06,-.33,-.06,-2.43],["l",0,-2.31],["l",-1.29,.51],["l",-1.26,.51],["l",0,2.43],["c",0,2.58,0,2.52,-.15,2.67],["c",-.06,.09,-.27,.18,-.36,.18],["c",-.12,0,-.33,-.09,-.39,-.18],["c",-.15,-.15,-.15,-.09,-.15,-2.43],["c",0,-1.23,0,-2.22,-.03,-2.22],["c",0,0,-.27,.12,-.6,.24],["c",-.69,.27,-.78,.3,-.96,.15],["c",-.21,-.15,-.21,-.18,-.21,-1.38],["c",0,-1.02,0,-1.11,.06,-1.2],["c",.03,-.06,.09,-.12,.12,-.15],["c",.06,-.03,.42,-.21,.84,-.36],["l",.78,-.33],["l",0,-2.43],["c",0,-1.32,0,-2.43,-.03,-2.43],["c",0,0,-.27,.12,-.6,.24],["c",-.69,.27,-.78,.3,-.96,.15],["c",-.21,-.15,-.21,-.18,-.21,-1.38],["c",0,-1.02,0,-1.11,.06,-1.2],["c",.03,-.06,.09,-.12,.12,-.15],["c",.06,-.03,.42,-.21,.84,-.36],["l",.78,-.33],["l",0,-2.52],["c",0,-2.28,.03,-2.55,.06,-2.64],["c",.21,-.36,.72,-.36,.93,0],["c",.03,.09,.06,.33,.06,2.43],["l",.03,2.31],["l",1.26,-.51],["l",1.26,-.51],["l",0,-2.43],["c",0,-2.28,0,-2.43,.06,-2.55],["c",.06,-.12,.12,-.18,.27,-.24],["z"],["m",-.33,10.65],["l",0,-2.43],["l",-1.29,.51],["l",-1.26,.51],["l",0,2.46],["l",0,2.43],["l",.09,-.03],["c",.06,-.03,.63,-.27,1.29,-.51],["l",1.17,-.48],["l",0,-2.46],["z"]],w:8.25,h:22.462},"accidentals.halfsharp":{d:[["M",2.43,-10.05],["c",.21,-.12,.54,-.03,.66,.24],["c",.06,.12,.06,.21,.06,2.01],["c",0,1.05,0,1.89,.03,1.89],["l",.72,-.48],["c",.69,-.48,.69,-.51,.87,-.51],["c",.15,0,.18,.03,.27,.09],["c",.21,.15,.21,.18,.21,1.41],["c",0,1.11,-.03,1.14,-.09,1.23],["c",-.03,.03,-.48,.39,-1.02,.75],["l",-.99,.66],["l",0,2.37],["c",0,1.32,0,2.37,.03,2.37],["l",.72,-.48],["c",.69,-.48,.69,-.51,.87,-.51],["c",.15,0,.18,.03,.27,.09],["c",.21,.15,.21,.18,.21,1.41],["c",0,1.11,-.03,1.14,-.09,1.23],["c",-.03,.03,-.48,.39,-1.02,.75],["l",-.99,.66],["l",0,2.25],["c",0,1.95,0,2.28,-.06,2.37],["c",-.06,.12,-.12,.21,-.24,.27],["c",-.27,.12,-.54,.03,-.69,-.24],["c",-.06,-.12,-.06,-.21,-.06,-2.01],["c",0,-1.05,0,-1.89,-.03,-1.89],["l",-.72,.48],["c",-.69,.48,-.69,.48,-.87,.48],["c",-.15,0,-.18,0,-.27,-.06],["c",-.21,-.15,-.21,-.18,-.21,-1.41],["c",0,-1.11,.03,-1.14,.09,-1.23],["c",.03,-.03,.48,-.39,1.02,-.75],["l",.99,-.66],["l",0,-2.37],["c",0,-1.32,0,-2.37,-.03,-2.37],["l",-.72,.48],["c",-.69,.48,-.69,.48,-.87,.48],["c",-.15,0,-.18,0,-.27,-.06],["c",-.21,-.15,-.21,-.18,-.21,-1.41],["c",0,-1.11,.03,-1.14,.09,-1.23],["c",.03,-.03,.48,-.39,1.02,-.75],["l",.99,-.66],["l",0,-2.25],["c",0,-2.13,0,-2.28,.06,-2.4],["c",.06,-.12,.12,-.18,.27,-.24],["z"]],w:5.25,h:20.174},"accidentals.nat":{d:[["M",.21,-11.4],["c",.24,-.06,.78,0,.99,.15],["c",.03,.03,.03,.48,0,2.61],["c",-.03,1.44,-.03,2.61,-.03,2.61],["c",0,.03,.75,-.09,1.68,-.24],["c",.96,-.18,1.71,-.27,1.74,-.27],["c",.15,.03,.27,.15,.36,.3],["l",.06,.12],["l",.09,8.67],["c",.09,6.96,.12,8.67,.09,8.67],["c",-.03,.03,-.12,.06,-.21,.09],["c",-.24,.09,-.72,.09,-.96,0],["c",-.09,-.03,-.18,-.06,-.21,-.09],["c",-.03,-.03,-.03,-.48,0,-2.61],["c",.03,-1.44,.03,-2.61,.03,-2.61],["c",0,-.03,-.75,.09,-1.68,.24],["c",-.96,.18,-1.71,.27,-1.74,.27],["c",-.15,-.03,-.27,-.15,-.36,-.3],["l",-.06,-.15],["l",-.09,-7.53],["c",-.06,-4.14,-.09,-8.04,-.12,-8.67],["l",0,-1.11],["l",.15,-.06],["c",.09,-.03,.21,-.06,.27,-.09],["z"],["m",3.75,8.4],["c",0,-.33,0,-.42,-.03,-.42],["c",-.12,0,-2.79,.45,-2.79,.48],["c",-.03,0,-.09,6.3,-.09,6.33],["c",.03,0,2.79,-.45,2.82,-.48],["c",0,0,.09,-4.53,.09,-5.91],["z"]],w:5.4,h:22.8},"accidentals.flat":{d:[["M",-.36,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"]],w:6.75,h:18.801},"accidentals.halfflat":{d:[["M",4.83,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.6,-.12,9.06],["c",-.09,5.55,-.15,9.06,-.18,9.12],["c",-.03,.09,-.09,.18,-.15,.27],["c",-.24,.21,-.54,.24,-.81,.06],["c",-.06,-.03,-.27,-.24,-.45,-.42],["c",-.36,-.42,-.66,-.66,-1.8,-1.44],["c",-1.23,-.84,-1.83,-1.32,-2.25,-1.77],["c",-.66,-.78,-.96,-1.56,-.93,-2.46],["c",.09,-1.41,1.11,-2.58,2.4,-2.79],["c",.3,-.06,.84,-.03,1.23,.06],["c",.54,.12,1.08,.33,1.53,.63],["c",.12,.09,.24,.15,.24,.12],["c",0,0,-.12,-8.37,-.18,-9.75],["l",0,-.66],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",-1.65,10.95],["c",-.6,-.18,-1.08,.09,-1.38,.69],["c",-.27,.6,-.36,1.38,-.18,2.07],["c",.12,.42,.42,.99,.72,1.41],["c",.3,.42,.93,1.05,1.56,1.59],["l",.48,.39],["l",0,-.12],["c",.03,-.09,.03,-.48,.06,-.9],["c",.03,-.57,.03,-1.08,0,-2.22],["c",-.03,-1.62,-.03,-1.62,-.24,-2.07],["c",-.21,-.42,-.6,-.75,-1.02,-.84],["z"]],w:6.728,h:18.801},"accidentals.dblflat":{d:[["M",-.36,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"],["m",3,-11],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"]],w:12.1,h:18.804},"accidentals.dblsharp":{d:[["M",-.18,-3.96],["c",.06,-.03,.12,-.06,.15,-.06],["c",.09,0,2.76,.27,2.79,.3],["c",.12,.03,.15,.12,.15,.51],["c",.06,.96,.24,1.59,.57,2.1],["c",.06,.09,.15,.21,.18,.24],["l",.09,.06],["l",.09,-.06],["c",.03,-.03,.12,-.15,.18,-.24],["c",.33,-.51,.51,-1.14,.57,-2.1],["c",0,-.39,.03,-.45,.12,-.51],["c",.03,0,.66,-.09,1.44,-.15],["c",1.47,-.15,1.5,-.15,1.56,-.03],["c",.03,.06,0,.42,-.09,1.44],["c",-.09,.72,-.15,1.35,-.15,1.38],["c",0,.03,-.03,.09,-.06,.12],["c",-.06,.06,-.12,.09,-.51,.09],["c",-1.08,.06,-1.8,.3,-2.28,.75],["l",-.12,.09],["l",.09,.09],["c",.12,.15,.39,.33,.63,.45],["c",.42,.18,.96,.27,1.68,.33],["c",.39,0,.45,.03,.51,.09],["c",.03,.03,.06,.09,.06,.12],["c",0,.03,.06,.66,.15,1.38],["c",.09,1.02,.12,1.38,.09,1.44],["c",-.06,.12,-.09,.12,-1.56,-.03],["c",-.78,-.06,-1.41,-.15,-1.44,-.15],["c",-.09,-.06,-.12,-.12,-.12,-.54],["c",-.06,-.93,-.24,-1.56,-.57,-2.07],["c",-.06,-.09,-.15,-.21,-.18,-.24],["l",-.09,-.06],["l",-.09,.06],["c",-.03,.03,-.12,.15,-.18,.24],["c",-.33,.51,-.51,1.14,-.57,2.07],["c",0,.42,-.03,.48,-.12,.54],["c",-.03,0,-.66,.09,-1.44,.15],["c",-1.47,.15,-1.5,.15,-1.56,.03],["c",-.03,-.06,0,-.42,.09,-1.44],["c",.09,-.72,.15,-1.35,.15,-1.38],["c",0,-.03,.03,-.09,.06,-.12],["c",.06,-.06,.12,-.09,.51,-.09],["c",.72,-.06,1.26,-.15,1.68,-.33],["c",.24,-.12,.51,-.3,.63,-.45],["l",.09,-.09],["l",-.12,-.09],["c",-.48,-.45,-1.2,-.69,-2.28,-.75],["c",-.39,0,-.45,-.03,-.51,-.09],["c",-.03,-.03,-.06,-.09,-.06,-.12],["c",0,-.03,-.06,-.63,-.12,-1.38],["c",-.09,-.72,-.15,-1.35,-.15,-1.38],["z"]],w:7.95,h:7.977},"dots.dot":{d:[["M",1.32,-1.68],["c",.09,-.03,.27,-.06,.39,-.06],["c",.96,0,1.74,.78,1.74,1.71],["c",0,.96,-.78,1.74,-1.71,1.74],["c",-.96,0,-1.74,-.78,-1.74,-1.71],["c",0,-.78,.54,-1.5,1.32,-1.68],["z"]],w:3.45,h:3.45},"noteheads.dbl":{d:[["M",-.69,-4.02],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["c",.06,.15,.06,.18,.06,1.41],["l",0,1.23],["l",.12,-.18],["c",.72,-1.26,2.64,-2.31,4.86,-2.64],["c",.81,-.15,1.11,-.15,2.13,-.15],["c",.99,0,1.29,0,2.1,.15],["c",.75,.12,1.38,.27,2.04,.54],["c",1.35,.51,2.34,1.26,2.82,2.1],["l",.12,.18],["l",0,-1.23],["c",0,-1.2,0,-1.26,.06,-1.38],["c",.09,-.18,.15,-.24,.33,-.33],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,3.54],["l",0,3.54],["l",-.06,.15],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.06,-.12,-.06,-.18,-.06,-1.38],["l",0,-1.23],["l",-.12,.18],["c",-.48,.84,-1.47,1.59,-2.82,2.1],["c",-.84,.33,-1.71,.54,-2.85,.66],["c",-.45,.06,-2.16,.06,-2.61,0],["c",-1.14,-.12,-2.01,-.33,-2.85,-.66],["c",-1.35,-.51,-2.34,-1.26,-2.82,-2.1],["l",-.12,-.18],["l",0,1.23],["c",0,1.23,0,1.26,-.06,1.38],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["l",-.06,-.15],["l",0,-3.54],["c",0,-3.48,0,-3.54,.06,-3.66],["c",.09,-.18,.15,-.24,.33,-.33],["z"],["m",7.71,.63],["c",-.36,-.06,-.9,-.06,-1.14,0],["c",-.3,.03,-.66,.24,-.87,.42],["c",-.6,.54,-.9,1.62,-.75,2.82],["c",.12,.93,.51,1.68,1.11,2.31],["c",.75,.72,1.83,1.2,2.85,1.26],["c",1.05,.06,1.83,-.54,2.1,-1.65],["c",.21,-.9,.12,-1.95,-.24,-2.82],["c",-.36,-.81,-1.08,-1.53,-1.95,-1.95],["c",-.3,-.15,-.78,-.3,-1.11,-.39],["z"]],w:16.83,h:8.145},"noteheads.whole":{d:[["M",6.51,-4.05],["c",.51,-.03,2.01,0,2.52,.03],["c",1.41,.18,2.64,.51,3.72,1.08],["c",1.2,.63,1.95,1.41,2.19,2.31],["c",.09,.33,.09,.9,0,1.23],["c",-.24,.9,-.99,1.68,-2.19,2.31],["c",-1.08,.57,-2.28,.9,-3.75,1.08],["c",-.66,.06,-2.31,.06,-2.97,0],["c",-1.47,-.18,-2.67,-.51,-3.75,-1.08],["c",-1.2,-.63,-1.95,-1.41,-2.19,-2.31],["c",-.09,-.33,-.09,-.9,0,-1.23],["c",.24,-.9,.99,-1.68,2.19,-2.31],["c",1.2,-.63,2.61,-.99,4.23,-1.11],["z"],["m",.57,.66],["c",-.87,-.15,-1.53,0,-2.04,.51],["c",-.15,.15,-.24,.27,-.33,.48],["c",-.24,.51,-.36,1.08,-.33,1.77],["c",.03,.69,.18,1.26,.42,1.77],["c",.6,1.17,1.74,1.98,3.18,2.22],["c",1.11,.21,1.95,-.15,2.34,-.99],["c",.24,-.51,.36,-1.08,.33,-1.8],["c",-.06,-1.11,-.45,-2.04,-1.17,-2.76],["c",-.63,-.63,-1.47,-1.05,-2.4,-1.2],["z"]],w:14.985,h:8.097},"noteheads.half":{d:[["M",7.44,-4.05],["c",.06,-.03,.27,-.03,.48,-.03],["c",1.05,0,1.71,.24,2.1,.81],["c",.42,.6,.45,1.35,.18,2.4],["c",-.42,1.59,-1.14,2.73,-2.16,3.39],["c",-1.41,.93,-3.18,1.44,-5.4,1.53],["c",-1.17,.03,-1.89,-.21,-2.28,-.81],["c",-.42,-.6,-.45,-1.35,-.18,-2.4],["c",.42,-1.59,1.14,-2.73,2.16,-3.39],["c",.63,-.42,1.23,-.72,1.98,-.96],["c",.9,-.3,1.65,-.42,3.12,-.54],["z"],["m",1.29,.87],["c",-.27,-.09,-.63,-.12,-.9,-.03],["c",-.72,.24,-1.53,.69,-3.27,1.8],["c",-2.34,1.5,-3.3,2.25,-3.57,2.79],["c",-.36,.72,-.06,1.5,.66,1.77],["c",.24,.12,.69,.09,.99,0],["c",.84,-.3,1.92,-.93,4.14,-2.37],["c",1.62,-1.08,2.37,-1.71,2.61,-2.19],["c",.36,-.72,.06,-1.5,-.66,-1.77],["z"]],w:10.37,h:8.132},"noteheads.quarter":{d:[["M",6.09,-4.05],["c",.36,-.03,1.2,0,1.53,.06],["c",1.17,.24,1.89,.84,2.16,1.83],["c",.06,.18,.06,.3,.06,.66],["c",0,.45,0,.63,-.15,1.08],["c",-.66,2.04,-3.06,3.93,-5.52,4.38],["c",-.54,.09,-1.44,.09,-1.83,.03],["c",-1.23,-.27,-1.98,-.87,-2.25,-1.86],["c",-.06,-.18,-.06,-.3,-.06,-.66],["c",0,-.45,0,-.63,.15,-1.08],["c",.24,-.78,.75,-1.53,1.44,-2.22],["c",1.2,-1.2,2.85,-2.01,4.47,-2.22],["z"]],w:9.81,h:8.094},"noteheads.slash.nostem":{d:[["M",9.3,-7.77],["c",.06,-.06,.18,-.06,1.71,-.06],["l",1.65,0],["l",.09,.09],["c",.06,.06,.06,.09,.06,.15],["c",-.03,.12,-9.21,15.24,-9.3,15.33],["c",-.06,.06,-.18,.06,-1.71,.06],["l",-1.65,0],["l",-.09,-.09],["c",-.06,-.06,-.06,-.09,-.06,-.15],["c",.03,-.12,9.21,-15.24,9.3,-15.33],["z"]],w:12.81,h:15.63},"noteheads.indeterminate":{d:[["M",.78,-4.05],["c",.12,-.03,.24,-.03,.36,.03],["c",.03,.03,.93,.72,1.95,1.56],["l",1.86,1.5],["l",1.86,-1.5],["c",1.02,-.84,1.92,-1.53,1.95,-1.56],["c",.21,-.12,.33,-.09,.75,.24],["c",.3,.27,.36,.36,.36,.54],["c",0,.03,-.03,.12,-.06,.18],["c",-.03,.06,-.9,.75,-1.89,1.56],["l",-1.8,1.47],["c",0,.03,.81,.69,1.8,1.5],["c",.99,.81,1.86,1.5,1.89,1.56],["c",.03,.06,.06,.15,.06,.18],["c",0,.18,-.06,.27,-.36,.54],["c",-.42,.33,-.54,.36,-.75,.24],["c",-.03,-.03,-.93,-.72,-1.95,-1.56],["l",-1.86,-1.5],["l",-1.86,1.5],["c",-1.02,.84,-1.92,1.53,-1.95,1.56],["c",-.21,.12,-.33,.09,-.75,-.24],["c",-.3,-.27,-.36,-.36,-.36,-.54],["c",0,-.03,.03,-.12,.06,-.18],["c",.03,-.06,.9,-.75,1.89,-1.56],["l",1.8,-1.47],["c",0,-.03,-.81,-.69,-1.8,-1.5],["c",-.99,-.81,-1.86,-1.5,-1.89,-1.56],["c",-.06,-.12,-.09,-.21,-.03,-.36],["c",.03,-.09,.57,-.57,.72,-.63],["z"]],w:9.843,h:8.139},"scripts.ufermata":{d:[["M",-.75,-10.77],["c",.12,0,.45,-.03,.69,-.03],["c",2.91,-.03,5.55,1.53,7.41,4.35],["c",1.17,1.71,1.95,3.72,2.43,6.03],["c",.12,.51,.12,.57,.03,.69],["c",-.12,.21,-.48,.27,-.69,.12],["c",-.12,-.09,-.18,-.24,-.27,-.69],["c",-.78,-3.63,-3.42,-6.54,-6.78,-7.38],["c",-.78,-.21,-1.2,-.24,-2.07,-.24],["c",-.63,0,-.84,0,-1.2,.06],["c",-1.83,.27,-3.42,1.08,-4.8,2.37],["c",-1.41,1.35,-2.4,3.21,-2.85,5.19],["c",-.09,.45,-.15,.6,-.27,.69],["c",-.21,.15,-.57,.09,-.69,-.12],["c",-.09,-.12,-.09,-.18,.03,-.69],["c",.33,-1.62,.78,-3,1.47,-4.38],["c",1.77,-3.54,4.44,-5.67,7.56,-5.97],["z"],["m",.33,7.47],["c",1.38,-.3,2.58,.9,2.31,2.25],["c",-.15,.72,-.78,1.35,-1.47,1.5],["c",-1.38,.27,-2.58,-.93,-2.31,-2.31],["c",.15,-.69,.78,-1.29,1.47,-1.44],["z"]],w:19.748,h:11.289},"scripts.dfermata":{d:[["M",-9.63,-.42],["c",.15,-.09,.36,-.06,.51,.03],["c",.12,.09,.18,.24,.27,.66],["c",.78,3.66,3.42,6.57,6.78,7.41],["c",.78,.21,1.2,.24,2.07,.24],["c",.63,0,.84,0,1.2,-.06],["c",1.83,-.27,3.42,-1.08,4.8,-2.37],["c",1.41,-1.35,2.4,-3.21,2.85,-5.22],["c",.09,-.42,.15,-.57,.27,-.66],["c",.21,-.15,.57,-.09,.69,.12],["c",.09,.12,.09,.18,-.03,.69],["c",-.33,1.62,-.78,3,-1.47,4.38],["c",-1.92,3.84,-4.89,6,-8.31,6],["c",-3.42,0,-6.39,-2.16,-8.31,-6],["c",-.48,-.96,-.84,-1.92,-1.14,-2.97],["c",-.18,-.69,-.42,-1.74,-.42,-1.92],["c",0,-.12,.09,-.27,.24,-.33],["z"],["m",9.21,0],["c",1.2,-.27,2.34,.63,2.34,1.86],["c",0,.9,-.66,1.68,-1.5,1.89],["c",-1.38,.27,-2.58,-.93,-2.31,-2.31],["c",.15,-.69,.78,-1.29,1.47,-1.44],["z"]],w:19.744,h:11.274},"scripts.sforzato":{d:[["M",-6.45,-3.69],["c",.06,-.03,.15,-.06,.18,-.06],["c",.06,0,2.85,.72,6.24,1.59],["l",6.33,1.65],["c",.33,.06,.45,.21,.45,.51],["c",0,.3,-.12,.45,-.45,.51],["l",-6.33,1.65],["c",-3.39,.87,-6.18,1.59,-6.21,1.59],["c",-.21,0,-.48,-.24,-.51,-.45],["c",0,-.15,.06,-.36,.18,-.45],["c",.09,-.06,.87,-.27,3.84,-1.05],["c",2.04,-.54,3.84,-.99,4.02,-1.02],["c",.15,-.06,1.14,-.24,2.22,-.42],["c",1.05,-.18,1.92,-.36,1.92,-.36],["c",0,0,-.87,-.18,-1.92,-.36],["c",-1.08,-.18,-2.07,-.36,-2.22,-.42],["c",-.18,-.03,-1.98,-.48,-4.02,-1.02],["c",-2.97,-.78,-3.75,-.99,-3.84,-1.05],["c",-.12,-.09,-.18,-.3,-.18,-.45],["c",.03,-.15,.15,-.3,.3,-.39],["z"]],w:13.5,h:7.5},"scripts.staccato":{d:[["M",-.36,-1.47],["c",.93,-.21,1.86,.51,1.86,1.47],["c",0,.93,-.87,1.65,-1.8,1.47],["c",-.54,-.12,-1.02,-.57,-1.14,-1.08],["c",-.21,-.81,.27,-1.65,1.08,-1.86],["z"]],w:2.989,h:3.004},"scripts.tenuto":{d:[["M",-4.2,-.48],["l",.12,-.06],["l",4.08,0],["l",4.08,0],["l",.12,.06],["c",.39,.21,.39,.75,0,.96],["l",-.12,.06],["l",-4.08,0],["l",-4.08,0],["l",-.12,-.06],["c",-.39,-.21,-.39,-.75,0,-.96],["z"]],w:8.985,h:1.08},"scripts.umarcato":{d:[["M",-.15,-8.19],["c",.15,-.12,.36,-.03,.45,.15],["c",.21,.42,3.45,7.65,3.45,7.71],["c",0,.12,-.12,.27,-.21,.3],["c",-.03,.03,-.51,.03,-1.14,.03],["c",-1.05,0,-1.08,0,-1.17,-.06],["c",-.09,-.06,-.24,-.36,-1.17,-2.4],["c",-.57,-1.29,-1.05,-2.34,-1.08,-2.34],["c",0,-.03,-.51,1.02,-1.08,2.34],["c",-.93,2.07,-1.08,2.34,-1.14,2.4],["c",-.06,.03,-.15,.06,-.18,.06],["c",-.15,0,-.33,-.18,-.33,-.33],["c",0,-.06,3.24,-7.32,3.45,-7.71],["c",.03,-.06,.09,-.15,.15,-.15],["z"]],w:7.5,h:8.245},"scripts.dmarcato":{d:[["M",-3.57,.03],["c",.03,0,.57,-.03,1.17,-.03],["c",1.05,0,1.08,0,1.17,.06],["c",.09,.06,.24,.36,1.17,2.4],["c",.57,1.29,1.05,2.34,1.08,2.34],["c",0,.03,.51,-1.02,1.08,-2.34],["c",.93,-2.07,1.08,-2.34,1.14,-2.4],["c",.06,-.03,.15,-.06,.18,-.06],["c",.15,0,.33,.18,.33,.33],["c",0,.09,-3.45,7.74,-3.54,7.83],["c",-.12,.12,-.3,.12,-.42,0],["c",-.09,-.09,-3.54,-7.74,-3.54,-7.83],["c",0,-.09,.12,-.27,.18,-.3],["z"]],w:7.5,h:8.25},"scripts.stopped":{d:[["M",-.27,-4.08],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,1.5],["l",0,1.47],["l",1.47,0],["l",1.5,0],["l",.15,.06],["c",.15,.09,.21,.15,.3,.33],["c",.09,.18,.09,.36,0,.54],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.12,.06,-.18,.06,-1.62,.06],["l",-1.47,0],["l",0,1.47],["l",0,1.47],["l",-.06,.15],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["l",-.06,-.15],["l",0,-1.47],["l",0,-1.47],["l",-1.47,0],["c",-1.44,0,-1.5,0,-1.62,-.06],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.09,-.36,0,-.54],["c",.09,-.18,.15,-.24,.33,-.33],["l",.15,-.06],["l",1.47,0],["l",1.47,0],["l",0,-1.47],["c",0,-1.44,0,-1.5,.06,-1.62],["c",.09,-.18,.15,-.24,.33,-.33],["z"]],w:8.295,h:8.295},"scripts.upbow":{d:[["M",-4.65,-15.54],["c",.12,-.09,.36,-.06,.48,.03],["c",.03,.03,.09,.09,.12,.15],["c",.03,.06,.66,2.13,1.41,4.62],["c",1.35,4.41,1.38,4.56,2.01,6.96],["l",.63,2.46],["l",.63,-2.46],["c",.63,-2.4,.66,-2.55,2.01,-6.96],["c",.75,-2.49,1.38,-4.56,1.41,-4.62],["c",.06,-.15,.18,-.21,.36,-.24],["c",.15,0,.3,.06,.39,.18],["c",.15,.21,.24,-.18,-2.1,7.56],["c",-1.2,3.96,-2.22,7.32,-2.25,7.41],["c",0,.12,-.06,.27,-.09,.3],["c",-.12,.21,-.6,.21,-.72,0],["c",-.03,-.03,-.09,-.18,-.09,-.3],["c",-.03,-.09,-1.05,-3.45,-2.25,-7.41],["c",-2.34,-7.74,-2.25,-7.35,-2.1,-7.56],["c",.03,-.03,.09,-.09,.15,-.12],["z"]],w:9.73,h:15.608},"scripts.downbow":{d:[["M",-5.55,-9.93],["l",.09,-.06],["l",5.46,0],["l",5.46,0],["l",.09,.06],["l",.06,.09],["l",0,4.77],["c",0,5.28,0,4.89,-.18,5.01],["c",-.18,.12,-.42,.06,-.54,-.12],["c",-.06,-.09,-.06,-.18,-.06,-2.97],["l",0,-2.85],["l",-4.83,0],["l",-4.83,0],["l",0,2.85],["c",0,2.79,0,2.88,-.06,2.97],["c",-.15,.24,-.51,.24,-.66,0],["c",-.06,-.09,-.06,-.21,-.06,-4.89],["l",0,-4.77],["z"]],w:11.22,h:9.992},"scripts.turn":{d:[["M",-4.77,-3.9],["c",.36,-.06,1.05,-.06,1.44,.03],["c",.78,.15,1.5,.51,2.34,1.14],["c",.6,.45,1.05,.87,2.22,2.01],["c",1.11,1.08,1.62,1.5,2.22,1.86],["c",.6,.36,1.32,.57,1.92,.57],["c",.9,0,1.71,-.57,1.89,-1.35],["c",.24,-.93,-.39,-1.89,-1.35,-2.1],["l",-.15,-.06],["l",-.09,.15],["c",-.03,.09,-.15,.24,-.24,.33],["c",-.72,.72,-2.04,.54,-2.49,-.36],["c",-.48,-.93,.03,-1.86,1.17,-2.19],["c",.3,-.09,1.02,-.09,1.35,0],["c",.99,.27,1.74,.87,2.25,1.83],["c",.69,1.41,.63,3,-.21,4.26],["c",-.21,.3,-.69,.81,-.99,1.02],["c",-.3,.21,-.84,.45,-1.17,.54],["c",-1.23,.36,-2.49,.15,-3.72,-.6],["c",-.75,-.48,-1.41,-1.02,-2.85,-2.46],["c",-1.11,-1.08,-1.62,-1.5,-2.22,-1.86],["c",-.6,-.36,-1.32,-.57,-1.92,-.57],["c",-.9,0,-1.71,.57,-1.89,1.35],["c",-.24,.93,.39,1.89,1.35,2.1],["l",.15,.06],["l",.09,-.15],["c",.03,-.09,.15,-.24,.24,-.33],["c",.72,-.72,2.04,-.54,2.49,.36],["c",.48,.93,-.03,1.86,-1.17,2.19],["c",-.3,.09,-1.02,.09,-1.35,0],["c",-.99,-.27,-1.74,-.87,-2.25,-1.83],["c",-.69,-1.41,-.63,-3,.21,-4.26],["c",.21,-.3,.69,-.81,.99,-1.02],["c",.48,-.33,1.11,-.57,1.74,-.66],["z"]],w:16.366,h:7.893},"scripts.trill":{d:[["M",-.51,-16.02],["c",.12,-.09,.21,-.18,.21,-.18],["l",-.81,4.02],["l",-.81,4.02],["c",.03,0,.51,-.27,1.08,-.6],["c",.6,-.3,1.14,-.63,1.26,-.66],["c",1.14,-.54,2.31,-.6,3.09,-.18],["c",.27,.15,.54,.36,.6,.51],["l",.06,.12],["l",.21,-.21],["c",.9,-.81,2.22,-.99,3.12,-.42],["c",.6,.42,.9,1.14,.78,2.07],["c",-.15,1.29,-1.05,2.31,-1.95,2.25],["c",-.48,-.03,-.78,-.3,-.96,-.81],["c",-.09,-.27,-.09,-.9,-.03,-1.2],["c",.21,-.75,.81,-1.23,1.59,-1.32],["l",.24,-.03],["l",-.09,-.12],["c",-.51,-.66,-1.62,-.63,-2.31,.03],["c",-.39,.42,-.3,.09,-1.23,4.77],["l",-.81,4.14],["c",-.03,0,-.12,-.03,-.21,-.09],["c",-.33,-.15,-.54,-.18,-.99,-.18],["c",-.42,0,-.66,.03,-1.05,.18],["c",-.12,.06,-.21,.09,-.21,.09],["c",0,-.03,.36,-1.86,.81,-4.11],["c",.9,-4.47,.87,-4.26,.69,-4.53],["c",-.21,-.36,-.66,-.51,-1.17,-.36],["c",-.15,.06,-2.22,1.14,-2.58,1.38],["c",-.12,.09,-.12,.09,-.21,.6],["l",-.09,.51],["l",.21,.24],["c",.63,.75,1.02,1.47,1.2,2.19],["c",.06,.27,.06,.36,.06,.81],["c",0,.42,0,.54,-.06,.78],["c",-.15,.54,-.33,.93,-.63,1.35],["c",-.18,.24,-.57,.63,-.81,.78],["c",-.24,.15,-.63,.36,-.84,.42],["c",-.27,.06,-.66,.06,-.87,.03],["c",-.81,-.18,-1.32,-1.05,-1.38,-2.46],["c",-.03,-.6,.03,-.99,.33,-2.46],["c",.21,-1.08,.24,-1.32,.21,-1.29],["c",-1.2,.48,-2.4,.75,-3.21,.72],["c",-.69,-.06,-1.17,-.3,-1.41,-.72],["c",-.39,-.75,-.12,-1.8,.66,-2.46],["c",.24,-.18,.69,-.42,1.02,-.51],["c",.69,-.18,1.53,-.15,2.31,.09],["c",.3,.09,.75,.3,.99,.45],["c",.12,.09,.15,.09,.15,.03],["c",.03,-.03,.33,-1.59,.72,-3.45],["c",.36,-1.86,.66,-3.42,.69,-3.45],["c",0,-.03,.03,-.03,.21,.03],["c",.21,.06,.27,.06,.48,.06],["c",.42,-.03,.78,-.18,1.26,-.48],["c",.15,-.12,.36,-.27,.48,-.39],["z"],["m",-5.73,7.68],["c",-.27,-.03,-.96,-.06,-1.2,-.03],["c",-.81,.12,-1.35,.57,-1.5,1.2],["c",-.18,.66,.12,1.14,.75,1.29],["c",.66,.12,1.92,-.12,3.18,-.66],["l",.33,-.15],["l",.09,-.39],["c",.06,-.21,.09,-.42,.09,-.45],["c",0,-.03,-.45,-.3,-.75,-.45],["c",-.27,-.15,-.66,-.27,-.99,-.36],["z"],["m",4.29,3.63],["c",-.24,-.39,-.51,-.75,-.51,-.69],["c",-.06,.12,-.39,1.92,-.45,2.28],["c",-.09,.54,-.12,1.14,-.06,1.38],["c",.06,.42,.21,.6,.51,.57],["c",.39,-.06,.75,-.48,.93,-1.14],["c",.09,-.33,.09,-1.05,0,-1.38],["c",-.09,-.39,-.24,-.69,-.42,-1.02],["z"]],w:17.963,h:16.49},"scripts.segno":{d:[["M",-3.72,-11.22],["c",.78,-.09,1.59,.03,2.31,.42],["c",1.2,.6,2.01,1.71,2.31,3.09],["c",.09,.42,.09,1.2,.03,1.5],["c",-.15,.45,-.39,.81,-.66,.93],["c",-.33,.18,-.84,.21,-1.23,.15],["c",-.81,-.18,-1.32,-.93,-1.26,-1.89],["c",.03,-.36,.09,-.57,.24,-.9],["c",.15,-.33,.45,-.6,.72,-.75],["c",.12,-.06,.18,-.09,.18,-.12],["c",0,-.03,-.03,-.15,-.09,-.24],["c",-.18,-.45,-.54,-.87,-.96,-1.08],["c",-1.11,-.57,-2.34,-.18,-2.88,.9],["c",-.24,.51,-.33,1.11,-.24,1.83],["c",.27,1.92,1.5,3.54,3.93,5.13],["c",.48,.33,1.26,.78,1.29,.78],["c",.03,0,1.35,-2.19,2.94,-4.89],["l",2.88,-4.89],["l",.84,0],["l",.87,0],["l",-.03,.06],["c",-.15,.21,-6.15,10.41,-6.15,10.44],["c",0,0,.21,.15,.48,.27],["c",2.61,1.47,4.35,3.03,5.13,4.65],["c",1.14,2.34,.51,5.07,-1.44,6.39],["c",-.66,.42,-1.32,.63,-2.13,.69],["c",-2.01,.09,-3.81,-1.41,-4.26,-3.54],["c",-.09,-.42,-.09,-1.2,-.03,-1.5],["c",.15,-.45,.39,-.81,.66,-.93],["c",.33,-.18,.84,-.21,1.23,-.15],["c",.81,.18,1.32,.93,1.26,1.89],["c",-.03,.36,-.09,.57,-.24,.9],["c",-.15,.33,-.45,.6,-.72,.75],["c",-.12,.06,-.18,.09,-.18,.12],["c",0,.03,.03,.15,.09,.24],["c",.18,.45,.54,.87,.96,1.08],["c",1.11,.57,2.34,.18,2.88,-.9],["c",.24,-.51,.33,-1.11,.24,-1.83],["c",-.27,-1.92,-1.5,-3.54,-3.93,-5.13],["c",-.48,-.33,-1.26,-.78,-1.29,-.78],["c",-.03,0,-1.35,2.19,-2.91,4.89],["l",-2.88,4.89],["l",-.87,0],["l",-.87,0],["l",.03,-.06],["c",.15,-.21,6.15,-10.41,6.15,-10.44],["c",0,0,-.21,-.15,-.48,-.3],["c",-2.61,-1.44,-4.35,-3,-5.13,-4.62],["c",-.9,-1.89,-.72,-4.02,.48,-5.52],["c",.69,-.84,1.68,-1.41,2.73,-1.53],["z"],["m",8.76,9.09],["c",.03,-.03,.15,-.03,.27,-.03],["c",.33,.03,.57,.18,.72,.48],["c",.09,.18,.09,.57,0,.75],["c",-.09,.18,-.21,.3,-.36,.39],["c",-.15,.06,-.21,.06,-.39,.06],["c",-.21,0,-.27,0,-.39,-.06],["c",-.3,-.15,-.48,-.45,-.48,-.75],["c",0,-.39,.24,-.72,.63,-.84],["z"],["m",-10.53,2.61],["c",.03,-.03,.15,-.03,.27,-.03],["c",.33,.03,.57,.18,.72,.48],["c",.09,.18,.09,.57,0,.75],["c",-.09,.18,-.21,.3,-.36,.39],["c",-.15,.06,-.21,.06,-.39,.06],["c",-.21,0,-.27,0,-.39,-.06],["c",-.3,-.15,-.48,-.45,-.48,-.75],["c",0,-.39,.24,-.72,.63,-.84],["z"]],w:15,h:22.504},"scripts.coda":{d:[["M",-.21,-10.47],["c",.18,-.12,.42,-.06,.54,.12],["c",.06,.09,.06,.18,.06,1.5],["l",0,1.38],["l",.18,0],["c",.39,.06,.96,.24,1.38,.48],["c",1.68,.93,2.82,3.24,3.03,6.12],["c",.03,.24,.03,.45,.03,.45],["c",0,.03,.6,.03,1.35,.03],["c",1.5,0,1.47,0,1.59,.18],["c",.09,.12,.09,.3,0,.42],["c",-.12,.18,-.09,.18,-1.59,.18],["c",-.75,0,-1.35,0,-1.35,.03],["c",0,0,0,.21,-.03,.42],["c",-.24,3.15,-1.53,5.58,-3.45,6.36],["c",-.27,.12,-.72,.24,-.96,.27],["l",-.18,0],["l",0,1.38],["c",0,1.32,0,1.41,-.06,1.5],["c",-.15,.24,-.51,.24,-.66,0],["c",-.06,-.09,-.06,-.18,-.06,-1.5],["l",0,-1.38],["l",-.18,0],["c",-.39,-.06,-.96,-.24,-1.38,-.48],["c",-1.68,-.93,-2.82,-3.24,-3.03,-6.15],["c",-.03,-.21,-.03,-.42,-.03,-.42],["c",0,-.03,-.6,-.03,-1.35,-.03],["c",-1.5,0,-1.47,0,-1.59,-.18],["c",-.09,-.12,-.09,-.3,0,-.42],["c",.12,-.18,.09,-.18,1.59,-.18],["c",.75,0,1.35,0,1.35,-.03],["c",0,0,0,-.21,.03,-.45],["c",.24,-3.12,1.53,-5.55,3.45,-6.33],["c",.27,-.12,.72,-.24,.96,-.27],["l",.18,0],["l",0,-1.38],["c",0,-1.53,0,-1.5,.18,-1.62],["z"],["m",-.18,6.93],["c",0,-2.97,0,-3.15,-.06,-3.15],["c",-.09,0,-.51,.15,-.66,.21],["c",-.87,.51,-1.38,1.62,-1.56,3.51],["c",-.06,.54,-.12,1.59,-.12,2.16],["l",0,.42],["l",1.2,0],["l",1.2,0],["l",0,-3.15],["z"],["m",1.17,-3.06],["c",-.09,-.03,-.21,-.06,-.27,-.09],["l",-.12,0],["l",0,3.15],["l",0,3.15],["l",1.2,0],["l",1.2,0],["l",0,-.81],["c",-.06,-2.4,-.33,-3.69,-.93,-4.59],["c",-.27,-.39,-.66,-.69,-1.08,-.81],["z"],["m",-1.17,10.14],["l",0,-3.15],["l",-1.2,0],["l",-1.2,0],["l",0,.81],["c",.03,.96,.06,1.47,.15,2.13],["c",.24,2.04,.96,3.12,2.13,3.36],["l",.12,0],["l",0,-3.15],["z"],["m",3.18,-2.34],["l",0,-.81],["l",-1.2,0],["l",-1.2,0],["l",0,3.15],["l",0,3.15],["l",.12,0],["c",1.17,-.24,1.89,-1.32,2.13,-3.36],["c",.09,-.66,.12,-1.17,.15,-2.13],["z"]],w:16.035,h:21.062},"scripts.comma":{d:[["M",1.14,-4.62],["c",.3,-.12,.69,-.03,.93,.15],["c",.12,.12,.36,.45,.51,.78],["c",.9,1.77,.54,4.05,-1.08,6.75],["c",-.36,.63,-.87,1.38,-.96,1.44],["c",-.18,.12,-.42,.06,-.54,-.12],["c",-.09,-.18,-.09,-.3,.12,-.6],["c",.96,-1.44,1.44,-2.97,1.38,-4.35],["c",-.06,-.93,-.3,-1.68,-.78,-2.46],["c",-.27,-.39,-.33,-.63,-.24,-.96],["c",.09,-.27,.36,-.54,.66,-.63],["z"]],w:3.042,h:9.237},"scripts.roll":{d:[["M",1.95,-6],["c",.21,-.09,.36,-.09,.57,0],["c",.39,.15,.63,.39,1.47,1.35],["c",.66,.75,.78,.87,1.08,1.05],["c",.75,.45,1.65,.42,2.4,-.06],["c",.12,-.09,.27,-.27,.54,-.6],["c",.42,-.54,.51,-.63,.69,-.63],["c",.09,0,.3,.12,.36,.21],["c",.09,.12,.12,.3,.03,.42],["c",-.06,.12,-3.15,3.9,-3.3,4.08],["c",-.06,.06,-.18,.12,-.27,.18],["c",-.27,.12,-.6,.06,-.99,-.27],["c",-.27,-.21,-.42,-.39,-1.08,-1.14],["c",-.63,-.72,-.81,-.9,-1.17,-1.08],["c",-.36,-.18,-.57,-.21,-.99,-.21],["c",-.39,0,-.63,.03,-.93,.18],["c",-.36,.15,-.51,.27,-.9,.81],["c",-.24,.27,-.45,.51,-.48,.54],["c",-.12,.09,-.27,.06,-.39,0],["c",-.24,-.15,-.33,-.39,-.21,-.6],["c",.09,-.12,3.18,-3.87,3.33,-4.02],["c",.06,-.06,.18,-.15,.24,-.21],["z"]],w:10.817,h:6.125},"scripts.prall":{d:[["M",-4.38,-3.69],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["c",.03,0,.57,-.84,1.23,-1.83],["c",1.14,-1.68,1.23,-1.83,1.35,-1.89],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["l",.48,-.69],["c",.51,-.78,.54,-.84,.69,-.9],["c",.42,-.18,.87,.15,.81,.6],["c",-.03,.12,-.3,.51,-1.5,2.37],["c",-1.38,2.07,-1.5,2.22,-1.62,2.28],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["c",-.03,0,-.57,.84,-1.23,1.83],["c",-1.14,1.68,-1.23,1.83,-1.35,1.89],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["l",-.48,.69],["c",-.51,.78,-.54,.84,-.69,.9],["c",-.42,.18,-.87,-.15,-.81,-.6],["c",.03,-.12,.3,-.51,1.5,-2.37],["c",1.38,-2.07,1.5,-2.22,1.62,-2.28],["z"]],w:15.011,h:7.5},"scripts.arpeggio":{d:[["M",1.5,0],["c",1.5,2,1.5,3,1.5,3],["s",0,1,-2,1.5],["s",-.5,3,1,5.5],["l",1.5,0],["s",-1.75,-2,-1.9,-3.25],["s",2.15,-.6,2.95,-1.6],["s",.45,-1,.5,-1.25],["s",0,-1,-2,-3.9],["l",-1.5,0],["z"]],w:5,h:10},"scripts.mordent":{d:[["M",-.21,-4.95],["c",.27,-.15,.63,0,.75,.27],["c",.06,.12,.06,.24,.06,1.44],["l",0,1.29],["l",.57,-.84],["c",.51,-.75,.57,-.84,.69,-.9],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["l",.48,-.69],["c",.51,-.78,.54,-.84,.69,-.9],["c",.42,-.18,.87,.15,.81,.6],["c",-.03,.12,-.3,.51,-1.5,2.37],["c",-1.38,2.07,-1.5,2.22,-1.62,2.28],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.83,-1.89],["c",-.81,-.99,-1.5,-1.8,-1.53,-1.86],["c",-.06,-.03,-.06,-.03,-.12,.03],["c",-.06,.06,-.06,.15,-.06,2.28],["c",0,1.95,0,2.25,-.06,2.34],["c",-.18,.45,-.81,.48,-1.05,.03],["c",-.03,-.06,-.06,-.24,-.06,-1.41],["l",0,-1.35],["l",-.57,.84],["c",-.54,.78,-.6,.87,-.72,.93],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["l",-.48,.69],["c",-.51,.78,-.54,.84,-.69,.9],["c",-.42,.18,-.87,-.15,-.81,-.6],["c",.03,-.12,.3,-.51,1.5,-2.37],["c",1.38,-2.07,1.5,-2.22,1.62,-2.28],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["c",.03,0,.06,-.06,.09,-.09],["c",.06,-.12,.06,-.15,.06,-2.28],["c",0,-1.92,0,-2.22,.06,-2.31],["c",.06,-.15,.15,-.24,.3,-.3],["z"]],w:15.011,h:10.012},"flags.u8th":{d:[["M",-.42,3.75],["l",0,-3.75],["l",.21,0],["l",.21,0],["l",0,.18],["c",0,.3,.06,.84,.12,1.23],["c",.24,1.53,.9,3.12,2.13,5.16],["l",.99,1.59],["c",.87,1.44,1.38,2.34,1.77,3.09],["c",.81,1.68,1.2,3.06,1.26,4.53],["c",.03,1.53,-.21,3.27,-.75,5.01],["c",-.21,.69,-.51,1.5,-.6,1.59],["c",-.09,.12,-.27,.21,-.42,.21],["c",-.15,0,-.42,-.12,-.51,-.21],["c",-.15,-.18,-.18,-.42,-.09,-.66],["c",.15,-.33,.45,-1.2,.57,-1.62],["c",.42,-1.38,.6,-2.58,.6,-3.9],["c",0,-.66,0,-.81,-.06,-1.11],["c",-.39,-2.07,-1.8,-4.26,-4.59,-7.14],["l",-.42,-.45],["l",-.21,0],["l",-.21,0],["l",0,-3.75],["z"]],w:6.692,h:22.59},"flags.u16th":{d:[["M",-.42,7.5],["l",0,-7.5],["l",.21,0],["l",.21,0],["l",0,.39],["c",.06,1.08,.39,2.19,.99,3.39],["c",.45,.9,.87,1.59,1.95,3.12],["c",1.29,1.86,1.77,2.64,2.22,3.57],["c",.45,.93,.72,1.8,.87,2.64],["c",.06,.51,.06,1.5,0,1.92],["c",-.12,.6,-.3,1.2,-.54,1.71],["l",-.09,.24],["l",.18,.45],["c",.51,1.2,.72,2.22,.69,3.42],["c",-.06,1.53,-.39,3.03,-.99,4.53],["c",-.3,.75,-.36,.81,-.57,.9],["c",-.15,.09,-.33,.06,-.48,0],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.12,-.75],["c",.66,-1.41,1.02,-2.88,1.08,-4.32],["c",0,-.6,-.03,-1.05,-.18,-1.59],["c",-.3,-1.2,-.99,-2.4,-2.25,-3.87],["c",-.42,-.48,-1.53,-1.62,-2.19,-2.22],["l",-.45,-.42],["l",-.03,1.11],["l",0,1.11],["l",-.21,0],["l",-.21,0],["l",0,-7.5],["z"],["m",1.65,.09],["c",-.3,-.3,-.69,-.72,-.9,-.87],["l",-.33,-.33],["l",0,.15],["c",0,.3,.06,.81,.15,1.26],["c",.27,1.29,.87,2.61,2.04,4.29],["c",.15,.24,.6,.87,.96,1.38],["l",1.08,1.53],["l",.42,.63],["c",.03,0,.12,-.36,.21,-.72],["c",.06,-.33,.06,-1.2,0,-1.62],["c",-.33,-1.71,-1.44,-3.48,-3.63,-5.7],["z"]],w:6.693,h:26.337},"flags.u32nd":{d:[["M",-.42,11.25],["l",0,-11.25],["l",.21,0],["l",.21,0],["l",0,.36],["c",.09,1.68,.69,3.27,2.07,5.46],["l",.87,1.35],["c",1.02,1.62,1.47,2.37,1.86,3.18],["c",.48,1.02,.78,1.92,.93,2.88],["c",.06,.48,.06,1.5,0,1.89],["c",-.09,.42,-.21,.87,-.36,1.26],["l",-.12,.3],["l",.15,.39],["c",.69,1.56,.84,2.88,.54,4.38],["c",-.09,.45,-.27,1.08,-.45,1.47],["l",-.12,.24],["l",.18,.36],["c",.33,.72,.57,1.56,.69,2.34],["c",.12,1.02,-.06,2.52,-.42,3.84],["c",-.27,.93,-.75,2.13,-.93,2.31],["c",-.18,.15,-.45,.18,-.66,.09],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.06,-.6],["c",.21,-.36,.42,-.9,.57,-1.38],["c",.51,-1.41,.69,-3.06,.48,-4.08],["c",-.15,-.81,-.57,-1.68,-1.2,-2.55],["c",-.72,-.99,-1.83,-2.13,-3.3,-3.33],["l",-.48,-.42],["l",-.03,1.53],["l",0,1.56],["l",-.21,0],["l",-.21,0],["l",0,-11.25],["z"],["m",1.26,-3.96],["c",-.27,-.3,-.54,-.6,-.66,-.72],["l",-.18,-.21],["l",0,.42],["c",.06,.87,.24,1.74,.66,2.67],["c",.36,.87,.96,1.86,1.92,3.18],["c",.21,.33,.63,.87,.87,1.23],["c",.27,.39,.6,.84,.75,1.08],["l",.27,.39],["l",.03,-.12],["c",.12,-.45,.15,-1.05,.09,-1.59],["c",-.27,-1.86,-1.38,-3.78,-3.75,-6.33],["z"],["m",-.27,6.09],["c",-.27,-.21,-.48,-.42,-.51,-.45],["c",-.06,-.03,-.06,-.03,-.06,.21],["c",0,.9,.3,2.04,.81,3.09],["c",.48,1.02,.96,1.77,2.37,3.63],["c",.6,.78,1.05,1.44,1.29,1.77],["c",.06,.12,.15,.21,.15,.18],["c",.03,-.03,.18,-.57,.24,-.87],["c",.06,-.45,.06,-1.32,-.03,-1.74],["c",-.09,-.48,-.24,-.9,-.51,-1.44],["c",-.66,-1.35,-1.83,-2.7,-3.75,-4.38],["z"]],w:6.697,h:32.145},"flags.u64th":{d:[["M",-.42,15],["l",0,-15],["l",.21,0],["l",.21,0],["l",0,.36],["c",.06,1.2,.39,2.37,1.02,3.66],["c",.39,.81,.84,1.56,1.8,3.09],["c",.81,1.26,1.05,1.68,1.35,2.22],["c",.87,1.5,1.35,2.79,1.56,4.08],["c",.06,.54,.06,1.56,-.03,2.04],["c",-.09,.48,-.21,.99,-.36,1.35],["l",-.12,.27],["l",.12,.27],["c",.09,.15,.21,.45,.27,.66],["c",.69,1.89,.63,3.66,-.18,5.46],["l",-.18,.39],["l",.15,.33],["c",.3,.66,.51,1.44,.63,2.1],["c",.06,.48,.06,1.35,0,1.71],["c",-.15,.57,-.42,1.2,-.78,1.68],["l",-.21,.27],["l",.18,.33],["c",.57,1.05,.93,2.13,1.02,3.18],["c",.06,.72,0,1.83,-.21,2.79],["c",-.18,1.02,-.63,2.34,-1.02,3.09],["c",-.15,.33,-.48,.45,-.78,.3],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.03,-.54],["c",.75,-1.5,1.23,-3.45,1.17,-4.89],["c",-.06,-1.02,-.42,-2.01,-1.17,-3.15],["c",-.48,-.72,-1.02,-1.35,-1.89,-2.22],["c",-.57,-.57,-1.56,-1.5,-1.92,-1.77],["l",-.12,-.09],["l",0,1.68],["l",0,1.68],["l",-.21,0],["l",-.21,0],["l",0,-15],["z"],["m",.93,-8.07],["c",-.27,-.3,-.48,-.54,-.51,-.54],["c",0,0,0,.69,.03,1.02],["c",.15,1.47,.75,2.94,2.04,4.83],["l",1.08,1.53],["c",.39,.57,.84,1.2,.99,1.44],["c",.15,.24,.3,.45,.3,.45],["c",0,0,.03,-.09,.06,-.21],["c",.36,-1.59,-.15,-3.33,-1.47,-5.4],["c",-.63,-.93,-1.35,-1.83,-2.52,-3.12],["z"],["m",.06,6.72],["c",-.24,-.21,-.48,-.42,-.51,-.45],["l",-.06,-.06],["l",0,.33],["c",0,1.2,.3,2.34,.93,3.6],["c",.45,.9,.96,1.68,2.25,3.51],["c",.39,.54,.84,1.17,1.02,1.44],["c",.21,.33,.33,.51,.33,.48],["c",.06,-.09,.21,-.63,.3,-.99],["c",.06,-.33,.06,-.45,.06,-.96],["c",0,-.6,-.03,-.84,-.18,-1.35],["c",-.3,-1.08,-1.02,-2.28,-2.13,-3.57],["c",-.39,-.45,-1.44,-1.47,-2.01,-1.98],["z"],["m",0,6.72],["c",-.24,-.21,-.48,-.39,-.51,-.42],["l",-.06,-.06],["l",0,.33],["c",0,1.41,.45,2.82,1.38,4.35],["c",.42,.72,.72,1.14,1.86,2.73],["c",.36,.45,.75,.99,.87,1.2],["c",.15,.21,.3,.36,.3,.36],["c",.06,0,.3,-.48,.39,-.75],["c",.09,-.36,.12,-.63,.12,-1.05],["c",-.06,-1.05,-.45,-2.04,-1.2,-3.18],["c",-.57,-.87,-1.11,-1.53,-2.07,-2.49],["c",-.36,-.33,-.84,-.78,-1.08,-1.02],["z"]],w:6.682,h:39.694},"flags.d8th":{d:[["M",5.67,-21.63],["c",.24,-.12,.54,-.06,.69,.15],["c",.06,.06,.21,.36,.39,.66],["c",.84,1.77,1.26,3.36,1.32,5.1],["c",.03,1.29,-.21,2.37,-.81,3.63],["c",-.6,1.23,-1.26,2.13,-3.21,4.38],["c",-1.35,1.53,-1.86,2.19,-2.4,2.97],["c",-.63,.93,-1.11,1.92,-1.38,2.79],["c",-.15,.54,-.27,1.35,-.27,1.8],["l",0,.15],["l",-.21,0],["l",-.21,0],["l",0,-3.75],["l",0,-3.75],["l",.21,0],["l",.21,0],["l",.48,-.3],["c",1.83,-1.11,3.12,-2.1,4.17,-3.12],["c",.78,-.81,1.32,-1.53,1.71,-2.31],["c",.45,-.93,.6,-1.74,.51,-2.88],["c",-.12,-1.56,-.63,-3.18,-1.47,-4.68],["c",-.12,-.21,-.15,-.33,-.06,-.51],["c",.06,-.15,.15,-.24,.33,-.33],["z"]],w:8.492,h:21.691},"flags.ugrace":{d:[["M",6.03,6.93],["c",.15,-.09,.33,-.06,.51,0],["c",.15,.09,.21,.15,.3,.33],["c",.09,.18,.06,.39,-.03,.54],["c",-.06,.15,-10.89,8.88,-11.07,8.97],["c",-.15,.09,-.33,.06,-.48,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.06,-.39,.03,-.54],["c",.06,-.15,10.89,-8.88,11.07,-8.97],["z"]],w:12.019,h:9.954},"flags.dgrace":{d:[["M",-6.06,-15.93],["c",.18,-.09,.33,-.12,.48,-.06],["c",.18,.09,14.01,8.04,14.1,8.1],["c",.12,.12,.18,.33,.18,.51],["c",-.03,.21,-.15,.39,-.36,.48],["c",-.18,.09,-.33,.12,-.48,.06],["c",-.18,-.09,-14.01,-8.04,-14.1,-8.1],["c",-.12,-.12,-.18,-.33,-.18,-.51],["c",.03,-.21,.15,-.39,.36,-.48],["z"]],w:15.12,h:9.212},"flags.d16th":{d:[["M",6.84,-22.53],["c",.27,-.12,.57,-.06,.72,.15],["c",.15,.15,.33,.87,.45,1.56],["c",.06,.33,.06,1.35,0,1.65],["c",-.06,.33,-.15,.78,-.27,1.11],["c",-.12,.33,-.45,.96,-.66,1.32],["l",-.18,.27],["l",.09,.18],["c",.48,1.02,.72,2.25,.69,3.3],["c",-.06,1.23,-.42,2.28,-1.26,3.45],["c",-.57,.87,-.99,1.32,-3,3.39],["c",-1.56,1.56,-2.22,2.4,-2.76,3.45],["c",-.42,.84,-.66,1.8,-.66,2.55],["l",0,.15],["l",-.21,0],["l",-.21,0],["l",0,-7.5],["l",0,-7.5],["l",.21,0],["l",.21,0],["l",0,1.14],["l",0,1.11],["l",.27,-.15],["c",1.11,-.57,1.77,-.99,2.52,-1.47],["c",2.37,-1.56,3.69,-3.15,4.05,-4.83],["c",.03,-.18,.03,-.39,.03,-.78],["c",0,-.6,-.03,-.93,-.24,-1.5],["c",-.06,-.18,-.12,-.39,-.15,-.45],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.63,7.5],["c",-.06,-.18,-.15,-.36,-.15,-.36],["c",-.03,0,-.03,.03,-.06,.06],["c",-.06,.12,-.96,1.02,-1.95,1.98],["c",-.63,.57,-1.26,1.17,-1.44,1.35],["c",-1.53,1.62,-2.28,2.85,-2.55,4.32],["c",-.03,.18,-.03,.54,-.06,.99],["l",0,.69],["l",.18,-.09],["c",.93,-.54,2.1,-1.29,2.82,-1.83],["c",.69,-.51,1.02,-.81,1.53,-1.29],["c",1.86,-1.89,2.37,-3.66,1.68,-5.82],["z"]],w:8.475,h:22.591},"flags.d32nd":{d:[["M",6.84,-29.13],["c",.27,-.12,.57,-.06,.72,.15],["c",.12,.12,.27,.63,.36,1.11],["c",.33,1.59,.06,3.06,-.81,4.47],["l",-.18,.27],["l",.09,.15],["c",.12,.24,.33,.69,.45,1.05],["c",.63,1.83,.45,3.57,-.57,5.22],["l",-.18,.3],["l",.15,.27],["c",.42,.87,.6,1.71,.57,2.61],["c",-.06,1.29,-.48,2.46,-1.35,3.78],["c",-.54,.81,-.93,1.29,-2.46,3],["c",-.51,.54,-1.05,1.17,-1.26,1.41],["c",-1.56,1.86,-2.25,3.36,-2.37,5.01],["l",0,.33],["l",-.21,0],["l",-.21,0],["l",0,-11.25],["l",0,-11.25],["l",.21,0],["l",.21,0],["l",0,1.35],["l",.03,1.35],["l",.78,-.39],["c",1.38,-.69,2.34,-1.26,3.24,-1.92],["c",1.38,-1.02,2.28,-2.13,2.64,-3.21],["c",.15,-.48,.18,-.72,.18,-1.29],["c",0,-.57,-.06,-.9,-.24,-1.47],["c",-.06,-.18,-.12,-.39,-.15,-.45],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.63,7.2],["c",-.09,-.18,-.12,-.21,-.12,-.15],["c",-.03,.09,-1.02,1.08,-2.04,2.04],["c",-1.17,1.08,-1.65,1.56,-2.07,2.04],["c",-.84,.96,-1.38,1.86,-1.68,2.76],["c",-.21,.57,-.27,.99,-.3,1.65],["l",0,.54],["l",.66,-.33],["c",3.57,-1.86,5.49,-3.69,5.94,-5.7],["c",.06,-.39,.06,-1.2,-.03,-1.65],["c",-.06,-.39,-.24,-.9,-.36,-1.2],["z"],["m",-.06,7.2],["c",-.06,-.15,-.12,-.33,-.15,-.45],["l",-.06,-.18],["l",-.18,.21],["l",-1.83,1.83],["c",-.87,.9,-1.77,1.8,-1.95,2.01],["c",-1.08,1.29,-1.62,2.31,-1.89,3.51],["c",-.06,.3,-.06,.51,-.09,.93],["l",0,.57],["l",.09,-.06],["c",.75,-.45,1.89,-1.26,2.52,-1.74],["c",.81,-.66,1.74,-1.53,2.22,-2.16],["c",1.26,-1.53,1.68,-3.06,1.32,-4.47],["z"]],w:8.385,h:29.191},"flags.d64th":{d:[["M",7.08,-32.88],["c",.3,-.12,.66,-.03,.78,.24],["c",.18,.33,.27,2.1,.15,2.64],["c",-.09,.39,-.21,.78,-.39,1.08],["l",-.15,.3],["l",.09,.27],["c",.03,.12,.09,.45,.12,.69],["c",.27,1.44,.18,2.55,-.3,3.6],["l",-.12,.33],["l",.06,.42],["c",.27,1.35,.33,2.82,.21,3.63],["c",-.12,.6,-.3,1.23,-.57,1.8],["l",-.15,.27],["l",.03,.42],["c",.06,1.02,.06,2.7,.03,3.06],["c",-.15,1.47,-.66,2.76,-1.74,4.41],["c",-.45,.69,-.75,1.11,-1.74,2.37],["c",-1.05,1.38,-1.5,1.98,-1.95,2.73],["c",-.93,1.5,-1.38,2.82,-1.44,4.2],["l",0,.42],["l",-.21,0],["l",-.21,0],["l",0,-15],["l",0,-15],["l",.21,0],["l",.21,0],["l",0,1.86],["l",0,1.89],["c",0,0,.21,-.03,.45,-.09],["c",2.22,-.39,4.08,-1.11,5.19,-2.01],["c",.63,-.54,1.02,-1.14,1.2,-1.8],["c",.06,-.3,.06,-1.14,-.03,-1.65],["c",-.03,-.18,-.06,-.39,-.09,-.48],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.45,6.15],["c",-.03,-.18,-.06,-.42,-.06,-.54],["l",-.03,-.18],["l",-.33,.3],["c",-.42,.36,-.87,.72,-1.68,1.29],["c",-1.98,1.38,-2.25,1.59,-2.85,2.16],["c",-.75,.69,-1.23,1.44,-1.47,2.19],["c",-.15,.45,-.18,.63,-.21,1.35],["l",0,.66],["l",.39,-.18],["c",1.83,-.9,3.45,-1.95,4.47,-2.91],["c",.93,-.9,1.53,-1.83,1.74,-2.82],["c",.06,-.33,.06,-.87,.03,-1.32],["z"],["m",-.27,4.86],["c",-.03,-.21,-.06,-.36,-.06,-.36],["c",0,-.03,-.12,.09,-.24,.24],["c",-.39,.48,-.99,1.08,-2.16,2.19],["c",-1.47,1.38,-1.92,1.83,-2.46,2.49],["c",-.66,.87,-1.08,1.74,-1.29,2.58],["c",-.09,.42,-.15,.87,-.15,1.44],["l",0,.54],["l",.48,-.33],["c",1.5,-1.02,2.58,-1.89,3.51,-2.82],["c",1.47,-1.47,2.25,-2.85,2.4,-4.26],["c",.03,-.39,.03,-1.17,-.03,-1.71],["z"],["m",-.66,7.68],["c",.03,-.15,.03,-.6,.03,-.99],["l",0,-.72],["l",-.27,.33],["l",-1.74,1.98],["c",-1.77,1.92,-2.43,2.76,-2.97,3.9],["c",-.51,1.02,-.72,1.77,-.75,2.91],["c",0,.63,0,.63,.06,.6],["c",.03,-.03,.3,-.27,.63,-.54],["c",.66,-.6,1.86,-1.8,2.31,-2.31],["c",1.65,-1.89,2.52,-3.54,2.7,-5.16],["z"]],w:8.485,h:32.932},"clefs.C":{d:[["M",.06,-14.94],["l",.09,-.06],["l",1.92,0],["l",1.92,0],["l",.09,.06],["l",.06,.09],["l",0,14.85],["l",0,14.82],["l",-.06,.09],["l",-.09,.06],["l",-1.92,0],["l",-1.92,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-14.82],["l",0,-14.85],["z"],["m",5.37,0],["c",.09,-.06,.09,-.06,.57,-.06],["c",.45,0,.45,0,.54,.06],["l",.06,.09],["l",0,7.14],["l",0,7.11],["l",.09,-.06],["c",.18,-.18,.72,-.84,.96,-1.2],["c",.3,-.45,.66,-1.17,.84,-1.65],["c",.36,-.9,.57,-1.83,.6,-2.79],["c",.03,-.48,.03,-.54,.09,-.63],["c",.12,-.18,.36,-.21,.54,-.12],["c",.18,.09,.21,.15,.24,.66],["c",.06,.87,.21,1.56,.57,2.22],["c",.51,1.02,1.26,1.68,2.22,1.92],["c",.21,.06,.33,.06,.78,.06],["c",.45,0,.57,0,.84,-.06],["c",.45,-.12,.81,-.33,1.08,-.6],["c",.57,-.57,.87,-1.41,.99,-2.88],["c",.06,-.54,.06,-3,0,-3.57],["c",-.21,-2.58,-.84,-3.87,-2.16,-4.5],["c",-.48,-.21,-1.17,-.36,-1.77,-.36],["c",-.69,0,-1.29,.27,-1.5,.72],["c",-.06,.15,-.06,.21,-.06,.42],["c",0,.24,0,.3,.06,.45],["c",.12,.24,.24,.39,.63,.66],["c",.42,.3,.57,.48,.69,.72],["c",.06,.15,.06,.21,.06,.48],["c",0,.39,-.03,.63,-.21,.96],["c",-.3,.6,-.87,1.08,-1.5,1.26],["c",-.27,.06,-.87,.06,-1.14,0],["c",-.78,-.24,-1.44,-.87,-1.65,-1.68],["c",-.12,-.42,-.09,-1.17,.09,-1.71],["c",.51,-1.65,1.98,-2.82,3.81,-3.09],["c",.84,-.09,2.46,.03,3.51,.27],["c",2.22,.57,3.69,1.8,4.44,3.75],["c",.36,.93,.57,2.13,.57,3.36],["c",0,1.44,-.48,2.73,-1.38,3.81],["c",-1.26,1.5,-3.27,2.43,-5.28,2.43],["c",-.48,0,-.51,0,-.75,-.09],["c",-.15,-.03,-.48,-.21,-.78,-.36],["c",-.69,-.36,-.87,-.42,-1.26,-.42],["c",-.27,0,-.3,0,-.51,.09],["c",-.57,.3,-.81,.9,-.81,2.1],["c",0,1.23,.24,1.83,.81,2.13],["c",.21,.09,.24,.09,.51,.09],["c",.39,0,.57,-.06,1.26,-.42],["c",.3,-.15,.63,-.33,.78,-.36],["c",.24,-.09,.27,-.09,.75,-.09],["c",2.01,0,4.02,.93,5.28,2.4],["c",.9,1.11,1.38,2.4,1.38,3.84],["c",0,1.5,-.3,2.88,-.84,3.96],["c",-.78,1.59,-2.19,2.64,-4.17,3.15],["c",-1.05,.24,-2.67,.36,-3.51,.27],["c",-1.83,-.27,-3.3,-1.44,-3.81,-3.09],["c",-.18,-.54,-.21,-1.29,-.09,-1.74],["c",.15,-.6,.63,-1.2,1.23,-1.47],["c",.36,-.18,.57,-.21,.99,-.21],["c",.42,0,.63,.03,1.02,.21],["c",.42,.21,.84,.63,1.05,1.05],["c",.18,.36,.21,.6,.21,.96],["c",0,.3,0,.36,-.06,.51],["c",-.12,.24,-.27,.42,-.69,.72],["c",-.57,.42,-.69,.63,-.69,1.08],["c",0,.24,0,.3,.06,.45],["c",.12,.21,.3,.39,.57,.54],["c",.42,.18,.87,.21,1.53,.15],["c",1.08,-.15,1.8,-.57,2.34,-1.32],["c",.54,-.75,.84,-1.83,.99,-3.51],["c",.06,-.57,.06,-3.03,0,-3.57],["c",-.12,-1.47,-.42,-2.31,-.99,-2.88],["c",-.27,-.27,-.63,-.48,-1.08,-.6],["c",-.27,-.06,-.39,-.06,-.84,-.06],["c",-.45,0,-.57,0,-.78,.06],["c",-1.14,.27,-2.01,1.17,-2.46,2.49],["c",-.21,.57,-.3,.99,-.33,1.65],["c",-.03,.51,-.06,.57,-.24,.66],["c",-.12,.06,-.27,.06,-.39,0],["c",-.21,-.09,-.21,-.15,-.24,-.75],["c",-.09,-1.92,-.78,-3.72,-2.01,-5.19],["c",-.18,-.21,-.36,-.42,-.39,-.45],["l",-.09,-.06],["l",0,7.11],["l",0,7.14],["l",-.06,.09],["c",-.09,.06,-.09,.06,-.54,.06],["c",-.48,0,-.48,0,-.57,-.06],["l",-.06,-.09],["l",0,-14.82],["l",0,-14.85],["z"]],w:20.31,h:29.97},"clefs.F":{d:[["M",6.3,-7.8],["c",.36,-.03,1.65,0,2.13,.03],["c",3.6,.42,6.03,2.1,6.93,4.86],["c",.27,.84,.36,1.5,.36,2.58],["c",0,.9,-.03,1.35,-.18,2.16],["c",-.78,3.78,-3.54,7.08,-8.37,9.96],["c",-1.74,1.05,-3.87,2.13,-6.18,3.12],["c",-.39,.18,-.75,.33,-.81,.36],["c",-.06,.03,-.15,.06,-.18,.06],["c",-.15,0,-.33,-.18,-.33,-.33],["c",0,-.15,.06,-.21,.51,-.48],["c",3,-1.77,5.13,-3.21,6.84,-4.74],["c",.51,-.45,1.59,-1.5,1.95,-1.95],["c",1.89,-2.19,2.88,-4.32,3.15,-6.78],["c",.06,-.42,.06,-1.77,0,-2.19],["c",-.24,-2.01,-.93,-3.63,-2.04,-4.71],["c",-.63,-.63,-1.29,-1.02,-2.07,-1.2],["c",-1.62,-.39,-3.36,.15,-4.56,1.44],["c",-.54,.6,-1.05,1.47,-1.32,2.22],["l",-.09,.21],["l",.24,-.12],["c",.39,-.21,.63,-.24,1.11,-.24],["c",.3,0,.45,0,.66,.06],["c",1.92,.48,2.85,2.55,1.95,4.38],["c",-.45,.99,-1.41,1.62,-2.46,1.71],["c",-1.47,.09,-2.91,-.87,-3.39,-2.25],["c",-.18,-.57,-.21,-1.32,-.03,-2.28],["c",.39,-2.25,1.83,-4.2,3.81,-5.19],["c",.69,-.36,1.59,-.6,2.37,-.69],["z"],["m",11.58,2.52],["c",.84,-.21,1.71,.3,1.89,1.14],["c",.3,1.17,-.72,2.19,-1.89,1.89],["c",-.99,-.21,-1.5,-1.32,-1.02,-2.25],["c",.18,-.39,.6,-.69,1.02,-.78],["z"],["m",0,7.5],["c",.84,-.21,1.71,.3,1.89,1.14],["c",.21,.87,-.3,1.71,-1.14,1.89],["c",-.87,.21,-1.71,-.3,-1.89,-1.14],["c",-.21,-.84,.3,-1.71,1.14,-1.89],["z"]],w:20.153,h:23.142},"clefs.G":{d:[["M",9.69,-37.41],["c",.09,-.09,.24,-.06,.36,0],["c",.12,.09,.57,.6,.96,1.11],["c",1.77,2.34,3.21,5.85,3.57,8.73],["c",.21,1.56,.03,3.27,-.45,4.86],["c",-.69,2.31,-1.92,4.47,-4.23,7.44],["c",-.3,.39,-.57,.72,-.6,.75],["c",-.03,.06,0,.15,.18,.78],["c",.54,1.68,1.38,4.44,1.68,5.49],["l",.09,.42],["l",.39,0],["c",1.47,.09,2.76,.51,3.96,1.29],["c",1.83,1.23,3.06,3.21,3.39,5.52],["c",.09,.45,.12,1.29,.06,1.74],["c",-.09,1.02,-.33,1.83,-.75,2.73],["c",-.84,1.71,-2.28,3.06,-4.02,3.72],["l",-.33,.12],["l",.03,1.26],["c",0,1.74,-.06,3.63,-.21,4.62],["c",-.45,3.06,-2.19,5.49,-4.47,6.21],["c",-.57,.18,-.9,.21,-1.59,.21],["c",-.69,0,-1.02,-.03,-1.65,-.21],["c",-1.14,-.27,-2.13,-.84,-2.94,-1.65],["c",-.99,-.99,-1.56,-2.16,-1.71,-3.54],["c",-.09,-.81,.06,-1.53,.45,-2.13],["c",.63,-.99,1.83,-1.56,3,-1.53],["c",1.5,.09,2.64,1.32,2.73,2.94],["c",.06,1.47,-.93,2.7,-2.37,2.97],["c",-.45,.06,-.84,.03,-1.29,-.09],["l",-.21,-.09],["l",.09,.12],["c",.39,.54,.78,.93,1.32,1.26],["c",1.35,.87,3.06,1.02,4.35,.36],["c",1.44,-.72,2.52,-2.28,2.97,-4.35],["c",.15,-.66,.24,-1.5,.3,-3.03],["c",.03,-.84,.03,-2.94,0,-3],["c",-.03,0,-.18,0,-.36,.03],["c",-.66,.12,-.99,.12,-1.83,.12],["c",-1.05,0,-1.71,-.06,-2.61,-.3],["c",-4.02,-.99,-7.11,-4.35,-7.8,-8.46],["c",-.12,-.66,-.12,-.99,-.12,-1.83],["c",0,-.84,0,-1.14,.15,-1.92],["c",.36,-2.28,1.41,-4.62,3.3,-7.29],["l",2.79,-3.6],["c",.54,-.66,.96,-1.2,.96,-1.23],["c",0,-.03,-.09,-.33,-.18,-.69],["c",-.96,-3.21,-1.41,-5.28,-1.59,-7.68],["c",-.12,-1.38,-.15,-3.09,-.06,-3.96],["c",.33,-2.67,1.38,-5.07,3.12,-7.08],["c",.36,-.42,.99,-1.05,1.17,-1.14],["z"],["m",2.01,4.71],["c",-.15,-.3,-.3,-.54,-.3,-.54],["c",-.03,0,-.18,.09,-.3,.21],["c",-2.4,1.74,-3.87,4.2,-4.26,7.11],["c",-.06,.54,-.06,1.41,-.03,1.89],["c",.09,1.29,.48,3.12,1.08,5.22],["c",.15,.42,.24,.78,.24,.81],["c",0,.03,.84,-1.11,1.23,-1.68],["c",1.89,-2.73,2.88,-5.07,3.15,-7.53],["c",.09,-.57,.12,-1.74,.06,-2.37],["c",-.09,-1.23,-.27,-1.92,-.87,-3.12],["z"],["m",-2.94,20.7],["c",-.21,-.72,-.39,-1.32,-.42,-1.32],["c",0,0,-1.2,1.47,-1.86,2.37],["c",-2.79,3.63,-4.02,6.3,-4.35,9.3],["c",-.03,.21,-.03,.69,-.03,1.08],["c",0,.69,0,.75,.06,1.11],["c",.12,.54,.27,.99,.51,1.47],["c",.69,1.38,1.83,2.55,3.42,3.42],["c",.96,.54,2.07,.9,3.21,1.08],["c",.78,.12,2.04,.12,2.94,-.03],["c",.51,-.06,.45,-.03,.42,-.3],["c",-.24,-3.33,-.72,-6.33,-1.62,-10.08],["c",-.09,-.39,-.18,-.75,-.18,-.78],["c",-.03,-.03,-.42,0,-.81,.09],["c",-.9,.18,-1.65,.57,-2.22,1.14],["c",-.72,.72,-1.08,1.65,-1.05,2.64],["c",.06,.96,.48,1.83,1.23,2.58],["c",.36,.36,.72,.63,1.17,.9],["c",.33,.18,.36,.21,.42,.33],["c",.18,.42,-.18,.9,-.6,.87],["c",-.18,-.03,-.84,-.36,-1.26,-.63],["c",-.78,-.51,-1.38,-1.11,-1.86,-1.83],["c",-1.77,-2.7,-.99,-6.42,1.71,-8.19],["c",.3,-.21,.81,-.48,1.17,-.63],["c",.3,-.09,1.02,-.3,1.14,-.3],["c",.06,0,.09,0,.09,-.03],["c",.03,-.03,-.51,-1.92,-1.23,-4.26],["z"],["m",3.78,7.41],["c",-.18,-.03,-.36,-.06,-.39,-.06],["c",-.03,0,0,.21,.18,1.02],["c",.75,3.18,1.26,6.3,1.5,9.09],["c",.06,.72,0,.69,.51,.42],["c",.78,-.36,1.44,-.96,1.98,-1.77],["c",1.08,-1.62,1.2,-3.69,.3,-5.55],["c",-.81,-1.62,-2.31,-2.79,-4.08,-3.15],["z"]],w:19.051,h:57.057},"clefs.perc":{d:[["M",5.07,-7.44],["l",.09,-.06],["l",1.53,0],["l",1.53,0],["l",.09,.06],["l",.06,.09],["l",0,7.35],["l",0,7.32],["l",-.06,.09],["l",-.09,.06],["l",-1.53,0],["l",-1.53,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-7.32],["l",0,-7.35],["z"],["m",6.63,0],["l",.09,-.06],["l",1.53,0],["l",1.53,0],["l",.09,.06],["l",.06,.09],["l",0,7.35],["l",0,7.32],["l",-.06,.09],["l",-.09,.06],["l",-1.53,0],["l",-1.53,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-7.32],["l",0,-7.35],["z"]],w:21,h:14.97},"tab.big":{d:[["M",20.16,-21.66],["c",.24,-.09,.66,.09,.78,.36],["c",.09,.21,.09,.24,-.18,.54],["c",-.78,.81,-1.86,1.44,-2.94,1.71],["c",-.87,.24,-1.71,.24,-2.55,.03],["l",-.06,-.03],["l",-.18,.99],["c",-.33,1.98,-.75,4.26,-.96,5.04],["c",-.42,1.65,-1.26,3.18,-2.28,4.14],["c",-.57,.57,-1.17,.9,-1.86,1.08],["c",-.18,.06,-.33,.06,-.66,.06],["c",-.54,0,-.78,-.03,-1.23,-.27],["c",-.39,-.18,-.66,-.39,-1.38,-.99],["c",-.3,-.24,-.66,-.51,-.75,-.57],["c",-.21,-.15,-.27,-.24,-.24,-.45],["c",.06,-.27,.36,-.6,.6,-.66],["c",.18,-.03,.33,.06,.9,.57],["c",.48,.42,.72,.57,.93,.69],["c",.66,.33,1.38,.21,1.95,-.36],["c",.63,-.6,1.05,-1.62,1.23,-3],["c",.03,-.18,.09,-.66,.09,-1.11],["c",.09,-1.56,.33,-3.81,.57,-5.49],["c",.06,-.33,.09,-.63,.09,-.63],["c",-.03,-.03,-.81,-.12,-1.02,-.12],["c",-.57,0,-1.32,.12,-1.8,.33],["c",-.87,.3,-1.35,.78,-1.5,1.41],["c",-.18,.63,.09,1.26,.66,1.65],["c",.12,.06,.15,.12,.18,.24],["c",.09,.27,.06,.57,-.09,.75],["c",-.03,.06,-.12,.09,-.27,.15],["c",-.72,.21,-1.44,.15,-2.1,-.18],["c",-.54,-.27,-.96,-.66,-1.2,-1.14],["c",-.39,-.75,-.33,-1.74,.15,-2.52],["c",.27,-.42,.84,-.93,1.41,-1.23],["c",1.17,-.57,2.88,-.9,4.8,-.9],["c",.69,0,.78,0,1.08,.06],["c",.45,.09,1.11,.3,2.07,.6],["c",1.47,.48,1.83,.57,2.55,.54],["c",1.02,-.06,2.04,-.45,2.94,-1.11],["c",.12,-.09,.24,-.18,.27,-.18],["z"],["m",-5.88,13.05],["c",.21,-.03,.81,0,1.08,.06],["c",.48,.12,.9,.42,.99,.69],["c",.03,.09,.03,.15,0,.27],["c",0,.09,-.03,.57,-.06,1.08],["c",-.09,2.19,-.24,5.76,-.39,8.28],["c",-.06,1.53,-.06,1.77,.03,2.01],["c",.09,.18,.15,.24,.3,.3],["c",.24,.12,.54,.06,1.23,-.27],["c",.57,-.27,.66,-.3,.75,-.24],["c",.09,.06,.18,.3,.18,.45],["c",0,.33,-.15,.51,-.45,.63],["c",-.12,.03,-.39,.15,-.6,.27],["c",-1.17,.6,-1.38,.69,-1.8,.72],["c",-.45,.03,-.78,-.09,-1.08,-.39],["c",-.39,-.42,-.66,-1.2,-1.02,-3.12],["c",-.24,-1.23,-.36,-2.07,-.54,-3.75],["l",0,-.18],["l",-.36,.45],["c",-.6,.75,-1.32,1.59,-1.95,2.25],["c",-.15,.18,-.27,.3,-.27,.33],["c",0,0,.06,.09,.15,.18],["c",.24,.33,.6,.57,1.05,.69],["c",.18,.06,.3,.06,.69,.06],["l",.48,.03],["l",.06,.12],["c",.15,.27,.03,.72,-.21,.9],["c",-.18,.12,-.93,.27,-1.41,.27],["c",-.84,0,-1.59,-.3,-1.98,-.84],["l",-.12,-.15],["l",-.45,.42],["c",-.99,.87,-1.53,1.32,-2.16,1.74],["c",-.78,.51,-1.5,.84,-2.1,.93],["c",-.69,.12,-1.2,.03,-1.95,-.42],["c",-.21,-.12,-.51,-.27,-.66,-.36],["c",-.24,-.12,-.3,-.18,-.33,-.24],["c",-.12,-.27,.15,-.78,.45,-.93],["c",.24,-.12,.33,-.09,.9,.18],["c",.6,.3,.84,.39,1.2,.36],["c",.87,-.09,1.77,-.69,3.24,-2.31],["c",2.67,-2.85,4.59,-5.94,5.7,-9.15],["c",.15,-.45,.24,-.63,.42,-.81],["c",.21,-.24,.6,-.45,.99,-.51],["z"],["m",-3.99,16.05],["c",.18,0,.69,-.03,1.17,0],["c",3.27,.03,5.37,.75,6,2.07],["c",.45,.99,.12,2.4,-.81,3.42],["c",-.24,.27,-.57,.57,-.84,.75],["c",-.09,.06,-.18,.09,-.18,.12],["c",0,0,.18,.03,.42,.09],["c",1.23,.3,2.01,.81,2.37,1.59],["c",.27,.54,.3,1.32,.09,2.1],["c",-.12,.36,-.45,1.05,-.69,1.35],["c",-.87,1.17,-2.1,1.92,-3.54,2.25],["c",-.36,.06,-.48,.06,-.96,.06],["c",-.45,0,-.66,0,-.84,-.03],["c",-.84,-.18,-1.47,-.51,-2.07,-1.11],["c",-.33,-.33,-.45,-.51,-.45,-.63],["c",0,-.06,.03,-.15,.06,-.24],["c",.18,-.33,.69,-.6,.93,-.48],["c",.03,.03,.15,.12,.27,.24],["c",.39,.42,.99,.57,1.62,.45],["c",1.05,-.21,1.98,-1.02,2.31,-2.01],["c",.48,-1.53,-.48,-2.55,-2.58,-2.67],["c",-.21,0,-.36,-.03,-.42,-.06],["c",-.15,-.09,-.21,-.51,-.06,-.78],["c",.12,-.27,.24,-.33,.6,-.36],["c",.57,-.06,1.11,-.42,1.5,-.99],["c",.48,-.72,.54,-1.59,.18,-2.31],["c",-.12,-.21,-.45,-.54,-.69,-.69],["c",-.33,-.21,-.93,-.45,-1.35,-.51],["l",-.12,-.03],["l",-.06,.48],["c",-.54,2.94,-1.14,6.24,-1.29,6.75],["c",-.33,1.35,-.93,2.61,-1.65,3.6],["c",-.3,.36,-.81,.9,-1.14,1.14],["c",-.3,.24,-.84,.48,-1.14,.57],["c",-.33,.09,-.96,.09,-1.26,.03],["c",-.45,-.12,-.87,-.39,-1.53,-.96],["c",-.24,-.15,-.51,-.39,-.63,-.48],["c",-.3,-.21,-.33,-.33,-.21,-.63],["c",.12,-.18,.27,-.36,.42,-.45],["c",.27,-.12,.36,-.09,.87,.33],["c",.78,.6,1.08,.75,1.65,.72],["c",.45,-.03,.81,-.21,1.17,-.54],["c",.87,-.9,1.38,-2.85,1.38,-5.37],["c",0,-.6,.03,-1.11,.12,-2.04],["c",.06,-.69,.24,-2.01,.33,-2.58],["c",.06,-.24,.06,-.42,.06,-.42],["c",0,0,-.12,.03,-.21,.09],["c",-1.44,.57,-2.16,1.65,-1.74,2.55],["c",.09,.15,.18,.24,.27,.33],["c",.24,.21,.3,.27,.33,.39],["c",.06,.24,0,.63,-.15,.78],["c",-.09,.12,-.54,.21,-.96,.24],["c",-1.02,.03,-2.01,-.48,-2.43,-1.32],["c",-.21,-.45,-.27,-.9,-.15,-1.44],["c",.06,-.27,.21,-.66,.39,-.93],["c",.87,-1.29,3,-2.22,5.64,-2.43],["z"]],w:19.643,h:43.325},"tab.tiny":{d:[["M",16.02,-17.25],["c",.12,-.09,.15,-.09,.27,-.09],["c",.21,.03,.51,.3,.51,.45],["c",0,.06,-.12,.18,-.3,.36],["c",-1.11,1.08,-2.55,1.59,-3.84,1.41],["c",-.15,-.03,-.33,-.06,-.39,-.09],["c",-.06,-.03,-.09,-.03,-.12,-.03],["c",0,0,-.06,.42,-.15,.93],["c",-.33,2.01,-.66,3.69,-.84,4.26],["c",-.42,1.41,-1.23,2.67,-2.16,3.33],["c",-.27,.18,-.75,.42,-.99,.48],["c",-.3,.09,-.72,.09,-1.02,.06],["c",-.45,-.09,-.84,-.33,-1.53,-.9],["c",-.21,-.18,-.51,-.39,-.63,-.48],["c",-.27,-.21,-.3,-.24,-.3,-.36],["c",0,-.12,.09,-.36,.18,-.45],["c",.09,-.09,.27,-.18,.36,-.18],["c",.12,0,.3,.12,.66,.45],["c",.57,.51,.87,.69,1.23,.72],["c",.93,.06,1.68,-.78,1.98,-2.37],["c",.09,-.39,.15,-.75,.18,-1.53],["c",.06,-.99,.24,-2.79,.42,-4.05],["c",.03,-.3,.06,-.57,.06,-.6],["c",0,-.06,-.03,-.09,-.15,-.12],["c",-.9,-.18,-2.13,.06,-2.76,.57],["c",-.36,.3,-.51,.6,-.51,1.02],["c",0,.45,.15,.75,.48,.99],["c",.06,.06,.15,.18,.18,.24],["c",.12,.24,.03,.63,-.15,.69],["c",-.24,.12,-.6,.15,-.9,.15],["c",-.36,-.03,-.57,-.09,-.87,-.24],["c",-.78,-.36,-1.23,-1.11,-1.2,-1.92],["c",.12,-1.53,1.74,-2.49,4.62,-2.7],["c",1.2,-.09,1.47,-.03,3.33,.57],["c",.9,.3,1.14,.36,1.56,.39],["c",.45,0,.93,-.06,1.38,-.21],["c",.51,-.18,.81,-.33,1.41,-.75],["z"],["m",-4.68,10.38],["c",.39,-.06,.84,0,1.2,.15],["c",.24,.12,.36,.21,.45,.36],["l",.09,.09],["l",-.06,1.41],["c",-.09,2.19,-.18,3.96,-.27,5.49],["c",-.03,.78,-.06,1.59,-.06,1.86],["c",0,.42,0,.48,.06,.57],["c",.06,.18,.18,.24,.36,.27],["c",.18,0,.39,-.06,.84,-.27],["c",.45,-.21,.54,-.24,.63,-.18],["c",.12,.12,.15,.54,.03,.69],["c",-.03,.03,-.15,.12,-.27,.18],["c",-.15,.03,-.3,.12,-.36,.15],["c",-.87,.45,-1.02,.51,-1.26,.57],["c",-.33,.09,-.6,.06,-.84,-.06],["c",-.42,-.18,-.63,-.6,-.87,-1.44],["c",-.3,-1.23,-.57,-2.97,-.66,-4.08],["c",0,-.18,-.03,-.3,-.03,-.33],["l",-.06,.06],["c",-.18,.27,-1.11,1.38,-1.68,2.01],["l",-.33,.33],["l",.06,.09],["c",.06,.15,.27,.33,.48,.42],["c",.27,.18,.51,.24,.96,.27],["l",.39,0],["l",.03,.12],["c",.12,.21,.03,.57,-.15,.69],["c",-.03,.03,-.21,.09,-.36,.15],["c",-.27,.06,-.39,.06,-.75,.06],["c",-.48,0,-.75,-.03,-1.08,-.21],["c",-.21,-.12,-.51,-.36,-.57,-.48],["l",-.03,-.09],["l",-.39,.36],["c",-1.47,1.35,-2.49,1.98,-3.42,2.13],["c",-.54,.09,-.96,-.03,-1.62,-.39],["c",-.21,-.15,-.45,-.27,-.54,-.3],["c",-.18,-.09,-.21,-.21,-.12,-.45],["c",.06,-.27,.33,-.48,.54,-.48],["c",.03,0,.27,.09,.48,.21],["c",.48,.24,.69,.27,.99,.27],["c",.6,-.06,1.17,-.42,2.1,-1.35],["c",2.22,-2.22,4.02,-4.98,4.95,-7.59],["c",.21,-.57,.3,-.78,.48,-.93],["c",.15,-.15,.42,-.27,.66,-.33],["z"],["m",-3.06,12.84],["c",.27,-.03,1.68,0,2.01,.03],["c",1.92,.18,3.15,.69,3.63,1.5],["c",.18,.33,.24,.51,.21,.93],["c",0,.45,-.06,.72,-.24,1.11],["c",-.24,.51,-.69,1.02,-1.17,1.35],["c",-.21,.15,-.21,.15,-.12,.18],["c",.72,.15,1.11,.3,1.5,.57],["c",.39,.24,.63,.57,.75,.96],["c",.09,.3,.09,.96,0,1.29],["c",-.15,.57,-.39,1.05,-.78,1.5],["c",-.66,.75,-1.62,1.32,-2.61,1.53],["c",-.27,.06,-.42,.06,-.84,.06],["c",-.48,0,-.57,0,-.81,-.06],["c",-.6,-.18,-1.05,-.42,-1.47,-.81],["c",-.36,-.39,-.42,-.51,-.3,-.75],["c",.12,-.21,.39,-.39,.6,-.39],["c",.09,0,.15,.03,.33,.18],["c",.12,.12,.27,.24,.36,.27],["c",.96,.48,2.46,-.33,2.82,-1.5],["c",.24,-.81,-.03,-1.44,-.69,-1.77],["c",-.39,-.21,-1.02,-.33,-1.53,-.33],["c",-.18,0,-.21,0,-.27,-.09],["c",-.06,-.09,-.06,-.3,-.03,-.48],["c",.06,-.18,.18,-.36,.33,-.36],["c",.39,-.06,.51,-.09,.72,-.18],["c",.69,-.36,1.11,-1.23,.99,-2.01],["c",-.09,-.51,-.42,-.9,-.93,-1.17],["c",-.24,-.12,-.6,-.27,-.87,-.3],["c",-.09,-.03,-.09,-.03,-.12,.12],["c",0,.09,-.21,1.11,-.42,2.25],["c",-.66,3.75,-.72,3.99,-1.26,5.07],["c",-.9,1.89,-2.25,2.85,-3.48,2.61],["c",-.39,-.09,-.69,-.27,-1.38,-.84],["c",-.63,-.51,-.63,-.48,-.63,-.6],["c",0,-.18,.18,-.48,.39,-.57],["c",.21,-.12,.3,-.09,.81,.33],["c",.15,.15,.39,.3,.54,.36],["c",.18,.12,.27,.12,.48,.15],["c",.99,.06,1.71,-.78,2.04,-2.46],["c",.12,-.66,.18,-1.14,.21,-2.22],["c",.03,-1.23,.12,-2.25,.36,-3.63],["c",.03,-.24,.06,-.45,.06,-.48],["c",-.06,-.03,-.66,.27,-.9,.42],["c",-.06,.06,-.21,.18,-.33,.3],["c",-.57,.57,-.6,1.35,-.06,1.74],["c",.18,.12,.24,.24,.21,.51],["c",-.03,.3,-.15,.42,-.57,.48],["c",-1.11,.24,-2.22,-.42,-2.43,-1.38],["c",-.09,-.45,.03,-1.02,.3,-1.47],["c",.18,-.24,.6,-.63,.9,-.84],["c",.9,-.6,2.28,-1.02,3.69,-1.11],["z"]],w:15.709,h:34.656},"timesig.common":{d:[["M",6.66,-7.83],["c",.72,-.06,1.41,-.03,1.98,.09],["c",1.2,.27,2.34,.96,3.09,1.92],["c",.63,.81,1.08,1.86,1.14,2.73],["c",.06,1.02,-.51,1.92,-1.44,2.22],["c",-.24,.09,-.3,.09,-.63,.09],["c",-.33,0,-.42,0,-.63,-.06],["c",-.66,-.24,-1.14,-.63,-1.41,-1.2],["c",-.15,-.3,-.21,-.51,-.24,-.9],["c",-.06,-1.08,.57,-2.04,1.56,-2.37],["c",.18,-.06,.27,-.06,.63,-.06],["l",.45,0],["c",.06,.03,.09,.03,.09,0],["c",0,0,-.09,-.12,-.24,-.27],["c",-1.02,-1.11,-2.55,-1.68,-4.08,-1.5],["c",-1.29,.15,-2.04,.69,-2.4,1.74],["c",-.36,.93,-.42,1.89,-.42,5.37],["c",0,2.97,.06,3.96,.24,4.77],["c",.24,1.08,.63,1.68,1.41,2.07],["c",.81,.39,2.16,.45,3.18,.09],["c",1.29,-.45,2.37,-1.53,3.03,-2.97],["c",.15,-.33,.33,-.87,.39,-1.17],["c",.09,-.24,.15,-.36,.3,-.39],["c",.21,-.03,.42,.15,.39,.36],["c",-.06,.39,-.42,1.38,-.69,1.89],["c",-.96,1.8,-2.49,2.94,-4.23,3.18],["c",-.99,.12,-2.58,-.06,-3.63,-.45],["c",-.96,-.36,-1.71,-.84,-2.4,-1.5],["c",-1.11,-1.11,-1.8,-2.61,-2.04,-4.56],["c",-.06,-.6,-.06,-2.01,0,-2.61],["c",.24,-1.95,.9,-3.45,2.01,-4.56],["c",.69,-.66,1.44,-1.11,2.37,-1.47],["c",.63,-.24,1.47,-.42,2.22,-.48],["z"]],w:13.038,h:15.689},"timesig.cut":{d:[["M",6.24,-10.44],["c",.09,-.06,.09,-.06,.48,-.06],["c",.36,0,.36,0,.45,.06],["l",.06,.09],["l",0,1.23],["l",0,1.26],["l",.27,0],["c",1.26,0,2.49,.45,3.48,1.29],["c",1.05,.87,1.8,2.28,1.89,3.48],["c",.06,1.02,-.51,1.92,-1.44,2.22],["c",-.24,.09,-.3,.09,-.63,.09],["c",-.33,0,-.42,0,-.63,-.06],["c",-.66,-.24,-1.14,-.63,-1.41,-1.2],["c",-.15,-.3,-.21,-.51,-.24,-.9],["c",-.06,-1.08,.57,-2.04,1.56,-2.37],["c",.18,-.06,.27,-.06,.63,-.06],["l",.45,0],["c",.06,.03,.09,.03,.09,0],["c",0,-.03,-.45,-.51,-.66,-.69],["c",-.87,-.69,-1.83,-1.05,-2.94,-1.11],["l",-.42,0],["l",0,7.17],["l",0,7.14],["l",.42,0],["c",.69,-.03,1.23,-.18,1.86,-.51],["c",1.05,-.51,1.89,-1.47,2.46,-2.7],["c",.15,-.33,.33,-.87,.39,-1.17],["c",.09,-.24,.15,-.36,.3,-.39],["c",.21,-.03,.42,.15,.39,.36],["c",-.03,.24,-.21,.78,-.39,1.2],["c",-.96,2.37,-2.94,3.9,-5.13,3.9],["l",-.3,0],["l",0,1.26],["l",0,1.23],["l",-.06,.09],["c",-.09,.06,-.09,.06,-.45,.06],["c",-.39,0,-.39,0,-.48,-.06],["l",-.06,-.09],["l",0,-1.29],["l",0,-1.29],["l",-.21,-.03],["c",-1.23,-.21,-2.31,-.63,-3.21,-1.29],["c",-.15,-.09,-.45,-.36,-.66,-.57],["c",-1.11,-1.11,-1.8,-2.61,-2.04,-4.56],["c",-.06,-.6,-.06,-2.01,0,-2.61],["c",.24,-1.95,.93,-3.45,2.04,-4.59],["c",.42,-.39,.78,-.66,1.26,-.93],["c",.75,-.45,1.65,-.75,2.61,-.9],["l",.21,-.03],["l",0,-1.29],["l",0,-1.29],["z"],["m",-.06,10.44],["c",0,-5.58,0,-6.99,-.03,-6.99],["c",-.15,0,-.63,.27,-.87,.45],["c",-.45,.36,-.75,.93,-.93,1.77],["c",-.18,.81,-.24,1.8,-.24,4.74],["c",0,2.97,.06,3.96,.24,4.77],["c",.24,1.08,.66,1.68,1.41,2.07],["c",.12,.06,.3,.12,.33,.15],["l",.09,0],["l",0,-6.96],["z"]],w:13.038,h:20.97},"timesig.imperfectum":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.imperfectum2":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.perfectum":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.perfectum2":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},f:{d:[["M",9.93,-14.28],["c",1.53,-.18,2.88,.45,3.12,1.5],["c",.12,.51,0,1.32,-.27,1.86],["c",-.15,.3,-.42,.57,-.63,.69],["c",-.69,.36,-1.56,.03,-1.83,-.69],["c",-.09,-.24,-.09,-.69,0,-.87],["c",.06,-.12,.21,-.24,.45,-.42],["c",.42,-.24,.57,-.45,.6,-.72],["c",.03,-.33,-.09,-.39,-.63,-.42],["c",-.3,0,-.45,0,-.6,.03],["c",-.81,.21,-1.35,.93,-1.74,2.46],["c",-.06,.27,-.48,2.25,-.48,2.31],["c",0,.03,.39,.03,.9,.03],["c",.72,0,.9,0,.99,.06],["c",.42,.15,.45,.72,.03,.9],["c",-.12,.06,-.24,.06,-1.17,.06],["l",-1.05,0],["l",-.78,2.55],["c",-.45,1.41,-.87,2.79,-.96,3.06],["c",-.87,2.37,-2.37,4.74,-3.78,5.91],["c",-1.05,.9,-2.04,1.23,-3.09,1.08],["c",-1.11,-.18,-1.89,-.78,-2.04,-1.59],["c",-.12,-.66,.15,-1.71,.54,-2.19],["c",.69,-.75,1.86,-.54,2.22,.39],["c",.06,.15,.09,.27,.09,.48],["c",0,.24,-.03,.27,-.12,.42],["c",-.03,.09,-.15,.18,-.27,.27],["c",-.09,.06,-.27,.21,-.36,.27],["c",-.24,.18,-.36,.36,-.39,.6],["c",-.03,.33,.09,.39,.63,.42],["c",.42,0,.63,-.03,.9,-.15],["c",.6,-.3,.96,-.96,1.38,-2.64],["c",.09,-.42,.63,-2.55,1.17,-4.77],["l",1.02,-4.08],["c",0,-.03,-.36,-.03,-.81,-.03],["c",-.72,0,-.81,0,-.93,-.06],["c",-.42,-.18,-.39,-.75,.03,-.9],["c",.09,-.06,.27,-.06,1.05,-.06],["l",.96,0],["l",0,-.09],["c",.06,-.18,.3,-.72,.51,-1.17],["c",1.2,-2.46,3.3,-4.23,5.34,-4.5],["z"]],w:16.155,h:19.445},m:{d:[["M",2.79,-8.91],["c",.09,0,.3,-.03,.45,-.03],["c",.24,.03,.3,.03,.45,.12],["c",.36,.15,.63,.54,.75,1.02],["l",.03,.21],["l",.33,-.3],["c",.69,-.69,1.38,-1.02,2.07,-1.02],["c",.27,0,.33,0,.48,.06],["c",.21,.09,.48,.36,.63,.6],["c",.03,.09,.12,.27,.18,.42],["c",.03,.15,.09,.27,.12,.27],["c",0,0,.09,-.09,.18,-.21],["c",.33,-.39,.87,-.81,1.29,-.99],["c",.78,-.33,1.47,-.21,2.01,.33],["c",.3,.33,.48,.69,.6,1.14],["c",.09,.42,.06,.54,-.54,3.06],["c",-.33,1.29,-.57,2.4,-.57,2.43],["c",0,.12,.09,.21,.21,.21],["c",.24,0,.75,-.3,1.2,-.72],["c",.45,-.39,.6,-.45,.78,-.27],["c",.18,.18,.09,.36,-.45,.87],["c",-1.05,.96,-1.83,1.47,-2.58,1.71],["c",-.93,.33,-1.53,.21,-1.8,-.33],["c",-.06,-.15,-.06,-.21,-.06,-.45],["c",0,-.24,.03,-.48,.6,-2.82],["c",.42,-1.71,.6,-2.64,.63,-2.79],["c",.03,-.57,-.3,-.75,-.84,-.48],["c",-.24,.12,-.54,.39,-.66,.63],["c",-.03,.09,-.42,1.38,-.9,3],["c",-.9,3.15,-.84,3,-1.14,3.15],["l",-.15,.09],["l",-.78,0],["c",-.6,0,-.78,0,-.84,-.06],["c",-.09,-.03,-.18,-.18,-.18,-.27],["c",0,-.03,.36,-1.38,.84,-2.97],["c",.57,-2.04,.81,-2.97,.84,-3.12],["c",.03,-.54,-.3,-.72,-.84,-.45],["c",-.24,.12,-.57,.42,-.66,.63],["c",-.06,.09,-.51,1.44,-1.05,2.97],["c",-.51,1.56,-.99,2.85,-.99,2.91],["c",-.06,.12,-.21,.24,-.36,.3],["c",-.12,.06,-.21,.06,-.9,.06],["c",-.6,0,-.78,0,-.84,-.06],["c",-.09,-.03,-.18,-.18,-.18,-.27],["c",0,-.03,.45,-1.38,.99,-2.97],["c",1.05,-3.18,1.05,-3.18,.93,-3.45],["c",-.12,-.27,-.39,-.3,-.72,-.15],["c",-.54,.27,-1.14,1.17,-1.56,2.4],["c",-.06,.15,-.15,.3,-.18,.36],["c",-.21,.21,-.57,.27,-.72,.09],["c",-.09,-.09,-.06,-.21,.06,-.63],["c",.48,-1.26,1.26,-2.46,2.01,-3.21],["c",.57,-.54,1.2,-.87,1.83,-1.02],["z"]],w:14.687,h:9.126},p:{d:[["M",1.92,-8.7],["c",.27,-.09,.81,-.06,1.11,.03],["c",.54,.18,.93,.51,1.17,.99],["c",.09,.15,.15,.33,.18,.36],["l",0,.12],["l",.3,-.27],["c",.66,-.6,1.35,-1.02,2.13,-1.2],["c",.21,-.06,.33,-.06,.78,-.06],["c",.45,0,.51,0,.84,.09],["c",1.29,.33,2.07,1.32,2.25,2.79],["c",.09,.81,-.09,2.01,-.45,2.79],["c",-.54,1.26,-1.86,2.55,-3.18,3.03],["c",-.45,.18,-.81,.24,-1.29,.24],["c",-.69,-.03,-1.35,-.18,-1.86,-.45],["c",-.3,-.15,-.51,-.18,-.69,-.09],["c",-.09,.03,-.18,.09,-.18,.12],["c",-.09,.12,-1.05,2.94,-1.05,3.06],["c",0,.24,.18,.48,.51,.63],["c",.18,.06,.54,.15,.75,.15],["c",.21,0,.36,.06,.42,.18],["c",.12,.18,.06,.42,-.12,.54],["c",-.09,.03,-.15,.03,-.78,0],["c",-1.98,-.15,-3.81,-.15,-5.79,0],["c",-.63,.03,-.69,.03,-.78,0],["c",-.24,-.15,-.24,-.57,.03,-.66],["c",.06,-.03,.48,-.09,.99,-.12],["c",.87,-.06,1.11,-.09,1.35,-.21],["c",.18,-.06,.33,-.18,.39,-.3],["c",.06,-.12,3.24,-9.42,3.27,-9.6],["c",.06,-.33,.03,-.57,-.15,-.69],["c",-.09,-.06,-.12,-.06,-.3,-.06],["c",-.69,.06,-1.53,1.02,-2.28,2.61],["c",-.09,.21,-.21,.45,-.27,.51],["c",-.09,.12,-.33,.24,-.48,.24],["c",-.18,0,-.36,-.15,-.36,-.3],["c",0,-.24,.78,-1.83,1.26,-2.55],["c",.72,-1.11,1.47,-1.74,2.28,-1.92],["z"],["m",5.37,1.47],["c",-.27,-.12,-.75,-.03,-1.14,.21],["c",-.75,.48,-1.47,1.68,-1.89,3.15],["c",-.45,1.47,-.42,2.34,0,2.7],["c",.45,.39,1.26,.21,1.83,-.36],["c",.51,-.51,.99,-1.68,1.38,-3.27],["c",.3,-1.17,.33,-1.74,.15,-2.13],["c",-.09,-.15,-.15,-.21,-.33,-.3],["z"]],w:14.689,h:13.127},r:{d:[["M",6.33,-9.12],["c",.27,-.03,.93,0,1.2,.06],["c",.84,.21,1.23,.81,1.02,1.53],["c",-.24,.75,-.9,1.17,-1.56,.96],["c",-.33,-.09,-.51,-.3,-.66,-.75],["c",-.03,-.12,-.09,-.24,-.12,-.3],["c",-.09,-.15,-.3,-.24,-.48,-.24],["c",-.57,0,-1.38,.54,-1.65,1.08],["c",-.06,.15,-.33,1.17,-.9,3.27],["c",-.57,2.31,-.81,3.12,-.87,3.21],["c",-.03,.06,-.12,.15,-.18,.21],["l",-.12,.06],["l",-.81,.03],["c",-.69,0,-.81,0,-.9,-.03],["c",-.09,-.06,-.18,-.21,-.18,-.3],["c",0,-.06,.39,-1.62,.9,-3.51],["c",.84,-3.24,.87,-3.45,.87,-3.72],["c",0,-.21,0,-.27,-.03,-.36],["c",-.12,-.15,-.21,-.24,-.42,-.24],["c",-.24,0,-.45,.15,-.78,.42],["c",-.33,.36,-.45,.54,-.72,1.14],["c",-.03,.12,-.21,.24,-.36,.27],["c",-.12,0,-.15,0,-.24,-.06],["c",-.18,-.12,-.18,-.21,-.06,-.54],["c",.21,-.57,.42,-.93,.78,-1.32],["c",.54,-.51,1.2,-.81,1.95,-.87],["c",.81,-.03,1.53,.3,1.92,.87],["l",.12,.18],["l",.09,-.09],["c",.57,-.45,1.41,-.84,2.19,-.96],["z"]],w:9.41,h:9.132},s:{d:[["M",4.47,-8.73],["c",.09,0,.36,-.03,.57,-.03],["c",.75,.03,1.29,.24,1.71,.63],["c",.51,.54,.66,1.26,.36,1.83],["c",-.24,.42,-.63,.57,-1.11,.42],["c",-.33,-.09,-.6,-.36,-.6,-.57],["c",0,-.03,.06,-.21,.15,-.39],["c",.12,-.21,.15,-.33,.18,-.48],["c",0,-.24,-.06,-.48,-.15,-.6],["c",-.15,-.21,-.42,-.24,-.75,-.15],["c",-.27,.06,-.48,.18,-.69,.36],["c",-.39,.39,-.51,.96,-.33,1.38],["c",.09,.21,.42,.51,.78,.72],["c",1.11,.69,1.59,1.11,1.89,1.68],["c",.21,.39,.24,.78,.15,1.29],["c",-.18,1.2,-1.17,2.16,-2.52,2.52],["c",-1.02,.24,-1.95,.12,-2.7,-.42],["c",-.72,-.51,-.99,-1.47,-.6,-2.19],["c",.24,-.48,.72,-.63,1.17,-.42],["c",.33,.18,.54,.45,.57,.81],["c",0,.21,-.03,.3,-.33,.51],["c",-.33,.24,-.39,.42,-.27,.69],["c",.06,.15,.21,.27,.45,.33],["c",.3,.09,.87,.09,1.2,0],["c",.75,-.21,1.23,-.72,1.29,-1.35],["c",.03,-.42,-.15,-.81,-.54,-1.2],["c",-.24,-.24,-.48,-.42,-1.41,-1.02],["c",-.69,-.42,-1.05,-.93,-1.05,-1.47],["c",0,-.39,.12,-.87,.3,-1.23],["c",.27,-.57,.78,-1.05,1.38,-1.35],["c",.24,-.12,.63,-.27,.9,-.3],["z"]],w:6.632,h:8.758},z:{d:[["M",2.64,-7.95],["c",.36,-.09,.81,-.03,1.71,.27],["c",.78,.21,.96,.27,1.74,.3],["c",.87,.06,1.02,.03,1.38,-.21],["c",.21,-.15,.33,-.15,.48,-.06],["c",.15,.09,.21,.3,.15,.45],["c",-.03,.06,-1.26,1.26,-2.76,2.67],["l",-2.73,2.55],["l",.54,.03],["c",.54,.03,.72,.03,2.01,.15],["c",.36,.03,.9,.06,1.2,.09],["c",.66,0,.81,-.03,1.02,-.24],["c",.3,-.3,.39,-.72,.27,-1.23],["c",-.06,-.27,-.06,-.27,-.03,-.39],["c",.15,-.3,.54,-.27,.69,.03],["c",.15,.33,.27,1.02,.27,1.5],["c",0,1.47,-1.11,2.7,-2.52,2.79],["c",-.57,.03,-1.02,-.09,-2.01,-.51],["c",-1.02,-.42,-1.23,-.48,-2.13,-.54],["c",-.81,-.06,-.96,-.03,-1.26,.18],["c",-.12,.06,-.24,.12,-.27,.12],["c",-.27,0,-.45,-.3,-.36,-.51],["c",.03,-.06,1.32,-1.32,2.91,-2.79],["l",2.88,-2.73],["c",-.03,0,-.21,.03,-.42,.06],["c",-.21,.03,-.78,.09,-1.23,.12],["c",-1.11,.12,-1.23,.15,-1.95,.27],["c",-.72,.15,-1.17,.18,-1.29,.09],["c",-.27,-.18,-.21,-.75,.12,-1.26],["c",.39,-.6,.93,-1.02,1.59,-1.2],["z"]],w:8.573,h:8.743},"+":{d:[["M",3.48,-9.3],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,1.29],["l",0,1.29],["l",1.29,0],["c",1.23,0,1.29,0,1.41,.06],["c",.06,.03,.15,.09,.18,.12],["c",.12,.09,.21,.33,.21,.48],["c",0,.15,-.09,.39,-.21,.48],["c",-.03,.03,-.12,.09,-.18,.12],["c",-.12,.06,-.18,.06,-1.41,.06],["l",-1.29,0],["l",0,1.29],["c",0,1.23,0,1.29,-.06,1.41],["c",-.09,.18,-.15,.24,-.3,.33],["c",-.21,.09,-.39,.09,-.57,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.06,-.12,-.06,-.18,-.06,-1.41],["l",0,-1.29],["l",-1.29,0],["c",-1.23,0,-1.29,0,-1.41,-.06],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.09,-.36,0,-.54],["c",.09,-.18,.15,-.24,.33,-.33],["l",.15,-.06],["l",1.26,0],["l",1.29,0],["l",0,-1.29],["c",0,-1.23,0,-1.29,.06,-1.41],["c",.09,-.18,.15,-.24,.33,-.33],["z"]],w:7.507,h:7.515},",":{d:[["M",1.85,-3.36],["c",.57,-.15,1.17,.03,1.59,.45],["c",.45,.45,.6,.96,.51,1.89],["c",-.09,1.23,-.42,2.46,-.99,3.93],["c",-.3,.72,-.72,1.62,-.78,1.68],["c",-.18,.21,-.51,.18,-.66,-.06],["c",-.03,-.06,-.06,-.15,-.06,-.18],["c",0,-.06,.12,-.33,.24,-.63],["c",.84,-1.8,1.02,-2.61,.69,-3.24],["c",-.12,-.24,-.27,-.36,-.75,-.6],["c",-.36,-.15,-.42,-.21,-.6,-.39],["c",-.69,-.69,-.69,-1.71,0,-2.4],["c",.21,-.21,.51,-.39,.81,-.45],["z"]],w:3.452,h:8.143},"-":{d:[["M",.18,-5.34],["c",.09,-.06,.15,-.06,2.31,-.06],["c",2.46,0,2.37,0,2.46,.21],["c",.12,.21,.03,.42,-.15,.54],["c",-.09,.06,-.15,.06,-2.28,.06],["c",-2.16,0,-2.22,0,-2.31,-.06],["c",-.27,-.15,-.27,-.54,-.03,-.69],["z"]],w:5.001,h:.81},".":{d:[["M",1.32,-3.36],["c",1.05,-.27,2.1,.57,2.1,1.65],["c",0,1.08,-1.05,1.92,-2.1,1.65],["c",-.9,-.21,-1.5,-1.14,-1.26,-2.04],["c",.12,-.63,.63,-1.11,1.26,-1.26],["z"]],w:3.413,h:3.402},"scripts.wedge":{d:[["M",-3.66,-7.44],["c",.06,-.09,0,-.09,.81,.03],["c",1.86,.3,3.84,.3,5.73,0],["c",.78,-.12,.72,-.12,.78,-.03],["c",.15,.15,.12,.24,-.24,.6],["c",-.93,.93,-1.98,2.76,-2.67,4.62],["c",-.3,.78,-.51,1.71,-.51,2.13],["c",0,.15,0,.18,-.06,.27],["c",-.12,.09,-.24,.09,-.36,0],["c",-.06,-.09,-.06,-.12,-.06,-.27],["c",0,-.42,-.21,-1.35,-.51,-2.13],["c",-.69,-1.86,-1.74,-3.69,-2.67,-4.62],["c",-.36,-.36,-.39,-.45,-.24,-.6],["z"]],w:7.49,h:7.752},"scripts.thumb":{d:[["M",-.54,-3.69],["c",.15,-.03,.36,-.06,.51,-.06],["c",1.44,0,2.58,1.11,2.94,2.85],["c",.09,.48,.09,1.32,0,1.8],["c",-.27,1.41,-1.08,2.43,-2.16,2.73],["l",-.18,.06],["l",0,.12],["c",.03,.06,.06,.45,.09,.87],["c",.03,.57,.03,.78,0,.84],["c",-.09,.27,-.39,.48,-.66,.48],["c",-.27,0,-.57,-.21,-.66,-.48],["c",-.03,-.06,-.03,-.27,0,-.84],["c",.03,-.42,.06,-.81,.09,-.87],["l",0,-.12],["l",-.18,-.06],["c",-1.08,-.3,-1.89,-1.32,-2.16,-2.73],["c",-.09,-.48,-.09,-1.32,0,-1.8],["c",.15,-.84,.51,-1.53,1.02,-2.04],["c",.39,-.39,.84,-.63,1.35,-.75],["z"],["m",1.05,.9],["c",-.15,-.09,-.21,-.09,-.45,-.12],["c",-.15,0,-.3,.03,-.39,.03],["c",-.57,.18,-.9,.72,-1.08,1.74],["c",-.06,.48,-.06,1.8,0,2.28],["c",.15,.9,.42,1.44,.9,1.65],["c",.18,.09,.21,.09,.51,.09],["c",.3,0,.33,0,.51,-.09],["c",.48,-.21,.75,-.75,.9,-1.65],["c",.03,-.27,.03,-.54,.03,-1.14],["c",0,-.6,0,-.87,-.03,-1.14],["c",-.15,-.9,-.45,-1.44,-.9,-1.65],["z"]],w:5.955,h:9.75},"scripts.open":{d:[["M",-.54,-3.69],["c",.15,-.03,.36,-.06,.51,-.06],["c",1.44,0,2.58,1.11,2.94,2.85],["c",.09,.48,.09,1.32,0,1.8],["c",-.33,1.74,-1.47,2.85,-2.91,2.85],["c",-1.44,0,-2.58,-1.11,-2.91,-2.85],["c",-.09,-.48,-.09,-1.32,0,-1.8],["c",.15,-.84,.51,-1.53,1.02,-2.04],["c",.39,-.39,.84,-.63,1.35,-.75],["z"],["m",1.11,.9],["c",-.21,-.09,-.27,-.09,-.51,-.12],["c",-.3,0,-.42,.03,-.66,.15],["c",-.24,.12,-.51,.39,-.66,.63],["c",-.54,.93,-.63,2.64,-.21,3.81],["c",.21,.54,.51,.9,.93,1.11],["c",.21,.09,.24,.09,.54,.09],["c",.3,0,.33,0,.54,-.09],["c",.42,-.21,.72,-.57,.93,-1.11],["c",.36,-.99,.36,-2.37,0,-3.36],["c",-.21,-.54,-.51,-.9,-.9,-1.11],["z"]],w:5.955,h:7.5},"scripts.longphrase":{d:[["M",1.47,-15.09],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.54,.06,11.25],["l",0,11.25],["l",-.63,.15],["c",-.66,.18,-1.44,.39,-1.5,.39],["c",-.03,0,-.03,-3.39,-.03,-11.25],["l",0,-11.25],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:23.04},"scripts.mediumphrase":{d:[["M",1.47,-7.59],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.39,.06,7.5],["l",0,7.5],["l",-.63,.15],["c",-.66,.18,-1.44,.39,-1.5,.39],["c",-.03,0,-.03,-2.28,-.03,-7.5],["l",0,-7.5],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:15.54},"scripts.shortphrase":{d:[["M",1.47,-7.59],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.21,.06,3.75],["l",0,3.75],["l",-.42,.09],["c",-.57,.18,-1.65,.45,-1.71,.45],["c",-.03,0,-.03,-.72,-.03,-3.75],["l",0,-3.75],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:8.04},"scripts.snap":{d:[["M",4.5,-3.39],["c",.36,-.03,.96,-.03,1.35,0],["c",1.56,.15,3.15,.9,4.2,2.01],["c",.24,.27,.33,.42,.33,.6],["c",0,.27,.03,.24,-2.46,2.22],["c",-1.29,1.02,-2.4,1.86,-2.49,1.92],["c",-.18,.09,-.3,.09,-.48,0],["c",-.09,-.06,-1.2,-.9,-2.49,-1.92],["c",-2.49,-1.98,-2.46,-1.95,-2.46,-2.22],["c",0,-.18,.09,-.33,.33,-.6],["c",1.05,-1.08,2.64,-1.86,4.17,-2.01],["z"],["m",1.29,1.17],["c",-1.47,-.15,-2.97,.3,-4.14,1.2],["l",-.18,.15],["l",.06,.09],["c",.15,.12,3.63,2.85,3.66,2.85],["c",.03,0,3.51,-2.73,3.66,-2.85],["l",.06,-.09],["l",-.18,-.15],["c",-.84,-.66,-1.89,-1.08,-2.94,-1.2],["z"]],w:10.38,h:6.84},"noteheads.slash.whole":{d:[["M",5,-5],["l",1,1],["l",-5,5],["l",-1,-1],["z"],["m",4,6],["l",-5,-5],["l",2,-2],["l",5,5],["z"],["m",0,-2],["l",1,1],["l",-5,5],["l",-1,-1],["z"],["m",-4,6],["l",-5,-5],["l",2,-2],["l",5,5],["z"]],w:10.81,h:15.63},"noteheads.slash.quarter":{d:[["M",9,-6],["l",0,4],["l",-9,9],["l",0,-4],["z"]],w:9,h:9},"noteheads.harmonic.quarter":{d:[["M",3.63,-4.02],["c",.09,-.06,.18,-.09,.24,-.03],["c",.03,.03,.87,.93,1.83,2.01],["c",1.5,1.65,1.8,1.98,1.8,2.04],["c",0,.06,-.3,.39,-1.8,2.04],["c",-.96,1.08,-1.8,1.98,-1.83,2.01],["c",-.06,.06,-.15,.03,-.24,-.03],["c",-.12,-.09,-3.54,-3.84,-3.6,-3.93],["c",-.03,-.03,-.03,-.09,-.03,-.15],["c",.03,-.06,3.45,-3.84,3.63,-3.96],["z"]],w:7.5,h:8.165},"noteheads.triangle.quarter":{d:[["M",0,4],["l",9,0],["l",-4.5,-9],["z"]],w:9,h:9}},n=function(e){for(var t=[],n=0,r=e.length;n<r;n++){t[n]=[];for(var i=0,a=e[n].length;i<a;i++)t[n][i]=e[n][i]}return t};return Vd={printSymbol:function(e,r,i,a,s){if(!t[i])return null;var o=n(t[i].d);o[0][1]+=e,o[0][2]+=r;for(var c="",l=0;l<o.length;l++)c+=o[l].join(" ");return s.path=c,a.path(s)},getPathForSymbol:function(e,r,i,a,s){if(a=a||1,s=s||1,!t[i])return null;var o=n(t[i].d);return 1===a&&1===s||function(e,t,n){for(var r=0,i=e.length;r<i;r++){var a,s,o=e[r];for(a=1,s=o.length;a<s;a++)o[a]*=a%2?t:n}}(o,a,s),o[0][1]+=e,o[0][2]+=r,o},getSymbolWidth:function(e){return t[e]?t[e].w:0},symbolHeightInPitches:function(n){return(t[n]?t[n].h:0)/e.STEP},getSymbolAlign:function(e){return"scripts"===e.substring(0,7)&&"scripts.roll"!==e?"center":"left"},getYCorr:function(e){switch(e){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"flags.d64th":case"scripts.trill":case"scripts.upbow":case"scripts.downbow":return-2;case"timesig.common":case"timesig.cut":default:return 0;case"flags.d32nd":case"rests.half":case"rests.8th":case"rests.quarter":case"rests.16th":case"rests.32nd":case"rests.64th":case"scripts.ufermata":case"scripts.wedge":case"scripts.roll":case"scripts.shortphrase":case"scripts.longphrase":return-1;case"flags.u32nd":case"rests.whole":case"scripts.dfermata":return 1;case"flags.u64th":return 3;case"f":case"m":case"p":case"s":case"z":return-4}},setSymbol:function(e,n){t[e]=n}}}function Xg(){if(ef)return Jd;ef=1;var e=function(e){this.type="TieElem",this.anchor1=e.anchor1,this.anchor2=e.anchor2,e.isGrace&&(this.isGrace=!0),e.fixedY&&(this.fixedY=!0),e.stemDir&&(this.stemDir=e.stemDir),void 0!==e.voiceNumber&&(this.voiceNumber=e.voiceNumber),void 0!==e.style&&(this.dotted=!0),this.internalNotes=[]};return e.prototype.addInternalNote=function(e){this.internalNotes.push(e)},e.prototype.setEndAnchor=function(e){this.anchor2=e,this.anchor1?(this.top=Math.max(this.anchor1.pitch,this.anchor2.pitch)+4,this.bottom=Math.min(this.anchor1.pitch,this.anchor2.pitch)-4):(this.top=this.anchor2.pitch+4,this.bottom=this.anchor2.pitch-4)},e.prototype.setStartX=function(e){this.startLimitX=e},e.prototype.setEndX=function(e){this.endLimitX=e},e.prototype.setHint=function(){this.hint=!0},e.prototype.calcTieDirection=function(){if(this.isGrace)this.above=!1;else if(0===this.voiceNumber)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e;e=this.anchor1?this.anchor1.pitch:this.anchor2?this.anchor2.pitch:14,this.anchor1&&"down"===this.anchor1.stemDir&&this.anchor2&&"down"===this.anchor2.stemDir?this.above=!0:this.anchor1&&"up"===this.anchor1.stemDir&&this.anchor2&&"up"===this.anchor2.stemDir?this.above=!1:this.anchor1&&this.anchor2?this.above=e>=6:this.anchor1?this.above="down"===this.anchor1.stemDir:this.anchor2?this.above="down"===this.anchor2.stemDir:this.above=e>=6}},e.prototype.calcSlurDirection=function(){if(this.isGrace)this.above=!1;else if(0===this.voiceNumber)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e=!1;this.anchor1&&"down"===this.anchor1.stemDir&&(e=!0),this.anchor2&&"down"===this.anchor2.stemDir&&(e=!0);for(var t=0;t<this.internalNotes.length;t++){"down"===this.internalNotes[t].stemDir&&(e=!0)}this.above=e}},e.prototype.calcX=function(e,t){this.anchor1?(this.startX=this.anchor1.x,this.anchor1.scalex<1&&(this.startX-=3)):this.startLimitX?this.startX=this.startLimitX.x+this.startLimitX.w:this.anchor2?this.startX=this.anchor2.x-20:this.startX=e,!this.anchor1&&this.dotted&&(this.startX-=3),this.anchor2?this.endX=this.anchor2.x:this.endLimitX?this.endX=this.endLimitX.x:this.endX=t},e.prototype.calcTieY=function(){this.anchor1?this.startY=this.anchor1.pitch:this.anchor2?this.startY=this.anchor2.pitch:this.startY=this.above?14:0,this.anchor2?this.endY=this.anchor2.pitch:this.anchor1?this.endY=this.anchor1.pitch:this.endY=this.above?14:0},e.prototype.calcSlurY=function(){if(this.anchor1&&this.anchor2){this.above&&"up"===this.anchor1.stemDir&&!this.fixedY?(this.startY=(this.anchor1.highestVert+this.anchor1.pitch)/2,this.startX+=this.anchor1.w/2):this.startY=this.anchor1.pitch;var e=this.anchor2.parent.beam&&this.anchor2.parent.beam.stemsUp&&this.anchor2.parent.beam.elems[0]!==this.anchor2.parent,t=(this.anchor2.highestVert+this.anchor2.pitch)/2;if(this.above&&"up"===this.anchor2.stemDir&&!this.fixedY&&!e&&t<this.startY?(this.endY=t,this.endX+=Math.round(this.anchor2.w/2)):this.endY=this.above&&e?this.anchor2.highestVert:this.anchor2.pitch,1===this.anchor1.scalex){var n=!!this.anchor1.parent.beam,r=!!this.anchor2.parent.beam;if(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);if(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)},e.prototype.avoidCollisionAbove=function(){if(this.above){for(var e=-50,t=0;t<this.internalNotes.length;t++)this.internalNotes[t].highestVert>e&&(e=this.internalNotes[t].highestVert);e>this.startY&&e>this.endY&&(this.startY=this.endY=e-1)}},e.prototype.getYBounds=function(){var e,t;return this.isTie?(this.calcTieDirection(),this.calcX(10,1e3),this.calcTieY()):(this.calcSlurDirection(),this.calcX(10,1e3),this.calcSlurY()),this.above?e=(t=Math.min(this.startY,this.endY))+3:t=(e=Math.min(this.startY,this.endY))-3,[e,t]},Jd=e}function Zg(){if(nf)return tf;nf=1;var e=$d?Yd:($d=1,Yd=function(e,t,n){this.type="DynamicDecoration",this.anchor=e,this.dec=t,"below"===n?this.volumeHeightBelow=6:this.volumeHeightAbove=6,this.pitch=void 0}),t=Qd?Kd:(Qd=1,Kd=function(e,t,n,r){this.type="CrescendoElem",this.anchor1=e,this.anchor2=t,this.dir=n,"above"===r?this.dynamicHeightAbove=6:this.dynamicHeightBelow=6,this.pitch=void 0}),n=Zd?Xd:(Zd=1,Xd=function(e,t){this.type="GlissandoElem",this.anchor1=e,this.anchor2=t}),r=Qg(),i=jg(),a=Xg(),s=function(){this.startDiminuendoX=void 0,this.startCrescendoX=void 0,this.minTop=12,this.minBottom=0},o=function(e,t,n,a,s){function o(e,t){var o="down"===s?function(){if(0===a.heads.length)return 2;for(var e=a.heads[0].pitch,t=1;t<a.heads.length;t++)e=Math.min(e,a.heads[t].pitch);return e}()+1:function(){if(0===a.heads.length)return 10;for(var e=a.heads[0].pitch,t=1;t<a.heads.length;t++)e=Math.max(e,a.heads[t].pitch);return e}()+9;"down"!==s&&1===t&&o--;var c=n/2;c+="down"===s?-5:3;for(var l=0;l<t;l++)o-=1,a.addFixedX(new i(e,c,r.getSymbolWidth(e),o))}for(var c=0;c<e.length;c++)switch(e[c]){case"/":o("flags.ugrace",1);break;case"//":o("flags.ugrace",2);break;case"///":o("flags.ugrace",3);break;case"////":o("flags.ugrace",4)}};return s.prototype.dynamicDecoration=function(e,r,i,a){for(var s,o,c,l=0;l<r.length;l++)switch(r[l]){case"diminuendo(":this.startDiminuendoX=i,s=void 0;break;case"diminuendo)":s={start:this.startDiminuendoX,stop:i},this.startDiminuendoX=void 0;break;case"crescendo(":this.startCrescendoX=i,o=void 0;break;case"crescendo)":o={start:this.startCrescendoX,stop:i},this.startCrescendoX=void 0;break;case"~(":case"glissando(":this.startGlissandoX=i,c=void 0;break;case"~)":case"glissando)":c={start:this.startGlissandoX,stop:i},this.startGlissandoX=void 0}s&&e.addOther(new t(s.start,s.stop,">",a)),o&&e.addOther(new t(o.start,o.stop,"<",a)),c&&e.addOther(new n(c.start,c.stop))},s.prototype.createDecoration=function(t,n,s,c,l,u,h,d,f,p,m){f||(f={ornamentPosition:"above",volumePosition:p?"above":"below",dynamicPosition:p?"above":"below"}),function(t,n,r,i){for(var a=0;a<n.length;a++)switch(n[a]){case"p":case"mp":case"pp":case"ppp":case"pppp":case"f":case"ff":case"fff":case"ffff":case"sfz":case"mf":var s=new e(r,n[a],i);t.addOther(s)}}(t,n,l,f.volumePosition),this.dynamicDecoration(t,n,l,f.dynamicPosition),o(n,0,c,l,h);var g=function(e,t,n,s,o,c,l,u,h){for(var d,f=0;f<t.length;f++){if("staccato"===t[f]||"tenuto"===t[f]||"accent"===t[f]&&!h){var p="scripts."+t[f];if("accent"===t[f]&&(p="scripts.sforzato"),d=void 0===d?"down"===l?n+2:u-2:"down"===l?d+2:d-2,"accent"===t[f])"up"===l?d--:d++;else switch(d){case 2:case 4:case 6:case 8:case 10:"up"===l?d--:d++}n>9&&d++;var m=s/2;"center"!==r.getSymbolAlign(p)&&(m-=r.getSymbolWidth(p)/2),o.addFixedX(new i(p,m,r.getSymbolWidth(p),d))}if("slide"===t[f]&&o.heads[0]){var g=o.heads[0].pitch,v=new i("",-c-15,0,(g-=2)-1),y=new i("",-c-5,0,g+1);o.addFixedX(v),o.addFixedX(y),e.addOther(new a({anchor1:v,anchor2:y,fixedY:!0}))}}return void 0===d&&(d=n),{above:d,below:o.bottom}}(t,n,s,c,l,u,h,d,m);g.above=Math.max(g.above,this.minTop),g.below=Math.min(g.below,d),function(e,t,n,a,s,o,c,l){function u(e,t){"above"===e?a.above+=t:a.below-=t}function h(e){var t;return"above"===e?(t=a.above)<o&&(t=o):(t=a.below)>c&&(t=c),t}function d(e,r,a){var s=h(r);n.addFixedX(new i(e,t/2,0,s+2,{type:"decoration",klass:"ornament",thickness:3,anchor:a})),u(r,5)}function f(e,a){var s=t/2;"center"!==r.getSymbolAlign(e)&&(s-=r.getSymbolWidth(e)/2);var o=r.symbolHeightInPitches(e)+1,c=h(a);c="above"===a?c+o/2:c-o/2,n.addFixedX(new i(e,s,r.getSymbolWidth(e),c,{klass:"ornament",thickness:r.symbolHeightInPitches(e),position:a})),u(a,o)}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,g=0;g<e.length;g++)switch(e[g]){case"0":case"1":case"2":case"3":case"4":case"5":case"D.C.":case"D.S.":d(e[g],s,"middle"),m=!0;break;case"D.C.alcoda":d("D.C. al coda",s,"end"),m=!0;break;case"D.C.alfine":d("D.C. al fine",s,"end"),m=!0;break;case"D.S.alcoda":d("D.S. al coda",s,"end"),m=!0;break;case"D.S.alfine":d("D.S. al fine",s,"end"),m=!0;break;case"fine":d("FINE",s,"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":f(p[e[g]],s),m=!0;break;case"invertedfermata":f(p[e[g]],"below"),m=!0;break;case"mark":n.klass="mark";break;case"accent":l&&(f("scripts.sforzato",s),m=!0)}}(n,c,l,g,f.ornamentPosition,this.minTop,d,m),function(e,t,n){for(var a=0;a<e.length;a++)if("arpeggio"===e[a])for(var s=t.abcelem.minpitch-1;s<=t.abcelem.maxpitch;s+=2)t.addExtra(new i("scripts.arpeggio",2*-r.getSymbolWidth("scripts.arpeggio")-n,0,s+2,{klass:"ornament",thickness:r.symbolHeightInPitches("scripts.arpeggio")}))}(n,l,u)},tf=s}function Jg(){if(lf)return cf;lf=1;var e=of?sf:(of=1,sf=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=function(e){this.getTextSize=e,this.voices=[],this.staffs=[],this.brace=void 0,this.bracket=void 0};return t.prototype.setLimit=function(e,t){t.specialY[e]&&(t.staff.specialY[e]?t.staff.specialY[e]=Math.max(t.staff.specialY[e],t.specialY[e]):t.staff.specialY[e]=t.specialY[e])},t.prototype.addVoice=function(e,t,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]},t.prototype.setHeight=function(){this.height=e(this)},t.prototype.setWidth=function(e){this.w=e;for(var t=0;t<this.voices.length;t++)this.voices[t].setWidth(e)},t.prototype.setStaffLimits=function(e){e.staff.top=Math.max(e.staff.top,e.top),e.staff.bottom=Math.min(e.staff.bottom,e.bottom),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},cf=t}function ev(){if(vf)return gf;vf=1;var e=jg(),t=Ng();const n=function(){if(mf)return pf;function e(e){switch(e){case"B#":return"H#";case"B♯":return"H♯";case"B":return"H";case"Bb":case"B♭":return"B"}return e}return mf=1,pf=function(t,n,r){var i=t.split("\n");for(let a=0;a<i.length;a++){let t=i[a].match(/^([ABCDEFG][♯♭]?)?([^\/]+)?(\/([ABCDEFG][#b♯♭]?))?/);if(!t)continue;let s=t[1]||"",o=t[2]||"",c=t[4]||"";r&&(s=e(s),c=e(c));const l=n?"":"",u=c?"/"+c:"";i[a]=[s,o,u].join(l)}return i.join("\n")}}();function r(r,i,a,s,o,c,l,u,h,d,f,p,m,g,v){for(var y=r.split("\n"),b=y.length-1;b>=0;b--){var _,w=y[b],x=0;s||(w=n(w,g,v));var k=u.calc(w,o,c),C=k.width,S=k.height/t.STEP;switch(i){case"left":x=-(f+=C+7),_=d.averagepitch,h.addExtra(new e(w,x,C+4,_,{type:"text",height:S,dim:l,position:"left"}));break;case"right":x=p+=4,_=d.averagepitch,h.addRight(new e(w,x,C+4,_,{type:"text",height:S,dim:l,position:"right"}));break;case"below":h.addRight(new e(w,0,0,void 0,{type:"text",position:"below",height:S,dim:l,realWidth:C}));break;case"above":h.addRight(new e(w,0,0,void 0,{type:"text",position:"above",height:S,dim:l,realWidth:C}));break;default:if(a){var E=a.y+3*t.STEP;h.addRight(new e(w,x+a.x,0,d.minpitch+E/t.STEP,{position:"relative",type:"text",height:S,dim:l}))}else{var M="above";d.positioning&&d.positioning.chordPosition&&(M=d.positioning.chordPosition),"hidden"!==M&&h.addCentered(new e(w,m/2,C,void 0,{type:"chord",position:M,height:S,dim:l,realWidth:C}))}}}return{roomTaken:f,roomTakenRight:p}}return gf=function(e,t,n,i,a,s,o,c){for(var l=0;l<n.chord.length;l++){var u,h,d=n.chord[l].position,f=n.chord[l].rel_position,p="left"===d||"right"===d||"below"===d||"above"===d||!!f;p?(u="annotationfont",h="abcjs-annotation"):(u="gchordfont",h="abcjs-chord");var m,g=e.attr(u,h),v=n.chord[l].name;if("string"==typeof v)i=(m=r(v,d,f,p,u,h,g,e,t,n,i,a,s,o,c)).roomTaken,a=m.roomTakenRight;else for(var y=0;y<v.length;y++)i=(m=r(v[y].text,d,f,p,u,h,g,e,t,n,i,a,s,o,c)).roomTaken,a=m.roomTakenRight}return{roomTaken:i,roomTakenRight:a}}}function tv(){if(bf)return yf;bf=1;var e=zg(),t=function(){if(Bd)return Dd;Bd=1;var e=function(e,t,n,r){this.type="BeamElem",this.isflat=!!n,this.isgrace=!(!t||"grace"!==t),this.forceup=!!(this.isgrace||t&&"up"===t),this.forcedown=!(!t||"down"!==t),this.elems=[],this.total=0,this.average=6,this.allrests=!0,this.stemHeight=e,this.beams=[],r&&r.duration?(this.duration=r.duration,r.startTriplet&&(this.duration*=r.tripletMultiplier),this.duration=Math.round(1e3*this.duration)/1e3):this.duration=0};function t(e,t){return t?e/t:0}return e.prototype.setHint=function(){this.hint=!0},e.prototype.runningDirection=function(e){var t=e.averagepitch;void 0!==t&&(this.total=Math.round(this.total+t),this.count||(this.count=0),this.count++)},e.prototype.add=function(e){var t=e.abcelem.averagepitch;void 0!==t&&(e.abcelem.rest||(this.allrests=!1),e.beam=this,this.elems.push(e),this.total=Math.round(this.total+t),(void 0===this.min||e.abcelem.minpitch<this.min)&&(this.min=e.abcelem.minpitch),(void 0===this.max||e.abcelem.maxpitch>this.max)&&(this.max=e.abcelem.maxpitch))},e.prototype.addBeam=function(e){this.beams.push(e)},e.prototype.setStemDirection=function(){this.average=t(this.total,this.count),this.forceup?this.stemsUp=!0:this.forcedown?this.stemsUp=!1:this.stemsUp=this.average<6,delete this.count,this.total=0},e.prototype.calcDir=function(){this.average=t(this.total,this.elems.length),this.forceup?this.stemsUp=!0:this.forcedown?this.stemsUp=!1:this.stemsUp=this.average<6;for(var e=this.stemsUp?"up":"down",n=0;n<this.elems.length;n++)for(var r=0;r<this.elems[n].heads.length;r++)this.elems[n].heads[r].stemDir=e},Dd=e}(),n=function(){if(Ld)return Od;Ld=1;var e=function(e,t){this.startVoice=e,this.type=t};return e.prototype.setBottomStaff=function(e){this.endVoice=e,this.startVoice.header&&!this.endVoice.header&&(this.header=this.startVoice.header,delete this.startVoice.header)},e.prototype.continuing=function(e){this.lastContinuedVoice=e},e.prototype.getWidth=function(){return 10},e.prototype.isStartVoice=function(e){return!!(this.startVoice&&this.startVoice.staff&&this.startVoice.staff.voices.length>0&&this.startVoice.staff.voices[0]===e)},Od=e}(),r=function(){if(zd)return Fd;zd=1;var e=zg(),t=Qg(),n=jg();return Fd=function(r,i){var a,s=0;r.el_type="clef";var o=new e(r,0,10,"staff-extra clef",i);switch(o.isClef=!0,r.type){case"treble":a="clefs.G";break;case"tenor":case"alto":a="clefs.C";break;case"bass":a="clefs.F";break;case"treble+8":a="clefs.G",s=1;break;case"tenor+8":case"alto+8":a="clefs.C",s=1;break;case"bass+8":a="clefs.F",s=1;break;case"treble-8":a="clefs.G",s=-1;break;case"tenor-8":case"alto-8":a="clefs.C",s=-1;break;case"bass-8":a="clefs.F",s=-1;break;case"none":return null;case"perc":a="clefs.perc";break;default:o.addFixed(new n("clef="+r.type,0,0,void 0,{type:"debug"}))}if(a){var c=t.symbolHeightInPitches(a),l=function(e){switch(e){case"clefs.G":return-5;case"clefs.C":case"clefs.F":return-4;case"clefs.perc":return-2;default:return 0}}(a);if(o.addRight(new n(a,5,t.getSymbolWidth(a),r.clefPos,{top:c+r.clefPos+l,bottom:r.clefPos+l})),0!==s){var u=2/3,h=(t.getSymbolWidth(a)-t.getSymbolWidth("8")*u)/2,d=s>0?o.top+3:o.bottom-1,f=s>0?o.top+3:o.bottom-3,p=f-2;"bass-8"===r.type&&(d=3,h=0),o.addRight(new n("8",5+h,t.getSymbolWidth("8")*u,d,{scalex:u,scaley:u,top:f,bottom:p}))}}return o}}(),i=function(){if(qd)return jd;qd=1;var e=zg(),t=Qg(),n=jg();return jd=function(r,i){if(r.el_type="keySignature",!r.accidentals||0===r.accidentals.length)return null;var a=new e(r,0,10,"staff-extra key-signature",i);a.isKeySig=!0;var s=0;return r.accidentals.forEach((function(e){var r,i=0;switch(e.acc){case"sharp":r="accidentals.sharp",i=-3;break;case"natural":r="accidentals.nat";break;case"flat":r="accidentals.flat",i=-1.2;break;case"quartersharp":r="accidentals.halfsharp",i=-2.5;break;case"quarterflat":r="accidentals.halfflat",i=-1.2;break;default:r="accidentals.flat"}a.addRight(new n(r,s,t.getSymbolWidth(r),e.verticalPos,{thickness:t.symbolHeightInPitches(r),top:e.verticalPos+t.symbolHeightInPitches(r)+i,bottom:e.verticalPos+i})),s+=t.getSymbolWidth(r)+2}),this),a}}(),a=function(){if(Ud)return Hd;Ud=1;var e=Qg(),t=jg();return Hd=function(n,r,i,a){a||(a={});var s,o=void 0!==a.dir?a.dir:null,c=void 0!==a.headx?a.headx:0,l=void 0!==a.extrax?a.extrax:0,u=void 0!==a.flag?a.flag:null,h=void 0!==a.dot?a.dot:0,d=void 0!==a.dotshiftx?a.dotshiftx:0,f=void 0!==a.scale?a.scale:1,p=void 0!==a.accidentalSlot?a.accidentalSlot:[],m=void 0!==a.shouldExtendStem&&a.shouldExtendStem,g=void 0===a.printAccidentals||a.printAccidentals,v=i.verticalPos,y=0,b=0,_=0;if(void 0===r)n.addFixed(new t("pitch is undefined",0,0,0,{type:"debug"}));else if(""===r)s=new t(null,0,0,v);else{var w=c;if(i.printer_shift){var x="same"===i.printer_shift?1:0;w="down"===o?-e.getSymbolWidth(r)*f+x:e.getSymbolWidth(r)*f-x}var k={scalex:f,scaley:f,thickness:e.symbolHeightInPitches(r)*f,name:i.name};if((s=new t(r,w,e.getSymbolWidth(r)*f,v,k)).stemDir=o,u){var C=v+("down"===o?-7:7)*f;m&&("down"===o&&C>6&&(C=6),"up"===o&&C<6&&(C=6));var S="down"===o?c:c+s.w-.6;n.addRight(new t(u,S,e.getSymbolWidth(u)*f,C,{scalex:f,scaley:f}))}for(b=s.w+d-2+5*h;h>0;h--){var E=1-Math.abs(v)%2;n.addRight(new t("dots.dot",s.w+d-2+5*h,e.getSymbolWidth("dots.dot"),v+E))}}if(s&&(s.highestVert=i.highestVert),g&&i.accidental){var M;switch(i.accidental){case"quartersharp":M="accidentals.halfsharp";break;case"dblsharp":M="accidentals.dblsharp";break;case"sharp":M="accidentals.sharp";break;case"quarterflat":M="accidentals.halfflat";break;case"flat":M="accidentals.flat";break;case"dblflat":M="accidentals.dblflat";break;case"natural":M="accidentals.nat"}for(var T=!1,N=l,A=0;A<p.length;A++)if(v-p[A][0]>=6){p[A][0]=v,N=p[A][1],T=!0;break}!1===T&&(N-=e.getSymbolWidth(M)*f+2,p.push([v,N]),y=e.getSymbolWidth(M)*f+2);var P=e.symbolHeightInPitches(M);n.addExtra(new t(M,N,e.getSymbolWidth(M),v,{scalex:f,scaley:f,top:v+P/2,bottom:v-P/2})),_=e.getSymbolWidth(M)/2}return{notehead:s,accidentalshiftx:y,dotshiftx:b,extraLeft:_}}}(),s=function(){if(Wd)return Gd;Wd=1;var e=zg(),t=Qg(),n=jg();return Gd=function(r,i){r.el_type="timeSignature";var a=new e(r,0,10,"staff-extra time-signature",i);if("specified"===r.type)for(var s=0,o=0;o<r.value.length;o++)if(0!==o&&(a.addRight(new n("+",s+1,t.getSymbolWidth("+"),6,{thickness:t.symbolHeightInPitches("+")})),s+=t.getSymbolWidth("+")+2),r.value[o].den){for(var c=0,l=0;l<r.value[o].num.length;l++)c+=t.getSymbolWidth(r.value[o].num[l]);var u=0;for(l=0;l<r.value[o].num.length;l++)u+=t.getSymbolWidth(r.value[o].den[l]);var h=Math.max(c,u);a.addRight(new n(r.value[o].num,s+(h-c)/2,c,8,{thickness:t.symbolHeightInPitches(r.value[o].num[0])})),a.addRight(new n(r.value[o].den,s+(h-u)/2,u,4,{thickness:t.symbolHeightInPitches(r.value[o].den[0])})),s+=h}else{for(var d=0,f=0;f<r.value[o].num.length;f++)d+=t.getSymbolWidth(r.value[o].num[f]);a.addRight(new n(r.value[o].num,s,d,6,{thickness:t.symbolHeightInPitches(r.value[o].num[0])})),s+=d}else"common_time"===r.type?a.addRight(new n("timesig.common",0,t.getSymbolWidth("timesig.common"),6,{thickness:t.symbolHeightInPitches("timesig.common")})):"cut_time"===r.type?a.addRight(new n("timesig.cut",0,t.getSymbolWidth("timesig.cut"),6,{thickness:t.symbolHeightInPitches("timesig.cut")})):"tempus_imperfectum"===r.type?a.addRight(new n("timesig.imperfectum",0,t.getSymbolWidth("timesig.imperfectum"),6,{thickness:t.symbolHeightInPitches("timesig.imperfectum")})):"tempus_imperfectum_prolatio"===r.type?a.addRight(new n("timesig.imperfectum2",0,t.getSymbolWidth("timesig.imperfectum2"),6,{thickness:t.symbolHeightInPitches("timesig.imperfectum2")})):"tempus_perfectum"===r.type?a.addRight(new n("timesig.perfectum",0,t.getSymbolWidth("timesig.perfectum"),6,{thickness:t.symbolHeightInPitches("timesig.perfectum")})):"tempus_perfectum_prolatio"===r.type?a.addRight(new n("timesig.perfectum2",0,t.getSymbolWidth("timesig.perfectum2"),6,{thickness:t.symbolHeightInPitches("timesig.perfectum2")})):console.log("time signature:",r);return a}}(),o=Zg(),c=af?rf:(af=1,rf=function(e,t,n){this.type="EndingElem",this.text=e,this.anchor1=t,this.anchor2=n,this.endingHeightAbove=5,this.pitch=void 0}),l=Qg(),u=jg(),h=Ng(),d=Jg(),f=function(){if(hf)return uf;hf=1;var e=zg(),t=jg(),n=function(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))};return n.prototype.setX=function(e){this.x=e},n.prototype.createNote=function(n,r,i){var a,s,o,c=.75,l=r.duration[0],u=new e(r,l,1,"tempo",i);l<=1/32?(o="noteheads.quarter",s="flags.u32nd",a=0):l<=1/16?(o="noteheads.quarter",s="flags.u16th",a=0):l<=3/32?(o="noteheads.quarter",s="flags.u16nd",a=1):l<=1/8?(o="noteheads.quarter",s="flags.u8th",a=0):l<=3/16?(o="noteheads.quarter",s="flags.u8th",a=1):l<=1/4?(o="noteheads.quarter",a=0):l<=3/8?(o="noteheads.quarter",a=1):l<=.5?(o="noteheads.half",a=0):l<=3/4?(o="noteheads.half",a=1):l<=1?(o="noteheads.whole",a=0):l<=1.5?(o="noteheads.whole",a=1):l<=2?(o="noteheads.dbl",a=0):(o="noteheads.dbl",a=1);var h,d=n(u,o,{verticalPos:0},{dir:"up",flag:s,dot:a,scale:c}).notehead;if(u.addHead(d),"noteheads.whole"!==o&&"noteheads.dbl"!==o){var f=d.dx+d.w;h=new t(null,f,0,.25,{type:"stem",pitch2:3.75,linewidth:-.6}),u.addRight(h)}return u},uf=n}(),p=Xg(),m=function(){if(ff)return df;ff=1;var e=function(e,t,n){this.type="TripletElem",this.anchor1=t,this.number=e,this.durationClass=("d"+Math.round(1e3*t.parent.durationClass)/1e3).replace(/\./,"-"),this.middleElems=[],this.flatBeams=n.flatBeams};return e.prototype.isClosed=function(){return!!this.anchor2},e.prototype.middleNote=function(e){this.middleElems.push(e)},e.prototype.setCloseAnchor=function(e){this.anchor2=e,this.anchor1.parent.beam&&"up"!==this.anchor1.stemDir||(this.endingHeightAbove=4)},df=e}(),g=Lg(),v=ev(),y=Pg(),b=yh(),_=function(e){var t=0;return e.duration&&(t=e.duration),t},w=!1,x={rest:{0:"rests.whole",1:"rests.half",2:"rests.quarter",3:"rests.8th",4:"rests.16th",5:"rests.32nd",6:"rests.64th",7:"rests.128th",multi:"rests.multimeasure"},note:{"-1":"noteheads.dbl",0:"noteheads.whole",1:"noteheads.half",2:"noteheads.quarter",3:"noteheads.quarter",4:"noteheads.quarter",5:"noteheads.quarter",6:"noteheads.quarter",7:"noteheads.quarter",nostem:"noteheads.quarter"},rhythm:{"-1":"noteheads.slash.whole",0:"noteheads.slash.whole",1:"noteheads.slash.whole",2:"noteheads.slash.quarter",3:"noteheads.slash.quarter",4:"noteheads.slash.quarter",5:"noteheads.slash.quarter",6:"noteheads.slash.quarter",7:"noteheads.slash.quarter",nostem:"noteheads.slash.nostem"},x:{"-1":"noteheads.indeterminate",0:"noteheads.indeterminate",1:"noteheads.indeterminate",2:"noteheads.indeterminate",3:"noteheads.indeterminate",4:"noteheads.indeterminate",5:"noteheads.indeterminate",6:"noteheads.indeterminate",7:"noteheads.indeterminate",nostem:"noteheads.indeterminate"},harmonic:{"-1":"noteheads.harmonic.quarter",0:"noteheads.harmonic.quarter",1:"noteheads.harmonic.quarter",2:"noteheads.harmonic.quarter",3:"noteheads.harmonic.quarter",4:"noteheads.harmonic.quarter",5:"noteheads.harmonic.quarter",6:"noteheads.harmonic.quarter",7:"noteheads.harmonic.quarter",nostem:"noteheads.harmonic.quarter"},triangle:{"-1":"noteheads.triangle.quarter",0:"noteheads.triangle.quarter",1:"noteheads.triangle.quarter",2:"noteheads.triangle.quarter",3:"noteheads.triangle.quarter",4:"noteheads.triangle.quarter",5:"noteheads.triangle.quarter",6:"noteheads.triangle.quarter",7:"noteheads.triangle.quarter",nostem:"noteheads.triangle.quarter"},uflags:{3:"flags.u8th",4:"flags.u16th",5:"flags.u32nd",6:"flags.u64th"},dflags:{3:"flags.d8th",4:"flags.d16th",5:"flags.d32nd",6:"flags.d64th"}},k=function(e,t,n){this.decoration=new o,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()};function C(e,t){var n=e[t];if("note"!==n.el_type||!n.startBeam||n.endBeam)return{count:1,elem:n};for(var r=[];t<e.length&&"note"===e[t].el_type&&(r.push(e[t]),!e[t].endBeam);)t++;return{count:r.length,elem:r}}function S(e){if(e.pitches){E(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}}k.prototype.reset=function(){this.slurs={},this.ties=[],this.voiceScale=1,this.voiceColor=void 0,this.slursbyvoice={},this.tiesbyvoice={},this.endingsbyvoice={},this.scaleByVoice={},this.colorByVoice={},this.tripletmultiplier=1,this.abcline=void 0,this.accidentalSlot=void 0,this.accidentalshiftx=void 0,this.dotshiftx=void 0,this.hasVocals=!1,this.minY=void 0,this.partstartelem=void 0,this.startlimitelem=void 0,this.stemdir=void 0},k.prototype.setStemHeight=function(e){this.stemHeight=Math.round(10*e/h.STEP)/10},k.prototype.getCurrentVoiceId=function(e,t){return"s"+e+"v"+t},k.prototype.pushCrossLineElems=function(e,t){this.slursbyvoice[this.getCurrentVoiceId(e,t)]=this.slurs,this.tiesbyvoice[this.getCurrentVoiceId(e,t)]=this.ties,this.endingsbyvoice[this.getCurrentVoiceId(e,t)]=this.partstartelem,this.scaleByVoice[this.getCurrentVoiceId(e,t)]=this.voiceScale,this.voiceColor&&(this.colorByVoice[this.getCurrentVoiceId(e,t)]=this.voiceColor)},k.prototype.popCrossLineElems=function(e,t){this.slurs=this.slursbyvoice[this.getCurrentVoiceId(e,t)]||{},this.ties=this.tiesbyvoice[this.getCurrentVoiceId(e,t)]||[],this.partstartelem=this.endingsbyvoice[this.getCurrentVoiceId(e,t)],this.voiceScale=this.scaleByVoice[this.getCurrentVoiceId(e,t)],void 0===this.voiceScale&&(this.voiceScale=1),this.voiceColor=this.colorByVoice[this.getCurrentVoiceId(e,t)]},k.prototype.containsLyrics=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e[t].voices.length;n++)for(var r=0;r<e[t].voices[n].length;r++){var i=e[t].voices[n][r];if(i.lyric)return void(i.positioning&&"below"!==i.positioning.vocalPosition||(this.hasVocals=!0))}},k.prototype.createABCLine=function(e,t,n){this.minY=2,this.containsLyrics(e);var r=new d(this.getTextSize);this.tempoSet=!1;for(var i=0;i<e.length;i++)w&&this.restoreState(),w=!1,this.createABCStaff(r,e[i],t,i,n);return r},k.prototype.createABCStaff=function(e,t,a,o,c){e.getTextSize.updateFonts(t);for(var l=0;l<t.voices.length;l++){var u=new g(l,t.voices.length);0===l?(u.barfrom="start"===t.connectBarLines||"continue"===t.connectBarLines,u.barto="continue"===t.connectBarLines||"end"===t.connectBarLines):u.duplicate=!0,t.title&&t.title[l]&&(u.header=t.title[l].replace(/\\n/g,"\n"),u.headerPosition=6+e.getTextSize.baselineToCenter(u.header,"voicefont","staff-extra voice-name",l,t.voices.length)/h.STEP),t.clef&&"perc"===t.clef.type&&(u.isPercussion=!0);var d=(!this.initialClef||0===c)&&r(t.clef,this.tuneNumber);d&&(0===l&&t.barNumber&&this.addMeasureNumber(t.barNumber,d),u.addChild(d),this.startlimitelem=d);var f=i(t.key,this.tuneNumber);if(f&&(u.addChild(f),this.startlimitelem=f),t.meter){"specified"===t.meter.type?this.measureLength=t.meter.value[0].num/t.meter.value[0].den:this.measureLength=1;var p=s(t.meter,this.tuneNumber);u.addChild(p),this.startlimitelem=p}u.duplicate&&(u.children=[]);var m=t.clef.stafflines||0===t.clef.stafflines?t.clef.stafflines:5;e.addVoice(u,o,m);var v=1===m;this.createABCVoice(t.voices[l],a,o,l,v,u),e.setStaffLimits(u),0===l&&("start"===t.brace||!e.brace&&t.brace?(e.brace||(e.brace=[]),e.brace.push(new n(u,"brace"))):"end"===t.brace&&e.brace?e.brace[e.brace.length-1].setBottomStaff(u):"continue"===t.brace&&e.brace&&e.brace[e.brace.length-1].continuing(u),"start"===t.bracket||!e.bracket&&t.bracket?(e.bracket||(e.bracket=[]),e.bracket.push(new n(u,"bracket"))):"end"===t.bracket&&e.bracket?e.bracket[e.bracket.length-1].setBottomStaff(u):"continue"===t.bracket&&e.bracket&&e.bracket[e.bracket.length-1].continuing(u))}},k.prototype.createABCVoice=function(t,n,r,i,s,o){this.popCrossLineElems(r,i),this.stemdir=this.isBagpipes?"down":null,this.abcline=t,this.partstartelem&&(this.partstartelem=new c("",null,null),o.addOther(this.partstartelem));var l=o.voicetotal<2?-1:o.voicenumber;for(var u in this.slurs)this.slurs.hasOwnProperty(u)&&(this.slurs[u]=new p({force:this.slurs[u].force,voiceNumber:l,stemDir:this.slurs[u].stemDir,style:this.slurs[u].dotted}),w&&this.slurs[u].setHint(),o.addOther(this.slurs[u]));for(var h=0;h<this.ties.length;h++)this.ties[h]=new p({force:this.ties[h].force,stemDir:this.ties[h].stemDir,voiceNumber:l,style:this.ties[h].dotted}),w&&this.ties[h].setHint(),o.addOther(this.ties[h]);for(var d=0;d<this.abcline.length;d++)S(this.abcline[d]),this.minY=Math.min(this.abcline[d].minpitch,this.minY);for(var m=0===r,g=0;g<this.abcline.length;){var v=C(this.abcline,g),y=this.createABCElement(m,s,o,v.elem);if(y)for(h=0;h<y.length;h++){if(!this.tempoSet&&n&&!n.suppress){this.tempoSet=!0;var b=new e(n,0,0,"tempo",this.tuneNumber,{});b.addFixedX(new f(n,this.tuneNumber,a)),o.addChild(b)}o.addChild(y[h])}g+=v.count}this.pushCrossLineElems(r,i)},k.prototype.saveState=function(){this.tiesSave=b.cloneArray(this.ties),this.slursSave=b.cloneHashOfHash(this.slurs),this.slursbyvoiceSave=b.cloneHashOfHash(this.slursbyvoice),this.tiesbyvoiceSave=b.cloneHashOfArrayOfHash(this.tiesbyvoice)},k.prototype.restoreState=function(){this.ties=b.cloneArray(this.tiesSave),this.slurs=b.cloneHashOfHash(this.slursSave),this.slursbyvoice=b.cloneHashOfHash(this.slursbyvoiceSave),this.tiesbyvoice=b.cloneHashOfArrayOfHash(this.tiesbyvoiceSave)},k.prototype.createABCElement=function(t,n,o,c){var l=[];switch(c.el_type){case void 0:l=this.createBeam(n,o,c);break;case"note":l[0]=this.createNote(c,!1,n,o),this.triplet&&this.triplet.isClosed()&&(o.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1);break;case"bar":l[0]=this.createBarLine(o,c,t),o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"meter":l[0]=s(c,this.tuneNumber),this.startlimitelem=l[0],o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"clef":if(l[0]=r(c,this.tuneNumber),!l[0])return null;o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"key":var d=i(c,this.tuneNumber);d&&(l[0]=d,this.startlimitelem=l[0]),o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"stem":this.stemdir="auto"===c.direction?void 0:c.direction;break;case"part":var p=new e(c,0,0,"part",this.tuneNumber),m=this.getTextSize.calc(c.title,"partsfont","part");p.addFixedX(new u(c.title,0,0,void 0,{type:"part",height:m.height/h.STEP})),l[0]=p;break;case"tempo":var g=new e(c,0,0,"tempo",this.tuneNumber);g.addFixedX(new f(c,this.tuneNumber,a)),l[0]=g;break;case"style":"normal"===c.head?delete this.style:this.style=c.head;break;case"hint":w=!0,this.saveState();break;case"midi":break;case"scale":this.voiceScale=c.size;break;case"color":this.voiceColor=c.color,o.color=this.voiceColor;break;default:var v=new e(c,0,0,"unsupported",this.tuneNumber);v.addFixed(new u("element type "+c.el_type,0,0,void 0,{type:"debug"})),l[0]=v}return l},k.prototype.createBeam=function(e,n,r){var i=[],a=new t(this.stemHeight*this.voiceScale,this.stemdir,this.flatBeams,r[0]);w&&a.setHint();for(var s=0;s<r.length;s++)a.runningDirection(r[s]);a.setStemDirection();var o=this.stemdir;for(this.stemdir=a.stemsUp?"up":"down",s=0;s<r.length;s++){var c=r[s],l=this.createNote(c,!0,e,n);i.push(l),a.add(l),this.triplet&&this.triplet.isClosed()&&(n.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1)}return a.calcDir(),n.addBeam(a),this.stemdir=o,i};var E=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)},M=function(e,t,n,r,i,a,s,o,c){for(var l=n;l>11;l--)l%2!=0||r||e.addFixed(new u(null,o,(i+4)*c,l,{type:"ledger"}));for(l=t;l<1;l++)l%2!=0||r||e.addFixed(new u(null,o,(i+4)*c,l,{type:"ledger"}));for(l=0;l<a.length;l++){var h=i;"down"===s&&(h=-h),e.addFixed(new u(null,h+o,(i+4)*c,a[l],{type:"ledger"}))}};function T(e,t){for(var n=0;n<e.length;n++)if(JSON.stringify(e[n])===JSON.stringify(t))return;e.push(t)}return k.prototype.addGraceNotes=function(e,n,r,i,s,o,c){var h=.6;s=Math.round(.7*s);var d,f,m=null;e.gracenotes.length>1&&(m=new t(s,"grace",o),w&&m.setHint(),m.mainNote=r);var g=[];for(f=e.gracenotes.length-1;f>=0;f--)c+=10,g[f]=c,e.gracenotes[f].accidental&&(c+=7);for(f=0;f<e.gracenotes.length;f++){var v=e.gracenotes[f].verticalPos;d=m?null:x.uflags[o?5:3];var y=a(r,"noteheads.quarter",e.gracenotes[f],{dir:"up",headx:-g[f],extrax:-g[f],flag:d,scale:h*this.voiceScale,accidentalSlot:[]});y.notehead.highestVert=y.notehead.pitch+s;var b=y.notehead;if(this.addSlursAndTies(r,e.gracenotes[f],b,n,"up",!0),r.addExtra(b),e.gracenotes[f].acciaccatura){var _=e.gracenotes[f].verticalPos+4.2,k=m?5:6;r.addRight(new u("flags.ugrace",-g[f]+k,0,_,{scalex:h,scaley:h}))}if(m){var C=e.gracenotes[f].duration/2;o&&(C/=2);var S={heads:[b],abcelem:{averagepitch:v,minpitch:v,maxpitch:v,duration:C}};m.add(S)}else{var E=v+1/3*h,T=v+4.2,N=b.dx+b.w;r.addExtra(new u(null,N,0,E,{type:"stem",pitch2:T,linewidth:-.6}))}M(r,v,v,!1,l.getSymbolWidth("noteheads.quarter"),[],!0,b.dx-1,.6);var A=e.rest&&("spacer"===e.rest.type||"invisible"===e.rest.type);0!==f||o||!this.graceSlurs||A||n.addOther(new p({anchor1:b,anchor2:i,isGrace:!0}))}return m&&(m.calcDir(),n.addBeam(m)),c},k.prototype.addNoteToAbcElement=function(e,t,n,r,i,s,o,c,h){var d,f,p,m,g,v=0,b=0,w=0,k=[],C=[],S=0,E=t.averagepitch>=6?"down":"up";for(r&&(E=r),(i=t.style?t.style:i)&&"normal"!==i||(i="note"),(m=s?x[i].nostem:x[i][-o])||console.log("noteSymbol:",i,o,s),g="down"===E?t.pitches.length-2:1;"down"===E?g>=0:g<t.pitches.length;g="down"===E?g-1:g+1){var M=t.pitches["down"===E?g+1:g-1],N=t.pitches[g],A="down"===E?M.pitch-N.pitch:N.pitch-M.pitch;A<=1&&!M.printer_shift&&(N.printer_shift=A?"different":"same",(N.verticalPos>11||N.verticalPos<1)&&k.push(N.verticalPos-N.verticalPos%2),"down"===E?b=l.getSymbolWidth(m)+2:v=l.getSymbolWidth(m)+2)}var P=t.pitches.length;for(g=0;g<t.pitches.length;g++){var I,D;if(!c)I="down"===E&&0!==g||"up"===E&&g!==P-1?null:x["down"===E?"dflags":"uflags"][-o];if(t.pitches[g].style)D=x[t.pitches[g].style][-o];else if(h.isPercussion&&this.percmap){D=m;var B=this.percmap[y(t.pitches[g])];B&&B.noteHead&&x[B.noteHead]&&(D=x[B.noteHead][-o])}else D=m;if(t.pitches[g].highestVert=t.pitches[g].verticalPos,("up"===r||"up"===E)&&0===g||("down"===r||"down"===E)&&g===P-1){if((t.startSlur||1===P)&&(t.pitches[g].highestVert=t.pitches[P-1].verticalPos,_(t)<1&&("up"===r||"up"===E)&&(t.pitches[g].highestVert+=6)),t.startSlur)for(t.pitches[g].startSlur||(t.pitches[g].startSlur=[]),p=0;p<t.startSlur.length;p++)T(t.pitches[g].startSlur,t.startSlur[p]);if(t.endSlur)for(t.pitches[g].highestVert=t.pitches[P-1].verticalPos,_(t)<1&&("up"===r||"up"===E)&&(t.pitches[g].highestVert+=6),t.pitches[g].endSlur||(t.pitches[g].endSlur=[]),p=0;p<t.endSlur.length;p++)T(t.pitches[g].endSlur,t.endSlur[p])}var O=!c&&o<=-1,L=a(e,D,t.pitches[g],{dir:E,extrax:-b,flag:I,dot:n,dotshiftx:v,scale:this.voiceScale,accidentalSlot:C,shouldExtendStem:!r,printAccidentals:!h.isPercussion});S=Math.max(l.getSymbolWidth(D),S),e.extraw-=L.extraLeft,(d=L.notehead)&&(this.addSlursAndTies(e,t.pitches[g],d,h,O?E:null,!1),t.gracenotes&&t.gracenotes.length>0&&(d.bottom=d.bottom-1),e.addHead(d)),b+=L.accidentalshiftx,w=Math.max(w,L.dotshiftx)}if(O){var V=Math.round(70*this.voiceScale)/10,R="down"===E?t.minpitch-V:t.minpitch+1/3;R>6&&!r&&(R=6);var F="down"===E?t.maxpitch-1/3:t.maxpitch+V;F<6&&!r&&(F=6);var z="down"===E||0===e.heads.length?0:e.heads[0].w,j="down"===E?1:-1;d&&"noteheads.slash.quarter"===d.c&&("down"===E?F-=1:R+=1),d&&"noteheads.triangle.quarter"===d.c&&("down"===E?F-=.7:R-=1.2),e.addRight(new u(null,z,0,R,{type:"stem",pitch2:F,linewidth:j,bottom:R-1})),f=Math.min(R,F)}return{noteHead:d,roomTaken:b,roomTakenRight:w,min:f,additionalLedgers:k,dir:E,symbolWidth:S}},k.prototype.addLyric=function(e,t){var n="";t.lyric.forEach((function(e){var t=" "===e.divider?"":e.divider;n+=e.syllable+t+"\n"}));var r=this.getTextSize.calc(n,"vocalfont","lyric"),i=t.positioning?t.positioning.vocalPosition:"below";e.addCentered(new u(n,0,r.width,void 0,{type:"lyric",position:i,height:r.height/h.STEP,dim:this.getTextSize.attr("vocalfont","lyric")}))},k.prototype.createNote=function(t,n,r,i){var s,o=null,c=0,h=0,d=0,f=[],p=_(t),g=!1;0===p&&(g=!0,p=.25,n=!0);for(var y=Math.floor(Math.log(p)/Math.log(2)),b=0,k=Math.pow(2,y),C=k/2;k<p;b++,k+=C,C/=2);t.startTriplet&&(this.tripletmultiplier=t.tripletMultiplier);var S=p*this.tripletmultiplier;t.rest&&"multimeasure"===t.rest.type&&(S=1),t.rest&&"invisible-multimeasure"===t.rest.type&&(S=this.measureLength*t.rest.text);var E=t.rest?"rest":"note",T=new e(t,S,1,E,this.tuneNumber,{durationClassOveride:t.duration*this.tripletmultiplier});if(w&&T.setHint(),t.rest){this.measureLength===p&&"invisible"!==t.rest.type&&"spacer"!==t.rest.type&&t.rest.type.indexOf("multimeasure")<0&&(t.rest.type="whole");var N=function(e,t,n,r,i,s,o,c,h){var d,f,p,m,g=7;switch(i&&("down"===s&&(g=3),"up"===s&&(g=11)),o&&(g=n<.5||n<1?7:5),t.rest.type){case"whole":d=x.rest[0],t.averagepitch=g,t.minpitch=g,t.maxpitch=g,r=0;break;case"rest":d="rhythm"===t.style?x.rhythm[-c]:x.rest[-c],t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case"invisible":case"invisible-multimeasure":case"spacer":d="",t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case"multimeasure":d=x.rest.multi,t.averagepitch=g,t.minpitch=g,t.maxpitch=g,r=0;var v=l.getSymbolWidth(d);e.addHead(new u(d,v,2*v,7));var y=new u(""+t.rest.text,v,v,16,{type:"multimeasure-text"});e.addExtra(y)}if(t.rest.type.indexOf("multimeasure")<0&&"invisible"!==t.rest.type){var b=a(e,d,{verticalPos:g},{dot:r,scale:h});(f=b.notehead)&&(e.addHead(f),p=b.accidentalshiftx,m=b.dotshiftx)}return{noteHead:f,roomTaken:p,roomTakenRight:m}}(T,t,p,b,i.voicetotal>1,this.stemdir,r,y,this.voiceScale);o=N.noteHead,c=N.roomTaken,h=N.roomTakenRight}else{var A=this.addNoteToAbcElement(T,t,b,this.stemdir,this.style,g,y,n,i);void 0!==A.min&&(this.minY=Math.min(A.min,this.minY)),o=A.noteHead,c=A.roomTaken,h=A.roomTakenRight,f=A.additionalLedgers,s=A.dir,d=A.symbolWidth}if(void 0!==t.lyric&&this.addLyric(T,t),void 0!==t.gracenotes&&(c+=this.addGraceNotes(t,i,T,o,this.stemHeight*this.voiceScale,this.isBagpipes,c)),t.decoration){var P=n&&"up"!==s?Math.min(-3,T.bottom-6):T.bottom;this.decoration.createDecoration(i,t.decoration,T.top,o?o.w:0,T,c,s,P,t.positioning,this.hasVocals,this.accentAbove)}if(t.barNumber&&T.addFixed(new u(t.barNumber,-10,0,0,{type:"barNumber"})),M(T,t.minpitch,t.maxpitch,t.rest,d,f,s,-2,1),void 0!==t.chord){var I=v(this.getTextSize,T,t,c,h,d,this.jazzchords,this.germanAlphabet);c=I.roomTaken,h=I.roomTakenRight}return t.startTriplet&&(this.triplet=new m(t.startTriplet,o,{flatBeams:this.flatBeams})),t.endTriplet&&this.triplet&&this.triplet.setCloseAnchor(o),!this.triplet||t.startTriplet||t.endTriplet||t.rest&&"spacer"===t.rest.type||this.triplet.middleNote(o),T},k.prototype.addSlursAndTies=function(e,t,n,r,i,a){if(t.endTie&&this.ties.length>0){for(var s=!1,o=0;o<this.ties.length;o++)if(this.ties[o].anchor1&&this.ties[o].anchor1.pitch===n.pitch){this.ties[o].setEndAnchor(n),r.setRange(this.ties[o]),this.ties.splice(o,1),s=!0;break}s||(this.ties[0].setEndAnchor(n),r.setRange(this.ties[0]),this.ties.splice(0,1))}var c,l,u=r.voicetotal<2?-1:r.voicenumber;if(t.startTie){var h=new p({anchor1:n,force:"down"===this.stemdir||"up"===this.stemdir,stemDir:this.stemdir,isGrace:a,voiceNumber:u,style:t.startTie.style});w&&h.setHint(),this.ties[this.ties.length]=h,r.addOther(h),e.startTie=!0}if(t.endSlur)for(var d=0;d<t.endSlur.length;d++)l=t.endSlur[d],this.slurs[l]?((c=this.slurs[l]).setEndAnchor(n),r.setRange(c),delete this.slurs[l]):(c=new p({anchor2:n,stemDir:this.stemdir,voiceNumber:u}),w&&c.setHint(),r.addOther(c)),this.startlimitelem&&c.setStartX(this.startlimitelem);else if(!a)for(var f in this.slurs)this.slurs.hasOwnProperty(f)&&this.slurs[f].addInternalNote(n);if(t.startSlur)for(d=0;d<t.startSlur.length;d++)l=t.startSlur[d].label,c=new p({anchor1:n,stemDir:this.stemdir,voiceNumber:u,style:t.startSlur[d].style}),w&&c.setHint(),this.slurs[l]=c,r.addOther(c)},k.prototype.addMeasureNumber=function(e,t){var n=this.getTextSize.calc(e,"measurefont","bar-number"),r=0;t.isClef&&(r+=n.width/2);var i=n.width>10&&"treble"===t.abcelem.type?13.5:11;t.addFixed(new u(e,r,n.width,i+n.height/h.STEP,{type:"barNumber",dim:this.getTextSize.attr("measurefont","bar-number")}))},k.prototype.createBarLine=function(t,n,r){var i=new e(n,0,10,"bar",this.tuneNumber),a=null,s=0;n.barNumber&&this.addMeasureNumber(n.barNumber,i);var o="bar_right_repeat"===n.type||"bar_dbl_repeat"===n.type,l="bar_left_repeat"!==n.type&&"bar_thick_thin"!==n.type&&"bar_invisible"!==n.type,h="bar_right_repeat"===n.type||"bar_dbl_repeat"===n.type||"bar_left_repeat"===n.type||"bar_thin_thick"===n.type||"bar_thick_thin"===n.type,d="bar_left_repeat"===n.type||"bar_thick_thin"===n.type||"bar_thin_thin"===n.type||"bar_dbl_repeat"===n.type,f="bar_left_repeat"===n.type||"bar_dbl_repeat"===n.type;if(o||f){for(var p in this.slurs)this.slurs.hasOwnProperty(p)&&this.slurs[p].setEndX(i);this.startlimitelem=i}if(o&&(i.addRight(new u("dots.dot",s,1,7)),i.addRight(new u("dots.dot",s,1,5)),s+=6),l&&(a=new u(null,s,1,2,{type:"bar",pitch2:10,linewidth:.6}),i.addRight(a)),"bar_invisible"===n.type&&(a=new u(null,s,1,2,{type:"none",pitch2:10,linewidth:.6}),i.addRight(a)),n.decoration&&this.decoration.createDecoration(t,n.decoration,12,h?3:1,i,0,"down",2,n.positioning,this.hasVocals,this.accentAbove),h&&(a=new u(null,s+=4,4,2,{type:"bar",pitch2:10,linewidth:4}),i.addRight(a),s+=5),this.partstartelem&&n.endEnding&&(this.partstartelem.anchor2=a,this.partstartelem=null),d&&(a=new u(null,s+=3,1,2,{type:"bar",pitch2:10,linewidth:.6}),i.addRight(a)),f&&(s+=3,i.addRight(new u("dots.dot",s,1,7)),i.addRight(new u("dots.dot",s,1,5))),n.startEnding&&r){var m=this.getTextSize.calc(n.startEnding,"repeatfont","").width;i.minspacing+=m+10,this.partstartelem=new c(n.startEnding,a,null),t.addOther(this.partstartelem)}return i.extraw-=5,void 0!==n.chord&&v(this.getTextSize,i,n,0,0,0,!1,this.germanAlphabet),i},yf=k}function nv(){if(kf)return xf;kf=1;var e=Ng(),t=function(){if(wf)return _f;wf=1;var e="http://www.w3.org/2000/svg";function t(e){this.svg=a(),this.currentGroup=[],e.appendChild(this.svg)}function n(e,t,n){var r=n-e;return"M "+e+" "+t+" l "+r+" 0 l 0 1 l "+-r+" 0 z "}function r(e,t,n){var r=n-t;return"M "+e+" "+t+" l 0 "+r+" l 1 0 l 0 "+-r+" z "}t.prototype.clear=function(){if(this.svg){var e=this.svg.parentNode;this.svg=a(),this.currentGroup=[],e&&(e.innerHTML="",e.appendChild(this.svg))}},t.prototype.setTitle=function(e){var t=document.createElement("title"),n=document.createTextNode(e);t.appendChild(n),this.svg.insertBefore(t,this.svg.firstChild)},t.prototype.setResponsiveWidth=function(e,t){if(this.svg.setAttribute("viewBox","0 0 "+e+" "+t),this.svg.setAttribute("preserveAspectRatio","xMinYMin meet"),this.svg.removeAttribute("height"),this.svg.removeAttribute("width"),this.svg.style.display="inline-block",this.svg.style.position="absolute",this.svg.style.top="0",this.svg.style.left="0",this.svg.parentNode){var 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"}},t.prototype.setSize=function(e,t){this.svg.setAttribute("width",e),this.svg.setAttribute("height",t)},t.prototype.setAttribute=function(e,t){this.svg.setAttribute(e,t)},t.prototype.setScale=function(e){1!==e?(this.svg.style.transform="scale("+e+","+e+")",this.svg.style["-ms-transform"]="scale("+e+","+e+")",this.svg.style["-webkit-transform"]="scale("+e+","+e+")",this.svg.style["transform-origin"]="0 0",this.svg.style["-ms-transform-origin-x"]="0",this.svg.style["-ms-transform-origin-y"]="0",this.svg.style["-webkit-transform-origin-x"]="0",this.svg.style["-webkit-transform-origin-y"]="0"):(this.svg.style.transform="",this.svg.style["-ms-transform"]="",this.svg.style["-webkit-transform"]="")},t.prototype.insertStyles=function(t){var n=document.createElementNS(e,"style");n.textContent=t,this.svg.insertBefore(n,this.svg.firstChild)},t.prototype.setParentStyles=function(e){for(var t in e)e.hasOwnProperty(t)&&this.svg.parentNode&&(this.svg.parentNode.style[t]=e[t]);this.dummySvg&&(document.querySelector("body").removeChild(this.dummySvg),this.dummySvg=null)},t.prototype.rect=function(e){var t=[],i=e.x,a=e.y,s=e.x+e.width,o=e.y+e.height;return t.push(n(i,a,s)),t.push(n(i,o,s)),t.push(r(s,a,o)),t.push(r(i,o,a)),this.path({path:t.join(" "),stroke:"none","data-name":e["data-name"]})},t.prototype.dottedLine=function(t){var n=document.createElementNS(e,"line");n.setAttribute("x1",t.x1),n.setAttribute("x2",t.x2),n.setAttribute("y1",t.y1),n.setAttribute("y2",t.y2),n.setAttribute("stroke",t.stroke),n.setAttribute("stroke-dasharray","5,5"),this.svg.insertBefore(n,this.svg.firstChild)},t.prototype.rectBeneath=function(t){var n=document.createElementNS(e,"rect");n.setAttribute("x",t.x),n.setAttribute("width",t.width),n.setAttribute("y",t.y),n.setAttribute("height",t.height),t.stroke&&n.setAttribute("stroke",t.stroke),t["stroke-opacity"]&&n.setAttribute("stroke-opacity",t["stroke-opacity"]),t.fill&&n.setAttribute("fill",t.fill),t["fill-opacity"]&&n.setAttribute("fill-opacity",t["fill-opacity"]),this.svg.insertBefore(n,this.svg.firstChild)},t.prototype.text=function(t,n,r){var i=document.createElementNS(e,"text");for(var a in i.setAttribute("stroke","none"),n)n.hasOwnProperty(a)&&i.setAttribute(a,n[a]);for(var s=(""+t).split("\n"),o=0;o<s.length;o++){var c=document.createElementNS(e,"tspan");if(c.setAttribute("x",n.x?n.x:0),0!==o&&c.setAttribute("dy","1.2em"),-1!==s[o].indexOf("")){var l=s[o].split("");if(c.textContent=l[0],l[1]){var u=document.createElementNS(e,"tspan");u.setAttribute("dy","-0.3em"),u.setAttribute("style","font-size:0.7em"),u.textContent=l[1],c.appendChild(u)}if(l[2]){var h=l[1]?"0.4em":"0.1em",d=document.createElementNS(e,"tspan");d.setAttribute("dy",h),d.setAttribute("style","font-size:0.7em"),d.textContent=l[2],c.appendChild(d)}}else c.textContent=s[o];i.appendChild(c)}return r?r.appendChild(i):this.append(i),i},t.prototype.richTextLine=function(t,n,r,i,a,s){var o=document.createElementNS(e,"text");o.setAttribute("stroke","none"),o.setAttribute("class",i),o.setAttribute("x",n),o.setAttribute("y",r),o.setAttribute("text-anchor",a),o.setAttribute("dominant-baseline","middle");for(var c=0;c<t.length;c++){for(var l=t[c],u=document.createElementNS(e,"tspan"),h=Object.keys(l.attrs),d=0;d<h.length;d++){var f=l.attrs[h[d]];""!==f&&u.setAttribute(h[d],f)}u.textContent=l.content,o.appendChild(u)}return s?s.appendChild(o):this.append(o),o},t.prototype.guessWidth=function(e,t){var n,r=this.createDummySvg(),i=this.text(e,t,r);try{n=i.getBBox(),n=isNaN(n.height)||!n.height?{width:t["font-size"]/2,height:t["font-size"]+2}:{width:n.width,height:n.height}}catch(a){n={width:t["font-size"]/2,height:t["font-size"]+2}}return r.removeChild(i),n},t.prototype.createDummySvg=function(){return this.dummySvg||(this.dummySvg=a(),this.dummySvg.setAttribute("style",["display: block !important;","height: 1px;","width: 1px;","position: absolute;"].join("")),document.querySelector("body").appendChild(this.dummySvg)),this.dummySvg};var i={};function a(){var t=document.createElementNS(e,"svg");return t.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),t.setAttribute("role","img"),t.setAttribute("fill","currentColor"),t.setAttribute("stroke","currentColor"),t}return t.prototype.getTextSize=function(e,t,n){if("number"==typeof e&&(e=""+e),!e||e.match(/^\s+$/))return{width:0,height:0};var r;if(e.length<20&&(r=e+JSON.stringify(t),i[r]))return i[r];var a,s=!n;n||(n=this.text(e,t));try{a=n.getBBox(),a=isNaN(a.height)||!a.height?this.guessWidth(e,t):{width:a.width,height:a.height}}catch(o){a=this.guessWidth(e,t)}return s&&(this.currentGroup.length>0?this.currentGroup[0].removeChild(n):this.svg.removeChild(n)),r&&(i[r]=a),a},t.prototype.openGroup=function(t){t=t||{};var n=document.createElementNS(e,"g");return t.klass&&n.setAttribute("class",t.klass),t.fill&&n.setAttribute("fill",t.fill),t.stroke&&n.setAttribute("stroke",t.stroke),t["data-name"]&&n.setAttribute("data-name",t["data-name"]),t.prepend?this.prepend(n):this.append(n),this.currentGroup.unshift(n),n},t.prototype.closeGroup=function(){var e=this.currentGroup.shift();return e&&0===e.children.length?(e.parentElement.removeChild(e),null):e},t.prototype.path=function(t){var n=document.createElementNS(e,"path");for(var r in t)t.hasOwnProperty(r)&&("path"===r?n.setAttributeNS(null,"d",t.path):"klass"===r?n.setAttributeNS(null,"class",t[r]):void 0!==t[r]&&n.setAttributeNS(null,r,t[r]));return this.append(n),n},t.prototype.pathToBack=function(t){var n=document.createElementNS(e,"path");for(var r in t)t.hasOwnProperty(r)&&("path"===r?n.setAttributeNS(null,"d",t.path):"klass"===r?n.setAttributeNS(null,"class",t[r]):n.setAttributeNS(null,r,t[r]));return this.prepend(n),n},t.prototype.lineToBack=function(t){for(var n=document.createElementNS(e,"line"),r=Object.keys(t),i=0;i<r.length;i++)n.setAttribute(r[i],t[r[i]]);return this.prepend(n),n},t.prototype.append=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.appendChild(e)},t.prototype.prepend=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.insertBefore(e,this.svg.firstChild)},t.prototype.setAttributeOnElement=function(e,t){for(var n in t)t.hasOwnProperty(n)&&e.setAttributeNS(null,n,t[n])},t.prototype.moveElementToChild=function(e,t){e.appendChild(t)},_f=t}(),n=function(n){this.paper=new t(n),this.controller=null,this.space=3*e.SPACE,this.padding={},this.reset(),this.firefox112=navigator.userAgent.indexOf("Firefox/112.0")>=0};return n.prototype.reset=function(){this.paper.clear(),this.y=0,this.abctune=null,this.path=null,this.isPrint=!1,this.lineThickness=0,this.initVerticalSpace()},n.prototype.newTune=function(e){this.abctune=e,this.setVerticalSpace(e.formatting),this.isPrint="print"===e.media,this.setPadding(e)},n.prototype.setLineThickness=function(e){this.lineThickness=e},n.prototype.setPaddingOverride=function(e){this.paddingOverride={top:e.paddingtop,bottom:e.paddingbottom,right:e.paddingright,left:e.paddingleft}},n.prototype.setPadding=function(e){function t(t,n,r,i,a){void 0!==e.formatting[r]?t.padding[n]=e.formatting[r]:void 0!==t.paddingOverride[n]?t.padding[n]=t.paddingOverride[n]:t.isPrint?t.padding[n]=i:t.padding[n]=a}t(this,"top","topmargin",38,15),t(this,"bottom","botmargin",38,15),t(this,"left","leftmargin",68,15),t(this,"right","rightmargin",68,15)},n.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},n.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}},n.prototype.setVerticalSpace=function(e){void 0!==e.staffsep&&(this.spacing.staffSeparation=4*e.staffsep/3),void 0!==e.composerspace&&(this.spacing.composer=4*e.composerspace/3),void 0!==e.partsspace&&(this.spacing.parts=4*e.partsspace/3),void 0!==e.textspace&&(this.spacing.text=4*e.textspace/3),void 0!==e.musicspace&&(this.spacing.music=4*e.musicspace/3),void 0!==e.titlespace&&(this.spacing.title=4*e.titlespace/3),void 0!==e.sysstaffsep&&(this.spacing.systemStaffSeparation=4*e.sysstaffsep/3),void 0!==e.stafftopmargin&&(this.spacing.staffTopMargin=4*e.stafftopmargin/3),void 0!==e.subtitlespace&&(this.spacing.subtitle=4*e.subtitlespace/3),void 0!==e.topspace&&(this.spacing.top=4*e.topspace/3),void 0!==e.vocalspace&&(this.spacing.vocal=4*e.vocalspace/3),void 0!==e.wordsspace&&(this.spacing.words=4*e.wordsspace/3)},n.prototype.calcY=function(t){return this.y-t*e.STEP},n.prototype.moveY=function(e,t){void 0===t&&(t=1),this.y+=e*t},n.prototype.absolutemoveY=function(e){this.y=e},xf=n}function rv(){if(Pf)return Af;return Pf=1,Af=function(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 i=n.calc("A",t.font,t.klass),a=t.text.split("\n").length;if("\n"===t.text[t.text.length-1]&&a--,!t.noMove){var s=1.1*i.height*a;e.push({move:Math.round(s)}),t.marginBottom&&e.push({move:t.marginBottom})}}}}function iv(){if(Df)return If;Df=1;const e=rv();return If=function(t,n,r,i,a,s,o,c){var l=c.calc("i",r,i);if(""===n)t.push({move:l.height});else{if("string"==typeof n)return void e(t,{marginLeft:s,text:n,font:r,klass:i,marginTop:o.marginTop,anchor:o.anchor,absElemType:o.absElemType,info:o.info,name:a},c);o.marginTop&&t.push({move:o.marginTop});var u=0,h={left:s,anchor:o.anchor,phrases:[]};i&&(h.klass=i),t.push(h);for(var d=0;d<n.length;d++){var f=n[d],p=f.font?f.font:c.attr(r,i).font,m={content:f.text};p&&(m.attrs={"font-family":c.getFamily(p.face),"font-size":p.size,"font-weight":p.weight,"font-style":p.style,"font-decoration":p.decoration}),h.phrases.push(m);var g=c.calc(f.text,p,i);u=Math.max(u,g.height)," "===f.text[f.text.length-1]&&l.width}t.push({move:u})}}}function av(){if(Ff)return Rf;function e(e,t,n,r){if(0===e.indexOf(t)){var i=e.replace(t,""),a=parseInt(i,10);""+a===i&&(n[r]=a)}}return Ff=1,Rf=function(t,n){var r=[];if(t.absEl.elemset){for(var i={},a=0;a<t.absEl.elemset.length;a++){var s=t.absEl.elemset[a];if(s)for(var o=s.getAttribute("class").split(" "),c=0;c<o.length;c++)i[o[c]]=!0}for(var l=0;l<Object.keys(i).length;l++)r.push(Object.keys(i)[l])}for(var u={},h=0;h<r.length;h++)e(r[h],"abcjs-v",u,"voice"),e(r[h],"abcjs-l",u,"line"),e(r[h],"abcjs-m",u,"measure");t.staffPos&&(u.staffPos=t.staffPos);for(var d=n.target;d&&d.dataset&&!d.dataset.name&&"svg"!==d.tagName.toLowerCase();)d=d.parentNode;for(var f=n.target;f&&f.dataset&&!f.dataset.index&&"svg"!==f.tagName.toLowerCase();)f=f.parentNode;return f&&f.dataset&&(u.name=f.dataset.name,u.clickedName=d.dataset.name,u.parentClasses=f.classList),d&&d.classList&&(u.clickedClasses=d.classList),u.selectableElement=t.svgEl,{classes:r,analysis:u}}}function sv(){if(jf)return zf;jf=1;var e=Ng(),t=av();function n(e){"keyboard"===this.dragMechanism&&0!==this.dragYStep&&this.dragTarget&&h.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,e),this.dragYStep=0}function r(e){switch(e.keyCode){case 38:case 40:e.preventDefault()}}function i(t){var n=!1,r=t.target.dataset.index;switch(t.keyCode){case 13:case 32:n=!0,this.dragTarget=this.selectables[r],this.dragIndex=r,this.dragMechanism="keyboard",l.bind(this)(t);break;case 38:n=!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*e.STEP+")"));break;case 40:n=!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*e.STEP+")"));break;case 9:0!==this.dragYStep&&l.bind(this)(t)}n&&t.preventDefault()}function a(e,t){var n,r,i,a=function(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}(e.selectables,function(e){if(!e)return null;if("svg"===e.tagName)return e;if(!e.getAttribute)return null;for(var t=e.getAttribute("selectable");!t;)t=!e.parentElement||"svg"===(e=e.parentElement).tagName||e.getAttribute("selectable");return e}(t.target));return a>=0?(i=function(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]}(e.selectables[a].svgEl.getBBox(),t,e.scale),n=i[0],r=i[1]):(i=function(e){var t,n,r=1,i=1,a=e.target.closest("svg"),s=0;return a&&a.viewBox&&a.viewBox.baseVal&&(0!==a.viewBox.baseVal.width&&(r=a.viewBox.baseVal.width/a.clientWidth),0!==a.viewBox.baseVal.height&&(i=a.viewBox.baseVal.height/a.clientHeight),s=a.viewBox.baseVal.y),e.target&&"svg"===e.target.tagName?(t=e.offsetX,n=e.offsetY):(t=e.layerX,n=e.layerY),[t*=r,(n*=i)+s]}(t),a=function(e,t,n){for(var r=9999999,i=-1,a=0;a<e.selectables.length&&r>0;a++){var s=e.selectables[a];if(e.getDim(s),s.dim.left<t&&s.dim.right>t&&s.dim.top<n&&s.dim.bottom>n)i=a,r=0;else if(s.dim.top<n&&s.dim.bottom>n){var o=Math.min(Math.abs(s.dim.left-t),Math.abs(s.dim.right-t));o<r&&(r=o,i=a)}else if(s.dim.left<t&&s.dim.right>t){var c=Math.min(Math.abs(s.dim.top-n),Math.abs(s.dim.bottom-n));c<r&&(r=c,i=a)}else{var l=Math.abs(t-s.dim.left)>Math.abs(t-s.dim.right)?Math.abs(t-s.dim.right):Math.abs(t-s.dim.left),u=Math.abs(n-s.dim.top)>Math.abs(n-s.dim.bottom)?Math.abs(n-s.dim.bottom):Math.abs(n-s.dim.top),h=Math.sqrt(l*l+u*u);h<r&&(r=h,i=a)}}return i>=0&&r<=12?i:-1}(e,n=i[0],r=i[1])),{x:n,y:r,clickedOn:a}}function s(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 o(e){var t=e;"touchstart"===e.type&&(s(e),e.touches.length>0&&(t=e.touches[0]));var n=a(this,t);n.clickedOn>=0&&("touchstart"===e.type||0===e.button)&&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&&(!function(e,t){if(e){var n=p(e.svg);n[t]=!0,m(e.svg,n)}}(this.renderer.paper,"abcjs-dragging-in-progress"),this.dragTarget.absEl.highlight(void 0,this.dragColor)))}function c(t){var n=t;if("touchmove"===t.type&&(s(t),t.touches.length>0&&(n=t.touches[0])),this.lastTouchMove=t,this.dragTarget&&this.dragging&&this.dragTarget.isDraggable&&"mouse"===this.dragMechanism&&this.dragMouseStart){var r=a(this,n),i=Math.round((r.y-this.dragMouseStart.y)/e.STEP);i!==this.dragYStep&&(this.dragYStep=i,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+i*e.STEP+")"))}}function l(e){var t=e;"touchend"===e.type&&this.lastTouchMove&&(s(this.lastTouchMove),this.lastTouchMove&&this.lastTouchMove.touches&&this.lastTouchMove.touches.length>0&&(t=this.lastTouchMove.touches[0])),this.dragTarget&&(d.bind(this)(),this.dragTarget.absEl&&this.dragTarget.absEl.highlight&&(this.selected=[this.dragTarget.absEl],this.dragTarget.absEl.highlight(void 0,this.selectionColor)),h.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,t),this.dragTarget.svgEl&&this.dragTarget.svgEl.focus&&(this.dragTarget.svgEl.focus(),this.dragTarget=null,this.dragIndex=-1),function(e,t){if(e){var n=p(e.svg);delete n[t],m(e.svg,n)}}(this.renderer.svg,"abcjs-dragging-in-progress"))}function u(e){e>=0&&e<this.selectables.length&&(this.dragTarget=this.selectables[e],this.dragIndex=e,this.dragMechanism="keyboard",l.bind(this)({target:this.dragTarget.svgEl}))}function h(e,n,r,i,a){for(var s=t(e,a),o=s.classes,c=s.analysis,l=0;l<this.listeners.length;l++)this.listeners[l](e.absEl.abcelem,e.absEl.tuneNumber,o.join(" "),c,{step:n,max:r,index:i,setSelection:u.bind(this)},a)}function d(){for(var e=0;e<this.selected.length;e++)this.selected[e].unhighlight(void 0,this.renderer.foregroundColor);this.selected=[]}function f(e,t){d.bind(this)();for(var n=0;n<this.staffgroups.length;n++)for(var r=this.staffgroups[n].voices,i=0;i<r.length;i++)for(var a=r[i].children,s=0;s<a.length;s++){var o=a[s].abcelem.startChar,c=a[s].abcelem.endChar;(t>o&&e<c||t===e&&t===c)&&(this.selected[this.selected.length]=a[s],a[s].highlight(void 0,this.selectionColor))}}function p(e){var t=e.getAttribute("class");t||(t="");for(var n=t.split(" "),r={},i=0;i<n.length;i++)r[n[i]]=!0;return r}function m(e,t){var n=[];for(var r in t)t.hasOwnProperty(r)&&n.push(r);e.setAttribute("class",n.join(" "))}return zf=function(e,t){if(e.rangeHighlight=f,e.dragging)for(var a=0;a<e.selectables.length;a++){var s=e.selectables[a];"true"===s.svgEl.getAttribute("selectable")&&(s.svgEl.setAttribute("tabindex",0),s.svgEl.setAttribute("data-index",a),s.svgEl.addEventListener("keydown",r.bind(e)),s.svgEl.addEventListener("keyup",i.bind(e)),s.svgEl.addEventListener("focus",n.bind(e)))}for(var u=0;u<t.length;u++)t[u].addEventListener("touchstart",o.bind(e),{passive:!0}),t[u].addEventListener("touchmove",c.bind(e),{passive:!0}),t[u].addEventListener("touchend",l.bind(e),{passive:!0}),t[u].addEventListener("mousedown",o.bind(e)),t[u].addEventListener("mousemove",c.bind(e)),t[u].addEventListener("mouseup",l.bind(e))}}function ov(){if(Hf)return qf;return Hf=1,qf=function(e,t,n,r,i){return t+(r-t)/(n-e)*(i-e)}}function cv(){if(Gf)return Uf;Gf=1;var e=jg(),t=Ng(),n=ov(),r=function(e){return void 0===e?0:Math.floor(Math.log(e)/Math.log(2))};function i(e,t,n,r){if(!e.children)return r;for(var i=0;i<e.children.length;i++){var a=e.children[i];t&&void 0!==a.top&&"flags.ugrace"===a.c?r=Math.max(r,a.top-n):t||void 0===a.bottom||"flags.ugrace"!==a.c||(r=Math.max(r,n-a.bottom+7))}return r}function a(e,t,n){var r=t.heads[e?0:t.heads.length-1],i=n.heads[e?0:n.heads.length-1],a=r.x;e&&(a+=r.w-.6);var s=i.x;return[a,s+=e?i.w:.6]}return Uf=function(s){if(0!==s.elems.length&&!s.allrests){var o=function(e,n){var r=e?t.STEP:-t.STEP;n&&(r*=.4);return r}(s.stemsUp,s.isgrace),c=s.elems[0],l=s.elems[s.elems.length-1],u=0,h=s.stemsUp?c.abcelem.maxpitch:c.abcelem.minpitch;u=i(c,s.stemsUp,h,u),u=i(l,s.stemsUp,h,u),u=Math.max(s.stemHeight,u+3);var d=function(e,t,n,r,i,a,s,o,c,l){var u=n-2,h=n-2,d=Math.round(r?Math.max(e+u,c+h):Math.min(e-u,o-h)),f=function(e,t,n,r){if(r)return 0;var i=e-t,a=n/2;i>a&&(i=a);i<-a&&(i=-a);return i}(i,a,t,s),p=d+Math.floor(f/2),m=d+Math.floor(-f/2);l||(r&&d<6||!r&&d>6)&&(p=6,m=6);return[p,m]}(s.average,s.elems.length,u,s.stemsUp,c.abcelem.averagepitch,l.abcelem.averagepitch,s.isflat,s.min,s.max,s.isgrace),f=a(s.stemsUp,c,l);s.addBeam({startX:f[0],endX:f[1],startY:d[0],endY:d[1],dy:o});for(var p=function(e,t,i,s,o){for(var c=[],l=[],u=0;u<e.length;u++){var h=e[u];if(!h.abcelem.rest){var d=h.heads[t?0:h.heads.length-1],f=d.x+(t?d.w:0),p=n(i.startX,i.startY,i.endX,i.endY,f),m=t?-1.5:1.5;s&&(m=2*m/3);var g=h.abcelem.duration;0===g&&(g=.25);for(var v=r(g);v<-3;v++){var y=-4-v;if(l[y]?l[y].single=!1:l[y]={x:f+(t?-.6:0),y:p+m*(y+1),durlog:v,single:!0},u>0&&h.abcelem.beambr&&h.abcelem.beambr<=y+1){l[y].split||(l[y].split=[l[y].x]);var b=a(t,e[u-1],h);l[y].split[l[y].split.length-1]>=b[0]&&(b[0]+=h.w),l[y].split.push(b[0]),l[y].split.push(b[1])}}for(var _=l.length-1;_>=0;_--)if(u===e.length-1||r(e[u+1].abcelem.duration)>-_-4){var w=f,x=p+m*(_+1);l[_].single&&(w=0===u?f+5:f-5,x=n(i.startX,i.startY,i.endX,i.endY,w)+m*(_+1));var k={startX:l[_].x,endX:w,startY:l[_].y,endY:x,dy:o};if(void 0!==l[_].split){var C=l[_].split;k.endX<=C[C.length-1]&&(C[C.length-1]-=h.w),C.push(k.endX),k.split=l[_].split}c.push(k),l=l.slice(0,_)}}}return c}(s.elems,s.stemsUp,s.beams[0],s.isgrace,o),m=0;m<p.length;m++)s.addBeam(p[m]);!function(r,i,a,s,o){for(var c=0;c<r.length;c++){var l=r[c];if(!l.abcelem.rest){var u=!l.addExtra,h=u?o:l,d=l.heads[i?0:l.heads.length-1],f=.2,p=d.pitch+(i?f:-f),m=i?d.w:0;u||(m+=d.dx);var g=d.x+m,v=n(a.startX,a.startY,a.endX,a.endY,g),y=i?-.6:.6;i||(v-=s/2/t.STEP),u&&(m+=l.heads[0].dx),"noteheads.slash.quarter"===d.c&&(i?p+=1:p-=1);var b=new e(null,m,0,p,{type:"stem",pitch2:v,linewidth:y});b.setX(h.x),h.addRight(b)}}}(s.elems,s.stemsUp,s.beams[0],o,s.mainNote)}}}function lv(){if(Yf)return Wf;Yf=1;var e=ov();function t(e){return e.stemsUp}return Wf=function(n){if(n.anchor1&&n.anchor2){n.hasBeam=!!n.anchor1.parent.beam&&n.anchor1.parent.beam===n.anchor2.parent.beam;var r=n.anchor1.parent.beam;if(!n.hasBeam||r.elems[0]===n.anchor1.parent&&r.elems[r.elems.length-1]===n.anchor2.parent||(n.hasBeam=!1),n.hasBeam){var i=t(r)?n.anchor1.x+n.anchor1.w:n.anchor1.x;n.yTextPos=function(t,n,r){if(0===r.beams.length)return 0;r=r.beams[0];var i=t+(n-t)/2;return e(r.startX,r.startY,r.endX,r.endY,i)}(i,n.anchor2.x,r),n.yTextPos+=t(r)?3:-2,n.xTextPos=(o=i,c=n.anchor2.x,o+(c-o)/2),n.top=n.yTextPos+1,n.bottom=n.yTextPos-2,t(r)&&(n.endingHeightAbove=4)}else{n.startNote=Math.max(n.anchor1.parent.top,9)+4,n.endNote=Math.max(n.anchor2.parent.top,9)+4,"rest"===n.anchor1.parent.type&&"rest"!==n.anchor2.parent.type?n.startNote=n.endNote:"rest"===n.anchor2.parent.type&&"rest"!==n.anchor1.parent.type&&(n.endNote=n.startNote);for(var a=0,s=0;s<n.middleElems.length;s++)a=Math.max(a,n.middleElems[s].top);((a+=4)>n.startNote||a>n.endNote)&&(n.startNote=a,n.endNote=a),n.flatBeams&&(n.startNote=Math.max(n.startNote,n.endNote),n.endNote=Math.max(n.startNote,n.endNote)),n.yTextPos=n.startNote+(n.endNote-n.startNote)/2,n.xTextPos=n.anchor1.x+(n.anchor2.x+n.anchor2.w-n.anchor1.x)/2,n.top=n.yTextPos+1}}var o,c;delete n.middleElems,delete n.flatBeams}}function uv(){if(Kf)return $f;Kf=1;var e=cv(),t=ov(),n=lv();function r(e){for(var t=0;t<e.elems.length;t++){var n=e.elems[t];if(n.top)for(var r=s(n,e),i=0;i<n.children.length;i++){var a=n.children[i];if("ornament"===a.klass&&"below"!==a.position&&a.bottom-1.5<r){var o=r-a.bottom+1.5;a.bottom+=o,a.top+=o,a.pitch+=o,r=n.top=a.top}}}}function i(e,t){var n=t.getChordDim();if(n){for(var r=0;r<e.length;r++){if(e[r]<n.left)return r>0&&t.putChordInLane(r),void(e[r]=n.right)}e.push(n.right),t.putChordInLane(e.length-1)}}function a(e){for(var t=0,n=0;n<e.children.length;n++){e.children[n].chordHeightBelow&&t++}return t}function s(e,n){return n=n.beams[0],t(n.startX,n.startY,n.endX,n.endY,e.x)}return $f=function(t){for(var s=0;s<t.beams.length;s++)if("BeamElem"===t.beams[s].type){e(t.beams[s]),r(t.beams[s]);for(var o=0;o<t.beams[s].elems.length;o++)t.adjustRange(t.beams[s].elems[o])}for(t.staff.specialY.chordLines=function(e){var t,n,r,s=[0],o=[0];for(t=0;t<e.length;t++){for(n=0;n<e[t].children.length;n++)(r=e[t].children[n]).chordHeightAbove&&i(s,r);for(n=e[t].children.length-1;n>=0;n--)(r=e[t].children[n]).chordHeightBelow&&i(o,r)}(s.length>1||o.length>1)&&function(e,t){for(var n=0;n<e.length;n++){a(e[n]);for(var r=0;r<e[n].children.length;r++){var i=e[n].children[r];i.chordHeightAbove&&i.invertLane(t)}}}(e,s.length,o.length);return{above:s.length,below:o.length}}(t.children),s=0;s<t.otherchildren.length;s++){var c=t.otherchildren[s];"TripletElem"===c.type&&(n(c),t.adjustRange(c))}t.staff.top=Math.max(t.staff.top,t.top),t.staff.bottom=Math.min(t.staff.bottom,t.bottom)}}function hv(){if(tp)return ep;tp=1;var e=function(){if(Jf)return Zf;Jf=1;var e=function(){};return e.beginLayout=function(e,t){t.i=0,t.durationindex=0,t.startx=e,t.minx=e,t.nextx=e,t.spacingduration=0},e.layoutEnded=function(e){return e.i>=e.children.length},e.getNextX=function(e){return Math.max(e.minx,e.nextx)},e.getSpacingUnits=function(e){return Math.sqrt(8*e.spacingduration)},e.layoutOneItem=function(e,t,n,r,i){var a=n.children[n.i];if(!a)return 0;var s=e-n.minx,o=n.durationindex+a.duration>0?r:0;if("note"===a.abcelem.el_type&&!a.abcelem.rest&&0!==n.voicenumber&&i){var c=i.children[i.i],l=c&&(a.abcelem.maxpitch<=c.abcelem.maxpitch+1&&a.abcelem.maxpitch>=c.abcelem.minpitch-1||a.abcelem.minpitch<=c.abcelem.maxpitch+1&&a.abcelem.minpitch>=c.abcelem.minpitch-1);if(l&&a.abcelem.minpitch===c.abcelem.minpitch&&a.abcelem.maxpitch===c.abcelem.maxpitch&&c.heads&&c.heads.length>0&&a.heads&&a.heads.length>0&&c.heads[0].c===a.heads[0].c&&(l=!1),l){var u=c.heads&&c.heads.length>0?c.heads[0].realWidth:c.fixed.w;a.adjustedWidth||(a.adjustedWidth=u+a.w),a.w=a.adjustedWidth;for(var h=0;h<a.children.length;h++){var d=a.children[h];d.name.indexOf("accidental")<0&&(d.adjustedWidth||(d.adjustedWidth=d.dx+u),d.dx=d.adjustedWidth)}}}var f=function(e,t){var n=0;return"note"!==e.type&&"bar"!==e.type||(n=t),-e.extraw+n}(a,o);return s<f&&(0===n.i||"bar"!==a.type||"part"!==n.children[n.i-1].type&&"tempo"!==n.children[n.i-1].type)&&(e+=f-s),a.setX(e),n.spacingduration=a.duration,n.minx=e+function(e){return e.w}(a),n.i!==n.children.length-1&&(n.minx+=a.minspacing),this.updateNextX(e,t,n),e},e.shiftRight=function(e,t){var n=t.children[t.i];n&&(n.setX(n.x+e),t.minx+=e,t.nextx+=e)},e.updateNextX=function(e,t,n){n.nextx=e+t*this.getSpacingUnits(n)},e.updateIndices=function(e){this.layoutEnded(e)||(e.durationindex+=e.children[e.i].duration,"bar"===e.children[e.i].type&&(e.durationindex=Math.round(64*e.durationindex)/64),e.i++)},Zf=e}();function t(t){for(var n=0;n<t.length;n++)if(!e.layoutEnded(t[n]))return!1;return!0}function n(e){return e.durationindex-(e.children[e.i]&&e.children[e.i].duration>0?0:5e-7)}function r(e,t){return!!(e&&e.staff&&e.staff.voices&&0!==e.staff.voices.length)&&(!!(t&&t.staff&&t.staff.voices&&0!==t.staff.voices.length)&&e.staff.voices[0]===t.staff.voices[0])}return ep=function(i,a,s,o,c){var l,u=0,h=1e3,d=c;o.startx=d;var f=0;for(s&&console.log("init layout",i),l=0;l<o.voices.length;l++)e.beginLayout(d,o.voices[l]);for(var p=0;!t(o.voices);){for(f=null,l=0;l<o.voices.length;l++)e.layoutEnded(o.voices[l])||f&&!(n(o.voices[l])<f)||(f=n(o.voices[l]));var m=[],g=[];for(l=0;l<o.voices.length;l++){n(o.voices[l])-f>1e-7?g.push(o.voices[l]):m.push(o.voices[l])}p=0;var v=0;for(l=0;l<m.length;l++)e.getNextX(m[l])>d&&(d=e.getNextX(m[l]),p=e.getSpacingUnits(m[l]),v=m[l].spacingduration);u+=p,h=Math.min(h,p),s&&console.log("currentduration: ",f,u,h);var y=void 0;for(l=0;l<m.length;l++){var b=m[l];0===b.voicenumber&&(y=l);var _=void 0!==y&&m[y].voicenumber!==b.voicenumber?m[y]:void 0;r(b,_)||(_=void 0);var w=e.layoutOneItem(d,i,b,a,_),x=w-d;if(x>0){d=w;for(var k=0;k<l;k++)e.shiftRight(x,m[k])}}for(l=0;l<g.length;l++)g[l].spacingduration-=v,e.updateNextX(d,i,g[l]);for(l=0;l<m.length;l++){var C=m[l];e.updateIndices(C)}}for(l=0;l<o.voices.length;l++)e.getNextX(o.voices[l])>d&&(d=e.getNextX(o.voices[l]),p=e.getSpacingUnits(o.voices[l]));return function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n];if(r.children.length>0){var i=r.children.length-1,a=r.children[i];if("bar"===a.abcelem.el_type){var s=a.children[0].x;s>t?t=s:a.children[0].x=t}}}}(o.voices),u+=p,o.setWidth(d),{spacingUnits:u,minSpace:h}}}function dv(){if(rp)return np;function e(e,t,n){if(t)for(var r=0;r<t.length;r++)if(t[r].header){var i=n.calc(t[r].header,"voicefont","");e=Math.max(e,i.width)}return e}function t(e,t,r){if(e)for(var i=0;i<e.length;i++)n(t,e[i]),r=Math.max(r,e[i].getWidth());return r}function n(e,t){t.x=e}return rp=1,np=function(n,r,i,a,s){var o,c,l=n.padding.left,u=0;for(o=0;o<i.length;o++)i[o].header&&(c=r.calc(i[o].header,"voicefont",""),u=Math.max(u,c.width));u=e(u,a,r),(u=e(u,s,r))&&(u+=r.calc("A","voicefont","").width);var h=0;return h=t(a,l+=u,h),l+(h=t(s,l,h))}}function fv(){if(ap)return ip;ap=1;var e=dv();return ip=function(t,n,r){var i=e(t,n.getTextSize,n.voices,n.brace,n.bracket),a=function(e,t){for(var n=0,r=0,i=0;i<e.voices.length;i++){for(var a=0,s=e.voices[i],o=0;o<s.children.length;o++){var c=s.children[o];if(a+=c.duration,c.duration){var l=(c.w+t)/c.duration;n=Math.max(n,l)}}r=Math.max(r,a)}return{totalDuration:r,minSpacing:n}}(n,r.minPadding),s=a.totalDuration,o=a.minSpacing*s;r.minWidth&&(o=Math.max(o,r.minWidth));var c=r.minPadding?r.minPadding/2:2;n.startx=i,n.w=o+i;for(var l=0;l<n.voices.length;l++){var u=n.voices[l];u.startx=i,u.w=o+i;for(var h=i,d=!1,f=0,p=0;p<u.children.length;p++){var m=u.children[p];d||(0!==m.duration?(d=!0,f=(o+i-h)/s,n.gridStart=h):(m.x=h,h+=m.w+m.minspacing)),d&&("center"===r.align?m.x=h+m.duration*f/2-m.w/2:0===m.duration?m.x=h+1-m.w:m.x=h+c-m.extraw,h+=m.duration*f);for(var g=0;g<m.children.length;g++){var v=m.children[g],y=v.dx?v.dx:0;v.x=m.x+y}}n.gridEnd=h}return o}}function pv(){if(op)return sp;op=1;var e=uv(),t=function(){if(Xf)return Qf;Xf=1;var e=Ng(),t=1;function n(e,n,r,i){if(e.specialY[r]){var a=e.specialY[r];i&&(a*=i),e.top+=a+t,n[r]=e.top}}function r(e,t,n){var r,c;for(r=0;r<t.children.length;r++)i(e,c=t.children[r],n);for(r=0;r<t.otherchildren.length;r++)switch((c=t.otherchildren[r]).type){case"CrescendoElem":a(e,c);break;case"DynamicDecoration":s(e,c);break;case"EndingElem":o(e,c);break;case"TieElem":var l=c.getYBounds();t.staff.top=Math.max(t.staff.top,l[0]),t.staff.top=Math.max(t.staff.top,l[1]),t.staff.bottom=Math.min(t.staff.bottom,l[0]),t.staff.bottom=Math.min(t.staff.bottom,l[1])}}function i(e,t,n){for(var r=0;r<t.children.length;r++){var i=t.children[r];for(var a in t.specialY)t.specialY.hasOwnProperty(a)&&i[a]&&(i.pitch=e[a],void 0===i.top&&("TempoElement"===i.type?c(e,i):l(e,i,n),t.pushTop(i.top),t.pushBottom(i.bottom)))}}function a(e,t){t.dynamicHeightAbove?t.pitch=e.dynamicHeightAbove:t.pitch=e.dynamicHeightBelow}function s(e,t){t.volumeHeightAbove?t.pitch=e.volumeHeightAbove:t.pitch=e.volumeHeightBelow}function o(e,t){t.pitch=e.endingHeightAbove-2}function c(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 i=t.note.children[r];i.top+=n,i.bottom+=n,i.pitch+=n,void 0!==i.pitch2&&(i.pitch2+=n)}}}function l(t,n,r){switch(n.type){case"part":n.top=t.partHeightAbove+n.height,n.bottom=t.partHeightAbove;break;case"text":case"chord":n.chordHeightAbove?(n.top=t.chordHeightAbove,n.bottom=t.chordHeightAbove):(n.top=t.chordHeightBelow,n.bottom=t.chordHeightBelow);break;case"lyric":n.lyricHeightAbove?(n.top=t.lyricHeightAbove,n.bottom=t.lyricHeightAbove):(n.top=t.lyricHeightBelow+r.vocal/e.STEP,n.bottom=t.lyricHeightBelow+r.vocal/e.STEP,n.pitch-=r.vocal/e.STEP);break;case"debug":n.top=t.chordHeightAbove,n.bottom=t.chordHeightAbove}void 0!==n.pitch&&void 0!==n.top||console.error("RelativeElement position not set.",n.type,n.pitch,n.top,t)}return Qf=function(i,a){for(var s,o=0;o<a.staffs.length;o++){var c=a.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(i.showDebug&&i.showDebug.indexOf("box")>=0&&(c.originalTop=c.top,c.originalBottom=c.bottom),n(c,l,"lyricHeightAbove"),n(c,l,"chordHeightAbove",c.specialY.chordLines.above),c.specialY.endingHeightAbove&&(c.specialY.chordHeightAbove?c.top+=2:c.top+=c.specialY.endingHeightAbove+t,l.endingHeightAbove=c.top),c.specialY.dynamicHeightAbove&&c.specialY.volumeHeightAbove?(c.top+=Math.max(c.specialY.dynamicHeightAbove,c.specialY.volumeHeightAbove)+t,l.dynamicHeightAbove=c.top,l.volumeHeightAbove=c.top):(n(c,l,"dynamicHeightAbove"),n(c,l,"volumeHeightAbove")),n(c,l,"partHeightAbove"),n(c,l,"tempoHeightAbove"),c.specialY.lyricHeightBelow&&(c.specialY.lyricHeightBelow+=i.spacing.vocal/e.STEP,l.lyricHeightBelow=c.bottom,c.bottom-=c.specialY.lyricHeightBelow+t),c.specialY.chordHeightBelow){l.chordHeightBelow=c.bottom;var u=c.specialY.chordHeightBelow;c.specialY.chordLines.below&&(u*=c.specialY.chordLines.below),c.bottom-=u+t}c.specialY.volumeHeightBelow&&c.specialY.dynamicHeightBelow?(l.volumeHeightBelow=c.bottom,l.dynamicHeightBelow=c.bottom,c.bottom-=Math.max(c.specialY.volumeHeightBelow,c.specialY.dynamicHeightBelow)+t):c.specialY.volumeHeightBelow?(l.volumeHeightBelow=c.bottom,c.bottom-=c.specialY.volumeHeightBelow+t):c.specialY.dynamicHeightBelow&&(l.dynamicHeightBelow=c.bottom,c.bottom-=c.specialY.dynamicHeightBelow+t),i.showDebug&&i.showDebug.indexOf("box")>=0&&(c.positionY=l);for(var h=0;h<c.voices.length;h++)r(l,a.voices[c.voices[h]],i.spacing);if(void 0!==s){var d=s+(c.top-10),f=i.spacing.systemStaffSeparation/e.STEP-d;f>0&&(c.top+=f)}c.top+=i.spacing.staffTopMargin/e.STEP,s=2-c.bottom}}}(),n=hv(),r=dv(),i=fv(),a=function(e,t,i,a,o,c,l){for(var u=r(e,a.getTextSize,a.voices,a.brace,a.bracket),h=i,d=0;d<8;d++){var f=n(h,e.minPadding,l,a,u);if(null===(h=s(c,o.stretchlast,t+e.padding.left,a.w,h,f.spacingUnits,f.minSpace,e.padding.left+e.padding.right)))break}return function(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=1;r<n.children.length-1;r++){var i=n.children[r];if(i.abcelem.rest&&("whole"===i.abcelem.rest.type||"multimeasure"===i.abcelem.rest.type)){var a=n.children[r-1],s=n.children[r+1];i.center(a,s)}}}(a.voices),a.w-u};function s(e,t,n,r,i,a,s,o){if(e)if(void 0===t){if(r/n<.66)return null}else if(!(1-(r+o)/n<t))return null;return Math.abs(n-r)<2?null:a>0?((i=(n-(r-a*i))/a)*s>50&&(i=50/s),i):null}return sp=function(n,r,s,o,c,l){var u,h,d=s;for(u=0;u<r.lines.length;u++){var f;if((h=r.lines[u]).staff)f=void 0!==l?i(n,h.staffGroup,l):a(n,d,o,h.staffGroup,r.formatting,u===r.lines.length-1,!1),Math.round(f)>Math.round(d)&&(d=f,c&&(u=-1))}for(u=0;u<r.lines.length;u++)if((h=r.lines[u]).staffGroup&&h.staffGroup.voices){for(var p=0;p<h.staffGroup.voices.length;p++)e(h.staffGroup.voices[p]);t(n,h.staffGroup)}for(u=0;u<r.lines.length;u++)(h=r.lines[u]).staffGroup&&h.staffGroup.setHeight();return d}}function mv(){if(mp)return pp;mp=1;return pp=function(){for(var e,t,n,r,i,a=0,s=arguments[a++],o=[];s;){if(t=/^[^\x25]+/.exec(s))o.push(t[0]);else if(t=/^\x25{2}/.exec(s))o.push("%");else{if(!(t=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(s)))throw"Huh ?!";if(null==(e=arguments[t[1]||a++])||null==e)throw"Too few arguments.";if(/[^s]/.test(t[7])&&"number"!=typeof e)throw"Expecting number but found "+typeof e;switch(t[7]){case"b":e=e.toString(2);break;case"c":e=String.fromCharCode(e);break;case"d":e=parseInt(e);break;case"e":e=t[6]?e.toExponential(t[6]):e.toExponential();break;case"f":e=t[6]?parseFloat(e).toFixed(t[6]):parseFloat(e);break;case"o":e=e.toString(8);break;case"s":e=(e=String(e))&&t[6]?e.substring(0,t[6]):e;break;case"u":e=Math.abs(e);break;case"x":e=e.toString(16);break;case"X":e=e.toString(16).toUpperCase()}e=/[def]/.test(t[7])&&t[2]&&e>0?"+"+e:e,r=t[3]?"0"==t[3]?"0":t[3][1]:" ",i=t[5]-String(e).length,n=t[5]?str_repeat(r,i):"",o.push(t[4]?e+n:n+e)}s=s.substring(t[0].length)}return o.join("")},pp}function gv(){if(vp)return gp;return vp=1,gp=function(e){return parseFloat(e.toFixed(2))}}function vv(){if(bp)return yp;bp=1;var e=gv();return yp=function(t,n,r){var i,a=n.y;if(n.phrases)return c=t.paper.richTextLine(n.phrases,n.x,n.y,n.klass,n.anchor);if(n.lane){var s=.25*n.dim.font.size;a+=(n.dim.font.size+s)*n.lane}n.dim?(i=n.dim).attr.class=n.klass:i=t.controller.getFontAndAttr.calc(n.type,n.klass),n.anchor&&(i.attr["text-anchor"]=n.anchor),n["dominant-baseline"]&&(i.attr["dominant-baseline"]=n["dominant-baseline"]),i.attr.x=n.x,i.attr.y=a,n.centerVertically||(i.attr.y+=i.font.size),"debugfont"===n.type&&(console.log("Debug msg: "+n.text),i.attr.stroke="#ff0000"),n.cursor&&(i.attr.cursor=n.cursor);var o=n.text.replace(/\n\n/g,"\n \n");o=o.replace(/^\n/," \n"),i.font.box&&(r||t.paper.openGroup({klass:i.attr.class,fill:t.foregroundColor,"data-name":n.name}),"end"===i.attr["text-anchor"]?i.attr.x-=i.font.padding:"start"===i.attr["text-anchor"]&&(i.attr.x+=i.font.padding),i.attr.y+=i.font.padding,delete i.attr.class),n.noClass&&delete i.attr.class,i.attr.x=e(i.attr.x),i.attr.y=e(i.attr.y),n.name&&(i.attr["data-name"]=n.name);var c=t.paper.text(o,i.attr);if(i.font.box){var l=c.getBBox(),u=0;"middle"===i.attr["text-anchor"]?u=l.width/2+i.font.padding:"end"===i.attr["text-anchor"]&&(u=l.width+2*i.font.padding);var h=0;n.centerVertically&&(h=l.height-i.font.padding),t.paper.rect({"data-name":"box",x:Math.round(n.x-u),y:Math.round(a-h),width:Math.round(l.width+2*i.font.padding),height:Math.round(l.height+2*i.font.padding)}),r||(c=t.paper.closeGroup())}return c}}function yv(){if(wp)return _p;wp=1;var e=mv(),t=Ng(),n=vv();function r(t,n,r,i){return e("M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z",t+r[0],n+i[0],t+r[1],n+i[1],t+r[2],n+i[2],t+r[3],n+i[3],t+r[4],n+i[4],t+r[5],n+i[5],t+r[6],n+i[6])}var i=function(i,a,s,o,c,l,u){var h;if(l){i.paper.openGroup({klass:i.controller.classes.generate("staff-extra voice-name"),"data-name":c});var d=s+(o-s)/2;d-=i.controller.getTextSize.baselineToCenter(l,"voicefont","staff-extra voice-name",0,1),n(i,{x:i.padding.left,y:d,text:l,type:"voicefont",klass:"staff-extra voice-name",anchor:"start",centerVertically:!0})}return"brace"===c?h=function(e,t,n,i,a){var s=i-n,o=r(t,n,[7.5,-8,21,0,18.5,-10.5,7.5],[0,s/5.5,s/3.14,s/2,s/2.93,s/4.88,0]);return o+=r(t,n,[0,17.5,-7.5,6.6,-5,20,0],[s/2,s/1.46,s/1.22,s,s/1.19,s/1.42,s/2]),e.paper.path({path:o,stroke:e.foregroundColor,fill:e.foregroundColor,class:e.controller.classes.generate(a),"data-name":a})}(i,a,s,o,c):"bracket"===c&&(h=function(n,r,i,a,s){r+=t.STEP;var o=.75*t.STEP,c=.75*t.STEP,l=a-i,u=e("M %f %f l %f %f l %f %f l %f %f z",r,i-c,0,l+2*c,o,0,0,-(l+2*c)),h=2*t.STEP,d=t.STEP;return u+=e("M %f %f q %f %f %f %f q %f %f %f %f z",r+o,i-c,.6*h,.2*d,h,-d,.1*-h,.3*d,-h,d+t.STEP),u+=e("M %f %f q %f %f %f %f q %f %f %f %f z",r+o,i+c+l,.6*h,.2*-d,h,d,.1*-h,.3*-d,-h,-d-t.STEP),n.paper.path({path:u,stroke:n.foregroundColor,fill:n.foregroundColor,class:n.controller.classes.generate(s),"data-name":s})}(i,a,s,o,c)),l&&(h=i.paper.closeGroup()),u.wrapSvgEl({el_type:c,startChar:-1,endChar:-1},h),h};return _p=function(e,n,r){var a=n.startVoice.staff.absoluteY-10*t.STEP;return n.endVoice&&n.endVoice.staff?n.endY=n.endVoice.staff.absoluteY-2*t.STEP:n.lastContinuedVoice&&n.lastContinuedVoice.staff?n.endY=n.lastContinuedVoice.staff.absoluteY-2*t.STEP:n.endY=n.startVoice.staff.absoluteY-2*t.STEP,i(e,n.x,a,n.endY,n.type,n.header,r)}}function bv(){if(kp)return xp;return kp=1,xp=function(e,t,n){return e.paper.path(t)}}function _v(){if(Sp)return Cp;Sp=1;var e=mv(),t=bv(),n=gv();function r(e,t,r){return n(e+r*t)}var i=[[3.5,-4.8]],a=[[1.5,-1],[.3,-.3],[-3.5,3.8]],s=[[-1.5,2]],o=[[3,4],[3,-4]],c=[[-3,4],[-3,-4]];function l(e,t){for(var n="",i=0;i<e.length;i++)n+="l"+e[i][0]+" "+r(e[i][1],t,e[i][0]);return n}var u=function(n,r,u,h,d){var f,p=e("M %f %f",r,u);for(p+=l(i,d),f=0;f<h;f++)p+=l(o,d);for(p+=l(a,d),f=0;f<h;f++)p+=l(c,d);return p+=l(s,d)+"z",t(n,{path:p,highlight:"stroke",stroke:n.foregroundColor,class:n.controller.classes.generate("decoration"),"data-name":"glissando"})};return Cp=function(e,t,n){t.anchor1&&t.anchor2&&t.anchor1.heads&&t.anchor2.heads&&0!==t.anchor1.heads.length&&0!==t.anchor2.heads.length||window.console.error("Glissando Element not set.");var i=e.calcY(t.anchor1.heads[0].pitch),a=e.calcY(t.anchor2.heads[0].pitch),s=t.anchor1.x+t.anchor1.w/2,o=t.anchor2.x+t.anchor2.w/2,c=function(e,t,n,r){var i=n-e,a=r-t;return Math.sqrt(i*i+a*a)}(s,i,o,a),l=t.anchor1.w/2+4,h=t.anchor2.w/2+4,d=function(e,t,n,r){return(r-t)/(n-e)}(s,i,o,a),f=r(i,d,l);r(a,d,-h);var p,m,g=(p=c-l-h,m=5,Math.max(2,Math.floor((p-2*m)/6))),v=u(e,s+l,f,g,d);return n.wrapSvgEl({el_type:"glissando",startChar:-1,endChar:-1},v),[v]}}function wv(){if(Np)return Tp;Np=1;var e=gv();function t(){this.ingroup=!1}t.prototype.beginGroup=function(e,t){this.paper=e,this.controller=t,this.path=[],this.lastM=[0,0],this.ingroup=!0,this.paper.openGroup()},t.prototype.isInGroup=function(){return this.ingroup},t.prototype.addPath=function(t){if(0!==(t=t||[]).length){t[0][0]="m",t[0][1]=e(t[0][1]-this.lastM[0]),t[0][2]=e(t[0][2]-this.lastM[1]),this.lastM[0]+=t[0][1],this.lastM[1]+=t[0][2],this.path.push(t[0]);for(var n=1,r=t.length;n<r;n++)"m"===t[n][0]&&(this.lastM[0]+=t[n][1],this.lastM[1]+=t[n][2]),this.path.push(t[n])}},t.prototype.endGroup=function(e,t){this.ingroup=!1;for(var n=0;n<this.path.length;n++)this.path[n].join(" ");this.path=[];var r=this.paper.closeGroup();return r&&(r.setAttribute("class",this.controller.classes.generate(e)),r.setAttribute("fill",this.controller.renderer.foregroundColor),r.setAttribute("stroke","none"),r.setAttribute("data-name",t)),r};var n=new t;return Tp=n}function xv(){if(Pp)return Ap;Pp=1;var e=vv(),t=Qg(),n=wv();function r(e,t,n){var r=n;return"f"===e&&"f"===t&&(r=2*r/3),"p"===e&&"p"===t&&(r=5*r/6),"f"===e&&"z"===t&&(r=5*r/8),r}return Ap=function(i,a,s,o,c){var l,u;if(!o)return null;if(o.length>1&&o.indexOf(".")<0){var h=n.isInGroup()?"":c.klass;i.paper.openGroup({"data-name":c.name,klass:h});for(var d=0,f=0;f<o.length;f++){var p=o[f];u=t.getYCorr(p),(l=t.printSymbol(a+d,i.calcY(s+u),p,i.paper,{stroke:c.stroke,fill:c.fill}))?f<o.length-1&&(d+=r(p,o[f+1],t.getSymbolWidth(p))):e(i,{x:a,y:i.y,text:"no symbol:"+o,type:"debugfont",klass:"debug-msg",anchor:"start"},!1)}return i.paper.closeGroup()}return u=t.getYCorr(o),(l=n.isInGroup()?t.printSymbol(a,i.calcY(s+u),o,i.paper,{"data-name":c.name}):t.printSymbol(a,i.calcY(s+u),o,i.paper,{klass:c.klass,stroke:c.stroke,fill:c.fill,"data-name":c.name}))?l:(e(i,{x:a,y:i.y,text:"no symbol:"+o,type:"debugfont",klass:"debug-msg",anchor:"start"},!1),null)}}function kv(){if(Op)return Bp;Op=1;var e=mv(),t=vv(),n=bv(),r=gv();function i(t,n,i,a){return e("M %f %f L %f %f",r(t),r(n),r(i),r(a))}return Bp=function(e,r,a){e.paper.openGroup({klass:e.controller.classes.generate("triplet "+r.durationClass),"data-name":"triplet"}),r.hasBeam||function(e,t,r,a,s){r=e.calcY(r),s=e.calcY(s);var o=5,c="";c+=i(t,r,t,r+o),c+=i(a,s,a,s+o);var l=t+(a-t)/2,u=8,h=(s-r)/(a-t),d=l-u;c+=i(t,r,d,r+(d-t)*h);var f=l+u;c+=i(f,r+(f-t)*h,a,s),n(e,{path:c,stroke:e.foregroundColor,"data-name":"triplet-bracket"})}(e,r.anchor1.x,r.startNote,r.anchor2.x+r.anchor2.w,r.endNote),t(e,{x:r.xTextPos,y:e.calcY(r.yTextPos-1),text:""+r.number,type:"tripletfont",anchor:"middle",centerVertically:!0,noClass:!0,name:""+r.number},!0);var s=e.paper.closeGroup();return a.wrapSvgEl({el_type:"triplet",startChar:-1,endChar:-1},s),s}}function Cv(){if(Hp)return qp;Hp=1;var e=wv(),t=gv();return qp=function(n,r,i,a,s,o,c){if(i<0||a<s){var l=t(s);s=t(a),a=l}else a=t(a),s=t(s);r=t(r);var u=t(r+i);if(n.firefox112){var h={x1:r+=i/2,x2:r,y1:a,y2:s,stroke:n.foregroundColor,"stroke-width":Math.abs(i)};return o&&(h.class=o),c&&(h["data-name"]=c),n.paper.lineToBack(h)}for(var d=[["M",r,a],["L",r,s],["L",u,s],["L",u,a],["z"]],f=(h={path:""},0);f<d.length;f++)h.path+=d[f].join(" ");return o&&(h.class=o),c&&(h["data-name"]=c),e.isInGroup()||(h.stroke="none",h.fill=n.foregroundColor),n.paper.pathToBack(h)}}function Sv(){if(Yp)return Wp;Yp=1;var e=function(){if(Gp)return Up;Gp=1;var e=mv(),t=gv();return Up=function(n,r,i,a,s,o,c){var l=n.foregroundColor;r=t(r),i=t(i);var u=t(a-c),h=t(a+c);if(n.firefox112){var d={x1:r,x2:i,y1:a+=c/2,y2:a,stroke:n.foregroundColor,"stroke-width":Math.abs(2*c)};return s&&(d.class=s),o&&(d["data-name"]=o),n.paper.lineToBack(d)}var f={path:e("M %f %f L %f %f L %f %f L %f %f z",r,u,i,u,i,h,r,h),stroke:"none",fill:l};return o&&(f["data-name"]=o),s&&(f.class=s),n.paper.pathToBack(f)}}();return Wp=function(t,n,r,i,a,s,o){var c=t.calcY(i);return e(t,n,r,c,a,s,o)}}function Ev(){if(Kp)return $p;Kp=1;var e=vv(),t=Cv(),n=Sv(),r=xv();return $p=function(i,a,s){void 0===a.pitch&&window.console.error(a.type+" Relative Element y-coordinate not set.");var o=i.calcY(a.pitch);switch(a.type){case"symbol":if(null===a.c)return null;var c="symbol";a.klass&&(c+=" "+a.klass),a.graphelem=r(i,a.x,a.pitch,a.c,{scalex:a.scalex,scaley:a.scaley,klass:i.controller.classes.generate(c),name:a.name});break;case"debug":a.graphelem=e(i,{x:a.x,y:i.calcY(15),text:""+a.c,type:"debugfont",klass:i.controller.classes.generate("debug-msg"),anchor:"start",centerVertically:!1,dim:a.dim},!1);break;case"tabNumber":var l="tabnumberfont",u="abcjs-tab-number";a.isGrace&&(l="tabgracefont",o+=2.5,u="tab-grace"),a.graphelem=e(i,{x:a.x,y:o,text:""+a.c,type:l,klass:i.controller.classes.generate(u),anchor:"middle",centerVertically:!1,dim:a.dim,cursor:"default"},!1);break;case"barNumber":a.graphelem=e(i,{x:a.x,y:o,text:""+a.c,type:"measurefont",klass:i.controller.classes.generate("bar-number"),anchor:"middle",dim:a.dim,name:"bar-number"},!0);break;case"lyric":a.graphelem=e(i,{x:a.x,y:o,text:a.c,type:"vocalfont",klass:i.controller.classes.generate("lyric"),anchor:"middle",dim:a.dim,name:"lyric"},!1);break;case"chord":a.graphelem=e(i,{x:a.x,y:o,text:a.c,type:"gchordfont",klass:i.controller.classes.generate("chord"),anchor:"middle",dim:a.dim,lane:a.getLane(),name:"chord"},!1);break;case"decoration":a.graphelem=e(i,{x:a.x,y:o+6,text:a.c,type:"annotationfont",klass:i.controller.classes.generate("annotation"),anchor:a.anchor,centerVertically:!0,dim:a.dim},!1);break;case"text":a.graphelem=e(i,{x:a.x,y:o,text:a.c,type:"annotationfont",klass:i.controller.classes.generate("annotation"),anchor:"start",centerVertically:a.centerVertically,dim:a.dim,lane:a.getLane(),name:"annotation"},!1);break;case"multimeasure-text":a.graphelem=e(i,{x:a.x+a.w/2,y:o,text:a.c,type:"tempofont",klass:i.controller.classes.generate("rest"),anchor:"middle",centerVertically:!1,dim:a.dim},!1);break;case"part":a.graphelem=e(i,{x:a.x,y:o,text:a.c,type:"partsfont",klass:i.controller.classes.generate("part"),anchor:"start",dim:a.dim,name:a.c},!0);break;case"bar":a.graphelem=t(i,a.x,a.linewidth+i.lineThickness,o,s||i.calcY(a.pitch2),null,"bar");break;case"stem":var h=a.linewidth>0?a.linewidth+i.lineThickness:a.linewidth-i.lineThickness;a.graphelem=t(i,a.x,h,o,i.calcY(a.pitch2),"abcjs-stem","stem");break;case"ledger":a.graphelem=n(i,a.x,a.x+a.w,a.pitch,"abcjs-ledger","ledger",.35+i.lineThickness)}return 1!==a.scalex&&a.graphelem&&function(e,t,n,r,i,a){e.setAttributeOnElement(t,{style:"transform:scale("+n+","+r+");transform-origin:"+i+"px "+a+"px;"})}(i.paper,a.graphelem,a.scalex,a.scaley,a.x,o),a.graphelem}}function Mv(){if(Jp)return Zp;Jp=1;var e=function(){if(Xp)return Qp;Xp=1;var e=Ev(),t=vv();return Qp=function(n,r){var i=r.x;void 0===r.pitch&&window.console.error("Tempo Element y-coordinate not set."),r.tempo.el_type="tempo";var a,s=n.calcY(r.pitch)+2;if(r.tempo.preString){a=t(n,{x:i,y:s,text:r.tempo.preString,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"pre"},!0);var o=n.controller.getTextSize.calc(r.tempo.preString,"tempofont","tempo",a).width;i+=o+o/r.tempo.preString.length}if(r.note){r.note.setX(i);for(var c=0;c<r.note.children.length;c++)e(n,r.note.children[c],i);i+=r.note.w+5;var l="= "+r.tempo.bpm;a=t(n,{x:i,y:s,text:l,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"beats"});var u=n.controller.getTextSize.calc(l,"tempofont","tempo",a).width;i+=u+u/l.length}r.tempo.postString&&t(n,{x:i,y:s,text:r.tempo.postString,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"post"},!0)}}(),t=Ev(),n=Ng(),r=Vg(),i=wv();return Zp=function(a,s,o,c,l){if(!s.invisible){var u=s.children.length>0&&"TempoElement"===s.children[0].type;s.elemset=[],i.beginGroup(a.paper,a.controller);for(var h=0;h<s.children.length;h++){var d=s.children[h];if("TempoElement"===d.type)e(a,d);else{var f=t(a,d,o);"symbol"===d.type&&d.c&&d.c.indexOf("notehead")>=0&&f.setAttribute("class","abcjs-notehead")}}var p=s.type;if(("note"===s.type||"rest"===s.type)&&(s.counters=a.controller.classes.getCurrent(),p=(p+=" d"+Math.round(1e3*s.durationClass)/1e3).replace(/\./g,"-"),s.abcelem.pitches))for(var m=0;m<s.abcelem.pitches.length;m++)p+=" p"+s.abcelem.pitches[m].pitch;var g=i.endGroup(p,s.type);if(g){if(s.cloned&&(s.cloned.overrideClasses=g.className.baseVal),s.overrideClasses){var v=g.classList&&g.classList.length>0?g.classList[0]+" ":"";g.setAttribute("class",v+s.overrideClasses)}if(u)s.startChar=s.abcelem.startChar,s.endChar=s.abcelem.endChar,c.add(s,g,!1,l);else{s.elemset.push(g);var y=!1;"note"!==s.type&&"tabNumber"!==s.type||(y=!0),c.add(s,g,y,l)}}else s.elemset.length>0&&c.add(s,s.elemset[0],"note"===s.type,l);if(s.klass&&r(s.elemset,"mark","","#00ff00"),s.hint&&r(s.elemset,"abcjs-hint","",null),s.abcelem.abselem=s,s.heads&&s.heads.length>0){s.notePositions=[];for(var b=0;b<s.heads.length;b++)s.notePositions.push({x:s.heads[b].x+s.heads[b].w/2,y:l.zero-s.heads[b].pitch*n.STEP})}}}}function Tv(){if(tm)return em;tm=1;var e=_v(),t=function(){if(Mp)return Ep;Mp=1;var e=mv(),t=bv(),n=gv(),r=function(r,i,a,s,o,c,l){i=n(i),a=n(a),s=n(s),o=n(o),c=n(c),l=n(l);var u=e("M %f %f L %f %f M %f %f L %f %f",c,i,l,a,c,s,l,o);return t(r,{path:u,highlight:"stroke",stroke:r.foregroundColor,class:r.controller.classes.generate("dynamics decoration"),"data-name":"dynamics"})};return Ep=function(e,t,n){void 0===t.pitch&&window.console.error("Crescendo Element y-coordinate not set.");var i,a=e.calcY(t.pitch)+4,s=t.anchor1?t.anchor1.x:0,o=t.anchor2?t.anchor2.x:800;return i="<"===t.dir?r(e,a+4,a,a+4,a+8,s,o):r(e,a,a+4,a+8,a+4,s,o),n.wrapSvgEl({el_type:"dynamicDecoration",startChar:-1,endChar:-1},i),[i]}}(),n=function(){if(Dp)return Ip;Dp=1;var e=xv();return Ip=function(t,n,r){void 0===n.pitch&&window.console.error("Dynamic Element y-coordinate not set.");var i=e(t,n.anchor.x,n.pitch,n.dec,{scalex:1,scaley:1,klass:t.controller.classes.generate("decoration dynamics"),fill:t.foregroundColor,stroke:"none",name:"dynamics"});return r.wrapSvgEl({el_type:"dynamicDecoration",startChar:-1,endChar:-1,decoration:n.dec},i),[i]}}(),r=kv(),i=function(){if(Vp)return Lp;Vp=1;var e=mv(),t=vv(),n=bv(),r=gv();return Lp=function(i,a,s,o,c){void 0===a.pitch&&window.console.error("Ending Element y-coordinate not set.");var l=r(i.calcY(a.pitch)),u="";a.anchor1&&(s=r(a.anchor1.x+a.anchor1.w),u+=e("M %f %f L %f %f ",s,l,s,r(l+20))),a.anchor2&&(o=r(a.anchor2.x),u+=e("M %f %f L %f %f ",o,l,o,r(l+20))),u+=e("M %f %f L %f %f ",s,l,o,l),i.paper.openGroup({klass:i.controller.classes.generate("ending"),"data-name":"ending"}),n(i,{path:u,stroke:i.foregroundColor,fill:i.foregroundColor,"data-name":"line"}),a.anchor1&&t(i,{x:r(s+5),y:r(i.calcY(a.pitch-.5)),text:a.text,type:"repeatfont",klass:"ending",anchor:"start",noClass:!0,name:a.text});var h=i.paper.closeGroup();return c.wrapSvgEl({el_type:"ending",startChar:-1,endChar:-1},h),[h]}}(),a=function(){if(Fp)return Rp;Fp=1;var e=mv(),t=gv(),n=function(e,t,n){e.anchor1&&e.anchor2?e.anchor1.pitch===e.anchor2.pitch&&0===e.internalNotes.length?e.isTie=!0:e.isTie=!1:e.isTie=!0,e.isTie?(e.calcTieDirection(),e.calcX(t,n),e.calcTieY()):(e.calcSlurDirection(),e.calcX(t,n),e.calcSlurY()),e.avoidCollisionAbove()},r=function(n,r,i,a,s,o,c,l,u){var h=l?1.2:1.5;r=t(r+6),i=t(i+4),a+=o?h:-h,s+=o?h:-h;var d,f=t(n.calcY(a)),p=t(n.calcY(s)),m=i-r,g=p-f,v=Math.sqrt(m*m+g*g),y=m/v,b=g/v,_=v/3.5,w=l?10:25,x=(o?-1:1)*Math.min(w,Math.max(4,_)),k=t(r+_*y-x*b),C=t(f+_*b+x*y),S=t(i-_*y-x*b),E=t(p-_*b+x*y);if(c?c+=" slur":c="slur",c+=l?" tie":" legato",u){c+=" dotted";var M=e("M %f %f C %f %f %f %f %f %f",r,f,k,C,S,E,i,p);d=n.paper.path({path:M,stroke:n.foregroundColor,fill:"none","stroke-dasharray":"5 5",class:n.controller.classes.generate(c),"data-name":l?"tie":"slur"})}else{var T=e("M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z",r,f,k,C,S,E,i,p,t(S-2*b),t(E+2*y),t(k-2*b),t(C+2*y),r,f);d=n.paper.path({path:T,stroke:"none",fill:n.foregroundColor,class:n.controller.classes.generate(c),"data-name":l?"tie":"slur"})}return d};return Rp=function(e,t,i,a,s){n(t,i,a);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=r(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 h=-1;return t.anchor2&&!t.isTie&&(h=t.anchor2.parent.abcelem.endChar+1),s.wrapSvgEl({el_type:"slur",startChar:u,endChar:h},l),[l]}}(),s=function(){if(jp)return zp;jp=1;var e=bv(),t=gv();function n(e,n,r,i,a,s){r=t(e.calcY(r)),a=t(e.calcY(a)),n=t(n),i=t(i);var o=t(r+s);return"M"+n+" "+r+" L"+i+" "+a+"L"+i+" "+t(a+s)+" L"+n+" "+o+"z"}function r(e,t,n,r,i){return(i-n)/(r-t)}function i(e,t,n,r){return t+(r-e)*n}return zp=function(t,a){if(0!==a.beams.length){for(var s="",o=0;o<a.beams.length;o++){var c=a.beams[o];if(c.split){for(var l=r(t,c.startX,c.startY,c.endX,c.endY),u=[],h=0;h<c.split.length;h+=2)u.push([c.split[h],c.split[h+1]]);for(h=0;h<u.length;h++){var d=i(c.startX,c.startY,l,u[h][0]),f=i(c.startX,c.startY,l,u[h][1]);s+=n(t,u[h][0],d,u[h][1],f,c.dy)}}else s+=n(t,c.startX,c.startY,c.endX,c.endY,c.dy)}var p=("abcjs-d"+a.duration).replace(/\./g,"-"),m=t.controller.classes.generate("beam-elem "+p);return[e(t,{path:s,stroke:"none",fill:t.foregroundColor,class:m})]}}}(),o=vv(),c=Mv();function l(e){return"rest"===e.type&&!(!e.abcelem||!e.abcelem.rest||"spacer"===e.abcelem.rest.type)}return em=function(u,h,d,f,p){var m=h.w-1;u.staffbottom=h.staff.bottom;var g,v,y=u.foregroundColor;if(h.color&&(u.foregroundColor=h.color),h.header){var b=o(u,{x:u.padding.left,y:u.calcY(h.headerPosition),text:h.header,type:"voicefont",klass:"staff-extra voice-name",anchor:"start",centerVertically:!0,name:"voice-name"},!0);f.wrapSvgEl({el_type:"voiceName",startChar:-1,endChar:-1,text:h.header},b)}var _=!1;for(g=0;g<h.children.length;g++){"note"!==(v=h.children[g]).type&&"rest"!==v.type||(_=!0);var w=!1;"staff-extra"===v.type||u.controller.classes.isInMeasure()||(u.controller.classes.startMeasure(),w=!0),h.staff.isTabStaff&&(v.invisible=!1,"bar"==v.type&&v.abcelem.lastBar&&(d=h.topLine)),c(u,v,h.barto||g===h.children.length-1?d:0,f,p),("note"===v.type||l(v))&&u.controller.classes.incrNote(),"bar"===v.type&&!w&&_&&u.controller.classes.incrMeasure()}for(u.controller.classes.startMeasure(),g=0;g<h.beams.length;g++){var x=h.beams[g];"bar"===x?u.controller.classes.incrMeasure():s(u,x,f)}for(u.controller.classes.startMeasure(),g=0;g<h.otherchildren.length;g++)if("bar"===(v=h.otherchildren[g]))u.controller.classes.incrMeasure();else switch(v.type){case"GlissandoElem":v.elemset=e(u,v,f);break;case"CrescendoElem":v.elemset=t(u,v,f);break;case"DynamicDecoration":v.elemset=n(u,v,f);break;case"TripletElem":r(u,v,f);break;case"EndingElem":v.elemset=i(u,v,h.startx+10,m,f);break;case"TieElem":v.elemset=a(u,v,h.startx+10,m,f);break;default:console.log(v),c(u,v,h.startx+10,m,f,p)}u.foregroundColor=y}}function Nv(){if(lm)return cm;lm=1;var e=om?sm:(om=1,sm=function(e,t){var n=Math.round(e.y),r=(e.controller.width-t)/2,i=r+t,a="M "+r+" "+n+" L "+i+" "+n+" L "+i+" "+(n+1)+" L "+r+" "+(n+1)+" L "+r+" "+n+" z";e.paper.pathToBack({path:a,stroke:"rgba(0,0,0,0)",fill:"rgba(0,0,0,255)",class:e.controller.classes.generate("defined-text")})}),t=vv();return cm=function(n,r,i){for(var a=0;a<r.rows.length;a++){var s=r.rows[a];if(s.absmove)n.absolutemoveY(s.absmove);else if(s.move)n.moveY(s.move);else if(s.text||s.phrases){var o=s.left?s.left:0,c=t(n,{x:o,y:n.y,text:s.text,phrases:s.phrases,"dominant-baseline":s["dominant-baseline"],type:s.font,klass:s.klass,name:s.name,anchor:s.anchor});s.absElemType&&i.wrapSvgEl({el_type:s.absElemType,name:s.name,startChar:s.startChar,endChar:s.endChar,text:s.text},c)}else if(s.separator)e(n,s.separator);else if(s.startGroup)n.paper.openGroup({klass:s.klass,"data-name":s.name});else if(s.endGroup){var l=n.paper.closeGroup();s.absElemType&&i.wrapSvgEl({el_type:s.absElemType,name:s.name,startChar:s.startChar,endChar:s.endChar,text:""},l)}}}}function Av(){if(hm)return um;hm=1;var e=Ng(),t=yv(),n=Tv(),r=function(){if(rm)return nm;rm=1;var e=Sv();return nm=function(t,n,r,i,a,s){var o="abcjs-top-line",c=2;a&&(c=a),t.paper.openGroup({prepend:!0,klass:t.controller.classes.generate("abcjs-staff")});var l=0,u=0;if(1===i)e(t,n,r,6,o,null,s+t.lineThickness),l=t.calcY(10),u=t.calcY(2);else for(var h=i-1;h>=0;h--){var d=(h+1)*c;u=t.calcY(d),0===l&&(l=u),e(t,n,r,d,o,null,s+t.lineThickness),o=void 0}return t.paper.closeGroup(),[l,u]}}(),i=am?im:(am=1,im=function(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}),a=Cv(),s=Nv();function o(n,r,i,a,s){if(i)for(var o=0;o<i.length;o++)i[o].isStartVoice(a)&&(i[o].startY=r-10*e.STEP,i[o].elemset=t(n,i[o],s))}function c(t,n,r){for(var a=0;a<r.length;a++)for(var s=n[r[a]].children,o=0;o<s.length;o++){var c=s[o],l=c.getFixedCoords();if(!c.invisible&&void 0!==l.t&&void 0!==l.b){var u=(l.t-l.b)*e.STEP;i(t,{x:l.x,y:t.calcY(l.t),width:l.w,height:u,fill:"#88e888","fill-opacity":.4,stroke:"#4aa93d","stroke-opacity":.8});for(var h=0;h<c.children.length;h++){var d=c.children[h],f=d.getChordDim();if(f){var p=t.calcY(d.pitch);p+=d.dim.font.size*d.getLane(),i(t,{x:f.left,y:p,width:f.right-f.left,height:d.dim.font.size,fill:"none",stroke:"#4aa93d","stroke-opacity":.8})}}}}}return um=function(t,l,u,h){for(var d,f,p,m=t.y,g=0;g<l.staffs.length;g++){var v=l.staffs[g];t.moveY(e.STEP,v.top),v.absoluteY=t.y,t.showDebug&&(t.showDebug.indexOf("box")>=0&&v.voices&&c(t,l.voices,v.voices),t.showDebug.indexOf("grid")>=0&&(t.paper.dottedLine({x1:t.padding.left,x2:t.padding.left+t.controller.width,y1:m,y2:m,stroke:"#0000ff"}),i(t,{x:t.padding.left,y:t.calcY(v.originalTop),width:t.controller.width,height:t.calcY(v.originalBottom)-t.calcY(v.originalTop),fill:t.foregroundColor,stroke:t.foregroundColor,"fill-opacity":.1,"stroke-opacity":.1}),d=0,M(v,"chordHeightAbove"),M(v,"chordHeightBelow"),M(v,"dynamicHeightAbove"),M(v,"dynamicHeightBelow"),M(v,"endingHeightAbove"),M(v,"lyricHeightAbove"),M(v,"lyricHeightBelow"),M(v,"partHeightAbove"),M(v,"tempoHeightAbove"),M(v,"volumeHeightAbove"),M(v,"volumeHeightBelow"))),t.moveY(e.STEP,-v.bottom),t.showDebug&&t.showDebug.indexOf("grid")>=0&&t.paper.dottedLine({x1:t.padding.left,x2:t.padding.left+t.controller.width,y1:t.y,y2:t.y,stroke:"#0000aa"})}for(var y=2,b=0,_=0;_<l.voices.length;_++){var w=l.voices[_].staff,x=l.voices[_].tabNameInfos;if(t.y=w.absoluteY,t.controller.classes.incrVoice(),!l.voices[_].duplicate){if(f||(f=t.calcY(10)),p=t.calcY(y),0!==w.lines){w.linePitch&&(y=w.linePitch),t.controller.classes.newMeasure();var k=r(t,l.startx,l.w,w.lines,w.linePitch,.35);p=k[1],w.bottomLine=p,w.topLine=k[0],w.hasTab&&(b=w.topLine),w.hasStaff&&(b=w.hasStaff.topLine,l.voices[_].barto=!0,l.voices[_].topLine=f)}o(t,w.absoluteY,l.brace,_,u),o(t,w.absoluteY,l.bracket,_,u)}n(t,l.voices[_],b,u,{top:m,zero:t.y,height:l.height*e.STEP});var C=0;if(x){var S={rows:[]};S.rows.push({absmove:p+2});S.rows.push({left:l.startx+8,text:x.name,font:"tablabelfont",klass:"text instrument-name",anchor:"start"}),S.rows.push({move:x.textSize.height}),s(t,S),C=x.textSize.height}t.controller.classes.newMeasure(),l.voices[_].duplicate||(b=t.calcY(2+C))}t.controller.classes.newMeasure();var E=l.staffs.length;function M(n,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(n.positionY&&n.positionY[r]){var s=n.specialY[r]*e.STEP;"chordHeightAbove"===r&&n.specialY.chordLines&&n.specialY.chordLines.above&&(s*=n.specialY.chordLines.above),"chordHeightBelow"===r&&n.specialY.chordLines&&n.specialY.chordLines.below&&(s*=n.specialY.chordLines.below),i(t,{x:t.padding.left,y:t.calcY(n.positionY[r]),width:t.controller.width,height:s,fill:a[d],stroke:a[d],"fill-opacity":.4,"stroke-opacity":.4},r.substr(0,4)),(d+=1)>6&&(d=0)}}E>1&&(f=l.staffs[0].topLine,p=l.staffs[E-1].bottomLine,a(t,l.startx,.6,f,p,null)),t.y=m}}function Pv(){if(vm)return gm;vm=1;var e=Av(),t=fm?dm:(fm=1,dm=function(e,t,n,r){var i=(t+e.padding.left+e.padding.right)*n,a=(e.y+e.padding.bottom)*n;if(e.isPrint&&(a=Math.max(a,1056)),""!==e.ariaLabel){var s="Sheet Music";e.abctune&&e.abctune.metaText&&e.abctune.metaText.title&&(s+=' for "'+e.abctune.metaText.title+'"'),e.paper.setTitle(s);var o=e.ariaLabel?e.ariaLabel:s;e.paper.setAttribute("aria-label",o)}e.paper.insertStyles(".abcjs-dragging-in-progress text, .abcjs-dragging-in-progress tspan {"+["-webkit-touch-callout: none;","-webkit-user-select: none;","-khtml-user-select: none;","-moz-user-select: none;","-ms-user-select: none;","user-select: none;"].join(" ")+"}");var c={overflow:"hidden"};"resize"===r?e.paper.setResponsiveWidth(i,a):(c.width="",c.height=a+"px",n<1?(c.width=i+"px",e.paper.setSize(i/n,a/n)):e.paper.setSize(i,a)),e.paper.setScale(n),e.paper.setParentStyles(c)}),n=Nv(),r=Ng(),i=function(){if(mm)return pm;mm=1;var e=Rg(),t=Fg();function n(e,t,n){this.elements=[],this.paper=e,this.tuneNumber=n,this.selectTypes=t}return n.prototype.getElements=function(){return this.elements},n.prototype.add=function(e,t,n,r){if(this.canSelect(e)){var i;i=void 0===this.selectTypes?{selectable:!1,"data-index":this.elements.length}:{selectable:!0,tabindex:0,"data-index":this.elements.length},this.paper.setAttributeOnElement(t,i);var a={absEl:e,svgEl:t,isDraggable:n};void 0!==r&&(a.staffPos=r),this.elements.push(a)}},n.prototype.canSelect=function(e){return!(!1===this.selectTypes||!e||!e.abcelem||!0!==this.selectTypes&&!(void 0===this.selectTypes?"note"===e.abcelem.el_type||"tabNumber"===e.abcelem.el_type:this.selectTypes.indexOf(e.abcelem.el_type)>=0))},n.prototype.wrapSvgEl=function(n,r){var i={tuneNumber:this.tuneNumber,abcelem:n,elemset:[r],highlight:e,unhighlight:t};this.add(i,r,!1)},pm=n}();function a(t,n,i,a){e(t,n,i,a);var s=n.height*r.STEP;return t.y+=s,n}function s(e,t,n,i){var a=-(n.staffs[n.staffs.length-1].bottom-2),s=(i.staffs[0].top-10+a)*r.STEP;s<t&&e.moveY(t-s)}return gm=function(e,r,o,c,l,u,h,d,f,p){var m=new i(e.paper,d,f),g={};r.shouldAddClasses&&(g.klass="abcjs-meta-top"),e.paper.openGroup(g),e.moveY(e.padding.top),n(e,o.topText,m),e.paper.closeGroup(),e.moveY(e.spacing.music);for(var v=[],y=0;y<o.lines.length;y++){r.incrLine();var b=o.lines[y];if(b.staff){r.shouldAddClasses&&(g.klass="abcjs-staff-wrapper abcjs-l"+r.lineNumber),e.paper.openGroup(g),b.vskip&&e.moveY(b.vskip),v.length>=1&&s(e,e.spacing.staffSeparation,v[v.length-1],b.staffGroup);var _=a(e,b.staffGroup,m,y);_.line=p+y,v.push(_),e.paper.closeGroup()}else b.nonMusic&&(r.shouldAddClasses&&(g.klass="abcjs-non-music"),e.paper.openGroup(g),n(e,b.nonMusic,m),e.paper.closeGroup())}return r.reset(),o.bottomText&&o.bottomText.rows&&o.bottomText.rows.length>0&&(r.shouldAddClasses&&(g.klass="abcjs-meta-bottom"),e.paper.openGroup(g),e.moveY(24),n(e,o.bottomText,m),e.paper.closeGroup()),t(e,l,h,u),{staffgroups:v,selectables:m.getElements()}}}function Iv(){if(wm)return _m;wm=1;var e=Ng(),t=tv(),n=nv(),r=Sf?Cf:(Sf=1,Cf=function(e,t,n,r,i,a){var s,o=e.text;this.rows=[],t&&this.rows.push({move:t});var c=n.calc("textfont","defined-text");if(""===o)this.rows.push({move:2*c.attr["font-size"]});else if("string"==typeof o)this.rows.push({move:c.attr["font-size"]/2}),this.rows.push({left:r,text:o,font:"textfont",klass:"defined-text",anchor:"start",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),s=a.calc(o,"textfont","defined-text"),this.rows.push({move:s.height});else if(o){for(var l=0,u=r,h="textfont",d=0;d<o.length;d++)h=o[d].font?o[d].font:"textfont",this.rows.push({left:u,text:o[d].text,font:h,klass:"defined-text",anchor:"start",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),u+=(s=a.calc(o[d].text,n.calc(h,"defined-text").font,"defined-text")).width+s.height/2,l=Math.max(l,s.height);this.rows.push({move:l})}else if(1===e.length){var f=i/2;this.rows.push({left:f,text:e[0].text,font:"textfont",klass:"defined-text",anchor:"middle",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),s=a.calc(e[0].text,"textfont","defined-text"),this.rows.push({move:s.height})}}),i=Mf?Ef:(Mf=1,Ef=function(e,t,n){this.rows=[],e&&this.rows.push({move:e}),this.rows.push({separator:t,absElemType:"separator"}),n&&this.rows.push({move:n})}),a=Nf?Tf:(Nf=1,Tf=function(e,t,n,r,i,a){this.rows=[],e&&this.rows.push({move:e});var s=t.titleleft?"start":"middle",o=t.titleleft?i:r;this.rows.push({left:o,text:n.text,font:"subtitlefont",klass:"text subtitle",anchor:s,startChar:n.startChar,endChar:n.endChar,absElemType:"subtitle",name:"subtitle"});var c=a.calc(n.text,"subtitlefont","text subtitle");this.rows.push({move:c.height})}),s=function(){if(Of)return Bf;Of=1;const e=rv(),t=iv();return Bf=function(n,r,i,a,s,o,c,l,u,h){if(this.rows=[],n.header&&o){var d=h.calc("X","headerfont","abcjs-header abcjs-meta-top").height;e(this.rows,{marginLeft:c,text:n.header.left,font:"headerfont",klass:"header meta-top",marginTop:-d,info:r.header,name:"header"},h),e(this.rows,{marginLeft:c+s/2,text:n.header.center,font:"headerfont",klass:"header meta-top",marginTop:-d,anchor:"middle",info:r.header,name:"header"},h),e(this.rows,{marginLeft:c+s,text:n.header.right,font:"headerfont",klass:"header meta-top",marginTop:-d,anchor:"end",info:r.header,name:"header"},h)}o&&this.rows.push({move:l.top});var f=i.titleleft?"start":"middle",p=i.titleleft?c:c+s/2;if(n.title){var m=u?"abcjs-title":"";t(this.rows,n.title,"titlefont",m,"title",p,{marginTop:l.title,anchor:f,absElemType:"title",info:r.title},h)}if(a.length)for(var g=0;g<a.length&&a[g].subtitle;)m=u?"abcjs-text abcjs-subtitle":"",t(this.rows,a[g].subtitle.text,"subtitlefont",m,"subtitle",p,{marginTop:l.subtitle,anchor:f,absElemType:"subtitle",info:a[g].subtitle},h),g++;if(n.rhythm||n.origin||n.composer){if(this.rows.push({move:l.composer}),n.rhythm&&n.rhythm.length>0){var v=!(!n.composer&&!n.origin);m=u?"abcjs-rhythm":"",e(this.rows,{marginLeft:c,text:n.rhythm,font:"infofont",klass:m,absElemType:"rhythm",noMove:v,info:r.rhythm,name:"rhythm"},h)}n.composer&&n.composer,n.origin&&n.origin;var y=n.composer?n.composer:"";n.origin&&("string"==typeof y&&"string"==typeof n.origin?y+=" ("+n.origin+")":"string"==typeof y&&"string"!=typeof n.origin?((y=[{text:y}]).push({text:" ("}),(y=y.concat(n.origin)).push({text:")"})):(y.push({text:" ("}),(y=y.concat(n.origin)).push({text:")"}))),y&&(m=u?"abcjs-composer":"",t(this.rows,y,"composerfont",m,"composer",c+s,{anchor:"end",absElemType:"composer",info:r.composer,ingroup:!0},h))}n.author&&n.author.length>0&&(m=u?"abcjs-author":"",t(this.rows,n.author,"composerfont",m,"author",c+s,{anchor:"end",absElemType:"author",info:r.author},h)),n.partOrder&&n.partOrder.length>0&&(m=u?"abcjs-part-order":"",t(this.rows,n.partOrder,"partsfont",m,"part-order",c,{absElemType:"partOrder",info:r.partOrder,anchor:"start"},h))}}(),o=function(){if(Vf)return Lf;Vf=1;const e=rv(),t=iv();function n(e,t,n,r,i,a,s){this.rows=[],e.unalignedWords&&e.unalignedWords.length>0&&this.unalignedWords(e.unalignedWords,r,i,a,s),this.extraText(e,r,i,a,s),e.footer&&n&&this.footer(e.footer,t,r,s)}function r(e,n,r,i,a,s,o){r&&(n&&(r="string"==typeof r?n+r:[{text:n}].concat(r)),t(e,r,"historyfont",a=s?"abcjs-extra-text "+a:"","description",i,{absElemType:"extraText",anchor:"start"},o))}function i(n,r,i,a,s,o,c,l,u,h,d,f){if(i){l=d?"abcjs-extra-text "+l:"";var p=f.calc("A",s,l);if("string"==typeof i)r&&(i=r+"\n"+i),e(n,{marginLeft:a,text:i,font:s,absElemType:"extraText",name:u,"dominant-baseline":"middle",klass:l},f);else{n.push({startGroup:c,klass:l,name:u}),n.push({move:h.info}),r&&(e(n,{marginLeft:a,text:r,font:s,absElemType:"extraText",name:u,"dominant-baseline":"middle"},f),n.push({move:3*p.height/4}));for(var m=0;m<i.length;m++)t(n,i[m],s,"",u,a,{anchor:"start"},f),m<i.length-1&&"string"==typeof i[m]&&"string"!=typeof i[m+1]&&n.push({move:3*p.height/4});n.push({endGroup:c,absElemType:o,startChar:-1,endChar:-1,name:u}),n.push({move:p.height})}}}return n.prototype.unalignedWords=function(e,t,n,r,a){var s=r?"abcjs-unaligned-words":"",o="wordsfont",c=a.calc("i",o,s);this.rows.push({move:n.words}),i(this.rows,"",e,t,o,"unalignedWords","unalignedWords",s,"unalignedWords",n,r,a),this.rows.push({move:c.height})},n.prototype.extraText=function(e,t,n,a,s){r(this.rows,"Book: ",e.book,t,"abcjs-book",a,s),r(this.rows,"Source: ",e.source,t,"abcjs-source",a,s),r(this.rows,"Discography: ",e.discography,t,"abcjs-discography",a,s),i(this.rows,"Notes:",e.notes,t,"historyfont","extraText","notes","abcjs-notes","description",n,a,s),r(this.rows,"Transcription: ",e.transcription,t,"abcjs-transcription",a,s),i(this.rows,"History:",e.history,t,"historyfont","extraText","history","abcjs-history","description",n,a,s),r(this.rows,"Copyright: ",e["abc-copyright"],t,"abcjs-copyright",a,s),r(this.rows,"Creator: ",e["abc-creator"],t,"abcjs-creator",a,s),r(this.rows,"Edited By: ",e["abc-edited-by"],t,"abcjs-edited-by",a,s)},n.prototype.footer=function(t,n,r,i){var a="header meta-bottom",s="footerfont";this.rows.push({startGroup:"footer",klass:a}),e(this.rows,{marginLeft:r,text:t.left,font:s,klass:a,name:"footer"},i),e(this.rows,{marginLeft:r+n/2,text:t.center,font:s,klass:a,anchor:"middle",name:"footer"},i),e(this.rows,{marginLeft:r+n,text:t.right,font:s,klass:a,anchor:"end",name:"footer"},i)},Lf=n}(),c=sv(),l=pv(),u=function(){if(lp)return cp;lp=1;var e=function(e){this.shouldAddClasses=e.shouldAddClasses,this.reset()};return e.prototype.reset=function(){this.lineNumber=null,this.voiceNumber=null,this.measureNumber=null,this.measureTotalPerLine=[],this.noteNumber=null},e.prototype.incrLine=function(){null===this.lineNumber?this.lineNumber=0:this.lineNumber++,this.voiceNumber=null,this.measureNumber=null,this.noteNumber=null},e.prototype.incrVoice=function(){null===this.voiceNumber?this.voiceNumber=0:this.voiceNumber++,this.measureNumber=null,this.noteNumber=null},e.prototype.isInMeasure=function(){return null!==this.measureNumber},e.prototype.newMeasure=function(){this.measureNumber&&(this.measureTotalPerLine[this.lineNumber]=this.measureNumber),this.measureNumber=null,this.noteNumber=null},e.prototype.startMeasure=function(){this.measureNumber=0,this.noteNumber=0},e.prototype.incrMeasure=function(){this.measureNumber++,this.noteNumber=0},e.prototype.incrNote=function(){this.noteNumber++},e.prototype.measureTotal=function(){for(var e=0,t=0;t<this.lineNumber;t++)e+=this.measureTotalPerLine[t]?this.measureTotalPerLine[t]:0;return this.measureNumber&&(e+=this.measureNumber),e},e.prototype.getCurrent=function(e){return{line:this.lineNumber,measure:this.measureNumber,measureTotal:this.measureTotal(),voice:this.voiceNumber,note:this.noteNumber}},e.prototype.generate=function(e){if(!this.shouldAddClasses)return"";var t=[];if(e&&e.length>0&&t.push(e),"abcjs-tab-number"===e)return t.join(" ");if("text instrument-name"===e)return"abcjs-text abcjs-instrument-name";if(null!==this.lineNumber&&t.push("l"+this.lineNumber),null!==this.measureNumber&&t.push("m"+this.measureNumber),null!==this.measureNumber&&t.push("mm"+this.measureTotal()),null!==this.voiceNumber&&t.push("v"+this.voiceNumber),e&&(e.indexOf("note")>=0||e.indexOf("rest")>=0||e.indexOf("lyric")>=0)&&null!==this.noteNumber&&t.push("n"+this.noteNumber),t.length>0){t=(t=t.join(" ")).split(" ");for(var n=0;n<t.length;n++)0!==t[n].indexOf("abcjs-")&&t[n].length>0&&(t[n]="abcjs-"+t[n])}return t.join(" ")},cp=e}(),h=function(){if(hp)return up;hp=1;var e=function(e,t){this.formatting=e,this.classes=t};return e.prototype.updateFonts=function(e){e.gchordfont&&(this.formatting.gchordfont=e.gchordfont),e.tripletfont&&(this.formatting.tripletfont=e.tripletfont),e.annotationfont&&(this.formatting.annotationfont=e.annotationfont),e.vocalfont&&(this.formatting.vocalfont=e.vocalfont)},e.prototype.getFamily=function(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1):e},e.prototype.calc=function(e,t){var n;n="string"==typeof e?(n=this.formatting[e])?{face:n.face,size:Math.round(4*n.size/3),decoration:n.decoration,style:n.style,weight:n.weight,box:n.box}:{face:"Arial",size:Math.round(16),decoration:"underline",style:"normal",weight:"normal"}:{face:e.face,size:Math.round(4*e.size/3),decoration:e.decoration,style:e.style,weight:e.weight,box:e.box};var r=this.formatting.fontboxpadding?this.formatting.fontboxpadding:.1;return n.padding=n.size*r,{font:n,attr:{"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)}}},up=e}(),d=function(){if(fp)return dp;fp=1;var e=function(e,t){this.getFontAndAttr=e,this.svg=t};return e.prototype.updateFonts=function(e){this.getFontAndAttr.updateFonts(e)},e.prototype.attr=function(e,t){return this.getFontAndAttr.calc(e,t)},e.prototype.getFamily=function(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1):e},e.prototype.calc=function(e,t,n,r){var i;i="string"==typeof t?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)}};var a=this.svg.getTextSize(e,i.attr,r);return i.font.box?{height:a.height+4*i.font.padding,width:a.width+4*i.font.padding}:a},e.prototype.baselineToCenter=function(e,t,n,r,i){return.5*this.calc(e,t,n).height+(i-r-2)*this.attr(t,n).font.size},dp=e}(),f=Pv(),p=Yg(),m=function(){if(bm)return ym;bm=1;var e=av();return ym=function(t){for(var n=t;n&&n.attributes&&"svg"!==n.tagName.toLowerCase()&&!n.attributes.selectable;)n=n.parentNode;if(n&&n.attributes&&n.attributes.selectable){var r=n.attributes["data-index"].nodeValue;if(r&&(r=parseInt(r,10))>=0&&r<this.selectables.length){var i=this.selectables[r],a=e(i,t);return a.index=r,a.element=i,a}}return null}}(),g=function(t,r){r=r||{},this.findSelectableElement=m,this.oneSvgPerLine=r.oneSvgPerLine,this.selectionColor=r.selectionColor,this.dragColor=r.dragColor?r.dragColor:r.selectionColor,this.dragging=!!r.dragging,this.selectTypes=r.selectTypes,this.responsive=r.responsive,this.space=3*e.SPACE,this.initialClef=r.initialClef,this.timeBasedLayout=r.timeBasedLayout,this.expandToWidest=!!r.expandToWidest,this.scale=r.scale?parseFloat(r.scale):0,this.classes=new u({shouldAddClasses:r.add_classes}),this.scale>.1||(this.scale=void 0),r.staffwidth?(this.staffwidthScreen=r.staffwidth,this.staffwidthPrint=r.staffwidth):(this.staffwidthScreen=740,this.staffwidthPrint=680),this.listeners=[],r.clickListener&&this.addSelectListener(r.clickListener),this.renderer=new n(t),this.renderer.setPaddingOverride(r),r.showDebug&&(this.renderer.showDebug=r.showDebug),r.jazzchords&&(this.jazzchords=r.jazzchords),r.accentAbove&&(this.accentAbove=r.accentAbove),r.germanAlphabet&&(this.germanAlphabet=r.germanAlphabet),r.lineThickness&&(this.lineThickness=r.lineThickness),this.renderer.controller=this,this.renderer.foregroundColor=r.foregroundColor?r.foregroundColor:"currentColor",void 0!==r.ariaLabel&&(this.renderer.ariaLabel=r.ariaLabel),this.renderer.minPadding=r.minPadding?r.minPadding:0,this.reset()};function v(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];"height"!==r.name&&"aria-label"!=r.name&&t.setAttribute(r.name,r.value)}return t}return g.prototype.reset=function(){this.selected=[],this.staffgroups=[],this.engraver&&this.engraver.reset(),this.engraver=null,this.renderer.reset(),this.dragTarget=null,this.dragIndex=-1,this.dragMouseStart={x:-1,y:-1},this.dragYStep=0,this.lineThickness&&this.renderer.setLineThickness(this.lineThickness)},g.prototype.engraveABC=function(e,t,n){void 0===e[0]&&(e=[e]),this.reset();for(var r=0;r<e.length;r++)void 0===t&&(t=r),this.getFontAndAttr=new h(e[r].formatting,this.classes),this.getTextSize=new d(this.getFontAndAttr,this.renderer.paper),this.engraveTune(e[r],t,n)},g.prototype.adjustNonScaledItems=function(e){this.width/=e,this.renderer.adjustNonScaledItems(e)},g.prototype.getMeasureWidths=function(e){this.reset(),this.getFontAndAttr=new h(e.formatting,this.classes),this.getTextSize=new d(this.getFontAndAttr,this.renderer.paper);var t=this.jazzchords;this.setupTune(e,0),this.constructTuneElements(e),l(this.renderer,e,0,this.space,this.timeBasedLayout);for(var n,r=[],i=!0,a=0;a<e.lines.length;a++){var s=e.lines[a];if(s.staff){if(i&&(n={left:0,measureWidths:[],total:0},r.push(n),i=!1),s.staffGroup.voices.length>0)for(var o=s.staffGroup.voices[0],c=!1,u=0,f=0;f<o.children.length;f++){var p=o.children[f];c||p.isClef||p.isKeySig||(c=!0,n.left=p.x,u=p.x),"bar"===p.type&&(n.measureWidths.push(p.x-u),n.total+=p.x-u,u=p.x)}}else i=!0}return this.jazzchords=t,r},g.prototype.setupTune=function(e,n){this.classes.reset(),void 0!==e.formatting.jazzchords&&(this.jazzchords=e.formatting.jazzchords),void 0!==e.formatting.accentAbove&&(this.accentAbove=e.formatting.accentAbove),this.renderer.newTune(e),this.engraver=new t(this.getTextSize,n,{bagpipes:e.formatting.bagpipes,flatbeams:e.formatting.flatbeams,graceSlurs:!1!==e.formatting.graceSlurs,percmap:e.formatting.percmap,initialClef:this.initialClef,jazzchords:this.jazzchords,timeBasedLayout:this.timeBasedLayout,accentAbove:this.accentAbove,germanAlphabet:this.germanAlphabet}),this.engraver.setStemHeight(this.renderer.spacing.stemHeight),this.engraver.measureLength=e.getMeterFraction().num/e.getMeterFraction().den,e.formatting.staffwidth?this.width=1.33*e.formatting.staffwidth:this.width=this.renderer.isPrint?this.staffwidthPrint:this.staffwidthScreen;var r=e.formatting.scale?e.formatting.scale:this.scale;return"resize"===this.responsive&&(r=void 0),void 0===r&&(r=this.renderer.isPrint?.75:1),this.adjustNonScaledItems(r),r},g.prototype.constructTuneElements=function(e){var t,n;e.topText=new s(e.metaText,e.metaTextInfo,e.formatting,e.lines,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize);var c=!1,l=!1;for(t=0;t<e.lines.length;t++)if((n=e.lines[t]).staff)l=!0,n.staffGroup=this.engraver.createABCLine(n.staff,c?null:e.metaText.tempo,t),c=!0;else if(n.subtitle){if(l){var u=this.width/2+this.renderer.padding.left;n.nonMusic=new a(this.renderer.spacing.subtitle,e.formatting,n.subtitle,u,this.renderer.padding.left,this.getTextSize)}}else void 0!==n.text?(l=!0,n.nonMusic=new r(n.text,n.vskip,this.getFontAndAttr,this.renderer.padding.left,this.width,this.getTextSize)):void 0!==n.separator&&n.separator.lineLength&&(l=!0,n.nonMusic=new i(n.separator.spaceAbove,n.separator.lineLength,n.separator.spaceBelow));e.bottomText=new o(e.metaText,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize)},g.prototype.engraveTune=function(e,t,n){var r=this.jazzchords,i=this.setupTune(e,t);this.constructTuneElements(e);var a=l(this.renderer,e,this.width,this.space,this.expandToWidest,this.timeBasedLayout);if(this.expandToWidest&&a>this.width+1&&(e.topText=new s(e.metaText,e.metaTextInfo,e.formatting,e.lines,a,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize),e.lines&&e.lines.length>0))for(var o=e.lines.length,u=0;u<o;++u){var h=e.lines[u];if(h.nonMusic&&h.nonMusic.rows&&h.nonMusic.rows.length>0)for(var d=h.nonMusic.rows.length,m=0;m<d;++m){var g=h.nonMusic.rows[m];g.left&&(h.subtitle||h.text&&h.text.length>0&&h.text[0].center)&&(g.left=a/2+this.renderer.padding.left)}}e.tablatures&&p.layoutTablatures(this.renderer,e);var y=f(this.renderer,this.classes,e,this.width,a,this.responsive,i,this.selectTypes,t,n);if(this.staffgroups=y.staffgroups,this.selectables=y.selectables,this.oneSvgPerLine){var b=this.renderer.paper.svg.parentNode;this.svgs=function(e,t,n,r,i){n||(n="Untitled");var a=t.querySelector("svg");"resize"===r&&(t.style.paddingBottom="");for(var s=a.querySelector("style"),o="resize"===r?a.viewBox.baseVal.width:a.getAttribute("width"),c=t.querySelectorAll("svg > g"),l=0,u=[],h=0;h<c.length;h++){var d=c[h],f=d.getBBox(),p=f.y-l,m=f.height+p,g=document.createElement("div"),y="overflow: hidden;";"resize"!==r&&(y+="height:"+m*i+"px;"),g.setAttribute("style",y);var b=v(a),_='Sheet Music for "'+n+'" section '+(h+1);b.setAttribute("aria-label",_),"resize"!==r&&b.setAttribute("height",m),"resize"===r&&(b.style.position="");var w=e.firefox112?m+1:m;b.setAttribute("viewBox","0 "+l+" "+o+" "+w),b.appendChild(s.cloneNode(!0));var x=document.createElement("title");x.innerText=_,b.appendChild(x),b.appendChild(d),g.appendChild(b),u.push(b),t.appendChild(g),l=f.y+f.height}return t.removeChild(a),u}(this.renderer,b,e.metaText.title,this.responsive,i)}else this.svgs=[this.renderer.paper.svg];c(this,this.svgs),this.jazzchords=r},g.prototype.getDim=function(e){if(!e.dim){var t=e.svgEl.getBBox();e.dim={left:Math.round(t.x),top:Math.round(t.y),right:Math.round(t.x+t.width),bottom:Math.round(t.y+t.height)}}return e.dim},g.prototype.addSelectListener=function(e){this.listeners[this.listeners.length]=e},_m=g}function Dv(){if(km)return xm;km=1;var e=$g();Dg();var t=Iv(),n=Og(),r=Tg(),i={};function a(){var e=window.innerWidth;for(var t in i)if(i.hasOwnProperty(t)){var n=i[t];e-=2*n.offsetLeft,n.style.width=e+"px"}}try{window.addEventListener("resize",a),window.addEventListener("orientationChange",a)}catch(o){}function s(e,n,r,a,s){r.viewportHorizontal?(e.innerHTML='<div class="abcjs-inner"></div>',r.scrollHorizontal?(e.style.overflowX="auto",e.style.overflowY="hidden"):e.style.overflow="hidden",i[e.id]=e,e=e.children[0]):r.viewportVertical?(e.innerHTML='<div class="abcjs-inner scroll-amount"></div>',e.style.overflowX="hidden",e.style.overflowY="auto",e=e.children[0]):e.innerHTML="";var o=new t(e,r);(o.engraveABC(n,a,s),n.engraver=o,r.viewportVertical||r.viewportHorizontal)&&(e.parentNode.style.width=e.style.width)}return xm=function(i,a,o,c,l){var u,h={};if(o){for(u in o)o.hasOwnProperty(u)&&(h[u]=o[u]);h.warnings_id&&h.tablature&&(h.tablature.warning_id=h.warnings_id)}if(c)for(u in c)c.hasOwnProperty(u)&&("listener"===u?c[u].highlight&&(h.clickListener=c[u].highlight):h[u]=c[u]);if(l)for(u in l)l.hasOwnProperty(u)&&(h[u]=l[u]);return e.renderEngine((function(e,i,a,o){var c=!1;return"*"===e&&(c=!0,(e=document.createElement("div")).setAttribute("style","visibility: hidden;"),document.body.appendChild(e)),!c&&h.wrap&&h.staffwidth?(i=function(e,i,a,o,c){var l=new t(e,c),u=l.getMeasureWidths(i),h=r.calcLineWraps(i,u,c);if(h.reParse){var d=new n;d.parse(o,h.revisedParams),i=d.getTune();var f=d.getWarnings();f&&(i.warnings=f)}c.afterParsing&&c.afterParsing(i,a,o);return s(e,i,h.revisedParams,a,0),i.explanation=h.explanation,i}(e,i,a,o,h),i):(h.afterParsing&&h.afterParsing(i,a,o),s(e,i,h,a,0),c&&e.parentNode.removeChild(e),null)}),i,a,h)}}function Bv(){if(Mm)return Em;Mm=1;return Em={}}function Ov(){if(Pm)return Am;Pm=1;return Am=["acoustic_grand_piano","bright_acoustic_piano","electric_grand_piano","honkytonk_piano","electric_piano_1","electric_piano_2","harpsichord","clavinet","celesta","glockenspiel","music_box","vibraphone","marimba","xylophone","tubular_bells","dulcimer","drawbar_organ","percussive_organ","rock_organ","church_organ","reed_organ","accordion","harmonica","tango_accordion","acoustic_guitar_nylon","acoustic_guitar_steel","electric_guitar_jazz","electric_guitar_clean","electric_guitar_muted","overdriven_guitar","distortion_guitar","guitar_harmonics","acoustic_bass","electric_bass_finger","electric_bass_pick","fretless_bass","slap_bass_1","slap_bass_2","synth_bass_1","synth_bass_2","violin","viola","cello","contrabass","tremolo_strings","pizzicato_strings","orchestral_harp","timpani","string_ensemble_1","string_ensemble_2","synth_strings_1","synth_strings_2","choir_aahs","voice_oohs","synth_choir","orchestra_hit","trumpet","trombone","tuba","muted_trumpet","french_horn","brass_section","synth_brass_1","synth_brass_2","soprano_sax","alto_sax","tenor_sax","baritone_sax","oboe","english_horn","bassoon","clarinet","piccolo","flute","recorder","pan_flute","blown_bottle","shakuhachi","whistle","ocarina","lead_1_square","lead_2_sawtooth","lead_3_calliope","lead_4_chiff","lead_5_charang","lead_6_voice","lead_7_fifths","lead_8_bass_lead","pad_1_new_age","pad_2_warm","pad_3_polysynth","pad_4_choir","pad_5_bowed","pad_6_metallic","pad_7_halo","pad_8_sweep","fx_1_rain","fx_2_soundtrack","fx_3_crystal","fx_4_atmosphere","fx_5_brightness","fx_6_goblins","fx_7_echoes","fx_8_scifi","sitar","banjo","shamisen","koto","kalimba","bagpipe","fiddle","shanai","tinkle_bell","agogo","steel_drums","woodblock","taiko_drum","melodic_tom","synth_drum","reverse_cymbal","guitar_fret_noise","breath_noise","seashore","bird_tweet","telephone_ring","helicopter","applause","gunshot","percussion"]}function Lv(){if(Om)return Bm;return Om=1,Bm=function(e){if(e)window.abcjsAudioContext=e;else if(!window.abcjsAudioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return!1;window.abcjsAudioContext=new t}return"suspended"!==window.abcjsAudioContext.state}}function Vv(){if(Vm)return Lm;Vm=1;var e=Lv();return Lm=function(){return window.abcjsAudioContext||e(),window.abcjsAudioContext}}function Rv(){if(Fm)return Rm;Fm=1;var e=Vv();return Rm=function(){if(!window.Promise)return!1;if(!(window.AudioContext||window.webkitAudioContext||navigator.mozAudioContext||navigator.msAudioContext))return!1;var t=e();return t?void 0!==t.resume:void 0}}function Fv(){if(jm)return zm;jm=1;return zm={21:"A0",22:"Bb0",23:"B0",24:"C1",25:"Db1",26:"D1",27:"Eb1",28:"E1",29:"F1",30:"Gb1",31:"G1",32:"Ab1",33:"A1",34:"Bb1",35:"B1",36:"C2",37:"Db2",38:"D2",39:"Eb2",40:"E2",41:"F2",42:"Gb2",43:"G2",44:"Ab2",45:"A2",46:"Bb2",47:"B2",48:"C3",49:"Db3",50:"D3",51:"Eb3",52:"E3",53:"F3",54:"Gb3",55:"G3",56:"Ab3",57:"A3",58:"Bb3",59:"B3",60:"C4",61:"Db4",62:"D4",63:"Eb4",64:"E4",65:"F4",66:"Gb4",67:"G4",68:"Ab4",69:"A4",70:"Bb4",71:"B4",72:"C5",73:"Db5",74:"D5",75:"Eb5",76:"E5",77:"F5",78:"Gb5",79:"G5",80:"Ab5",81:"A5",82:"Bb5",83:"B5",84:"C6",85:"Db6",86:"D6",87:"Eb6",88:"E6",89:"F6",90:"Gb6",91:"G6",92:"Ab6",93:"A6",94:"Bb6",95:"B6",96:"C7",97:"Db7",98:"D7",99:"Eb7",100:"E7",101:"F7",102:"Gb7",103:"G7",104:"Ab7",105:"A7",106:"Bb7",107:"B7",108:"C8",109:"Db8",110:"D8",111:"Eb8",112:"E8",113:"F8",114:"Gb8",115:"G8",116:"Ab8",117:"A8",118:"Bb8",119:"B8",120:"C9",121:"Db9"}}function zv(){if(Hm)return qm;Hm=1;return qm=function(e){return window.URL.createObjectURL(function(e){var t,n,r=e[0],i=r.numberOfChannels,a=r.length*i*2+44,s=new ArrayBuffer(a),o=new DataView(s),c=[],l=0,u=0;for(d(1179011410),d(a-8),d(1163280727),d(544501094),d(16),h(1),h(i),d(r.sampleRate),d(2*r.sampleRate*i),h(2*i),h(16),d(1635017060),d(a-u-4),t=0;t<i;t++)c.push(r.getChannelData(t));for(;u<a;){for(t=0;t<c.length;t++)n=0|(.5+(n=Math.max(-1,Math.min(1,c[t][l])))<0?32768*n:32767*n),o.setInt16(u,n,!0),u+=2;l++}return new Blob([s],{type:"audio/wav"});function h(e){o.setUint16(u,e,!0),u+=2}function d(e){o.setUint32(u,e,!0),u+=4}}(e.audioBuffers))}}function jv(){if(Gm)return Um;return Gm=1,Um=function(e){return Math.pow(2,e/1200)}}function qv(){if(Km)return $m;Km=1;var e=function(){if(Nm)return Tm;Nm=1;var e=Bv();return Tm=function(t,n,r,i){e[n]||(e[n]={});var a=e[n];return a[r]||(a[r]=new Promise((function(e,a){var s=new XMLHttpRequest;let o=t+n+"-mp3/"+r+".mp3";s.open("GET",o,!0),s.responseType="arraybuffer",s.onload=function(){if(200===s.status){var t=i.decodeAudioData(s.response,(function(t){e({instrument:n,name:r,status:"loaded",audioBuffer:t})}),(function(){a(Error("Can't decode sound at "+o))}));t&&"function"==typeof t.catch&&t.catch(a)}else a(Error("Can't load sound at "+o+" status="+s.status))},s.onerror=function(){a(Error("Can't load sound at "+o))},s.send()})).catch((e=>{throw console.error("Didn't load note",n,r,":",e.message),e}))),a[r]}}(),t=function(){if(Dm)return Im;Dm=1;var e=Ov();return Im=function(t){for(var n=[],r=0;r<t.tracks.length;r++)n.push([]);var i=e[0];return t.tracks.forEach((function(t,r){t.forEach((function(t){switch(t.cmd){case"note":var a=void 0!==t.instrument?e[t.instrument]:i;if(t.duration>0){var s=t.gap?t.gap:0,o=t.duration;s=Math.min(s,2*o/3);var c={pitch:t.pitch,instrument:a,start:Math.round(1e6*t.start)/1e6,end:Math.round(1e6*(t.start+o-s))/1e6,volume:t.volume};t.startChar&&(c.startChar=t.startChar),t.endChar&&(c.endChar=t.endChar),t.style&&(c.style=t.style),t.cents&&(c.cents=t.cents),n[r].push(c)}break;case"program":i=e[t.instrument];break;case"text":break;default:console.log("Unhandled midi event",t)}}))})),n}}(),n=Lv(),r=Vv(),i=Rv(),a=Fv(),s=Ov(),o=zv(),c=function(){if(Ym)return Wm;Ym=1;var e=Bv(),t=Fv(),n=jv(),r=function(e,t,n){for(var r=0;r<2;r++)for(var i=t.getChannelData(r),a=e.getChannelData(r),s=0;s<i.length;s++)a[s+n]+=i[s]};return Wm=function(i,a,s,o,c,l,u,h,d){var f=window.OfflineAudioContext||window.webkitOfflineAudioContext,p=s.len*s.tempoMultiplier;l&&(p+=l/1e3),(p-=h)<0&&(p=.005);var m=new f(2,Math.floor((p+u)*a),a),g=t[s.pitch];if(!e[s.instrument])return d&&d("placeNote skipped (instrument empty): "+s.instrument+":"+g),Promise.resolve();var v=e[s.instrument][g];return v?v.then((function(e){var t=m.createBufferSource();t.buffer=e.audioBuffer;var h,f=s.volume/96*c;return t.gainNode=m.createGain(),s.pan&&m.createStereoPanner&&(t.panNode=m.createStereoPanner(),t.panNode.pan.setValueAtTime(s.pan,0)),t.gainNode.gain.value=f,t.gainNode.gain.linearRampToValueAtTime(t.gainNode.gain.value,p),t.gainNode.gain.linearRampToValueAtTime(0,p+u),s.cents&&(t.playbackRate.value=n(s.cents)),t.panNode?(t.panNode.connect(m.destination),t.gainNode.connect(t.panNode)):t.gainNode.connect(m.destination),t.connect(t.gainNode),t.start(0),t.noteOff?t.noteOff(p+u):t.stop(p+u),m.oncomplete=function(e){if(e.renderedBuffer&&e.renderedBuffer.getChannelData)for(var t=0;t<o.length;t++){var n=o[t]*s.tempoMultiplier;l&&(n-=l/1e3),n<0&&(n=0),n=Math.floor(n*a),r(i,e.renderedBuffer,n)}d&&d("placeNote: "+s.instrument+":"+g),h()},m.startRendering(),new Promise((function(e){h=e}))})).catch((function(e){return d&&d("placeNote catch: "+e.message),Promise.resolve()})):(d&&d("placeNote skipped: "+s.instrument+":"+g),Promise.resolve())}}(),l=Bv(),u="MIDI is not supported in this browser.",h="https://paulrosen.github.io/midi-js-soundfonts/abcjs/",d="https://paulrosen.github.io/midi-js-soundfonts/FluidR3_GM/";return $m=function(){var f=this;f.audioBufferPossible=void 0,f.directSource=[],f.startTimeSec=void 0,f.pausedTimeSec=void 0,f.audioBuffers=[],f.duration=void 0,f.isRunning=!1,f.options=void 0,f.pickupLength=0,f.init=function(e){e||(e={}),e.options&&(f.options=e.options),n(e.audioContext);var t=r().currentTime;if(f.debugCallback=e.debugCallback,f.debugCallback&&f.debugCallback("init called"),f.audioBufferPossible=f._deviceCapable(),!f.audioBufferPossible)return Promise.reject({status:"NotSupported",message:u});var i=e.options?e.options:{};f.soundFontUrl=i.soundFontUrl?i.soundFontUrl:d,"/"!==f.soundFontUrl[f.soundFontUrl.length-1]&&(f.soundFontUrl+="/"),i.soundFontVolumeMultiplier||0===i.soundFontVolumeMultiplier?f.soundFontVolumeMultiplier=i.soundFontVolumeMultiplier:f.soundFontUrl===d||"https://paulrosen.github.io/midi-js-soundfonts/MusyngKite/"===f.soundFontUrl?f.soundFontVolumeMultiplier=3:f.soundFontUrl===h?f.soundFontVolumeMultiplier=.4:f.soundFontVolumeMultiplier=1,i.programOffsets?f.programOffsets=i.programOffsets:f.soundFontUrl===h?f.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}:f.programOffsets={};var o=void 0!==i.fadeLength?parseInt(i.fadeLength,10):NaN;if(f.fadeLength=isNaN(o)?200:o,o=void 0!==i.noteEnd?parseInt(i.noteEnd,10):NaN,f.noteEnd=isNaN(o)?0:o,f.pan=i.pan,f.meterSize=1,e.visualObj){f.flattened=e.visualObj.setUpAudio(i),e.visualObj.getMeterFraction().den&&(f.meterSize=e.visualObj.getMeterFraction().num/e.visualObj.getMeterFraction().den),f.pickupLength=e.visualObj.getPickupLength()}else{if(!e.sequence)return Promise.reject(new Error("Must pass in either a visualObj or a sequence"));f.flattened=e.sequence}f.millisecondsPerMeasure=e.millisecondsPerMeasure?e.millisecondsPerMeasure:e.visualObj?e.visualObj.millisecondsPerMeasure(f.flattened.tempo):1e3,f.beatsPerMeasure=e.visualObj?e.visualObj.getBeatsPerMeasure():4,f.sequenceCallback=i.sequenceCallback,f.callbackContext=i.callbackContext,f.onEnded=i.onEnded,f.meterFraction=e.visualObj?e.visualObj.getMeterFraction():{den:1};var c={},p=[],m=[],g=s[0];f.flattened.tracks.forEach((function(e){e.forEach((function(e){if("program"===e.cmd&&s[e.instrument]&&(g=s[e.instrument]),void 0!==e.pitch){var t=e.pitch,n=a[t],r=void 0!==e.instrument?s[e.instrument]:g;if(n)if(c[r]||(c[r]={}),l[r]&&l[r][n]){var i=r+":"+n;p.indexOf(i)<0&&p.push(i)}else c[r][n]=!0;else{var o=r+":"+n;console.log("Can't find note: ",t,o),m.indexOf(o)<0&&m.push(o)}}}))})),f.debugCallback&&f.debugCallback("note gathering time = "+Math.floor(1e3*(r().currentTime-t))+"ms"),t=r().currentTime;var v=[];Object.keys(c).forEach((function(e){Object.keys(c[e]).forEach((function(t){v.push({instrument:e,note:t})}))})),f.debugCallback&&f.debugCallback("notes "+JSON.stringify(v));for(var y=[],b=0;b<v.length;b+=256)y.push(v.slice(b,b+256));return new Promise((function(e,n){var i={cached:p,error:m,loaded:[]},a=0,s=function(){f.debugCallback&&f.debugCallback("loadBatch idx="+a+" len="+y.length),a<y.length?f._loadBatch(y[a],f.soundFontUrl,t).then((function(e){f.debugCallback&&f.debugCallback("loadBatch then"),t=r().currentTime,e&&(e.error&&(i.error=i.error.concat(e.error)),e.loaded&&(i.loaded=i.loaded.concat(e.loaded))),a++,s()}),n):(f.debugCallback&&f.debugCallback("resolve init"),e(i))};s()}))},f._loadBatch=function(t,n,i,a){var s=[];return t.forEach((function(t){f.debugCallback&&f.debugCallback("getNote "+t.instrument+":"+t.note),s.push(e(n,t.instrument,t.note,r()))})),Promise.all(s).then((function(e){f.debugCallback&&f.debugCallback("mp3 load time = "+Math.floor(1e3*(r().currentTime-i))+"ms");for(var s=[],o=[],c=[],l=[],u=0;u<e.length;u++){var h=e[u],d=h.instrument+":"+h.name;"loaded"===h.status?s.push(d):"pending"===h.status?c.push(d):"cached"===h.status?o.push(d):l.push(d+" "+h.message)}if(c.length>0){if(f.debugCallback&&f.debugCallback("pending "+JSON.stringify(c)),a?a*=2:a=50,a<9e4)return new Promise((function(e,t){setTimeout((function(){var r=[];for(u=0;u<c.length;u++)d=c[u].split(":"),r.push({instrument:d[0],note:d[1]});f.debugCallback&&f.debugCallback("retry "+JSON.stringify(r)),f._loadBatch(r,n,i,a).then((function(t){e(t)})).catch((function(e){t(e)}))}),a)}));for(var p=[],m=0;m<t.length;m++)p.push(t[m].instrument+"/"+t[m].note);return f.debugCallback&&f.debugCallback("loadBatch timeout"),Promise.reject(new Error("timeout attempting to load: "+p.join(", ")))}return f.debugCallback&&f.debugCallback("loadBatch resolve"),Promise.resolve({loaded:s,cached:o,error:l})})).catch((function(e){f.debugCallback&&f.debugCallback("loadBatch catch "+e.message)}))},f.prime=function(){var e=f.fadeLength/1e3;return f.isRunning=!1,f.audioBufferPossible?(f.debugCallback&&f.debugCallback("prime called"),new Promise((function(n){var i=r().currentTime,a=f.millisecondsPerMeasure/1e3/f.meterSize;if(f.duration=f.flattened.totalDuration*a,f.duration<=0)return f.audioBuffers=[],n({status:"empty",seconds:0});f.duration+=e;var s=Math.floor(r().sampleRate*f.duration);f.stop();var o=t(f.flattened);f.options.swing&&function(e,t,n,r){if(4!=n.den&&8!=n.den)return;if(t=parseFloat(t),isNaN(t)||t<=50)return;t>75&&(t=75);t=t/50-1;var i=0,a=.25;8===n.den&&(a/=2);for(var s=a/2,o=s*t,c=0;c<e.length;c++)for(var l=e[c],u=0;u<l.length;u++){var h=l[u];if((h.start-r)%s==0&&(h.start-r)%a!=0&&(0==u||l[u-1].start<=l[u].start-s)&&(u==l.length-1||l[u+1].start>=l[u].start+s)){var d=h.start;h.start+=o,h.volume*=1+i,u>0&&l[u-1].end==d&&(l[u-1].end=h.start,l[u-1].volume*=1-i)}}}(o,f.options.swing,f.meterFraction,f.pickupLength),f.sequenceCallback&&f.sequenceCallback(o,f.callbackContext);var l=function(e,t){if(null==t)return null;var n=[];if(t.length){for(var r=0;r<e;r++)if(r<t.length){var i=parseFloat(t[r]);i<-1?i=-1:i>1&&(i=1),n.push(i)}else n.push(0);return n}var a=parseFloat(t);if(a*(e-1)>2)return null;for(var s=e%2==0,o=s?0-a/2:0,c=o+a,l=0;l<e;l++)(s=l%2==0)?(n.push(o),o-=a):(n.push(c),c+=a);return n}(o.length,f.pan),u={};o.forEach((function(e,t){var n=l&&l.length>t?l[t]:0;e.forEach((function(e){var t=e.instrument+":"+e.pitch+":"+e.volume+":"+Math.round(1e3*(e.end-e.start))/1e3+":"+n+":"+a+":"+(e.cents?e.cents:0);f.debugCallback&&f.debugCallback("noteMapTrack "+t),u[t]||(u[t]=[]),u[t].push(e.start)}))}));for(var h=[],d=r().createBuffer(2,s,r().sampleRate),p=0;p<Object.keys(u).length;p++){var m=Object.keys(u)[p],g=m.split(":"),v=void 0!==g[6]?parseFloat(g[6]):0;g={instrument:g[0],pitch:parseInt(g[1],10),volume:parseInt(g[2],10),len:parseFloat(g[3]),pan:parseFloat(g[4]),tempoMultiplier:parseFloat(g[5]),cents:v},h.push(c(d,r().sampleRate,g,u[m],f.soundFontVolumeMultiplier,f.programOffsets[g.instrument],e,f.noteEnd/1e3,f.debugCallback))}function y(e){var t=e&&e.audioBuffers&&e.audioBuffers.length>0?e.audioBuffers[0].duration:0;return{status:r().state,duration:t}}f.audioBuffers=[d],f.debugCallback&&(f.debugCallback("sampleRate = "+r().sampleRate),f.debugCallback("totalSamples = "+s),f.debugCallback("creationTime = "+Math.floor(1e3*(r().currentTime-i))+"ms")),Promise.all(h).then((function(){"suspended"===r().state?r().resume().then((function(){n(y(f))})):"interrupted"===r().state?r().suspend().then((function(){r().resume().then((function(){n(y(f))}))})):n(y(f))}))}))):Promise.reject(new Error(u))},f.start=function(){if(!f.audioBufferPossible)throw new Error(u);f.debugCallback&&f.debugCallback("start called");var e=f.pausedTimeSec?f.pausedTimeSec:0;f._kickOffSound(e),f.startTimeSec=r().currentTime-e,f.pausedTimeSec=void 0,f.debugCallback&&f.debugCallback("MIDI STARTED",f.startTimeSec)},f.pause=function(){if(!f.audioBufferPossible)throw new Error(u);return f.debugCallback&&f.debugCallback("pause called"),f.pausedTimeSec=f.stop(),f.pausedTimeSec},f.resume=function(){f.start()},f.seek=function(e,t){var n;switch(t){case"seconds":n=e;break;case"beats":n=e*f.millisecondsPerMeasure/f.beatsPerMeasure/1e3;break;default:n=(f.duration-f.fadeLength/1e3)*e}if(!f.audioBufferPossible)throw new Error(u);f.debugCallback&&f.debugCallback("seek called sec="+n),f.isRunning?(f.stop(),f._kickOffSound(n)):f.pausedTimeSec=n,f.pausedTimeSec=n},f.stop=function(){return f.isRunning=!1,f.pausedTimeSec=void 0,f.directSource.forEach((function(e){try{e.stop()}catch(t){console.log("direct source didn't stop:",t)}})),f.directSource=[],r().currentTime-f.startTimeSec},f.finished=function(){f.startTimeSec=void 0,f.pausedTimeSec=void 0,f.isRunning=!1},f.download=function(){return o(f)},f.getAudioBuffer=function(){return f.audioBuffers[0]},f.getIsRunning=function(){return f.isRunning},f._deviceCapable=function(){return!!i()||(console.warn(u),f.debugCallback&&f.debugCallback(u),!1)},f._kickOffSound=function(e){f.isRunning=!0,f.directSource=[],f.audioBuffers.forEach((function(e,t){f.directSource[t]=r().createBufferSource(),f.directSource[t].buffer=e,f.directSource[t].connect(r().destination)})),f.directSource.forEach((function(t){t.start(0,e)})),f.onEnded&&(f.directSource[0].onended=function(){f.onEnded(f.callbackContext)})}}}function Hv(){if(Xm)return Qm;Xm=1;return Qm=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,i,a){var s={cmd:"note",duration:r,gap:0,instrument:e.currentInstrument[t],pitch:n,start:e.starts[t],volume:i};a&&(s.cents=a),e.tracks[t].push(s),e.starts[t]+=r,e.totalDuration=Math.max(e.totalDuration,e.starts[t])}}}function Uv(){if(lg)return cg;lg=1;var e=Rv(),t=Lv(),n=Vv(),r=Jm?Zm:(Jm=1,Zm='\n<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 700" preserveAspectRatio="xMidYMid meet">\n\t<g transform="translate(0,700) scale(0.1,-0.1)" >\n\t<path d="M3111 6981 c-20 -37 -90 -55 -364 -96 -120 -18 -190 -33 -244 -55\n\t-42 -17 -124 -42 -182 -56 -78 -18 -119 -34 -157 -60 -28 -19 -86 -46 -128\n\t-60 -43 -13 -107 -42 -144 -64 -37 -23 -84 -46 -106 -52 -21 -7 -56 -29 -79\n\t-50 -22 -22 -61 -50 -86 -63 -26 -13 -67 -40 -91 -60 -24 -20 -65 -47 -90 -60\n\t-25 -13 -53 -31 -61 -41 -8 -9 -32 -30 -54 -46 -75 -54 -486 -460 -512 -507\n\t-15 -25 -48 -69 -75 -98 -26 -28 -48 -57 -48 -63 0 -6 -18 -29 -39 -53 -21\n\t-23 -56 -71 -77 -107 -20 -36 -50 -80 -65 -97 -16 -18 -33 -52 -40 -75 -12\n\t-47 -47 -115 -84 -166 -13 -18 -30 -56 -38 -83 -8 -27 -34 -80 -56 -118 -33\n\t-53 -46 -91 -62 -167 -12 -63 -34 -127 -59 -179 -42 -84 -60 -166 -60 -270 0\n\t-90 26 -122 125 -154 54 -17 96 -19 430 -20 305 -1 381 2 430 14 82 22 140 51\n\t153 78 6 12 22 47 37 77 14 30 38 77 54 103 15 27 34 73 40 103 7 30 28 78 48\n\t107 19 28 44 74 55 101 10 28 34 67 53 87 18 20 49 61 68 90 19 30 44 63 57\n\t74 13 11 36 40 52 65 59 94 232 270 306 313 20 11 57 37 82 58 25 20 70 52\n\t100 72 30 19 66 47 79 61 13 14 49 35 80 46 30 12 80 37 111 56 31 19 95 45\n\t143 58 48 12 110 37 139 55 63 40 127 55 323 76 83 9 208 28 279 41 156 29\n\t165 29 330 4 453 -71 514 -84 606 -130 31 -16 83 -36 116 -45 32 -9 84 -34\n\t115 -56 31 -21 82 -48 113 -60 32 -11 72 -33 89 -48 18 -16 59 -45 92 -65 33\n\t-21 74 -51 90 -66 17 -15 49 -40 73 -54 52 -32 65 -61 50 -113 -8 -31 -61 -90\n\t-277 -308 -300 -303 -361 -382 -369 -481 -2 -29 0 -66 6 -81 13 -40 88 -138\n\t115 -151 12 -6 54 -26 92 -44 l70 -33 945 -2 c520 -1 975 2 1012 7 64 8 191\n\t50 231 76 11 7 33 34 50 60 22 34 42 51 65 58 l32 9 0 1101 0 1102 -32 9 c-21\n\t7 -44 26 -64 55 -60 84 -77 97 -140 110 -44 9 -76 10 -127 2 -59 -9 -77 -17\n\t-134 -62 -37 -28 -172 -155 -301 -281 -129 -127 -249 -237 -267 -245 -25 -10\n\t-41 -11 -71 -2 -58 15 -112 45 -124 69 -6 11 -35 35 -64 54 -28 18 -58 41 -66\n\t50 -8 9 -41 35 -75 58 -33 22 -77 56 -99 75 -21 18 -64 46 -95 61 -31 14 -73\n\t39 -93 55 -20 15 -70 40 -110 55 -40 15 -97 44 -127 64 -29 21 -78 44 -107 53\n\t-30 8 -77 31 -105 51 -42 28 -73 39 -173 60 -68 14 -154 39 -196 58 -95 43\n\t-131 51 -343 76 -209 24 -242 32 -279 70 l-30 29 -328 0 c-312 0 -330 -1 -339\n\t-19z"></path>\n\t<path d="M254 2875 c-89 -16 -107 -26 -145 -78 -32 -44 -62 -66 -91 -67 -17 0\n\t-18 -61 -18 -1140 l0 -1140 24 0 c16 0 41 -17 72 -50 40 -42 61 -55 117 -72\n\tl69 -21 82 23 c44 12 96 30 114 39 18 9 148 132 290 272 141 141 267 261 279\n\t268 51 26 86 14 176 -61 32 -26 62 -48 66 -48 5 0 36 -25 70 -55 34 -30 74\n\t-61 89 -69 15 -8 37 -28 50 -45 12 -17 50 -45 84 -62 34 -17 78 -44 98 -60 19\n\t-16 61 -37 93 -48 32 -11 81 -37 107 -56 27 -20 76 -45 109 -56 33 -12 75 -31\n\t93 -44 62 -45 93 -58 191 -82 54 -12 130 -37 168 -54 68 -29 180 -58 226 -59\n\t62 0 183 -64 183 -96 0 -12 88 -14 639 -14 l639 0 12 30 c18 44 76 66 233 89\n\t89 14 160 30 200 47 34 15 106 42 159 60 54 18 112 44 130 57 47 35 85 52 146\n\t67 29 7 76 28 105 48 29 20 77 48 107 63 30 15 66 39 80 54 14 15 50 40 81 56\n\t31 15 78 46 104 69 26 22 61 46 79 54 17 7 43 26 56 42 14 16 41 41 60 56 64\n\t48 380 362 408 405 15 23 40 51 55 63 15 12 36 38 46 58 11 21 37 57 58 82 22\n\t25 49 62 62 83 13 20 38 56 57 78 19 23 50 74 69 113 19 39 46 86 59 104 14\n\t18 34 62 46 98 12 36 32 77 45 92 31 38 60 97 80 167 9 33 26 76 37 95 29 50\n\t47 103 68 206 10 52 32 117 51 155 29 56 33 74 34 140 0 94 -10 108 -101 138\n\t-61 20 -83 21 -463 21 -226 0 -421 -4 -451 -10 -63 -12 -86 -30 -110 -85 -10\n\t-22 -33 -63 -52 -92 -21 -31 -42 -80 -53 -123 -11 -44 -32 -93 -56 -128 -20\n\t-32 -47 -83 -59 -115 -12 -32 -37 -77 -56 -100 -19 -23 -50 -65 -69 -94 -19\n\t-29 -44 -57 -54 -63 -11 -5 -29 -27 -42 -47 -52 -85 -234 -277 -300 -315 -25\n\t-15 -53 -38 -62 -51 -9 -14 -42 -39 -74 -57 -32 -18 -75 -48 -95 -66 -21 -18\n\t-59 -44 -85 -58 -26 -13 -72 -40 -100 -59 -35 -24 -78 -41 -128 -52 -47 -11\n\t-99 -31 -139 -56 -69 -42 -94 -49 -391 -110 -245 -51 -425 -66 -595 -50 -168\n\t16 -230 27 -330 61 -47 16 -123 35 -170 44 -98 17 -123 25 -172 58 -20 14 -71\n\t37 -114 53 -44 15 -95 40 -115 56 -20 16 -70 42 -110 59 -40 16 -88 45 -108\n\t63 -20 19 -55 46 -78 61 -24 14 -49 35 -55 47 -7 11 -34 33 -60 49 -50 31 -65\n\t61 -53 102 4 13 130 147 281 298 236 238 277 283 299 335 15 32 35 71 46 86\n\t12 18 19 44 19 76 0 42 -8 63 -53 138 -92 151 11 139 -1207 141 -798 2 -1030\n\t0 -1086 -11z"></path>\n\t</g>\n</svg>\n'),i=tg?eg:(tg=1,eg='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-play-svg">\n <g>\n <polygon points="4 0 23 12.5 4 25"/>\n </g>\n</svg>\n'),a=rg?ng:(rg=1,ng='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-pause-svg">\n <g>\n <rect width="8.23" height="25"/>\n <rect width="8.23" height="25" x="17"/>\n </g>\n</svg>\n'),s=ag?ig:(ag=1,ig='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="abcjs-loading-svg">\n <circle cx="50" cy="50" fill="none" stroke-width="20" r="35" stroke-dasharray="160 55"></circle>\n</svg>\n'),o=og?sg:(og=1,sg='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">\n <g>\n <polygon points="5 12.5 24 0 24 25"/>\n <rect width="3" height="25" x="0" y="0"/>\n </g>\n</svg>\n');function c(r,i,a,s,o){var c=!0;if(n()?c="suspended"===n().state:t(),!e())throw{status:"NotSupported",message:"This browser does not support audio."};(c||o)&&a&&a.classList.add("abcjs-loading"),c?n().resume().then((function(){s?s().then((function(e){l(r,i,a,o)})):l(r,i,a,o)})):l(r,i,a,o)}function l(e,t,n,r){r?e(t).then((function(){n&&n.classList.remove("abcjs-loading")})):(e(t),n&&n.classList.remove("abcjs-loading"))}return cg=function(e,l){var u=this;if("string"==typeof e){var h=e;if(!(e=document.querySelector(h)))throw new Error('Cannot find element "'+h+'" in the DOM.')}else if(!(e instanceof HTMLElement))throw new Error("The first parameter must be a valid element or selector in the DOM.");if(u.parent=e,u.options={},l&&(u.options=Object.assign({},l)),u.options.ac&&t(u.options.ac),function(e,t){var n=!!t.loopHandler,c=!!t.restartHandler,l=!!t.playHandler||!!t.playPromiseHandler,u=!!t.progressHandler,h=!!t.warpHandler,d=!1!==t.hasClock,f='<div class="abcjs-inline-audio">\n';if(n){var p=t.repeatTitle?t.repeatTitle:"Click to toggle play once/repeat.";f+='<button type="button" class="abcjs-midi-loop abcjs-btn" title="'+p+'" aria-label="'+(t.repeatAria?t.repeatAria:p)+'">'+r+"</button>\n"}if(c){var m=t.restartTitle?t.restartTitle:"Click to go to beginning.";f+='<button type="button" class="abcjs-midi-reset abcjs-btn" title="'+m+'" aria-label="'+(t.restartAria?t.restartAria:m)+'">'+o+"</button>\n"}if(l){var g=t.playTitle?t.playTitle:"Click to play/pause.";f+='<button type="button" class="abcjs-midi-start abcjs-btn" title="'+g+'" aria-label="'+(t.playAria?t.playAria:g)+'">'+i+a+s+"</button>\n"}if(u){var v=t.randomTitle?t.randomTitle:"Click to change the playback position.";f+='<button type="button" class="abcjs-midi-progress-background" title="'+v+'" aria-label="'+(t.randomAria?t.randomAria:v)+'"><span class="abcjs-midi-progress-indicator"></span></button>\n'}d&&(f+='<span class="abcjs-midi-clock"></span>\n');if(h){var y=t.warpTitle?t.warpTitle:"Change the playback speed.";f+='<span class="abcjs-tempo-wrapper"><label><input class="abcjs-midi-tempo" type="number" min="1" max="300" value="100" title="'+y+'" aria-label="'+(t.warpAria?t.warpAria:y)+'">%</label><span> (<span class="abcjs-midi-current-tempo"></span> '+(t.bpm?t.bpm:"BPM")+")</span></span>\n"}f+='<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>',f+="</div>\n",e.innerHTML=f}(u.parent,u.options),function(e){var t=!!e.options.loopHandler,n=!!e.options.restartHandler,r=!!e.options.playHandler||!!e.options.playPromiseHandler,i=!!e.options.progressHandler,a=!!e.options.warpHandler,s=e.parent.querySelector(".abcjs-midi-start");t&&e.parent.querySelector(".abcjs-midi-loop").addEventListener("click",(function(t){c(e.options.loopHandler,t,s,e.options.afterResume)}));n&&e.parent.querySelector(".abcjs-midi-reset").addEventListener("click",(function(t){c(e.options.restartHandler,t,s,e.options.afterResume)}));r&&s.addEventListener("click",(function(t){c(e.options.playPromiseHandler||e.options.playHandler,t,s,e.options.afterResume,!!e.options.playPromiseHandler)}));i&&e.parent.querySelector(".abcjs-midi-progress-background").addEventListener("click",(function(t){c(e.options.progressHandler,t,s,e.options.afterResume)}));a&&e.parent.querySelector(".abcjs-midi-tempo").addEventListener("change",(function(t){c(e.options.warpHandler,t,s,e.options.afterResume)}))}(u),u.disable=function(e){var t=u.parent.querySelector(".abcjs-inline-audio");e?t.classList.add("abcjs-disabled"):t.classList.remove("abcjs-disabled")},u.setWarp=function(e,t){u.parent.querySelector(".abcjs-midi-tempo").value=Math.round(t),u.setTempo(e)},u.setTempo=function(e){var t=u.parent.querySelector(".abcjs-midi-current-tempo");t&&(t.innerHTML=Math.round(e))},u.resetAll=function(){for(var e=u.parent.querySelectorAll(".abcjs-pushed"),t=0;t<e.length;t++){e[t].classList.remove("abcjs-pushed")}},u.pushPlay=function(e){var t=u.parent.querySelector(".abcjs-midi-start");t&&(e?t.classList.add("abcjs-pushed"):t.classList.remove("abcjs-pushed"))},u.pushLoop=function(e){var t=u.parent.querySelector(".abcjs-midi-loop");t&&(e?t.classList.add("abcjs-pushed"):t.classList.remove("abcjs-pushed"))},u.setProgress=function(e,t){var n=u.parent.querySelector(".abcjs-midi-progress-background"),r=u.parent.querySelector(".abcjs-midi-progress-indicator");if(n&&r){var i=n.clientWidth*e;r.style.left=i+"px";var a=u.parent.querySelector(".abcjs-midi-clock");if(a){var s=t*e/1e3,o=Math.floor(s/60),c=Math.floor(s%60),l=c<10?"0"+c:c;a.innerHTML=o+":"+l}}},u.options.afterResume){var d=!1;u.options.ac?d="suspended"!==u.options.ac.state:n()&&(d="suspended"!==n().state),d&&u.options.afterResume()}}}function Gv(){if(fg)return dg;fg=1;var e=Uv(),t=qv(),n=gh(),r=Vv();return dg=function(){var i=this;i.warp=100,i.cursorControl=null,i.visualObj=null,i.timer=null,i.midiBuffer=null,i.options=null,i.currentTempo=null,i.control=null,i.isLooping=!1,i.isStarted=!1,i.isLoaded=!1,i.isLoading=!1,i.load=function(t,n,r){r||(r={}),void 0===r.displayPlay&&(r.displayPlay=!0),void 0===r.displayProgress&&(r.displayProgress=!0),i.control=new e(t,{loopHandler:r.displayLoop?i.toggleLoop:void 0,restartHandler:r.displayRestart?i.restart:void 0,playPromiseHandler:r.displayPlay?i.play:void 0,progressHandler:r.displayProgress?i.randomAccess:void 0,warpHandler:r.displayWarp?i.onWarp:void 0,afterResume:i.init}),i.cursorControl=n,i.disable(!0)},i.disable=function(e){i.control&&i.control.disable(e)},i.setTune=function(e,t,n){return i.visualObj=e,i.disable(!1),i.options=n||{},i.control&&(i.pause(),i.setProgress(0,1),i.control.resetAll(),i.restart(),i.isStarted=!1),i.isLooping=!1,t?i.go():Promise.resolve({status:"no-audio-context"})},i.go=function(){i.isLoading=!0;var e,a=100*i.visualObj.millisecondsPerMeasure()/i.warp;return i.currentTempo=Math.round(i.visualObj.getBeatsPerMeasure()/a*6e4),i.control&&i.control.setTempo(i.currentTempo),i.percent=0,i.midiBuffer||(i.midiBuffer=new t),r().resume().then((function(e){return i.midiBuffer.init({visualObj:i.visualObj,options:i.options,millisecondsPerMeasure:a})})).then((function(t){return e=t,i.midiBuffer.prime()})).then((function(){var t=16;return i.cursorControl&&void 0!==i.cursorControl.beatSubdivisions&&parseInt(i.cursorControl.beatSubdivisions,10)>=1&&parseInt(i.cursorControl.beatSubdivisions,10)<=64&&(t=parseInt(i.cursorControl.beatSubdivisions,10)),i.timer=new n(i.visualObj,{beatCallback:i.beatCallback,eventCallback:i.eventCallback,lineEndCallback:i.lineEndCallback,qpm:i.currentTempo,extraMeasuresAtBeginning:i.cursorControl?i.cursorControl.extraMeasuresAtBeginning:void 0,lineEndAnticipation:i.cursorControl?i.cursorControl.lineEndAnticipation:0,beatSubdivisions:t}),i.cursorControl&&i.cursorControl.onReady&&"function"==typeof i.cursorControl.onReady&&i.cursorControl.onReady(i),i.isLoaded=!0,i.isLoading=!1,Promise.resolve({status:"created",notesStatus:e})}))},i.destroy=function(){i.timer&&(i.timer.reset(),i.timer.stop(),i.timer=null),i.midiBuffer&&(i.midiBuffer.stop(),i.midiBuffer=null),i.setProgress(0,1),i.control&&i.control.resetAll()},i.play=function(){return i.runWhenReady(i._play,void 0)},i.runWhenReady=function(e,t){return i.visualObj?i.isLoading?(n=500,new Promise((function(e){setTimeout(e,n)}))).then((function(){return i.isLoading?i.runWhenReady(e,t):e(t)})):i.isLoaded?e(t):i.go().then((function(){return e(t)})):Promise.resolve({status:"loading"});var n},i._play=function(){return r().resume().then((function(){return i.isStarted=!i.isStarted,i.isStarted?(i.cursorControl&&i.cursorControl.onStart&&"function"==typeof i.cursorControl.onStart&&i.cursorControl.onStart(),i.midiBuffer.start(),i.timer.start(i.percent),i.control&&i.control.pushPlay(!0)):i.pause(),Promise.resolve({status:"ok"})}))},i.pause=function(){i.timer&&(i.timer.pause(),i.midiBuffer.pause(),i.control&&i.control.pushPlay(!1))},i.toggleLoop=function(){i.isLooping=!i.isLooping,i.control&&i.control.pushLoop(i.isLooping)},i.restart=function(){i.timer&&(i.timer.setProgress(0),i.midiBuffer.seek(0))},i.randomAccess=function(e){return i.runWhenReady(i._randomAccess,e)},i._randomAccess=function(e){var t=e.target.classList.contains("abcjs-midi-progress-indicator")?e.target.parentNode:e.target,n=(e.x-t.getBoundingClientRect().left)/t.offsetWidth;return n<0&&(n=0),n>1&&(n=1),i.seek(n),Promise.resolve({status:"ok"})},i.seek=function(e,t){i.timer&&i.midiBuffer&&(i.timer.setProgress(e,t),i.midiBuffer.seek(e,t))},i.setWarp=function(e){if(parseInt(e,10)>0){i.warp=parseInt(e,10);var t=i.isStarted,n=i.percent;return i.destroy(),i.isStarted=!1,i.go().then((function(){return i.setProgress(n,1e3*i.midiBuffer.duration),i.control&&i.control.setWarp(i.currentTempo,i.warp),t?i.play().then((function(){return i.seek(n),Promise.resolve()})):(i.seek(n),Promise.resolve())}))}return Promise.resolve()},i.onWarp=function(e){var t=e.target.value;return i.setWarp(t)},i.setProgress=function(e,t){i.percent=e,i.control&&i.control.setProgress(e,t)},i.finished=function(){if(i.timer.reset(),i.isLooping)return i.timer.start(0),i.midiBuffer.finished(),i.midiBuffer.start(),"continue";i.timer.stop(),i.isStarted&&(i.control&&i.control.pushPlay(!1),i.isStarted=!1,i.midiBuffer.finished(),i.cursorControl&&i.cursorControl.onFinished&&"function"==typeof i.cursorControl.onFinished&&i.cursorControl.onFinished(),i.setProgress(0,1))},i.beatCallback=function(e,t,n,r){var a=e/t;i.setProgress(a,n),i.cursorControl&&i.cursorControl.onBeat&&"function"==typeof i.cursorControl.onBeat&&i.cursorControl.onBeat(e,t,n,r)},i.eventCallback=function(e){if(!e)return i.finished();i.cursorControl&&i.cursorControl.onEvent&&"function"==typeof i.cursorControl.onEvent&&i.cursorControl.onEvent(e)},i.lineEndCallback=function(e,t){i.cursorControl&&i.cursorControl.onLineEnd&&"function"==typeof i.cursorControl.onLineEnd&&i.cursorControl.onLineEnd(e,t)},i.getUrl=function(){return i.midiBuffer.download()},i.download=function(e){var t=i.getUrl(),n=document.createElement("a");document.body.appendChild(n),n.setAttribute("style","display: none;"),n.href=t,n.download=e||"output.wav",n.click(),window.URL.revokeObjectURL(t),document.body.removeChild(n)}}}function Wv(){if(mg)return pg;mg=1;var e,t=jv();return function(){function n(e,t){for(var n in t)t.hasOwnProperty(n)&&e.setAttribute(n,t[n]);return e}function r(){this.trackstrings="",this.trackcount=0,this.noteOnAndChannel="%90",this.noteOffAndChannel="%80"}r.prototype.setTempo=function(e){0===this.trackcount&&(this.startTrack(),this.track+="%00%FF%51%03"+a(Math.round(6e7/e),6),this.endTrack())},r.prototype.setGlobalInfo=function(e,t,n,r){if(0===this.trackcount){this.startTrack();var s=Math.round(6e7/e);this.track+="%00%FF%51%03"+a(s,6),n&&(this.track+=function(e){if(!e||!e.accidentals)return"";for(var t="%00%FF%59%02",n=0,r=256,i=0;i<e.accidentals.length;i++)"sharp"===e.accidentals[i].acc?n++:"flat"===e.accidentals[i].acc&&r--;var s=a(256!==r?r:n,2),o="m"===e.mode?"%01":"%00";return t+s+o}(n)),r&&(this.track+=function(e){var t,n="%00%FF%58%04"+a(e.num,2),r={1:0,2:1,4:2,8:3,16:4,32:5}[e.den];if(!r)return"";switch(n+=a(r,2),e.num+"/"+e.den){case"2/4":case"3/4":case"4/4":case"5/4":t=24;break;case"6/4":t=72;break;case"2/2":case"3/2":case"4/2":t=48;break;case"3/8":case"6/8":case"9/8":case"12/8":t=36}return t?(n+=a(t,2))+"%08":""}(r)),t&&(this.track+=i(t,"%01")),this.endTrack()}},r.prototype.startTrack=function(){this.noteWarped={},this.track="",this.trackName="",this.trackInstrument="",this.silencelength=0,this.trackcount++,this.instrument&&this.setInstrument(this.instrument)},r.prototype.endTrack=function(){this.track=this.trackName+this.trackInstrument+this.track;var e=a(this.track.length/3+4,8);this.track="MTrk"+e+this.track+"%00%FF%2F%00",this.trackstrings+=this.track},r.prototype.setText=function(e,t){if("name"===e)this.trackName=i(t,"%03")},r.prototype.setInstrument=function(e){this.trackInstrument="%00%C0"+a(e,2),this.instrument=e},r.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(64*(t+1)),this.track+=n+"%0A"+a(t,2),this.track+=n+"%07%64",this.noteOnAndChannel="%9"+this.channel.toString(16),this.noteOffAndChannel="%8"+this.channel.toString(16)};function i(e,t){for(var n="",r=0;r<e.length;r++)n+=a(e.charCodeAt(r),2);return"%00%FF"+t+a(n.length/3,2)+n}function a(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)),function(e){for(var t="",n=0;n<e.length;n+=2)t+="%",t+=e.substr(n,2);return t}(n)}function s(e){var t=(e=Math.round(e))%128;return a(2*(e-t)+t,4)}function o(e){var t=0,n=[];for(e=Math.round(e);0!==e;)n.push(127&e),e>>=7;for(var r=n.length-1;r>=0;r--){t<<=8;var i=n[r];0!==r&&(i|=128),t|=i}var s=t.toString(16).length;return a(t,s+=s%2)}r.prototype.startNote=function(e,n,r){if(this.track+=o(this.silencelength),this.silencelength=0,r){this.track+="%e"+this.channel.toString(16);var i=Math.round(4096*t(r));this.track+=s(8192+i),this.track+=o(0),this.noteWarped[e]=!0}this.track+=this.noteOnAndChannel,this.track+="%"+e.toString(16)+a(n,2)},r.prototype.endNote=function(e){this.track+=o(this.silencelength),this.silencelength=0,this.noteWarped[e]&&(this.track+="%e"+this.channel.toString(16),this.track+=s(8192),this.track+=o(0),this.noteWarped[e]=!1),this.track+=this.noteOffAndChannel,this.track+="%"+e.toString(16)+"%00"},r.prototype.addRest=function(e){this.silencelength+=e,this.silencelength<0&&(this.silencelength=0)},r.prototype.getData=function(){return"data:audio/midi,MThd%00%00%00%06%00%01"+a(this.trackcount,4)+"%01%e0"+this.trackstrings},r.prototype.embed=function(e,t){var r=this.getData(),i=n(document.createElement("a"),{href:r});if(i.innerHTML="download midi",e.insertBefore(i,e.firstChild),!t){var a=n(document.createElement("embed"),{src:r,type:"video/quicktime",controller:"true",autoplay:"false",loop:"false",enablejavascript:"true",style:"display:block; height: 20px;"});e.insertBefore(a,e.firstChild)}},e=function(){return new r}}(),pg=e}function Yv(){if(bg)return yg;bg=1;var e=$g(),t=function(){if(vg)return gg;vg=1;var e,t=Wv();return function(){function n(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;i++)r[i]=parseFloat(r[i]);r.sort((function(e,t){return e-t}));for(var a=0,s=0;s<r.length;s++){var o=t[r[s]];if(r[s]>a){var c=(r[s]-a)*n;e.addRest(c),a=r[s]}for(var l=0;l<o.length;l++){var u=o[l];u.volume?e.startNote(u.pitch,u.volume,u.cents):e.endNote(u.pitch)}}}e=function(e,r){void 0===r&&(r={});var i=e.setUpAudio(r),a=t(),s=e.metaText?e.metaText.title:void 0;s&&s.length>128&&(s=s.substring(0,124)+"...");var o=e.getKeySignature(),c=e.getMeterFraction(),l=i.tempo,u=l/60;8==c.den&&(u=(l=6e4/(e.millisecondsPerMeasure()/c.num)/2)/60),a.setGlobalInfo(l,s,o,c);for(var h=0;h<i.tracks.length;h++){a.startTrack();for(var d={},f=0;f<i.tracks[h].length;f++){var p=i.tracks[h][f];switch(p.cmd){case"text":a.setText(p.type,p.text);break;case"program":var m=0;r.pan&&r.pan.length>h&&(m=r.pan[h]),128===p.instrument?(a.setChannel(9,m),a.setInstrument(0)):(a.setChannel(p.channel,m),a.setInstrument(p.instrument));break;case"note":var g=p.gap*u,v=p.start,y=v+p.duration-g;d[v]||(d[v]=[]),d[v].push({pitch:p.pitch,volume:p.volume,cents:p.cents}),d[y]||(d[y]=[]),d[y].push({pitch:p.pitch,volume:0});break;default:console.log("MIDI create Unknown: "+p.cmd)}}n(a,d,1920),a.endTrack()}return a.getData()}}(),gg=e}();var n=function(e,t,n,r){var i=["abcjs-download-midi","abcjs-midi-"+r];t.downloadClass&&i.push(t.downloadClass);var a='<div class="'+i.join(" ")+'">';t.preTextDownload&&(a+=t.preTextDownload);var s,o,c=e.metaText&&e.metaText.title?e.metaText.title:"Untitled";return s=t.downloadLabel&&((o=t.downloadLabel)&&"[object Function]"==={}.toString.call(o))?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,"_"),a+='<a download="'+(t.fileName?t.fileName:c+".midi")+'" href="'+n+'">'+s+"</a>",t.postTextDownload&&(a+=t.postTextDownload),a+"</div>"};return yg=function(r,i){var a={};if(i)for(var s in i)i.hasOwnProperty(s)&&(a[s]=i[s]);function o(e,r,i){var s=t(r,a);switch(a.midiOutputType){case"encoded":return s;case"binary":var o=s.replace("data:audio/midi,","");o=(o=o.replace(/MThd/g,"%4d%54%68%64")).replace(/MTrk/g,"%4d%54%72%6b");for(var c=new ArrayBuffer(o.length/3),l=new Uint8Array(c),u=0;u<o.length/3;u++){var h=3*u+1,d=parseInt(o.substring(h,h+2),16);l[u]=d}return l;default:return n(r,a,s,i)}}return a.generateInline=!1,"string"==typeof r?e.renderEngine(o,"*",r,a):o(0,r,0)},yg}function $v(){if(wg)return _g;wg=1;try{if("function"!=typeof window.CustomEvent){var e=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};e.prototype=window.Event.prototype,window.CustomEvent=e}}catch(n){}var t=function(e){this.textarea="string"==typeof e?document.getElementById(e):e,this.initialText=this.textarea.value,this.isDragging=!1};return t.prototype.addSelectionListener=function(e){this.textarea.onmousemove=function(t){this.isDragging&&e.fireSelectionChanged()}},t.prototype.addChangeListener=function(e){this.changelistener=e,this.textarea.onkeyup=function(){e.fireChanged()},this.textarea.onmousedown=function(){this.isDragging=!0,e.fireSelectionChanged()},this.textarea.onmouseup=function(){this.isDragging=!1,e.fireChanged()},this.textarea.onchange=function(){e.fireChanged()}},t.prototype.getSelection=function(){return{start:this.textarea.selectionStart,end:this.textarea.selectionEnd}},t.prototype.setSelection=function(e,t){if(this.textarea.setSelectionRange)this.textarea.setSelectionRange(e,t);else if(this.textarea.createTextRange){var n=this.textarea.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select()}this.textarea.focus()},t.prototype.getString=function(){return this.textarea.value},t.prototype.setString=function(e){this.textarea.value=e,this.initialText=this.getString(),this.changelistener&&this.changelistener.fireChanged()},t.prototype.getElem=function(){return this.textarea},_g=t}const Kv=d(function(){if(Sg)return Cg;Sg=1;var e=Yu?Wu:(Yu=1,Wu="6.4.4"),t=vh(),n=$g(),r=Ag(),i=Kg(),a={};a.signature="abcjs-basic v"+e,Object.keys(t).forEach((function(e){a[e]=t[e]})),Object.keys(n).forEach((function(e){a[e]=n[e]})),a.renderAbc=Dv(),a.tuneMetrics=function(){if(Sm)return Cm;Sm=1;var e=$g(),t=Iv();return Cm=function(n,r){return e.renderEngine((function(e,n,i,a){(e=document.createElement("div")).setAttribute("style","visibility: hidden;"),document.body.appendChild(e);var s=new t(e,r).getMeasureWidths(n);return e.parentNode.removeChild(e),{sections:s}}),"*",n,r)}}(),a.TimingCallbacks=gh();var s=Qg();a.setGlyph=s.setSymbol,a.strTranspose=i;var o=qv(),c=Ov(),l=Fv(),u=Hv(),h=Uv(),d=Lv(),f=Vv(),p=Rv(),m=function(){if(hg)return ug;hg=1;var e=Hv(),t=qv(),n=Vv();function r(e,n,r,i){var a=new t;return a.init({sequence:e,millisecondsPerMeasure:n,options:{soundFontUrl:r},debugCallback:i}).then((function(){return a.prime()})).then((function(){return a.start(),Promise.resolve()}))}return ug=function(t,i,a,s,o){for(var c=new e,l=0;l<t.length;l++){var u=t[l],h=c.addTrack();if(c.setInstrument(h,u.instrument),0===l&&i)for(var d=0;d<i.length;d++){var f=i[d];c.appendNote(h,f.pitch,1/64,f.volume,f.cents)}c.appendNote(h,u.pitch,u.duration,u.volume,u.cents)}var p=n();return"suspended"===p.state?p.resume().then((function(){return r(c,a,s,o)})):r(c,a,s,o)}}(),g=Gv(),v=Yv(),y=Wv();return a.synth={CreateSynth:o,instrumentIndexToName:c,pitchToNoteName:l,SynthController:g,SynthSequence:u,CreateSynthControl:h,registerAudioContext:d,activeAudioContext:f,supportsAudio:p,playEvent:m,getMidiFile:v,sequence:r,midiRenderer:y},a.Editor=function(){if(kg)return xg;kg=1;var e=yh(),t=Gv(),n=Rv(),r=Dv(),i=$v(),a=function(t,r){this.abcjsParams=function(e){var t,n={};if(e.abcjsParams)for(t in e.abcjsParams)e.abcjsParams.hasOwnProperty(t)&&(n[t]=e.abcjsParams[t]);if(e.midi_options)for(t in e.midi_options)e.midi_options.hasOwnProperty(t)&&(n[t]=e.midi_options[t]);if(e.parser_options)for(t in e.parser_options)e.parser_options.hasOwnProperty(t)&&(n[t]=e.parser_options[t]);if(e.render_options)for(t in e.render_options)e.render_options.hasOwnProperty(t)&&(n[t]=e.render_options[t]);return n.tablature&&e.warnings_id&&(n.tablature.warnings_id=e.warnings_id),n}(r),r.indicate_changed&&(this.indicate_changed=!0),this.editarea="string"==typeof t?new i(t):t,this.editarea.addSelectionListener(this),this.editarea.addChangeListener(this),r.canvas_id?this.div=r.canvas_id:r.paper_id?this.div=r.paper_id:(this.div=document.createElement("DIV"),this.editarea.getElem().parentNode.insertBefore(this.div,this.editarea.getElem())),"string"==typeof this.div&&(this.div=document.getElementById(this.div)),r.selectionChangeCallback&&(this.selectionChangeCallback=r.selectionChangeCallback),this.clientClickListener=this.abcjsParams.clickListener,this.abcjsParams.clickListener=this.highlight.bind(this),r.synth&&n()&&(this.synth={el:r.synth.el,cursorControl:r.synth.cursorControl,options:r.synth.options}),r.generate_midi&&(this.generate_midi=r.generate_midi,this.abcjsParams.generateDownload&&("string"==typeof r.midi_download_id?this.downloadMidi=document.getElementById(r.midi_download_id):r.midi_download_id&&(this.downloadMidi=r.midi_download_id)),!1!==this.abcjsParams.generateInline&&("string"==typeof r.midi_id?this.inlineMidi=document.getElementById(r.midi_id):r.midi_id&&(this.inlineMidi=r.midi_id))),r.warnings_id?"string"==typeof r.warnings_id?this.warningsdiv=document.getElementById(r.warnings_id):this.warningsdiv=r.warnings_id:r.generate_warnings&&(this.warningsdiv=document.createElement("div"),this.div.parentNode.insertBefore(this.warningsdiv,this.div)),this.onchangeCallback=r.onchange,this.currentAbc="",this.tunes=[],this.bReentry=!1,this.parseABC(),this.modelChanged(),this.addClassName=function(e,t){var n,r;return n=t,(r=e.className).length>0&&(r===n||new RegExp("(^|\\s)"+n+"(\\s|$)").test(r))||(e.className+=(e.className?" ":"")+t),e},this.removeClassName=function(t,n){return t.className=e.strip(t.className.replace(new RegExp("(^|\\s+)"+n+"(\\s+|$)")," ")),t},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))}};return a.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 n=this.synth.synthControl;this.synth.synthControl||(this.synth.synthControl=new t,this.synth.synthControl.load(this.synth.el,this.synth.cursorControl,this.synth.options)),this.synth.synthControl.setTune(this.tunes[0],n,this.synth.options)}},a.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=r(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}},a.prototype.paramChanged=function(e){if(e)for(var t in e)e.hasOwnProperty(t)&&(this.abcjsParams[t]=e[t]);this.currentAbc="",this.fireChanged()},a.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()}},a.prototype.parseABC=function(){var e=this.editarea.getString();return e===this.currentAbc?(this.updateSelection(),!1):(this.currentAbc=e,!0)},a.prototype.updateSelection=function(){var e=this.editarea.getSelection();try{this.tunes.length>0&&this.tunes[0].engraver&&this.tunes[0].engraver.rangeHighlight(e.start,e.end)}catch(t){}this.selectionChangeCallback&&this.selectionChangeCallback(e.start,e.end)},a.prototype.fireSelectionChanged=function(){this.updateSelection()},a.prototype.setDirtyStyle=function(t){if(void 0!==this.indicate_changed){var n,r,i,a,s="abc_textarea_dirty",o=this.editarea.getElem();t?(i=r=s,(a=(n=o).className).length>0&&(a===i||new RegExp("(^|\\s)"+i+"(\\s|$)").test(a))||(n.className+=(n.className?" ":"")+r)):function(t,n){t.className=e.strip(t.className.replace(new RegExp("(^|\\s+)"+n+"(\\s+|$)")," "))}(o,s)}},a.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)}},a.prototype.setNotDirty=function(){this.editarea.initialText=this.editarea.getString(),this.wasDirty=!1,this.setDirtyStyle(!1)},a.prototype.isDirty=function(){return void 0!==this.indicate_changed&&this.editarea.initialText!==this.editarea.getString()},a.prototype.highlight=function(e,t,n,r,i,a){this.editarea.setSelection(e.startChar,e.endChar),this.selectionChangeCallback&&this.selectionChangeCallback(e.startChar,e.endChar),this.clientClickListener&&this.clientClickListener(e,t,n,r,i,a)},a.prototype.pause=function(e){this.bIsPaused=e,e||this.fireChanged()},a.prototype.millisecondsPerMeasure=function(){return this.synth&&this.synth.synthControl&&this.synth.synthControl.visualObj?this.synth.synthControl.visualObj.millisecondsPerMeasure():0},a.prototype.pauseMidi=function(e){this.midiPause=e,e||this.redrawMidi()},xg=a}(),a.EditArea=$v(),Cg=a}()),Qv=t.defineComponent({name:"MusicScoreRenderer",props:{abcString:{type:String,required:!0}},mounted(){Kv.renderAbc("abc",this.abcString)}}),Xv={id:"abc"};const Zv=E(Qv,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",Xv)}]]);const Jv=t.defineComponent({name:"IdentifyKeyView",components:{RadioMultipleChoice:n.RadioMultipleChoice,MusicScoreRenderer:Zv},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"IdentifyKeyView"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new iy(e.data);const o=t.computed((()=>a.question.value)),c=t.computed((()=>{var e,t;const n=function(){const e=[];for(let t=0;t<5;t++)e.push(ny[Math.floor(Math.random()*ny.length)]);return e}();return n.includes((null==(e=o.value)?void 0:e.key)||"")||(n[Math.floor(Math.random()*n.length)]=(null==(t=o.value)?void 0:t.key)||""),n}));return{...i,...a,answer:s,question:o,choices:c,submit:()=>{}}}}),ey={"data-viewable":"IdentifyKeyView"};const ty=E(Jv,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("MusicScoreRenderer"),c=t.resolveComponent("RadioMultipleChoice");return t.openBlock(),t.createElementBlock("div",ey,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(o,{"key-signature":`X:1\nK:${e.question.key}\n||`,"abc-string":"''"},null,8,["key-signature"]),n[0]||(n[0]=t.createTextVNode(" This signature is for the major key: _____ ")),t.createVNode(c,{"choice-list":e.choices},null,8,["choice-list"])],64)):t.createCommentVNode("",!0)])}]]),ny=["C","G","D","A","E","B","F#","C#","F","Bb","Eb","Ab","Db","Gb","Cb"],ry=class _IdentifyKeyQuestion2 extends n.Question{constructor(e){super(e),u(this,"key"),this.key=_IdentifyKeyQuestion2.getKey(e[0].key)}static getKey(e){return ny[e]}isCorrect(e){return console.log(`answer: ${JSON.stringify(e)}, key: ${this.key}`),this.key===e.choiceList[e.selection]}dataShapes(){return _IdentifyKeyQuestion2.dataShapes}views(){return _IdentifyKeyQuestion2.views}};u(ry,"dataShapes",[{name:r.DataShapeName.SIGHTSING_IdentifyKey,fields:[{name:"key",type:r.FieldType.NUMBER,validator:{test:e=>{const t=parseInt(e);return t>=0&&t<=ny.length?{msg:"",status:r.Status.ok}:{msg:"Please enter a number between 0 and 11",status:r.Status.error}}}}]}]),u(ry,"views",[ty]);let iy=ry;const ay=new Course("sightSing",[iy]),sy=t.defineComponent({name:"LetterQuestionView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"LetterQuestionView"),a=n.useQuestionView(i),s=t.ref(null);a.question.value=new uy(e.data);const o=t.computed((()=>a.question.value)),c=e=>{var t;if(!o.value)return;const n=e.key.toLowerCase(),r=o.value.letter.toLowerCase();if(n===r){null==(t=s.value)||t.classList.add("pressed");const e=t=>{var i;t.key.toLowerCase()===r&&(null==(i=s.value)||i.classList.remove("pressed"),a.submitAnswer(n),window.removeEventListener("keyup",e))};window.addEventListener("keyup",e)}else a.submitAnswer(n)};return t.onMounted((()=>{window.addEventListener("keypress",c)})),t.onUnmounted((()=>{window.removeEventListener("keypress",c)})),{...a,...i,letterDisplay:s,question:o}}}),oy={"data-viewable":"LetterQuestionView"};const cy=E(sy,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",oy,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[n[0]||(n[0]=t.createElementVNode("p",{class:"text-h5"},"Type this letter!",-1)),t.createElementVNode("div",{ref:"letterDisplay",class:"letter-display"},t.toDisplayString(e.question.letter),513)],64)):t.createCommentVNode("",!0)])}],["__scopeId","data-v-4ae4db54"]]),ly=class _TypeLetterQuestion2 extends n.Question{constructor(e){super(e),u(this,"letter"),this.letter=e[0].letter}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}displayedSkill(e,t){return this.isCorrect(e)?t<3e3?1:1-(t-3e3)/7e3*.75:0}dataShapes(){return _TypeLetterQuestion2.dataShapes}views(){return _TypeLetterQuestion2.views}isCorrect(e){const t=e.toLowerCase()===this.letter.toLowerCase();return console.log(`singleLetter Q isCorrect: ${t}`),t}};u(ly,"dataShapes",[{name:r.DataShapeName.TYPING_singleLetter,fields:[{name:"letter",type:r.FieldType.STRING,validator:{instructions:"Enter a single letter",test:function(e){return e&&1===e.length&&/[a-zA-Z]/.test(e)?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Input must be a single letter"}}}}]}]),u(ly,"views",[cy]),u(ly,"acceptsUserData",!0),u(ly,"seedData",function(){const e=[];for(let t=0;t<26;t++)e.push({letter:String.fromCharCode(65+t)});return e}());let uy=ly;const hy=t.defineComponent({name:"FallingLettersView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"FallingLettersView"),a=n.useQuestionView(i),s=t.ref(null),o=t.ref([]),c=t.ref(!1),l=t.ref(""),u=t.ref(30),h=t.ref(0),d=t.ref([]),f=t.ref([]),p=t.ref({currentSpeed:2,letterId:0,gameLoop:null,lastSpawn:0,lastUpdate:0,spawnInterval:1e3}),m=e=>{if(c.value)return;const t=(e-p.value.lastUpdate)/1e3;if(p.value.lastUpdate=e,u.value-=t,a.question.value&&(p.value.currentSpeed+=a.question.value.acceleration*t),u.value<=0)return c.value=!0,l.value="You Win!",void a.submitAnswer({lettersTyped:h.value,win:!0,percentage:1});e-p.value.lastSpawn>=p.value.spawnInterval&&((()=>{if(!s.value)return;const e={id:p.value.letterId++,char:String.fromCharCode(65+Math.floor(26*Math.random())),x:Math.random()*(s.value.clientWidth-30),y:-30};o.value.push(e)})(),p.value.lastSpawn=e,p.value.spawnInterval=Math.max(500,p.value.spawnInterval-10)),s.value&&(o.value=o.value.filter((e=>{return e.y+=p.value.currentSpeed,!(e.y>s.value.clientHeight)||(c.value=!0,l.value="Game Over!",a.submitAnswer({lettersTyped:h.value,percentage:u.value/((null==(t=a.question.value)?void 0:t.gameLength)||30),win:!1}),!1);var t}))),p.value.gameLoop=requestAnimationFrame(m)},g=e=>{if(c.value)return;const t=e.key.toUpperCase(),n=o.value.findIndex((e=>e.char===t));-1!==n&&(f.value.push({id:Date.now(),x:o.value[n].x,y:o.value[n].y}),setTimeout((()=>{f.value=f.value.filter((e=>e.id!==f.value[f.value.length-1].id))}),300),o.value.splice(n,1),h.value++)};return t.onMounted((()=>{try{a.question.value=new xy(e.data),a.maxAttemptsPerView.value=1,window.addEventListener("keypress",g),d.value=Array.from({length:7},((e,t)=>({id:t,left:20+t*Math.random()*30-10,height:100+120*Math.random(),scale:1+2*Math.random()}))),a.question.value?(u.value=a.question.value.gameLength,h.value=0,o.value=[],c.value=!1,l.value="",p.value={currentSpeed:a.question.value.initialSpeed,letterId:0,gameLoop:null,lastSpawn:performance.now(),lastUpdate:performance.now(),spawnInterval:1e3*a.question.value.spawnInterval},p.value.gameLoop=requestAnimationFrame(m)):i.logger.error("Question not initialized")}catch(t){i.logger.error("Error initializing game:",t)}})),t.onUnmounted((()=>{window.removeEventListener("keypress",g),p.value.gameLoop&&cancelAnimationFrame(p.value.gameLoop)})),{...a,gameArea:s,letters:o,gameOver:c,gameOverMessage:l,timeLeft:u,score:h,treePositions:d,explosions:f}}}),dy={class:"game-container"},fy={class:"stats"},py={class:"time"},my={class:"score"},gy={ref:"gameArea",class:"game-area"},vy={class:"letter-text"},yy={class:"trees"},by={key:0,class:"game-over"};const _y=E(hy,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",dy,[t.createElementVNode("div",fy,[t.createElementVNode("div",py,"Time: "+t.toDisplayString(e.timeLeft.toFixed(1))+"s",1),t.createElementVNode("div",my,"Score: "+t.toDisplayString(e.score),1)]),t.createElementVNode("div",gy,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.letters,(e=>(t.openBlock(),t.createElementBlock("div",{key:e.id,class:"falling-letter",style:t.normalizeStyle({left:e.x+"px",top:e.y+"px"})},[n[0]||(n[0]=t.createElementVNode("div",{class:"meteor-effect"},null,-1)),t.createElementVNode("span",vy,t.toDisplayString(e.char),1)],4)))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.explosions,(e=>(t.openBlock(),t.createElementBlock("div",{key:e.id,class:"explosion",style:t.normalizeStyle({left:e.x+"px",top:e.y+"px"})},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(12,(e=>t.createElementVNode("div",{key:e,class:"particle"}))),64))],4)))),128)),n[2]||(n[2]=t.createElementVNode("div",{class:"grass-container"},[t.createElementVNode("div",{class:"grass"}),t.createElementVNode("div",{class:"grass-overlay"})],-1)),t.createElementVNode("div",yy,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.treePositions,(e=>(t.openBlock(),t.createElementBlock("div",{key:e.id,class:"tree",style:t.normalizeStyle({left:`${e.left}%`,height:`${e.height}px`,transform:`scale(${e.scale})`})},n[1]||(n[1]=[t.createElementVNode("div",{class:"tree-crown"},null,-1),t.createElementVNode("div",{class:"tree-trunk"},null,-1)]),4)))),128))])],512),e.gameOver?(t.openBlock(),t.createElementBlock("div",by,t.toDisplayString(e.gameOverMessage),1)):t.createCommentVNode("",!0)])}],["__scopeId","data-v-3c9f2af5"]]),wy=class _FallingLettersQuestion2 extends n.Question{constructor(e){super(e),u(this,"gameLength"),u(this,"initialSpeed"),u(this,"acceleration"),u(this,"spawnInterval"),this.gameLength=e[0].gameLength,this.initialSpeed=e[0].initialSpeed,this.acceleration=e[0].acceleration,this.spawnInterval=e[0].spawnInterval}evaluate(e){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e)}}displayedSkill(e){return e.win?1:e.percentage}dataShapes(){return _FallingLettersQuestion2.dataShapes}views(){return _FallingLettersQuestion2.views}isCorrect(e){return e.win}};u(wy,"dataShapes",[{name:r.DataShapeName.TYPING_fallingLetters,fields:[{name:"gameLength",type:r.FieldType.NUMBER},{name:"initialSpeed",type:r.FieldType.NUMBER},{name:"acceleration",type:r.FieldType.NUMBER},{name:"spawnInterval",type:r.FieldType.NUMBER,validator:{instructions:"How often should a new letter spawn? (in seconds)",test:e=>{if("string"==typeof e){return parseFloat(e)>0?{status:r.Status.ok,msg:""}:{status:r.Status.error,msg:"Must be greater than 0"}}return{status:r.Status.error,msg:"Unexpected non-string input."}},placeholder:"1"}}]}]),u(wy,"views",[_y]),u(wy,"acceptsUserData",!0),u(wy,"seedData",[{gameLength:30,initialSpeed:2,acceleration:.1,spawnInterval:1}]);let xy=wy;const ky=new Course("typing",[uy,xy]),Cy=t.defineComponent({name:"IdentifyVocab",components:{AudioAutoPlayer:n.AudioAutoPlayer,UserInputString:n.UserInputString},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:r}){const i=n.useViewable(e,r,"IdentifyVocab"),a=n.useQuestionView(i),s=t.ref("");a.question.value=new Ay(e.data);const o=t.computed((()=>a.question.value));return{...i,...a,answer:s,question:o,submit:()=>{o.value&&a.submitAnswer(s.value)}}}}),Sy={"data-viewable":"IdentifyVocab"},Ey={key:0,class:"text-h6"};const My=E(Cy,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("UserInputString"),c=t.resolveComponent("center"),l=t.resolveComponent("audio-auto-player");return t.openBlock(),t.createElementBlock("div",Sy,[e.question?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[n[1]||(n[1]=t.createElementVNode("span",{class:"text-h5"}," Spell the word: ",-1)),t.createVNode(o,{modelValue:e.answer,"onUpdate:modelValue":n[0]||(n[0]=t=>e.answer=t)},null,8,["modelValue"]),t.createVNode(c,null,{default:t.withCtx((()=>[e.priorAttempts?(t.openBlock(),t.createElementBlock("span",Ey,t.toDisplayString(e.question.word),1)):t.createCommentVNode("",!0)])),_:1}),t.createVNode(c,null,{default:t.withCtx((()=>[t.createVNode(l,{src:[e.getURL("WordAudio"),e.getURL("SentenceAudio"),e.getURL("WordAudio")]},null,8,["src"])])),_:1})],64)):t.createCommentVNode("",!0)])}]]),Ty=[{name:"Word",type:r.FieldType.STRING,validator:r.Validators.NonEmptyString},{name:"ExampleSentence",type:r.FieldType.STRING},{name:"WordAudio",type:r.FieldType.AUDIO},{name:"SentenceAudio",type:r.FieldType.AUDIO}],Ny=class _SpellingQuestion2 extends n.Question{constructor(e){super(e),u(this,"word"),u(this,"sentence"),u(this,"audio_word"),u(this,"audio_sentence"),this.word=e[0].Word,this.sentence=e[0].Sentence,this.audio_word=e[0].WordAudio,this.audio_sentence=e[0].SentenceAudio}isCorrect(e){return e===this.word}dataShapes(){return _SpellingQuestion2.dataShapes}views(){return _SpellingQuestion2.views}};u(Ny,"dataShapes",[{fields:Ty,name:r.DataShapeName.WORDWORK_Spelling}]),u(Ny,"views",[My]);let Ay=Ny;const Py=new Course("wordWork",[Ay]),Iy=t.defineComponent({name:"PianoRangeVisualizer",props:{lowestNote:{type:Number,required:!0},highestNote:{type:Number,required:!0},maxWidth:{type:Number,default:1e3}},setup(e){const n=t.ref(null),r=t.ref(800),i=t.computed((()=>{let e=0;for(let t=21;t<=108;t++)c(t)&&e++;return e})),a=t.computed((()=>Math.min(22,r.value/Math.max(25,i.value)))),s=t.computed((()=>.6*a.value)),o=t.computed((()=>Math.min(e.maxWidth,a.value*i.value+10))),c=e=>[0,2,4,5,7,9,11].includes(e%12);return t.onMounted((()=>{if(n.value){r.value=n.value.clientWidth;new ResizeObserver((e=>{for(const t of e)r.value=t.contentRect.width})).observe(n.value)}})),{pianoWrapper:n,keyHeight:100,blackKeyHeight:60,whiteKeyWidth:a,blackKeyWidth:s,svgWidth:o,isWhiteKey:c,getKeyPosition:e=>{let t=0;for(let n=21;n<e;n++)c(n)&&t++;return c(e)?t*a.value:t*a.value-s.value/2},getNoteLabel:e=>{const t=e%12,n=Math.floor(e/12)-1;return`${["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][t]}${n}`}}}}),Dy={class:"piano-range-container"},By={class:"piano-wrapper",ref:"pianoWrapper"},Oy=["width","height"],Ly={class:"background-keys",opacity:"0.15"},Vy=["x","width","height"],Ry=["x","width","height"],Fy={class:"selected-range"},zy=["x","width","height"],jy=["x","width","height"],qy={class:"range-markers"},Hy=["x","height"],Uy=["x","height"],Gy=["x","y"],Wy=["x","y"];const Yy=E(Iy,[["render",function(e,n,r,i,a,s){return t.openBlock(),t.createElementBlock("div",Dy,[t.createElementVNode("div",By,[(t.openBlock(),t.createElementBlock("svg",{width:e.svgWidth,height:e.keyHeight+20,class:"piano-svg"},[t.createElementVNode("g",Ly,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(88,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`bg-${n}`},[e.isWhiteKey(n+20)?(t.openBlock(),t.createElementBlock("rect",{key:0,x:e.getKeyPosition(n+20),y:"0",width:e.whiteKeyWidth,height:e.keyHeight,class:"white-key",stroke:"#999","stroke-width":"1"},null,8,Vy)):t.createCommentVNode("",!0)],64)))),64)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(88,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`bg-black-${n}`},[e.isWhiteKey(n+20)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("rect",{key:0,x:e.getKeyPosition(n+20),y:"0",width:e.blackKeyWidth,height:e.blackKeyHeight,class:"black-key"},null,8,Ry))],64)))),64))]),t.createElementVNode("g",Fy,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(128,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`white-${n}`},[e.isWhiteKey(n)&&n>=e.lowestNote&&n<=e.highestNote?(t.openBlock(),t.createElementBlock("rect",{key:0,x:e.getKeyPosition(n),y:"0",width:e.whiteKeyWidth,height:e.keyHeight,class:"white-key active",stroke:"#666","stroke-width":"1"},null,8,zy)):t.createCommentVNode("",!0)],64)))),64)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(128,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`black-${n}`},[!e.isWhiteKey(n)&&n>=e.lowestNote&&n<=e.highestNote?(t.openBlock(),t.createElementBlock("rect",{key:0,x:e.getKeyPosition(n),y:"0",width:e.blackKeyWidth,height:e.blackKeyHeight,class:"black-key active"},null,8,jy)):t.createCommentVNode("",!0)],64)))),64))]),t.createElementVNode("g",qy,[t.createElementVNode("rect",{x:e.getKeyPosition(e.lowestNote)-2,y:"0",width:4,height:e.keyHeight+5,class:"range-marker start"},null,8,Hy),t.createElementVNode("rect",{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-2,y:"0",width:4,height:e.keyHeight+5,class:"range-marker end"},null,8,Uy)]),t.createElementVNode("text",{x:e.getKeyPosition(e.lowestNote)+3,y:e.keyHeight+12,class:"note-label"},t.toDisplayString(e.getNoteLabel(e.lowestNote)),9,Gy),t.createElementVNode("text",{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-3,y:e.keyHeight+12,"text-anchor":"end",class:"note-label"},t.toDisplayString(e.getNoteLabel(e.highestNote)),9,Wy)],8,Oy))],512)])}],["__scopeId","data-v-4b232a8b"]]);t.defineComponent({name:"MidiConfig",components:{PianoRangeVisualizer:Yy},props:{_id:{type:String,required:!0},user:{type:Object,required:!0}},setup(e){const i=t.ref(),s=t.ref(!0),o=t.ref([]),c=t.ref([]),l=t.ref(""),u=t.ref(""),h=t.ref(!1),d=t.ref(""),f=t.ref(""),p=t.ref(!1),m=t.ref("full-88"),g=t.ref(21),v=t.ref(108),y=t.ref(""),b=t.ref(0),_=t.ref(0),w=t.ref([]),x=t.ref([{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"}]),k=()=>{p.value=l.value!==d.value||u.value!==f.value||m.value!==y.value||"custom"===m.value&&(g.value!==b.value||v.value!==_.value)},C=e=>{n.alertUser({text:`I hear a ${e.note.name}!`,status:r.Status.ok})};t.watch(l,(()=>{var e;null==(e=i.value)||e.selectInput(l.value),k()})),t.watch(u,(()=>{var e;null==(e=i.value)||e.selectOutput(u.value),k()}));return t.onMounted((async()=>{var t,n;(()=>{const e=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],t=[];for(let n=0;n<=127;n++){const r=Math.floor(n/12)-1,i=e[n%12];t.push({title:`${i}${r} (${n})`,value:n})}w.value=t})();try{i.value=await Ya.instance(),s.value="ready"===i.value.state||"nodevice"===i.value.state}catch(r){console.log(`Error on midi Init: ${r}`),s.value=!1}s.value&&(null==(t=i.value)||t.addNoteonListenter(C),i.value?(o.value=i.value.inputs.filter((e=>"connected"===e.state)).map((e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id}))),c.value=null==(n=i.value)?void 0:n.outputs.filter((e=>"connected"===e.state)).map((e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id})))):(o.value=[{title:"No inputs available",value:""}],c.value=[{title:"No outputs available",value:""}]),await(async()=>{const t=await(await e.user.getCourseInterface(e._id)).getCourseSettings();if(null==t?void 0:t.midiinput){const e=t.midiinput.toString();o.value.some((t=>t.value===e))&&(l.value=e,d.value=e)}if(null==t?void 0:t.midioutput){const e=t.midioutput.toString();c.value.some((t=>t.value===e))&&(u.value=e,f.value=e)}(null==t?void 0:t.keyboardRange)&&(y.value=t.keyboardRange.toString(),m.value=y.value),(null==t?void 0:t.lowestNote)&&(b.value=parseInt(t.lowestNote.toString()),g.value=b.value),(null==t?void 0:t.highestNote)&&(_.value=parseInt(t.highestNote.toString()),v.value=_.value),(null==t?void 0:t.lowestNote)&&(null==t?void 0:t.highestNote)&&!(null==t?void 0:t.keyboardRange)&&(m.value="custom"),p.value=!1})(),!l.value&&o.value.length>0&&(l.value=o.value[0].value),!u.value&&c.value.length>0&&(u.value=c.value[0].value))})),{midiSupported:s,inputs:o,outputs:c,selectedInput:l,selectedOutput:u,updatePending:h,playSound:()=>{var e;null==(e=i.value)||e.play([{note:{number:64,name:"E",octave:4},type:"noteon",velocity:.4251968503937008,timestamp:0},{note:{number:64,name:"E",octave:4},velocity:.3779527559055118,type:"noteoff",timestamp:511.90500000002794},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5275590551181102,timestamp:535.8800000001211},{note:{number:60,name:"C",octave:4},velocity:.33858267716535434,type:"noteoff",timestamp:674.9899999999907},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5590551181102362,timestamp:1070.8800000000047},{note:{number:60,name:"C",octave:4},velocity:.3464566929133858,type:"noteoff",timestamp:1214.8999999999069},{note:{number:64,name:"E",octave:4},type:"noteon",velocity:.5118110236220472,timestamp:1424.9400000000605},{note:{number:64,name:"E",octave:4},velocity:.2755905511811024,type:"noteoff",timestamp:1576.9150000000373},{note:{number:62,name:"D",octave:4},type:"noteon",velocity:.3937007874015748,timestamp:1756.9149999999208},{note:{number:62,name:"D",octave:4},velocity:.36220472440944884,type:"noteoff",timestamp:1926.9899999998743},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5196850393700787,timestamp:1970.9600000000792},{note:{number:60,name:"C",octave:4},velocity:.36220472440944884,type:"noteoff",timestamp:2126.009999999893},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5984251968503937,timestamp:2502.0050000000047},{note:{number:60,name:"C",octave:4},velocity:.3858267716535433,type:"noteoff",timestamp:2853.920000000042},{note:{number:67,name:"G",octave:4},type:"noteon",velocity:.6850393700787402,timestamp:2875.8649999999907},{note:{number:67,name:"G",octave:4},velocity:.6377952755905512,type:"noteoff",timestamp:4497.004999999888}])},saveSettings:async()=>{h.value=!0;(await a.getDataLayer().getUserDB().getCourseInterface(e._id)).updateCourseSettings([{key:"midiinput",value:l.value},{key:"midioutput",value:u.value},{key:"keyboardRange",value:m.value},{key:"lowestNote",value:g.value},{key:"highestNote",value:v.value}]),d.value=l.value,f.value=u.value,y.value=m.value,b.value=g.value,_.value=v.value,p.value=!1,h.value=!1,n.alertUser({text:"Settings updated.",status:r.Status.ok})},configChanged:p,lowestNote:g,highestNote:v,keyboardRangeOptions:x,selectedKeyboardRange:m,noteOptions:w,updateCustomRangeFromPreset:()=>{switch(m.value){case"full-88":g.value=21,v.value=108;break;case"76-key":g.value=28,v.value=103;break;case"61-key":g.value=36,v.value=96;break;case"49-key":g.value=48,v.value=96;break;case"37-key":g.value=48,v.value=84;break;case"25-key":g.value=60,v.value=84}k()},updateRangeAndCheckChanges:()=>{g.value>=v.value&&(v.value=g.value+12),k()}}}});const $y=new class CourseList{constructor(e){u(this,"courseList"),u(this,"cachedRawViews",null),this.courseList=e}get courses(){return this.courseList}getCourse(e){return this.courseList.find((t=>t.name===e))}allViewsRaw(){if(!this.cachedRawViews){const e=this.allViews();this.cachedRawViews=Object.fromEntries(Object.entries(e).map((([e,n])=>[e,t.markRaw(n)])))}return this.cachedRawViews}allViews(){const e={};return this.courseList.forEach((t=>{Object.assign(e,t.allViewsMap)})),e}getView(e){let t;t="string"==typeof e?r.NameSpacer.getViewDescriptor(e):e;const n=this.getCourse(t.course);if(n){const e=n.getQuestion(t.questionType);if(e){const 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}\n\n descriptor: ${JSON.stringify(t)}\n\n course: ${n.name}\n question: ${e.name}\n views: ${e.views.map((e=>e.name)).join(", ")}\n `),new Error(`view ${t.view} does not exist.`)}throw console.error(`Question ${t.questionType} not found in course ${t.course}\n\n descriptor: ${JSON.stringify(t)}\n\n course: ${n.name}\n questions: ${n.questions.map((e=>e.name)).join(", ")}\n `),new Error(`question ${t.questionType} does not exist.`)}throw console.error(`Course ${t.course} not found.\n\n descriptor: ${JSON.stringify(t)}`),new Error(`course ${t.course} does not exist.`)}toString(){let e="";return this.courses.forEach((t=>{e+=`Course: ${t.name}\n`,t.questions.forEach((t=>{e+=` Question: ${t.name}\n`,t.views.forEach((t=>{e+=` View: ${t.name}\n`}))}))})),e}allDataShapesRaw(){const e=[];return this.courseList.forEach((t=>{t.questions.forEach((t=>{t.dataShapes.forEach((t=>{e.includes(t)||e.push(t)}))}))})),e}allDataShapes(){const e=[];return this.courseList.forEach((t=>{t.questions.forEach((n=>{n.dataShapes.forEach((r=>{-1===e.findIndex((e=>e.course===t.name&&e.dataShape===r.name))&&e.push({course:t.name,dataShape:r.name,displayable:n})}))}))})),e}getDataShape(e){let t;if(this.getCourse(e.course).questions.forEach((n=>{n.dataShapes.forEach((n=>{n.name===e.dataShape&&(t=n)}))})),t)return t;throw new Error(`DataShape ${r.NameSpacer.getDataShapeString(e)} not found`)}}([wi,Py,Yn,L,Vu,Gu,ay,On,ky]);function Ky(e){return null!==e&&"object"==typeof e&&"clearData"in e&&"validate"in e&&"function"==typeof e.clearData&&"function"==typeof e.validate}var Qy="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Xy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zy,Jy={exports:{}},eb=Jy.exports;
|
|
75
|
+
/**
|
|
76
|
+
* @license
|
|
77
|
+
* Lodash <https://lodash.com/>
|
|
78
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
79
|
+
* Released under MIT license <https://lodash.com/license>
|
|
80
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
81
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
82
|
+
*/var tb=(Zy||(Zy=1,function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,o=128,c=256,l=1/0,u=9007199254740991,h=NaN,d=4294967295,f=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",c]],p="[object Arguments]",m="[object Array]",g="[object Boolean]",v="[object Date]",y="[object Error]",b="[object Function]",_="[object GeneratorFunction]",w="[object Map]",x="[object Number]",k="[object Object]",C="[object Promise]",S="[object RegExp]",E="[object Set]",M="[object String]",T="[object Symbol]",N="[object WeakMap]",A="[object ArrayBuffer]",P="[object DataView]",I="[object Float32Array]",D="[object Float64Array]",B="[object Int8Array]",O="[object Int16Array]",L="[object Int32Array]",V="[object Uint8Array]",R="[object Uint8ClampedArray]",F="[object Uint16Array]",z="[object Uint32Array]",j=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,W=RegExp(U.source),Y=RegExp(G.source),$=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,oe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,pe=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,_e="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xe="\\u2700-\\u27bf",ke="a-z\\xdf-\\xf6\\xf8-\\xff",Ce="A-Z\\xc0-\\xd6\\xd8-\\xde",Se="\\ufe0e\\ufe0f",Ee="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Me="['’]",Te="["+_e+"]",Ne="["+Ee+"]",Ae="["+we+"]",Pe="\\d+",Ie="["+xe+"]",De="["+ke+"]",Be="[^"+_e+Ee+Pe+xe+ke+Ce+"]",Oe="\\ud83c[\\udffb-\\udfff]",Le="[^"+_e+"]",Ve="(?:\\ud83c[\\udde6-\\uddff]){2}",Re="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Ce+"]",ze="\\u200d",je="(?:"+De+"|"+Be+")",qe="(?:"+Fe+"|"+Be+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ge="(?:"+Ae+"|"+Oe+")?",We="["+Se+"]?",Ye=We+Ge+"(?:"+ze+"(?:"+[Le,Ve,Re].join("|")+")"+We+Ge+")*",$e="(?:"+[Ie,Ve,Re].join("|")+")"+Ye,Ke="(?:"+[Le+Ae+"?",Ae,Ve,Re,Te].join("|")+")",Qe=RegExp(Me,"g"),Xe=RegExp(Ae,"g"),Ze=RegExp(Oe+"(?="+Oe+")|"+Ke+Ye,"g"),Je=RegExp([Fe+"?"+De+"+"+He+"(?="+[Ne,Fe,"$"].join("|")+")",qe+"+"+Ue+"(?="+[Ne,Fe+je,"$"].join("|")+")",Fe+"?"+je+"+"+He,Fe+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pe,$e].join("|"),"g"),et=RegExp("["+ze+_e+we+Se+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[I]=it[D]=it[B]=it[O]=it[L]=it[V]=it[R]=it[F]=it[z]=!0,it[p]=it[m]=it[A]=it[g]=it[P]=it[v]=it[y]=it[b]=it[w]=it[x]=it[k]=it[S]=it[E]=it[M]=it[N]=!1;var at={};at[p]=at[m]=at[A]=at[P]=at[g]=at[v]=at[I]=at[D]=at[B]=at[O]=at[L]=at[w]=at[x]=at[k]=at[S]=at[E]=at[M]=at[T]=at[V]=at[R]=at[F]=at[z]=!0,at[y]=at[b]=at[N]=!1;var st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ot=parseFloat,ct=parseInt,lt="object"==typeof Qy&&Qy&&Qy.Object===Object&&Qy,ut="object"==typeof self&&self&&self.Object===Object&&self,ht=lt||ut||Function("return this")(),dt=t&&!t.nodeType&&t,ft=dt&&e&&!e.nodeType&&e,pt=ft&&ft.exports===dt,mt=pt&<.process,gt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||mt&&mt.binding&&mt.binding("util")}catch(t){}}(),vt=gt&>.isArrayBuffer,yt=gt&>.isDate,bt=gt&>.isMap,_t=gt&>.isRegExp,wt=gt&>.isSet,xt=gt&>.isTypedArray;function kt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Ct(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var s=e[i];t(r,s,n(s),e)}return r}function St(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Et(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Mt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Tt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[i++]=s)}return a}function Nt(e,t){return!(null==e||!e.length)&&Ft(e,t,0)>-1}function At(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Pt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function It(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Dt(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Bt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Ot(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Lt=Ht("length");function Vt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function Rt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Ft(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Rt(e,jt,n)}function zt(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function jt(e){return e!=e}function qt(e,t){var n=null==e?0:e.length;return n?Wt(e,t)/n:h}function Ht(e){return function(t){return null==t?n:t[e]}}function Ut(e){return function(t){return null==e?n:e[t]}}function Gt(e,t,n,r,i){return i(e,(function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)})),n}function Wt(e,t){for(var r,i=-1,a=e.length;++i<a;){var s=t(e[i]);s!==n&&(r=r===n?s:r+s)}return r}function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function $t(e){return e?e.slice(0,hn(e)+1).replace(ne,""):e}function Kt(e){return function(t){return e(t)}}function Qt(e,t){return Pt(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function Zt(e,t){for(var n=-1,r=e.length;++n<r&&Ft(t,e[n],0)>-1;);return n}function Jt(e,t){for(var n=e.length;n--&&Ft(t,e[n],0)>-1;);return n}var en=Ut({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),tn=Ut({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+st[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function sn(e,t){return function(n){return e(t(n))}}function on(e,t){for(var n=-1,r=e.length,i=0,s=[];++n<r;){var o=e[n];o!==t&&o!==a||(e[n]=a,s[i++]=n)}return s}function cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function ln(e){return rn(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):Lt(e)}function un(e){return rn(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function hn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var dn=Ut({"&":"&","<":"<",">":">",""":'"',"'":"'"}),fn=function e(t){var re,_e=(t=null==t?ht:fn.defaults(ht.Object(),t,fn.pick(ht,nt))).Array,we=t.Date,xe=t.Error,ke=t.Function,Ce=t.Math,Se=t.Object,Ee=t.RegExp,Me=t.String,Te=t.TypeError,Ne=_e.prototype,Ae=ke.prototype,Pe=Se.prototype,Ie=t["__core-js_shared__"],De=Ae.toString,Be=Pe.hasOwnProperty,Oe=0,Le=(re=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",Ve=Pe.toString,Re=De.call(Se),Fe=ht._,ze=Ee("^"+De.call(Be).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=pt?t.Buffer:n,qe=t.Symbol,He=t.Uint8Array,Ue=je?je.allocUnsafe:n,Ge=sn(Se.getPrototypeOf,Se),We=Se.create,Ye=Pe.propertyIsEnumerable,$e=Ne.splice,Ke=qe?qe.isConcatSpreadable:n,Ze=qe?qe.iterator:n,et=qe?qe.toStringTag:n,st=function(){try{var e=la(Se,"defineProperty");return e({},"",{}),e}catch(t){}}(),lt=t.clearTimeout!==ht.clearTimeout&&t.clearTimeout,ut=we&&we.now!==ht.Date.now&&we.now,dt=t.setTimeout!==ht.setTimeout&&t.setTimeout,ft=Ce.ceil,mt=Ce.floor,gt=Se.getOwnPropertySymbols,Lt=je?je.isBuffer:n,Ut=t.isFinite,pn=Ne.join,mn=sn(Se.keys,Se),gn=Ce.max,vn=Ce.min,yn=we.now,bn=t.parseInt,_n=Ce.random,wn=Ne.reverse,xn=la(t,"DataView"),kn=la(t,"Map"),Cn=la(t,"Promise"),Sn=la(t,"Set"),En=la(t,"WeakMap"),Mn=la(Se,"create"),Tn=En&&new En,Nn={},An=Ra(xn),Pn=Ra(kn),In=Ra(Cn),Dn=Ra(Sn),Bn=Ra(En),On=qe?qe.prototype:n,Ln=On?On.valueOf:n,Vn=On?On.toString:n;function Rn(e){if(to(e)&&!Us(e)&&!(e instanceof qn)){if(e instanceof jn)return e;if(Be.call(e,"__wrapped__"))return Fa(e)}return new jn(e)}var Fn=function(){function e(){}return function(t){if(!eo(t))return{};if(We)return We(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function zn(){}function jn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function qn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Gn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Un(e);this.size=t.size}function $n(e,t){var n=Us(e),r=!n&&Hs(e),i=!n&&!r&&$s(e),a=!n&&!r&&!i&&lo(e),s=n||r||i||a,o=s?Yt(e.length,Me):[],c=o.length;for(var l in e)!t&&!Be.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ga(l,c))||o.push(l);return o}function Kn(e){var t=e.length;return t?e[Wr(0,t-1)]:n}function Qn(e,t){return Ia(Mi(e),ar(t,0,e.length))}function Xn(e){return Ia(Mi(e))}function Zn(e,t,r){(r!==n&&!zs(e[t],r)||r===n&&!(t in e))&&rr(e,t,r)}function Jn(e,t,r){var i=e[t];Be.call(e,t)&&zs(i,r)&&(r!==n||t in e)||rr(e,t,r)}function er(e,t){for(var n=e.length;n--;)if(zs(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,(function(e,i,a){t(r,e,n(e),a)})),r}function nr(e,t){return e&&Ti(t,Io(t),e)}function rr(e,t,n){"__proto__"==t&&st?st(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var r=-1,i=t.length,a=_e(i),s=null==e;++r<i;)a[r]=s?n:Mo(e,t[r]);return a}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function sr(e,t,r,i,a,s){var o,c=1&t,l=2&t,u=4&t;if(r&&(o=a?r(e,i,a,s):r(e)),o!==n)return o;if(!eo(e))return e;var h=Us(e);if(h){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return Mi(e,o)}else{var d=da(e),f=d==b||d==_;if($s(e))return wi(e,c);if(d==k||d==p||f&&!a){if(o=l||f?{}:pa(e),!c)return l?function(e,t){return Ti(e,ha(e),t)}(e,function(e,t){return e&&Ti(t,Do(t),e)}(o,e)):function(e,t){return Ti(e,ua(e),t)}(e,nr(o,e))}else{if(!at[d])return a?e:{};o=function(e,t,n){var r,i=e.constructor;switch(t){case A:return xi(e);case g:case v:return new i(+e);case P:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case I:case D:case B:case O:case L:case V:case R:case F:case z:return ki(e,n);case w:return new i;case x:case M:return new i(e);case S:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new i;case T:return r=e,Ln?Se(Ln.call(r)):{}}}(e,d,c)}}s||(s=new Yn);var m=s.get(e);if(m)return m;s.set(e,o),so(e)?e.forEach((function(n){o.add(sr(n,t,r,n,e,s))})):no(e)&&e.forEach((function(n,i){o.set(i,sr(n,t,r,i,e,s))}));var y=h?n:(u?l?na:ta:l?Do:Io)(e);return St(y||e,(function(n,i){y&&(n=e[i=n]),Jn(o,i,sr(n,t,r,i,e,s))})),o}function or(e,t,r){var i=r.length;if(null==e)return!i;for(e=Se(e);i--;){var a=r[i],s=t[a],o=e[a];if(o===n&&!(a in e)||!s(o))return!1}return!0}function cr(e,t,i){if("function"!=typeof e)throw new Te(r);return Ta((function(){e.apply(n,i)}),t)}function lr(e,t,n,r){var i=-1,a=Nt,s=!0,o=e.length,c=[],l=t.length;if(!o)return c;n&&(t=Pt(t,Kt(n))),r?(a=At,s=!1):t.length>=200&&(a=Xt,s=!1,t=new Wn(t));e:for(;++i<o;){var u=e[i],h=null==n?u:n(u);if(u=r||0!==u?u:0,s&&h==h){for(var d=l;d--;)if(t[d]===h)continue e;c.push(u)}else a(t,h,r)||c.push(u)}return c}Rn.templateSettings={escape:$,evaluate:K,interpolate:Q,variable:"",imports:{_:Rn}},Rn.prototype=zn.prototype,Rn.prototype.constructor=Rn,jn.prototype=Fn(zn.prototype),jn.prototype.constructor=jn,qn.prototype=Fn(zn.prototype),qn.prototype.constructor=qn,Hn.prototype.clear=function(){this.__data__=Mn?Mn(null):{},this.size=0},Hn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hn.prototype.get=function(e){var t=this.__data__;if(Mn){var r=t[e];return r===i?n:r}return Be.call(t,e)?t[e]:n},Hn.prototype.has=function(e){var t=this.__data__;return Mn?t[e]!==n:Be.call(t,e)},Hn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mn&&t===n?i:t,this},Un.prototype.clear=function(){this.__data__=[],this.size=0},Un.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():$e.call(t,n,1),--this.size,0))},Un.prototype.get=function(e){var t=this.__data__,r=er(t,e);return r<0?n:t[r][1]},Un.prototype.has=function(e){return er(this.__data__,e)>-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new Hn,map:new(kn||Un),string:new Hn}},Gn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Gn.prototype.get=function(e){return oa(this,e).get(e)},Gn.prototype.has=function(e){return oa(this,e).has(e)},Gn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,i),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Un,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!kn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gn(r)}return n.set(e,t),this.size=n.size,this};var ur=Pi(yr),hr=Pi(br,!0);function dr(e,t){var n=!0;return ur(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function fr(e,t,r){for(var i=-1,a=e.length;++i<a;){var s=e[i],o=t(s);if(null!=o&&(c===n?o==o&&!co(o):r(o,c)))var c=o,l=s}return l}function pr(e,t){var n=[];return ur(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function mr(e,t,n,r,i){var a=-1,s=e.length;for(n||(n=ma),i||(i=[]);++a<s;){var o=e[a];t>0&&n(o)?t>1?mr(o,t-1,n,r,i):It(i,o):r||(i[i.length]=o)}return i}var gr=Ii(),vr=Ii(!0);function yr(e,t){return e&&gr(e,t,Io)}function br(e,t){return e&&vr(e,t,Io)}function _r(e,t){return Tt(t,(function(t){return Xs(e[t])}))}function wr(e,t){for(var r=0,i=(t=vi(t,e)).length;null!=e&&r<i;)e=e[Va(t[r++])];return r&&r==i?e:n}function xr(e,t,n){var r=t(e);return Us(e)?r:It(r,n(e))}function kr(e){return null==e?e===n?"[object Undefined]":"[object Null]":et&&et in Se(e)?function(e){var t=Be.call(e,et),r=e[et];try{e[et]=n;var i=!0}catch(s){}var a=Ve.call(e);return i&&(t?e[et]=r:delete e[et]),a}(e):function(e){return Ve.call(e)}(e)}function Cr(e,t){return e>t}function Sr(e,t){return null!=e&&Be.call(e,t)}function Er(e,t){return null!=e&&t in Se(e)}function Mr(e,t,r){for(var i=r?At:Nt,a=e[0].length,s=e.length,o=s,c=_e(s),l=1/0,u=[];o--;){var h=e[o];o&&t&&(h=Pt(h,Kt(t))),l=vn(h.length,l),c[o]=!r&&(t||a>=120&&h.length>=120)?new Wn(o&&h):n}h=e[0];var d=-1,f=c[0];e:for(;++d<a&&u.length<l;){var p=h[d],m=t?t(p):p;if(p=r||0!==p?p:0,!(f?Xt(f,m):i(u,m,r))){for(o=s;--o;){var g=c[o];if(!(g?Xt(g,m):i(e[o],m,r)))continue e}f&&f.push(m),u.push(p)}}return u}function Tr(e,t,r){var i=null==(e=Sa(e,t=vi(t,e)))?e:e[Va(Qa(t))];return null==i?n:kt(i,e,r)}function Nr(e){return to(e)&&kr(e)==p}function Ar(e,t,r,i,a){return e===t||(null==e||null==t||!to(e)&&!to(t)?e!=e&&t!=t:function(e,t,r,i,a,s){var o=Us(e),c=Us(t),l=o?m:da(e),u=c?m:da(t),h=(l=l==p?k:l)==k,d=(u=u==p?k:u)==k,f=l==u;if(f&&$s(e)){if(!$s(t))return!1;o=!0,h=!1}if(f&&!h)return s||(s=new Yn),o||lo(e)?Ji(e,t,r,i,a,s):function(e,t,n,r,i,a,s){switch(n){case P:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case A:return!(e.byteLength!=t.byteLength||!a(new He(e),new He(t)));case g:case v:case x:return zs(+e,+t);case y:return e.name==t.name&&e.message==t.message;case S:case M:return e==t+"";case w:var o=an;case E:var c=1&r;if(o||(o=cn),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var u=Ji(o(e),o(t),r,i,a,s);return s.delete(e),u;case T:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(e,t,l,r,i,a,s);if(!(1&r)){var b=h&&Be.call(e,"__wrapped__"),_=d&&Be.call(t,"__wrapped__");if(b||_){var C=b?e.value():e,N=_?t.value():t;return s||(s=new Yn),a(C,N,r,i,s)}}return!!f&&(s||(s=new Yn),function(e,t,r,i,a,s){var o=1&r,c=ta(e),l=c.length,u=ta(t),h=u.length;if(l!=h&&!o)return!1;for(var d=l;d--;){var f=c[d];if(!(o?f in t:Be.call(t,f)))return!1}var p=s.get(e),m=s.get(t);if(p&&m)return p==t&&m==e;var g=!0;s.set(e,t),s.set(t,e);for(var v=o;++d<l;){var y=e[f=c[d]],b=t[f];if(i)var _=o?i(b,y,f,t,e,s):i(y,b,f,e,t,s);if(!(_===n?y===b||a(y,b,r,i,s):_)){g=!1;break}v||(v="constructor"==f)}if(g&&!v){var w=e.constructor,x=t.constructor;w==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(g=!1)}return s.delete(e),s.delete(t),g}(e,t,r,i,a,s))}(e,t,r,i,Ar,a))}function Pr(e,t,r,i){var a=r.length,s=a,o=!i;if(null==e)return!s;for(e=Se(e);a--;){var c=r[a];if(o&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<s;){var l=(c=r[a])[0],u=e[l],h=c[1];if(o&&c[2]){if(u===n&&!(l in e))return!1}else{var d=new Yn;if(i)var f=i(u,h,l,e,t,d);if(!(f===n?Ar(h,u,3,i,d):f))return!1}}return!0}function Ir(e){return!(!eo(e)||(t=e,Le&&Le in t))&&(Xs(e)?ze:pe).test(Ra(e));var t}function Dr(e){return"function"==typeof e?e:null==e?ic:"object"==typeof e?Us(e)?Fr(e[0],e[1]):Rr(e):fc(e)}function Br(e){if(!wa(e))return mn(e);var t=[];for(var n in Se(e))Be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Or(e){if(!eo(e))return function(e){var t=[];if(null!=e)for(var n in Se(e))t.push(n);return t}(e);var t=wa(e),n=[];for(var r in e)("constructor"!=r||!t&&Be.call(e,r))&&n.push(r);return n}function Lr(e,t){return e<t}function Vr(e,t){var n=-1,r=Ws(e)?_e(e.length):[];return ur(e,(function(e,i,a){r[++n]=t(e,i,a)})),r}function Rr(e){var t=ca(e);return 1==t.length&&t[0][2]?ka(t[0][0],t[0][1]):function(n){return n===e||Pr(n,e,t)}}function Fr(e,t){return ya(e)&&xa(t)?ka(Va(e),t):function(r){var i=Mo(r,e);return i===n&&i===t?To(r,e):Ar(t,i,3)}}function zr(e,t,r,i,a){e!==t&&gr(t,(function(s,o){if(a||(a=new Yn),eo(s))!function(e,t,r,i,a,s,o){var c=Ea(e,r),l=Ea(t,r),u=o.get(l);if(u)Zn(e,r,u);else{var h=s?s(c,l,r+"",e,t,o):n,d=h===n;if(d){var f=Us(l),p=!f&&$s(l),m=!f&&!p&&lo(l);h=l,f||p||m?Us(c)?h=c:Ys(c)?h=Mi(c):p?(d=!1,h=wi(l,!0)):m?(d=!1,h=ki(l,!0)):h=[]:io(l)||Hs(l)?(h=c,Hs(c)?h=yo(c):eo(c)&&!Xs(c)||(h=pa(l))):d=!1}d&&(o.set(l,h),a(h,l,i,s,o),o.delete(l)),Zn(e,r,h)}}(e,t,o,r,zr,i,a);else{var c=i?i(Ea(e,o),s,o+"",e,t,a):n;c===n&&(c=s),Zn(e,o,c)}}),Do)}function jr(e,t){var r=e.length;if(r)return ga(t+=t<0?r:0,r)?e[t]:n}function qr(e,t,n){t=t.length?Pt(t,(function(e){return Us(e)?function(t){return wr(t,1===e.length?e[0]:e)}:e})):[ic];var r=-1;return t=Pt(t,Kt(sa())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Vr(e,(function(e,n,i){return{criteria:Pt(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,s=i.length,o=n.length;++r<s;){var c=Ci(i[r],a[r]);if(c)return r>=o?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Hr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var s=t[r],o=wr(e,s);n(o,s)&&Xr(a,vi(s,e),o)}return a}function Ur(e,t,n,r){var i=r?zt:Ft,a=-1,s=t.length,o=e;for(e===t&&(t=Mi(t)),n&&(o=Pt(e,Kt(n)));++a<s;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(o,u,c,r))>-1;)o!==e&&$e.call(o,c,1),$e.call(e,c,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ga(i)?$e.call(e,i,1):li(e,i)}}return e}function Wr(e,t){return e+mt(_n()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function $r(e,t){return Na(Ca(e,t,ic),e+"")}function Kr(e){return Kn(jo(e))}function Qr(e,t){var n=jo(e);return Ia(n,ar(t,0,n.length))}function Xr(e,t,r,i){if(!eo(e))return e;for(var a=-1,s=(t=vi(t,e)).length,o=s-1,c=e;null!=c&&++a<s;){var l=Va(t[a]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(a!=o){var h=c[l];(u=i?i(h,l,c):n)===n&&(u=eo(h)?h:ga(t[a+1])?[]:{})}Jn(c,l,u),c=c[l]}return e}var Zr=Tn?function(e,t){return Tn.set(e,t),e}:ic,Jr=st?function(e,t){return st(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:ic;function ei(e){return Ia(jo(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=_e(i);++r<i;)a[r]=e[r+t];return a}function ni(e,t){var n;return ur(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,s=e[a];null!==s&&!co(s)&&(n?s<=t:s<t)?r=a+1:i=a}return i}return ii(e,t,ic,n)}function ii(e,t,r,i){var a=0,s=null==e?0:e.length;if(0===s)return 0;for(var o=(t=r(t))!=t,c=null===t,l=co(t),u=t===n;a<s;){var h=mt((a+s)/2),d=r(e[h]),f=d!==n,p=null===d,m=d==d,g=co(d);if(o)var v=i||m;else v=u?m&&(i||f):c?m&&f&&(i||!p):l?m&&f&&!p&&(i||!g):!p&&!g&&(i?d<=t:d<t);v?a=h+1:s=h}return vn(s,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n],o=t?t(s):s;if(!n||!zs(o,c)){var c=o;a[i++]=0===s?0:s}}return a}function si(e){return"number"==typeof e?e:co(e)?h:+e}function oi(e){if("string"==typeof e)return e;if(Us(e))return Pt(e,oi)+"";if(co(e))return Vn?Vn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=Nt,a=e.length,s=!0,o=[],c=o;if(n)s=!1,i=At;else if(a>=200){var l=t?null:Yi(e);if(l)return cn(l);s=!1,i=Xt,c=new Wn}else c=t?[]:o;e:for(;++r<a;){var u=e[r],h=t?t(u):u;if(u=n||0!==u?u:0,s&&h==h){for(var d=c.length;d--;)if(c[d]===h)continue e;t&&c.push(h),o.push(u)}else i(c,h,n)||(c!==o&&c.push(h),o.push(u))}return o}function li(e,t){return null==(e=Sa(e,t=vi(t,e)))||delete e[Va(Qa(t))]}function ui(e,t,n,r){return Xr(e,t,n(wr(e,t)),r)}function hi(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?ti(e,r?0:a,r?a+1:i):ti(e,r?a+1:0,r?i:a)}function di(e,t){var n=e;return n instanceof qn&&(n=n.value()),Dt(t,(function(e,t){return t.func.apply(t.thisArg,It([e],t.args))}),n)}function fi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,a=_e(r);++i<r;)for(var s=e[i],o=-1;++o<r;)o!=i&&(a[i]=lr(a[i]||s,e[o],t,n));return ci(mr(a,1),t,n)}function pi(e,t,r){for(var i=-1,a=e.length,s=t.length,o={};++i<a;){var c=i<s?t[i]:n;r(o,e[i],c)}return o}function mi(e){return Ys(e)?e:[]}function gi(e){return"function"==typeof e?e:ic}function vi(e,t){return Us(e)?e:ya(e,t)?[e]:La(bo(e))}var yi=$r;function bi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ti(e,t,r)}var _i=lt||function(e){return ht.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function ki(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ci(e,t){if(e!==t){var r=e!==n,i=null===e,a=e==e,s=co(e),o=t!==n,c=null===t,l=t==t,u=co(t);if(!c&&!u&&!s&&e>t||s&&o&&l&&!c&&!u||i&&o&&l||!r&&l||!a)return 1;if(!i&&!s&&!u&&e<t||u&&r&&a&&!i&&!s||c&&r&&a||!o&&a||!l)return-1}return 0}function Si(e,t,n,r){for(var i=-1,a=e.length,s=n.length,o=-1,c=t.length,l=gn(a-s,0),u=_e(c+l),h=!r;++o<c;)u[o]=t[o];for(;++i<s;)(h||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[o++]=e[i++];return u}function Ei(e,t,n,r){for(var i=-1,a=e.length,s=-1,o=n.length,c=-1,l=t.length,u=gn(a-o,0),h=_e(u+l),d=!r;++i<u;)h[i]=e[i];for(var f=i;++c<l;)h[f+c]=t[c];for(;++s<o;)(d||i<a)&&(h[f+n[s]]=e[i++]);return h}function Mi(e,t){var n=-1,r=e.length;for(t||(t=_e(r));++n<r;)t[n]=e[n];return t}function Ti(e,t,r,i){var a=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var c=t[s],l=i?i(r[c],e[c],c,r,e):n;l===n&&(l=e[c]),a?rr(r,c,l):Jn(r,c,l)}return r}function Ni(e,t){return function(n,r){var i=Us(n)?Ct:tr,a=t?t():{};return i(n,e,sa(r,2),a)}}function Ai(e){return $r((function(t,r){var i=-1,a=r.length,s=a>1?r[a-1]:n,o=a>2?r[2]:n;for(s=e.length>3&&"function"==typeof s?(a--,s):n,o&&va(r[0],r[1],o)&&(s=a<3?n:s,a=1),t=Se(t);++i<a;){var c=r[i];c&&e(t,c,i,s)}return t}))}function Pi(e,t){return function(n,r){if(null==n)return n;if(!Ws(n))return e(n,r);for(var i=n.length,a=t?i:-1,s=Se(n);(t?a--:++a<i)&&!1!==r(s[a],a,s););return n}}function Ii(e){return function(t,n,r){for(var i=-1,a=Se(t),s=r(t),o=s.length;o--;){var c=s[e?o:++i];if(!1===n(a[c],c,a))break}return t}}function Di(e){return function(t){var r=rn(t=bo(t))?un(t):n,i=r?r[0]:t.charAt(0),a=r?bi(r,1).join(""):t.slice(1);return i[e]()+a}}function Bi(e){return function(t){return Dt(Zo(Uo(t).replace(Qe,"")),e,"")}}function Oi(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Fn(e.prototype),r=e.apply(n,t);return eo(r)?r:n}}function Li(e){return function(t,r,i){var a=Se(t);if(!Ws(t)){var s=sa(r,3);t=Io(t),r=function(e){return s(a[e],e,a)}}var o=e(t,r,i);return o>-1?a[s?t[o]:o]:n}}function Vi(e){return ea((function(t){var i=t.length,a=i,s=jn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new Te(r);if(s&&!c&&"wrapper"==ia(o))var c=new jn([],!0)}for(a=c?a:i;++a<i;){var l=ia(o=t[a]),u="wrapper"==l?ra(o):n;c=u&&ba(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ia(u[0])].apply(c,u[3]):1==o.length&&ba(o)?c[l]():c.thru(o)}return function(){var e=arguments,n=e[0];if(c&&1==e.length&&Us(n))return c.plant(n).value();for(var r=0,a=i?t[r].apply(this,e):n;++r<i;)a=t[r].call(this,a);return a}}))}function Ri(e,t,r,i,a,s,c,l,u,h){var d=t&o,f=1&t,p=2&t,m=24&t,g=512&t,v=p?n:Oi(e);return function o(){for(var y=arguments.length,b=_e(y),_=y;_--;)b[_]=arguments[_];if(m)var w=aa(o),x=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,w);if(i&&(b=Si(b,i,a,m)),s&&(b=Ei(b,s,c,m)),y-=x,m&&y<h){var k=on(b,w);return Gi(e,t,Ri,o.placeholder,r,b,k,l,u,h-y)}var C=f?r:this,S=p?C[e]:e;return y=b.length,l?b=function(e,t){for(var r=e.length,i=vn(t.length,r),a=Mi(e);i--;){var s=t[i];e[i]=ga(s,r)?a[s]:n}return e}(b,l):g&&y>1&&b.reverse(),d&&u<y&&(b.length=u),this&&this!==ht&&this instanceof o&&(S=v||Oi(S)),S.apply(C,b)}}function Fi(e,t){return function(n,r){return function(e,t,n,r){return yr(e,(function(e,i,a){t(r,n(e),i,a)})),r}(n,e,t(r),{})}}function zi(e,t){return function(r,i){var a;if(r===n&&i===n)return t;if(r!==n&&(a=r),i!==n){if(a===n)return i;"string"==typeof r||"string"==typeof i?(r=oi(r),i=oi(i)):(r=si(r),i=si(i)),a=e(r,i)}return a}}function ji(e){return ea((function(t){return t=Pt(t,Kt(sa())),$r((function(n){var r=this;return e(t,(function(e){return kt(e,r,n)}))}))}))}function qi(e,t){var r=(t=t===n?" ":oi(t)).length;if(r<2)return r?Yr(t,e):t;var i=Yr(t,ft(e/ln(t)));return rn(t)?bi(un(i),0,e).join(""):i.slice(0,e)}function Hi(e){return function(t,r,i){return i&&"number"!=typeof i&&va(t,r,i)&&(r=i=n),t=po(t),r===n?(r=t,t=0):r=po(r),function(e,t,n,r){for(var i=-1,a=gn(ft((t-e)/(n||1)),0),s=_e(a);a--;)s[r?a:++i]=e,e+=n;return s}(t,r,i=i===n?t<r?1:-1:po(i),e)}}function Ui(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=vo(t),n=vo(n)),e(t,n)}}function Gi(e,t,r,i,a,o,c,l,u,h){var d=8&t;t|=d?s:64,4&(t&=~(d?64:s))||(t&=-4);var f=[e,t,a,d?o:n,d?c:n,d?n:o,d?n:c,l,u,h],p=r.apply(n,f);return ba(e)&&Ma(p,f),p.placeholder=i,Aa(p,e,t)}function Wi(e){var t=Ce[e];return function(e,n){if(e=vo(e),(n=null==n?0:vn(mo(n),292))&&Ut(e)){var r=(bo(e)+"e").split("e");return+((r=(bo(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Yi=Sn&&1/cn(new Sn([,-0]))[1]==l?function(e){return new Sn(e)}:lc;function $i(e){return function(t){var n=da(t);return n==w?an(t):n==E?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Pt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ki(e,t,i,l,u,h,d,f){var p=2&t;if(!p&&"function"!=typeof e)throw new Te(r);var m=l?l.length:0;if(m||(t&=-97,l=u=n),d=d===n?d:gn(mo(d),0),f=f===n?f:mo(f),m-=u?u.length:0,64&t){var g=l,v=u;l=u=n}var y=p?n:ra(e),b=[e,t,i,l,u,g,v,h,d,f];if(y&&function(e,t){var n=e[1],r=t[1],i=n|r,s=i<131,l=r==o&&8==n||r==o&&n==c&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!s&&!l)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var h=e[3];e[3]=h?Si(h,u,t[4]):u,e[4]=h?on(e[3],a):t[4]}(u=t[5])&&(h=e[5],e[5]=h?Ei(h,u,t[6]):u,e[6]=h?on(e[5],a):t[6]),(u=t[7])&&(e[7]=u),r&o&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(b,y),e=b[0],t=b[1],i=b[2],l=b[3],u=b[4],!(f=b[9]=b[9]===n?p?0:e.length:gn(b[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,r){var i=Oi(e);return function a(){for(var s=arguments.length,o=_e(s),c=s,l=aa(a);c--;)o[c]=arguments[c];var u=s<3&&o[0]!==l&&o[s-1]!==l?[]:on(o,l);return(s-=u.length)<r?Gi(e,t,Ri,a.placeholder,n,o,u,n,n,r-s):kt(this&&this!==ht&&this instanceof a?i:e,this,o)}}(e,t,f):t!=s&&33!=t||u.length?Ri.apply(n,b):function(e,t,n,r){var i=1&t,a=Oi(e);return function t(){for(var s=-1,o=arguments.length,c=-1,l=r.length,u=_e(l+o),h=this&&this!==ht&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;o--;)u[c++]=arguments[++s];return kt(h,i?n:this,u)}}(e,t,i,l);else var _=function(e,t,n){var r=1&t,i=Oi(e);return function t(){return(this&&this!==ht&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return Aa((y?Zr:Ma)(_,b),e,t)}function Qi(e,t,r,i){return e===n||zs(e,Pe[r])&&!Be.call(i,r)?t:e}function Xi(e,t,r,i,a,s){return eo(e)&&eo(t)&&(s.set(t,e),zr(e,t,n,Xi,s),s.delete(t)),e}function Zi(e){return io(e)?n:e}function Ji(e,t,r,i,a,s){var o=1&r,c=e.length,l=t.length;if(c!=l&&!(o&&l>c))return!1;var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var d=-1,f=!0,p=2&r?new Wn:n;for(s.set(e,t),s.set(t,e);++d<c;){var m=e[d],g=t[d];if(i)var v=o?i(g,m,d,t,e,s):i(m,g,d,e,t,s);if(v!==n){if(v)continue;f=!1;break}if(p){if(!Ot(t,(function(e,t){if(!Xt(p,t)&&(m===e||a(m,e,r,i,s)))return p.push(t)}))){f=!1;break}}else if(m!==g&&!a(m,g,r,i,s)){f=!1;break}}return s.delete(e),s.delete(t),f}function ea(e){return Na(Ca(e,n,Ga),e+"")}function ta(e){return xr(e,Io,ua)}function na(e){return xr(e,Do,ha)}var ra=Tn?function(e){return Tn.get(e)}:lc;function ia(e){for(var t=e.name+"",n=Nn[t],r=Be.call(Nn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function aa(e){return(Be.call(Rn,"placeholder")?Rn:e).placeholder}function sa(){var e=Rn.iteratee||ac;return e=e===ac?Dr:e,arguments.length?e(arguments[0],arguments[1]):e}function oa(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function ca(e){for(var t=Io(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,xa(i)]}return t}function la(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Ir(r)?r:n}var ua=gt?function(e){return null==e?[]:(e=Se(e),Tt(gt(e),(function(t){return Ye.call(e,t)})))}:gc,ha=gt?function(e){for(var t=[];e;)It(t,ua(e)),e=Ge(e);return t}:gc,da=kr;function fa(e,t,n){for(var r=-1,i=(t=vi(t,e)).length,a=!1;++r<i;){var s=Va(t[r]);if(!(a=null!=e&&n(e,s)))break;e=e[s]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&Js(i)&&ga(s,i)&&(Us(e)||Hs(e))}function pa(e){return"function"!=typeof e.constructor||wa(e)?{}:Fn(Ge(e))}function ma(e){return Us(e)||Hs(e)||!!(Ke&&e&&e[Ke])}function ga(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&ge.test(e))&&e>-1&&e%1==0&&e<t}function va(e,t,n){if(!eo(n))return!1;var r=typeof t;return!!("number"==r?Ws(n)&&ga(t,n.length):"string"==r&&t in n)&&zs(n[t],e)}function ya(e,t){if(Us(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!co(e))||Z.test(e)||!X.test(e)||null!=t&&e in Se(t)}function ba(e){var t=ia(e),n=Rn[t];if("function"!=typeof n||!(t in qn.prototype))return!1;if(e===n)return!0;var r=ra(n);return!!r&&e===r[0]}(xn&&da(new xn(new ArrayBuffer(1)))!=P||kn&&da(new kn)!=w||Cn&&da(Cn.resolve())!=C||Sn&&da(new Sn)!=E||En&&da(new En)!=N)&&(da=function(e){var t=kr(e),r=t==k?e.constructor:n,i=r?Ra(r):"";if(i)switch(i){case An:return P;case Pn:return w;case In:return C;case Dn:return E;case Bn:return N}return t});var _a=Ie?Xs:vc;function wa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pe)}function xa(e){return e==e&&!eo(e)}function ka(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in Se(r))}}function Ca(e,t,r){return t=gn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=gn(n.length-t,0),s=_e(a);++i<a;)s[i]=n[t+i];i=-1;for(var o=_e(t+1);++i<t;)o[i]=n[i];return o[t]=r(s),kt(e,this,o)}}function Sa(e,t){return t.length<2?e:wr(e,ti(t,0,-1))}function Ea(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ma=Pa(Zr),Ta=dt||function(e,t){return ht.setTimeout(e,t)},Na=Pa(Jr);function Aa(e,t,n){var r=t+"";return Na(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(f,(function(n){var r="_."+n[0];t&n[1]&&!Nt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(r),n)))}function Pa(e){var t=0,r=0;return function(){var i=yn(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Ia(e,t){var r=-1,i=e.length,a=i-1;for(t=t===n?i:t;++r<t;){var s=Wr(r,a),o=e[s];e[s]=e[r],e[r]=o}return e.length=t,e}var Da,Ba,Oa,La=(Da=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(J,(function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)})),t},Ba=Bs(Da,(function(e){return 500===Oa.size&&Oa.clear(),e})),Oa=Ba.cache,Ba);function Va(e){if("string"==typeof e||co(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ra(e){if(null!=e){try{return De.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Fa(e){if(e instanceof qn)return e.clone();var t=new jn(e.__wrapped__,e.__chain__);return t.__actions__=Mi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var za=$r((function(e,t){return Ys(e)?lr(e,mr(t,1,Ys,!0)):[]})),ja=$r((function(e,t){var r=Qa(t);return Ys(r)&&(r=n),Ys(e)?lr(e,mr(t,1,Ys,!0),sa(r,2)):[]})),qa=$r((function(e,t){var r=Qa(t);return Ys(r)&&(r=n),Ys(e)?lr(e,mr(t,1,Ys,!0),n,r):[]}));function Ha(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:mo(n);return i<0&&(i=gn(r+i,0)),Rt(e,sa(t,3),i)}function Ua(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var a=i-1;return r!==n&&(a=mo(r),a=r<0?gn(i+a,0):vn(a,i-1)),Rt(e,sa(t,3),a,!0)}function Ga(e){return null!=e&&e.length?mr(e,1):[]}function Wa(e){return e&&e.length?e[0]:n}var Ya=$r((function(e){var t=Pt(e,mi);return t.length&&t[0]===e[0]?Mr(t):[]})),$a=$r((function(e){var t=Qa(e),r=Pt(e,mi);return t===Qa(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Mr(r,sa(t,2)):[]})),Ka=$r((function(e){var t=Qa(e),r=Pt(e,mi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Mr(r,n,t):[]}));function Qa(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Xa=$r(Za);function Za(e,t){return e&&e.length&&t&&t.length?Ur(e,t):e}var Ja=ea((function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Gr(e,Pt(t,(function(e){return ga(e,n)?+e:e})).sort(Ci)),r}));function es(e){return null==e?e:wn.call(e)}var ts=$r((function(e){return ci(mr(e,1,Ys,!0))})),ns=$r((function(e){var t=Qa(e);return Ys(t)&&(t=n),ci(mr(e,1,Ys,!0),sa(t,2))})),rs=$r((function(e){var t=Qa(e);return t="function"==typeof t?t:n,ci(mr(e,1,Ys,!0),n,t)}));function is(e){if(!e||!e.length)return[];var t=0;return e=Tt(e,(function(e){if(Ys(e))return t=gn(e.length,t),!0})),Yt(t,(function(t){return Pt(e,Ht(t))}))}function as(e,t){if(!e||!e.length)return[];var r=is(e);return null==t?r:Pt(r,(function(e){return kt(t,n,e)}))}var ss=$r((function(e,t){return Ys(e)?lr(e,t):[]})),os=$r((function(e){return fi(Tt(e,Ys))})),cs=$r((function(e){var t=Qa(e);return Ys(t)&&(t=n),fi(Tt(e,Ys),sa(t,2))})),ls=$r((function(e){var t=Qa(e);return t="function"==typeof t?t:n,fi(Tt(e,Ys),n,t)})),us=$r(is),hs=$r((function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,as(e,r)}));function ds(e){var t=Rn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ps=ea((function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof qn&&ga(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:fs,args:[a],thisArg:n}),new jn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(a)})),ms=Ni((function(e,t,n){Be.call(e,n)?++e[n]:rr(e,n,1)})),gs=Li(Ha),vs=Li(Ua);function ys(e,t){return(Us(e)?St:ur)(e,sa(t,3))}function bs(e,t){return(Us(e)?Et:hr)(e,sa(t,3))}var _s=Ni((function(e,t,n){Be.call(e,n)?e[n].push(t):rr(e,n,[t])})),ws=$r((function(e,t,n){var r=-1,i="function"==typeof t,a=Ws(e)?_e(e.length):[];return ur(e,(function(e){a[++r]=i?kt(t,e,n):Tr(e,t,n)})),a})),xs=Ni((function(e,t,n){rr(e,n,t)}));function ks(e,t){return(Us(e)?Pt:Vr)(e,sa(t,3))}var Cs=Ni((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Ss=$r((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),qr(e,mr(t,1),[])})),Es=ut||function(){return ht.Date.now()};function Ms(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Ki(e,o,n,n,n,n,t)}function Ts(e,t){var i;if("function"!=typeof t)throw new Te(r);return e=mo(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Ns=$r((function(e,t,n){var r=1;if(n.length){var i=on(n,aa(Ns));r|=s}return Ki(e,r,t,n,i)})),As=$r((function(e,t,n){var r=3;if(n.length){var i=on(n,aa(As));r|=s}return Ki(t,r,e,n,i)}));function Ps(e,t,i){var a,s,o,c,l,u,h=0,d=!1,f=!1,p=!0;if("function"!=typeof e)throw new Te(r);function m(t){var r=a,i=s;return a=s=n,h=t,c=e.apply(i,r)}function g(e){var r=e-u;return u===n||r>=t||r<0||f&&e-h>=o}function v(){var e=Es();if(g(e))return y(e);l=Ta(v,function(e){var n=t-(e-u);return f?vn(n,o-(e-h)):n}(e))}function y(e){return l=n,p&&a?m(e):(a=s=n,c)}function b(){var e=Es(),r=g(e);if(a=arguments,s=this,u=e,r){if(l===n)return function(e){return h=e,l=Ta(v,t),d?m(e):c}(u);if(f)return _i(l),l=Ta(v,t),m(u)}return l===n&&(l=Ta(v,t)),c}return t=vo(t)||0,eo(i)&&(d=!!i.leading,o=(f="maxWait"in i)?gn(vo(i.maxWait)||0,t):o,p="trailing"in i?!!i.trailing:p),b.cancel=function(){l!==n&&_i(l),h=0,a=u=s=l=n},b.flush=function(){return l===n?c:y(Es())},b}var Is=$r((function(e,t){return cr(e,1,t)})),Ds=$r((function(e,t,n){return cr(e,vo(t)||0,n)}));function Bs(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Te(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var s=e.apply(this,r);return n.cache=a.set(i,s)||a,s};return n.cache=new(Bs.Cache||Gn),n}function Os(e){if("function"!=typeof e)throw new Te(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Bs.Cache=Gn;var Ls=yi((function(e,t){var n=(t=1==t.length&&Us(t[0])?Pt(t[0],Kt(sa())):Pt(mr(t,1),Kt(sa()))).length;return $r((function(r){for(var i=-1,a=vn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return kt(e,this,r)}))})),Vs=$r((function(e,t){var r=on(t,aa(Vs));return Ki(e,s,n,t,r)})),Rs=$r((function(e,t){var r=on(t,aa(Rs));return Ki(e,64,n,t,r)})),Fs=ea((function(e,t){return Ki(e,c,n,n,n,t)}));function zs(e,t){return e===t||e!=e&&t!=t}var js=Ui(Cr),qs=Ui((function(e,t){return e>=t})),Hs=Nr(function(){return arguments}())?Nr:function(e){return to(e)&&Be.call(e,"callee")&&!Ye.call(e,"callee")},Us=_e.isArray,Gs=vt?Kt(vt):function(e){return to(e)&&kr(e)==A};function Ws(e){return null!=e&&Js(e.length)&&!Xs(e)}function Ys(e){return to(e)&&Ws(e)}var $s=Lt||vc,Ks=yt?Kt(yt):function(e){return to(e)&&kr(e)==v};function Qs(e){if(!to(e))return!1;var t=kr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!io(e)}function Xs(e){if(!eo(e))return!1;var t=kr(e);return t==b||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zs(e){return"number"==typeof e&&e==mo(e)}function Js(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function eo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function to(e){return null!=e&&"object"==typeof e}var no=bt?Kt(bt):function(e){return to(e)&&da(e)==w};function ro(e){return"number"==typeof e||to(e)&&kr(e)==x}function io(e){if(!to(e)||kr(e)!=k)return!1;var t=Ge(e);if(null===t)return!0;var n=Be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==Re}var ao=_t?Kt(_t):function(e){return to(e)&&kr(e)==S},so=wt?Kt(wt):function(e){return to(e)&&da(e)==E};function oo(e){return"string"==typeof e||!Us(e)&&to(e)&&kr(e)==M}function co(e){return"symbol"==typeof e||to(e)&&kr(e)==T}var lo=xt?Kt(xt):function(e){return to(e)&&Js(e.length)&&!!it[kr(e)]},uo=Ui(Lr),ho=Ui((function(e,t){return e<=t}));function fo(e){if(!e)return[];if(Ws(e))return oo(e)?un(e):Mi(e);if(Ze&&e[Ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ze]());var t=da(e);return(t==w?an:t==E?cn:jo)(e)}function po(e){return e?(e=vo(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function mo(e){var t=po(e),n=t%1;return t==t?n?t-n:t:0}function go(e){return e?ar(mo(e),0,d):0}function vo(e){if("number"==typeof e)return e;if(co(e))return h;if(eo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=eo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$t(e);var n=fe.test(e);return n||me.test(e)?ct(e.slice(2),n?2:8):de.test(e)?h:+e}function yo(e){return Ti(e,Do(e))}function bo(e){return null==e?"":oi(e)}var _o=Ai((function(e,t){if(wa(t)||Ws(t))Ti(t,Io(t),e);else for(var n in t)Be.call(t,n)&&Jn(e,n,t[n])})),wo=Ai((function(e,t){Ti(t,Do(t),e)})),xo=Ai((function(e,t,n,r){Ti(t,Do(t),e,r)})),ko=Ai((function(e,t,n,r){Ti(t,Io(t),e,r)})),Co=ea(ir),So=$r((function(e,t){e=Se(e);var r=-1,i=t.length,a=i>2?t[2]:n;for(a&&va(t[0],t[1],a)&&(i=1);++r<i;)for(var s=t[r],o=Do(s),c=-1,l=o.length;++c<l;){var u=o[c],h=e[u];(h===n||zs(h,Pe[u])&&!Be.call(e,u))&&(e[u]=s[u])}return e})),Eo=$r((function(e){return e.push(n,Xi),kt(Oo,n,e)}));function Mo(e,t,r){var i=null==e?n:wr(e,t);return i===n?r:i}function To(e,t){return null!=e&&fa(e,t,Er)}var No=Fi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ve.call(t)),e[t]=n}),tc(ic)),Ao=Fi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ve.call(t)),Be.call(e,t)?e[t].push(n):e[t]=[n]}),sa),Po=$r(Tr);function Io(e){return Ws(e)?$n(e):Br(e)}function Do(e){return Ws(e)?$n(e,!0):Or(e)}var Bo=Ai((function(e,t,n){zr(e,t,n)})),Oo=Ai((function(e,t,n,r){zr(e,t,n,r)})),Lo=ea((function(e,t){var n={};if(null==e)return n;var r=!1;t=Pt(t,(function(t){return t=vi(t,e),r||(r=t.length>1),t})),Ti(e,na(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Vo=ea((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return To(e,n)}))}(e,t)}));function Ro(e,t){if(null==e)return{};var n=Pt(na(e),(function(e){return[e]}));return t=sa(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Fo=$i(Io),zo=$i(Do);function jo(e){return null==e?[]:Qt(e,Io(e))}var qo=Bi((function(e,t,n){return t=t.toLowerCase(),e+(n?Ho(t):t)}));function Ho(e){return Xo(bo(e).toLowerCase())}function Uo(e){return(e=bo(e))&&e.replace(ve,en).replace(Xe,"")}var Go=Bi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Wo=Bi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Yo=Di("toLowerCase"),$o=Bi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ko=Bi((function(e,t,n){return e+(n?" ":"")+Xo(t)})),Qo=Bi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xo=Di("toUpperCase");function Zo(e,t,r){return e=bo(e),(t=r?n:t)===n?function(e){return tt.test(e)}(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.match(oe)||[]}(e):e.match(t)||[]}var Jo=$r((function(e,t){try{return kt(e,n,t)}catch(r){return Qs(r)?r:new xe(r)}})),ec=ea((function(e,t){return St(t,(function(t){t=Va(t),rr(e,t,Ns(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=Vi(),rc=Vi(!0);function ic(e){return e}function ac(e){return Dr("function"==typeof e?e:sr(e,1))}var sc=$r((function(e,t){return function(n){return Tr(n,e,t)}})),oc=$r((function(e,t){return function(n){return Tr(e,n,t)}}));function cc(e,t,n){var r=Io(t),i=_r(t,r);null!=n||eo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,Io(t)));var a=!(eo(n)&&"chain"in n&&!n.chain),s=Xs(e);return St(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,It([this.value()],arguments))})})),e}function lc(){}var uc=ji(Pt),hc=ji(Mt),dc=ji(Ot);function fc(e){return ya(e)?Ht(Va(e)):function(e){return function(t){return wr(t,e)}}(e)}var pc=Hi(),mc=Hi(!0);function gc(){return[]}function vc(){return!1}var yc,bc=zi((function(e,t){return e+t}),0),_c=Wi("ceil"),wc=zi((function(e,t){return e/t}),1),xc=Wi("floor"),kc=zi((function(e,t){return e*t}),1),Cc=Wi("round"),Sc=zi((function(e,t){return e-t}),0);return Rn.after=function(e,t){if("function"!=typeof t)throw new Te(r);return e=mo(e),function(){if(--e<1)return t.apply(this,arguments)}},Rn.ary=Ms,Rn.assign=_o,Rn.assignIn=wo,Rn.assignInWith=xo,Rn.assignWith=ko,Rn.at=Co,Rn.before=Ts,Rn.bind=Ns,Rn.bindAll=ec,Rn.bindKey=As,Rn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(e)?e:[e]},Rn.chain=ds,Rn.chunk=function(e,t,r){t=(r?va(e,t,r):t===n)?1:gn(mo(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,o=_e(ft(i/t));a<i;)o[s++]=ti(e,a,a+=t);return o},Rn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Rn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=_e(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return It(Us(n)?Mi(n):[n],mr(t,1))},Rn.cond=function(e){var t=null==e?0:e.length,n=sa();return e=t?Pt(e,(function(e){if("function"!=typeof e[1])throw new Te(r);return[n(e[0]),e[1]]})):[],$r((function(n){for(var r=-1;++r<t;){var i=e[r];if(kt(i[0],this,n))return kt(i[1],this,n)}}))},Rn.conforms=function(e){return function(e){var t=Io(e);return function(n){return or(n,e,t)}}(sr(e,1))},Rn.constant=tc,Rn.countBy=ms,Rn.create=function(e,t){var n=Fn(e);return null==t?n:nr(n,t)},Rn.curry=function e(t,r,i){var a=Ki(t,8,n,n,n,n,n,r=i?n:r);return a.placeholder=e.placeholder,a},Rn.curryRight=function e(t,r,i){var a=Ki(t,16,n,n,n,n,n,r=i?n:r);return a.placeholder=e.placeholder,a},Rn.debounce=Ps,Rn.defaults=So,Rn.defaultsDeep=Eo,Rn.defer=Is,Rn.delay=Ds,Rn.difference=za,Rn.differenceBy=ja,Rn.differenceWith=qa,Rn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=r||t===n?1:mo(t))<0?0:t,i):[]},Rn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,0,(t=i-(t=r||t===n?1:mo(t)))<0?0:t):[]},Rn.dropRightWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!0,!0):[]},Rn.dropWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!0):[]},Rn.fill=function(e,t,r,i){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&va(e,t,r)&&(r=0,i=a),function(e,t,r,i){var a=e.length;for((r=mo(r))<0&&(r=-r>a?0:a+r),(i=i===n||i>a?a:mo(i))<0&&(i+=a),i=r>i?0:go(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Rn.filter=function(e,t){return(Us(e)?Tt:pr)(e,sa(t,3))},Rn.flatMap=function(e,t){return mr(ks(e,t),1)},Rn.flatMapDeep=function(e,t){return mr(ks(e,t),l)},Rn.flatMapDepth=function(e,t,r){return r=r===n?1:mo(r),mr(ks(e,t),r)},Rn.flatten=Ga,Rn.flattenDeep=function(e){return null!=e&&e.length?mr(e,l):[]},Rn.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===n?1:mo(t)):[]},Rn.flip=function(e){return Ki(e,512)},Rn.flow=nc,Rn.flowRight=rc,Rn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Rn.functions=function(e){return null==e?[]:_r(e,Io(e))},Rn.functionsIn=function(e){return null==e?[]:_r(e,Do(e))},Rn.groupBy=_s,Rn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Rn.intersection=Ya,Rn.intersectionBy=$a,Rn.intersectionWith=Ka,Rn.invert=No,Rn.invertBy=Ao,Rn.invokeMap=ws,Rn.iteratee=ac,Rn.keyBy=xs,Rn.keys=Io,Rn.keysIn=Do,Rn.map=ks,Rn.mapKeys=function(e,t){var n={};return t=sa(t,3),yr(e,(function(e,r,i){rr(n,t(e,r,i),e)})),n},Rn.mapValues=function(e,t){var n={};return t=sa(t,3),yr(e,(function(e,r,i){rr(n,r,t(e,r,i))})),n},Rn.matches=function(e){return Rr(sr(e,1))},Rn.matchesProperty=function(e,t){return Fr(e,sr(t,1))},Rn.memoize=Bs,Rn.merge=Bo,Rn.mergeWith=Oo,Rn.method=sc,Rn.methodOf=oc,Rn.mixin=cc,Rn.negate=Os,Rn.nthArg=function(e){return e=mo(e),$r((function(t){return jr(t,e)}))},Rn.omit=Lo,Rn.omitBy=function(e,t){return Ro(e,Os(sa(t)))},Rn.once=function(e){return Ts(2,e)},Rn.orderBy=function(e,t,r,i){return null==e?[]:(Us(t)||(t=null==t?[]:[t]),Us(r=i?n:r)||(r=null==r?[]:[r]),qr(e,t,r))},Rn.over=uc,Rn.overArgs=Ls,Rn.overEvery=hc,Rn.overSome=dc,Rn.partial=Vs,Rn.partialRight=Rs,Rn.partition=Cs,Rn.pick=Vo,Rn.pickBy=Ro,Rn.property=fc,Rn.propertyOf=function(e){return function(t){return null==e?n:wr(e,t)}},Rn.pull=Xa,Rn.pullAll=Za,Rn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ur(e,t,sa(n,2)):e},Rn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Ur(e,t,n,r):e},Rn.pullAt=Ja,Rn.range=pc,Rn.rangeRight=mc,Rn.rearg=Fs,Rn.reject=function(e,t){return(Us(e)?Tt:pr)(e,Os(sa(t,3)))},Rn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=sa(t,3);++r<a;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return Gr(e,i),n},Rn.rest=function(e,t){if("function"!=typeof e)throw new Te(r);return $r(e,t=t===n?t:mo(t))},Rn.reverse=es,Rn.sampleSize=function(e,t,r){return t=(r?va(e,t,r):t===n)?1:mo(t),(Us(e)?Qn:Qr)(e,t)},Rn.set=function(e,t,n){return null==e?e:Xr(e,t,n)},Rn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Xr(e,t,r,i)},Rn.shuffle=function(e){return(Us(e)?Xn:ei)(e)},Rn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&va(e,t,r)?(t=0,r=i):(t=null==t?0:mo(t),r=r===n?i:mo(r)),ti(e,t,r)):[]},Rn.sortBy=Ss,Rn.sortedUniq=function(e){return e&&e.length?ai(e):[]},Rn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,sa(t,2)):[]},Rn.split=function(e,t,r){return r&&"number"!=typeof r&&va(e,t,r)&&(t=r=n),(r=r===n?d:r>>>0)?(e=bo(e))&&("string"==typeof t||null!=t&&!ao(t))&&!(t=oi(t))&&rn(e)?bi(un(e),0,r):e.split(t,r):[]},Rn.spread=function(e,t){if("function"!=typeof e)throw new Te(r);return t=null==t?0:gn(mo(t),0),$r((function(n){var r=n[t],i=bi(n,0,t);return r&&It(i,r),kt(e,this,i)}))},Rn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Rn.take=function(e,t,r){return e&&e.length?ti(e,0,(t=r||t===n?1:mo(t))<0?0:t):[]},Rn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=i-(t=r||t===n?1:mo(t)))<0?0:t,i):[]},Rn.takeRightWhile=function(e,t){return e&&e.length?hi(e,sa(t,3),!1,!0):[]},Rn.takeWhile=function(e,t){return e&&e.length?hi(e,sa(t,3)):[]},Rn.tap=function(e,t){return t(e),e},Rn.throttle=function(e,t,n){var i=!0,a=!0;if("function"!=typeof e)throw new Te(r);return eo(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Ps(e,t,{leading:i,maxWait:t,trailing:a})},Rn.thru=fs,Rn.toArray=fo,Rn.toPairs=Fo,Rn.toPairsIn=zo,Rn.toPath=function(e){return Us(e)?Pt(e,Va):co(e)?[e]:Mi(La(bo(e)))},Rn.toPlainObject=yo,Rn.transform=function(e,t,n){var r=Us(e),i=r||$s(e)||lo(e);if(t=sa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:eo(e)&&Xs(a)?Fn(Ge(e)):{}}return(i?St:yr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Rn.unary=function(e){return Ms(e,1)},Rn.union=ts,Rn.unionBy=ns,Rn.unionWith=rs,Rn.uniq=function(e){return e&&e.length?ci(e):[]},Rn.uniqBy=function(e,t){return e&&e.length?ci(e,sa(t,2)):[]},Rn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ci(e,n,t):[]},Rn.unset=function(e,t){return null==e||li(e,t)},Rn.unzip=is,Rn.unzipWith=as,Rn.update=function(e,t,n){return null==e?e:ui(e,t,gi(n))},Rn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:ui(e,t,gi(r),i)},Rn.values=jo,Rn.valuesIn=function(e){return null==e?[]:Qt(e,Do(e))},Rn.without=ss,Rn.words=Zo,Rn.wrap=function(e,t){return Vs(gi(t),e)},Rn.xor=os,Rn.xorBy=cs,Rn.xorWith=ls,Rn.zip=us,Rn.zipObject=function(e,t){return pi(e||[],t||[],Jn)},Rn.zipObjectDeep=function(e,t){return pi(e||[],t||[],Xr)},Rn.zipWith=hs,Rn.entries=Fo,Rn.entriesIn=zo,Rn.extend=wo,Rn.extendWith=xo,cc(Rn,Rn),Rn.add=bc,Rn.attempt=Jo,Rn.camelCase=qo,Rn.capitalize=Ho,Rn.ceil=_c,Rn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=vo(r))==r?r:0),t!==n&&(t=(t=vo(t))==t?t:0),ar(vo(e),t,r)},Rn.clone=function(e){return sr(e,4)},Rn.cloneDeep=function(e){return sr(e,5)},Rn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:n)},Rn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:n)},Rn.conformsTo=function(e,t){return null==t||or(e,t,Io(t))},Rn.deburr=Uo,Rn.defaultTo=function(e,t){return null==e||e!=e?t:e},Rn.divide=wc,Rn.endsWith=function(e,t,r){e=bo(e),t=oi(t);var i=e.length,a=r=r===n?i:ar(mo(r),0,i);return(r-=t.length)>=0&&e.slice(r,a)==t},Rn.eq=zs,Rn.escape=function(e){return(e=bo(e))&&Y.test(e)?e.replace(G,tn):e},Rn.escapeRegExp=function(e){return(e=bo(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Rn.every=function(e,t,r){var i=Us(e)?Mt:dr;return r&&va(e,t,r)&&(t=n),i(e,sa(t,3))},Rn.find=gs,Rn.findIndex=Ha,Rn.findKey=function(e,t){return Vt(e,sa(t,3),yr)},Rn.findLast=vs,Rn.findLastIndex=Ua,Rn.findLastKey=function(e,t){return Vt(e,sa(t,3),br)},Rn.floor=xc,Rn.forEach=ys,Rn.forEachRight=bs,Rn.forIn=function(e,t){return null==e?e:gr(e,sa(t,3),Do)},Rn.forInRight=function(e,t){return null==e?e:vr(e,sa(t,3),Do)},Rn.forOwn=function(e,t){return e&&yr(e,sa(t,3))},Rn.forOwnRight=function(e,t){return e&&br(e,sa(t,3))},Rn.get=Mo,Rn.gt=js,Rn.gte=qs,Rn.has=function(e,t){return null!=e&&fa(e,t,Sr)},Rn.hasIn=To,Rn.head=Wa,Rn.identity=ic,Rn.includes=function(e,t,n,r){e=Ws(e)?e:jo(e),n=n&&!r?mo(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),oo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ft(e,t,n)>-1},Rn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:mo(n);return i<0&&(i=gn(r+i,0)),Ft(e,t,i)},Rn.inRange=function(e,t,r){return t=po(t),r===n?(r=t,t=0):r=po(r),function(e,t,n){return e>=vn(t,n)&&e<gn(t,n)}(e=vo(e),t,r)},Rn.invoke=Po,Rn.isArguments=Hs,Rn.isArray=Us,Rn.isArrayBuffer=Gs,Rn.isArrayLike=Ws,Rn.isArrayLikeObject=Ys,Rn.isBoolean=function(e){return!0===e||!1===e||to(e)&&kr(e)==g},Rn.isBuffer=$s,Rn.isDate=Ks,Rn.isElement=function(e){return to(e)&&1===e.nodeType&&!io(e)},Rn.isEmpty=function(e){if(null==e)return!0;if(Ws(e)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||$s(e)||lo(e)||Hs(e)))return!e.length;var t=da(e);if(t==w||t==E)return!e.size;if(wa(e))return!Br(e).length;for(var n in e)if(Be.call(e,n))return!1;return!0},Rn.isEqual=function(e,t){return Ar(e,t)},Rn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Ar(e,t,n,r):!!i},Rn.isError=Qs,Rn.isFinite=function(e){return"number"==typeof e&&Ut(e)},Rn.isFunction=Xs,Rn.isInteger=Zs,Rn.isLength=Js,Rn.isMap=no,Rn.isMatch=function(e,t){return e===t||Pr(e,t,ca(t))},Rn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Pr(e,t,ca(t),r)},Rn.isNaN=function(e){return ro(e)&&e!=+e},Rn.isNative=function(e){if(_a(e))throw new xe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ir(e)},Rn.isNil=function(e){return null==e},Rn.isNull=function(e){return null===e},Rn.isNumber=ro,Rn.isObject=eo,Rn.isObjectLike=to,Rn.isPlainObject=io,Rn.isRegExp=ao,Rn.isSafeInteger=function(e){return Zs(e)&&e>=-9007199254740991&&e<=u},Rn.isSet=so,Rn.isString=oo,Rn.isSymbol=co,Rn.isTypedArray=lo,Rn.isUndefined=function(e){return e===n},Rn.isWeakMap=function(e){return to(e)&&da(e)==N},Rn.isWeakSet=function(e){return to(e)&&"[object WeakSet]"==kr(e)},Rn.join=function(e,t){return null==e?"":pn.call(e,t)},Rn.kebabCase=Go,Rn.last=Qa,Rn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var a=i;return r!==n&&(a=(a=mo(r))<0?gn(i+a,0):vn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):Rt(e,jt,a,!0)},Rn.lowerCase=Wo,Rn.lowerFirst=Yo,Rn.lt=uo,Rn.lte=ho,Rn.max=function(e){return e&&e.length?fr(e,ic,Cr):n},Rn.maxBy=function(e,t){return e&&e.length?fr(e,sa(t,2),Cr):n},Rn.mean=function(e){return qt(e,ic)},Rn.meanBy=function(e,t){return qt(e,sa(t,2))},Rn.min=function(e){return e&&e.length?fr(e,ic,Lr):n},Rn.minBy=function(e,t){return e&&e.length?fr(e,sa(t,2),Lr):n},Rn.stubArray=gc,Rn.stubFalse=vc,Rn.stubObject=function(){return{}},Rn.stubString=function(){return""},Rn.stubTrue=function(){return!0},Rn.multiply=kc,Rn.nth=function(e,t){return e&&e.length?jr(e,mo(t)):n},Rn.noConflict=function(){return ht._===this&&(ht._=Fe),this},Rn.noop=lc,Rn.now=Es,Rn.pad=function(e,t,n){e=bo(e);var r=(t=mo(t))?ln(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return qi(mt(i),n)+e+qi(ft(i),n)},Rn.padEnd=function(e,t,n){e=bo(e);var r=(t=mo(t))?ln(e):0;return t&&r<t?e+qi(t-r,n):e},Rn.padStart=function(e,t,n){e=bo(e);var r=(t=mo(t))?ln(e):0;return t&&r<t?qi(t-r,n)+e:e},Rn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),bn(bo(e).replace(ne,""),t||0)},Rn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&va(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=po(e),t===n?(t=e,e=0):t=po(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var a=_n();return vn(e+a*(t-e+ot("1e-"+((a+"").length-1))),t)}return Wr(e,t)},Rn.reduce=function(e,t,n){var r=Us(e)?Dt:Gt,i=arguments.length<3;return r(e,sa(t,4),n,i,ur)},Rn.reduceRight=function(e,t,n){var r=Us(e)?Bt:Gt,i=arguments.length<3;return r(e,sa(t,4),n,i,hr)},Rn.repeat=function(e,t,r){return t=(r?va(e,t,r):t===n)?1:mo(t),Yr(bo(e),t)},Rn.replace=function(){var e=arguments,t=bo(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Rn.result=function(e,t,r){var i=-1,a=(t=vi(t,e)).length;for(a||(a=1,e=n);++i<a;){var s=null==e?n:e[Va(t[i])];s===n&&(i=a,s=r),e=Xs(s)?s.call(e):s}return e},Rn.round=Cc,Rn.runInContext=e,Rn.sample=function(e){return(Us(e)?Kn:Kr)(e)},Rn.size=function(e){if(null==e)return 0;if(Ws(e))return oo(e)?ln(e):e.length;var t=da(e);return t==w||t==E?e.size:Br(e).length},Rn.snakeCase=$o,Rn.some=function(e,t,r){var i=Us(e)?Ot:ni;return r&&va(e,t,r)&&(t=n),i(e,sa(t,3))},Rn.sortedIndex=function(e,t){return ri(e,t)},Rn.sortedIndexBy=function(e,t,n){return ii(e,t,sa(n,2))},Rn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&zs(e[r],t))return r}return-1},Rn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Rn.sortedLastIndexBy=function(e,t,n){return ii(e,t,sa(n,2),!0)},Rn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(zs(e[n],t))return n}return-1},Rn.startCase=Ko,Rn.startsWith=function(e,t,n){return e=bo(e),n=null==n?0:ar(mo(n),0,e.length),t=oi(t),e.slice(n,n+t.length)==t},Rn.subtract=Sc,Rn.sum=function(e){return e&&e.length?Wt(e,ic):0},Rn.sumBy=function(e,t){return e&&e.length?Wt(e,sa(t,2)):0},Rn.template=function(e,t,r){var i=Rn.templateSettings;r&&va(e,t,r)&&(t=n),e=bo(e),t=xo({},t,i,Qi);var a,s,o=xo({},t.imports,i.imports,Qi),c=Io(o),l=Qt(o,c),u=0,h=t.interpolate||ye,d="__p += '",f=Ee((t.escape||ye).source+"|"+h.source+"|"+(h===Q?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),p="//# sourceURL="+(Be.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rt+"]")+"\n";e.replace(f,(function(t,n,r,i,o,c){return r||(r=i),d+=e.slice(u,c).replace(be,nn),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),o&&(s=!0,d+="';\n"+o+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+t.length,t})),d+="';\n";var m=Be.call(t,"variable")&&t.variable;if(m){if(ce.test(m))throw new xe("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(s?d.replace(j,""):d).replace(q,"$1").replace(H,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Jo((function(){return ke(c,p+"return "+d).apply(n,l)}));if(g.source=d,Qs(g))throw g;return g},Rn.times=function(e,t){if((e=mo(e))<1||e>u)return[];var n=d,r=vn(e,d);t=sa(t),e-=d;for(var i=Yt(r,t);++n<e;)t(n);return i},Rn.toFinite=po,Rn.toInteger=mo,Rn.toLength=go,Rn.toLower=function(e){return bo(e).toLowerCase()},Rn.toNumber=vo,Rn.toSafeInteger=function(e){return e?ar(mo(e),-9007199254740991,u):0===e?e:0},Rn.toString=bo,Rn.toUpper=function(e){return bo(e).toUpperCase()},Rn.trim=function(e,t,r){if((e=bo(e))&&(r||t===n))return $t(e);if(!e||!(t=oi(t)))return e;var i=un(e),a=un(t);return bi(i,Zt(i,a),Jt(i,a)+1).join("")},Rn.trimEnd=function(e,t,r){if((e=bo(e))&&(r||t===n))return e.slice(0,hn(e)+1);if(!e||!(t=oi(t)))return e;var i=un(e);return bi(i,0,Jt(i,un(t))+1).join("")},Rn.trimStart=function(e,t,r){if((e=bo(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=oi(t)))return e;var i=un(e);return bi(i,Zt(i,un(t))).join("")},Rn.truncate=function(e,t){var r=30,i="...";if(eo(t)){var a="separator"in t?t.separator:a;r="length"in t?mo(t.length):r,i="omission"in t?oi(t.omission):i}var s=(e=bo(e)).length;if(rn(e)){var o=un(e);s=o.length}if(r>=s)return e;var c=r-ln(i);if(c<1)return i;var l=o?bi(o,0,c).join(""):e.slice(0,c);if(a===n)return l+i;if(o&&(c+=l.length-c),ao(a)){if(e.slice(c).search(a)){var u,h=l;for(a.global||(a=Ee(a.source,bo(he.exec(a))+"g")),a.lastIndex=0;u=a.exec(h);)var d=u.index;l=l.slice(0,d===n?c:d)}}else if(e.indexOf(oi(a),c)!=c){var f=l.lastIndexOf(a);f>-1&&(l=l.slice(0,f))}return l+i},Rn.unescape=function(e){return(e=bo(e))&&W.test(e)?e.replace(U,dn):e},Rn.uniqueId=function(e){var t=++Oe;return bo(e)+t},Rn.upperCase=Qo,Rn.upperFirst=Xo,Rn.each=ys,Rn.eachRight=bs,Rn.first=Wa,cc(Rn,(yc={},yr(Rn,(function(e,t){Be.call(Rn.prototype,t)||(yc[t]=e)})),yc),{chain:!1}),Rn.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Rn[e].placeholder=Rn})),St(["drop","take"],(function(e,t){qn.prototype[e]=function(r){r=r===n?1:gn(mo(r),0);var i=this.__filtered__&&!t?new qn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(r,i.__takeCount__):i.__views__.push({size:vn(r,d),type:e+(i.__dir__<0?"Right":"")}),i},qn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;qn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:sa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");qn.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");qn.prototype[e]=function(){return this.__filtered__?new qn(this):this[n](1)}})),qn.prototype.compact=function(){return this.filter(ic)},qn.prototype.find=function(e){return this.filter(e).head()},qn.prototype.findLast=function(e){return this.reverse().find(e)},qn.prototype.invokeMap=$r((function(e,t){return"function"==typeof e?new qn(this):this.map((function(n){return Tr(n,e,t)}))})),qn.prototype.reject=function(e){return this.filter(Os(sa(e)))},qn.prototype.slice=function(e,t){e=mo(e);var r=this;return r.__filtered__&&(e>0||t<0)?new qn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=mo(t))<0?r.dropRight(-t):r.take(t-e)),r)},qn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},qn.prototype.toArray=function(){return this.take(d)},yr(qn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=Rn[i?"take"+("last"==t?"Right":""):t],s=i||/^find/.test(t);a&&(Rn.prototype[t]=function(){var t=this.__wrapped__,o=i?[1]:arguments,c=t instanceof qn,l=o[0],u=c||Us(t),h=function(e){var t=a.apply(Rn,It([e],o));return i&&d?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var d=this.__chain__,f=!!this.__actions__.length,p=s&&!d,m=c&&!f;if(!s&&u){t=m?t:new qn(this);var g=e.apply(t,o);return g.__actions__.push({func:fs,args:[h],thisArg:n}),new jn(g,d)}return p&&m?e.apply(this,o):(g=this.thru(h),p?i?g.value()[0]:g.value():g)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ne[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Rn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Us(i)?i:[],e)}return this[n]((function(n){return t.apply(Us(n)?n:[],e)}))}})),yr(qn.prototype,(function(e,t){var n=Rn[t];if(n){var r=n.name+"";Be.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[Ri(n,2).name]=[{name:"wrapper",func:n}],qn.prototype.clone=function(){var e=new qn(this.__wrapped__);return e.__actions__=Mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Mi(this.__views__),e},qn.prototype.reverse=function(){if(this.__filtered__){var e=new qn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},qn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Us(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],s=a.size;switch(a.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=vn(t,e+s);break;case"takeRight":e=gn(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=a.start,o=a.end,c=o-s,l=r?o:s-1,u=this.__iteratees__,h=u.length,d=0,f=vn(c,this.__takeCount__);if(!n||!r&&i==c&&f==c)return di(e,this.__actions__);var p=[];e:for(;c--&&d<f;){for(var m=-1,g=e[l+=t];++m<h;){var v=u[m],y=v.iteratee,b=v.type,_=y(g);if(2==b)g=_;else if(!_){if(1==b)continue e;break e}}p[d++]=g}return p},Rn.prototype.at=ps,Rn.prototype.chain=function(){return ds(this)},Rn.prototype.commit=function(){return new jn(this.value(),this.__chain__)},Rn.prototype.next=function(){this.__values__===n&&(this.__values__=fo(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Rn.prototype.plant=function(e){for(var t,r=this;r instanceof zn;){var i=Fa(r);i.__index__=0,i.__values__=n,t?a.__wrapped__=i:t=i;var a=i;r=r.__wrapped__}return a.__wrapped__=e,t},Rn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof qn){var t=e;return this.__actions__.length&&(t=new qn(this)),(t=t.reverse()).__actions__.push({func:fs,args:[es],thisArg:n}),new jn(t,this.__chain__)}return this.thru(es)},Rn.prototype.toJSON=Rn.prototype.valueOf=Rn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Rn.prototype.first=Rn.prototype.head,Ze&&(Rn.prototype[Ze]=function(){return this}),Rn}();ft?((ft.exports=fn)._=fn,dt._=fn):ht._=fn}).call(eb)}(Jy,Jy.exports)),Jy.exports);const nb=Xy(tb),rb={status:r.Status.ok,msg:""};function ib(e){const t={status:r.Status.error,msg:"This input must be a number"};return function(e){return!isNaN(e-parseFloat(e))}(e)?rb:t}function ab(e){const t={status:r.Status.error,msg:"This input must be an integer (..., -2, -1, 0, 1, 2, ...)."};return ib(e).status===r.Status.error?ib(e):function(e){return/^[+,-]?\s?\d+$/.test(e)}(e)?rb:t}const sb=o.defineStore("fieldStore",{state:()=>({dataShape:null,inputs:{},mediaInputs:{},inputIsValid:!1,validation:{},convertedInput:{},previewInput:{}}),getters:{isValidated(){return this.inputIsValid},getPreview:e=>e.inputIsValid?e.previewInput:{},getConverted:e=>e.inputIsValid?e.convertedInput:{}},actions:{$reset(){console.log("[FieldInputStore].reset()"),this.inputs={},this.mediaInputs={},this.validation={},this.convertedInput={},this.previewInput={},this.inputIsValid=!1;for(let e=1;e<=10;e++){const t=`audio-${e}`,n=`image-${e}`;delete this.mediaInputs[t],delete this.mediaInputs[n]}},setFieldValue(e,t){this.inputs[e]=t,this.validate(),this.convert()},setMedia(e,t){console.log(`[FieldInputStore].setMedia: ${e}`),this.mediaInputs[e]=t,this.convert()},validate(){if(this.validation={},null!==this.dataShape){this.inputIsValid=!0;for(const e of this.dataShape.fields)if(e.validator){e.validator.test(this.inputs[e.name]).status===r.Status.ok?this.validation[e.name]=!0:(this.inputIsValid=!1,this.validation[e.name]=!1)}}else this.inputIsValid=!1},convert(){this.convertedInput={},this.dataShape?.fields.forEach((e=>{this.convertedInput[e.name]=r.fieldConverters[e.type].databaseConverter(this.inputs[e.name]),this.previewInput[e.name]=r.fieldConverters[e.type].previewConverter(this.inputs[e.name])}));for(let e=1;e<11;e++){const t=`audio-${e}`,n=this.mediaInputs[t];if(!n)break;this.convertedInput[t]=r.fieldConverters[r.FieldType.AUDIO].databaseConverter(n),this.previewInput[t]=r.fieldConverters[r.FieldType.AUDIO].previewConverter(n)}for(let e=1;e<11;e++){const t=`image-${e}`,n=this.mediaInputs[t];if(!n)break;this.convertedInput[t]=r.fieldConverters[r.FieldType.IMAGE].databaseConverter(n),this.previewInput[t]=r.fieldConverters[r.FieldType.IMAGE].previewConverter(n)}},clearMediaEntries(){for(let e=1;e<=10;e++)delete this.mediaInputs[`audio-${e}`],delete this.mediaInputs[`image-${e}`],delete this.convertedInput[`audio-${e}`],delete this.convertedInput[`image-${e}`],delete this.previewInput[`audio-${e}`],delete this.previewInput[`image-${e}`]},clearField(e){delete this.inputs[e],delete this.validation[e],delete this.convertedInput[e],delete this.previewInput[e]}}}),ob=t.defineComponent({name:"FieldInput",props:{autofocus:Boolean,field:{type:Object,required:!0}},setup(e){const n=sb(),i=t.ref(null),a=t.computed({get:()=>n.inputs[e.field.name],set:t=>n.setFieldValue(e.field.name,t)});t.watch(a,((t,r)=>{console.log("[FieldInput] modelValue changed:",{new:t,old:r,currentStoreValue:n.inputs[e.field.name]})}));const s=t.computed((()=>{const t=[];return e.field?.validator&&t.push(e.field.validator.test),t})),o=()=>{if(!e.field?.name)throw new Error("Field name is required for FieldInput component");return n.inputs[e.field.name]};return{inputField:i,fieldStore:n,modelValue:a,validators:s,focus:()=>{i.value&&i.value.focus()},userInput:o,clearData:()=>{if(console.log(`[FieldInput] Running generic clearData() for ${e.field?.name} in FieldInput.ts`),i.value){if(i.value.value="",!e.field?.name)return;n.clearField(e.field.name)}},setData:t=>{if(!e.field?.name)throw new Error("Field name is required for FieldInput component");n.setFieldValue(e.field.name,t)},vuetifyRules:()=>e.field?.validator?s.value.map((e=>r.validationFunctionToVuetifyRule(e))):[],generateTags:()=>(console.log("[FieldInput] Running generic generateTags() in FieldInput.ts"),e.field?.tagger?e.field.tagger(o()):[]),generateELO:()=>(console.log("[FieldInput] Running generic generateELO() in FieldInput.ts"),e.field?.generateELO?e.field.generateELO(o()):void 0)}},data:()=>({validationStatus:{status:r.Status.ok,msg:""}})}),cb=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const lb=cb(t.defineComponent({name:"IntegerInput",extends:ob,setup(e,n){const r=ob.setup?.(e,n);return{...r,validators:t.computed((()=>{const t=ob.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t?[ab,...t]:[ab]}))}}}),[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-text-field");return t.openBlock(),t.createBlock(o,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",type:"number",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const ub=cb(t.defineComponent({name:"MarkdownInput",extends:ob,setup(e,t){const n=ob.setup?.(e,t);return{...n}}}),[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-textarea");return t.openBlock(),t.createBlock(o,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}],["__scopeId","data-v-28ef24ff"]]),hb=t.defineComponent({name:"MediaDragDropUploader",extends:ob,setup(e,t){const n=ob.setup?.(e,t),{fieldStore:r}=n;return{...n,fieldStore:r}},data:()=>({isDragging:!1,mediaItems:[]}),computed:{hasMedia(){return this.mediaItems.length>0}},created(){},methods:{dragOverHandler(e){e.preventDefault()},dragEnterHandler(e){e.preventDefault(),this.isDragging=!0},dragLeaveHandler(e){e.preventDefault(),this.isDragging=!1},dropHandler(e){e.preventDefault(),this.isDragging=!1;const t=e.dataTransfer?.files;t&&this.processFiles(t)},triggerFileInput(){this.$refs.fileInput.click()},handleFileInput(e){const t=e.target.files;t&&this.processFiles(t)},processFiles(e){Array.from(e).forEach((e=>{this.addMediaItem(e)})),this.updateStore()},addMediaItem(e){const t=e.type.startsWith("image/")?"image":"audio",n={type:t,file:e,url:URL.createObjectURL(e)};"image"===t&&this.createThumbnail(e).then((e=>{n.thumbnailUrl=e,this.$nextTick((()=>{this.$forceUpdate()}))})),this.mediaItems.push(n)},createThumbnail:async e=>new Promise((t=>{const n=new FileReader;n.onload=e=>{t(e.target?.result)},n.readAsDataURL(e)})),removeMedia(e){URL.revokeObjectURL(this.mediaItems[e].url),this.mediaItems.splice(e,1),this.updateStore()},clearData(){this.mediaItems.forEach((e=>{URL.revokeObjectURL(e.url)})),this.mediaItems=[],this.updateStore()},addMoreMedia(){console.log("addMoreMedia"),this.triggerFileInput()},updateStore(){let e=0,t=0;this.mediaItems.forEach((n=>{"image"===n.type?(e++,this.fieldStore.setMedia(`image-${e}`,{content_type:n.file.type,data:n.file})):"audio"===n.type&&(t++,this.fieldStore.setMedia(`audio-${t}`,{content_type:n.file.type,data:n.file}))}))},getValidators(){return[()=>({status:this.mediaItems.length>0?r.Status.ok:r.Status.error,msg:this.mediaItems.length>0?"":"At least one media item is required"})]}}}),db={class:"mr-2 mb-2"},fb=["src"],pb=["src"];const mb=cb(hb,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-label"),c=t.resolveComponent("v-btn");return t.openBlock(),t.createElementBlock("div",db,[t.createVNode(o,{class:"text-h5"},{default:t.withCtx((()=>n[5]||(n[5]=[t.createTextVNode("Add media:")]))),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["drop-zone",{"drop-zone--over":e.isDragging}]),onDrop:n[1]||(n[1]=(...t)=>e.dropHandler&&e.dropHandler(...t)),onDragover:n[2]||(n[2]=t.withModifiers(((...t)=>e.dragOverHandler&&e.dragOverHandler(...t)),["prevent"])),onDragenter:n[3]||(n[3]=t.withModifiers(((...t)=>e.dragEnterHandler&&e.dragEnterHandler(...t)),["prevent"])),onDragleave:n[4]||(n[4]=t.withModifiers(((...t)=>e.dragLeaveHandler&&e.dragLeaveHandler(...t)),["prevent"]))},[t.createElementVNode("input",{ref:"fileInput",type:"file",accept:"image/*,audio/*",multiple:"",style:{display:"none"},onChange:n[0]||(n[0]=(...t)=>e.handleFileInput&&e.handleFileInput(...t))},null,544),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.mediaItems,((r,i)=>(t.openBlock(),t.createElementBlock("div",{key:i,class:"media-item"},["image"===r.type?(t.openBlock(),t.createElementBlock("img",{key:0,src:r.thumbnailUrl,alt:"Uploaded image thumbnail",class:"thumbnail"},null,8,fb)):"audio"===r.type?(t.openBlock(),t.createElementBlock("audio",{key:1,controls:"",src:r.url},null,8,pb)):t.createCommentVNode("",!0),t.createVNode(c,{size:"small",onClick:t=>e.removeMedia(i)},{default:t.withCtx((()=>n[6]||(n[6]=[t.createTextVNode("Remove")]))),_:2},1032,["onClick"])])))),128)),n[8]||(n[8]=t.createTextVNode(" Drop image or audio files here... ")),t.createVNode(c,{onClick:e.triggerFileInput},{default:t.withCtx((()=>n[7]||(n[7]=[t.createTextVNode("Or Click to Upload")]))),_:1},8,["onClick"])],34)])}],["__scopeId","data-v-e86645b6"]]),gb=t.defineComponent({name:"MidiInput",components:{SyllableSeqVis:ou},extends:ob,data:()=>({midi:null,recording:!1,SylSeq:Ga([]),display:!1,transpositions:!1}),async created(){try{this.midi=await Ya.instance(),this.record(),this.store[this.field.name]=this.getTransposedSeqs}catch(e){throw new Error(`MidiInput.created: ${e}`)}},methods:{record(){this.midi&&(this.midi.record(),this.midi.addNoteonListenter((e=>{this.SylSeq.append(e),this.$refs.inputVis.updateBounds()})),this.recording=!0)},getTransposedSeqs(){return this.midi?this.transpositions?[-5,-4,-3,-2,-1,0,1,2,3,4,5,6].map((e=>Ua(this.midi.recording,e))):[this.midi.recording]:[]},clearData(){this.midi&&(console.log("midiInput clearing data..."),this.midi.stopRecording(),this.midi.eraseRecording(),this.SylSeq=Ga([]),this.record(),this.recording=!0,this.store.convertedInput[this.field.name]=this.midi.recording,this.store.validation[this.field.name]=!1,this.store[this.field.name]=this.getTransposedSeqs)},hasRecording(){return this.midi?.hasRecording??!1},reset(){this.clearData()},play(){this.midi&&(this.midi.play(),this.display=!0,this.validate())}}}),vb={key:0},yb={class:"text-h5"},bb={class:"font-weight-black"};const _b=cb(gb,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("syllable-seq-vis"),c=t.resolveComponent("v-icon"),l=t.resolveComponent("v-btn"),u=t.resolveComponent("v-checkbox");return t.openBlock(),t.createElementBlock("div",null,[e.recording?(t.openBlock(),t.createElementBlock("div",vb,[t.createElementVNode("span",yb,[n[1]||(n[1]=t.createTextVNode(" Now Recording from device: ")),t.createElementVNode("span",bb,t.toDisplayString(e.midi.configuredInput),1)])])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(o,{key:1,ref:"inputVis",seq:e.SylSeq,"last-t-ssuggestion":"5000"},null,8,["seq"])),t.createVNode(l,{color:"primary",disabled:e.hasRecording(),onClick:e.play},{default:t.withCtx((()=>[n[3]||(n[3]=t.createTextVNode(" Preview ")),t.createVNode(c,{end:""},{default:t.withCtx((()=>n[2]||(n[2]=[t.createTextVNode("volume_up")]))),_:1})])),_:1},8,["disabled","onClick"]),t.createVNode(l,{color:"error",disabled:e.hasRecording(),onClick:e.reset},{default:t.withCtx((()=>[n[5]||(n[5]=t.createTextVNode(" Clear and try again ")),t.createVNode(c,{end:""},{default:t.withCtx((()=>n[4]||(n[4]=[t.createTextVNode("close")]))),_:1})])),_:1},8,["disabled","onClick"]),t.createVNode(u,{modelValue:e.transpositions,"onUpdate:modelValue":n[0]||(n[0]=t=>e.transpositions=t),label:"Include Transpositions",onClickCapture:e.reset},null,8,["modelValue","onClickCapture"])])}]]);const wb=cb(t.defineComponent({name:"NumberInput",extends:ob,setup(e,n){const r=ob.setup?.(e,n);return{...r,validators:t.computed((()=>{const t=ob.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t?[ib,...t]:[ib]}))}}}),[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-text-field");return t.openBlock(),t.createBlock(o,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",type:"number",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const xb=cb(t.defineComponent({name:"StringInput",extends:ob,setup(e,n){const r=ob.setup?.(e,n);return{...r,validators:t.computed((()=>{const t=ob.validators.call(this);return e.field.validator?.test&&t.push(e.field.validator.test),t||[]}))}}}),[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-text-field");return t.openBlock(),t.createBlock(o,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",type:"text",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),hint:e.validationStatus.msg,autofocus:e.autofocus},null,8,["modelValue","name","label","rules","hint","autofocus"])}]]);const kb=cb(t.defineComponent({name:"ChessPuzzleInput",extends:ob,setup(e,t){const n=ob.setup?.(e,t),r=()=>{if(!n)return[];console.log(`CPI.generateTags: modelValue: ${n.modelValue.value}`);const e=n.modelValue.value.split(","),t=e[7].split(" "),r=e[9].split(" ");return t.map((e=>`theme-${e}`)).concat(r.map((e=>`opening-${e}`)))};return{...n,generateELO:()=>{if(!n)return;const e=n.modelValue.value.split(","),t=parseInt(e[3]),i=parseInt(e[6]),a={global:{score:t,count:i},tags:{},misc:{}};return r().forEach((e=>{a.tags[e]={score:t,count:i}})),console.log("generateELO",JSON.stringify(a)),a},generateTags:r}}}),[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-text-field");return t.openBlock(),t.createBlock(o,{ref:"inputField",modelValue:e.modelValue,"onUpdate:modelValue":n[0]||(n[0]=t=>e.modelValue=t),variant:"filled",name:e.field.name,label:e.field.name,rules:e.vuetifyRules(),autofocus:e.autofocus},null,8,["modelValue","name","label","rules","autofocus"])}]]),Cb=o.defineStore("dataInputForm",{state:()=>({dataInputForm:{dataShape:null,course:null,shapeViews:[],fields:[],fieldStore:sb(),uploading:!1}}),actions:{setDataShape(e){this.dataInputForm.dataShape=e,this.dataInputForm.fieldStore.dataShape=e,this.dataInputForm.fieldStore.$reset()},setCourse(e){this.dataInputForm.course=e}}}),Sb=t.defineComponent({name:"DataInputForm",components:{NumberInput:wb,StringInput:xb,IntegerInput:lb,MarkdownInput:ub,MidiInput:_b,CardBrowser:n.CardBrowser,MediaDragDropUploader:mb,TagsInput:n.TagsInput,ChessPuzzleInput:kb},props:{courseCfg:{type:Object,required:!0,default:()=>({courseID:"default-test"})},dataShape:{type:Object,required:!0},previewComponent:{type:Object,required:!1,default:null}},data:()=>({tag:"",tags:[],autoCompleteSuggestions:[],timer:void 0,dataInputFormStore:Cb(),fieldInputRefs:[],courseDB:null}),computed:{ftString:()=>r.FieldType.STRING,int:()=>r.FieldType.INT,num:()=>r.FieldType.NUMBER,img:()=>r.FieldType.IMAGE,mkd:()=>r.FieldType.MARKDOWN,audio:()=>r.FieldType.AUDIO,midi:()=>r.FieldType.MIDI,uploader:()=>r.FieldType.MEDIA_UPLOADS,chessPuzzle:()=>r.FieldType.CHESS_PUZZLE,fieldInputs(){return Array.from(this.fieldInputRefs.values())},shapeViews:{get(){return this.dataInputFormStore.dataInputForm.shapeViews},set(e){this.dataInputFormStore.dataInputForm.shapeViews=e}},allowSubmit(){return this.dataInputFormStore.dataInputForm.fieldStore.isValidated},fieldStore(){return this.dataInputFormStore.dataInputForm.fieldStore},uploading:{get(){return this.dataInputFormStore.dataInputForm.uploading},set(e){this.dataInputFormStore.dataInputForm.uploading=e}},previewInput(){return this.fieldStore.getPreview},convertedInput(){return this.fieldStore.convertedInput},inputIsValidated(){return this.dataInputFormStore.dataInputForm.fieldStore.isValidated},datashapeDescriptor(){if(!this.courseCfg||!this.courseCfg.dataShapes)return{course:"",dataShape:""};for(const e of this.courseCfg.dataShapes){const t=r.NameSpacer.getDataShapeDescriptor(e.name);if(t.dataShape===this.dataShape.name)return t}return{course:"",dataShape:""}}},watch:{dataShape:{handler(){this.previewComponent||this.getImplementingViews()},immediate:!0},store:{handler(){this.convertInput()}},"dataShape.fields"(e){console.log(`[DataInputForm].watch(fields): newFields ${JSON.stringify(e)}`),console.log(`[DataInputForm].watch(fields): fields ${JSON.stringify(this.dataShape.fields)}`),this.fieldInputRefs=new Array(e.length).fill(null),console.log(`[DataInputForm].watch(fields): fieldRefs ${JSON.stringify(this.fieldInputRefs)}`)}},created(){this.uploading=!1,this.courseDB=a.getDataLayer().getCourseDB(this.courseCfg.courseID),this.getCourseTags(),this.dataInputFormStore.setDataShape(this.dataShape),console.log(`[DataInputForm].created: fields: ${JSON.stringify(this.dataShape.fields)}`),this.fieldInputRefs=new Array(this.dataShape.fields.length).fill(null),this.previewComponent&&this.getImplementingViews()},beforeUnmount(){this.fieldInputRefs=[]},methods:{async updateTags(e){console.log(`[DataInputForm] tags updated: ${JSON.stringify(e)}`),this.tags=e},setFieldInputRef(e,t){for(console.log(`[DataInputForm].setFieldInputRef: index: ${t}`),t>=this.fieldInputRefs.length&&(this.fieldInputRefs=this.fieldInputRefs.concat(new Array(t-this.fieldInputRefs.length+1).fill(null)));null===this.fieldInputRefs[this.fieldInputRefs.length-1];)this.fieldInputRefs.pop();this.fieldInputRefs[t]=e},async getCourseTags(){const e=await this.courseDB.getCourseTagStubs();this.autoCompleteSuggestions=e.rows.map((e=>e.doc.name))},expectedValidations(){return this.dataShape.fields.length},checkInput:()=>!0,convertInput(){},inputContainsTranspositionFcns(){this.convertInput();for(const e in this.convertedInput)if("function"==typeof this.convertedInput[e])return!0;return!1},objectContainsFunction(e){for(const t in e)if("function"==typeof e[t])return!0;return!1},expandO(e){let t=[];if(this.objectContainsFunction(e)){for(const n in e)if("function"==typeof e[n]){console.log(`[DataInputForm] Key ${n} is a function.`);const r=[];e[n]().forEach((t=>{let i={};i=nb.cloneDeep(e),i[n]=t,console.log(`[DataInputForm] Replaced Copy: ${JSON.stringify(i)}`),r.push(i)})),r.forEach((e=>{if(this.objectContainsFunction(e)){console.log("[DataInputForm] 2nd pass...");const n=this.expandO(e);t=t.concat(n)}else t.push(e)}))}return t}return[]},getTags(){const e=[];this.fieldInputs.forEach((t=>{if(t.generateTags){const n=t.generateTags();e.push(...n)}}));const t=this.$refs.tagsInput.tags.map((e=>e.text));return e.concat(t)},getElo(){for(const e of this.fieldInputs)if(e.generateELO)return e.generateELO()},async submit(){if(this.checkInput()){console.log(`[DataInputForm] Store: ${JSON.stringify(this.fieldStore.inputs)}`),console.log(`[DataInputForm] ConvertedStore: ${JSON.stringify(this.convertedInput)}`),this.uploading=!0;let e=[];this.inputContainsTranspositionFcns()?(console.log(`[DataInputForm] Expanded input: ${JSON.stringify(this.expandO(this.convertedInput))}`),e=this.expandO(this.convertedInput)):(console.log("[DataInputForm] No Transposition fcn detected"),e=[this.convertedInput]);const t=await Promise.all(e.map((async e=>await this.courseDB.addNote(this.datashapeDescriptor.course,this.dataShape,e,(await n.getCurrentUser()).getUsername(),this.getTags(),void 0,this.getElo()))));if(t[0].status===r.Status.ok){n.alertUser({text:"Content added... Thank you!",status:r.Status.ok});const e=this.$refs.tagsInput;e.tags.length&&(e.updateAvailableCourseTags(),e.tags=[]),this.reset()}else n.alertUser({text:"A problem occurred. Content has not been added.",status:r.Status.error}),console.error(`Error in DataInputForm.submit(). Result from addNote: ${JSON.stringify(t)}`),this.uploading=!1}},reset(){console.log("[DataInputForm].reset()"),this.uploading=!1,this.fieldInputs.forEach((e=>{e.clearData()})),this.fieldStore.$reset(),this.fieldInputs[0].focus(),this.convertInput()},getImplementingViews(){if(this.previewComponent)return console.log("[DataInputForm] Getting previewComponent views"),void(this.shapeViews=this.previewComponent.views);for(const e of this.courseCfg.dataShapes){const t=r.NameSpacer.getDataShapeDescriptor(e.name);if(console.log("[DataInputForm] descriptor",t),console.log("[DataInputForm] this.dataShape",this.dataShape),console.log("[DataInputForm] this.dataShape.name",this.dataShape.name),t.dataShape===this.dataShape.name){const n=$y.getCourse(t.course);this.shapeViews=[],n.getBaseQTypes().forEach((e=>{e.dataShapes[0].name===this.dataShape.name&&(this.shapeViews=this.shapeViews.concat(e.views))}));for(const t of e.questionTypes){const e=r.NameSpacer.getQuestionDescriptor(t);n.getQuestion(e.questionType).views.forEach((e=>{this.shapeViews=this.shapeViews.concat(e)}))}}}},isFieldInput:e=>Ky(e)}}),Eb={key:1};const Mb=cb(Sb,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("string-input"),c=t.resolveComponent("chess-puzzle-input"),l=t.resolveComponent("number-input"),u=t.resolveComponent("integer-input"),h=t.resolveComponent("markdown-input"),d=t.resolveComponent("midi-input"),f=t.resolveComponent("media-drag-drop-uploader"),p=t.resolveComponent("tags-input"),m=t.resolveComponent("v-icon"),g=t.resolveComponent("v-btn"),v=t.resolveComponent("v-form"),y=t.resolveComponent("v-col"),b=t.resolveComponent("card-browser"),_=t.resolveComponent("v-row"),w=t.resolveComponent("v-container");return t.openBlock(),t.createBlock(w,{fluid:""},{default:t.withCtx((()=>[t.createVNode(_,null,{default:t.withCtx((()=>[t.createVNode(y,{cols:"12",xl:"6"},{default:t.withCtx((()=>[t.createVNode(v,{"ma-2":"",autocomplete:"off"},{default:t.withCtx((()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.dataShape.fields,((n,r)=>(t.openBlock(),t.createElementBlock("div",{key:e.dataShape.fields.indexOf(n)},[n.type===e.ftString?(t.openBlock(),t.createBlock(o,{key:0,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r},null,8,["field","autofocus"])):n.type===e.chessPuzzle?(t.openBlock(),t.createBlock(c,{key:1,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r},null,8,["field","autofocus"])):n.type===e.num?(t.openBlock(),t.createBlock(l,{key:2,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r},null,8,["field","autofocus"])):n.type===e.int?(t.openBlock(),t.createBlock(u,{key:3,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r},null,8,["field","autofocus"])):n.type===e.mkd?(t.openBlock(),t.createBlock(h,{key:4,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r,"data-cy":"markdown-input"},null,8,["field","autofocus"])):n.type===e.midi?(t.openBlock(),t.createBlock(d,{key:5,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r},null,8,["field","autofocus"])):n.type===e.uploader?(t.openBlock(),t.createBlock(f,{key:6,ref_for:!0,ref:t=>e.setFieldInputRef(t,r),field:n,autofocus:0==r},null,8,["field","autofocus"])):t.createCommentVNode("",!0)])))),128)),t.createVNode(p,{ref:"tagsInput","hide-submit":!0,"course-i-d":e.courseCfg.courseID,"card-i-d":""},null,8,["course-i-d"]),e.previewComponent?(t.openBlock(),t.createElementBlock("div",Eb,"Input validated: "+t.toDisplayString(e.inputIsValidated),1)):(t.openBlock(),t.createBlock(g,{key:0,"data-cy":"add-card-btn",class:"float-right",type:"submit",color:"primary",loading:e.uploading,disabled:!e.allowSubmit,onClick:t.withModifiers(e.submit,["prevent"])},{default:t.withCtx((()=>[n[1]||(n[1]=t.createTextVNode(" Add card ")),t.createVNode(m,{end:""},{default:t.withCtx((()=>n[0]||(n[0]=[t.createTextVNode("mdi-plus-circle")]))),_:1})])),_:1},8,["loading","disabled","onClick"]))])),_:1})])),_:1}),t.createVNode(y,{cols:"12",xl:"6"},{default:t.withCtx((()=>[e.inputIsValidated?(t.openBlock(),t.createBlock(b,{key:0,class:"ml-4",views:e.shapeViews,data:[e.previewInput]},null,8,["views","data"])):t.createCommentVNode("",!0)])),_:1})])),_:1})])),_:1})}]]),Tb=t.defineComponent({name:"CardPreviewList",components:{CardBrowser:n.CardBrowser,SkMouseTrap:n.SkMouseTrap},props:{parsedCards:{type:Array,required:!0,default:()=>[]},dataShape:{type:Object,required:!0},viewComponents:{type:Array,required:!1,default:()=>[]}},emits:["update:parsedCards","edit-card","delete-card"],data:()=>({currentIndex:0,loading:!1,keyBindings:[],showDeleteConfirm:!1,dontAskAgain:!1,skipDeleteConfirmation:!1,shortcutsEnabled:!0}),computed:{currentCard(){return 0===this.parsedCards.length||this.currentIndex>=this.parsedCards.length?null:this.parsedCards[this.currentIndex]},currentViewData(){return this.currentCard?{Input:this.currentCard.markdown}:{Input:""}}},mounted(){this.setupKeyBindings()},beforeUnmount(){this.shortcutsEnabled&&this.keyBindings.forEach((e=>{n.SkldrMouseTrap.removeBinding(e.hotkey)}))},methods:{nextCard(){this.currentIndex<this.parsedCards.length-1&&this.currentIndex++},prevCard(){this.currentIndex>0&&this.currentIndex--},showCard(e){e>=0&&e<this.parsedCards.length&&(this.currentIndex=e)},setupKeyBindings(){this.keyBindings=[{command:"Previous Card",hotkey:"left",callback:()=>(this.prevCard(),!1)},{command:"Next Card",hotkey:"right",callback:()=>(this.nextCard(),!1)},{command:"Delete Card",hotkey:"del",callback:()=>(this.promptDelete(),!1)},{command:"Edit Card",hotkey:"e",callback:()=>(this.editCurrentCard(),!1)}],this.shortcutsEnabled&&n.SkldrMouseTrap.addBinding(this.keyBindings)},enableShortcuts(){this.shortcutsEnabled||(this.shortcutsEnabled=!0,n.SkldrMouseTrap.addBinding(this.keyBindings),console.log("[CardPreviewList] Keyboard shortcuts enabled"))},disableShortcuts(){this.shortcutsEnabled&&(this.shortcutsEnabled=!1,this.keyBindings.forEach((e=>{n.SkldrMouseTrap.removeBinding(e.hotkey)})),console.log("[CardPreviewList] Keyboard shortcuts disabled"))},toggleShortcuts(e){e?this.enableShortcuts():this.disableShortcuts()},promptDelete(){this.currentCard&&(this.skipDeleteConfirmation?this.deleteCurrentCard():this.showDeleteConfirm=!0)},cancelDelete(){this.showDeleteConfirm=!1},confirmDelete(){this.dontAskAgain&&(this.skipDeleteConfirmation=!0),this.showDeleteConfirm=!1,this.deleteCurrentCard()},deleteCurrentCard(){if(!this.currentCard)return;const e=[...this.parsedCards];e.splice(this.currentIndex,1),this.$emit("update:parsedCards",e),this.$emit("delete-card",this.currentIndex),this.currentIndex>=e.length&&e.length>0&&(this.currentIndex=e.length-1)},editCurrentCard(){this.currentCard&&this.$emit("edit-card",this.currentCard,this.currentIndex)}}}),Nb={class:"card-preview-list"},Ab={class:"d-flex align-center"},Pb={class:"text-subtitle-1 mr-2"},Ib={key:0,class:"d-flex justify-center align-center my-4"},Db={key:1},Bb={key:0},Ob={key:0},Lb={key:1},Vb={class:"markdown-content"},Rb={class:"card-metadata mt-2"},Fb={class:"d-flex flex-wrap gap-1"},zb={key:0,class:"mt-2 text-caption"},jb={key:1,class:"text-center pa-4"};const qb=cb(Tb,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-card-title"),c=t.resolveComponent("v-checkbox"),l=t.resolveComponent("v-card-text"),u=t.resolveComponent("v-spacer"),h=t.resolveComponent("v-btn"),d=t.resolveComponent("v-card-actions"),f=t.resolveComponent("v-card"),p=t.resolveComponent("v-dialog"),m=t.resolveComponent("sk-mouse-trap"),g=t.resolveComponent("v-progress-circular"),v=t.resolveComponent("card-browser"),y=t.resolveComponent("v-sheet"),b=t.resolveComponent("v-chip"),_=t.resolveComponent("v-icon");return t.openBlock(),t.createElementBlock("div",Nb,[t.createVNode(p,{modelValue:e.showDeleteConfirm,"onUpdate:modelValue":n[1]||(n[1]=t=>e.showDeleteConfirm=t),"max-width":"400px"},{default:t.withCtx((()=>[t.createVNode(f,null,{default:t.withCtx((()=>[t.createVNode(o,{class:"text-h5"},{default:t.withCtx((()=>n[2]||(n[2]=[t.createTextVNode("Remove Card")]))),_:1}),t.createVNode(l,null,{default:t.withCtx((()=>[n[3]||(n[3]=t.createElementVNode("p",null,"Are you sure you want to remove this card?",-1)),t.createVNode(c,{modelValue:e.dontAskAgain,"onUpdate:modelValue":n[0]||(n[0]=t=>e.dontAskAgain=t),label:"Don't ask me again","hide-details":"",class:"mt-2"},null,8,["modelValue"])])),_:1}),t.createVNode(d,null,{default:t.withCtx((()=>[t.createVNode(u),t.createVNode(h,{color:"grey-darken-1",variant:"text",onClick:e.cancelDelete},{default:t.withCtx((()=>n[4]||(n[4]=[t.createTextVNode("Cancel")]))),_:1},8,["onClick"]),t.createVNode(h,{color:"error",onClick:e.confirmDelete},{default:t.withCtx((()=>n[5]||(n[5]=[t.createTextVNode("Remove")]))),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),e.parsedCards.length>0?(t.openBlock(),t.createBlock(f,{key:0,class:"mb-4"},{default:t.withCtx((()=>[t.createVNode(o,{class:"d-flex align-center justify-space-between"},{default:t.withCtx((()=>[n[6]||(n[6]=t.createElementVNode("span",null,"Card Preview",-1)),t.createElementVNode("div",Ab,[t.createElementVNode("div",Pb,t.toDisplayString(e.currentIndex+1)+" of "+t.toDisplayString(e.parsedCards.length),1),t.createVNode(m)])])),_:1}),t.createVNode(l,null,{default:t.withCtx((()=>[e.loading?(t.openBlock(),t.createElementBlock("div",Ib,[t.createVNode(g,{indeterminate:"",color:"primary"})])):(t.openBlock(),t.createElementBlock("div",Db,[e.currentCard?(t.openBlock(),t.createElementBlock("div",Bb,[t.createVNode(y,{class:"card-content pa-4 mb-4",rounded:"",border:""},{default:t.withCtx((()=>[e.viewComponents&&e.viewComponents.length>0?(t.openBlock(),t.createElementBlock("div",Ob,[t.createVNode(v,{views:e.viewComponents,data:[e.currentViewData],"suppress-spinner":!0},null,8,["views","data"])])):(t.openBlock(),t.createElementBlock("div",Lb,[n[7]||(n[7]=t.createElementVNode("div",{class:"mb-2 font-weight-bold"},"Card content:",-1)),t.createElementVNode("div",Vb,t.toDisplayString(e.currentCard.markdown),1)]))])),_:1}),t.createElementVNode("div",Rb,[t.createElementVNode("div",Fb,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.currentCard.tags,(e=>(t.openBlock(),t.createBlock(b,{key:e,size:"small",color:"primary",variant:"outlined",class:"mr-1 mb-1"},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e),1)])),_:2},1024)))),128))]),void 0!==e.currentCard.elo?(t.openBlock(),t.createElementBlock("div",zb,"ELO: "+t.toDisplayString(e.currentCard.elo),1)):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",jb,"No card selected or available to preview."))]))])),_:1}),t.createVNode(d,{class:"px-4 pb-4"},{default:t.withCtx((()=>[t.createVNode(h,{variant:"outlined",icon:"",disabled:0===e.currentIndex||e.loading,onClick:e.prevCard},{default:t.withCtx((()=>[t.createVNode(_,null,{default:t.withCtx((()=>n[8]||(n[8]=[t.createTextVNode("mdi-chevron-left")]))),_:1})])),_:1},8,["disabled","onClick"]),t.createVNode(u),t.createVNode(h,{variant:"tonal",color:"error","prepend-icon":"mdi-delete",class:"mx-2",disabled:!e.currentCard||e.loading,onClick:e.promptDelete},{default:t.withCtx((()=>n[9]||(n[9]=[t.createTextVNode(" Remove ")]))),_:1},8,["disabled","onClick"]),t.createVNode(h,{variant:"tonal",color:"primary","prepend-icon":"mdi-pencil",class:"mx-2",disabled:!e.currentCard||e.loading,onClick:e.editCurrentCard},{default:t.withCtx((()=>n[10]||(n[10]=[t.createTextVNode(" Edit ")]))),_:1},8,["disabled","onClick"]),t.createVNode(u),t.createVNode(h,{variant:"outlined",icon:"",disabled:e.currentIndex>=e.parsedCards.length-1||e.loading,onClick:e.nextCard},{default:t.withCtx((()=>[t.createVNode(_,null,{default:t.withCtx((()=>n[11]||(n[11]=[t.createTextVNode("mdi-chevron-right")]))),_:1})])),_:1},8,["disabled","onClick"])])),_:1})])),_:1})):t.createCommentVNode("",!0)])}],["__scopeId","data-v-41613480"]]),Hb=t.defineComponent({name:"BulkImportView",components:{CardPreviewList:qb},props:{courseCfg:{type:Object,required:!0}},data:()=>({bulkText:"",parsedCards:[],parsingComplete:!1,importAttempted:!1,results:[],processing:!1,courseDB:null,dataShape:I[0],cardViewComponents:[],editingCard:null,editingCardIndex:-1,showEditDialog:!1,editedMarkdown:"",editedTags:[],editedElo:void 0,newTagText:""}),computed:{uniqueTags(){if(!this.parsedCards||0===this.parsedCards.length)return[];const e=this.parsedCards.reduce(((e,t)=>(t.tags&&t.tags.length>0&&e.push(...t.tags),e)),[]);return[...new Set(e)].sort()}},created(){this.courseCfg?.courseID?(this.courseDB=a.getDataLayer().getCourseDB(this.courseCfg.courseID),this.courseCfg.dataShapes&&0!==this.courseCfg.dataShapes.length?this.initializeCardPreviewComponents():(console.error("[BulkImportView] Course config does not contain any dataShapes."),n.alertUser({text:"Course configuration has no dataShapes. Bulk import may not work correctly.",status:r.Status.warning}))):(console.error("[BulkImportView] Course config or Course ID is missing."),n.alertUser({text:"Course configuration is missing. Cannot initialize bulk import.",status:r.Status.error}))},methods:{handleDeleteCard(e){console.log(`[BulkImportView] Card at index ${e} was deleted`),n.alertUser({text:"Card removed from import list",status:r.Status.ok})},handleEditCard(e,t){this.$refs.cardPreviewList&&this.$refs.cardPreviewList.toggleShortcuts(!1),this.editingCard={...e},this.editingCardIndex=t,this.editedMarkdown=e.markdown,this.editedTags=[...e.tags],this.editedElo=e.elo,this.showEditDialog=!0,this.$nextTick((()=>{this.$refs.markdownTextarea&&this.$refs.markdownTextarea.$el.querySelector("textarea")?.focus()}))},saveEditedCard(){if(this.editingCardIndex<0||!this.editingCard)return;const e={markdown:this.editedMarkdown,tags:this.editedTags,elo:this.editedElo},t=[...this.parsedCards];t[this.editingCardIndex]=e,this.parsedCards=t,this.closeEditDialog(),n.alertUser({text:"Card updated successfully",status:r.Status.ok})},closeEditDialog(){this.showEditDialog=!1,this.editingCard=null,this.editingCardIndex=-1,this.editedMarkdown="",this.editedTags=[],this.editedElo=void 0,setTimeout((()=>{this.$refs.cardPreviewList&&this.$refs.cardPreviewList.toggleShortcuts(!0)}),100)},addTag(){const e=this.newTagText.trim();e&&!this.editedTags.includes(e)&&(this.editedTags.push(e),this.newTagText="")},removeTag(e){this.editedTags=this.editedTags.filter((t=>t!==e))},initializeCardPreviewComponents(){const e=this.courseCfg?.dataShapes?.[0];if(!e)return;this.dataShape.name!==I[0].name&&(this.dataShape=I[0]);const t=r.NameSpacer.getDataShapeDescriptor(e.name),n=$y.getCourse(t.course);if(n){this.cardViewComponents=[],n.getBaseQTypes().forEach((e=>{e.dataShapes[0].name===this.dataShape?.name&&(this.cardViewComponents=this.cardViewComponents.concat(e.views))}));for(const t of e.questionTypes){const e=r.NameSpacer.getQuestionDescriptor(t),i=n.getQuestion(e.questionType)?.views||[];this.cardViewComponents=this.cardViewComponents.concat(i)}console.log(`[BulkImportView] Loaded ${this.cardViewComponents.length} view components for card preview`)}},resetToInputStage(){this.parsingComplete=!1,this.parsedCards=[],this.importAttempted=!1},startNewBulkImport(){this.bulkText="",this.results=[],this.parsedCards=[],this.parsingComplete=!1,this.importAttempted=!1},handleInitialParse(){if(this.courseDB){if(r.isValidBulkFormat(this.bulkText)){this.processing=!0,this.results=[],this.parsedCards=[],this.parsingComplete=!1;try{if(this.parsedCards=r.parseBulkTextToCards(this.bulkText),0===this.parsedCards.length)return n.alertUser({text:'No cards could be parsed from the input. Please check the format and ensure cards are separated by two "---" lines and that cards have content.',status:r.Status.warning}),void(this.processing=!1);0===this.cardViewComponents.length&&this.initializeCardPreviewComponents(),this.parsingComplete=!0,console.log(`[BulkImportView] Successfully parsed ${this.parsedCards.length} cards for preview`)}catch(e){console.error("[BulkImportView] Error parsing bulk text:",e),n.alertUser({text:`Error parsing cards: ${e instanceof Error?e.message:"Unknown error"}`,status:r.Status.error})}finally{this.processing=!1}}}else n.alertUser({text:"Database connection not available. Cannot process cards.",status:r.Status.error})},async confirmAndImportCards(){if(!this.courseDB)return n.alertUser({text:"Database connection lost before import.",status:r.Status.error}),void(this.processing=!1);if(0===this.parsedCards.length)return n.alertUser({text:"No parsed cards to import.",status:r.Status.warning}),void(this.processing=!1);if(!this.courseCfg?.dataShapes||0===this.courseCfg.dataShapes.length)return n.alertUser({text:"This course has no data shapes configured. Cannot import cards.",status:r.Status.error}),void(this.processing=!1);this.processing=!0,this.results=[];const e=(await n.getCurrentUser()).getUsername(),t=I[0];if(!t)return n.alertUser({text:"Critical: Could not find BlanksCardDataShapes. Aborting import.",status:r.Status.error}),void(this.processing=!1);const i=this.courseCfg?.dataShapes?.[0];if(!i)return n.alertUser({text:"Critical: No data shapes found in course configuration. Aborting import.",status:r.Status.error}),void(this.processing=!1);const s=r.NameSpacer.getDataShapeDescriptor(i.name).course,o={dataShape:t,courseCode:s,userName:e},c=a.validateProcessorConfig(o);if(!c.isValid)return n.alertUser({text:c.errorMessage||"Invalid processor configuration for import.",status:r.Status.error}),void(this.processing=!1);console.log("[BulkImportView] Starting import of parsed cards:",{courseID:this.courseCfg.courseID,dataShapeToUse:t.name,courseCode:s,numberOfCards:this.parsedCards.length});try{this.results=await a.importParsedCards(this.parsedCards,this.courseDB,o)}catch(l){console.error("[BulkImportView] Error importing parsed cards:",l),this.results.push({originalText:"Bulk Operation Error",status:"error",message:`Critical error during import: ${l instanceof Error?l.message:"Unknown error"}`})}finally{this.processing=!1,this.importAttempted=!0}this.results.every((e=>"success"===e.status))&&this.results.length>0?n.alertUser({text:`${this.results.length} card(s) imported successfully!`,status:r.Status.ok}):this.results.some((e=>"error"===e.status))&&n.alertUser({text:"Some cards failed to import. Please review the results below.",status:r.Status.warning})}}}),Ub={key:0},Gb={key:1,class:"text--secondary"},Wb={class:"my-4"},Yb={class:"d-flex align-center mb-2"},$b={class:"d-flex flex-wrap"},Kb={key:0,class:"ml-6"},Qb={key:1,class:"ml-6"},Xb={key:2,class:"ml-6"},Zb={style:{"white-space":"pre-wrap","background-color":"#f5f5f5",padding:"5px"}};const Jb=cb(Hb,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-textarea"),c=t.resolveComponent("v-col"),l=t.resolveComponent("v-row"),u=t.resolveComponent("v-card-title"),h=t.resolveComponent("v-chip"),d=t.resolveComponent("v-card-text"),f=t.resolveComponent("v-card"),p=t.resolveComponent("card-preview-list"),m=t.resolveComponent("v-text-field"),g=t.resolveComponent("v-btn"),v=t.resolveComponent("v-form"),y=t.resolveComponent("v-spacer"),b=t.resolveComponent("v-tooltip"),_=t.resolveComponent("v-card-actions"),w=t.resolveComponent("v-dialog"),x=t.resolveComponent("v-icon"),k=t.resolveComponent("v-list-subheader"),C=t.resolveComponent("v-list-item-title"),S=t.resolveComponent("v-list-item-subtitle"),E=t.resolveComponent("v-list-item"),M=t.resolveComponent("v-list"),T=t.resolveComponent("v-container");return t.openBlock(),t.createBlock(T,{fluid:""},{default:t.withCtx((()=>[e.parsingComplete?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(l,{key:0},{default:t.withCtx((()=>[t.createVNode(c,{cols:"12"},{default:t.withCtx((()=>[t.createVNode(o,{modelValue:e.bulkText,"onUpdate:modelValue":n[0]||(n[0]=t=>e.bulkText=t),label:"Bulk Card Input",placeholder:"Paste card data here.\nSeparate cards with two consecutive '---' lines on their own lines.\nExample:\nCard 1 Question\n{{blank}}\ntags: tagA, tagB\nelo: 1500\n---\n---\nCard 2 Question\nAnother {{blank}}\nelo: 1200\ntags: tagC",rows:"15",variant:"outlined","data-cy":"bulk-import-textarea"},null,8,["modelValue"])])),_:1})])),_:1})),e.parsingComplete?(t.openBlock(),t.createBlock(l,{key:1,class:"mb-4"},{default:t.withCtx((()=>[t.createVNode(c,{cols:"12",md:"4"},{default:t.withCtx((()=>[t.createVNode(f,{border:""},{default:t.withCtx((()=>[t.createVNode(u,null,{default:t.withCtx((()=>n[6]||(n[6]=[t.createTextVNode("Parsing Summary")]))),_:1}),t.createVNode(d,null,{default:t.withCtx((()=>[t.createElementVNode("p",null,[t.createElementVNode("strong",null,t.toDisplayString(e.parsedCards.length),1),n[7]||(n[7]=t.createTextVNode(" card(s) parsed and ready for import. "))]),e.parsedCards.length>0?(t.openBlock(),t.createElementBlock("div",Ub,[n[8]||(n[8]=t.createElementVNode("strong",null,"Tags Found:",-1)),e.uniqueTags.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(e.uniqueTags,(e=>(t.openBlock(),t.createBlock(h,{key:e,class:"mr-1 mb-1",size:"small",label:""},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e),1)])),_:2},1024)))),128)):(t.openBlock(),t.createElementBlock("span",Gb,"No unique tags identified across parsed cards."))])):t.createCommentVNode("",!0)])),_:1})])),_:1})])),_:1}),t.createVNode(c,{cols:"12",md:"8"},{default:t.withCtx((()=>[e.parsedCards.length>0?(t.openBlock(),t.createBlock(p,{key:0,ref:"cardPreviewList","parsed-cards":e.parsedCards,"onUpdate:parsedCards":n[1]||(n[1]=t=>e.parsedCards=t),"data-shape":e.dataShape,"view-components":e.cardViewComponents,onEditCard:e.handleEditCard,onDeleteCard:e.handleDeleteCard},null,8,["parsed-cards","data-shape","view-components","onEditCard","onDeleteCard"])):t.createCommentVNode("",!0)])),_:1})])),_:1})):t.createCommentVNode("",!0),t.createVNode(w,{modelValue:e.showEditDialog,"onUpdate:modelValue":n[5]||(n[5]=t=>e.showEditDialog=t),"max-width":"800px"},{default:t.withCtx((()=>[t.createVNode(f,null,{default:t.withCtx((()=>[t.createVNode(u,null,{default:t.withCtx((()=>n[9]||(n[9]=[t.createTextVNode("Edit Card")]))),_:1}),t.createVNode(d,null,{default:t.withCtx((()=>[t.createVNode(v,{onSubmit:t.withModifiers(e.saveEditedCard,["prevent"]),onKeydown:t.withKeys(e.closeEditDialog,["esc"])},{default:t.withCtx((()=>[t.createVNode(o,{ref:"markdownTextarea",modelValue:e.editedMarkdown,"onUpdate:modelValue":n[2]||(n[2]=t=>e.editedMarkdown=t),label:"Card Content",rows:"6","auto-grow":"",variant:"outlined",onKeydown:t.withKeys(t.withModifiers(e.saveEditedCard,["ctrl"]),["enter"])},null,8,["modelValue","onKeydown"]),t.createElementVNode("div",Wb,[t.createElementVNode("div",Yb,[n[11]||(n[11]=t.createElementVNode("h3",{class:"text-subtitle-1 mr-2"},"Tags",-1)),t.createVNode(m,{modelValue:e.newTagText,"onUpdate:modelValue":n[3]||(n[3]=t=>e.newTagText=t),density:"compact","hide-details":"",placeholder:"Add a tag",variant:"outlined",class:"mr-2",onKeydown:[t.withKeys(t.withModifiers(e.addTag,["prevent"]),["enter"]),t.withKeys(e.closeEditDialog,["esc"])]},null,8,["modelValue","onKeydown"]),t.createVNode(g,{size:"small",color:"primary",variant:"text",onClick:e.addTag},{default:t.withCtx((()=>n[10]||(n[10]=[t.createTextVNode("Add")]))),_:1},8,["onClick"])]),t.createElementVNode("div",$b,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.editedTags,(n=>(t.openBlock(),t.createBlock(h,{key:n,closable:"",class:"mr-1 mb-1","onClick:close":t=>e.removeTag(n)},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(n),1)])),_:2},1032,["onClick:close"])))),128))])]),t.createVNode(m,{modelValue:e.editedElo,"onUpdate:modelValue":n[4]||(n[4]=t=>e.editedElo=t),modelModifiers:{number:!0},label:"ELO Rating (optional)",type:"number",variant:"outlined",min:"0",max:"3000"},null,8,["modelValue"])])),_:1},8,["onSubmit","onKeydown"])])),_:1}),t.createVNode(_,null,{default:t.withCtx((()=>[t.createVNode(y),t.createVNode(g,{color:"grey",variant:"text",onClick:e.closeEditDialog},{default:t.withCtx((()=>[n[13]||(n[13]=t.createTextVNode(" Cancel ")),t.createVNode(b,{activator:"parent",location:"top"},{default:t.withCtx((()=>n[12]||(n[12]=[t.createTextVNode("Press ESC")]))),_:1})])),_:1},8,["onClick"]),t.createVNode(g,{color:"primary",onClick:e.saveEditedCard},{default:t.withCtx((()=>[n[15]||(n[15]=t.createTextVNode(" Save ")),t.createVNode(b,{activator:"parent",location:"top"},{default:t.withCtx((()=>n[14]||(n[14]=[t.createTextVNode("Press Ctrl+Enter")]))),_:1})])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]),t.createVNode(l,null,{default:t.withCtx((()=>[t.createVNode(c,{cols:"12"},{default:t.withCtx((()=>[e.parsingComplete?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(g,{key:0,color:"primary",loading:e.processing,disabled:!e.bulkText.trim()||e.processing,"data-cy":"bulk-import-parse-btn",onClick:e.handleInitialParse},{default:t.withCtx((()=>[n[17]||(n[17]=t.createTextVNode(" Parse Cards ")),t.createVNode(x,{end:""},{default:t.withCtx((()=>n[16]||(n[16]=[t.createTextVNode("mdi-play-circle-outline")]))),_:1})])),_:1},8,["loading","disabled","onClick"])),e.parsingComplete?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(g,{color:"primary",class:"mr-2",loading:e.processing,disabled:0===e.parsedCards.length||e.processing||e.importAttempted,"data-cy":"bulk-import-confirm-btn",onClick:e.confirmAndImportCards},{default:t.withCtx((()=>[t.createTextVNode(" Confirm and Import "+t.toDisplayString(e.parsedCards.length)+" Card(s) ",1),t.createVNode(x,{end:""},{default:t.withCtx((()=>n[18]||(n[18]=[t.createTextVNode("mdi-check-circle-outline")]))),_:1})])),_:1},8,["loading","disabled","onClick"]),e.importAttempted?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(g,{key:0,variant:"outlined",color:"grey-darken-1",disabled:e.processing,"data-cy":"bulk-import-edit-again-btn",onClick:e.resetToInputStage},{default:t.withCtx((()=>[t.createVNode(x,{start:""},{default:t.withCtx((()=>n[19]||(n[19]=[t.createTextVNode("mdi-pencil")]))),_:1}),n[20]||(n[20]=t.createTextVNode(" Back to bulk-editor. "))])),_:1},8,["disabled","onClick"])),e.importAttempted?(t.openBlock(),t.createBlock(g,{key:1,variant:"outlined",color:"blue-darken-1",disabled:e.processing,"data-cy":"bulk-import-add-another-btn",onClick:e.startNewBulkImport},{default:t.withCtx((()=>[t.createVNode(x,{start:""},{default:t.withCtx((()=>n[21]||(n[21]=[t.createTextVNode("mdi-plus-circle-outline")]))),_:1}),n[22]||(n[22]=t.createTextVNode(" Add Another Bulk Import "))])),_:1},8,["disabled","onClick"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)])),_:1})])),_:1}),e.results.length>0?(t.openBlock(),t.createBlock(l,{key:2},{default:t.withCtx((()=>[t.createVNode(c,{cols:"12"},{default:t.withCtx((()=>[t.createVNode(M,{density:"compact"},{default:t.withCtx((()=>[t.createVNode(k,null,{default:t.withCtx((()=>n[23]||(n[23]=[t.createTextVNode("Import Results")]))),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.results,((e,r)=>(t.openBlock(),t.createBlock(E,{key:r,class:t.normalizeClass({"lime-lighten-5":"success"===e.status,"red-lighten-5":"error"===e.status,"force-dark-text":"success"===e.status||"error"===e.status})},{default:t.withCtx((()=>[t.createVNode(C,null,{default:t.withCtx((()=>[t.createVNode(x,{color:"success"===e.status?"green":"red"},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString("success"===e.status?"mdi-check-circle":"mdi-alert-circle"),1)])),_:2},1032,["color"]),t.createTextVNode(" Card "+t.toDisplayString(r+1),1)])),_:2},1024),t.createVNode(S,null,{default:t.withCtx((()=>[e.message?(t.openBlock(),t.createElementBlock("div",Kb,t.toDisplayString(e.message),1)):t.createCommentVNode("",!0),e.cardId?(t.openBlock(),t.createElementBlock("div",Qb,"ID: "+t.toDisplayString(e.cardId),1)):t.createCommentVNode("",!0),"error"===e.status&&e.originalText?(t.openBlock(),t.createElementBlock("details",Xb,[n[24]||(n[24]=t.createElementVNode("summary",null,"Original Input",-1)),t.createElementVNode("pre",Zb,t.toDisplayString(e.originalText),1)])):t.createCommentVNode("",!0)])),_:2},1024)])),_:2},1032,["class"])))),128))])),_:1})])),_:1})])),_:1})):t.createCommentVNode("",!0)])),_:1})}],["__scopeId","data-v-3689f51b"]]),e_=t.defineComponent({name:"CourseEditor",components:{DataInputForm:Mb,BulkImportView:Jb},props:{course:{type:String,required:!0}},data:()=>({registeredDataShapes:[],dataShapes:[],selectedShape:O.dataShapes[0].name,courseConfig:null,dataShape:I[0],loading:!0,currentTab:"single",dataInputFormStore:Cb()}),watch:{selectedShape:{handler(e){e&&(this.dataShape=this.getDataShape(e),this.dataInputFormStore.setDataShape(this.dataShape),this.dataInputFormStore.dataInputForm.course=this.courseConfig)}}},async created(){this.courseConfig=await a.getDataLayer().getCoursesDB().getCourseConfig(this.course),$y.courses.forEach((e=>{e.questions.forEach((e=>{e.dataShapes.forEach((e=>{this.dataShapes.push(e)}))}))})),this.courseConfig&&this.courseConfig.dataShapes&&this.courseConfig.dataShapes.forEach((e=>{this.registeredDataShapes.push(this.dataShapes.find((t=>t.name===r.NameSpacer.getDataShapeDescriptor(e.name).dataShape)))})),this.loading=!1},methods:{getDataShape(e){return this.dataShapes.find((t=>t.name===e))}}}),t_={key:0,class:"courseEditor"},n_={key:0},r_={key:1},i_={class:"text-h4"};const a_=cb(e_,[["render",function(e,n,r,i,a,s){const o=t.resolveComponent("v-progress-circular"),c=t.resolveComponent("router-link"),l=t.resolveComponent("v-tab"),u=t.resolveComponent("v-tabs"),h=t.resolveComponent("v-select"),d=t.resolveComponent("data-input-form"),f=t.resolveComponent("v-container"),p=t.resolveComponent("v-window-item"),m=t.resolveComponent("bulk-import-view"),g=t.resolveComponent("component-registration"),v=t.resolveComponent("navigation-strategy-editor"),y=t.resolveComponent("v-window");return e.course?(t.openBlock(),t.createElementBlock("div",t_,[e.loading?(t.openBlock(),t.createElementBlock("div",n_,[t.createVNode(o,{indeterminate:"",color:"secondary"})])):(t.openBlock(),t.createElementBlock("div",r_,[t.createElementVNode("h1",i_,[t.createVNode(c,{to:"/q"},{default:t.withCtx((()=>n[3]||(n[3]=[t.createTextVNode("Quilts")]))),_:1}),n[4]||(n[4]=t.createTextVNode(" / ")),t.createVNode(c,{to:`/q/${e.courseConfig?e.courseConfig.name:e.course}`},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e.courseConfig?.name),1)])),_:1},8,["to"])]),t.createVNode(u,{modelValue:e.currentTab,"onUpdate:modelValue":n[0]||(n[0]=t=>e.currentTab=t),"bg-color":"primary",grow:""},{default:t.withCtx((()=>[t.createVNode(l,{value:"single"},{default:t.withCtx((()=>n[5]||(n[5]=[t.createTextVNode("Single Card Input")]))),_:1}),t.createVNode(l,{value:"bulk"},{default:t.withCtx((()=>n[6]||(n[6]=[t.createTextVNode("Bulk Import")]))),_:1}),t.createVNode(l,{value:"registration"},{default:t.withCtx((()=>n[7]||(n[7]=[t.createTextVNode("Navigation")]))),_:1}),t.createVNode(l,{value:"registration"},{default:t.withCtx((()=>n[8]||(n[8]=[t.createTextVNode("Component Registration")]))),_:1})])),_:1},8,["modelValue"]),t.createVNode(y,{modelValue:e.currentTab,"onUpdate:modelValue":n[2]||(n[2]=t=>e.currentTab=t)},{default:t.withCtx((()=>[t.createVNode(p,{value:"single"},{default:t.withCtx((()=>[t.createVNode(f,{fluid:""},{default:t.withCtx((()=>[t.createVNode(h,{modelValue:e.selectedShape,"onUpdate:modelValue":n[1]||(n[1]=t=>e.selectedShape=t),label:"What kind of content are you adding?",items:e.registeredDataShapes.map((e=>e.name)),class:"mt-4"},null,8,["modelValue","items"]),""!==e.selectedShape&&e.courseConfig&&e.dataShape?(t.openBlock(),t.createBlock(d,{key:0,"data-shape":e.dataShape,"course-cfg":e.courseConfig},null,8,["data-shape","course-cfg"])):t.createCommentVNode("",!0)])),_:1})])),_:1}),t.createVNode(p,{value:"bulk"},{default:t.withCtx((()=>[t.createVNode(f,{fluid:""},{default:t.withCtx((()=>[e.courseConfig?(t.openBlock(),t.createBlock(m,{key:0,"course-cfg":e.courseConfig,class:"mt-4"},null,8,["course-cfg"])):t.createCommentVNode("",!0)])),_:1})])),_:1}),t.createVNode(p,{value:"registration"},{default:t.withCtx((()=>[t.createVNode(f,{fluid:""},{default:t.withCtx((()=>[t.createVNode(g,{course:e.course,class:"mt-4"},null,8,["course"])])),_:1})])),_:1}),t.createVNode(p,{value:"navigation"},{default:t.withCtx((()=>[t.createVNode(f,{fluid:""},{default:t.withCtx((()=>[t.createVNode(v,{"course-id":e.course},null,8,["course-id"])])),_:1})])),_:1})])),_:1},8,["modelValue"])]))])):t.createCommentVNode("",!0)}],["__scopeId","data-v-e17c0876"]]);e.BulkImportView=Jb,e.ChessPuzzleInput=kb,e.CourseEditor=a_,e.DataInputForm=Mb,e.IntegerInput=lb,e.MarkdownInput=ub,e.MediaDragDropUploader=mb,e.MidiInput=_b,e.NumberInput=wb,e.OptionsFieldInput=ob,e.StringInput=xb,e.integerValidator=ab,e.isFieldInput=Ky,e.numberValidator=ib,e.useDataInputFormStore=Cb,e.useFieldInputStore=sb,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
83
|
+
//# sourceMappingURL=edit-ui.umd.js.map
|