var wr=Object.defineProperty;var Pr=(i,e,t)=>e in i?wr(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var mt=(i,e,t)=>(Pr(i,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=t(s);fetch(s.href,o)}})();const index="",common="",popup$1="",SnackbarSfc="",elevation="",loading$1="",button="",icon="",snackbar="",coreSfc="",cell="",CellSfc="",ripple="",formDetails="",hoverOverlay="",_switch="",SwitchSfc="",style="";function makeMap(i,e){const t=Object.create(null),r=i.split(",");for(let s=0;s!!t[s.toLowerCase()]:s=>!!t[s]}const EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,onRE=/^on[^a-z]/,isOn=i=>onRE.test(i),isModelListener=i=>i.startsWith("onUpdate:"),extend$3=Object.assign,remove$7=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},hasOwnProperty$f=Object.prototype.hasOwnProperty,hasOwn$2=(i,e)=>hasOwnProperty$f.call(i,e),isArray$9=Array.isArray,isMap$3=i=>toTypeString(i)==="[object Map]",isSet$3=i=>toTypeString(i)==="[object Set]",isFunction$6=i=>typeof i=="function",isString$2=i=>typeof i=="string",isSymbol$1=i=>typeof i=="symbol",isObject$5=i=>i!==null&&typeof i=="object",isPromise$1=i=>isObject$5(i)&&isFunction$6(i.then)&&isFunction$6(i.catch),objectToString$3=Object.prototype.toString,toTypeString=i=>objectToString$3.call(i),toRawType=i=>toTypeString(i).slice(8,-1),isPlainObject$3=i=>toTypeString(i)==="[object Object]",isIntegerKey=i=>isString$2(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,isReservedProp=makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cacheStringFunction=i=>{const e=Object.create(null);return t=>e[t]||(e[t]=i(t))},camelizeRE$1=/-(\w)/g,camelize$2=cacheStringFunction(i=>i.replace(camelizeRE$1,(e,t)=>t?t.toUpperCase():"")),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(i=>i.replace(hyphenateRE,"-$1").toLowerCase()),capitalize=cacheStringFunction(i=>i.charAt(0).toUpperCase()+i.slice(1)),toHandlerKey=cacheStringFunction(i=>i?"on".concat(capitalize(i)):""),hasChanged=(i,e)=>!Object.is(i,e),invokeArrayFns=(i,e)=>{for(let t=0;t{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value:t})},looseToNumber=i=>{const e=parseFloat(i);return isNaN(e)?i:e},toNumber$1=i=>{const e=isString$2(i)?Number(i):NaN;return isNaN(e)?i:e};let _globalThis;const getGlobalThis=()=>_globalThis||(_globalThis=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function normalizeStyle(i){if(isArray$9(i)){const e={};for(let t=0;t{if(t){const r=t.split(propertyDelimiterRE);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function stringifyStyle(i){let e="";if(!i||isString$2(i))return e;for(const t in i){const r=i[t],s=t.startsWith("--")?t:hyphenate(t);(isString$2(r)||typeof r=="number")&&(e+="".concat(s,":").concat(r,";"))}return e}function normalizeClass(i){let e="";if(isString$2(i))e=i;else if(isArray$9(i))for(let t=0;tisString$2(i)?i:i==null?"":isArray$9(i)||isObject$5(i)&&(i.toString===objectToString$3||!isFunction$6(i.toString))?JSON.stringify(i,replacer,2):String(i),replacer=(i,e)=>e&&e.__v_isRef?replacer(i,e.value):isMap$3(e)?{["Map(".concat(e.size,")")]:[...e.entries()].reduce((t,[r,s])=>(t["".concat(r," =>")]=s,t),{})}:isSet$3(e)?{["Set(".concat(e.size,")")]:[...e.values()]}:isObject$5(e)&&!isArray$9(e)&&!isPlainObject$3(e)?String(e):e;let activeEffectScope;class EffectScope{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=activeEffectScope,!e&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}on(){activeEffectScope=this}off(){activeEffectScope=this.parent}stop(e){if(this._active){let t,r;for(t=0,r=this.effects.length;t{const e=new Set(i);return e.w=0,e.n=0,e},wasTracked=i=>(i.w&trackOpBit)>0,newTracked=i=>(i.n&trackOpBit)>0,initDepMarkers=({deps:i})=>{if(i.length)for(let e=0;e{const{deps:e}=i;if(e.length){let t=0;for(let r=0;r{(m==="length"||m>=c)&&l.push(u)})}else switch(t!==void 0&&l.push(a.get(t)),e){case"add":isArray$9(i)?isIntegerKey(t)&&l.push(a.get("length")):(l.push(a.get(ITERATE_KEY)),isMap$3(i)&&l.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray$9(i)||(l.push(a.get(ITERATE_KEY)),isMap$3(i)&&l.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap$3(i)&&l.push(a.get(ITERATE_KEY));break}if(l.length===1)l[0]&&triggerEffects(l[0]);else{const c=[];for(const u of l)u&&c.push(...u);triggerEffects(createDep(c))}}function triggerEffects(i,e){const t=isArray$9(i)?i:[...i];for(const r of t)r.computed&&triggerEffect(r);for(const r of t)r.computed||triggerEffect(r)}function triggerEffect(i,e){(i!==activeEffect||i.allowRecurse)&&(i.scheduler?i.scheduler():i.run())}function getDepFromReactive(i,e){var t;return(t=targetMap.get(i))==null?void 0:t.get(e)}const isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(isSymbol$1)),get$1=createGetter(),shallowGet=createGetter(!1,!0),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){const i={};return["includes","indexOf","lastIndexOf"].forEach(e=>{i[e]=function(...t){const r=toRaw(this);for(let o=0,a=this.length;o{i[e]=function(...t){pauseTracking();const r=toRaw(this)[e].apply(this,t);return resetTracking(),r}}),i}function hasOwnProperty$e(i){const e=toRaw(this);return track(e,"has",i),e.hasOwnProperty(i)}function createGetter(i=!1,e=!1){return function(r,s,o){if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&o===(i?e?shallowReadonlyMap:readonlyMap:e?shallowReactiveMap:reactiveMap).get(r))return r;const a=isArray$9(r);if(!i){if(a&&hasOwn$2(arrayInstrumentations,s))return Reflect.get(arrayInstrumentations,s,o);if(s==="hasOwnProperty")return hasOwnProperty$e}const l=Reflect.get(r,s,o);return(isSymbol$1(s)?builtInSymbols.has(s):isNonTrackableKeys(s))||(i||track(r,"get",s),e)?l:isRef(l)?a&&isIntegerKey(s)?l:l.value:isObject$5(l)?i?readonly(l):reactive(l):l}}const set$1=createSetter(),shallowSet=createSetter(!0);function createSetter(i=!1){return function(t,r,s,o){let a=t[r];if(isReadonly(a)&&isRef(a)&&!isRef(s))return!1;if(!i&&(!isShallow(s)&&!isReadonly(s)&&(a=toRaw(a),s=toRaw(s)),!isArray$9(t)&&isRef(a)&&!isRef(s)))return a.value=s,!0;const l=isArray$9(t)&&isIntegerKey(r)?Number(r)i,getProto$1=i=>Reflect.getPrototypeOf(i);function get$2(i,e,t=!1,r=!1){i=i.__v_raw;const s=toRaw(i),o=toRaw(e);t||(e!==o&&track(s,"get",e),track(s,"get",o));const{has:a}=getProto$1(s),l=r?toShallow:t?toReadonly:toReactive;if(a.call(s,e))return l(i.get(e));if(a.call(s,o))return l(i.get(o));i!==s&&i.get(e)}function has$4(i,e=!1){const t=this.__v_raw,r=toRaw(t),s=toRaw(i);return e||(i!==s&&track(r,"has",i),track(r,"has",s)),i===s?t.has(i):t.has(i)||t.has(s)}function size(i,e=!1){return i=i.__v_raw,!e&&track(toRaw(i),"iterate",ITERATE_KEY),Reflect.get(i,"size",i)}function add(i){i=toRaw(i);const e=toRaw(this);return getProto$1(e).has.call(e,i)||(e.add(i),trigger(e,"add",i,i)),this}function set(i,e){e=toRaw(e);const t=toRaw(this),{has:r,get:s}=getProto$1(t);let o=r.call(t,i);o||(i=toRaw(i),o=r.call(t,i));const a=s.call(t,i);return t.set(i,e),o?hasChanged(e,a)&&trigger(t,"set",i,e):trigger(t,"add",i,e),this}function deleteEntry(i){const e=toRaw(this),{has:t,get:r}=getProto$1(e);let s=t.call(e,i);s||(i=toRaw(i),s=t.call(e,i)),r&&r.call(e,i);const o=e.delete(i);return s&&trigger(e,"delete",i,void 0),o}function clear(){const i=toRaw(this),e=i.size!==0,t=i.clear();return e&&trigger(i,"clear",void 0,void 0),t}function createForEach(i,e){return function(r,s){const o=this,a=o.__v_raw,l=toRaw(a),c=e?toShallow:i?toReadonly:toReactive;return!i&&track(l,"iterate",ITERATE_KEY),a.forEach((u,m)=>r.call(s,c(u),c(m),o))}}function createIterableMethod(i,e,t){return function(...r){const s=this.__v_raw,o=toRaw(s),a=isMap$3(o),l=i==="entries"||i===Symbol.iterator&&a,c=i==="keys"&&a,u=s[i](...r),m=t?toShallow:e?toReadonly:toReactive;return!e&&track(o,"iterate",c?MAP_KEY_ITERATE_KEY:ITERATE_KEY),{next(){const{value:d,done:y}=u.next();return y?{value:d,done:y}:{value:l?[m(d[0]),m(d[1])]:m(d),done:y}},[Symbol.iterator](){return this}}}}function createReadonlyMethod(i){return function(...e){return i==="delete"?!1:this}}function createInstrumentations(){const i={get(o){return get$2(this,o)},get size(){return size(this)},has:has$4,add,set,delete:deleteEntry,clear,forEach:createForEach(!1,!1)},e={get(o){return get$2(this,o,!1,!0)},get size(){return size(this)},has:has$4,add,set,delete:deleteEntry,clear,forEach:createForEach(!1,!0)},t={get(o){return get$2(this,o,!0)},get size(){return size(this,!0)},has(o){return has$4.call(this,o,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!1)},r={get(o){return get$2(this,o,!0,!0)},get size(){return size(this,!0)},has(o){return has$4.call(this,o,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{i[o]=createIterableMethod(o,!1,!1),t[o]=createIterableMethod(o,!0,!1),e[o]=createIterableMethod(o,!1,!0),r[o]=createIterableMethod(o,!0,!0)}),[i,t,e,r]}const[mutableInstrumentations,readonlyInstrumentations,shallowInstrumentations,shallowReadonlyInstrumentations]=createInstrumentations();function createInstrumentationGetter(i,e){const t=e?i?shallowReadonlyInstrumentations:shallowInstrumentations:i?readonlyInstrumentations:mutableInstrumentations;return(r,s,o)=>s==="__v_isReactive"?!i:s==="__v_isReadonly"?i:s==="__v_raw"?r:Reflect.get(hasOwn$2(t,s)&&s in r?t:r,s,o)}const mutableCollectionHandlers={get:createInstrumentationGetter(!1,!1)},shallowCollectionHandlers={get:createInstrumentationGetter(!1,!0)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0,!1)},reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(i){return i.__v_skip||!Object.isExtensible(i)?0:targetTypeMap(toRawType(i))}function reactive(i){return isReadonly(i)?i:createReactiveObject(i,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(i){return createReactiveObject(i,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(i){return createReactiveObject(i,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(i,e,t,r,s){if(!isObject$5(i)||i.__v_raw&&!(e&&i.__v_isReactive))return i;const o=s.get(i);if(o)return o;const a=getTargetType(i);if(a===0)return i;const l=new Proxy(i,a===2?r:t);return s.set(i,l),l}function isReactive(i){return isReadonly(i)?isReactive(i.__v_raw):!!(i&&i.__v_isReactive)}function isReadonly(i){return!!(i&&i.__v_isReadonly)}function isShallow(i){return!!(i&&i.__v_isShallow)}function isProxy(i){return isReactive(i)||isReadonly(i)}function toRaw(i){const e=i&&i.__v_raw;return e?toRaw(e):i}function markRaw(i){return def(i,"__v_skip",!0),i}const toReactive=i=>isObject$5(i)?reactive(i):i,toReadonly=i=>isObject$5(i)?readonly(i):i;function trackRefValue(i){shouldTrack&&activeEffect&&(i=toRaw(i),trackEffects(i.dep||(i.dep=createDep())))}function triggerRefValue(i,e){i=toRaw(i);const t=i.dep;t&&triggerEffects(t)}function isRef(i){return!!(i&&i.__v_isRef===!0)}function ref(i){return createRef(i,!1)}function shallowRef(i){return createRef(i,!0)}function createRef(i,e){return isRef(i)?i:new RefImpl(i,e)}class RefImpl{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:toRaw(e),this._value=t?e:toReactive(e)}get value(){return trackRefValue(this),this._value}set value(e){const t=this.__v_isShallow||isShallow(e)||isReadonly(e);e=t?e:toRaw(e),hasChanged(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:toReactive(e),triggerRefValue(this))}}function unref(i){return isRef(i)?i.value:i}const shallowUnwrapHandlers={get:(i,e,t)=>unref(Reflect.get(i,e,t)),set:(i,e,t,r)=>{const s=i[e];return isRef(s)&&!isRef(t)?(s.value=t,!0):Reflect.set(i,e,t,r)}};function proxyRefs(i){return isReactive(i)?i:new Proxy(i,shallowUnwrapHandlers)}function toRefs(i){const e=isArray$9(i)?new Array(i.length):{};for(const t in i)e[t]=propertyToRef(i,t);return e}class ObjectRefImpl{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0}get value(){const e=this._object[this._key];return e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return getDepFromReactive(toRaw(this._object),this._key)}}function propertyToRef(i,e,t){const r=i[e];return isRef(r)?r:new ObjectRefImpl(i,e,t)}class ComputedRefImpl{constructor(e,t,r,s){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new ReactiveEffect(e,()=>{this._dirty||(this._dirty=!0,triggerRefValue(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=r}get value(){const e=toRaw(this);return trackRefValue(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function computed$1(i,e,t=!1){let r,s;const o=isFunction$6(i);return o?(r=i,s=NOOP):(r=i.get,s=i.set),new ComputedRefImpl(r,s,o||!s,t)}function warn(i,...e){}function callWithErrorHandling(i,e,t,r){let s;try{s=r?i(...r):i()}catch(o){handleError(o,e,t)}return s}function callWithAsyncErrorHandling(i,e,t,r){if(isFunction$6(i)){const o=callWithErrorHandling(i,e,t,r);return o&&isPromise$1(o)&&o.catch(a=>{handleError(a,e,t)}),o}const s=[];for(let o=0;o>>1;getId(queue$1[r])flushIndex&&queue$1.splice(e,1)}function queuePostFlushCb(i){isArray$9(i)?pendingPostFlushCbs.push(...i):(!activePostFlushCbs||!activePostFlushCbs.includes(i,i.allowRecurse?postFlushIndex+1:postFlushIndex))&&pendingPostFlushCbs.push(i),queueFlush()}function flushPreFlushCbs(i,e=isFlushing?flushIndex+1:0){for(;egetId(t)-getId(r)),postFlushIndex=0;postFlushIndexi.id==null?1/0:i.id,comparator=(i,e)=>{const t=getId(i)-getId(e);if(t===0){if(i.pre&&!e.pre)return-1;if(e.pre&&!i.pre)return 1}return t};function flushJobs(i){isFlushPending=!1,isFlushing=!0,queue$1.sort(comparator);const e=NOOP;try{for(flushIndex=0;flushIndexisString$2(b)?b.trim():b)),d&&(s=t.map(looseToNumber))}let l,c=r[l=toHandlerKey(e)]||r[l=toHandlerKey(camelize$2(e))];!c&&o&&(c=r[l=toHandlerKey(hyphenate(e))]),c&&callWithAsyncErrorHandling(c,i,6,s);const u=r[l+"Once"];if(u){if(!i.emitted)i.emitted={};else if(i.emitted[l])return;i.emitted[l]=!0,callWithAsyncErrorHandling(u,i,6,s)}}function normalizeEmitsOptions(i,e,t=!1){const r=e.emitsCache,s=r.get(i);if(s!==void 0)return s;const o=i.emits;let a={},l=!1;if(!isFunction$6(i)){const c=u=>{const m=normalizeEmitsOptions(u,e,!0);m&&(l=!0,extend$3(a,m))};!t&&e.mixins.length&&e.mixins.forEach(c),i.extends&&c(i.extends),i.mixins&&i.mixins.forEach(c)}return!o&&!l?(isObject$5(i)&&r.set(i,null),null):(isArray$9(o)?o.forEach(c=>a[c]=null):extend$3(a,o),isObject$5(i)&&r.set(i,a),a)}function isEmitListener(i,e){return!i||!isOn(e)?!1:(e=e.slice(2).replace(/Once$/,""),hasOwn$2(i,e[0].toLowerCase()+e.slice(1))||hasOwn$2(i,hyphenate(e))||hasOwn$2(i,e))}let currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(i){const e=currentRenderingInstance;return currentRenderingInstance=i,currentScopeId=i&&i.type.__scopeId||null,e}function pushScopeId(i){currentScopeId=i}function popScopeId(){currentScopeId=null}function withCtx(i,e=currentRenderingInstance,t){if(!e||i._n)return i;const r=(...s)=>{r._d&&setBlockTracking(-1);const o=setCurrentRenderingInstance(e);let a;try{a=i(...s)}finally{setCurrentRenderingInstance(o),r._d&&setBlockTracking(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function markAttrsAccessed(){}function renderComponentRoot(i){const{type:e,vnode:t,proxy:r,withProxy:s,props:o,propsOptions:[a],slots:l,attrs:c,emit:u,render:m,renderCache:d,data:y,setupState:b,ctx:S,inheritAttrs:A}=i;let P,x;const E=setCurrentRenderingInstance(i);try{if(t.shapeFlag&4){const T=s||r;P=normalizeVNode(m.call(T,T,d,o,b,y,S)),x=c}else{const T=e;P=normalizeVNode(T.length>1?T(o,{attrs:c,slots:l,emit:u}):T(o,null)),x=e.props?c:getFunctionalFallthrough(c)}}catch(T){blockStack.length=0,handleError(T,i,1),P=createVNode(Comment)}let _=P;if(x&&A!==!1){const T=Object.keys(x),{shapeFlag:C}=_;T.length&&C&7&&(a&&T.some(isModelListener)&&(x=filterModelListeners(x,a)),_=cloneVNode(_,x))}return t.dirs&&(_=cloneVNode(_),_.dirs=_.dirs?_.dirs.concat(t.dirs):t.dirs),t.transition&&(_.transition=t.transition),P=_,setCurrentRenderingInstance(E),P}const getFunctionalFallthrough=i=>{let e;for(const t in i)(t==="class"||t==="style"||isOn(t))&&((e||(e={}))[t]=i[t]);return e},filterModelListeners=(i,e)=>{const t={};for(const r in i)(!isModelListener(r)||!(r.slice(9)in e))&&(t[r]=i[r]);return t};function shouldUpdateComponent(i,e,t){const{props:r,children:s,component:o}=i,{props:a,children:l,patchFlag:c}=e,u=o.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&c>=0){if(c&1024)return!0;if(c&16)return r?hasPropsChanged(r,a,u):!!a;if(c&8){const m=e.dynamicProps;for(let d=0;di.__isSuspense;function queueEffectWithSuspense(i,e){e&&e.pendingBranch?isArray$9(i)?e.effects.push(...i):e.effects.push(i):queuePostFlushCb(i)}function watchEffect(i,e){return doWatch(i,null,e)}const INITIAL_WATCHER_VALUE={};function watch(i,e,t){return doWatch(i,e,t)}function doWatch(i,e,{immediate:t,deep:r,flush:s,onTrack:o,onTrigger:a}=EMPTY_OBJ){var l;const c=getCurrentScope()===((l=currentInstance)==null?void 0:l.scope)?currentInstance:null;let u,m=!1,d=!1;if(isRef(i)?(u=()=>i.value,m=isShallow(i)):isReactive(i)?(u=()=>i,r=!0):isArray$9(i)?(d=!0,m=i.some(T=>isReactive(T)||isShallow(T)),u=()=>i.map(T=>{if(isRef(T))return T.value;if(isReactive(T))return traverse(T);if(isFunction$6(T))return callWithErrorHandling(T,c,2)})):isFunction$6(i)?e?u=()=>callWithErrorHandling(i,c,2):u=()=>{if(!(c&&c.isUnmounted))return y&&y(),callWithAsyncErrorHandling(i,c,3,[b])}:u=NOOP,e&&r){const T=u;u=()=>traverse(T())}let y,b=T=>{y=E.onStop=()=>{callWithErrorHandling(T,c,4)}},S;if(isInSSRComponentSetup)if(b=NOOP,e?t&&callWithAsyncErrorHandling(e,c,3,[u(),d?[]:void 0,b]):u(),s==="sync"){const T=useSSRContext();S=T.__watcherHandles||(T.__watcherHandles=[])}else return NOOP;let A=d?new Array(i.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE;const P=()=>{if(E.active)if(e){const T=E.run();(r||m||(d?T.some((C,R)=>hasChanged(C,A[R])):hasChanged(T,A)))&&(y&&y(),callWithAsyncErrorHandling(e,c,3,[T,A===INITIAL_WATCHER_VALUE?void 0:d&&A[0]===INITIAL_WATCHER_VALUE?[]:A,b]),A=T)}else E.run()};P.allowRecurse=!!e;let x;s==="sync"?x=P:s==="post"?x=()=>queuePostRenderEffect(P,c&&c.suspense):(P.pre=!0,c&&(P.id=c.uid),x=()=>queueJob(P));const E=new ReactiveEffect(u,x);e?t?P():A=E.run():s==="post"?queuePostRenderEffect(E.run.bind(E),c&&c.suspense):E.run();const _=()=>{E.stop(),c&&c.scope&&remove$7(c.scope.effects,E)};return S&&S.push(_),_}function instanceWatch(i,e,t){const r=this.proxy,s=isString$2(i)?i.includes(".")?createPathGetter(r,i):()=>r[i]:i.bind(r,r);let o;isFunction$6(e)?o=e:(o=e.handler,t=e);const a=currentInstance;setCurrentInstance(this);const l=doWatch(s,o.bind(r),t);return a?setCurrentInstance(a):unsetCurrentInstance(),l}function createPathGetter(i,e){const t=e.split(".");return()=>{let r=i;for(let s=0;s{traverse(t,e)});else if(isPlainObject$3(i))for(const t in i)traverse(i[t],e);return i}function withDirectives(i,e){const t=currentRenderingInstance;if(t===null)return i;const r=getExposeProxy(t)||t.proxy,s=i.dirs||(i.dirs=[]);for(let o=0;o{i.isMounted=!0}),onBeforeUnmount(()=>{i.isUnmounting=!0}),i}const TransitionHookValidator=[Function,Array],BaseTransitionPropsValidators={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:TransitionHookValidator,onEnter:TransitionHookValidator,onAfterEnter:TransitionHookValidator,onEnterCancelled:TransitionHookValidator,onBeforeLeave:TransitionHookValidator,onLeave:TransitionHookValidator,onAfterLeave:TransitionHookValidator,onLeaveCancelled:TransitionHookValidator,onBeforeAppear:TransitionHookValidator,onAppear:TransitionHookValidator,onAfterAppear:TransitionHookValidator,onAppearCancelled:TransitionHookValidator},BaseTransitionImpl={name:"BaseTransition",props:BaseTransitionPropsValidators,setup(i,{slots:e}){const t=getCurrentInstance(),r=useTransitionState();let s;return()=>{const o=e.default&&getTransitionRawChildren(e.default(),!0);if(!o||!o.length)return;let a=o[0];if(o.length>1){for(const A of o)if(A.type!==Comment){a=A;break}}const l=toRaw(i),{mode:c}=l;if(r.isLeaving)return emptyPlaceholder(a);const u=getKeepAliveChild(a);if(!u)return emptyPlaceholder(a);const m=resolveTransitionHooks(u,l,r,t);setTransitionHooks(u,m);const d=t.subTree,y=d&&getKeepAliveChild(d);let b=!1;const{getTransitionKey:S}=u.type;if(S){const A=S();s===void 0?s=A:A!==s&&(s=A,b=!0)}if(y&&y.type!==Comment&&(!isSameVNodeType(u,y)||b)){const A=resolveTransitionHooks(y,l,r,t);if(setTransitionHooks(y,A),c==="out-in")return r.isLeaving=!0,A.afterLeave=()=>{r.isLeaving=!1,t.update.active!==!1&&t.update()},emptyPlaceholder(a);c==="in-out"&&u.type!==Comment&&(A.delayLeave=(P,x,E)=>{const _=getLeavingNodesForType(r,y);_[String(y.key)]=y,P._leaveCb=()=>{x(),P._leaveCb=void 0,delete m.delayedLeave},m.delayedLeave=E})}return a}}},BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(i,e){const{leavingVNodes:t}=i;let r=t.get(e.type);return r||(r=Object.create(null),t.set(e.type,r)),r}function resolveTransitionHooks(i,e,t,r){const{appear:s,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:m,onBeforeLeave:d,onLeave:y,onAfterLeave:b,onLeaveCancelled:S,onBeforeAppear:A,onAppear:P,onAfterAppear:x,onAppearCancelled:E}=e,_=String(i.key),T=getLeavingNodesForType(t,i),C=(M,D)=>{M&&callWithAsyncErrorHandling(M,r,9,D)},R=(M,D)=>{const H=D[1];C(M,D),isArray$9(M)?M.every(W=>W.length<=1)&&H():M.length<=1&&H()},I={mode:o,persisted:a,beforeEnter(M){let D=l;if(!t.isMounted)if(s)D=A||l;else return;M._leaveCb&&M._leaveCb(!0);const H=T[_];H&&isSameVNodeType(i,H)&&H.el._leaveCb&&H.el._leaveCb(),C(D,[M])},enter(M){let D=c,H=u,W=m;if(!t.isMounted)if(s)D=P||c,H=x||u,W=E||m;else return;let O=!1;const z=M._enterCb=k=>{O||(O=!0,k?C(W,[M]):C(H,[M]),I.delayedLeave&&I.delayedLeave(),M._enterCb=void 0)};D?R(D,[M,z]):z()},leave(M,D){const H=String(i.key);if(M._enterCb&&M._enterCb(!0),t.isUnmounting)return D();C(d,[M]);let W=!1;const O=M._leaveCb=z=>{W||(W=!0,D(),z?C(S,[M]):C(b,[M]),M._leaveCb=void 0,T[H]===i&&delete T[H])};T[H]=i,y?R(y,[M,O]):O()},clone(M){return resolveTransitionHooks(M,e,t,r)}};return I}function emptyPlaceholder(i){if(isKeepAlive(i))return i=cloneVNode(i),i.children=null,i}function getKeepAliveChild(i){return isKeepAlive(i)?i.children?i.children[0]:void 0:i}function setTransitionHooks(i,e){i.shapeFlag&6&&i.component?setTransitionHooks(i.component.subTree,e):i.shapeFlag&128?(i.ssContent.transition=e.clone(i.ssContent),i.ssFallback.transition=e.clone(i.ssFallback)):i.transition=e}function getTransitionRawChildren(i,e=!1,t){let r=[],s=0;for(let o=0;o1)for(let o=0;oextend$3({name:i.name},e,{setup:i}))():i}const isAsyncWrapper=i=>!!i.type.__asyncLoader,isKeepAlive=i=>i.type.__isKeepAlive;function onActivated(i,e){registerKeepAliveHook(i,"a",e)}function onDeactivated(i,e){registerKeepAliveHook(i,"da",e)}function registerKeepAliveHook(i,e,t=currentInstance){const r=i.__wdc||(i.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return i()});if(injectHook(e,r,t),t){let s=t.parent;for(;s&&s.parent;)isKeepAlive(s.parent.vnode)&&injectToKeepAliveRoot(r,e,t,s),s=s.parent}}function injectToKeepAliveRoot(i,e,t,r){const s=injectHook(e,i,r,!0);onUnmounted(()=>{remove$7(r[e],s)},t)}function injectHook(i,e,t=currentInstance,r=!1){if(t){const s=t[i]||(t[i]=[]),o=e.__weh||(e.__weh=(...a)=>{if(t.isUnmounted)return;pauseTracking(),setCurrentInstance(t);const l=callWithAsyncErrorHandling(e,t,i,a);return unsetCurrentInstance(),resetTracking(),l});return r?s.unshift(o):s.push(o),o}}const createHook=i=>(e,t=currentInstance)=>(!isInSSRComponentSetup||i==="sp")&&injectHook(i,(...r)=>e(...r),t),onBeforeMount=createHook("bm"),onMounted=createHook("m"),onBeforeUpdate=createHook("bu"),onUpdated=createHook("u"),onBeforeUnmount=createHook("bum"),onUnmounted=createHook("um"),onServerPrefetch=createHook("sp"),onRenderTriggered=createHook("rtg"),onRenderTracked=createHook("rtc");function onErrorCaptured(i,e=currentInstance){injectHook("ec",i,e)}const COMPONENTS="components",DIRECTIVES="directives";function resolveComponent(i,e){return resolveAsset(COMPONENTS,i,!0,e)||i}const NULL_DYNAMIC_COMPONENT=Symbol.for("v-ndc");function resolveDynamicComponent(i){return isString$2(i)?resolveAsset(COMPONENTS,i,!1)||i:i||NULL_DYNAMIC_COMPONENT}function resolveDirective(i){return resolveAsset(DIRECTIVES,i)}function resolveAsset(i,e,t=!0,r=!1){const s=currentRenderingInstance||currentInstance;if(s){const o=s.type;if(i===COMPONENTS){const l=getComponentName(o,!1);if(l&&(l===e||l===camelize$2(e)||l===capitalize(camelize$2(e))))return o}const a=resolve(s[i]||o[i],e)||resolve(s.appContext[i],e);return!a&&r?o:a}}function resolve(i,e){return i&&(i[e]||i[camelize$2(e)]||i[capitalize(camelize$2(e))])}function renderList(i,e,t,r){let s;const o=t&&t[r];if(isArray$9(i)||isString$2(i)){s=new Array(i.length);for(let a=0,l=i.length;ae(a,l,void 0,o&&o[l]));else{const a=Object.keys(i);s=new Array(a.length);for(let l=0,c=a.length;lisVNode(e)?!(e.type===Comment||e.type===Fragment&&!ensureValidVNode(e.children)):!0)?i:null}const getPublicInstance=i=>i?isStatefulComponent(i)?getExposeProxy(i)||i.proxy:getPublicInstance(i.parent):null,publicPropertiesMap=extend$3(Object.create(null),{$:i=>i,$el:i=>i.vnode.el,$data:i=>i.data,$props:i=>i.props,$attrs:i=>i.attrs,$slots:i=>i.slots,$refs:i=>i.refs,$parent:i=>getPublicInstance(i.parent),$root:i=>getPublicInstance(i.root),$emit:i=>i.emit,$options:i=>resolveMergedOptions(i),$forceUpdate:i=>i.f||(i.f=()=>queueJob(i.update)),$nextTick:i=>i.n||(i.n=nextTick.bind(i.proxy)),$watch:i=>instanceWatch.bind(i)}),hasSetupBinding=(i,e)=>i!==EMPTY_OBJ&&!i.__isScriptSetup&&hasOwn$2(i,e),PublicInstanceProxyHandlers={get({_:i},e){const{ctx:t,setupState:r,data:s,props:o,accessCache:a,type:l,appContext:c}=i;let u;if(e[0]!=="$"){const b=a[e];if(b!==void 0)switch(b){case 1:return r[e];case 2:return s[e];case 4:return t[e];case 3:return o[e]}else{if(hasSetupBinding(r,e))return a[e]=1,r[e];if(s!==EMPTY_OBJ&&hasOwn$2(s,e))return a[e]=2,s[e];if((u=i.propsOptions[0])&&hasOwn$2(u,e))return a[e]=3,o[e];if(t!==EMPTY_OBJ&&hasOwn$2(t,e))return a[e]=4,t[e];shouldCacheAccess&&(a[e]=0)}}const m=publicPropertiesMap[e];let d,y;if(m)return e==="$attrs"&&track(i,"get",e),m(i);if((d=l.__cssModules)&&(d=d[e]))return d;if(t!==EMPTY_OBJ&&hasOwn$2(t,e))return a[e]=4,t[e];if(y=c.config.globalProperties,hasOwn$2(y,e))return y[e]},set({_:i},e,t){const{data:r,setupState:s,ctx:o}=i;return hasSetupBinding(s,e)?(s[e]=t,!0):r!==EMPTY_OBJ&&hasOwn$2(r,e)?(r[e]=t,!0):hasOwn$2(i.props,e)||e[0]==="$"&&e.slice(1)in i?!1:(o[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:r,appContext:s,propsOptions:o}},a){let l;return!!t[a]||i!==EMPTY_OBJ&&hasOwn$2(i,a)||hasSetupBinding(e,a)||(l=o[0])&&hasOwn$2(l,a)||hasOwn$2(r,a)||hasOwn$2(publicPropertiesMap,a)||hasOwn$2(s.config.globalProperties,a)},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:hasOwn$2(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};function normalizePropsOrEmits(i){return isArray$9(i)?i.reduce((e,t)=>(e[t]=null,e),{}):i}let shouldCacheAccess=!0;function applyOptions(i){const e=resolveMergedOptions(i),t=i.proxy,r=i.ctx;shouldCacheAccess=!1,e.beforeCreate&&callHook$1(e.beforeCreate,i,"bc");const{data:s,computed:o,methods:a,watch:l,provide:c,inject:u,created:m,beforeMount:d,mounted:y,beforeUpdate:b,updated:S,activated:A,deactivated:P,beforeDestroy:x,beforeUnmount:E,destroyed:_,unmounted:T,render:C,renderTracked:R,renderTriggered:I,errorCaptured:M,serverPrefetch:D,expose:H,inheritAttrs:W,components:O,directives:z,filters:k}=e;if(u&&resolveInjections(u,r,null),a)for(const G in a){const N=a[G];isFunction$6(N)&&(r[G]=N.bind(t))}if(s){const G=s.call(t,t);isObject$5(G)&&(i.data=reactive(G))}if(shouldCacheAccess=!0,o)for(const G in o){const N=o[G],V=isFunction$6(N)?N.bind(t,t):isFunction$6(N.get)?N.get.bind(t,t):NOOP,K=!isFunction$6(N)&&isFunction$6(N.set)?N.set.bind(t):NOOP,U=computed({get:V,set:K});Object.defineProperty(r,G,{enumerable:!0,configurable:!0,get:()=>U.value,set:J=>U.value=J})}if(l)for(const G in l)createWatcher(l[G],r,t,G);if(c){const G=isFunction$6(c)?c.call(t):c;Reflect.ownKeys(G).forEach(N=>{provide(N,G[N])})}m&&callHook$1(m,i,"c");function F(G,N){isArray$9(N)?N.forEach(V=>G(V.bind(t))):N&&G(N.bind(t))}if(F(onBeforeMount,d),F(onMounted,y),F(onBeforeUpdate,b),F(onUpdated,S),F(onActivated,A),F(onDeactivated,P),F(onErrorCaptured,M),F(onRenderTracked,R),F(onRenderTriggered,I),F(onBeforeUnmount,E),F(onUnmounted,T),F(onServerPrefetch,D),isArray$9(H))if(H.length){const G=i.exposed||(i.exposed={});H.forEach(N=>{Object.defineProperty(G,N,{get:()=>t[N],set:V=>t[N]=V})})}else i.exposed||(i.exposed={});C&&i.render===NOOP&&(i.render=C),W!=null&&(i.inheritAttrs=W),O&&(i.components=O),z&&(i.directives=z)}function resolveInjections(i,e,t=NOOP){isArray$9(i)&&(i=normalizeInject(i));for(const r in i){const s=i[r];let o;isObject$5(s)?"default"in s?o=inject(s.from||r,s.default,!0):o=inject(s.from||r):o=inject(s),isRef(o)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:a=>o.value=a}):e[r]=o}}function callHook$1(i,e,t){callWithAsyncErrorHandling(isArray$9(i)?i.map(r=>r.bind(e.proxy)):i.bind(e.proxy),e,t)}function createWatcher(i,e,t,r){const s=r.includes(".")?createPathGetter(t,r):()=>t[r];if(isString$2(i)){const o=e[i];isFunction$6(o)&&watch(s,o)}else if(isFunction$6(i))watch(s,i.bind(t));else if(isObject$5(i))if(isArray$9(i))i.forEach(o=>createWatcher(o,e,t,r));else{const o=isFunction$6(i.handler)?i.handler.bind(t):e[i.handler];isFunction$6(o)&&watch(s,o,i)}}function resolveMergedOptions(i){const e=i.type,{mixins:t,extends:r}=e,{mixins:s,optionsCache:o,config:{optionMergeStrategies:a}}=i.appContext,l=o.get(e);let c;return l?c=l:!s.length&&!t&&!r?c=e:(c={},s.length&&s.forEach(u=>mergeOptions$1(c,u,a,!0)),mergeOptions$1(c,e,a)),isObject$5(e)&&o.set(e,c),c}function mergeOptions$1(i,e,t,r=!1){const{mixins:s,extends:o}=e;o&&mergeOptions$1(i,o,t,!0),s&&s.forEach(a=>mergeOptions$1(i,a,t,!0));for(const a in e)if(!(r&&a==="expose")){const l=internalOptionMergeStrats[a]||t&&t[a];i[a]=l?l(i[a],e[a]):e[a]}return i}const internalOptionMergeStrats={data:mergeDataFn,props:mergeEmitsOrPropsOptions,emits:mergeEmitsOrPropsOptions,methods:mergeObjectOptions,computed:mergeObjectOptions,beforeCreate:mergeAsArray,created:mergeAsArray,beforeMount:mergeAsArray,mounted:mergeAsArray,beforeUpdate:mergeAsArray,updated:mergeAsArray,beforeDestroy:mergeAsArray,beforeUnmount:mergeAsArray,destroyed:mergeAsArray,unmounted:mergeAsArray,activated:mergeAsArray,deactivated:mergeAsArray,errorCaptured:mergeAsArray,serverPrefetch:mergeAsArray,components:mergeObjectOptions,directives:mergeObjectOptions,watch:mergeWatchOptions,provide:mergeDataFn,inject:mergeInject};function mergeDataFn(i,e){return e?i?function(){return extend$3(isFunction$6(i)?i.call(this,this):i,isFunction$6(e)?e.call(this,this):e)}:e:i}function mergeInject(i,e){return mergeObjectOptions(normalizeInject(i),normalizeInject(e))}function normalizeInject(i){if(isArray$9(i)){const e={};for(let t=0;t1)return t&&isFunction$6(e)?e.call(r&&r.proxy):e}}function initProps(i,e,t,r=!1){const s={},o={};def(o,InternalObjectKey,1),i.propsDefaults=Object.create(null),setFullProps(i,e,s,o);for(const a in i.propsOptions[0])a in s||(s[a]=void 0);t?i.props=r?s:shallowReactive(s):i.type.props?i.props=s:i.props=o,i.attrs=o}function updateProps(i,e,t,r){const{props:s,attrs:o,vnode:{patchFlag:a}}=i,l=toRaw(s),[c]=i.propsOptions;let u=!1;if((r||a>0)&&!(a&16)){if(a&8){const m=i.vnode.dynamicProps;for(let d=0;d{c=!0;const[y,b]=normalizePropsOptions(d,e,!0);extend$3(a,y),b&&l.push(...b)};!t&&e.mixins.length&&e.mixins.forEach(m),i.extends&&m(i.extends),i.mixins&&i.mixins.forEach(m)}if(!o&&!c)return isObject$5(i)&&r.set(i,EMPTY_ARR),EMPTY_ARR;if(isArray$9(o))for(let m=0;m-1,b[1]=A<0||S-1||hasOwn$2(b,"default"))&&l.push(d)}}}const u=[a,l];return isObject$5(i)&&r.set(i,u),u}function validatePropName(i){return i[0]!=="$"}function getType(i){const e=i&&i.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:i===null?"null":""}function isSameType(i,e){return getType(i)===getType(e)}function getTypeIndex(i,e){return isArray$9(e)?e.findIndex(t=>isSameType(t,i)):isFunction$6(e)&&isSameType(e,i)?0:-1}const isInternalKey=i=>i[0]==="_"||i==="$stable",normalizeSlotValue=i=>isArray$9(i)?i.map(normalizeVNode):[normalizeVNode(i)],normalizeSlot$1=(i,e,t)=>{if(e._n)return e;const r=withCtx((...s)=>normalizeSlotValue(e(...s)),t);return r._c=!1,r},normalizeObjectSlots=(i,e,t)=>{const r=i._ctx;for(const s in i){if(isInternalKey(s))continue;const o=i[s];if(isFunction$6(o))e[s]=normalizeSlot$1(s,o,r);else if(o!=null){const a=normalizeSlotValue(o);e[s]=()=>a}}},normalizeVNodeSlots=(i,e)=>{const t=normalizeSlotValue(e);i.slots.default=()=>t},initSlots=(i,e)=>{if(i.vnode.shapeFlag&32){const t=e._;t?(i.slots=toRaw(e),def(e,"_",t)):normalizeObjectSlots(e,i.slots={})}else i.slots={},e&&normalizeVNodeSlots(i,e);def(i.slots,InternalObjectKey,1)},updateSlots=(i,e,t)=>{const{vnode:r,slots:s}=i;let o=!0,a=EMPTY_OBJ;if(r.shapeFlag&32){const l=e._;l?t&&l===1?o=!1:(extend$3(s,e),!t&&l===1&&delete s._):(o=!e.$stable,normalizeObjectSlots(e,s)),a=e}else e&&(normalizeVNodeSlots(i,e),a={default:1});if(o)for(const l in s)!isInternalKey(l)&&!(l in a)&&delete s[l]};function setRef(i,e,t,r,s=!1){if(isArray$9(i)){i.forEach((y,b)=>setRef(y,e&&(isArray$9(e)?e[b]:e),t,r,s));return}if(isAsyncWrapper(r)&&!s)return;const o=r.shapeFlag&4?getExposeProxy(r.component)||r.component.proxy:r.el,a=s?null:o,{i:l,r:c}=i,u=e&&e.r,m=l.refs===EMPTY_OBJ?l.refs={}:l.refs,d=l.setupState;if(u!=null&&u!==c&&(isString$2(u)?(m[u]=null,hasOwn$2(d,u)&&(d[u]=null)):isRef(u)&&(u.value=null)),isFunction$6(c))callWithErrorHandling(c,l,12,[a,m]);else{const y=isString$2(c),b=isRef(c);if(y||b){const S=()=>{if(i.f){const A=y?hasOwn$2(d,c)?d[c]:m[c]:c.value;s?isArray$9(A)&&remove$7(A,o):isArray$9(A)?A.includes(o)||A.push(o):y?(m[c]=[o],hasOwn$2(d,c)&&(d[c]=m[c])):(c.value=[o],i.k&&(m[i.k]=c.value))}else y?(m[c]=a,hasOwn$2(d,c)&&(d[c]=a)):b&&(c.value=a,i.k&&(m[i.k]=a))};a?(S.id=-1,queuePostRenderEffect(S,t)):S()}}}const queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(i){return baseCreateRenderer(i)}function baseCreateRenderer(i,e){const t=getGlobalThis();t.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:a,createText:l,createComment:c,setText:u,setElementText:m,parentNode:d,nextSibling:y,setScopeId:b=NOOP,insertStaticContent:S}=i,A=(ee,te,B,re=null,Z=null,Y=null,q=!1,ie=null,ne=!!te.dynamicChildren)=>{if(ee===te)return;ee&&!isSameVNodeType(ee,te)&&(re=oe(ee),J(ee,Z,Y,!0),ee=null),te.patchFlag===-2&&(ne=!1,te.dynamicChildren=null);const{type:se,ref:ce,shapeFlag:de}=te;switch(se){case Text:P(ee,te,B,re);break;case Comment:x(ee,te,B,re);break;case Static:ee==null&&E(te,B,re,q);break;case Fragment:O(ee,te,B,re,Z,Y,q,ie,ne);break;default:de&1?C(ee,te,B,re,Z,Y,q,ie,ne):de&6?z(ee,te,B,re,Z,Y,q,ie,ne):(de&64||de&128)&&se.process(ee,te,B,re,Z,Y,q,ie,ne,fe)}ce!=null&&Z&&setRef(ce,ee&&ee.ref,Y,te||ee,!te)},P=(ee,te,B,re)=>{if(ee==null)r(te.el=l(te.children),B,re);else{const Z=te.el=ee.el;te.children!==ee.children&&u(Z,te.children)}},x=(ee,te,B,re)=>{ee==null?r(te.el=c(te.children||""),B,re):te.el=ee.el},E=(ee,te,B,re)=>{[ee.el,ee.anchor]=S(ee.children,te,B,re,ee.el,ee.anchor)},_=({el:ee,anchor:te},B,re)=>{let Z;for(;ee&&ee!==te;)Z=y(ee),r(ee,B,re),ee=Z;r(te,B,re)},T=({el:ee,anchor:te})=>{let B;for(;ee&&ee!==te;)B=y(ee),s(ee),ee=B;s(te)},C=(ee,te,B,re,Z,Y,q,ie,ne)=>{q=q||te.type==="svg",ee==null?R(te,B,re,Z,Y,q,ie,ne):D(ee,te,Z,Y,q,ie,ne)},R=(ee,te,B,re,Z,Y,q,ie)=>{let ne,se;const{type:ce,props:de,shapeFlag:ve,transition:ye,dirs:ge}=ee;if(ne=ee.el=a(ee.type,Y,de&&de.is,de),ve&8?m(ne,ee.children):ve&16&&M(ee.children,ne,null,re,Z,Y&&ce!=="foreignObject",q,ie),ge&&invokeDirectiveHook(ee,null,re,"created"),I(ne,ee,ee.scopeId,q,re),de){for(const pe in de)pe!=="value"&&!isReservedProp(pe)&&o(ne,pe,null,de[pe],Y,ee.children,re,Z,Se);"value"in de&&o(ne,"value",null,de.value),(se=de.onVnodeBeforeMount)&&invokeVNodeHook(se,re,ee)}ge&&invokeDirectiveHook(ee,null,re,"beforeMount");const Pe=(!Z||Z&&!Z.pendingBranch)&&ye&&!ye.persisted;Pe&&ye.beforeEnter(ne),r(ne,te,B),((se=de&&de.onVnodeMounted)||Pe||ge)&&queuePostRenderEffect(()=>{se&&invokeVNodeHook(se,re,ee),Pe&&ye.enter(ne),ge&&invokeDirectiveHook(ee,null,re,"mounted")},Z)},I=(ee,te,B,re,Z)=>{if(B&&b(ee,B),re)for(let Y=0;Y{for(let se=ne;se{const ie=te.el=ee.el;let{patchFlag:ne,dynamicChildren:se,dirs:ce}=te;ne|=ee.patchFlag&16;const de=ee.props||EMPTY_OBJ,ve=te.props||EMPTY_OBJ;let ye;B&&toggleRecurse(B,!1),(ye=ve.onVnodeBeforeUpdate)&&invokeVNodeHook(ye,B,te,ee),ce&&invokeDirectiveHook(te,ee,B,"beforeUpdate"),B&&toggleRecurse(B,!0);const ge=Z&&te.type!=="foreignObject";if(se?H(ee.dynamicChildren,se,ie,B,re,ge,Y):q||N(ee,te,ie,null,B,re,ge,Y,!1),ne>0){if(ne&16)W(ie,te,de,ve,B,re,Z);else if(ne&2&&de.class!==ve.class&&o(ie,"class",null,ve.class,Z),ne&4&&o(ie,"style",de.style,ve.style,Z),ne&8){const Pe=te.dynamicProps;for(let pe=0;pe{ye&&invokeVNodeHook(ye,B,te,ee),ce&&invokeDirectiveHook(te,ee,B,"updated")},re)},H=(ee,te,B,re,Z,Y,q)=>{for(let ie=0;ie{if(B!==re){if(B!==EMPTY_OBJ)for(const ie in B)!isReservedProp(ie)&&!(ie in re)&&o(ee,ie,B[ie],null,q,te.children,Z,Y,Se);for(const ie in re){if(isReservedProp(ie))continue;const ne=re[ie],se=B[ie];ne!==se&&ie!=="value"&&o(ee,ie,se,ne,q,te.children,Z,Y,Se)}"value"in re&&o(ee,"value",B.value,re.value)}},O=(ee,te,B,re,Z,Y,q,ie,ne)=>{const se=te.el=ee?ee.el:l(""),ce=te.anchor=ee?ee.anchor:l("");let{patchFlag:de,dynamicChildren:ve,slotScopeIds:ye}=te;ye&&(ie=ie?ie.concat(ye):ye),ee==null?(r(se,B,re),r(ce,B,re),M(te.children,B,ce,Z,Y,q,ie,ne)):de>0&&de&64&&ve&&ee.dynamicChildren?(H(ee.dynamicChildren,ve,B,Z,Y,q,ie),(te.key!=null||Z&&te===Z.subTree)&&traverseStaticChildren(ee,te,!0)):N(ee,te,B,ce,Z,Y,q,ie,ne)},z=(ee,te,B,re,Z,Y,q,ie,ne)=>{te.slotScopeIds=ie,ee==null?te.shapeFlag&512?Z.ctx.activate(te,B,re,q,ne):k(te,B,re,Z,Y,q,ne):$(ee,te,ne)},k=(ee,te,B,re,Z,Y,q)=>{const ie=ee.component=createComponentInstance(ee,re,Z);if(isKeepAlive(ee)&&(ie.ctx.renderer=fe),setupComponent(ie),ie.asyncDep){if(Z&&Z.registerDep(ie,F),!ee.el){const ne=ie.subTree=createVNode(Comment);x(null,ne,te,B)}return}F(ie,ee,te,B,Z,Y,q)},$=(ee,te,B)=>{const re=te.component=ee.component;if(shouldUpdateComponent(ee,te,B))if(re.asyncDep&&!re.asyncResolved){G(re,te,B);return}else re.next=te,invalidateJob(re.update),re.update();else te.el=ee.el,re.vnode=te},F=(ee,te,B,re,Z,Y,q)=>{const ie=()=>{if(ee.isMounted){let{next:ce,bu:de,u:ve,parent:ye,vnode:ge}=ee,Pe=ce,pe;toggleRecurse(ee,!1),ce?(ce.el=ge.el,G(ee,ce,q)):ce=ge,de&&invokeArrayFns(de),(pe=ce.props&&ce.props.onVnodeBeforeUpdate)&&invokeVNodeHook(pe,ye,ce,ge),toggleRecurse(ee,!0);const Te=renderComponentRoot(ee),Le=ee.subTree;ee.subTree=Te,A(Le,Te,d(Le.el),oe(Le),ee,Z,Y),ce.el=Te.el,Pe===null&&updateHOCHostEl(ee,Te.el),ve&&queuePostRenderEffect(ve,Z),(pe=ce.props&&ce.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook(pe,ye,ce,ge),Z)}else{let ce;const{el:de,props:ve}=te,{bm:ye,m:ge,parent:Pe}=ee,pe=isAsyncWrapper(te);if(toggleRecurse(ee,!1),ye&&invokeArrayFns(ye),!pe&&(ce=ve&&ve.onVnodeBeforeMount)&&invokeVNodeHook(ce,Pe,te),toggleRecurse(ee,!0),de&&Ee){const Te=()=>{ee.subTree=renderComponentRoot(ee),Ee(de,ee.subTree,ee,Z,null)};pe?te.type.__asyncLoader().then(()=>!ee.isUnmounted&&Te()):Te()}else{const Te=ee.subTree=renderComponentRoot(ee);A(null,Te,B,re,ee,Z,Y),te.el=Te.el}if(ge&&queuePostRenderEffect(ge,Z),!pe&&(ce=ve&&ve.onVnodeMounted)){const Te=te;queuePostRenderEffect(()=>invokeVNodeHook(ce,Pe,Te),Z)}(te.shapeFlag&256||Pe&&isAsyncWrapper(Pe.vnode)&&Pe.vnode.shapeFlag&256)&&ee.a&&queuePostRenderEffect(ee.a,Z),ee.isMounted=!0,te=B=re=null}},ne=ee.effect=new ReactiveEffect(ie,()=>queueJob(se),ee.scope),se=ee.update=()=>ne.run();se.id=ee.uid,toggleRecurse(ee,!0),se()},G=(ee,te,B)=>{te.component=ee;const re=ee.vnode.props;ee.vnode=te,ee.next=null,updateProps(ee,te.props,re,B),updateSlots(ee,te.children,B),pauseTracking(),flushPreFlushCbs(),resetTracking()},N=(ee,te,B,re,Z,Y,q,ie,ne=!1)=>{const se=ee&&ee.children,ce=ee?ee.shapeFlag:0,de=te.children,{patchFlag:ve,shapeFlag:ye}=te;if(ve>0){if(ve&128){K(se,de,B,re,Z,Y,q,ie,ne);return}else if(ve&256){V(se,de,B,re,Z,Y,q,ie,ne);return}}ye&8?(ce&16&&Se(se,Z,Y),de!==se&&m(B,de)):ce&16?ye&16?K(se,de,B,re,Z,Y,q,ie,ne):Se(se,Z,Y,!0):(ce&8&&m(B,""),ye&16&&M(de,B,re,Z,Y,q,ie,ne))},V=(ee,te,B,re,Z,Y,q,ie,ne)=>{ee=ee||EMPTY_ARR,te=te||EMPTY_ARR;const se=ee.length,ce=te.length,de=Math.min(se,ce);let ve;for(ve=0;vece?Se(ee,Z,Y,!0,!1,de):M(te,B,re,Z,Y,q,ie,ne,de)},K=(ee,te,B,re,Z,Y,q,ie,ne)=>{let se=0;const ce=te.length;let de=ee.length-1,ve=ce-1;for(;se<=de&&se<=ve;){const ye=ee[se],ge=te[se]=ne?cloneIfMounted(te[se]):normalizeVNode(te[se]);if(isSameVNodeType(ye,ge))A(ye,ge,B,null,Z,Y,q,ie,ne);else break;se++}for(;se<=de&&se<=ve;){const ye=ee[de],ge=te[ve]=ne?cloneIfMounted(te[ve]):normalizeVNode(te[ve]);if(isSameVNodeType(ye,ge))A(ye,ge,B,null,Z,Y,q,ie,ne);else break;de--,ve--}if(se>de){if(se<=ve){const ye=ve+1,ge=yeve)for(;se<=de;)J(ee[se],Z,Y,!0),se++;else{const ye=se,ge=se,Pe=new Map;for(se=ge;se<=ve;se++){const ke=te[se]=ne?cloneIfMounted(te[se]):normalizeVNode(te[se]);ke.key!=null&&Pe.set(ke.key,se)}let pe,Te=0;const Le=ve-ge+1;let Ie=!1,Re=0;const Me=new Array(Le);for(se=0;se=Le){J(ke,Z,Y,!0);continue}let Fe;if(ke.key!=null)Fe=Pe.get(ke.key);else for(pe=ge;pe<=ve;pe++)if(Me[pe-ge]===0&&isSameVNodeType(ke,te[pe])){Fe=pe;break}Fe===void 0?J(ke,Z,Y,!0):(Me[Fe-ge]=se+1,Fe>=Re?Re=Fe:Ie=!0,A(ke,te[Fe],B,null,Z,Y,q,ie,ne),Te++)}const De=Ie?getSequence(Me):EMPTY_ARR;for(pe=De.length-1,se=Le-1;se>=0;se--){const ke=ge+se,Fe=te[ke],qe=ke+1{const{el:Y,type:q,transition:ie,children:ne,shapeFlag:se}=ee;if(se&6){U(ee.component.subTree,te,B,re);return}if(se&128){ee.suspense.move(te,B,re);return}if(se&64){q.move(ee,te,B,fe);return}if(q===Fragment){r(Y,te,B);for(let de=0;deie.enter(Y),Z);else{const{leave:de,delayLeave:ve,afterLeave:ye}=ie,ge=()=>r(Y,te,B),Pe=()=>{de(Y,()=>{ge(),ye&&ye()})};ve?ve(Y,ge,Pe):Pe()}else r(Y,te,B)},J=(ee,te,B,re=!1,Z=!1)=>{const{type:Y,props:q,ref:ie,children:ne,dynamicChildren:se,shapeFlag:ce,patchFlag:de,dirs:ve}=ee;if(ie!=null&&setRef(ie,null,B,ee,!0),ce&256){te.ctx.deactivate(ee);return}const ye=ce&1&&ve,ge=!isAsyncWrapper(ee);let Pe;if(ge&&(Pe=q&&q.onVnodeBeforeUnmount)&&invokeVNodeHook(Pe,te,ee),ce&6)le(ee.component,B,re);else{if(ce&128){ee.suspense.unmount(B,re);return}ye&&invokeDirectiveHook(ee,null,te,"beforeUnmount"),ce&64?ee.type.remove(ee,te,B,Z,fe,re):se&&(Y!==Fragment||de>0&&de&64)?Se(se,te,B,!1,!0):(Y===Fragment&&de&384||!Z&&ce&16)&&Se(ne,te,B),re&&me(ee)}(ge&&(Pe=q&&q.onVnodeUnmounted)||ye)&&queuePostRenderEffect(()=>{Pe&&invokeVNodeHook(Pe,te,ee),ye&&invokeDirectiveHook(ee,null,te,"unmounted")},B)},me=ee=>{const{type:te,el:B,anchor:re,transition:Z}=ee;if(te===Fragment){he(B,re);return}if(te===Static){T(ee);return}const Y=()=>{s(B),Z&&!Z.persisted&&Z.afterLeave&&Z.afterLeave()};if(ee.shapeFlag&1&&Z&&!Z.persisted){const{leave:q,delayLeave:ie}=Z,ne=()=>q(B,Y);ie?ie(ee.el,Y,ne):ne()}else Y()},he=(ee,te)=>{let B;for(;ee!==te;)B=y(ee),s(ee),ee=B;s(te)},le=(ee,te,B)=>{const{bum:re,scope:Z,update:Y,subTree:q,um:ie}=ee;re&&invokeArrayFns(re),Z.stop(),Y&&(Y.active=!1,J(q,ee,te,B)),ie&&queuePostRenderEffect(ie,te),queuePostRenderEffect(()=>{ee.isUnmounted=!0},te),te&&te.pendingBranch&&!te.isUnmounted&&ee.asyncDep&&!ee.asyncResolved&&ee.suspenseId===te.pendingId&&(te.deps--,te.deps===0&&te.resolve())},Se=(ee,te,B,re=!1,Z=!1,Y=0)=>{for(let q=Y;qee.shapeFlag&6?oe(ee.component.subTree):ee.shapeFlag&128?ee.suspense.next():y(ee.anchor||ee.el),ue=(ee,te,B)=>{ee==null?te._vnode&&J(te._vnode,null,null,!0):A(te._vnode||null,ee,te,null,null,null,B),flushPreFlushCbs(),flushPostFlushCbs(),te._vnode=ee},fe={p:A,um:J,m:U,r:me,mt:k,mc:M,pc:N,pbc:H,n:oe,o:i};let be,Ee;return e&&([be,Ee]=e(fe)),{render:ue,hydrate:be,createApp:createAppAPI(ue,be)}}function toggleRecurse({effect:i,update:e},t){i.allowRecurse=e.allowRecurse=t}function traverseStaticChildren(i,e,t=!1){const r=i.children,s=e.children;if(isArray$9(r)&&isArray$9(s))for(let o=0;o>1,i[t[l]]0&&(e[r]=t[o-1]),t[o]=r)}}for(o=t.length,a=t[o-1];o-- >0;)t[o]=a,a=e[a];return t}const isTeleport=i=>i.__isTeleport,isTeleportDisabled=i=>i&&(i.disabled||i.disabled===""),isTargetSVG=i=>typeof SVGElement<"u"&&i instanceof SVGElement,resolveTarget=(i,e)=>{const t=i&&i.to;return isString$2(t)?e?e(t):null:t},TeleportImpl={__isTeleport:!0,process(i,e,t,r,s,o,a,l,c,u){const{mc:m,pc:d,pbc:y,o:{insert:b,querySelector:S,createText:A,createComment:P}}=u,x=isTeleportDisabled(e.props);let{shapeFlag:E,children:_,dynamicChildren:T}=e;if(i==null){const C=e.el=A(""),R=e.anchor=A("");b(C,t,r),b(R,t,r);const I=e.target=resolveTarget(e.props,S),M=e.targetAnchor=A("");I&&(b(M,I),a=a||isTargetSVG(I));const D=(H,W)=>{E&16&&m(_,H,W,s,o,a,l,c)};x?D(t,R):I&&D(I,M)}else{e.el=i.el;const C=e.anchor=i.anchor,R=e.target=i.target,I=e.targetAnchor=i.targetAnchor,M=isTeleportDisabled(i.props),D=M?t:R,H=M?C:I;if(a=a||isTargetSVG(R),T?(y(i.dynamicChildren,T,D,s,o,a,l),traverseStaticChildren(i,e,!0)):c||d(i,e,D,H,s,o,a,l,!1),x)M||moveTeleport(e,t,C,u,1);else if((e.props&&e.props.to)!==(i.props&&i.props.to)){const W=e.target=resolveTarget(e.props,S);W&&moveTeleport(e,W,null,u,0)}else M&&moveTeleport(e,R,I,u,1)}updateCssVars(e)},remove(i,e,t,r,{um:s,o:{remove:o}},a){const{shapeFlag:l,children:c,anchor:u,targetAnchor:m,target:d,props:y}=i;if(d&&o(m),(a||!isTeleportDisabled(y))&&(o(u),l&16))for(let b=0;b0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(i),i}function createElementBlock(i,e,t,r,s,o){return setupBlock(createBaseVNode(i,e,t,r,s,o,!0))}function createBlock(i,e,t,r,s){return setupBlock(createVNode(i,e,t,r,s,!0))}function isVNode(i){return i?i.__v_isVNode===!0:!1}function isSameVNodeType(i,e){return i.type===e.type&&i.key===e.key}const InternalObjectKey="__vInternal",normalizeKey=({key:i})=>i!=null?i:null,normalizeRef=({ref:i,ref_key:e,ref_for:t})=>(typeof i=="number"&&(i=""+i),i!=null?isString$2(i)||isRef(i)||isFunction$6(i)?{i:currentRenderingInstance,r:i,k:e,f:!!t}:i:null);function createBaseVNode(i,e=null,t=null,r=0,s=null,o=i===Fragment?0:1,a=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:i,props:e,key:e&&normalizeKey(e),ref:e&&normalizeRef(e),scopeId:currentScopeId,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return l?(normalizeChildren(c,t),o&128&&i.normalize(c)):t&&(c.shapeFlag|=isString$2(t)?8:16),isBlockTreeEnabled>0&&!a&¤tBlock&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&¤tBlock.push(c),c}const createVNode=_createVNode;function _createVNode(i,e=null,t=null,r=0,s=null,o=!1){if((!i||i===NULL_DYNAMIC_COMPONENT)&&(i=Comment),isVNode(i)){const l=cloneVNode(i,e,!0);return t&&normalizeChildren(l,t),isBlockTreeEnabled>0&&!o&¤tBlock&&(l.shapeFlag&6?currentBlock[currentBlock.indexOf(i)]=l:currentBlock.push(l)),l.patchFlag|=-2,l}if(isClassComponent(i)&&(i=i.__vccOpts),e){e=guardReactiveProps(e);let{class:l,style:c}=e;l&&!isString$2(l)&&(e.class=normalizeClass(l)),isObject$5(c)&&(isProxy(c)&&!isArray$9(c)&&(c=extend$3({},c)),e.style=normalizeStyle(c))}const a=isString$2(i)?1:isSuspense(i)?128:isTeleport(i)?64:isObject$5(i)?4:isFunction$6(i)?2:0;return createBaseVNode(i,e,t,r,s,a,o,!0)}function guardReactiveProps(i){return i?isProxy(i)||InternalObjectKey in i?extend$3({},i):i:null}function cloneVNode(i,e,t=!1){const{props:r,ref:s,patchFlag:o,children:a}=i,l=e?mergeProps(r||{},e):r;return{__v_isVNode:!0,__v_skip:!0,type:i.type,props:l,key:l&&normalizeKey(l),ref:e&&e.ref?t&&s?isArray$9(s)?s.concat(normalizeRef(e)):[s,normalizeRef(e)]:normalizeRef(e):s,scopeId:i.scopeId,slotScopeIds:i.slotScopeIds,children:a,target:i.target,targetAnchor:i.targetAnchor,staticCount:i.staticCount,shapeFlag:i.shapeFlag,patchFlag:e&&i.type!==Fragment?o===-1?16:o|16:o,dynamicProps:i.dynamicProps,dynamicChildren:i.dynamicChildren,appContext:i.appContext,dirs:i.dirs,transition:i.transition,component:i.component,suspense:i.suspense,ssContent:i.ssContent&&cloneVNode(i.ssContent),ssFallback:i.ssFallback&&cloneVNode(i.ssFallback),el:i.el,anchor:i.anchor,ctx:i.ctx,ce:i.ce}}function createTextVNode(i=" ",e=0){return createVNode(Text,null,i,e)}function createCommentVNode(i="",e=!1){return e?(openBlock(),createBlock(Comment,null,i)):createVNode(Comment,null,i)}function normalizeVNode(i){return i==null||typeof i=="boolean"?createVNode(Comment):isArray$9(i)?createVNode(Fragment,null,i.slice()):typeof i=="object"?cloneIfMounted(i):createVNode(Text,null,String(i))}function cloneIfMounted(i){return i.el===null&&i.patchFlag!==-1||i.memo?i:cloneVNode(i)}function normalizeChildren(i,e){let t=0;const{shapeFlag:r}=i;if(e==null)e=null;else if(isArray$9(e))t=16;else if(typeof e=="object")if(r&65){const s=e.default;s&&(s._c&&(s._d=!1),normalizeChildren(i,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!(InternalObjectKey in e)?e._ctx=currentRenderingInstance:s===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?e._=1:(e._=2,i.patchFlag|=1024))}else isFunction$6(e)?(e={default:e,_ctx:currentRenderingInstance},t=32):(e=String(e),r&64?(t=16,e=[createTextVNode(e)]):t=8);i.children=e,i.shapeFlag|=t}function mergeProps(...i){const e={};for(let t=0;tcurrentInstance||currentRenderingInstance;let internalSetCurrentInstance,globalCurrentInstanceSetters,settersKey="__VUE_INSTANCE_SETTERS__";(globalCurrentInstanceSetters=getGlobalThis()[settersKey])||(globalCurrentInstanceSetters=getGlobalThis()[settersKey]=[]),globalCurrentInstanceSetters.push(i=>currentInstance=i),internalSetCurrentInstance=i=>{globalCurrentInstanceSetters.length>1?globalCurrentInstanceSetters.forEach(e=>e(i)):globalCurrentInstanceSetters[0](i)};const setCurrentInstance=i=>{internalSetCurrentInstance(i),i.scope.on()},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),internalSetCurrentInstance(null)};function isStatefulComponent(i){return i.vnode.shapeFlag&4}let isInSSRComponentSetup=!1;function setupComponent(i,e=!1){isInSSRComponentSetup=e;const{props:t,children:r}=i.vnode,s=isStatefulComponent(i);initProps(i,t,s,e),initSlots(i,r);const o=s?setupStatefulComponent(i,e):void 0;return isInSSRComponentSetup=!1,o}function setupStatefulComponent(i,e){const t=i.type;i.accessCache=Object.create(null),i.proxy=markRaw(new Proxy(i.ctx,PublicInstanceProxyHandlers));const{setup:r}=t;if(r){const s=i.setupContext=r.length>1?createSetupContext(i):null;setCurrentInstance(i),pauseTracking();const o=callWithErrorHandling(r,i,0,[i.props,s]);if(resetTracking(),unsetCurrentInstance(),isPromise$1(o)){if(o.then(unsetCurrentInstance,unsetCurrentInstance),e)return o.then(a=>{handleSetupResult(i,a,e)}).catch(a=>{handleError(a,i,0)});i.asyncDep=o}else handleSetupResult(i,o,e)}else finishComponentSetup(i,e)}function handleSetupResult(i,e,t){isFunction$6(e)?i.type.__ssrInlineRender?i.ssrRender=e:i.render=e:isObject$5(e)&&(i.setupState=proxyRefs(e)),finishComponentSetup(i,t)}let compile$1;function finishComponentSetup(i,e,t){const r=i.type;if(!i.render){if(!e&&compile$1&&!r.render){const s=r.template||resolveMergedOptions(i).template;if(s){const{isCustomElement:o,compilerOptions:a}=i.appContext.config,{delimiters:l,compilerOptions:c}=r,u=extend$3(extend$3({isCustomElement:o,delimiters:l},a),c);r.render=compile$1(s,u)}}i.render=r.render||NOOP}setCurrentInstance(i),pauseTracking(),applyOptions(i),resetTracking(),unsetCurrentInstance()}function getAttrsProxy(i){return i.attrsProxy||(i.attrsProxy=new Proxy(i.attrs,{get(e,t){return track(i,"get","$attrs"),e[t]}}))}function createSetupContext(i){const e=t=>{i.exposed=t||{}};return{get attrs(){return getAttrsProxy(i)},slots:i.slots,emit:i.emit,expose:e}}function getExposeProxy(i){if(i.exposed)return i.exposeProxy||(i.exposeProxy=new Proxy(proxyRefs(markRaw(i.exposed)),{get(e,t){if(t in e)return e[t];if(t in publicPropertiesMap)return publicPropertiesMap[t](i)},has(e,t){return t in e||t in publicPropertiesMap}}))}function getComponentName(i,e=!0){return isFunction$6(i)?i.displayName||i.name:i.name||e&&i.__name}function isClassComponent(i){return isFunction$6(i)&&"__vccOpts"in i}const computed=(i,e)=>computed$1(i,e,isInSSRComponentSetup);function h$1(i,e,t){const r=arguments.length;return r===2?isObject$5(e)&&!isArray$9(e)?isVNode(e)?createVNode(i,null,[e]):createVNode(i,e):createVNode(i,null,e):(r>3?t=Array.prototype.slice.call(arguments,2):r===3&&isVNode(t)&&(t=[t]),createVNode(i,e,t))}const ssrContextKey=Symbol.for("v-scx"),useSSRContext=()=>inject(ssrContextKey),version="3.3.4",svgNS="http://www.w3.org/2000/svg",doc$2=typeof document<"u"?document:null,templateContainer=doc$2&&doc$2.createElement("template"),nodeOps={insert:(i,e,t)=>{e.insertBefore(i,t||null)},remove:i=>{const e=i.parentNode;e&&e.removeChild(i)},createElement:(i,e,t,r)=>{const s=e?doc$2.createElementNS(svgNS,i):doc$2.createElement(i,t?{is:t}:void 0);return i==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:i=>doc$2.createTextNode(i),createComment:i=>doc$2.createComment(i),setText:(i,e)=>{i.nodeValue=e},setElementText:(i,e)=>{i.textContent=e},parentNode:i=>i.parentNode,nextSibling:i=>i.nextSibling,querySelector:i=>doc$2.querySelector(i),setScopeId(i,e){i.setAttribute(e,"")},insertStaticContent(i,e,t,r,s,o){const a=t?t.previousSibling:e.lastChild;if(s&&(s===o||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),t),!(s===o||!(s=s.nextSibling)););else{templateContainer.innerHTML=r?"".concat(i,""):i;const l=templateContainer.content;if(r){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}e.insertBefore(l,t)}return[a?a.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function patchClass(i,e,t){const r=i._vtc;r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?i.removeAttribute("class"):t?i.setAttribute("class",e):i.className=e}function patchStyle(i,e,t){const r=i.style,s=isString$2(t);if(t&&!s){if(e&&!isString$2(e))for(const o in e)t[o]==null&&setStyle(r,o,"");for(const o in t)setStyle(r,o,t[o])}else{const o=r.display;s?e!==t&&(r.cssText=t):e&&i.removeAttribute("style"),"_vod"in i&&(r.display=o)}}const importantRE=/\s*!important$/;function setStyle(i,e,t){if(isArray$9(t))t.forEach(r=>setStyle(i,e,r));else if(t==null&&(t=""),e.startsWith("--"))i.setProperty(e,t);else{const r=autoPrefix(i,e);importantRE.test(t)?i.setProperty(hyphenate(r),t.replace(importantRE,""),"important"):i[r]=t}}const prefixes=["Webkit","Moz","ms"],prefixCache={};function autoPrefix(i,e){const t=prefixCache[e];if(t)return t;let r=camelize$2(e);if(r!=="filter"&&r in i)return prefixCache[e]=r;r=capitalize(r);for(let s=0;scachedNow||(p.then(()=>cachedNow=0),cachedNow=Date.now());function createInvoker(i,e){const t=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=t.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(r,t.value),e,5,[r])};return t.value=i,t.attached=getNow(),t}function patchStopImmediatePropagation(i,e){if(isArray$9(e)){const t=i.stopImmediatePropagation;return i.stopImmediatePropagation=()=>{t.call(i),i._stopped=!0},e.map(r=>s=>!s._stopped&&r&&r(s))}else return e}const nativeOnRE=/^on[a-z]/,patchProp=(i,e,t,r,s=!1,o,a,l,c)=>{e==="class"?patchClass(i,r,s):e==="style"?patchStyle(i,t,r):isOn(e)?isModelListener(e)||patchEvent(i,e,t,r,a):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):shouldSetAsProp(i,e,r,s))?patchDOMProp(i,e,r,o,a,l,c):(e==="true-value"?i._trueValue=r:e==="false-value"&&(i._falseValue=r),patchAttr(i,e,r,s))};function shouldSetAsProp(i,e,t,r){return r?!!(e==="innerHTML"||e==="textContent"||e in i&&nativeOnRE.test(e)&&isFunction$6(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&i.tagName==="INPUT"||e==="type"&&i.tagName==="TEXTAREA"||nativeOnRE.test(e)&&isString$2(t)?!1:e in i}const TRANSITION="transition",ANIMATION="animation",Transition=(i,{slots:e})=>h$1(BaseTransition,resolveTransitionProps(i),e);Transition.displayName="Transition";const DOMTransitionPropsValidators={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},TransitionPropsValidators=Transition.props=extend$3({},BaseTransitionPropsValidators,DOMTransitionPropsValidators),callHook=(i,e=[])=>{isArray$9(i)?i.forEach(t=>t(...e)):i&&i(...e)},hasExplicitCallback=i=>i?isArray$9(i)?i.some(e=>e.length>1):i.length>1:!1;function resolveTransitionProps(i){const e={};for(const O in i)O in DOMTransitionPropsValidators||(e[O]=i[O]);if(i.css===!1)return e;const{name:t="v",type:r,duration:s,enterFromClass:o="".concat(t,"-enter-from"),enterActiveClass:a="".concat(t,"-enter-active"),enterToClass:l="".concat(t,"-enter-to"),appearFromClass:c=o,appearActiveClass:u=a,appearToClass:m=l,leaveFromClass:d="".concat(t,"-leave-from"),leaveActiveClass:y="".concat(t,"-leave-active"),leaveToClass:b="".concat(t,"-leave-to")}=i,S=normalizeDuration(s),A=S&&S[0],P=S&&S[1],{onBeforeEnter:x,onEnter:E,onEnterCancelled:_,onLeave:T,onLeaveCancelled:C,onBeforeAppear:R=x,onAppear:I=E,onAppearCancelled:M=_}=e,D=(O,z,k)=>{removeTransitionClass(O,z?m:l),removeTransitionClass(O,z?u:a),k&&k()},H=(O,z)=>{O._isLeaving=!1,removeTransitionClass(O,d),removeTransitionClass(O,b),removeTransitionClass(O,y),z&&z()},W=O=>(z,k)=>{const $=O?I:E,F=()=>D(z,O,k);callHook($,[z,F]),nextFrame(()=>{removeTransitionClass(z,O?c:o),addTransitionClass(z,O?m:l),hasExplicitCallback($)||whenTransitionEnds(z,r,A,F)})};return extend$3(e,{onBeforeEnter(O){callHook(x,[O]),addTransitionClass(O,o),addTransitionClass(O,a)},onBeforeAppear(O){callHook(R,[O]),addTransitionClass(O,c),addTransitionClass(O,u)},onEnter:W(!1),onAppear:W(!0),onLeave(O,z){O._isLeaving=!0;const k=()=>H(O,z);addTransitionClass(O,d),forceReflow(),addTransitionClass(O,y),nextFrame(()=>{O._isLeaving&&(removeTransitionClass(O,d),addTransitionClass(O,b),hasExplicitCallback(T)||whenTransitionEnds(O,r,P,k))}),callHook(T,[O,k])},onEnterCancelled(O){D(O,!1),callHook(_,[O])},onAppearCancelled(O){D(O,!0),callHook(M,[O])},onLeaveCancelled(O){H(O),callHook(C,[O])}})}function normalizeDuration(i){if(i==null)return null;if(isObject$5(i))return[NumberOf(i.enter),NumberOf(i.leave)];{const e=NumberOf(i);return[e,e]}}function NumberOf(i){return toNumber$1(i)}function addTransitionClass(i,e){e.split(/\s+/).forEach(t=>t&&i.classList.add(t)),(i._vtc||(i._vtc=new Set)).add(e)}function removeTransitionClass(i,e){e.split(/\s+/).forEach(r=>r&&i.classList.remove(r));const{_vtc:t}=i;t&&(t.delete(e),t.size||(i._vtc=void 0))}function nextFrame(i){requestAnimationFrame(()=>{requestAnimationFrame(i)})}let endId=0;function whenTransitionEnds(i,e,t,r){const s=i._endId=++endId,o=()=>{s===i._endId&&r()};if(t)return setTimeout(o,t);const{type:a,timeout:l,propCount:c}=getTransitionInfo(i,e);if(!a)return r();const u=a+"end";let m=0;const d=()=>{i.removeEventListener(u,y),o()},y=b=>{b.target===i&&++m>=c&&d()};setTimeout(()=>{m(t[S]||"").split(", "),s=r("".concat(TRANSITION,"Delay")),o=r("".concat(TRANSITION,"Duration")),a=getTimeout(s,o),l=r("".concat(ANIMATION,"Delay")),c=r("".concat(ANIMATION,"Duration")),u=getTimeout(l,c);let m=null,d=0,y=0;e===TRANSITION?a>0&&(m=TRANSITION,d=a,y=o.length):e===ANIMATION?u>0&&(m=ANIMATION,d=u,y=c.length):(d=Math.max(a,u),m=d>0?a>u?TRANSITION:ANIMATION:null,y=m?m===TRANSITION?o.length:c.length:0);const b=m===TRANSITION&&/\b(transform|all)(,|$)/.test(r("".concat(TRANSITION,"Property")).toString());return{type:m,timeout:d,propCount:y,hasTransform:b}}function getTimeout(i,e){for(;i.lengthtoMs(t)+toMs(i[r])))}function toMs(i){return Number(i.slice(0,-1).replace(",","."))*1e3}function forceReflow(){return document.body.offsetHeight}const positionMap=new WeakMap,newPositionMap=new WeakMap,TransitionGroupImpl={name:"TransitionGroup",props:extend$3({},TransitionPropsValidators,{tag:String,moveClass:String}),setup(i,{slots:e}){const t=getCurrentInstance(),r=useTransitionState();let s,o;return onUpdated(()=>{if(!s.length)return;const a=i.moveClass||"".concat(i.name||"v","-move");if(!hasCSSTransform(s[0].el,t.vnode.el,a))return;s.forEach(callPendingCbs),s.forEach(recordPosition);const l=s.filter(applyTranslation);forceReflow(),l.forEach(c=>{const u=c.el,m=u.style;addTransitionClass(u,a),m.transform=m.webkitTransform=m.transitionDuration="";const d=u._moveCb=y=>{y&&y.target!==u||(!y||/transform$/.test(y.propertyName))&&(u.removeEventListener("transitionend",d),u._moveCb=null,removeTransitionClass(u,a))};u.addEventListener("transitionend",d)})}),()=>{const a=toRaw(i),l=resolveTransitionProps(a);let c=a.tag||Fragment;s=o,o=e.default?getTransitionRawChildren(e.default()):[];for(let u=0;udelete i.mode;TransitionGroupImpl.props;const TransitionGroup=TransitionGroupImpl;function callPendingCbs(i){const e=i.el;e._moveCb&&e._moveCb(),e._enterCb&&e._enterCb()}function recordPosition(i){newPositionMap.set(i,i.el.getBoundingClientRect())}function applyTranslation(i){const e=positionMap.get(i),t=newPositionMap.get(i),r=e.left-t.left,s=e.top-t.top;if(r||s){const o=i.el.style;return o.transform=o.webkitTransform="translate(".concat(r,"px,").concat(s,"px)"),o.transitionDuration="0s",i}}function hasCSSTransform(i,e,t){const r=i.cloneNode();i._vtc&&i._vtc.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),t.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const s=e.nodeType===1?e:e.parentNode;s.appendChild(r);const{hasTransform:o}=getTransitionInfo(r);return s.removeChild(r),o}const keyNames={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},withKeys=(i,e)=>t=>{if(!("key"in t))return;const r=hyphenate(t.key);if(e.some(s=>s===r||keyNames[s]===r))return i(t)},vShow={beforeMount(i,{value:e},{transition:t}){i._vod=i.style.display==="none"?"":i.style.display,t&&e?t.beforeEnter(i):setDisplay(i,e)},mounted(i,{value:e},{transition:t}){t&&e&&t.enter(i)},updated(i,{value:e,oldValue:t},{transition:r}){!e!=!t&&(r?e?(r.beforeEnter(i),setDisplay(i,!0),r.enter(i)):r.leave(i,()=>{setDisplay(i,!1)}):setDisplay(i,e))},beforeUnmount(i,{value:e}){setDisplay(i,e)}};function setDisplay(i,e){i.style.display=e?i._vod:"none"}const rendererOptions=extend$3({patchProp},nodeOps);let renderer;function ensureRenderer(){return renderer||(renderer=createRenderer(rendererOptions))}const createApp=(...i)=>{const e=ensureRenderer().createApp(...i),{mount:t}=e;return e.mount=r=>{const s=normalizeContainer(r);if(!s)return;const o=e._component;!isFunction$6(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.innerHTML="";const a=t(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),a},e};function normalizeContainer(i){return isString$2(i)?document.querySelector(i):i}/*! * vue-router v4.2.4 * (c) 2023 Eduardo San Martin Morote * @license MIT */const isBrowser=typeof window<"u";function isESModule(i){return i.__esModule||i[Symbol.toStringTag]==="Module"}const assign$2=Object.assign;function applyToParams(i,e){const t={};for(const r in e){const s=e[r];t[r]=isArray$8(s)?s.map(i):i(s)}return t}const noop$2=()=>{},isArray$8=Array.isArray,TRAILING_SLASH_RE=/\/$/,removeTrailingSlash=i=>i.replace(TRAILING_SLASH_RE,"");function parseURL(i,e,t="/"){let r,s={},o="",a="";const l=e.indexOf("#");let c=e.indexOf("?");return l=0&&(c=-1),c>-1&&(r=e.slice(0,c),o=e.slice(c+1,l>-1?l:e.length),s=i(o)),l>-1&&(r=r||e.slice(0,l),a=e.slice(l,e.length)),r=resolveRelativePath(r!=null?r:e,t),{fullPath:r+(o&&"?")+o+a,path:r,query:s,hash:a}}function stringifyURL(i,e){const t=e.query?i(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function stripBase(i,e){return!e||!i.toLowerCase().startsWith(e.toLowerCase())?i:i.slice(e.length)||"/"}function isSameRouteLocation(i,e,t){const r=e.matched.length-1,s=t.matched.length-1;return r>-1&&r===s&&isSameRouteRecord(e.matched[r],t.matched[s])&&isSameRouteLocationParams(e.params,t.params)&&i(e.query)===i(t.query)&&e.hash===t.hash}function isSameRouteRecord(i,e){return(i.aliasOf||i)===(e.aliasOf||e)}function isSameRouteLocationParams(i,e){if(Object.keys(i).length!==Object.keys(e).length)return!1;for(const t in i)if(!isSameRouteLocationParamsValue(i[t],e[t]))return!1;return!0}function isSameRouteLocationParamsValue(i,e){return isArray$8(i)?isEquivalentArray(i,e):isArray$8(e)?isEquivalentArray(e,i):i===e}function isEquivalentArray(i,e){return isArray$8(e)?i.length===e.length&&i.every((t,r)=>t===e[r]):i.length===1&&i[0]===e}function resolveRelativePath(i,e){if(i.startsWith("/"))return i;if(!i)return e;const t=e.split("/"),r=i.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=t.length-1,a,l;for(a=0;a1&&o--;else break;return t.slice(0,o).join("/")+"/"+r.slice(a-(a===r.length?1:0)).join("/")}var NavigationType;(function(i){i.pop="pop",i.push="push"})(NavigationType||(NavigationType={}));var NavigationDirection;(function(i){i.back="back",i.forward="forward",i.unknown=""})(NavigationDirection||(NavigationDirection={}));function normalizeBase(i){if(!i)if(isBrowser){const e=document.querySelector("base");i=e&&e.getAttribute("href")||"/",i=i.replace(/^\w+:\/\/[^\/]+/,"")}else i="/";return i[0]!=="/"&&i[0]!=="#"&&(i="/"+i),removeTrailingSlash(i)}const BEFORE_HASH_RE=/^[^#]+#/;function createHref(i,e){return i.replace(BEFORE_HASH_RE,"#")+e}function getElementPosition(i,e){const t=document.documentElement.getBoundingClientRect(),r=i.getBoundingClientRect();return{behavior:e.behavior,left:r.left-t.left-(e.left||0),top:r.top-t.top-(e.top||0)}}const computeScrollPosition=()=>({left:window.pageXOffset,top:window.pageYOffset});function scrollToPosition(i){let e;if("el"in i){const t=i.el,r=typeof t=="string"&&t.startsWith("#"),s=typeof t=="string"?r?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!s)return;e=getElementPosition(s,i)}else e=i;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function getScrollKey(i,e){return(history.state?history.state.position-e:-1)+i}const scrollPositions=new Map;function saveScrollPosition(i,e){scrollPositions.set(i,e)}function getSavedScrollPosition(i){const e=scrollPositions.get(i);return scrollPositions.delete(i),e}let createBaseLocation=()=>location.protocol+"//"+location.host;function createCurrentLocation(i,e){const{pathname:t,search:r,hash:s}=e,o=i.indexOf("#");if(o>-1){let l=s.includes(i.slice(o))?i.slice(o).length:1,c=s.slice(l);return c[0]!=="/"&&(c="/"+c),stripBase(c,"")}return stripBase(t,i)+r+s}function useHistoryListeners(i,e,t,r){let s=[],o=[],a=null;const l=({state:y})=>{const b=createCurrentLocation(i,location),S=t.value,A=e.value;let P=0;if(y){if(t.value=b,e.value=y,a&&a===S){a=null;return}P=A?y.position-A.position:0}else r(b);s.forEach(x=>{x(t.value,S,{delta:P,type:NavigationType.pop,direction:P?P>0?NavigationDirection.forward:NavigationDirection.back:NavigationDirection.unknown})})};function c(){a=t.value}function u(y){s.push(y);const b=()=>{const S=s.indexOf(y);S>-1&&s.splice(S,1)};return o.push(b),b}function m(){const{history:y}=window;y.state&&y.replaceState(assign$2({},y.state,{scroll:computeScrollPosition()}),"")}function d(){for(const y of o)y();o=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",m)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",m,{passive:!0}),{pauseListeners:c,listen:u,destroy:d}}function buildState(i,e,t,r=!1,s=!1){return{back:i,current:e,forward:t,replaced:r,position:window.history.length,scroll:s?computeScrollPosition():null}}function useHistoryStateNavigation(i){const{history:e,location:t}=window,r={value:createCurrentLocation(i,t)},s={value:e.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(c,u,m){const d=i.indexOf("#"),y=d>-1?(t.host&&document.querySelector("base")?i:i.slice(d))+c:createBaseLocation()+i+c;try{e[m?"replaceState":"pushState"](u,"",y),s.value=u}catch(b){console.error(b),t[m?"replace":"assign"](y)}}function a(c,u){const m=assign$2({},e.state,buildState(s.value.back,c,s.value.forward,!0),u,{position:s.value.position});o(c,m,!0),r.value=c}function l(c,u){const m=assign$2({},s.value,e.state,{forward:c,scroll:computeScrollPosition()});o(m.current,m,!0);const d=assign$2({},buildState(r.value,c,null),{position:m.position+1},u);o(c,d,!1),r.value=c}return{location:r,state:s,push:l,replace:a}}function createWebHistory(i){i=normalizeBase(i);const e=useHistoryStateNavigation(i),t=useHistoryListeners(i,e.state,e.location,e.replace);function r(o,a=!0){a||t.pauseListeners(),history.go(o)}const s=assign$2({location:"",base:i,go:r,createHref:createHref.bind(null,i)},e,t);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function createWebHashHistory(i){return i=location.host?i||location.pathname+location.search:"",i.includes("#")||(i+="#"),createWebHistory(i)}function isRouteLocation(i){return typeof i=="string"||i&&typeof i=="object"}function isRouteName(i){return typeof i=="string"||typeof i=="symbol"}const START_LOCATION_NORMALIZED={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},NavigationFailureSymbol=Symbol("");var NavigationFailureType;(function(i){i[i.aborted=4]="aborted",i[i.cancelled=8]="cancelled",i[i.duplicated=16]="duplicated"})(NavigationFailureType||(NavigationFailureType={}));function createRouterError(i,e){return assign$2(new Error,{type:i,[NavigationFailureSymbol]:!0},e)}function isNavigationFailure(i,e){return i instanceof Error&&NavigationFailureSymbol in i&&(e==null||!!(i.type&e))}const BASE_PARAM_PATTERN="[^/]+?",BASE_PATH_PARSER_OPTIONS={sensitive:!1,strict:!1,start:!0,end:!0},REGEX_CHARS_RE=/[.+*?^${}()[\]/\\]/g;function tokensToParser(i,e){const t=assign$2({},BASE_PATH_PARSER_OPTIONS,e),r=[];let s=t.start?"^":"";const o=[];for(const u of i){const m=u.length?[]:[90];t.strict&&!u.length&&(s+="/");for(let d=0;de.length?e.length===1&&e[0]===40+40?1:-1:0}function comparePathParserScore(i,e){let t=0;const r=i.score,s=e.score;for(;t0&&e[e.length-1]<0}const ROOT_TOKEN={type:0,value:""},VALID_PARAM_RE=/[a-zA-Z0-9_]/;function tokenizePath(i){if(!i)return[[]];if(i==="/")return[[ROOT_TOKEN]];if(!i.startsWith("/"))throw new Error('Invalid path "'.concat(i,'"'));function e(b){throw new Error("ERR (".concat(t,')/"').concat(u,'": ').concat(b))}let t=0,r=t;const s=[];let o;function a(){o&&s.push(o),o=[]}let l=0,c,u="",m="";function d(){u&&(t===0?o.push({type:0,value:u}):t===1||t===2||t===3?(o.length>1&&(c==="*"||c==="+")&&e("A repeatable param (".concat(u,") must be alone in its segment. eg: '/:ids+.")),o.push({type:1,value:u,regexp:m,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):e("Invalid state to consume buffer"),u="")}function y(){u+=c}for(;l{a(E)}:noop$2}function a(m){if(isRouteName(m)){const d=r.get(m);d&&(r.delete(m),t.splice(t.indexOf(d),1),d.children.forEach(a),d.alias.forEach(a))}else{const d=t.indexOf(m);d>-1&&(t.splice(d,1),m.record.name&&r.delete(m.record.name),m.children.forEach(a),m.alias.forEach(a))}}function l(){return t}function c(m){let d=0;for(;d=0&&(m.record.path!==t[d].record.path||!isRecordChildOf(m,t[d]));)d++;t.splice(d,0,m),m.record.name&&!isAliasRecord(m)&&r.set(m.record.name,m)}function u(m,d){let y,b={},S,A;if("name"in m&&m.name){if(y=r.get(m.name),!y)throw createRouterError(1,{location:m});A=y.record.name,b=assign$2(paramsFromLocation(d.params,y.keys.filter(E=>!E.optional).map(E=>E.name)),m.params&¶msFromLocation(m.params,y.keys.map(E=>E.name))),S=y.stringify(b)}else if("path"in m)S=m.path,y=t.find(E=>E.re.test(S)),y&&(b=y.parse(S),A=y.record.name);else{if(y=d.name?r.get(d.name):t.find(E=>E.re.test(d.path)),!y)throw createRouterError(1,{location:m,currentLocation:d});A=y.record.name,b=assign$2({},d.params,m.params),S=y.stringify(b)}const P=[];let x=y;for(;x;)P.unshift(x.record),x=x.parent;return{name:A,path:S,params:b,matched:P,meta:mergeMetaFields(P)}}return i.forEach(m=>o(m)),{addRoute:o,resolve:u,removeRoute:a,getRoutes:l,getRecordMatcher:s}}function paramsFromLocation(i,e){const t={};for(const r of e)r in i&&(t[r]=i[r]);return t}function normalizeRouteRecord(i){return{path:i.path,redirect:i.redirect,name:i.name,meta:i.meta||{},aliasOf:void 0,beforeEnter:i.beforeEnter,props:normalizeRecordProps(i),children:i.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in i?i.components||null:i.component&&{default:i.component}}}function normalizeRecordProps(i){const e={},t=i.props||!1;if("component"in i)e.default=t;else for(const r in i.components)e[r]=typeof t=="object"?t[r]:t;return e}function isAliasRecord(i){for(;i;){if(i.record.aliasOf)return!0;i=i.parent}return!1}function mergeMetaFields(i){return i.reduce((e,t)=>assign$2(e,t.meta),{})}function mergeOptions(i,e){const t={};for(const r in i)t[r]=r in e?e[r]:i[r];return t}function isRecordChildOf(i,e){return e.children.some(t=>t===i||isRecordChildOf(i,t))}const HASH_RE=/#/g,AMPERSAND_RE=/&/g,SLASH_RE=/\//g,EQUAL_RE=/=/g,IM_RE=/\?/g,PLUS_RE=/\+/g,ENC_BRACKET_OPEN_RE=/%5B/g,ENC_BRACKET_CLOSE_RE=/%5D/g,ENC_CARET_RE=/%5E/g,ENC_BACKTICK_RE=/%60/g,ENC_CURLY_OPEN_RE=/%7B/g,ENC_PIPE_RE=/%7C/g,ENC_CURLY_CLOSE_RE=/%7D/g,ENC_SPACE_RE=/%20/g;function commonEncode(i){return encodeURI(""+i).replace(ENC_PIPE_RE,"|").replace(ENC_BRACKET_OPEN_RE,"[").replace(ENC_BRACKET_CLOSE_RE,"]")}function encodeHash(i){return commonEncode(i).replace(ENC_CURLY_OPEN_RE,"{").replace(ENC_CURLY_CLOSE_RE,"}").replace(ENC_CARET_RE,"^")}function encodeQueryValue(i){return commonEncode(i).replace(PLUS_RE,"%2B").replace(ENC_SPACE_RE,"+").replace(HASH_RE,"%23").replace(AMPERSAND_RE,"%26").replace(ENC_BACKTICK_RE,"`").replace(ENC_CURLY_OPEN_RE,"{").replace(ENC_CURLY_CLOSE_RE,"}").replace(ENC_CARET_RE,"^")}function encodeQueryKey(i){return encodeQueryValue(i).replace(EQUAL_RE,"%3D")}function encodePath(i){return commonEncode(i).replace(HASH_RE,"%23").replace(IM_RE,"%3F")}function encodeParam(i){return i==null?"":encodePath(i).replace(SLASH_RE,"%2F")}function decode$5(i){try{return decodeURIComponent(""+i)}catch(e){}return""+i}function parseQuery(i){const e={};if(i===""||i==="?")return e;const r=(i[0]==="?"?i.slice(1):i).split("&");for(let s=0;so&&encodeQueryValue(o)):[r&&encodeQueryValue(r)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+t,o!=null&&(e+="="+o))})}return e}function normalizeQuery(i){const e={};for(const t in i){const r=i[t];r!==void 0&&(e[t]=isArray$8(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return e}const matchedRouteKey=Symbol(""),viewDepthKey=Symbol(""),routerKey=Symbol(""),routeLocationKey=Symbol(""),routerViewLocationKey=Symbol("");function useCallbacks(){let i=[];function e(r){return i.push(r),()=>{const s=i.indexOf(r);s>-1&&i.splice(s,1)}}function t(){i=[]}return{add:e,list:()=>i.slice(),reset:t}}function guardToPromiseFn(i,e,t,r,s){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(createRouterError(4,{from:t,to:e})):d instanceof Error?l(d):isRouteLocation(d)?l(createRouterError(2,{from:e,to:d})):(o&&r.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i.call(r&&r.instances[s],e,t,c);let m=Promise.resolve(u);i.length<3&&(m=m.then(c)),m.catch(d=>l(d))})}function extractComponentsGuards(i,e,t,r){const s=[];for(const o of i)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(isRouteComponent(l)){const u=(l.__vccOpts||l)[e];u&&s.push(guardToPromiseFn(u,t,r,o,a))}else{let c=l();s.push(()=>c.then(u=>{if(!u)return Promise.reject(new Error("Couldn't resolve component \"".concat(a,'" at "').concat(o.path,'"')));const m=isESModule(u)?u.default:u;o.components[a]=m;const y=(m.__vccOpts||m)[e];return y&&guardToPromiseFn(y,t,r,o,a)()}))}}return s}function isRouteComponent(i){return typeof i=="object"||"displayName"in i||"props"in i||"__vccOpts"in i}function useLink(i){const e=inject(routerKey),t=inject(routeLocationKey),r=computed(()=>e.resolve(unref(i.to))),s=computed(()=>{const{matched:c}=r.value,{length:u}=c,m=c[u-1],d=t.matched;if(!m||!d.length)return-1;const y=d.findIndex(isSameRouteRecord.bind(null,m));if(y>-1)return y;const b=getOriginalPath(c[u-2]);return u>1&&getOriginalPath(m)===b&&d[d.length-1].path!==b?d.findIndex(isSameRouteRecord.bind(null,c[u-2])):y}),o=computed(()=>s.value>-1&&includesParams(t.params,r.value.params)),a=computed(()=>s.value>-1&&s.value===t.matched.length-1&&isSameRouteLocationParams(t.params,r.value.params));function l(c={}){return guardEvent(c)?e[unref(i.replace)?"replace":"push"](unref(i.to)).catch(noop$2):Promise.resolve()}return{route:r,href:computed(()=>r.value.href),isActive:o,isExactActive:a,navigate:l}}const RouterLinkImpl=defineComponent({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink,setup(i,{slots:e}){const t=reactive(useLink(i)),{options:r}=inject(routerKey),s=computed(()=>({[getLinkClass(i.activeClass,r.linkActiveClass,"router-link-active")]:t.isActive,[getLinkClass(i.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const o=e.default&&e.default(t);return i.custom?o:h$1("a",{"aria-current":t.isExactActive?i.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:s.value},o)}}}),RouterLink=RouterLinkImpl;function guardEvent(i){if(!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)&&!i.defaultPrevented&&!(i.button!==void 0&&i.button!==0)){if(i.currentTarget&&i.currentTarget.getAttribute){const e=i.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return i.preventDefault&&i.preventDefault(),!0}}function includesParams(i,e){for(const t in e){const r=e[t],s=i[t];if(typeof r=="string"){if(r!==s)return!1}else if(!isArray$8(s)||s.length!==r.length||r.some((o,a)=>o!==s[a]))return!1}return!0}function getOriginalPath(i){return i?i.aliasOf?i.aliasOf.path:i.path:""}const getLinkClass=(i,e,t)=>i!=null?i:e!=null?e:t,RouterViewImpl=defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(i,{attrs:e,slots:t}){const r=inject(routerViewLocationKey),s=computed(()=>i.route||r.value),o=inject(viewDepthKey,0),a=computed(()=>{let u=unref(o);const{matched:m}=s.value;let d;for(;(d=m[u])&&!d.components;)u++;return u}),l=computed(()=>s.value.matched[a.value]);provide(viewDepthKey,computed(()=>a.value+1)),provide(matchedRouteKey,l),provide(routerViewLocationKey,s);const c=ref();return watch(()=>[c.value,l.value,i.name],([u,m,d],[y,b,S])=>{m&&(m.instances[d]=u,b&&b!==m&&u&&u===y&&(m.leaveGuards.size||(m.leaveGuards=b.leaveGuards),m.updateGuards.size||(m.updateGuards=b.updateGuards))),u&&m&&(!b||!isSameRouteRecord(m,b)||!y)&&(m.enterCallbacks[d]||[]).forEach(A=>A(u))},{flush:"post"}),()=>{const u=s.value,m=i.name,d=l.value,y=d&&d.components[m];if(!y)return normalizeSlot(t.default,{Component:y,route:u});const b=d.props[m],S=b?b===!0?u.params:typeof b=="function"?b(u):b:null,P=h$1(y,assign$2({},S,e,{onVnodeUnmounted:x=>{x.component.isUnmounted&&(d.instances[m]=null)},ref:c}));return normalizeSlot(t.default,{Component:P,route:u})||P}}});function normalizeSlot(i,e){if(!i)return null;const t=i(e);return t.length===1?t[0]:t}const RouterView=RouterViewImpl;function createRouter(i){const e=createRouterMatcher(i.routes,i),t=i.parseQuery||parseQuery,r=i.stringifyQuery||stringifyQuery,s=i.history,o=useCallbacks(),a=useCallbacks(),l=useCallbacks(),c=shallowRef(START_LOCATION_NORMALIZED);let u=START_LOCATION_NORMALIZED;isBrowser&&i.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const m=applyToParams.bind(null,oe=>""+oe),d=applyToParams.bind(null,encodeParam),y=applyToParams.bind(null,decode$5);function b(oe,ue){let fe,be;return isRouteName(oe)?(fe=e.getRecordMatcher(oe),be=ue):be=oe,e.addRoute(be,fe)}function S(oe){const ue=e.getRecordMatcher(oe);ue&&e.removeRoute(ue)}function A(){return e.getRoutes().map(oe=>oe.record)}function P(oe){return!!e.getRecordMatcher(oe)}function x(oe,ue){if(ue=assign$2({},ue||c.value),typeof oe=="string"){const B=parseURL(t,oe,ue.path),re=e.resolve({path:B.path},ue),Z=s.createHref(B.fullPath);return assign$2(B,re,{params:y(re.params),hash:decode$5(B.hash),redirectedFrom:void 0,href:Z})}let fe;if("path"in oe)fe=assign$2({},oe,{path:parseURL(t,oe.path,ue.path).path});else{const B=assign$2({},oe.params);for(const re in B)B[re]==null&&delete B[re];fe=assign$2({},oe,{params:d(B)}),ue.params=d(ue.params)}const be=e.resolve(fe,ue),Ee=oe.hash||"";be.params=m(y(be.params));const ee=stringifyURL(r,assign$2({},oe,{hash:encodeHash(Ee),path:be.path})),te=s.createHref(ee);return assign$2({fullPath:ee,hash:Ee,query:r===stringifyQuery?normalizeQuery(oe.query):oe.query||{}},be,{redirectedFrom:void 0,href:te})}function E(oe){return typeof oe=="string"?parseURL(t,oe,c.value.path):assign$2({},oe)}function _(oe,ue){if(u!==oe)return createRouterError(8,{from:ue,to:oe})}function T(oe){return I(oe)}function C(oe){return T(assign$2(E(oe),{replace:!0}))}function R(oe){const ue=oe.matched[oe.matched.length-1];if(ue&&ue.redirect){const{redirect:fe}=ue;let be=typeof fe=="function"?fe(oe):fe;return typeof be=="string"&&(be=be.includes("?")||be.includes("#")?be=E(be):{path:be},be.params={}),assign$2({query:oe.query,hash:oe.hash,params:"path"in be?{}:oe.params},be)}}function I(oe,ue){const fe=u=x(oe),be=c.value,Ee=oe.state,ee=oe.force,te=oe.replace===!0,B=R(fe);if(B)return I(assign$2(E(B),{state:typeof B=="object"?assign$2({},Ee,B.state):Ee,force:ee,replace:te}),ue||fe);const re=fe;re.redirectedFrom=ue;let Z;return!ee&&isSameRouteLocation(r,be,fe)&&(Z=createRouterError(16,{to:re,from:be}),U(be,be,!0,!1)),(Z?Promise.resolve(Z):H(re,be)).catch(Y=>isNavigationFailure(Y)?isNavigationFailure(Y,2)?Y:K(Y):N(Y,re,be)).then(Y=>{if(Y){if(isNavigationFailure(Y,2))return I(assign$2({replace:te},E(Y.to),{state:typeof Y.to=="object"?assign$2({},Ee,Y.to.state):Ee,force:ee}),ue||re)}else Y=O(re,be,!0,te,Ee);return W(re,be,Y),Y})}function M(oe,ue){const fe=_(oe,ue);return fe?Promise.reject(fe):Promise.resolve()}function D(oe){const ue=he.values().next().value;return ue&&typeof ue.runWithContext=="function"?ue.runWithContext(oe):oe()}function H(oe,ue){let fe;const[be,Ee,ee]=extractChangingRecords(oe,ue);fe=extractComponentsGuards(be.reverse(),"beforeRouteLeave",oe,ue);for(const B of be)B.leaveGuards.forEach(re=>{fe.push(guardToPromiseFn(re,oe,ue))});const te=M.bind(null,oe,ue);return fe.push(te),Se(fe).then(()=>{fe=[];for(const B of o.list())fe.push(guardToPromiseFn(B,oe,ue));return fe.push(te),Se(fe)}).then(()=>{fe=extractComponentsGuards(Ee,"beforeRouteUpdate",oe,ue);for(const B of Ee)B.updateGuards.forEach(re=>{fe.push(guardToPromiseFn(re,oe,ue))});return fe.push(te),Se(fe)}).then(()=>{fe=[];for(const B of ee)if(B.beforeEnter)if(isArray$8(B.beforeEnter))for(const re of B.beforeEnter)fe.push(guardToPromiseFn(re,oe,ue));else fe.push(guardToPromiseFn(B.beforeEnter,oe,ue));return fe.push(te),Se(fe)}).then(()=>(oe.matched.forEach(B=>B.enterCallbacks={}),fe=extractComponentsGuards(ee,"beforeRouteEnter",oe,ue),fe.push(te),Se(fe))).then(()=>{fe=[];for(const B of a.list())fe.push(guardToPromiseFn(B,oe,ue));return fe.push(te),Se(fe)}).catch(B=>isNavigationFailure(B,8)?B:Promise.reject(B))}function W(oe,ue,fe){l.list().forEach(be=>D(()=>be(oe,ue,fe)))}function O(oe,ue,fe,be,Ee){const ee=_(oe,ue);if(ee)return ee;const te=ue===START_LOCATION_NORMALIZED,B=isBrowser?history.state:{};fe&&(be||te?s.replace(oe.fullPath,assign$2({scroll:te&&B&&B.scroll},Ee)):s.push(oe.fullPath,Ee)),c.value=oe,U(oe,ue,fe,te),K()}let z;function k(){z||(z=s.listen((oe,ue,fe)=>{if(!le.listening)return;const be=x(oe),Ee=R(be);if(Ee){I(assign$2(Ee,{replace:!0}),be).catch(noop$2);return}u=be;const ee=c.value;isBrowser&&saveScrollPosition(getScrollKey(ee.fullPath,fe.delta),computeScrollPosition()),H(be,ee).catch(te=>isNavigationFailure(te,12)?te:isNavigationFailure(te,2)?(I(te.to,be).then(B=>{isNavigationFailure(B,20)&&!fe.delta&&fe.type===NavigationType.pop&&s.go(-1,!1)}).catch(noop$2),Promise.reject()):(fe.delta&&s.go(-fe.delta,!1),N(te,be,ee))).then(te=>{te=te||O(be,ee,!1),te&&(fe.delta&&!isNavigationFailure(te,8)?s.go(-fe.delta,!1):fe.type===NavigationType.pop&&isNavigationFailure(te,20)&&s.go(-1,!1)),W(be,ee,te)}).catch(noop$2)}))}let $=useCallbacks(),F=useCallbacks(),G;function N(oe,ue,fe){K(oe);const be=F.list();return be.length?be.forEach(Ee=>Ee(oe,ue,fe)):console.error(oe),Promise.reject(oe)}function V(){return G&&c.value!==START_LOCATION_NORMALIZED?Promise.resolve():new Promise((oe,ue)=>{$.add([oe,ue])})}function K(oe){return G||(G=!oe,k(),$.list().forEach(([ue,fe])=>oe?fe(oe):ue()),$.reset()),oe}function U(oe,ue,fe,be){const{scrollBehavior:Ee}=i;if(!isBrowser||!Ee)return Promise.resolve();const ee=!fe&&getSavedScrollPosition(getScrollKey(oe.fullPath,0))||(be||!fe)&&history.state&&history.state.scroll||null;return nextTick().then(()=>Ee(oe,ue,ee)).then(te=>te&&scrollToPosition(te)).catch(te=>N(te,oe,ue))}const J=oe=>s.go(oe);let me;const he=new Set,le={currentRoute:c,listening:!0,addRoute:b,removeRoute:S,hasRoute:P,getRoutes:A,resolve:x,options:i,push:T,replace:C,go:J,back:()=>J(-1),forward:()=>J(1),beforeEach:o.add,beforeResolve:a.add,afterEach:l.add,onError:F.add,isReady:V,install(oe){const ue=this;oe.component("RouterLink",RouterLink),oe.component("RouterView",RouterView),oe.config.globalProperties.$router=ue,Object.defineProperty(oe.config.globalProperties,"$route",{enumerable:!0,get:()=>unref(c)}),isBrowser&&!me&&c.value===START_LOCATION_NORMALIZED&&(me=!0,T(s.location).catch(Ee=>{}));const fe={};for(const Ee in START_LOCATION_NORMALIZED)Object.defineProperty(fe,Ee,{get:()=>c.value[Ee],enumerable:!0});oe.provide(routerKey,ue),oe.provide(routeLocationKey,shallowReactive(fe)),oe.provide(routerViewLocationKey,c);const be=oe.unmount;he.add(oe),oe.unmount=function(){he.delete(oe),he.size<1&&(u=START_LOCATION_NORMALIZED,z&&z(),z=null,c.value=START_LOCATION_NORMALIZED,me=!1,G=!1),be()}}};function Se(oe){return oe.reduce((ue,fe)=>ue.then(()=>D(fe)),Promise.resolve())}return le}function extractChangingRecords(i,e){const t=[],r=[],s=[],o=Math.max(e.matched.length,i.matched.length);for(let a=0;aisSameRouteRecord(u,l))?r.push(l):t.push(l));const c=i.matched[a];c&&(e.matched.find(u=>isSameRouteRecord(u,c))||s.push(c))}return[t,r,s]}function useRouter(){return inject(routerKey)}function useRoute$1(){return inject(routeLocationKey)}function noop$1(){}const extend$2=Object.assign,inBrowser$2=typeof window<"u",isObject$4=i=>i!==null&&typeof i=="object",isDef$1=i=>i!=null,isFunction$5=i=>typeof i=="function",isPromise=i=>isObject$4(i)&&isFunction$5(i.then)&&isFunction$5(i.catch),isNumeric=i=>typeof i=="number"||/^\d+(\.\d+)?$/.test(i),isIOS$1=()=>inBrowser$2?/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()):!1;function get(i,e){const t=e.split(".");let r=i;return t.forEach(s=>{var o;r=isObject$4(r)&&(o=r[s])!=null?o:""}),r}function pick$1(i,e,t){return e.reduce((r,s)=>((!t||i[s]!==void 0)&&(r[s]=i[s]),r),{})}const isSameValue=(i,e)=>JSON.stringify(i)===JSON.stringify(e),toArray=i=>Array.isArray(i)?i:[i],unknownProp=null,numericProp=[Number,String],truthProp={type:Boolean,default:!0},makeRequiredProp=i=>({type:i,required:!0}),makeArrayProp=()=>({type:Array,default:()=>[]}),makeNumberProp=i=>({type:Number,default:i}),makeNumericProp=i=>({type:numericProp,default:i}),makeStringProp=i=>({type:String,default:i});var inBrowser$1=typeof window<"u";function raf(i){return inBrowser$1?requestAnimationFrame(i):-1}function cancelRaf(i){inBrowser$1&&cancelAnimationFrame(i)}function doubleRaf(i){raf(()=>raf(i))}var isWindow$1=i=>i===window,makeDOMRect=(i,e)=>({top:0,left:0,right:i,bottom:e,width:i,height:e}),useRect=i=>{const e=unref(i);if(isWindow$1(e)){const t=e.innerWidth,r=e.innerHeight;return makeDOMRect(t,r)}return e!=null&&e.getBoundingClientRect?e.getBoundingClientRect():makeDOMRect(0,0)};function useParent$1(i){const e=inject(i,null);if(e){const t=getCurrentInstance(),{link:r,unlink:s,internalChildren:o}=e;r(t),onUnmounted(()=>s(t));const a=computed(()=>o.indexOf(t));return{parent:e,index:a}}return{parent:null,index:ref(-1)}}function flattenVNodes(i){const e=[],t=r=>{Array.isArray(r)&&r.forEach(s=>{var o;isVNode(s)&&(e.push(s),(o=s.component)!=null&&o.subTree&&(e.push(s.component.subTree),t(s.component.subTree.children)),s.children&&t(s.children))})};return t(i),e}var findVNodeIndex=(i,e)=>{const t=i.indexOf(e);return t===-1?i.findIndex(r=>e.key!==void 0&&e.key!==null&&r.type===e.type&&r.key===e.key):t};function sortChildren(i,e,t){const r=flattenVNodes(i.subTree.children);t.sort((o,a)=>findVNodeIndex(r,o.vnode)-findVNodeIndex(r,a.vnode));const s=t.map(o=>o.proxy);e.sort((o,a)=>{const l=s.indexOf(o),c=s.indexOf(a);return l-c})}function useChildren$1(i){const e=reactive([]),t=reactive([]),r=getCurrentInstance();return{children:e,linkChildren:o=>{provide(i,Object.assign({link:c=>{c.proxy&&(t.push(c),e.push(c.proxy),sortChildren(r,e,t))},unlink:c=>{const u=t.indexOf(c);e.splice(u,1),t.splice(u,1)},children:e,internalChildren:t},o))}}}function onMountedOrActivated(i){let e;onMounted(()=>{i(),nextTick(()=>{e=!0})}),onActivated(()=>{e&&i()})}function useEventListener$1(i,e,t={}){if(!inBrowser$1)return;const{target:r=window,passive:s=!1,capture:o=!1}=t;let a=!1,l;const c=d=>{if(a)return;const y=unref(d);y&&!l&&(y.addEventListener(i,e,{capture:o,passive:s}),l=!0)},u=d=>{if(a)return;const y=unref(d);y&&l&&(y.removeEventListener(i,e,o),l=!1)};onUnmounted(()=>u(r)),onDeactivated(()=>u(r)),onMountedOrActivated(()=>c(r));let m;return isRef(r)&&(m=watch(r,(d,y)=>{u(y),c(d)})),()=>{m==null||m(),u(r),a=!0}}function useClickAway(i,e,t={}){if(!inBrowser$1)return;const{eventName:r="click"}=t;useEventListener$1(r,o=>{(Array.isArray(i)?i:[i]).every(c=>{const u=unref(c);return u&&!u.contains(o.target)})&&e(o)},{target:document})}var width,height;function useWindowSize(){if(!width&&(width=ref(0),height=ref(0),inBrowser$1)){const i=()=>{width.value=window.innerWidth,height.value=window.innerHeight};i(),window.addEventListener("resize",i,{passive:!0}),window.addEventListener("orientationchange",i,{passive:!0})}return{width,height}}var overflowScrollReg=/scroll|auto|overlay/i,defaultRoot=inBrowser$1?window:void 0;function isElement$1(i){return i.tagName!=="HTML"&&i.tagName!=="BODY"&&i.nodeType===1}function getScrollParent(i,e=defaultRoot){let t=i;for(;t&&t!==e&&isElement$1(t);){const{overflowY:r}=window.getComputedStyle(t);if(overflowScrollReg.test(r))return t;t=t.parentNode}return e}function useScrollParent(i,e=defaultRoot){const t=ref();return onMounted(()=>{i.value&&(t.value=getScrollParent(i.value,e))}),t}var visibility;function usePageVisibility(){if(!visibility&&(visibility=ref("visible"),inBrowser$1)){const i=()=>{visibility.value=document.hidden?"hidden":"visible"};i(),window.addEventListener("visibilitychange",i)}return visibility}var CUSTOM_FIELD_INJECTION_KEY=Symbol("van-field");function useCustomFieldValue(i){const e=inject(CUSTOM_FIELD_INJECTION_KEY,null);e&&!e.customValue.value&&(e.customValue.value=i,watch(i,()=>{e.resetValidation(),e.validateWithTrigger("onChange")}))}function getScrollTop(i){const e="scrollTop"in i?i.scrollTop:i.pageYOffset;return Math.max(e,0)}function setScrollTop(i,e){"scrollTop"in i?i.scrollTop=e:i.scrollTo(i.scrollX,e)}function getRootScrollTop(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function setRootScrollTop(i){setScrollTop(window,i),setScrollTop(document.body,i)}function getElementTop(i,e){if(i===window)return 0;const t=e?getScrollTop(e):getRootScrollTop();return useRect(i).top+t}const isIOS=isIOS$1();function resetScroll(){isIOS&&setRootScrollTop(getRootScrollTop())}const stopPropagation=i=>i.stopPropagation();function preventDefault(i,e){(typeof i.cancelable!="boolean"||i.cancelable)&&i.preventDefault(),e&&stopPropagation(i)}function isHidden(i){const e=unref(i);if(!e)return!1;const t=window.getComputedStyle(e),r=t.display==="none",s=e.offsetParent===null&&t.position!=="fixed";return r||s}const{width:windowWidth,height:windowHeight}=useWindowSize();function addUnit(i){if(isDef$1(i))return isNumeric(i)?"".concat(i,"px"):String(i)}function getSizeStyle(i){if(isDef$1(i)){if(Array.isArray(i))return{width:addUnit(i[0]),height:addUnit(i[1])};const e=addUnit(i);return{width:e,height:e}}}function getZIndexStyle(i){const e={};return i!==void 0&&(e.zIndex=+i),e}let rootFontSize;function getRootFontSize(){if(!rootFontSize){const i=document.documentElement,e=i.style.fontSize||window.getComputedStyle(i).fontSize;rootFontSize=parseFloat(e)}return rootFontSize}function convertRem(i){return i=i.replace(/rem/g,""),+i*getRootFontSize()}function convertVw(i){return i=i.replace(/vw/g,""),+i*windowWidth.value/100}function convertVh(i){return i=i.replace(/vh/g,""),+i*windowHeight.value/100}function unitToPx(i){if(typeof i=="number")return i;if(inBrowser$2){if(i.includes("rem"))return convertRem(i);if(i.includes("vw"))return convertVw(i);if(i.includes("vh"))return convertVh(i)}return parseFloat(i)}const camelizeRE=/-(\w)/g,camelize$1=i=>i.replace(camelizeRE,(e,t)=>t.toUpperCase()),clamp=(i,e,t)=>Math.min(Math.max(i,e),t);function trimExtraChar(i,e,t){const r=i.indexOf(e);return r===-1?i:e==="-"&&r!==0?i.slice(0,r):i.slice(0,r+1)+i.slice(r).replace(t,"")}function formatNumber(i,e=!0,t=!0){e?i=trimExtraChar(i,".",/\./g):i=i.split(".")[0],t?i=trimExtraChar(i,"-",/-/g):i=i.replace(/-/,"");const r=e?/[^-0-9.]/g:/[^-0-9]/g;return i.replace(r,"")}function addNumber(i,e){return Math.round((i+e)*1e10)/1e10}const{hasOwnProperty:hasOwnProperty$d}=Object.prototype;function assignKey(i,e,t){const r=e[t];isDef$1(r)&&(!hasOwnProperty$d.call(i,t)||!isObject$4(r)?i[t]=r:i[t]=deepAssign(Object(i[t]),r))}function deepAssign(i,e){return Object.keys(e).forEach(t=>{assignKey(i,e,t)}),i}var stdin_default$i={name:"姓名",tel:"电话",save:"保存",clear:"清空",cancel:"取消",confirm:"确认",delete:"删除",loading:"加载中...",noCoupon:"暂无优惠券",nameEmpty:"请填写姓名",addContact:"添加联系人",telInvalid:"请填写正确的电话",vanCalendar:{end:"结束",start:"开始",title:"日期选择",weekdays:["日","一","二","三","四","五","六"],monthTitle:(i,e)=>"".concat(i,"年").concat(e,"月"),rangePrompt:i=>"最多选择 ".concat(i," 天")},vanCascader:{select:"请选择"},vanPagination:{prev:"上一页",next:"下一页"},vanPullRefresh:{pulling:"下拉即可刷新...",loosing:"释放即可刷新..."},vanSubmitBar:{label:"合计:"},vanCoupon:{unlimited:"无门槛",discount:i=>"".concat(i,"折"),condition:i=>"满".concat(i,"元可用")},vanCouponCell:{title:"优惠券",count:i=>"".concat(i,"张可用")},vanCouponList:{exchange:"兑换",close:"不使用",enable:"可用",disabled:"不可用",placeholder:"输入优惠码"},vanAddressEdit:{area:"地区",areaEmpty:"请选择地区",addressEmpty:"请填写详细地址",addressDetail:"详细地址",defaultAddress:"设为默认收货地址"},vanAddressList:{add:"新增地址"}};const lang=ref("zh-CN"),messages=reactive({"zh-CN":stdin_default$i}),Locale={messages(){return messages[lang.value]},use(i,e){lang.value=i,this.add({[i]:e})},add(i={}){deepAssign(messages,i)}};var stdin_default$h=Locale;function createTranslate(i){const e=camelize$1(i)+".";return(t,...r)=>{const s=stdin_default$h.messages(),o=get(s,e+t)||get(s,t);return isFunction$5(o)?o(...r):o}}function genBem(i,e){return e?typeof e=="string"?" ".concat(i,"--").concat(e):Array.isArray(e)?e.reduce((t,r)=>t+genBem(i,r),""):Object.keys(e).reduce((t,r)=>t+(e[r]?genBem(i,r):""),""):""}function createBEM(i){return(e,t)=>(e&&typeof e!="string"&&(t=e,e=""),e=e?"".concat(i,"__").concat(e):i,"".concat(e).concat(genBem(e,t)))}function createNamespace$1(i){const e="van-".concat(i);return[e,createBEM(e),createTranslate(e)]}const BORDER="van-hairline",BORDER_TOP="".concat(BORDER,"--top"),BORDER_LEFT="".concat(BORDER,"--left"),BORDER_RIGHT="".concat(BORDER,"--right"),BORDER_BOTTOM="".concat(BORDER,"--bottom"),BORDER_SURROUND="".concat(BORDER,"--surround"),BORDER_TOP_BOTTOM="".concat(BORDER,"--top-bottom"),BORDER_UNSET_TOP_BOTTOM="".concat(BORDER,"-unset--top-bottom"),HAPTICS_FEEDBACK="van-haptics-feedback",FORM_KEY=Symbol("van-form"),TAP_OFFSET=5;function callInterceptor(i,{args:e=[],done:t,canceled:r}){if(i){const s=i.apply(null,e);isPromise(s)?s.then(o=>{o?t():r&&r()}).catch(noop$1):s?t():r&&r()}else t()}function withInstall$1(i){return i.install=e=>{const{name:t}=i;t&&(e.component(t,i),e.component(camelize$1("-".concat(t)),i))},i}const POPUP_TOGGLE_KEY=Symbol();function onPopupReopen(i){const e=inject(POPUP_TOGGLE_KEY,null);e&&watch(e,t=>{t&&i()})}const useHeight=(i,e)=>{const t=ref(),r=()=>{t.value=useRect(i).height};return onMounted(()=>{if(nextTick(r),e)for(let s=1;s<=3;s++)setTimeout(r,100*s)}),onPopupReopen(()=>nextTick(r)),watch([windowWidth,windowHeight],r),t};function usePlaceholder(i,e){const t=useHeight(i,!0);return r=>createVNode("div",{class:e("placeholder"),style:{height:t.value?"".concat(t.value,"px"):void 0}},[r()])}function useExpose(i){const e=getCurrentInstance();e&&extend$2(e.proxy,i)}const routeProps={to:[String,Object],url:String,replace:Boolean};function route({to:i,url:e,replace:t,$router:r}){i&&r?r[t?"replace":"push"](i):e&&(t?location.replace(e):location.href=e)}function useRoute(){const i=getCurrentInstance().proxy;return()=>route(i)}const[name$m,bem$e]=createNamespace$1("badge"),badgeProps={dot:Boolean,max:numericProp,tag:makeStringProp("div"),color:String,offset:Array,content:numericProp,showZero:truthProp,position:makeStringProp("top-right")};var stdin_default$g=defineComponent({name:name$m,props:badgeProps,setup(i,{slots:e}){const t=()=>{if(e.content)return!0;const{content:l,showZero:c}=i;return isDef$1(l)&&l!==""&&(c||l!==0&&l!=="0")},r=()=>{const{dot:l,max:c,content:u}=i;if(!l&&t())return e.content?e.content():isDef$1(c)&&isNumeric(u)&&+u>+c?"".concat(c,"+"):u},s=l=>l.startsWith("-")?l.replace("-",""):"-".concat(l),o=computed(()=>{const l={background:i.color};if(i.offset){const[c,u]=i.offset,{position:m}=i,[d,y]=m.split("-");e.default?(typeof u=="number"?l[d]=addUnit(d==="top"?u:-u):l[d]=d==="top"?addUnit(u):s(u),typeof c=="number"?l[y]=addUnit(y==="left"?c:-c):l[y]=y==="left"?addUnit(c):s(c)):(l.marginTop=addUnit(u),l.marginLeft=addUnit(c))}return l}),a=()=>{if(t()||i.dot)return createVNode("div",{class:bem$e([i.position,{dot:i.dot,fixed:!!e.default}]),style:o.value},[r()])};return()=>{if(e.default){const{tag:l}=i;return createVNode(l,{class:bem$e("wrapper")},{default:()=>[e.default(),a()]})}return a()}}});const Badge=withInstall$1(stdin_default$g);let globalZIndex=2e3;const useGlobalZIndex=()=>++globalZIndex,[name$l,bem$d]=createNamespace$1("config-provider"),CONFIG_PROVIDER_KEY=Symbol(name$l),[name$k,bem$c]=createNamespace$1("icon"),isImage=i=>i==null?void 0:i.includes("/"),iconProps={dot:Boolean,tag:makeStringProp("i"),name:String,size:numericProp,badge:numericProp,color:String,badgeProps:Object,classPrefix:String};var stdin_default$f=defineComponent({name:name$k,props:iconProps,setup(i,{slots:e}){const t=inject(CONFIG_PROVIDER_KEY,null),r=computed(()=>i.classPrefix||(t==null?void 0:t.iconPrefix)||bem$c());return()=>{const{tag:s,dot:o,name:a,size:l,badge:c,color:u}=i,m=isImage(a);return createVNode(Badge,mergeProps({dot:o,tag:s,class:[r.value,m?"":"".concat(r.value,"-").concat(a)],style:{color:u,fontSize:addUnit(l)},content:c},i.badgeProps),{default:()=>{var d;return[(d=e.default)==null?void 0:d.call(e),m&&createVNode("img",{class:bem$c("image"),src:a},null)]}})}}});const Icon$1=withInstall$1(stdin_default$f),[name$j,bem$b]=createNamespace$1("loading"),SpinIcon=Array(12).fill(null).map((i,e)=>createVNode("i",{class:bem$b("line",String(e+1))},null)),CircularIcon=createVNode("svg",{class:bem$b("circular"),viewBox:"25 25 50 50"},[createVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),loadingProps={size:numericProp,type:makeStringProp("circular"),color:String,vertical:Boolean,textSize:numericProp,textColor:String};var stdin_default$e=defineComponent({name:name$j,props:loadingProps,setup(i,{slots:e}){const t=computed(()=>extend$2({color:i.color},getSizeStyle(i.size))),r=()=>{const o=i.type==="spinner"?SpinIcon:CircularIcon;return createVNode("span",{class:bem$b("spinner",i.type),style:t.value},[e.icon?e.icon():o])},s=()=>{var o;if(e.default)return createVNode("span",{class:bem$b("text"),style:{fontSize:addUnit(i.textSize),color:(o=i.textColor)!=null?o:i.color}},[e.default()])};return()=>{const{type:o,vertical:a}=i;return createVNode("div",{class:bem$b([o,{vertical:a}]),"aria-live":"polite","aria-busy":!0},[r(),s()])}}});const Loading$1=withInstall$1(stdin_default$e),[name$i,bem$a]=createNamespace$1("button"),buttonProps=extend$2({},routeProps,{tag:makeStringProp("button"),text:String,icon:String,type:makeStringProp("default"),size:makeStringProp("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:makeStringProp("button"),loadingSize:numericProp,loadingText:String,loadingType:String,iconPosition:makeStringProp("left")});var stdin_default$d=defineComponent({name:name$i,props:buttonProps,emits:["click"],setup(i,{emit:e,slots:t}){const r=useRoute(),s=()=>t.loading?t.loading():createVNode(Loading$1,{size:i.loadingSize,type:i.loadingType,class:bem$a("loading")},null),o=()=>{if(i.loading)return s();if(t.icon)return createVNode("div",{class:bem$a("icon")},[t.icon()]);if(i.icon)return createVNode(Icon$1,{name:i.icon,class:bem$a("icon"),classPrefix:i.iconPrefix},null)},a=()=>{let u;if(i.loading?u=i.loadingText:u=t.default?t.default():i.text,u)return createVNode("span",{class:bem$a("text")},[u])},l=()=>{const{color:u,plain:m}=i;if(u){const d={color:m?u:"white"};return m||(d.background=u),u.includes("gradient")?d.border=0:d.borderColor=u,d}},c=u=>{i.loading?preventDefault(u):i.disabled||(e("click",u),r())};return()=>{const{tag:u,type:m,size:d,block:y,round:b,plain:S,square:A,loading:P,disabled:x,hairline:E,nativeType:_,iconPosition:T}=i,C=[bem$a([m,d,{plain:S,block:y,round:b,square:A,loading:P,disabled:x,hairline:E}]),{[BORDER_SURROUND]:E}];return createVNode(u,{type:_,class:C,style:l(),disabled:x,onClick:c},{default:()=>[createVNode("div",{class:bem$a("content")},[T==="left"&&o(),a(),T==="right"&&o()])]})}}});const Button$1=withInstall$1(stdin_default$d),popupSharedProps={show:Boolean,zIndex:numericProp,overlay:truthProp,duration:numericProp,teleport:[String,Object],lockScroll:truthProp,lazyRender:truthProp,beforeClose:Function,overlayStyle:Object,overlayClass:unknownProp,transitionAppear:Boolean,closeOnClickOverlay:truthProp},popupSharedPropKeys=Object.keys(popupSharedProps);function getDirection(i,e){return i>e?"horizontal":e>i?"vertical":""}function useTouch(){const i=ref(0),e=ref(0),t=ref(0),r=ref(0),s=ref(0),o=ref(0),a=ref(""),l=ref(!0),c=()=>a.value==="vertical",u=()=>a.value==="horizontal",m=()=>{t.value=0,r.value=0,s.value=0,o.value=0,a.value="",l.value=!0};return{move:b=>{const S=b.touches[0];t.value=(S.clientX<0?0:S.clientX)-i.value,r.value=S.clientY-e.value,s.value=Math.abs(t.value),o.value=Math.abs(r.value);const A=10;(!a.value||s.valueTAP_OFFSET||o.value>TAP_OFFSET)&&(l.value=!1)},start:b=>{m(),i.value=b.touches[0].clientX,e.value=b.touches[0].clientY},reset:m,startX:i,startY:e,deltaX:t,deltaY:r,offsetX:s,offsetY:o,direction:a,isVertical:c,isHorizontal:u,isTap:l}}let totalLockCount=0;const BODY_LOCK_CLASS="van-overflow-hidden";function useLockScroll(i,e){const t=useTouch(),r="01",s="10",o=m=>{t.move(m);const d=t.deltaY.value>0?s:r,y=getScrollParent(m.target,i.value),{scrollHeight:b,offsetHeight:S,scrollTop:A}=y;let P="11";A===0?P=S>=b?"00":"01":A+S>=b&&(P="10"),P!=="11"&&t.isVertical()&&!(parseInt(P,2)&parseInt(d,2))&&preventDefault(m,!0)},a=()=>{document.addEventListener("touchstart",t.start),document.addEventListener("touchmove",o,{passive:!1}),totalLockCount||document.body.classList.add(BODY_LOCK_CLASS),totalLockCount++},l=()=>{totalLockCount&&(document.removeEventListener("touchstart",t.start),document.removeEventListener("touchmove",o),totalLockCount--,totalLockCount||document.body.classList.remove(BODY_LOCK_CLASS))},c=()=>e()&&a(),u=()=>e()&&l();onMountedOrActivated(c),onDeactivated(u),onBeforeUnmount(u),watch(e,m=>{m?a():l()})}function useLazyRender(i){const e=ref(!1);return watch(i,t=>{t&&(e.value=t)},{immediate:!0}),t=>()=>e.value?t():null}const[name$h,bem$9]=createNamespace$1("overlay"),overlayProps={show:Boolean,zIndex:numericProp,duration:numericProp,className:unknownProp,lockScroll:truthProp,lazyRender:truthProp,customStyle:Object};var stdin_default$c=defineComponent({name:name$h,props:overlayProps,setup(i,{slots:e}){const t=ref(),r=useLazyRender(()=>i.show||!i.lazyRender),s=a=>{i.lockScroll&&preventDefault(a,!0)},o=r(()=>{var a;const l=extend$2(getZIndexStyle(i.zIndex),i.customStyle);return isDef$1(i.duration)&&(l.animationDuration="".concat(i.duration,"s")),withDirectives(createVNode("div",{ref:t,style:l,class:[bem$9(),i.className]},[(a=e.default)==null?void 0:a.call(e)]),[[vShow,i.show]])});return useEventListener$1("touchmove",s,{target:t}),()=>createVNode(Transition,{name:"van-fade",appear:!0},{default:o})}});const Overlay=withInstall$1(stdin_default$c),popupProps=extend$2({},popupSharedProps,{round:Boolean,position:makeStringProp("center"),closeIcon:makeStringProp("cross"),closeable:Boolean,transition:String,iconPrefix:String,closeOnPopstate:Boolean,closeIconPosition:makeStringProp("top-right"),safeAreaInsetTop:Boolean,safeAreaInsetBottom:Boolean}),[name$g,bem$8]=createNamespace$1("popup");var stdin_default$b=defineComponent({name:name$g,inheritAttrs:!1,props:popupProps,emits:["open","close","opened","closed","keydown","update:show","clickOverlay","clickCloseIcon"],setup(i,{emit:e,attrs:t,slots:r}){let s,o;const a=ref(),l=ref(),c=useLazyRender(()=>i.show||!i.lazyRender),u=computed(()=>{const R={zIndex:a.value};if(isDef$1(i.duration)){const I=i.position==="center"?"animationDuration":"transitionDuration";R[I]="".concat(i.duration,"s")}return R}),m=()=>{s||(s=!0,a.value=i.zIndex!==void 0?+i.zIndex:useGlobalZIndex(),e("open"))},d=()=>{s&&callInterceptor(i.beforeClose,{done(){s=!1,e("close"),e("update:show",!1)}})},y=R=>{e("clickOverlay",R),i.closeOnClickOverlay&&d()},b=()=>{if(i.overlay)return createVNode(Overlay,{show:i.show,class:i.overlayClass,zIndex:a.value,duration:i.duration,customStyle:i.overlayStyle,role:i.closeOnClickOverlay?"button":void 0,tabindex:i.closeOnClickOverlay?0:void 0,onClick:y},{default:r["overlay-content"]})},S=R=>{e("clickCloseIcon",R),d()},A=()=>{if(i.closeable)return createVNode(Icon$1,{role:"button",tabindex:0,name:i.closeIcon,class:[bem$8("close-icon",i.closeIconPosition),HAPTICS_FEEDBACK],classPrefix:i.iconPrefix,onClick:S},null)};let P;const x=()=>{P&&clearTimeout(P),P=setTimeout(()=>{e("opened")})},E=()=>e("closed"),_=R=>e("keydown",R),T=c(()=>{var R;const{round:I,position:M,safeAreaInsetTop:D,safeAreaInsetBottom:H}=i;return withDirectives(createVNode("div",mergeProps({ref:l,style:u.value,role:"dialog",tabindex:0,class:[bem$8({round:I,[M]:M}),{"van-safe-area-top":D,"van-safe-area-bottom":H}],onKeydown:_},t),[(R=r.default)==null?void 0:R.call(r),A()]),[[vShow,i.show]])}),C=()=>{const{position:R,transition:I,transitionAppear:M}=i,D=R==="center"?"van-fade":"van-popup-slide-".concat(R);return createVNode(Transition,{name:I||D,appear:M,onAfterEnter:x,onAfterLeave:E},{default:T})};return watch(()=>i.show,R=>{R&&!s&&(m(),t.tabindex===0&&nextTick(()=>{var I;(I=l.value)==null||I.focus()})),!R&&s&&(s=!1,e("close"))}),useExpose({popupRef:l}),useLockScroll(l,()=>i.show&&i.lockScroll),useEventListener$1("popstate",()=>{i.closeOnPopstate&&(d(),o=!1)}),onMounted(()=>{i.show&&m()}),onActivated(()=>{o&&(e("update:show",!0),o=!1)}),onDeactivated(()=>{i.show&&i.teleport&&(d(),o=!0)}),provide(POPUP_TOGGLE_KEY,()=>i.show),()=>i.teleport?createVNode(Teleport,{to:i.teleport},{default:()=>[b(),C()]}):createVNode(Fragment,null,[b(),C()])}});const Popup=withInstall$1(stdin_default$b);let current=0;function useId(){const i=getCurrentInstance(),{name:e="unknown"}=(i==null?void 0:i.type)||{};return"".concat(e,"-").concat(++current)}let lockCount=0;function lockClick(i){i?(lockCount||document.body.classList.add("van-toast--unclickable"),lockCount++):lockCount&&(lockCount--,lockCount||document.body.classList.remove("van-toast--unclickable"))}const[name$f,bem$7]=createNamespace$1("toast"),popupInheritProps=["show","overlay","teleport","transition","overlayClass","overlayStyle","closeOnClickOverlay"],toastProps={icon:String,show:Boolean,type:makeStringProp("text"),overlay:Boolean,message:numericProp,iconSize:numericProp,duration:makeNumberProp(2e3),position:makeStringProp("middle"),teleport:[String,Object],wordBreak:String,className:unknownProp,iconPrefix:String,transition:makeStringProp("van-fade"),loadingType:String,forbidClick:Boolean,overlayClass:unknownProp,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean};var stdin_default$a=defineComponent({name:name$f,props:toastProps,emits:["update:show"],setup(i,{emit:e,slots:t}){let r,s=!1;const o=()=>{const d=i.show&&i.forbidClick;s!==d&&(s=d,lockClick(s))},a=d=>e("update:show",d),l=()=>{i.closeOnClick&&a(!1)},c=()=>clearTimeout(r),u=()=>{const{icon:d,type:y,iconSize:b,iconPrefix:S,loadingType:A}=i;if(d||y==="success"||y==="fail")return createVNode(Icon$1,{name:d||y,size:b,class:bem$7("icon"),classPrefix:S},null);if(y==="loading")return createVNode(Loading$1,{class:bem$7("loading"),size:b,type:A},null)},m=()=>{const{type:d,message:y}=i;if(t.message)return createVNode("div",{class:bem$7("text")},[t.message()]);if(isDef$1(y)&&y!=="")return d==="html"?createVNode("div",{key:0,class:bem$7("text"),innerHTML:String(y)},null):createVNode("div",{class:bem$7("text")},[y])};return watch(()=>[i.show,i.forbidClick],o),watch(()=>[i.show,i.type,i.message,i.duration],()=>{c(),i.show&&i.duration>0&&(r=setTimeout(()=>{a(!1)},i.duration))}),onMounted(o),onUnmounted(o),()=>createVNode(Popup,mergeProps({class:[bem$7([i.position,i.wordBreak==="normal"?"break-normal":i.wordBreak,{[i.type]:!i.icon}]),i.className],lockScroll:!1,onClick:l,onClosed:c,"onUpdate:show":a},pick$1(i,popupInheritProps)),{default:()=>[u(),m()]})}});function usePopupState(){const i=reactive({show:!1}),e=s=>{i.show=s},t=s=>{extend$2(i,s,{transitionAppear:!0}),e(!0)},r=()=>e(!1);return useExpose({open:t,close:r,toggle:e}),{open:t,close:r,state:i,toggle:e}}function mountComponent(i){const e=createApp(i),t=document.createElement("div");return document.body.appendChild(t),{instance:e.mount(t),unmount(){e.unmount(),document.body.removeChild(t)}}}const defaultOptions$1={icon:"",type:"text",message:"",className:"",overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:"body",iconSize:void 0,iconPrefix:void 0,position:"middle",transition:"van-fade",forbidClick:!1,loadingType:void 0,overlayClass:"",overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1};let queue=[],allowMultiple=!1,currentOptions=extend$2({},defaultOptions$1);const defaultOptionsMap=new Map;function parseOptions(i){return isObject$4(i)?i:{message:i}}function createInstance(){const{instance:i,unmount:e}=mountComponent({setup(){const t=ref(""),{open:r,state:s,close:o,toggle:a}=usePopupState(),l=()=>{},c=()=>createVNode(stdin_default$a,mergeProps(s,{onClosed:l,"onUpdate:show":a}),null);return watch(t,u=>{s.message=u}),getCurrentInstance().render=c,{open:r,close:o,message:t}}});return i}function getInstance(){if(!queue.length||allowMultiple){const i=createInstance();queue.push(i)}return queue[queue.length-1]}function showToast(i={}){if(!inBrowser$2)return{};const e=getInstance(),t=parseOptions(i);return e.open(extend$2({},currentOptions,defaultOptionsMap.get(t.type||currentOptions.type),t)),e}const createMethod=i=>e=>showToast(extend$2({type:i},parseOptions(e))),showLoadingToast=createMethod("loading"),closeToast=i=>{queue.length&&(i?(queue.forEach(e=>{e.close()}),queue=[]):queue[0].close())};withInstall$1(stdin_default$a);const[name$e,bem$6]=createNamespace$1("empty"),emptyProps={image:makeStringProp("default"),imageSize:[Number,String,Array],description:String};var stdin_default$9=defineComponent({name:name$e,props:emptyProps,setup(i,{slots:e}){const t=()=>{const x=e.description?e.description():i.description;if(x)return createVNode("p",{class:bem$6("description")},[x])},r=()=>{if(e.default)return createVNode("div",{class:bem$6("bottom")},[e.default()])},s=useId(),o=x=>"".concat(s,"-").concat(x),a=x=>"url(#".concat(o(x),")"),l=(x,E,_)=>createVNode("stop",{"stop-color":x,offset:"".concat(E,"%"),"stop-opacity":_},null),c=(x,E)=>[l(x,0),l(E,100)],u=x=>[createVNode("defs",null,[createVNode("radialGradient",{id:o(x),cx:"50%",cy:"54%",fx:"50%",fy:"54%",r:"297%",gradientTransform:"matrix(-.16 0 0 -.33 .58 .72)"},[l("#EBEDF0",0),l("#F2F3F5",100,.3)])]),createVNode("ellipse",{fill:a(x),opacity:".8",cx:"80",cy:"140",rx:"46",ry:"8"},null)],m=()=>[createVNode("defs",null,[createVNode("linearGradient",{id:o("a"),x1:"64%",y1:"100%",x2:"64%"},[l("#FFF",0,.5),l("#F2F3F5",100)])]),createVNode("g",{opacity:".8"},[createVNode("path",{d:"M36 131V53H16v20H2v58h34z",fill:a("a")},null),createVNode("path",{d:"M123 15h22v14h9v77h-31V15z",fill:a("a")},null)])],d=()=>[createVNode("defs",null,[createVNode("linearGradient",{id:o("b"),x1:"64%",y1:"97%",x2:"64%",y2:"0%"},[l("#F2F3F5",0,.3),l("#F2F3F5",100)])]),createVNode("g",{opacity:".8"},[createVNode("path",{d:"M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",fill:a("b")},null),createVNode("path",{d:"M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",fill:a("b")},null)])],y=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{id:o(1),x1:"64%",y1:"100%",x2:"64%"},[l("#FFF",0,.5),l("#F2F3F5",100)]),createVNode("linearGradient",{id:o(2),x1:"50%",x2:"50%",y2:"84%"},[l("#EBEDF0",0),l("#DCDEE0",100,0)]),createVNode("linearGradient",{id:o(3),x1:"100%",x2:"100%",y2:"100%"},[c("#EAEDF0","#DCDEE0")]),createVNode("radialGradient",{id:o(4),cx:"50%",cy:"0%",fx:"50%",fy:"0%",r:"100%",gradientTransform:"matrix(0 1 -.54 0 .5 -.5)"},[l("#EBEDF0",0),l("#FFF",100,0)])]),createVNode("g",{fill:"none"},[m(),createVNode("path",{fill:a(4),d:"M0 139h160v21H0z"},null),createVNode("path",{d:"M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",fill:a(2)},null),createVNode("g",{opacity:".6","stroke-linecap":"round","stroke-width":"7"},[createVNode("path",{d:"M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",stroke:a(3)},null),createVNode("path",{d:"M53 36a34 34 0 0 0 0 48",stroke:a(3)},null),createVNode("path",{d:"M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",stroke:a(3)},null),createVNode("path",{d:"M106 84a34 34 0 0 0 0-48",stroke:a(3)},null)]),createVNode("g",{transform:"translate(31 105)"},[createVNode("rect",{fill:"#EBEDF0",width:"98",height:"34",rx:"2"},null),createVNode("rect",{fill:"#FFF",x:"9",y:"8",width:"80",height:"18",rx:"1.1"},null),createVNode("rect",{fill:"#EBEDF0",x:"15",y:"12",width:"18",height:"6",rx:"1.1"},null)])])]),b=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(5)},[c("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"95%",y1:"48%",x2:"5.5%",y2:"51%",id:o(6)},[c("#EAEDF1","#DCDEE0")]),createVNode("linearGradient",{y1:"45%",x2:"100%",y2:"54%",id:o(7)},[c("#EAEDF1","#DCDEE0")])]),m(),d(),createVNode("g",{transform:"translate(36 50)",fill:"none"},[createVNode("g",{transform:"translate(8)"},[createVNode("rect",{fill:"#EBEDF0",opacity:".6",x:"38",y:"13",width:"36",height:"53",rx:"2"},null),createVNode("rect",{fill:a(5),width:"64",height:"66",rx:"2"},null),createVNode("rect",{fill:"#FFF",x:"6",y:"6",width:"52",height:"55",rx:"1"},null),createVNode("g",{transform:"translate(15 17)",fill:a(6)},[createVNode("rect",{width:"34",height:"6",rx:"1"},null),createVNode("path",{d:"M0 14h34v6H0z"},null),createVNode("rect",{y:"28",width:"34",height:"6",rx:"1"},null)])]),createVNode("rect",{fill:a(7),y:"61",width:"88",height:"28",rx:"1"},null),createVNode("rect",{fill:"#F7F8FA",x:"29",y:"72",width:"30",height:"6",rx:"1"},null)])]),S=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(8)},[c("#EAEDF1","#DCDEE0")])]),m(),d(),u("c"),createVNode("path",{d:"m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",fill:a(8)},null)]),A=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",y1:"100%",x2:"50%",id:o(9)},[c("#EEE","#D8D8D8")]),createVNode("linearGradient",{x1:"100%",y1:"50%",y2:"50%",id:o(10)},[c("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(11)},[c("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(12)},[c("#FFF","#F7F8FA")])]),m(),d(),u("d"),createVNode("g",{transform:"rotate(-45 113 -4)",fill:"none"},[createVNode("rect",{fill:a(9),x:"24",y:"52.8",width:"5.8",height:"19",rx:"1"},null),createVNode("rect",{fill:a(10),x:"22.1",y:"67.3",width:"9.9",height:"28",rx:"1"},null),createVNode("circle",{stroke:a(11),"stroke-width":"8",cx:"27",cy:"27",r:"27"},null),createVNode("circle",{fill:a(12),cx:"27",cy:"27",r:"16"},null),createVNode("path",{d:"M37 7c-8 0-15 5-16 12",stroke:a(11),"stroke-width":"3",opacity:".5","stroke-linecap":"round",transform:"rotate(45 29 13)"},null)])]),P=()=>{var x;if(e.image)return e.image();const E={error:S,search:A,network:y,default:b};return((x=E[i.image])==null?void 0:x.call(E))||createVNode("img",{src:i.image},null)};return()=>createVNode("div",{class:bem$6()},[createVNode("div",{class:bem$6("image"),style:getSizeStyle(i.imageSize)},[P()]),t(),r()])}});const Empty=withInstall$1(stdin_default$9),[name$d,bem$5]=createNamespace$1("nav-bar"),navBarProps={title:String,fixed:Boolean,zIndex:numericProp,border:truthProp,leftText:String,rightText:String,leftDisabled:Boolean,rightDisabled:Boolean,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean,clickable:truthProp};var stdin_default$8=defineComponent({name:name$d,props:navBarProps,emits:["clickLeft","clickRight"],setup(i,{emit:e,slots:t}){const r=ref(),s=usePlaceholder(r,bem$5),o=m=>{i.leftDisabled||e("clickLeft",m)},a=m=>{i.rightDisabled||e("clickRight",m)},l=()=>t.left?t.left():[i.leftArrow&&createVNode(Icon$1,{class:bem$5("arrow"),name:"arrow-left"},null),i.leftText&&createVNode("span",{class:bem$5("text")},[i.leftText])],c=()=>t.right?t.right():createVNode("span",{class:bem$5("text")},[i.rightText]),u=()=>{const{title:m,fixed:d,border:y,zIndex:b}=i,S=getZIndexStyle(b),A=i.leftArrow||i.leftText||t.left,P=i.rightText||t.right;return createVNode("div",{ref:r,style:S,class:[bem$5({fixed:d}),{[BORDER_BOTTOM]:y,"van-safe-area-top":i.safeAreaInsetTop}]},[createVNode("div",{class:bem$5("content")},[A&&createVNode("div",{class:[bem$5("left",{disabled:i.leftDisabled}),i.clickable&&!i.leftDisabled?HAPTICS_FEEDBACK:""],onClick:o},[l()]),createVNode("div",{class:[bem$5("title"),"van-ellipsis"]},[t.title?t.title():m]),P&&createVNode("div",{class:[bem$5("right",{disabled:i.rightDisabled}),i.clickable&&!i.rightDisabled?HAPTICS_FEEDBACK:""],onClick:a},[c()])])])};return()=>i.fixed&&i.placeholder?s(u):u()}});const NavBar=withInstall$1(stdin_default$8),[name$c,bem$4]=createNamespace$1("notice-bar"),noticeBarProps={text:String,mode:String,color:String,delay:makeNumericProp(1),speed:makeNumericProp(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,default:null}};var stdin_default$7=defineComponent({name:name$c,props:noticeBarProps,emits:["close","replay"],setup(i,{emit:e,slots:t}){let r=0,s=0,o;const a=ref(),l=ref(),c=reactive({show:!0,offset:0,duration:0}),u=()=>{if(t["left-icon"])return t["left-icon"]();if(i.leftIcon)return createVNode(Icon$1,{class:bem$4("left-icon"),name:i.leftIcon},null)},m=()=>{if(i.mode==="closeable")return"cross";if(i.mode==="link")return"arrow"},d=P=>{i.mode==="closeable"&&(c.show=!1,e("close",P))},y=()=>{if(t["right-icon"])return t["right-icon"]();const P=m();if(P)return createVNode(Icon$1,{name:P,class:bem$4("right-icon"),onClick:d},null)},b=()=>{c.offset=r,c.duration=0,raf(()=>{doubleRaf(()=>{c.offset=-s,c.duration=(s+r)/+i.speed,e("replay")})})},S=()=>{const P=i.scrollable===!1&&!i.wrapable,x={transform:c.offset?"translateX(".concat(c.offset,"px)"):"",transitionDuration:"".concat(c.duration,"s")};return createVNode("div",{ref:a,role:"marquee",class:bem$4("wrap")},[createVNode("div",{ref:l,style:x,class:[bem$4("content"),{"van-ellipsis":P}],onTransitionend:b},[t.default?t.default():i.text])])},A=()=>{const{delay:P,speed:x,scrollable:E}=i,_=isDef$1(P)?+P*1e3:0;r=0,s=0,c.offset=0,c.duration=0,clearTimeout(o),o=setTimeout(()=>{if(!a.value||!l.value||E===!1)return;const T=useRect(a).width,C=useRect(l).width;(E||C>T)&&doubleRaf(()=>{r=T,s=C,c.offset=-s,c.duration=s/+x})},_)};return onPopupReopen(A),onMountedOrActivated(A),useEventListener$1("pageshow",A),useExpose({reset:A}),watch(()=>[i.text,i.scrollable],A),()=>{const{color:P,wrapable:x,background:E}=i;return withDirectives(createVNode("div",{role:"alert",class:bem$4({wrapable:x}),style:{color:P,background:E}},[u(),S(),y()]),[[vShow,c.show]])}}});const NoticeBar=withInstall$1(stdin_default$7),[name$b,bem$3]=createNamespace$1("skeleton-title"),skeletonTitleProps={round:Boolean,titleWidth:numericProp};var stdin_default$6=defineComponent({name:name$b,props:skeletonTitleProps,setup(i){return()=>createVNode("h3",{class:bem$3([{round:i.round}]),style:{width:addUnit(i.titleWidth)}},null)}});const SkeletonTitle=withInstall$1(stdin_default$6);var stdin_default$5=SkeletonTitle;const[name$a,bem$2]=createNamespace$1("skeleton-avatar"),skeletonAvatarProps={avatarSize:numericProp,avatarShape:makeStringProp("round")};var stdin_default$4=defineComponent({name:name$a,props:skeletonAvatarProps,setup(i){return()=>createVNode("div",{class:bem$2([i.avatarShape]),style:getSizeStyle(i.avatarSize)},null)}});const SkeletonAvatar=withInstall$1(stdin_default$4);var stdin_default$3=SkeletonAvatar;const DEFAULT_ROW_WIDTH="100%",skeletonParagraphProps={round:Boolean,rowWidth:{type:numericProp,default:DEFAULT_ROW_WIDTH}},[name$9,bem$1]=createNamespace$1("skeleton-paragraph");var stdin_default$2=defineComponent({name:name$9,props:skeletonParagraphProps,setup(i){return()=>createVNode("div",{class:bem$1([{round:i.round}]),style:{width:i.rowWidth}},null)}});const SkeletonParagraph=withInstall$1(stdin_default$2);var stdin_default$1=SkeletonParagraph;const[name$8,bem]=createNamespace$1("skeleton"),DEFAULT_LAST_ROW_WIDTH="60%",skeletonProps={row:makeNumericProp(0),round:Boolean,title:Boolean,titleWidth:numericProp,avatar:Boolean,avatarSize:numericProp,avatarShape:makeStringProp("round"),loading:truthProp,animate:truthProp,rowWidth:{type:[Number,String,Array],default:DEFAULT_ROW_WIDTH}};var stdin_default=defineComponent({name:name$8,inheritAttrs:!1,props:skeletonProps,setup(i,{slots:e,attrs:t}){const r=()=>{if(i.avatar)return createVNode(stdin_default$3,{avatarShape:i.avatarShape,avatarSize:i.avatarSize},null)},s=()=>{if(i.title)return createVNode(stdin_default$5,{round:i.round,titleWidth:i.titleWidth},null)},o=c=>{const{rowWidth:u}=i;return u===DEFAULT_ROW_WIDTH&&c===+i.row-1?DEFAULT_LAST_ROW_WIDTH:Array.isArray(u)?u[c]:u},a=()=>Array(+i.row).fill("").map((c,u)=>createVNode(stdin_default$1,{key:u,round:i.round,rowWidth:addUnit(o(u))},null)),l=()=>e.template?e.template():createVNode(Fragment,null,[r(),createVNode("div",{class:bem("content")},[s(),a()])]);return()=>{var c;return i.loading?createVNode("div",mergeProps({class:bem({animate:i.animate,round:i.round})},t),[l()]):(c=e.default)==null?void 0:c.call(e)}}});const Skeleton=withInstall$1(stdin_default),storeData=reactive({status:"init",user:{},platformType:"STUDENT",platformApi:"/api-student",proxy:"",isApp:!1}),setStoreData=i=>{Object.assign(storeData,i)},setUserInfo=i=>{storeData.status="login",storeData.user=i||{}};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function getAugmentedNamespace(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var assign$1=make_assign(),create$1=make_create(),trim$1=make_trim(),Global$5=typeof window<"u"?window:commonjsGlobal,util$i={assign:assign$1,create:create$1,trim:trim$1,bind:bind$3,slice:slice$3,each:each$8,map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$4,isObject:isObject$3,Global:Global$5};function make_assign(){return Object.assign?Object.assign:function(e,t,r,s){for(var o=1;o"u"?null:console;if(i){var e=i.warn?i.warn:i.log;e.apply(i,arguments)}}function createStore(i,e,t){t||(t=""),i&&!isList(i)&&(i=[i]),e&&!isList(e)&&(e=[e]);var r=t?"__storejs_"+t+"_":"",s=t?new RegExp("^"+r):null,o=/^[a-zA-Z0-9_\-]*$/;if(!o.test(t))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var a={_namespacePrefix:r,_namespaceRegexp:s,_testStorage:function(c){try{var u="__storejs__test__";c.write(u,u);var m=c.read(u)===u;return c.remove(u),m}catch(d){return!1}},_assignPluginFnProp:function(c,u){var m=this[u];this[u]=function(){var y=slice$2(arguments,0),b=this;function S(){if(m)return each$7(arguments,function(P,x){y[x]=P}),m.apply(b,y)}var A=[S].concat(y);return c.apply(b,A)}},_serialize:function(c){return JSON.stringify(c)},_deserialize:function(c,u){if(!c)return u;var m="";try{m=JSON.parse(c)}catch(d){m=c}return m!==void 0?m:u},_addStorage:function(c){this.enabled||this._testStorage(c)&&(this.storage=c,this.enabled=!0)},_addPlugin:function(c){var u=this;if(isList(c)){each$7(c,function(y){u._addPlugin(y)});return}var m=pluck(this.plugins,function(y){return c===y});if(!m){if(this.plugins.push(c),!isFunction$3(c))throw new Error("Plugins must be function values that return objects");var d=c.call(this);if(!isObject$2(d))throw new Error("Plugins must return an object of function properties");each$7(d,function(y,b){if(!isFunction$3(y))throw new Error("Bad plugin property: "+b+" from plugin "+c.name+". Plugins should only return functions.");u._assignPluginFnProp(y,b)})}},addStorage:function(c){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(c)}},l=create(a,storeAPI,{plugins:[]});return l.raw={},each$7(l,function(c,u){isFunction$3(c)&&(l.raw[u]=bind$2(l,c))}),each$7(i,function(c){l._addStorage(c)}),each$7(e,function(c){l._addPlugin(c)}),l}var util$g=util$i,Global$4=util$g.Global,localStorage_1={name:"localStorage",read:read$5,write:write$5,each:each$6,remove:remove$6,clearAll:clearAll$5};function localStorage$1(){return Global$4.localStorage}function read$5(i){return localStorage$1().getItem(i)}function write$5(i,e){return localStorage$1().setItem(i,e)}function each$6(i){for(var e=localStorage$1().length-1;e>=0;e--){var t=localStorage$1().key(e);i(read$5(t),t)}}function remove$6(i){return localStorage$1().removeItem(i)}function clearAll$5(){return localStorage$1().clear()}var util$f=util$i,Global$3=util$f.Global,oldFFGlobalStorage={name:"oldFF-globalStorage",read:read$4,write:write$4,each:each$5,remove:remove$5,clearAll:clearAll$4},globalStorage=Global$3.globalStorage;function read$4(i){return globalStorage[i]}function write$4(i,e){globalStorage[i]=e}function each$5(i){for(var e=globalStorage.length-1;e>=0;e--){var t=globalStorage.key(e);i(globalStorage[t],t)}}function remove$5(i){return globalStorage.removeItem(i)}function clearAll$4(){each$5(function(i,e){delete globalStorage[i]})}var util$e=util$i,Global$2=util$e.Global,oldIEUserDataStorage={name:"oldIE-userDataStorage",write:write$3,read:read$3,each:each$4,remove:remove$4,clearAll:clearAll$3},storageName="storejs",doc$1=Global$2.document,_withStorageEl=_makeIEStorageElFunction(),disable$1=(Global$2.navigator?Global$2.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function write$3(i,e){if(!disable$1){var t=fixKey(i);_withStorageEl(function(r){r.setAttribute(t,e),r.save(storageName)})}}function read$3(i){if(!disable$1){var e=fixKey(i),t=null;return _withStorageEl(function(r){t=r.getAttribute(e)}),t}}function each$4(i){_withStorageEl(function(e){for(var t=e.XMLDocument.documentElement.attributes,r=t.length-1;r>=0;r--){var s=t[r];i(e.getAttribute(s.name),s.name)}})}function remove$4(i){var e=fixKey(i);_withStorageEl(function(t){t.removeAttribute(e),t.save(storageName)})}function clearAll$3(){_withStorageEl(function(i){var e=i.XMLDocument.documentElement.attributes;i.load(storageName);for(var t=e.length-1;t>=0;t--)i.removeAttribute(e[t].name);i.save(storageName)})}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function fixKey(i){return i.replace(/^\d/,"___$&").replace(forbiddenCharsRegex,"___")}function _makeIEStorageElFunction(){if(!doc$1||!doc$1.documentElement||!doc$1.documentElement.addBehavior)return null;var i="script",e,t,r;try{t=new ActiveXObject("htmlfile"),t.open(),t.write("<"+i+">document.w=window'),t.close(),e=t.w.frames[0].document,r=e.createElement("div")}catch(s){r=doc$1.createElement("div"),e=doc$1.body}return function(s){var o=[].slice.call(arguments,0);o.unshift(r),e.appendChild(r),r.addBehavior("#default#userData"),r.load(storageName),s.apply(this,o),e.removeChild(r)}}var util$d=util$i,Global$1=util$d.Global,trim=util$d.trim,cookieStorage={name:"cookieStorage",read:read$2,write:write$2,each:each$3,remove:remove$3,clearAll:clearAll$2},doc=Global$1.document;function read$2(i){if(!i||!_has(i))return null;var e="(?:^|.*;\\s*)"+escape(i).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(e),"$1"))}function each$3(i){for(var e=doc.cookie.split(/; ?/g),t=e.length-1;t>=0;t--)if(trim(e[t])){var r=e[t].split("="),s=unescape(r[0]),o=unescape(r[1]);i(o,s)}}function write$2(i,e){i&&(doc.cookie=escape(i)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function remove$3(i){!i||!_has(i)||(doc.cookie=escape(i)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function clearAll$2(){each$3(function(i,e){remove$3(e)})}function _has(i){return new RegExp("(?:^|;\\s*)"+escape(i).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var util$c=util$i,Global=util$c.Global,sessionStorage_1={name:"sessionStorage",read:read$1,write:write$1,each:each$2,remove:remove$2,clearAll:clearAll$1};function sessionStorage$1(){return Global.sessionStorage}function read$1(i){return sessionStorage$1().getItem(i)}function write$1(i,e){return sessionStorage$1().setItem(i,e)}function each$2(i){for(var e=sessionStorage$1().length-1;e>=0;e--){var t=sessionStorage$1().key(e);i(read$1(t),t)}}function remove$2(i){return sessionStorage$1().removeItem(i)}function clearAll$1(){return sessionStorage$1().clear()}var memoryStorage_1={name:"memoryStorage",read,write,each:each$1,remove:remove$1,clearAll},memoryStorage={};function read(i){return memoryStorage[i]}function write(i,e){memoryStorage[i]=e}function each$1(i){for(var e in memoryStorage)memoryStorage.hasOwnProperty(e)&&i(memoryStorage[e],e)}function remove$1(i){delete memoryStorage[i]}function clearAll(i){memoryStorage={}}var all=[localStorage_1,oldFFGlobalStorage,oldIEUserDataStorage,cookieStorage,sessionStorage_1,memoryStorage_1],json2$1={},hasRequiredJson2;function requireJson2(){return hasRequiredJson2||(hasRequiredJson2=1,typeof JSON!="object"&&(JSON={}),function(){var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(i){return i<10?"0"+i:i}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(i){return rx_escapable.lastIndex=0,rx_escapable.test(i)?'"'+i.replace(rx_escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'}function str(i,e){var t,r,s,o,a=gap,l,c=e[i];switch(c&&typeof c=="object"&&typeof c.toJSON=="function"&&(c=c.toJSON(i)),typeof rep=="function"&&(c=rep.call(e,i,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,l=[],Object.prototype.toString.apply(c)==="[object Array]"){for(o=c.length,t=0;ti==null,strictUriEncode=i=>encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16).toUpperCase())),encodeFragmentIdentifier=Symbol("encodeFragmentIdentifier");function encoderForArrayFormat(i){switch(i.arrayFormat){case"index":return e=>(t,r)=>{const s=t.length;return r===void 0||i.skipNull&&r===null||i.skipEmptyString&&r===""?t:r===null?[...t,[encode$1(e,i),"[",s,"]"].join("")]:[...t,[encode$1(e,i),"[",encode$1(s,i),"]=",encode$1(r,i)].join("")]};case"bracket":return e=>(t,r)=>r===void 0||i.skipNull&&r===null||i.skipEmptyString&&r===""?t:r===null?[...t,[encode$1(e,i),"[]"].join("")]:[...t,[encode$1(e,i),"[]=",encode$1(r,i)].join("")];case"colon-list-separator":return e=>(t,r)=>r===void 0||i.skipNull&&r===null||i.skipEmptyString&&r===""?t:r===null?[...t,[encode$1(e,i),":list="].join("")]:[...t,[encode$1(e,i),":list=",encode$1(r,i)].join("")];case"comma":case"separator":case"bracket-separator":{const e=i.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(r,s)=>s===void 0||i.skipNull&&s===null||i.skipEmptyString&&s===""?r:(s=s===null?"":s,r.length===0?[[encode$1(t,i),e,encode$1(s,i)].join("")]:[[r,encode$1(s,i)].join(i.arrayFormatSeparator)])}default:return e=>(t,r)=>r===void 0||i.skipNull&&r===null||i.skipEmptyString&&r===""?t:r===null?[...t,encode$1(e,i)]:[...t,[encode$1(e,i),"=",encode$1(r,i)].join("")]}}function parserForArrayFormat(i){let e;switch(i.arrayFormat){case"index":return(t,r,s)=>{if(e=/\[(\d*)]$/.exec(t),t=t.replace(/\[\d*]$/,""),!e){s[t]=r;return}s[t]===void 0&&(s[t]={}),s[t][e[1]]=r};case"bracket":return(t,r,s)=>{if(e=/(\[])$/.exec(t),t=t.replace(/\[]$/,""),!e){s[t]=r;return}if(s[t]===void 0){s[t]=[r];return}s[t]=[...s[t],r]};case"colon-list-separator":return(t,r,s)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){s[t]=r;return}if(s[t]===void 0){s[t]=[r];return}s[t]=[...s[t],r]};case"comma":case"separator":return(t,r,s)=>{const o=typeof r=="string"&&r.includes(i.arrayFormatSeparator),a=typeof r=="string"&&!o&&decode$3(r,i).includes(i.arrayFormatSeparator);r=a?decode$3(r,i):r;const l=o||a?r.split(i.arrayFormatSeparator).map(c=>decode$3(c,i)):r===null?r:decode$3(r,i);s[t]=l};case"bracket-separator":return(t,r,s)=>{const o=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!o){s[t]=r&&decode$3(r,i);return}const a=r===null?[]:r.split(i.arrayFormatSeparator).map(l=>decode$3(l,i));if(s[t]===void 0){s[t]=a;return}s[t]=[...s[t],...a]};default:return(t,r,s)=>{if(s[t]===void 0){s[t]=r;return}s[t]=[...[s[t]].flat(),r]}}}function validateArrayFormatSeparator(i){if(typeof i!="string"||i.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function encode$1(i,e){return e.encode?e.strict?strictUriEncode(i):encodeURIComponent(i):i}function decode$3(i,e){return e.decode?decodeUriComponent(i):i}function keysSorter(i){return Array.isArray(i)?i.sort():typeof i=="object"?keysSorter(Object.keys(i)).sort((e,t)=>Number(e)-Number(t)).map(e=>i[e]):i}function removeHash(i){const e=i.indexOf("#");return e!==-1&&(i=i.slice(0,e)),i}function getHash(i){let e="";const t=i.indexOf("#");return t!==-1&&(e=i.slice(t)),e}function parseValue(i,e){return e.parseNumbers&&!Number.isNaN(Number(i))&&typeof i=="string"&&i.trim()!==""?i=Number(i):e.parseBooleans&&i!==null&&(i.toLowerCase()==="true"||i.toLowerCase()==="false")&&(i=i.toLowerCase()==="true"),i}function extract(i){i=removeHash(i);const e=i.indexOf("?");return e===-1?"":i.slice(e+1)}function parse$6(i,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...e},validateArrayFormatSeparator(e.arrayFormatSeparator);const t=parserForArrayFormat(e),r=Object.create(null);if(typeof i!="string"||(i=i.trim().replace(/^[?#&]/,""),!i))return r;for(const s of i.split("&")){if(s==="")continue;const o=e.decode?s.replace(/\+/g," "):s;let[a,l]=splitOnFirst(o,"=");a===void 0&&(a=o),l=l===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?l:decode$3(l,e),t(decode$3(a,e),l,r)}for(const[s,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,l]of Object.entries(o))o[a]=parseValue(l,e);else r[s]=parseValue(o,e);return e.sort===!1?r:(e.sort===!0?Object.keys(r).sort():Object.keys(r).sort(e.sort)).reduce((s,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?s[o]=keysSorter(a):s[o]=a,s},Object.create(null))}function stringify$2(i,e){if(!i)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},validateArrayFormatSeparator(e.arrayFormatSeparator);const t=a=>e.skipNull&&isNullOrUndefined(i[a])||e.skipEmptyString&&i[a]==="",r=encoderForArrayFormat(e),s={};for(const[a,l]of Object.entries(i))t(a)||(s[a]=l);const o=Object.keys(s);return e.sort!==!1&&o.sort(e.sort),o.map(a=>{const l=i[a];return l===void 0?"":l===null?encode$1(a,e):Array.isArray(l)?l.length===0&&e.arrayFormat==="bracket-separator"?encode$1(a,e)+"[]":l.reduce(r(a),[]).join("&"):encode$1(a,e)+"="+encode$1(l,e)}).filter(a=>a.length>0).join("&")}function parseUrl(i,e){var s,o;e={decode:!0,...e};let[t,r]=splitOnFirst(i,"#");return t===void 0&&(t=i),{url:(o=(s=t==null?void 0:t.split("?"))==null?void 0:s[0])!=null?o:"",query:parse$6(extract(i),e),...e&&e.parseFragmentIdentifier&&r?{fragmentIdentifier:decode$3(r,e)}:{}}}function stringifyUrl(i,e){e={encode:!0,strict:!0,[encodeFragmentIdentifier]:!0,...e};const t=removeHash(i.url).split("?")[0]||"",r=extract(i.url),s={...parse$6(r,{sort:!1}),...i.query};let o=stringify$2(s,e);o&&(o="?".concat(o));let a=getHash(i.url);if(i.fragmentIdentifier){const l=new URL(t);l.hash=i.fragmentIdentifier,a=e[encodeFragmentIdentifier]?l.hash:"#".concat(i.fragmentIdentifier)}return"".concat(t).concat(o).concat(a)}function pick(i,e,t){t={parseFragmentIdentifier:!0,[encodeFragmentIdentifier]:!1,...t};const{url:r,query:s,fragmentIdentifier:o}=parseUrl(i,t);return stringifyUrl({url:r,query:includeKeys(s,e),fragmentIdentifier:o},t)}function exclude(i,e,t){const r=Array.isArray(e)?s=>!e.includes(s):(s,o)=>!e(s,o);return pick(i,r,t)}const queryString=Object.freeze(Object.defineProperty({__proto__:null,exclude,extract,parse:parse$6,parseUrl,pick,stringify:stringify$2,stringifyUrl},Symbol.toStringTag,{value:"Module"})),getQuery=()=>{let i={};try{i={...queryString.parse(location.search),...queryString.parse(location.hash.split("?")[1])}}catch(e){}return{...i}},browser=()=>{const i=navigator.userAgent;return{trident:i.indexOf("Trident")>-1,presto:i.indexOf("Presto")>-1,webKit:i.indexOf("AppleWebKit")>-1,gecko:i.indexOf("Gecko")>-1&&i.indexOf("KHTML")==-1,mobile:!!i.match(/AppleWebKit.*Mobile.*/),ios:!!i.match(/Mac OS X/)||/(iPhone|iPad|iPod|iOS)/i.test(i),android:i.indexOf("Android")>-1||i.indexOf("Adr")>-1,iPhone:i.indexOf("ORCHESTRAAPPI")>-1,isApp:i.includes("DAYAAPPA")||i.includes("DAYAAPPI")||i.includes("COLEXIUAPPA")||i.includes("COLEXIUAPPI")||i.includes("ORCHESTRAAPPI")||i.includes("ORCHESTRAAPPA"),isTeacher:i.indexOf("ORCHESTRATEACHER")>-1||i.includes("COLEXIUTEACHER"),isStudent:i.indexOf("ORCHESTRASTUDENT")>-1||i.includes("COLEXIUSTUDENT"),isSchool:i.indexOf("ORCHESTRASCHOOL")>-1,iPad:i.indexOf("iPad")>-1,webApp:i.indexOf("Safari")==-1,weixin:i.indexOf("MicroMessenger")>-1,alipay:i.indexOf("AlipayClient")>-1,huawei:!!i.match(/huawei/i)||!!i.match(/honor/i),xiaomi:!!i.match(/mi\s/i)||!!i.match(/redmi/i)||!!i.match(/mix/i)}},getRandomKey=()=>""+Date.now()+Math.floor(Math.random()*1e6),AuthorizationKey="AUTHORIZATION",setToken=i=>{sessionStorage.setItem(AuthorizationKey,i)},getToken=()=>sessionStorage.getItem(AuthorizationKey)||"",setGlobalData=(i,e)=>{if(!i||!e)return;const t=window.GYM||{};t[i]=e,window.GYM=t},BEHAVIORIDKEY="BEHAVIORID",setBehaviorId=i=>{localStorage.setItem(BEHAVIORIDKEY,i)},getBehaviorId=()=>localStorage.getItem(BEHAVIORIDKEY),campIdKey="CAMPID",setCampId=i=>{sessionStorage.setItem(campIdKey,i)},getCampId=()=>sessionStorage.getItem(campIdKey)||"",getSecondRPM=(i,e)=>{if(isNaN(i))return"00:00";let t=Math.floor(i/60/60%24),r=Math.floor(i/60%60),s=Math.floor(i%60);return e==="cn"?"".concat(t>0?t.toString().padStart(2,"0")+"时":"").concat(r.toString().padStart(2,"0"),"分").concat(s.toString().padStart(2,"0"),"秒"):"".concat(t>0?t.toString().padStart(2,"0")+":":"").concat(r.toString().padStart(2,"0"),":").concat(s.toString().padStart(2,"0"))},SPEEDKEY="speeds",setStorageSpeed=(i,e)=>{const t=store.get(SPEEDKEY)||{};t[i]=e,store.set(SPEEDKEY,t)},getStorageSpeed=i=>(store.get(SPEEDKEY)||{})[i]||0,matchProductApiUrl=()=>{const i=getQuery(),e={cbs:{dev:"https://dev.resource.colexiu.com",test:"https://test.resource.colexiu.com",online:"https://mec.colexiu.com"},gym:{dev:"https://dev.dayaedu.com",test:"https://test.dayaedu.com",online:"https://online.dayaedu.com"},colexiu:{dev:"https://dev.colexiu.com/",test:"https://test.colexiu.com",online:"https://online.colexiu.com"},orchestra:{dev:"https://dev.lexiaoya.cn",test:"https://test.lexiaoya.cn",online:"https://online.lexiaoya.cn"},instrument:{dev:"https://dev.kt.colexiu.com",test:"https://test.kt.colexiu.com",test2:"https://test.lexiaoya.cn",online:"https://kt.colexiu.com"}};let t=location.origin.includes("//dev")?"dev":location.origin.includes("//test")?"test":location.origin.includes("//online")||location.origin.includes("//kt")||location.origin.includes("//mec")?"online":"dev";if(i.isCbs)return e.cbs[t]+"/cbs-app";{const r=location.pathname.includes("gym")?"gym":location.pathname.includes("colexiu")?"colexiu":location.pathname.includes("orchestra")?"orchestra":"instrument";return r==="instrument"&&t==="test"&&(t=location.origin.includes("//test.kt")?"test":"test2"),e[r][t]+"/edu-app"}},debounce=(i,e=0)=>{let t;return function(...r){clearTimeout(t),t=setTimeout(()=>i.apply(this,r),e)}},originalPostMessage=window.postMessage;window.postMessage=i=>{originalPostMessage(i,"*")};const loop=()=>{},calls={};var Ai,xi,Ei,wi,Pi,_i;const instance=window.DAYA||((xi=(Ai=window.webkit)==null?void 0:Ai.messageHandlers)==null?void 0:xi.DAYA)||window.COLEXIU||((wi=(Ei=window.webkit)==null?void 0:Ei.messageHandlers)==null?void 0:wi.COLEXIU)||window.ORCHESTRA||((_i=(Pi=window.webkit)==null?void 0:Pi.messageHandlers)==null?void 0:_i.ORCHESTRA);instance&&window.addEventListener("message",i=>{var e,t;try{const r=i.data?typeof i.data=="object"?i.data:JSON.parse(i.data):{},s=((e=r.content)==null?void 0:e.uuid)||r.uuid;try{r.content&&(r.content=JSON.parse(r.content))}catch(l){}if(!s){const l=Object.keys(calls).filter(c=>c.indexOf(r.api)===0);for(const c of l){const u=calls[c]||loop;typeof u=="function"&&u(r),Array.isArray(u)&&u.forEach(m=>{typeof m=="function"&&m(r)})}return}const o=((t=r.content)==null?void 0:t.uuid)||r.uuid||r.api+r.uuid,a=calls[o]||loop;typeof a=="function"&&a(r)}catch(r){console.error("通信消息解析错误",r)}});const postMessage=(i,e)=>{if(instance){const t=getRandomKey();calls[t]=e||loop,i.content=i.content?{...i.content,uuid:t}:{uuid:t},instance.postMessage(JSON.stringify(i)),console.log("h5_请求_api:",i)}},listenerMessage=(i,e)=>{const t=i;calls[t]||(calls[t]=[]),calls[t].push(e||loop)},removeListenerMessage=(i,e)=>{const t=i;if(Array.isArray(calls[t])){const r=calls[t].indexOf(e);calls[t].splice(r,1)}},promisefiyPostMessage=i=>new Promise(e=>{postMessage(i,t=>e(t))}),api_getToken=()=>storeData.isApp?promisefiyPostMessage({api:"getToken"}):Promise.resolve({}),getEarphone=()=>storeData.isApp?promisefiyPostMessage({api:"isWiredHeadsetOn"}):Promise.resolve({}),isSpecialShapedScreen=()=>storeData.isApp?promisefiyPostMessage({api:"isSpecialShapedScreen"}):Promise.resolve({}),sendResult=i=>{listenerMessage("sendResult",i)},removeResult=i=>{removeListenerMessage("sendResult",i)},endSoundCheck=()=>{postMessage({api:"endSoundCheck"})},startEvaluating=i=>storeData.isApp?promisefiyPostMessage({api:"startEvaluating",content:i}):Promise.resolve({}),endEvaluating=i=>storeData.isApp?promisefiyPostMessage({api:"endEvaluating",content:i}):Promise.resolve({}),cancelEvaluating=()=>{postMessage({api:"cancelEvaluating"})},api_startRecordingCb=(i,e)=>{postMessage({api:"startRecording",content:i},e)},api_proxyServiceMessage=i=>storeData.isApp?promisefiyPostMessage({api:"proxyServiceMessage",content:i}):Promise.resolve({}),api_recordStartTime=i=>{listenerMessage("recordStartTime",i)},api_remove_recordStartTime=i=>{removeListenerMessage("recordStartTime",i)},api_videoUpdate=i=>{postMessage({api:"videoUpdate"},i)},api_shareAchievements=i=>storeData.isApp?promisefiyPostMessage({api:"shareAchievements",content:i}):Promise.resolve({}),api_openWebView=i=>storeData.isApp?promisefiyPostMessage({api:"openWebView",content:i}):Promise.resolve({}),api_openCamera=()=>storeData.isApp?promisefiyPostMessage({api:"openCamera"}):Promise.resolve({}),api_closeCamera=()=>storeData.isApp?promisefiyPostMessage({api:"closeCamera"}):Promise.resolve({}),api_setStatusBarVisibility=()=>{postMessage({api:"setStatusBarVisibility",content:{isVisibility:0}})},api_cloudToggleFollow=i=>storeData.isApp?promisefiyPostMessage({api:"cloudToggleFollow",content:{state:i}}):Promise.resolve({}),api_cloudFollowTime=(i,e=!0)=>{e?listenerMessage("cloudFollowTime",i):removeListenerMessage("cloudFollowTime",i)},api_goback=()=>{postMessage({api:"goBack"})},api_back=()=>{postMessage({api:"back"})},api_cloudLoading=(i=!1)=>{postMessage({api:"cloudLoading",content:{show:i,type:"fullscreen"}})},api_cloudDestroy=()=>{postMessage({api:"cloudDestroy"})},api_setEventTracking=()=>{postMessage({api:"setEventTracking",content:{type:"klx_xiaokuAI"}})},api_savePicture=i=>storeData.isApp?promisefiyPostMessage({api:"savePicture",content:i}):Promise.resolve({}),api_setCache=i=>{postMessage({api:"setCache",content:i})},api_suspendPlay=i=>{listenerMessage("suspendPlay",i)},api_startCapture=()=>{postMessage({api:"startCapture"})},api_endCapture=()=>{postMessage({api:"endCapture"})},api_getDeviceDelay=()=>storeData.isApp?promisefiyPostMessage({api:"getDeviceDelay"}):Promise.resolve({}),api_toggleTune=(i,e)=>{if(!storeData.isApp)return Promise.resolve({});if(i==="start")return promisefiyPostMessage({api:"startTune",content:{count:e+""}});if(i==="stop")return promisefiyPostMessage({api:"endTune"});if(i==="finishTune")return promisefiyPostMessage({api:"finishTune"})},api_createMusicPlayer=i=>storeData.isApp?promisefiyPostMessage({api:"createMusicPlayer",content:i}):Promise.resolve({}),api_keepScreenLongLight=()=>{postMessage({api:"keepScreenLongLight",content:{isOpenLight:!0}})},api_setRequestedOrientation=i=>{postMessage({api:"setRequestedOrientation",content:{orientation:i}})},api_playProgress=i=>{listenerMessage("playProgress",i)},api_openAdjustRecording=i=>{postMessage({api:"openAdjustRecording",content:i})},hideComplexButton=(i,e)=>{e?listenerMessage("hideComplexButton",i):removeListenerMessage("hideComplexButton",i)},addCheckPlayEnd=i=>{listenerMessage("checkPlayEnd",i)},removeCheckPlayEnd=i=>{removeListenerMessage("checkPlayEnd",i)},api_checkSocketStatus=()=>promisefiyPostMessage({api:"checkSocketStatus"}),addAccompanyError=i=>{listenerMessage("accompanyError",i)},removeAccompanyError=i=>{removeListenerMessage("accompanyError",i)},addSocketStatus=i=>{listenerMessage("socketConnectSuccessReport",i)},removeSocketStatus=i=>{removeListenerMessage("socketConnectSuccessReport",i)},api_disconnectSocket=()=>promisefiyPostMessage({api:"disconnectSocket"}),api_cloudDetail=(i,e)=>{postMessage({api:"cloudDetail",content:i},e)},api_cloudGetMediaStatus=()=>promisefiyPostMessage({api:"cloudGetMediaStatus"}),api_cloudPlay=i=>{promisefiyPostMessage({api:"cloudPlay",content:i})},api_cloudSuspend=i=>{promisefiyPostMessage({api:"cloudSuspend",content:i})},api_cloudSetCurrentTime=i=>{promisefiyPostMessage({api:"cloudSetCurrentTime",content:i})},api_cloudChangeSpeed=i=>{promisefiyPostMessage({api:"cloudChangeSpeed",content:i})},api_cloudVolume=i=>{promisefiyPostMessage({api:"cloudVolume",content:i})},api_cloudTimeUpdae=i=>{listenerMessage("cloudTimeUpdae",i)},api_remove_cloudTimeUpdae=i=>{removeListenerMessage("cloudTimeUpdae",i)},api_cloudplayed=i=>{listenerMessage("cloudplayed",i)},api_remove_cloudplayed=i=>{removeListenerMessage("cloudplayed",i)},api_midiMicDelay=i=>{postMessage({api:"proxyServiceMessage",content:i})},TheError=defineComponent({name:"The-error",setup(i,e){return()=>createVNode("div",null,[createVNode(NavBar,{leftArrow:!0,onClickLeft:()=>{api_back()}},null),createVNode(Empty,{image:"error",description:"网络开小差,请稍后重试"},{default:()=>[createVNode(Button$1,{type:"primary",size:"small",onClick:()=>history.go(0)},{default:()=>[createTextVNode("重新加载")]})]})])}});var shams=function i(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;e[t]=s;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==s||a.enumerable!==!0)return!1}return!0},origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=shams,hasSymbols$1=function i(){return typeof origSymbol!="function"||typeof Symbol!="function"||typeof origSymbol("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:hasSymbolSham()},test={foo:{}},$Object=Object,hasProto$1=function i(){return{__proto__:test}.foo===test.foo&&!({__proto__:null}instanceof $Object)},ERROR_MESSAGE="Function.prototype.bind called on incompatible ",slice$1=Array.prototype.slice,toStr$1=Object.prototype.toString,funcType="[object Function]",implementation$1=function i(e){var t=this;if(typeof t!="function"||toStr$1.call(t)!==funcType)throw new TypeError(ERROR_MESSAGE+t);for(var r=slice$1.call(arguments,1),s,o=function(){if(this instanceof s){var m=t.apply(this,r.concat(slice$1.call(arguments)));return Object(m)===m?m:this}else return t.apply(e,r.concat(slice$1.call(arguments)))},a=Math.max(0,t.length-r.length),l=[],c=0;c"u"||!getProto?undefined$1:getProto(Uint8Array),INTRINSICS={"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto?undefined$1:getProto(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto?undefined$1:getProto(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$1,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet};if(getProto)try{null.error}catch(i){var errorProto=getProto(getProto(i));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function i(e){var t;if(e==="%AsyncFunction%")t=getEvalledConstructor("async function () {}");else if(e==="%GeneratorFunction%")t=getEvalledConstructor("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=getEvalledConstructor("async function* () {}");else if(e==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&getProto&&(t=getProto(s.prototype))}return INTRINSICS[e]=t,t},LEGACY_ALIASES={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=functionBind,hasOwn$1=src$1,$concat$1=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace$1=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function i(e){var t=$strSlice(e,0,1),r=$strSlice(e,-1);if(t==="%"&&r!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var s=[];return $replace$1(e,rePropName,function(o,a,l,c){s[s.length]=l?$replace$1(c,reEscapeChar,"$1"):a||o}),s},getBaseIntrinsic=function i(e,t){var r=e,s;if(hasOwn$1(LEGACY_ALIASES,r)&&(s=LEGACY_ALIASES[r],r="%"+s[0]+"%"),hasOwn$1(INTRINSICS,r)){var o=INTRINSICS[r];if(o===needsEval&&(o=doEval(r)),typeof o>"u"&&!t)throw new $TypeError$1("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new $SyntaxError("intrinsic "+e+" does not exist!")},getIntrinsic=function i(e,t){if(typeof e!="string"||e.length===0)throw new $TypeError$1("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new $TypeError$1('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,e)===null)throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=stringToPath(e),s=r.length>0?r[0]:"",o=getBaseIntrinsic("%"+s+"%",t),a=o.name,l=o.value,c=!1,u=o.alias;u&&(s=u[0],$spliceApply(r,$concat$1([0,1],u)));for(var m=1,d=!0;m=r.length){var A=$gOPD(l,y);d=!!A,d&&"get"in A&&!("originalValue"in A.get)?l=A.get:l=l[y]}else d=hasOwn$1(l,y),l=l[y];d&&!c&&(INTRINSICS[a]=l)}}return l},callBind$1={exports:{}};(function(i){var e=functionBind,t=getIntrinsic,r=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),o=t("%Reflect.apply%",!0)||e.call(s,r),a=t("%Object.getOwnPropertyDescriptor%",!0),l=t("%Object.defineProperty%",!0),c=t("%Math.max%");if(l)try{l({},"a",{value:1})}catch(m){l=null}i.exports=function(d){var y=o(e,s,arguments);if(a&&l){var b=a(y,"length");b.configurable&&l(y,"length",{value:1+c(0,d.length-(arguments.length-1))})}return y};var u=function(){return o(e,r,arguments)};l?l(i.exports,"apply",{value:u}):i.exports.apply=u})(callBind$1);var callBindExports=callBind$1.exports,GetIntrinsic$1=getIntrinsic,callBind=callBindExports,$indexOf=callBind(GetIntrinsic$1("String.prototype.indexOf")),callBound$1=function i(e,t){var r=GetIntrinsic$1(e,!!t);return typeof r=="function"&&$indexOf(e,".prototype.")>-1?callBind(r):r};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(__viteBrowserExternal$1);var hasMap=typeof Map=="function"&&Map.prototype,mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mapSize=hasMap&&mapSizeDescriptor&&typeof mapSizeDescriptor.get=="function"?mapSizeDescriptor.get:null,mapForEach=hasMap&&Map.prototype.forEach,hasSet=typeof Set=="function"&&Set.prototype,setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,setSize=hasSet&&setSizeDescriptor&&typeof setSizeDescriptor.get=="function"?setSizeDescriptor.get:null,setForEach=hasSet&&Set.prototype.forEach,hasWeakMap=typeof WeakMap=="function"&&WeakMap.prototype,weakMapHas=hasWeakMap?WeakMap.prototype.has:null,hasWeakSet=typeof WeakSet=="function"&&WeakSet.prototype,weakSetHas=hasWeakSet?WeakSet.prototype.has:null,hasWeakRef=typeof WeakRef=="function"&&WeakRef.prototype,weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null,booleanValueOf=Boolean.prototype.valueOf,objectToString$2=Object.prototype.toString,functionToString=Function.prototype.toString,$match=String.prototype.match,$slice=String.prototype.slice,$replace=String.prototype.replace,$toUpperCase=String.prototype.toUpperCase,$toLowerCase=String.prototype.toLowerCase,$test=RegExp.prototype.test,$concat=Array.prototype.concat,$join=Array.prototype.join,$arrSlice=Array.prototype.slice,$floor=Math.floor,bigIntValueOf=typeof BigInt=="function"?BigInt.prototype.valueOf:null,gOPS=Object.getOwnPropertySymbols,symToString=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,hasShammedSymbols=typeof Symbol=="function"&&typeof Symbol.iterator=="object",toStringTag=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===hasShammedSymbols||"symbol")?Symbol.toStringTag:null,isEnumerable=Object.prototype.propertyIsEnumerable,gPO=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function addNumericSeparator(i,e){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||$test.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-$floor(-i):$floor(i);if(r!==i){var s=String(r),o=$slice.call(e,s.length+1);return $replace.call(s,t,"$&_")+"."+$replace.call($replace.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,t,"$&_")}var utilInspect=require$$0$1,inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,objectInspect=function i(e,t,r,s){var o=t||{};if(has$3(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has$3(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=has$3(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has$3(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has$3(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return inspectString(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return l?addNumericSeparator(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return l?addNumericSeparator(e,u):u}var m=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=m&&m>0&&typeof e=="object")return isArray$7(e)?"[Array]":"[Object]";var d=getIndent(o,r);if(typeof s>"u")s=[];else if(indexOf$2(s,e)>=0)return"[Circular]";function y(z,k,$){if(k&&(s=$arrSlice.call(s),s.push(k)),$){var F={depth:o.depth};return has$3(o,"quoteStyle")&&(F.quoteStyle=o.quoteStyle),i(z,F,r+1,s)}return i(z,o,r+1,s)}if(typeof e=="function"&&!isRegExp$1(e)){var b=nameOf(e),S=arrObjKeys(e,y);return"[Function"+(b?": "+b:" (anonymous)")+"]"+(S.length>0?" { "+$join.call(S,", ")+" }":"")}if(isSymbol(e)){var A=hasShammedSymbols?$replace.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(e);return typeof e=="object"&&!hasShammedSymbols?markBoxed(A):A}if(isElement(e)){for(var P="<"+$toLowerCase.call(String(e.nodeName)),x=e.attributes||[],E=0;E",P}if(isArray$7(e)){if(e.length===0)return"[]";var _=arrObjKeys(e,y);return d&&!singleLineValues(_)?"["+indentedJoin(_,d)+"]":"[ "+$join.call(_,", ")+" ]"}if(isError(e)){var T=arrObjKeys(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!isEnumerable.call(e,"cause")?"{ ["+String(e)+"] "+$join.call($concat.call("[cause]: "+y(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+$join.call(T,", ")+" }"}if(typeof e=="object"&&a){if(inspectSymbol&&typeof e[inspectSymbol]=="function"&&utilInspect)return utilInspect(e,{depth:m-r});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(isMap$2(e)){var C=[];return mapForEach&&mapForEach.call(e,function(z,k){C.push(y(k,e,!0)+" => "+y(z,e))}),collectionOf("Map",mapSize.call(e),C,d)}if(isSet$2(e)){var R=[];return setForEach&&setForEach.call(e,function(z){R.push(y(z,e))}),collectionOf("Set",setSize.call(e),R,d)}if(isWeakMap(e))return weakCollectionOf("WeakMap");if(isWeakSet(e))return weakCollectionOf("WeakSet");if(isWeakRef(e))return weakCollectionOf("WeakRef");if(isNumber$1(e))return markBoxed(y(Number(e)));if(isBigInt(e))return markBoxed(y(bigIntValueOf.call(e)));if(isBoolean$1(e))return markBoxed(booleanValueOf.call(e));if(isString$1(e))return markBoxed(y(String(e)));if(!isDate$1(e)&&!isRegExp$1(e)){var I=arrObjKeys(e,y),M=gPO?gPO(e)===Object.prototype:e instanceof Object||e.constructor===Object,D=e instanceof Object?"":"null prototype",H=!M&&toStringTag&&Object(e)===e&&toStringTag in e?$slice.call(toStr(e),8,-1):D?"Object":"",W=M||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",O=W+(H||D?"["+$join.call($concat.call([],H||[],D||[]),": ")+"] ":"");return I.length===0?O+"{}":d?O+"{"+indentedJoin(I,d)+"}":O+"{ "+$join.call(I,", ")+" }"}return String(e)};function wrapQuotes(i,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+i+r}function quote(i){return $replace.call(String(i),/"/g,""")}function isArray$7(i){return toStr(i)==="[object Array]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isDate$1(i){return toStr(i)==="[object Date]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isRegExp$1(i){return toStr(i)==="[object RegExp]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isError(i){return toStr(i)==="[object Error]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isString$1(i){return toStr(i)==="[object String]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isNumber$1(i){return toStr(i)==="[object Number]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isBoolean$1(i){return toStr(i)==="[object Boolean]"&&(!toStringTag||!(typeof i=="object"&&toStringTag in i))}function isSymbol(i){if(hasShammedSymbols)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!symToString)return!1;try{return symToString.call(i),!0}catch(e){}return!1}function isBigInt(i){if(!i||typeof i!="object"||!bigIntValueOf)return!1;try{return bigIntValueOf.call(i),!0}catch(e){}return!1}var hasOwn=Object.prototype.hasOwnProperty||function(i){return i in this};function has$3(i,e){return hasOwn.call(i,e)}function toStr(i){return objectToString$2.call(i)}function nameOf(i){if(i.name)return i.name;var e=$match.call(functionToString.call(i),/^function\s*([\w$]+)/);return e?e[1]:null}function indexOf$2(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;te.maxStringLength){var t=i.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return inspectString($slice.call(i,0,e.maxStringLength),e)+r}var s=$replace.call($replace.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte);return wrapQuotes(s,"single",e)}function lowbyte(i){var e=i.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+$toUpperCase.call(e.toString(16))}function markBoxed(i){return"Object("+i+")"}function weakCollectionOf(i){return i+" { ? }"}function collectionOf(i,e,t,r){var s=r?indentedJoin(t,r):$join.call(t,", ");return i+" ("+e+") {"+s+"}"}function singleLineValues(i){for(var e=0;e=0)return!1;return!0}function getIndent(i,e){var t;if(i.indent===" ")t=" ";else if(typeof i.indent=="number"&&i.indent>0)t=$join.call(Array(i.indent+1)," ");else return null;return{base:t,prev:$join.call(Array(e+1),t)}}function indentedJoin(i,e){if(i.length===0)return"";var t="\n"+e.prev+e.base;return t+$join.call(i,","+t)+"\n"+e.prev}function arrObjKeys(i,e){var t=isArray$7(i),r=[];if(t){r.length=i.length;for(var s=0;s1;){var t=e.pop(),r=t.obj[t.prop];if(isArray$6(r)){for(var s=[],o=0;o=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===formats$2.RFC1738&&(u===40||u===41)){l+=a.charAt(c);continue}if(u<128){l=l+hexTable[u];continue}if(u<2048){l=l+(hexTable[192|u>>6]+hexTable[128|u&63]);continue}if(u<55296||u>=57344){l=l+(hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|u&63]);continue}c+=1,u=65536+((u&1023)<<10|a.charCodeAt(c)&1023),l+=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|u&63]}return l},compact=function i(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],s=0;s"u"&&(_=0)}if(typeof c=="function"?x=c(t,x):x instanceof Date?x=d(x):r==="comma"&&isArray$5(x)&&(x=utils$2.maybeMap(x,function(F){return F instanceof Date?d(F):F})),x===null){if(o)return l&&!S?l(t,defaults$1.encoder,A,"key",y):t;x=""}if(isNonNullishPrimitive(x)||utils$2.isBuffer(x)){if(l){var R=S?t:l(t,defaults$1.encoder,A,"key",y);return[b(R)+"="+b(l(x,defaults$1.encoder,A,"value",y))]}return[b(t)+"="+b(String(x))]}var I=[];if(typeof x>"u")return I;var M;if(r==="comma"&&isArray$5(x))S&&l&&(x=utils$2.maybeMap(x,l)),M=[{value:x.length>0?x.join(",")||null:void 0}];else if(isArray$5(c))M=c;else{var D=Object.keys(x);M=u?D.sort(u):D}for(var H=s&&isArray$5(x)&&x.length===1?t+"[]":t,W=0;W"u"?defaults$1.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:defaults$1.charsetSentinel,delimiter:typeof e.delimiter>"u"?defaults$1.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:defaults$1.encode,encoder:typeof e.encoder=="function"?e.encoder:defaults$1.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:defaults$1.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:defaults$1.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:defaults$1.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:defaults$1.strictNullHandling}},stringify_1=function(i,e){var t=i,r=normalizeStringifyOptions(e),s,o;typeof r.filter=="function"?(o=r.filter,t=o("",t)):isArray$5(r.filter)&&(o=r.filter,s=o);var a=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in arrayPrefixGenerators?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var c=arrayPrefixGenerators[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=c==="comma"&&e&&e.commaRoundTrip;s||(s=Object.keys(t)),r.sort&&s.sort(r.sort);for(var m=getSideChannel(),d=0;d0?S+b:""},utils$1=utils$3,has=Object.prototype.hasOwnProperty,isArray$4=Array.isArray,defaults={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:utils$1.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function i(e,t){var r={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=t.parameterLimit===1/0?void 0:t.parameterLimit,a=s.split(t.delimiter,o),l=-1,c,u=t.charset;if(t.charsetSentinel)for(c=0;c-1&&(S=isArray$4(S)?[S]:S),has.call(r,b)?r[b]=utils$1.combine(r[b],S):r[b]=S}return r},parseObject=function(i,e,t,r){for(var s=r?e:parseArrayValue(e,t),o=i.length-1;o>=0;--o){var a,l=i[o];if(l==="[]"&&t.parseArrays)a=[].concat(s);else{a=t.plainObjects?Object.create(null):{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=parseInt(c,10);!t.parseArrays&&c===""?a={0:s}:!isNaN(u)&&l!==c&&String(u)===c&&u>=0&&t.parseArrays&&u<=t.arrayLimit?(a=[],a[u]=s):c!=="__proto__"&&(a[c]=s)}s=a}return s},parseKeys=function i(e,t,r,s){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,c=r.depth>0&&a.exec(o),u=c?o.slice(0,c.index):o,m=[];if(u){if(!r.plainObjects&&has.call(Object.prototype,u)&&!r.allowPrototypes)return;m.push(u)}for(var d=0;r.depth>0&&(c=l.exec(o))!==null&&d"u"?defaults.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?defaults.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:defaults.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:defaults.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:defaults.comma,decoder:typeof e.decoder=="function"?e.decoder:defaults.decoder,delimiter:typeof e.delimiter=="string"||utils$1.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:defaults.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:defaults.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:defaults.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:defaults.strictNullHandling}},parse$5=function(i,e){var t=normalizeParseOptions(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?parseValues(i,t):i,s=t.plainObjects?Object.create(null):{},o=Object.keys(r),a=0;a-1};function normalizeName(i){if(typeof i!="string"&&(i=String(i)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(i)||i==="")throw new TypeError('Invalid character in header field name: "'+i+'"');return i.toLowerCase()}function normalizeValue(i){return typeof i!="string"&&(i=String(i)),i}function iteratorFor(i){var e={next:function(){var t=i.shift();return{done:t===void 0,value:t}}};return support.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Headers(i){this.map={},i instanceof Headers?i.forEach(function(e,t){this.append(t,e)},this):Array.isArray(i)?i.forEach(function(e){if(e.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):i&&Object.getOwnPropertyNames(i).forEach(function(e){this.append(e,i[e])},this)}Headers.prototype.append=function(i,e){i=normalizeName(i),e=normalizeValue(e);var t=this.map[i];this.map[i]=t?t+", "+e:e};Headers.prototype.delete=function(i){delete this.map[normalizeName(i)]};Headers.prototype.get=function(i){return i=normalizeName(i),this.has(i)?this.map[i]:null};Headers.prototype.has=function(i){return this.map.hasOwnProperty(normalizeName(i))};Headers.prototype.set=function(i,e){this.map[normalizeName(i)]=normalizeValue(e)};Headers.prototype.forEach=function(i,e){for(var t in this.map)this.map.hasOwnProperty(t)&&i.call(e,this.map[t],t,this)};Headers.prototype.keys=function(){var i=[];return this.forEach(function(e,t){i.push(t)}),iteratorFor(i)};Headers.prototype.values=function(){var i=[];return this.forEach(function(e){i.push(e)}),iteratorFor(i)};Headers.prototype.entries=function(){var i=[];return this.forEach(function(e,t){i.push([t,e])}),iteratorFor(i)};support.iterable&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);function consumed(i){if(!i._noBody){if(i.bodyUsed)return Promise.reject(new TypeError("Already read"));i.bodyUsed=!0}}function fileReaderReady(i){return new Promise(function(e,t){i.onload=function(){e(i.result)},i.onerror=function(){t(i.error)}})}function readBlobAsArrayBuffer(i){var e=new FileReader,t=fileReaderReady(e);return e.readAsArrayBuffer(i),t}function readBlobAsText(i){var e=new FileReader,t=fileReaderReady(e),r=/charset=([A-Za-z0-9_-]+)/.exec(i.type),s=r?r[1]:"utf-8";return e.readAsText(i,s),t}function readArrayBufferAsText(i){for(var e=new Uint8Array(i),t=new Array(e.length),r=0;r-1?e:i}function Request(i,e){if(!(this instanceof Request))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var t=e.body;if(i instanceof Request){if(i.bodyUsed)throw new TypeError("Already read");this.url=i.url,this.credentials=i.credentials,e.headers||(this.headers=new Headers(i.headers)),this.method=i.method,this.mode=i.mode,this.signal=i.signal,!t&&i._bodyInit!=null&&(t=i._bodyInit,i.bodyUsed=!0)}else this.url=String(i);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new Headers(e.headers)),this.method=normalizeMethod(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in g){var o=new AbortController;return o.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&t)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(t),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+new Date().getTime());else{var s=/\?/;this.url+=(s.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode$1(i){var e=new FormData;return i.trim().split("&").forEach(function(t){if(t){var r=t.split("="),s=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(s),decodeURIComponent(o))}}),e}function parseHeaders(i){var e=new Headers,t=i.replace(/\r?\n[\t ]+/g," ");return t.split("\r").map(function(r){return r.indexOf("\n")===0?r.substr(1,r.length):r}).forEach(function(r){var s=r.split(":"),o=s.shift().trim();if(o){var a=s.join(":").trim();try{e.append(o,a)}catch(l){console.warn("Response "+l.message)}}}),e}Body.call(Request.prototype);function Response(i,e){if(!(this instanceof Response))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new Headers(e.headers),this.url=e.url||"",this._initBody(i)}Body.call(Response.prototype);Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})};Response.error=function(){var i=new Response(null,{status:200,statusText:""});return i.status=0,i.type="error",i};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(i,e){if(redirectStatuses.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Response(null,{status:e,headers:{location:i}})};var DOMException=g.DOMException;try{new DOMException}catch(i){DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$2(i,e){return new Promise(function(t,r){var s=new Request(i,e);if(s.signal&&s.signal.aborted)return r(new DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}o.onload=function(){var u={statusText:o.statusText,headers:parseHeaders(o.getAllResponseHeaders()||"")};s.url.startsWith("file://")&&(o.status<200||o.status>599)?u.status=200:u.status=o.status,u.url="responseURL"in o?o.responseURL:u.headers.get("X-Request-URL");var m="response"in o?o.response:o.responseText;setTimeout(function(){t(new Response(m,u))},0)},o.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request timed out"))},0)},o.onabort=function(){setTimeout(function(){r(new DOMException("Aborted","AbortError"))},0)};function l(u){try{return u===""&&g.location.href?g.location.href:u}catch(m){return u}}if(o.open(s.method,l(s.url),!0),s.credentials==="include"?o.withCredentials=!0:s.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(support.blob?o.responseType="blob":support.arrayBuffer&&(o.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Headers||g.Headers&&e.headers instanceof g.Headers)){var c=[];Object.getOwnPropertyNames(e.headers).forEach(function(u){c.push(normalizeName(u)),o.setRequestHeader(u,normalizeValue(e.headers[u]))}),s.headers.forEach(function(u,m){c.indexOf(m)===-1&&o.setRequestHeader(m,u)})}else s.headers.forEach(function(u,m){o.setRequestHeader(m,u)});s.signal&&(s.signal.addEventListener("abort",a),o.onreadystatechange=function(){o.readyState===4&&s.signal.removeEventListener("abort",a)}),o.send(typeof s._bodyInit>"u"?null:s._bodyInit)})}fetch$2.polyfill=!0;g.fetch||(g.fetch=fetch$2,g.Headers=Headers,g.Request=Request,g.Response=Response);self.fetch.bind(self);function ownKeys(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function _objectSpread2(i){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(i){return!1}}function _construct(i,e,t){return _isNativeReflectConstruct()?_construct=Reflect.construct:_construct=function(s,o,a){var l=[null];l.push.apply(l,o);var c=Function.bind.apply(s,l),u=new c;return a&&_setPrototypeOf(u,a.prototype),u},_construct.apply(null,arguments)}function _isNativeFunction(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function _wrapNativeSuper(i){var e=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(r){if(r===null||!_isNativeFunction(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,s)}function s(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(s,r)},_wrapNativeSuper(i)}function _assertThisInitialized(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _possibleConstructorReturn(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(i)}function _createSuper(i){var e=_isNativeReflectConstruct();return function(){var r=_getPrototypeOf(i),s;if(e){var o=_getPrototypeOf(this).constructor;s=Reflect.construct(r,arguments,o)}else s=r.apply(this,arguments);return _possibleConstructorReturn(this,s)}}function _toConsumableArray(i){return _arrayWithoutHoles(i)||_iterableToArray(i)||_unsupportedIterableToArray(i)||_nonIterableSpread()}function _arrayWithoutHoles(i){if(Array.isArray(i))return _arrayLikeToArray(i)}function _iterableToArray(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function _unsupportedIterableToArray(i,e){if(i){if(typeof i=="string")return _arrayLikeToArray(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _arrayLikeToArray(i,e)}}function _arrayLikeToArray(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1,defaultInstance:!1},s=!1,o=!1,a=!1;if(typeof r=="number"?(process&&process.env,s=!0,o=!1):_typeof(r)==="object"&&r&&(o=r.global||!1,s=r.core||!1,a=r.defaultInstance||!1),o){i.globalMiddlewares.splice(i.globalMiddlewares.length-i.defaultGlobalMiddlewaresLength,0,t);return}if(s){i.coreMiddlewares.splice(i.coreMiddlewares.length-i.defaultCoreMiddlewaresLength,0,t);return}if(a){this.defaultMiddlewares.push(t);return}this.middlewares.push(t)}},{key:"execute",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=compose([].concat(_toConsumableArray(this.middlewares),_toConsumableArray(this.defaultMiddlewares),_toConsumableArray(i.globalMiddlewares),_toConsumableArray(i.coreMiddlewares)));return r(t)}}]),i}();Onion.globalMiddlewares=[];Onion.defaultGlobalMiddlewaresLength=0;Onion.coreMiddlewares=[];Onion.defaultCoreMiddlewaresLength=0;var MapCache$1=function(){function i(e){_classCallCheck(this,i),this.cache=new Map,this.timer={},this.extendOptions(e)}return _createClass(i,[{key:"extendOptions",value:function(t){this.maxCache=t.maxCache||0}},{key:"get",value:function(t){return this.cache.get(JSON.stringify(t))}},{key:"set",value:function(t,r){var s=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var a=_toConsumableArray(this.cache.keys())[0];this.cache.delete(a),this.timer[a]&&clearTimeout(this.timer[a])}var l=JSON.stringify(t);this.cache.set(l,r),o>0&&(this.timer[l]=setTimeout(function(){s.cache.delete(l),delete s.timer[l]},o))}},{key:"delete",value:function(t){var r=JSON.stringify(t);return delete this.timer[r],this.cache.delete(r)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),i}(),RequestError=function(i){_inherits(t,i);var e=_createSuper(t);function t(r,s){var o,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"RequestError";return _classCallCheck(this,t),o=e.call(this,r),o.name="RequestError",o.request=s,o.type=a,o}return t}(_wrapNativeSuper(Error)),ResponseError=function(i){_inherits(t,i);var e=_createSuper(t);function t(r,s,o,a){var l,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"ResponseError";return _classCallCheck(this,t),l=e.call(this,s||r.statusText),l.name="ResponseError",l.data=o,l.response=r,l.request=a,l.type=c,l}return t}(_wrapNativeSuper(Error));function readerGBK(i){return new Promise(function(e,t){var r=new FileReader;r.onload=function(){e(r.result)},r.onerror=t,r.readAsText(i,"GBK")})}function safeJsonParse(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;try{return JSON.parse(i)}catch(s){if(e)throw new ResponseError(t,"JSON.parse fail",i,r,"ParseError")}return i}function timeout2Throw(i,e,t){return new Promise(function(r,s){setTimeout(function(){s(new RequestError(e||"timeout of ".concat(i,"ms exceeded"),t,"Timeout"))},i)})}function cancel2Throw(i){return new Promise(function(e,t){i.cancelToken&&i.cancelToken.promise.then(function(r){t(r)})})}var toString$2=Object.prototype.toString;function getEnv(){var i;return typeof process<"u"&&toString$2.call(process)==="[object process]"&&(i="NODE"),typeof XMLHttpRequest<"u"&&(i="BROWSER"),i}function isArray$3(i){return _typeof(i)==="object"&&Object.prototype.toString.call(i)==="[object Array]"}function isURLSearchParams(i){return typeof URLSearchParams<"u"&&i instanceof URLSearchParams}function isDate(i){return _typeof(i)==="object"&&Object.prototype.toString.call(i)==="[object Date]"}function isObject$1(i){return i!==null&&_typeof(i)==="object"}function forEach2ObjArr(i,e){if(i)if(_typeof(i)!=="object"&&(i=[i]),isArray$3(i))for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},r=t.prefix,s=t.suffix;return r&&(e="".concat(r).concat(e)),s&&(e="".concat(e).concat(s)),{url:e,options:t}},warnedCoreType=!1;function __defaultValidateCache(i,e){var t=e.method,r=t===void 0?"get":t;return r.toLowerCase()==="get"}function fetchMiddleware(i,e){if(!i)return e();var t=i.req;t=t===void 0?{}:t;var r=t.options,s=r===void 0?{}:r,o=t.url,a=o===void 0?"":o,l=i.cache,c=i.responseInterceptors,u=s.timeout,m=u===void 0?0:u,d=s.timeoutMessage,y=s.__umiRequestCoreType__,b=y===void 0?"normal":y,S=s.useCache,A=S===void 0?!1:S,P=s.method,x=P===void 0?"get":P,E=s.params,_=s.ttl,T=s.validateCache,C=T===void 0?__defaultValidateCache:T;if(b!=="normal")return process&&process.env,e();var R=fetch;if(!R)throw new Error("Global fetch not exist!");var I=getEnv()==="BROWSER",M=C(a,s)&&A&&I;if(M){var D=l.get({url:a,params:E,method:x});if(D)return D=D.clone(),D.useCache=!0,i.res=D,e()}var H;return m>0?H=Promise.race([cancel2Throw(s),R(a,s),timeout2Throw(m,d,i.req)]):H=Promise.race([cancel2Throw(s),R(a,s)]),c.forEach(function(W){H=H.then(function(O){var z=typeof O.clone=="function"?O.clone():O;return W(z,s)})}),H.then(function(W){if(M&&W.status===200){var O=W.clone();O.useCache=!0,l.set({url:a,params:E,method:x},O,_)}return i.res=W,e()})}function parseResponseMiddleware(i,e){var t;return e().then(function(){if(i){var r=i.res,s=r===void 0?{}:r,o=i.req,a=o===void 0?{}:o,l=a||{},c=l.options;c=c===void 0?{}:c;var u=c.responseType,m=u===void 0?"json":u,d=c.charset,y=d===void 0?"utf8":d;c.getResponse;var b=c.throwErrIfParseFail,S=b===void 0?!1:b,A=c.parseResponse,P=A===void 0?!0:A;if(P&&!(!s||!s.clone)){if(t=getEnv()==="BROWSER"?s.clone():s,t.useCache=s.useCache||!1,y==="gbk")try{return s.blob().then(readerGBK).then(function(x){return safeJsonParse(x,!1,t,a)})}catch(x){throw new ResponseError(t,x.message,null,a,"ParseError")}else if(m==="json")return s.text().then(function(x){return safeJsonParse(x,S,t,a)});try{return s[m]()}catch(x){throw new ResponseError(t,"responseType not support",null,a,"ParseError")}}}}).then(function(r){if(i){i.res;var s=i.req,o=s===void 0?{}:s,a=o||{},l=a.options;l=l===void 0?{}:l;var c=l.getResponse,u=c===void 0?!1:c;if(t){if(t.status>=200&&t.status<300){if(u){i.res={data:r,response:t};return}i.res=r;return}throw new ResponseError(t,"http error",r,o,"HttpError")}}}).catch(function(r){if(r instanceof RequestError||r instanceof ResponseError)throw r;var s=i.req,o=i.res;throw r.request=r.request||s,r.response=r.response||o,r.type=r.type||r.name,r.data=r.data||void 0,r})}function simplePostMiddleware(i,e){if(!i)return e();var t=i.req;t=t===void 0?{}:t;var r=t.options,s=r===void 0?{}:r,o=s.method,a=o===void 0?"get":o;if(["post","put","patch","delete"].indexOf(a.toLowerCase())===-1)return e();var l=s.requestType,c=l===void 0?"json":l,u=s.data;if(u){var m=Object.prototype.toString.call(u);m==="[object Object]"||m==="[object Array]"?c==="json"?(s.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},s.headers),s.body=JSON.stringify(u)):c==="form"&&(s.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},s.headers),s.body=reqStringify(u)):(s.headers=_objectSpread2({Accept:"application/json"},s.headers),s.body=u)}return i.req.options=s,e()}function paramsSerialize(i,e){var t,r;if(i)if(e)t=e(i);else if(isURLSearchParams(i))t=i.toString();else if(isArray$3(i))r=[],forEach2ObjArr(i,function(o){o===null||typeof o>"u"?r.push(o):r.push(isObject$1(o)?JSON.stringify(o):o)}),t=reqStringify(r);else{r={},forEach2ObjArr(i,function(o,a){var l=o;o===null||typeof o>"u"?r[a]=o:isDate(o)?l=o.toISOString():isArray$3(o)?l=o:isObject$1(o)&&(l=JSON.stringify(o)),r[a]=l});var s=reqStringify(r);t=s}return t}function simpleGetMiddleware(i,e){if(!i)return e();var t=i.req;t=t===void 0?{}:t;var r=t.options,s=r===void 0?{}:r,o=s.paramsSerializer,a=s.params,l=i.req;l=l===void 0?{}:l;var c=l.url,u=c===void 0?"":c;s.method=s.method?s.method.toUpperCase():"GET",s.credentials=s.credentials||"same-origin";var m=paramsSerialize(a,o);if(i.req.originUrl=u,m){var d=u.indexOf("?")!==-1?"&":"?";i.req.url="".concat(u).concat(d).concat(m)}return i.req.options=s,e()}var globalMiddlewares=[simplePostMiddleware,simpleGetMiddleware,parseResponseMiddleware],coreMiddlewares=[fetchMiddleware];Onion.globalMiddlewares=globalMiddlewares;Onion.defaultGlobalMiddlewaresLength=globalMiddlewares.length;Onion.coreMiddlewares=coreMiddlewares;Onion.defaultCoreMiddlewaresLength=coreMiddlewares.length;var Core=function(){function i(e){_classCallCheck(this,i),this.onion=new Onion([]),this.fetchIndex=0,this.mapCache=new MapCache$1(e),this.initOptions=e,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return _createClass(i,[{key:"use",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1};return this.onion.use(t,r),this}},{key:"extendOptions",value:function(t){this.initOptions=mergeRequestOptions(this.initOptions,t),this.mapCache.extendOptions(t)}},{key:"dealRequestInterceptors",value:function(t){var r=function(a,l){return a.then(function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t.req.url=c.url||t.req.url,t.req.options=c.options||t.req.options,l(t.req.url,t.req.options)})},s=[].concat(_toConsumableArray(i.requestInterceptors),_toConsumableArray(this.instanceRequestInterceptors));return s.reduce(r,Promise.resolve()).then(function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t.req.url=o.url||t.req.url,t.req.options=o.options||t.req.options,Promise.resolve()})}},{key:"request",value:function(t,r){var s=this,o=this.onion,a={req:{url:t,options:_objectSpread2(_objectSpread2({},r),{},{url:t})},res:null,cache:this.mapCache,responseInterceptors:[].concat(_toConsumableArray(i.responseInterceptors),_toConsumableArray(this.instanceResponseInterceptors))};if(typeof t!="string")throw new Error("url MUST be a string");return new Promise(function(l,c){s.dealRequestInterceptors(a).then(function(){return o.execute(a)}).then(function(){l(a.res)}).catch(function(u){var m=a.req.options.errorHandler;if(m)try{var d=m(u);l(d)}catch(y){c(y)}else c(u)})})}}],[{key:"requestUse",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof t!="function")throw new TypeError("Interceptor must be function!");r.global?i.requestInterceptors.push(t):this.instanceRequestInterceptors.push(t)}},{key:"responseUse",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof t!="function")throw new TypeError("Interceptor must be function!");r.global?i.responseInterceptors.push(t):this.instanceResponseInterceptors.push(t)}}]),i}();Core.requestInterceptors=[addfix];Core.responseInterceptors=[];function Cancel(i){this.message=i}Cancel.prototype.toString=function i(){return this.message?"Cancel: ".concat(this.message):"Cancel"};Cancel.prototype.__CANCEL__=!0;function CancelToken(i){if(typeof i!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var t=this;i(function(s){t.reason||(t.reason=new Cancel(s),e(t.reason))})}CancelToken.prototype.throwIfRequested=function i(){if(this.reason)throw this.reason};CancelToken.source=function i(){var e,t=new CancelToken(function(s){e=s});return{token:t,cancel:e}};function isCancel(i){return!!(i&&i.__CANCEL__)}var request$1=function i(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=new Core(e),r=function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=mergeRequestOptions(t.initOptions,l);return t.request(a,c)};r.use=t.use.bind(t),r.fetchIndex=t.fetchIndex,r.interceptors={request:{use:Core.requestUse.bind(t)},response:{use:Core.responseUse.bind(t)}};var s=["get","post","delete","put","patch","head","options","rpc"];return s.forEach(function(o){r[o]=function(a,l){return r(a,_objectSpread2(_objectSpread2({},l),{},{method:o}))}}),r.Cancel=Cancel,r.CancelToken=CancelToken,r.isCancel=isCancel,r.extendOptions=t.extendOptions.bind(t),r.middlewares={instance:t.onion.middlewares,defaultInstance:t.onion.defaultMiddlewares,global:Onion.globalMiddlewares,core:Onion.coreMiddlewares},r},extend$1=function i(e){return request$1(e)};request$1({parseResponse:!1});var request$1$1=request$1({}),lodash_isempty={exports:{}};lodash_isempty.exports;(function(i,e){var t=9007199254740991,r="[object Arguments]",s="[object Function]",o="[object GeneratorFunction]",a="[object Map]",l="[object Object]",c="[object Promise]",u="[object Set]",m="[object WeakMap]",d="[object DataView]",y=/[\\^$.*+?()[\]{}|]/g,b=/^\[object .+?Constructor\]$/,S=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,A=typeof self=="object"&&self&&self.Object===Object&&self,P=S||A||Function("return this")(),x=e&&!e.nodeType&&e,E=x&&!0&&i&&!i.nodeType&&i,_=E&&E.exports===x;function T(pe,Te){return pe==null?void 0:pe[Te]}function C(pe){var Te=!1;if(pe!=null&&typeof pe.toString!="function")try{Te=!!(pe+"")}catch(Le){}return Te}function R(pe,Te){return function(Le){return pe(Te(Le))}}var I=Function.prototype,M=Object.prototype,D=P["__core-js_shared__"],H=function(){var pe=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||"");return pe?"Symbol(src)_1."+pe:""}(),W=I.toString,O=M.hasOwnProperty,z=M.toString,k=RegExp("^"+W.call(O).replace(y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$=_?P.Buffer:void 0,F=M.propertyIsEnumerable,G=$?$.isBuffer:void 0,N=R(Object.keys,Object),V=ee(P,"DataView"),K=ee(P,"Map"),U=ee(P,"Promise"),J=ee(P,"Set"),me=ee(P,"WeakMap"),he=!F.call({valueOf:1},"valueOf"),le=Z(V),Se=Z(K),oe=Z(U),ue=Z(J),fe=Z(me);function be(pe){return z.call(pe)}function Ee(pe){if(!ye(pe)||B(pe))return!1;var Te=de(pe)||C(pe)?k:b;return Te.test(Z(pe))}function ee(pe,Te){var Le=T(pe,Te);return Ee(Le)?Le:void 0}var te=be;(V&&te(new V(new ArrayBuffer(1)))!=d||K&&te(new K)!=a||U&&te(U.resolve())!=c||J&&te(new J)!=u||me&&te(new me)!=m)&&(te=function(pe){var Te=z.call(pe),Le=Te==l?pe.constructor:void 0,Ie=Le?Z(Le):void 0;if(Ie)switch(Ie){case le:return d;case Se:return a;case oe:return c;case ue:return u;case fe:return m}return Te});function B(pe){return!!H&&H in pe}function re(pe){var Te=pe&&pe.constructor,Le=typeof Te=="function"&&Te.prototype||M;return pe===Le}function Z(pe){if(pe!=null){try{return W.call(pe)}catch(Te){}try{return pe+""}catch(Te){}}return""}function Y(pe){return ne(pe)&&O.call(pe,"callee")&&(!F.call(pe,"callee")||z.call(pe)==r)}var q=Array.isArray;function ie(pe){return pe!=null&&ve(pe.length)&&!de(pe)}function ne(pe){return ge(pe)&&ie(pe)}var se=G||Pe;function ce(pe){if(ie(pe)&&(q(pe)||typeof pe=="string"||typeof pe.splice=="function"||se(pe)||Y(pe)))return!pe.length;var Te=te(pe);if(Te==a||Te==u)return!pe.size;if(he||re(pe))return!N(pe).length;for(var Le in pe)if(O.call(pe,Le))return!1;return!0}function de(pe){var Te=ye(pe)?z.call(pe):"";return Te==s||Te==o}function ve(pe){return typeof pe=="number"&&pe>-1&&pe%1==0&&pe<=t}function ye(pe){var Te=typeof pe;return!!pe&&(Te=="object"||Te=="function")}function ge(pe){return!!pe&&typeof pe=="object"}function Pe(){return!1}i.exports=ce})(lodash_isempty,lodash_isempty.exports);var lodash_isemptyExports=lodash_isempty.exports,objectTag$4="[object Object]";function isHostObject(i){var e=!1;if(i!=null&&typeof i.toString!="function")try{e=!!(i+"")}catch(t){}return e}function overArg$1(i,e){return function(t){return i(e(t))}}var funcProto$2=Function.prototype,objectProto$f=Object.prototype,funcToString$2=funcProto$2.toString,hasOwnProperty$c=objectProto$f.hasOwnProperty,objectCtorString=funcToString$2.call(Object),objectToString$1=objectProto$f.toString,getPrototype$2=overArg$1(Object.getPrototypeOf,Object);function isObjectLike$1(i){return!!i&&typeof i=="object"}function isPlainObject$2(i){if(!isObjectLike$1(i)||objectToString$1.call(i)!=objectTag$4||isHostObject(i))return!1;var e=getPrototype$2(i);if(e===null)return!0;var t=hasOwnProperty$c.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&funcToString$2.call(t)==objectCtorString}var lodash_isplainobject=isPlainObject$2,lodash_transform={exports:{}};lodash_transform.exports;(function(i,e){var t=200,r="Expected a function",s="__lodash_hash_undefined__",o=1,a=2,l=1/0,c=9007199254740991,u="[object Arguments]",m="[object Array]",d="[object Boolean]",y="[object Date]",b="[object Error]",S="[object Function]",A="[object GeneratorFunction]",P="[object Map]",x="[object Number]",E="[object Object]",_="[object Promise]",T="[object RegExp]",C="[object Set]",R="[object String]",I="[object Symbol]",M="[object WeakMap]",D="[object ArrayBuffer]",H="[object DataView]",W="[object Float32Array]",O="[object Float64Array]",z="[object Int8Array]",k="[object Int16Array]",$="[object Int32Array]",F="[object Uint8Array]",G="[object Uint8ClampedArray]",N="[object Uint16Array]",V="[object Uint32Array]",K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,U=/^\w*$/,J=/^\./,me=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,he=/[\\^$.*+?()[\]{}|]/g,le=/\\(\\)?/g,Se=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,ue={};ue[W]=ue[O]=ue[z]=ue[k]=ue[$]=ue[F]=ue[G]=ue[N]=ue[V]=!0,ue[u]=ue[m]=ue[D]=ue[d]=ue[H]=ue[y]=ue[b]=ue[S]=ue[P]=ue[x]=ue[E]=ue[T]=ue[C]=ue[R]=ue[M]=!1;var fe=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,be=typeof self=="object"&&self&&self.Object===Object&&self,Ee=fe||be||Function("return this")(),ee=e&&!e.nodeType&&e,te=ee&&!0&&i&&!i.nodeType&&i,B=te&&te.exports===ee,re=B&&fe.process,Z=function(){try{return re&&re.binding("util")}catch(Q){}}(),Y=Z&&Z.isTypedArray;function q(Q,ae){for(var xe=-1,_e=Q?Q.length:0;++xe<_e&&ae(Q[xe],xe,Q)!==!1;);return Q}function ie(Q,ae){for(var xe=-1,_e=Q?Q.length:0;++xe<_e;)if(ae(Q[xe],xe,Q))return!0;return!1}function ne(Q){return function(ae){return ae==null?void 0:ae[Q]}}function se(Q,ae){for(var xe=-1,_e=Array(Q);++xe-1}function Ri(Q,ae){var xe=this.__data__,_e=Wt(xe,Q);return _e<0?xe.push([Q,ae]):xe[_e][1]=ae,this}ot.prototype.clear=ii,ot.prototype.delete=Mi,ot.prototype.get=Ii,ot.prototype.has=Li,ot.prototype.set=Ri;function bt(Q){var ae=-1,xe=Q?Q.length:0;for(this.clear();++aeVe))return!1;var We=Ce.get(Q);if(We&&Ce.get(ae))return We==ae;var Ke=-1,it=!0,je=Be&o?new Ut:void 0;for(Ce.set(Q,ae),Ce.set(ae,Q);++Ke-1&&Q%1==0&&Q-1&&Q%1==0&&Q<=c}function Ot(Q){var ae=typeof Q;return!!Q&&(ae=="object"||ae=="function")}function Xt(Q){return!!Q&&typeof Q=="object"}function ai(Q){return typeof Q=="symbol"||Xt(Q)&&ke.call(Q)==I}var vi=Y?ce(Y):er;function br(Q){return Q==null?"":or(Q)}function vr(Q,ae,xe){var _e=Q==null?void 0:ui(Q,ae);return _e===void 0?xe:_e}function Sr(Q,ae){return Q!=null&&hr(Q,ae,qi)}function qt(Q){return bi(Q)?Wi(Q):ir(Q)}function Ar(Q,ae,xe){var _e=St(Q)||vi(Q);if(ae=tr(ae),xe==null)if(_e||Ot(Q)){var Be=Q.constructor;_e?xe=St(Q)?new Be:[]:xe=si(Be)?ji(kt(Q)):{}}else xe={};return(_e?q:Qi)(Q,function(Ce,Oe,Ve){return ae(xe,Ce,Oe,Ve)}),xe}function xr(Q){return Q}function Er(Q){return Yt(Q)?ne(Qt(Q)):sr(Q)}i.exports=Ar})(lodash_transform,lodash_transform.exports);var lodash_transformExports=lodash_transform.exports;const isEmpty$1=lodash_isemptyExports,isPlainObject$1=lodash_isplainobject,transform=lodash_transformExports;var src=function i(e,{cleanKeys:t=[],cleanValues:r=[],emptyArrays:s=!0,emptyObjects:o=!0,emptyStrings:a=!0,NaNValues:l=!1,nullValues:c=!0,undefinedValues:u=!0}={}){return transform(e,(m,d,y)=>{if(!t.includes(y)&&((Array.isArray(d)||isPlainObject$1(d))&&(d=i(d,{NaNValues:l,cleanKeys:t,cleanValues:r,emptyArrays:s,emptyObjects:o,emptyStrings:a,nullValues:c,undefinedValues:u})),!r.includes(d)&&!(o&&isPlainObject$1(d)&&isEmpty$1(d))&&!(s&&Array.isArray(d)&&!d.length)&&!(a&&d==="")&&!(l&&Number.isNaN(d))&&!(c&&d===null)&&!(u&&d===void 0))){if(Array.isArray(m))return m.push(d);m[y]=d}})};const cleanDeep=getDefaultExportFromCjs(src),whiteUrl=()=>({"/sysMusicScoreCategories/queryTree":"/eduMusicScore/queryTree","/sysMusicScoreAccompaniment/queryPage":queryString.parse(location.search).platform?"/sysMusicScoreAccompaniment/queryPage":"/eduMusicScore/queryPage","/sysMusicScoreAccompaniment/queryPageLimit":"/eduMusicScore/queryPageLimit","/sysMusicScoreAccompaniment/querySubjectIds":"/eduMusicScore/querySubjectIds"});whiteUrl();browser();getQuery();const request=extend$1({requestType:"form",timeout:1e4});request.interceptors.request.use((i,e)=>{const t=e.isContentCenter?"/cbs-app":storeData.platformApi;storeData.proxy+t,i=matchProductApiUrl()+i;const r=getToken(),s={};return r&&!e.isContentCenter&&(s.Authorization=r),{url:i,options:{...e,params:cleanDeep(e.params),data:cleanDeep(e.data),headers:{...e.headers,...s}}}},{global:!1});request.interceptors.response.use(async(i,e)=>{if(i.status>299||i.status<200){const r=i.statusText+", 状态码"+i.status;showToast(r)}const t=await i.clone().json();if(t.code===5e3)return t;if(t.code!==200&&t.errCode!==0){const r=t.msg||t.message||"处理失败,请重试";throw t.code===403||t.code,new Error(r)}return t},{global:!1});var dayjs_min={exports:{}};(function(i,e){(function(t,r){i.exports=r()})(commonjsGlobal,function(){var t=1e3,r=6e4,s=36e5,o="millisecond",a="second",l="minute",c="hour",u="day",m="week",d="month",y="quarter",b="year",S="date",A="Invalid Date",P=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,E={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var $=["th","st","nd","rd"],F=k%100;return"["+k+($[(F-20)%10]||$[F]||$[0])+"]"}},_=function(k,$,F){var G=String(k);return!G||G.length>=$?k:""+Array($+1-G.length).join(F)+k},T={s:_,z:function(k){var $=-k.utcOffset(),F=Math.abs($),G=Math.floor(F/60),N=F%60;return($<=0?"+":"-")+_(G,2,"0")+":"+_(N,2,"0")},m:function k($,F){if($.date()1)return k(K[0])}else{var U=$.name;R[U]=$,N=U}return!G&&N&&(C=N),N||!G&&C},H=function(k,$){if(M(k))return k.clone();var F=typeof $=="object"?$:{};return F.date=k,F.args=arguments,new O(F)},W=T;W.l=D,W.i=M,W.w=function(k,$){return H(k,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var O=function(){function k(F){this.$L=D(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[I]=!0}var $=k.prototype;return $.parse=function(F){this.$d=function(G){var N=G.date,V=G.utc;if(N===null)return new Date(NaN);if(W.u(N))return new Date;if(N instanceof Date)return new Date(N);if(typeof N=="string"&&!/Z$/i.test(N)){var K=N.match(P);if(K){var U=K[2]-1||0,J=(K[7]||"0").substring(0,3);return V?new Date(Date.UTC(K[1],U,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)):new Date(K[1],U,K[3]||1,K[4]||0,K[5]||0,K[6]||0,J)}}return new Date(N)}(F),this.init()},$.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},$.$utils=function(){return W},$.isValid=function(){return this.$d.toString()!==A},$.isSame=function(F,G){var N=H(F);return this.startOf(G)<=N&&N<=this.endOf(G)},$.isAfter=function(F,G){return H(F)=0&&d<=1){if(y._volume=d,y._muted)return y;y.usingWebAudio&&y.masterGain.gain.setValueAtTime(d,t.ctx.currentTime);for(var b=0;b=0;y--)d._howls[y].unload();return d.usingWebAudio&&d.ctx&&typeof d.ctx.close<"u"&&(d.ctx.close(),d.ctx=null,m()),d},codecs:function(d){return(this||t)._codecs[d.replace(/^x-/,"")]},_setup:function(){var d=this||t;if(d.state=d.ctx&&d.ctx.state||"suspended",d._autoSuspend(),!d.usingWebAudio)if(typeof Audio<"u")try{var y=new Audio;typeof y.oncanplaythrough>"u"&&(d._canPlayEvent="canplay")}catch(b){d.noAudio=!0}else d.noAudio=!0;try{var y=new Audio;y.muted&&(d.noAudio=!0)}catch(b){}return d.noAudio||d._setupCodecs(),d},_setupCodecs:function(){var d=this||t,y=null;try{y=typeof Audio<"u"?new Audio:null}catch(T){return d}if(!y||typeof y.canPlayType!="function")return d;var b=y.canPlayType("audio/mpeg;").replace(/^no$/,""),S=d._navigator?d._navigator.userAgent:"",A=S.match(/OPR\/(\d+)/g),P=A&&parseInt(A[0].split("/")[1],10)<33,x=S.indexOf("Safari")!==-1&&S.indexOf("Chrome")===-1,E=S.match(/Version\/(.*?) /),_=x&&E&&parseInt(E[1],10)<15;return d._codecs={mp3:!!(!P&&(b||y.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!b,opus:!!y.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!y.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!y.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(y.canPlayType('audio/wav; codecs="1"')||y.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!y.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!y.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(y.canPlayType("audio/x-m4a;")||y.canPlayType("audio/m4a;")||y.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(y.canPlayType("audio/x-m4b;")||y.canPlayType("audio/m4b;")||y.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(y.canPlayType("audio/x-mp4;")||y.canPlayType("audio/mp4;")||y.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!_&&y.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!_&&y.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!y.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(y.canPlayType("audio/x-flac;")||y.canPlayType("audio/flac;")).replace(/^no$/,"")},d},_unlockAudio:function(){var d=this||t;if(!(d._audioUnlocked||!d.ctx)){d._audioUnlocked=!1,d.autoUnlock=!1,!d._mobileUnloaded&&d.ctx.sampleRate!==44100&&(d._mobileUnloaded=!0,d.unload()),d._scratchBuffer=d.ctx.createBuffer(1,1,22050);var y=function(b){for(;d._html5AudioPool.length"u"?_.noteOn(0):_.start(0),typeof d.ctx.resume=="function"&&d.ctx.resume(),_.onended=function(){_.disconnect(0),d._audioUnlocked=!0,document.removeEventListener("touchstart",y,!0),document.removeEventListener("touchend",y,!0),document.removeEventListener("click",y,!0),document.removeEventListener("keydown",y,!0);for(var T=0;T"u"||!t.usingWebAudio)){for(var y=0;y"u"||!t.usingWebAudio))return d.state==="running"&&d.ctx.state!=="interrupted"&&d._suspendTimer?(clearTimeout(d._suspendTimer),d._suspendTimer=null):d.state==="suspended"||d.state==="running"&&d.ctx.state==="interrupted"?(d.ctx.resume().then(function(){d.state="running";for(var y=0;y"u"&&(d="__default",!b._playLock)){for(var A=0,P=0;P0?x._seek:b._sprite[d][0]/1e3),T=Math.max(0,(b._sprite[d][0]+b._sprite[d][1])/1e3-_),C=T*1e3/Math.abs(x._rate),R=b._sprite[d][0]/1e3,I=(b._sprite[d][0]+b._sprite[d][1])/1e3;x._sprite=d,x._ended=!1;var M=function(){x._paused=!1,x._seek=_,x._start=R,x._stop=I,x._loop=!!(x._loop||b._sprite[d][2])};if(_>=I){b._ended(x);return}var D=x._node;if(b._webAudio){var H=function(){b._playLock=!1,M(),b._refreshBuffer(x);var k=x._muted||b._muted?0:x._volume;D.gain.setValueAtTime(k,t.ctx.currentTime),x._playStart=t.ctx.currentTime,typeof D.bufferSource.start>"u"?x._loop?D.bufferSource.noteGrainOn(0,_,86400):D.bufferSource.noteGrainOn(0,_,T):x._loop?D.bufferSource.start(0,_,86400):D.bufferSource.start(0,_,T),C!==1/0&&(b._endTimers[x._id]=setTimeout(b._ended.bind(b,x),C)),y||setTimeout(function(){b._emit("play",x._id),b._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?H():(b._playLock=!0,b.once("resume",H),b._clearTimer(x._id))}else{var W=function(){D.currentTime=_,D.muted=x._muted||b._muted||t._muted||D.muted,D.volume=x._volume*t.volume(),D.playbackRate=x._rate;try{var k=D.play();if(k&&typeof Promise<"u"&&(k instanceof Promise||typeof k.then=="function")?(b._playLock=!0,M(),k.then(function(){b._playLock=!1,D._unlocked=!0,y?b._loadQueue():b._emit("play",x._id)}).catch(function(){b._playLock=!1,b._emit("playerror",x._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),x._ended=!0,x._paused=!0})):y||(b._playLock=!1,M(),b._emit("play",x._id)),D.playbackRate=x._rate,D.paused){b._emit("playerror",x._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}d!=="__default"||x._loop?b._endTimers[x._id]=setTimeout(b._ended.bind(b,x),C):(b._endTimers[x._id]=function(){b._ended(x),D.removeEventListener("ended",b._endTimers[x._id],!1)},D.addEventListener("ended",b._endTimers[x._id],!1))}catch($){b._emit("playerror",x._id,$)}};D.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(D.src=b._src,D.load());var O=window&&window.ejecta||!D.readyState&&t._navigator.isCocoonJS;if(D.readyState>=3||O)W();else{b._playLock=!0,b._state="loading";var z=function(){b._state="loaded",W(),D.removeEventListener(t._canPlayEvent,z,!1)};D.addEventListener(t._canPlayEvent,z,!1),b._clearTimer(x._id)}}return x._id},pause:function(d){var y=this;if(y._state!=="loaded"||y._playLock)return y._queue.push({event:"pause",action:function(){y.pause(d)}}),y;for(var b=y._getSoundIds(d),S=0;S"u"?A._node.bufferSource.noteOff(0):A._node.bufferSource.stop(0),y._cleanBuffer(A._node)}else(!isNaN(A._node.duration)||A._node.duration===1/0)&&A._node.pause();arguments[1]||y._emit("pause",A?A._id:null)}return y},stop:function(d,y){var b=this;if(b._state!=="loaded"||b._playLock)return b._queue.push({event:"stop",action:function(){b.stop(d)}}),b;for(var S=b._getSoundIds(d),A=0;A"u"?P._node.bufferSource.noteOff(0):P._node.bufferSource.stop(0),b._cleanBuffer(P._node)):(!isNaN(P._node.duration)||P._node.duration===1/0)&&(P._node.currentTime=P._start||0,P._node.pause(),P._node.duration===1/0&&b._clearSound(P._node))),y||b._emit("stop",P._id))}return b},mute:function(d,y){var b=this;if(b._state!=="loaded"||b._playLock)return b._queue.push({event:"mute",action:function(){b.mute(d,y)}}),b;if(typeof y>"u")if(typeof d=="boolean")b._muted=d;else return b._muted;for(var S=b._getSoundIds(y),A=0;A"u"){var A=d._getSoundIds(),P=A.indexOf(y[0]);P>=0?S=parseInt(y[0],10):b=parseFloat(y[0])}else y.length>=2&&(b=parseFloat(y[0]),S=parseInt(y[1],10));var x;if(typeof b<"u"&&b>=0&&b<=1){if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"volume",action:function(){d.volume.apply(d,y)}}),d;typeof S>"u"&&(d._volume=b),S=d._getSoundIds(S);for(var E=0;E"u")}}return A},_startFadeInterval:function(d,y,b,S,A,P){var x=this,E=y,_=b-y,T=Math.abs(_/.01),C=Math.max(4,T>0?S/T:S),R=Date.now();d._fadeTo=b,d._interval=setInterval(function(){var I=(Date.now()-R)/S;R=Date.now(),E+=_*I,E=Math.round(E*100)/100,_<0?E=Math.max(b,E):E=Math.min(b,E),x._webAudio?d._volume=E:x.volume(E,d._id,!0),P&&(x._volume=E),(by&&E>=b)&&(clearInterval(d._interval),d._interval=null,d._fadeTo=null,x.volume(b,d._id),x._emit("fade",d._id))},C)},_stopFade:function(d){var y=this,b=y._soundById(d);return b&&b._interval&&(y._webAudio&&b._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(b._interval),b._interval=null,y.volume(b._fadeTo,d),b._fadeTo=null,y._emit("fade",d)),y},loop:function(){var d=this,y=arguments,b,S,A;if(y.length===0)return d._loop;if(y.length===1)if(typeof y[0]=="boolean")b=y[0],d._loop=b;else return A=d._soundById(parseInt(y[0],10)),A?A._loop:!1;else y.length===2&&(b=y[0],S=parseInt(y[1],10));for(var P=d._getSoundIds(S),x=0;x=0?S=parseInt(y[0],10):b=parseFloat(y[0])}else y.length===2&&(b=parseFloat(y[0]),S=parseInt(y[1],10));var x;if(typeof b=="number"){if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"rate",action:function(){d.rate.apply(d,y)}}),d;typeof S>"u"&&(d._rate=b),S=d._getSoundIds(S);for(var E=0;E=0?S=parseInt(y[0],10):d._sounds.length&&(S=d._sounds[0]._id,b=parseFloat(y[0]))}else y.length===2&&(b=parseFloat(y[0]),S=parseInt(y[1],10));if(typeof S>"u")return 0;if(typeof b=="number"&&(d._state!=="loaded"||d._playLock))return d._queue.push({event:"seek",action:function(){d.seek.apply(d,y)}}),d;var x=d._soundById(S);if(x)if(typeof b=="number"&&b>=0){var E=d.playing(S);E&&d.pause(S,!0),x._seek=b,x._ended=!1,d._clearTimer(S),!d._webAudio&&x._node&&!isNaN(x._node.duration)&&(x._node.currentTime=b);var _=function(){E&&d.play(S,!0),d._emit("seek",S)};if(E&&!d._webAudio){var T=function(){d._playLock?setTimeout(T,0):_()};setTimeout(T,0)}else _()}else if(d._webAudio){var C=d.playing(S)?t.ctx.currentTime-x._playStart:0,R=x._rateSeek?x._rateSeek-x._seek:0;return x._seek+(R+C*Math.abs(x._rate))}else return x._node.currentTime;return d},playing:function(d){var y=this;if(typeof d=="number"){var b=y._soundById(d);return b?!b._paused:!1}for(var S=0;S=0&&t._howls.splice(S,1);var A=!0;for(b=0;b=0){A=!1;break}return o&&A&&delete o[d._src],t.noAudio=!1,d._state="unloaded",d._sounds=[],d=null,null},on:function(d,y,b,S){var A=this,P=A["_on"+d];return typeof y=="function"&&P.push(S?{id:b,fn:y,once:S}:{id:b,fn:y}),A},off:function(d,y,b){var S=this,A=S["_on"+d],P=0;if(typeof y=="number"&&(b=y,y=null),y||b)for(P=0;P=0;P--)(!A[P].id||A[P].id===y||d==="load")&&(setTimeout((function(x){x.call(this,y,b)}).bind(S,A[P].fn),0),A[P].once&&S.off(d,A[P].fn,A[P].id));return S._loadQueue(d),S},_loadQueue:function(d){var y=this;if(y._queue.length>0){var b=y._queue[0];b.event===d&&(y._queue.shift(),y._loadQueue()),d||b.action()}return y},_ended:function(d){var y=this,b=d._sprite;if(!y._webAudio&&d._node&&!d._node.paused&&!d._node.ended&&d._node.currentTime=0;S--){if(b<=y)return;d._sounds[S]._ended&&(d._webAudio&&d._sounds[S]._node&&d._sounds[S]._node.disconnect(0),d._sounds.splice(S,1),b--)}}},_getSoundIds:function(d){var y=this;if(typeof d>"u"){for(var b=[],S=0;S=0;if(!d.bufferSource)return y;if(t._scratchBuffer&&d.bufferSource&&(d.bufferSource.onended=null,d.bufferSource.disconnect(0),b))try{d.bufferSource.buffer=t._scratchBuffer}catch(S){}return d.bufferSource=null,y},_clearSound:function(d){var y=/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent);y||(d.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(d){this._parent=d,this.init()};s.prototype={init:function(){var d=this,y=d._parent;return d._muted=y._muted,d._loop=y._loop,d._volume=y._volume,d._rate=y._rate,d._seek=0,d._paused=!0,d._ended=!0,d._sprite="__default",d._id=++t._counter,y._sounds.push(d),d.create(),d},create:function(){var d=this,y=d._parent,b=t._muted||d._muted||d._parent._muted?0:d._volume;return y._webAudio?(d._node=typeof t.ctx.createGain>"u"?t.ctx.createGainNode():t.ctx.createGain(),d._node.gain.setValueAtTime(b,t.ctx.currentTime),d._node.paused=!0,d._node.connect(t.masterGain)):t.noAudio||(d._node=t._obtainHtml5Audio(),d._errorFn=d._errorListener.bind(d),d._node.addEventListener("error",d._errorFn,!1),d._loadFn=d._loadListener.bind(d),d._node.addEventListener(t._canPlayEvent,d._loadFn,!1),d._endFn=d._endListener.bind(d),d._node.addEventListener("ended",d._endFn,!1),d._node.src=y._src,d._node.preload=y._preload===!0?"auto":y._preload,d._node.volume=b*t.volume(),d._node.load()),d},reset:function(){var d=this,y=d._parent;return d._muted=y._muted,d._loop=y._loop,d._volume=y._volume,d._rate=y._rate,d._seek=0,d._rateSeek=0,d._paused=!0,d._ended=!0,d._sprite="__default",d._id=++t._counter,d},_errorListener:function(){var d=this;d._parent._emit("loaderror",d._id,d._node.error?d._node.error.code:0),d._node.removeEventListener("error",d._errorFn,!1)},_loadListener:function(){var d=this,y=d._parent;y._duration=Math.ceil(d._node.duration*10)/10,Object.keys(y._sprite).length===0&&(y._sprite={__default:[0,y._duration*1e3]}),y._state!=="loaded"&&(y._state="loaded",y._emit("load"),y._loadQueue()),d._node.removeEventListener(t._canPlayEvent,d._loadFn,!1)},_endListener:function(){var d=this,y=d._parent;y._duration===1/0&&(y._duration=Math.ceil(d._node.duration*10)/10,y._sprite.__default[1]===1/0&&(y._sprite.__default[1]=y._duration*1e3),y._ended(d)),d._node.removeEventListener("ended",d._endFn,!1)}};var o={},a=function(d){var y=d._src;if(o[y]){d._duration=o[y].duration,u(d);return}if(/^data:[^;]+;base64,/.test(y)){for(var b=atob(y.split(",")[1]),S=new Uint8Array(b.length),A=0;A0?(o[y._src]=A,u(y,A)):b()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(d).then(S).catch(b):t.ctx.decodeAudioData(d,S,b)},u=function(d,y){y&&!d._duration&&(d._duration=y.duration),Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,d._duration*1e3]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue())},m=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch(A){t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var d=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),y=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),b=y?parseInt(y[1],10):null;if(d&&b&&b<9){var S=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!S&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=typeof t.ctx.createGain>"u"?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};i.Howler=t,i.Howl=r,typeof commonjsGlobal<"u"?(commonjsGlobal.HowlerGlobal=e,commonjsGlobal.Howler=t,commonjsGlobal.Howl=r,commonjsGlobal.Sound=s):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=r,window.Sound=s)})();/*! * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. * * howler.js v2.2.4 * howlerjs.com * * (c) 2013-2020, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var r=this;if(!r.ctx||!r.ctx.listener)return r;for(var s=r._howls.length-1;s>=0;s--)r._howls[s].stereo(t);return r},HowlerGlobal.prototype.pos=function(t,r,s){var o=this;if(!o.ctx||!o.ctx.listener)return o;if(r=typeof r!="number"?o._pos[1]:r,s=typeof s!="number"?o._pos[2]:s,typeof t=="number")o._pos=[t,r,s],typeof o.ctx.listener.positionX<"u"?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]);else return o._pos;return o},HowlerGlobal.prototype.orientation=function(t,r,s,o,a,l){var c=this;if(!c.ctx||!c.ctx.listener)return c;var u=c._orientation;if(r=typeof r!="number"?u[1]:r,s=typeof s!="number"?u[2]:s,o=typeof o!="number"?u[3]:o,a=typeof a!="number"?u[4]:a,l=typeof l!="number"?u[5]:l,typeof t=="number")c._orientation=[t,r,s,o,a,l],typeof c.ctx.listener.forwardX<"u"?(c.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),c.ctx.listener.forwardY.setTargetAtTime(r,Howler.ctx.currentTime,.1),c.ctx.listener.forwardZ.setTargetAtTime(s,Howler.ctx.currentTime,.1),c.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),c.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),c.ctx.listener.upZ.setTargetAtTime(l,Howler.ctx.currentTime,.1)):c.ctx.listener.setOrientation(t,r,s,o,a,l);else return u;return c},Howl.prototype.init=function(t){return function(r){var s=this;return s._orientation=r.orientation||[1,0,0],s._stereo=r.stereo||null,s._pos=r.pos||null,s._pannerAttr={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:360,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:360,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:0,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:"inverse",maxDistance:typeof r.maxDistance<"u"?r.maxDistance:1e4,panningModel:typeof r.panningModel<"u"?r.panningModel:"HRTF",refDistance:typeof r.refDistance<"u"?r.refDistance:1,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:1},s._onstereo=r.onstereo?[{fn:r.onstereo}]:[],s._onpos=r.onpos?[{fn:r.onpos}]:[],s._onorientation=r.onorientation?[{fn:r.onorientation}]:[],t.call(this,r)}}(Howl.prototype.init),Howl.prototype.stereo=function(t,r){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"stereo",action:function(){s.stereo(t,r)}}),s;var o=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof r>"u")if(typeof t=="number")s._stereo=t,s._pos=[t,0,0];else return s._stereo;for(var a=s._getSoundIds(r),l=0;l"u")if(typeof t=="number")a._pos=[t,r,s];else return a._pos;for(var l=a._getSoundIds(o),c=0;c"u")if(typeof t=="number")a._orientation=[t,r,s];else return a._orientation;for(var l=a._getSoundIds(o),c=0;c"u"&&(s.pannerAttr||(s.pannerAttr={coneInnerAngle:s.coneInnerAngle,coneOuterAngle:s.coneOuterAngle,coneOuterGain:s.coneOuterGain,distanceModel:s.distanceModel,maxDistance:s.maxDistance,refDistance:s.refDistance,rolloffFactor:s.rolloffFactor,panningModel:s.panningModel}),t._pannerAttr={coneInnerAngle:typeof s.pannerAttr.coneInnerAngle<"u"?s.pannerAttr.coneInnerAngle:t._coneInnerAngle,coneOuterAngle:typeof s.pannerAttr.coneOuterAngle<"u"?s.pannerAttr.coneOuterAngle:t._coneOuterAngle,coneOuterGain:typeof s.pannerAttr.coneOuterGain<"u"?s.pannerAttr.coneOuterGain:t._coneOuterGain,distanceModel:typeof s.pannerAttr.distanceModel<"u"?s.pannerAttr.distanceModel:t._distanceModel,maxDistance:typeof s.pannerAttr.maxDistance<"u"?s.pannerAttr.maxDistance:t._maxDistance,refDistance:typeof s.pannerAttr.refDistance<"u"?s.pannerAttr.refDistance:t._refDistance,rolloffFactor:typeof s.pannerAttr.rolloffFactor<"u"?s.pannerAttr.rolloffFactor:t._rolloffFactor,panningModel:typeof s.pannerAttr.panningModel<"u"?s.pannerAttr.panningModel:t._panningModel});else return a=t._soundById(parseInt(r[0],10)),a?a._pannerAttr:t._pannerAttr;else r.length===2&&(s=r[0],o=parseInt(r[1],10));for(var l=t._getSoundIds(o),c=0;cmetronomeData.cursorMode,()=>{const i=document.querySelector("#cursorImg-0");if(i){switch(metronomeData.cursorMode){case 1:i.classList.remove("lineHide"),i.style.opacity="inherit",metronomeData.cursorTips="您已切换到指针跟随音符播放",i.style.opacity="inherit";break;case 2:i.classList.add("lineHide"),i.style.opacity="inherit",metronomeData.cursorTips="您已切换到指针跟随节拍播放";break;case 3:i.style.opacity="0",metronomeData.cursorTips="您已关闭指针显示";break}hideCursorTip()}});const toggleLine=()=>{if(!metronomeData.lineShow)return;const i=document.querySelector("#cursorImg-0");i&&(state$1.times[state$1.activeNoteIndex].multipleRestMeasures?i.classList.remove("lineHide"):i.classList.add("lineHide"))};watch(()=>metronomeData.lineShow,()=>{const i=document.querySelector("#cursorImg-0");i&&(metronomeData.lineShow?i.classList.add("lineHide"):i.classList.remove("lineHide"))});class Metronome{constructor(e){mt(this,"playType","tick");mt(this,"source",null);mt(this,"source1",null);mt(this,"source2",null);mt(this,"createAudio",e=>new Promise(t=>{const r=new Audio(e);r.load(),r.onloadedmetadata=()=>{t(r)},r.onerror=()=>{t(null)}}));mt(this,"sound",e=>{state$1.sectionStatus||(e=setCurrentTime(e));let t=-1,r=-1;for(let s=0;s=o)t=s,r=o;else break}if(t>-1&&metronomeData.activeIndex!==t){metronomeData.activeIndex=t,metronomeData.activeMetro=this.getStep(r),this.playAudio(),metronomeData.isClick=!1;return}toggleLine(),metronomeData.isClick=!1});mt(this,"playAudio",()=>{var t;if(!metronomeData.initPlayerState||state$1.playState==="paused")return;const e=state$1.setting.beatVolume/100;this.source=((t=metronomeData.activeMetro)==null?void 0:t.index)===0?audioData$2.tick:audioData$2.tock,this.source.volume=metronomeData.disable?0:e,this.source.volume<=0?this.source.muted=!0:this.source.muted=!1,this.source.play()});mt(this,"simulatePlayAudio",()=>{if(!metronomeData.initPlayerState)return;const e=state$1.setting.beatVolume/100;this.source=metronomeData.followAudioIndex===1?audioData$2.tick:audioData$2.tock,this.source.volume=metronomeData.disable?0:e,this.source.volume<=0?this.source.muted=!0:this.source.muted=!1,console.log("音量",this.source,this.source.volume),this.source.play(),metronomeData.followAudioIndex+=1,metronomeData.followAudioIndex=metronomeData.followAudioIndex>metronomeData.totalNumerator?1:metronomeData.followAudioIndex});mt(this,"loadAudio1",()=>new howler.Howl({src:tockAndTick.tick}));mt(this,"loadAudio2",()=>new howler.Howl({src:tockAndTick.tock}))}init(e){this.calculation(e),metronomeData.activeList=[]}initPlayer(){Promise.all([this.createAudio(tickWav),this.createAudio(tockWav)]).then(([e,t])=>{e&&(audioData$2.tick=e),t&&(audioData$2.tock=t),metronomeData.initPlayerState=!0})}selectPlay(){}getStep(e){for(let t=0;to.time===e);if(s)return s}return{}}calculation(e){var a,l,c,u,m,d,y,b,S,A,P,x,E,_;const t=[];let r=-1;for(let T=0;T-1&&R!=r){const M={measureNumberXML:R,measureNumberIndex:I,numerator:((y=(d=(m=C==null?void 0:C.noteElement)==null?void 0:m.sourceMeasure)==null?void 0:d.ActiveTimeSignature)==null?void 0:y.numerator)||0,start:C.measures[0].time,end:C.measures[C.measures.length-1].endtime,time:C.measures[C.measures.length-1].endtime-C.measures[0].time,stave_x:((x=(P=(A=(S=(b=C==null?void 0:C.noteElement)==null?void 0:b.sourceMeasure)==null?void 0:S.verticalMeasureList)==null?void 0:A[0])==null?void 0:P.stave)==null?void 0:x.x)||0,end_x:((E=C==null?void 0:C.stave)==null?void 0:E.end_x)||0||0,stepList:[],svgs:[],isRestFlag:C.isRestFlag};if([121].includes(state$1.subjectId)){const D=e.filter(H=>{var W,O;return((O=(W=H==null?void 0:H.noteElement)==null?void 0:W.sourceMeasure)==null?void 0:O.measureListIndex)==I});C.measures=D,M.start=C.measures[0].time,M.end=C.measures[C.measures.length-1].endtime,M.time=C.measures[C.measures.length-1].endtime-C.measures[0].time;try{const H=C.noteElement.sourceMeasure.verticalMeasureList.reduce((O,z)=>(O.push(...z.vfVoices[1].tickables),O),[]),W=[];M.svgs=H.map(O=>{const z=O.getBoundingBox().x;if(!W.includes(z)&&O.duration!=="w")return W.push(z),O._start_x=z,O}).filter(Boolean).sort((O,z)=>O._start_x-z._start_x)}catch(H){console.log(H)}M.stepList=calculateMutilpleMetroStep(C.measures,M)}else M.stepList=calculateMetroStep(C.measures,M);t.push(M),r=R}}let s=[];const o=[];try{for(let T=0;T-1?"".concat(O," + ").concat(M,"%"):"".concat(O,"px + ").concat(M,"%"):"".concat(M,"%"),C.stepList[D]=W}o[T].push({index:D,time:H,left:(W==null?void 0:W.indexOf("%"))>-1?"calc(".concat(W,")"):W,measureNumberXML:C.measureNumberXML,isRestFlag:C.isRestFlag})}}}catch(T){console.log(T)}metronomeData.metroList=s,metronomeData.metroMeasure=o,metronomeData.activeMetro=((_=o[0])==null?void 0:_[0])||{}}}function calculateMetroStep(i,e){var l,c,u,m,d,y,b,S,A,P,x,E,_,T,C,R,I,M,D,H,W,O,z,k,$,F,G,N,V,K,U,J,me,he,le,Se,oe,ue,fe,be,Ee,ee,te,B,re;const r=i.reduce((Z,Y)=>(Z+=Y._noteLength,Z),0)/e.numerator;if(i.length===1){const Z=i[0].svgElement;if(Z&&!Z.isRest()){const Y=((d=(m=(u=(c=(l=Z==null?void 0:Z.attrs)==null?void 0:l.el)==null?void 0:c.parentElement)==null?void 0:u.parentElement)==null?void 0:m.getBoundingClientRect)==null?void 0:d.call(m))||{x:0,right:0};let q=((S=(b=(y=Z==null?void 0:Z.attrs)==null?void 0:y.el)==null?void 0:b.getBoundingClientRect)==null?void 0:S.call(b))||{x:0},ie=Math.abs(Y.right-q.x)/e.numerator,ne=[];for(let se=0;se=1){s-=r;const ne=((O=(W=(H=(D=(M=(I=Y==null?void 0:Y.svgElement)==null?void 0:I.attrs)==null?void 0:M.el)==null?void 0:D.parentElement)==null?void 0:H.parentElement)==null?void 0:W.getBoundingClientRect)==null?void 0:O.call(W))||{x:0};if(o.length>0){let ve=((G=(F=($=(k=(z=o[0])==null?void 0:z.svgElement)==null?void 0:k.attrs)==null?void 0:$.el)==null?void 0:F.getBoundingClientRect)==null?void 0:G.call(F))||{x:0},ye=ve.x-ne.x;if(o[0]._noteLength/r>=1){const ge=((J=(U=(K=(V=(N=i[o[0].index+1])==null?void 0:N.svgElement)==null?void 0:V.attrs)==null?void 0:K.el)==null?void 0:U.getBoundingClientRect)==null?void 0:J.call(U))||{x:ne.right},Pe=Math.abs(ve.x-ge.x)/2;ye=ve.x-ne.x+Pe}a.push(ye)}else{let ye=(((Se=(le=(he=(me=Y==null?void 0:Y.svgElement)==null?void 0:me.attrs)==null?void 0:he.el)==null?void 0:le.getBoundingClientRect)==null?void 0:Se.call(le))||{x:0}).x-ne.x;a.push(ye)}o=[];let se=((be=(fe=(ue=(oe=Y==null?void 0:Y.svgElement)==null?void 0:oe.attrs)==null?void 0:ue.el)==null?void 0:fe.getBoundingClientRect)==null?void 0:be.call(fe))||{x:0},ce=se.x-ne.x,de=0;if(ie>1){const ve=((re=(B=(te=(ee=(Ee=i[Z+1])==null?void 0:Ee.svgElement)==null?void 0:ee.attrs)==null?void 0:te.el)==null?void 0:B.getBoundingClientRect)==null?void 0:re.call(B))||{x:ne.right};de=Math.abs(se.x-ve.x)/ie}for(let ve=1;veNumber.EPSILON&&s>0&&o.push(Y)}return a=a.reduce((Z,Y)=>(Z.includes(Y)?Z.push(void 0):Z.push(Y),Z),[]),a}function calculateMutilpleMetroStep(i,e){var l,c,u,m,d,y,b,S,A,P,x,E,_,T,C,R,I,M,D;const t=e.time/e.numerator,r=((b=(y=(d=(m=(u=(c=(l=i[0])==null?void 0:l.svgElement)==null?void 0:c.attrs)==null?void 0:u.el)==null?void 0:m.parentElement)==null?void 0:d.parentElement)==null?void 0:y.getBoundingClientRect)==null?void 0:b.call(y))||{x:0};if(i.length===1){const H=e.svgs[0];let W=((P=(A=(S=H==null?void 0:H.attrs)==null?void 0:S.el)==null?void 0:A.getBoundingClientRect)==null?void 0:P.call(A))||{x:0};return H&&!H.isRest()?[W.x-r.x]:[]}let s=0,o=[],a=[];for(let H=0;Ht){s-=t;let $=k.x-r.x;o.length>0&&(z=(C=(T=e.svgs[o[0]._index])==null?void 0:T.attrs)==null?void 0:C.el,k=((R=z==null?void 0:z.getBoundingClientRect)==null?void 0:R.call(z))||{x:0},$=k.x-r.x),a.push($),o=[]}else o.push(W);if(Math.abs(s-t)<.001){let $=k.x-r.x;o.length>0&&(z=(M=(I=e.svgs[o[0]._index])==null?void 0:I.attrs)==null?void 0:M.el,k=((D=z==null?void 0:z.getBoundingClientRect)==null?void 0:D.call(z))||{x:0},$=k.x-r.x),a.push($),s=0,o=[]}}return a=a.reduce((H,W)=>(H.includes(W)?H.push(void 0):H.push(W),H),[]),a}function setCurrentTime(i){return browserInfo$3.huawei||browserInfo$3.xiaomi?i+=.125:browserInfo$3.android?i+=.11:browserInfo$3.ios&&(i+=.01),i}function hideCursorTip(){tipsTimer?(clearTimeout(tipsTimer),tipsTimer=setTimeout(()=>{metronomeData.cursorTips="",clearTimeout(tipsTimer),tipsTimer=null},2e3)):tipsTimer=setTimeout(()=>{metronomeData.cursorTips="",clearTimeout(tipsTimer),tipsTimer=null},2e3)}var GradualVersion=(i=>(i[i.BASE=0]="BASE",i[i.ENSEMBLE=1]="ENSEMBLE",i))(GradualVersion||{});const scoreMode="_scoreMode_6lpfe_1",tipBox="_tipBox_6lpfe_5",tipContent="_tipContent_6lpfe_15",tipBtn="_tipBtn_6lpfe_18",hiddenPop="_hiddenPop_6lpfe_28",styles$6={scoreMode,tipBox,tipContent,tipBtn,hiddenPop};var context={locks:{},zIndex:2e3,enableRipple:!0};reactive(context);const Context=reactive(context);var __defProp$1=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols$1=Object.getOwnPropertySymbols,__hasOwnProp$1=Object.prototype.hasOwnProperty,__propIsEnum$1=Object.prototype.propertyIsEnumerable,__defNormalProp$1=(i,e,t)=>e in i?__defProp$1(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,__spreadValues$1=(i,e)=>{for(var t in e||(e={}))__hasOwnProp$1.call(e,t)&&__defNormalProp$1(i,t,e[t]);if(__getOwnPropSymbols$1)for(var t of __getOwnPropSymbols$1(e))__propIsEnum$1.call(e,t)&&__defNormalProp$1(i,t,e[t]);return i},__spreadProps=(i,e)=>__defProps(i,__getOwnPropDescs(e)),isString=i=>typeof i=="string",isBoolean=i=>typeof i=="boolean",isNumber=i=>typeof i=="number",isPlainObject=i=>Object.prototype.toString.call(i)==="[object Object]",isFunction$2=i=>typeof i=="function",isArray$2=i=>Array.isArray(i),isURL=i=>i?/^(http)|(\.*\/)/.test(i):!1,isWindow=i=>i===window,supportTouch=()=>inBrowser()&&"ontouchstart"in window,toNumber=i=>i==null?0:isString(i)?(i=parseFloat(i),i=Number.isNaN(i)?0:i,i):isBoolean(i)?Number(i):i,removeItem=(i,e)=>{if(i.length){const t=i.indexOf(e);if(t>-1)return i.splice(t,1)}},inBrowser=()=>typeof window<"u",bigCamelize=i=>camelize(i).replace(i.charAt(0),i.charAt(0).toUpperCase()),camelize=i=>i.replace(/-(\w)/g,(e,t)=>t.toUpperCase()),getStyle$1=i=>window.getComputedStyle(i),getRect=i=>{if(isWindow(i)){const e=i.innerWidth,t=i.innerHeight,r={x:0,y:0,top:0,left:0,right:e,bottom:t,width:e,height:t};return __spreadProps(__spreadValues$1({},r),{toJSON:()=>r})}return i.getBoundingClientRect()},__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,e,t)=>e in i?__defProp(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,__spreadValues=(i,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(i,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(i,t,e[t]);return i},__objRest=(i,e)=>{var t={};for(var r in i)__hasOwnProp.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&__getOwnPropSymbols)for(var r of __getOwnPropSymbols(i))e.indexOf(r)<0&&__propIsEnum.call(i,r)&&(t[r]=i[r]);return t};function onSmartMounted(i){let e=!1;onMounted(()=>{i(),nextTick(()=>{e=!0})}),onActivated(()=>{e&&i()})}function useEventListener(i,e,t,r={}){if(!inBrowser())return;const{passive:s=!1,capture:o=!1}=r;let a=!1,l=!1;const c=b=>isFunction$2(b)?b():unref(b),u=b=>{if(a||l)return;const S=c(b);S&&(S.addEventListener(e,t,{passive:s,capture:o}),a=!0)},m=b=>{if(!a||l)return;const S=c(b);S&&(S.removeEventListener(e,t,{capture:o}),a=!1)};let d;isRef(i)&&(d=watch(()=>i.value,(b,S)=>{m(S),u(b)}));const y=()=>{d==null||d(),m(i),l=!0};return onSmartMounted(()=>{u(i)}),onBeforeUnmount(()=>{m(i)}),onDeactivated(()=>{m(i)}),y}function keyInProvides(i){const e=getCurrentInstance();return i in e.provides}function useParent(i){if(!keyInProvides(i))return{index:null,parentProvider:null,bindParent:null};const t=inject(i),{childInstances:r,collect:s,clear:o}=t,a=__objRest(t,["childInstances","collect","clear"]),l=getCurrentInstance();return{index:computed(()=>r.indexOf(l)),parentProvider:a,bindParent:m=>{onMounted(()=>{nextTick().then(()=>{s(l,m)})}),onBeforeUnmount(()=>{nextTick().then(()=>{o(l,m)})})}}}function flatVNodes(i){const e=[],t=r=>{if(r!=null&&r.component){t(r==null?void 0:r.component.subTree);return}Array.isArray(r==null?void 0:r.children)&&r.children.forEach(s=>{isVNode(s)&&(e.push(s),t(s))})};return t(i),e}function useChildren(i){const e=getCurrentInstance(),t=reactive([]),r=[],s=computed(()=>t.length),o=()=>{const u=flatVNodes(e.subTree);t.sort((m,d)=>u.indexOf(m.vnode)-u.indexOf(d.vnode))},a=(u,m)=>{t.push(u),r.push(m),o()},l=(u,m)=>{removeItem(t,u),removeItem(r,m)};return{length:s,childProviders:r,bindChildren:u=>{provide(i,__spreadValues({childInstances:t,collect:a,clear:l},u))}}}function useInitialized(i,e){const t=ref(!1);return watch(i,r=>{e===r&&(t.value=!0)},{immediate:!0}),t}function asyncGeneratorStep$1(i,e,t,r,s,o,a){try{var l=i[o](a),c=l.value}catch(u){t(u);return}l.done?e(c):Promise.resolve(c).then(r,s)}function _asyncToGenerator$1(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var o=i.apply(e,t);function a(c){asyncGeneratorStep$1(o,r,s,a,l,"next",c)}function l(c){asyncGeneratorStep$1(o,r,s,a,l,"throw",c)}a(void 0)})}}function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(i){for(var e=1;e(t[r]=i[r],t),{}):i[e]}function withInstall(i,e){var t=e!=null?e:i;return t.install=function(r){var{name:s}=i;s&&r.component(s,i)},t}function mount(i){var e=createApp(i),t=document.createElement("div");return document.body.appendChild(t),{instance:e.mount(t),unmount(){e.unmount(),document.body.removeChild(t)}}}function mountInstance(i,e,t){e===void 0&&(e={}),t===void 0&&(t={});var r={setup(){return()=>h$1(i,_extends$5({},e,t))}},{unmount:s}=mount(r);return{unmountInstance:s}}function useValidation(){var i=ref(""),e=function(){var s=_asyncToGenerator$1(function*(o,a,l){if(!isArray$2(o)||!o.length)return!0;var c=yield Promise.all(o.map(u=>u(a,l)));return!c.some(u=>u!==!0?(i.value=String(u),!0):!1)});return function(a,l,c){return s.apply(this,arguments)}}(),t=()=>{i.value=""},r=function(){var s=_asyncToGenerator$1(function*(o,a,l,c,u){o.includes(a)&&(yield e(l,c,u))&&(i.value="")});return function(a,l,c,u,m){return s.apply(this,arguments)}}();return{errorMessage:i,validate:e,resetValidation:t,validateWithTrigger:r}}function useRouteListener(i){useEventListener(()=>window,"hashchange",i),useEventListener(()=>window,"popstate",i)}function useTeleport(){var i=ref(!1);return onActivated(()=>{i.value=!1}),onDeactivated(()=>{i.value=!0}),{disabled:i}}function createNamespace(i){var e="var",t=e+"-"+i,r=o=>o?o[0]==="$"?o.replace("$",e):o.startsWith("--")?""+t+o:t+"__"+o:t,s=function(){for(var o=arguments.length,a=new Array(o),l=0;l{if(isArray$2(c)){var[u,m,d=null]=c;return u?m:d}return c})};return{name:bigCamelize(t),n:r,classes:s}}function call(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;rs(...t));if(i)return i(...t)}function defineListenerProp(i){return{type:[Function,Array],default:i}}function formatElevation(i,e){return i===!1?null:(i===!0&&e&&(i=e),"var-elevation--"+i)}function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(i){for(var e=1;e{e.tasker=null;var{x:r,y:s,centerX:o,centerY:a,size:l}=computeRippleStyles(this,i),c=document.createElement("div");c.classList.add(n$9()),c.style.opacity="0",c.style.transform="translate("+r+"px, "+s+"px) scale3d(.3, .3, .3)",c.style.width=l+"px",c.style.height=l+"px",e.color&&(c.style.backgroundColor=e.color),c.dataset.createdAt=String(performance.now()),setStyles(this),this.appendChild(c),window.setTimeout(()=>{c.style.transform="translate("+o+"px, "+a+"px) scale3d(1, 1, 1)",c.style.opacity=".25"},20)};e.tasker=window.setTimeout(t,30)}}function removeRipple(){var i=this._ripple,e=()=>{var t=this.querySelectorAll("."+n$9());if(t.length){var r=t[t.length-1],s=ANIMATION_DURATION-performance.now()+Number(r.dataset.createdAt);window.setTimeout(()=>{r.style.opacity="0",window.setTimeout(()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)},ANIMATION_DURATION)},s)}};i.tasker?window.setTimeout(e,30):e()}function forbidRippleTask(){if(!(!supportTouch()||!Context.enableRipple)){var i=this._ripple;i.tasker&&window.clearTimeout(i.tasker),i.tasker=null}}function mounted$1(i,e){var t;i._ripple=_extends$4({tasker:null},(t=e.value)!=null?t:{},{removeRipple:removeRipple.bind(i)}),i.addEventListener("touchstart",createRipple,{passive:!0}),i.addEventListener("touchmove",forbidRippleTask,{passive:!0}),i.addEventListener("dragstart",removeRipple,{passive:!0}),document.addEventListener("touchend",i._ripple.removeRipple,{passive:!0}),document.addEventListener("touchcancel",i._ripple.removeRipple,{passive:!0})}function unmounted$1(i){i.removeEventListener("touchstart",createRipple),i.removeEventListener("touchmove",forbidRippleTask),i.removeEventListener("dragstart",removeRipple),document.removeEventListener("touchend",i._ripple.removeRipple),document.removeEventListener("touchcancel",i._ripple.removeRipple)}function updated$1(i,e){var t,r,s,o,a={color:(t=e.value)==null?void 0:t.color,disabled:(r=e.value)==null?void 0:r.disabled},l=a.color!==((s=i._ripple)==null?void 0:s.color)||a.disabled!==((o=i._ripple)==null?void 0:o.disabled);if(l){var c,u;i._ripple=_extends$4({tasker:a.disabled?null:(c=i._ripple)==null?void 0:c.tasker,removeRipple:(u=i._ripple)==null?void 0:u.removeRipple},a)}}var Ripple={mounted:mounted$1,unmounted:unmounted$1,updated:updated$1,install(i){i.directive("ripple",this)}};const Ripple$1=Ripple;function resolveLock(){var i=Object.keys(Context.locks).length;i<=0?document.body.classList.remove("var--lock"):document.body.classList.add("var--lock")}function addLock(i){Context.locks[i]=1,resolveLock()}function releaseLock(i){delete Context.locks[i],resolveLock()}function useLock(i,e){var{uid:t}=getCurrentInstance();e&&watch(e,r=>{r===!1?releaseLock(t):r===!0&&i()===!0&&addLock(t)}),watch(i,r=>{e&&e()===!1||(r===!0?addLock(t):releaseLock(t))}),onBeforeMount(()=>{e&&e()===!1||i()===!0&&addLock(t)}),onUnmounted(()=>{e&&e()===!1||i()===!0&&releaseLock(t)}),onActivated(()=>{e&&e()===!1||i()===!0&&addLock(t)}),onDeactivated(()=>{e&&e()===!1||i()===!0&&releaseLock(t)})}function useZIndex(i,e){var t=ref(Context.zIndex);return watch(i,r=>{r&&(Context.zIndex+=e,t.value=Context.zIndex)},{immediate:!0}),{zIndex:t}}var props$8={name:String,size:[Number,String],color:String,namespace:{type:String,default:"var-icon"},transition:{type:[Number,String],default:0},animationClass:String,onClick:defineListenerProp()};function getViewportSize(){var{width:i,height:e}=getRect(window);return{vw:i,vh:e,vMin:Math.min(i,e),vMax:Math.max(i,e)}}var isRem=i=>isString(i)&&i.endsWith("rem"),isEm=i=>isString(i)&&i.endsWith("em")&&!i.endsWith("rem"),isPx=i=>isString(i)&&i.endsWith("px")||isNumber(i),isPercent=i=>isString(i)&&i.endsWith("%"),isVw=i=>isString(i)&&i.endsWith("vw"),isVh=i=>isString(i)&&i.endsWith("vh"),isVMin=i=>isString(i)&&i.endsWith("vmin"),isVMax=i=>isString(i)&&i.endsWith("vmax"),isCalc=i=>isString(i)&&i.startsWith("calc("),isVar=i=>isString(i)&&i.startsWith("var("),toPxNum=i=>{if(isNumber(i))return i;if(isPx(i))return+i.replace("px","");if(!inBrowser())return 0;var{vw:e,vh:t,vMin:r,vMax:s}=getViewportSize();if(isVw(i))return+i.replace("vw","")*e/100;if(isVh(i))return+i.replace("vh","")*t/100;if(isVMin(i))return+i.replace("vmin","")*r/100;if(isVMax(i))return+i.replace("vmax","")*s/100;if(isRem(i)){var o=+i.replace("rem",""),a=getStyle$1(document.documentElement).fontSize;return o*parseFloat(a)}return isString(i)?toNumber(i):0},toSizeUnit=i=>{if(i!=null)return isPercent(i)||isVw(i)||isVh(i)||isEm(i)||isRem(i)||isCalc(i)||isVar(i)||isVMin(i)||isVMax(i)?i:toPxNum(i)+"px"},multiplySizeUnit=function(i,e){if(e===void 0&&(e=1),i!=null){var t=toSizeUnit(i),r=t.match(/(vh|%|r?em|px|vw|vmin|vmax)$/)[0];return""+parseFloat(t)*e+r}};function asyncGeneratorStep(i,e,t,r,s,o,a){try{var l=i[o](a),c=l.value}catch(u){t(u);return}l.done?e(c):Promise.resolve(c).then(r,s)}function _asyncToGenerator(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var o=i.apply(e,t);function a(c){asyncGeneratorStep(o,r,s,a,l,"next",c)}function l(c){asyncGeneratorStep(o,r,s,a,l,"throw",c)}a(void 0)})}}var{name:name$7,n:n$8,classes:classes$6}=createNamespace("icon");function __render__$8(i,e){return openBlock(),createBlock(resolveDynamicComponent(i.isURL(i.name)?"img":"i"),{class:normalizeClass(i.classes(i.n(),[i.namespace!==i.n(),i.namespace],i.namespace+"--set",[i.isURL(i.name),i.n("image"),i.namespace+"-"+i.nextName],[i.animateInProgress,i.animationClass==null?i.n("--shrinking"):i.animationClass])),style:normalizeStyle({color:i.color,"transition-duration":i.toNumber(i.transition)+"ms",width:i.isURL(i.name)?i.toSizeUnit(i.size):null,height:i.isURL(i.name)?i.toSizeUnit(i.size):null,fontSize:i.toSizeUnit(i.size)}),src:i.isURL(i.name)?i.nextName:null,onClick:i.onClick},null,8,["class","style","src","onClick"])}var __sfc__$8=defineComponent({name:name$7,props:props$8,setup(i){var e=ref(""),t=ref(!1);watch(()=>i.name,r,{immediate:!0});function r(o,a){return s.apply(this,arguments)}function s(){return s=_asyncToGenerator(function*(o,a){var{transition:l}=i;if(a==null||toNumber(l)===0){e.value=o;return}t.value=!0,yield nextTick(),setTimeout(()=>{a!=null&&(e.value=o),t.value=!1},toNumber(l))}),s.apply(this,arguments)}return{nextName:e,animateInProgress:t,n:n$8,classes:classes$6,isURL,toNumber,toSizeUnit}}});__sfc__$8.render=__render__$8;const Icon=__sfc__$8;withInstall(Icon);var props$7={type:{type:String,default:"circle"},radius:[String,Number],size:{type:String,default:"normal"},color:String,description:String,loading:Boolean},{name:name$6,n:n$7,classes:classes$5}=createNamespace("loading"),_withScopeId$1=i=>(pushScopeId(""),i=i(),popScopeId(),i),_hoisted_1$4=_withScopeId$1(()=>createBaseVNode("svg",{viewBox:"25 25 50 50"},[createBaseVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"})],-1)),_hoisted_2$2=[_hoisted_1$4];function __render__$7(i,e){return openBlock(),createElementBlock("div",{class:normalizeClass(i.n())},[i.$slots.default?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.classes(i.n("content"),[i.loading,i.n("content--active")]))},[renderSlot(i.$slots,"default"),i.loading?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.n("content-mask"))},null,2)):createCommentVNode("v-if",!0)],2)):createCommentVNode("v-if",!0),i.isShow?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(i.classes(i.n("$--box"),i.n("body"),[i.$slots.default,i.n("inside")]))},[i.type==="circle"?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.n("circle"))},[createBaseVNode("span",{class:normalizeClass(i.classes(i.n("circle-block"),i.n("circle-block--"+i.size))),style:normalizeStyle({width:i.multiplySizeUnit(i.radius,2),height:i.multiplySizeUnit(i.radius,2),color:i.color})},_hoisted_2$2,6)],2)):createCommentVNode("v-if",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(i.loadingTypeDict,(t,r)=>(openBlock(),createElementBlock(Fragment,{key:r},[i.type===r?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.classes(i.n(r),i.n(r+"--"+i.size)))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(t,s=>(openBlock(),createElementBlock("div",{key:s+r,style:normalizeStyle({backgroundColor:i.color}),class:normalizeClass(i.classes(i.n(r+"-item"),i.n(r+"-item--"+i.size)))},null,6))),128))],2)):createCommentVNode("v-if",!0)],64))),128)),i.$slots.description||i.description?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(i.classes(i.n("description"),i.n("description--"+i.size))),style:normalizeStyle({color:i.color})},[renderSlot(i.$slots,"description",{},()=>[createTextVNode(toDisplayString(i.description),1)])],6)):createCommentVNode("v-if",!0)],2)):createCommentVNode("v-if",!0)],2)}var __sfc__$7=defineComponent({name:name$6,props:props$7,setup(i,e){var{slots:t}=e,r=computed(()=>call(t.default)?i.loading:!0),s={wave:5,cube:4,rect:8,disappear:3};return{loadingTypeDict:s,isShow:r,n:n$7,classes:classes$5,multiplySizeUnit}}});__sfc__$7.render=__render__$7;const Loading=__sfc__$7;withInstall(Loading);var props$6={hovering:{type:Boolean,default:!0}},{name:name$5,n:n$6,classes:classes$4}=createNamespace("hover-overlay");function __render__$6(i,e){return openBlock(),createElementBlock("div",{class:normalizeClass(i.classes(i.n(),[i.hovering,i.n("--hovering")]))},null,2)}var __sfc__$6=defineComponent({name:name$5,props:props$6,setup:()=>({n:n$6,classes:classes$4})});__sfc__$6.render=__render__$6;const HoverOverlay=__sfc__$6;withInstall(HoverOverlay);function useHoverOverlay(){var i=ref(!1),e=t=>{i.value=t};return{hovering:i,handleHovering:e}}function shouldDisabled(i){if(!i)return!1;var e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);return!!(i==="desktop"&&e||i==="mobile"&&!e)}function getStyle(i){var e=i.getAttribute("style");return e?e.split(";").filter(Boolean).reduce((t,r)=>{var[s,o]=r.split(":").map(a=>a.trim());return t[camelize(s)]=o,t},{}):{}}function updateRawStyle(i){var{value:e}=i._hover,t=getStyle(i);Object.keys(e).forEach(r=>{var s=camelize(r),o=e[s];o!=null&&t[s]&&(i._hover.rawStyle[s]=t[s])})}function updateStyle(i,e){Object.keys(e).forEach(t=>{var r=e[t];r!=null&&(i.style[t]=r)})}function clearStyle(i){Object.keys(i._hover.value).forEach(e=>{var t=i._hover.value[e];t!=null&&(i.style[e]="")})}function restoreStyle(i){clearStyle(i),updateStyle(i,i._hover.rawStyle)}function createHover(){var{value:i}=this._hover;if(this._hover.hovering=!0,isFunction$2(i)){i(this._hover.hovering);return}updateStyle(this,i)}function removeHover(){if(this._hover.hovering=!1,isFunction$2(this._hover.value)){this._hover.value(this._hover.hovering);return}restoreStyle(this)}function mounted(i,e){var t,r,{arg:s,value:o}=e;shouldDisabled(s)||(i._hover={value:o,hovering:(t=(r=i._hover)==null?void 0:r.hovering)!=null?t:!1,rawStyle:{}},updateRawStyle(i),i.addEventListener("mouseenter",createHover),i.addEventListener("mouseleave",removeHover))}function unmounted(i,e){shouldDisabled(e.arg)||(restoreStyle(i),i.removeEventListener("mouseenter",createHover),i.removeEventListener("mouseleave",removeHover))}function beforeUpdate(i,e){i._hover&&unmounted(i,e)}function shouldUpdateStyle(i,e){return!isFunction$2(e.value)&&i._hover.hovering}function updated(i,e){mounted(i,e),shouldUpdateStyle(i,e)&&updateStyle(i,e.value)}var Hover={mounted,unmounted,beforeUpdate,updated,install(i){i.directive("hover",this)}};const Hover$1=Hover;function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(i){for(var e=1;e{if(!t)return{elevation:formatElevation(i.elevation,2),type:i.type!=null?i.type:"default",size:i.size!=null?i.size:"normal",color:i.color,text:i.text,textColor:i.textColor,outline:i.outline};var{type:u,size:m,color:d,textColor:y,mode:b}=t;return{elevation:"",type:i.type!=null?i.type:u.value,size:i.size!=null?i.size:m.value,color:i.color!=null?i.color:d.value,textColor:i.textColor!=null?i.textColor:y.value,text:b.value!=="normal",outline:b.value==="outline"}});function a(u){i.autoLoading&&(e.value=!0,u=isArray$2(u)?u:[u],Promise.all(u).then(()=>{e.value=!1}).catch(()=>{e.value=!1}))}function l(u){var{loading:m,disabled:d,onClick:y}=i;!y||m||d||e.value||a(call(y,u))}function c(u){var{loading:m,disabled:d,onTouchstart:y}=i;!y||m||d||e.value||a(call(y,u))}return{pending:e,states:o,hovering:r,n:n$5,classes:classes$3,handleHovering:s,handleClick:l,handleTouchstart:c}}});__sfc__$5.render=__render__$5;const Button=__sfc__$5;withInstall(Button);var props$4={type:{type:String,default:"default"},size:{type:String,default:"normal"},color:String,textColor:String,mode:{type:String,default:"normal"},elevation:{type:[Boolean,Number,String],default:!0},vertical:Boolean},{name:name$3,n:n$4,classes:classes$2}=createNamespace("button-group");function __render__$4(i,e){return openBlock(),createElementBlock("div",{class:normalizeClass(i.classes(i.n(),i.n("$--box"),[i.mode,""+i.n("--mode-"+i.mode)],[i.vertical,i.n("--vertical"),i.n("--horizontal")],[i.mode==="normal",i.formatElevation(i.elevation,2)]))},[renderSlot(i.$slots,"default")],2)}var __sfc__$4=defineComponent({name:name$3,props:props$4,setup(i){var{bindButtons:e}=useButtons(),t={elevation:computed(()=>i.elevation),type:computed(()=>i.type),size:computed(()=>i.size),color:computed(()=>i.color),textColor:computed(()=>i.textColor),mode:computed(()=>i.mode)};return e(t),{n:n$4,classes:classes$2,formatElevation}}});__sfc__$4.render=__render__$4;const ButtonGroup=__sfc__$4;withInstall(ButtonGroup);var props$3={errorMessage:{type:String,default:""},extraMessage:{type:String,default:""}},{name:name$2,n:n$3}=createNamespace("form-details"),_hoisted_1$2={key:0},_hoisted_2$1={key:0};function __render__$3(i,e){return openBlock(),createBlock(Transition,{name:i.n()},{default:withCtx(()=>[i.errorMessage||i.extraMessage||i.$slots["extra-message"]?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(i.n())},[createBaseVNode("div",{class:normalizeClass(i.n("error-message"))},[createVNode(Transition,{name:i.n("message")},{default:withCtx(()=>[i.errorMessage?(openBlock(),createElementBlock("div",_hoisted_1$2,toDisplayString(i.errorMessage),1)):createCommentVNode("v-if",!0)]),_:1},8,["name"])],2),createBaseVNode("div",{class:normalizeClass(i.n("extra-message"))},[createVNode(Transition,{name:i.n("message")},{default:withCtx(()=>[renderSlot(i.$slots,"extra-message",{},()=>[i.extraMessage?(openBlock(),createElementBlock("div",_hoisted_2$1,toDisplayString(i.extraMessage),1)):createCommentVNode("v-if",!0)])]),_:3},8,["name"])],2)],2)):createCommentVNode("v-if",!0)]),_:3},8,["name"])}var __sfc__$3=defineComponent({name:name$2,props:props$3,setup:()=>({n:n$3})});__sfc__$3.render=__render__$3;const FormDetails=__sfc__$3;withInstall(FormDetails);function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(i){for(var e=1;e{t(_extends$2({},o,{instance:r}))}:null;return{index:e,form:i,bindForm:s}}function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(i){for(var e=1;e[createTextVNode(toDisplayString(i.content),1)])],2),createBaseVNode("div",{class:normalizeClass([i.n("icon")])},[i.iconName?(openBlock(),createBlock(t,{key:0,name:i.iconName},null,8,["name"])):createCommentVNode("v-if",!0),i.type==="loading"?(openBlock(),createBlock(r,{key:1,type:i.loadingType,size:i.loadingSize,color:i.loadingColor,radius:i.loadingRadius},null,8,["type","size","color","radius"])):createCommentVNode("v-if",!0),renderSlot(i.$slots,"icon")],2),createBaseVNode("div",{class:normalizeClass(i.n("action"))},[renderSlot(i.$slots,"action")],2)],6)],6)),[[vShow,i.show]])}var __sfc__$2=defineComponent({name:"VarSnackbarCore",components:{VarLoading:Loading,VarIcon:Icon},props:props$2,setup(i){var e=ref(null),{zIndex:t}=useZIndex(()=>i.show,1);useLock(()=>i.show,()=>i.lockScroll);var r=computed(()=>i.type==="loading"||i.forbidClick),s=computed(()=>i.type?ICON_TYPE_DICT[i.type]:""),o=()=>{e.value=setTimeout(()=>{i.type!=="loading"&&call(i["onUpdate:show"],!1)},i.duration)};return watch(()=>i.show,a=>{a?(call(i.onOpen),o()):a===!1&&(clearTimeout(e.value),call(i.onClose))}),watch(()=>i._update,()=>{clearTimeout(e.value),o()}),onSmartMounted(()=>{i.show&&(call(i.onOpen),o())}),{SNACKBAR_TYPE,n:n$2,classes:classes$1,zIndex:t,iconName:s,isForbidClick:r}}});__sfc__$2.render=__render__$2;const VarSnackbarCore=__sfc__$2;var{name:name$1,n:n$1}=createNamespace("snackbar");function __render__$1(i,e){var t=resolveComponent("var-snackbar-core");return openBlock(),createBlock(Teleport,{to:i.teleport===!1?void 0:i.teleport,disabled:i.disabled||i.teleport===!1},[createVNode(Transition,{name:i.n()+"-fade",onAfterEnter:i.onOpened,onAfterLeave:i.onClosed},{default:withCtx(()=>[createVNode(t,mergeProps(i.$props,{class:i.n("transition")}),{icon:withCtx(()=>[renderSlot(i.$slots,"icon")]),action:withCtx(()=>[renderSlot(i.$slots,"action")]),default:withCtx(()=>[renderSlot(i.$slots,"default",{},()=>[createTextVNode(toDisplayString(i.content),1)])]),_:3},16,["class"])]),_:3},8,["name","onAfterEnter","onAfterLeave"])],8,["to","disabled"])}var __sfc__$1=defineComponent({name:name$1,components:{VarSnackbarCore},props:props$2,setup(){var{disabled:i}=useTeleport();return{disabled:i,n:n$1}}});__sfc__$1.render=__render__$1;const VarSnackbar=__sfc__$1;function _extends(){return _extends=Object.assign?Object.assign.bind():function(i){for(var e=1;e{},onOpened:()=>{},onClose:()=>{},onClosed:()=>{}},uniqSnackbarOptions=reactive([]),defaultOptions=defaultOptionsValue,transitionGroupProps={name:"var-snackbar-fade",tag:"div",class:"var-transition-group"},getSlotValue=i=>()=>isFunction$2(i)?i():i,TransitionGroupHost={setup(){return()=>{var i=uniqSnackbarOptions.map(e=>{var{id:t,reactiveSnackOptions:r,_update:s}=e,o=document.querySelector(".var-transition-group");r.forbidClick||r.type==="loading"?o.classList.add("var-pointer-auto"):o.classList.remove("var-pointer-auto"),isAllowMultiple&&(r.position="top");var a=isAllowMultiple?"relative":"absolute",l=_extends({position:a},getTop(r.position)),{content:c,icon:u,action:m}=r,d={default:getSlotValue(c),icon:getSlotValue(u),action:getSlotValue(m)};return createVNode(VarSnackbarCore,mergeProps(r,{key:t,style:l,"data-id":t,_update:s,show:r.show,"onUpdate:show":y=>r.show=y}),d)});return createVNode(TransitionGroup,mergeProps(transitionGroupProps,{style:{zIndex:Context.zIndex},onAfterEnter:opened,onAfterLeave:removeUniqOption}),_isSlot(i)?i:{default:()=>[i]})}}},Snackbar=function(i){var e=normalizeOptions(i),t=reactive(_extends({},defaultOptions,e));t.show=!0,isMount||(isMount=!0,unmount=mountInstance(TransitionGroupHost).unmountInstance);var{length:r}=uniqSnackbarOptions,s={id:sid++,reactiveSnackOptions:t};if(r===0||isAllowMultiple)addUniqOption(s);else{var o="update-"+sid;updateUniqOption(t,o)}return{clear(){!isAllowMultiple&&uniqSnackbarOptions.length?uniqSnackbarOptions[0].reactiveSnackOptions.show=!1:t.show=!1}}};SNACKBAR_TYPE.forEach(i=>{Snackbar[i]=e=>(isPlainObject(e)?e.type=i:e={content:e,type:i},Snackbar(e))});Snackbar.allowMultiple=function(i){i===void 0&&(i=!1),i!==isAllowMultiple&&(uniqSnackbarOptions.forEach(e=>{e.reactiveSnackOptions.show=!1}),isAllowMultiple=i)};Snackbar.clear=function(){uniqSnackbarOptions.forEach(i=>{i.reactiveSnackOptions.show=!1})};Snackbar.setDefaultOptions=function(i){defaultOptions=i};Snackbar.resetDefaultOptions=function(){defaultOptions=defaultOptionsValue};function opened(i){var e=i.getAttribute("data-id"),t=uniqSnackbarOptions.find(r=>r.id===toNumber(e));t&&call(t.reactiveSnackOptions.onOpened)}function removeUniqOption(i){i.parentElement&&i.parentElement.classList.remove("var-pointer-auto");var e=i.getAttribute("data-id"),t=uniqSnackbarOptions.find(s=>s.id===toNumber(e));t&&(t.animationEnd=!0,call(t.reactiveSnackOptions.onClosed));var r=uniqSnackbarOptions.every(s=>s.animationEnd);r&&(call(unmount),uniqSnackbarOptions=reactive([]),isMount=!1)}function addUniqOption(i){uniqSnackbarOptions.push(i)}function normalizeOptions(i){return i===void 0&&(i={}),isString(i)?{content:i}:i}function updateUniqOption(i,e){var[t]=uniqSnackbarOptions;t.reactiveSnackOptions=_extends({},t.reactiveSnackOptions,i),t._update=e}function getTop(i){return i===void 0&&(i="top"),i==="bottom"?{[i]:"5%"}:{top:i==="top"?"5%":"45%"}}Snackbar.Component=VarSnackbar;withInstall(VarSnackbar);withInstall(VarSnackbar,Snackbar);const Snackbar$1=Snackbar;var props$1={modelValue:{default:!1},activeValue:{default:!0},inactiveValue:{default:!1},disabled:Boolean,readonly:Boolean,loading:Boolean,color:String,loadingColor:String,closeColor:String,size:[String,Number],rules:Array,ripple:{type:Boolean,default:!0},onClick:defineListenerProp(),onChange:defineListenerProp(),"onUpdate:modelValue":defineListenerProp()},{name,n,classes}=createNamespace("switch"),_withScopeId=i=>(pushScopeId(""),i=i(),popScopeId(),i),_hoisted_1$1=_withScopeId(()=>createBaseVNode("svg",{viewBox:"25 25 50 50"},[createBaseVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"})],-1)),_hoisted_2=[_hoisted_1$1];function __render__(i,e){var t=resolveComponent("var-hover-overlay"),r=resolveComponent("var-form-details"),s=resolveDirective("ripple"),o=resolveDirective("hover");return withDirectives((openBlock(),createElementBlock("div",{class:normalizeClass(i.n())},[createBaseVNode("div",{class:normalizeClass(i.classes(i.n("block"),[i.disabled||i.formDisabled,i.n("--disabled")])),onClick:e[0]||(e[0]=function(){return i.switchActive&&i.switchActive(...arguments)}),style:normalizeStyle(i.styleComputed.switch)},[createBaseVNode("div",{style:normalizeStyle(i.styleComputed.track),class:normalizeClass(i.classes(i.n("track"),[i.modelValue===i.activeValue,i.n("track--active")],[i.errorMessage,i.n("track--error")]))},null,6),withDirectives((openBlock(),createElementBlock("div",{class:normalizeClass(i.classes(i.n("ripple"),[i.modelValue===i.activeValue,i.n("ripple--active")])),style:normalizeStyle(i.styleComputed.ripple)},[createBaseVNode("div",{style:normalizeStyle(i.styleComputed.handle),class:normalizeClass(i.classes(i.n("handle"),i.n("$-elevation--2"),[i.modelValue===i.activeValue,i.n("handle--active")],[i.errorMessage,i.n("handle--error")]))},[i.loading?(openBlock(),createElementBlock("span",{key:0,class:normalizeClass(i.n("loading")),style:normalizeStyle({width:i.radius,height:i.radius})},_hoisted_2,6)):createCommentVNode("v-if",!0)],6),createVNode(t,{hovering:i.hovering},null,8,["hovering"])],6)),[[s,{disabled:!i.ripple||i.disabled||i.loading||i.formDisabled}]])],6),createVNode(r,{"error-message":i.errorMessage},null,8,["error-message"])],2)),[[o,i.hover,"desktop"]])}var __sfc__=defineComponent({name,components:{VarFormDetails:FormDetails,VarHoverOverlay:HoverOverlay},directives:{Ripple:Ripple$1,Hover:Hover$1},props:props$1,setup(i){var{bindForm:e,form:t}=useForm(),{errorMessage:r,validateWithTrigger:s,validate:o,resetValidation:a}=useValidation(),{hovering:l,handleHovering:c}=useHoverOverlay(),u=computed(()=>{var{size:x,modelValue:E,color:_,closeColor:T,loadingColor:C,activeValue:R}=i;return{handle:{width:multiplySizeUnit(x),height:multiplySizeUnit(x),backgroundColor:E===R?_:T,color:C},ripple:{left:E===R?multiplySizeUnit(x,.5):"-"+multiplySizeUnit(x,.5),color:E===R?_:T||"#999",width:multiplySizeUnit(x,2),height:multiplySizeUnit(x,2)},track:{height:multiplySizeUnit(x,.72),width:multiplySizeUnit(x,1.9),borderRadius:multiplySizeUnit(x,2/3),filter:E===R||r!=null&&r.value?void 0:"brightness(.6)",backgroundColor:E===R?_:T},switch:{height:multiplySizeUnit(x,1.2),width:multiplySizeUnit(x,2)}}}),m=computed(()=>multiplySizeUnit(i.size,.8)),d={reset:P,validate:y,resetValidation:a};call(e,d);function y(){return o(i.rules,i.modelValue)}function b(){return nextTick(()=>s(["onChange"],"onChange",i.rules,i.modelValue))}function S(x){var{onClick:E,onChange:_,disabled:T,loading:C,readonly:R,modelValue:I,activeValue:M,inactiveValue:D,"onUpdate:modelValue":H}=i;if(call(E,x),!(T||C||R||t!=null&&t.disabled.value||t!=null&&t.readonly.value)){var W=I===M?D:M;call(_,W),call(H,W),b()}}function A(x){i.disabled||t!=null&&t.disabled.value||c(x)}function P(){call(i["onUpdate:modelValue"],i.inactiveValue),a()}return{hovering:l,radius:m,styleComputed:u,errorMessage:r,formDisabled:t==null?void 0:t.disabled,formReadonly:t==null?void 0:t.readonly,n,classes,multiplySizeUnit,switchActive:S,hover:A}}});__sfc__.render=__render__;const Switch=__sfc__;withInstall(Switch);const Image1=""+new URL("5-d8bfbf51.png",import.meta.url).href,Image2=""+new URL("4-cfa387c7.png",import.meta.url).href,Image3=""+new URL("3-d02c685a.png",import.meta.url).href,Image4=""+new URL("2-5c4c2ef5.png",import.meta.url).href,Image5=""+new URL("1-a0d5037d.png",import.meta.url).href,clx1=""+new URL("clx5-b3331931.svg",import.meta.url).href,clx2=""+new URL("clx4-7a8a1657.svg",import.meta.url).href,clx3=""+new URL("clx3-82262a8a.svg",import.meta.url).href,clx4=""+new URL("clx2-99f2ced3.svg",import.meta.url).href,clx5=""+new URL("clx1-3d063166.svg",import.meta.url).href,good="data:image/png;base64,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",bad="data:image/png;base64,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",perfect="data:image/png;base64,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",great="data:image/png;base64,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",scoreIcon={good,bad,perfect,great},leveByScoreMeasureIcons=[{icon:scoreIcon.bad,text:"bad",color:"#EE4C6A"},{icon:scoreIcon.good,text:"good",color:"#FF958B"},{icon:scoreIcon.great,text:"great",color:"#FF8E5A"},{icon:scoreIcon.perfect,text:"perfect",color:"#516AFF"}],icons=[{img:Image1,tips:"你的演奏不太好,再练一练吧~",mome:"敢于尝试",clxImg:clx1,clxtip:"你的演奏不太好,音准和完整性还需加强,再练一练吧~",clxmome:"敢于尝试"},{img:Image2,tips:"你的演奏还不熟练,加紧训练才能有好成绩哦~",mome:"还要加油哦~",clxImg:clx2,clxtip:"你的演奏还不熟练,音准和完整性还需加强,加紧训练才能有好成绩哦~",clxmome:"还要加油哦~"},{img:Image3,tips:"你的演奏还不流畅,科学的练习才能更完美哦~",mome:"突破自我",clxImg:clx3,clxtip:"你的演奏还不流畅,音准和节奏还需加强,科学的练习才能更完美哦~",clxmome:"突破自我"},{img:Image4,tips:"你的演奏还不错,继续加油吧,离完美就差一步啦~",mome:"崭露头角",clxImg:clx4,clxtip:"你的演奏还不错,继续加油吧,加强音准,离完美就差一步啦~",clxmome:"崭露头角"},{img:Image5,tips:"你的演奏完美无缺,继续努力吧~",mome:"你很棒",clxImg:clx5,clxtip:"你的演奏非常不错,音准的把握和节奏稍有瑕疵,完整性把握的很好~",clxmome:"你很棒"}],getLeveByScore=i=>{if(!i&&typeof i!="number")return{};let e=0;return i>20&&i<=40?e=1:i>40&&i<=60?e=2:i>60&&i<=80?e=3:i>80&&(e=4),{...icons[e],leve:e}},getLeveByScoreMeasure=i=>{if(!i&&typeof i!="number")return{};let e=0;return i>=40&&i<70?e=1:i>=70&&i<90?e=2:i>=90&&(e=3),e},audioList="_audioList_1j0z3_1",styles$5={audioList};let timer=null;const midiData=reactive({iframeRef:null,playing:!1,index:0,rate:1}),playNote=()=>{var t,r;if(!midiData.playing)return;const i=state$1.times[midiData.index];if(!i)return;midiData.index++;const e=i.endtime-i.time;(r=(t=midiData.iframeRef)==null?void 0:t.contentWindow)==null||r.playNote(i.realKey,e),timer=setTimeout(()=>{playNote()},e/midiData.rate*1e3)},hanldeInitMidiData=i=>{midiData.iframeRef=i},hanldeSetMidiPlaybackRate=i=>{midiData.rate=i},setMidiCurrentTime=i=>{clearTimeout(timer),midiData.index=i,playNote()},initMidi=(i,e)=>{const t=ref(!1);if(e){console.log("曲谱为midi,使用app播放"),t.value=!0,state$1.midiPlayIniting=!0;const r=getDuration(state$1.osmd);api_cloudDestroy(),api_cloudDetail({midi:e,denominator:r.denominator,numerator:r.numerator,originalSpeed:state$1.originSpeed,interval:50,duration:i*1e3},()=>{state$1.midiPlayIniting=!1,t.value=!1,e&&changeMode("music")}),state$1.durationNum=i}return{initial:t}},getActiveMidiId=()=>{var i,e,t,r,s,o,a;return(a=(o=(s=(r=(t=(e=(i=state$1.osmd)==null?void 0:i.sheet)==null?void 0:e.instruments)==null?void 0:t[0])==null?void 0:r.subInstruments)==null?void 0:s[0])==null?void 0:o.midiInstrumentID)!=null?a:0},changeMode=async(i,e)=>{var r,s,o,a;const t=i==="background"?"music":"background";if(console.log(!state$1.songs[i],i,t),state$1.isAppPlay){const l=new Map;for(const c of state$1.partListNames)l.set(c,60);api_cloudVolume({activeMidiId:getActiveMidiId(),activeMidiVolume:t==="background"?100:0,parts:Array.from(l.keys()).map(c=>({name:c,volume:l.get(c)}))})}state$1.playSource=i,e==="all"?((r=state$1.audiosInstance)==null||r.setMute(!0,state$1.songs[t]),(s=state$1.audiosInstance)==null||s.setMute(!0,state$1.songs[i])):((o=state$1.audiosInstance)==null||o.setMute(!0,state$1.songs[t]),(a=state$1.audiosInstance)==null||a.setMute(!1,state$1.songs[i]))},cloudToggleState=async i=>{const e=await api_cloudGetMediaStatus(),t=e==null?void 0:e.content.status;if(t==="init"||t==="suspend"&&i==="paused")return;t==="suspend"?(state$1.isSelectMeasureMode&&(audioData$1.progress=state$1.midiSectionStart),await api_cloudPlay({songID:state$1.examSongId,startTime:audioData$1.progress*1e3,originalSpeed:state$1.originSpeed,speed:state$1.modeType==="evaluating"?state$1.originSpeed:state$1.speed,hertz:440}),onPlay()):(await api_cloudSuspend({songID:state$1.examSongId}),state$1.modeType==="evaluating"&&(audioData$1.progress=0));const r=await api_cloudGetMediaStatus();state$1.playState=(r==null?void 0:r.content.status)==="suspend"?"paused":"play",console.log(r,"cloudGetMediaStatused")},audioData$1=reactive({songEle:null,backgroundEle:null,midiRender:!1,progress:0,duration:0}),midiRef=ref(),audioListStart=i=>{var e,t,r,s;if(i==="play"&&state$1.originSpeed!==0&&setAudioPlaybackRate(state$1.speed/state$1.originSpeed),state$1.isAppPlay){cloudToggleState(i);return}i==="play"?((e=audioData$1.songEle)==null||e.play(),(t=audioData$1.backgroundEle)==null||t.play()):i==="paused"&&((r=audioData$1.songEle)==null||r.pause(),(s=audioData$1.backgroundEle)==null||s.pause())},setAudioPlaybackRate=i=>{if(state$1.isAppPlay){if(state$1.modeType==="evaluating")return;hanldeSetMidiPlaybackRate(i);return}audioData$1.songEle&&(audioData$1.songEle.playbackRate=i),audioData$1.backgroundEle&&(audioData$1.backgroundEle.playbackRate=i)},getAudioCurrentTime=()=>{var i,e,t;return state$1.isAppPlay?audioData$1.progress:state$1.playSource==="music"?((i=audioData$1.songEle)==null?void 0:i.currentTime)||audioData$1.progress:state$1.playSource==="background"?((e=audioData$1.backgroundEle)==null?void 0:e.currentTime)||audioData$1.progress:((t=audioData$1.songEle)==null?void 0:t.currentTime)||audioData$1.progress},getAudioDuration=()=>{var i,e,t;if(state$1.isAppPlay){const r=((i=state$1.times[state$1.times.length-1||0])==null?void 0:i.endtime)||0;return audioData$1.duration||r}return((e=audioData$1.songEle)==null?void 0:e.duration)||((t=audioData$1.backgroundEle)==null?void 0:t.duration)||audioData$1.duration},setAudioCurrentTime=(i,e=0)=>{if(state$1.isAppPlay){setMidiCurrentTime(e);return}audioData$1.songEle&&(audioData$1.songEle.currentTime=i),audioData$1.backgroundEle&&(audioData$1.backgroundEle.currentTime=i),audioData$1.progress=i},toggleMutePlayAudio=(i,e)=>{i==="music"?audioData$1.songEle&&(audioData$1.songEle.muted=e):i==="background"&&audioData$1.backgroundEle&&(audioData$1.backgroundEle.muted=e)},AudioList=defineComponent({name:"audio-list",setup(){const i=()=>{midiRef.value.contentWindow.handleRendered=()=>{audioData$1.midiRender=!0},hanldeInitMidiData(midiRef.value)};watch(()=>state$1.playSource,()=>{if(state$1.modeType==="evaluating"&&!state$1.setting.enableAccompaniment){console.log("评测模式设置了关闭伴奏,不切换原音伴奏");return}state$1.playSource==="music"?(audioData$1.songEle&&(audioData$1.songEle.muted=!1),audioData$1.backgroundEle&&(audioData$1.backgroundEle.muted=!0)):(audioData$1.songEle&&(audioData$1.songEle.muted=!0),audioData$1.backgroundEle&&(audioData$1.backgroundEle.muted=!1))});const e=o=>new Promise(a=>{const l=new Audio(o+"?v="+Date.now());l.load(),l.onloadedmetadata=()=>{a(l)},l.onerror=()=>{a(null)}}),t=o=>{var u,m,d;const a=(o==null?void 0:o.currentTime)||((u=o==null?void 0:o.content)==null?void 0:u.currentTime),l=(o==null?void 0:o.totalDuration)||((m=o==null?void 0:o.content)==null?void 0:m.totalDuration),c=a/1e3;if(audioData$1.progress=c,audioData$1.songEle&&(audioData$1.songEle.currentTime=c),audioData$1.backgroundEle&&(audioData$1.backgroundEle.currentTime=c),audioData$1.duration=l/1e3,((d=o==null?void 0:o.content)==null?void 0:d.totalDuration)>1e3&&a>=l){if(evaluatingData.isAudioPlayEnd)return;evaluatingData.isAudioPlayEnd=!0,onEnded()}},r=o=>{var c,u,m;if(audioData$1.duration==0){const d=((c=state$1.times[state$1.times.length-1||0])==null?void 0:c.endtime)||0;audioData$1.duration=d}const a=(o==null?void 0:o.currentTime)||((u=o==null?void 0:o.content)==null?void 0:u.currentTime);o!=null&&o.totalDuration||((m=o==null?void 0:o.content)==null||m.totalDuration);const l=a/1e3;audioData$1.progress=l,state$1.sectionStatus&&state$1.section.length==2&&a>=state$1.section},s=o=>{o&&(console.log("midi结束"),audioData$1.progress=0,onEnded())};return onMounted(()=>{var o;if(state$1.playMode!=="MIDI")Promise.all([e(state$1.music),e(state$1.accompany)]).then(([a,l])=>{a&&(audioData$1.songEle=a),l&&(audioData$1.backgroundEle=l),audioData$1.songEle?(audioData$1.songEle.addEventListener("play",onPlay),audioData$1.songEle.addEventListener("ended",onEnded),l&&(l.muted=!0)):audioData$1.backgroundEle&&(audioData$1.backgroundEle.addEventListener("play",onPlay),audioData$1.backgroundEle.addEventListener("ended",onEnded))}),api_playProgress(t);else{const a=((o=state$1.times[state$1.times.length-1||0])==null?void 0:o.endtime)||0;audioData$1.duration=a,api_cloudTimeUpdae(r),api_cloudplayed(s)}}),onUnmounted(()=>{api_remove_cloudplayed(s),api_remove_cloudTimeUpdae(r)}),()=>createVNode("div",{class:styles$5.audioList},[state$1.playMode==="MIDI"&&state$1.speed!=0&&createVNode("iframe",{style:{display:"none"},ref:midiRef,src:"/midi/index.html",onLoad:i},null)])}}),popup="_popup_1838h_1",dots="_dots_1838h_6",dot="_dot_1838h_6",active="_active_1838h_20",one="_one_1838h_23",styles$4={popup,dots,dot,active,one},browserInfo$2=browser(),tickData=reactive({list:[],len:0,tickEnd:!1,beatLengthInMilliseconds:0,state:"",source1:"",source2:"",index:0,show:!1}),handlePlay=(i,e)=>new Promise(t=>{setTimeout(()=>{if(tickData.tickEnd){t(i);return}if(tickData.index++,e){const r=state$1.setting.beatVolume/100;e.volume=r,e.volume<=0?e.muted=!0:e.muted=!1,e.play()}t(i)},tickData.beatLengthInMilliseconds)}),audioData=reactive({tick:null,tock:null}),createAudio=i=>new Promise(e=>{const t=new Audio(i+"?v="+Date.now());t.load(),t.onloadedmetadata=()=>{e(t)},t.onerror=()=>{e(null)}}),handleInitTick=(i,e)=>{tickData.state="",tickData.beatLengthInMilliseconds=i,tickData.len=e},handleStartTick=async()=>{tickData.show=!0,tickData.tickEnd=!1,tickData.state!=="ok"&&(tickData.source1=new howler.Howl({src:tockAndTick.tick,html5:browserInfo$2.ios}),tickData.source2=new howler.Howl({src:tockAndTick.tock}),tickData.state="ok"),tickData.index=0,tickData.beatLengthInMilliseconds=60/state$1.speed*1e3;for(let i=0;i<=tickData.len;i++){if(tickData.tickEnd)return!1;const e=i===0?audioData.tick:i===tickData.len?null:audioData.tock;await handlePlay(i,e)}return tickData.show=!1,!0},Tick=defineComponent({name:"metronome",setup(){const i=()=>{tickData.tickEnd=!0};return onMounted(()=>{Promise.all([createAudio(tickWav),createAudio(tockWav)]).then(([e,t])=>{e&&(audioData.tick=e),t&&(audioData.tock=t)})}),()=>createVNode(Popup,{class:styles$4.popup,show:tickData.show,"onUpdate:show":e=>tickData.show=e,closeable:!0,onClickCloseIcon:i},{default:()=>[createVNode("div",{class:styles$4.dots},[Array(tickData.len).fill(0).map((e,t)=>createVNode("div",{class:[styles$4.dot,tickData.index>t&&styles$4.active,tickData.index>t&&t===0&&styles$4.one]},null))])]})}}),fraction="_fraction_8vx8x_1",close="_close_8vx8x_11",bg="_bg_8vx8x_18",content="_content_8vx8x_21",title="_title_8vx8x_21",desc="_desc_8vx8x_29",btn="_btn_8vx8x_37",loadColumn="_loadColumn_8vx8x_42",loadIcon="_loadIcon_8vx8x_57",successIcon="_successIcon_8vx8x_61",styles$3={fraction,close,bg,content,title,desc,btn,loadColumn,loadIcon,successIcon};var lottie={exports:{}};(function(module,exports){typeof navigator<"u"&&function(i,e){module.exports=e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(i){return document.createElement(i)}function extendPrototype(i,e){var t,r=i.length,s;for(t=0;t1?t[1]=1:t[1]<=0&&(t[1]=0),HSVtoRGB(t[0],t[1],t[2])}function addBrightnessToRGB(i,e){var t=RGBtoHSV(i[0]*255,i[1]*255,i[2]*255);return t[2]+=e,t[2]>1?t[2]=1:t[2]<0&&(t[2]=0),HSVtoRGB(t[0],t[1],t[2])}function addHueToRGB(i,e){var t=RGBtoHSV(i[0]*255,i[1]*255,i[2]*255);return t[0]+=e/360,t[0]>1?t[0]-=1:t[0]<0&&(t[0]+=1),HSVtoRGB(t[0],t[1],t[2])}var rgbToHex=function(){var i=[],e,t;for(e=0;e<256;e+=1)t=e.toString(16),i[e]=t.length===1?"0"+t:t;return function(r,s,o){return r<0&&(r=0),s<0&&(s=0),o<0&&(o=0),"#"+i[r]+i[s]+i[o]}}(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(e){expressionsInterfaces=e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e};function createNS(i){return document.createElementNS(svgNS,i)}function _typeof$5(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(t){return typeof t}:_typeof$5=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$5(i)}var dataManager=function(){var i=1,e=[],t,r,s={onmessage:function(){},postMessage:function(b){t({data:b})}},o={postMessage:function(b){s.onmessage({data:b})}};function a(y){if(window.Worker&&window.Blob&&getWebWorker()){var b=new Blob(["var _workerSelf = self; self.onmessage = ",y.toString()],{type:"text/javascript"}),S=URL.createObjectURL(b);return new Worker(S)}return t=y,s}function l(){r||(r=a(function(b){function S(){function P($,F){var G,N,V=$.length,K,U,J,me;for(N=0;N=0;F-=1)if($[F].ty==="sh")if($[F].ks.k.i)C($[F].ks.k);else for(V=$[F].ks.k.length,N=0;NG[0]?!0:G[0]>$[0]?!1:$[1]>G[1]?!0:G[1]>$[1]?!1:$[2]>G[2]?!0:G[2]>$[2]?!1:null}var I=function(){var $=[4,4,14];function F(N){var V=N.t.d;N.t.d={k:[{s:V,t:0}]}}function G(N){var V,K=N.length;for(V=0;V=0;V-=1)if(N[V].ty==="sh")if(N[V].ks.k.i)N[V].ks.k.c=N[V].closed;else for(J=N[V].ks.k.length,U=0;U500)&&(this._imageLoaded(),clearInterval(_)),E+=1}).bind(this),50)}function o(x){var E=r(x,this.assetsPath,this.path),_=createNS("image");isSafari?this.testImageLoaded(_):_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",(function(){T.img=i,this._imageLoaded()}).bind(this),!1),_.setAttributeNS("http://www.w3.org/1999/xlink","href",E),this._elementHelper.append?this._elementHelper.append(_):this._elementHelper.appendChild(_);var T={img:_,assetData:x};return T}function a(x){var E=r(x,this.assetsPath,this.path),_=createTag("img");_.crossOrigin="anonymous",_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",(function(){T.img=i,this._imageLoaded()}).bind(this),!1),_.src=E;var T={img:_,assetData:x};return T}function l(x){var E={assetData:x},_=r(x,this.assetsPath,this.path);return dataManager.loadData(_,(function(T){E.img=T,this._footageLoaded()}).bind(this),(function(){E.img={},this._footageLoaded()}).bind(this)),E}function c(x,E){this.imagesLoadedCb=E;var _,T=x.length;for(_=0;_this.animationData.op&&(this.animationData.op=i.op,this.totalFrames=Math.floor(i.op-this.animationData.ip));var e=this.animationData.layers,t,r=e.length,s=i.layers,o,a=s.length;for(o=0;othis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(i){this.triggerRenderFrameError(i)}},AnimationItem.prototype.play=function(i){i&&this.name!==i||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(i){i&&this.name!==i||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(i){i&&this.name!==i||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(i){i&&this.name!==i||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(i){for(var e,t=0;t=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(t=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(t=!0,e=0)):this.setCurrentRawFrameValue(e),t&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(i,e){this.playCount=0,i[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=i[0]-i[1],this.timeCompleted=this.totalFrames,this.firstFrame=i[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):i[1]>i[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=i[1]-i[0],this.timeCompleted=this.totalFrames,this.firstFrame=i[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(i,e){var t=-1;this.isPaused&&(this.currentRawFrame+this.firstFramee&&(t=e-i)),this.firstFrame=i,this.totalFrames=e-i,this.timeCompleted=this.totalFrames,t!==-1&&this.goToAndStop(t,!0)},AnimationItem.prototype.playSegments=function(i,e){if(e&&(this.segments.length=0),_typeof$4(i[0])==="object"){var t,r=i.length;for(t=0;t=0;G-=1)e[G].animation.destroy(F)}function M(F,G,N){var V=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),K,U=V.length;for(K=0;K0?T=M:_=M;while(Math.abs(I)>o&&++D=s?P(_,W,T,C):O===0?W:A(_,I,I+c,T,C)}},i}(),pooling=function(){function i(e){return e.concat(createSizedArray(e.length))}return{double:i}}(),poolFactory=function(){return function(i,e,t){var r=0,s=i,o=createSizedArray(s),a={newElement:l,release:c};function l(){var u;return r?(r-=1,u=o[r]):u=e(),u}function c(u){r===s&&(o=pooling.double(o),s*=2),t&&t(u),o[r]=u,r+=1}return a}}(),bezierLengthPool=function(){function i(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,i)}(),segmentsLengthPool=function(){function i(){return{lengths:[],totalLength:0}}function e(t){var r,s=t.lengths.length;for(r=0;r-.001&&E<.001}function t(y,b,S,A,P,x,E,_,T){if(S===0&&x===0&&T===0)return e(y,b,A,P,E,_);var C=i.sqrt(i.pow(A-y,2)+i.pow(P-b,2)+i.pow(x-S,2)),R=i.sqrt(i.pow(E-y,2)+i.pow(_-b,2)+i.pow(T-S,2)),I=i.sqrt(i.pow(E-A,2)+i.pow(_-P,2)+i.pow(T-x,2)),M;return C>R?C>I?M=C-R-I:M=I-R-C:I>R?M=I-R-C:M=R-C-I,M>-1e-4&&M<1e-4}var r=function(){return function(y,b,S,A){var P=getDefaultCurveSegments(),x,E,_,T,C,R=0,I,M=[],D=[],H=bezierLengthPool.newElement();for(_=S.length,x=0;xE?-1:1,C=!0;C;)if(A[x]<=E&&A[x+1]>E?(_=(E-A[x])/(A[x+1]-A[x]),C=!1):x+=T,x<0||x>=P-1){if(x===P-1)return S[x];C=!1}return S[x]+(S[x+1]-S[x])*_}function u(y,b,S,A,P,x){var E=c(P,x),_=1-E,T=i.round((_*_*_*y[0]+(E*_*_+_*E*_+_*_*E)*S[0]+(E*E*_+_*E*E+E*_*E)*A[0]+E*E*E*b[0])*1e3)/1e3,C=i.round((_*_*_*y[1]+(E*_*_+_*E*_+_*_*E)*S[1]+(E*E*_+_*E*E+E*_*E)*A[1]+E*E*E*b[1])*1e3)/1e3;return[T,C]}var m=createTypedArray("float32",8);function d(y,b,S,A,P,x,E){P<0?P=0:P>1&&(P=1);var _=c(P,E);x=x>1?1:x;var T=c(x,E),C,R=y.length,I=1-_,M=1-T,D=I*I*I,H=_*I*I*3,W=_*_*I*3,O=_*_*_,z=I*I*M,k=_*I*M+I*_*M+I*I*T,$=_*_*M+I*_*T+_*I*T,F=_*_*T,G=I*M*M,N=_*M*M+I*T*M+I*M*T,V=_*T*M+I*T*T+_*M*T,K=_*T*T,U=M*M*M,J=T*M*M+M*T*M+M*M*T,me=T*T*M+M*T*T+T*M*T,he=T*T*T;for(C=0;C=u.t-t){c.h&&(c=u),s=0;break}if(u.t-t>i){s=o;break}o=x||i=x?T.points.length-1:0;for(y=T.points[C].point.length,d=0;d=M&&R=x)r[0]=_[0],r[1]=_[1],r[2]=_[2];else if(i<=E)r[0]=c.s[0],r[1]=c.s[1],r[2]=c.s[2];else{var k=createQuaternion(c.s),$=createQuaternion(_),F=(i-E)/(x-E);quaternionToEuler(r,slerp(k,$,F))}else for(o=0;o=x?b=1:i1e-6?(y=Math.acos(b),S=Math.sin(y),A=Math.sin((1-t)*y)/S,P=Math.sin(t*y)/S):(A=1-t,P=t),r[0]=A*s+P*c,r[1]=A*o+P*u,r[2]=A*a+P*m,r[3]=A*l+P*d,r}function quaternionToEuler(i,e){var t=e[0],r=e[1],s=e[2],o=e[3],a=Math.atan2(2*r*o-2*t*s,1-2*r*r-2*s*s),l=Math.asin(2*t*r+2*s*o),c=Math.atan2(2*t*o-2*r*s,1-2*t*t-2*s*s);i[0]=a/degToRads,i[1]=l/degToRads,i[2]=c/degToRads}function createQuaternion(i){var e=i[0]*degToRads,t=i[1]*degToRads,r=i[2]*degToRads,s=Math.cos(e/2),o=Math.cos(t/2),a=Math.cos(r/2),l=Math.sin(e/2),c=Math.sin(t/2),u=Math.sin(r/2),m=s*o*a-l*c*u,d=l*c*a+s*o*u,y=l*o*a+s*c*u,b=s*c*a-l*o*u;return[d,y,b,m]}function getValueAtCurrentTime(){var i=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,t=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(i===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=t&&i>=t||this._caching.lastFrame=i&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var r=this.interpolateValue(i,this._caching);this.pv=r}return this._caching.lastFrame=i,this.pv}function setVValue(i){var e;if(this.propType==="unidimensional")e=i*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var t=0,r=this.v.length;t1e-5&&(this.v[t]=e,this._mdf=!0),t+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var i,e=this.effectsSequence.length,t=this.kf?this.pv:this.data.k;for(i=0;i=this._maxLength&&this.doubleArrayLength(),t){case"v":o=this.v;break;case"i":o=this.i;break;case"o":o=this.o;break;default:o=[];break}(!o[r]||o[r]&&!s)&&(o[r]=pointPool.newElement()),o[r][0]=i,o[r][1]=e},ShapePath.prototype.setTripleAt=function(i,e,t,r,s,o,a,l){this.setXYAt(i,e,"v",a,l),this.setXYAt(t,r,"o",a,l),this.setXYAt(s,o,"i",a,l)},ShapePath.prototype.reverse=function(){var i=new ShapePath;i.setPathData(this.c,this._length);var e=this.v,t=this.o,r=this.i,s=0;this.c&&(i.setTripleAt(e[0][0],e[0][1],r[0][0],r[0][1],t[0][0],t[0][1],0,!1),s=1);var o=this._length-1,a=this._length,l;for(l=s;l=k[k.length-1].t-this.offsetTime)C=k[k.length-1].s?k[k.length-1].s[0]:k[k.length-2].e[0],I=!0;else{for(var $=T,F=k.length-1,G=!0,N,V,K;G&&(N=k[$],V=k[$+1],!(V.t-this.offsetTime>x));)$=V.t-this.offsetTime)O=1;else if(x_&&x>_)||(this._caching.lastIndex=T0||N>-1e-6&&N<0?r(N*V)/V:N}function G(){var N=this.props,V=F(N[0]),K=F(N[1]),U=F(N[4]),J=F(N[5]),me=F(N[12]),he=F(N[13]);return"matrix("+V+","+K+","+U+","+J+","+me+","+he+")"}return function(){this.reset=s,this.rotate=o,this.rotateX=a,this.rotateY=l,this.rotateZ=c,this.skew=m,this.skewFromAxis=d,this.shear=u,this.scale=y,this.setTransform=b,this.translate=S,this.transform=A,this.multiply=P,this.applyToPoint=C,this.applyToX=R,this.applyToY=I,this.applyToZ=M,this.applyToPointArray=z,this.applyToTriplePoints=O,this.applyToPointStringified=k,this.toCSS=$,this.to2dCSS=G,this.clone=_,this.cloneFromProps=T,this.equals=E,this.inversePoints=W,this.inversePoint=H,this.getInverseMatrix=D,this._t=this.transform,this.isIdentity=x,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$3=function(t){return typeof t}:_typeof$3=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$3(i)}var lottie={};function setLocation(i){setLocationHref(i)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(i){setSubframeEnabled(i)}function setPrefix(i){setIdPrefix(i)}function loadAnimation(i){return animationManager.loadAnimation(i)}function setQuality(i){if(typeof i=="string")switch(i){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(i)&&i>1&&setDefaultCurveSegments(i)}function inBrowser(){return typeof navigator<"u"}function installPlugin(i,e){i==="expressions"&&setExpressionsPlugin(e)}function getFactory(i){switch(i){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(i){for(var e=queryString.split("&"),t=0;t=1?o.push({s:i-1,e:e-1}):(o.push({s:i,e:1}),o.push({s:0,e:e-1}));var a=[],l,c=o.length,u;for(l=0;lr+t)){var m,d;u.s*s<=r?m=0:m=(u.s*s-r)/t,u.e*s>=r+t?d=1:d=(u.e*s-r)/t,a.push([m,d])}return a.length||a.push([0,0]),a},TrimModifier.prototype.releasePathsData=function(i){var e,t=i.length;for(e=0;e1?e=1+r:this.s.v<0?e=0+r:e=this.s.v+r,this.e.v>1?t=1+r:this.e.v<0?t=0+r:t=this.e.v+r,e>t){var s=e;e=t,t=s}e=Math.round(e*1e4)*1e-4,t=Math.round(t*1e4)*1e-4,this.sValue=e,this.eValue=t}else e=this.sValue,t=this.eValue;var o,a,l=this.shapes.length,c,u,m,d,y,b=0;if(t===e)for(a=0;a=0;a-=1)if(A=this.shapes[a],A.shape._mdf){for(P=A.localShapeCollection,P.releaseShapes(),this.m===2&&l>1?(T=this.calculateShapeEdges(e,t,A.totalShapeLength,_,b),_+=A.totalShapeLength):T=[[x,E]],u=T.length,c=0;c=1?S.push({s:A.totalShapeLength*(x-1),e:A.totalShapeLength*(E-1)}):(S.push({s:A.totalShapeLength*x,e:A.totalShapeLength}),S.push({s:0,e:A.totalShapeLength*(E-1)}));var C=this.addShapes(A,S[0]);if(S[0].s!==S[0].e){if(S.length>1){var R=A.shape.paths.shapes[A.shape.paths._length-1];if(R.c){var I=C.pop();this.addPaths(C,P),C=this.addShapes(A,S[1],I)}else this.addPaths(C,P),C=this.addShapes(A,S[1])}this.addPaths(C,P)}}A.shape.paths=P}}},TrimModifier.prototype.addPaths=function(i,e){var t,r=i.length;for(t=0;te.e){t.c=!1;break}else e.s<=u&&e.e>=u+m.addedLength?(this.addSegment(s[o].v[l-1],s[o].o[l-1],s[o].i[l],s[o].v[l],t,d,P),P=!1):(b=bez.getNewSegment(s[o].v[l-1],s[o].v[l],s[o].o[l-1],s[o].i[l],(e.s-u)/m.addedLength,(e.e-u)/m.addedLength,y[l-1]),this.addSegmentFromArray(b,t,d,P),P=!1,t.c=!1),u+=m.addedLength,d+=1;if(s[o].c&&y.length){if(m=y[l-1],u<=e.e){var x=y[l-1].addedLength;e.s<=u&&e.e>=u+x?(this.addSegment(s[o].v[l-1],s[o].o[l-1],s[o].i[0],s[o].v[0],t,d,P),P=!1):(b=bez.getNewSegment(s[o].v[l-1],s[o].v[0],s[o].o[l-1],s[o].i[0],(e.s-u)/x,(e.e-u)/x,y[l-1]),this.addSegmentFromArray(b,t,d,P),P=!1,t.c=!1)}else t.c=!1;u+=m.addedLength,d+=1}if(t._length&&(t.setXYAt(t.v[A][0],t.v[A][1],"i",A),t.setXYAt(t.v[t._length-1][0],t.v[t._length-1][1],"o",t._length-1)),u>e.e)break;o=this.p.keyframes[this.p.keyframes.length-1].t?(m=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/u,0),d=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/u,0)):(m=this.p.pv,d=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/u,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){m=[],d=[];var y=this.px,b=this.py;y._caching.lastFrame+y.offsetTime<=y.keyframes[0].t?(m[0]=y.getValueAtTime((y.keyframes[0].t+.01)/u,0),m[1]=b.getValueAtTime((b.keyframes[0].t+.01)/u,0),d[0]=y.getValueAtTime(y.keyframes[0].t/u,0),d[1]=b.getValueAtTime(b.keyframes[0].t/u,0)):y._caching.lastFrame+y.offsetTime>=y.keyframes[y.keyframes.length-1].t?(m[0]=y.getValueAtTime(y.keyframes[y.keyframes.length-1].t/u,0),m[1]=b.getValueAtTime(b.keyframes[b.keyframes.length-1].t/u,0),d[0]=y.getValueAtTime((y.keyframes[y.keyframes.length-1].t-.01)/u,0),d[1]=b.getValueAtTime((b.keyframes[b.keyframes.length-1].t-.01)/u,0)):(m=[y.pv,b.pv],d[0]=y.getValueAtTime((y._caching.lastFrame+y.offsetTime-.01)/u,y.offsetTime),d[1]=b.getValueAtTime((b._caching.lastFrame+b.offsetTime-.01)/u,b.offsetTime))}else d=i,m=d;this.v.rotate(-Math.atan2(m[1]-d[1],m[0]-d[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function s(){}function o(c){this._addDynamicProperty(c),this.elem.addDynamicProperty(c),this._isDirty=!0}function a(c,u,m){if(this.elem=c,this.frameId=-1,this.propType="transform",this.data=u,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(m||c),u.p&&u.p.s?(this.px=PropertyFactory.getProp(c,u.p.x,0,0,this),this.py=PropertyFactory.getProp(c,u.p.y,0,0,this),u.p.z&&(this.pz=PropertyFactory.getProp(c,u.p.z,0,0,this))):this.p=PropertyFactory.getProp(c,u.p||{k:[0,0,0]},1,0,this),u.rx){if(this.rx=PropertyFactory.getProp(c,u.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(c,u.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(c,u.rz,0,degToRads,this),u.or.k[0].ti){var d,y=u.or.k.length;for(d=0;d0;)t-=1,this._elements.unshift(e[t]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(i){var e,t=i.length;for(e=0;e0?Math.floor(y):Math.ceil(y),A=this.pMatrix.props,P=this.rMatrix.props,x=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var E=0;if(y>0){for(;ES;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),E-=1;b&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-b,!0),E-=b)}r=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,o=this._currentCopies;for(var _,T;o;){if(e=this.elemsData[r].it,t=e[e.length-1].transform.mProps.v.props,T=t.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),E!==0){for((r!==0&&s===1||r!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(P[0],P[1],P[2],P[3],P[4],P[5],P[6],P[7],P[8],P[9],P[10],P[11],P[12],P[13],P[14],P[15]),this.matrix.transform(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]),this.matrix.transform(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],A[8],A[9],A[10],A[11],A[12],A[13],A[14],A[15]),_=0;_0&&r<1?[e]:[]:[e-r,e+r].filter(function(s){return s>0&&s<1})},PolynomialBezier.prototype.split=function(i){if(i<=0)return[singlePoint(this.points[0]),this];if(i>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],i),t=lerpPoint(this.points[1],this.points[2],i),r=lerpPoint(this.points[2],this.points[3],i),s=lerpPoint(e,t,i),o=lerpPoint(t,r,i),a=lerpPoint(s,o,i);return[new PolynomialBezier(this.points[0],e,s,a,!0),new PolynomialBezier(a,o,r,this.points[3],!0)]};function extrema(i,e){var t=i.points[0][e],r=i.points[i.points.length-1][e];if(t>r){var s=r;r=t,t=s}for(var o=quadRoots(3*i.a[e],2*i.b[e],i.c[e]),a=0;a0&&o[a]<1){var l=i.point(o[a])[e];lr&&(r=l)}return{min:t,max:r}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var i=this.bounds();return{left:i.x.min,right:i.x.max,top:i.y.min,bottom:i.y.max,width:i.x.max-i.x.min,height:i.y.max-i.y.min,cx:(i.x.max+i.x.min)/2,cy:(i.y.max+i.y.min)/2}};function intersectData(i,e,t){var r=i.boundingBox();return{cx:r.cx,cy:r.cy,width:r.width,height:r.height,bez:i,t:(e+t)/2,t1:e,t2:t}}function splitData(i){var e=i.bez.split(.5);return[intersectData(e[0],i.t1,i.t),intersectData(e[1],i.t,i.t2)]}function boxIntersect(i,e){return Math.abs(i.cx-e.cx)*2=o||i.width<=r&&i.height<=r&&e.width<=r&&e.height<=r){s.push([i.t,e.t]);return}var a=splitData(i),l=splitData(e);intersectsImpl(a[0],l[0],t+1,r,s,o),intersectsImpl(a[0],l[1],t+1,r,s,o),intersectsImpl(a[1],l[0],t+1,r,s,o),intersectsImpl(a[1],l[1],t+1,r,s,o)}}PolynomialBezier.prototype.intersections=function(i,e,t){e===void 0&&(e=2),t===void 0&&(t=7);var r=[];return intersectsImpl(intersectData(this,0,1),intersectData(i,0,1),0,e,r,t),r},PolynomialBezier.shapeSegment=function(i,e){var t=(e+1)%i.length();return new PolynomialBezier(i.v[e],i.o[e],i.i[t],i.v[t],!0)},PolynomialBezier.shapeSegmentInverted=function(i,e){var t=(e+1)%i.length();return new PolynomialBezier(i.v[t],i.i[t],i.o[e],i.v[e],!0)};function crossProduct(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function lineIntersection(i,e,t,r){var s=[i[0],i[1],1],o=[e[0],e[1],1],a=[t[0],t[1],1],l=[r[0],r[1],1],c=crossProduct(crossProduct(s,o),crossProduct(a,l));return floatZero(c[2])?null:[c[0]/c[2],c[1]/c[2]]}function polarOffset(i,e,t){return[i[0]+Math.cos(e)*t,i[1]-Math.sin(e)*t]}function pointDistance(i,e){return Math.hypot(i[0]-e[0],i[1]-e[1])}function pointEqual(i,e){return floatEqual(i[0],e[0])&&floatEqual(i[1],e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(i,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(i,e.s,0,null,this),this.frequency=PropertyFactory.getProp(i,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(i,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(i,e,t,r,s,o,a){var l=t-Math.PI/2,c=t+Math.PI/2,u=e[0]+Math.cos(t)*r*s,m=e[1]-Math.sin(t)*r*s;i.setTripleAt(u,m,u+Math.cos(l)*o,m-Math.sin(l)*o,u+Math.cos(c)*a,m-Math.sin(c)*a,i.length())}function getPerpendicularVector(i,e){var t=[e[0]-i[0],e[1]-i[1]],r=-Math.PI*.5,s=[Math.cos(r)*t[0]-Math.sin(r)*t[1],Math.sin(r)*t[0]+Math.cos(r)*t[1]];return s}function getProjectingAngle(i,e){var t=e===0?i.length()-1:e-1,r=(e+1)%i.length(),s=i.v[t],o=i.v[r],a=getPerpendicularVector(s,o);return Math.atan2(0,1)-Math.atan2(a[1],a[0])}function zigZagCorner(i,e,t,r,s,o,a){var l=getProjectingAngle(e,t),c=e.v[t%e._length],u=e.v[t===0?e._length-1:t-1],m=e.v[(t+1)%e._length],d=o===2?Math.sqrt(Math.pow(c[0]-u[0],2)+Math.pow(c[1]-u[1],2)):0,y=o===2?Math.sqrt(Math.pow(c[0]-m[0],2)+Math.pow(c[1]-m[1],2)):0;setPoint(i,e.v[t%e._length],l,a,r,y/((s+1)*2),d/((s+1)*2))}function zigZagSegment(i,e,t,r,s,o){for(var a=0;a1&&e.length>1&&(s=getIntersection(i[0],e[e.length-1]),s)?[[i[0].split(s[0])[0]],[e[e.length-1].split(s[1])[1]]]:[t,r]}function pruneIntersections(i){for(var e,t=1;t1&&(e=pruneSegmentIntersection(i[i.length-1],i[0]),i[i.length-1]=e[0],i[0]=e[1]),i}function offsetSegmentSplit(i,e){var t=i.inflectionPoints(),r,s,o,a;if(t.length===0)return[offsetSegment(i,e)];if(t.length===1||floatEqual(t[1],1))return o=i.split(t[0]),r=o[0],s=o[1],[offsetSegment(r,e),offsetSegment(s,e)];o=i.split(t[0]),r=o[0];var l=(t[1]-t[0])/(1-t[0]);return o=o[1].split(l),a=o[0],s=o[1],[offsetSegment(r,e),offsetSegment(a,e),offsetSegment(s,e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(i,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(i,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(i,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(i,e,t,r){var s=shapePool.newElement();s.c=i.c;var o=i.length();i.c||(o-=1);var a,l,c,u=[];for(a=0;a=0;a-=1)c=PolynomialBezier.shapeSegmentInverted(i,a),u.push(offsetSegmentSplit(c,e));u=pruneIntersections(u);var m=null,d=null;for(a=0;a0&&(J=!1),J){var le=createTag("style");le.setAttribute("f-forigin",N[V].fOrigin),le.setAttribute("f-origin",N[V].origin),le.setAttribute("f-family",N[V].fFamily),le.type="text/css",le.innerText="@font-face {font-family: "+N[V].fFamily+"; font-style: normal; src: url('"+N[V].fPath+"');}",G.appendChild(le)}}else if(N[V].fOrigin==="g"||N[V].origin===1){for(me=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),he=0;he=55296&&N<=56319){var V=F.charCodeAt(1);V>=56320&&V<=57343&&(G=(N-55296)*1024+V-56320+65536)}return G}function R(F,G){var N=F.toString(16)+G.toString(16);return d.indexOf(N)!==-1}function I(F){return F===c}function M(F){return F===l}function D(F){var G=C(F);return G>=u&&G<=m}function H(F){return D(F.substr(0,2))&&D(F.substr(2,2))}function W(F){return t.indexOf(F)!==-1}function O(F,G){var N=C(F.substr(G,2));if(N!==r)return!1;var V=0;for(G+=2;V<5;){if(N=C(F.substr(G,2)),Na)return!1;V+=1,G+=2}return C(F.substr(G,2))===s}function z(){this.isLoaded=!0}var k=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};k.isModifier=R,k.isZeroWidthJoiner=I,k.isFlagEmoji=H,k.isRegionalCode=D,k.isCombinedCharacter=W,k.isRegionalFlag=O,k.isVariationSelector=M,k.BLACK_FLAG_CODE_POINT=r;var $={addChars:x,addFonts:P,getCharData:E,getFontByName:T,measureText:_,checkLoadedFonts:S,setIsLoaded:z};return k.prototype=$,k}();function SlotManager(i){this.animationData=i}SlotManager.prototype.getProp=function(i){return this.animationData.slots&&this.animationData.slots[i.sid]?Object.assign(i,this.animationData.slots[i.sid].p):i};function slotFactory(i){return new SlotManager(i)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,t=this.renderableComponents.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(i){this.audio.rate(i)},AudioElement.prototype.volume=function(i){this._volumeMultiplier=i,this._previousVolume=i*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(i){var e,t=this.layers.length,r;for(this.completeLayers=!0,e=t-1;e>=0;e-=1)this.elements[e]||(r=this.layers[e],r.ip-r.st<=i-this.layers[e].st&&r.op-r.st>i-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(i){switch(i.ty){case 2:return this.createImage(i);case 0:return this.createComp(i);case 1:return this.createSolid(i);case 3:return this.createNull(i);case 4:return this.createShape(i);case 5:return this.createText(i);case 6:return this.createAudio(i);case 13:return this.createCamera(i);case 15:return this.createFootage(i);default:return this.createNull(i)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(i){return new AudioElement(i,this.globalData,this)},BaseRenderer.prototype.createFootage=function(i){return new FootageElement(i,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var i,e=this.layers.length;for(i=0;i0&&(this.maskElement.setAttribute("id",y),this.element.maskedElement.setAttribute(E,"url("+getLocationHref()+"#"+y+")"),r.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(i){return this.viewData[i].prop},MaskElement.prototype.renderFrame=function(i){var e=this.element.finalTransform.mat,t,r=this.masksProperties.length;for(t=0;t1&&(r+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),t.lastPath!==r){var a="";t.elem&&(e.c&&(a=i.inv?this.solidPath+r:r),t.elem.setAttribute("d",a)),t.lastPath=r}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var i={};i.createFilter=e,i.createAlphaToLuminanceFilter=t;function e(r,s){var o=createNS("filter");return o.setAttribute("id",r),s!==!0&&(o.setAttribute("filterUnits","objectBoundingBox"),o.setAttribute("x","0%"),o.setAttribute("y","0%"),o.setAttribute("width","100%"),o.setAttribute("height","100%")),o}function t(){var r=createNS("feColorMatrix");return r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),r}return i}(),featureSupport=function(){var i={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(i.maskType=!1),/firefox/i.test(navigator.userAgent)&&(i.svgLumaHidden=!1),i}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(i){var e,t="SourceGraphic",r=i.data.ef?i.data.ef.length:0,s=createElementID(),o=filtersFactory.createFilter(s,!0),a=0;this.filters=[];var l;for(e=0;e=0&&(r=this.shapeModifiers[e].processShapes(this._isFirstFrame),!r);e-=1);}},searchProcessedElement:function(e){for(var t=this.processedElements,r=0,s=t.length;r.01)return!1;t+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var i=0,e=this.data.k.k.length;i0;)x=y.transformers[D].mProps._mdf||x,M-=1,D-=1;if(x)for(M=C-y.styles[_].lvl,D=y.transformers.length-1;M>0;)I.multiply(y.transformers[D].mProps.v),M-=1,D-=1}else I=i;if(R=y.sh.paths,A=R._length,x){for(P="",S=0;S=1?z=.99:z<=-1&&(z=-.99);var k=W*z,$=Math.cos(O+y.a.v)*k+P[0],F=Math.sin(O+y.a.v)*k+P[1];S.setAttribute("fx",$),S.setAttribute("fy",F),A&&!y.g._collapsable&&(y.of.setAttribute("fx",$),y.of.setAttribute("fy",F))}}}function m(d,y,b){var S=y.style,A=y.d;A&&(A._mdf||b)&&A.dashStr&&(S.pElem.setAttribute("stroke-dasharray",A.dashStr),S.pElem.setAttribute("stroke-dashoffset",A.dashoffset[0])),y.c&&(y.c._mdf||b)&&S.pElem.setAttribute("stroke","rgb("+bmFloor(y.c.v[0])+","+bmFloor(y.c.v[1])+","+bmFloor(y.c.v[2])+")"),(y.o._mdf||b)&&S.pElem.setAttribute("stroke-opacity",y.o.v),(y.w._mdf||b)&&(S.pElem.setAttribute("stroke-width",y.w.v),S.msElem&&S.msElem.setAttribute("stroke-width",y.w.v))}return t}();function SVGShapeElement(i,e,t){this.shapes=[],this.shapesData=i.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(i,e,t),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var i,e=this.shapes.length,t,r,s=this.stylesList.length,o,a=[],l=!1;for(r=0;r1&&l&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(i){var e,t=i.length;for(e=0;e=0;c-=1){if(P=this.searchProcessedElement(i[c]),P?e[c]=t[P-1]:i[c]._render=a,i[c].ty==="fl"||i[c].ty==="st"||i[c].ty==="gf"||i[c].ty==="gs"||i[c].ty==="no")P?e[c].style.closed=!1:e[c]=this.createStyleElement(i[c],s),i[c]._render&&e[c].style.pElem.parentNode!==r&&r.appendChild(e[c].style.pElem),y.push(e[c].style);else if(i[c].ty==="gr"){if(!P)e[c]=this.createGroupElement(i[c]);else for(d=e[c].it.length,m=0;m1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(i){this.effectsSequence.push(i),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(i){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!i)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,t=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var r,s=this.effectsSequence.length,o=i||this.data.d.k[this.keysIndex].s;for(r=0;re);)t+=1;return this.keysIndex!==t&&(this.keysIndex=t),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(i){for(var e=[],t=0,r=i.length,s,o,a=!1,l=!1,c="";t=55296&&s<=56319?FontManager.isRegionalFlag(i,t)?c=i.substr(t,14):(o=i.charCodeAt(t+1),o>=56320&&o<=57343&&(FontManager.isModifier(s,o)?(c=i.substr(t,2),a=!0):FontManager.isFlagEmoji(i.substr(t,4))?c=i.substr(t,4):c=i.substr(t,2))):s>56319?(o=i.charCodeAt(t+1),FontManager.isVariationSelector(s)&&(a=!0)):FontManager.isZeroWidthJoiner(s)&&(a=!0,l=!0),a?(e[e.length-1]+=c,a=!1):e.push(c),t+=c.length;return e},TextProperty.prototype.completeTextData=function(i){i.__complete=!0;var e=this.elem.globalData.fontManager,t=this.data,r=[],s,o,a,l=0,c,u=t.m.g,m=0,d=0,y=0,b=[],S=0,A=0,P,x,E=e.getFontByName(i.f),_,T=0,C=getFontProperties(E);i.fWeight=C.weight,i.fStyle=C.style,i.finalSize=i.s,i.finalText=this.buildFinalText(i.t),o=i.finalText.length,i.finalLineHeight=i.lh;var R=i.tr/1e3*i.finalSize,I;if(i.sz)for(var M=!0,D=i.sz[0],H=i.sz[1],W,O;M;){O=this.buildFinalText(i.t),W=0,S=0,o=O.length,R=i.tr/1e3*i.finalSize;var z=-1;for(s=0;sD&&O[s]!==" "?(z===-1?o+=1:s=z,W+=i.finalLineHeight||i.finalSize*1.2,O.splice(s,z===s?1:0,"\r"),z=-1,S=0):(S+=T,S+=R);W+=E.ascent*i.finalSize/100,this.canResize&&i.finalSize>this.minimumFontSize&&HA?S:A,S=-2*R,c="",a=!0,y+=1):c=$,e.chars?(_=e.getCharData($,E.fStyle,e.getFontByName(i.f).fFamily),T=a?0:_.w*i.finalSize/100):T=e.measureText(c,i.f,i.finalSize),$===" "?k+=T+R:(S+=T+R+k,k=0),r.push({l:T,an:T,add:m,n:a,anIndexes:[],val:c,line:y,animatorJustifyOffset:0}),u==2){if(m+=T,c===""||c===" "||s===o-1){for((c===""||c===" ")&&(m-=T);d<=s;)r[d].an=m,r[d].ind=l,r[d].extra=T,d+=1;l+=1,m=0}}else if(u==3){if(m+=T,c===""||s===o-1){for(c===""&&(m-=T);d<=s;)r[d].an=m,r[d].ind=l,r[d].extra=T,d+=1;m=0,l+=1}}else r[l].ind=l,r[l].extra=0,l+=1;if(i.l=r,A=S>A?S:A,b.push(S),i.sz)i.boxWidth=i.sz[0],i.justifyOffset=0;else switch(i.boxWidth=A,i.j){case 1:i.justifyOffset=-i.boxWidth;break;case 2:i.justifyOffset=-i.boxWidth/2;break;default:i.justifyOffset=0}i.lineWidths=b;var F=t.a,G,N;x=F.length;var V,K,U=[];for(P=0;P0?l=this.ne.v/100:c=-this.ne.v/100,this.xe.v>0?u=1-this.xe.v/100:m=1+this.xe.v/100;var d=BezierFactory.getBezierEasing(l,c,u,m).get,y=0,b=this.finalS,S=this.finalE,A=this.data.sh;if(A===2)S===b?y=a>=S?1:0:y=i(0,e(.5/(S-b)+(a-b)/(S-b),1)),y=d(y);else if(A===3)S===b?y=a>=S?0:1:y=1-i(0,e(.5/(S-b)+(a-b)/(S-b),1)),y=d(y);else if(A===4)S===b?y=0:(y=i(0,e(.5/(S-b)+(a-b)/(S-b),1)),y<.5?y*=2:y=1-2*(y-.5)),y=d(y);else if(A===5){if(S===b)y=0;else{var P=S-b;a=e(i(0,a+.5-b),S-b);var x=-P/2+a,E=P/2;y=Math.sqrt(1-x*x/(E*E))}y=d(y)}else A===6?(S===b?y=0:(a=e(i(0,a+.5-b),S-b),y=(1+Math.cos(Math.PI+Math.PI*2*a/(S-b)))/2),y=d(y)):(a>=t(b)&&(a-b<0?y=i(0,e(e(S,1)-(b-a),1)):y=i(0,e(S-a,1))),y=d(y));if(this.sm.v!==100){var _=this.sm.v*.01;_===0&&(_=1e-8);var T=.5-_*.5;y1&&(y=1))}return y*this.a.v},getValue:function(a){this.iterateDynamicProperties(),this._mdf=a||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,a&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,c=this.o.v/l,u=this.s.v/l+c,m=this.e.v/l+c;if(u>m){var d=u;u=m,m=d}this.finalS=u,this.finalE=m}},extendPrototype([DynamicPropertyContainer],r);function s(o,a,l){return new r(o,a)}return{getTextSelectorProp:s}}();function TextAnimatorDataProperty(i,e,t){var r={propType:!1},s=PropertyFactory.getProp,o=e.a;this.a={r:o.r?s(i,o.r,0,degToRads,t):r,rx:o.rx?s(i,o.rx,0,degToRads,t):r,ry:o.ry?s(i,o.ry,0,degToRads,t):r,sk:o.sk?s(i,o.sk,0,degToRads,t):r,sa:o.sa?s(i,o.sa,0,degToRads,t):r,s:o.s?s(i,o.s,1,.01,t):r,a:o.a?s(i,o.a,1,0,t):r,o:o.o?s(i,o.o,0,.01,t):r,p:o.p?s(i,o.p,1,0,t):r,sw:o.sw?s(i,o.sw,0,0,t):r,sc:o.sc?s(i,o.sc,1,0,t):r,fc:o.fc?s(i,o.fc,1,0,t):r,fh:o.fh?s(i,o.fh,0,0,t):r,fs:o.fs?s(i,o.fs,0,.01,t):r,fb:o.fb?s(i,o.fb,0,.01,t):r,t:o.t?s(i,o.t,0,0,t):r},this.s=TextSelectorProp.getTextSelectorProp(i,e.s,t),this.s.t=e.s.t}function TextAnimatorProperty(i,e,t){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=i,this._renderType=e,this._elem=t,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(t)}TextAnimatorProperty.prototype.searchProperties=function(){var i,e=this._textData.a.length,t,r=PropertyFactory.getProp;for(i=0;i=S+ge||!C?(D=(S+ge-P)/A.partialLength,he=T.point[0]+(A.point[0]-T.point[0])*D,le=T.point[1]+(A.point[1]-T.point[1])*D,o.translate(-t[0]*y[m].an*.005,-(t[1]*k)*.01),x=!1):C&&(P+=A.partialLength,E+=1,E>=C.length&&(E=0,_+=1,R[_]?C=R[_].points:W.v.c?(E=0,_=0,C=R[_].points):(P-=A.partialLength,C=null)),C&&(T=A,A=C[E],I=A.partialLength));me=y[m].an/2-y[m].add,o.translate(-me,0,0)}else me=y[m].an/2-y[m].add,o.translate(-me,0,0),o.translate(-t[0]*y[m].an*.005,-t[1]*k*.01,0);for(N=0;Ni?this.textSpans[i].span:createNS(l?"g":"text"),_<=i){if(c.setAttribute("stroke-linecap","butt"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit","4"),this.textSpans[i].span=c,l){var C=createNS("g");c.appendChild(C),this.textSpans[i].childSpan=C}this.textSpans[i].span=c,this.layerElement.appendChild(c)}c.style.display="inherit"}if(u.reset(),d&&(a[i].n&&(y=-A,b+=t.yOffset,b+=S?1:0,S=!1),this.applyTextPropertiesToMatrix(t,u,a[i].line,y,b),y+=a[i].l||0,y+=A),l){T=this.globalData.fontManager.getCharData(t.finalText[i],r.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily);var R;if(T.t===1)R=new SVGCompElement(T.data,this.globalData,this);else{var I=emptyShapeData;T.data&&T.data.shapes&&(I=this.buildShapeData(T.data,t.finalSize)),R=new SVGShapeElement(I,this.globalData,this)}if(this.textSpans[i].glyph){var M=this.textSpans[i].glyph;this.textSpans[i].childSpan.removeChild(M.layerElement),M.destroy()}this.textSpans[i].glyph=R,R._debug=!0,R.prepareFrame(0),R.renderFrame(),this.textSpans[i].childSpan.appendChild(R.layerElement),T.t===1&&this.textSpans[i].childSpan.setAttribute("transform","scale("+t.finalSize/100+","+t.finalSize/100+")")}else d&&c.setAttribute("transform","translate("+u.props[12]+","+u.props[13]+")"),c.textContent=a[i].val,c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}d&&c&&c.setAttribute("d",m)}for(;i=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(i-this.layers[e].st);if(this.globalData._mdf)for(e=0;e=0;t-=1)(this.completeLayers||this.elements[t])&&(this.elements[t].prepareFrame(this.renderedFrame-this.layers[t].st),this.elements[t]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var i,e=this.layers.length;for(i=0;i=0;r-=1)e.finalTransform.multiply(e.transforms[r].transform.mProps.v);e._mdf=o},processSequences:function(e){var t,r=this.sequenceList.length;for(t=0;t=1){this.buffers=[];var e=this.globalData.canvasContext,t=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(t);var r=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(r),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var t=getBlendMode(this.data.bm);e.canvasContext.globalCompositeOperation=t}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0],t=e.getContext("2d");this.clearCanvas(t),t.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],t=e.getContext("2d");this.clearCanvas(t),t.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var r=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(r.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var s=assetLoader.getLumaCanvas(this.canvasContext.canvas),o=s.getContext("2d");o.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(s,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var t=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(t),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(t),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(i,e,t,r){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;e.ty==="rc"?s=5:e.ty==="el"?s=6:e.ty==="sr"&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(i,e,s,i);var o,a=t.length,l;for(o=0;o=0;o-=1){if(d=this.searchProcessedElement(i[o]),d?e[o]=t[d-1]:i[o]._shouldRender=r,i[o].ty==="fl"||i[o].ty==="st"||i[o].ty==="gf"||i[o].ty==="gs")d?e[o].style.closed=!1:e[o]=this.createStyleElement(i[o],S),u.push(e[o].style);else if(i[o].ty==="gr"){if(!d)e[o]=this.createGroupElement(i[o]);else for(c=e[o].it.length,l=0;l=0;s-=1)e[s].ty==="tr"?(a=t[s].transform,this.renderShapeTransform(i,a)):e[s].ty==="sh"||e[s].ty==="el"||e[s].ty==="rc"||e[s].ty==="sr"?this.renderPath(e[s],t[s]):e[s].ty==="fl"?this.renderFill(e[s],t[s],a):e[s].ty==="st"?this.renderStroke(e[s],t[s],a):e[s].ty==="gf"||e[s].ty==="gs"?this.renderGradientFill(e[s],t[s],a):e[s].ty==="gr"?this.renderShape(a,e[s].it,t[s].it):e[s].ty;r&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(i,e){if(this._isFirstFrame||e._mdf||i.transforms._mdf){var t=i.trNodes,r=e.paths,s,o,a,l=r._length;t.length=0;var c=i.transforms.finalTransform;for(a=0;a=1?m=.99:m<=-1&&(m=-.99);var d=c*m,y=Math.cos(u+e.a.v)*d+a[0],b=Math.sin(u+e.a.v)*d+a[1];s=o.createRadialGradient(y,b,0,a[0],a[1],c)}var S,A=i.g.p,P=e.g.c,x=1;for(S=0;So&&c==="xMidYMid slice"||ss&&l==="meet"||os&&l==="slice")?this.transformCanvas.tx=(t-this.transformCanvas.w*(r/this.transformCanvas.h))/2*this.renderConfig.dpr:u==="xMax"&&(os&&l==="slice")?this.transformCanvas.tx=(t-this.transformCanvas.w*(r/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,m==="YMid"&&(o>s&&l==="meet"||os&&l==="meet"||o=0;i-=1)this.elements[i]&&this.elements[i].destroy&&this.elements[i].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(i,e){if(!(this.renderedFrame===i&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||i===-1)){this.renderedFrame=i,this.globalData.frameNum=i-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=i;var t,r=this.layers.length;for(this.completeLayers||this.checkLayers(i),t=r-1;t>=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(i-this.layers[t].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),t=r-1;t>=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(i){var e=this.elements;if(!(e[i]||this.layers[i].ty===99)){var t=this.createItem(this.layers[i],this,this.globalData);e[i]=t,t.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var i=this.pendingElements.pop();i.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var i,e=15;for(i=0;i=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var i,e=this.layers.length;for(i=e-1;i>=0;i-=1)this.elements[i]&&this.elements[i].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(i){return new CVCompElement(i,this.globalData,this)};function CanvasRenderer(i,e){this.animationItem=i,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(i){return new CVCompElement(i,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var t=this.finalTransform.mat.toCSS();e.transform=t,e.webkitTransform=t}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(i,e,t){this.initElement(i,e,t)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var i;this.data.hasMask?(i=createNS("rect"),i.setAttribute("width",this.data.sw),i.setAttribute("height",this.data.sh),i.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(i=createTag("div"),i.style.width=this.data.sw+"px",i.style.height=this.data.sh+"px",i.style.backgroundColor=this.data.sc),this.layerElement.appendChild(i)};function HShapeElement(i,e,t){this.shapes=[],this.shapesData=i.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(i,e,t),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var i;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),i=this.svgElement;else{i=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;i.setAttribute("width",e.w),i.setAttribute("height",e.h),i.appendChild(this.shapesContainer),this.layerElement.appendChild(i)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=i},HShapeElement.prototype.getTransformedPoint=function(i,e){var t,r=i.length;for(t=0;t0&&c<1&&s[y].push(this.calculateF(c,i,e,t,r,y))):(u=a*a-4*l*o,u>=0&&(m=(-a+bmSqrt(u))/(2*o),m>0&&m<1&&s[y].push(this.calculateF(m,i,e,t,r,y)),d=(-a-bmSqrt(u))/(2*o),d>0&&d<1&&s[y].push(this.calculateF(d,i,e,t,r,y)))));this.shapeBoundingBox.left=bmMin.apply(null,s[0]),this.shapeBoundingBox.top=bmMin.apply(null,s[1]),this.shapeBoundingBox.right=bmMax.apply(null,s[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,s[1])},HShapeElement.prototype.calculateF=function(i,e,t,r,s,o){return bmPow(1-i,3)*e[o]+3*bmPow(1-i,2)*i*t[o]+3*(1-i)*bmPow(i,2)*r[o]+bmPow(i,3)*s[o]},HShapeElement.prototype.calculateBoundingBox=function(i,e){var t,r=i.length;for(t=0;tt&&(t=s)}t*=i.mult}else t=i.v*i.mult;e.x-=t,e.xMax+=t,e.y-=t,e.yMax+=t},HShapeElement.prototype.currentBoxContains=function(i){return this.currentBBox.x<=i.x&&this.currentBBox.y<=i.y&&this.currentBBox.width+this.currentBBox.x>=i.x+i.width&&this.currentBBox.height+this.currentBBox.y>=i.y+i.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var i=this.tempBoundingBox,e=999999;if(i.x=e,i.xMax=-e,i.y=e,i.yMax=-e,this.calculateBoundingBox(this.itemsData,i),i.width=i.xMax=0;e-=1){var r=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-r.p.v[0],-r.p.v[1],r.p.v[2]),this.mat.rotateX(-r.or.v[0]).rotateY(-r.or.v[1]).rotateZ(r.or.v[2]),this.mat.rotateX(-r.rx.v).rotateY(-r.ry.v).rotateZ(r.rz.v),this.mat.scale(1/r.s.v[0],1/r.s.v[1],1/r.s.v[2]),this.mat.translate(r.a.v[0],r.a.v[1],r.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;this.p?s=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:s=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var o=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),a=[s[0]/o,s[1]/o,s[2]/o],l=Math.sqrt(a[2]*a[2]+a[0]*a[0]),c=Math.atan2(a[1],l),u=Math.atan2(a[0],-a[2]);this.mat.rotateY(u).rotateX(-c)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var m=!this._prevMat.equals(this.mat);if((m||this.pe._mdf)&&this.comp.threeDElements){t=this.comp.threeDElements.length;var d,y,b;for(e=0;e=i)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(i,e){var t=createTag("div"),r,s;styleDiv(t);var o=createTag("div");if(styleDiv(o),e==="3d"){r=t.style,r.width=this.globalData.compSize.w+"px",r.height=this.globalData.compSize.h+"px";var a="50% 50%";r.webkitTransformOrigin=a,r.mozTransformOrigin=a,r.transformOrigin=a,s=o.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.transform=l,s.webkitTransform=l}t.appendChild(o);var c={container:o,perspectiveElem:t,startPos:i,endPos:i,type:e};return this.threeDElements.push(c),c},HybridRendererBase.prototype.build3dContainers=function(){var i,e=this.layers.length,t,r="";for(i=0;i=0;i-=1)this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(i,e){for(var t=0,r=this.threeDElements.length;tt?(s=i/this.globalData.compSize.w,o=i/this.globalData.compSize.w,a=0,l=(e-this.globalData.compSize.h*(i/this.globalData.compSize.w))/2):(s=e/this.globalData.compSize.h,o=e/this.globalData.compSize.h,a=(i-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,l=0);var c=this.resizerElem.style;c.webkitTransform="matrix3d("+s+",0,0,0,0,"+o+",0,0,0,0,1,0,"+a+","+l+",0,1)",c.transform=c.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var i=this.globalData.compSize.w,e=this.globalData.compSize.h,t,r=this.threeDElements.length;for(t=0;t=u;)W/=2,O/=2,z>>>=1;return(W+z)/O};return D.int32=function(){return M.g(4)|0},D.quick=function(){return M.g(4)/4294967296},D.double=D,P(E(M.S),i),(T.pass||C||function(H,W,O,z){return z&&(z.S&&S(z,M),H.state=function(){return S(M,{})}),O?(e[a]=H,W):H})(D,I,"global"in T?T.global:this==e,T.state)}e["seed"+a]=y;function b(_){var T,C=_.length,R=this,I=0,M=R.i=R.j=0,D=R.S=[];for(C||(_=[C++]);It){var r=t;t=e,e=r}return Math.min(Math.max(i,e),t)}function radiansToDegrees(i){return i/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(i){return i*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(i,e){if(typeof i=="number"||i instanceof Number)return e=e||0,Math.abs(i-e);e||(e=helperLengthArray);var t,r=Math.min(i.length,e.length),s=0;for(t=0;t.5?u/(2-s-o):u/(s+o),s){case e:a=(t-r)/u+(t1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function hslToRgb(i){var e=i[0],t=i[1],r=i[2],s,o,a;if(t===0)s=r,a=r,o=r;else{var l=r<.5?r*(1+t):r+t-r*t,c=2*r-l;s=hue2rgb(c,l,e+1/3),o=hue2rgb(c,l,e),a=hue2rgb(c,l,e-1/3)}return[s,o,a,i[3]]}function linear(i,e,t,r,s){if((r===void 0||s===void 0)&&(r=e,s=t,e=0,t=1),t=t)return s;var a=t===e?0:(i-e)/(t-e);if(!r.length)return r+(s-r)*a;var l,c=r.length,u=createTypedArray("float32",c);for(l=0;l1){for(s=0;s1?e=1:e<0&&(e=0);var a=i(e);if($bm_isInstanceOfArray(s)){var l,c=s.length,u=createTypedArray("float32",c);for(l=0;ldata.k[e].t&&idata.k[e+1].t-i?(r=e+2,s=data.k[e+1].t):(r=e+1,s=data.k[e].t);break}r===-1&&(r=e+1,s=data.k[e].t)}var o={};return o.index=r,o.time=s/elem.comp.globalData.frameRate,o}function key(i){var e,t,r;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+i);i-=1,e={time:data.k[i].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[i],"s")?data.k[i].s:data.k[i-1].e;for(r=s.length,t=0;tP.length-1)&&(b=P.length-1),_=P[P.length-1-b].t,E=x-_);var T,C,R;if(y==="pingpong"){var I=Math.floor((A-_)/E);if(I%2!==0)return this.getValueAtTime((E-(A-_)%E+_)/this.comp.globalData.frameRate,0)}else if(y==="offset"){var M=this.getValueAtTime(_/this.comp.globalData.frameRate,0),D=this.getValueAtTime(x/this.comp.globalData.frameRate,0),H=this.getValueAtTime(((A-_)%E+_)/this.comp.globalData.frameRate,0),W=Math.floor((A-_)/E);if(this.pv.length){for(R=new Array(M.length),C=R.length,T=0;T=x)return this.pv;var E,_;S?(b?E=Math.abs(this.elem.comp.globalData.frameRate*b):E=Math.max(0,this.elem.data.op-x),_=x+E):((!b||b>P.length-1)&&(b=P.length-1),_=P[b].t,E=_-x);var T,C,R;if(y==="pingpong"){var I=Math.floor((x-A)/E);if(I%2===0)return this.getValueAtTime(((x-A)%E+x)/this.comp.globalData.frameRate,0)}else if(y==="offset"){var M=this.getValueAtTime(x/this.comp.globalData.frameRate,0),D=this.getValueAtTime(_/this.comp.globalData.frameRate,0),H=this.getValueAtTime((E-(x-A)%E+x)/this.comp.globalData.frameRate,0),W=Math.floor((x-A)/E)+1;if(this.pv.length){for(R=new Array(M.length),C=R.length,T=0;T1?(P-A)/(b-1):1,E=0,_=0,T;this.pv.length?T=createTypedArray("float32",this.pv.length):T=0;for(var C;EE){var I=_,M=A.c&&_===T-1?0:_+1,D=(E-C)/x[_].addedLength;R=bez.getPointInSegment(A.v[I],A.v[M],A.o[I],A.i[M],D,x[_]);break}else C+=x[_].addedLength;_+=1}return R||(R=A.c?[A.v[0][0],A.v[0][1]]:[A.v[A._length-1][0],A.v[A._length-1][1]]),R},vectorOnPath:function(b,S,A){b==1?b=this.v.c:b==0&&(b=.999);var P=this.pointOnPath(b,S),x=this.pointOnPath(b+.001,S),E=x[0]-P[0],_=x[1]-P[1],T=Math.sqrt(Math.pow(E,2)+Math.pow(_,2));if(T===0)return[0,0];var C=A==="tangent"?[E/T,_/T]:[-_/T,E/T];return C},tangentOnPath:function(b,S){return this.vectorOnPath(b,S,"tangent")},normalOnPath:function(b,S){return this.vectorOnPath(b,S,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([m],c),extendPrototype([m],u),u.prototype.getValueAtTime=l,u.prototype.initiateExpression=ExpressionManager.initiateExpression;var d=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(y,b,S,A,P){var x=d(y,b,S,A,P);return x.propertyIndex=b.ix,x.lock=!1,S===3?expressionHelpers.searchExpressions(y,b.pt,x):S===4&&expressionHelpers.searchExpressions(y,b.ks,x),x.k&&y.addDynamicProperty(x),x}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function i(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,t){var r=this.calculateExpression(t);if(e.t!==r){var s={};return this.copyData(s,e),s.t=r.toString(),s.__complete=!1,s}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),t=this.searchExpressions();return this.kf=e||t,this.kf},TextProperty.prototype.searchExpressions=i}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function i(e,t){var r=createNS("feMerge");r.setAttribute("result",e);var s,o;for(o=0;o=u?d=S<0?r:s:d=r+b*Math.pow((l-i)/S,1/t),m[y]=d,y+=1,o+=256/(a-1);return m.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(i){if(i||this.filterManager._mdf){var e,t=this.filterManager.effectElements;this.feFuncRComposed&&(i||t[3].p._mdf||t[4].p._mdf||t[5].p._mdf||t[6].p._mdf||t[7].p._mdf)&&(e=this.getTableValue(t[3].p.v,t[4].p.v,t[5].p.v,t[6].p.v,t[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(i||t[10].p._mdf||t[11].p._mdf||t[12].p._mdf||t[13].p._mdf||t[14].p._mdf)&&(e=this.getTableValue(t[10].p.v,t[11].p.v,t[12].p.v,t[13].p.v,t[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(i||t[17].p._mdf||t[18].p._mdf||t[19].p._mdf||t[20].p._mdf||t[21].p._mdf)&&(e=this.getTableValue(t[17].p.v,t[18].p.v,t[19].p.v,t[20].p.v,t[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(i||t[24].p._mdf||t[25].p._mdf||t[26].p._mdf||t[27].p._mdf||t[28].p._mdf)&&(e=this.getTableValue(t[24].p.v,t[25].p.v,t[26].p.v,t[27].p.v,t[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(i||t[31].p._mdf||t[32].p._mdf||t[33].p._mdf||t[34].p._mdf||t[35].p._mdf)&&(e=this.getTableValue(t[31].p.v,t[32].p.v,t[33].p.v,t[34].p.v,t[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(i,e,t,r,s){var o=e.container.globalData.renderConfig.filterSize,a=e.data.fs||o;i.setAttribute("x",a.x||o.x),i.setAttribute("y",a.y||o.y),i.setAttribute("width",a.width||o.width),i.setAttribute("height",a.height||o.height),this.filterManager=e;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",r+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,i.appendChild(l);var c=createNS("feOffset");c.setAttribute("dx","25"),c.setAttribute("dy","0"),c.setAttribute("in",r+"_drop_shadow_1"),c.setAttribute("result",r+"_drop_shadow_2"),this.feOffset=c,i.appendChild(c);var u=createNS("feFlood");u.setAttribute("flood-color","#00ff00"),u.setAttribute("flood-opacity","1"),u.setAttribute("result",r+"_drop_shadow_3"),this.feFlood=u,i.appendChild(u);var m=createNS("feComposite");m.setAttribute("in",r+"_drop_shadow_3"),m.setAttribute("in2",r+"_drop_shadow_2"),m.setAttribute("operator","in"),m.setAttribute("result",r+"_drop_shadow_4"),i.appendChild(m);var d=this.createMergeNode(r,[r+"_drop_shadow_4",s]);i.appendChild(d)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(i){if(i||this.filterManager._mdf){if((i||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),i||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((i||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),i||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var t=this.filterManager.effectElements[3].p.v,r=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=t*Math.cos(r),o=t*Math.sin(r);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",o)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(i,e,t){this.initialized=!1,this.filterManager=e,this.filterElem=i,this.elem=t,t.matteElement=createNS("g"),t.matteElement.appendChild(t.layerElement),t.matteElement.appendChild(t.transformedElement),t.baseElement=t.matteElement}SVGMatte3Effect.prototype.findSymbol=function(i){for(var e=0,t=_svgMatteSymbols.length;e-1&&i%1==0&&i-1&&i%1==0&&i<=MAX_SAFE_INTEGER}function isArrayLike(i){return i!=null&&isLength(i.length)&&!isFunction$1(i)}var objectProto$a=Object.prototype;function isPrototype(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||objectProto$a;return i===t}function baseTimes(i,e){for(var t=-1,r=Array(i);++t-1}function listCacheSet(i,e){var t=this.__data__,r=assocIndexOf(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}function ListCache(i){var e=-1,t=i==null?0:i.length;for(this.clear();++el))return!1;var u=o.get(i),m=o.get(e);if(u&&m)return u==e&&m==i;var d=-1,y=!0,b=t&COMPARE_UNORDERED_FLAG$1?new SetCache:void 0;for(o.set(i,e),o.set(e,i);++d{const t=i.__vccOpts||i;for(const[r,s]of e)t[r]=s;return t};const _sfc_main=defineComponent({props:{animationData:{type:Object,default:()=>({})},animationLink:{type:String,default:""},loop:{type:[Boolean,Number],default:!0},autoPlay:{type:Boolean,default:!0},width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:"100%"},speed:{type:Number,default:1},delay:{type:Number,default:0},direction:{type:String,default:"forward"},pauseOnHover:{type:Boolean,default:!1},playOnHover:{type:Boolean,default:!1},backgroundColor:{type:String,default:"transparent"},pauseAnimation:{type:Boolean,default:!1},renderer:{type:String,default:"svg"},rendererSettings:{type:Object,default:()=>({})},assetsPath:{type:String,default:""}},emits:{onComplete:null,onLoopComplete:null,onEnterFrame:null,onSegmentStart:null,onAnimationLoaded:null},setup(i,{emit:e}){let t=ref(null);const r=ref("");let s=1;const o=M=>document.querySelector('[data-id="'.concat(M,'"]'))!==null,a=async M=>{let D=i.autoPlay;i.playOnHover&&(D=!1);let H={};if(isEqual(i.animationData,{})===!1&&(H=cloneDeep(i.animationData)),i.animationLink!="")try{H=await(await fetch(i.animationLink)).json()}catch(z){console.error(z);return}let W=i.loop;typeof W=="number"&&W>0&&(W=W-1),i.delay>0&&(D=!1);const O={container:M,renderer:i.renderer,loop:W,autoplay:D,animationData:H,assetsPath:i.assetsPath};isEqual(i.rendererSettings,{})===!1&&(O.rendererSettings=i.rendererSettings),t=Lottie.loadAnimation(O),setTimeout(()=>{D=i.autoPlay,i.playOnHover?t.pause():D?t.play():t.pause(),e("onAnimationLoaded")},i.delay),t.setSpeed(i.speed),i.direction==="reverse"&&t.setDirection(-1),i.direction==="normal"&&t.setDirection(1),(i.pauseAnimation||i.playOnHover)&&t.pause(),t.addEventListener("loopComplete",()=>{i.direction==="alternate"&&(t.stop(),s=s*-1,t.setDirection(s),t.play()),e("onLoopComplete")}),t.addEventListener("complete",()=>{e("onComplete")}),t.addEventListener("enterFrame",()=>{e("onEnterFrame")}),t.addEventListener("segmentStart",()=>{e("onSegmentStart")})},l=computed(()=>{let M=i.width,D=i.height;return typeof i.width=="number"&&(M="".concat(i.width,"px")),typeof i.height=="number"&&(D="".concat(i.height,"px")),{"--lottie-animation-container-width":M,"--lottie-animation-container-height":D,"--lottie-animation-container-background-color":i.backgroundColor}}),c=()=>{t&&i.pauseOnHover&&t.pause(),t&&i.playOnHover&&t.play()},u=()=>{t&&i.pauseOnHover&&t.play(),t&&i.playOnHover&&t.pause()};watch(()=>i.pauseAnimation,()=>{if((i.pauseOnHover||i.playOnHover)&&i.pauseAnimation){console.error("If you are using pauseAnimation prop for Vue3-Lottie, please remove the props pauseOnHover and playOnHover");return}t&&(i.pauseAnimation?t.pause():t.play())});const m=()=>{t&&t.play()},d=()=>{t&&t.pause()},y=()=>{t&&t.stop()},b=()=>{t&&t.destroy()},S=(M=1)=>{if(M<=0)throw new Error("Speed must be greater than 0");t&&t.setSpeed(M)},A=M=>{t&&(M==="forward"?t.setDirection(1):M==="reverse"&&t.setDirection(-1))},P=(M,D=!0)=>{t&&t.goToAndStop(M,D)},x=(M,D=!0)=>{t&&t.goToAndPlay(M,D)},E=(M,D=!1)=>{t&&t.playSegments(M,D)},_=(M=!0)=>{t&&t.setSubframe(M)},T=(M=!0)=>{if(t)return t.getDuration(M)},C=(M,D=0)=>{t&&t.renderer.elements[D].updateDocumentData(M)},R=M=>{for(var D="",H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",W=H.length,O=0;O{if(i.pauseOnHover&&i.playOnHover)throw new Error("You cannot set pauseOnHover and playOnHover for Vue3-Lottie at the same time.");if(i.animationLink===""&&isEqual(i.animationData,{}))throw new Error("You must provide either animationLink or animationData");const D=setInterval(()=>{if(o(M)){clearInterval(D);const H=document.querySelector('[data-id="'.concat(M,'" ]'));H&&a(H)}},0)};return onMounted(async()=>{r.value=R(20),I(r.value)}),{elementid:r,hoverEnded:u,hoverStarted:c,getCurrentStyle:l,play:m,pause:d,stop:y,destroy:b,setSpeed:S,setDirection:A,goToAndStop:P,goToAndPlay:x,playSegments:E,setSubFrame:_,getDuration:T,updateDocumentData:C}}}),_hoisted_1=["data-id"];function _sfc_render(i,e,t,r,s,o){return openBlock(),createElementBlock("div",{"data-id":i.elementid,class:"lottie-animation-container",style:normalizeStyle(i.getCurrentStyle),onMouseenter:e[0]||(e[0]=(...a)=>i.hoverStarted&&i.hoverStarted(...a)),onMouseleave:e[1]||(e[1]=(...a)=>i.hoverEnded&&i.hoverEnded(...a))},null,44,_hoisted_1)}var Vue3Lottie=_export_sfc(_sfc_main,[["render",_sfc_render]]);const v="5.7.1",fr=25,ip=0,op=50,w=120,h=120,nm="转动",ddd=0,assets=[],layers=[{ddd:0,ind:1,ty:4,nm:"转动",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[60,60,0],ix:2},a:{a:0,k:[-16,-36,0],ix:1},s:{a:0,k:[23.737,23.737,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[447.14,447.14],ix:2},p:{a:0,k:[0,0],ix:3},nm:"椭圆路径 1",mn:"ADBE Vector Shape - Ellipse",hd:!1},{ty:"st",c:{a:0,k:[.125490196078,.741176470588,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:46,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"描边 1",mn:"ADBE Vector Graphic - Stroke",hd:!1},{ty:"tr",p:{a:0,k:[-16,-36],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"椭圆 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1},{ty:"tm",s:{a:0,k:0,ix:1},e:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0],e:[50]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:25,s:[50],e:[0]},{t:50}],ix:2},o:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0],e:[720]},{t:50}],ix:3},m:1,ix:2,nm:"修剪路径 1",mn:"ADBE Vector Filter - Trim",hd:!1}],ip:0,op:50,st:0,bm:0},{ddd:0,ind:2,ty:4,nm:"底",sr:1,ks:{o:{a:0,k:30,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[60,60,0],ix:2},a:{a:0,k:[-16,-36,0],ix:1},s:{a:0,k:[23.737,23.737,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[447.14,447.14],ix:2},p:{a:0,k:[0,0],ix:3},nm:"椭圆路径 1",mn:"ADBE Vector Shape - Ellipse",hd:!1},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:46,ix:5},lc:1,lj:1,ml:4,bm:0,nm:"描边 1",mn:"ADBE Vector Graphic - Stroke",hd:!1},{ty:"tr",p:{a:0,k:[-16,-36],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"椭圆 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:50,st:0,bm:0}],markers=[],loading={v,fr,ip,op,w,h,nm,ddd,assets,layers,markers},AbnormalPop=defineComponent({name:"abnormal-pop",props:{},emits:["close","confirm"],setup(i,{emit:e}){return()=>createVNode(Fragment,null,[evaluatingData.socketErrorStatus===0&&createVNode("div",{class:styles$3.fraction},[createVNode("img",{class:styles$3.close,src:popImgs.icon_close,onClick:()=>e("close")},null),createVNode("img",{class:styles$3.bg,src:popImgs.icon_bg},null),createVNode("div",{class:styles$3.content},[createVNode("div",{class:styles$3.title},[createTextVNode("您的网络连接异常")]),createVNode("div",{class:styles$3.desc},[createTextVNode("请确保网络正常后重新连接")])]),createVNode("div",null,[createVNode("img",{src:popImgs.icon_btn,class:styles$3.btn,onClick:()=>e("confirm",!0)},null)])]),evaluatingData.socketErrorStatus===1&&createVNode("div",{class:styles$3.loadColumn},[createVNode(Vue3Lottie,{class:styles$3.loadIcon,animationData:loading,loop:!0},null),createVNode("img",{class:styles$3.close,src:popImgs.icon_close,onClick:()=>e("close")},null),createVNode("p",null,[createTextVNode("正在连接服务器,请稍后…")])]),evaluatingData.socketErrorStatus===2&&createVNode("div",{class:styles$3.loadColumn},[createVNode("img",{class:styles$3.successIcon,src:popImgs.icon_success},null),createVNode("p",null,[createTextVNode("连接成功")])])])}}),icon_bg=""+new URL("icon_bg-026faf73.svg",import.meta.url).href,icon_close=""+new URL("icon_close-0f82fcc9.svg",import.meta.url).href,icon_btn=""+new URL("icon_btn-f3b09ea8.svg",import.meta.url).href,icon_success=""+new URL("icon_success-6e9ec0d6.svg",import.meta.url).href,browserInfo$1=browser();let socketStartTime=0;const popImgs={icon_bg,icon_close,icon_btn,icon_success},evaluatingData=reactive({contentData:{},rendered:!1,earphone:!1,soundEffect:!1,soundEffectFrequency:0,checkStep:0,checkEnd:!1,earphoneMode:!1,soundEffectMode:!1,websocketState:!1,startBegin:!1,backtime:0,evaluatings:{},resultData:{},resulstMode:!1,isComplete:!1,isDisabledPlayMusic:!1,socketErrorPop:!1,errorContents:"",socketErrorStatus:0,delayCheckSocketError:!1,isErrorState:!1,accompanyErrorType:"",isAudioPlayEnd:!1}),sendOffsetTime=async i=>{var t;const e=await api_getDeviceDelay();api_midiMicDelay({header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:i,micDelay:(t=e==null?void 0:e.content)==null?void 0:t.value}})},handleStartEvaluat=async()=>{var i;if(state$1.modeType==="evaluating")handleCancelEvaluat();else if(state$1.platform!=="PC"){const e=await api_checkSocketStatus();((i=e==null?void 0:e.content)==null?void 0:i.status)==="connected"&&handleStopPlay()}else handleStopPlay();state$1.modeType=state$1.modeType==="evaluating"?"practise":"evaluating",state$1.modeType!=="evaluating"&&(evaluatingData.rendered=!1)},startCheckDelay=async()=>{var e;const i=await api_checkSocketStatus();return((e=i==null?void 0:i.content)==null?void 0:e.status)==="connected"?new Promise(t=>{t({checked:!0})}):(socketStartTime=+new Date,evaluatingData.socketErrorPop=!0,evaluatingData.socketErrorStatus=1,new Promise(t=>{t({checked:!1})}))},check_currentTime=()=>{let i=0;if(state$1.isSelectMeasureMode&&(i=state$1.section[0].time*1e3),getAudioCurrentTime()*1e3-i>=500){sendEvaluatingOffsetTime(500);return}setTimeout(()=>{check_currentTime()},10)},sendEvaluatingOffsetTime=async i=>{if(!evaluatingData.backtime)return;const t=Date.now()-evaluatingData.backtime-i;console.error("真正播放延迟",t,"currentTime:",i),await api_proxyServiceMessage({header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:t<0?0:t,micDelay:0}})},checkUseEarphone=async()=>{var e;const i=await getEarphone();return((e=i==null?void 0:i.content)==null?void 0:e.checkIsWired)||!1},handleEndSoundCheck=()=>{endSoundCheck()},connectWebsocket=async i=>{evaluatingData.contentData=i,evaluatingData.websocketState=!0},handlePerformDetection=async()=>{if(!evaluatingData.checkEnd){if(evaluatingData.checkStep===0){if(evaluatingData.checkStep=5,state$1.setting.soundEffect){evaluatingData.soundEffectMode=!0;return}const i=await api_getDeviceDelay();if(console.log("🚀 ~ delayTime:",i),!i){evaluatingData.soundEffectMode=!0;return}handlePerformDetection();return}if(evaluatingData.checkStep=5){if(evaluatingData.checkStep=10,!await checkUseEarphone()){evaluatingData.earphoneMode=!0;return}handlePerformDetection();return}evaluatingData.checkStep===10&&(evaluatingData.checkEnd=!0)}},addMeasureScore=(i,e=!0)=>{for(let t in evaluatingData.evaluatings)evaluatingData.evaluatings[t].show=!1;evaluatingData.evaluatings[i.measureRenderIndex]={...i,leve:getLeveByScoreMeasure(i.score),show:e}},handleScoreResult=i=>{if(console.log("返回",i),i!=null&&i.content){const{header:e,body:t}=i.content;e.commond==="checking"&&(evaluatingData.soundEffectFrequency=t.frequency),(e==null?void 0:e.commond)==="measureScore"&&(console.log("🚀 ~ 评测返回:",i),addMeasureScore(t)),(e==null?void 0:e.commond)==="overall"&&(console.log("🚀 ~ 评测返回:",i),state$1.isHideEvaluatReportSaveBtn=!1,setTimeout(()=>{evaluatingData.resulstMode=!evaluatingData.isErrorState},200),evaluatingData.resultData={...t,...getLeveByScore(t.score)},closeToast())}},handleStartBegin=async i=>{var t,r;state$1.isAppPlay&&await api_cloudSetCurrentTime({currentTime:0,songID:state$1.examSongId}),evaluatingData.isComplete=!1,evaluatingData.evaluatings={},evaluatingData.resultData={},evaluatingData.backtime=0,resetPlaybackToStart(),evaluatingData.isAudioPlayEnd=!1;const e=await startEvaluating(evaluatingData.contentData);if((e==null?void 0:e.api)!=="startEvaluating"){Snackbar$1.error("请在APP端进行评测"),evaluatingData.startBegin=!1;return}if((t=e==null?void 0:e.content)!=null&&t.reson){showToast((r=e.content)==null?void 0:r.des),evaluatingData.startBegin=!1;return}if(evaluatingData.startBegin=!0,evaluatingData.isDisabledPlayMusic){if(state$1.playState=state$1.playState==="paused"?"play":"paused",state$1.playState==="play"&&state$1.needTick){const s=await handleStartTick();if(console.log("🚀 ~ tickend:",s),!s){state$1.playState="paused",evaluatingData.startBegin=!1;return}}onPlay()}evaluatingData.isErrorState||(await api_startRecordingCb({accompanimentState:state$1.setting.enableAccompaniment?1:0,firstNoteTime:i||0},()=>{state$1.isAppPlay&&setTimeout(()=>{sendOffsetTime(0)},300)}),state$1.setting.camera&&(console.log("开始录制视频"),await api_startCapture()),state$1.isAppPlay&&(await api_cloudChangeSpeed({speed:state$1.originSpeed,originalSpeed:state$1.originSpeed,songID:state$1.examSongId}),audioData$1.progress=0,audioListStart(state$1.playState)))},playMusic=async()=>{if(!await togglePlay("play")){evaluatingData.startBegin=!1,handleCancelEvaluat();return}check_currentTime(),state$1.setting.camera&&(console.log("开始录制视频"),api_startCapture())},recordStartTimePoint=async i=>{var t;if(console.error("开始录音"),!evaluatingData.startBegin)return;let e=((t=i==null?void 0:i.content)==null?void 0:t.inteveral)||0;browserInfo$1.ios&&(e*=1e3),evaluatingData.backtime=e||Date.now(),console.log("🚀 ~ 开始时间点:",evaluatingData.backtime,"已经录的时间:",Date.now()-e,"记录时间点:",Date.now()),!evaluatingData.isDisabledPlayMusic&&playMusic()},handleEndEvaluat=(i=!1)=>{!evaluatingData.startBegin||state$1.modeType!=="evaluating"||(console.log("评测结束1"),endEvaluating({musicScoreId:state$1.examSongId}),showLoadingToast({message:"评分中",duration:0,overlay:!0,overlayClass:styles$6.scoreMode}),setTimeout(()=>{evaluatingData.startBegin=!1},500),evaluatingData.isComplete=i,state$1.setting.camera&&(console.log("结束录制视频"),api_endCapture()))},handleEndBegin=()=>{handleEndEvaluat(),handleStopPlay()},handleCancelEvaluat=i=>{evaluatingData.evaluatings={},evaluatingData.startBegin=!1,closeToast(),api_proxyServiceMessage({header:{commond:"recordCancel",type:"SOUND_COMPARE",status:200}}),cancelEvaluating(),handleStopPlay(),console.log("评测结束2"),endEvaluating({musicScoreId:state$1.examSongId}),state$1.setting.camera&&(console.log("结束录制视频"),api_endCapture())},handleViewReport=(i,e)=>{var s;const t=((s=evaluatingData.resultData)==null?void 0:s[i])||"";let r="";switch(e){case"gym":r=location.origin+location.pathname+"#/report/"+t;break;case"orchestra":r=location.origin+location.pathname+"report-share.html?id="+t;break;case"instrument":r=location.origin+location.pathname+"#/evaluat-report?id="+t+"&musicRenderType="+state$1.musicRenderType;break;default:r=location.origin+location.pathname+"report-share.html?id="+t;break}api_openWebView({url:r,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0,c_orientation:0})},handleComplexButton=i=>{console.log("监听是否隐藏保存按钮",i),i!=null&&i.content&&(i.content,state$1.isHideEvaluatReportSaveBtn=!0)},handleAccompanyError=i=>{if(console.log("异常信息返回",i),i!=null&&i.content){const{type:e,reson:t}=i.content;switch(e){case"enterBackground":case"playError":case"socketError":if(evaluatingData.soundEffectMode){evaluatingData.socketErrorStatus=0,evaluatingData.delayCheckSocketError=!0,evaluatingData.socketErrorPop=e==="socketError",evaluatingData.accompanyErrorType=e;return}state$1.modeType==="evaluating"&&evaluatingData.startBegin&&handleCancelEvaluat(),tickData.show&&(tickData.tickEnd=!0,tickData.show=!1),evaluatingData.socketErrorStatus=0,evaluatingData.socketErrorPop=e==="socketError",evaluatingData.isErrorState=!0,evaluatingData.accompanyErrorType=e,resetPlaybackToStart();break}}},handleSocketStatus=i=>{var e;if(((e=i==null?void 0:i.content)==null?void 0:e.status)==="connected"){const t=+new Date;evaluatingData.delayCheckSocketError=!1;const r=t-socketStartTime;if(r<1e3){const s=1e3-r;console.log(s,99999),setTimeout(()=>{evaluatingData.socketErrorStatus=2},s)}}},hanldeConfirmPop=async()=>{api_checkSocketStatus(),evaluatingData.socketErrorStatus=1,socketStartTime=+new Date},hanldeClosePop=()=>{evaluatingData.socketErrorPop=!1,evaluatingData.socketErrorStatus=0},Evaluating=defineComponent({name:"evaluating",setup(){const i=usePageVisibility(),e=reactive({finger:!1,play_mode:"",enableAccompaniment:!0}),t=()=>{e.finger=state$1.setting.displayFingering,state$1.setting.displayFingering=!1,e.play_mode=state$1.playSource,e.enableAccompaniment=state$1.setting.enableAccompaniment,e.enableAccompaniment||(console.log("关闭伴奏"),toggleMutePlayAudio(e.play_mode==="music"?"music":"background",!0))},r=()=>{state$1.setting.displayFingering=e.finger,state$1.playSource=e.play_mode,e.enableAccompaniment||toggleMutePlayAudio(e.play_mode==="music"?"music":"background",!1)};return watch(i,s=>{s=="hidden"&&evaluatingData.startBegin}),watch(()=>evaluatingData.socketErrorStatus,()=>{evaluatingData.socketErrorStatus===2&&setTimeout(()=>{evaluatingData.socketErrorPop=!1},1e3)}),onMounted(()=>{resetPlaybackToStart(),t(),evaluatingData.resultData={},evaluatingData.evaluatings={},evaluatingData.soundEffectFrequency=0,evaluatingData.checkStep=0,evaluatingData.rendered=!0,sendResult(handleScoreResult),hideComplexButton(handleComplexButton,!0),api_recordStartTime(recordStartTimePoint),addAccompanyError(handleAccompanyError),addSocketStatus(handleSocketStatus),state$1.isSelectMeasureMode||clearSelection(),console.log("加载评测模块成功")}),onUnmounted(()=>{evaluatingData.checkEnd=!1,evaluatingData.rendered=!1,resetPlaybackToStart(),removeResult(handleScoreResult),hideComplexButton(()=>{},!1),api_remove_recordStartTime(recordStartTimePoint),r(),removeAccompanyError(handleAccompanyError),removeSocketStatus(handleSocketStatus),api_disconnectSocket(),console.log("卸载评测模块成功")}),()=>createVNode("div",null,[createVNode("div",{class:styles$6.hiddenPop},[createVNode("img",{src:popImgs.icon_bg},null),createVNode("img",{src:popImgs.icon_btn},null),createVNode("img",{src:popImgs.icon_success},null),createVNode("img",{src:popImgs.icon_close},null)]),createVNode(Popup,{teleport:"body",closeOnClickOverlay:!1,class:["popup-custom","van-scale"],transition:"van-scale",show:evaluatingData.socketErrorPop,"onUpdate:show":s=>evaluatingData.socketErrorPop=s},{default:()=>[createVNode(AbnormalPop,{onConfirm:hanldeConfirmPop,onClose:hanldeClosePop},null)]})])}}),scriptRel="modulepreload",assetsURL=function(i,e){return new URL(i,e).href},seen={},__vitePreload=function i(e,t,r){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=assetsURL(o,r),o in seen)return;seen[o]=!0;const a=o.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let m=s.length-1;m>=0;m--){const d=s[m];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector('link[href="'.concat(o,'"]').concat(l)))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":scriptRel,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((m,d)=>{u.addEventListener("load",m),u.addEventListener("error",()=>d(new Error("Unable to preload CSS for ".concat(o))))})})).then(()=>e()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})},relationships={flute:{59:[27,26,25,15,24,22,17,20],60:[27,26,25,15,24,22,17,20],61:[27,26,25,15,24,22,17,21],62:[27,26,25,15,24,22,17],63:[27,26,25,15,24,22,17,19],64:[27,26,25,15,24,22,19],65:[27,26,25,15,24,19],66:[27,26,25,15,17,19],67:[27,26,25,15,19],68:[27,26,25,15,18,19],69:[27,26,15,19],70:[[27,14,19],[27,24,15,19]],71:[27,15,19],72:[27,19],73:[19],74:[26,25,24,22,17,15],75:[26,25,24,22,17,19,15],76:[27,26,25,15,24,22,19],77:[27,26,25,15,24,19],78:[27,26,25,15,17,19],79:[27,26,25,15,19],80:[27,26,25,15,18,19],81:[27,26,15,19],82:[[27,14,19],[27,24,15,19]],83:[27,15,19],84:[27,19],85:[19],86:[26,25,15,19],87:[27,26,25,15,24,22,17,18,19],88:[27,26,15,24,22,19],89:[27,25,24,15,19],90:[27,25,17,15,19],91:[27,26,25,19],92:[26,25,18,19],93:[26,24,15,19],94:[23,24,15,19],95:[27,25,15,16],96:[27,26,25,18,24,19]},clarinet:{52:[[3,4,6,8,9,11,14,18,20],[3,4,6,8,9,11,14,20]],53:[[3,4,6,8,9,11,12,20],[3,4,6,8,9,11,18,20]],54:[[3,4,6,8,9,11,13,18,20],[3,4,6,8,9,11,13,20],[3,4,6,8,9,11,15]],55:[3,4,6,8,9,11,20],56:[3,4,6,8,9,11,16,20],57:[3,4,6,8,9,20],58:[3,4,6,8,20],59:[[3,4,6,9,20],[3,4,6,8,10,20]],60:[3,4,6,20],61:[3,4,6,7,20],62:[3,4,20],63:[[3,4,20,24],[3,4,5,20],[3,8,20]],64:[3,20],65:[20],66:[[3],[20,23,24]],67:[],68:[2],69:[1],70:[1,19],71:[[3,4,6,8,9,11,14,18,19,20],[3,4,6,8,9,11,14,19,20]],72:[[3,4,6,8,9,11,12,19,20],[3,4,6,8,9,11,18,19,20]],73:[[3,4,6,8,9,11,13,19,20],[3,4,6,8,9,11,13,18,19,20],[3,4,6,8,9,11,15,19,20]],74:[3,4,6,8,9,11,19,20],75:[3,4,6,8,9,11,16,19,20],76:[3,4,6,8,9,19,20],77:[3,4,6,8,19,20],78:[[3,4,6,9,19,20],[3,4,6,8,10,19,20]],79:[3,4,6,19,20],80:[3,4,6,7,19,20],81:[3,4,19,20],82:[[3,4,19,20,24],[3,4,5,19,20],[3,4,8,19,20]],83:[3,19,20],84:[19,20],85:[4,6,8,9,19,20],86:[4,6,8,16,19,20],87:[[4,6,8,10,16,19,20],[4,6,9,16,19,20]],88:[4,6,16,19,20],89:[4,6,7,16,19,20]},trumpet:{0:[1,2,3],54:[4,5,6],55:[4,2,6],56:[1,5,6],57:[4,5,3],58:[4,2,3],59:[1,5,3],60:[1,2,3],61:[4,5,6],62:[4,2,6],63:[1,5,6],64:[4,5,3],65:[4,2,3],66:[1,5,3],67:[1,2,3],68:[1,5,6],69:[4,5,3],70:[4,2,3],71:[1,5,3],72:[1,2,3],73:[4,5,3],74:[4,2,3],75:[1,5,3],76:[1,2,3],77:[4,2,3],78:[1,4,3],79:[1,2,3],80:[1,5,6],81:[4,5,3],82:[4,2,3],83:[1,5,3],84:[1,2,3]},horn:{53:[1],54:[2],55:[],56:[2,3],57:[1,2],58:[1],59:[2],60:[],61:[1,2],62:[1],63:[2],64:[],65:[1],66:[2],67:[],68:[0,2,3],69:[0,1,2],70:[0,1],71:[0,2],72:[0],73:[0,2,3],74:[0,1,2],75:[0,1],76:[0,2],77:[0],78:[0,2],79:[0],80:[0,2,3],81:[0,1,2],82:[0,1],83:[0,2],84:[0]},"up-bass-horn":{0:[1,2,3],40:[4,5,6],41:[4,2,6],42:[1,5,6],43:[4,5,3],44:[4,2,3],45:[1,5,3],46:[1,2,3],47:[4,5,6],48:[4,2,6],49:[1,5,6],50:[4,5,3],51:[4,2,3],52:[1,5,3],53:[1,2,3],54:[1,5,6],55:[4,5,3],56:[4,2,3],57:[1,5,3],58:[1,2,3],59:[4,5,3],60:[4,2,3],61:[1,5,3],62:[1,2,3],63:[4,2,3],64:[1,5,3],65:[1,2,3],66:[1,5,6],67:[4,5,3],68:[4,2,3],69:[1,5,3],70:[1,2,3]},trombone:{0:[1],40:[22],41:[11],42:[5],43:[4],44:[3],45:[2],46:[1],47:[22],48:[11],49:[5],50:[4],51:[3],52:[2],53:[1],54:[5],55:[4],56:[3],57:[2],58:[1],59:[4],60:[3],61:[2],62:[1],63:[3],64:[2],65:[1],66:[5],67:[4],68:[3],69:[2],70:[1]},saxophone:{58:[2,4,5,13,17,18,19,23],59:[2,4,5,11,17,18,19,23],60:[2,4,5,17,18,19,23],61:[2,4,5,12,17,18,19,23],62:[2,4,5,17,18,19],63:[2,4,5,17,18,19,22],64:[2,4,5,17,18],65:[2,4,5,17],66:[[2,4,5,18],[2,4,5,17,21]],67:[2,4,5],68:[2,4,5,10],69:[2,4],70:[[2,4,16],[2,17],[2,3]],71:[2],72:[[4],[2,15]],73:[],74:[2,4,5,6,17,18,19],75:[2,4,5,6,17,18,19,22],76:[2,4,5,6,17,18],77:[2,4,5,6,17],78:[[2,4,5,6,18],[2,4,5,6,17,21]],79:[2,4,5,6],80:[2,4,5,6,10],81:[2,4,6],82:[[2,4,6,16],[2,6,17],[2,3,6]],83:[2,6],84:[[4,6],[2,6,15]],85:[6],86:[6,9],87:[6,7,8],88:[6,8,9,14],89:[[6,7,8,9,14],[1,4,6]]},tuba:{0:[1,2,3],28:[4,5,6],29:[4,2,6],30:[1,5,6],31:[4,5,3],32:[4,2,3],33:[4,2,6],34:[1,2,3],35:[4,5,6],36:[4,2,6],37:[1,5,6],38:[4,5,3],39:[4,2,3],40:[1,5,3],41:[1,2,3],42:[1,5,6],43:[4,5,3],44:[4,2,3],45:[1,5,3],46:[1,2,3],47:[4,5,3],48:[4,2,3],49:[1,5,3],50:[1,2,3],51:[4,2,3],52:[1,5,3],53:[1,2,3],54:[1,5,6],55:[4,5,3],56:[4,2,3],57:[1,5,3],58:[1,2,3]},piccolo:{60:[11,2,33,4,5,6,7,8],61:[11,2,33,4,5,6,7,88],62:[11,2,33,4,5,6,7],63:[11,2,33,4,5,6,77],64:[11,2,33,4,5,6],65:[11,2,33,4,5],66:[11,2,33,4,6,7],67:[11,2,33,4],68:[11,2,33,5,6,77],69:[11,2,33],70:[[11,2,4,5],[1,11,2,4,6,7]],71:[[11,2],[11,33,4]],72:[11,33],73:[[2,33],[11]],74:[33],75:[33,4,5,6,7],76:[1,2,33,4,5,6],77:[1,2,33,4,5],78:[1,2,33,4,6,8],79:[1,2,33,4],80:[1,2,33,4,6,7,8],81:[1,2,33],82:[1,2,33,5,6,7],83:[1,2,33,5,6],84:[1,2,5,6],85:[1,2,4,5,7,8,100],86:[1,2,4,5,7,8]},"small-drum":{0:["active","active-left","active-right"],64:["left","right"]},hulusi:{64:[7,6,5,4,3,2,11,91],65:[7,6,5,4,3,2,1,91],66:[7,6,5,4,3,2,91],67:[7,6,5,4,3,2,11,92],68:[7,6,5,4,3,2,1,92],69:[7,6,5,4,3,2,93],70:[7,6,5,4,3,11,93],71:[7,6,5,4,3,93],72:[7,6,5,4,95],73:[7,6,5,3,2,95],74:[7,6,5,95],75:[7,6,4,3,95],76:[7,6,95],77:[7,5,4,3,2,94],78:[7,5,4,94],79:[7,94],80:[6,94],81:[96]},pan:{55:[21],57:[20],59:[19],60:[18],62:[17],64:[16],65:[15],67:[14],69:[13],71:[12],72:[11],74:[10],76:[9],77:[8],79:[7],81:[6],83:[5],84:[4],86:[3],88:[2],89:[1]},ocarina:{57:[1,2,3,4,5,6,7,8,9,10,11,12],58:[1,2,3,4,5,6,8,9,10,11,12],59:[1,2,4,5,6,7,8,9,10,11,12],60:[1,2,4,5,6,8,9,10,11,12],61:[1,2,4,5,6,7,8,9,11,12],62:[1,2,4,5,6,8,9,11,12],63:[1,2,4,5,6,9,11,12],64:[1,2,4,5,6,8,11,12],65:[1,2,4,5,6,11,12],66:[1,2,4,6,9,11,12],67:[1,2,4,6,11,12],68:[1,2,6,9,11,12],69:[1,2,6,11,12],70:[1,6,9,11,12],71:[1,6,11,12],72:[6,11,12],73:[6,9,12],74:[6,12],75:[6,9],76:[6],77:[]},melodica:{53:[1],54:[101],55:[2],56:[102],57:[3],58:[103],59:[4],60:[5],61:[104],62:[6],63:[105],64:[7],65:[8],66:[106],67:[9],68:[107],69:[10],70:[108],71:[11],72:[12],73:[109],74:[13],75:[110],76:[14],77:[15],78:[111],79:[16],80:[112],81:[17],82:[113],83:[18],84:[19]},baroqueRecorder:{60:[11,2,33,4,5,6,7,8],61:[11,2,33,4,5,6,7,88],62:[11,2,33,4,5,6,7],63:[11,2,33,4,5,6,77],64:[11,2,33,4,5,6],65:[11,2,33,4,5,7,8],66:[11,2,33,4,6,7],67:[11,2,33,4],68:[11,2,33,5,6,77],69:[11,2,33],70:[11,2,4,5],71:[11,2],72:[11,33],73:[2,33],74:[33],75:[33,4,5,6,7],76:[1,2,33,4,5,6],77:[1,2,33,4,5,7],78:[1,2,33,4,6],79:[1,2,33,4],80:[1,2,33,5],81:[1,2,33],82:[1,2,33,5,6,7],83:[1,2,33,5,6],84:[1,2,5,6],85:[1,2,4,5,7,8,100],86:[1,2,4,5,7,8],87:[1,2,4],88:[1,2,33,4,5,6],89:[1,2,33,4,5,7],90:[1,2,33,4,6],91:[1,2,33,4],92:[1,2,33,5],93:[1,2,33],94:[1,2,33,5,6,7],95:[1,2,33,5,6],96:[1,2,5,6],97:[1,2,4,5,7,8],98:[1,2,4]}},mappingVoicePart=(i,e)=>{if(e==="GYM")return Number(i);if(e==="COLEXIU")return{Flute:2,Clarinet:4,Trombone:14,Tuba:17,Trumpet:12,Horn:13,AltoSaxophone:6,TenorSaxophone:6,Saxophone:6,UpBassHorn:15,Melodica:137,HulusiFlute:136,PanFlute:135,Ocarina:134,Recorder:120,Ukulele:130,Mouthorgan:140,Piano:150}[i];if(e==="ORCHESTRA")return{1:23,2:2,3:5,4:4,5:12,6:14,7:13,8:15,9:17}[i];if(e==="INSTRUMENT"){let t=i;return typeof t=="string"&&(t=t.toLocaleLowerCase().replace(/ /g,"")),{flute:2,clarinet:4,trombone:14,tuba:17,trumpet:12,horn:13,altosaxophone:6,tenorsaxophone:6,saxophone:6,upbasshorn:15,melodica:137,hulusiFlute:136,panflute:135,recorder:120,ukulele:130,mouthorgan:140,piano:150,baroquerecorder:"baroque-recorder",4:"piccolo",3:"hulusi-flute",1:"pan-flute",2:"ocarina",5:"melodica",23:2,24:6,25:4,26:12,27:14,28:13,29:15,30:17,tenorrecorder:"piccolo",woodwind:"hulusi-flute",panpipes:"pan-flute",ocarina:"ocarina",nai:"melodica",15:"baroque-recorder",16:"baroque-recorder"}[t]||0}else if(e==="ENSEMBLE"){let t=i;const r={Piccolo:"piccolo",Flute:2,"Flute 1":2,"Flute 2":2,Oboe:1,"Clarinet in Bb 1":4,"Clarinet in Bb 2":4,"Alto Clarinet in Eb":4,"Bass Clarinet in Bb":4,Bassoon:1,"Alto Saxophone":5,"Tenor Saxophone":5,"Baritone Saxophone":5,"Trumpet in Bb 1":12,"Trumpet in Bb 2":12,"Horn in F":13,"Horn in F 1":13,"Horn in F 2":13,"Trombone 1":14,"Trombone 2":14,"Trombone 3":14,Euphonium:15,Tuba:17,Chimes:1,Bells:1,Xylophone:1,"Snare Drum":1,"Bass Drum":1,Triangle:1,"Suspended Cymbal":1,"Crash Cymbals":1,"Concert Toms":1,Timpani:1,flute:2,oboe:4,clarinet:4,trombone:14,tuba:17,trumpet:12,horn:13,altosaxophone:6,tenorsaxophone:6,saxophone:6,upbasshorn:15,melodica:137,hulusiFlute:136,panflute:135,recorder:120,ukulele:130,mouthorgan:140,piano:150,4:"piccolo",3:"hulusi-flute",1:"pan-flute",2:"ocarina",5:"melodica",26:12,tenorrecorder:"piccolo",woodwind:"hulusi-flute",panpipes:"pan-flute",ocarina:"ocarina",nai:"melodica",BaroqueRecorder:"baroque-recorder"};let s;if(typeof t=="string"){for(let o in r)if(o===t){s=r[o];break}}else s=r.code;return s}return 0},matchVoicePart=(i,e)=>{if(e==="SINGLE")return{33:"pan-flute",34:"ocarina",35:"hulusi-flute",37:"piccolo",36:"melodica",38:"baroque-recorder",1:2,5:5,3:4,11:12,13:14,12:13,14:15,16:17}[i];{let t=i;const r={Piccolo:"piccolo",Flute:2,"Flute 1":2,"Flute 2":2,Oboe:1,"Clarinet in Bb":4,"Clarinet in Bb 1":4,"Clarinet in Bb 2":4,"Alto Clarinet in Eb":4,"Bass Clarinet in Bb":4,Bassoon:1,"Alto Saxophone":5,"Tenor Saxophone":5,"Baritone Saxophone":5,"Trumpet in Bb 1":12,"Trumpet in Bb 2":12,"Horn in F":13,"Horn in F 1":13,"Horn in F 2":13,"Trombone 1":14,"Trombone 2":14,"Trombone 3":14,Euphonium:15,Tuba:17,Chimes:1,Bells:1,Xylophone:1,"Snare Drum":1,"Bass Drum":1,Triangle:1,"Suspended Cymbal":1,"Crash Cymbals":1,"Concert Toms":1,Timpani:1,flute:2,oboe:4,clarinet:4,trombone:14,tuba:17,trumpet:12,horn:13,altosaxophone:6,tenorsaxophone:6,saxophone:6,upbasshorn:15,melodica:137,hulusiFlute:136,panflute:135,recorder:120,ukulele:130,mouthorgan:140,piano:150,4:"piccolo",3:"hulusi-flute",1:"pan-flute",2:"ocarina",5:"melodica",26:12,tenorrecorder:"piccolo",woodwind:"hulusi-flute",panpipes:"pan-flute",ocarina:"ocarina",nai:"melodica",BaroqueRecorder:"baroque-recorder","Drum Set":24,Marimba:26,Vibraphone:27,"Tubular Bells":30,Mallets:32};let s;if(typeof t=="string"){t=t.toLocaleLowerCase().replace(/ /g,"");for(let o in r){let a=o;if(typeof o=="string"&&(a=a.toLocaleLowerCase().replace(/ /g,"")),a===t){s=r[o];break}}}else s=r.code;return s}},subjectFingering=i=>{switch(i){case 2:return{name:"flute",direction:"transverse",height:"1.6rem",hasTizhi:!0,id:1};case 4:return{name:"clarinet",direction:"vertical",width:"3rem",hasTizhi:!0,id:3};case 5:case 6:return{name:"saxophone",direction:"vertical",width:"4.34rem",hasTizhi:!0,id:5};case 12:return{name:"trumpet",direction:"transverse",height:"1.6rem",hasTizhi:!1,id:11};case 13:return{name:"horn",direction:"vertical",width:"4.98rem",hasTizhi:!1,id:12};case 14:return{name:"trombone",direction:"transverse",height:"1.6rem",hasTizhi:!1,id:13};case 15:return{name:"up-bass-horn",direction:"vertical",width:"4.34rem",hasTizhi:!1,id:14};case 17:return{name:"tuba",direction:"vertical",width:"4.34rem",hasTizhi:!1,id:16};case 120:return{name:"piccolo",direction:"vertical",width:"3rem",orientation:1,hasTizhi:!0,id:2};case"piccolo":return{name:"piccolo",direction:"vertical",width:"3rem",orientation:1,code:"竖笛",hasTizhi:!0,id:37};case"hulusi-flute":return{name:"hulusi-flute",direction:"vertical",width:"3rem",orientation:1,code:"葫芦丝",hasTizhi:!1,id:35};case"pan-flute":return{name:"pan-flute",direction:"transverse",height:"2rem",disabledFinger:!0,orientation:0,code:"排箫",hasTizhi:!1,id:33};case"ocarina":return{name:"ocarina",direction:"vertical",width:"3rem",disabledFinger:!0,orientation:0,code:"陶笛",hasTizhi:!1,id:34};case"melodica":return{name:"melodica",direction:"transverse",height:"2rem",orientation:0,code:"口风琴",hasTizhi:!1,id:36};case"baroque-recorder":return{name:"baroque-recorder",direction:"vertical",width:"3rem",orientation:1,code:"竖笛",hasTizhi:!0,id:38};default:return typeof i=="number"?{id:i}:{}}},getFingeringConfig=async i=>{switch(i){case"flute":return{json:(await __vitePreload(()=>import("./index-7f22768f.js"),[],import.meta.url)).default,relationship:relationships.flute,height:"60px",styles:{}};case"clarinet":return{json:(await __vitePreload(()=>import("./index-2499965c.js"),[],import.meta.url)).default,relationship:relationships.clarinet,styles:{marginLeft:".4rem",marginRight:".7rem"}};case"trumpet":return{json:(await __vitePreload(()=>import("./index-f01bef28.js"),[],import.meta.url)).default,relationship:relationships.trumpet};case"horn":return{json:(await __vitePreload(()=>import("./index-20c025d3.js"),[],import.meta.url)).default,relationship:relationships.horn,height:"212px",width:"252px"};case"tuba":return{json:(await __vitePreload(()=>import("./index-902205b3.js"),[],import.meta.url)).default,relationship:relationships.tuba};case"piccolo":return{json:(await __vitePreload(()=>import("./index-991877f6.js"),[],import.meta.url)).default,relationship:relationships.piccolo};case"piccolo1":return{json:(await __vitePreload(()=>import("./index-0bbf84fb.js"),[],import.meta.url)).default,relationship:relationships.piccolo};case"piccolo2":return{json:(await __vitePreload(()=>import("./index-f5dd9e1d.js"),[],import.meta.url)).default,relationship:relationships.piccolo};case"up-bass-horn":return{json:(await __vitePreload(()=>import("./index-ad5b3309.js"),[],import.meta.url)).default,relationship:relationships["up-bass-horn"]};case"trombone":return{json:(await __vitePreload(()=>import("./index-f23e3dbf.js"),[],import.meta.url)).default,relationship:relationships.trombone};case"saxophone":return{json:(await __vitePreload(()=>import("./index-cef965b9.js"),[],import.meta.url)).default,relationship:relationships.saxophone,styles:{marginLeft:".2rem",marginRight:".3rem"}};case"small-drum":return{json:(await __vitePreload(()=>import("./index-7ad0b9f0.js"),[],import.meta.url)).default,relationship:relationships["up-bass-horn"],width:"180px"};case"hulusi-flute":return{json:(await __vitePreload(()=>import("./index-71a277d3.js"),[],import.meta.url)).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"hulusi-flute1":return{json:(await __vitePreload(()=>import("./index-03bddf2b.js"),[],import.meta.url)).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"hulusi-flute2":return{json:(await __vitePreload(()=>import("./index-97e45cdd.js"),[],import.meta.url)).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"pan-flute":return{json:(await __vitePreload(()=>import("./index-0bc55d54.js"),[],import.meta.url)).default,relationship:relationships.pan};case"pan-flute1":return{json:(await __vitePreload(()=>import("./index-97c2723f.js"),[],import.meta.url)).default,relationship:relationships.pan};case"pan-flute2":return{json:(await __vitePreload(()=>import("./index-589cb412.js"),[],import.meta.url)).default,relationship:relationships.pan};case"pan-flute3":return{json:(await __vitePreload(()=>import("./index-e427d448.js"),[],import.meta.url)).default,relationship:relationships.pan};case"ocarina":return{json:(await __vitePreload(()=>import("./index-ecdafa29.js"),[],import.meta.url)).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"ocarina1":return{json:(await __vitePreload(()=>import("./index-1cca1c70.js"),[],import.meta.url)).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"ocarina2":return{json:(await __vitePreload(()=>import("./index-a1f8bc5d.js"),[],import.meta.url)).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"melodica":return{json:(await __vitePreload(()=>import("./index-55a98a41.js"),[],import.meta.url)).default,relationship:relationships.melodica,height:"80px",styles:{marginTop:"auto"}};case"melodica1":return{json:(await __vitePreload(()=>import("./index-b6d2ab3b.js"),[],import.meta.url)).default,relationship:relationships.melodica,height:"80px",styles:{marginTop:"auto"}};case"baroque-recorder":return{json:(await __vitePreload(()=>import("./index-7908a008.js"),[],import.meta.url)).default,relationship:relationships.baroqueRecorder};case"baroque-recorder1":return{json:(await __vitePreload(()=>import("./index-142fdf16.js"),[],import.meta.url)).default,relationship:relationships.baroqueRecorder};case"baroque-recorder2":return{json:(await __vitePreload(()=>import("./index-d13c0247.js"),[],import.meta.url)).default,relationship:relationships.baroqueRecorder};default:return null}};function autoCorrelate(i,e){for(var t=i.length,r=0,s=0;su[d+1];)d++;for(var y=-1,b=-1,s=d;sy&&(y=u[s],b=s);var S=b,A=u[S-1],P=u[S],x=u[S+1];let E=(A+x-2*P)/2,_=(x-A)/2;return E&&(S=S-_/(2*E)),e/S}const audioRecorder={audioContext:null,mediaRecorder:null,recordeState:!1,progress:i=>{},init(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)},toggleRecord(i){return new Promise((e,t)=>{i?navigator.mediaDevices.getUserMedia({audio:!0}).then(r=>{audioRecorder.mediaRecorder=r.getAudioTracks()[0],audioRecorder.recordeState=!0;const s=this.audioContext.createMediaStreamSource(r),o=this.audioContext.createAnalyser();o.fftSize=2048,s.connect(o);var a=new Float32Array(o.fftSize);const l=this.audioContext.sampleRate;function c(){if(!audioRecorder.recordeState)return;o.getFloatTimeDomainData(a);const u=autoCorrelate(a,l);audioRecorder.progress(u),setTimeout(()=>{c()},10)}c(),e(!0)}).catch(r=>{e(!1),console.error("Error accessing media devices:",r)}):audioRecorder.mediaRecorder.stop()})},checkSupport(){return new Promise((i,e)=>{if(navigator.mediaDevices.getUserMedia){const t={audio:!0};navigator.mediaDevices.getUserMedia(t).then(r=>{i(!0),console.log("授权成功!")},()=>{i(!1),console.error("授权失败!")})}else i(!1),console.error("浏览器不支持 getUserMedia")})}},studentQueryUserInfo=async()=>await request.get("/user/getUserInfo"),api_musicPracticeRecordSave=i=>request.post("/musicPracticeRecord/save",{requestType:"json",data:i}),api_lessonTrainingSubmitTraining=i=>request.post("/lessonTraining/submitTraining",{requestType:"json",data:i}),api_lessonTrainingTrainingStudentDetail=i=>request.get("/lessonTraining/trainingContentStudentDetail?id=".concat(i)),api_musicPracticeRecordVideoUpload=i=>request.post("/musicPracticeRecord/videoUpload",{data:i,requestType:"json"}),sysSuggestionAdd=i=>request.post("/sysSuggestion/save",{data:i,requestType:"json"}),api_musicPracticeRecordDetail=i=>request.get("/musicPracticeRecord/detail/"+i),api_subjectList=i=>request.post("/subject/list",{data:i,requestType:"json"}),api_musicSheetPage=i=>request.post("/musicSheet/page",{data:i,requestType:"json"}),getSuggestionList=i=>request.post("/sysSuggestionType/page",{data:i,requestType:"json"}),query$2=getQuery(),followData=reactive({list:[],index:0,start:!1,rendered:!1,earphone:!1}),handleRecord=i=>{if(query$2.isCbs)return;i<0&&(i=0);const e=i/1e3,t={clientType:storeData.user.clientType,musicSheetId:state$1.examSongId,sysMusicScoreId:state$1.examSongId,feature:"FOLLOW_UP_TRAINING",practiceSource:"FOLLOW_UP_TRAINING",playTime:e,deviceType:browser().android?"ANDROID":"IOS",behaviorId:getBehaviorId()};api_musicPracticeRecordSave(t)},toggleFollow=(i=!0)=>{state$1.modeType=state$1.modeType==="follow"?"practise":"follow",i||(followData.start=!1,openToggleRecord(!1))},noteFrequency=ref(0),audioFrequency=ref(0),followTime=ref(0),openToggleRecord=async(i=!0)=>{if(i||api_cloudToggleFollow(i?"start":"end"),i)followTime.value=Date.now();else{const e=Date.now()-followTime.value;followTime.value!==0&&e>0&&(handleRecord(e),followTime.value=0)}storeData.isApp||!await(audioRecorder==null?void 0:audioRecorder.toggleRecord(i))&&followData.start&&(followData.earphone=!0,followData.start=!1)},onClear=()=>{state$1.times.forEach(i=>{const e=document.querySelector("div[data-vf=vf".concat(i.id,"]"));e&&e.classList.remove("follow-up","follow-down","follow-error","follow-success");const t=document.getElementById("vf-".concat(i.id));t&&t.classList.remove("follow-up","follow-down")})},handleFollowStart=async()=>{var e;const i=await api_cloudToggleFollow("start");if(!((e=i==null?void 0:i.content)!=null&&e.reson)){if(followData.start=!0,!await handleStartTick())return followData.start=!1,!1;onClear(),followData.start=!0,followData.index=0,followData.list=[],resetPlaybackToStart(),openToggleRecord(!0),getNoteIndex();const r=getDuration(state$1.osmd);metronomeData.totalNumerator=r.numerator||2,metronomeData.followAudioIndex=1,state$1.beatStartTime=0,followBeatPaly()}},handleFollowEnd=()=>{onClear(),followData.start=!1,openToggleRecord(!1),followData.index=0,console.log("结束")},next=()=>{gotoNext(state$1.times[followData.index])},getNoteIndex=()=>{const i=state$1.times[followData.index];return i.frequency<=0?(followData.index=followData.index+1,next(),getNoteIndex()):(noteFrequency.value=i.frequency,{id:i.id,min:i.frequency-(i.frequency-i.prevFrequency)*.5,max:i.frequency+(i.nextFrequency-i.frequency)*.5,duration:i.duration,baseFrequency:i.frequency})};let checking=!1;const onFollowTime=i=>{var t;const e=(t=i==null?void 0:i.content)==null?void 0:t.frequency;followData.start&&e>0&&(audioFrequency.value=e,checked())};let startTime=0;const checked=()=>{if(checking)return;checking=!0;const i=getNoteIndex();if(audioFrequency.value=i.min&&audioFrequency.value<=i.max){if(startTime===0)startTime=Date.now();else if((Date.now()-startTime)/1e3>=i.duration*.6){startTime=0,followData.index=followData.index+1,setColor(i,"",!0),next(),checking=!1;return}}setColor(i,audioFrequency.value>i.baseFrequency?"follow-up":"follow-down"),checking=!1},setColor=(i,e,t=!1)=>{const r=document.querySelector("div[data-vf=vf".concat(i.id,"]"));r&&(r.classList.remove("follow-up","follow-down","follow-error","follow-success"),t?r.classList.add("follow-success"):r.classList.add("follow-error",e));const s=document.getElementById("vf-".concat(i.id));s&&(s.classList.remove("follow-up","follow-down"),e&&s.classList.add(e))},FollowPractice=defineComponent({name:"follow",setup(){return onMounted(async()=>{storeData.isApp?api_cloudFollowTime(onFollowTime):await audioRecorder.checkSupport()?(audioRecorder.init(),audioRecorder.progress=e=>{onFollowTime({api:"",content:{frequency:e}})}):followData.earphone=!0,console.log("进入跟练模式")}),onUnmounted(()=>{api_cloudFollowTime(onFollowTime,!1),resetPlaybackToStart(),onClear(),openToggleRecord(!1),console.log("退出跟练模式")}),()=>createVNode("div",null,null)}}),getMusicSheetDetail=i=>request.get("/musicSheet/cbsDetail/"+i),query$1=getQuery();var EnumMusicRenderType=(i=>(i.staff="staff",i.firstTone="firstTone",i.fixedTone="fixedTone",i))(EnumMusicRenderType||{});const musicscoresettingKey="musicscoresetting";var IPlatform=(i=>(i.APP="APP",i.PC="PC",i))(IPlatform||{});const classids=[1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,30,31,35,36,38,108,150,151,152,153,154,155,156,157,158,178,179,180,181,182],musicalInstrumentCodeInfo=[{name:"长笛",code:"Flute",id:1},{name:"短笛",code:"Piccolo",id:2},{name:"单簧管",code:"Clarinet",id:3},{name:"低音单簧管",code:"Bass Clarinet",id:4},{name:"中音萨克斯",code:"Alto Saxophone",id:5},{name:"次中音萨克斯",code:"Tenor Saxophone",id:6},{name:"高音萨克斯",code:"Soprano Saxophone",id:7},{name:"上低音萨克斯",code:"Baritone Saxophone",id:8},{name:"双簧管",code:"Oboe",id:9},{name:"大管",code:"Bassoon",id:10},{name:"小号",code:"Trumpet",id:11},{name:"圆号",code:"Horn",id:12},{name:"长号",code:"Trombone",id:13},{name:"上低音号",code:"Baritone",id:14},{name:"次中音号",code:"Euphonium",id:15},{name:"大号",code:"Tuba",id:16},{name:"钢琴",code:"Piano",id:17},{name:"电钢琴",code:"Electronical Piano",id:18},{name:"钢片琴",code:"Glockenspiel",id:19},{name:"小提琴",code:"Violin",id:20},{name:"中提琴",code:"Viola",id:21},{name:"大提琴",code:"Violoncello",id:22},{name:"低音提琴",code:"Contrabass",id:23},{name:"架子鼓",code:"Drum Set",id:24},{name:"小鼓",code:"Snare Drum",id:25},{name:"马林巴",code:"Marimba",id:26},{name:"颤音琴",code:"Vibraphone",id:27},{name:"钟琴",code:"Chimes",id:28},{name:"木琴",code:"Xylophone",id:29},{name:"管钟",code:"Tubular Bells",id:30},{name:"定音鼓",code:"Timpani",id:31},{name:"键盘",code:"Mallets",id:32},{name:"排箫",code:"Panpipes",id:33},{name:"陶笛",code:"Ocarina",id:34},{name:"葫芦丝",code:"Woodwind",id:35},{name:"口风琴",code:"Nai",id:36},{name:"德式竖笛",code:"Tenor Recorder",id:37},{name:"英式竖笛",code:"Baroque Recorder",id:38}],state=reactive({platform:"",appName:"",musicRenderType:"staff",musicRendered:!1,detailId:"",xmlUrl:"",subjectId:0,trackId:0,categoriesId:0,categoriesName:"",enableEvaluation:!0,enableNotation:!1,examSongId:"",cbsExamSongId:"",examSongName:"",coverImg:"",extConfigJson:{},extStyleConfigJson:{},isOpenMetronome:!1,isShowFingering:!1,music:"",accompany:"",midiUrl:"",parentCategoriesId:0,musicSheetCategoriesId:0,bizMusicCategoryId:0,playMode:"MP3",speed:0,originSpeed:0,playIngSpeed:0,track:"",partIndex:0,needTick:!1,osmd:null,isSpecialBookCategory:!1,playState:"paused",playEnd:!1,playSource:"music",playProgress:0,activeNoteIndex:0,activeMeasureIndex:0,sectionStatus:!1,section:[],sectionBoundingBoxs:[],isOpenPrepare:!1,sectionFirst:null,times:[],modeType:"practise",setting:{soundEffect:!0,eyeProtection:!1,camera:!1,cameraOpacity:70,repeatAutoPlay:!0,displayFingering:!0,displayCursor:!0,frequency:0,evaluationDifficulty:"ADVANCED",saveToAlbum:!0,enableAccompaniment:!0,reactionTimeMs:0,beatVolume:50},baseFrequency:440,fixtime:0,fingeringInfo:{},scrollContainer:"musicAndSelection",isPercussion:!1,evaluationStandard:"",repeatedBeats:0,partListNames:[],gradual:[],gradualVersion:GradualVersion.BASE,gradualTimes:null,multitrack:0,zoom:.8,musicZoom:1,isSelectMeasureMode:!1,isReport:!1,isHideEvaluatReportSaveBtn:!1,isConcert:!1,userChooseEndIndex:0,repeatInfo:[],canSelectTracks:[],subjectCodeId:0,musicalCodeId:0,musicalCode:"",isCombineRender:!1,measureTime:0,beatStartTime:0,isPreView:!1,isEvaluatReport:!1,midiPlayIniting:!1,songs:{},isAppPlay:!1,audiosInstance:null,durationNum:0,midiSectionStart:0});browser();let offset_duration=0;const customData=reactive({customNoteRealValue:[],customNoteCurrentTime:!1}),setStep=()=>{if(state.playState!=="play"){console.log("暂停播放");return}let i=Date.now();requestAnimationFrame(()=>{Date.now()-i<16.7?(handlePlaying(),setStep()):setTimeout(()=>{handlePlaying(),setStep()},16.7)})},onPlay=()=>{console.log("开始播放"),state.playEnd=!1,offset_duration=.2,setStep()},autoResetPlay=()=>{state.modeType==="practise"&&(skipNotePlay(0,!0),state.setting.repeatAutoPlay&&(scrollViewNote(),setTimeout(()=>{togglePlay("play")},1e3)))},onEnded=()=>{console.log("音频播放结束"),state.playEnd=!0,state.playState="paused",audioListStart(state.playState),handleEndEvaluat(!0),autoResetPlay()},handlePlaying=()=>{var r;const i=getAudioCurrentTime(),e=getAudioDuration();state.playProgress=i/e*100;let t=getNote(i);if(t&&state.modeType==="practise"&&state.playState==="play"&&t.measureSpeed&&t.measureSpeed!==state.playIngSpeed){const s=state.speed/state.originSpeed;state.playIngSpeed=Math.ceil(s*t.measureSpeed)||state.speed}else state.modeType==="practise"&&state.playState==="play"&&t&&!t.measureSpeed&&(state.playIngSpeed=state.speed);if(t){if(state.sectionStatus&&state.section.length===2){const s=state.sectionFirst?state.sectionFirst:state.section[0],o=state.section[1];if(state.repeatInfo.length){const a=verifyCanRepeat(state.section[0].MeasureNumberXML,state.section[1].MeasureNumberXML),l=a.repeatIdx==-1?0:a.repeatIdx;if(state.modeType==="practise"&&!a.canRepeat&&state.section[1].MeasureNumberXML>state.repeatInfo[l].end){const c=state.times[t.i-1];if(c&&c.MeasureNumberXML>t.MeasureNumberXML){const u=state.times.find(m=>m.MeasureNumberXML===c.MeasureNumberXML+1);if(u){setAudioCurrentTime(u.time,u.i),gotoNext(u);return}}}}if(i-o.endtime>offset_duration){if(console.log("选段播放结束",state.setting.repeatAutoPlay),state.modeType==="evaluating"&&state.isSelectMeasureMode){onEnded();return}if(state.modeType==="practise"&&state.sectionStatus){onEnded(),resetPlaybackToStart();return}t=s,setAudioCurrentTime(s.time,s.i)}}gotoNext(t)}(r=metronomeData.metro)==null||r.sound(i)},skipNotePlay=async(i,e=!1)=>{var s;const t=state.times[i];let r=t.time;e&&(r=0),t&&(setAudioCurrentTime(r,i),gotoNext(t),(s=metronomeData.metro)==null||s.sound(r),state.isAppPlay&&(await api_cloudSetCurrentTime({currentTime:r*1e3,songID:state.examSongId}),audioData$1.progress=r,state.midiSectionStart=r))},togglePlay=async i=>{if(state.isAppPlay){if(i==="paused"){await api_cloudSuspend({songID:state.examSongId}),state.playState="paused";return}await api_cloudChangeSpeed({speed:state.modeType==="evaluating"?state.originSpeed:state.speed,originalSpeed:state.originSpeed,songID:state.examSongId});const e=await api_cloudGetMediaStatus(),t=(e==null?void 0:e.content.status)==="suspend"?"play":"paused";state.playState=t}else state.playState=i||(state.playState==="paused"?"play":"paused");return state.playState==="play"&&state.sectionStatus&&state.section.length==2&&state.playProgress===0&&resetPlaybackToStart(),state.playState==="play"&&state.needTick&&!await handleStartTick()?(state.playState="paused",!1):(state.playState=="play"&&state.sectionStatus&&state.section.length<2&&clearSelection(),audioListStart(state.playState),!0)},handleStopPlay=()=>{state.playState="paused",audioListStart(state.playState)},resetPlaybackToStart=()=>{if(state.sectionStatus&&state.section.length===2){state.section=formateSelectMearure(state.section);return}skipNotePlay(0,!0)},gotoCustomNote=i=>{try{state.osmd.cursor.reset()}catch(e){}for(let e=0;e{(state.musicRenderType==="firstTone"||state.musicRenderType==="fixedTone")&&nextTick(()=>{var o,a,l,c;let t=i.bbox;if(!t){const m=(((o=document.getElementById("musicAndSelection"))==null?void 0:o.getBoundingClientRect())||{x:0,y:0}).x||0,d=document.querySelector("#vf-".concat((l=(a=i.svgElement)==null?void 0:a.attrs)==null?void 0:l.id));if(d){const y=d.querySelector(".vf-numbered-note-head"),b=(c=y==null?void 0:y.getBoundingClientRect)==null?void 0:c.call(y);b&&(i.bbox={left:b.x-m-b.width/4,width:b.width*1.5},t=i.bbox)}}if(!t)return;const r=state.platform==="PC"?29:18,s=(t.width-r)/3;e.cursorElement.style.left=t.left+"px",e.cursorElement.style.transform="translateX(".concat(s,"px)")})},gotoNext=i=>{const e=i.i;if(state.activeNoteIndex===i.i){try{setCursorPosition(i,state.osmd.cursor)}catch(s){console.log(s)}return}const t=state.osmd;let r=state.activeNoteIndex;if(state.activeNoteIndex=e,state.activeMeasureIndex=i.MeasureNumberXML,r&&e-r===1)t.cursor.next();else if(r&&e-r>0)for(;e-r>0;)r++,t.cursor.next();else gotoCustomNote(e);try{setCursorPosition(i,state.osmd.cursor)}catch(s){console.log(s)}scrollViewNote()},getNote=i=>{const e=state.times,t=state.times.length;if(i>e[t-1].endtime+2&&!state.isAppPlay){onEnded();return}let r=null;for(let s=state.activeNoteIndex;s=o.time)(!a||o.time!=a.time)&&(r=o);else break}return r},handleResetPlay=()=>{state.isAppPlay&&(audioData$1.progress=0),resetPlaybackToStart(),togglePlay("play")},handleSetSpeed=i=>{setStorageSpeed(state.examSongId,i),state.speed=i},clearSelection=()=>{state.sectionStatus=!1,state.section=[],closeToast()},handleChangeSection=()=>{if(state.sectionStatus){togglePlay("paused"),skipNotePlay(0,!0),clearSelection();return}state.sectionStatus=!0,state.sectionStatus&&togglePlay("paused"),showToast({message:"请选择开始小节",duration:0,position:"top",className:"selectionToast"})},formateSelectMearure=i=>{var l,c;if(!i.length)return[];const e=i.sort((u,m)=>u.time-m.time),t=(l=e[0])==null?void 0:l.measureOpenIndex,r=(c=e.last())==null?void 0:c.measureOpenIndex,s=state.times.filter(u=>t===u.measureOpenIndex)||[],o=state.times.filter(u=>r===u.measureOpenIndex)||[];if(!s.length||!o.length)return clearSelection(),[];e[0]=s[0],e[1]=o.last();let a=e[0].i;if(state.isOpenPrepare){const u=e[0].MeasureNumberXML;state.sectionFirst=state.times.find(m=>u-m.MeasureNumberXML===1),a=state.sectionFirst?state.sectionFirst.i:a}return skipNotePlay(a,a===0),e},handleSelection=i=>{!state.sectionStatus||state.section.length>1||(state.section.length!==2&&i&&(state.section.push(i),state.section.length===2&&(setSection(state.section[0].MeasureNumberXML,state.section[1].MeasureNumberXML),closeToast())),state.section.length===1&&showToast({message:"请选择结束小节",duration:0,position:"top",className:"selectionToast"}))},setSection=(i,e,t)=>{var S;const r=state.times.filter(A=>A.noteElement.sourceMeasure.MeasureNumberXML==i),s=state.times.filter(A=>A.noteElement.sourceMeasure.MeasureNumberXML==e),o=s[s.length-1].noteId;let a=s.filter(A=>A.noteId===o);const l=verifyCanRepeat(i,e);console.log(22222,l);const c=l.canRepeat;let u=e;const m=((S=state.repeatInfo[l.repeatIdx])==null?void 0:S.end)||0;for(;c&&a.length===1&&a[0].MeasureNumberXML<=m;){u=u-1;const A=state.times.filter(x=>x.noteElement.sourceMeasure.MeasureNumberXML==u),P=A[A.length-1].noteId;a=A.filter(x=>x.noteId===P)}const d=c&&l.repeatIdx==state.repeatInfo.length-1?a.length-1:0,y=r[0],b=a[d];y&&b&&(state.isSelectMeasureMode=!0,hanldeDirectSelection([y,b]),t&&handleSetSpeed(t))},hanldeDirectSelection=i=>{!Array.isArray(i)||i.length!==2||(state.sectionStatus=!0,setTimeout(()=>{state.section=formateSelectMearure(i)},500))};let offsetTop=0;const scrollViewNote=()=>{const i=document.getElementById("cursorImg-0"),e=document.getElementById(state.scrollContainer);!i||!e||offsetTop===i.offsetTop||(offsetTop=i.offsetTop,offsetTop>50?e.scrollTo({top:(offsetTop-50)*state.musicZoom,behavior:"smooth"}):e.scrollTo({top:0,behavior:"smooth"}))},isRhythmicExercises=()=>state.examSongName.indexOf("节奏练习")>-1,handleRessetState=()=>{skipNotePlay(0,!0),clearSelection(),state.isAppPlay&&(audioData$1.progress=0),state.modeType==="evaluating"?handleStartEvaluat():state.modeType==="practise"?togglePlay("paused"):state.modeType==="follow"&&toggleFollow(!1)},state$1=state,evaluatCreateMusicPlayer=()=>api_createMusicPlayer({musicSrc:state.accompany||state.music,tuneSrc:"https://oss.dayaedu.com/cloud-coach/1686725501654check_music1_(1).mp3"}),getMusicDetail=async i=>{const e=await getMusicSheetDetail(i);(e==null?void 0:e.code)===200&&getMusicInfo(e)},getMusicInfo=i=>{var o,a;const e=query$1["part-index"]?parseInt(query$1["part-index"]):0,t=((o=i.data.musicSheetSoundList)==null?void 0:o[e])||{},r=((a=i.data.musicSheetAccompanimentList)==null?void 0:a[0])||{},s={...i.data,music:t.audioFileUrl||"",accompany:r.audioFileUrl||"",musicSheetId:t.musicSheetId||i.data.bizId,track:t.track||""};console.log("🚀 ~ musicInfo:",s),setState(s,e)},setState=(i,e)=>{var m,d,y,b,S,A,P,x,E,_,T,C,R,I;state.appName="COLEXIU",state.detailId=i.bizId,state.xmlUrl=i.xmlFileUrl,state.partIndex=e,state.trackId=i.track,state.subjectId=i.subjectIds?(m=i.subjectIds.split(","))==null?void 0:m[0]:0;const t=i.subjectCodes?(d=i.subjectCodes.split(","))==null?void 0:d[0]:"";let r=i.musicalInstrumentIdCodes?(y=i.musicalInstrumentIdCodes.split(","))==null?void 0:y[0]:"";const s=musicalInstrumentCodeInfo.find(M=>M.code.toLocaleLowerCase()===t.toLocaleLowerCase()),o=musicalInstrumentCodeInfo.find(M=>M.code.toLocaleLowerCase()===r.toLocaleLowerCase());if(state.subjectCodeId=s?s.id:0,state.musicalCodeId=o?o.id:0,state.categoriesId=i.musicCategoryId,state.categoriesName=i.musicTagNames,state.examSongId=i.bizId+"",state.cbsExamSongId=i.id+"",state.examSongName=i.name,state.coverImg=(b=i.musicCover)!=null?b:"",state.isCombineRender=i.musicSheetType==="SINGLE"&&((S=i.musicSheetSoundList)==null?void 0:S.length)>1,setCustom(state.isCombineRender?(A=i.musicSheetSoundList)==null?void 0:A.length:0),i.extConfigJson)try{state.extConfigJson=JSON.parse(i.extConfigJson)}catch(M){console.error("解析扩展字段错误:",M)}state.gradualTimes=state.extConfigJson.gradualTimes,state.repeatedBeats=state.extConfigJson.repeatedBeats||0,state.needTick=!!(i.isUseSystemBeat&&i.isPlayBeat),state.isOpenMetronome=!!(i.isPlayBeat&&!i.isUseSystemBeat),state.isShowFingering=!!i.isShowFingering,state.isAppPlay=i.playMode==="MIDI",state.music=i.music,state.accompany=i.accompany,state.midiUrl=i.midiFileUrl,state.parentCategoriesId=i.musicTag,state.musicSheetCategoriesId=i.musicCategoryId,state.bizMusicCategoryId=i.bizMusicCategoryId,state.playMode=i.playMode==="MP3"?"MP3":"MIDI",state.originSpeed=state.speed=i.playSpeed;const a=i.code||i.track;state.track=a?a.replace(/ /g,"").toLocaleLowerCase():"",state.isAppPlay?state.enableEvaluation=!!state.midiUrl:state.enableEvaluation=!!state.accompany,state.isConcert=i.musicSheetType==="CONCERT",state.canSelectTracks=i.multiTracksSelection==="null"||i.multiTracksSelection===""||i.multiTracksSelection===null?[]:(P=i.multiTracksSelection)==null?void 0:P.split(","),state.isOpenPrepare=!0,state.extStyleConfigJson=i.extStyleConfigJson||{},state.isPercussion=i.evaluationStandard==="AMPLITUDE"||i.evaluationStandard==="DECIBELS",state.evaluationStandard=((x=i.evaluationStandard)==null?void 0:x.toLocaleLowerCase())||"",state.isSpecialBookCategory=!classids.includes(Number(i.musicCategoryId));const l=state.isConcert?matchVoicePart(state.trackId,"CONCERT"):matchVoicePart(state.musicalCodeId,"SINGLE");state.fingeringInfo=subjectFingering(l),console.log("🚀 ~ state.fingeringInfo:",l,state.fingeringInfo,state.trackId,state.track),state.musicalCodeId=((E=state.fingeringInfo)==null?void 0:E.id)||0,state.musicalCode=((_=musicalInstrumentCodeInfo.find(M=>M.id===state.musicalCodeId))==null?void 0:_.code)||state.trackId,window.DYSubjectId=state.musicalCodeId,window.customSectionAmount=!0,!state.fingeringInfo.name&&state.setting.displayFingering&&(state.setting.displayFingering=!1),(!state.music||!state.accompany)&&(state.playSource=state.music?"music":"background"),state.platform=((T=query$1.platform)==null?void 0:T.toLocaleUpperCase())||"",state.platform==="PC"&&(state.zoom=query$1.zoom||1.5);let c=null;state.isConcert?(r=(C=musicalInstrumentCodeInfo.find(M=>M.id===state.musicalCodeId))==null?void 0:C.code,c=(R=i.musicalInstruments)==null?void 0:R.find(M=>M.code===r)):c=(I=i.musicalInstruments)==null?void 0:I.find(M=>M.code===r);let u="";c!=null&&c.defaultScore&&(u=(c==null?void 0:c.defaultScore)==="STAVE"?"staff":(c==null?void 0:c.defaultScore)==="JIAN"?"fixedTone":(c==null?void 0:c.defaultScore)==="FIRST"?"firstTone":""),state.musicRenderType=query$1.musicRenderType||u||"firstTone",state.enableNotation=c?i.isConvertibleScore&&c.transferFlag:i.isConvertibleScore,console.log("state对象",state),state.baseFrequency=i.evaluationFrequency?i.evaluationFrequency.split(",")[0]:440,state.baseFrequency=Number(state.baseFrequency),Math.abs(state.setting.frequency-state.baseFrequency)>10?state.setting.frequency=state.baseFrequency>=0?state.baseFrequency:440:state.setting.frequency=state.setting.frequency||state.baseFrequency},setCustom=i=>{(i||state.extConfigJson.multitrack)&&setGlobalData("multitrack",i||state.extConfigJson.multitrack)},followBeatPaly=()=>{let i=null;if(!followData.start){clearTimeout(i),i=null;return}const e=state.measureTime*1e3/metronomeData.totalNumerator;requestAnimationFrame(()=>{var r;Date.now()-state.beatStartTime-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)r=new XMLHttpRequest;else if(ActiveXObject)r=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(new Error("XMLHttp not supported."));return r.timeout=t,new Promise((o,a)=>{r.onreadystatechange=()=>{r.readyState===XMLHttpRequest.DONE&&(r.status===200||r.status===0&&r.responseText?o(r.responseText):a(new Error("Could not retrieve requested URL "+r.status)))},r.ontimeout=l=>{a(new Error("Server request Timeout"))},r.overrideMimeType(s),r.open("GET",e,!0),r.send()})}}const _Fraction=class Je{constructor(e=0,t=1,r=0,s=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=e,this.denominator=t,this.wholeValue=r,s&&this.simplify(),this.setRealValue()}static max(e,t){return e.RealValue>t.RealValue?e:t}static Equal(e,t){return e.wholeValue===t.wholeValue&&e.Denominator===t.Denominator&&e.Numerator===t.Numerator}static createFromFraction(e){return new Je(e.numerator,e.denominator,e.wholeValue,!1)}static plus(e,t){const r=e.clone();return r.Add(t),r}static minus(e,t){const r=e.clone();return r.Sub(t),r}static multiply(e,t){return new Je((e.wholeValue*e.denominator+e.numerator)*(t.wholeValue*t.denominator+t.numerator),e.denominator*t.denominator)}static greatestCommonDenominator(e,t){if(e===0)return t;if(t===1)return 1;for(;Math.abs(t)>1e-8;)e>t?e-=t:t-=e;return Math.round(e)}toString(){let e=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(e=this.wholeValue+" "+e),e}clone(){return new Je(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(e){this.numerator!==e&&(this.numerator=e,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(e){this.denominator!==e&&(this.denominator=e,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(e){this.wholeValue!==e&&(this.wholeValue=e,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let e=1,t=2;const r=this.GetExpandedNumerator();for(;te;)t.Numerator++;if(this.numerator>this.denominator){const r=new Je(this.numerator-1,this.denominator,this.wholeValue);for(;r.Denominator>e;)r.Numerator--;if(r.DenominatorJe.maximumAllowedNumber){const r=this.denominator/Je.maximumAllowedNumber;this.numerator=Math.round(this.numerator/r),this.denominator=Math.round(this.denominator/r)}if(this.numerator>Je.maximumAllowedNumber){const r=this.numerator/Je.maximumAllowedNumber;this.numerator=Math.round(this.numerator/r),this.denominator=Math.round(this.denominator/r)}}isOnBeat(e){const t=this.distanceFromBeat(e);return Math.abs(t)(i[i.Above=0]="Above",i[i.Below=1]="Below",i[i.Left=2]="Left",i[i.Right=3]="Right",i[i.NotYetDefined=4]="NotYetDefined",i[i.AboveOrBelow=5]="AboveOrBelow",i))(PlacementEnum||{});const _ContinuousDynamicExpression=class xt extends AbstractExpression{constructor(e,t,r,s,o,a,l=""){super(t),super.parentMeasure=s,this.NumberXml=a,this.dynamicType=e,this.label=l,this.staffNumber=r,this.activeInstantaneousDynamic=o,this.startVolume=1,this.endVolume=1,this.setStartAndEndVolume(),l!==""&&this.setType()}setStartAndEndVolume(){this.activeInstantaneousDynamic&&(this.dynamicType===0&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*1.2),this.dynamicType===1&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*.8))}get DynamicType(){return this.dynamicType}set DynamicType(e){this.dynamicType=e}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(e){this.startMultiExpression=e}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(e){this.endMultiExpression=e}get Placement(){return this.placement}set Placement(e){this.placement=e}get StartVolume(){return this.startVolume}set StartVolume(e){this.startVolume=e}get EndVolume(){return this.endVolume}set EndVolume(e){this.endVolume=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get Label(){return this.label}set Label(e){this.label=e,this.setType()}static isInputStringContinuousDynamic(e){return e?xt.isStringInStringList(xt.listContinuousDynamicIncreasing,e)||xt.isStringInStringList(xt.listContinuousDynamicDecreasing,e):!1}getInterpolatedDynamic(e){const t=this.StartMultiExpression.AbsoluteTimestamp;let r;if(this.EndMultiExpression?r=this.EndMultiExpression.AbsoluteTimestamp:r=Fraction$1.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),e.lt(t))return-1;if(r.lt(e))return-2;const s=Fraction$1.minus(e,t).RealValue/Fraction$1.minus(r,t).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*s))}isWedge(){return!this.label}setType(){xt.isStringInStringList(xt.listContinuousDynamicIncreasing,this.label)?this.dynamicType=0:xt.isStringInStringList(xt.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=1)}};_ContinuousDynamicExpression.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."];_ContinuousDynamicExpression.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];let ContinuousDynamicExpression=_ContinuousDynamicExpression;var ContDynamicEnum=(i=>(i[i.crescendo=0]="crescendo",i[i.diminuendo=1]="diminuendo",i))(ContDynamicEnum||{}),DynamicExpressionSymbolEnum=(i=>(i[i.p=0]="p",i[i.f=1]="f",i[i.s=2]="s",i[i.z=3]="z",i[i.m=4]="m",i[i.r=5]="r",i))(DynamicExpressionSymbolEnum||{});class MusicSheetReadingException{constructor(e,t){this.message=e,t&&(this.message+=" "+t.toString())}}class ArgumentOutOfRangeException{constructor(e){this.message=e}}class InvalidEnumArgumentException{constructor(e){this.message=e}}var loglevel={exports:{}};(function(i){(function(e,t){i.exports?i.exports=t():e.log=t()})(commonjsGlobal,function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"];function o(A,P){var x=A[P];if(typeof x.bind=="function")return x.bind(A);try{return Function.prototype.bind.call(x,A)}catch(E){return function(){return Function.prototype.apply.apply(x,[A,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(A){return A==="debug"&&(A="log"),typeof console===t?!1:A==="trace"&&r?a:console[A]!==void 0?o(console,A):console.log!==void 0?o(console,"log"):e}function c(A,P){for(var x=0;x=0&&D<=E.levels.SILENT){if(_=D,H!==!1&&C(D),c.call(E,D,A),typeof console===t&&D"u"}i.isUndefined=l;function c(d){return Object.prototype.toString.call(d)==="[object String]"}i.isString=c;function u(d){return l(d)||!a(d)?function(y,b){return y=0;o--)if(r(i[o],e))return o;return-1}arrays$4.lastIndexOf=lastIndexOf;function contains(i,e,t){return indexOf$1(i,e,t)>=0}arrays$4.contains=contains;function remove(i,e,t){var r=indexOf$1(i,e,t);return r<0?!1:(i.splice(r,1),!0)}arrays$4.remove=remove;function frequency(i,e,t){for(var r=t||util$a.defaultEquals,s=i.length,o=0,a=0;a=i.length||t<0||t>=i.length)return!1;var r=i[e];return i[e]=i[t],i[t]=r,!0}arrays$4.swap=swap;function toString$1(i){return"["+i.toString()+"]"}arrays$4.toString=toString$1;function forEach(i,e){for(var t=0,r=i;te.size())return!1;var t=!0;return this.forEach(function(r){return e.contains(r)?!0:(t=!1,!1)}),t},i.prototype.remove=function(e){return this.contains(e)?(this.dictionary.remove(e),!0):!1},i.prototype.forEach=function(e){this.dictionary.forEach(function(t,r){return e(r)})},i.prototype.toArray=function(){return this.dictionary.values()},i.prototype.isEmpty=function(){return this.dictionary.isEmpty()},i.prototype.size=function(){return this.dictionary.size()},i.prototype.clear=function(){this.dictionary.clear()},i.prototype.toString=function(){return arrays$3.toString(this.toArray())},i}();_Set.default=Set$1;Object.defineProperty(Bag$1,"__esModule",{value:!0});var util$7=util$b,Dictionary_1$4=Dictionary$2,Set_1$1=_Set,Bag=function(){function i(e){this.toStrF=e||util$7.defaultToString,this.dictionary=new Dictionary_1$4.default(this.toStrF),this.nElements=0}return i.prototype.add=function(e,t){if(t===void 0&&(t=1),util$7.isUndefined(e)||t<=0)return!1;if(this.contains(e))this.dictionary.getValue(e).copies+=t;else{var r={value:e,copies:t};this.dictionary.setValue(e,r)}return this.nElements+=t,!0},i.prototype.count=function(e){return this.contains(e)?this.dictionary.getValue(e).copies:0},i.prototype.contains=function(e){return this.dictionary.containsKey(e)},i.prototype.remove=function(e,t){if(t===void 0&&(t=1),util$7.isUndefined(e)||t<=0)return!1;if(this.contains(e)){var r=this.dictionary.getValue(e);return t>r.copies?this.nElements-=r.copies:this.nElements-=t,r.copies-=t,r.copies<=0&&this.dictionary.remove(e),!0}else return!1},i.prototype.toArray=function(){for(var e=[],t=this.dictionary.values(),r=0,s=t;rthis.nElements||util$6.isUndefined(e))return!1;var r=this.createNode(e);if(this.nElements===0||this.lastNode===null)this.firstNode=r,this.lastNode=r;else if(t===this.nElements)this.lastNode.next=r,this.lastNode=r;else if(t===0)r.next=this.firstNode,this.firstNode=r;else{var s=this.nodeAtIndex(t-1);if(s===null)return!1;r.next=s.next,s.next=r}return this.nElements++,!0},i.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},i.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},i.prototype.elementAtIndex=function(e){var t=this.nodeAtIndex(e);if(t!==null)return t.element},i.prototype.indexOf=function(e,t){var r=t||util$6.defaultEquals;if(util$6.isUndefined(e))return-1;for(var s=this.firstNode,o=0;s!==null;){if(r(s.element,e))return o;o++,s=s.next}return-1},i.prototype.contains=function(e,t){return this.indexOf(e,t)>=0},i.prototype.remove=function(e,t){var r=t||util$6.defaultEquals;if(this.nElements<1||util$6.isUndefined(e))return!1;for(var s=null,o=this.firstNode;o!==null;){if(r(o.element,e))return s===null?(this.firstNode=o.next,o===this.lastNode&&(this.lastNode=null)):o===this.lastNode?(this.lastNode=s,s.next=o.next,o.next=null):(s.next=o.next,o.next=null),this.nElements--,!0;s=o,o=o.next}return!1},i.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},i.prototype.equals=function(e,t){var r=t||util$6.defaultEquals;return!(e instanceof i)||this.size()!==e.size()?!1:this.equalsAux(this.firstNode,e.firstNode,r)},i.prototype.equalsAux=function(e,t,r){for(;e!==null&&t!==null;){if(!r(e.element,t.element))return!1;e=e.next,t=t.next}return!0},i.prototype.removeElementAtIndex=function(e){if(!(e<0||e>=this.nElements||this.firstNode===null||this.lastNode===null)){var t;if(this.nElements===1)t=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var r=this.nodeAtIndex(e-1);r===null?(t=this.firstNode.element,this.firstNode=this.firstNode.next):r.next===this.lastNode&&(t=this.lastNode.element,this.lastNode=r),r!==null&&r.next!==null&&(t=r.next.element,r.next=r.next.next)}return this.nElements--,t}},i.prototype.forEach=function(e){for(var t=this.firstNode;t!==null&&e(t.element)!==!1;)t=t.next},i.prototype.reverse=function(){for(var e=null,t=this.firstNode,r=null;t!==null;)r=t.next,t.next=e,e=t,t=r;r=this.firstNode,this.firstNode=this.lastNode,this.lastNode=r},i.prototype.toArray=function(){for(var e=[],t=this.firstNode;t!==null;)e.push(t.element),t=t.next;return e},i.prototype.size=function(){return this.nElements},i.prototype.isEmpty=function(){return this.nElements<=0},i.prototype.toString=function(){return arrays$2.toString(this.toArray())},i.prototype.nodeAtIndex=function(e){if(e<0||e>=this.nElements)return null;if(e===this.nElements-1)return this.lastNode;for(var t=this.firstNode,r=0;r0&&(e=e.rightCh);return e},i.prototype.transplant=function(e,t){e.parent===null?this.root=t:e===e.parent.leftCh?e.parent.leftCh=t:e.parent.rightCh=t,t!==null&&(t.parent=e.parent)},i.prototype.removeNode=function(e){if(e.leftCh===null)this.transplant(e,e.rightCh);else if(e.rightCh===null)this.transplant(e,e.leftCh);else{var t=this.minimumAux(e.rightCh);t.parent!==e&&(this.transplant(t,t.rightCh),t.rightCh=e.rightCh,t.rightCh.parent=t),this.transplant(e,t),t.leftCh=e.leftCh,t.leftCh.parent=t}},i.prototype.inorderTraversalAux=function(e,t,r){e===null||r.stop||(this.inorderTraversalAux(e.leftCh,t,r),!r.stop&&(r.stop=t(e.element)===!1,!r.stop&&this.inorderTraversalAux(e.rightCh,t,r)))},i.prototype.levelTraversalAux=function(e,t){var r=new Queue_1$1.default;for(e!==null&&r.enqueue(e),e=r.dequeue()||null;e!=null;){if(t(e.element)===!1)return;e.leftCh!==null&&r.enqueue(e.leftCh),e.rightCh!==null&&r.enqueue(e.rightCh),e=r.dequeue()||null}},i.prototype.preorderTraversalAux=function(e,t,r){e===null||r.stop||(r.stop=t(e.element)===!1,!r.stop&&(this.preorderTraversalAux(e.leftCh,t,r),!r.stop&&this.preorderTraversalAux(e.rightCh,t,r)))},i.prototype.postorderTraversalAux=function(e,t,r){e===null||r.stop||(this.postorderTraversalAux(e.leftCh,t,r),!r.stop&&(this.postorderTraversalAux(e.rightCh,t,r),!r.stop&&(r.stop=t(e.element)===!1)))},i.prototype.minimumAux=function(e){for(;e!=null&&e.leftCh!==null;)e=e.leftCh;return e},i.prototype.maximumAux=function(e){for(;e!=null&&e.rightCh!==null;)e=e.rightCh;return e},i.prototype.heightAux=function(e){return e===null?-1:Math.max(this.heightAux(e.leftCh),this.heightAux(e.rightCh))+1},i.prototype.insertNode=function(e){for(var t=null,r=this.root;r!==null;){var s=this.compare(e.element,r.element);if(s===0)return null;s<0?(t=r,r=r.leftCh):(t=r,r=r.rightCh)}return e.parent=t,t===null?this.root=e:this.compare(e.element,t.element)<0?t.leftCh=e:t.rightCh=e,e},i.prototype.createNode=function(e){return{element:e,leftCh:null,rightCh:null,parent:null}},i}();BSTreeKV$1.default=BSTreeKV;var __extends$2=commonjsGlobal&&commonjsGlobal.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(e,t){i(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(BSTree$1,"__esModule",{value:!0});var BSTreeKV_1$1=BSTreeKV$1,BSTree=function(i){__extends$2(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return e}(BSTreeKV_1$1.default);BSTree$1.default=BSTree;var Heap$1={};Object.defineProperty(Heap$1,"__esModule",{value:!0});var collections=util$b,arrays$1=arrays$4,Heap=function(){function i(e){this.data=[],this.compare=e||collections.defaultCompare}return i.prototype.leftChildIndex=function(e){return 2*e+1},i.prototype.rightChildIndex=function(e){return 2*e+2},i.prototype.parentIndex=function(e){return Math.floor((e-1)/2)},i.prototype.minIndex=function(e,t){return t>=this.data.length?e>=this.data.length?-1:e:this.compare(this.data[e],this.data[t])<=0?e:t},i.prototype.siftUp=function(e){for(var t=this.parentIndex(e);e>0&&this.compare(this.data[t],this.data[e])>0;)arrays$1.swap(this.data,t,e),e=t,t=this.parentIndex(e)},i.prototype.siftDown=function(e){for(var t=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e));t>=0&&this.compare(this.data[e],this.data[t])>0;)arrays$1.swap(this.data,t,e),e=t,t=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e))},i.prototype.peek=function(){if(this.data.length>0)return this.data[0]},i.prototype.add=function(e){return collections.isUndefined(e)?!1:(this.data.push(e),this.siftUp(this.data.length-1),!0)},i.prototype.removeRoot=function(){if(this.data.length>0){var e=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),e}},i.prototype.contains=function(e){var t=collections.compareToEquals(this.compare);return arrays$1.contains(this.data,e,t)},i.prototype.size=function(){return this.data.length},i.prototype.isEmpty=function(){return this.data.length<=0},i.prototype.clear=function(){this.data.length=0},i.prototype.forEach=function(e){arrays$1.forEach(this.data,e)},i}();Heap$1.default=Heap;var LinkedDictionary$1={},__extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(e,t){i(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(LinkedDictionary$1,"__esModule",{value:!0});var Dictionary_1$3=Dictionary$2,util$4=util$b,LinkedDictionaryPair=function(){function i(e,t){this.key=e,this.value=t}return i.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},i}(),HeadOrTailLinkedDictionaryPair=function(){function i(){this.key=null,this.value=null}return i.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},i}();function isHeadOrTailLinkedDictionaryPair(i){return!i.next}var LinkedDictionary=function(i){__extends$1(e,i);function e(t){var r=i.call(this,t)||this;return r.head=new HeadOrTailLinkedDictionaryPair,r.tail=new HeadOrTailLinkedDictionaryPair,r.head.next=r.tail,r.tail.prev=r.head,r}return e.prototype.appendToTail=function(t){var r=this.tail.prev;r.next=t,t.prev=r,t.next=this.tail,this.tail.prev=t},e.prototype.getLinkedDictionaryPair=function(t){if(!util$4.isUndefined(t)){var r="$"+this.toStr(t),s=this.table[r];return s}},e.prototype.getValue=function(t){var r=this.getLinkedDictionaryPair(t);if(!util$4.isUndefined(r))return r.value},e.prototype.remove=function(t){var r=this.getLinkedDictionaryPair(t);if(!util$4.isUndefined(r))return i.prototype.remove.call(this,t),r.unlink(),r.value},e.prototype.clear=function(){i.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},e.prototype.replace=function(t,r){var s="$"+this.toStr(r.key);r.next=t.next,r.prev=t.prev,this.remove(t.key),r.prev.next=r,r.next.prev=r,this.table[s]=r,++this.nElements},e.prototype.setValue=function(t,r){if(!(util$4.isUndefined(t)||util$4.isUndefined(r))){var s=this.getLinkedDictionaryPair(t),o=new LinkedDictionaryPair(t,r),a="$"+this.toStr(t);if(util$4.isUndefined(s)){this.appendToTail(o),this.table[a]=o,++this.nElements;return}else return this.replace(s,o),s.value}},e.prototype.keys=function(){var t=[];return this.forEach(function(r,s){t.push(r)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(r,s){t.push(s)}),t},e.prototype.forEach=function(t){for(var r=this.head.next;!isHeadOrTailLinkedDictionaryPair(r);){var s=t(r.key,r.value);if(s===!1)return;r=r.next}},e}(Dictionary_1$3.default);LinkedDictionary$1.default=LinkedDictionary;var MultiDictionary$1={};Object.defineProperty(MultiDictionary$1,"__esModule",{value:!0});var util$3=util$b,Dictionary_1$2=Dictionary$2,arrays=arrays$4,MultiDictionary=function(){function i(e,t,r){r===void 0&&(r=!1),this.dict=new Dictionary_1$2.default(e),this.equalsF=t||util$3.defaultEquals,this.allowDuplicate=r}return i.prototype.getValue=function(e){var t=this.dict.getValue(e);return util$3.isUndefined(t)?[]:arrays.copy(t)},i.prototype.setValue=function(e,t){if(util$3.isUndefined(e)||util$3.isUndefined(t))return!1;var r=this.dict.getValue(e);return util$3.isUndefined(r)?(this.dict.setValue(e,[t]),!0):!this.allowDuplicate&&arrays.contains(r,t,this.equalsF)?!1:(r.push(t),!0)},i.prototype.remove=function(e,t){if(util$3.isUndefined(t)){var r=this.dict.remove(e);return!util$3.isUndefined(r)}var s=this.dict.getValue(e);return!util$3.isUndefined(s)&&arrays.remove(s,t,this.equalsF)?(s.length===0&&this.dict.remove(e),!0):!1},i.prototype.keys=function(){return this.dict.keys()},i.prototype.values=function(){for(var e=this.dict.values(),t=[],r=0,s=e;r-1&&this.insertIdIntoRoot(t,r);for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)){var o=this.findNodeId(s,e);o>-1&&this.insertIdIntoNode(s,t,o)}},i.prototype.insertIdAfterId=function(e,t){var r=this.findRootId(e);r>-1&&this.insertIdIntoRoot(t,r+1);for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)){var o=this.findNodeId(s,e);o>-1&&this.insertIdIntoNode(s,t,o+1)}},i.prototype.insertIdIntoId=function(e,t){this.nodeInsertAtEnd(e,t),this.nodes[t]=[]},i.prototype.insertIdIntoRoot=function(e,t){if(t===void 0)this.rootInsertAtEnd(e);else if(t<0){var r=this.rootIds.length;this.rootIds.splice(t+r+1,0,e)}else this.rootIds.splice(t,0,e);this.nodes[e]=this.nodes[e]||[]},i.prototype.insertIdIntoNode=function(e,t,r){if(this.nodes[e]=this.nodes[e]||[],this.nodes[t]=this.nodes[t]||[],r===void 0)this.nodeInsertAtEnd(e,t);else if(r<0){var s=this.nodes[e].length;this.nodes[e].splice(r+s+1,0,t)}else this.nodes[e].splice(r,0,t)},i.prototype.moveId=function(e,t,r){var s=e,o=this.findRootId(s);this.nodes[t];for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,t);break}var l=t,c=this.findRootId(l);this.nodes[t];for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,t);break}if(o>-1)if(c>-1)switch(this.rootDelete(o),c>o&&c--,r){case Direction.BEFORE:this.insertIdIntoRoot(s,c);break;case Direction.AFTER:this.insertIdIntoRoot(s,c+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}else{this.rootDelete(o);for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,l);if(u>-1){switch(r){case Direction.BEFORE:this.insertIdIntoNode(a,s,u);break;case Direction.AFTER:this.insertIdIntoNode(a,s,u+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}break}}}else if(c>-1){for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,s);if(u>-1){this.nodeDeleteAtIndex(a,u);break}}switch(r){case Direction.BEFORE:this.insertIdIntoRoot(s,c);break;case Direction.AFTER:this.insertIdIntoRoot(s,c+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}}else{for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,s);if(u>-1){this.nodeDeleteAtIndex(a,u);break}}for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,l);if(u>-1){switch(r){case Direction.BEFORE:this.insertIdIntoNode(a,s,u);break;case Direction.AFTER:this.insertIdIntoNode(a,s,u+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}break}}}},i.prototype.swapArrayElements=function(e,t,r){var s=e[t];return e[t]=e[r],e[r]=s,e},i.prototype.rootDeleteId=function(e){var t=this.findRootId(e);t>-1&&this.rootDelete(t)},i.prototype.nodeAndSubNodesDelete=function(e){for(var t=[],r=0;r(i[i.pppppp=0]="pppppp",i[i.ppppp=1]="ppppp",i[i.pppp=2]="pppp",i[i.ppp=3]="ppp",i[i.pp=4]="pp",i[i.p=5]="p",i[i.mp=6]="mp",i[i.mf=7]="mf",i[i.f=8]="f",i[i.ff=9]="ff",i[i.fff=10]="fff",i[i.ffff=11]="ffff",i[i.fffff=12]="fffff",i[i.ffffff=13]="ffffff",i[i.sf=14]="sf",i[i.sff=15]="sff",i[i.sfp=16]="sfp",i[i.sfpp=17]="sfpp",i[i.fp=18]="fp",i[i.rf=19]="rf",i[i.rfz=20]="rfz",i[i.sfz=21]="sfz",i[i.sffz=22]="sffz",i[i.fz=23]="fz",i[i.other=24]="other",i))(DynamicEnum||{});InstantaneousDynamicExpression.staticConstructor();class DynamicsContainer{constructor(e,t){e instanceof ContinuousDynamicExpression?this.continuousDynamicExpression=e:e instanceof InstantaneousDynamicExpression&&(this.instantaneousDynamicExpression=e),this.staffNumber=t}static Compare(e,t){return e.parMultiExpression().AbsoluteTimestamp.CompareTo(t.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){if(this.continuousDynamicExpression)return this.continuousDynamicExpression.StartMultiExpression;if(this.instantaneousDynamicExpression)return this.instantaneousDynamicExpression.ParentMultiExpression}}class AbstractNotationInstruction{constructor(e){this.printObject=!0,this.parent=e}get Parent(){return this.parent}set Parent(e){this.parent=e}get PrintObject(){return this.printObject}set PrintObject(e){this.printObject=e}}class RhythmInstruction extends AbstractNotationInstruction{constructor(e,t){super(void 0),this.rhythm=e,this.numerator=e.Numerator,this.denominator=e.Denominator,this.symbolEnum=t}get Rhythm(){return this.rhythm}set Rhythm(e){this.rhythm=e}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(e){this.symbolEnum=e}clone(){return new RhythmInstruction(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(e){const t=this;return t===e?!0:!t||!e?!1:t.numerator===e.numerator&&t.denominator===e.denominator}OperatorNotEqual(e){return this!==e}ToString(){return"Rhythm: "+this.rhythm.toString()}}var RhythmSymbolEnum=(i=>(i[i.NONE=0]="NONE",i[i.COMMON=1]="COMMON",i[i.CUT=2]="CUT",i))(RhythmSymbolEnum||{});class MusicPartManagerIterator{constructor(e,t,r){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.repetitionIterationCountDictKeys=[],this.repetitionIterationCountDictValues=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new Fraction$1(0,1),this.currentEnrolledMeasureTimestamp=new Fraction$1(0,1),this.currentRelativeInMeasureTimestamp=new Fraction$1(0,1),this.currentVerticalContainerInMeasureTimestamp=new Fraction$1(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[];try{this.frontReached=!0,this.musicSheet=e,this.currentBpm=e.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const s of this.musicSheet.Repetitions)this.setRepetitionIterationCount(s,1);for(let s=0;s=this.JumpResponsibleRepetition.StartIndex&&s.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(s)}}handleRepetitionsAtMeasureEnd(){for(let e=0,t=this.currentMeasure.LastRepetitionInstructions.length;e-1&&this.getRepetitionIterationCount(s)=this.JumpResponsibleRepetition.StartIndex&&s.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(s),this.repetitionIterationCountDictKeys.contains(s))){const o=s.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(s));if(o>=0){this.currentMeasureIndex=o,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=s,this.forwardJumpOccurred=!0;return}o===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(e){this.currentMeasureIndex=e.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(e),this.jumpResponsibleRepetition=e,this.backJumpOccurred=!0}activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){const e=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let t=0,r=e.length;t0&&(this.currentDynamicEntryIndex>=e.length||e[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=t.length||t[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!e)return!0;for(let r=0,s=t.length;rt&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[t].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>r){const o=this.openSheetMusicDisplay.Sheet.SourceMeasures[r];this.openSheetMusicDisplay.Sheet.SelectionEnd=Fraction$1.plus(o.AbsoluteTimestamp,o.Duration)}this.iterator=this.manager.getIterator()}getStaffEntryFromVoiceEntry(e){const t=e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,r=e.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(r,t,e.ParentSourceStaffEntry)}updateWithTimestamp(e){const t=this.manager.absoluteEnrolledToSheetTimestamp(e),r=this.graphic.calculateXPositionFromTimestamp(t),s=r[0],o=r[1];this.updateCurrentPageFromSystem(o);const a=r[2];if(!a)return;const l=Math.max(a.parentMeasure.MeasureNumber,1);let c;for(const y of this.graphic.MeasureList[l-1])if(y){c=y;break}const u=this.graphic.calculateCursorPoints(s,o),m=u[0].y,d=u[1].y-m;if(c){if(this.updateWidthAndStyle(c.PositionAndShape,s,m,d),this.openSheetMusicDisplay.FollowCursor){const y=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:y<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();const e=this.Iterator,t=e.CurrentVisibleVoiceEntries();if(e.EndReached||!e.CurrentVoiceEntries||t.length===0)return;let r=0,s=0,o=0,a;if(e.CurrentMeasure.isReducedToMultiRest){const m=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0),d=m.parentSourceMeasure.multipleRestMeasures,b=e.CurrentMeasure.multipleRestMeasureNumber/(d+1),S=m.PositionAndShape.Size.width-m.beginInstructionsWidth;r=m.PositionAndShape.AbsolutePosition.x+m.beginInstructionsWidth+b*S,a=m.ParentMusicSystem}else{const d=t.map(y=>this.getStaffEntryFromVoiceEntry(y)).sort((y,b)=>{var S,A,P,x;return((A=(S=y==null?void 0:y.PositionAndShape)==null?void 0:S.AbsolutePosition)==null?void 0:A.x)<=((x=(P=b==null?void 0:b.PositionAndShape)==null?void 0:P.AbsolutePosition)==null?void 0:x.x)?-1:1})[0];d&&(r=d.PositionAndShape.AbsolutePosition.x,a=d.parentMeasure.ParentMusicSystem)}if(!a)return;s=a.PositionAndShape.AbsolutePosition.y+a.StaffLines[0].PositionAndShape.RelativePosition.y;const l=a.StaffLines[a.StaffLines.length-1];o=a.PositionAndShape.AbsolutePosition.y+l.PositionAndShape.RelativePosition.y+l.StaffHeight-s;const u=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(u,r,s,o),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{const m=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:m<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}updateWidthAndStyle(e,t,r,s){var c;const o=this.cursorElement;let a=0,l=s;switch(this.cursorOptions.type){case 1:o.style.top=r*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=(t-1.5)*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=5*this.openSheetMusicDisplay.zoom;break;case 2:o.style.top=(r-2.5)*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=t*10*this.openSheetMusicDisplay.zoom+"px",l=1.5*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=5*this.openSheetMusicDisplay.zoom;break;case 3:o.style.top=e.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=e.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=e.Size.width*10*this.openSheetMusicDisplay.zoom;break;case 4:o.style.top=e.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=e.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=(t-e.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:o.style.top=r*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=(t-1.5)*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=3*10*this.openSheetMusicDisplay.zoom;break}(c=window.GYM)!=null&&c.multitrack&&(o.height=l+24,o.style.height=l+24+"px"),a!==o.width&&(o.width=a,this.updateStyle(a,this.cursorOptions))}hide(){this.cursorElement.style.display="none",this.hidden=!0}next(){this.Iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator();const e=this.manager.getIterator(this.graphic.ParentMusicSheet.SelectionStart);this.updateWithTimestamp(e.CurrentEnrolledTimestamp)}updateStyle(e,t=void 0){t!==void 0&&(this.cursorOptions=t);const r=document.createElement("canvas");r.width=this.cursorElement.width,r.height=1;const s=r.getContext("2d");s.globalAlpha=this.cursorOptions.alpha;const o=s.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case 1:case 2:case 3:case 4:o.addColorStop(1,this.cursorOptions.color);break;default:o.addColorStop(0,"white"),o.addColorStop(.2,this.cursorOptions.color),o.addColorStop(.8,this.cursorOptions.color),o.addColorStop(1,"white");break}s.fillStyle=o,s.fillRect(0,0,e,1),this.cursorElement.src=r.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(e){return this.Iterator.CurrentVisibleVoiceEntries(e)}NotesUnderCursor(e){const t=this.VoicesUnderCursor(e),r=[];return t.forEach(s=>{r.push.apply(r,s.Notes)}),r}GNotesUnderCursor(e){const t=this.VoicesUnderCursor(e),r=[];return t.forEach(s=>{r.push(...s.Notes.map(o=>this.rules.GNote(o)))}),r}updateCurrentPage(){const e=this.Iterator.currentTimeStamp;for(const t of this.graphic.MusicPages)if(t.MusicSystems.last().GetSystemsLastTimeStamp().gt(e)){const s=t.PageNumber;return s!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+s),this.container.appendChild(this.cursorElement)),this.currentPageNumber=s}return 1}updateCurrentPageFromSystem(e){if(e!=null&&e.Parent){const t=e.Parent.PageNumber;return t!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+t),this.container.appendChild(this.cursorElement)),this.currentPageNumber=t}return 1}}class PointF2D{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}static get Empty(){return new PointF2D}static pointsAreEqual(e,t){return e.x===t.x&&e.y===t.y}ToString(){return"["+this.x+", "+this.y+"]"}}class SizeF2D{constructor(e=0,t=0){this.width=e,this.height=t}}class RectangleF2D{constructor(e,t,r,s){this.x=0,this.y=0,this.width=0,this.height=0,this.x=e,this.y=t,this.width=r,this.height=s}static createFromLocationAndSize(e,t){return new RectangleF2D(e.x,e.y,t.width,t.height)}get Location(){return new PointF2D(this.x,this.y)}get Size(){return new SizeF2D(this.width,this.height)}}class AClassHierarchyTrackable{isInstanceOfClass(e){let t=this.constructor.prototype;for(;t;){if(e===t.constructor.name)return!0;t=t.__proto__}return!1}}class GraphicalObject extends AClassHierarchyTrackable{get PositionAndShape(){return this.boundingBox}set PositionAndShape(e){this.boundingBox=e}}class StaffLineActivitySymbol extends GraphicalObject{constructor(e){super(),this.parentStaffLine=e;const t=e.PositionAndShape;this.boundingBox=new BoundingBox$1(this,t),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}class Clickable extends GraphicalObject{}let BoundingBox$1=class{constructor(e=void 0,t=void 0,r=!1){this.isSymbol=!1,this.relativePositionHasBeenSet=!1,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,this.absolutePosition=new PointF2D,this.relativePosition=new PointF2D,this.size=new SizeF2D,this.marginSize=new SizeF2D,this.upperLeftCorner=new PointF2D,this.upperLeftMarginCorner=new PointF2D,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.borderMarginLeft=0,this.borderMarginRight=0,this.borderMarginTop=0,this.borderMarginBottom=0,this.childElements=[],this.parent=t,this.dataObject=e,this.isSymbol=r,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,t&&(this.Parent=t)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(e){this.xBordersHaveBeenSet=e}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(e){this.yBordersHaveBeenSet=e}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(e){this.absolutePosition=e}get RelativePosition(){return this.relativePosition}set RelativePosition(e){this.relativePosition=e,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(e){this.size=e}get MarginSize(){return this.marginSize}get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(e){this.borderLeft=e,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(e){this.borderRight=e,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(e){this.borderTop=e,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(e){this.borderBottom=e,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(e){this.borderMarginLeft=e,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(e){this.borderMarginTop=e,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(a,1)}this.parent=e,((r=(t=this.parent)==null?void 0:t.ChildElements)==null?void 0:r.indexOf(this))>-1?log$2.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):(o=(s=this.parent)==null?void 0:s.ChildElements)==null||o.push(this)}get DataObject(){return this.dataObject}get Center(){return new PointF2D(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}setAbsolutePositionFromParent(){this.parent?(this.absolutePosition.x=this.parent.AbsolutePosition.x+this.relativePosition.x,this.absolutePosition.y=this.parent.AbsolutePosition.y+this.relativePosition.y):this.absolutePosition=this.relativePosition}calculateAbsolutePosition(){this.absolutePosition.x=this.relativePosition.x,this.absolutePosition.y=this.relativePosition.y;let e=this.parent;for(;e;)this.absolutePosition.x+=e.relativePosition.x,this.absolutePosition.y+=e.relativePosition.y,e=e.parent}calculateAbsolutePositionsRecursiveWithoutTopelement(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(let e=0,t=this.ChildElements.length;e.001;break;case 2:case 3:s=this.relativePosition.y,e.calculateMarginPositionAlongDirection(this,t),o=Math.abs(s-this.relativePosition.y)>.001;break;default:throw new ArgumentOutOfRangeException("direction")}while(o)}collisionDetection(e){const t=Math.min(this.AbsolutePosition.x+this.borderRight,e.absolutePosition.x+e.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,e.absolutePosition.x+e.borderLeft),r=Math.min(this.AbsolutePosition.y+this.borderBottom,e.absolutePosition.y+e.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,e.absolutePosition.y+e.borderTop);return t>0&&r>0}liesInsideBorders(e){const t=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderLeft&&e.absolutePosition.x+e.borderLeft<=this.AbsolutePosition.x+this.borderRight,r=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderRight&&e.absolutePosition.x+e.borderRight<=this.AbsolutePosition.x+this.borderRight;if(t&&r){const s=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderTop&&e.absolutePosition.y+e.borderTop<=this.AbsolutePosition.y+this.borderBottom,o=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderBottom&&e.absolutePosition.y+e.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(s&&o)return!0}return!1}pointLiesInsideBorders(e){return this.AbsolutePosition.x+this.borderLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderBottom}marginCollisionDetection(e){const t=Math.min(this.AbsolutePosition.x+this.borderMarginRight,e.absolutePosition.x+e.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,e.absolutePosition.x+e.borderMarginLeft),r=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,e.absolutePosition.y+e.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,e.absolutePosition.y+e.borderMarginTop);return t>0&&r>0}liesInsideMargins(e){const t=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginLeft&&e.absolutePosition.x+e.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,r=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginRight&&e.absolutePosition.x+e.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(t&&r){const s=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginTop&&e.absolutePosition.y+e.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,o=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginBottom&&e.absolutePosition.y+e.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(s&&o)return!0}return!1}pointLiesInsideMargins(e){return this.AbsolutePosition.x+this.borderMarginLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderMarginBottom}computeNonOverlappingPosition(e,t,r){this.RelativePosition=new PointF2D(r.x,r.y),this.setAbsolutePositionFromParent();let s=0,o=!1;do switch(t){case 0:case 1:s=this.relativePosition.x,e.calculatePositionAlongDirection(this,t),o=Math.abs(s-this.relativePosition.x)>1e-4;break;case 2:case 3:s=this.relativePosition.y,e.calculatePositionAlongDirection(this,t),o=Math.abs(s-this.relativePosition.y)>1e-4;break;default:throw new ArgumentOutOfRangeException("direction")}while(o)}getClickedObjectOfType(e){const t=this.dataObject;if(this.pointLiesInsideBorders(e)&&t)return t;for(let r=0,s=this.childElements.length;r(i[i.Left=0]="Left",i[i.Right=1]="Right",i[i.Up=2]="Up",i[i.Down=3]="Down",i))(ColDirEnum||{});class GraphicalMusicPage extends GraphicalObject{constructor(e){super(),this.musicSystems=[],this.labels=[],this.parent=e,this.boundingBox=new BoundingBox$1(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(e){this.musicSystems=e}get Labels(){return this.labels}set Labels(e){this.labels=e}get Parent(){return this.parent}set Parent(e){this.parent=e}get PageNumber(){return this.pageNumber}set PageNumber(e){this.pageNumber=e}setMusicPageAbsolutePosition(e,t){return new PointF2D(0,0)}}var PagePlacementEnum=(i=>(i[i.Down=0]="Down",i[i.Right=1]="Right",i[i.RightDown=2]="RightDown",i))(PagePlacementEnum||{}),TextAlignmentEnum=(i=>(i[i.LeftTop=0]="LeftTop",i[i.LeftCenter=1]="LeftCenter",i[i.LeftBottom=2]="LeftBottom",i[i.CenterTop=3]="CenterTop",i[i.CenterCenter=4]="CenterCenter",i[i.CenterBottom=5]="CenterBottom",i[i.RightTop=6]="RightTop",i[i.RightCenter=7]="RightCenter",i[i.RightBottom=8]="RightBottom",i))(TextAlignmentEnum||{});class TextAlignment{static IsLeft(e){return e===0||e===1||e===2}static IsCenterAligned(e){return e===3||e===4||e===5}static IsRight(e){return e===6||e===7||e===8}}var FontStyles=(i=>(i[i.Regular=0]="Regular",i[i.Bold=1]="Bold",i[i.Italic=2]="Italic",i[i.BoldItalic=3]="BoldItalic",i[i.Underlined=4]="Underlined",i))(FontStyles||{}),Fonts=(i=>(i[i.TimesNewRoman=0]="TimesNewRoman",i[i.Kokila=1]="Kokila",i[i.Gonville=2]="Gonville",i))(Fonts||{});const FontStringNames={0:"Times New Roman",1:"Kokila",2:"Gonville"};var TieTypes=(i=>(i.SIMPLE="",i.HAMMERON="H",i.PULLOFF="P",i.SLIDE="S",i.TAPPING="T",i))(TieTypes||{});const Additional={"-2":[11,3],"-7":[12],"-9":[5],12:[33,34,37,38,2]};var NoteEnum=(i=>(i[i.C=0]="C",i[i.D=2]="D",i[i.E=4]="E",i[i.F=5]="F",i[i.G=7]="G",i[i.A=9]="A",i[i.B=11]="B",i))(NoteEnum||{}),AccidentalEnum=(i=>(i[i.SHARP=0]="SHARP",i[i.FLAT=1]="FLAT",i[i.NONE=2]="NONE",i[i.NATURAL=3]="NATURAL",i[i.DOUBLESHARP=4]="DOUBLESHARP",i[i.DOUBLEFLAT=5]="DOUBLEFLAT",i[i.TRIPLESHARP=6]="TRIPLESHARP",i[i.TRIPLEFLAT=7]="TRIPLEFLAT",i[i.QUARTERTONESHARP=8]="QUARTERTONESHARP",i[i.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",i[i.SLASHFLAT=10]="SLASHFLAT",i[i.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",i[i.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",i[i.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",i[i.SLASHSHARP=14]="SLASHSHARP",i[i.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",i[i.SORI=16]="SORI",i[i.KORON=17]="KORON",i))(AccidentalEnum||{});const _Pitch=class Ne{constructor(e,t,r,s=void 0){this.accidental=2,this.fundamentalNote=e,this.octave=t,this.accidental=r,this.accidentalXml=s,this.halfTone=e+(t+Ne.octXmlDiff)*12+Ne.HalfTonesFromAccidental(r),this.frequency=Ne.calcFrequency(this),this.nextFrequency=Ne.calcFrequency(this,"next"),this.prevFrequency=Ne.calcFrequency(this,"prev")}static getNoteEnumString(e){switch(e){case 0:return"C";case 2:return"D";case 4:return"E";case 5:return"F";case 7:return"G";case 9:return"A";case 11:return"B";default:return""}}static lineShiftFromNoteEnum(e,t){if(t===0)return[e,0];const r=Ne.pitchEnumValues,s=r.indexOf(e);let o=0,a=(s+t)%r.length;return s+t>r.length-1&&(o=1),a<0&&(a=r.length+a,o=-1),[r[a],o]}static CalculateTransposedHalfTone(e,t){const r=e.fundamentalNote+e.AccidentalHalfTones+t;return Ne.WrapAroundCheck(r,12)}static WrapAroundCheck(e,t){let r=0;for(;e<0;)e+=t,r--;for(;e>=t;)e-=t,r++;return{overflow:r,halftone:e}}static calcFrequency(e,t){let r=0,s;if(e instanceof Ne){const u=e;r=u.octave-1,s=u.fundamentalNote-9+u.AccidentalHalfTones}else typeof e=="number"&&(s=e-57);const o=window.DYSubjectId;let a=0;if(window.DYEnvironment==="COLEXIU"&&(Additional[12]=[120]),window.xmlNeedAdjustVoice){for(const u in Additional)if(Object.prototype.hasOwnProperty.call(Additional,u)&&Additional[u].includes(o)){a=parseFloat(u);break}}let l=s+a;return t==="next"&&l++,t==="prev"&&l--,442*Math.pow(2,r)*Math.pow(2,l/12)}static calcFractionalKey(e){return Math.log(e/440)/Math.LN10*Ne.halftoneFactor+57}static fromFrequency(e){const t=Ne.calcFractionalKey(e)+.5,r=Math.floor(t/12)-Ne.octXmlDiff,s=Math.floor(t)%12;let o=s,a=2;return this.pitchEnumValues.indexOf(o)===-1&&(o=s-1,a=0),new Ne(o,r,a)}static fromHalftone(e){const t=Math.floor(e/12)-Ne.octXmlDiff,r=e%12;let s=r,o=2;return this.pitchEnumValues.indexOf(s)===-1&&(s=r-1,o=0),new Ne(s,t,o)}static ceiling(e){e=e%12;let t=e;return this.pitchEnumValues.indexOf(t)===-1&&(t=e+1),t}static floor(e){e=e%12;let t=e;return this.pitchEnumValues.indexOf(t)===-1&&(t=e-1),t}static HalfTonesFromAccidental(e){switch(e){case 2:return 0;case 0:return 1;case 1:return-1;case 3:return 0;case 4:return 2;case 5:return-2;case 6:return 3;case 7:return-3;case 8:return .5;case 9:return-.5;case 10:return-.51;case 11:return 1.5;case 12:return-1.5;case 13:return .0013;case 14:return .0014;case 15:return-.0015;case 16:return .0016;case 17:return .0017;default:throw new Error("Unhandled AccidentalEnum value")}}static AccidentalFromHalfTones(e){switch(e){case 0:return 2;case 1:return 0;case-1:return 1;case 2:return 4;case-2:return 5;case 3:return 6;case-3:return 7;case .5:return 8;case-.5:return 9;case 1.5:return 11;case-1.5:return 12;default:return e>0&&e<1?8:e<0&&e>-1?9:8}}static accidentalVexflow(e){let t;switch(e){case 3:t="n";break;case 1:t="b";break;case 0:t="#";break;case 4:t="##";break;case 6:t="###";break;case 5:t="bb";break;case 7:t="bbs";break;case 8:t="+";break;case 9:t="d";break;case 10:t="bs";break;case 11:t="++";break;case 12:t="db";break;case 13:t="+-";break;case 14:t="++-";break;case 15:t="bss";break;case 16:t="o";break;case 17:t="k";break}return t}get AccidentalHalfTones(){return Ne.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get AccidentalXml(){return this.accidentalXml}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return Ne.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(e){if(e>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return e>0?this.getHigherPitchByTransposeFactor(e):e<0?this.getLowerPitchByTransposeFactor(-e):this}DoEnharmonicChange(){switch(this.accidental){case 1:case 5:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=Ne.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+Ne.octXmlDiff)*12));break;case 0:case 4:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=Ne.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+Ne.octXmlDiff)*12));break;default:return}}ToString(){let e=Ne.accidentalVexflow(this.accidental);return e||(e=""),"Key: "+Ne.getNoteEnumString(this.fundamentalNote)+e+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(e){const t=this;return!t||!e?!1:t.FundamentalNote===e.FundamentalNote&&t.Octave===e.Octave&&t.Accidental===e.Accidental}OperatorNotEqual(e){return this!==e}OperatorFundamentalGreaterThan(e){const t=this;return t.Octave===e.Octave?t.FundamentalNote>e.FundamentalNote:t.Octave>e.Octave}OperatorFundamentalLessThan(e){const t=this;return t.Octave===e.Octave?t.FundamentalNoteNe.pitchEnumValues.length-1?(s=Ne.pitchEnumValues[t+e-Ne.pitchEnumValues.length],r++):s=Ne.pitchEnumValues[t+e],new Ne(s,r,2)}getLowerPitchByTransposeFactor(e){const t=Ne.pitchEnumValues.indexOf(this.fundamentalNote);let r=this.octave,s;return t-e<0?(s=Ne.pitchEnumValues[Ne.pitchEnumValues.length+t-e],r--):s=Ne.pitchEnumValues[t-e],new Ne(s,r,2)}getNextFundamentalNote(e){let t=Ne.pitchEnumValues.indexOf(e);return t=(t+1)%Ne.pitchEnumValues.length,Ne.pitchEnumValues[t]}getPreviousFundamentalNote(e){const t=Ne.pitchEnumValues.indexOf(e);return t>0?Ne.pitchEnumValues[t-1]:Ne.pitchEnumValues[Ne.pitchEnumValues.length-1]}};_Pitch.pitchEnumValues=[0,2,4,5,7,9,11];_Pitch.halftoneFactor=12/(Math.LN2/Math.LN10);_Pitch.octXmlDiff=3;let Pitch=_Pitch;class VerticalGraphicalStaffEntryContainer{constructor(e,t){this.staffEntries=[],this.absoluteTimestamp=t,this.staffEntries=new Array(e)}get Index(){return this.index}set Index(e){this.index=e}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(e){this.staffEntries=e}static compareByTimestamp(e,t){const r=e.absoluteTimestamp.RealValue,s=t.absoluteTimestamp.RealValue;return rs?1:0}getFirstNonNullStaffEntry(){for(let e=0,t=this.staffEntries.length;e(i[i.BaseWritingColor=0]="BaseWritingColor",i[i.FollowingCursor=1]="FollowingCursor",i[i.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",i[i.PlaybackCursor=3]="PlaybackCursor",i[i.Highlighted=4]="Highlighted",i[i.ErrorUnderlay=5]="ErrorUnderlay",i[i.Selected=6]="Selected",i[i.SelectionSymbol=7]="SelectionSymbol",i[i.DebugColor1=8]="DebugColor1",i[i.DebugColor2=9]="DebugColor2",i[i.DebugColor3=10]="DebugColor3",i[i.SplitScreenDivision=11]="SplitScreenDivision",i[i.GreyTransparentOverlay=12]="GreyTransparentOverlay",i[i.MarkedArea1=13]="MarkedArea1",i[i.MarkedArea2=14]="MarkedArea2",i[i.MarkedArea3=15]="MarkedArea3",i[i.MarkedArea4=16]="MarkedArea4",i[i.MarkedArea5=17]="MarkedArea5",i[i.MarkedArea6=18]="MarkedArea6",i[i.MarkedArea7=19]="MarkedArea7",i[i.MarkedArea8=20]="MarkedArea8",i[i.MarkedArea9=21]="MarkedArea9",i[i.MarkedArea10=22]="MarkedArea10",i[i.Comment1=23]="Comment1",i[i.Comment2=24]="Comment2",i[i.Comment3=25]="Comment3",i[i.Comment4=26]="Comment4",i[i.Comment5=27]="Comment5",i[i.Comment6=28]="Comment6",i[i.Comment7=29]="Comment7",i[i.Comment8=30]="Comment8",i[i.Comment9=31]="Comment9",i[i.Comment10=32]="Comment10",i))(OutlineAndFillStyleEnum||{});const OUTLINE_AND_FILL_STYLE_DICT=new Dictionary;OUTLINE_AND_FILL_STYLE_DICT.setValue(0,"Thistle");OUTLINE_AND_FILL_STYLE_DICT.setValue(1,"Aqua");OUTLINE_AND_FILL_STYLE_DICT.setValue(2,"Azure");OUTLINE_AND_FILL_STYLE_DICT.setValue(3,"Bisque");OUTLINE_AND_FILL_STYLE_DICT.setValue(4,"CadetBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(5,"DarkBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(6,"DarkGoldenRod");OUTLINE_AND_FILL_STYLE_DICT.setValue(7,"BlanchedAlmond");OUTLINE_AND_FILL_STYLE_DICT.setValue(8,"Chartreuse");OUTLINE_AND_FILL_STYLE_DICT.setValue(9,"DarkGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(10,"DarkOrange");OUTLINE_AND_FILL_STYLE_DICT.setValue(11,"FireBrick");OUTLINE_AND_FILL_STYLE_DICT.setValue(12,"DarkSalmon");OUTLINE_AND_FILL_STYLE_DICT.setValue(13,"DarkSeaGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(14,"DarkOrchid");OUTLINE_AND_FILL_STYLE_DICT.setValue(15,"Aquamarine");OUTLINE_AND_FILL_STYLE_DICT.setValue(16,"DarkKhaki");OUTLINE_AND_FILL_STYLE_DICT.setValue(17,"ForestGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(18,"AliceBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(19,"DeepPink");OUTLINE_AND_FILL_STYLE_DICT.setValue(20,"Coral");OUTLINE_AND_FILL_STYLE_DICT.setValue(21,"DarkOliveGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(22,"Chocolate");OUTLINE_AND_FILL_STYLE_DICT.setValue(23,"DodgerBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(24,"Blue");OUTLINE_AND_FILL_STYLE_DICT.setValue(25,"Beige");OUTLINE_AND_FILL_STYLE_DICT.setValue(26,"Crimson");OUTLINE_AND_FILL_STYLE_DICT.setValue(27,"Fuchsia");OUTLINE_AND_FILL_STYLE_DICT.setValue(28,"Brown");OUTLINE_AND_FILL_STYLE_DICT.setValue(29,"BlanchedAlmond");OUTLINE_AND_FILL_STYLE_DICT.setValue(30,"CornflowerBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(31,"Cornsilk");OUTLINE_AND_FILL_STYLE_DICT.setValue(32,"DarkGrey");var GraphicalLayers=(i=>(i[i.Background=0]="Background",i[i.Highlight=1]="Highlight",i[i.MeasureError=2]="MeasureError",i[i.SelectionSymbol=3]="SelectionSymbol",i[i.Cursor=4]="Cursor",i[i.PSI_Debug=5]="PSI_Debug",i[i.Notes=6]="Notes",i[i.Comment=7]="Comment",i[i.Debug_above=8]="Debug_above",i))(GraphicalLayers||{}),NoteState=(i=>(i[i.Normal=0]="Normal",i[i.Selected=1]="Selected",i[i.Follow_Confirmed=2]="Follow_Confirmed",i[i.QFeedback_NotFound=3]="QFeedback_NotFound",i[i.QFeedback_OK=4]="QFeedback_OK",i[i.QFeedback_Perfect=5]="QFeedback_Perfect",i[i.Debug1=6]="Debug1",i[i.Debug2=7]="Debug2",i[i.Debug3=8]="Debug3",i))(NoteState||{}),AutoColorSet=(i=>(i.C="#d82c6b",i.D="#F89D15",i.E="#FFE21A",i.F="#4dbd5c",i.G="#009D96",i.A="#43469d",i.B="#76429c",i.Rest="#000000",i))(AutoColorSet||{});class GraphicalLine{constructor(e,t,r=0,s=OutlineAndFillStyleEnum.BaseWritingColor,o=void 0){this.start=e,this.end=t,this.width=r,this.styleId=s,this.colorHex=o}get Start(){return this.start}set Start(e){this.start=e}get End(){return this.end}set End(e){this.end=e}get Width(){return this.width}set Width(e){this.width=e}}class ClefInstruction extends AbstractNotationInstruction{constructor(e=0,t=0,r=2){super(void 0),this.clefType=0,this.line=2,this.octaveOffset=0,this.line=r,this.clefType=e,this.octaveOffset=t,this.calcParameters()}static getDefaultClefFromMidiInstrument(e){switch(e){case 0:return new ClefInstruction(1,0,4);case 33:return new ClefInstruction(1,0,4);case 34:return new ClefInstruction(1,0,4);case 35:return new ClefInstruction(1,0,4);case 36:return new ClefInstruction(1,0,4);case 37:return new ClefInstruction(1,0,4);case 38:return new ClefInstruction(1,0,4);case 39:return new ClefInstruction(1,0,4);case 43:return new ClefInstruction(1,0,4);default:return new ClefInstruction(0,0,2)}}static getAllPossibleClefs(){const e=[];for(let t=0;t<=2;t++){const r=new ClefInstruction(0,t,2);e.push(r)}for(let t=-2;t<=0;t++){const r=new ClefInstruction(1,t,4);e.push(r)}return e}static isSupportedClef(e){switch(e){case 0:case 1:case 2:case 3:case 4:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(e){this.clefType=e}get Line(){return this.line}set Line(e){this.line=e}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(e){this.octaveOffset=e}get ClefPitch(){return this.clefPitch}set ClefPitch(e){this.clefPitch=e}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(e){this.referenceCyPosition=e}Equals(e){return this===e?!0:!this||!e?!1:this.clefPitch===e.clefPitch&&this.Line===e.Line}NotEqual(e){return!this.Equals(e)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case 0:this.clefPitch=new Pitch(NoteEnum.G,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case 1:this.clefPitch=new Pitch(NoteEnum.F,0+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case 2:this.clefPitch=new Pitch(NoteEnum.C,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case 3:this.clefPitch=new Pitch(NoteEnum.C,2,AccidentalEnum.NONE),this.referenceCyPosition=2;break;case 4:this.clefPitch=new Pitch(NoteEnum.G,0,AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new ArgumentOutOfRangeException("clefType")}}}var ClefEnum=(i=>(i[i.G=0]="G",i[i.F=1]="F",i[i.C=2]="C",i[i.percussion=3]="percussion",i[i.TAB=4]="TAB",i))(ClefEnum||{}),MidiInstrument=(i=>(i[i.None=-1]="None",i[i.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",i[i.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",i[i.Electric_Grand_Piano=2]="Electric_Grand_Piano",i[i.Honky_tonk_Piano=3]="Honky_tonk_Piano",i[i.Electric_Piano_1=4]="Electric_Piano_1",i[i.Electric_Piano_2=5]="Electric_Piano_2",i[i.Harpsichord=6]="Harpsichord",i[i.Clavinet=7]="Clavinet",i[i.Celesta=8]="Celesta",i[i.Glockenspiel=9]="Glockenspiel",i[i.Music_Box=10]="Music_Box",i[i.Vibraphone=11]="Vibraphone",i[i.Marimba=12]="Marimba",i[i.Xylophone=13]="Xylophone",i[i.Tubular_Bells=14]="Tubular_Bells",i[i.Dulcimer=15]="Dulcimer",i[i.Drawbar_Organ=16]="Drawbar_Organ",i[i.Percussive_Organ=17]="Percussive_Organ",i[i.Rock_Organ=18]="Rock_Organ",i[i.Church_Organ=19]="Church_Organ",i[i.Reed_Organ=20]="Reed_Organ",i[i.Accordion=21]="Accordion",i[i.Harmonica=22]="Harmonica",i[i.Tango_Accordion=23]="Tango_Accordion",i[i.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",i[i.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",i[i.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",i[i.Electric_Guitar_clean=27]="Electric_Guitar_clean",i[i.Electric_Guitar_muted=28]="Electric_Guitar_muted",i[i.Overdriven_Guitar=29]="Overdriven_Guitar",i[i.Distortion_Guitar=30]="Distortion_Guitar",i[i.Guitar_harmonics=31]="Guitar_harmonics",i[i.Acoustic_Bass=32]="Acoustic_Bass",i[i.Electric_Bass_finger=33]="Electric_Bass_finger",i[i.Electric_Bass_pick=34]="Electric_Bass_pick",i[i.Fretless_Bass=35]="Fretless_Bass",i[i.Slap_Bass_1=36]="Slap_Bass_1",i[i.Slap_Bass_2=37]="Slap_Bass_2",i[i.Synth_Bass_1=38]="Synth_Bass_1",i[i.Synth_Bass_2=39]="Synth_Bass_2",i[i.Violin=40]="Violin",i[i.Viola=41]="Viola",i[i.Cello=42]="Cello",i[i.Contrabass=43]="Contrabass",i[i.Tremolo_Strings=44]="Tremolo_Strings",i[i.Pizzicato_Strings=45]="Pizzicato_Strings",i[i.Orchestral_Harp=46]="Orchestral_Harp",i[i.Timpani=47]="Timpani",i[i.String_Ensemble_1=48]="String_Ensemble_1",i[i.String_Ensemble_2=49]="String_Ensemble_2",i[i.Synth_Strings_1=50]="Synth_Strings_1",i[i.Synth_Strings_2=51]="Synth_Strings_2",i[i.Choir_Aahs=52]="Choir_Aahs",i[i.Voice_Oohs=53]="Voice_Oohs",i[i.Synth_Voice=54]="Synth_Voice",i[i.Orchestra_Hit=55]="Orchestra_Hit",i[i.Trumpet=56]="Trumpet",i[i.Trombone=57]="Trombone",i[i.Tuba=58]="Tuba",i[i.Muted_Trumpet=59]="Muted_Trumpet",i[i.French_Horn=60]="French_Horn",i[i.Brass_Section=61]="Brass_Section",i[i.Synth_Brass_1=62]="Synth_Brass_1",i[i.Synth_Brass_2=63]="Synth_Brass_2",i[i.Soprano_Sax=64]="Soprano_Sax",i[i.Alto_Sax=65]="Alto_Sax",i[i.Tenor_Sax=66]="Tenor_Sax",i[i.Baritone_Sax=67]="Baritone_Sax",i[i.Oboe=68]="Oboe",i[i.English_Horn=69]="English_Horn",i[i.Bassoon=70]="Bassoon",i[i.Clarinet=71]="Clarinet",i[i.Piccolo=72]="Piccolo",i[i.Flute=73]="Flute",i[i.Recorder=74]="Recorder",i[i.Pan_Flute=75]="Pan_Flute",i[i.Blown_Bottle=76]="Blown_Bottle",i[i.Shakuhachi=77]="Shakuhachi",i[i.Whistle=78]="Whistle",i[i.Ocarina=79]="Ocarina",i[i.Lead_1_square=80]="Lead_1_square",i[i.Lead_2_sawtooth=81]="Lead_2_sawtooth",i[i.Lead_3_calliope=82]="Lead_3_calliope",i[i.Lead_4_chiff=83]="Lead_4_chiff",i[i.Lead_5_charang=84]="Lead_5_charang",i[i.Lead_6_voice=85]="Lead_6_voice",i[i.Lead_7_fifths=86]="Lead_7_fifths",i[i.Lead_8_bass_lead=87]="Lead_8_bass_lead",i[i.Pad_1_new_age=88]="Pad_1_new_age",i[i.Pad_2_warm=89]="Pad_2_warm",i[i.Pad_3_polysynth=90]="Pad_3_polysynth",i[i.Pad_4_choir=91]="Pad_4_choir",i[i.Pad_5_bowed=92]="Pad_5_bowed",i[i.Pad_6_metallic=93]="Pad_6_metallic",i[i.Pad_7_halo=94]="Pad_7_halo",i[i.Pad_8_sweep=95]="Pad_8_sweep",i[i.FX_1_rain=96]="FX_1_rain",i[i.FX_2_soundtrack=97]="FX_2_soundtrack",i[i.FX_3_crystal=98]="FX_3_crystal",i[i.FX_4_atmosphere=99]="FX_4_atmosphere",i[i.FX_5_brightness=100]="FX_5_brightness",i[i.FX_6_goblins=101]="FX_6_goblins",i[i.FX_7_echoes=102]="FX_7_echoes",i[i.FX_8_scifi=103]="FX_8_scifi",i[i.Sitar=104]="Sitar",i[i.Banjo=105]="Banjo",i[i.Shamisen=106]="Shamisen",i[i.Koto=107]="Koto",i[i.Kalimba=108]="Kalimba",i[i.Bag_pipe=109]="Bag_pipe",i[i.Fiddle=110]="Fiddle",i[i.Shanai=111]="Shanai",i[i.Tinkle_Bell=112]="Tinkle_Bell",i[i.Agogo=113]="Agogo",i[i.Steel_Drums=114]="Steel_Drums",i[i.Woodblock=115]="Woodblock",i[i.Taiko_Drum=116]="Taiko_Drum",i[i.Melodic_Tom=117]="Melodic_Tom",i[i.Synth_Drum=118]="Synth_Drum",i[i.Reverse_Cymbal=119]="Reverse_Cymbal",i[i.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",i[i.Breath_Noise=121]="Breath_Noise",i[i.Seashore=122]="Seashore",i[i.Bird_Tweet=123]="Bird_Tweet",i[i.Telephone_Ring=124]="Telephone_Ring",i[i.Helicopter=125]="Helicopter",i[i.Applause=126]="Applause",i[i.Gunshot=127]="Gunshot",i[i.euphonium=128]="euphonium",i[i.AltoClarinetInEb=200]="AltoClarinetInEb",i[i.TrumpetInBb=201]="TrumpetInBb",i[i.BaritoneSaxophone=202]="BaritoneSaxophone",i[i.TenorSaxophone=203]="TenorSaxophone",i[i.ClarinetInEb=204]="ClarinetInEb",i[i.Euphonium=205]="Euphonium",i[i.Alto_Clarinet=206]="Alto_Clarinet",i[i.Bass_Clarinet=207]="Bass_Clarinet",i[i.Bass_Trombone=208]="Bass_Trombone",i[i.clarinet_in_bb=209]="clarinet_in_bb",i[i.clarinet_in_eb=210]="clarinet_in_eb",i[i.Percussion=135]="Percussion",i))(MidiInstrument||{});const _KeyInstruction=class Ht extends AbstractNotationInstruction{constructor(e=void 0,t=0,r=0){super(e),this.isTransposedBy=0,this.Key=t,this.keyTypeOriginal=t,this.mode=r,this.alteratedNotes=this.calcAlteratedNotes()}static copy(e){const t=new Ht(e.parent,e.Key,e.Mode);return t.keyTypeOriginal=e.keyTypeOriginal,t}static getAllPossibleMajorKeyInstructions(){const e=[];for(let t=-7;t<7;t++){const r=new Ht(void 0,t,0);e.push(r)}return e}get Key(){return this.keyType}set Key(e){this.keyType=e,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(e){this.mode=e}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const e=[];if(this.keyType>0)for(let t=0;t=0}getAlterationForPitch(e){return this.keyType>0&&this.alteratedNotes.indexOf(e.FundamentalNote)<=this.keyType?AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(e.FundamentalNote)<=Math.abs(this.keyType)?AccidentalEnum.FLAT:AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(e){const t=this;return t===e?!0:!t||!e?!1:t.Key===e.Key&&t.Mode===e.Mode}OperatorNotEqual(e){return!this.OperatorEquals(e)}};_KeyInstruction.sharpPositionList=[NoteEnum.F,NoteEnum.C,NoteEnum.G,NoteEnum.D,NoteEnum.A,NoteEnum.E,NoteEnum.B];_KeyInstruction.flatPositionList=[NoteEnum.B,NoteEnum.E,NoteEnum.A,NoteEnum.D,NoteEnum.G,NoteEnum.C,NoteEnum.F];let KeyInstruction=_KeyInstruction;var KeyEnum=(i=>(i[i.major=0]="major",i[i.minor=1]="minor",i[i.none=2]="none",i[i.dorian=3]="dorian",i[i.phrygian=4]="phrygian",i[i.lydian=5]="lydian",i[i.mixolydian=6]="mixolydian",i[i.aeolian=7]="aeolian",i[i.ionian=8]="ionian",i[i.locrian=9]="locrian",i))(KeyEnum||{});Array.prototype.last||Object.defineProperty(Array.prototype,"last",{enumerable:!1,value:function(){return this[this.length-1]}});Array.prototype.clear||Object.defineProperty(Array.prototype,"clear",{enumerable:!1,value:function(){this.length=0}});Array.prototype.contains||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,value:function(i){return this.indexOf(i)!==-1}});class CollectionUtil{static contains2(e,t){for(let r=0;r{var r,s,o,a;return((s=(r=t.sourceNote.Pitch)==null?void 0:r.getHalfTone())!=null?s:0)-((a=(o=e.sourceNote.Pitch)==null?void 0:o.getHalfTone())!=null?a:0)}),this.notes}sortForVexflow(){return this.notes.sort((e,t)=>{var r,s,o;return((s=(r=e.sourceNote.Pitch)==null?void 0:r.getHalfTone())!=null?s:0)-((o=t.sourceNote.Pitch.getHalfTone())!=null?o:0)}),this.notes}color(){}}class GraphicalMusicSheet{constructor(e,t){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=e,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=t,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get JianpuKeySignature(){return this.jianpuKeySignature}set JianpuKeySignature(e){this.jianpuKeySignature=e}get MusicPages(){return this.musicPages}set MusicPages(e){this.musicPages=e}get MeasureList(){return this.measureList}set MeasureList(e){this.measureList=e}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(e){this.verticalGraphicalStaffEntryContainers=e}get Title(){return this.title}set Title(e){this.title=e}get Subtitle(){return this.subtitle}set Subtitle(e){this.subtitle=e}get Composer(){return this.composer}set Composer(e){this.composer=e}get Lyricist(){return this.lyricist}set Lyricist(e){this.lyricist=e}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(e){this.minAllowedSystemWidth=e}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(e){this.leadSheet=e}static transformRelativeToAbsolutePosition(e){for(let t=0;t=0;r--){const s=this.measureList[r][t];if(s)return s}}findGraphicalStaffEntryFromMeasureList(e,t,r){for(let s=t;s0)return a.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(e,t){const r=[],s=this.measureList[0].length;for(let o=e;o<=t;o++)for(let a=0;a=0;t--){if(this.verticalGraphicalStaffEntryContainers[t].AbsoluteTimestamp.lt(e)){const r=new VerticalGraphicalStaffEntryContainer(this.numberOfStaves,e);return this.verticalGraphicalStaffEntryContainers.splice(t+1,0,r),r}if(this.verticalGraphicalStaffEntryContainers[t].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers[t]}}GetVerticalContainerFromTimestamp(e,t=0){const r=CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new VerticalGraphicalStaffEntryContainer(0,e),VerticalGraphicalStaffEntryContainer.compareByTimestamp,t);if(r>=0)return this.verticalGraphicalStaffEntryContainers[r]}GetInterpolatedIndexInVerticalContainers(e){const t=this.verticalGraphicalStaffEntryContainers;let r=0,s=t.length-1,o,a;if(e.lte(t[t.length-1].AbsoluteTimestamp)){for(;s-r>1;){const m=Math.floor((s+r)/2);if(t[r].AbsoluteTimestamp.Equals(e)){s=r;break}else if(t[s].AbsoluteTimestamp.Equals(e)){r=s;break}else{if(t[m].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers.indexOf(t[m]);e.lt(t[m].AbsoluteTimestamp)?s=m:r=m}}if(r===s)return this.verticalGraphicalStaffEntryContainers.indexOf(t[r]);o=t[r].AbsoluteTimestamp,a=t[s].AbsoluteTimestamp}else o=t[t.length-1].AbsoluteTimestamp,a=Fraction$1.plus(this.getLongestStaffEntryDuration(t.length-1),o),s=t.length;const l=a.RealValue-o.RealValue,c=a.RealValue-e.RealValue,u=s-c/l;return Math.min(u,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(e){const t=[],r=[];for(let s=0,o=e.length;s{var r;return((r=t.parentStaffEntry)==null?void 0:r.relInMeasureTimestamp)!==void 0})}GetNearestNote(e,t){const r=this.GetNearestVoiceEntry(e);if(!r)return;let s,o=Number.MAX_SAFE_INTEGER;for(const a of r.notes){const l=a.PositionAndShape.AbsolutePosition.y,c=Math.abs(a.PositionAndShape.AbsolutePosition.x-e.x),u=Math.abs(l-e.y);c+ua.PositionAndShape.RelativePosition.x&&(r=a):r=a)}}catch(s){log$2.info("GraphicalMusicSheet.getStaffEntry",s)}return r}GetPreviousVisibleContainerIndex(e){for(let t=e-1;t>=0;t--){const r=this.verticalGraphicalStaffEntryContainers[t].StaffEntries;for(let s=0,o=r.length;s=0;o--)if(r=this.getStaffEntry(o),r)if(t){if(r.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return r}else return r}findClosestRightStaffEntry(e,t){let r;const s=Math.max(0,Math.ceil(e));for(let o=s;o{};Vex.L=(i,e)=>{if(!e)return;const t=Array.prototype.slice.call(e).join(" ");window.console.log(i+": "+t)};Vex.MakeException=i=>class extends Error{constructor(t,r){super(t),this.name=i,this.message=t,this.data=r}};class RuntimeError{constructor(e,t){this.code=e,this.message=t}toString(){return"[RuntimeError] "+this.code+":"+this.message}}Vex.RuntimeError=RuntimeError;Vex.RERR=Vex.RuntimeError;Vex.Merge=(i,e)=>{for(const t in e)i[t]=e[t];return i};Vex.Min=Math.min;Vex.Max=Math.max;Vex.forEach=(i,e)=>{for(let t=0;ti%e>=e/2?parseInt(i/e,10)*e+e:parseInt(i/e,10)*e;Vex.MidLine=(i,e)=>{let t=e+(i-e)/2;return t%2>0&&(t=Vex.RoundN(t*10,5)/10),t};Vex.SortAndUnique=(i,e,t)=>{if(i.length>1){const r=[];let s;i.sort(e);for(let o=0;o{let t=i.length;for(;t--;)if(i[t]===e)return!0;return!1};Vex.getCanvasContext=i=>{if(!i)throw new Vex.RERR("BadArgument","Invalid canvas selector: "+i);const e=document.getElementById(i);if(!(e&&e.getContext))throw new Vex.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return e.getContext("2d")};Vex.drawDot=(i,e,t,r="#55")=>{i.save(),i.setFillStyle(r),i.beginPath(),i.arc(e,t,3,0,Math.PI*2,!0),i.closePath(),i.fill(),i.restore()};Vex.BM=(i,e)=>{const t=new Date().getTime();e();const r=new Date().getTime()-t;Vex.L(i+r+"ms")};Vex.StackTrace=()=>new Error().stack;Vex.W=(...i)=>{const e=i.join(" ");window.console.log("Warning: ",e,Vex.StackTrace())};Vex.Prefix=i=>Vex.Prefix.prefix+i;Vex.Prefix.prefix="vf-";class Fraction{static GCD(e,t){if(typeof e!="number"||typeof t!="number")throw new Vex.RERR("BadArgument","Invalid numbers: ".concat(e,", ").concat(t));let r;for(;t!==0;)r=t,t=e%t,e=r;return e}static LCM(e,t){return e*t/Fraction.GCD(e,t)}static LCMM(e){if(e.length===0)return 0;if(e.length===1)return e[0];if(e.length===2)return Fraction.LCM(e[0],e[1]);{const t=e[0];return e.shift(),Fraction.LCM(t,Fraction.LCMM(e))}}constructor(e,t){this.set(e,t)}set(e,t){return this.numerator=e===void 0?1:e,this.denominator=t===void 0?1:t,this}value(){return this.numerator/this.denominator}simplify(){let e=this.numerator,t=this.denominator;const r=Fraction.GCD(e,t);return e/=r,t/=r,t<0&&(t=-t,e=-e),this.set(e,t)}add(e,t){let r,s;e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=0,t!==void 0?s=t:s=1);const o=Fraction.LCM(this.denominator,s),a=o/this.denominator,l=o/s,c=this.numerator*a+r*l;return this.set(c,o)}subtract(e,t){let r,s;e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=0,t!==void 0?s=t:s=1);const o=Fraction.LCM(this.denominator,s),a=o/this.denominator,l=o/s,c=this.numerator*a-r*l;return this.set(c,o)}multiply(e,t){let r,s;return e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=1,t!==void 0?s=t:s=1),this.set(this.numerator*r,this.denominator*s)}divide(e,t){let r,s;return e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=1,t!==void 0?s=t:s=1),this.set(this.numerator*s,this.denominator*r)}equals(e){const t=Fraction.__compareA.copy(e).simplify(),r=Fraction.__compareB.copy(this).simplify();return t.numerator===r.numerator&&t.denominator===r.denominator}greaterThan(e){const t=Fraction.__compareB.copy(this);return t.subtract(e),t.numerator>0}greaterThanEquals(e){const t=Fraction.__compareB.copy(this);return t.subtract(e),t.numerator>=0}lessThan(e){return!this.greaterThanEquals(e)}lessThanEquals(e){return!this.greaterThan(e)}clone(){return new Fraction(this.numerator,this.denominator)}copy(e){return typeof e=="number"?this.set(e||0,1):this.set(e.numerator,e.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}fraction(){return this.numerator%this.denominator}abs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return this.numerator+"/"+this.denominator}toSimplifiedString(){return Fraction.__tmp.copy(this).simplify().toString()}toMixedString(){let e="";const t=this.quotient(),r=Fraction.__tmp.copy(this);return t<0?r.abs().fraction():r.fraction(),t!==0?(e+=t,r.numerator!==0&&(e+=" "+r.toSimplifiedString())):r.numerator===0?e="0":e=r.toSimplifiedString(),e}parse(e){const t=e.split("/"),r=parseInt(t[0],10),s=t[1]?parseInt(t[1],10):1;return this.set(r,s)}}Fraction.__compareA=new Fraction;Fraction.__compareB=new Fraction;Fraction.__tmp=new Fraction;const X$3=Vex.MakeException("RegistryError");function setIndexValue(i,e,t,r,s){i[e][t]||(i[e][t]={}),i[e][t][r]=s}class Registry{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(e){Registry.defaultRegistry=e}static getDefaultRegistry(){return Registry.defaultRegistry}static disableDefaultRegistry(){Registry.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:e,name:t,value:r,oldValue:s}){const o=this.getElementById(e);s!==null&&this.index[t][s]&&delete this.index[t][s][e],r!==null&&setIndexValue(this.index,t,r,o.getAttribute("id"),o)}register(e,t){if(t=t||e.getAttribute("id"),!t)throw new X$3("Can't add element without `id` attribute to registry",e);return e.setAttribute("id",t),setIndexValue(this.index,"id",t,t,e),Registry.INDEXES.forEach(r=>{this.updateIndex({id:t,name:r,value:e.getAttribute(r),oldValue:null})}),e.onRegister(this),this}getElementById(e){return this.index.id[e]?this.index.id[e][e]:null}getElementsByAttribute(e,t){const r=this.index[e];return r&&r[t]?Object.keys(r[t]).map(s=>r[t][s]):[]}getElementsByType(e){return this.getElementsByAttribute("type",e)}getElementsByClass(e){return this.getElementsByAttribute("class",e)}onUpdate({id:e,name:t,value:r,oldValue:s}){function o(a,l){return a.filter(c=>c===l).length>0}return o(Registry.INDEXES.concat(["id","class"]),t)?(this.updateIndex({id:e,name:t,value:r,oldValue:s}),this):this}}Registry.defaultRegistry=null;let Element$1=class li{static newID(){return"auto"+li.ID++}constructor({type:e}={}){this.attrs={id:li.newID(),el:null,type:e||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,Registry.getDefaultRegistry()&&Registry.getDefaultRegistry().register(this)}setStyle(e){return this.style=e,this}getStyle(){return this.style}applyStyle(e=this.context,t=this.getStyle()){return t?(e.save(),t.shadowColor&&e.setShadowColor(t.shadowColor),t.shadowBlur&&e.setShadowBlur(t.shadowBlur),t.fillStyle&&e.setFillStyle(t.fillStyle),t.strokeStyle&&e.setStrokeStyle(t.strokeStyle),t.lineWidth&&e.setLineWidth(t.lineWidth),this):this}restoreStyle(e=this.context,t=this.getStyle()){return t?(e.restore(),this):this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(e){return this.attrs.classes[e]===!0}addClass(e){return this.attrs.classes[e]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:e,oldValue:null}),this}removeClass(e){return delete this.attrs.classes[e],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:e}),this}onRegister(e){return this.registry=e,this}isRendered(){return this.rendered}setRendered(e=!0){return this.rendered=e,this}getAttributes(){return this.attrs}getAttribute(e){return this.attrs[e]}setAttribute(e,t){const r=this.attrs.id,s=this.attrs[e];return this.attrs[e]=t,this.registry&&this.registry.onUpdate({id:r,name:e,value:t,oldValue:s}),this}getContext(){return this.context}setContext(e){return this.context=e,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new Vex.RERR("NoContext","No rendering context attached to instance");return this.context}};Element$1.ID=1e3;class BoundingBoxComputation{constructor(e,t,r,s){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(e,t),this.addPoint(r,s)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(e,t){e!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),ethis.x2&&(this.x2=e)),t!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addQuadraticCurve(e,t,r,s,o,a){const l=e+.6666666666666666*(r-e),c=t+2/3*(s-t),u=l+1/3*(o-e),m=c+1/3*(a-t);this.addBezierCurve(e,t,l,c,u,m,o,a)}addBezierCurve(e,t,r,s,o,a,l,c){const u=[e,t],m=[r,s],d=[o,a],y=[l,c];let b;this.addPoint(u[0],u[1]),this.addPoint(y[0],y[1]);const S=(A,P)=>Math.pow(1-A,3)*u[P]+3*Math.pow(1-A,2)*A*m[P]+3*(1-A)*Math.pow(A,2)*d[P]+Math.pow(A,3)*y[P];for(b=0;b<=1;b++){const A=6*u[b]-12*m[b]+6*d[b],P=-3*u[b]+9*m[b]-9*d[b]+3*y[b],x=3*m[b]-3*u[b];if(P===0){if(A===0)continue;const C=-x/A;0{if(!i)throw new Vex.RERR("BadArgument","Invalid clef: "+i);const e=Flow.clefProperties.values[i];if(!e)throw new Vex.RERR("BadArgument","Invalid clef: "+i);return e};Flow.clefProperties.values={treble:{line_shift:0},bass:{line_shift:6},tenor:{line_shift:4},alto:{line_shift:3},soprano:{line_shift:1},percussion:{line_shift:0},"mezzo-soprano":{line_shift:2},"baritone-c":{line_shift:5},"baritone-f":{line_shift:5},subbass:{line_shift:7},french:{line_shift:-1}};Flow.keyProperties=(i,e,t)=>{e===void 0&&(e="treble");const r={octave_shift:0};typeof t=="object"&&Vex.Merge(r,t);const s=i.split("/");if(s.length<2)throw new Vex.RERR("BadArguments","Key must have note + octave and an optional glyph: ".concat(i));const o=s[0].toUpperCase(),a=Flow.keyProperties.note_values[o];if(!a)throw new Vex.RERR("BadArguments","Invalid key name: "+o);a.octave&&(s[1]=a.octave);let l=parseInt(s[1],10);l+=-1*r.octave_shift;let u=(l*7-4*7+a.index)/2;u+=Flow.clefProperties(e).line_shift;let m=0;u<=0&&u*2%2===0&&(m=1),u>=6&&u*2%2===0&&(m=-1);const d=typeof a.int_val<"u"?l*12+a.int_val:null,y=a.code,b=a.shift_right;let S={};if(s.length>2&&s[2]){const A=s[2].toUpperCase();S=Flow.keyProperties.customNoteHeads[A]||{}}return{key:o,octave:l,line:u,int_value:d,accidental:a.accidental,code:y,stroke:m,shift_right:b,displaced:!1,...S}};Flow.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}};Flow.keyProperties.customNoteHeads={D0:{code:"v27",shift_right:0,stem_up_x_offset:0,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:0},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2,stem_up_y_offset:-4,stem_down_y_offset:4},T1:{code:"v93",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T2:{code:"v40",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T3:{code:"v7d",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},X0:{code:"v92",stem_up_x_offset:-2,stem_down_x_offset:0,stem_up_y_offset:4,stem_down_y_offset:4},X1:{code:"v95",shift_right:-.5,stem_up_y_offset:4,stem_down_y_offset:4},X2:{code:"v3e",shift_right:.5,stem_up_y_offset:4,stem_down_y_offset:4},X3:{code:"v3b",shift_right:0,stem_up_x_offset:-1.2,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:2},S1:{code:"vd3",shift_right:0},S2:{code:"vd2",shift_right:0},R1:{code:"vd5",shift_right:0},R2:{code:"vd4",shift_right:0}};Flow.integerToNote=i=>{if(typeof i>"u")throw new Vex.RERR("BadArguments","Undefined integer for integerToNote");if(i<-2)throw new Vex.RERR("BadArguments","integerToNote requires integer > -2: ".concat(i));const e=Flow.integerToNote.table[i];if(!e)throw new Vex.RERR("BadArguments","Unknown note value for integer: ".concat(i));return e};Flow.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"};Flow.tabToGlyph=(i,e=1)=>{let t=null,r=0,s=0;if(i.toString().toUpperCase()==="X"){const o=new Glyph("v7f",Flow.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();t="v7f",r=o.width,s=-o.height/2}else r=Flow.textWidth(i.toString());return{text:i,code:t,getWidth:()=>r*e,shift_y:s}};Flow.textWidth=i=>7*i.toString().length;Flow.articulationCodes=i=>Flow.articulationCodes.articulations[i];Flow.articulationCodes.articulations={"a.":{code:"v23",between_lines:!0},av:{code:"v28",between_lines:!0},"a>":{code:"v42",between_lines:!0},"a-":{code:"v25",between_lines:!0},"a^":{code:"va",between_lines:!1},"a+":{code:"v8b",between_lines:!1},ao:{code:"v94",between_lines:!1},ah:{code:"vb9",between_lines:!1},"a@a":{code:"v43",between_lines:!1},"a@u":{code:"v5b",between_lines:!1},"a|":{code:"v75",between_lines:!1},am:{code:"v97",between_lines:!1},"a,":{code:"vb3",between_lines:!1}};Flow.accidentalCodes=i=>Flow.accidentalCodes.accidentals[i];Flow.accidentalCodes.accidentals={"#":{code:"v18",parenRightPaddingAdjustment:-1},"##":{code:"v7f",parenRightPaddingAdjustment:-1},b:{code:"v44",parenRightPaddingAdjustment:-2},bb:{code:"v26",parenRightPaddingAdjustment:-2},n:{code:"v4e",parenRightPaddingAdjustment:-1},"{":{code:"v9c",parenRightPaddingAdjustment:-1},"}":{code:"v84",parenRightPaddingAdjustment:-1},db:{code:"v9e",parenRightPaddingAdjustment:-1},d:{code:"vab",parenRightPaddingAdjustment:0},bbs:{code:"v90",parenRightPaddingAdjustment:-1},"++":{code:"v51",parenRightPaddingAdjustment:-1},"+":{code:"v78",parenRightPaddingAdjustment:-1},"+-":{code:"v8d",parenRightPaddingAdjustment:-1},"++-":{code:"v7a",parenRightPaddingAdjustment:-1},bs:{code:"vb7",parenRightPaddingAdjustment:-1},bss:{code:"v39",parenRightPaddingAdjustment:-1},o:{code:"vd0",parenRightPaddingAdjustment:-1},k:{code:"vd1",parenRightPaddingAdjustment:-1},ashs:{code:"vd6",parenRightPaddingAdjustment:-1},afhf:{code:"vd7",parenRightPaddingAdjustment:-1}};Flow.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}};Flow.ornamentCodes=i=>Flow.ornamentCodes.ornaments[i];Flow.ornamentCodes.ornaments={mordent:{code:"v1e"},mordent_inverted:{code:"v45"},turn:{code:"v72"},turn_inverted:{code:"v33"},tr:{code:"v1f"},upprall:{code:"v60"},downprall:{code:"vb4"},prallup:{code:"v6d"},pralldown:{code:"v2c"},upmordent:{code:"v29"},downmordent:{code:"v68"},lineprall:{code:"v20"},prallprall:{code:"v86"}};Flow.keySignature=i=>{const e=Flow.keySignature.keySpecs[i];if(!e)throw new Vex.RERR("BadKeySignature","Bad key signature spec: '".concat(i,"'"));if(!e.acc)return[];const t=Flow.keySignature.accidentalList(e.acc),r=[];for(let s=0;s({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[i];Flow.parseNoteDurationString=i=>{if(typeof i!="string")return null;const t=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(i);if(!t)return null;const r=t[1],s=t[2].length;let o=t[3];return o.length===0&&(o="n"),{duration:r,dots:s,type:o}};Flow.parseNoteStruct=i=>{const e=i.duration,t=Flow.parseNoteDurationString(e);if(!t)return null;let r=Flow.durationToTicks(t.duration);if(r==null)return null;let s=i.type;const o=[];if(s){if(!Flow.getGlyphProps.validTypes[s])return null}else s=t.type||"n",i.keys!==void 0&&i.keys.forEach((c,u)=>{const m=c.split("/");m&&m.length===3&&(o[u]=m[2])});const a=i.dots?i.dots:t.dots;if(typeof a!="number")return null;let l=r;for(let c=0;c{const e=Flow.durationAliases[i];if(e!==void 0&&(i=e),Flow.durationToTicks.durations[i]===void 0)throw new Vex.RERR("BadArguments","The provided duration is not valid: ".concat(i));return i};Flow.durationToFraction=i=>new Fraction().parse(Flow.sanitizeDuration(i));Flow.durationToNumber=i=>Flow.durationToFraction(i).value();Flow.durationToTicks=i=>{i=Flow.sanitizeDuration(i);const e=Flow.durationToTicks.durations[i];return e===void 0?null:e};Flow.durationToTicks.durations={"1/2":Flow.RESOLUTION*2,1:Flow.RESOLUTION/1,2:Flow.RESOLUTION/2,4:Flow.RESOLUTION/4,8:Flow.RESOLUTION/8,16:Flow.RESOLUTION/16,32:Flow.RESOLUTION/32,64:Flow.RESOLUTION/64,128:Flow.RESOLUTION/128,256:Flow.RESOLUTION/256};Flow.durationAliases={w:"1",h:"2",q:"4",b:"256"};Flow.getGlyphProps=(i,e)=>{i=Flow.sanitizeDuration(i);const t=Flow.getGlyphProps.duration_codes[i];if(t===void 0)return null;e||(e="n");let r=t.type[e];if(r===void 0){const s=Flow.keyProperties.customNoteHeads[e.toUpperCase()];if(s===void 0)return null;r={code_head:s.code,...s}}return{...t.common,...r}};Flow.getGlyphProps.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"}};Flow.getGlyphProps.duration_codes={"1/2":{common:{getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v53",i).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-Flow.STEM_HEIGHT,stem_down_extension:-Flow.STEM_HEIGHT,tabnote_stem_up_extension:-Flow.STEM_HEIGHT,tabnote_stem_down_extension:-Flow.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v53"},h:{code_head:"v59"},m:{code_head:"vf",stem_offset:0},r:{code_head:"v31",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},1:{common:{getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v1d",i).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-Flow.STEM_HEIGHT,stem_down_extension:-Flow.STEM_HEIGHT,tabnote_stem_up_extension:-Flow.STEM_HEIGHT,tabnote_stem_down_extension:-Flow.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v1d"},h:{code_head:"v46"},m:{code_head:"v92",stem_offset:-3},r:{code_head:"v5c",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},2:{common:{getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v81",i).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v81"},h:{code_head:"v2d"},m:{code_head:"v95",stem_offset:-3},r:{code_head:"vc",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},4:{common:{getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e",stem_offset:-3},r:{code_head:"v7c",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},8:{common:{getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"v54",code_flag_downstem:"v9a",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"va5",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},16:{common:{beam_count:2,getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v3f",code_flag_downstem:"v8f",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v3c",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},32:{common:{beam_count:3,getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v47",code_flag_downstem:"v2a",stem_up_extension:9,stem_down_extension:9,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v55",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},64:{common:{beam_count:4,getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"va9",code_flag_downstem:"v58",stem_up_extension:13,stem_down_extension:13,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v38",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},128:{common:{beam_count:5,getWidth(i=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",i).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v9b",code_flag_downstem:"v30",stem_up_extension:22,stem_down_extension:22,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"vaa",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}}};Flow.smufl={};Flow.smufl.to_code_points={bracketTop:"v1b",bracketBottom:"v10",barlineTick:"v6f",segno:"v8c",coda:"v4d",gClef:"v83",cClef:"vad",fClef:"v79",unpitchedPercussionClef1:"v59","6stringTabClef":"v2f",timeSig0:"v0",timeSig1:"v1",timeSig2:"v2",timeSig3:"v3",timeSig4:"v4",timeSig5:"v5",timeSig6:"v6",timeSig7:"v7",timeSig8:"v8",timeSig9:"v9",timeSigCommon:"v41",timeSigCutCommon:"vb6",noteheadDoubleWhole:"v53",noteheadWhole:"v1d",noteheadHalf:"v81",noteheadBlack:"vb",noteheadXWhole:"v92",noteheadXHalf:"v95",noteheadXBlack:"v3e",noteheadCircleX:"v3b",noteheadTriangleUpWhole:"v49",noteheadTriangleUpHalf:"v93",noteheadTriangleUpBlack:"v40",noteheadDiamondWhole:"v46",noteheadDiamondHalf:"v2d",noteheadDiamondBlack:"v22",augmentationDot:"v23",tremolo1:"v74",flag8thUp:"v54",flag8thDown:"v9a",flag16thUp:"v3f",flag16thDown:"v8f",flag32ndUp:"v47",flag32ndDown:"v2a",flag64thUp:"va9",flag64thDown:"v58",flag128thUp:"v9b",flag128thDown:"v30",accidentalFlat:"v44",accidentalNatural:"v4e",accidentalSharp:"v18",accidentalDoubleSharp:"v7f",accidentalDoubleFlat:"v26",accidentalParensLeft:"v9c",accidentalParensRight:"v84",accidentalQuarterToneFlatStein:"vab",accidentalThreeQuarterTonesFlatZimmermann:"v9e",accidentalQuarterToneSharpStein:"v78",accidentalThreeQuarterTonesSharpStein:"v51",accidentalBuyukMucennebFlat:"v39",accidentalBakiyeFlat:"vb7",accidentalKomaSharp:"v51",accidentalKucukMucennebSharp:"v8d",accidentalKoron:"vd1",accidentalSori:"vd0",articAccentAbove:"v42",articAccentBelow:"v42",articTenutoAbove:"v25",articTenutoBelow:"v25",articStaccatoAbove:"v23",articStaccatoBelow:"v23",articStaccatissimoAbove:"v28",articMarcatoAbove:"va",fermataAbove:"v43",fermataBelow:"v5b",breathMarkComma:"v6c",breathMarkUpbow:"v8a",caesura:"v34",caesuraCurved:"v4b",restMaxima:"v59",restDoubleWhole:"v31",restWhole:"v5c",restHalf:"vc",restQuarter:"v7c",rest8th:"va5",rest16th:"v3c",rest32nd:"v55",rest64th:"v38",rest128th:"vaa",dynamicPiano:"vbf",dynamicMezzo:"v62",dynamicForte:"vba",dynamicRinforzando:"vba",dynamicSforzando:"v4a",dynamicZ:"v80",ornamentTrill:"v1f",ornamentTurn:"v72",ornamentTurnSlash:"v33",ornamentMordent:"v45",ornamentMordentInverted:"v1e",ornamentTremblement:"v86",ornamentPrecompAppoggTrill:"v20",ornamentPrecompSlideTrillDAnglebert:"v60",ornamentPrecompSlideTrillBach:"v29",ornamentPrecompTrillSuffixDandrieu:"v6d",ornamentPrecompDoubleCadenceUpperPrefix:"vb4",ornamentPrecompDoubleCadenceUpperPrefixTurn:"v68",ornamentPrecompTrillLowerSuffix:"v2c",stringsDownBow:"v94",stringsUpBow:"v75",stringsHarmonic:"vb9",pluckedSnapPizzicatoAbove:"v94",pluckedLeftHandPizzicato:"v8b",keyboardPedalPed:"v36",keyboardPedalUp:"v5d",pictChokeCymbal:"vb3",wiggleArpeggiatoUp:"va3",arrowheadBlackUp:"vc3",arrowheadBlackDown:"v52"};Flow.TIME4_4={num_beats:4,beat_value:4,resolution:Flow.RESOLUTION};class CanvasContext{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static SanitizeCanvasDims(e,t){return Math.max(e,t)>this.CANVAS_BROWSER_SIZE_LIMIT&&(Vex.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT)),[e,t]}constructor(e){this.vexFlowCanvasContext=e,e.canvas?this.canvas=e.canvas:this.canvas={width:CanvasContext.WIDTH,height:CanvasContext.HEIGHT}}clear(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(){}closeGroup(){}add(){}setFont(e,t,r){return this.vexFlowCanvasContext.font=(r||"")+" "+t+"pt "+e,this}setRawFont(e){return this.vexFlowCanvasContext.font=e,this}setFillStyle(e){return this.vexFlowCanvasContext.fillStyle=e,this}setBackgroundFillStyle(e){return this.background_fillStyle=e,this}setStrokeStyle(e){return this.vexFlowCanvasContext.strokeStyle=e,this}setShadowColor(e){return this.vexFlowCanvasContext.shadowColor=e,this}setShadowBlur(e){return this.vexFlowCanvasContext.shadowBlur=e,this}setLineWidth(e){return this.vexFlowCanvasContext.lineWidth=e,this}setLineCap(e){return this.vexFlowCanvasContext.lineCap=e,this}setLineDash(e){return this.vexFlowCanvasContext.lineDash=e,this}scale(e,t){return this.vexFlowCanvasContext.scale(parseFloat(e),parseFloat(t))}resize(e,t){return[e,t]=this.SanitizeCanvasDims(parseInt(e,10),parseInt(t,10)),this.vexFlowCanvasContext.resize(e,t)}rect(e,t,r,s){return this.vexFlowCanvasContext.rect(e,t,r,s)}fillRect(e,t,r,s){return this.vexFlowCanvasContext.fillRect(e,t,r,s)}clearRect(e,t,r,s){return this.vexFlowCanvasContext.clearRect(e,t,r,s)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(e,t){return this.vexFlowCanvasContext.moveTo(e,t)}lineTo(e,t){return this.vexFlowCanvasContext.lineTo(e,t)}bezierCurveTo(e,t,r,s,o,a){return this.vexFlowCanvasContext.bezierCurveTo(e,t,r,s,o,a)}quadraticCurveTo(e,t,r,s){return this.vexFlowCanvasContext.quadraticCurveTo(e,t,r,s)}arc(e,t,r,s,o,a){return this.vexFlowCanvasContext.arc(e,t,r,s,o,a)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(e){return this.vexFlowCanvasContext.measureText(e)}fillText(e,t,r){return this.vexFlowCanvasContext.fillText(e,t,r)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}}class RaphaelContext{constructor(e){this.element=e,this.paper=Raphael(e),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}openGroup(){}closeGroup(){}add(){}setFont(e,t,r){return this.state.font_family=e,this.state.font_size=t,this.state.font_weight=r,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(e){return this.attributes.font=e,this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(){return this}setLineCap(){return this}scale(e,t){return this.state.scale={x:e,y:t},this.attributes.transform="S"+e+","+t+",0,0",this.attributes.scale=e+","+t+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+e+","+t+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}clear(){this.paper.clear()}resize(e,t){return this.element.style.width=e,this.paper.setSize(e,t),this}setViewBox(e){this.paper.canvas.setAttribute("viewBox",e)}rect(e,t,r,s){return s<0&&(t+=s,s=-s),this.paper.rect(e,t,r-.5,s-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(e,t,r,s){return s<0&&(t+=s,s=-s),this.paper.rect(e,t,r-.5,s-.5).attr(this.attributes),this}clearRect(e,t,r,s){return s<0&&(t+=s,s=-s),this.paper.rect(e,t,r-.5,s-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(e,t){return this.path+="M"+e+","+t,this.pen.x=e,this.pen.y=t,this}lineTo(e,t){return this.path+="L"+e+","+t,this.pen.x=e,this.pen.y=t,this}bezierCurveTo(e,t,r,s,o,a){return this.path+="C"+e+","+t+","+r+","+s+","+o+","+a,this.pen.x=o,this.pen.y=a,this}quadraticCurveTo(e,t,r,s){return this.path+="Q"+e+","+t+","+r+","+s,this.pen.x=r,this.pen.y=s,this}arc(e,t,r,s,o,a){function l(u){for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;return u}if(s=l(s),o=l(o),s>o){const u=s;s=o,o=u,a=!a}const c=o-s;return c>Math.PI?(this.arcHelper(e,t,r,s,s+c/2,a),this.arcHelper(e,t,r,s+c/2,o,a)):this.arcHelper(e,t,r,s,o,a),this}arcHelper(e,t,r,s,o,a){const l=e+r*Math.cos(s),c=t+r*Math.sin(s),u=e+r*Math.cos(o),m=t+r*Math.sin(o);let d=0,y=0;a?(y=1,o-sMath.PI&&(d=1),this.path+="M"+l+","+c+",A"+r+","+r+",0,"+d+","+y+","+u+","+m+"M"+this.pen.x+","+this.pen.y}glow(){const e=this.paper.set();if(this.shadow_attributes.width>0){const t=this.shadow_attributes,r=t.width/2;for(let s=1;s<=r;s++)e.push(this.paper.path(this.path).attr({stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(t.width/r*s).toFixed(3),opacity:+((t.opacity||.3)/r).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return e}fill(){const e=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(e),this}stroke(){const e=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,t=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",e);return this.glow(t),this}closePath(){return this.path+="Z",this}measureText(e){const t=this.paper.text(0,0,e).attr(this.attributes).attr("fill","none").attr("stroke","none"),r=t.getBBox();return t.remove(),{width:r.width,height:r.height}}fillText(e,t,r){return this.paper.text(t+this.measureText(e).width/2,r-this.state.font_size/(2.25*this.state.scale.y),e).attr(this.attributes),this}save(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this}restore(){const e=this.state_stack.pop();return this.state.font_family=e.state.font_family,this.attributes.font=e.attributes.font,this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this}}const attrNamesToIgnoreMap={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const i={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};Vex.Merge(attrNamesToIgnoreMap.rect,i),Vex.Merge(attrNamesToIgnoreMap.path,i)}class SVGContext{constructor(e){this.element=e,this.svgNS="http://www.w3.org/2000/svg";const t=this.create("svg");this.element.appendChild(t),this.svg=t,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}create(e){return document.createElementNS(this.svgNS,e)}openGroup(e,t,r){const s=this.create("g");return this.groups.push(s),this.parent.appendChild(s),this.parent=s,e&&s.setAttribute("class",Vex.Prefix(e)),t&&s.setAttribute("id",Vex.Prefix(t)),r&&r.pointerBBox&&s.setAttribute("pointer-events","bounding-box"),s}closeGroup(e){e?this.groups.pop().setAttribute("transform","translate(3,-7)"):this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(e){this.parent.appendChild(e)}iePolyfill(){typeof navigator<"u"&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))}setFont(e,t,r){let s=!1,o=!1,a="normal";typeof r=="string"&&(r.indexOf("italic")!==-1&&(r=r.replace(/italic/g,""),o=!0),r.indexOf("bold")!==-1&&(r=r.replace(/bold/g,""),s=!0),r=r.replace(/ /g,"")),r=s?"bold":r,r=typeof r>"u"||r===""?"normal":r,a=o?"italic":a;const l={"font-family":e,"font-size":t+"pt","font-weight":r,"font-style":a};return this.fontSize=Number(t),Vex.Merge(this.attributes,l),Vex.Merge(this.state,l),this}setRawFont(e){e=e.trim();const t=e.split(" ");return this.attributes["font-family"]=t[1],this.state["font-family"]=t[1],this.attributes["font-size"]=t[0],this.state["font-size"]=t[0],this.fontSize=Number(t[0].match(/\d+/)),this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(e){if(Object.prototype.toString.call(e)==="[object Array]")return e=e.join(", "),this.attributes["stroke-dasharray"]=e,this;throw new Vex.RERR("ArgumentError","lineDash must be an array of integers.")}setLineCap(e){return this.attributes["stroke-linecap"]=e,this}resize(e,t){this.width=e,this.height=t,this.element.style.width=e;const r={width:e,height:t};return this.applyAttributes(this.svg,r),this.scale(this.state.scale.x,this.state.scale.y),this}scale(e,t){this.state.scale={x:e,y:t};const r=this.width/e,s=this.height/t;return this.setViewBox(0,0,r,s),this}setViewBox(...e){if(e.length===1){const[t]=e;this.svg.setAttribute("viewBox",t)}else{const[t,r,s,o]=e,a=t+" "+r+" "+s+" "+o;this.svg.setAttribute("viewBox",a)}}applyAttributes(e,t){const r=attrNamesToIgnoreMap[e.nodeName];return Object.keys(t).forEach(s=>{var o;r&&r[s]||!s||!t[s]||s==="d"&&((o=t[s])==null?void 0:o.indexOf("NaN"))>-1||e.setAttributeNS(null,s,t[s])}),e}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(e,t,r,s,o){s<0&&(t+=s,s*=-1);const a=this.create("rect");return typeof o>"u"&&(o={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),Vex.Merge(o,{x:e,y:t,width:r,height:s}),this.applyAttributes(a,o),this.add(a),this}fillRect(e,t,r,s){return s<0&&(t+=s,s*=-1),this.rect(e,t,r,s,this.attributes),this}clearRect(e,t,r,s){return this.rect(e,t,r,s,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(e,t){return this.path+="M"+e+" "+t,this.pen.x=e,this.pen.y=t,this}lineTo(e,t){return this.path+="L"+e+" "+t,this.pen.x=e,this.pen.y=t,this}bezierCurveTo(e,t,r,s,o,a){return this.path+="C"+e+" "+t+","+r+" "+s+","+o+" "+a,this.pen.x=o,this.pen.y=a,this}quadraticCurveTo(e,t,r,s){return this.path+="Q"+e+" "+t+","+r+" "+s,this.pen.x=r,this.pen.y=s,this}arc(e,t,r,s,o,a){function l(u){for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;return u}if(s=l(s),o=l(o),s>o){const u=s;s=o,o=u,a=!a}const c=o-s;return c>Math.PI?(this.arcHelper(e,t,r,s,s+c/2,a),this.arcHelper(e,t,r,s+c/2,o,a)):this.arcHelper(e,t,r,s,o,a),this}arcHelper(e,t,r,s,o,a){const l=e+r*Math.cos(s),c=t+r*Math.sin(s),u=e+r*Math.cos(o),m=t+r*Math.sin(o);let d=0,y=0;a?(y=1,o-sMath.PI&&(d=1),this.path+="M"+l+" "+c+" A"+r+" "+r+" 0 "+d+" "+y+" "+u+" "+m,!isNaN(this.pen.x)&&!isNaN(this.pen.y)&&(this.peth+="M"+this.pen.x+" "+this.pen.y)}closePath(){return this.path+="Z",this}glow(){if(this.shadow_attributes.width>0){const e=this.shadow_attributes,t=e.width/2;for(let r=1;r<=t;r++){const s={stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width*.4/t*r).toFixed(3),opacity:+((e.opacity||.3)/t).toFixed(3)},o=this.create("path");s.d=this.path,this.applyAttributes(o,s),this.add(o)}}return this}fill(e){this.glow();const t=this.create("path");let r=e;return typeof e>"u"?(e={},Vex.Merge(e,this.attributes),e.stroke="none",r=e):(r=e,Vex.Merge(r,this.attributes),e.class&&(r.class=e.class),e.id&&(r.id=e.id)),e.d=this.path,this.applyAttributes(t,e),this.add(t),this}stroke(e=void 0){this.glow();const t=this.create("path"),r={};return Vex.Merge(r,this.attributes),e&&Vex.Merge(r,e),r.fill="none",r["stroke-width"]=this.lineWidth,r.d=this.path,this.applyAttributes(t,r),this.add(t),this}measureText(e){const t=this.create("text");if(typeof t.getBBox!="function")return{x:0,y:0,width:0,height:0};t.textContent=e,this.applyAttributes(t,this.attributes),this.svg.appendChild(t);let r=t.getBBox();return this.ie&&e!==""&&this.attributes["font-style"]==="italic"&&(r=this.ieMeasureTextFix(r,e)),this.svg.removeChild(t),r}ieMeasureTextFix(e){const t=Number(this.fontSize),r=1.196,s=1.9598,o=r*t+s,a=e.width-o,l=e.height-1.5;return{x:e.x,y:e.y,width:a,height:l}}fillText(e,t,r){if(!e||e.length<=0)return;const s={};Vex.Merge(s,this.attributes),s.stroke="none",s.x=t,s.y=r;const o=this.create("text");o.textContent=e,this.applyAttributes(o,s),this.add(o)}save(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this}restore(){const e=this.state_stack.pop();return this.state["font-family"]=e.state["font-family"],this.state["font-weight"]=e.state["font-weight"],this.state["font-style"]=e.state["font-style"],this.state["font-size"]=e.state["font-size"],this.state.scale=e.state.scale,this.attributes["font-family"]=e.attributes["font-family"],this.attributes["font-weight"]=e.attributes["font-weight"],this.attributes["font-style"]=e.attributes["font-style"],this.attributes["font-size"]=e.attributes["font-size"],this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.attributes["stroke-dasharray"]=e.attributes["stroke-dasharray"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this.lineWidth=e.lineWidth,this}}let lastContext=null;class Renderer{static get Backends(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}static get LineEndType(){return{NONE:1,UP:2,DOWN:3}}static get USE_CANVAS_PROXY(){return!1}static get lastContext(){return lastContext}static set lastContext(e){lastContext=e}static buildContext(e,t,r,s,o){const a=new Renderer(e,t);r&&s&&a.resize(r,s),o||(o="#FFF");const l=a.getContext();return l.setBackgroundFillStyle(o),Renderer.lastContext=l,l}static getCanvasContext(e,t,r,s){return Renderer.buildContext(e,Renderer.Backends.CANVAS,t,r,s)}static getRaphaelContext(e,t,r,s){return Renderer.buildContext(e,Renderer.Backends.RAPHAEL,t,r,s)}static getSVGContext(e,t,r,s){return Renderer.buildContext(e,Renderer.Backends.SVG,t,r,s)}static bolsterCanvasContext(e){if(Renderer.USE_CANVAS_PROXY)return new CanvasContext(e);const t=["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"];return e.vexFlowCanvasContext=e,t.forEach(r=>{e[r]=e[r]||CanvasContext.prototype[r]}),e}static drawDashedLine(e,t,r,s,o,a){e.beginPath();const l=s-t,c=o-r,u=Math.atan2(c,l);let m=t,d=r;e.moveTo(t,r);let y=0,b=!0;for(;!((l<0?m<=s:m>=s)&&(c<0?d<=o:d>=o));){const S=a[y++%a.length],A=m+Math.cos(u)*S;m=l<0?Math.max(s,A):Math.min(s,A);const P=d+Math.sin(u)*S;d=c<0?Math.max(o,P):Math.min(o,P),b?e.lineTo(m,d):e.moveTo(m,d),b=!b}e.closePath(),e.stroke()}constructor(e,t){if(this.elementId=e,!this.elementId)throw new Vex.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(e),this.element||(this.element=e),this.ctx=null,this.paper=null,this.backend=t,this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement","Can't get canvas context from element: ".concat(e));this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===Renderer.Backends.RAPHAEL)this.ctx=new RaphaelContext(this.element);else if(this.backend===Renderer.Backends.SVG)this.ctx=new SVGContext(this.element);else throw new Vex.RERR("InvalidBackend","No support for backend: ".concat(this.backend))}resize(e,t){if(this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement","Can't get canvas context from element: ".concat(this.elementId));[e,t]=CanvasContext.SanitizeCanvasDims(e,t);const r=window.devicePixelRatio||1;this.element.width=e*r,this.element.height=t*r,this.element.style.width=e+"px",this.element.style.height=t+"px",this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(r,r)}else this.ctx.resize(e,t);return this}getContext(){return this.ctx}}function L$j(...i){Stem.DEBUG&&Vex.L("Vex.Flow.Stem",i)}class Stem extends Element$1{static get CATEGORY(){return"stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return Flow.STEM_WIDTH}static get HEIGHT(){return Flow.STEM_HEIGHT}constructor(e={}){super(),this.setAttribute("type","Stem"),this.x_begin=e.x_begin||0,this.x_end=e.x_end||0,this.y_top=e.y_top||0,this.y_bottom=e.y_bottom||0,this.stem_extension=e.stem_extension||0,this.stem_direction=e.stem_direction||0,this.hide=e.hide||!1,this.isStemlet=e.isStemlet||!1,this.stemletHeight=e.stemletHeight||0,this.resetHeight=0,this.renderHeightAdjustment=0,this.setOptions(e)}setResetHeight(e){this.resetHeight=e}setOptions(e){this.stem_up_y_offset=e.stem_up_y_offset||0,this.stem_down_y_offset=e.stem_down_y_offset||0}setNoteHeadXBounds(e,t){return this.x_begin=e,this.x_end=t,this}setDirection(e){this.stem_direction=e}setExtension(e){this.stem_extension=e}getExtension(){return this.stem_extension}setYBounds(e,t){this.y_top=e,this.y_bottom=t}getCategory(){return Stem.CATEGORY}getHeight(){const e=this.stem_direction===Stem.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(Stem.HEIGHT-e+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new Vex.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const e=this.stem_direction===Stem.UP,t=[this.y_top,this.y_bottom],r=Stem.HEIGHT+this.stem_extension,s=(e?Math.min:Math.max)(...t),o=(e?Math.max:Math.min)(...t);return{topY:s+r*-this.stem_direction+this.resetHeight*-this.stem_direction,baseY:o}}setVisibility(e){return this.hide=!e,this}setStemlet(e,t){return this.isStemlet=e,this.stemletHeight=t,this}draw(){if(this.setRendered(),this.hide)return;const e=this.checkContext();let t,r;const s=this.stem_direction;s===Stem.DOWN?(t=this.x_begin,r=this.y_top+this.stem_down_y_offset):(t=this.x_end,r=this.y_bottom-this.stem_up_y_offset);const o=this.getHeight();L$j("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const a=this.isStemlet?o-this.stemletHeight*this.stem_direction:0;if(e.save(),this.applyStyle(e),e.beginPath(),e.setLineWidth(Stem.WIDTH),e.moveTo(t,r-a),e.lineTo(t,r-o-this.renderHeightAdjustment*s-this.resetHeight*s),e.svg){const l={class:Vex.Prefix("stem")};this.id&&(l.id=this.id),e.stroke(l)}else e.stroke();this.restoreStyle(e),e.restore()}}let Tuplet$1=class Et extends Element$1{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(e,t){if(super(),this.setAttribute("type","Tuplet"),!e||!e.length)throw new Vex.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=Vex.Merge({},t),this.notes=e,this.num_notes="num_notes"in this.options?this.options.num_notes:e.length,this.options.beats_occupied&&this.beatsOccupiedDeprecationWarning(),this.notes_occupied=this.options.notes_occupied||this.options.beats_occupied||2,"bracketed"in this.options?this.bracketed=this.options.bracketed:this.bracketed=e.some(r=>r.beam===null),this.ratioed="ratioed"in this.options?this.options.ratioed:Math.abs(this.notes_occupied-this.num_notes)>1,this.point=28,this.y_pos=16,this.x_pos=100,this.width=200,this.location=this.options.location||Et.LOCATION_TOP,Formatter.AlignRestsToNotes(e,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let e=0;e=1;)this.numerator_glyphs.unshift(new Glyph("v"+e%10,this.point)),e=parseInt(e/10,10);for(this.denom_glyphs=[],e=this.notes_occupied;e>=1;)this.denom_glyphs.unshift(new Glyph("v"+e%10,this.point)),e=parseInt(e/10,10)}getNestedTupletCount(){const e=this.location,t=this.notes[0];let r=o(t,e),s=o(t,e);function o(a,l){return a.tupletStack.filter(c=>c.location===l).length}return this.notes.forEach(a=>{const l=o(a,e);r=l>r?l:r,s=ls&&(s=a)}}return s+e+t}draw(){this.checkContext(),this.setRendered();const e=this.notes[0],t=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=e.getTieLeftX()-5,this.width=t.getTieRightX()-this.x_pos+5):(this.x_pos=e.getStemX(),this.width=t.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const r=(c,u)=>c+u.getMetrics().width;let s=this.numerator_glyphs.reduce(r,0);this.ratioed&&(s=this.denom_glyphs.reduce(r,s),s+=this.point*.32);const a=this.x_pos+this.width/2-s/2;if(this.bracketed){const c=this.width/2-s/2-5;c>0&&(this.context.fillRect(this.x_pos,this.y_pos,c,1),this.context.fillRect(this.x_pos+this.width/2+s/2+5,this.y_pos,c,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===Et.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===Et.LOCATION_BOTTOM),1,this.location*10))}let l=0;if(this.numerator_glyphs.forEach(c=>{c.render(this.context,a+l,this.y_pos+this.point/3-2),l+=c.getMetrics().width}),this.ratioed){const c=a+l+this.point*.16,u=this.point*.06;this.context.beginPath(),this.context.arc(c,this.y_pos-this.point*.08,u,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(c,this.y_pos+this.point*.12,u,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),l+=this.point*.32,this.denom_glyphs.forEach(m=>{m.render(this.context,a+l,this.y_pos+this.point/3-2),l+=m.getMetrics().width})}}};function calculateStemDirection(i){let e=0;return i.forEach(t=>{t.keyProps&&t.keyProps.forEach(r=>{e+=r.line-3})}),e>=0?Stem.DOWN:Stem.UP}const getStemSlope=(i,e)=>{const t=i.getStemExtents().topY,r=i.getStemX(),s=e.getStemExtents().topY,o=e.getStemX();return(s-t)/(o-r)},BEAM_LEFT="L",BEAM_RIGHT="R",BEAM_BOTH="B";let Beam$1=class ci extends Element$1{static getDefaultBeamGroups(e){(!e||e==="c")&&(e="4/4");const r={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[e];if(r===void 0){const s=parseInt(e.split("/")[0],10),o=parseInt(e.split("/")[1],10);if(s%3===0)return[new Fraction(3,o)];if(o>4)return[new Fraction(2,o)];if(o<=4)return[new Fraction(1,o)]}else return r.map(s=>new Fraction().parse(s));return[new Fraction(1,4)]}static applyAndGetBeams(e,t,r){return ci.generateBeams(e.getTickables(),{groups:r,stem_direction:t})}static generateBeams(e,t){t||(t={}),(!t.groups||!t.groups.length)&&(t.groups=[new Fraction(2,8)]);const r=t.groups.map(T=>{if(!T.multiply)throw new Vex.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return T.clone().multiply(Flow.RESOLUTION,1)}),s=e;let o=0,a=[],l=[];function c(T){return T.reduce((C,R)=>R.getTicks().clone().add(C),new Fraction(0,1))}function u(){r.length-1>o?o+=1:o=0}function m(){let T=[];s.forEach(C=>{if(T=[],C.shouldIgnoreTicks()){a.push(l),l=T;return}l.push(C);const R=r[o].clone(),I=c(l),M=Flow.durationToNumber(C.duration)<8;M&&C.tuplet&&(R.numerator*=2),I.greaterThan(R)?(M||T.push(l.pop()),a.push(l),l=T,u()):I.equals(R)&&(a.push(l),l=T,u())}),l.length>0&&a.push(l)}function d(){return a.filter(T=>{if(T.length>1){let C=!0;return T.forEach(R=>{R.getIntrinsicTicks()>=Flow.durationToTicks("4")&&(C=!1)}),C}return!1})}function y(){const T=[];a.forEach(C=>{let R=[];C.forEach((I,M,D)=>{const H=M===0||M===D.length-1,W=D[M-1],O=!t.beam_rests&&I.isRest(),z=t.beam_rests&&t.beam_middle_only&&I.isRest()&&H;let k=!1;if(t.maintain_stem_directions&&W&&!I.isRest()&&!W.isRest()){const G=W.getStemDirection();k=I.getStemDirection()!==G}const $=parseInt(I.duration,10)<8;O||z||k||$?(R.length>0&&T.push(R),R=k?[I]:[]):R.push(I)}),R.length>0&&T.push(R)}),a=T}function b(){a.forEach(T=>{let C;if(t.maintain_stem_directions){const R=S(T);C=R?R.getStemDirection():Stem.UP}else t.stem_direction?C=t.stem_direction:C=calculateStemDirection(T);A(T,C)})}function S(T){for(let C=0;C{R.setStemDirection(C)})}function P(){const T=[];return a.forEach(C=>{let R=null;C.forEach(I=>{I.tuplet&&R!==I.tuplet&&(R=I.tuplet,T.push(R))})}),T}m(),y(),b();const x=d(),E=P(),_=[];return x.forEach(T=>{const C=new ci(T);t.show_stemlets&&(C.render_options.show_stemlets=!0),t.secondary_breaks&&(C.render_options.secondary_break_ticks=Flow.durationToTicks(t.secondary_breaks)),t.flat_beams===!0&&(C.render_options.flat_beams=!0,C.render_options.flat_beam_offset=t.flat_beam_offset),_.push(C)}),E.forEach(T=>{const C=T.notes[0].stem_direction===Stem.DOWN?Tuplet$1.LOCATION_BOTTOM:Tuplet$1.LOCATION_TOP;T.setTupletLocation(C);let R=!1;for(let I=0;I=Flow.durationToTicks("4"))throw new Vex.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let r,s;for(this.stem_direction=Stem.UP,r=0;rl+c.stem_direction,0)>-1?Stem.UP:Stem.DOWN),r=0;rr.getGlyph().beam_count).reduce((r,s)=>s>r?s:r)}breakSecondaryAt(e){return this.break_on_indices=e,this}getSlopeY(e,t,r,s){return r+(e-t)*s}calculateSlope(){const{notes:e,stem_direction:t,render_options:{max_slope:r,min_slope:s,slope_iterations:o,slope_cost:a}}=this,l=e[0],c=getStemSlope(l,e[e.length-1]),u=(r-s)/o;let m=Number.MAX_VALUE,d=0,y=0;for(let b=s;b<=r;b+=u){let S=0,A=0;for(let _=1;_P)&&(u=P,l=Math.min(...A.getYs()),c=A.getBeamCount())}let m=a/e.length;const d=r*1.5,y=s+c*d,b=l+y*-t;t===Stem.DOWN&&mb&&(m=l-y),o+this.render_options.flat_beam_offset_per_beam>0?t===Stem.DOWN&&m>o&&!this.render_options.flat_beams?this.render_options.flat_beam_offset=m:t===Stem.UP&&m0){let s=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(s+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let o=this.notes[0].note_heads[0].y;const a=this.stem_direction>0?Math.min:Math.max;for(const l of this.notes)for(const c of l.note_heads)o=a(o,c.y);r=o+s*-this.stem_direction}return r}applyStemExtensions(){const{notes:e,slope:t,y_shift:r,stem_direction:s,beam_count:o,render_options:{show_stemlets:a,stemlet_extension:l,beam_width:c}}=this,u=e[0],m=this.getBeamYToDraw(),d=u.getStemX();for(let y=0;y=8&&(b=this.break_on_indices.indexOf(m)!==-1,this.render_options.secondary_break_ticks&&c>=this.render_options.secondary_break_ticks&&(c=0,b=!0));const S=d.getIntrinsicTicks(){e.getStem()&&(this.context.openGroup("stem",e.getAttribute("id")+"-stem"),e.getStem().setContext(this.context).draw(),this.context.closeGroup())},this)}drawBeamLines(){this.checkContext();const e=["4","8","16","32","64"],t=this.notes[0];let r=this.getBeamYToDraw();const s=t.getStemX(),o=this.render_options.beam_width*this.stem_direction,a={};for(const l of this.notes)a[l.getAttribute("id")]=0;for(let l=0;l{e.getStave()||e.setStave(this.stave)}),this.preFormatted=!0,this)}draw(e=this.context,t=this.stave){this.setRendered();let r=null;for(let s=0;s0&&r){const a=o.getBoundingBox();a&&r.mergeWith(a)}o.setContext(e),o.drawWithStyle()}this.boundingBox=r}};function drawBoldDoubleLine(i,e,t,r,s){if(e!==StaveConnector.type.BOLD_DOUBLE_LEFT&&e!==StaveConnector.type.BOLD_DOUBLE_RIGHT)throw new Vex.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let o=3,a=3.5;const l=2;e===StaveConnector.type.BOLD_DOUBLE_RIGHT&&(o=-5,a=3),i.fillRect(t+o,r,1,s-r),i.fillRect(t-l,r,a,s-r)}class StaveConnector extends Element$1{static get type(){return{SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8}}static get typeString(){return{singleRight:StaveConnector.type.SINGLE_RIGHT,singleLeft:StaveConnector.type.SINGLE_LEFT,single:StaveConnector.type.SINGLE,double:StaveConnector.type.DOUBLE,brace:StaveConnector.type.BRACE,bracket:StaveConnector.type.BRACKET,boldDoubleLeft:StaveConnector.type.BOLD_DOUBLE_LEFT,boldDoubleRight:StaveConnector.type.BOLD_DOUBLE_RIGHT,thinDouble:StaveConnector.type.THIN_DOUBLE,none:StaveConnector.type.NONE}}constructor(e,t){super(),this.setAttribute("type","StaveConnector"),this.thickness=Flow.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=e,this.bottom_stave=t,this.type=StaveConnector.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(e){return e=typeof e=="string"?StaveConnector.typeString[e]:e,e>=StaveConnector.type.SINGLE_RIGHT&&e<=StaveConnector.type.NONE&&(this.type=e),this}setText(e,t){return this.texts.push({content:e,options:Vex.Merge({shift_x:0,shift_y:0},t)}),this}setFont(e){Vex.Merge(this.font,e)}setXShift(e){if(typeof e!="number")throw Vex.RERR("InvalidType","x_shift must be a Number");return this.x_shift=e,this}draw(){const e=this.checkContext();this.setRendered();let t=this.top_stave.getYForLine(0),r=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,s=this.width,o=this.top_stave.getX();(this.type===StaveConnector.type.SINGLE_RIGHT||this.type===StaveConnector.type.BOLD_DOUBLE_RIGHT||this.type===StaveConnector.type.THIN_DOUBLE)&&(o=this.top_stave.getX()+this.top_stave.width);let l=r-t;switch(this.type){case StaveConnector.type.SINGLE:s=1;break;case StaveConnector.type.SINGLE_LEFT:s=1;break;case StaveConnector.type.SINGLE_RIGHT:s=1;break;case StaveConnector.type.DOUBLE:o-=this.width+2;break;case StaveConnector.type.BRACE:{s=12;const c=this.top_stave.getX()-2+this.x_shift,u=t,m=c,d=r,y=c-s,b=u+l/2,S=y-.9*s,A=u+.2*l,P=c+1.1*s,x=b-.135*l,E=P,_=b+.135*l,T=S,C=d-.2*l,R=y-s,I=C,M=c+.4*s,D=b+.135*l,H=M,W=b-.135*l,O=R,z=A;e.beginPath(),e.moveTo(c,u),e.bezierCurveTo(S,A,P,x,y,b),e.bezierCurveTo(E,_,T,C,m,d),e.bezierCurveTo(R,I,M,D,y,b),e.bezierCurveTo(H,W,O,z,c,u),e.fill(),e.stroke();break}case StaveConnector.type.BRACKET:t-=4,r+=4,l=r-t,Glyph.renderGlyph(e,o-5,t-3,40,"v1b",!0),Glyph.renderGlyph(e,o-5,r+3,40,"v10",!0),o-=this.width+2;break;case StaveConnector.type.BOLD_DOUBLE_LEFT:drawBoldDoubleLine(e,this.type,o+this.x_shift,t,r);break;case StaveConnector.type.BOLD_DOUBLE_RIGHT:drawBoldDoubleLine(e,this.type,o,t,r);break;case StaveConnector.type.THIN_DOUBLE:s=1;break;case StaveConnector.type.NONE:break;default:throw new Vex.RERR("InvalidType","The provided StaveConnector.type (".concat(this.type,") is invalid"))}this.type!==StaveConnector.type.BRACE&&this.type!==StaveConnector.type.BOLD_DOUBLE_LEFT&&this.type!==StaveConnector.type.BOLD_DOUBLE_RIGHT&&this.type!==StaveConnector.type.NONE&&e.fillRect(o,t,s,l),this.type===StaveConnector.type.THIN_DOUBLE&&e.fillRect(o-3,t,s,l),e.save(),e.lineWidth=2,e.setFont(this.font.family,this.font.size,this.font.weight);for(let c=0;c0){const P=A.space.deviation,x=P>=0?"+":"";e.setFillStyle("red"),e.fillText(x+Math.round(P),l+t.getXShift(),r-10)}e.restore()}constructor(e){if(super(),this.setAttribute("type","Note"),!e)throw new Vex.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const t=Flow.parseNoteStruct(e);if(!t)throw new Vex.RuntimeError("BadArguments","Invalid note initialization object: ".concat(JSON.stringify(e)));if(this.duration=t.duration,this.dots=t.dots,this.noteType=t.type,this.customTypes=t.customTypes,this.DYMusicScoreType=e.DYMusicScoreType,e.duration_override?this.setDuration(e.duration_override):this.setIntrinsicTicks(t.ticks),this.modifiers=[],this.glyph=Flow.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(r=>Flow.getGlyphProps(this.duration,r)),this.positions&&(typeof this.positions!="object"||!this.positions.length))throw new Vex.RuntimeError("BadArguments","Note keys must be array type.");this.playNote=null,this.tickContext=null,this.modifierContext=null,this.ignore_ticks=!1,this.width=0,this.extraLeftPx=0,this.extraRightPx=0,this.x_shift=0,this.left_modPx=0,this.right_modPx=0,this.voice=null,this.preFormatted=!1,this.ys=[],e.align_center&&this.setCenterAlignment(e.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:Note.STAVEPADDING}}getPlayNote(){return this.playNote}setPlayNote(e){return this.playNote=e,this}isRest(){return!1}addStroke(e,t){return t.setNote(this),t.setIndex(e),this.modifiers.push(t),this.setPreFormatted(!1),this}getStave(){return this.stave}setStave(e){return this.stave=e,this.setYs([e.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return Note.CATEGORY}setContext(e){return this.context=e,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(e){return this.extraLeftPx=e,this}setExtraRightPx(e){return this.extraRightPx=e,this}shouldIgnoreTicks(){return this.ignore_ticks}getLineNumber(){return 0}getLineForRest(){return 0}getGlyph(){return this.glyph}getGlyphWidth(){return this.glyph.getWidth?this.glyph.getWidth(this.render_options.glyph_font_scale):15}setYs(e){return this.ys=e,this}getYs(){if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(e){if(!this.stave)throw new Vex.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(e)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new Vex.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(e){return this.voice=e,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(e){return this.tickContext=e,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.dots>0}hasStem(){return!1}getDots(){return this.dots}getNoteType(){return this.noteType}setBeam(){return this}setModifierContext(e){return this.modifierContext=e,this}addModifier(e,t=0){return e.setNote(this),e.setIndex(t),this.modifiers.push(e),this.setPreFormatted(!1),this}getModifierStartXY(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let e=0,t=0;this.modifierContext!=null&&(e=this.modifierContext.state.left_shift,t=this.modifierContext.state.right_shift);const r=this.getWidth();return{width:r,noteWidth:r-e-t-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:e,modRightPx:t,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(e){this.width=e}getWidth(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}setXShift(e){return this.x_shift=e,this}getXShift(){return this.x_shift}getX(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}getAbsoluteX(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");let e=this.tickContext.getX();return this.stave&&(e+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(this.DYMusicScoreType==="jianpu"||(e+=this.getCenterXShift())),e}setPreFormatted(e){if(this.preFormatted=e,this.preFormatted){const t=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,t.left),this.right_modPx=Math.max(this.right_modPx,t.right)}}}function L$i(...i){NoteHead.DEBUG&&Vex.L("Vex.Flow.NoteHead",i)}function drawSlashNoteHead(i,e,t,r,s,o){const a=Flow.SLASH_NOTEHEAD_WIDTH;i.save(),i.setLineWidth(Flow.STEM_WIDTH);let l=!1;if(Flow.durationToNumber(e)>2&&(l=!0),l||(t-=Flow.STEM_WIDTH/2*s),i.beginPath(),i.moveTo(t,r+o),i.lineTo(t,r+1),i.lineTo(t+a,r-o),i.lineTo(t+a,r),i.lineTo(t,r+o),i.closePath(),l?i.fill():i.stroke(),Flow.durationToFraction(e).equals(.5)){const c=[-3,-1,a+1,a+3];for(let u=0;u{const l=a.getTickContext();a.setStave(t.stave),l.setXOffset(o)})}}class Dot extends Modifier{static get CATEGORY(){return"dots"}static format(e,t){const r=t.right_shift,s=1;if(!e||e.length===0)return!1;const o=[],a={};for(let b=0;bS.line-b.line);let l=r,c=0,u=null,m=null,d=null,y=0;for(let b=0;bc?l:c,u=x,m=A}return t.right_shift+=c,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=Modifier.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return Dot.CATEGORY}setNote(e){this.note=e,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(e){return this.dot_shiftY=e,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index===null)throw new Vex.RERR("NoAttachedNote","Can't draw dot without a note and index.");const e=this.note.stave.options.spacing_between_lines_px,t=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(t.y=this.note.getStemExtents().baseY+1);const r=t.x+this.x_shift+this.width-this.radius;let s=this.dot_shiftY*e;this.note&&this.note.DYMusicScoreType=="jianpu"&&(s=-5);const o=t.y+this.y_shift+s,a=this.context;a.beginPath(),a.arc(r,o,this.radius,0,Math.PI*2,!1),a.fill()}}function L$h(...i){StaveNote.DEBUG&&Vex.L("Vex.Flow.StaveNote",i)}const getStemAdjustment=i=>Stem.WIDTH/(2*-i.getStemDirection()),isInnerNoteIndex=(i,e)=>e===(i.getStemDirection()===Stem.UP?i.keyProps.length-1:0);function shiftRestVertical(i,e,t){const r=(e.isrest?0:1)*t;i.line+=r,i.maxLine+=r,i.minLine+=r,i.note.setKeyLine(0,i.note.getKeyLine(0)+r)}function centerRest(i,e,t){const r=i.line-Vex.MidLine(e.minLine,t.maxLine);i.note.setKeyLine(0,i.note.getKeyLine(0)-r),i.line-=r,i.maxLine-=r,i.minLine-=r}class StaveNote extends StemmableNote{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return Stem.UP}static get STEM_DOWN(){return Stem.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static renderVibrato(e,t,r,s){let{width:o,height:a,wave_width:l,wave_girth:c,wave_height:u,stem_direction:m}=s;const d=Math.floor(o/l);let y=a/(d/2)*m;y==0&&(m=1,y=.3),e.beginPath(),e.moveTo(t,r+c);for(let b=0;b2?r[1]:null;let c=o>2?r[2]:r[1];o===2&&a.stemDirection===-1&&c.stemDirection===1&&(a=r[1],c=r[0]);const u=Math.max(a.voice_shift,c.voice_shift);let m=0,d;if(o===2){const y=a.stemDirection===c.stemDirection?0:.5;if(a.stemDirection===c.stemDirection&&a.minLine<=c.maxLine&&(a.isrest||(d=Math.abs(a.line-(c.maxLine+.5)),d=Math.max(d,a.stemMin),a.minLine=a.line-d,a.note.setStemLength(d*10))),a.minLine<=c.maxLine+y)if(a.isrest)shiftRestVertical(a,c,1);else if(c.isrest)shiftRestVertical(c,a,-1);else{m=u;const b=Math.abs(a.line-c.line);let S=0,A=0;a.note.duration==="h"?S++:a.note.duration==="w"&&A++,c.note.duration==="h"?S++:c.note.duration==="w"&&A++;let P=S===1||A===1||a.note.dots!==c.note.dots;if(s&&(P=P||A===2),b===0&&P){if(c.note.setXShift(m),a.note.dots>0){let x=0;for(const E of a.note.modifiers)if(E instanceof Dot&&(x++,E.setYShift(-10*(c.maxLine-a.line+1)),x===a.note.dots))break}}else b<1&&b>0?c.note.setXShift(m):a.note.voice!==c.note.voice&&a.stemDirection===c.stemDirection&&(a.line>c.line?a.stemDirection===1?c.note.renderFlag=!1:a.note.renderFlag=!1:c.line>a.line?c.stemDirection===1?a.note.renderFlag=!1:c.note.renderFlag=!1:c.stemDirection===1&&(c.stemDirection=-1,c.note.setStemDirection(-1)))}return!0}if(l!==null&&l.minLinet.postFormat()),!0):!1}constructor(e){if(super(e),this.setAttribute("type","StaveNote"),this.keys=e.keys,this.clef=e.clef,this.octave_shift=e.octave_shift,this.beam=null,this.vibrato=null,this.slideNote=null,this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): ".concat(JSON.stringify(e)));this.displaced=!1,this.dot_shiftY=0,this.addDotsCount=0,this.keyProps=[],this.use_default_head_x=!1,this.note_heads=[],this.modifiers=[],Vex.Merge(this.render_options,{glyph_font_scale:e.glyph_font_scale||Flow.DEFAULT_NOTATION_FONT_SCALE,stroke_px:e.stroke_px||StaveNote.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),e.auto_stem?this.autoStem():this.setStemDirection(e.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();const e=this.note_heads.map(t=>t.getStyle());this.buildNoteHeads(),this.note_heads.forEach((t,r)=>t.setStyle(e[r])),this.stave&&this.note_heads.forEach(t=>t.setStave(this.stave)),this.calcExtraPx()}setBeam(e){return this.beam=e,this.calcExtraPx(),this}setVibrato(e){this.vibrato=e}setSlideNote(e){this.slideNote=e}getCategory(){return StaveNote.CATEGORY}buildStem(){this.setStem(new Stem({hide:!!this.isRest()})),this.stem.id=Vex.Prefix("".concat(this.getAttribute("id"),"-stem"))}buildNoteHeads(){this.note_heads=[];const e=this.getStemDirection(),t=this.getKeys();let r=null,s=null,o=!1,a,l,c;e===Stem.UP?(a=0,l=t.length,c=1):e===Stem.DOWN&&(a=t.length-1,l=-1,c=-1);for(let u=a;u!==l;u+=c){const m=this.keyProps[u],d=m.line;r===null?r=d:(s=Math.abs(r-d),s===0||s===.5?o=!o:(o=!1,this.use_default_head_x=!0)),r=d;const y=new NoteHead({duration:this.duration,note_type:this.noteType,displaced:o,stem_direction:e,custom_glyph_code:m.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:m.shift_right,stem_up_x_offset:m.stem_up_x_offset,stem_down_x_offset:m.stem_down_x_offset,line:m.line});this.note_heads[u]=y}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const e=3,r=(this.minLine+this.maxLine)/20&&(this.keyProps[t-1].displaced=!0)),e=a,this.keyProps.push(o)}e=-1/0,this.keyProps.forEach(t=>{t.linet.line-r.line)}getBoundingBox(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:e,modLeftPx:t,extraLeftPx:r}=this.getMetrics(),s=this.getAbsoluteX()-t-r;let o=0,a=0;const l=this.getStave().getSpacingBetweenLines()/2,c=l*2;if(this.isRest()){const u=this.ys[0],m=Flow.durationToFraction(this.duration);m.equals(1)||m.equals(2)?(o=u-l,a=u+l):(o=u-this.glyph.line_above*c,a=u+this.glyph.line_below*c)}else if(this.glyph.stem){const u=this.getStemExtents();u.baseY+=l*this.stem_direction,o=Math.min(u.topY,u.baseY),a=Math.max(u.topY,u.baseY)}else{o=null,a=null;for(let u=0;ut&&(t=s):s1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()&&this.renderFlag}getStemX(){return this.noteType==="r"?this.getCenterGlyphX():super.getStemX()+getStemAdjustment(this)}getYForTopText(e){const t=this.getStemExtents();return Math.min(this.stave.getYForTopText(e),t.topY-this.render_options.annotation_spacing*(e+1))}getYForBottomText(e){const t=this.getStemExtents();return Math.max(this.stave.getYForTopText(e),t.baseY+this.render_options.annotation_spacing*e)}setStave(e){super.setStave(e);const t=this.note_heads.map(r=>(r.setStave(e),r.getY()));if(this.setYs(t),this.stem){const{y_top:r,y_bottom:s}=this.getNoteHeadBounds();this.stem.setYBounds(r,s)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(e){return this.displaced=e,this}getTieRightX(){let e=this.getAbsoluteX();return e+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(e+=this.modifierContext.getExtraRightPx()),e}getTieLeftX(){let e=this.getAbsoluteX();return e+=this.x_shift-this.extraLeftPx,e}getLineForRest(){let e=this.keyProps[0].line;if(this.keyProps.length>1){const t=this.keyProps[this.keyProps.length-1].line,r=Math.max(e,t),s=Math.min(e,t);e=Vex.MidLine(r,s)}return e}getModifierStartXY(e,t,r){if(r=r||{},!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-Values calculated for this note.");const{ABOVE:s,BELOW:o,LEFT:a,RIGHT:l}=Modifier.Position;let c=0;return e===a?c=-1*2:e===l?(c=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===Stem.UP&&this.hasFlag()&&(r.forceFlagRight||isInnerNoteIndex(this,t))&&(c+=this.flag.getMetrics().width)):(e===o||e===s)&&(c=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+c,y:this.ys[t]}}setStyle(e){super.setStyle(e),this.note_heads.forEach(t=>t.setStyle(e)),this.stem&&this.stem.setStyle(e)}setStemStyle(e){this.stem&&this.getStem().setStyle(e)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(e){this.ledgerLineStyle=e}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(e){this.flagStyle=e}getFlagStyle(){return this.flagStyle}setKeyStyle(e,t){return this.note_heads[e].setStyle(t),this}setKeyLine(e,t){return this.keyProps[e].line=t,this.reset(),this}getKeyLine(e){return this.keyProps[e].line}addToModifierContext(e){this.setModifierContext(e);for(let t=0;t{const y=d.getLine(),b=d.getY();(e===null||bt)&&(t=b),s===null&&d.isDisplaced()&&(s=d.getAbsoluteX()),r===null&&!d.isDisplaced()&&(r=d.getAbsoluteX()),o=y>o?y:o,a=y{let C;T&&_?C=A-r:_?C=S-r:C=b-r;const R=_&&T?a:o;s.beginPath(),s.moveTo(C,E),s.lineTo(C+R,E),s.stroke()},x={...e.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(s,x);for(let E=6;E<=l;++E){const _=S!==null&&E<=m,T=b!==null&&E<=u;P(e.getYForNote(E),_,T)}for(let E=0;E>=c;--E){const _=S!==null&&E>=y,T=b!==null&&E>=d;P(e.getYForNote(E),_,T)}this.restoreStyle(s,x)}drawVibrato(){if(this.vibrato){const e=this.context,t=this.vibrato.getNoteHeadEndX()+2;let{y_bottom:r}=this.vibrato.getNoteHeadBounds(),{y_top:s}=this.getNoteHeadBounds();const o=r1&&a.getAttribute("type")==="Accidental"&&this.modifiers.findIndex(m=>m.getAttribute("type")==="GraceNoteGroup")>=0)&&!(a.note&&a.note.DYMusicScoreType=="jianpu"&&a.getAttribute("type")==="Dot"&&!a.note.formatterMetrics.duration)){if(a.note&&a.note.DYMusicScoreType=="jianpu"&&a.getAttribute("type")==="Dot")try{a.note.getModifierStartXY(a.position,0,{forceFlagRight:!0}).x-a.note.x<9&&(a.x_shift+=7)}catch(u){console.log("🚀 ~ error:",u)}a.note&&a.note.DYMusicScoreType=="jianpu"&&(((r=a==null?void 0:a.articulation)==null?void 0:r.code)==="v28"||((s=a==null?void 0:a.articulation)==null?void 0:s.code)==="v42")&&(t=!0),l.applyStyle(e,c),a.setContext(e),a.drawWithStyle(),l.restoreStyle(e,c)}}e.closeGroup(t),this.drawVibrato(),this.drawSlide()}drawFlag(){const{stem:e,beam:t,context:r}=this;if(!r)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");const s=t===null&&this.renderFlag;if(this.getGlyph().flag&&s){const{y_top:a,y_bottom:l}=this.getNoteHeadBounds(),c=e.getHeight(),u=this.getStemX();let m=this.getStemDirection()===Stem.DOWN?a-c+2:l-c-2;if(e&&!t){const d=this.keyProps[0].line;(d>6.5||d<-.5)&&(m=m+(d>6.5?(d-6.5)*10:(d+.5)*10))}r.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(r,this.getFlagStyle()||!1),this.flag.render(r,u,m),this.restoreStyle(r,this.getFlagStyle()||!1),r.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(e=>{this.context.openGroup("notehead",null,{pointerBBox:!0});try{if(this.isRest()&&this.duration==="w"){const t=this.stave.options.line_config.filter(s=>s.visible).length;this.keyProps[0].line===4&&t<5&&e.setY(e.getY()+10),t===1&&e.setLine(3)}}catch(t){}e.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(e){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");e&&this.setStem(new Stem(e)),this.stem.id=Vex.Prefix("".concat(this.getAttribute("id"),"-stem")),this.stem&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup())}draw(){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new Vex.RERR("NoYValues","Can't draw note without Y values.");const e=this.stave.getLines();if(e===2||e===3||e===4)for(let s=0;ss.setX(t)),this.stem){let s=this.getStemX();const o=this.keyProps[0].line;(o>6.5||o<-.5)&&(this.beam||(this.stem.renderHeightAdjustment=o>6.5?(o-6.5)*10:Math.abs(o+.5)*10)),this.stem.setNoteHeadXBounds(s,s)}L$h("Rendering ",this.isChord()?"chord :":"note :",this.keys),this.drawLedgerLines(),this.applyStyle(),this.setAttribute("el",this.context.openGroup("stavenote",this.getAttribute("id"))),this.context.openGroup("note",null,{pointerBBox:!0}),r&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}class FretHandFinger extends Modifier{static get CATEGORY(){return"frethandfinger"}static format(e,t){const{left_shift:r,right_shift:s}=t,o=1;if(!e||e.length===0)return!1;const a=[];let l=null,c=0,u=0;for(let P=0;Px.line-P.line);let m=0,d=0,y=0,b=0,S=null,A=null;for(let P=0;Py?x:y):_===Modifier.Position.RIGHT&&(T.setXShift(d),x=u+M,b=x>b?x:b),S=C,A=E}return t.left_shift+=y,t.right_shift+=b,!0}constructor(e){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=e,this.width=7,this.position=Modifier.Position.LEFT,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return FretHandFinger.CATEGORY}setFretHandFinger(e){return this.finger=e,this}setOffsetX(e){return this.x_offset=e,this}setOffsetY(e){return this.y_offset=e,this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const e=this.context,t=this.note.getModifierStartXY(this.position,this.index);let r=t.x+this.x_shift+this.x_offset,s=t.y+this.y_shift+this.y_offset+5;switch(this.position){case Modifier.Position.ABOVE:r-=4,s-=12;break;case Modifier.Position.BELOW:r-=2,s+=10;break;case Modifier.Position.LEFT:r-=this.width;break;case Modifier.Position.RIGHT:r+=1;break;default:throw new Vex.RERR("InvalidPostion","The position ".concat(this.position," does not exist"))}e.save(),e.setFont(this.font.family,this.font.size,this.font.weight),e.fillText(""+this.finger,r,s),e.restore()}}class Music{static get NUM_TONES(){return 12}static get roots(){return["c","d","e","f","g","a","b"]}static get root_values(){return[0,2,4,5,7,9,11]}static get root_indices(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonical_notes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonic_intervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonic_accidentals(){return{unison:{note:0,accidental:0},m2:{note:1,accidental:-1},M2:{note:1,accidental:0},m3:{note:2,accidental:-1},M3:{note:2,accidental:0},p4:{note:3,accidental:0},dim5:{note:4,accidental:-1},p5:{note:4,accidental:0},m6:{note:5,accidental:-1},M6:{note:5,accidental:0},b7:{note:6,accidental:-1},M7:{note:6,accidental:0},octave:{note:7,accidental:0}}}static get intervals(){return{u:0,unison:0,m2:1,b2:1,min2:1,S:1,H:1,2:2,M2:2,maj2:2,T:2,W:2,m3:3,b3:3,min3:3,M3:4,3:4,maj3:4,4:5,p4:5,"#4":6,b5:6,aug4:6,dim5:6,5:7,p5:7,"#5":8,b6:8,aug5:8,6:9,M6:9,maj6:9,b7:10,m7:10,min7:10,dom7:10,M7:11,maj7:11,8:12,octave:12}}static get scales(){return{major:[2,2,1,2,2,2,1],dorian:[2,1,2,2,2,1,2],mixolydian:[2,2,1,2,2,1,2],minor:[2,1,2,2,1,2,2]}}static get scaleTypes(){return{M:Music.scales.major,m:Music.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{root_index:0,int_val:0},cn:{root_index:0,int_val:0},"c#":{root_index:0,int_val:1},"c##":{root_index:0,int_val:2},cb:{root_index:0,int_val:11},cbb:{root_index:0,int_val:10},d:{root_index:1,int_val:2},dn:{root_index:1,int_val:2},"d#":{root_index:1,int_val:3},"d##":{root_index:1,int_val:4},db:{root_index:1,int_val:1},dbb:{root_index:1,int_val:0},e:{root_index:2,int_val:4},en:{root_index:2,int_val:4},"e#":{root_index:2,int_val:5},"e##":{root_index:2,int_val:6},eb:{root_index:2,int_val:3},ebb:{root_index:2,int_val:2},f:{root_index:3,int_val:5},fn:{root_index:3,int_val:5},"f#":{root_index:3,int_val:6},"f##":{root_index:3,int_val:7},fb:{root_index:3,int_val:4},fbb:{root_index:3,int_val:3},g:{root_index:4,int_val:7},gn:{root_index:4,int_val:7},"g#":{root_index:4,int_val:8},"g##":{root_index:4,int_val:9},gb:{root_index:4,int_val:6},gbb:{root_index:4,int_val:5},a:{root_index:5,int_val:9},an:{root_index:5,int_val:9},"a#":{root_index:5,int_val:10},"a##":{root_index:5,int_val:11},ab:{root_index:5,int_val:8},abb:{root_index:5,int_val:7},b:{root_index:6,int_val:11},bn:{root_index:6,int_val:11},"b#":{root_index:6,int_val:0},"b##":{root_index:6,int_val:1},bb:{root_index:6,int_val:10},bbb:{root_index:6,int_val:9}}}isValidNoteValue(e){return!(e==null||e<0||e>=Music.NUM_TONES)}isValidIntervalValue(e){return this.isValidNoteValue(e)}getNoteParts(e){if(!e||e.length<1)throw new Vex.RERR("BadArguments","Invalid note name: "+e);if(e.length>3)throw new Vex.RERR("BadArguments","Invalid note name: "+e);const t=e.toLowerCase(),s=/^([cdefgab])(b|bb|n|#|##)?$/.exec(t);if(s!=null){const o=s[1],a=s[2];return{root:o,accidental:a}}else throw new Vex.RERR("BadArguments","Invalid note name: "+e)}getKeyParts(e){if(!e||e.length<1)throw new Vex.RERR("BadArguments","Invalid key: "+e);const t=e.toLowerCase(),s=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(t);if(s!=null){const o=s[1],a=s[2];let l=s[3];return l||(l="M"),{root:o,accidental:a,type:l}}else throw new Vex.RERR("BadArguments","Invalid key: ".concat(e))}getNoteValue(e){const t=Music.noteValues[e];if(t==null)throw new Vex.RERR("BadArguments","Invalid note name: ".concat(e));return t.int_val}getIntervalValue(e){const t=Music.intervals[e];if(t==null)throw new Vex.RERR("BadArguments","Invalid interval name: ".concat(e));return t}getCanonicalNoteName(e){if(!this.isValidNoteValue(e))throw new Vex.RERR("BadArguments","Invalid note value: ".concat(e));return Music.canonical_notes[e]}getCanonicalIntervalName(e){if(!this.isValidIntervalValue(e))throw new Vex.RERR("BadArguments","Invalid interval value: ".concat(e));return Music.diatonic_intervals[e]}getRelativeNoteValue(e,t,r){if(r==null&&(r=1),r!==1&&r!==-1)throw new Vex.RERR("BadArguments","Invalid direction: ".concat(r));let s=(e+r*t)%Music.NUM_TONES;return s<0&&(s+=Music.NUM_TONES),s}getRelativeNoteName(e,t){const r=this.getNoteParts(e),s=this.getNoteValue(r.root);let o=t-s;if(Math.abs(o)>Music.NUM_TONES-3){let l=1;o>0&&(l=-1);const c=(t+1+(s+1))%Music.NUM_TONES*l;if(Math.abs(c)>2)throw new Vex.RERR("BadArguments","Notes not related: ".concat(e,", ").concat(t,")"));o=c}if(Math.abs(o)>2)throw new Vex.RERR("BadArguments","Notes not related: ".concat(e,", ").concat(t,")"));let a=r.root;if(o>0)for(let l=1;l<=o;++l)a+="#";else if(o<0)for(let l=-1;l>=o;--l)a+="b";return a}getScaleTones(e,t){const r=[e];let s=e;for(let o=0;oi.getMetrics().width;class Accidental extends Modifier{static get CATEGORY(){return"accidentals"}static format(e,t){const s=t.left_shift+1,o=3;if(!e||e.length===0)return;const a=[];let l=null,c=0,u;for(let E=0;E_.line-E.line);const m=[];let d=0,y=null;for(let E=0;Ed?_.shift:d,y=_.line}let b=0;for(let E=0;Em[T+k],I=k=>k.map(R),M=(k,$)=>{const[F,G]=I([k,$]).map(N=>N.line);return F-G},D=(...k)=>k.map(I).every($=>!this.checkCollision(...$)),H=C-T+1;let W=this.checkCollision(m[T],m[C])?"a":"b";switch(H){case 3:W==="a"&&M(1,2)===.5&&M(0,1)!==.5&&(W="second_on_bottom");break;case 4:D([0,2],[1,3])&&(W="spaced_out_tetrachord");break;case 5:W==="b"&&D([1,3])&&(W="spaced_out_pentachord",D([0,2],[2,4])&&(W="very_spaced_out_pentachord"));break;case 6:D([0,3],[1,4],[2,5])&&(W="spaced_out_hexachord"),D([0,2],[2,4],[1,3],[3,5])&&(W="very_spaced_out_hexachord");break}let O,z;if(H>=7){let k=2,$=!0;for(;$===!0;){$=!1;for(let F=0;F+kz?b:z}else for(O=E;O<=C;O++)z=Flow.accidentalColumnsTable[H][W][O-E],m[O].column=z,b=b>z?b:z;E=C}const S=[],A=[];for(let E=0;E<=b;E++)S[E]=0,A[E]=0;S[0]=d+s,A[0]=d+s,m.forEach(E=>{E.width>S[E.column]&&(S[E.column]=E.width)});for(let E=1;E{let _=0;const T=x+E.numAcc;for(x;x0?(s=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(r-=.5)):(s=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(r-=.5));const o=Math.abs(r){const c=new Fraction(0,1);l.getTickables().forEach(m=>{if(m.shouldIgnoreTicks())return;const d=s[c.value()];d?d.push(m):(r.push(c.value()),s[c.value()]=[m]),c.add(m.getTicks())})});const o=new Music;t||(t="C");const a=o.createScaleMap(t);r.forEach(l=>{const c=s[l],u=[],m=d=>{d.isRest()||d.shouldIgnoreTicks()||(d.keys.forEach((y,b)=>{const S=o.getNoteParts(y.split("/")[0]),A=S.accidental||"n",P=S.root+A,x=a[S.root]===P,E=u.indexOf(P)>-1;if(!x||x&&E){a[S.root]=P;const _=new Accidental(A);d.addAccidental(b,_),u.push(P)}}),d.getModifiers().forEach(y=>{y.getCategory()==="gracenotegroups"&&y.getGraceNotes().forEach(m)}))};c.forEach(m)})}constructor(e=null){if(super(),this.setAttribute("type","Accidental"),L$g("New accidental: ",e),this.note=null,this.index=null,this.type=e,this.position=Modifier.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},this.accidental=Flow.accidentalCodes(this.type),!this.accidental)throw new Vex.RERR("ArgumentError","Unknown accidental type: ".concat(e));this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){const e=this.render_options.font_scale;this.glyph=new Glyph(this.accidental.code,e),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new Glyph(Flow.accidentalCodes("{").code,e),this.parenRight=new Glyph(Flow.accidentalCodes("}").code,e),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return Accidental.CATEGORY}getWidth(){const e=this.cautionary?getGlyphWidth(this.parenLeft)+getGlyphWidth(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return getGlyphWidth(this.glyph)+e}setNote(e){if(!e)throw new Vex.RERR("ArgumentError","Bad note value: ".concat(e));this.note=e,this.note.getCategory()==="gracenotes"&&(this.render_options.font_scale=25,this.reset())}setAsCautionary(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}draw(){const{context:e,type:t,position:r,note:s,index:o,cautionary:a,x_shift:l,y_shift:c,glyph:u,parenLeft:m,parenRight:d,render_options:{parenLeftPadding:y,parenRightPadding:b}}=this;if(this.checkContext(),!(s&&o!=null))throw new Vex.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const S=s.getModifierStartXY(r,o);let A=S.x+l;const P=S.y+c;L$g("Rendering: ",t,A,P),a?(d.render(e,A,P),A-=getGlyphWidth(d),A-=b,A-=this.accidental.parenRightPaddingAdjustment,u.render(e,A,P),A-=getGlyphWidth(u),A-=y,m.render(e,A,P)):u.render(e,A,P),this.setRendered()}}let NoteSubGroup$1=class Ti extends Modifier{static get CATEGORY(){return"notesubgroup"}static format(e,t){if(!e||e.length===0)return!1;let r=0;for(let s=0;s{t.ignore_ticks=!1}),this.width=0,this.preFormatted=!1,this.formatter=new Formatter,this.voice=new Voice$1({num_beats:4,beat_value:4,resolution:Flow.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return Ti.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(e){this.note=e}setWidth(e){this.width=e}getWidth(){return this.width}draw(){this.checkContext();const e=this.getNote();if(!(e&&this.index!==null))throw new Vex.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,e),this.subNotes.forEach(t=>t.setContext(this.context).drawWithStyle())}};class StaveTie extends Element$1{constructor(e,t){super(),this.setAttribute("type","StaveTie"),this.notes=e,this.context=null,this.text=t,this.direction=null,this.render_options={cp1:8,cp2:12,text_shift_x:0,first_x_shift:0,last_x_shift:0,y_shift:7,tie_spacing:0,font:{family:"Arial",size:15,style:""}},this.font=this.render_options.font,this.setNotes(e)}setFont(e){return this.font=e,this}setDirection(e){return this.direction=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new Vex.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new Vex.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(e){if(e.first_ys.length===0||e.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const t=this.context;let r=this.render_options.cp1,s=this.render_options.cp2;Math.abs(e.last_x_px-e.first_x_px)<10&&(r=2,s=8);const o=this.render_options.first_x_shift,a=this.render_options.last_x_shift,l=this.render_options.y_shift*e.direction;for(let c=0;cy&&Math.abs(m-y)<10?-6:0;if(this.first_note&&this.first_note.DYMusicScoreType==="jianpu"){if(this.getAttribute("type")==="TabTie")continue;m1){const t=new Beam$1(e);t.render_options.beam_width=3,t.render_options.partial_beam_length=4,this.beams.push(t)}return this}setNote(e){this.note=e}setWidth(e){this.width=e}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();const e=this.getNote();if(L$f("Drawing grace note group for:",e),!(e&&this.index!==null))throw new Vex.RuntimeError("NoAttachedNote","Can't draw grace note without a parent note and parent note index.");if(this.setRendered(),this.alignSubNotesWithNote(this.getGraceNotes(),e),this.grace_notes.forEach(t=>{t.setContext(this.context).draw()}),this.beams.forEach(t=>{t.setContext(this.context).draw()}),this.show_slur){const t=this.getNote().getCategory()===StaveNote.CATEGORY,r=t?StaveTie:TabTie;this.slur=new r({last_note:this.grace_notes[0],first_note:e,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(t?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}}class Stroke extends Modifier{static get CATEGORY(){return"strokes"}static get Type(){return{BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASQUEDO_DOWN:5,RASQUEDO_UP:6,ARPEGGIO_DIRECTIONLESS:7}}static format(e,t){const r=t.left_shift,s=0;if(!e||e.length===0)return this;const o=e.map(c=>{const u=c.getNote();if(u instanceof StaveNote){const{line:m,displaced:d}=u.getKeyProps()[c.getIndex()],y=d?u.getExtraLeftPx():0;return{line:m,shift:y,stroke:c}}else{const{str:m}=u.getPositions()[c.getIndex()];return{line:m,shift:0,stroke:c}}}),a=r,l=o.reduce((c,{stroke:u,shift:m})=>(u.setXShift(a+m),Math.max(u.getWidth()+s,c)),0);return t.left_shift+=l,!0}constructor(e,t){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=Vex.Merge({},t),this.all_voices="all_voices"in this.options?this.options.all_voices:!0,this.note_end=null,this.index=null,this.type=e,this.position=Modifier.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,stroke_spacing:10},this.font={family:"serif",size:10,weight:"bold italic"},this.setXShift(0),this.setWidth(10)}getCategory(){return Stroke.CATEGORY}getPosition(){return this.position}addEndNote(e){return this.note_end=e,this}draw(){if(this.checkContext(),this.setRendered(),!(this.note&&this.index!=null))throw new Vex.RERR("NoAttachedNote","Can't draw stroke without a note and index.");const e=this.note.getModifierStartXY(this.position,this.index);let t=this.note.getYs(),r=e.y,s=e.y;const o=e.x-5,a=this.note.stave.options.spacing_between_lines_px,l=this.getModifierContext().getModifiers(this.note.getCategory());for(let b=0;bC.line-T.line);let A=0,P=0,x=0,E=null,_=null;for(m=0;mP?T:P):b===Modifier.Position.RIGHT&&(d.setXShift(A),T+=I,x=T>x?T:x),E=C,_=y}return t.left_shift+=P,t.right_shift+=x,!0}constructor(e){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=e,this.setWidth(20),this.position=Modifier.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=Renderer.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return StringNumber.CATEGORY}getNote(){return this.note}setNote(e){return this.note=e,this}getIndex(){return this.index}setIndex(e){return this.index=e,this}setLineEndType(e){return e>=Renderer.LineEndType.NONE&&e<=Renderer.LineEndType.DOWN&&(this.leg=e),this}setStringNumber(e){return this.string_number=e,this}setOffsetX(e){return this.x_offset=e,this}setOffsetY(e){return this.y_offset=e,this}setLastNote(e){return this.last_note=e,this}setDashed(e){return this.dashed=e,this}draw(){const e=this.checkContext();if(!(this.note&&this.index!=null))throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const t=this.note.stave.options.spacing_between_lines_px,r=this.note.getModifierStartXY(this.position,this.index);let s=r.x+this.x_shift+this.x_offset,o=r.y+this.y_shift+this.y_offset;switch(this.position){case Modifier.Position.ABOVE:case Modifier.Position.BELOW:{const l=this.note.getStemExtents();let c=l.topY,u=l.baseY+2;this.note.stem_direction===StaveNote.STEM_DOWN&&(c=l.baseY,u=l.topY-2),this.position===Modifier.Position.ABOVE?o=this.note.hasStem()?c-t*1.75:r.y-t*1.75:o=this.note.hasStem()?u+t*1.5:r.y+t*1.75,o+=this.y_shift+this.y_offset;break}case Modifier.Position.LEFT:s-=this.radius/2+5;break;case Modifier.Position.RIGHT:s+=this.radius/2+6;break;default:throw new Vex.RERR("InvalidPosition","The position ".concat(this.position," is invalid"))}e.save(),e.beginPath(),e.arc(s,o,this.radius,0,Math.PI*2,!1),e.lineWidth=1.5,e.stroke(),e.setFont(this.font.family,this.font.size,this.font.weight);const a=s-e.measureText(this.string_number).width/2;if(e.fillText(""+this.string_number,a,o+4.5),this.last_note!=null){const l=this.last_note.getStemX()-this.note.getX()+5;e.strokeStyle="#000000",e.lineCap="round",e.lineWidth=.6,this.dashed?Renderer.drawDashedLine(e,s+10,o,s+l,o,[3,3]):Renderer.drawDashedLine(e,s+10,o,s+l,o,[3,0]);let c,u;switch(this.leg){case Renderer.LineEndType.UP:c=-10,u=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,s+l,o,s+l,o+c,u);break;case Renderer.LineEndType.DOWN:c=10,u=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,s+l,o,s+l,o+c,u);break}}e.restore()}}function L$e(...i){Articulation$1.DEBUG&&Vex.L("Vex.Flow.Articulation",i)}const{ABOVE,BELOW}=Modifier.Position,roundToNearestHalf=(i,e)=>i(e/.5)*.5,isWithinLines=(i,e)=>e===ABOVE?i<=5:i>=1,getRoundingFunction=(i,e)=>isWithinLines(i,e)?e===ABOVE?Math.ceil:Math.floor:Math.round,snapLineToStaff=(i,e,t,r)=>{const s=roundToNearestHalf(getRoundingFunction(e,t),e),o=i&&isWithinLines(s,t),a=s%1===0;return o&&a?s+.5*-r:s},isStaveNote=i=>{const e=i.getCategory();return e==="stavenotes"||e==="gracenotes"},isTabNote=i=>{const e=i.getCategory();return e==="tabnotes"||e==="numberednotes"},getTopY=(i,e)=>{const t=i.getStave(),r=i.getStemDirection(),{topY:s,baseY:o}=i.getStemExtents();if(isStaveNote(i))return i.hasStem()?r===Stem.UP?s:o:Math.min(...i.getYs());if(isTabNote(i))return i.hasStem()&&r===Stem.UP?s:t.getYForTopText(e);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getBottomY=(i,e)=>{const t=i.getStave(),r=i.getStemDirection(),{topY:s,baseY:o}=i.getStemExtents();if(isStaveNote(i))return i.hasStem()?r===Stem.UP?o:s:Math.max(...i.getYs());if(isTabNote(i))return i.hasStem()?r===Stem.UP?t.getYForBottomText(e):s:t.getYForBottomText(e);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getInitialOffset=(i,e)=>{const t=e===ABOVE&&i.getStemDirection()===Stem.UP||e===BELOW&&i.getStemDirection()===Stem.DOWN;return isStaveNote(i)?i.hasStem()&&t?.5:1:i.hasStem()&&t?1:0};let Articulation$1=class Zt extends Modifier{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(e,t){if(!e||e.length===0)return!1;const r=c=>c.getPosition()===ABOVE,s=c=>c.getPosition()===BELOW,o=.5,a=(c,u,m)=>roundToNearestHalf(getRoundingFunction(u,m),c.glyph.getMetrics().height/10+o);e.filter(r).forEach(c=>{c.setTextLine(t.top_text_line),t.top_text_line+=a(c,t.top_text_line,ABOVE)}),e.filter(s).forEach(c=>{c.setTextLine(t.text_line),t.text_line+=a(c,t.text_line,BELOW)});const l=e.map(c=>c.getWidth()).reduce((c,u)=>Math.max(u,c));return t.left_shift+=l/2,t.right_shift+=l/2,!0}static easyScoreHook({articulations:e},t,r){if(!e)return;const s={staccato:"a.",tenuto:"a-"};e.split(",").map(o=>o.trim().split(".")).map(([o,a])=>{const l={type:s[o]};return a&&(l.position=Modifier.PositionString[a]),r.getFactory().Articulation(l)}).map(o=>t.addModifier(0,o))}constructor(e){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=e,this.position=BELOW,this.render_options={font_scale:38},this.articulation=Flow.articulationCodes(this.type),!this.articulation)throw new Vex.RERR("ArgumentError","Articulation not found: ".concat(this.type));this.glyph=new Glyph(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return Zt.CATEGORY}draw(){const{note:e,index:t,position:r,glyph:s,articulation:{between_lines:o},text_line:a,context:l}=this;if(this.checkContext(),!e||t==null)throw new Vex.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const c=e.getStave(),u=c.getSpacingBetweenLines(),m=e.getCategory()==="tabnotes",{x:d}=e.getModifierStartXY(r,t),y=!o||m,b=getInitialOffset(e,r);let S={[ABOVE]:()=>{s.setOrigin(.5,1);const A=getTopY(e,a)-(a+b)*u+(this.y_shift||0);return y?Math.min(c.getYForTopText(Zt.INITIAL_OFFSET),A):A},[BELOW]:()=>{s.setOrigin(.5,0);const A=getBottomY(e,a)+(a+b)*u;return y?Math.max(c.getYForBottomText(Zt.INITIAL_OFFSET),A):A}}[r]();if(!m){const A=r===ABOVE?-1:1,P=m?e.positions[t].str:e.getKeyProps()[t].line,E=(e.getYs()[t]-S)/u+P,_=snapLineToStaff(o,E,r,A);isWithinLines(_,r)&&s.setOrigin(.5,.5),S+=Math.abs(_-E)*u*A}L$e("Rendering articulation at (x: ".concat(d,", y: ").concat(S,")")),s.render(l,d,S)}};class TickContext extends Tickable{static getNextContext(e){const t=e.tContexts,r=t.indexOf(e);return t[r+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new Fraction(0,1),this.maxTicks=new Fraction(0,1),this.minTicks=null,this.padding=3,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.notePx=0,this.extraLeftPx=0,this.extraRightPx=0,this.tContexts=[]}getX(){return this.x}setX(e){return this.x=e,this.xBase=e,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(e){this.xBase=e,this.x=e+this.xOffset}getXOffset(){return this.xOffset}setXOffset(e){this.xOffset=e,this.x=this.xBase+e}getWidth(){return this.width+this.padding*2}setPadding(e){return this.padding=e,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(e=>e.isCenterAligned())}getMetrics(){const{width:e,notePx:t,extraLeftPx:r,extraRightPx:s}=this;return{width:e,notePx:t,extraLeftPx:r,extraRightPx:s}}getCurrentTick(){return this.currentTick}setCurrentTick(e){this.currentTick=e,this.preFormatted=!1}getExtraPx(){let e=0,t=0,r=0,s=0;for(let o=0;o0&&s--;for(let c=0;c{L$b("Preformatting ModifierContext: ",e.CATEGORY),e.format(this.getModifiers(e.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(e=>{L$b("Postformatting ModifierContext: ",e.CATEGORY),e.postFormat(this.getModifiers(e.CATEGORY),this)})}}function L$a(...i){Formatter.DEBUG&&Vex.L("Vex.Flow.Formatter",i)}function getNext(i,e){var r,s;const t=i[e+1];return t&&((r=t==null?void 0:t.keys)!=null&&r.includes("b/4"))||(s=t==null?void 0:t.keys)!=null&&s.includes("r/4")?getNext(i,e+1):t}function createContexts(i,e,t){if(!i||!i.length)throw new Vex.RERR("BadArgument","No voices to format");const r=i[0].getTotalTicks(),s=i.reduce((c,u)=>{if(!u.getTotalTicks().equals(r))throw new Vex.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(u.getMode()===Voice$1.Mode.STRICT&&!u.isComplete())throw new Vex.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(c,Fraction.LCM(c,u.getResolutionMultiplier()))},1),o={},a=[],l=[];return i.forEach(c=>{const u=new Fraction(0,s);c.getTickables().forEach(m=>{const d=u.numerator;if(!o[d]){const y=new e;l.push(y),o[d]=y}t(m,o[d]),a.push(d),u.add(m.getTicks())})}),{map:o,array:l,list:Vex.SortAndUnique(a,(c,u)=>c-u,(c,u)=>c===u),resolutionMultiplier:s}}class Formatter{static SimpleFormat(e,t=0,{paddingBetween:r=10}={}){e.reduce((s,o)=>{o.addToModifierContext(new ModifierContext);const a=new TickContext().addTickable(o).preFormat(),l=a.getExtraPx();return a.setX(s+l.left),s+a.getWidth()+l.right+r},t)}static plotDebugging(e,t,r,s,o){const a=r+Note.STAVEPADDING,l=t.contextGaps;function c(u,m,d){e.beginPath(),e.setStrokeStyle(d),e.setFillStyle(d),e.setLineWidth(1),e.fillRect(u,s,m-u,o-s)}e.save(),e.setFont("Arial",8,""),l.gaps.forEach(u=>{c(a+u.x1,a+u.x2,"#aaa"),e.fillText(Math.round(u.x2-u.x1),a+u.x1,o+12)}),e.fillText(Math.round(l.total)+"px",a-20,o+12),e.setFillStyle("red"),e.fillText("Loss: "+t.lossHistory.map(u=>Math.round(u)),a-20,o+22),e.restore()}static FormatAndDraw(e,t,r,s){const o={auto_beam:!1,align_rests:!1};typeof s=="object"?Vex.Merge(o,s):typeof s=="boolean"&&(o.auto_beam=s);const a=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(r),l=o.auto_beam?Beam$1.applyAndGetBeams(a):[];return new Formatter().joinVoices([a],{align_rests:o.align_rests}).formatToStave([a],t,{align_rests:o.align_rests,stave:t}),a.setStave(t).draw(e,t),l.forEach(c=>c.setContext(e).draw()),a.getBoundingBox()}static FormatAndDrawTab(e,t,r,s,o,a,l){const c={auto_beam:a,align_rests:!1};typeof l=="object"?Vex.Merge(c,l):typeof l=="boolean"&&(c.auto_beam=l);const u=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(o),m=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(s),d=c.auto_beam?Beam$1.applyAndGetBeams(u):[];new Formatter().joinVoices([u],{align_rests:c.align_rests}).joinVoices([m]).formatToStave([u,m],r,{align_rests:c.align_rests}),u.draw(e,r),m.draw(e,t),d.forEach(y=>y.setContext(e).draw()),new StaveConnector(r,t).setContext(e).draw()}static AlignRestsToNotes(e,t,r){return e.forEach((s,o)=>{if(s instanceof StaveNote&&s.isRest()){if(s.tuplet&&!r)return;if(["va5","v3c"].includes(s.glyph.code_head)){const a=s.glyph.code_head==="va5"?10:14,l=e[o-1],c=getNext(e,o);let u=!1;if(l&&c&&l.beam&&c.beam&&(u=l.beam.notes.includes(c)),u){s.setKeyLine(0,3);let m=[...l.beam.notes,...c.beam.notes];s.beam&&s.beam.notes&&m.push(...s.beam.notes),m=Array.from(new Set(m));for(let d=0;d0){const S=y<1.5?Math.abs(y-1.5)*a:0;b.setResetHeight(S)}else{const S=y>4.5?Math.abs(y-4.5)*a:0;b.setResetHeight(S)}}}}}}),this}constructor(){this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.totalTicks=new Fraction(0,1),this.tickContexts=null,this.modiferContexts=null,this.contextGaps={total:0,gaps:[]},this.voices=[]}alignRests(e,t){if(!e||!e.length)throw new Vex.RERR("BadArgument","No voices to format rests");e.forEach(r=>Formatter.AlignRestsToNotes(r.getTickables(),t))}preCalculateMinTotalWidth(e){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!e)throw new Vex.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(e)}const{list:t,map:r}=this.tickContexts;return this.minTotalWidth=t.map(s=>{const o=r[s];return o.preFormat(),o.getWidth()}).reduce((s,o)=>s+o,0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new Vex.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(e){const t=createContexts(e,ModifierContext,(r,s)=>r.addToModifierContext(s));return this.modiferContexts=t,t}createTickContexts(e){const t=createContexts(e,TickContext,(r,s)=>s.addTickable(r));return t.array.forEach(r=>{r.tContexts=t.array}),this.totalTicks=e[0].getTicksUsed().clone(),this.tickContexts=t,t}preFormat(e=0,t,r,s){const o=this.tickContexts,{list:a,map:l,resolutionMultiplier:c}=o;r&&s&&r.forEach(A=>A.setStave(s).preFormat());let u=0,m=0;const d=e/2;if(this.minTotalWidth=0,a.forEach(A=>{const P=l[A];t&&P.setContext(t),P.preFormat();const x=P.getWidth();this.minTotalWidth+=x;const E=P.getMetrics();u=u+m+E.extraLeftPx,P.setX(u),m=x-E.extraLeftPx}),this.minTotalWidth=u+m,this.hasMinTotalWidth=!0,e<=0)return;const b=(e-this.minTotalWidth)/(this.totalTicks.value()*c);let S=0;a.forEach((A,P)=>{const x=a[P-1]||0,E=l[A],_=(A-x)*b;S+=_,E.setX(E.getX()+S),E.getCenterAlignedTickables().forEach(T=>{T.center_x_shift=d-E.getX()})}),a.length!==1&&(this.justifyWidth=e,this.lossHistory=[],this.evaluate())}evaluate(){const e=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((o,a)=>{if(a===0)return;const l=this.tickContexts.list[a-1],c=this.tickContexts.map[l],u=this.tickContexts.map[o],m=c.getMetrics(),d=c.getX()+m.width,y=u.getX(),b=y-d;this.contextGaps.total+=b,this.contextGaps.gaps.push({x1:d,x2:y}),u.getFormatterMetrics().freedom.left=b,c.getFormatterMetrics().freedom.right=b});const t=this.durationStats={};function r(o,a){const l=t[o];l===void 0?t[o]={mean:a,count:1}:(l.count+=1,l.mean=(l.mean+a)/2)}this.voices.forEach(o=>{o.getTickables().forEach((a,l,c)=>{const u=a.getTicks().clone().simplify().toString(),m=a.getMetrics(),d=a.getFormatterMetrics(),y=a.getX()+m.noteWidth+m.modRightPx+m.extraRightPx;let b=0;if(l{o.getTickables().forEach(a=>{const l=a.getTicks().clone().simplify().toString(),c=a.getFormatterMetrics();c.iterations+=1,c.space.deviation=c.space.used-t[l].mean,c.duration=l,c.space.mean=t[l].mean,s+=Math.pow(t[l].mean,2)})}),this.totalCost=Math.sqrt(s),this.lossHistory.push(this.totalCost),this}tune(){const e=s=>s.reduce((o,a)=>o+a);function t(s,o,a,l){s.setX(s.getX()+l),s.getFormatterMetrics().freedom.left+=l,s.getFormatterMetrics().freedom.right-=l,o&&(o.getFormatterMetrics().freedom.right+=l),a&&(a.getFormatterMetrics().freedom.left-=l)}let r=0;return this.tickContexts.list.forEach((s,o,a)=>{const l=this.tickContexts.map[s],c=o>0?this.tickContexts.map[a[o-1]]:null,u=oy.getFormatterMetrics().space.deviation));m>0?r=-Math.min(l.getFormatterMetrics().freedom.right,Math.abs(m)):m<0&&(u?r=Math.min(u.getFormatterMetrics().freedom.right,Math.abs(m)):r=0);const d=Math.min(5,Math.abs(r));r=r>0?d:-d}),this.evaluate()}postFormat(){const e=t=>t.list.forEach(r=>t.map[r].postFormat());return e(this.modiferContexts),e(this.tickContexts),this}joinVoices(e){return this.createModifierContexts(e),this.hasMinTotalWidth=!1,this}format(e,t,r){const s={align_rests:!1,context:null,stave:null};return Vex.Merge(s,r),this.voices=e,this.alignRests(e,s.align_rests),this.createTickContexts(e),this.preFormat(t,s.context,e,s.stave),this}formatToStave(e,t,r){const s=t.getNoteEndX()-t.getNoteStartX()-10;L$a("Formatting voices to width: ",s);const o={context:t.getContext()};return Vex.Merge(o,r),this.format(e,s,o)}}class StaveModifier extends Element$1{static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4,BEGIN:5,END:6}}constructor(){super(),this.setAttribute("type","StaveModifier"),this.padding=10,this.position=StaveModifier.Position.ABOVE,this.layoutMetrics=null}getPosition(){return this.position}setPosition(e){return this.position=e,this}getStave(){return this.stave}setStave(e){return this.stave=e,this}getWidth(){return this.width}setWidth(e){return this.width=e,this}getX(){return this.x}setX(e){return this.x=e,this}getCategory(){return""}makeSpacer(e){return{getContext(){return!0},setStave(){},renderToStave(){},getMetrics(){return{width:e}}}}placeGlyphOnLine(e,t,r){e.setYShift(t.getYForLine(r)-t.getYForGlyphs())}getPadding(e){return e!==void 0&&e<2?0:this.padding}setPadding(e){return this.padding=e,this}setLayoutMetrics(e){return this.layoutMetrics=e,this}getLayoutMetrics(){return this.layoutMetrics}}class Barline extends StaveModifier{static get CATEGORY(){return"barlines"}static get type(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}static get typeString(){return{single:Barline.type.SINGLE,double:Barline.type.DOUBLE,end:Barline.type.END,repeatBegin:Barline.type.REPEAT_BEGIN,repeatEnd:Barline.type.REPEAT_END,repeatBoth:Barline.type.REPEAT_BOTH,none:Barline.type.NONE}}constructor(e){super(),this.setAttribute("type","Barline"),this.thickness=Flow.STAVE_LINE_THICKNESS;const t=Barline.type;this.widths={},this.widths[t.SINGLE]=5,this.widths[t.DOUBLE]=5,this.widths[t.END]=5,this.widths[t.REPEAT_BEGIN]=5,this.widths[t.REPEAT_END]=5,this.widths[t.REPEAT_BOTH]=5,this.widths[t.NONE]=5,this.paddings={},this.paddings[t.SINGLE]=0,this.paddings[t.DOUBLE]=0,this.paddings[t.END]=0,this.paddings[t.REPEAT_BEGIN]=15,this.paddings[t.REPEAT_END]=15,this.paddings[t.REPEAT_BOTH]=15,this.paddings[t.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[t.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[t.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(StaveModifier.Position.BEGIN),this.setType(e)}getCategory(){return Barline.CATEGORY}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Barline.typeString[e]:e,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(e){switch(e.checkContext(),this.setRendered(),this.type){case Barline.type.SINGLE:this.drawVerticalBar(e,this.x,!1);break;case Barline.type.DOUBLE:this.drawVerticalBar(e,this.x,!0);break;case Barline.type.END:this.drawVerticalEndBar(e,this.x);break;case Barline.type.REPEAT_BEGIN:this.drawRepeatBar(e,this.x,!0),e.getX()!==this.x&&this.drawVerticalBar(e,e.getX());break;case Barline.type.REPEAT_END:this.drawRepeatBar(e,this.x,!1);break;case Barline.type.REPEAT_BOTH:this.drawRepeatBar(e,this.x,!1),this.drawRepeatBar(e,this.x,!0);break}}drawVerticalBar(e,t,r){e.checkContext();const s=e.getTopLineTopY(),o=e.getBottomLineBottomY();r&&e.context.fillRect(t-3,s,1,o-s),e.context.fillRect(t,s,1,o-s)}drawVerticalEndBar(e,t){e.checkContext();const r=e.getTopLineTopY(),s=e.getBottomLineBottomY();e.context.fillRect(t-5,r,1,s-r),e.context.fillRect(t-2,r,3,s-r)}drawRepeatBar(e,t,r){e.checkContext();const s=e.getTopLineTopY(),o=e.getBottomLineBottomY();let a=3;r||(a=-5),e.context.fillRect(t+a,s,1,o-s),e.context.fillRect(t-2,s,3,o-s);const l=2;r?a+=4:a-=4;const c=t+a+l/2;let u=(e.getNumLines()-1)*e.getSpacingBetweenLines();u=u/2-e.getSpacingBetweenLines()/2;let m=s+u+l/2;e.context.beginPath(),e.context.arc(c,m,l,0,Math.PI*2,!1),e.context.fill(),m+=e.getSpacingBetweenLines(),e.context.beginPath(),e.context.arc(c,m,l,0,Math.PI*2,!1),e.context.fill()}}let Repetition$1=class Ze extends StaveModifier{static get CATEGORY(){return"repetitions"}static get type(){return{NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12,TO_CODA:13}}constructor(e,t,r){super(),this.setAttribute("type","Repetition"),this.symbol_type=e,this.x=t,this.x_shift=0,this.y_shift=r,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Ze.CATEGORY}setShiftX(e){return this.x_shift=e,this}setShiftY(e){return this.y_shift=e,this}setX(e){return this.x=e,this}draw(e,t){switch(this.setRendered(),this.symbol_type){case Ze.type.CODA_RIGHT:this.drawCodaFixed(e,t+e.width);break;case Ze.type.CODA_LEFT:this.drawSymbolText(e,t,"Coda",!1);break;case Ze.type.SEGNO_LEFT:this.drawSignoFixed(e,t);break;case Ze.type.SEGNO_RIGHT:this.drawSignoFixed(e,t+e.width);break;case Ze.type.DC:this.drawSymbolText(e,t,"D.C.",!1);break;case Ze.type.DC_AL_CODA:this.drawSymbolText(e,t,"D.C. al Coda",!0);break;case Ze.type.DC_AL_FINE:this.drawSymbolText(e,t,"D.C. al Fine",!1);break;case Ze.type.DS:this.drawSymbolText(e,t,"D.S.",!1);break;case Ze.type.DS_AL_CODA:this.drawSymbolText(e,t,"D.S. al Coda",!0);break;case Ze.type.DS_AL_FINE:this.drawSymbolText(e,t,"D.S. al Fine",!1);break;case Ze.type.FINE:this.drawSymbolText(e,t,"Fine",!1);break;case Ze.type.TO_CODA:this.drawSymbolText(e,t,"To Coda",!0);break}return this}drawCodaFixed(e,t){const r=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+t+this.x_shift,r+25,40,"v4d",!0),this}drawSignoFixed(e,t){const r=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+t+this.x_shift,r+25,30,"v8c",!0),this}drawSymbolText(e,t,r,s){const o=e.checkContext();o.save(),o.setFont(this.font.family,this.font.size,this.font.weight);let a=0+this.x_shift,l=t+this.x_shift;this.symbol_type===Ze.type.CODA_LEFT?(a=this.x+e.options.vertical_bar_width,l=a+o.measureText(r).width+12):(this.x_shift=-(a+o.measureText(r).width+12+e.options.vertical_bar_width+12),a=this.x+this.x_shift+e.options.vertical_bar_width,l=a+o.measureText(r).width+12);const c=e.getYForTopText(e.options.num_lines)+this.y_shift+25;return s&&Glyph.renderGlyph(o,l,c,40,"v4d",!0),o.fillText(r,a,c+5),o.restore(),this}};class StaveSection extends StaveModifier{static get CATEGORY(){return"stavesection"}constructor(e,t,r){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=e,this.x=t,this.shift_x=0,this.shift_y=r,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return StaveSection.CATEGORY}setStaveSection(e){return this.section=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}draw(e,t){const r=e.checkContext();this.setRendered(),r.save(),r.lineWidth=2,r.setFont(this.font.family,this.font.size,this.font.weight);const s=r.measureText(""+this.section),o=s.width,a=s.height;let l=o+6;l<18&&(l=18);const c=a,u=e.getYForTopText(3)+this.shift_y;let m=this.x+t;return r.beginPath(),r.lineWidth=2,r.rect(m,u+a/4,l,c),r.stroke(),m+=(l-o)/2,r.fillText(""+this.section,m,u+16),r.restore(),this}}class StaveTempo extends StaveModifier{static get CATEGORY(){return"stavetempo"}constructor(e,t,r){super(),this.setAttribute("type","StaveTempo"),this.tempo=e,this.position=Modifier.Position.ABOVE,this.x=t,this.shift_x=10,this.shift_y=r,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return StaveTempo.CATEGORY}setTempo(e){return this.tempo=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}draw(e,t){const r=e.checkContext();this.setRendered();const s=this.render_options,o=s.glyph_font_scale/38,a=this.tempo.name,l=this.tempo.duration,c=this.tempo.dots,u=this.tempo.bpm,m=this.font;let d=this.x+this.shift_x+t;const y=e.getYForTopText(1)+this.shift_y;if(r.save(),r.openGroup("stavetempo",null,{}),a&&(r.setFont(m.family,m.size,m.weight),r.fillText(a,d,y),d+=r.measureText(a).width),l&&u){r.setFont(m.family,m.size,"normal"),a&&(d+=r.measureText(" ").width,r.fillText("(",d,y),d+=r.measureText("(").width);const b=Flow.getGlyphProps(l);if(d+=3*o,Glyph.renderGlyph(r,d,y,s.glyph_font_scale,b.code_head),d+=b.getWidth()*o,b.stem){let S=30;b.beam_count&&(S+=3*(b.beam_count-1)),S*=o;const A=y-S;r.fillRect(d-o,A,o,S),b.flag&&(Glyph.renderGlyph(r,d,A,s.glyph_font_scale,b.code_flag_upstem),c||(d+=6*o))}for(let S=0;S=e.line?c.above:c.below)}this.placeGlyphOnLine(s,this.stave,e.line),this.glyphs.push(s);const a=this.xPositions[this.xPositions.length-1],l=s.getMetrics().width+o;this.xPositions.push(a+l),this.width+=l}cancelKey(e){return this.formatted=!1,this.cancelKeySpec=e,this}convertToCancelAccList(e){const t=Flow.keySignature(e),r=this.accList.length>0&&t.length>0&&t[0].type!==this.accList[0].type,s=r?t.length:t.length-this.accList.length;if(s<1)return;const o=[];for(let a=0;a0?e[0].type:null;let r;if(this.cancelKeySpec&&(r=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const s=(this.position===StaveModifier.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;r&&this.convertAccLines(s,r.type,r.accList),this.convertAccLines(s,t,e);for(let o=0;o0){this.stave.context.openGroup("keysignature");for(let e=0;e{const e=i.split("/").filter(t=>t!=="");if(e.length!==2)throw new Vex.RERR("BadTimeSignature","Invalid time spec: ".concat(i,'. Must be in the form "/"'));e.forEach(t=>{if(isNaN(Number(t)))throw new Vex.RERR("BadTimeSignature","Invalid time spec: ".concat(i,". Must contain two valid numbers."))})};class TimeSignature extends StaveModifier{static get CATEGORY(){return"timesignatures"}static get glyphs(){return{C:{code:"v41",point:40,line:2},"C|":{code:"vb6",point:40,line:2}}}constructor(e=null,t=15,r=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=r,e===null)return;const s=t;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(StaveModifier.Position.BEGIN),this.setTimeSig(e),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(s)}getCategory(){return TimeSignature.CATEGORY}parseTimeSpec(e){if(e==="C"||e==="C|"){const{line:s,code:o,point:a}=TimeSignature.glyphs[e];return{line:s,num:!1,glyph:new Glyph(o,a)}}this.validate_args&&assertIsValidFraction(e);const[t,r]=e.split("/").map(s=>s.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(t,r)}}makeTimeSignatureGlyph(e,t){const r=new Glyph("v0",this.point);r.topGlyphs=[],r.botGlyphs=[];let s=0;for(let d=0;do?s:o,l=r.getMetrics().x_min;r.getMetrics=()=>({x_min:l,x_max:l+a,width:a});const c=(a-s)/2,u=(a-o)/2,m=this;return r.renderToStave=function(y){let b=y+c;for(let S=0;St.visible).filter(Boolean).length}getOptions(){return this.options}setNoteStartX(e){this.formatted||this.format(),this.setStartX(e);const t=this.modifiers[0];return t.setX(this.start_x-t.getWidth()),this}setStartX(e){this.start_x=e}getNoteStartX(){return this.formatted||this.format(),this.start_x}getNoteEndX(){return this.formatted||this.format(),this.end_x}getTieStartX(){return this.start_x}getTieEndX(){return this.x+this.width}getX(){return this.x}getNumLines(){return this.options.num_lines}setNumLines(e){return this.options.num_lines=parseInt(e,10),this.resetLines(),this}setY(e){return this.y=e,this}getTopLineTopY(){return this.getYForLine(0)-Flow.STAVE_LINE_THICKNESS/2}getBottomLineBottomY(){return this.getLines()===2?this.getYForLine(6)+Flow.STAVE_LINE_THICKNESS/2:this.getYForLine(this.getNumLines()-1)+Flow.STAVE_LINE_THICKNESS/2}setX(e){const t=e-this.x;this.formatted=!1,this.x=e,this.start_x+=t,this.end_x+=t;for(let r=0;rr.getWidth()&&(t-=r.getWidth()),t}setRepetitionTypeLeft(e,t){return this.modifiers.push(new Repetition$1(e,this.x,t)),this}setRepetitionTypeRight(e,t){return this.modifiers.push(new Repetition$1(e,this.x,t)),this}setVoltaType(e,t,r){if(e===2)volta.type===2&&volta.stave.modifiers.push(new Volta(volta.type,volta.number_t,volta.x,volta.y)),volta={stave:this,type:e,number_t:t,MeasureNumber:this.MeasureNumber,y:r,x:this.x};else if(e===4){let s=this.MeasureNumber-volta.MeasureNumber,o=Math.max(volta.y,r);for(let a=0;a<=s;a++)voltaMeasureNumber[volta.MeasureNumber+a]={type:a===0?2:a===s?4:0,number_t:t,y:o};volta={}}else this.modifiers.push(new Volta(e,t,this.x,r));return this}drawVolta(){let e=voltaMeasureNumber[this.MeasureNumber];e&&(this.modifiers.push(new Volta(e.type,e.number_t,this.x,e.y)),delete voltaMeasureNumber[this.MeasureNumber]),volta.type&&volta.MeasureNumber==this.MeasureNumber&&(this.modifiers.push(new Volta(volta.type,volta.number_t,this.x,volta.y)),volta={})}setSection(e,t,r=0,s=12){const o=new StaveSection(e,this.x+r,t);return o.font.size=s,this.modifiers.push(o),this}setTempo(e,t){return this.modifiers.push(new StaveTempo(e,this.x,t)),this}setText(e,t,r){let s=new StaveText(e,t,r);return s.setFont({family:"Arial",size:14,weight:"normal"}),this.modifiers.push(s),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new BoundingBox(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const e=this.options,t=e.spacing_between_lines_px;return this.getYForLine(e.num_lines)+e.space_below_staff_ln*t}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(e){const t=this.options,r=t.spacing_between_lines_px,s=t.space_above_staff_ln;return this.y+e*r+s*r}getLineForY(e){const t=this.options,r=t.spacing_between_lines_px,s=t.space_above_staff_ln;return(e-this.y)/r-s}getYForTopText(e){const t=e||0;return this.getYForLine(-t-this.options.top_text_position)}getYForBottomText(e){const t=e||0;return this.getYForLine(this.options.bottom_text_position+t)}getYForNote(e){const t=this.options,r=t.spacing_between_lines_px,s=t.space_above_staff_ln;return this.y+s*r+5*r-e*r}getYForGlyphs(){return this.getYForLine(3)}addModifier(e,t,r){return t!==void 0&&e.setPosition(t),r&&(this.timeSignature.numerator=r.numerator,this.timeSignature.denominator=r.denominator),e.setStave(this),this.formatted=!1,this.modifiers.push(e),this}addEndModifier(e){return this.addModifier(e,StaveModifier.Position.END),this}setBegBarType(e){const{SINGLE:t,REPEAT_BEGIN:r,NONE:s}=Barline.type;return(e===t||e===r||e===s)&&(this.modifiers[0].setType(e),this.formatted=!1),this}setEndBarType(e){return e!==Barline.type.REPEAT_BEGIN&&(this.modifiers[1].setType(e),this.formatted=!1),this}setClef(e,t,r,s){s===void 0&&(s=StaveModifier.Position.BEGIN),s===StaveModifier.Position.END?this.endClef=e:this.clef=e;const o=this.getModifiers(s,Clef.CATEGORY);return o.length===0?this.addClef(e,t,r,s):o[0].setType(e,t,r),this}setEndClef(e,t,r){return this.setClef(e,t,r,StaveModifier.Position.END),this}setKeySignature(e,t,r){this.options.keySignature=e,r===void 0&&(r=StaveModifier.Position.BEGIN);const s=this.getModifiers(r,KeySignature.CATEGORY);return s.length===0?this.options.DYMusicScoreType!=="jianpu"&&this.addKeySignature(e,t,r):s[0].setKeySig(e,t),this}setEndKeySignature(e,t){return this.setKeySignature(e,t,StaveModifier.Position.END),this}setTimeSignature(e,t,r){r===void 0&&(r=StaveModifier.Position.BEGIN);const s=this.getModifiers(r,TimeSignature.CATEGORY);return s.length===0?this.addTimeSignature(e,t,r):s[0].setTimeSig(e),this}setEndTimeSignature(e,t){return this.setTimeSignature(e,t,StaveModifier.Position.END),this}addKeySignature(e,t,r){return r===void 0&&(r=StaveModifier.Position.BEGIN),this.addModifier(new KeySignature(e,t).setPosition(r),r),this}addClef(e,t,r,s){return s===void 0||s===StaveModifier.Position.BEGIN?this.clef=e:s===StaveModifier.Position.END&&(this.endClef=e),this.addModifier(new Clef(e,t,r),s),this}addEndClef(e,t,r){return this.addClef(e,t,r,StaveModifier.Position.END),this}addTimeSignature(e,t,r){return this.addModifier(new TimeSignature(e,t),r),this}addEndTimeSignature(e,t){return this.addTimeSignature(e,t,StaveModifier.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(e,t){return e===void 0&&t===void 0?this.modifiers:this.modifiers.filter(r=>(e===void 0||e===r.getPosition())&&(t===void 0||t===r.getCategory()))}sortByCategory(e,t){for(let r=e.length-1;r>=0;r--)for(let s=0;st[e[s+1].getCategory()]){const o=e[s];e[s]=e[s+1],e[s+1]=o}}format(){const e=this.modifiers[0],t=this.modifiers[1],r=this.getModifiers(StaveModifier.Position.BEGIN),s=this.getModifiers(StaveModifier.Position.END);this.sortByCategory(r,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(s,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),r.length>1&&e.getType()===Barline.type.REPEAT_BEGIN&&(r.push(r.splice(0,1)[0]),r.splice(0,0,new Barline(Barline.type.SINGLE))),s.indexOf(t)>0&&s.splice(0,0,new Barline(Barline.type.NONE));let o,a,l,c=0,u=this.x;for(let y=0;y{a.includes(c)?l.visible=!0:l.visible=!1})}for(let a=0;athis.drawStaveTempo()),this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const a=this.context.measureText(""+this.measure).width;s=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-a/2,s),this.context.restore()}return this}drawStaveTempo(){if(!this.staveTempos.length)return;const e=document.querySelector("#".concat(this.attrs.id));if(!e)return;const t=e.parentElement.getBBox(),r=this.getYForLine(0),s=e.parentElement.parentElement.querySelectorAll(".vf-curve");if(s.length){const o=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),a=this.getYForTopText(1)+t.y-r+5;s.forEach(l=>{const c=l.getBBox();c.x-10o&&c.y-10a&&(t.y=c.y+5)})}for(let o=0;o=0&&this.timeSignature.numerator){let e=40,t=0;this.MeasureNumber<2&&(e=70,t=-72),this.setText("".concat(this.timeSignature.numerator),1,{justification:1,shift_x:e,shift_y:t-13}),this.setText("ᅳ",1,{justification:1,shift_x:e+3,shift_y:t-2}),this.setText("".concat(this.timeSignature.denominator),1,{justification:1,shift_x:e,shift_y:t+8})}}drawVertical(e,t){this.drawVerticalFixed(this.x+e,t)}drawVerticalFixed(e,t){this.checkContext();const r=this.getYForLine(0),s=this.getYForLine(this.options.num_lines-1);t&&this.context.fillRect(e-3,r,1,s-r+1),this.context.fillRect(e,r,1,s-r+1)}drawVerticalBar(e){this.drawVerticalBarFixed(this.x+e,!1)}drawVerticalBarFixed(e){this.checkContext();const t=this.getYForLine(0),r=this.getYForLine(this.options.num_lines-1);this.context.fillRect(e,t,1,r-t+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(e,t){if(e>=this.options.num_lines||e<0)throw new Vex.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(t.visible===void 0)throw new Vex.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof t.visible!="boolean")throw new Vex.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[e]=t,this}setConfigForLines(e){if(e.length!==this.options.num_lines)throw new Vex.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(const t in e)e[t]||(e[t]=this.options.line_config[t]),Vex.Merge(this.options.line_config[t],e[t]);return this.options.line_config=e,this}}class TabStave extends Stave{constructor(e,t,r,s){const o={spacing_between_lines_px:13,num_lines:6,top_text_position:1};Vex.Merge(o,s),super(e,t,r,o),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}function getUnusedStringGroups(i,e){const t=[];let r=[];for(let s=1;s<=i;s++)e.indexOf(s)>-1?(t.push(r),r=[]):r.push(s);return r.length>0&&t.push(r),t}function getPartialStemLines(i,e,t,r){const s=r!==1,o=r!==-1,a=t.getSpacingBetweenLines(),l=t.getNumLines(),c=[];return e.forEach(u=>{const m=u.indexOf(l)>-1,d=u.indexOf(1)>-1;if(s&&d||o&&m)return;u.length===1&&u.push(u[0]);const y=[];u.forEach((b,S,A)=>{const P=b===1,x=b===l;let E=t.getYForLine(b-1);S===0&&!P?E-=a/2-1:S===A.length-1&&!x&&(E+=a/2-1),y.push(E),r===1&&P?y.push(i-2):r===-1&&x&&y.push(i+2)}),c.push(y.sort((b,S)=>b-S))}),c}let TabNote$1=class Ci extends StemmableNote{static get CATEGORY(){return"tabnotes"}constructor(e,t){if(super(e),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=e.positions,Vex.Merge(this.render_options,{glyph_font_scale:Flow.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:t,draw_dots:t,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): ".concat(JSON.stringify(e)));this.buildStem(),e.stem_direction?this.setStemDirection(e.stem_direction):this.setStemDirection(Stem.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return Ci.CATEGORY}setGhost(e){return this.ghost=e,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const e=this.getGlyph();return this.stem_extension_override!=null?this.stem_extension_override:e?this.getStemDirection()===1?e.tabnote_stem_up_extension:e.tabnote_stem_down_extension:0}addDot(){const e=new Dot;return this.dots+=1,this.addModifier(e,0)}updateWidth(){this.glyphs=[],this.width=0;for(let e=0;ethis.width}setStave(e){super.setStave(e),this.context=e.context;let t;if(this.context){const s=this.context;for(this.width=0,t=0;to.width),this.width=Math.max(o.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const r=this.positions.map(({str:s})=>e.getYForLine(s-1));return this.setYs(r),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(e){this.setModifierContext(e);for(let t=0;t{e.getCategory()==="dots"&&!this.render_options.draw_dots||(e.setContext(this.context),e.drawWithStyle())})}drawStemThrough(){const e=this.getStemX(),t=this.getStemY(),r=this.context,s=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&s){const a=this.stave.getNumLines(),l=this.positions.map(m=>m.str),c=getUnusedStringGroups(a,l),u=getPartialStemLines(t,c,this.getStave(),this.getStemDirection());r.save(),r.setLineWidth(Stem.WIDTH),u.forEach(m=>{m.length!==0&&(r.beginPath(),r.moveTo(e,m[0]),r.lineTo(e,m[m.length-1]),r.stroke(),r.closePath())}),r.restore()}}drawPositions(){const e=this.context,t=this.getAbsoluteX(),r=this.ys;for(let s=0;sparseInt(s,10)?TabSlide.SLIDE_DOWN:TabSlide.SLIDE_UP}this.slide_direction=t,this.render_options.cp1=11,this.render_options.cp2=14,this.render_options.y_shift=.5,this.setFont({font:"Times",size:10,style:"bold italic"}),this.setNotes(e)}renderTie(e){if(e.first_ys.length===0||e.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const t=this.context,r=e.first_x_px,s=e.first_ys,o=e.last_x_px,a=this.slide_direction;if(a!==TabSlide.SLIDE_UP&&a!==TabSlide.SLIDE_DOWN)throw new Vex.RERR("BadSlide","Invalid slide direction");for(let l=0;lthis.numStrings)throw new Vex.RERR("BadArguments","String number must be between 1 and ".concat(this.numStrings,":").concat(e));return this.tuningValues[t-1]}getValueForFret(e,t){const r=this.getValueForString(t),s=parseInt(e,10);if(s<0)throw new Vex.RERR("BadArguments","Fret number must be 0 or higher: "+e);return r+s}getNoteForFret(e,t){const r=this.getValueForFret(e,t),s=Math.floor(r/12),o=r%12;return Flow.integerToNote(o)+"/"+s}}class KeyManager{constructor(e){this.music=new Music,this.setKey(e)}setKey(e){return this.key=e,this.reset(),this}getKey(){return this.key}reset(){if(this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental),!Music.scaleTypes[this.keyParts.type])throw new Vex.RERR("BadArguments","Unsupported key type: ".concat(this.key));this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),Music.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const t=Music.root_indices[this.keyParts.root];for(let r=0;r{const r=TextDynamics.GLYPHS[t];if(!r)throw new Vex.RERR("Invalid dynamics character: "+t);const s=this.render_options.glyph_font_size,o=new Glyph(r.code,s);this.glyphs.push(o),e+=r.width}),this.setWidth(e),this.preFormatted=!0,this}draw(){this.setRendered();const e=this.getAbsoluteX(),t=this.stave.getYForLine(this.line+-3);L$7("Rendering Dynamics: ",this.sequence);let r=e;this.glyphs.forEach((s,o)=>{const a=this.sequence[o];s.render(this.context,r,t),r+=TextDynamics.GLYPHS[a].width})}}function drawArrowHead(i,e,t,r,s,o,a){i.beginPath(),i.moveTo(e,t),i.lineTo(r,s),i.lineTo(o,a),i.lineTo(e,t),i.closePath(),i.fill()}function drawArrowLine(i,e,t,r){const s=r.draw_start_arrow&&r.draw_end_arrow,o=e.x,a=e.y,l=t.x,c=t.y,u=Math.sqrt((l-o)*(l-o)+(c-a)*(c-a)),m=(u-r.arrowhead_length/3)/u;let d,y,b,S;r.draw_end_arrow||s?(d=Math.round(o+(l-o)*m),y=Math.round(a+(c-a)*m)):(d=l,y=c),r.draw_start_arrow||s?(b=o+(l-o)*(1-m),S=a+(c-a)*(1-m)):(b=o,S=a),r.color&&(i.setStrokeStyle(r.color),i.setFillStyle(r.color)),i.beginPath(),i.moveTo(b,S),i.lineTo(d,y),i.stroke(),i.closePath();const A=Math.atan2(c-a,l-o),P=Math.abs(r.arrowhead_length/Math.cos(r.arrowhead_angle));let x,E,_,T,C,R;(r.draw_end_arrow||s)&&(x=A+Math.PI+r.arrowhead_angle,_=l+Math.cos(x)*P,T=c+Math.sin(x)*P,E=A+Math.PI-r.arrowhead_angle,C=l+Math.cos(E)*P,R=c+Math.sin(E)*P,drawArrowHead(i,_,T,l,c,C,R)),(r.draw_start_arrow||s)&&(x=A+r.arrowhead_angle,_=o+Math.cos(x)*P,T=a+Math.sin(x)*P,E=A-r.arrowhead_angle,C=o+Math.cos(E)*P,R=a+Math.sin(E)*P,drawArrowHead(i,_,T,o,a,C,R))}class StaveLine extends Element$1{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(e){super(),this.setAttribute("type","StaveLine"),this.notes=e,this.text="",this.font={family:"Arial",size:10,weight:""},this.render_options={padding_left:4,padding_right:3,line_width:1,line_dash:null,rounded_end:!0,color:null,draw_start_arrow:!1,draw_end_arrow:!1,arrowhead_length:10,arrowhead_angle:Math.PI/8,text_position_vertical:StaveLine.TextVerticalPosition.TOP,text_justification:StaveLine.TextJustification.CENTER},this.setNotes(e)}setFont(e){return this.font=e,this}setText(e){return this.text=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new Vex.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new Vex.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}applyLineStyle(){const e=this.checkContext(),t=this.render_options;t.line_dash&&e.setLineDash(t.line_dash),t.line_width&&e.setLineWidth(t.line_width),t.rounded_end?e.setLineCap("round"):e.setLineCap("square")}applyFontStyle(){const e=this.checkContext();this.font&&e.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color))}draw(){const e=this.checkContext();this.setRendered();const t=this.first_note,r=this.last_note,s=this.render_options;e.save(),this.applyLineStyle();let o,a;this.first_indices.forEach((y,b)=>{const S=this.last_indices[b];o=t.getModifierStartXY(2,y),a=r.getModifierStartXY(1,S);const A=o.y>a.y;o.x+=t.getMetrics().modRightPx+s.padding_left,a.x-=r.getMetrics().modLeftPx+s.padding_right;const P=t.getGlyph().getWidth();t.getKeyProps()[y].displaced&&t.getStemDirection()===1&&(o.x+=P+s.padding_left),r.getKeyProps()[S].displaced&&r.getStemDirection()===-1&&(a.x-=P+s.padding_right),o.y+=A?-3:1,a.y+=A?2:0,drawArrowLine(e,o,a,this.render_options)}),e.restore();const l=e.measureText(this.text).width,c=s.text_justification;let u=0;c===StaveLine.TextJustification.LEFT?u=o.x:c===StaveLine.TextJustification.CENTER?u=(a.x-o.x)/2+o.x-l/2:c===StaveLine.TextJustification.RIGHT&&(u=a.x-l);let m;const d=s.text_position_vertical;return d===StaveLine.TextVerticalPosition.TOP?m=t.getStave().getYForTopText():d===StaveLine.TextVerticalPosition.BOTTOM&&(m=t.getStave().getYForBottomText(Flow.TEXT_HEIGHT_OFFSET_HACK)),e.save(),this.applyFontStyle(),e.fillText(this.text,u,m),e.restore(),this}}function L$6(...i){PedalMarking.DEBUG&&Vex.L("Vex.Flow.PedalMarking",i)}function drawPedalGlyph(i,e,t,r,s){const o=PedalMarking.GLYPHS[i];new Glyph(o.code,s).render(e,t+o.x_shift,r+o.y_shift)}class PedalMarking extends Element$1{static get GLYPHS(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}static get Styles(){return{TEXT:1,BRACKET:2,MIXED:3,MIXED_OPEN_END:4,BRACKET_OPEN_BEGIN:5,BRACKET_OPEN_END:6,BRACKET_OPEN_BOTH:7}}static get StylesString(){return{text:PedalMarking.Styles.TEXT,bracket:PedalMarking.Styles.BRACKET,mixed:PedalMarking.Styles.MIXED,mixed_open_end:PedalMarking.Styles.MIXED_OPEN_END,bracket_open_begin:PedalMarking.Styles.BRACKET_OPEN_BEGIN,bracket_open_end:PedalMarking.Styles.BRACKET_OPEN_END,bracket_open_both:PedalMarking.Styles.BRACKET_OPEN_BOTH}}static createSustain(e){return new PedalMarking(e)}static createSostenuto(e){const t=new PedalMarking(e);return t.setStyle(PedalMarking.Styles.MIXED),t.setCustomText("Sost. Ped."),t}static createUnaCorda(e){const t=new PedalMarking(e);return t.setStyle(PedalMarking.Styles.TEXT),t.setCustomText("una corda","tre corda"),t}constructor(e){super(),this.setAttribute("type","PedalMarking"),this.EndsStave=!1,this.ChangeBegin=!1,this.ChangeEnd=!1,this.notes=e,this.style=PedalMarking.TEXT,this.line=0,this.custom_depress_text="",this.custom_release_text="",this.font={family:"Times New Roman",size:12,weight:"italic bold"},this.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"}}setEndStave(e){if(this.endStave=e,this.endStaveAddedWidth=0,this.startMargin=0,this.endMargin=0,Array.isArray(this.endStave.modifiers))for(let t=0;t3)throw new Vex.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=e,this}setLine(e){return this.line=e,this}drawBracketed(){const e=this.context;let t=!1,r,s;const o=this;this.notes.forEach((a,l,c)=>{t=!t;let u=0;if(a?u=a.getNoteHeadBeginX():u=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)t?this.ChangeBegin&&(u=a.getAbsoluteX()):(a?this.ChangeEnd?u=a.getAbsoluteX():u=a.getStave().end_x+this.endStaveAddedWidth-o.render_options.text_margin_right:u=this.endStave.end_x+this.endStaveAddedWidth-o.render_options.text_margin_right,this.endMargin=-o.render_options.text_margin_right);else if(a)if(t)this.ChangeBegin&&(u=a.getAbsoluteX());else switch(o.style){case PedalMarking.Styles.BRACKET_OPEN_END:case PedalMarking.Styles.BRACKET_OPEN_BOTH:case PedalMarking.Styles.MIXED_OPEN_END:u=a.getNoteHeadEndX();break;default:this.ChangeEnd?u=a.getAbsoluteX():(u=a.getNoteHeadBeginX()-o.render_options.text_margin_right,this.startMargin=-o.render_options.text_margin_right);break}let m=this.endStave;a&&(m=a.getStave());let d=m.getYForBottomText(o.line+3);s&&s>d&&(d=s);const y=c[l+1]===a,b=c[l-1]===a;let S=0;if(t)if(S=b?5:0,(o.style===PedalMarking.Styles.MIXED||o.style===PedalMarking.Styles.MIXED_OPEN_END)&&!b)if(o.custom_depress_text){const A=e.measureText(o.custom_depress_text).width;e.fillText(o.custom_depress_text,u-A/2,d),S=A/2+o.render_options.text_margin_right}else drawPedalGlyph("pedal_depress",e,u,d,o.render_options.glyph_point_size),S=20+o.render_options.text_margin_right;else e.beginPath(),o.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||o.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?e.moveTo(u+S,d):(this.ChangeBegin&&(u+=5),e.moveTo(u,d-o.render_options.bracket_height),this.ChangeBegin&&(u+=5),e.lineTo(u+S,d)),e.stroke(),e.closePath();else S=y&&!this.EndsStave?-5:0,e.beginPath(),e.moveTo(r,s),e.lineTo(u+S,d),o.style!==PedalMarking.Styles.BRACKET_OPEN_END&&o.style!==PedalMarking.Styles.MIXED_OPEN_END&&o.style!==PedalMarking.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(u+=5),e.lineTo(u,d-o.render_options.bracket_height)),e.stroke(),e.closePath();r=u+S,s=d})}drawText(){const e=this.context;let t=!1;const r=this,s=r.render_options.glyph_point_size;this.notes.forEach(o=>{t=!t;const a=o.getStave(),l=o.getAbsoluteX(),c=a.getYForBottomText(r.line+3);let u=0;t?r.custom_depress_text?(u=e.measureText(r.custom_depress_text).width,e.fillText(r.custom_depress_text,l-u/2,c)):drawPedalGlyph("pedal_depress",e,l,c,s):r.custom_release_text?(u=e.measureText(r.custom_release_text).width,e.fillText(r.custom_release_text,l-u/2,c)):drawPedalGlyph("pedal_release",e,l,c,s)})}draw(){const e=this.checkContext();this.setRendered(),e.save(),e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color),e.setFont(this.font.family,this.font.size,this.font.weight),L$6("Rendering Pedal Marking"),this.style===PedalMarking.Styles.BRACKET||this.style===PedalMarking.Styles.MIXED||this.style===PedalMarking.Styles.MIXED_OPEN_END||this.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||this.style===PedalMarking.Styles.BRACKET_OPEN_END||this.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?(e.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===PedalMarking.Styles.TEXT&&this.drawText(),e.restore()}}function L$5(...i){TextBracket.DEBUG&&Vex.L("Vex.Flow.TextBracket",i)}class TextBracket extends Element$1{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:TextBracket.Positions.TOP,bottom:TextBracket.Positions.BOTTOM}}constructor({start:e,stop:t,text:r="",superscript:s="",position:o=TextBracket.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=e,this.stop=t,this.text=r,this.superscript=s,this.position=typeof o=="string"?TextBracket.PositionString[o]:o,this.line=1,this.font={family:"Serif",size:15,weight:"italic"},this.render_options={dashed:!0,dash:[5],color:"black",line_width:1,show_bracket:!0,bracket_height:8,underline_superscript:!0}}applyStyle(e){return e.setFont(this.font.family,this.font.size,this.font.weight),e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color),e.setLineWidth(this.render_options.line_width),this}setDashed(e,t){return this.render_options.dashed=e,t&&(this.render_options.dash=t),this}setFont(e){return this.font={...this.font,...e},this}setLine(e){return this.line=e,this}draw(){const e=this.context;this.setRendered();let t=0;switch(this.position){case TextBracket.Positions.TOP:t=this.start.getStave().getYForTopText(this.line);break;case TextBracket.Positions.BOTTOM:t=this.start.getStave().getYForBottomText(this.line+Flow.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new Vex.RERR("InvalidPosition","The position ".concat(this.position," is invalid"))}const r={x:this.start.getAbsoluteX(),y:t},s={x:this.stop.getAbsoluteX(),y:t};L$5("Rendering TextBracket: start:",r,"stop:",s,"y:",t);const o=this.render_options.bracket_height*this.position;e.save(),this.applyStyle(e),e.fillText(this.text,r.x,r.y);const a=e.measureText(this.text).width,l=e.measureText("M").width,c=r.y-l/2.5;e.setFont(this.font.family,this.font.size/1.4,this.font.weight),e.fillText(this.superscript,r.x+a+1,c);const u=e.measureText(this.superscript).width,m=e.measureText("M").width;let d=r.x,y=c;const b=s.x+this.stop.getGlyph().getWidth();this.position===TextBracket.Positions.TOP?(d+=a+u+5,y-=m/2.7):this.position===TextBracket.Positions.BOTTOM&&(y+=m/2.7,d+=a+2,this.render_options.underline_superscript||(d+=u)),this.render_options.dashed?(Renderer.drawDashedLine(e,d,y,b,y,this.render_options.dash),this.render_options.show_bracket&&Renderer.drawDashedLine(e,b,y+1*this.position,b,y+o,this.render_options.dash)):(e.beginPath(),e.moveTo(d,y),e.lineTo(b,y),this.render_options.show_bracket&&e.lineTo(b,y+o),e.stroke(),e.closePath()),e.restore()}}function L$4(...i){BarNote.DEBUG&&Vex.L("Vex.Flow.BarNote",i)}class BarNote extends Note{constructor(e=Barline.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const t=Barline.type;this.metrics.widths={[t.SINGLE]:8,[t.DOUBLE]:12,[t.END]:15,[t.REPEAT_BEGIN]:14,[t.REPEAT_END]:14,[t.REPEAT_BOTH]:18,[t.NONE]:0},this.ignore_ticks=!0,this.setType(e)}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Barline.typeString[e]:e,this.setWidth(this.metrics.widths[this.type]),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");L$4("Rendering bar line at: ",this.getAbsoluteX());const e=new Barline(this.type);e.setX(this.getAbsoluteX()),e.draw(this.stave),this.setRendered()}}class GhostNote extends StemmableNote{constructor(e){if(!e)throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let t;if(typeof e=="string")t={duration:e};else if(typeof e=="object")t=e;else throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");super(t),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(e){super.setStave(e)}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let e=0;e0||t===!0;return t&&!(o>0)&&(this.pos=s),l?this.matchSuccess():this.matchFail(s),{success:l,results:r,numMatches:o}}expectZeroOrMore(e){return this.expectOneOrMore(e,!0)}expect(e){L$2("Evaluating rules:",e);let t;if(!e)throw new X$2("Invalid Rule: "+e,e);const r=e.bind(this.grammar)();if(r.token)t=this.matchToken(r.token,r.noSpace===!0),t.success&&(this.pos+=t.incrementPos);else if(r.expect)r.oneOrMore?t=this.expectOneOrMore(r):r.zeroOrMore?t=this.expectZeroOrMore(r):t=this.expectOne(r);else throw new X$2("Bad grammar! No `token` or `expect` property",r);return t.matches=[],t.results&&t.results.forEach(s=>t.matches.push(flattenMatches(s))),r.run&&t.success&&r.run(t),t}}function L$1(...i){EasyScore.DEBUG&&Vex.L("Vex.Flow.EasyScore",i)}const X$1=Vex.MakeException("EasyScoreError");class Grammar{constructor(e){this.builder=e}begin(){return this.LINE}LINE(){return{expect:[this.PIECE,this.PIECES,this.EOL]}}PIECE(){return{expect:[this.CHORDORNOTE,this.PARAMS],run:()=>this.builder.commitPiece()}}PIECES(){return{expect:[this.COMMA,this.PIECE],zeroOrMore:!0}}PARAMS(){return{expect:[this.DURATION,this.TYPE,this.DOTS,this.OPTS]}}CHORDORNOTE(){return{expect:[this.CHORD,this.SINGLENOTE],or:!0}}CHORD(){return{expect:[this.LPAREN,this.NOTES,this.RPAREN],run:e=>this.builder.addChord(e.matches[1])}}NOTES(){return{expect:[this.NOTE],oneOrMore:!0}}NOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE]}}SINGLENOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE],run:e=>this.builder.addSingleNote(e.matches[0],e.matches[1],e.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:e=>this.builder.setNoteDots(e.matches[0])}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:e=>this.builder.setNoteType(e.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:e=>this.builder.setNoteDuration(e.matches[1])}}OPTS(){return{expect:[this.LBRACKET,this.KEYVAL,this.KEYVALS,this.RBRACKET],maybe:!0}}KEYVALS(){return{expect:[this.COMMA,this.KEYVAL],zeroOrMore:!0}}KEYVAL(){const e=t=>t.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:t=>this.builder.addNoteOption(t.matches[0],e(t.matches[2]))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"bbs|bb|bss|bs|b|db|d|##|#|n|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSxX]"}}LPAREN(){return{token:"[(]"}}RPAREN(){return{token:"[)]"}}COMMA(){return{token:"[,]"}}DOT(){return{token:"[.]"}}SLASH(){return{token:"[/]"}}MAYBESLASH(){return{token:"[/]?"}}EQUALS(){return{token:"[=]"}}LBRACKET(){return{token:"\\["}}RBRACKET(){return{token:"\\]"}}EOL(){return{token:"$"}}}class Builder{constructor(e){this.factory=e,this.commitHooks=[],this.reset()}reset(e={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,e)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(e){this.commitHooks.push(e)}resetPiece(){L$1("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(e){L$1("setNoteDots:",e),e&&(this.piece.dots=e.length)}setNoteDuration(e){L$1("setNoteDuration:",e),this.rollingDuration=this.piece.duration=e||this.rollingDuration}setNoteType(e){L$1("setNoteType:",e),e&&(this.piece.type=e)}addNoteOption(e,t){L$1("addNoteOption: key:",e,"value:",t),this.piece.options[e]=t}addNote(e,t,r){L$1("addNote:",e,t,r),this.piece.chord.push({key:e,accid:t,octave:r})}addSingleNote(e,t,r){L$1("addSingleNote:",e,t,r),this.addNote(e,t,r)}addChord(e){L$1("startChord"),typeof e[0]!="object"?this.addSingleNote(e[0]):e.forEach(t=>{t&&this.addNote(...t)}),L$1("endChord")}commitPiece(){L$1("commitPiece");const{factory:e}=this;if(!e)return;const t={...this.options,...this.piece.options},{stem:r,clef:s}=t,o=r.toLowerCase()==="auto",a=!o&&r.toLowerCase()==="up"?StaveNote.STEM_UP:StaveNote.STEM_DOWN,{chord:l,duration:c,dots:u,type:m}=this.piece,d=l.map(S=>S.key+"/"+S.octave),y=e.StaveNote({keys:d,duration:c,dots:u,type:m,clef:s,auto_stem:o});o||y.setStemDirection(a);const b=l.map(S=>S.accid||null);b.forEach((S,A)=>{S&&y.addAccidental(A,e.Accidental({type:S}))});for(let S=0;SS(t,y,this)),this.elements.notes.push(y),this.elements.accidentals.concat(b),this.resetPiece()}}function setId({id:i},e){i!==void 0&&e.setAttribute("id",i)}function setClass(i,e){if(!i.class)return;const t=/\s*,\s*/;i.class.split(t).forEach(r=>e.addClass(r))}class EasyScore{constructor(e={}){this.setOptions(e),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(e){return Object.assign(this.defaults,e),this}setOptions(e){return this.options={factory:null,builder:null,commitHooks:[setId,setClass,Articulation$1.easyScoreHook],throwOnError:!1,...e},this.factory=this.options.factory,this.builder=this.options.builder||new Builder(this.factory),this.grammar=new Grammar(this.builder),this.parser=new Parser(this.grammar),this.options.commitHooks.forEach(t=>this.addCommitHook(t)),this}setContext(e){return this.factory&&this.factory.setContext(e),this}parse(e,t={}){this.builder.reset(t);const r=this.parser.parse(e);if(!r.success&&this.options.throwOnError)throw new X$1("Error parsing line: "+e,r);return r}beam(e,t={}){return this.factory.Beam({notes:e,options:t}),e}tuplet(e,t={}){return this.factory.Tuplet({notes:e,options:t}),e}notes(e,t={}){return t={clef:this.defaults.clef,stem:this.defaults.stem,...t},this.parse(e,t),this.builder.getElements().notes}voice(e,t){return t={time:this.defaults.time,...t},this.factory.Voice(t).addTickables(e)}addCommitHook(e){return this.builder.addCommitHook(e)}}function initGroup(){return{notes:[],finish:!1,total:0,staveId:""}}let _text_width=null,tone="C",group=initGroup(),_denominator="",_numerator="",ornamentGroup="";class NumberedNote extends StaveNote{static get CATEGORY(){return"numberednotes"}static accidentalAndKey(e){switch(e){case"G":return{4:"#"};case"D":return{1:"#",4:"#"};case"A":return{1:"#",4:"#",5:"#"};case"E":return{1:"#",2:"#",4:"#",5:"#"};case"B":return{1:"#",2:"#",4:"#",5:"#",6:"#"};case"F#":return{1:"#",2:"#",3:"#",4:"#",5:"#",6:"#"};case"C#":return{1:"#",2:"#",3:"#",4:"#",5:"#",6:"#",7:"#"};case"F":return{7:"b"};case"Bb":return{7:"b",3:"b"};case"Eb":return{7:"b",3:"b",6:"b"};case"Ab":return{7:"b",2:"b",3:"b",6:"b"};case"Db":return{7:"b",2:"b",3:"b",5:"b",6:"b"};case"Gb":return{7:"b",1:"b",2:"b",3:"b",5:"b",6:"b"};case"Cb":return{7:"b",1:"b",2:"b",3:"b",4:"b",5:"b",6:"b"};default:return{}}}static accidentalMap(e){switch(e){case"C":return"";case"F":case"Bb":case"Eb":case"Ab":case"Db":case"Gb":case"Cb":return{bb:"b",b:"",n:"#","#":"##"};default:return{b:"bb",n:"b","#":"","##":"#"}}}static get noteLift(){switch(tone){case"G":return["7"];case"D":return["7","3"];case"A":return["7","3","6"];case"E":return["2","6","3","7"];case"B":return["5","2","6","3","7"];case"F#":return["1","5","2","6","3","7"];case"C#":return["4","1","5","2","6","3","7"];case"F":return["4"];case"Bb":return["1","4"];case"Eb":return["5","1","4"];case"Ab":return["2","5","1","4"];case"Db":return["6","2","5","1","4"];case"Gb":return["3","6","2","5","1","4"];case"Cb":return["7","3","6","2","5","1","4"]}}static get longDurationLine(){return{1:3,2:1,6:2}}static get numberedDurationLine(){return{8:1,16:2,32:3,64:4,128:5}}static get durationTime(){return{8:6144,4:4096}}constructor(e){super(e),this.setAttribute("type","NumberedNote"),tone=e.keyString,this.ornament=!!e.ornament,this.line=0,this.keys=e.keys||[],this.fontSize=20,this.offset_x=0,this.offset_y=0,this.note_tones=[],this.duration_lines=0,this.long_duration_lines=0,this.note_size=e.note_size||16;const t=Flow.sanitizeDuration(this.duration);var r=NumberedNote.numberedDurationLine[t.toString()];if(r&&(this.duration_lines=r),r=NumberedNote.longDurationLine[t.toString()],r&&(this.long_duration_lines=r),!_text_width){var s="__$text_wraper$$__";let a=document.createElement("canvas");a.id=s,document.body.append(a);const l=document.getElementById(s),c=l.getContext("2d");c.font="Arial 22px";var o=c.measureText("5");_text_width=o.width+2,document.body.removeChild(l)}}getCategory(){return NumberedNote.CATEGORY}setKeySignature(e){this.keySignature=e}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setWidth(this.full_width),this.setPreFormatted(!0))}filterNote(){if(window&&window.sett&&window.sett.keySignature||!this.keys||!this.keys.length)return;const e=NumberedNote.accidentalMap(tone);if(!e)return;const t=NumberedNote.noteLift;if(!t)return;var r=this.keys[0].split("/"),s=r[0];s==="b"&&(s="R"),s=s.replace(new RegExp("#","g"),""),s=s.replace(new RegExp("n","g"),""),s.length>1&&(s=s.replace(new RegExp("b","g"),""));const o=NumberedNoteHead.numberedNotationMapping[s.toUpperCase()];if(t.includes(o))for(let a=0;a{switch(r.getAttribute("type")){case"Accidental":r.render_options.font_scale=this.note_width*1.4,r.x_shift=2,r.y_shift=this.unit_height/2,this.ornament&&(r.render_options.font_scale=this.note_width,r.x_shift=14,r.y_shift=-10);break;case"Stroke":r.x_shift=-1*e,r.y_shift=1*this.unit_height;break;case"Dot":r.x_shift=t*this.duration_dot_width+7,r.y_shift=1*this.unit_height,t++;break;case"Ornament":r.y_shift=-3;break;default:r.y_shift=1*this.unit_height}r.reset&&r.reset(),e+=r.getWidth()/2})}handleDeleteDot(){for(let e=0;ea),r=t.length?t[0]/t[1]:0;if(this.ornament)return;if(r===0)return this.long_duration_lines=this.intrinsicTicks/e-1,this.long_duration_lines>=_numerator&&(this.long_duration_lines=_numerator-1),_denominator==8&&(this.long_duration_lines=0,_numerator==3&&this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),_numerator==6&&(this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),new Glyph("v0",40).render(this.context,this.bottom_x+40,this.top_y),this.draw_dot(this.context,this.bottom_x+65,this.bottom_y-30,this.dot_width))),group=initGroup();let s={lines:this.duration_lines,duration:r,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,y:this.y,width:this.full_width};r>e*2&&(this.long_duration_lines=parseInt(r/e)-1,this.handleDeleteDot()),ornamentGroup&&(s.x+=this.note_width),group.notes.push(s);let o=group.notes.reduce((a,l)=>a+l.duration,0);o=parseInt(o),o>e&&(o-=e),o>e-10&&ol.lines===0).length&&(this.drawDurationLoneLine(),group=initGroup()))}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");let e=this.context;e.save(),e.setFont("Arial",this.note_height,"normal"),this.setAttribute("el",e.openGroup("stavenote",this.getAttribute("id"))),e.openGroup("note",null,{pointerBBox:!0});let t=this.getAbsoluteX()+2.5;this.x=t;let r=this.stave.getYForLine(2)+this.note_height/2;this.y=r,this.buildToneHeads(),this.preFormatModifier(),this.applyStyle(),this.note_tones.forEach(s=>{s.draw(e)}),e.openGroup("modifier",null,{pointerBBox:!0}),this.drawModifiers(),e.closeGroup(),e.closeGroup(),e.closeGroup(),this.calcGroup(),group.staveId=this.stave.attrs.id,this.drawDurationLine(e,{}),this.drawLongDurationLines(e),this.restoreStyle(),this.setRendered(),this.ornament?ornamentGroup?ornamentGroup=Object.assign(ornamentGroup,{lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}):ornamentGroup={lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}:ornamentGroup=""}drawDurationLoneLine(e,t){e=e||this.context;let r=t||this.y+this.duration_line_space;for(let s=0;s<5;s++){let o=[],a=0;for(let l=0;ls)o.push(c),a++;else{if(o.length>1){let u=o.length-1;r=o[0].y+this.duration_line_space,e.rect(o[0].x,r+s*3,o[u].x-o[0].x+o[u].width,.5)}o=[],a=l+1}}if(o.length>1){let l=o.length-1;r=o[0].y+this.duration_line_space,e.rect(o[0].x,r+s*3,o[l].x-o[0].x+o[l].width,.5)}}}draw_dot(e,t,r,s){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(t,r,s,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}drawDurationLine(e,t){var r=this.attrs.id+"-lines";e.openGroup("numbered_note_lines",r);var s,o;if(this.duration_lines>0){const c=this.duration_line_space;var a=this.full_width;if(t&&t.width&&(a=t.width),a<0&&(a=this.note_width),!t||typeof t.startX>"u"?s=this.x-c/2-this.left_width:s=t.startX,!t||typeof t.startY>"u"?o=this.y+this.duration_line_space:o=t.startY,group.finish&&(this.drawDurationLoneLine(e,o),group=initGroup()),this.ornament?(s+=12,o-=22,a=15,ornamentGroup&&(s-=10,a+=10)):ornamentGroup&&(s+=this.note_width,a-=this.note_width),a>0){for(var l=0;lc.getAttribute("type")==="Dot"),a=this.modifiers.findIndex(c=>c.getAttribute("type")==="Accidental"),l=this.modifiers.findIndex(c=>c.getAttribute("type")==="GraceNoteGroup");s&&a>-1?this.modifiers[a].accidental.code=s==="#"?"v18":"v44":o>=0||l>=0?o>=0&&this.modifiers.splice(o+1,1):this.modifiers.splice(a,1)}}catch(s){console.log("🚀 ~ error",s)}}this.setYs(e)}getFullWidth(){return this.full_width}getFullHeight(){return this.full_height}getLine(){return this.keyProps[0].line}get full_width(){return this.note_width+this.left_width+this.right_width+this.long_duration_line_width}get long_duration_line_width(){return(this.long_duration_width+this.long_duration_space)*this.long_duration_lines}get full_height(){return this.bottom_y-this.top_y}get note_width(){return this.note_size||0}get note_dot_width(){return 6}get note_height(){return this.unit_height}get unit_height(){return this.note_size||0}get note_x(){return this.x||0}get top_x(){return this.x||0}get top_y(){var e=this;return(this.y||0)-(e.note_tones.map(r=>(r.td+r.bd)*(e.dot_space+e.dot_width)).reduce((r,s)=>r+s,0)+this.note_height*this.note_tones.length-this.unit_height-this.note_tones[0].bd*(e.dot_space+e.dot_width)+(this.note_tones.length-1)*this.head_space)}get bottom_x(){return this.x||0}get bottom_y(){return(this.y||0)+this.unit_height+this.duration_lines*(this.duration_line_height+this.duration_line_space)+this.note_tones[0].meta.bd*(this.dot_width+this.dot_space)}get left_width(){return this.modifiers_width}get right_width(){return this.full_duration_dot_width}get duration_dot_width(){return 6}get full_duration_dot_width(){return this.duration_dot_width*this.getModifiersByCategory(Dot.CATEGORY).length}getModifiersByCategory(e){var t=[];return this.modifiers.forEach(r=>{r.getCategory()===e&&t.push(r)}),t}get head_space(){return 6}get duration_line_height(){return 2}get duration_line_space(){return 4}get dot_width(){return 2}get dot_space(){return 2}get long_duration_space(){return 10}get long_duration_width(){return 20}getWidth(){return this.full_width}get modifiers_width(){let e=0;return this.modifiers.forEach(t=>{e+=t.getWidth()}),e}}class NumberedNoteHead{static get numberedNotationMapping(){let e=tone;switch(window&&window.sett&&window.sett.keySignature&&(e="C"),e){case"A":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:2.5,max:5.5};case"B":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"D":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"E":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"F":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"G":case"Gb":return{C:"4",D:"5",E:"6",F:"7",G:"1",A:"2",B:"3",R:"0",min:2,max:5};case"Eb":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"D#":case"Db":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"F#":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"Ab":case"G#":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:-1,max:2};case"Bb":case"A#":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"C#":case"Cb":default:return{C:"1",D:"2",E:"3",F:"4",G:"5",A:"6",B:"7",R:"0",min:0,max:3}}}tone_to_numbered_key(){var e=this.key.split("/"),t=e[0];t==="b"&&(t="R"),t=t.replace(new RegExp("#","g"),""),t=t.replace(new RegExp("n","g"),""),t.length>1&&(t=t.replace(new RegExp("b","g"),""));let r=0,s=0;this.note.stave&&this.note.stave.options&&this.note.stave.options.keySignature&&(tone=this.note.stave.options.keySignature);const o=this.note.getLine();return oNumberedNoteHead.numberedNotationMapping.max&&(s=Math.ceil((o-NumberedNoteHead.numberedNotationMapping.max)/3.5)),t.toUpperCase()==="R"&&(r=0,s=0),{key:NumberedNoteHead.numberedNotationMapping[t.toUpperCase()],td:s,bd:r}}constructor(e){this.key=e.key,this.x=e.x||0,this.y=e.y||0,this.idx=e.idx||0,this.note=e.note||0,this.meta=this.tone_to_numbered_key(),this.noteSize=e.noteSize||16,this.td=this.meta.td,this.bd=this.meta.bd}draw(e){let t=this.y;e.openGroup("numbered-note-head");var r=this.x+(this.note.ornament?-2:0);let s=t-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2);for(let a=0;a1&&(l-=this.note.duration_line_space),t+=l}this.draw_dot(e,r+_text_width,t,this.note.dot_width),t+=this.note.dot_width+this.note.dot_space}e.closeGroup()}get height(){return this.note.note_height+(this.meta.bd+this.meta.td)*(this.note.dot_width+this.note.dot_space)}draw_dot(e,t,r,s){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(t,r,s,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}}function L(...i){Factory.DEBUG&&Vex.L("Vex.Flow.Factory",i)}const X=Vex.MakeException("FactoryError");function setDefaults$1(i={},e){const t=e.options;return i=Object.assign(e,i),i.options=Object.assign(t,i.options),i}class Factory{constructor(e){L("New factory: ",e);const t={stave:{space:10},renderer:{context:null,elementId:"",backend:Renderer.Backends.SVG,width:500,height:200,background:"#FFF"},font:{face:"Arial",point:10,style:""}};this.options=t,this.setOptions(e)}static newFromElementId(e,t=500,r=200){return new Factory({renderer:{elementId:e,width:t,height:r}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(e){for(const t of["stave","renderer","font"])Object.assign(this.options[t],e[t]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:e,backend:t,width:r,height:s,background:o}=this.options.renderer;if(e==="")throw new X("HTML DOM element not set in Factory");this.context=Renderer.buildContext(e,t,r,s,o)}getContext(){return this.context}setContext(e){return this.context=e,this}getStave(){return this.stave}getVoices(){return this.voices}space(e){return this.options.stave.space*e}Stave(e){e=setDefaults$1(e,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});const t=new Stave(e.x,e.y,e.width,e.options);return this.staves.push(t),t.setContext(this.context),this.stave=t,t}TabStave(e){e=setDefaults$1(e,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space*1.3}});const t=new TabStave(e.x,e.y,e.width,e.options);return this.staves.push(t),t.setContext(this.context),this.stave=t,t}StaveNote(e){const t=new StaveNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}GhostNote(e){const t=new GhostNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}TextNote(e){const t=new TextNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}NumberedNote(e){const t=new NumberedNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}BarNote(e){e=setDefaults$1(e,{type:"single",options:{}});const t=new BarNote(e.type);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}ClefNote(e){e=setDefaults$1(e,{type:"treble",options:{size:"default"}});const t=new ClefNote(e.type,e.options.size,e.options.annotation);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}TimeSigNote(e){e=setDefaults$1(e,{time:"4/4",options:{}});const t=new TimeSigNote(e.time);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}KeySigNote(e){const t=new KeySigNote(e.key,e.cancelKey,e.alterKey);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}TabNote(e){const t=new TabNote$1(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}GraceNote(e){const t=new GraceNote(e);return this.stave&&t.setStave(this.stave),t.setContext(this.context),t}GraceNoteGroup(e){const t=new GraceNoteGroup(e.notes,e.slur);return t.setContext(this.context),t}Accidental(e){e=setDefaults$1(e,{type:null,options:{}});const t=new Accidental(e.type);return t.setContext(this.context),t}Annotation(e){e=setDefaults$1(e,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const t=new Annotation(e.text);return t.setJustification(e.hJustify),t.setVerticalJustification(e.vJustify),t.setFont(e.fontFamily,e.fontSize,e.fontWeight),t.setContext(this.context),t}Articulation(e){e=setDefaults$1(e,{type:"a.",position:"above",options:{}});const t=new Articulation$1(e.type);return t.setPosition(e.position),t.setContext(this.context),t}TextDynamics(e){e=setDefaults$1(e,{text:"p",duration:"q",dots:0,line:0,options:{}});const t=new TextDynamics({text:e.text,line:e.line,duration:e.duration,dots:e.dots});return this.stave&&t.setStave(this.stave),t.setContext(this.context),this.renderQ.push(t),t}Fingering(e){e=setDefaults$1(e,{number:"0",position:"left",options:{}});const t=new FretHandFinger(e.number);return t.setPosition(e.position),t.setContext(this.context),t}StringNumber(e){e=setDefaults$1(e,{number:"0",position:"left",options:{}});const t=new StringNumber(e.number);return t.setPosition(e.position),t.setContext(this.context),t}TickContext(){return new TickContext().setContext(this.context)}ModifierContext(){return new ModifierContext}MultiMeasureRest(e){const t=new MultiMeasureRest(e.number_of_measures,e);return t.setContext(this.context),this.renderQ.push(t),t}Voice(e){e=setDefaults$1(e,{time:"4/4",options:{}});const t=new Voice$1(e.time);return this.voices.push(t),t}StaveConnector(e){e=setDefaults$1(e,{top_stave:null,bottom_stave:null,type:"double",options:{}});const t=new StaveConnector(e.top_stave,e.bottom_stave);return t.setType(e.type).setContext(this.context),this.renderQ.push(t),t}Formatter(){return new Formatter}Tuplet(e){e=setDefaults$1(e,{notes:[],options:{}});const t=new Tuplet$1(e.notes,e.options).setContext(this.context);return this.renderQ.push(t),t}Beam(e){e=setDefaults$1(e,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const t=new Beam$1(e.notes,e.options.autoStem).setContext(this.context);return t.breakSecondaryAt(e.options.secondaryBeamBreaks),this.renderQ.push(t),t}Curve(e){e=setDefaults$1(e,{from:null,to:null,options:{}});const t=new Curve(e.from,e.to,e.options).setContext(this.context);return this.renderQ.push(t),t}StaveTie(e){e=setDefaults$1(e,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const t=new StaveTie({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices},e.text);return e.options.direction&&t.setDirection(e.options.direction),t.setContext(this.context),this.renderQ.push(t),t}StaveLine(e){e=setDefaults$1(e,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const t=new StaveLine({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices});return e.options.text&&t.setText(e.options.text),e.options.font&&t.setFont(e.options.font),t.setContext(this.context),this.renderQ.push(t),t}VibratoBracket(e){e=setDefaults$1(e,{from:null,to:null,options:{harsh:!1}});const t=new VibratoBracket({start:e.from,stop:e.to});return e.options.line&&t.setLine(e.options.line),e.options.harsh&&t.setHarsh(e.options.harsh),t.setContext(this.context),this.renderQ.push(t),t}TextBracket(e){e=setDefaults$1(e,{from:null,to:null,text:"",options:{superscript:"",position:1}});const t=new TextBracket({start:e.from,stop:e.to,text:e.text,superscript:e.options.superscript,position:e.options.position});return e.options.line&&t.setLine(e.options.line),e.options.font&&t.setFont(e.options.font),t.setContext(this.context),this.renderQ.push(t),t}System(e={}){e.factory=this;const t=new System(e).setContext(this.context);return this.systems.push(t),t}EasyScore(e={}){return e.factory=this,new EasyScore(e)}PedalMarking(e={}){e=setDefaults$1(e,{notes:[],options:{style:"mixed"}});const t=new PedalMarking(e.notes);return t.setStyle(PedalMarking.StylesString[e.options.style]),t.setContext(this.context),this.renderQ.push(t),t}NoteSubGroup(e={}){e=setDefaults$1(e,{notes:[],options:{}});const t=new NoteSubGroup$1(e.notes);return t.setContext(this.context),t}draw(){this.systems.forEach(e=>e.setContext(this.context).format()),this.staves.forEach(e=>e.setContext(this.context).draw()),this.voices.forEach(e=>e.setContext(this.context).draw()),this.renderQ.forEach(e=>{e.isRendered()||e.setContext(this.context).draw()}),this.systems.forEach(e=>e.setContext(this.context).draw()),this.reset()}}function setDefaults(i,e){const t=e.options;return i=Object.assign(e,i),i.options=Object.assign(t,i.options),i}class System extends Element$1{constructor(e={}){super(),this.setAttribute("type","System"),this.setOptions(e),this.parts=[]}setOptions(e={}){this.options=setDefaults(e,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new Factory({renderer:{el:null}})}setContext(e){return super.setContext(e),this.factory.setContext(e),this}addConnector(e="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:e}),this.connector}addStave(e){return e=setDefaults(e,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}}),e.stave||(e.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:e.options})),e.voices.forEach(t=>t.setContext(this.context).setStave(e.stave).getTickables().forEach(r=>r.setStave(e.stave))),this.parts.push(e),e.stave}format(){const e=new Formatter;this.formatter=e;let t=this.options.y,r=0,s=[];const o=[];this.parts.forEach(l=>{t=t+l.stave.space(l.spaceAbove),l.stave.setY(t),e.joinVoices(l.voices),t=t+l.stave.space(l.spaceBelow),t=t+l.stave.space(this.options.spaceBetweenStaves),l.debugNoteMetrics&&(o.push({y:t,voice:l.voices[0]}),t+=15),s=s.concat(l.voices),r=Math.max(r,l.stave.getNoteStartX())}),this.parts.forEach(l=>l.stave.setNoteStartX(r));const a=this.options.width-(r-this.options.x)-Note.STAVEPADDING;e.format(s,a);for(let l=0;l{t.voice.getTickables().forEach(r=>Note.plotMetrics(e,r,t.y))})}}Vex.Flow=Flow;Vex.Flow.Element=Element$1;Vex.Flow.Fraction=Fraction;Vex.Flow.Renderer=Renderer;Vex.Flow.Formatter=Formatter;Vex.Flow.Music=Music;Vex.Flow.Glyph=Glyph;Vex.Flow.Stave=Stave;Vex.Flow.StaveNote=StaveNote;Vex.Flow.StaveModifier=StaveModifier;Vex.Flow.StaveTempo=StaveTempo;Vex.Flow.Voice=Voice$1;Vex.Flow.Accidental=Accidental;Vex.Flow.Beam=Beam$1;Vex.Flow.StaveTie=StaveTie;Vex.Flow.TabStave=TabStave;Vex.Flow.TabNote=TabNote$1;Vex.Flow.Bend=Bend;Vex.Flow.Vibrato=Vibrato;Vex.Flow.VibratoBracket=VibratoBracket;Vex.Flow.Note=Note;Vex.Flow.ModifierContext=ModifierContext;Vex.Flow.MultiMeasureRest=MultiMeasureRest;Vex.Flow.TickContext=TickContext;Vex.Flow.Articulation=Articulation$1;Vex.Flow.Annotation=Annotation;Vex.Flow.Barline=Barline;Vex.Flow.NoteHead=NoteHead;Vex.Flow.StaveConnector=StaveConnector;Vex.Flow.ClefNote=ClefNote;Vex.Flow.KeySignature=KeySignature;Vex.Flow.KeySigNote=KeySigNote;Vex.Flow.TimeSignature=TimeSignature;Vex.Flow.TimeSigNote=TimeSigNote;Vex.Flow.Stem=Stem;Vex.Flow.TabTie=TabTie;Vex.Flow.Clef=Clef;Vex.Flow.Dot=Dot;Vex.Flow.Modifier=Modifier;Vex.Flow.TabSlide=TabSlide;Vex.Flow.Tuplet=Tuplet$1;Vex.Flow.GraceNote=GraceNote;Vex.Flow.GraceTabNote=GraceTabNote;Vex.Flow.Tuning=Tuning;Vex.Flow.KeyManager=KeyManager;Vex.Flow.StaveHairpin=StaveHairpin;Vex.Flow.BoundingBox=BoundingBox;Vex.Flow.Stroke=Stroke;Vex.Flow.TextNote=TextNote;Vex.Flow.Curve=Curve;Vex.Flow.TextDynamics=TextDynamics;Vex.Flow.StaveLine=StaveLine;Vex.Flow.Ornament=Ornament;Vex.Flow.PedalMarking=PedalMarking;Vex.Flow.TextBracket=TextBracket;Vex.Flow.FretHandFinger=FretHandFinger;Vex.Flow.Repetition=Repetition$1;Vex.Flow.BarNote=BarNote;Vex.Flow.GhostNote=GhostNote;Vex.Flow.NoteSubGroup=NoteSubGroup$1;Vex.Flow.GraceNoteGroup=GraceNoteGroup;Vex.Flow.Tremolo=Tremolo;Vex.Flow.StringNumber=StringNumber;Vex.Flow.Crescendo=Crescendo;Vex.Flow.Volta=Volta;Vex.Flow.Font=Font;Vex.Flow.System=System;Vex.Flow.Factory=Factory;Vex.Flow.Parser=Parser;Vex.Flow.EasyScore=EasyScore;Vex.Flow.Registry=Registry;var SystemLinesEnum=(i=>(i[i.SingleThin=0]="SingleThin",i[i.DoubleThin=1]="DoubleThin",i[i.ThinBold=2]="ThinBold",i[i.BoldThinDots=3]="BoldThinDots",i[i.DotsThinBold=4]="DotsThinBold",i[i.DotsBoldBoldDots=5]="DotsBoldBoldDots",i[i.None=6]="None",i[i.Dotted=7]="Dotted",i[i.Dashed=8]="Dashed",i[i.Bold=9]="Bold",i[i.BoldThin=10]="BoldThin",i[i.DoubleBold=11]="DoubleBold",i[i.Tick=12]="Tick",i[i.Short=13]="Short",i))(SystemLinesEnum||{});class SystemLinesEnumHelper{static xmlBarlineStyleToSystemLinesEnum(e){return e==="regular"?0:e==="dotted"?7:e==="dashed"?8:e==="heavy"?9:e==="light-light"?1:e==="light-heavy"?2:e==="heavy-light"?10:e==="heavy-heavy"?11:e==="tick"?12:e==="short"?13:e==="none"?6:0}}class Matrix2D{constructor(){this.matrix=[];for(let e=0;e<2;e++){this.matrix[e]=[];for(let t=0;t<2;t++)this.matrix[e][t]=0}}static getRotationMatrix(e){const t=new Matrix2D,r=Math.cos(e),s=Math.sin(e);return t.matrix[0][0]=r,t.matrix[0][1]=-s,t.matrix[1][0]=s,t.matrix[1][1]=r,t}scalarMultiplication(e){for(let t=0;t<2;t++)for(let r=0;r<2;r++)this.matrix[t][r]*=e}getTransposeMatrix(){const e=new Matrix2D;for(let t=0;t<2;t++)for(let r=0;r<2;r++)e.matrix[t][r]=this.matrix[r][t];return e}vectorMultiplication(e){const t=new PointF2D;return t.x=e.x*this.matrix[0][0]+e.y*this.matrix[0][1],t.y=e.x*this.matrix[1][0]+e.y*this.matrix[1][1],t}}class MusicSheetErrors{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(e){let t=this.measureErrors[e];t||(t=[]),this.measureErrors[e]=t.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(e){this.tempErrors.push(e)}push(e){this.errors.push(e)}}class Arpeggio{constructor(e,t=7){this.parentVoiceEntry=e,this.type=t,this.notes=[]}addNote(e){this.notes.push(e),e.Arpeggio=this}}var ArpeggioType=(i=>(i[i.BRUSH_DOWN=1]="BRUSH_DOWN",i[i.BRUSH_UP=2]="BRUSH_UP",i[i.ROLL_DOWN=3]="ROLL_DOWN",i[i.ROLL_UP=4]="ROLL_UP",i[i.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",i[i.RASQUEDO_UP=6]="RASQUEDO_UP",i[i.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",i))(ArpeggioType||{});class Beam{constructor(e=1,t=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=e,this.BeamNumberOffsetToXML=t}get Notes(){return this.notes}set Notes(e){this.notes=e}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(e){this.extendedNoteList=e}addNoteToBeam(e){e&&(e.NoteBeam=this,this.notes.push(e),this.extendedNoteList.push(e))}}class Voice{constructor(e,t){this.voiceEntries=[],this.volume=1,this.parent=e,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=t,this.uniqueVoiceId="I:"+this.parent.Id+" V: "+this.voiceId}get VoiceEntries(){return this.voiceEntries}get Parent(){return this.parent}get Visible(){return this.visible}set Visible(e){this.visible=e}get Audible(){return this.audible}set Audible(e){this.audible=e}get Following(){return this.following}set Following(e){this.following=e}get Solo(){return this.solo}set Solo(e){this.solo=e}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(e){this.volume=e}toString(){return this.uniqueVoiceId}}class LinkedVoice extends Voice{constructor(e,t,r){super(e,t),this.master=r}get Master(){return this.master}}class Notehead{constructor(e,t,r=void 0){this.sourceNote=e,this.setShapeFromXml(t,r)}setShapeFromXml(e,t=void 0){this.shape=Notehead.ShapeTypeXmlToShape(e);let r=t;r===void 0&&(this.sourceNote?r=this.sourceNote.Length.Denominator>2:(log$2.warn("notehead: sourceNote and filledXmlAttribute undefined."),r=!0)),this.filled=r}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(e){switch(e.toLowerCase()){case"normal":return 2;case"x":return 7;case"slash":return 4;case"diamond":return 1;case"square":return 5;case"la":return 5;case"do":case"triangle":return 6;case"rectangle":return 3;case"circle-x":return 0;default:return log$2.info("unsupported/unhandled xml notehead '"+e+"'. Using normal notehead."),2}}}var NoteHeadShape=(i=>(i[i.CIRCLEX=0]="CIRCLEX",i[i.DIAMOND=1]="DIAMOND",i[i.NORMAL=2]="NORMAL",i[i.RECTANGLE=3]="RECTANGLE",i[i.SLASH=4]="SLASH",i[i.SQUARE=5]="SQUARE",i[i.TRIANGLE=6]="TRIANGLE",i[i.X=7]="X",i))(NoteHeadShape||{});class ITextTranslation{static translateText(e,t){if(!this.defaultTextTranslation)return t}}var NoteType=(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i._1024th=1]="_1024th",i[i._512th=2]="_512th",i[i._256th=3]="_256th",i[i._128th=4]="_128th",i[i._64th=5]="_64th",i[i._32nd=6]="_32nd",i[i._16th=7]="_16th",i[i.EIGTH=8]="EIGTH",i[i.QUARTER=9]="QUARTER",i[i.HALF=10]="HALF",i[i.WHOLE=11]="WHOLE",i[i.BREVE=12]="BREVE",i[i.LONG=13]="LONG",i[i.MAXIMA=14]="MAXIMA",i))(NoteType||{});class NoteTypeHandler{static NoteTypeToString(e){return this.NoteTypeXmlValues[e]}static StringToNoteType(e){const t=this.NoteTypeXmlValues.indexOf(e);return t!==-1?t:0}static getNoteDurationFromType(e){switch(e){case"1024th":return new Fraction$1(1,1024);case"512th":return new Fraction$1(1,512);case"256th":return new Fraction$1(1,256);case"128th":return new Fraction$1(1,128);case"64th":return new Fraction$1(1,64);case"32th":case"32nd":return new Fraction$1(1,32);case"16th":return new Fraction$1(1,16);case"eighth":return new Fraction$1(1,8);case"quarter":return new Fraction$1(1,4);case"half":return new Fraction$1(1,2);case"whole":return new Fraction$1(1,1);case"breve":return new Fraction$1(2,1);case"long":return new Fraction$1(4,1);case"maxima":return new Fraction$1(8,1);default:{const t=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new MusicSheetReadingException(t)}}}}NoteTypeHandler.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];class OrnamentContainer{constructor(e){this.placement=PlacementEnum.Above,this.accidentalAbove=AccidentalEnum.NONE,this.accidentalBelow=AccidentalEnum.NONE,this.ornament=e}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(e){this.accidentalAbove=e}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(e){this.accidentalBelow=e}}var OrnamentEnum=(i=>(i[i.Trill=0]="Trill",i[i.Turn=1]="Turn",i[i.InvertedTurn=2]="InvertedTurn",i[i.DelayedTurn=3]="DelayedTurn",i[i.DelayedInvertedTurn=4]="DelayedInvertedTurn",i[i.Mordent=5]="Mordent",i[i.InvertedMordent=6]="InvertedMordent",i))(OrnamentEnum||{});class VerticalSourceStaffEntryContainer{constructor(e,t,r){this.staffEntries=[],this.comments=[],this.timestamp=t,this.staffEntries=new Array(r),this.parentMeasure=e}$get$(e){return this.staffEntries[e]}$set$(e,t){this.staffEntries[e]=t}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get StaffEntries(){return this.staffEntries}set StaffEntries(e){this.staffEntries=e}get Comments(){return this.comments}set Comments(e){this.comments=e}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(e){this.parentMeasure=e}getAbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}class SourceStaffEntry{constructor(e,t){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=e,this.parentStaff=t}get ParentStaff(){return this.parentStaff}get VerticalContainerParent(){return this.verticalContainerParent}get Timestamp(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}get AbsoluteTimestamp(){if(this.VerticalContainerParent)return Fraction$1.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}get VoiceEntries(){return this.voiceEntries}set VoiceEntries(e){this.voiceEntries=e}get Link(){return this.staffEntryLink}set Link(e){this.staffEntryLink=e}get Instructions(){return this.instructions}set Instructions(e){this.instructions=e}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(e){this.chordSymbolContainers=e}removeAllInstructionsOfTypeClefInstruction(){let e=0,t=0;for(;e0)return!0;return!1}hasTie(){for(let e=0,t=this.VoiceEntries.length;et.parentRepetition.StartIndex)return-1}if(e.alignment===0&&t.alignment===0){if(e.parentRepetition.EndIndext.parentRepetition.EndIndex)return-1}}return 0}}class RepetitionInstruction{constructor(e,t,r=1,s=void 0,o=void 0){this.endingIndices=void 0,this.measureIndex=e,o&&(this.endingIndices=o.slice()),this.type=t,this.alignment=r,this.parentRepetition=s}CompareTo(e){const t=e;if(this.measureIndex>t.measureIndex)return 1;if(this.measureIndex(i[i.StartLine=0]="StartLine",i[i.ForwardJump=1]="ForwardJump",i[i.BackJumpLine=2]="BackJumpLine",i[i.Ending=3]="Ending",i[i.DaCapo=4]="DaCapo",i[i.DalSegno=5]="DalSegno",i[i.Fine=6]="Fine",i[i.ToCoda=7]="ToCoda",i[i.DalSegnoAlFine=8]="DalSegnoAlFine",i[i.DaCapoAlFine=9]="DaCapoAlFine",i[i.DalSegnoAlCoda=10]="DalSegnoAlCoda",i[i.DaCapoAlCoda=11]="DaCapoAlCoda",i[i.Coda=12]="Coda",i[i.Segno=13]="Segno",i[i.None=14]="None",i))(RepetitionInstructionEnum||{}),AlignmentType=(i=>(i[i.Begin=0]="Begin",i[i.End=1]="End",i))(AlignmentType||{});let prevSourceMeasure=null;class SourceMeasure{constructor(e,t){this.printNewSystemXml=!1,this.printNewPageXml=!1,this.IsSystemStartMeasure=!1,this.hasLyrics=!1,this.hasMoodExpressions=!1,this.allRests=!1,this.isReducedToMultiRest=!1,this.multipleRestMeasureNumber=0,this.staffLinkedExpressions=[],this.tempoExpressions=[],this.verticalSourceStaffEntryContainers=[],this.graphicalMeasureErrors=[],this.firstRepetitionInstructions=[],this.lastRepetitionInstructions=[],this.metronomeNoteIndex=0,this.completeNumberOfStaves=e,this.implicitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=SystemLinesEnum.SingleThin,this.firstInstructionsStaffEntries=new Array(e),this.lastInstructionsStaffEntries=new Array(e),this.rules=t,this.TempoInBPM=0;for(let r=0;r1)return e[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(e){this.verticalMeasureList=e}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(e){this.tempoInBPM=e}findOrCreateStaffEntry(e,t,r){let s,o;for(const l of this.verticalSourceStaffEntryContainers)if(l.Timestamp.Equals(e)){o=l;break}if(o)return o.StaffEntries[t]?s=o.StaffEntries[t]:(s=new SourceStaffEntry(o,r),o.StaffEntries[t]=s),{createdNewContainer:!1,staffEntry:s};const a=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||a.Timestamp.lt(e)){const l=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(l),s=new SourceStaffEntry(l,r),l.StaffEntries[t]=s}else for(let l=this.verticalSourceStaffEntryContainers.length-1;l>=0;l--){if(this.verticalSourceStaffEntryContainers[l].Timestamp.lt(e)){const c=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l+1,0,c),s=new SourceStaffEntry(c,r),c.StaffEntries[t]=s;break}if(l===0){const c=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l,0,c),s=new SourceStaffEntry(c,r),c.StaffEntries[t]=s;break}}return{createdNewContainer:!0,staffEntry:s}}findOrCreateVoiceEntry(e,t){let r,s=!1;for(const o of e.VoiceEntries)if(o.ParentVoice===t){r=o;break}return r||(r=new VoiceEntry(e.Timestamp,t,e),s=!0),{createdVoiceEntry:s,voiceEntry:r}}getPreviousSourceStaffEntryFromIndex(e,t){for(let r=t-1;r>=0;r--)if(this.verticalSourceStaffEntryContainers[r][e])return this.verticalSourceStaffEntryContainers[r][e]}getVerticalContainerIndexByTimestamp(e){for(let t=0,r=this.VerticalSourceStaffEntryContainers.length;t=0;d--){const y=this.verticalSourceStaffEntryContainers[d][l+c];if(y!==void 0&&y.hasTie()&&a.lt(Fraction$1.plus(y.Timestamp,y.calculateMaxNoteLength()))){a=Fraction$1.plus(y.Timestamp,y.calculateMaxNoteLength());break}}}}s.push(a)}for(let o=0,a=s.length;o0)return!0}return!1}beginsWithLineRepetition(){for(let e=0,t=this.FirstRepetitionInstructions.length;e=0&&(t=this.verticalSourceStaffEntryContainers[r].StaffEntries[e],!t);r--);return t}canBeReducedToMultiRest(){var r,s,o,a,l,c;let e=!0,t=!1;for(const u of this.verticalSourceStaffEntryContainers)if(u){for(const m of u.StaffEntries)if(!(!m||!m.ParentStaff.ParentInstrument.Visible)){if(m.ChordContainers.length>0||(m.ParentStaff.hasLyrics&&(t=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0))return!1;for(const d of m.VoiceEntries){for(const y of d.Notes)if(!y.isRest()){e=!1;break}if(!e)break}}}if(!e||t||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const u of this.staffLinkedExpressions)if(u.length>0)return!1;for(const u of this.lastInstructionsStaffEntries)for(let m=0,d=u==null?void 0:u.Instructions.length;m=0;t--)for(let r=0;r(i[i.Fingering=0]="Fingering",i[i.String=1]="String",i))(TechnicalInstructionType||{});class TechnicalInstruction{}class PlaybackNote{constructor(e,t){this.parentEntry=e,this.parentNote=t,this.ParentNote.PlaybackNote=this,this.Length=this.ParentNote.Length,t.Pitch!==void 0?this.ParentNote.ParentStaff.ParentInstrument.MidiInstrumentId===MidiInstrument.Percussion?this.MidiKey=PlaybackNote.noteToMidiDrumKey(t):this.MidiKey=t.Pitch.getHalfTone()+12:this.MidiKey=0}setLength(){this.ParentNote.NoteTie!==void 0&&this.ParentNote.NoteTie.StartNote===this.ParentNote&&(this.Length=this.ParentNote.NoteTie.Duration)}get ParentEntry(){return this.parentEntry}get ParentNote(){return this.parentNote}static noteToMidiDrumKey(e){var s;const t=e.Pitch.getHalfTone()-12,r=(s=e.Notehead)==null?void 0:s.Shape;switch(e.Pitch.Octave){case 1:switch(e.Pitch.FundamentalNote){case NoteEnum.D:switch(r){default:return 44}case NoteEnum.E:switch(r){default:return 35}case NoteEnum.F:switch(r){default:return 36}case NoteEnum.G:switch(r){default:return 41}case NoteEnum.A:switch(r){default:return 43}case NoteEnum.B:switch(r){case NoteHeadShape.TRIANGLE:return 54;default:return 47}default:return t}case 2:switch(e.Pitch.FundamentalNote){case NoteEnum.C:switch(r){case NoteHeadShape.X:return 37;default:return 38}case NoteEnum.D:switch(r){case NoteHeadShape.X:return 59;default:return 48}case NoteEnum.E:switch(r){case NoteHeadShape.X:return 42;case NoteHeadShape.CIRCLEX:return 46;case NoteHeadShape.TRIANGLE:return 56;default:return 50}case NoteEnum.F:switch(r){case NoteHeadShape.DIAMOND:return 53;default:return 51}case NoteEnum.G:switch(r){case NoteHeadShape.CIRCLEX:case NoteHeadShape.DIAMOND:return 46;default:return 42}case NoteEnum.A:switch(r){default:return 49}case NoteEnum.B:switch(r){default:return 57}default:return t}case 3:switch(e.Pitch.FundamentalNote){case NoteEnum.C:switch(r){case NoteHeadShape.CIRCLEX:return 52;default:return 55}default:return t}default:return t}}}class PlaybackEntry{constructor(e){this.notes=[],this.TimestampShift=new Fraction$1,this.parentVoiceEntry=e;for(const t of e.Notes)this.Notes.push(new PlaybackNote(this,t))}get ParentVoiceEntry(){return this.parentVoiceEntry}get Notes(){return this.notes}get Length(){if(this.Notes.length>0)return this.Notes[0].Length}set Length(e){for(const t of this.Notes)t.Length=e}get HasNotes(){return this.Notes.length>0}}class VoiceEntry{constructor(e,t,r,s=!0,o=!1,a=!1,l=!1){if(this.notes=[],this.graceVoiceEntriesBefore=[],this.graceVoiceEntriesAfter=[],this.articulations=[],this.playbackEntries=[],this.technicalInstructions=[],this.lyricsEntries=new Dictionary,this.wantedStemDirection=-1,this.stemDirectionXml=-1,this.stemDirection=-1,this.timestamp=e,this.parentVoice=t,this.parentSourceStaffEntry=r,this.isGrace=o,this.graceAfterMainNote=!1,this.graceNoteSlash=a,this.graceSlur=l,o||t.VoiceEntries.push(this),s&&r!==void 0){const c=r.VoiceEntries;c.indexOf(this)===-1&&c.push(this)}this.mainPlaybackEntry=new PlaybackEntry(this),this.PlaybackEntries.push(this.mainPlaybackEntry)}get ParentSourceStaffEntry(){return this.parentSourceStaffEntry}get ParentVoice(){return this.parentVoice}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get Notes(){return this.notes}addNote(e){this.notes.push(e),!e.isRest()&&(e.NoteTie===void 0||e.NoteTie.StartNote===e)&&this.MainPlaybackEntry.Notes.push(new PlaybackNote(this.MainPlaybackEntry,e))}get GraceVoiceEntriesBefore(){return this.graceVoiceEntriesBefore}set GraceVoiceEntriesBefore(e){this.graceVoiceEntriesBefore=e;for(const t of this.graceVoiceEntriesBefore)t.parentSourceStaffEntry=this.ParentSourceStaffEntry}get GraceVoiceEntriesAfter(){return this.graceVoiceEntriesAfter}set GraceVoiceEntriesAfter(e){this.graceVoiceEntriesAfter=e;for(const t of this.graceVoiceEntriesAfter)t.parentSourceStaffEntry=this.ParentSourceStaffEntry}get IsGrace(){return this.isGrace}set IsGrace(e){this.isGrace=e}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(e){this.graceAfterMainNote=e}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(e){this.graceNoteSlash=e}get GraceSlur(){return this.graceSlur}set GraceSlur(e){this.graceSlur=e}get Articulations(){return this.articulations}get PlaybackEntries(){return this.playbackEntries}get Fermata(){return this.fermata}get MainPlaybackEntry(){return this.mainPlaybackEntry}set MainPlaybackEntry(e){this.mainPlaybackEntry=e}removeMainPlaybackEntry(){this.mainPlaybackEntry!==void 0&&this.removePlaybackEntry(this.mainPlaybackEntry)}removePlaybackEntry(e){this.mainPlaybackEntry===e&&(this.mainPlaybackEntry=void 0);const t=this.playbackEntries.indexOf(e);t>-1&&this.playbackEntries.splice(t,1)}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(e){this.arpeggio=e}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(e){this.ornamentContainer=e}set WantedStemDirection(e){this.wantedStemDirection=e}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(e){this.stemDirectionXml=e}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(e){this.stemDirection=e}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(e){this.stemColorXml=e}get StemColor(){return this.stemColor}set StemColor(e){this.stemColor=e}get VolumeModifier(){return this.volumeModifier}set VolumeModifier(e){this.volumeModifier=e}get DurationModifier(){return this.durationModifier}set DurationModifier(e){this.durationModifier=e}hasArticulation(e){for(const t of this.articulations)if(t.Equals(e))return!0;return!1}static isSupportedArticulation(e){switch(e){case 0:case 1:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 26:case 24:return!0;default:return!1}}hasTie(){for(let e=0,t=this.Notes.length;e0)return!0;return!1}isStaccato(){for(const e of this.Articulations)if(e.articulationEnum===5)return!0;return!1}isAccent(){for(const e of this.Articulations)if(e.articulationEnum===0||e.articulationEnum===1)return!0;return!1}getVerseNumberForLyricEntry(e){let t=1;return this.lyricsEntries.forEach((r,s)=>{e===s&&(t=r)}),t}}var ArticulationEnum=(i=>(i[i.accent=0]="accent",i[i.strongaccent=1]="strongaccent",i[i.marcatoup=2]="marcatoup",i[i.marcatodown=3]="marcatodown",i[i.invertedstrongaccent=4]="invertedstrongaccent",i[i.staccato=5]="staccato",i[i.staccatissimo=6]="staccatissimo",i[i.spiccato=7]="spiccato",i[i.tenuto=8]="tenuto",i[i.fermata=9]="fermata",i[i.invertedfermata=10]="invertedfermata",i[i.breathmark=11]="breathmark",i[i.caesura=12]="caesura",i[i.lefthandpizzicato=13]="lefthandpizzicato",i[i.naturalharmonic=14]="naturalharmonic",i[i.snappizzicato=15]="snappizzicato",i[i.upbow=16]="upbow",i[i.downbow=17]="downbow",i[i.scoop=18]="scoop",i[i.plop=19]="plop",i[i.doit=20]="doit",i[i.falloff=21]="falloff",i[i.stress=22]="stress",i[i.unstress=23]="unstress",i[i.detachedlegato=24]="detachedlegato",i[i.otherarticulation=25]="otherarticulation",i[i.bend=26]="bend",i))(ArticulationEnum||{}),StemDirectionType=(i=>(i[i.Undefined=-1]="Undefined",i[i.Up=0]="Up",i[i.Down=1]="Down",i[i.None=2]="None",i[i.Double=3]="Double",i))(StemDirectionType||{}),SystemLinePosition=(i=>(i[i.MeasureBegin=0]="MeasureBegin",i[i.MeasureEnd=1]="MeasureEnd",i))(SystemLinePosition||{});class GraphicalLabel extends Clickable{constructor(e,t,r,s,o=void 0){super(),this.label=e,this.boundingBox=new BoundingBox$1(this,o),this.label.fontHeight=t,this.label.textAlignment=r,this.rules=s,this.rules.MpatMode&&this.label.text==="TRIO"&&(this.label.fontFamily="Arial")}get Label(){return this.label}toString(){return"".concat(this.label.text," (").concat(this.boundingBox.RelativePosition.x,",").concat(this.boundingBox.RelativePosition.y,")")}setLabelPositionAndShapeBorders(){var l,c;if(this.Label.text.trim()==="")return;this.TextLines=[];const e=(c=(l=this.rules)==null?void 0:l.LabelMarginBorderFactor)!=null?c:.1,t=this.Label.text.split(/[\n\r]+/g),r=t.length;let s=0;for(let u=0;u0&&this.TextLines.length>1&&(o+=this.rules.SpacingBetweenTextLines*r/10);const a=this.PositionAndShape;switch(this.Label.textAlignment){case TextAlignmentEnum.CenterBottom:a.BorderTop=-o,a.BorderLeft=-s/2,a.BorderBottom=0,a.BorderRight=s/2;break;case TextAlignmentEnum.CenterCenter:a.BorderTop=-o/2,a.BorderLeft=-s/2,a.BorderBottom=o/2,a.BorderRight=s/2;break;case TextAlignmentEnum.CenterTop:a.BorderTop=0,a.BorderLeft=-s/2,a.BorderBottom=o,a.BorderRight=s/2;break;case TextAlignmentEnum.LeftBottom:a.BorderTop=-o,a.BorderLeft=0,a.BorderBottom=0,a.BorderRight=s;break;case TextAlignmentEnum.LeftCenter:a.BorderTop=-o/2,a.BorderLeft=0,a.BorderBottom=o/2,a.BorderRight=s;break;case TextAlignmentEnum.LeftTop:a.BorderTop=0,a.BorderLeft=0,a.BorderBottom=o,a.BorderRight=s;break;case TextAlignmentEnum.RightBottom:a.BorderTop=-o,a.BorderLeft=-s,a.BorderBottom=0,a.BorderRight=0;break;case TextAlignmentEnum.RightCenter:a.BorderTop=-o/2,a.BorderLeft=-s,a.BorderBottom=o/2,a.BorderRight=0;break;case TextAlignmentEnum.RightTop:a.BorderTop=0,a.BorderLeft=-s,a.BorderBottom=o,a.BorderRight=0;break}a.BorderMarginTop=a.BorderTop-o*e,a.BorderMarginLeft=a.BorderLeft-o*e,a.BorderMarginBottom=a.BorderBottom+o*e,a.BorderMarginRight=a.BorderRight+o*e}}class Label{constructor(e="",t=TextAlignmentEnum.CenterBottom,r=void 0,s=!0){this.IsCreditLabel=!1,this.text=e,this.print=s,this.textAlignment=t,this.font=r,this.fontFamily=void 0}set font(e){this.fontEnumValue=e,this.fontFamily=FontStringNames[e]}get font(){return this.fontEnumValue}ToString(){return this.text}}const SpeedTag={Grava:40,Largo:46,Lento:52,Adagio:56,Larghetto:60,Andante:66,Anderato:69,Andantino:69,Moderato:88,Allegretto:108,"Allegro Moderato":108,Allegro:132,Vivace:152,Vivo:160,Vivacissimo:168,Presto:184,Prestissimo:208},SpecialMarks=["纯律","纯律结束"],HideWords=["跳过下一个","b","#","§","º","X"],GradientWords=["poco rit.","rall.","rit.","accel.","molto rit.","molto rall","lentando","poco accel.","calando"],GRADIENT_SPEED_CLOSE_TAG="结束范围速度",GRADIENT_SPEED_RESET_TAG="a tempo",SpecialWords=[GRADIENT_SPEED_CLOSE_TAG],SpeedKeyword="速度 ",SpeedHiddenKeyword="仅文本速度 ";function isSpeedKeyword(i){return i.indexOf(SpeedKeyword)===0}function isSpeedHiddenKeyword(i){return i.indexOf(SpeedHiddenKeyword)===0}function formatSpeedKeyword(i){return i.replace(SpeedHiddenKeyword,"").replace(SpeedKeyword,"")}function isGradientWords(i){return GradientWords.includes(i)}function isSpecialMark(i){return[...Object.keys(SpeedTag),...SpecialMarks,...SpecialWords,...HideWords].map(e=>e.trim().toLocaleUpperCase()).includes(i.toLocaleUpperCase().trim())}function isTopFont(i){return[TextAlignmentEnum.CenterTop,TextAlignmentEnum.RightTop].includes(i)}var MusicSymbol=(i=>(i[i.Unused_first_Symbol=0]="Unused_first_Symbol",i[i.BLACK_HEAD=1]="BLACK_HEAD",i[i.UPWARDS_TAIL=2]="UPWARDS_TAIL",i[i.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",i[i.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",i[i.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",i[i.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",i[i.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",i[i.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",i[i.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",i[i.ROUND_HEAD=10]="ROUND_HEAD",i[i.WHITE_HEAD=11]="WHITE_HEAD",i[i.G_CLEF=12]="G_CLEF",i[i.F_CLEF=13]="F_CLEF",i[i.C_CLEF=14]="C_CLEF",i[i.BREVE=15]="BREVE",i[i.BREVE_REST=16]="BREVE_REST",i[i.COMMON_TIME=17]="COMMON_TIME",i[i.CUT_TIME=18]="CUT_TIME",i[i.WHOLE_REST=19]="WHOLE_REST",i[i.HALF_REST=20]="HALF_REST",i[i.QUARTER_REST=21]="QUARTER_REST",i[i.EIGHTH_REST=22]="EIGHTH_REST",i[i.SIXTEENTH_REST=23]="SIXTEENTH_REST",i[i.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",i[i.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",i[i.FLAT=26]="FLAT",i[i.SHARP=27]="SHARP",i[i.NATURAL=28]="NATURAL",i[i.DOUBLE_FLAT=29]="DOUBLE_FLAT",i[i.DOUBLE_SHARP=30]="DOUBLE_SHARP",i[i.ZERO=31]="ZERO",i[i.ONE=32]="ONE",i[i.TWO=33]="TWO",i[i.THREE=34]="THREE",i[i.FOUR=35]="FOUR",i[i.FIVE=36]="FIVE",i[i.SIX=37]="SIX",i[i.SEVEN=38]="SEVEN",i[i.EIGHT=39]="EIGHT",i[i.NINE=40]="NINE",i[i.DOT=41]="DOT",i[i.FERMATA=42]="FERMATA",i[i.INVERTED_FERMATA=43]="INVERTED_FERMATA",i[i.SPICCATO=44]="SPICCATO",i[i.TENUTO=45]="TENUTO",i[i.MARCATO=46]="MARCATO",i[i.MARCATISSIMO=47]="MARCATISSIMO",i[i.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",i[i.P=49]="P",i[i.F=50]="F",i[i.S=51]="S",i[i.Z=52]="Z",i[i.M=53]="M",i[i.R=54]="R",i[i.SEGNO=55]="SEGNO",i[i.CODA=56]="CODA",i[i.DRUM_CLEF=57]="DRUM_CLEF",i[i.G_CLEF_SUB8=58]="G_CLEF_SUB8",i[i.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",i[i.G_CLEF_SUB15=60]="G_CLEF_SUB15",i[i.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",i[i.F_CLEF_SUB8=62]="F_CLEF_SUB8",i[i.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",i[i.F_CLEF_SUB15=64]="F_CLEF_SUB15",i[i.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",i[i.DOWN_BOW=66]="DOWN_BOW",i[i.MORDENT=67]="MORDENT",i[i.INVERTED_MORDENT=68]="INVERTED_MORDENT",i[i.TURN=69]="TURN",i[i.INVERTED_TURN=70]="INVERTED_TURN",i[i.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",i[i.RELEASE_PED=72]="RELEASE_PED",i[i.ENGAGE_PED=73]="ENGAGE_PED",i[i.VA8=74]="VA8",i[i.VB8=75]="VB8",i[i.TRILL=76]="TRILL",i[i.MA15=77]="MA15",i[i.MB15=78]="MB15",i[i.HIGH=79]="HIGH",i[i.PLAY=80]="PLAY",i[i.MIC=81]="MIC",i[i.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",i[i.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",i[i.EditPen=84]="EditPen",i[i.PEDAL_BRACKET=85]="PEDAL_BRACKET",i[i.PEDAL_MIXED=86]="PEDAL_MIXED",i[i.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",i))(MusicSymbol||{}),MusicSymbolDrawingStyle=(i=>(i[i.Normal=0]="Normal",i[i.Disabled=1]="Disabled",i[i.Selected=2]="Selected",i[i.Clickable=3]="Clickable",i[i.PlaybackSymbols=4]="PlaybackSymbols",i[i.FollowSymbols=5]="FollowSymbols",i[i.QFeedbackNotFound=6]="QFeedbackNotFound",i[i.QFeedbackOk=7]="QFeedbackOk",i[i.QFeedbackPerfect=8]="QFeedbackPerfect",i[i.Debug1=9]="Debug1",i[i.Debug2=10]="Debug2",i[i.Debug3=11]="Debug3",i))(MusicSymbolDrawingStyle||{}),PhonicScoreModes=(i=>(i[i.Following=0]="Following",i[i.Midi=1]="Midi",i[i.Manual=2]="Manual",i))(PhonicScoreModes||{});class LabelRenderSpecs{}class MusicSheetDrawer{constructor(e,t){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.needSpecialArrTs=[],this.phonicScoreMode=PhonicScoreModes.Manual,this.textMeasurer=e,this.splitScreenLineColor=-1,this.drawingParameters=t,this.rules=t.Rules}set Mode(e){this.phonicScoreMode=e}drawSheet(e){if(this.graphicalMusicSheet=e,this.rules=e.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(const r of e.Cursors){if(!r)continue;const s=new BoundingBox$1(r);s.AbsolutePosition=r.Start,s.BorderBottom=r.End.y-r.Start.y,s.BorderRight=r.Width/2,s.BorderLeft=-r.Width/2,this.isVisible(s)&&this.drawLineAsVerticalRectangle(r,GraphicalLayers.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const t=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let r=0;rU[0]).filter(Boolean))||[],V=[];let K=!1;for(let U=0;UU.x-J.x))==null?void 0:C[0])==null?void 0:R.measure;break}}}catch(F){console.log("🚀 ~ error",F)}let k=0;z?k=((I=z.stave)==null?void 0:I.end_x)||0:k=((M=r.sourceNote.SourceMeasure.VerticalMeasureList[0])==null?void 0:M.getVFStave()).end_x;const $=0;o.ScreenPosition.x=k,o.ScreenPosition.y=W===0?(e.PositionAndShape.Parent.AbsolutePosition.y-3-$)*10:W*10}const c=["C","G","D","A","E","B","F#","C#","G#","F","Bb","Eb","Ab","Db","Gb","Cb","Fb","D#","A#","E#"];c.includes(s.text)&&(o.ScreenPosition.y=(e.PositionAndShape.Parent.AbsolutePosition.y+e.PositionAndShape.Parent.BorderTop+e.PositionAndShape.Parent.BorderMarginTop)*10),["play","listen"].includes(s.text.toLocaleLowerCase())&&s.textAlignment===TextAlignmentEnum.LeftBottom&&(o.ScreenPosition.y=(e.PositionAndShape.Parent.AbsolutePosition.y-1+e.PositionAndShape.Parent.BorderBottom)*10);const u=["ffp","p-f","sfzp","szf","sffzp"];for(let W=0;W0&&(isTopFont(e.Label.textAlignment)||[TextAlignmentEnum.CenterBottom].includes(e.Label.textAlignment))){let W=-1,O=!1;for(const z of(l==null?void 0:l.AbstractExpressions)||[])if(z.Label===e?W=(D=z==null?void 0:z.parentMeasure)==null?void 0:D.measureListIndex:(H=z.expression)!=null&&H.TempoInBpm&&(O=z.expression.TempoInBpm>0),O&&W>-1){o.ScreenPosition.y-=4*10;break}}this.rules.DYMusicScoreType==="jianpu"?isNaN(parseInt(e.Label.text,10))&&this.renderLabel(e,t,o):this.renderLabel(e,t,o)}calculateLabel(e){var c,u;const t=new LabelRenderSpecs,r=e.Label,s=new BoundingBox$1(this);s.AbsolutePosition.x=e.PositionAndShape.AbsolutePosition.x,s.AbsolutePosition.y=e.PositionAndShape.AbsolutePosition.y||e.PositionAndShape.Parent.AbsolutePosition.y,t.ScreenPosition=this.applyScreenTransformation(s.AbsolutePosition),t.FontHeightInPixel=this.calculatePixelDistance(r.fontHeight);const o=this.calculatePixelDistance(e.PositionAndShape.Size.width);switch(t.BitmapWidth=Math.ceil(o),t.BitmapHeight=e.TextLines?Math.ceil(t.FontHeightInPixel*(.2+e.TextLines.length)):10,r.textAlignment){case TextAlignmentEnum.LeftTop:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y+=t.BitmapHeight*1.5;break;case TextAlignmentEnum.LeftCenter:t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.LeftBottom:t.ScreenPosition.y-=t.BitmapHeight;break;case TextAlignmentEnum.CenterTop:t.ScreenPosition.x-=t.BitmapWidth/2;break;case TextAlignmentEnum.CenterCenter:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.CenterBottom:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y-=t.BitmapHeight,r.text==="筒音作5"&&this.rules.DYMusicScoreType==="jianpu"&&(t.ScreenPosition.x=80);break;case TextAlignmentEnum.RightTop:t.ScreenPosition.x-=t.BitmapWidth;break;case TextAlignmentEnum.RightCenter:t.ScreenPosition.x-=t.BitmapWidth,t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.RightBottom:t.ScreenPosition.x-=t.BitmapWidth,t.ScreenPosition.y-=t.BitmapHeight;break;default:throw new ArgumentOutOfRangeException("")}const a=e.PositionAndShape.Parent.DataObject,l=[1,3,7,9,15,20,22,24,28,30,36,41];this.rules.DYMusicScoreId&&this.rules.DYMusicScoreId==="1722157850347765762"&&(r.text==="."&&(t.ScreenPosition.x=142,t.ScreenPosition.y=134),r.text==="T"&&(this.needSpecialArrTs.push(t),((u=(c=a==null?void 0:a.measures)==null?void 0:c[0])==null?void 0:u.MeasureNumber)===1?t.ScreenPosition.y+=20:t.ScreenPosition.y-=20));for(let m in this.needSpecialArrTs)l.includes(Number(m))&&(this.needSpecialArrTs[m].ScreenPosition.x-=20);return t}applyScreenTransformations(e){const t=[];for(const r of e)t.push(this.applyScreenTransformation(r));return t}drawSplitScreenLine(){}renderRectangle(e,t,r,s=void 0,o=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(e){}drawSelectionEndSymbol(e){}renderLabel(e,t,r){throw new Error("not implemented")}renderSystemToScreen(e,t,r){}drawSkyLine(e){}drawBottomLine(e){}drawInstrumentBrace(e,t){}drawGroupBracket(e,t){}isVisible(e){return!0}drawMusicSystem(e){const t=this.getSystemAbsBoundingRect(e),r=this.getSytemBoundingBoxInPixels(t);this.drawMusicSystemComponents(e,r,t)}getSytemBoundingBoxInPixels(e){const t=this.applyScreenTransformationForRect(e);return t.x=Math.round(t.x),t.y=Math.round(t.y),t}getSystemAbsBoundingRect(e){const t=e.PositionAndShape.BoundingRectangle;return new RectangleF2D(e.PositionAndShape.AbsolutePosition.x+e.PositionAndShape.BorderLeft-1,e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderTop-1,t.width+6,t.height+2)}drawMusicSystemComponents(e,t,r){const s=this.graphicalMusicSheet.SelectionStartSymbol,o=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&s!==void 0&&this.isVisible(s.PositionAndShape)&&this.drawSelectionStartSymbol(s),this.drawingParameters.drawSelectionEndSymbol&&o!==void 0&&this.isVisible(o.PositionAndShape)&&this.drawSelectionEndSymbol(o);for(const c of e.StaffLines)this.drawStaffLine(c),this.rules.RenderLyrics&&(c.LyricsDashes.length>0&&this.drawDashes(c.LyricsDashes),c.LyricLines.length>0&&this.drawLyricLines(c.LyricLines,c));for(const c of e.SystemLines)this.drawSystemLineObject(c);if(e.Parent===e.Parent.Parent.MusicPages[0])for(const c of e.Labels)c.SVGNode=this.drawLabel(c,GraphicalLayers.Notes);const a=this.graphicalMusicSheet.ParentMusicSheet.Instruments,l=a.filter(c=>c.Visible).length;for(const c of e.InstrumentBrackets)this.drawInstrumentBrace(c,e);if(a.length>0)if(l>1)for(const c of e.GroupBrackets)this.drawGroupBracket(c,e);else for(const c of e.GroupBrackets)c.Visible=!1;if(!this.leadSheet)for(const c of e.MeasureNumberLabels)c.SVGNode=this.drawLabel(c,GraphicalLayers.Notes);for(const c of e.StaffLines)this.drawStaffLineSymbols(c);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(e)}activateSystemRendering(e,t,r,s){return!0}drawSystemLineObject(e){}drawStaffLine(e){for(const t of e.Measures)this.drawMeasure(t);this.rules.RenderLyrics&&e.LyricsDashes.length>0&&this.drawDashes(e.LyricsDashes),this.drawOctaveShifts(e),this.drawPedals(e),this.drawWavyLines(e),this.drawExpressions(e),this.skyLineVisible&&this.drawSkyLine(e),this.bottomLineVisible&&this.drawBottomLine(e)}drawLyricLines(e,t){t.LyricLines.forEach(r=>{r.Start.y+=t.PositionAndShape.AbsolutePosition.y,r.End.y+=t.PositionAndShape.AbsolutePosition.y,r.Start.x+=t.PositionAndShape.AbsolutePosition.x,r.End.x+=t.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(r,this.rules.LyricUnderscoreLineWidth)})}drawExpressions(e){}drawGraphicalLine(e,t,r="black"){return this.drawLine(e.Start,e.End,r,t)}drawLine(e,t,r="#FF0000FF",s){}drawDashes(e){e.forEach(t=>t.SVGNode=this.drawLabel(t,GraphicalLayers.Notes))}drawOctaveShifts(e){}drawStaffLines(e){if(e.StaffLines){const t=e.PositionAndShape.AbsolutePosition;for(let r=0;r<5;r++)this.drawLineAsHorizontalRectangleWithOffset(e.StaffLines[r],t,GraphicalLayers.Notes)}}drawSymbol(e,t,r,s=1,o=GraphicalLayers.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(e){this.graphicalMusicSheet.LeadSheet=e}drawPage(e){if(this.isVisible(e.PositionAndShape)){for(const t of e.MusicSystems)this.isVisible(t.PositionAndShape)&&this.drawMusicSystem(t);if(e===e.Parent.MusicPages[0])for(const t of e.Labels)t.SVGNode=this.drawLabel(t,GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(e.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(e,t=0,r="all"){const s=e.DataObject.constructor.name;let o=!1;r==="all"&&(o=!0),(o||s===r)&&this.drawBoundingBox(e,void 0,!0,s,t),t++,e.ChildElements.forEach(a=>this.drawBoundingBoxes(a,t,r))}drawBoundingBox(e,t=void 0,r=!1,s=void 0,o=0){let a=new RectangleF2D(e.AbsolutePosition.x+e.BorderMarginLeft,e.AbsolutePosition.y+e.BorderMarginTop,e.BorderMarginRight-e.BorderMarginLeft,e.BorderMarginBottom-e.BorderMarginTop);r&&(this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(e.AbsolutePosition.x-1,e.AbsolutePosition.y),new PointF2D(e.AbsolutePosition.x+1,e.AbsolutePosition.y),.1,OutlineAndFillStyleEnum.BaseWritingColor,t),o-1),this.drawLineAsVerticalRectangle(new GraphicalLine(new PointF2D(e.AbsolutePosition.x,e.AbsolutePosition.y-1),new PointF2D(e.AbsolutePosition.x,e.AbsolutePosition.y+1),.1,OutlineAndFillStyleEnum.BaseWritingColor,t),o-1)),a=this.applyScreenTransformationForRect(a);const l=this.renderRectangle(a,GraphicalLayers.Background,o,t,.5);if(s){const c=new Label(s),u=new LabelRenderSpecs;u.BitmapWidth=a.width,u.BitmapHeight=a.height,u.FontHeightInPixel=a.height,u.ScreenPosition=new PointF2D(a.x,a.y+12),this.renderLabel(new GraphicalLabel(c,.8,TextAlignmentEnum.CenterCenter,this.rules),o,u)}return l}drawMarkedAreas(e){for(const t of e.GraphicalMarkedAreas)t&&(t.systemRectangle&&this.drawRectangle(t.systemRectangle,GraphicalLayers.Background),t.settings&&(t.settings.SVGNode=this.drawLabel(t.settings,GraphicalLayers.Comment)),t.labelRectangle&&this.drawRectangle(t.labelRectangle,GraphicalLayers.Background),t.label&&(t.label.SVGNode=this.drawLabel(t.label,GraphicalLayers.Comment)))}drawStaffLineSymbols(e){const t=e.ParentStaff.ParentInstrument,r=e.PositionAndShape.AbsolutePosition.x,s=e.PositionAndShape.AbsolutePosition.y+2,o=e.PositionAndShape.BorderRight;t.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(r,s),new PointF2D(r+o,s),4,OutlineAndFillStyleEnum.Highlighted),GraphicalLayers.Highlight);let a=MusicSymbolDrawingStyle.Disabled,l=MusicSymbol.PLAY,c=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case PhonicScoreModes.Midi:l=MusicSymbol.PLAY,this.midiPlaybackAvailable&&e.ParentStaff.audible&&(a=MusicSymbolDrawingStyle.PlaybackSymbols);break;case PhonicScoreModes.Following:l=MusicSymbol.MIC,e.ParentStaff.following&&(a=MusicSymbolDrawingStyle.FollowSymbols);break;default:c=!1;break}if(c){const u=new PointF2D(r+o+2,s);this.drawSymbol(l,a,u)}if(this.drawingParameters.drawErrors)for(const u of e.Measures){const m=u.PositionAndShape,d=m.AbsolutePosition.x,y=m.AbsolutePosition.y+2;u.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(d,y),new PointF2D(d+m.BorderRight,y),4,OutlineAndFillStyleEnum.ErrorUnderlay),GraphicalLayers.MeasureError)}}}class VexFlowTextMeasurer{constructor(e){this.fontSize=20,this.fontSizeStandard=this.fontSize;const t=document.createElement("canvas");this.context=t.getContext("2d"),this.rules=e}computeTextWidthToHeightRatio(e,t,r,s=void 0,o=this.fontSize){return this.context.font=VexFlowConverter.font(o,r,t,this.rules,s),this.context.measureText(e).width/o}setFontSize(e=this.fontSizeStandard){return this.fontSize=e,e}}class AbstractGraphicalExpression extends GraphicalObject{constructor(e,t,r){super(),this.expression=t,this.parentMeasure=r,this.boundingBox=new BoundingBox$1(this,e.PositionAndShape),this.parentStaffLine=e,this.parentStaffLine.AbstractExpressions.push(this),this.rules=e.ParentMusicSystem.rules}get Label(){return this.label}get ParentStaffLine(){return this.parentStaffLine}get SourceExpression(){return this.expression}get Placement(){return this.expression.Placement}}class GraphicalInstantaneousTempoExpression extends AbstractGraphicalExpression{constructor(e,t){super(t.PositionAndShape.Parent.DataObject,e,e.parentMeasure),this.label=t}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}class GraphicalInstantaneousDynamicExpression extends AbstractGraphicalExpression{constructor(e,t,r){super(t,e,r.parentSourceMeasure),this.mInstantaneousDynamicExpression=e,this.mMeasure=r}updateSkyBottomLine(){const e=this.parentStaffLine.SkyBottomLineCalculator,t=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,r=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let s=0;switch(this.Placement){case PlacementEnum.Above:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,e.updateSkyLineInRange(t,r,s);break;case PlacementEnum.Below:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,e.updateBottomLineInRange(t,r,s);break;default:log$2.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpression{constructor(e,t,r){super(t,e,r),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(e){this.startMeasure=e}get EndMeasure(){return this.endMeasure}set EndMeasure(e){this.endMeasure=e}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(e){this.isSplittedPart=e}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(e){this.notToBeRemoved=e}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){var s;const e=this.parentStaffLine.SkyBottomLineCalculator,t=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,r=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsVerbal&&this.lines.length<2&&log$2.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==ContDynamicEnum.crescendo&&this.ContinuousDynamic.DynamicType!==ContDynamicEnum.diminuendo&&log$2.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+((s=this.startMeasure)==null?void 0:s.MeasureNumber)),this.Placement){case PlacementEnum.Above:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?e.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&e.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);else{const o=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(t,r,o)}break;case PlacementEnum.Below:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?e.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&e.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);else{const o=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(t,r,o)}break;default:log$2.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(e,t,r,s=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r),l=new PointF2D(t,r-s/2),c=new PointF2D(t,r+s/2);this.addWedgeLines(a,l,c,o)}createFirstHalfCrescendoLines(e,t,r,s=this.rules.WedgeMeasureEndOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r),l=new PointF2D(t,r-s/2),c=new PointF2D(t,r+s/2);this.addWedgeLines(a,l,c,o)}createSecondHalfCrescendoLines(e,t,r,s=this.rules.WedgeMeasureBeginOpeningLength,o=this.rules.WedgeOpeningLength,a=this.rules.WedgeLineWidth){const l=new PointF2D(e,r-s/2),c=new PointF2D(e,r+s/2),u=new PointF2D(t,r-o/2),m=new PointF2D(t,r+o/2);this.addDoubleLines(l,u,c,m,a)}recalculateCrescendoLines(e,t,r){const s=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),s?this.createSecondHalfCrescendoLines(e,t,r):this.isSplittedPart?this.createFirstHalfCrescendoLines(e,t,r):this.createCrescendoLines(e,t,r)}createDiminuendoLines(e,t,r,s=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r-s/2),l=new PointF2D(e,r+s/2),c=new PointF2D(t,r);this.addWedgeLines(c,a,l,o)}createFirstHalfDiminuendoLines(e,t,r,s=this.rules.WedgeOpeningLength,o=this.rules.WedgeMeasureEndOpeningLength,a=this.rules.WedgeLineWidth){const l=new PointF2D(e,r-s/2),c=new PointF2D(e,r+s/2),u=new PointF2D(t,r-o/2),m=new PointF2D(t,r+o/2);this.addDoubleLines(l,u,c,m,a)}createSecondHalfDiminuendoLines(e,t,r,s=this.rules.WedgeMeasureBeginOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r-s/2),l=new PointF2D(e,r+s/2),c=new PointF2D(t,r);this.addWedgeLines(c,a,l,o)}recalculateDiminuendoLines(e,t,r){const s=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),s?this.createFirstHalfDiminuendoLines(e,t,r):this.isSplittedPart?this.createSecondHalfDiminuendoLines(e,t,r):this.createDiminuendoLines(e,t,r)}calcPsi(){if(this.IsVerbal){this.PositionAndShape.calculateBoundingBox();return}this.PositionAndShape.RelativePosition=this.lines[0].Start,this.PositionAndShape.BorderMarginTop=this.lines[0].End.y-this.lines[0].Start.y,this.PositionAndShape.BorderMarginBottom=this.lines[1].End.y-this.lines[1].Start.y,this.PositionAndShape.Center.y=(this.PositionAndShape.BorderMarginTop+this.PositionAndShape.BorderMarginBottom)/2,this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[0].End.x-this.lines[0].Start.x):(this.PositionAndShape.BorderMarginLeft=this.lines[0].End.x-this.lines[0].Start.x,this.PositionAndShape.BorderMarginRight=0)}cleanUp(){this.lines.clear()}shiftYPosition(e){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=e,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=e,this.lines[0].End.y+=e,this.lines[1].End.y+=e)}squeeze(e){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)0?this.lines[0].Start.x+=e:(this.lines[0].End.x+=e,this.lines[1].End.x+=e):e<0?this.lines[0].Start.x+=e:(this.lines[0].End.x+=e,this.lines[1].End.x+=e),this.calcPsi())}addWedgeLines(e,t,r,s){const o=new GraphicalLine(e,t,s),a=new GraphicalLine(e,r,s);this.lines.push(o),this.lines.push(a)}addDoubleLines(e,t,r,s,o){const a=new GraphicalLine(e,t,o),l=new GraphicalLine(r,s,o);this.lines.push(a),this.lines.push(l)}}class GraphicalUnknownExpression extends AbstractGraphicalExpression{constructor(e,t,r,s,o=void 0){super(e,new AbstractExpression(r),s),this.label=t,this.sourceMultiExpression=o}updateSkyBottomLine(){const e=this.parentStaffLine.SkyBottomLineCalculator,t=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,r=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case PlacementEnum.Above:const s=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(t,r,s);break;case PlacementEnum.Below:const o=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(t,r,o);break;default:log$2.error("Placement for GraphicalUnknownExpression is unknown")}}}const unitInPixels=10;class VexFlowMusicSheetDrawer extends MusicSheetDrawer{constructor(e=new DrawingParameters){super(new VexFlowTextMeasurer(e.Rules),e),this.backends=[],this.zoom=1,this.pageIdx=0,this.getDotId=(t,r)=>r?String(t.Label.PositionAndShape.RelativePosition[r]):String(t.Label.PositionAndShape.RelativePosition.x)+String(t.Label.PositionAndShape.RelativePosition.y),this.hasDot=(t,r,s,o)=>{const a=r||Object.values(o);for(const l of a){if(s)return t.x===l.x&&t.y===l.y;if(t.x===l.x)return!0}return!1}}get Zoom(){return this.zoom}get Backends(){return this.backends}initializeBackendForPage(e){this.backend=this.backends[e.PageNumber-1]}drawSheet(e){var t,r,s;this.rules.DefaultVexFlowNoteFont==="gonville"&&(Vex.Flow.DEFAULT_FONT_STACK=[(t=Vex.Flow.Fonts)==null?void 0:t.Gonville,(r=Vex.Flow.Fonts)==null?void 0:r.Bravura,(s=Vex.Flow.Fonts)==null?void 0:s.Custom]),Vex.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*unitInPixels,Vex.Flow.STEM_WIDTH=this.rules.StemWidth*unitInPixels,Vex.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,Vex.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;for(const o of e.MusicPages){if(o.PageNumber>this.rules.MaxPageToDrawNumber)break;const a=this.backends[this.pageIdx];a.graphicalMusicPage=o,a.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(e)}drawPage(e){e&&(this.backend=this.backends[e.PageNumber-1],super.drawPage(e),this.pageIdx+=1)}clear(){for(const e of this.backends)e.clear()}setZoom(e){this.zoom=e}calculatePixelDistance(e){return e*unitInPixels}drawStaffLine(e){const t=this.backend.getContext().openGroup();t&&t.classList.add("staffline"),super.drawStaffLine(e);const r=e.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(e,r),this.backend.getContext().closeGroup()}drawSlurs(e,t){var s,o,a,l;const r=(s=window.GYM)==null?void 0:s.vfcurveItem;for(let c=0;c(d.index?d.index===c:!0)&&d.MeasureNumberXML==u.staffEntries[u.staffEntries.length-1].parentMeasure.MeasureNumber);m&&(u.bezierEndControlPt.y+=(o=m==null?void 0:m.bezierEndControlPt)!=null&&o.y?m.bezierEndControlPt.y:0,u.bezierEndPt.y+=(a=m==null?void 0:m.bezierEndPt)!=null&&a.y?m.bezierEndPt.y:0,u.bezierStartControlPt.y+=(l=m==null?void 0:m.bezierStartControlPt)!=null&&l.y?m.bezierStartControlPt.y:0)}catch(m){console.log(m)}this.drawSlur(u,t)}}}drawSlur(e,t){const r=[];let s,o,a,l;this.rules.DYMusicScoreType==="jianpu"?((e.placement>0||e.bezierStartPt.y>0)&&(e.bezierStartPt.y=-.8,e.bezierStartControlPt.y=-2.5),s=new PointF2D(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),o=new PointF2D(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),a=new PointF2D(e.bezierEndControlPt.x+t.x,e.bezierStartControlPt.y+t.y),l=new PointF2D(e.bezierEndPt.x+t.x,e.bezierStartPt.y+t.y)):(s=new PointF2D(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),o=new PointF2D(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),a=new PointF2D(e.bezierEndControlPt.x+t.x,e.bezierEndControlPt.y+t.y),l=new PointF2D(e.bezierEndPt.x+t.x,e.bezierEndPt.y+t.y)),r.push(this.applyScreenTransformation(s)),r.push(this.applyScreenTransformation(o)),r.push(this.applyScreenTransformation(a)),r.push(this.applyScreenTransformation(l)),e.placement===PlacementEnum.Above?(s.y-=.05,o.y-=.3,a.y-=.3,l.y-=.05):(s.y+=.05,o.y+=.3,a.y+=.3,l.y+=.05),r.push(this.applyScreenTransformation(s)),r.push(this.applyScreenTransformation(o)),r.push(this.applyScreenTransformation(a)),r.push(this.applyScreenTransformation(l)),e.SVGElement=this.backend.renderCurve(r)}drawMeasure(e){e.setAbsoluteCoordinates(e.PositionAndShape.AbsolutePosition.x*unitInPixels,e.PositionAndShape.AbsolutePosition.y*unitInPixels);const t=this.backend.getContext();try{e.draw(t)}catch(r){log$2.warn("VexFlowMusicSheetDrawer.drawMeasure",r)}for(const r of e.staffEntries)this.drawStaffEntry(r)}drawLine(e,t,r="#FF0000FF",s=.2){return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),this.backend.renderLine(e,t,r,s*unitInPixels)}DrawOverlayLine(e,t,r,s="#FF0000FF",o=.2){if(!r.PageNumber||r.PageNumber>this.backends.length||r.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}const a=r.PageNumber-1,l=this.backends[a];return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),l.renderLine(e,t,s,o*unitInPixels)}drawSkyLine(e){const t=e.PositionAndShape.AbsolutePosition,r=e.PositionAndShape.Size.width;this.drawSampledLine(e.SkyLine,t,r)}drawBottomLine(e){const t=new PointF2D(e.PositionAndShape.AbsolutePosition.x,e.PositionAndShape.AbsolutePosition.y),r=e.PositionAndShape.Size.width;this.drawSampledLine(e.BottomLine,t,r,"#0000FFFF")}drawSampledLine(e,t,r,s="#FF0000FF"){const o=[];let a=0;for(let c=0;c0){const c=this.rules.SamplingUnit;let u=new PointF2D(l.x,l.y),m=new PointF2D(o[0]/c+l.x,l.y);this.drawLine(u,m,s);let d,y;e[0]>=0&&(d=new PointF2D(o[0]/c+l.x,l.y),y=new PointF2D(o[0]/c+l.x,l.y+e[o[0]]),this.drawLine(d,y,s));for(let b=1;b0)for(const t of e.FingeringEntries)t.SVGNode=this.drawLabel(t,GraphicalLayers.Notes);if(e.graphicalChordContainers!==void 0&&e.graphicalChordContainers.length>0)for(const t of e.graphicalChordContainers){const r=t.GraphicalLabel;r.SVGNode=this.drawLabel(r,GraphicalLayers.Notes)}this.rules.RenderLyrics&&e.LyricsEntries.length>0&&this.drawLyrics(e.LyricsEntries,GraphicalLayers.Notes)}drawLyrics(e,t){e.forEach(r=>{const s=r.GraphicalLabel;s.SVGNode=this.drawLabel(s,t)})}drawInstrumentBrace(e,t){e.draw(this.backend.getContext())}drawGroupBracket(e,t){e.draw(this.backend.getContext())}drawOctaveShifts(e){for(const t of e.OctaveShifts)if(t){const r=t,s=this.backend.getContext(),o=r.getTextBracket();o.setContext(s);try{o.draw()}catch(a){log$2.warn(a)}}}drawPedals(e){for(const t of e.Pedals)if(t){const r=t,s=this.backend.getContext(),o=r.getPedalMarking();o.setContext(s),o.draw()}}drawWavyLines(e){for(const t of e.WavyLines)if(t){const r=t,s=this.backend.getContext(),o=r.getVibratoBracket();o.setContext(s),o.draw()}}getMaxExpressionsYAndDots(e){var c,u;const t=[];let r=0;for(const m of e.measures)t.push(m.measureNumber);const s={},o={},a={};for(const m of e.AbstractExpressions)if(m instanceof GraphicalUnknownExpression&&t.includes(m.parentMeasure.MeasureNumber)){const d=this.getDotId(m),y=this.getDotId(m,"x");o[d]||(o[d]=[]),a[y]||(a[y]=[]),this.hasDot(m.Label.PositionAndShape.RelativePosition,o[d],!0)||(o[d].push(m.Label.PositionAndShape.RelativePosition),a[y].push(m.Label.PositionAndShape.RelativePosition)),s[d]=m.Label.PositionAndShape.RelativePosition}let l=0;for(const m of e.AbstractExpressions){const d=(c=m.parentMeasure)==null?void 0:c.MeasureNumber;if(m instanceof GraphicalUnknownExpression&&t.includes(d)){const y=(u=m.parentMeasure.verticalMeasureList[0])==null?void 0:u.stave,b=(y==null?void 0:y.end_x)-(y==null?void 0:y.x),S=this.getDotId(m,"x");if((a[S]||[]).length===1&&l!==d){const A=m.Label.PositionAndShape.AbsolutePosition.y;r=r===0?A:Math.min(r,A)}(a[S]||[]).length!==1&&b/10Number.EPSILON){let r=Math.min(...e.Lines.map(o=>o.Start.x)),s=Math.min(...e.Lines.map(o=>o.Start.y));e.Lines[0].Start.x=r,e.Lines[1].Start.x=r,e.Lines[0].Start.y=s+this.rules.WedgeOpeningLength/2,e.Lines[1].Start.y=s+this.rules.WedgeOpeningLength*2,e.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,e.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch(r){}const t=this.backend.getContext();t.openGroup("lineGroup");for(const r of e.Lines){const s=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+r.Start.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+r.Start.y),o=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+r.End.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+r.End.y);this.drawLine(s,o,"black",r.Width)}t.closeGroup()}}renderLabel(e,t,r){return this._renderLabel(e,r)}_renderLabel(e,t){var u;if(!e.Label.print)return;const r=e.Label.fontHeight*unitInPixels,{font:s}=e.Label;let o;this.rules.ColoringEnabled&&(o=e.Label.colorDefault,e.Label.color&&(o=e.Label.color.toString()),o||(o=this.rules.DefaultColorLabel));let{fontStyle:a,fontFamily:l}=e.Label;a||(a=this.rules.DefaultFontStyle),l||(l=this.rules.DefaultFontFamily);let c;for(let m=0;m<((u=e.TextLines)==null?void 0:u.length);m++){const d=e.TextLines[m],y=this.calculatePixelDistance(d.xOffset),b=new PointF2D(t.ScreenPosition.x+y,t.ScreenPosition.y),S=this.backend.renderText(r,a,s,d.text,t.FontHeightInPixel,b,o,e.Label.fontFamily);c?c.appendChild(S):c=S,t.ScreenPosition.y=t.ScreenPosition.y+t.FontHeightInPixel,e.TextLines.length>1&&(t.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return c}renderRectangle(e,t,r,s,o){return this.backend.renderRectangle(e,r,s,o)}applyScreenTransformation(e){return new PointF2D(e.x*unitInPixels,e.y*unitInPixels)}applyScreenTransformationForRect(e){return new RectangleF2D(e.x*unitInPixels,e.y*unitInPixels,e.width*unitInPixels,e.height*unitInPixels)}}const VF$c=Vex.Flow,_VexFlowConverter=class rt{static durations(e,t){const r=[],s=e.clone();for(;s.RealValue>0;){const o=s.RealValue;if(o>=2)r.push("1/2"),s.Sub(new Fraction$1(2,1));else if(o>=1)r.push("w"),s.Sub(new Fraction$1(1,1));else if(o<1&&o>=.5){if(t&&o>.5)return["w"];r.push("h"),s.Sub(new Fraction$1(1,2))}else if(o<.5&&o>=.25){if(t&&o>.25)return["h"];r.push("q"),s.Sub(new Fraction$1(1,4))}else if(o<.25&&o>=.125){if(t&&o>.125)return["q"];r.push("8"),s.Sub(new Fraction$1(1,8))}else if(o<.125&&o>=.0625){if(t&&o>.0625)return["8"];r.push("16"),s.Sub(new Fraction$1(1,16))}else if(o<.0625&&o>=.03125){if(t&&o>.03125)return["16"];r.push("32"),s.Sub(new Fraction$1(1,32))}else if(o<.03125&&o>=.015625){if(t&&o>.015625)return["32"];r.push("64"),s.Sub(new Fraction$1(1,64))}else{if(t)return["64"];r.push("128"),s.Sub(new Fraction$1(1,128))}}return r}static pitch(e,t,r,s=void 0,o=void 0){let a=o;o===void 0&&(a=3),t&&o===void 0&&(a=0,r.ClefType===ClefEnum.F&&(a=2),r.ClefType===ClefEnum.C&&(a=2));const l=NoteEnum[e.FundamentalNote].toLowerCase(),c=Pitch.accidentalVexflow(e.Accidental),u=e.Octave-r.OctaveOffset+a;let m="";return s&&(m=this.NoteHeadCode(s)),[l+"n/"+u+m,c,r]}static restToNotePitch(e,t){let r=e.Octave;switch(t){case ClefEnum.C:case ClefEnum.F:{r+=2;break}case ClefEnum.G:}return new Pitch(e.FundamentalNote,r,AccidentalEnum.NONE)}static NoteHeadCode(e){const t="/",r=e.Filled?"2":"1";switch(e.Shape){case NoteHeadShape.NORMAL:return"";case NoteHeadShape.DIAMOND:return t+"D"+r;case NoteHeadShape.TRIANGLE:return t+"T"+r;case NoteHeadShape.X:return t+"X"+r;case NoteHeadShape.CIRCLEX:return t+"X3";case NoteHeadShape.RECTANGLE:return t+"R"+r;case NoteHeadShape.SQUARE:return t+"S"+r;case NoteHeadShape.SLASH:return"";default:return""}}static GhostNotes(e){const t=[],r=rt.durations(e,!1);for(const s of r)t.push(new VF$c.GhostNote({duration:s}));return t}static StaveNote(e){var M,D,H,W,O,z,k,$,F,G,N,V,K,U,J,me,he;e.sortForVexflow();const t=e.notes,r=e.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,s=t[0];let o=[],a;const l=[],c=s.graphicalNoteLength,u=s.sourceNote.NoteTuplet!==void 0;let m=rt.durations(c,u)[0];s.sourceNote.TypeLength!==void 0&&s.sourceNote.TypeLength!==c&&s.sourceNote.TypeLength.RealValue!==0&&(m=rt.durations(s.sourceNote.TypeLength,u)[0],s.numberOfDots=s.sourceNote.DotsXml);let d,y=s.numberOfDots,b=!1,S=0,A=!1,P=!1,x;for(const le of t){if(y=1&&be.length-1>=te+1&&(Ee=(O=(W=be[te-1])==null?void 0:W.graphicalVoiceEntries[0])==null?void 0:O.parentVoiceEntry,ee=(k=(z=be[te+1])==null?void 0:z.graphicalVoiceEntries[0])==null?void 0:k.parentVoiceEntry,Ee&&ee)){const B=Ee.Notes[0],re=ee.Notes[0];if(($=B.NoteBeam)!=null&&$.Notes.includes(re)&&re.ParentStaffEntry.ParentStaff.StafflineCount!==1){const Z=Ee.Notes.last().Pitch,Y=le.Clef(),q=rt.pitch(rt.restToNotePitch(Z.getTransposedPitch(-2),Y.ClefType),!1,Y);Z.FundamentalNote===4&&(o=[q[0]])}}}}if(c.RealValue===le.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(o=r.DYMusicScoreType==="staff"?["d/5"]:["R/5"],m="w",y=0,b=!0,S=r.WholeRestXShiftVexflow*unitInPixels),[...le.sourceNote.ParentStaff.Voices].filter(fe=>(fe==null?void 0:fe.VoiceId)!=1).length){const fe=le.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,be=le.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let Ee,ee;for(const te of fe)for(const B of te.notes){if(B===le||B.sourceNote.isRest()||!B.sourceNote.PrintObject){le.lineShift=-2;continue}const re=B.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,Z=be===1||be===5,Y=Z?1:-1,ie=B.sourceNote.Pitch.getHalfTone(),ne=Y===1&&ie>Ee,se=Y===-1&&ie0){let te=3;const B=le.Clef();switch(B.ClefType){case ClefEnum.F:te=5;break;case ClefEnum.C:te=4;break}x=Pitch.fromHalftone(Ee),o=[rt.pitch(x,!0,B,void 0,te)[0]]}}break}le.sourceNote.Notehead&&le.sourceNote.Notehead.Shape===NoteHeadShape.SLASH&&(A=!0);const Se=le.vfpitch;if((G=(F=Se[2])==null?void 0:F.Parent)!=null&&G.Instructions)for(let oe=0,ue=Se[2].Parent.Instructions.length;oe1&&e.notes[0].sourceNote.ParentVoiceEntry.ParentVoice.VoiceId==1&&(E.getKeyProps()[0].line=4.5);const I=(U=window.GYM)==null?void 0:U.customBassDrum;if(I&&E.isRest()&&(E.getDuration()==="q"&&(E.getKeyProps()[0].line=I),E.getDuration()==="h"&&(E.getKeyProps()[0].line=I-1)),E.getKeyProps().forEach(({line:le},Se)=>e.notes[Se].staffLine=le),(r.LedgerLineWidth||r.LedgerLineStrokeStyle)&&(E.ledgerLineStyle||(E.ledgerLineStyle={}),r.LedgerLineWidth&&(E.ledgerLineStyle.lineWidth=r.LedgerLineWidth),r.LedgerLineStrokeStyle&&(E.ledgerLineStyle.strokeStyle=r.LedgerLineStrokeStyle)),r.ColoringEnabled){const le=r.DefaultColorStem;let Se=e.parentVoiceEntry.StemColor;!Se&&le&&(Se=le);const oe={fillStyle:Se,strokeStyle:Se};Se&&(E.setStemStyle(oe),E.flag&&r.ColorFlags&&E.setFlagStyle(oe))}if(E.x_shift=S,e.parentVoiceEntry.IsGrace&&e.notes[0].sourceNote.NoteBeam&&(e.parentVoiceEntry.WantedStemDirection=e.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),e.parentVoiceEntry){let le=e.parentVoiceEntry.WantedStemDirection;const Se=((J=window.GYM)==null?void 0:J.stemDirectionNote)||[],oe=Se==null?void 0:Se.find(ue=>ue.id===e.notes[0].sourceNote.NoteToGraphicalNoteObjectId);switch(oe&&typeof(oe==null?void 0:oe.direction)=="number"&&(le=oe.direction),le){case StemDirectionType.Up:E.setStemDirection(VF$c.Stem.UP),e.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case StemDirectionType.Down:E.setStemDirection(VF$c.Stem.DOWN),e.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}for(let le=0,Se=t.length;le0&&ue==="single"){const fe=new VF$c.Tremolo(oe);fe.extra_stroke_scale=r.TremoloStrokeScale,fe.y_spacing_scale=r.TremoloYSpacingScale,E&&E.duration==="w"&&E.stem.setExtension(-9),E.addModifier(le,fe)}if(oe>0&&ue==="start"&&this.noteTremoloList.push(E),oe>0&&ue==="stop"){if(this.noteTremoloList.push(E),this.noteTremoloList.filter(Ee=>Ee.duration==="w").length===this.noteTremoloList.length)try{this.noteTremoloList[0].keyProps&&this.noteTremoloList[1].keyProps&&((me=(this.noteTremoloList[0].keyProps[0].line>this.noteTremoloList[1].keyProps[0].line?this.noteTremoloList[1]:this.noteTremoloList[0]).stem)==null||me.setResetHeight(30))}catch(Ee){console.error("设置都是全音符,stem的高度失败")}const be=new VF$c.Tremolo(oe,[...this.noteTremoloList]);be.extra_stroke_scale=1.2,be.y_spacing_scale=1.2,be.x_shift=-30,E.addModifier(le,be),this.noteTremoloList=[]}this.glissandoList.length&&(E.setVibrato(this.glissandoList[0].vfnote[0]),this.glissandoList=[]),t[le].sourceNote.glissandoType==="start"&&this.glissandoList.push(t[le])}if(this.slideNote){try{E.setSlideNote(this.slideNote)}catch(le){console.error(le)}this.slideNote=null}if(e.notes[0].sourceNote.slideType==="start"&&(this.slideNote=E),T.Length.RealValue===.25&&T.Notehead&&T.Notehead.Filled===!1){const le=E.getKeyProps();for(let Se=0;Se1){let le=E.getKeyProps().filter(oe=>!oe.code&&oe.line>3);!((he=window.GYM)==null?void 0:he.stemDirectionNote)&&le.length===o.length&&E.setStemDirection(-1)}r.DYMusicScoreType==="jianpu"&&window&&window.sett&&window.sett.keySignature&&E.addAccidental(0,new VF$c.Accidental("#"));try{const le=["b","#","§","º","X"],Se={b:"b","#":"#","§":"n",º:"bb",X:"##"};for(const oe of t){const ue=oe.sourceNote.voiceEntry.Timestamp;for(const fe of oe.sourceNote.SourceMeasure.StaffLinkedExpressions)for(const be of fe){const Ee=Fraction$1.Equal(ue,be.Timestamp),te=be.EntriesList.map(B=>B.label).filter(B=>le.includes(B)).map(B=>Se[B]);if(Ee){for(const B of te)B&&E.addAnnotation(0,new VF$c.Annotation(B));break}}}}catch(le){}return E}static generateArticulations(e,t,r){var s,o,a,l,c,u;if(!(!e||e.getAttribute("type")==="GhostNote"))for(const m of t){let d=VF$c.Modifier.Position.ABOVE;e.getStemDirection()===VF$c.Stem.UP&&(d=VF$c.Modifier.Position.BELOW);let y;const b=m.articulationEnum;switch(r.ArticulationPlacementFromXML&&(m.placement===PlacementEnum.Above?d=VF$c.Modifier.Position.ABOVE:m.placement===PlacementEnum.Below&&(d=VF$c.Modifier.Position.BELOW)),b){case ArticulationEnum.accent:{y=new VF$c.Articulation("a>");break}case ArticulationEnum.downbow:{y=new VF$c.Articulation("am"),m.placement===void 0&&(d=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.fermata:{y=new VF$c.Articulation("a@a"),d=VF$c.Modifier.Position.ABOVE;break}case ArticulationEnum.marcatodown:{y=new VF$c.Articulation("a|");break}case ArticulationEnum.marcatoup:{y=new VF$c.Articulation("a^");break}case ArticulationEnum.invertedfermata:{y=new VF$c.Articulation("a@u"),d=VF$c.Modifier.Position.BELOW;break}case ArticulationEnum.lefthandpizzicato:{y=new VF$c.Articulation("a+");break}case ArticulationEnum.naturalharmonic:{y=new VF$c.Articulation("ah");break}case ArticulationEnum.snappizzicato:{y=new VF$c.Articulation("ao");break}case ArticulationEnum.staccatissimo:{y=new VF$c.Articulation("av");break}case ArticulationEnum.staccato:{y=new VF$c.Articulation("a.");break}case ArticulationEnum.tenuto:{y=new VF$c.Articulation("a-");break}case ArticulationEnum.upbow:{y=new VF$c.Articulation("a|"),m.placement===void 0&&(d=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.strongaccent:{y=new VF$c.Articulation("a^");break}}y&&(!e.hasStem()&&!e.isRest()&&b==ArticulationEnum.accent&&e.getLineNumber()>=3&&(d=VF$c.Modifier.Position.ABOVE,(o=(s=e==null?void 0:e.modifiers)==null?void 0:s.filter(P=>["TREMOLO"].includes(P.getCategory().toLocaleUpperCase())))!=null&&o.length&&y.setYShift(-16)),b===ArticulationEnum.strongaccent&&(d=VF$c.Modifier.Position.ABOVE,(a=window.GYM)!=null&&a.customArtPosition&&(e.getStemDirection()===1?d=VF$c.Modifier.Position.ABOVE:(d=VF$c.Modifier.Position.BELOW,y=new VF$c.Articulation("a|")))),(l=window.GYM)!=null&&l.customAccentItem&&b===ArticulationEnum.accent&&(d=VF$c.Modifier.Position.ABOVE),(c=window.GYM)!=null&&c.customLefthandpizzicatoItem&&(b===ArticulationEnum.lefthandpizzicato||b===ArticulationEnum.naturalharmonic)&&(d=VF$c.Modifier.Position.ABOVE),b===ArticulationEnum.tenuto&&e.getDuration()==="w"&&((u=window.GYM)!=null&&u.customTenutoItem)&&(d=VF$c.Modifier.Position.ABOVE),y.setPosition(d),e.addModifier(0,y))}}static generateOrnaments(e,t){let r=VF$c.Modifier.Position.ABOVE;t.placement===PlacementEnum.Below&&(r=VF$c.Modifier.Position.BELOW);let s;switch(t.GetOrnament){case OrnamentEnum.DelayedInvertedTurn:{s=new VF$c.Ornament("turn_inverted"),s.setDelayed(!0);break}case OrnamentEnum.DelayedTurn:{s=new VF$c.Ornament("turn"),s.setDelayed(!0);break}case OrnamentEnum.InvertedMordent:{s=new VF$c.Ornament("mordent"),s.setDelayed(!1);break}case OrnamentEnum.InvertedTurn:{s=new VF$c.Ornament("turn_inverted"),s.setDelayed(!1);break}case OrnamentEnum.Mordent:{s=new VF$c.Ornament("mordent_inverted"),s.setDelayed(!1);break}case OrnamentEnum.Trill:{s=new VF$c.Ornament("tr"),s.setDelayed(!1);break}case OrnamentEnum.Turn:{s=new VF$c.Ornament("turn"),s.setDelayed(!1);break}default:{log$2.warn("unhandled OrnamentEnum type: "+t.GetOrnament);return}}s&&(t.AccidentalBelow!==AccidentalEnum.NONE&&s.setLowerAccidental(Pitch.accidentalVexflow(t.AccidentalBelow)),t.AccidentalAbove!==AccidentalEnum.NONE&&s.setUpperAccidental(Pitch.accidentalVexflow(t.AccidentalAbove)),s.setPosition(r),e.addModifier(0,s))}static StrokeTypeFromArpeggioType(e){switch(e){case ArpeggioType.ARPEGGIO_DIRECTIONLESS:return VF$c.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case ArpeggioType.BRUSH_DOWN:return VF$c.Stroke.Type.BRUSH_UP;case ArpeggioType.BRUSH_UP:return VF$c.Stroke.Type.BRUSH_DOWN;case ArpeggioType.RASQUEDO_DOWN:return VF$c.Stroke.Type.RASQUEDO_UP;case ArpeggioType.RASQUEDO_UP:return VF$c.Stroke.Type.RASQUEDO_DOWN;case ArpeggioType.ROLL_DOWN:return VF$c.Stroke.Type.ROLL_UP;case ArpeggioType.ROLL_UP:return VF$c.Stroke.Type.ROLL_DOWN;default:return VF$c.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}static CreateTabNote(e){const t=[],r=e.notes.reverse(),s=[],o=e.notes[0].graphicalNoteLength,a=e.notes[0].sourceNote.NoteTuplet!==void 0;let l=rt.durations(o,a)[0],c=0;for(const m of e.notes){const d=m.sourceNote,y={str:d.StringNumberTab,fret:d.FretNumber};t.push(y),d.BendArray&&d.BendArray.forEach(function(b){let S;const A=b.bendalter-y.fret;A>1?S="Full":A===1?S="1/2":S="1/4",b.direction==="up"?s.push({type:VF$c.Bend.UP,text:S,width:10}):s.push({type:VF$c.Bend.DOWN,text:S,width:10})}),c(i[i.VA8=0]="VA8",i[i.VB8=1]="VB8",i[i.MA15=2]="MA15",i[i.MB15=3]="MB15",i[i.NONE=4]="NONE",i))(OctaveEnum||{});class AbstractTempoExpression extends AbstractExpression{constructor(e,t,r,s){super(t),this.label=e,this.staffNumber=r,this.parentMultiTempoExpression=s}get Label(){return this.label}set Label(e){this.label=e}get Placement(){return this.placement}set Placement(e){this.placement=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}static isStringInStringList(e,t){for(const r of e)if(AbstractTempoExpression.stringContainsSeparatedWord(t.toLowerCase().trim(),r.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(e,t){return e===t||e.indexOf(" "+t)!==-1||e.indexOf(t+" ")!==-1}}const _InstantaneousTempoExpression=class we extends AbstractTempoExpression{constructor(e,t,r,s,o,a=!1){super(e,t,r,o),this.setTempoAndTempoType(s)}static getDefaultValueForTempoType(e){switch(e){case 1:return 20;case 2:return 30;case 3:return 48;case 4:return 52;case 5:return 63;case 6:return 70;case 7:return 75;case 8:return 88;case 9:return 92;case 10:return 96;case 11:return 106;case 12:return 112;case 13:return 118;case 14:return 130;case 15:return 140;case 16:return 155;case 17:return 170;case 18:return 184;case 19:return 200;default:throw new ArgumentOutOfRangeException("tempoEnum")}}static isInputStringInstantaneousTempo(e){return e?we.isStringInStringList(we.listInstantaneousTempoLarghissimo,e)||we.isStringInStringList(we.listInstantaneousTempoGrave,e)||we.isStringInStringList(we.listInstantaneousTempoLento,e)||we.isStringInStringList(we.listInstantaneousTempoLargo,e)||we.isStringInStringList(we.listInstantaneousTempoLarghetto,e)||we.isStringInStringList(we.listInstantaneousTempoAdagio,e)||we.isStringInStringList(we.listInstantaneousTempoAdagietto,e)||we.isStringInStringList(we.listInstantaneousTempoAndanteModerato,e)||we.isStringInStringList(we.listInstantaneousTempoAndante,e)||we.isStringInStringList(we.listInstantaneousTempoAndantino,e)||we.isStringInStringList(we.listInstantaneousTempoModerato,e)||we.isStringInStringList(we.listInstantaneousTempoAllegretto,e)||we.isStringInStringList(we.listInstantaneousTempoAllegroModerato,e)||we.isStringInStringList(we.listInstantaneousTempoAllegro,e)||we.isStringInStringList(we.listInstantaneousTempoVivace,e)||we.isStringInStringList(we.listInstantaneousTempoVivacissimo,e)||we.isStringInStringList(we.listInstantaneousTempoAllegrissimo,e)||we.isStringInStringList(we.listInstantaneousTempoPresto,e)||we.isStringInStringList(we.listInstantaneousTempoPrestissimo,e)||we.isStringInStringList(we.listInstantaneousTempoChangesGeneral,e):!1}get Label(){return this.label}set Label(e){this.label=e}get Placement(){return this.placement}set Placement(e){this.placement=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get Enum(){return this.tempoEnum}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(e){this.tempoInBpm=e}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}getAbsoluteTimestamp(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}getAbsoluteFloatTimestamp(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}setTempoAndTempoType(e){if(!this.label){this.tempoInBpm=e,this.tempoEnum=23;return}if(we.isStringInStringList(we.listInstantaneousTempoLarghissimo,this.label)){e===0&&(e=we.getDefaultValueForTempoType(1)),this.tempoInBpm=e,this.tempoEnum=1;return}if(we.isStringInStringList(we.listInstantaneousTempoGrave,this.label)){e===0&&(e=we.getDefaultValueForTempoType(2)),this.tempoInBpm=e,this.tempoEnum=2;return}if(we.isStringInStringList(we.listInstantaneousTempoLento,this.label)){e===0&&(e=we.getDefaultValueForTempoType(3)),this.tempoInBpm=e,this.tempoEnum=3;return}if(we.isStringInStringList(we.listInstantaneousTempoLargo,this.label)){e===0&&(e=we.getDefaultValueForTempoType(4)),this.tempoInBpm=e,this.tempoEnum=4;return}if(we.isStringInStringList(we.listInstantaneousTempoLarghetto,this.label)){e===0&&(e=we.getDefaultValueForTempoType(5)),this.tempoInBpm=e,this.tempoEnum=5;return}if(we.isStringInStringList(we.listInstantaneousTempoAdagio,this.label)){e===0&&(e=we.getDefaultValueForTempoType(6)),this.tempoInBpm=e,this.tempoEnum=6;return}if(we.isStringInStringList(we.listInstantaneousTempoAdagietto,this.label)){e===0&&(e=we.getDefaultValueForTempoType(7)),this.tempoInBpm=e,this.tempoEnum=7;return}if(we.isStringInStringList(we.listInstantaneousTempoAndanteModerato,this.label)){e===0&&(e=we.getDefaultValueForTempoType(8)),this.tempoInBpm=e,this.tempoEnum=8;return}if(we.isStringInStringList(we.listInstantaneousTempoAndante,this.label)){e===0&&(e=we.getDefaultValueForTempoType(9)),this.tempoInBpm=e,this.tempoEnum=9;return}if(we.isStringInStringList(we.listInstantaneousTempoAndantino,this.label)){e===0&&(e=we.getDefaultValueForTempoType(10)),this.tempoInBpm=e,this.tempoEnum=10;return}if(we.isStringInStringList(we.listInstantaneousTempoModerato,this.label)){e===0&&(e=we.getDefaultValueForTempoType(11)),this.tempoInBpm=e,this.tempoEnum=11;return}if(we.isStringInStringList(we.listInstantaneousTempoAllegretto,this.label)){e===0&&(e=we.getDefaultValueForTempoType(12)),this.tempoInBpm=e,this.tempoEnum=12;return}if(we.isStringInStringList(we.listInstantaneousTempoAllegroModerato,this.label)){e===0&&(e=we.getDefaultValueForTempoType(13)),this.tempoInBpm=e,this.tempoEnum=13;return}if(we.isStringInStringList(we.listInstantaneousTempoAllegro,this.label)){e===0&&(e=we.getDefaultValueForTempoType(14)),this.tempoInBpm=e,this.tempoEnum=14;return}if(we.isStringInStringList(we.listInstantaneousTempoVivace,this.label)){e===0&&(e=we.getDefaultValueForTempoType(15)),this.tempoInBpm=e,this.tempoEnum=15;return}if(we.isStringInStringList(we.listInstantaneousTempoVivacissimo,this.label)){e===0&&(e=we.getDefaultValueForTempoType(16)),this.tempoInBpm=e,this.tempoEnum=16;return}if(we.isStringInStringList(we.listInstantaneousTempoAllegrissimo,this.label)){e===0&&(e=we.getDefaultValueForTempoType(17)),this.tempoInBpm=e,this.tempoEnum=17;return}if(we.isStringInStringList(we.listInstantaneousTempoPresto,this.label)){e===0&&(e=we.getDefaultValueForTempoType(18)),this.tempoInBpm=e,this.tempoEnum=18;return}if(we.isStringInStringList(we.listInstantaneousTempoPrestissimo,this.label)){e===0&&(e=we.getDefaultValueForTempoType(19)),this.tempoInBpm=e,this.tempoEnum=19;return}if(we.isStringInStringList(we.listInstantaneousTempoAddons,this.label)){this.tempoInBpm=0,this.tempoEnum=21;return}if(we.isStringInStringList(we.listInstantaneousTempoChangesGeneral,this.label)){this.tempoInBpm=0,this.tempoEnum=22;return}}};_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo=["Larghissimo","Sehr breit","very, very slow"];_InstantaneousTempoExpression.listInstantaneousTempoGrave=["Grave","Schwer","slow and solemn"];_InstantaneousTempoExpression.listInstantaneousTempoLento=["Lento","Lent","Langsam","slowly"];_InstantaneousTempoExpression.listInstantaneousTempoLargo=["Largo","Breit","broadly"];_InstantaneousTempoExpression.listInstantaneousTempoLarghetto=["Larghetto","Etwas breit","rather broadly"];_InstantaneousTempoExpression.listInstantaneousTempoAdagio=["Adagio","Langsam","Ruhig","slow and stately"];_InstantaneousTempoExpression.listInstantaneousTempoAdagietto=["Adagietto","Ziemlich ruhig","Ziemlich langsam","rather slow"];_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato=["Andante moderato"];_InstantaneousTempoExpression.listInstantaneousTempoAndante=["Andante","Gehend","Schreitend","at a walking pace"];_InstantaneousTempoExpression.listInstantaneousTempoAndantino=["Andantino"];_InstantaneousTempoExpression.listInstantaneousTempoModerato=["Moderato","Mäßig","Mod�r�","moderately"];_InstantaneousTempoExpression.listInstantaneousTempoAllegretto=["Allegretto","fast"];_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato=["Allegro moderato"];_InstantaneousTempoExpression.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fr�hlich"];_InstantaneousTempoExpression.listInstantaneousTempoVivace=["Vivace","Lebhaft","Lebendig","lively and fast"];_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo=["Vivacissimo","Sehr lebhaft","Sehr lebendig"];_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo=["Allegrissimo","very fast"];_InstantaneousTempoExpression.listInstantaneousTempoPresto=["Presto","Sehr schnell","Geschwind"];_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo=["Prestissimo","äußerst schnell"];_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral=["tempo primo","a tempo","tempo i","rubato","doppio movimento"];_InstantaneousTempoExpression.listInstantaneousTempoAddons=["assai","amoroso","cantabile","con brio","con dolore","con espressione","con fuoco","con moto","con spirito","spiritoso","espressivo","giocoso","giusto","grazioso","lesto","lugubre","maestoso","ma non troppo","marcato","molto","morendo","mosso","non tanto","piu","un poco","poco","quasi","risoluto","scherzando","sostenuto","teneramente","tempo giusto","tranquillo","sehr","lieblich","liebevoll","mit Leidenschaft","mit Liebe","amourös","gesanglich","mit Schwung","mit Feuer","mit Schmerz","mit Ausdruck","mit Bewegung","geistvoll","ausdrucksvoll","freudig","verspielt","angemessen","graziös","mit Grazie","flink","behände","traurig","klagend","majestätisch","aber nicht zu sehr","markant","gemäßigt","viel","sehr","ersterbend","bewegt","nicht zu sehr","mehr","ein wenig","gleichsam","entschlossen","zupackend","heiter","nachdrücklich","getragen","gewichtig","zart","zärtlich","im angemessenen Zeitmaß","ruhig","ein wenig","alla marcia","ad libitum","alla breve"];let InstantaneousTempoExpression=_InstantaneousTempoExpression;var TempoEnum=(i=>(i[i.none=0]="none",i[i.larghissimo=1]="larghissimo",i[i.grave=2]="grave",i[i.lento=3]="lento",i[i.largo=4]="largo",i[i.larghetto=5]="larghetto",i[i.adagio=6]="adagio",i[i.adagietto=7]="adagietto",i[i.andanteModerato=8]="andanteModerato",i[i.andante=9]="andante",i[i.andantino=10]="andantino",i[i.moderato=11]="moderato",i[i.allegretto=12]="allegretto",i[i.allegroModerato=13]="allegroModerato",i[i.allegro=14]="allegro",i[i.vivace=15]="vivace",i[i.vivacissimo=16]="vivacissimo",i[i.allegrissimo=17]="allegrissimo",i[i.presto=18]="presto",i[i.prestissimo=19]="prestissimo",i[i.lastRealTempo=20]="lastRealTempo",i[i.addon=21]="addon",i[i.changes=22]="changes",i[i.metronomeMark=23]="metronomeMark",i))(TempoEnum||{});const _MoodExpression=class Ae extends AbstractExpression{constructor(e,t,r){super(t),this.label=e,this.staffNumber=r,this.setMoodType()}static isInputStringMood(e){return e?Ae.isStringInStringList(Ae.listMoodAffettuoso,e)||Ae.isStringInStringList(Ae.listMoodAgitato,e)||Ae.isStringInStringList(Ae.listMoodAnimato,e)||Ae.isStringInStringList(Ae.listMoodAppassionato,e)||Ae.isStringInStringList(Ae.listMoodBrillante,e)||Ae.isStringInStringList(Ae.listMoodCantabile,e)||Ae.isStringInStringList(Ae.listMoodDolce,e)||Ae.isStringInStringList(Ae.listMoodEnergico,e)||Ae.isStringInStringList(Ae.listMoodEroico,e)||Ae.isStringInStringList(Ae.listMoodEspressivo,e)||Ae.isStringInStringList(Ae.listMoodFurioso,e)||Ae.isStringInStringList(Ae.listMoodGiocoso,e)||Ae.isStringInStringList(Ae.listMoodGioioso,e)||Ae.isStringInStringList(Ae.listMoodGrandioso,e)||Ae.isStringInStringList(Ae.listMoodGrazioso,e)||Ae.isStringInStringList(Ae.listMoodLacrimoso,e)||Ae.isStringInStringList(Ae.listMoodLeggiero,e)||Ae.isStringInStringList(Ae.listMoodMaestoso,e)||Ae.isStringInStringList(Ae.listMoodMalinconico,e)||Ae.isStringInStringList(Ae.listMoodMarcato,e)||Ae.isStringInStringList(Ae.listMoodMarziale,e)||Ae.isStringInStringList(Ae.listMoodMesto,e)||Ae.isStringInStringList(Ae.listMoodMorendo,e)||Ae.isStringInStringList(Ae.listMoodNobilmente,e)||Ae.isStringInStringList(Ae.listMoodPatetico,e)||Ae.isStringInStringList(Ae.listMoodPesante,e)||Ae.isStringInStringList(Ae.listMoodSaltando,e)||Ae.isStringInStringList(Ae.listMoodSautille,e)||Ae.isStringInStringList(Ae.listMoodScherzando,e)||Ae.isStringInStringList(Ae.listMoodSostenuto,e)||Ae.isStringInStringList(Ae.listMoodSpiccato,e)||Ae.isStringInStringList(Ae.listMoodTenerezza,e)||Ae.isStringInStringList(Ae.listMoodTranquillamente,e)||Ae.isStringInStringList(Ae.listMoodTrionfante,e):!1}get Label(){return this.label}set Label(e){this.label=e}get Mood(){return this.moodType}set Mood(e){this.moodType=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get Placement(){return this.placement}set Placement(e){this.placement=e}setMoodType(){Ae.isStringInStringList(Ae.listMoodAffettuoso,this.label)?this.moodType=0:Ae.isStringInStringList(Ae.listMoodAgitato,this.label)?this.moodType=1:Ae.isStringInStringList(Ae.listMoodAnimato,this.label)?this.moodType=3:Ae.isStringInStringList(Ae.listMoodAppassionato,this.label)?this.moodType=2:Ae.isStringInStringList(Ae.listMoodBrillante,this.label)?this.moodType=4:Ae.isStringInStringList(Ae.listMoodCantabile,this.label)?this.moodType=5:Ae.isStringInStringList(Ae.listMoodDolce,this.label)?this.moodType=6:Ae.isStringInStringList(Ae.listMoodEnergico,this.label)?this.moodType=7:Ae.isStringInStringList(Ae.listMoodEroico,this.label)?this.moodType=8:Ae.isStringInStringList(Ae.listMoodEspressivo,this.label)?this.moodType=9:Ae.isStringInStringList(Ae.listMoodFurioso,this.label)?this.moodType=10:Ae.isStringInStringList(Ae.listMoodGiocoso,this.label)?this.moodType=11:Ae.isStringInStringList(Ae.listMoodGioioso,this.label)?this.moodType=12:Ae.isStringInStringList(Ae.listMoodGrandioso,this.label)?this.moodType=14:Ae.isStringInStringList(Ae.listMoodGrazioso,this.label)?this.moodType=15:Ae.isStringInStringList(Ae.listMoodLacrimoso,this.label)?this.moodType=13:Ae.isStringInStringList(Ae.listMoodLeggiero,this.label)?this.moodType=16:Ae.isStringInStringList(Ae.listMoodMaestoso,this.label)?this.moodType=17:Ae.isStringInStringList(Ae.listMoodMalinconico,this.label)?this.moodType=18:Ae.isStringInStringList(Ae.listMoodMarcato,this.label)?this.moodType=19:Ae.isStringInStringList(Ae.listMoodMarziale,this.label)?this.moodType=20:Ae.isStringInStringList(Ae.listMoodMesto,this.label)?this.moodType=21:Ae.isStringInStringList(Ae.listMoodMorendo,this.label)?this.moodType=22:Ae.isStringInStringList(Ae.listMoodNobilmente,this.label)?this.moodType=23:Ae.isStringInStringList(Ae.listMoodPatetico,this.label)?this.moodType=24:Ae.isStringInStringList(Ae.listMoodPesante,this.label)?this.moodType=25:Ae.isStringInStringList(Ae.listMoodSaltando,this.label)?this.moodType=27:Ae.isStringInStringList(Ae.listMoodSautille,this.label)?this.moodType=26:Ae.isStringInStringList(Ae.listMoodScherzando,this.label)?this.moodType=28:Ae.isStringInStringList(Ae.listMoodSostenuto,this.label)?this.moodType=29:Ae.isStringInStringList(Ae.listMoodSpiccato,this.label)?this.moodType=30:Ae.isStringInStringList(Ae.listMoodTenerezza,this.label)?this.moodType=31:Ae.isStringInStringList(Ae.listMoodTranquillamente,this.label)?this.moodType=32:Ae.isStringInStringList(Ae.listMoodTrionfante,this.label)&&(this.moodType=33)}};_MoodExpression.listMoodAffettuoso=["affettuoso"];_MoodExpression.listMoodAgitato=["agitato"];_MoodExpression.listMoodAppassionato=["appassionato"];_MoodExpression.listMoodAnimato=["animato","lively"];_MoodExpression.listMoodBrillante=["brillante"];_MoodExpression.listMoodCantabile=["cantabile"];_MoodExpression.listMoodDolce=["dolce"];_MoodExpression.listMoodEnergico=["energico"];_MoodExpression.listMoodEroico=["eroico"];_MoodExpression.listMoodEspressivo=["espressivo"];_MoodExpression.listMoodFurioso=["furioso"];_MoodExpression.listMoodGiocoso=["giocoso"];_MoodExpression.listMoodGioioso=["gioioso"];_MoodExpression.listMoodLacrimoso=["lacrimoso"];_MoodExpression.listMoodGrandioso=["grandioso"];_MoodExpression.listMoodGrazioso=["grazioso"];_MoodExpression.listMoodLeggiero=["leggiero"];_MoodExpression.listMoodMaestoso=["maestoso"];_MoodExpression.listMoodMalinconico=["malinconico"];_MoodExpression.listMoodMarcato=["marcato"];_MoodExpression.listMoodMarziale=["marziale"];_MoodExpression.listMoodMesto=["mesto"];_MoodExpression.listMoodMorendo=["morendo"];_MoodExpression.listMoodNobilmente=["nobilmente"];_MoodExpression.listMoodPatetico=["patetico"];_MoodExpression.listMoodPesante=["pesante"];_MoodExpression.listMoodSautille=["sautille"];_MoodExpression.listMoodSaltando=["saltando"];_MoodExpression.listMoodScherzando=["scherzando"];_MoodExpression.listMoodSostenuto=["sostenuto"];_MoodExpression.listMoodSpiccato=["spiccato"];_MoodExpression.listMoodTenerezza=["tenerezza"];_MoodExpression.listMoodTranquillamente=["tranquillamente"];_MoodExpression.listMoodTrionfante=["trionfante"];let MoodExpression=_MoodExpression;class UnknownExpression extends AbstractExpression{constructor(e,t,r,s){super(t),this.label=e,this.staffNumber=s,r===void 0&&(r=TextAlignmentEnum.LeftBottom),this.textAlignment=r}get Label(){return this.label}get Placement(){return this.placement}set Placement(e){this.placement=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get TextAlignment(){return this.textAlignment}}class MultiExpression{constructor(e,t){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=e,this.timestamp=t}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(e){this.sourceMeasure=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get AbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}get InstantaneousDynamic(){return this.instantaneousDynamic}set InstantaneousDynamic(e){this.instantaneousDynamic=e}get EndingContinuousDynamic(){return this.endingContinuousDynamic}set EndingContinuousDynamic(e){this.endingContinuousDynamic=e}get StartingContinuousDynamic(){return this.startingContinuousDynamic}set StartingContinuousDynamic(e){this.startingContinuousDynamic=e}get MoodList(){return this.moodList}get UnknownList(){return this.unknownList}get EntriesList(){return this.expressions}get OctaveShiftStart(){return this.octaveShiftStart}set OctaveShiftStart(e){this.octaveShiftStart=e}get OctaveShiftEnd(){return this.octaveShiftEnd}set OctaveShiftEnd(e){this.octaveShiftEnd=e}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(e){this.combinedExpressionsText=e}getPlacementOfFirstEntry(){let e=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof InstantaneousDynamicExpression?e=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof ContinuousDynamicExpression?e=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof MoodExpression?e=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof UnknownExpression&&(e=this.expressions[0].expression.Placement)),e}getFontstyleOfFirstEntry(){var t;let e=FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof ContinuousDynamicExpression||this.expressions[0].expression instanceof MoodExpression?e=FontStyles.Italic:this.expressions[0].expression instanceof UnknownExpression&&(e=(t=this.expressions[0].expression.fontStyle)!=null?t:FontStyles.Regular)),e}addExpression(e,t){e instanceof InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=e,this.instantaneousDynamic.ParentMultiExpression=this):e instanceof ContinuousDynamicExpression?this.startingContinuousDynamic=e:e instanceof MoodExpression?this.moodList.push(e):e instanceof UnknownExpression&&this.unknownList.push(e),this.addExpressionToEntryList(e,t)}CompareTo(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue=5&&e<=12}get TempoType(){return this.tempoType}set TempoType(e){this.tempoType=e}get StartTempo(){return this.startTempo}set StartTempo(e){this.startTempo=e}get EndTempo(){return this.endTempo}set EndTempo(e){this.endTempo=e}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(e){this.absoluteEndTimestamp=e}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(e){const t=Fraction$1.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(e.lt(t))return-1;if(this.absoluteEndTimestamp.lt(e))return-2;const r=Fraction$1.minus(e,t).RealValue/Fraction$1.minus(this.absoluteEndTimestamp,t).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*r))}setTempoType(){wt.isStringInStringList(wt.listContinuousTempoFaster,this.label)?this.tempoType=0:wt.isStringInStringList(wt.listContinuousTempoSlower,this.label)&&(this.tempoType=9)}};_ContinuousTempoExpression.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"];_ContinuousTempoExpression.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","rallentando","ritardando","ritenuto","ritard.","ritard","riten.","riten"];let ContinuousTempoExpression=_ContinuousTempoExpression;class MultiTempoExpression{constructor(e,t){this.expressions=[],this.sourceMeasure=e,this.timestamp=t}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return Fraction$1.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(e){this.sourceMeasure=e}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(e){this.combinedExpressionsText=e}getPlacementOfFirstEntry(){let e=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof InstantaneousTempoExpression?e=this.expressions[0].Expression.Placement:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(e=this.expressions[0].Expression.Placement)),e}getFontstyleOfFirstEntry(){let e=FontStyles.Regular;return this.expressions[0].Expression instanceof InstantaneousTempoExpression?e=FontStyles.Bold:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(e=FontStyles.Italic),e}addExpression(e,t){if(this.checkIfAlreadyExists(e))return;e instanceof InstantaneousTempoExpression?this.instantaneousTempo=e:e instanceof ContinuousTempoExpression&&(this.continuousTempo=e);const r=new TempoExpressionEntry;r.prefix=t,r.Expression=e,r.label=e.Label,this.expressions.push(r)}CompareTo(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return this.musicSystems}calculateSystemYLayout(){for(const e of this.musicSystems)this.optimizeDistanceBetweenStaffLines(e);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(e,t,r,s){for(let o=0,a=e.length;o0&&(l.beginInstructionsWidth=r),s>0&&(l.endInstructionsWidth=s)}}finalizeCurrentAndCreateNewSystem(e,t=!1,r=!0,s=!1){this.finalizeCurrentSystem(e,t,r,s),this.currentSystemParams=new SystemBuildParameters,e!==void 0&&this.measureListIndex=1){const t=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let r=0;const s=e[e.length-1];s.endLine===SystemLinesEnum.DotsBoldBoldDots&&(s.endLine=SystemLinesEnum.DotsThinBold,r=t[0].getLineWidth(SystemLinesEnum.DotsBoldBoldDots)/2-t[0].getLineWidth(SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=r;for(let o=0,a=t.length;o1){a=!0;break}}let l=0;for(let c=0;c=0&&this.measureList[R]){const M=(_=this.measureList[R][0])==null?void 0:_.parentSourceMeasure;M!=null&&M.ImplicitMeasure&&(M!=null&&M.RhythmPrinted)&&(T=!1)}T&&(t.addRhythmAtBegin(u),t.parentSourceMeasure.RhythmPrinted=u,b=!0)}return(d||y||b)&&(a+=t.beginInstructionsWidth,b&&(a+=this.rules.RhythmRightMargin)),a}addInstructionsAtMeasureEnd(e,t,r){if(!e||!e.Instructions||e.Instructions.length===0)return 0;for(let s=0,o=e.Instructions.length;s0&&(this.currentSystemParams.systemMeasures.push({beginLine:SystemLinesEnum.None,endLine:SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=s,this.currentSystemParams.currentSystemFixWidth+=s)}addExtraInstructionMeasure(e,t,r){const s=this.currentSystemParams.currentSystem,o=MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(s.StaffLines[e]);t&&o.addKeyAtBegin(t,this.activeKeys[e],this.activeClefs[e]),r!==void 0&&r.PrintObject&&o.addRhythmAtBegin(r),o.PositionAndShape.BorderLeft=0,o.PositionAndShape.BorderTop=0,o.PositionAndShape.BorderBottom=this.rules.StaffHeight;const a=this.rules.MeasureLeftMargin+o.beginInstructionsWidth+this.rules.MeasureRightMargin;return o.PositionAndShape.BorderRight=a,s.StaffLines[e].Measures.push(o),a}addStaveMeasuresToSystem(e){if(e[0]){const t=[];for(let s=0;s1){const l=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,e.measureListIndex+e.multipleRestMeasures-1);e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[l]}}finally{}const t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,r=t[this.measureListIndex];let s=!1;return r.allRests&&(s=(a=(o=t[this.measureListIndex+r.multipleRestMeasures-1])==null?void 0:o.endsWithLineRepetition)==null?void 0:a.call(o)),this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||s?SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?SystemLinesEnum.DoubleThin:e&&e.endingBarStyleEnum!==void 0?e.endingBarStyleEnum:SystemLinesEnum.SingleThin}getLineWidth(e,t,r){let s=e.getLineWidth(t);return t===SystemLinesEnum.DotsBoldBoldDots&&(s/=2),r&&t===SystemLinesEnum.BoldThinDots&&(s+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),s}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let e=0,t=this.measureList[this.measureListIndex-1].length;e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[e])return!1;for(let t=0,r=this.measureList[e].length;t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||e>this.measureList.length-1)return!1;for(let t=0,r=this.measureList[e].length;t1)for(let l=1;lo&&(o=m)}for(let l=0;lthis.rules.PageHeight-this.rules.PageBottomMargin&&(s++,s<=4&&console.log("warning: could not fit a single system on page ".concat(e.PageNumber," and measure number ").concat(r.GraphicalMeasures[0][0].MeasureNumber,'.\n The PageFormat may be too small for this sheet."\n Will not give further warnings for all pages, only total.')))}else{const c=this.musicSystems[l-1],u=c.StaffLines[c.StaffLines.length-1],m=u.PositionAndShape;let d=this.findRequiredDistanceWithSkyBottomLine(c,r);d=Math.max(o,d),d+=this.rules.MinSkyBottomDistBetweenSystems,((a=window==null?void 0:window.appName)==null?void 0:a.toLocaleUpperCase())==="GYM"&&(d=d<16?16:d);const y=this.hasExpressionCounts(r);y.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(d+=2),y.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(d+=2),d=Math.max(d,this.rules.MinimumDistanceBetweenSystems+u.StaffHeight);const b=t+m.RelativePosition.y+d,S=b+r.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&c.breaksPage)&&S0&&console.log("total amount of pages that couldn't fit a single music system: ".concat(s," of ").concat(e.PageNumber))}findRequiredDistanceWithSkyBottomLine(e,t){const r=e.StaffLines[e.StaffLines.length-1],s=t.StaffLines[0],o=r.BottomLine,a=s.SkyLine,l=r.PositionAndShape,c=s.PositionAndShape,u=1/this.rules.SamplingUnit;let m=0;for(let d=0;d=a.length)break;const S=Math.max(0,b-6),A=Math.min(a.length-1,b+6);let P=0;for(let E=S;E<=A;E++)P=Math.min(P,a[E]);const x=y-P;m=Math.max(x,m)}return m===0&&(m=l.BorderBottom-c.BorderTop),m}}class SystemBuildParameters{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return this.systemMeasureIndex===0}}class OctaveShiftParams{constructor(e,t,r){this.getOpenOctaveShift=e,this.getAbsoluteStartTimestamp=t,this.getAbsoluteEndTimestamp=r}}class AccidentalCalculator{constructor(){this.keySignatureNoteAlterationsDict=new Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new Dictionary}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(e){this.activeKeyInstruction=e,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(const e of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(e,this.keySignatureNoteAlterationsDict.getValue(e))}checkAccidental(e,t){if(!t)return;const r=t.FundamentalNote+t.Octave*12,s=this.currentAlterationsComparedToKeyInstructionList.indexOf(r)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(r)){if(s&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(r),1),this.currentInMeasureNoteAlterationsDict.getValue(r)!==t.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(r)&&this.keySignatureNoteAlterationsDict.getValue(r)!==t.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(r),this.currentInMeasureNoteAlterationsDict.setValue(r,t.AccidentalHalfTones)):t.Accidental!==AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(r);const o=this.currentInMeasureNoteAlterationsDict.getValue(r);if(t.Accidental===AccidentalEnum.NONE&&(Math.abs(o)===.5?t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NONE):t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NATURAL)),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t)}}else if(t.Accidental!==AccidentalEnum.NONE){if(s||this.currentAlterationsComparedToKeyInstructionList.push(r),this.currentInMeasureNoteAlterationsDict.setValue(r,t.AccidentalHalfTones),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t)}else s&&(t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(r),1),MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t))}isAlterAmbiguousAccidental(e){return e===AccidentalEnum.SLASHFLAT||e===AccidentalEnum.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const e=this.activeKeyInstruction.AlteratedNotes;let t;this.activeKeyInstruction.Key>0?t=AccidentalEnum.SHARP:t=AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let r=-9;r<9;r++)for(let s=0;s0?(r=m-1,e.push({startIndex:t,endIndex:r}),t=m):b.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(r=m,e.push({startIndex:t,endIndex:r}),t=m+1)}t0?Number(O):6,C===O||T+D>A&&C%2===0?(o.push(C),T=M,C=1):C++}else T>A?(o.push(C),T=M,C=1):C++;M>A?H=R+1:H=Math.ceil(H),E===H?_+=1:(s.push(_),E=H,_=1)}s.push(_),o.push(C),o=o.filter(Boolean)}return o.length>1&&o[o.length-1]===1&&(o[o.length-2]=o[o.length-2]-1,o[o.length-1]=o[o.length-1]+1),console.log(o,s),this.buildPreparedMusicSystems(o)}buildPreparedMusicSystems(e){let t=!1;this.currentSystemParams=new SystemBuildParameters,this.currentSystemParams.currentSystem=this.initMusicSystem();for(let r=0,s=this.measureList.length;r0&&this.rules.RenderMultipleRestMeasures){d.isReducedToMultiRest=!0,d.multipleRestMeasureNumber=1;const b=d.multipleRestMeasures-1;u+=b;for(let S=1;S<=b;S++){const A=e.SourceMeasures[d.MeasureNumber-1+S];A.multipleRestMeasureNumber=S+1,A.isReducedToMultiRest=!0,t.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let u,m=0;for(let d=0,y=e.SourceMeasures.length;d0){u.isReducedToMultiRest=!0,u.multipleRestMeasureNumber=1,m++,b.multipleRestMeasureNumber=m,b.isReducedToMultiRest=!0;for(let S=0;S1){u.multipleRestMeasures=m;const S=this.createGraphicalMeasuresForSourceMeasure(u,r,o,l,s);t[u.measureListIndex]=S,m=0,u=void 0}else m=0,u=void 0}if(m>1){u.multipleRestMeasures=m,u.isReducedToMultiRest=!0;const d=this.createGraphicalMeasuresForSourceMeasure(u,r,o,l,s);t[u.measureListIndex]=d,m=0,u=void 0}}const c=s.map(u=>u.ClefType===ClefEnum.percussion);this.handleStaffEntries(c),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()}calculate(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}calculateXLayout(e,t){let r=0;const s=this.rules.MaxInstructionsConstValue;if(this.graphicalMusicSheet.MeasureList.length>0){let o=this.graphicalMusicSheet.MeasureList[0],a=this.calculateMeasureXLayout(o);a=this.calculateMeasureWidthFromStaffEntries(o,a),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(o,a),r=a*1.2+t+s;for(let l=1;l0)return;const a=t.Measures[o];(a.MeasureNumber===0||a.MeasureNumber===1)&&(r=a.MeasureNumber),a!==t.Measures[0]&&this.rules.MeasureNumberLabelXOffset?s=this.rules.MeasureNumberLabelXOffset:s=0;const l=this.rules.UseXMLMeasureNumbers&&a.MeasureNumber===1&&a.parentSourceMeasure.getPrintedMeasureNumber()!==1;((a.MeasureNumber===r||a.MeasureNumber>=r+this.rules.MeasureNumberLabelOffset)&&!a.parentSourceMeasure.ImplicitMeasure||l)&&((a.MeasureNumber!==1||a.MeasureNumber===1&&a!==t.Measures[0]||l)&&this.calculateSingleMeasureNumberPlacement(a,t,e,s),r=a.MeasureNumber)}}calculateSingleMeasureNumberPlacement(e,t,r,s=0){const o=e.parentSourceMeasure.getPrintedMeasureNumber().toString(),a=new Label(o),l=new GraphicalLabel(a,this.rules.MeasureNumberLabelHeight,TextAlignmentEnum.LeftBottom,this.rules),c=t.SkyBottomLineCalculator;l.setLabelPositionAndShapeBorders(),l.PositionAndShape.Parent=r.PositionAndShape;const u=t.PositionAndShape.RelativePosition.x+e.PositionAndShape.RelativePosition.x-l.PositionAndShape.BorderMarginLeft+s;let m,d=u,y=u-l.PositionAndShape.BorderLeft+l.PositionAndShape.BorderRight;d-=t.PositionAndShape.RelativePosition.x,y-=t.PositionAndShape.RelativePosition.x;const b=d+.5,S=y-.5,A=c.getSkyLineMinInRange(b,S);if(e===t.Measures[0]){let P=0;if(r.GroupBrackets.length>0)for(const x of r.GroupBrackets)P=Math.min(P,x.PositionAndShape.BorderTop);m=Math.min(A,P)}else m=A;m=Math.min(0,m),l.PositionAndShape.RelativePosition=new PointF2D(u,m),r.MeasureNumberLabels.push(l)}calculateMeasureNumberSkyline(e){const t=e.StaffLines[0];for(const r of e.MeasureNumberLabels){let s=r.PositionAndShape.RelativePosition.x,o=s-r.PositionAndShape.BorderLeft+r.PositionAndShape.BorderRight;s-=t.PositionAndShape.RelativePosition.x,o-=t.PositionAndShape.RelativePosition.x,t.SkyBottomLineCalculator.updateSkyLineInRange(s,o,r.PositionAndShape.RelativePosition.y+r.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(e,t,r){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(e,t){let r=0,s=this.rules.StaffHeight;const o=[],a=e.SkyBottomLineCalculator;let l=e.Measures.length;for(let u=0;u0){o.push(S),r=Math.max(r,S.LyricsEntries.length);const A=S.PositionAndShape.RelativePosition.x+d.x;let P=Number.MAX_VALUE,x=Number.MIN_VALUE;for(let _=0;_0){const u=e.PositionAndShape.Size.width;let m=o[0].PositionAndShape.RelativePosition.x+o[0].PositionAndShape.BorderMarginLeft+o[0].parentMeasure.PositionAndShape.RelativePosition.x;m=m>u?u:m,a.updateBottomLineInRange(m,u,c)}return o}calculateLyricsExtendsAndDashes(e){for(let t=0,r=e.length;t0||e.UnknownList.length>0){let c="";for(let b=0,S=e.EntriesList.length;be.length-1&&(log$2.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=e.length-1);const t=[];for(let a=this.rules.MinMeasureToDrawIndex,l=e.length;a0)&&(s=r.getSkyLineMinInRange(d,y));let b=0;l===0?(b+=this.rules.ChordSymbolYOffset,b+=.1):b+=this.rules.ChordSymbolYPadding,b*=-1;const S=c.GraphicalLabel;S.PositionAndShape.RelativePosition.y=s+b,S.setLabelPositionAndShapeBorders(),S.PositionAndShape.calculateBoundingBox(),r.updateSkyLineInRange(d,y,s+S.PositionAndShape.BorderMarginTop)}}}}calculateAlignedChordSymbolsOffset(e,t){let r=Number.MAX_SAFE_INTEGER;for(const s of e)for(const o of s.graphicalChordContainers){const a=s.PositionAndShape,l=o.PositionAndShape,c=l.BorderMarginLeft+a.AbsolutePosition.x,u=l.BorderMarginRight+a.AbsolutePosition.x;r=Math.min(r,t.getSkyLineMinInRange(c,u))}return r}layoutMeasureWithWholeRest(e,t,r){}layoutBeams(e){}layoutArticulationMarks(e,t,r){}layoutOrnament(e,t,r){}calculateRestNotePlacementWithinGraphicalBeam(e,t,r,s,o){}calculateTupletNumbers(){}calculateSlurs(){}calculateDynamicExpressionsForMultiExpression(e,t,r){}calculateGraphicalVerbalContinuousDynamic(e,t){const r=e.Label,s=t.x+r.PositionAndShape.BorderMarginLeft,o=t.x+r.PositionAndShape.BorderMarginRight,a=e.ContinuousDynamic.Placement,c=e.ParentStaffLine.SkyBottomLineCalculator;let u;a===PlacementEnum.Below?(u=c.getBottomLineMaxInRange(s,o),r.PositionAndShape.RelativePosition=new PointF2D(t.x,u-r.PositionAndShape.BorderMarginTop)):(u=c.getSkyLineMinInRange(s,o),r.PositionAndShape.RelativePosition=new PointF2D(t.x,u-r.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(e,t){var k,$,F;const r=e.ParentStaffLine.ParentStaff.idInMusicSheet,s=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(e.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,r);if(!s){log$2.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}e.EndMeasure=s;const o=e.ParentStaffLine,a=s.ParentStaffLine,l=a&&o===a;let c=!1;a?c=a==null?void 0:a.isPartOfMultiStaffInstrument():o&&(c=o==null?void 0:o.isPartOfMultiStaffInstrument());const u=Fraction$1.createFromFraction(e.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),m=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(u),d=m.getFirstNonNullStaffEntry().parentMeasure,y=d.PositionAndShape.AbsolutePosition.x+d.PositionAndShape.BorderRight;let b=new Fraction$1(0,0,0);for(const G of m.StaffEntries){const N=(k=G==null?void 0:G.sourceStaffEntry)==null?void 0:k.calculateMaxNoteLength();N!=null&&N.gt(b)&&(b=N)}const S=this.getRelativePositionInStaffLineFromTimestamp(u,r,a,c,0),A=Fraction$1.plus(u,b),P=this.getRelativePositionInStaffLineFromTimestamp(A,r,a,c,0);P.x>S.x&&P.x_){const K=E.StaffLines[G].PositionAndShape.RelativePosition.y-o.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;O=this.rules.StaffHeight+K/2}else O=this.rules.WedgePlacementBelowY;O-=this.rules.WedgeOpeningLength/2,l||(z=O);let N=T.getBottomLineMaxInRange(M,H);if(N>O&&(O=N),_z&&(z=N),z+=this.rules.WedgeOpeningLength/2,z+=this.rules.WedgeVerticalMargin),O+=this.rules.WedgeOpeningLength/2,O+=this.rules.WedgeVerticalMargin}else if(C===PlacementEnum.Above){if(o.ParentStaff.ParentInstrument.Staves.length===1)O=this.rules.WedgePlacementAboveY;else{let N=0;_>0&&(N=_-1);const V=E.StaffLines[N];O=-(o.PositionAndShape.RelativePosition.y-V.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}O+=this.rules.WedgeOpeningLength/2,l||(z=O);let G=T.getSkyLineMinInRange(M,H);if(G1&&_>0){const N=o.findClosestStaffEntry(M),V=o.findClosestStaffEntry(H);N&&V&&N.parentVerticalContainer}l||(G=a.SkyBottomLineCalculator.getSkyLineMinInRange(D,W),G-d/2?c=-d/2:c=u-e.PositionAndShape.BorderMarginBottom}else c=u-e.PositionAndShape.BorderMarginBottom;e.PositionAndShape.RelativePosition=new PointF2D(t.x,c)}else if(e.Placement===PlacementEnum.Below){const u=l.getBottomLineMaxInRange(o,a),m=s.ParentStaff.ParentInstrument.Staves[s.ParentStaff.ParentInstrument.Staves.length-1];if(s.isPartOfMultiStaffInstrument()&&s.ParentStaff!==m){const y=s.ParentMusicSystem.StaffLines[s.ParentMusicSystem.StaffLines.indexOf(s)+1].PositionAndShape.RelativePosition.y-s.PositionAndShape.RelativePosition.y-this.rules.StaffHeight,b=e.PositionAndShape.BorderMarginBottom;u+be.PositionAndShape.Size.width&&(y=e.PositionAndShape.Size.width-this.rules.MeasureRightMargin,d=y-u.PositionAndShape.MarginSize.width,t.x=d-u.PositionAndShape.BorderMarginLeft);let b;const S=e.SkyBottomLineCalculator;return o===PlacementEnum.Below?b=S.getBottomLineMaxInRange(d,y):b=S.getSkyLineMinInRange(d,y),u.PositionAndShape.RelativePosition=new PointF2D(t.x,b),o===PlacementEnum.Below?S.updateBottomLineInRange(d,y,u.PositionAndShape.BorderMarginBottom+b):S.updateSkyLineInRange(d,y,u.PositionAndShape.BorderMarginTop+b),u}calculateTempoExpressionsForMultiTempoExpression(e,t,r,s){metronomeMarks={};const o=Fraction$1.plus(e.AbsoluteTimestamp,t.Timestamp),a=this.graphicalMusicSheet.MeasureList[r];let l=new PointF2D;if(t.ContinuousTempo||t.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!a[0])return;let c=a[0].ParentStaffLine,u=a[0].PositionAndShape.RelativePosition.x,m=0;for(let d=0;d0){c=a[d].ParentStaffLine,u=a[d].PositionAndShape.RelativePosition.x,m=d;break}if(l=this.getRelativePositionInStaffLineFromTimestamp(o,m,c,c.isPartOfMultiStaffInstrument(),u),t.EntriesList.length>0&&t.EntriesList[0].Expression instanceof InstantaneousTempoExpression){const d=t.EntriesList[0].Expression;if(d.Placement=PlacementEnum.Above,c.Measures[0].staffEntries.length>0&&Math.abs(l.x-c.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&c.ParentMusicSystem===this.musicSystems[0]){const y=c.Measures[0].FirstInstructionStaffEntry;if(y){const b=y.GraphicalInstructions.last();l.x=b.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(l.x=c.PositionAndShape.RelativePosition.x+c.Measures[0].PositionAndShape.RelativePosition.x)}}for(const d of t.EntriesList){let y=TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(y=TextAlignmentEnum.LeftBottom);const b=this.calculateLabel(c,l,d.label,t.getFontstyleOfFirstEntry(),d.Expression.Placement,this.rules.UnknownTextHeight,y);if(d.Expression instanceof InstantaneousTempoExpression){for(const A of c.AbstractExpressions)A instanceof GraphicalInstantaneousTempoExpression&&(A.SourceExpression.Label,d.Expression.Label);new GraphicalInstantaneousTempoExpression(d.Expression,b).ParentStaffLine||log$2.warn("Adding staffline didn't work"),d.Expression.Enum===TempoEnum.metronomeMark&&(metronomeMarks[r]=d.Expression)}else d.Expression instanceof ContinuousTempoExpression;if(s===e.TempoExpressions.length-1)for(const S of Object.values(metronomeMarks))this.createMetronomeMark(S,r)}}}createMetronomeMark(e,t){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(e){}clearSystemsAndMeasures(){for(let e=0,t=this.graphicalMusicSheet.MusicPages.length;e-1&&y.PositionAndShape.ChildElements.splice(b,1),y.FirstInstructionStaffEntry=void 0,y.beginInstructionsWidth=0}if(y.LastInstructionStaffEntry){const b=y.PositionAndShape.ChildElements.indexOf(y.LastInstructionStaffEntry.PositionAndShape);b>-1&&y.PositionAndShape.ChildElements.splice(b,1),y.LastInstructionStaffEntry=void 0,y.endInstructionsWidth=0}}u.Measures=[],u.PositionAndShape.ChildElements=[]}a.StaffLines.length=0,a.PositionAndShape.ChildElements=[]}r.MusicSystems=[],r.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(e,t,r,s,o,a,l,c,u,m=void 0,d=void 0){e.StemDirectionXml!==StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&e.StemDirectionXml!==void 0?e.WantedStemDirection=e.StemDirectionXml:this.calculateStemDirectionFromVoices(e);const y=t.findOrCreateGraphicalVoiceEntry(e);y.octaveShiftValue=c;const b=t.tabStaffEntry;let S;b&&(S=b.findOrCreateGraphicalVoiceEntry(e));for(let A=0,P=e.Notes.length;A-1)continue;let E;if(e.IsGrace?E=MusicSheetCalculator.symbolFactory.createGraceNote(x,y,o,this.rules,c):(E=MusicSheetCalculator.symbolFactory.createNote(x,y,o,c,this.rules,void 0),MusicSheetCalculator.stafflineNoteCalculator.trackNote(E)),x.Pitch&&this.checkNoteForAccidental(E,r,o,c),this.resetYPositionForLeadSheet(E.PositionAndShape),t.addGraphicalNoteToListAtCorrectYPosition(y,E),E.PositionAndShape.calculateBoundingBox(),this.leadSheet||(x.NoteBeam!==void 0&&x.PrintObject&&this.handleBeam(E,x.NoteBeam,l),x.NoteTuplet!==void 0&&x.PrintObject&&this.handleTuplet(E,x.NoteTuplet,a)),S){const _=MusicSheetCalculator.symbolFactory.createNote(x,S,o,c,this.rules,void 0);b.addGraphicalNoteToListAtCorrectYPosition(S,_),_.PositionAndShape.calculateBoundingBox(),this.leadSheet||x.NoteTuplet&&this.handleTuplet(_,x.NoteTuplet,a)}}return e.Articulations.length>0&&this.handleVoiceEntryArticulations(e.Articulations,e,t),e.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(e.TechnicalInstructions,e,t),e.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(e,t,s),e.OrnamentContainer&&this.handleVoiceEntryOrnaments(e.OrnamentContainer,e,t),c}resetYPositionForLeadSheet(e){this.leadSheet&&(e.RelativePosition=new PointF2D(e.RelativePosition.x,0))}layoutVoiceEntries(e,t){if(e.PositionAndShape.RelativePosition=new PointF2D(0,0),!this.leadSheet)for(const r of e.graphicalVoiceEntries){const s=r.notes;if(s.length===0)continue;const o=s[0].sourceNote.ParentVoiceEntry,a=s[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(o,s,e,a)}}maxInstrNameLabelLength(){var t;let e=0;for(const r of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if((t=r.NameLabel)!=null&&t.print&&r.Voices.length>0&&r.Voices[0].Visible){let s=r.NameLabel;this.rules.RenderPartNames||(s=new Label("",s.textAlignment,s.font));const o=new GraphicalLabel(s,this.rules.InstrumentLabelTextHeight,TextAlignmentEnum.LeftCenter,this.rules);o.setLabelPositionAndShapeBorders(),e=Math.max(e,o.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?e:0}calculateSheetLabelBoundingBoxes(){var s;const e=this.graphicalMusicSheet.ParentMusicSheet,t=this.rules.DefaultColorTitle;if(e.Title!==void 0&&this.rules.RenderTitle){const o=new GraphicalLabel(e.Title,this.rules.SheetTitleHeight,TextAlignmentEnum.CenterBottom,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=t,this.graphicalMusicSheet.Title=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(e.Subtitle!==void 0&&this.rules.RenderSubtitle){const o=new GraphicalLabel(e.Subtitle,this.rules.SheetSubtitleHeight,TextAlignmentEnum.CenterCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=t,this.graphicalMusicSheet.Subtitle=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(e.Composer!==void 0&&this.rules.RenderComposer){const o=new GraphicalLabel(e.Composer,this.rules.SheetComposerHeight,TextAlignmentEnum.RightCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=t,this.graphicalMusicSheet.Composer=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(e.Lyricist!==void 0&&this.rules.RenderLyricist){const o=new GraphicalLabel(e.Lyricist,this.rules.SheetAuthorHeight,TextAlignmentEnum.LeftCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=t,this.graphicalMusicSheet.Lyricist=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);const r=(s=this.graphicalMusicSheet.musicSheet.sourceMeasures)==null?void 0:s[0];if(r&&r.FirstInstructionsStaffEntries.length>0){const o=r.FirstInstructionsStaffEntries[0];let a,l;for(let c=0,u=o.Instructions.length;c0&&m.graphicalVoiceEntries[0].notes.length===1){const d=m.graphicalVoiceEntries[0].notes[0];!d.sourceNote.Pitch&&new Fraction$1(1,2).lt(d.sourceNote.Length)&&this.layoutMeasureWithWholeRest(d,m,u)}}}}}}optimizeRestNotePlacement(e,t){if(e.graphicalVoiceEntries.length===0)return;const r=e.graphicalVoiceEntries[0].notes;if(r.length===0)return;const s=r[0],o=s.sourceNote.isRest();if(e.graphicalVoiceEntries.length===2){let a=!1;const l=e.graphicalVoiceEntries[1].notes;l.length>0&&(a=l[0].sourceNote.isRest()),o&&a?this.calculateTwoRestNotesPlacementWithCollisionDetection(e):(o||a)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(e)}else if(o&&e!==t.staffEntries[0]&&e!==t.staffEntries[t.staffEntries.length-1]){const a=t.staffEntries.indexOf(e),l=t.staffEntries[a-1],c=t.staffEntries[a+1];if(l.graphicalVoiceEntries.length===1){const u=l.graphicalVoiceEntries[0].notes[0];if(u.sourceNote.NoteBeam!==void 0&&c.graphicalVoiceEntries.length===1){const m=c.graphicalVoiceEntries[0].notes[0];m.sourceNote.NoteBeam!==void 0&&u.sourceNote.NoteBeam===m.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(e,s,u,c,m),e.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(e,t,r,s,o=0){let a=new PointF2D,l,c;const u=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,m=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),d=Math.min(Math.floor(m),u-1),y=Math.min(Math.ceil(m),u-1);if(d<0||t<0)return a;if(l=this.getFirstLeftNotNullStaffEntryFromContainer(d,t,s),c=this.getFirstRightNotNullStaffEntryFromContainer(y,t,s),l&&c){let b=l.parentMeasure.PositionAndShape.RelativePosition.x;o>0&&(b=o);let S=l.PositionAndShape.RelativePosition.x+b,A=c.PositionAndShape.RelativePosition.x+c.parentMeasure.PositionAndShape.RelativePosition.x;o>0&&(A=c.PositionAndShape.RelativePosition.x+b);let P=0;if(l!==c){const x=l.getAbsoluteTimestamp(),E=c.getAbsoluteTimestamp();P=Fraction$1.minus(e,x).RealValue/Fraction$1.minus(E,x).RealValue}l.parentMeasure.ParentStaffLine!==c.parentMeasure.ParentStaffLine&&(l.parentMeasure.ParentStaffLine===r?A=r.PositionAndShape.Size.width:S=r.PositionAndShape.RelativePosition.x),a=new PointF2D(S+(A-S)*P,0)}return a}getRelativeXPositionFromTimestamp(e){const t=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,r=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),s=Math.max(0,Math.min(Math.round(r),t-1)),o=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[s].getFirstNonNullStaffEntry();return o.PositionAndShape.RelativePosition.x+o.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(e){var a;this.rules.RenderSingleHorizontalStaffline&&(e.PositionAndShape.BorderRight=e.PositionAndShape.Size.width,e.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=e.PositionAndShape.Size.width);let t=10;if(e.MusicSystems.length>0){const l=e.MusicSystems[0];t=l.PositionAndShape.RelativePosition.y+l.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){const l=this.graphicalMusicSheet.Title;l.PositionAndShape.Parent=e.PositionAndShape;const c=new PointF2D;c.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,c.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,l.PositionAndShape.RelativePosition=c,e.Labels.push(l)}if(this.graphicalMusicSheet.Subtitle){const l=this.graphicalMusicSheet.Subtitle;l.PositionAndShape.Parent=e.PositionAndShape;const c=new PointF2D;c.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,c.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,l.PositionAndShape.RelativePosition=c,e.Labels.push(l)}const r=this.graphicalMusicSheet.Composer;let s;if(r){r.PositionAndShape.Parent=e.PositionAndShape,r.setLabelPositionAndShapeBorders();const l=new PointF2D;l.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,l.y=t,l.y-=this.rules.SystemComposerDistance;const c=(a=r.TextLines)==null?void 0:a.length;c>1&&(l.y-=r.PositionAndShape.BorderBottom*(c-1)/c),s=l.y,r.PositionAndShape.RelativePosition=l,e.Labels.push(r)}const o=this.graphicalMusicSheet.Lyricist;if(o){o.PositionAndShape.Parent=e.PositionAndShape,o.setLabelPositionAndShapeBorders();const l=new PointF2D;l.x=this.rules.PageLeftMargin,l.y=t,l.y+=o.PositionAndShape.BorderBottom,l.y=Math.min(l.y,s!=null?s:Number.MAX_SAFE_INTEGER),o.PositionAndShape.RelativePosition=l,e.Labels.push(o)}}createGraphicalTies(){for(let e=0;e=0&&this.staffEntriesWithGraphicalTies.push(o)}o=l}}setTieDirections(e){if(!e)return;const t=e.ties;if(t.length>1){let r;for(const s of t){const o=s.Notes[0];(!r||o.Pitch.getHalfTone()>r.Pitch.getHalfTone())&&(r=o)}for(const s of t)s.TieDirection===PlacementEnum.NotYetDefined&&(s.Notes[0]===r?s.TieDirection=PlacementEnum.Above:s.TieDirection=PlacementEnum.Below)}}createAccidentalCalculators(){const e=[],t=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(t)for(let r=0;r1)return;d=MusicSheetCalculator.symbolFactory.createGraphicalMeasure(e,m)}if(d.hasError=e.getErrorInMeasure(c),e.FirstInstructionsStaffEntries[c])for(let _=0,T=e.FirstInstructionsStaffEntries[c].Instructions.length;_0){const M=T.Instructions[0];MusicSheetCalculator.symbolFactory.createInStaffClef(C,M)}this.rules.RenderChordSymbols&&((E=T.ChordContainers)==null?void 0:E.length)>0&&(T.ParentStaff.ParentInstrument.HasChordSymbols=!0,MusicSheetCalculator.symbolFactory.createChordSymbols(T,C,s.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(s.doCalculationsAtEndOfMeasure(),e.LastInstructionsStaffEntries[c]){const _=e.LastInstructionsStaffEntries[c];for(let T=0,C=_.Instructions.length;T=1&&d.staffEntries.length===0){const _=new SourceStaffEntry(new VerticalSourceStaffEntryContainer(d.parentSourceMeasure,d.parentSourceMeasure.AbsoluteTimestamp,d.parentSourceMeasure.CompleteNumberOfStaves),m),T=new VoiceEntry(new Fraction$1(0,1),m.Voices[0],_),C=new Note$1(T,_,Fraction$1.createFromFraction(e.Duration),void 0,e);C.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===FillEmptyMeasuresWithWholeRests.YesVisible,T.addNote(C);const R=MusicSheetCalculator.symbolFactory.createStaffEntry(_,d);d.addGraphicalStaffEntry(R),R.relInMeasureTimestamp=T.Timestamp;const I=MusicSheetCalculator.symbolFactory.createVoiceEntry(T,R);R.graphicalVoiceEntries.push(I);const M=MusicSheetCalculator.symbolFactory.createNote(C,I,new ClefInstruction,OctaveEnum.NONE,void 0);MusicSheetCalculator.stafflineNoteCalculator.trackNote(M),I.notes.push(M)}d.hasOnlyRests=!0;for(const _ of d.staffEntries)if(d.hasOnlyRests=_.hasOnlyRests(),!d.hasOnlyRests)break;return d}checkNoteForAccidental(e,t,r,s){let o=e.sourceNote.Pitch;const a=e.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();a!==0&&e.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==MidiInstrument.Percussion&&(o=e.Transpose(t.ActiveKeyInstruction,r,a,s),e.sourceNote.TransposedPitch=o),e.sourceNote.halfTone=o.getHalfTone(),t.checkAccidental(e,o)}handleStaffEntries(e){for(let t=0,r=this.graphicalMusicSheet.MeasureList.length;t0&&c.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(c,o),this.layoutStaffEntry(c));this.graphicalMeasureCreatedCalculations(l)}}}}calculateSkyBottomLines(){for(const e of this.musicSystems)for(const t of e.StaffLines)t.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let e=0,t=this.musicSystems.length;e0&&this.layoutArticulationMarks(A.Articulations,A,y)}}}}}}calculateOrnaments(){for(let e=0,t=this.musicSystems.length;e0&&s.LyricVersesNumbers.sort()}for(let t=0,r=this.musicSystems.length;t=0&&(s=t.GraphicalLyricsEntries[r+1]),!s)return;const o=e.StaffEntryParent.parentMeasure.ParentStaffLine,a=s.StaffEntryParent.parentMeasure.ParentStaffLine,l=e.StaffEntryParent,c=s.StaffEntryParent;if(e.StaffEntryParent.parentMeasure.ParentStaffLine===s.StaffEntryParent.parentMeasure.ParentStaffLine){const u=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=c.parentMeasure.PositionAndShape.RelativePosition.x+c.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.RelativePosition.x+s.GraphicalLabel.PositionAndShape.BorderMarginLeft,d=e.GraphicalLabel.PositionAndShape.RelativePosition.y;let y=1;m-u>this.rules.MinimumDistanceBetweenDashes*3&&(y=Math.floor((m-u)/this.rules.MinimumDistanceBetweenDashes)-1),y===1?this.calculateSingleDashForLyricWord(o,u,m,d):this.calculateDashes(o,u,m,d)}else{const u=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=o.Measures[o.Measures.length-1],d=m.PositionAndShape.RelativePosition.x+m.PositionAndShape.Size.width;let y=e.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(o,u,d,y),a&&a.Measures[0]&&c.parentMeasure.ParentStaffLine&&!(c===c.parentMeasure.staffEntries[0]&&c.parentMeasure===c.parentMeasure.ParentStaffLine.Measures[0])){const b=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,S=c.parentMeasure.PositionAndShape.RelativePosition.x+c.PositionAndShape.RelativePosition.x+s.GraphicalLabel.PositionAndShape.BorderMarginLeft;y=s.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(a,b,S,y)}}}calculateDashes(e,t,r,s){let o=r-t;if(ot;)o=this.calculateRightAndLeftDashesForLyricWord(e,t,r,s),t+=l,r-=l,c++;o>l*2&&this.calculateSingleDashForLyricWord(e,t,r,s)}}calculateSingleDashForLyricWord(e,t,r,s){const o=new Label("-"),a=new GraphicalLabel(o,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(a),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e),a.PositionAndShape.Parent=e.PositionAndShape;const l=new PointF2D(t+(r-t)/2,s);a.PositionAndShape.RelativePosition=l}calculateLyricExtend(e){let t=e.GraphicalLabel.PositionAndShape.RelativePosition.y;const r=e.StaffEntryParent,s=r.parentMeasure.ParentStaffLine;let o,a;const l=r.parentMeasure.ParentStaff.idInMusicSheet;for(let c=r.parentVerticalContainer.Index+1;c0)break;o=u,a=o.parentMeasure.ParentStaffLine,a||(a=r.parentMeasure.ParentStaffLine)}}if(!(!o||!a))if(s===a&&o.parentMeasure.ParentStaffLine){const c=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,u=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+o.PositionAndShape.BorderMarginRight;t-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(s,c,u,t)}else{const c=s.Measures[s.Measures.length-1].PositionAndShape,u=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=c.RelativePosition.x+c.Size.width;if(t-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(s,u,m,t),!o)return;if(o.parentMeasure.ParentStaffLine&&o.parentMeasure.staffEntries&&!(o===o.parentMeasure.staffEntries[0]&&o.parentMeasure===o.parentMeasure.ParentStaffLine.Measures[0])){const d=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,y=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+o.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(a,d,y,t)}}}calculateSingleLyricWordWithUnderscore(e,t,r,s){const o=new PointF2D(t,s),a=new PointF2D(r,s),l=new GraphicalLine(o,a,this.rules.LyricUnderscoreLineWidth);e.LyricLines.push(l),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e)}calculateRightAndLeftDashesForLyricWord(e,t,r,s){const o=new Label("-"),a=new GraphicalLabel(o,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(a),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e),a.PositionAndShape.Parent=e.PositionAndShape;const l=new PointF2D(t,s);a.PositionAndShape.RelativePosition=l;const c=new Label("-"),u=new GraphicalLabel(c,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);u.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(u),u.PositionAndShape.Parent=e.PositionAndShape;const m=new PointF2D(r,s);return u.PositionAndShape.RelativePosition=m,u.PositionAndShape.RelativePosition.x-a.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const e=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),t=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let r=t;r<=e;r++){const s=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[r];this.dynamicExpressionMap.clear();for(let o=0;o=0;a--)if((o=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[a])!=null&&o.StaffEntries[t])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[a].StaffEntries[t]}getFirstRightNotNullStaffEntryFromContainer(e,t,r){var s,o;if((s=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e])!=null&&s.StaffEntries[t])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e].StaffEntries[t];for(let a=e+1;a0||t.StaffLinkedExpressions[r][s].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(t.StaffLinkedExpressions[r][s],e,r)}}calculateStemDirectionFromVoices(e){if(e.ParentSourceStaffEntry.Link!==void 0)if(e===e.ParentSourceStaffEntry.VoiceEntries[0]){e.WantedStemDirection=StemDirectionType.Up;return}else{e.WantedStemDirection=StemDirectionType.Down;return}else e.ParentVoice instanceof LinkedVoice?e.WantedStemDirection=StemDirectionType.Down:e.ParentSourceStaffEntry.VoiceEntries.length>1&&(e.WantedStemDirection=StemDirectionType.Up)}setBeamNotesWantedStemDirections(e){if(!(e.Notes.length>0))return;const t=e.Notes[0].NoteBeam;if(t){for(const r of t.Notes)if(r.ParentVoiceEntry.WantedStemDirection!==StemDirectionType.Undefined&&r.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===e.ParentSourceStaffEntry.ParentStaff.Id){e.WantedStemDirection=r.ParentVoiceEntry.WantedStemDirection;break}}}}class ChordSymbolContainer{constructor(e,t,r,s,o){this.rootPitch=e,this.chordKind=t,this.bassPitch=r,this.degrees=s,this.rules=o}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(e,t,r){let s=e.RootPitch;if(MusicSheetCalculator.transposeCalculator&&(s=MusicSheetCalculator.transposeCalculator.transposePitch(e.RootPitch,r,t)),e.ChordKind===31)return e.getTextFromChordKindEnum(e.ChordKind);let o=Pitch.getNoteEnumString(s.FundamentalNote);s.Accidental!==AccidentalEnum.NONE&&(o+=this.getTextForAccidental(s.Accidental));const a={adds:[],alts:[],subs:[]};for(const m of e.ChordDegrees)if(m){let d="";switch(m.alteration!==AccidentalEnum.NONE&&(d+=this.getTextForAccidental(m.alteration)),d+=m.value,m.text){case 0:a.adds.push(d);break;case 1:a.alts.push(d);break;case 2:a.subs.push(d);break}}let l=e.getTextFromChordKindEnum(e.ChordKind);const c=["adds","alts","subs"],u=e.rules.CustomChords;for(const m of u){if(m.chordKind!==e.chordKind)continue;let d=!0;for(const y of c){for(const b of m.degrees[y]||[])if(a[y].indexOf(b)<0){d=!1;break}if(!d)break}if(d){for(const y of c)for(const b of m.degrees[y]||[])a[y].splice(a[y].indexOf(b),1);l=m.alternateName}}if(o+=l,a.adds.length>0&&(o+="("+a.adds.join(",")+")"),a.alts.length>0&&(o+="(alt "+a.alts.join(",")+")"),a.subs.length>0&&(o+="(omit "+a.subs.join(",")+")"),e.BassPitch){let m=e.BassPitch;MusicSheetCalculator.transposeCalculator&&(m=MusicSheetCalculator.transposeCalculator.transposePitch(e.BassPitch,r,t)),o+="/",o+=Pitch.getNoteEnumString(m.FundamentalNote),o+=this.getTextForAccidental(m.Accidental)}return o}static getTextForAccidental(e){let t="";switch(e){case AccidentalEnum.DOUBLEFLAT:t+="bb";break;case AccidentalEnum.FLAT:t+="b";break;case AccidentalEnum.SHARP:t+="#";break;case AccidentalEnum.DOUBLESHARP:t+="x";break}return t}getTextFromChordKindEnum(e){var t;return(t=this.rules.ChordSymbolLabelTexts.getValue(e))!=null?t:""}}class Degree{constructor(e,t,r){this.value=e,this.alteration=t,this.text=r}}class CustomChord{constructor(e,t,r){this.alternateName=e,this.chordKind=t,this.degrees=r}static createCustomChord(e,t,r){return new CustomChord(e,t,r)}static renameCustomChord(e,t,r){for(const s of r)s.alternateName===e&&(s.alternateName=t)}}var ChordDegreeText=(i=>(i[i.add=0]="add",i[i.alter=1]="alter",i[i.subtract=2]="subtract",i))(ChordDegreeText||{}),ChordSymbolEnum=(i=>(i[i.major=0]="major",i[i.minor=1]="minor",i[i.augmented=2]="augmented",i[i.diminished=3]="diminished",i[i.dominant=4]="dominant",i[i.majorseventh=5]="majorseventh",i[i.minorseventh=6]="minorseventh",i[i.diminishedseventh=7]="diminishedseventh",i[i.augmentedseventh=8]="augmentedseventh",i[i.halfdiminished=9]="halfdiminished",i[i.majorminor=10]="majorminor",i[i.majorsixth=11]="majorsixth",i[i.minorsixth=12]="minorsixth",i[i.dominantninth=13]="dominantninth",i[i.majorninth=14]="majorninth",i[i.minorninth=15]="minorninth",i[i.dominant11th=16]="dominant11th",i[i.major11th=17]="major11th",i[i.minor11th=18]="minor11th",i[i.dominant13th=19]="dominant13th",i[i.major13th=20]="major13th",i[i.minor13th=21]="minor13th",i[i.suspendedsecond=22]="suspendedsecond",i[i.suspendedfourth=23]="suspendedfourth",i[i.Neapolitan=24]="Neapolitan",i[i.Italian=25]="Italian",i[i.French=26]="French",i[i.German=27]="German",i[i.pedal=28]="pedal",i[i.power=29]="power",i[i.Tristan=30]="Tristan",i[i.none=31]="none",i))(ChordSymbolEnum||{});class GraphicalNote extends GraphicalObject{constructor(e,t,r,s=void 0){super(),this.DrawnAccidental=AccidentalEnum.NONE,this.lineShift=0,this.sourceNote=e,this.parentVoiceEntry=t,this.PositionAndShape=new BoundingBox$1(this,t.PositionAndShape),s?this.graphicalNoteLength=s:this.graphicalNoteLength=e.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=r,this.rules.addGraphicalNoteToNoteMap(e,this)}Transpose(e,t,r,s){let o=this.sourceNote.Pitch;return MusicSheetCalculator.transposeCalculator&&(o=MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,e,r)),o}calculateNumberOfNeededDots(e){return!this.sourceNote||!this.sourceNote.NoteTuplet?e.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}static FromNote(e,t){return t.NoteToGraphicalNoteMap.getValue(e.NoteToGraphicalNoteObjectId)}}const _EngravingRules=class ct{constructor(){this.DYSlursStartingAtSameStaffEntryYOffset=0,this.DYMinNoteWidth=0,this.DYWorkId=0,this.DYWorkSpecial=!1,this.DYContainerId="osmdCanvasPage",this.DYSVGContainerId="osmdSvgPage",this.DYMusicScoreType="staff",this.DYMusicScoreId="",this.DYMusicClientType="",this.NoteDistances=[1,1,1.3,1.6,2,2.5,3,4],this.NoteDistancesScalingFactors=[1,2,4,8,16,32,64,128],this.DurationDistanceDict={},this.DurationScalingDistanceDict={},this.NoteToGraphicalNoteMapObjectCount=0,this.PlayAlreadyStartedNotesFromCursorPosition=!1,this.PlaybackSkipNotesSafetyInterval=.02,this.UseDefaultVoiceInteractionListener=!0,this.loadDefaultValues()}loadDefaultValues(){this.SamplingUnit=ct.unit*3,this.MpatMode=!0,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.CompactMode=!1,this.PagePlacementEnum=PagePlacementEnum.Down,this.PageHeight=100001,this.PageTopMargin=5,this.PageTopMarginNarrow=0,this.PageBottomMargin=5,this.PageLeftMargin=5,this.PageRightMargin=5,this.TitleTopDistance=5,this.TitleBottomDistance=1,this.StaffDistance=7,this.BetweenStaffDistance=5,this.MinimumStaffLineDistance=4,this.MinSkyBottomDistBetweenStaves=1,this.StaffHeight=4,this.TabStaffInterlineHeight=1.1111,this.BetweenStaffLinesDistance=ct.unit,this.SystemLeftMargin=0,this.SystemRightMargin=0,this.SystemLabelsRightMargin=2,this.SystemComposerDistance=2,this.InstrumentLabelTextHeight=2,this.MinimumDistanceBetweenSystems=7,this.MinSkyBottomDistBetweenSystems=5,this.LastSystemMaxScalingFactor=1.4,this.AutoBeamNotes=!1,this.AutoBeamOptions={beam_middle_rests_only:!1,beam_rests:!1,maintain_stem_directions:!1},this.AutoBeamTabs=!1,this.BeamWidth=ct.unit/2,this.BeamSpaceWidth=ct.unit/3,this.BeamForwardLength=1.25*ct.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionUseXMLDisplayStep=!0,this.PercussionXMLDisplayStepNoteValueShift=0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.BetweenKeySymbolsDistance=.2,this.KeyRightMargin=.75,this.RhythmRightMargin=1.25,this.ShowRhythmAgainAfterPartEndOrFinalBarline=!0,this.NewPartAndSystemAfterFinalBarline=!1,this.InStaffClefScalingFactor=.8,this.DistanceBetweenNaturalAndSymbolWhenCancelling=.4,this.NoteHelperLinesOffset=.25,this.MeasureLeftMargin=.7,this.MeasureRightMargin=0,this.DistanceBetweenLastInstructionAndRepetitionBarline=1,this.ArpeggioDistance=.6,this.StaccatoShorteningFactor=2,this.IdealStemLength=3,this.StemNoteHeadBorderYOffset=.2,this.StemMargin=.2,this.StemMinLength=2.5,this.StemMaxLength=4.5,this.BeamSlopeMaxAngle=10,this.StemMinAllowedDistanceBetweenNoteHeadAndBeamLine=1,this.SetWantedStemDirectionByXml=!0,this.GraceNoteScalingFactor=.6,this.GraceNoteXOffset=.2,this.WedgeOpeningLength=1.2,this.WedgeMeasureEndOpeningLength=.75,this.WedgeMeasureBeginOpeningLength=.75,this.WedgePlacementAboveY=-1.5,this.WedgePlacementBelowY=1.5,this.WedgeHorizontalMargin=.6,this.WedgeVerticalMargin=.5,this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges=.3,this.WedgeMinLength=2,this.WedgeEndDistanceBetweenTimestampsFactor=1.75,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignment=TextAlignmentEnum.LeftBottom,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=.1,this.ChordSymbolYPadding=0,this.ChordSymbolYAlignment=!0,this.ChordSymbolYAlignmentScope="staffline",this.ChordSymbolLabelTexts=new Dictionary,this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts),this.CustomChords=[],this.resetChordNames(),this.RepetitionSymbolsYOffset=0,this.RehearsalMarkXOffsetDefault=10,this.RehearsalMarkXOffset=0,this.RehearsalMarkXOffsetSystemStartMeasure=-20,this.RehearsalMarkYOffsetDefault=-15,this.RehearsalMarkYOffset=0,this.RehearsalMarkFontSize=10,this.MeasureNumberLabelHeight=1.5*ct.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*ct.unit,this.TupletNumberYOffset=.5,this.LabelMarginBorderFactor=.1,this.TupletVerticalLineLength=.5,this.TupletNumbersInTabs=!1,this.SlurPlacementFromXML=!0,this.BezierCurveStepSize=1e3,this.calculateCurveParametersArrays(),this.TieGhostObjectWidth=.75,this.TieYPositionOffsetFactor=.3,this.MinimumNeededXspaceForTieGhostObject=1,this.TieHeightMinimum=.28,this.TieHeightMaximum=1.2,this.TieHeightInterpolationK=.0288,this.TieHeightInterpolationD=.136,this.SlurNoteHeadYOffset=.5,this.SlurStemXOffset=.3,this.SlurSlopeMaxAngle=15,this.SlurTangentMinAngle=30,this.SlurTangentMaxAngle=80,this.SlurHeightFactor=1,this.SlurHeightFlattenLongSlursFactorByWidth=.24,this.SlurHeightFlattenLongSlursFactorByAngle=.36,this.SlurHeightFlattenLongSlursCutoffAngle=47,this.SlurHeightFlattenLongSlursCutoffWidth=16,this.SlursStartingAtSameStaffEntryYOffset=.8,this.SlurMaximumYControlPointDistance=void 0,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.VoltaOffset=2.5,this.LyricsAlignmentStandard=TextAlignmentEnum.LeftBottom,this.LyricsHeight=2,this.LyricsYOffsetToStaffHeight=0,this.VerticalBetweenLyricsDistance=.5,this.HorizontalBetweenLyricsDistance=.2,this.BetweenSyllableMaximumDistance=10,this.BetweenSyllableMinimumDistance=.5,this.LyricOverlapAllowedIntoNextMeasure=3.4,this.MinimumDistanceBetweenDashes=10,this.MaximumLyricsElongationFactor=2.5,this.InstantaneousTempoTextHeight=2.3,this.ContinuousDynamicTextHeight=2.3,this.MoodTextHeight=2.3,this.UnknownTextHeight=2,this.ContinuousTempoTextHeight=2.3,this.DynamicExpressionMaxDistance=2,this.DynamicExpressionSpacer=.5,this.VexFlowDefaultNotationFontScale=39,this.VexFlowDefaultTabFontScale=39,this.TremoloStrokeScale=1,this.TremoloYSpacingScale=1,this.StemWidth=.15,this.StaffLineWidth=.1,this.StaffLineColor=void 0,this.LedgerLineWidth=1,this.LedgerLineStrokeStyle=void 0,this.LedgerLineColorDefault="#000000",this.WedgeLineWidth=.12,this.TupletLineWidth=.12,this.LyricUnderscoreLineWidth=.12,this.SystemThinLineWidth=.12,this.SystemBoldLineWidth=ct.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=ct.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=ct.unit,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.SheetMaximumWidth=32767,this.VoiceSpacingMultiplierVexflow=.85,this.VoiceSpacingAddendVexflow=3,this.PickupMeasureWidthMultiplier=1,this.DisplacedNoteMargin=.1,this.MinNoteDistance=2,this.SubMeasureXSpacingThreshold=35,this.MeasureDynamicsMaxScalingFactor=2.5,this.WholeRestXShiftVexflow=-1.5,this.MetronomeMarksDrawn=!0,this.MetronomeMarkXShift=-6,this.MetronomeMarkYShift=-.5,this.SoftmaxFactorVexFlow=15,this.StaggerSameWholeNotes=!0,this.AlignRests=AlignRestOption.Never,this.RestCollisionYPadding=0,this.FillEmptyMeasuresWithWholeRest=FillEmptyMeasuresWithWholeRests.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.ColoringMode=ColoringModes.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.applyDefaultColorMusic("#000000"),this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=FontStyles.Regular,this.DefaultVexFlowNoteFont="gonville",this.MaxMeasureToDrawIndex=Number.MAX_VALUE,this.MinMeasureToDrawIndex=0,this.MaxSystemToDrawNumber=Number.MAX_VALUE,this.MaxPageToDrawNumber=Number.MAX_VALUE,this.RenderComposer=!0,this.RenderTitle=!0,this.RenderSubtitle=!0,this.RenderLyricist=!0,this.RenderPartNames=!0,this.RenderPartAbbreviations=!0,this.RenderFingerings=!0,this.RenderMeasureNumbers=!0,this.RenderMeasureNumbersOnlyAtSystemStart=!1,this.UseXMLMeasureNumbers=!0,this.RenderLyrics=!0,this.RenderChordSymbols=!0,this.RenderMultipleRestMeasures=!0,this.AutoGenerateMutipleRestMeasuresFromRestMeasures=!0,this.RenderRehearsalMarks=!0,this.RenderClefsAtBeginningOfStaffline=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.ArticulationPlacementFromXML=!0,this.FingeringPosition=PlacementEnum.AboveOrBelow,this.FingeringPositionFromXML=!0,this.FingeringPositionGrace=PlacementEnum.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.FingeringOffsetY=0,this.FingeringPaddingY=-.2,this.FingeringTextSize=1.5,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,ct.FixStafflineBoundingBox=!1,this.PageFormat=PageFormat.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.PerformanceMode=!1,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(e){log$2.info("EngravingRules()",e)}this.MpatMode&&(this.NewPartAndSystemAfterFinalBarline=!0)}applyDefaultColorMusic(e){this.DefaultColorMusic=e,this.DefaultColorNotehead=this.DefaultColorMusic,this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.LedgerLineColorDefault=this.DefaultColorNotehead}addGraphicalNoteToNoteMap(e,t){e.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(e.NoteToGraphicalNoteObjectId,t),this.NoteToGraphicalNoteMapObjectCount++}GNote(e){return GraphicalNote.FromNote(e,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(e,t){this.ChordSymbolLabelTexts.setValue(e,t)}resetChordSymbolLabelTexts(e){return e.setValue(ChordSymbolEnum.minor,"m"),e.setValue(ChordSymbolEnum.augmented,"aug"),e.setValue(ChordSymbolEnum.diminished,"dim"),e.setValue(ChordSymbolEnum.dominant,"7"),e.setValue(ChordSymbolEnum.majorseventh,"maj7"),e.setValue(ChordSymbolEnum.minorseventh,"m7"),e.setValue(ChordSymbolEnum.diminishedseventh,"dim7"),e.setValue(ChordSymbolEnum.augmentedseventh,"aug7"),e.setValue(ChordSymbolEnum.halfdiminished,"m7b5"),e.setValue(ChordSymbolEnum.majorminor,"m(maj7)"),e.setValue(ChordSymbolEnum.majorsixth,"maj6"),e.setValue(ChordSymbolEnum.minorsixth,"m6"),e.setValue(ChordSymbolEnum.dominantninth,"9"),e.setValue(ChordSymbolEnum.majorninth,"maj9"),e.setValue(ChordSymbolEnum.minorninth,"m9"),e.setValue(ChordSymbolEnum.dominant11th,"11"),e.setValue(ChordSymbolEnum.major11th,"maj11"),e.setValue(ChordSymbolEnum.minor11th,"m11"),e.setValue(ChordSymbolEnum.dominant13th,"13"),e.setValue(ChordSymbolEnum.major13th,"maj13"),e.setValue(ChordSymbolEnum.minor13th,"m13"),e.setValue(ChordSymbolEnum.suspendedsecond,"sus2"),e.setValue(ChordSymbolEnum.suspendedfourth,"sus4"),e.setValue(ChordSymbolEnum.power,"5"),e.setValue(ChordSymbolEnum.none,"N.C."),e}addChordName(e,t,r,s,o){if(ChordSymbolEnum[t]!==void 0){const a={adds:r,alts:s,subs:o};this.CustomChords.push(CustomChord.createCustomChord(e,ChordSymbolEnum[t],a))}}renameChord(e,t){CustomChord.renameCustomChord(e,t,this.CustomChords)}resetChordNames(){this.addChordName("alt","major",["#5","b9","#9"],["b5"],[]),this.addChordName("7alt","dominant",["#5","b9","#9"],["b5"],[]),this.addChordName("7sus4","dominant",["4"],[],["3"]),this.addChordName("7sus4","suspendedfourth",["7"],[],[]),this.addChordName("9sus4","dominantninth",["4"],[],["3"]),this.addChordName("9sus4","suspendedfourth",["9"],[],[]),this.addChordName("11sus4","dominant11th",["4"],[],["3"]),this.addChordName("11sus4","suspendedfourth",["11"],[],[]),this.addChordName("13sus4","dominant13th",["4"],[],["3"]),this.addChordName("13sus4","suspendedfourth",["13"],[],[]),this.addChordName("7sus2","dominant",["2"],[],["3"]),this.addChordName("7sus2","suspendedsecond",["7"],[],[]),this.addChordName("m7b5","minorseventh",[],["b5"],[]),this.addChordName("9sus2","dominantninth",["2"],[],["3"]),this.addChordName("9sus2","suspendedsecond",["9"],[],[]),this.addChordName("11sus2","dominant11th",["2"],[],["3"]),this.addChordName("11sus2","suspendedsecond",["11"],[],[]),this.addChordName("13sus2","dominant13th",["2"],[],["3"]),this.addChordName("13sus2","suspendedsecond",["13"],[],[]),this.addChordName("m(maj9)","majorminor",["9"],[],[]),this.addChordName("m(maj11)","majorminor",["11"],[],[]),this.addChordName("m(maj13)","majorminor",["13"],[],[]),this.addChordName("69","majorsixth",["9"],[],[]),this.addChordName("mi69","minorsixth",["9"],[],[])}calculateCurveParametersArrays(){this.TPower3=new Array(this.BezierCurveStepSize),this.OneMinusTPower3=new Array(this.BezierCurveStepSize),this.FactorOne=new Array(this.BezierCurveStepSize),this.FactorTwo=new Array(this.BezierCurveStepSize);for(let e=0;e(i[i.XML=0]="XML",i[i.AutoColoring=1]="AutoColoring",i[i.CustomColorSet=2]="CustomColorSet",i))(ColoringModes||{}),DrawingParametersEnum=(i=>(i.allon="allon",i.compact="compact",i.compacttight="compacttight",i.default="default",i.leadsheet="leadsheet",i.preview="preview",i.thumbnail="thumbnail",i))(DrawingParametersEnum||{});class DrawingParameters{constructor(e="default"){this.rules=new EngravingRules,this.drawCursors=!0,this.drawTitle=!0,this.drawSubtitle=!0,this.drawLyricist=!0,this.drawComposer=!0,this.drawCredits=!0,this.drawPartNames=!0,this.fingeringPosition=PlacementEnum.Left,this.drawHiddenNotes=!1,this.DrawingParametersEnum=e}set DrawingParametersEnum(e){switch(this.drawingParametersEnum=e,e){case"allon":this.setForAllOn();break;case"thumbnail":this.setForThumbnail();break;case"leadsheet":this.setForLeadsheet();break;case"compact":this.setForCompactMode();break;case"compacttight":this.setForCompactTightMode();break;case"default":default:this.setForDefault()}}get DrawingParametersEnum(){return this.drawingParametersEnum}setForAllOn(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.DrawTitle=!0,this.DrawSubtitle=!0,this.DrawComposer=!0,this.DrawLyricist=!0,this.drawCredits=!0,this.DrawPartNames=!0,this.drawHiddenNotes=!0,this.rules.CompactMode=!1}setForDefault(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}setForThumbnail(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}setForCompactMode(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}setForCompactTightMode(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}setForLeadsheet(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0}get DrawCredits(){return this.drawCredits}set DrawCredits(e){this.drawCredits=e,this.DrawComposer=e,this.DrawTitle=e,this.DrawSubtitle=e,this.DrawLyricist=e}get DrawTitle(){return this.drawTitle}set DrawTitle(e){this.drawTitle=e,this.rules.RenderTitle=e,e||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(e){this.drawSubtitle=e,this.rules.RenderSubtitle=e,e&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(e){this.drawComposer=e,this.rules.RenderComposer=e}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(e){this.drawLyricist=e,this.rules.RenderLyricist=e}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(e){this.drawPartNames=e,this.rules.RenderPartNames=e,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(e){this.fingeringPosition=e,this.rules.FingeringPosition=e}get Rules(){return this.rules}set Rules(e){this.rules=e}}var AlignRestOption=(i=>(i[i.Never=0]="Never",i[i.Always=1]="Always",i[i.Auto=2]="Auto",i))(AlignRestOption||{}),FillEmptyMeasuresWithWholeRests=(i=>(i[i.No=0]="No",i[i.YesVisible=1]="YesVisible",i[i.YesInvisible=2]="YesInvisible",i))(FillEmptyMeasuresWithWholeRests||{}),BackendType=(i=>(i[i.SVG=0]="SVG",i[i.Canvas=1]="Canvas",i))(BackendType||{});class OSMDOptions{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:DrawingParametersEnum.default}}static BackendTypeFromString(e){return e&&e.toLowerCase()==="canvas"?1:0}}class IXmlElement{constructor(e){if(this.hasAttributes=!1,!e)throw new Error("IXmlElement: expected Element, got undefined");this.elem=e,this.name=e.nodeName.toLowerCase(),e.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=e.attributes[0]),this.hasElements=e.hasChildNodes(),e.childNodes.length===1&&e.childNodes[0].nodeType===Node.TEXT_NODE?this.value=e.childNodes[0].nodeValue:this.value=""}attribute(e){return this.elem.attributes.getNamedItem(e)}attributes(){if(!this.attrs){const e=this.elem.attributes,t=[];for(let r=0;r0?this.Voices[0].Visible:!1}set Visible(e){for(let t=0,r=this.Voices.length;t-1&&this.parent.MusicSystems.splice(t,1)}this.parent=e,this.boundingBox.Parent=e.PositionAndShape}get NextSystem(){const e=this.Parent.MusicSystems.indexOf(this);return e!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[e+1]:void 0}get StaffLines(){return this.staffLines}get GraphicalMeasures(){return this.graphicalMeasures}get MeasureNumberLabels(){return this.measureNumberLabels}get Labels(){return this.labels.values()}get ObjectsToRedraw(){return this.objectsToRedraw}get InstrumentBrackets(){return this.instrumentBrackets}get GroupBrackets(){return this.groupBrackets}get GraphicalMarkedAreas(){return this.graphicalMarkedAreas}get SystemLines(){return this.systemLines}get Id(){return this.id}createSystemLeftLine(e,t,r){let s=-e/2;r&&(s=this.maxLabelLength+t-e/2);const o=this.staffLines[0].Measures[0];let a;this.staffLines.length>1&&(a=this.staffLines[this.staffLines.length-1].Measures[0]);const l=this.createSystemLine(s,e,SystemLinesEnum.SingleThin,SystemLinePosition.MeasureBegin,this,o,a);this.SystemLines.push(l),l.PositionAndShape.RelativePosition=new PointF2D(s,0),l.PositionAndShape.BorderLeft=0,l.PositionAndShape.BorderRight=e,l.PositionAndShape.BorderTop=0,l.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(l)}createVerticalLineForMeasure(e,t,r,s,o,a){const l=a.ParentStaffLine,c=new PointF2D(l.PositionAndShape.RelativePosition.x,l.PositionAndShape.RelativePosition.y),u=l.ParentStaff.ParentInstrument.Staves;if(l.ParentStaff===u[0]){let m;u.length>1&&(m=this.getBottomStaffLine(l).Measures[o]);const d=this.createSystemLine(e,t,r,s,this,a,m),y=c.x+e;d.PositionAndShape.RelativePosition=new PointF2D(y,0),d.PositionAndShape.BorderLeft=0,d.PositionAndShape.BorderRight=t,this.SystemLines.push(d)}}setYPositionsToVerticalLineObjectsAndCreateLines(e){}calculateBorders(e){}alignBeginInstructions(){}GetLeftBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth}GetRightBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x}AddGraphicalMeasures(e){for(let t=0,r=e.length;t1){let a,l;for(let c=0,u=this.staffLines.length;cthis.maxLabelLength&&(this.maxLabelLength=m.PositionAndShape.Size.width,t=o)}this.updateMusicSystemStaffLineXPosition(t)}setMusicSystemLabelsYPosition(){this.labels.forEach((e,t)=>{let r=0,s=0;for(let o=0;o0&&(t.PositionAndShape.RelativePosition=new PointF2D(0,r/s+2))})}checkStaffEntriesForStaffEntryLink(){let e=!1,t=!1;for(let r=0;r=0;r--){if(t=e.InstrumentalGroups[r],t instanceof Instrument){if(t.Visible===!0)return t;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(t)}}updateMusicSystemStaffLineXPosition(e){for(let t=0,r=this.StaffLines.length;t1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let e=new Fraction$1(0,1);const t=[];for(let r=0,s=this.staffEntries.length;r0&&a.Add(c.notes[0].graphicalNoteLength);e.lt(a)&&(e=Fraction$1.createFromFraction(a))}return e}addGraphicalStaffEntry(e){this.staffEntries.push(e)}addGraphicalStaffEntryAtTimestamp(e){if(e)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(e.relInMeasureTimestamp))this.staffEntries.push(e);else for(let t=this.staffEntries.length-1;t>=0;t--){if(this.staffEntries[t].relInMeasureTimestamp.lt(e.relInMeasureTimestamp)){this.staffEntries.splice(t+1,0,e);break}t===0&&this.staffEntries.splice(t,0,e)}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!0:this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!1:this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}beginsWithLineRepetition(){const e=this.parentSourceMeasure;return e?e.beginsWithLineRepetition():!1}endsWithLineRepetition(){const e=this.parentSourceMeasure;return e?e.endsWithLineRepetition():!1}beginsWithWordRepetition(){const e=this.parentSourceMeasure;return e?e.beginsWithWordRepetition():!1}endsWithWordRepetition(){const e=this.parentSourceMeasure;return e?e.endsWithWordRepetition():!1}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}class VexFlowVoiceEntry extends GraphicalVoiceEntry{constructor(e,t){super(e,t)}applyBordersFromVexflow(){const e=this.vfStaveNote;if(!e.getNoteHeadBeginX)return;const t=e.getBoundingBox(),r=e.getNoteHeadBeginX()-t.x;this.PositionAndShape.RelativePosition.y=t.y/unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=t.h/unitInPixels,this.PositionAndShape.BorderLeft=-(r+e.width/2)/unitInPixels,this.PositionAndShape.BorderRight=(t.w-r)/unitInPixels}set vfStaveNote(e){this.mVexFlowStaveNote=e}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var y;const e=this.rules.DefaultColorNotehead,t=this.rules.DefaultColorRest,r=this.rules.DefaultColorStem,s="#00000000";let o,a;const l=this.vfStaveNote;for(let b=0;bc.symbol_type===t))return;const l=new VF$9.Repetition(t,s,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(l,r);return}this.addVolta(e)}addVolta(e){var r;let t=VF$9.Volta.type.BEGIN;if(e.type===RepetitionInstructionEnum.Ending){switch(e.alignment){case AlignmentType.Begin:this.parentSourceMeasure.endsRepetitionEnding()?t=VF$9.Volta.type.BEGIN_END:t=VF$9.Volta.type.BEGIN;break;case AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;t=VF$9.Volta.type.END;break}const s=this.ParentStaffLine.SkyBottomLineCalculator,o=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,a=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,o+.4),l=s.getSkyLineMinInRange(o,a)-2;let c=-6.1+this.rules.VoltaOffset,u=this.rules.VoltaOffset;if(l0){log$2.trace("Ghost Found in between (measure ".concat(this.MeasureNumber,")"));const d=this.createGhostGves(m);r.splice(a,0,...d),a+=d.length}}else{const m=Fraction$1.minus(c,this.parentSourceMeasure.AbsoluteTimestamp);if(m.RealValue>0){log$2.trace("Ghost Found at start (measure ".concat(this.MeasureNumber,")"));const d=this.createGhostGves(m);r.splice(0,0,...d),a+=d.length}}t=u}const s=Fraction$1.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),o=Fraction$1.minus(s,t);if(o.RealValue>0){log$2.trace("Ghost Found at end (measure ".concat(this.MeasureNumber,")"));const a=this.createGhostGves(o);r=r.concat(a)}return r}createGhostGves(e){const t=VexFlowConverter.GhostNotes(e),r=[];for(const s of t){const o=new VexFlowVoiceEntry(void 0,void 0);o.vfStaveNote=s,r.push(o)}return r}handleBeam(e,t){const r=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let s=this.beams[r];s||(s=this.beams[r]=[]);let o;for(const l of s)l[0]===t&&(o=l);o||(o=[t,[]],s.push(o));const a=e.parentVoiceEntry;o[1].indexOf(a)<0&&o[1].push(a)}handleTuplet(e,t){const r=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;t=e.sourceNote.NoteTuplet;let s=this.tuplets[r];s||(s=this.tuplets[r]=[]);let o;for(const l of s)l[0]===t&&(o=l);o||(o=[t,[]],s.push(o));const a=e.parentVoiceEntry;o[1].indexOf(a)<0&&o[1].push(a)}finalizeBeams(){this.vfbeams={};const e=[];for(const t in this.beams)if(this.beams.hasOwnProperty(t)){let r=this.vfbeams[t];r||(r=this.vfbeams[t]=[]);for(const s of this.beams[t]){let o=!1;for(const b of s[0].Notes)if(b.Length.RealValue>=new Fraction$1(1,4).RealValue&&(!b.TypeLength||b.TypeLength.RealValue>.125)){o=!0;break}if(o){log$2.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const a=[],l=s[0],c=s[1];let u=!0;for(const b of c)b.parentVoiceEntry.ParentVoice===l.Notes[0].ParentVoiceEntry.ParentVoice&&(u=b.parentVoiceEntry.WantedStemDirection===StemDirectionType.Undefined);let m=!1,d;const y=[];for(const b of c){const S=b.vfStaveNote;S&&(a.push(S),e.push(S)),b.parentVoiceEntry.IsGrace&&(m=!0),b.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&y.push(b.parentVoiceEntry.StemColor)}if(a.length>1){const b=new VF$9.Beam(a,u);if(m&&(b.render_options.beam_width=3,b.render_options.partial_beam_length=4),y.length>=2&&this.rules.ColorBeams){d=y[0];for(const S of y)if(S!==d){d=void 0;break}b.setStyle({fillStyle:d,strokeStyle:d})}this.rules.FlatBeams&&(b.render_options.flat_beams=!0,b.render_options.flat_beam_offset=this.rules.FlatBeamOffset,b.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),r.push(b)}else log$2.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(e)}autoBeamNotes(e){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let t=[],r=[],s,o=[];this.autoTupletVfBeams=[];const a=[];this.autoVfBeams=[];let l=this.parentSourceMeasure.ActiveTimeSignature;l||(l=this.parentSourceMeasure.Duration);for(const m of this.staffEntries)for(const d of m.graphicalVoiceEntries){const y=d.vfStaveNote,b=d.notes[0],S=m.relInMeasureTimestamp.isOnBeat(l),A=r.length>=2,P=b.sourceNote.Length.RealValue-new Fraction$1(1,4).RealValue>-Fraction$1.FloatInaccuracyTolerance,x=d.parentVoiceEntry.IsGrace||P||e.contains(y);if(x||S){if(A){for(const _ of r)t.push(_);a.push(t.slice()),t=[]}if(r=[],x)continue}const E=d.notes[0].sourceNote.NoteTuplet;if(E){let _=!1;for(const T of E.Notes){for(const C of T)if(C.NoteTypeXml>=NoteType.QUARTER||C.ParentVoiceEntry.IsGrace||C.isRest()&&!this.rules.AutoBeamOptions.beam_rests){_=!0;break}if(_)break}if(!s)s=E;else if(s!==E){if(o.length>1){const T=new VF$9.Beam(o,!0);this.rules.FlatBeams&&(T.render_options.flat_beams=!0,T.render_options.flat_beam_offset=this.rules.FlatBeamOffset,T.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(T)}o=[],s=E}_||o.push(y);continue}else s=void 0;r.push(y)}if(o.length>=2){const m=new VF$9.Beam(o,!0);this.rules.FlatBeams&&(m.render_options.flat_beams=!0,m.render_options.flat_beam_offset=this.rules.FlatBeamOffset,m.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(m)}if(r.length>=2){for(const m of r)t.push(m);a.push(t)}const c=this.rules.AutoBeamOptions,u={beam_middle_only:c.beam_middle_rests_only,beam_rests:c.beam_rests,maintain_stem_directions:c.maintain_stem_directions};if(c.groups&&c.groups.length){const m=[];for(const d of c.groups)m.push(new VF$9.Fraction(d[0],d[1]));u.groups=m}for(const m of a){const d=VF$9.Beam.generateBeams(m,u);for(const y of d)this.rules.FlatBeams&&(y.render_options.flat_beams=!0,y.render_options.flat_beam_offset=this.rules.FlatBeamOffset,y.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(y)}}finalizeTuplets(){this.vftuplets={};for(const e in this.tuplets)if(this.tuplets.hasOwnProperty(e)){let t=this.vftuplets[e];t||(t=this.vftuplets[e]=[]);for(const r of this.tuplets[e]){const s=[],o=r[1];for(const a of o)s.push(a.vfStaveNote);if(s.length>1){const a=r[0],l=a.Notes[0][0].NormalNotes,c=a.Bracket||a.TupletLabelNumber===3&&this.rules.TripletsBracketed||a.TupletLabelNumber!==3&&this.rules.TupletsBracketed;let u=VF$9.Tuplet.LOCATION_TOP;a.tupletLabelNumberPlacement===PlacementEnum.Below&&(u=VF$9.Tuplet.LOCATION_BOTTOM),t.push(new VF$9.Tuplet(s,{bracketed:c,location:u,notes_occupied:l,num_notes:a.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else log$2.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(e){}graphicalMeasureCreatedCalculations(){let e,t=[];const r=[];for(const o of this.staffEntries){e=!1,t=[];for(const a of o.graphicalVoiceEntries){if(a.parentVoiceEntry.IsGrace){t.push(a),r.push(a),e||(e=a.parentVoiceEntry.GraceSlur);continue}if(a.vfStaveNote=VexFlowConverter.StaveNote(a),t.length>0){const l=[];for(let u=0;u0&&(m.GraceSlash=!1);const d=VexFlowConverter.StaveNote(m);m.vfStaveNote=d,l.push(d)}const c=new VF$9.GraceNoteGroup(l,e);a.vfStaveNote.addModifier(0,c),t=[]}}}if(t.length>0)for(const o of t)o.vfStaveNote=VexFlowConverter.StaveNote(o),o.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const s=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const o of this.staffEntries)o.setModifierXOffsets();for(const o of s){if(!o)continue;this.vfVoices[o.VoiceId]=new VF$9.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:VF$9.RESOLUTION}).setMode(VF$9.Voice.Mode.SOFT);const a=this.getRestFilledVexFlowStaveNotesPerVoice(o);for(const l of a){if(l.parentVoiceEntry&&l.parentVoiceEntry.IsGrace&&!l.parentVoiceEntry.GraceAfterMainNote)continue;const c=l;if(c.vfStaveNote.ticks.denominator===0)continue;if(l.notes.length===0||!l.notes[0]||!l.notes[0].sourceNote.PrintObject){this.vfVoices[o.VoiceId].addTickable(c.vfStaveNote);continue}const u=c.parentStaffEntry;if(u&&u.vfClefBefore){const m=new NoteSubGroup([u.vfClefBefore]);c.vfStaveNote.getCategory&&c.vfStaveNote.getCategory()==="stavenotes"&&c.vfStaveNote.addModifier(0,m)}l.parentVoiceEntry&&this.rules.RenderFingerings&&((this.rules.FingeringPosition===PlacementEnum.Left||this.rules.FingeringPosition===PlacementEnum.Right)&&this.createFingerings(l),this.createStringNumber(l)),this.createArpeggio(l),this.vfVoices[o.VoiceId].addTickable(c.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(const o of r)this.createFingerings(o),this.createStringNumber(o),this.createArpeggio(o);this.createArticulations(),this.createOrnaments()}createArpeggio(e){if(e.parentVoiceEntry&&e.parentVoiceEntry.Arpeggio){const t=e.parentVoiceEntry.Arpeggio;if(e.notes&&e.notes.length>1){const r=VexFlowConverter.StrokeTypeFromArpeggioType(t.type),s=new VF$9.Stroke(r,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&e.vfStaveNote.addStroke(0,s)}else log$2.debug("[OSMD] arpeggio in measure ".concat(this.MeasureNumber," could not be drawn.\n voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow."))}}setStemDirectionFromVexFlow(){for(const e of this.staffEntries)for(const t of e.graphicalVoiceEntries)for(const r of t.notes){const s=r.vfnote;if(!s||!s[0])continue;switch(s[0].getStemDirection()){case VF$9.Stem.UP:t.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case VF$9.Stem.DOWN:t.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}}createArticulations(){for(let e=0,t=this.staffEntries.length;e1||e.parentStaffEntry.graphicalVoiceEntries.length>1?u=VF$9.StaveModifier.Position.LEFT:d.idInMusicSheet===0?(u=VF$9.StaveModifier.Position.ABOVE,l=PlacementEnum.Above):(u=VF$9.StaveModifier.Position.BELOW,l=PlacementEnum.Below)}const m=new VF$9.FretHandFinger(a.value);if(m.setPosition(u),m.setOffsetX(c),l===PlacementEnum.Above||l===PlacementEnum.Below){const d=l===PlacementEnum.Above?-1:1,y=l===PlacementEnum.Above?s:r-1-s;if(this.rules.FingeringInsideStafflines&&r>1){const b=m.getWidth()/2,S=r*2.5;m.setOffsetY(d*(y+S)*b)}else if(!this.rules.FingeringInsideStafflines){const b=new VF$9.StringNumber(a.value);b.radius=0,b.setPosition(u),b.setOffsetY(d*y*b.getWidth()*2/3),t.vfStaveNote.addModifier(s,b);continue}}t.vfStaveNote.addModifier(s,m)}}createStringNumber(e){if(!this.rules.RenderStringNumbersClassical)return;const t=e;e.notes.forEach((r,s)=>{const o=r.sourceNote.StringInstruction;if(o){let a=o.value;switch(a){case"1":a="I";break;case"2":a="II";break;case"3":a="III";break;case"4":a="IV";break;case"5":a="V";break;case"6":a="VI";break}const l=new VF$9.StringNumber(a);l.radius=0;const c=-this.rules.StringNumberOffsetY;e.notes.length>1||e.parentStaffEntry.graphicalVoiceEntries.length>1?(l.setOffsetX(r.baseStringNumberXOffset*13),l.setPosition(VF$9.Modifier.Position.RIGHT)):l.setPosition(VF$9.Modifier.Position.ABOVE),l.setOffsetY(c),t.vfStaveNote.addModifier(s,l)}})}lineTo(e,t){const r=new VF$9.StaveConnector(e.getVFStave(),this.stave);r.setType(t),this.connectors.push(r)}getVFStave(){return this.stave}updateInstructionWidth(){let e=0,t=0;const r=this.stave.getModifiers();for(const s of r)s.getPosition()===5?e+=s.getWidth()+s.getPadding(void 0):s.getPosition()===6&&(t+=s.getWidth()+s.getPadding(void 0));this.beginInstructionsWidth=(e!=null?e:0)/unitInPixels,this.endInstructionsWidth=(t!=null?t:0)/unitInPixels}addStaveTie(e,t){this.vfTies.push(e),t.vfTie=e}}class GraphicalStaffEntry extends GraphicalObject{constructor(e,t=void 0,r=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=e,this.graphicalVoiceEntries=[],this.sourceStaffEntry=t,r?(this.staffEntryParent=r,this.parentVerticalContainer=r.parentVerticalContainer,this.PositionAndShape=new BoundingBox$1(this,r.PositionAndShape)):this.PositionAndShape=new BoundingBox$1(this,e.PositionAndShape),t&&(this.relInMeasureTimestamp=t.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(e){this.lyricsEntries=e}getAbsoluteTimestamp(){const e=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&e.Add(this.relInMeasureTimestamp),e}findTieGraphicalNoteFromNote(e){var r;const t=((r=window.GYM)==null?void 0:r.graceCustom)||!1;for(const s of this.graphicalVoiceEntries)for(const o of s.notes){const a=o.sourceNote;if(t){if(e.NoteToGraphicalNoteObjectId==a.NoteToGraphicalNoteObjectId)return o}else if(!a.isRest()&&a.Pitch.FundamentalNote===e.Pitch.FundamentalNote&&a.Pitch.Octave===e.Pitch.Octave&&a.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return o}}findEndTieGraphicalNoteFromNoteWithStartingSlur(e,t){if(e){for(const r of this.graphicalVoiceEntries)if(r.parentVoiceEntry===e.ParentVoiceEntry)for(const s of r.notes){const o=s.sourceNote;if(o.NoteTie&&o.NoteSlurs.indexOf(t)!==-1)return s}}}findGraphicalNoteFromGraceNote(e){if(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e.ParentVoiceEntry){for(const r of t.notes)if(r.sourceNote===e)return r}}}findGraphicalNoteFromNote(e){if(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e.ParentVoiceEntry){for(const r of t.notes)if(r.sourceNote===e&&this.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return r}}}getGraphicalNoteDurationFromVoice(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry.ParentVoice===e)return t.notes[0].graphicalNoteLength;return new Fraction$1(0,1)}findVoiceEntryGraphicalNotes(e){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e)return t.notes}isVoiceEntryPartOfLinkedVoiceEntry(e){if(this.sourceStaffEntry.Link)for(let t=0,r=this.sourceStaffEntry.Link.LinkStaffEntries.length;t0&&(e=s)}return e}findStaffEntryMaxNoteLength(){let e=new Fraction$1(0,1);for(const t of this.graphicalVoiceEntries)for(const r of t.notes){const s=r.graphicalNoteLength;e.lt(s)&&s.GetExpandedNumerator()>0&&(e=s)}return e}findOrCreateGraphicalVoiceEntry(e){for(const r of this.graphicalVoiceEntries)if(r.parentVoiceEntry===e)return r;const t=MusicSheetCalculator.symbolFactory.createVoiceEntry(e,this);return this.graphicalVoiceEntries.push(t),t}findOrCreateGraphicalVoiceEntryFromGraphicalNote(e){for(const r of this.graphicalVoiceEntries)if(r===e.parentVoiceEntry)return r;const t=MusicSheetCalculator.symbolFactory.createVoiceEntry(e.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(t),t}addGraphicalNoteToListAtCorrectYPosition(e,t){const r=e.notes;if(r.length===0||t.PositionAndShape.RelativePosition.y=0;s--){if(r[s].PositionAndShape.RelativePosition.y>t.PositionAndShape.RelativePosition.y){r.splice(s+1,0,t);break}if(s===0){r.splice(0,0,t);break}}}hasOnlyRests(){for(const t of this.graphicalVoiceEntries)for(const r of t.notes)if(!r.sourceNote.isRest())return!1;return!0}getSkylineMin(){var s;const e=(s=this.parentMeasure)==null?void 0:s.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;const[t,r]=this.getAbsoluteStartAndEnd();return e.getSkyLineMinInRange(t,r)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var s;const e=(s=this.parentMeasure)==null?void 0:s.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;const[t,r]=this.getAbsoluteStartAndEnd();return e.getBottomLineMaxInRange(t,r)}getAbsoluteStartAndEnd(){let e=this.PositionAndShape.AbsolutePosition.x;e-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;const t=e+this.PositionAndShape.Size.width;return[e,t]}}const VF$8=Vex.Flow;class VexFlowStaffEntry extends GraphicalStaffEntry{constructor(e,t,r){super(e,t,r)}calculateXPosition(){const e=this.parentMeasure.getVFStave();let t=0;for(const r of this.graphicalVoiceEntries)if(r.vfStaveNote){if(r.vfStaveNote.setStave(e),e&&e.getLines&&e.getLines()===1&&r.vfStaveNote.getStemDirection()<0&&(r.vfStaveNote.setStemDirection(VF$8.Stem.UP),r.parentVoiceEntry.StemDirection=StemDirectionType.Up),!r.vfStaveNote.preFormatted)continue;r.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(r.vfStaveNote.getAbsoluteX()+r.vfStaveNote.glyph.getWidth())/unitInPixels:this.PositionAndShape.RelativePosition.x=r.vfStaveNote.getBoundingBox().getX()/unitInPixels;const s=r.notes[0].sourceNote;s.isRest()&&s.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,r.PositionAndShape.BorderLeft=-.7,r.PositionAndShape.BorderRight=.7),r.PositionAndShape.BorderLefto.staffLine),r=this.calculateModifierXOffsets(t,1),s=this.calculateModifierXOffsets(t,.5);e.forEach((o,a)=>{o.baseFingeringXOffset=s[a],o.baseStringNumberXOffset=r[a]})}calculateModifierXOffsets(e,t){const r=[];for(let s=0;s=0;l--){if(Math.abs(e[s]-e[l])<=t&&o===r[l]){o++,a=!0;break}a=!1}r.push(o)}return r}}class VexFlowGraphicalNote extends GraphicalNote{constructor(e,t,r,s=OctaveEnum.NONE,o,a=void 0){if(super(e,t,o,a),this.clef=r,this.octaveShift=s,e.Pitch){const l=e.isRest()?e.Pitch:OctaveShift.getPitchFromOctaveShift(e.Pitch,s);this.vfpitch=VexFlowConverter.pitch(l,e.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(e){const t=this.drawPitch(e);this.vfpitch=VexFlowConverter.pitch(t,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=t.Accidental}drawPitch(e){return OctaveShift.getPitchFromOctaveShift(e,this.octaveShift)}Transpose(e,t,r,s){const o=super.Transpose(e,t,r,s),a=OctaveShift.getPitchFromOctaveShift(o,this.octaveShift);return this.vfpitch=VexFlowConverter.pitch(a,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,a}setIndex(e,t){this.vfnote=[e,t],this.vfnoteIndex=t}notehead(e=void 0){let t=e;t||(t=this.vfnote[0]);const r=t.note_heads;return r&&r.length>this.vfnoteIndex&&r[this.vfnoteIndex]?t.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){if(this.vfnote)return this.vfnote[0].getAttribute("id")}getSVGGElement(){if(this.vfnote)return this.vfnote[0].getAttribute("el")}getStemSVG(){return document.getElementById("vf-"+this.getSVGId()+"-stem")}getBeamSVGs(){const e=[];for(let t=0;;t++){const r=document.getElementById("vf-".concat(this.getSVGId(),"-beam").concat(t));if(!r)break;e.push(r)}return e}}class GraphicalChordSymbolContainer extends GraphicalObject{constructor(e,t,r,s,o,a){super(),this.chordSymbolContainer=e,this.boundingBox=new BoundingBox$1(this,t),this.rules=a,this.calculateLabel(r,o,s)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(e,t,r){const s=ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,t,r);this.graphicalLabel=new GraphicalLabel(new Label(s),e,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}}const VF$7=Vex.Flow;class VexFlowTabMeasure extends VexFlowMeasure{constructor(e,t=void 0,r=void 0){super(e,t,r),this.isTabMeasure=!0}resetLayout(){var t;const e=(t=this.ParentStaff.StafflineCount)!=null?t:6;this.stave=new VF$7.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:e}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let t=0,r=this.staffEntries.length;t1){const l=VexFlowConverter.StrokeTypeFromArpeggioType(a.type),c=new VF$7.Stroke(l,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&o.vfStaveNote.addStroke(0,c)}else log$2.debug("[OSMD] arpeggio in measure ".concat(this.MeasureNumber," could not be drawn.\n voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow."))}this.vfVoices[t.VoiceId].addTickable(o.vfStaveNote)}}}}class StaffLine extends GraphicalObject{constructor(e,t){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.Pedals=[],this.WavyLines=[],this.parentMusicSystem=e,this.parentStaff=t,this.boundingBox=new BoundingBox$1(this,e.PositionAndShape),this.skyBottomLine=MusicSheetCalculator.symbolFactory.createSkyBottomLineCalculator(this),this.staffHeight=this.parentMusicSystem.rules.StaffHeight,this.topLineOffset=0,this.bottomLineOffset=4,this.calculateStaffLineOffsets()}calculateStaffLineOffsets(){if(this.ParentStaff.isTab)switch(this.ParentStaff.StafflineCount){case 5:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*6;break;default:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount;break}else switch(this.ParentStaff.StafflineCount){case 4:this.bottomLineOffset=1;break;case 3:this.topLineOffset=1,this.bottomLineOffset=1;break;case 2:this.topLineOffset=2,this.bottomLineOffset=1;break;case 1:this.topLineOffset=2,this.bottomLineOffset=2;break}}get Measures(){return this.measures}set Measures(e){this.measures=e}get StaffLines(){return this.staffLines}set StaffLines(e){this.staffLines=e}get Index(){return this.parentMusicSystem.StaffLines.indexOf(this)}get NextStaffLine(){const e=this.Index;return e!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[e+1]:void 0}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(e){this.abstractExpressions=e}set LyricLines(e){this.lyricLines=e}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(e){this.lyricsDashes=e}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(e){this.parentMusicSystem=e}get ParentStaff(){return this.parentStaff}set ParentStaff(e){this.parentStaff=e}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(e){this.octaveShifts=e}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}addSlurToStaffline(e){this.graphicalSlurs.push(e)}addActivitySymbolClickArea(){const e=new StaffLineActivitySymbol(this),t=this.PositionAndShape;e.PositionAndShape.RelativePosition=new PointF2D(t.RelativePosition.x+t.BorderRight+.5,t.RelativePosition.y+.5),e.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(e){let t;for(let r=0,s=this.Measures.length;r0){const c=l.map(y=>y.PositionAndShape.Center.y),u=Math.max(...c),m=((o=window.GYM)==null?void 0:o.noNeedContinuousDynamic)||!1,d=((a=window.GYM)==null?void 0:a.noNeedGraphicalContinuousDynamic)||!1;for(let y=0;y0?l[y-1]:void 0;if(A){const x=this.getOverlap(b.PositionAndShape,A.PositionAndShape);b.squeeze(-(x.x+this.rules.DynamicExpressionSpacer))}if(P){const x=this.getOverlap(P.PositionAndShape,b.PositionAndShape);b.squeeze(x.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(e,t){const r=e.RelativePosition.x+e.BorderMarginRight,s=t.RelativePosition.x+t.BorderMarginLeft,o=e.RelativePosition.y+e.BorderMarginBottom,a=t.RelativePosition.y+t.BorderMarginTop;return new PointF2D(s-r,a-o)}getOverlap(e,t){return new PointF2D(e.RelativePosition.x+e.BorderMarginRight-(t.RelativePosition.x+t.BorderMarginLeft),e.RelativePosition.y+e.BorderMarginBottom-(t.RelativePosition.y+t.BorderMarginTop))}}class VexFlowStaffLine extends StaffLine{constructor(e,t){super(e,t),this.slursInVFStaffLine=[],this.alignmentManager=new AlignmentManager(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(e){this.slursInVFStaffLine.push(e)}get AlignmentManager(){return this.alignmentManager}}const VF$6=Vex.Flow;class VexFlowMultiRestMeasure extends VexFlowMeasure{constructor(e,t=void 0,r=void 0){super(e,t,r),this.minimumStaffEntriesWidth=-1,r?this.rules=r.ParentMusicSystem.rules:t&&(this.rules=t.Rules),this.resetLayout(),this.multiRestElement=new VF$6.MultiMeasureRest(t.multipleRestMeasures,{})}draw(e){var o,a,l,c,u;const t=e.openGroup();(o=t==null?void 0:t.classList)==null||o.add("vf-measure");const r=e.openGroup();(a=r==null?void 0:r.classList)==null||a.add("vf-stave"),r==null||r.setAttribute("id",(c=(l=this.stave)==null?void 0:l.attrs)==null?void 0:c.id),this.stave.setContext(e).draw(),e.closeGroup();const s=e.openGroup();(u=s==null?void 0:s.classList)==null||u.add("vf-voices"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(e),this.multiRestElement.draw(),e.closeGroup();for(const m of this.connectors)m.setContext(e).draw();return e.closeGroup(),t}format(){}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(e){return[]}getRestFilledVexFlowStaveNotesPerVoice(e){return[]}handleBeam(e,t){}handleTuplet(e,t){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(e){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(e){}getVFStave(){return this.stave}}const VF$5=Vex.Flow;class VexFlowBackend{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let e=this.canvas;return this.getVexflowBackendType()===VF$5.Renderer.Backends.CANVAS&&(e=this.inner),e}getRenderer(){return this.renderer}removeAllChildrenFromContainer(e){for(;e.children.length!==0;)e.removeChild(e.children.item(0))}removeFromContainer(e){const t=this.getRenderElement();for(let r=0;r\n\r<")),o.download="opensheetmusicdisplay_download.svg",o.innerHTML=window.location.href+"/download",document.body.appendChild(o)}}class VexFlowInstantaneousDynamicExpression extends GraphicalInstantaneousDynamicExpression{constructor(e,t,r){super(e,t,r);const s=new Label(this.Expression);this.label=new GraphicalLabel(s,this.rules.ContinuousDynamicTextHeight,TextAlignmentEnum.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=FontStyles.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}class GraphicalOctaveShift extends GraphicalObject{constructor(e,t){super(),this.getOctaveShift=e,this.setSymbol(),this.PositionAndShape=new BoundingBox$1(this,t)}setSymbol(){switch(this.getOctaveShift.Type){case OctaveEnum.VA8:this.octaveSymbol=MusicSymbol.VA8;break;case OctaveEnum.VB8:this.octaveSymbol=MusicSymbol.VB8;break;case OctaveEnum.MA15:this.octaveSymbol=MusicSymbol.MA15;break;case OctaveEnum.MB15:this.octaveSymbol=MusicSymbol.MB15;break;default:throw new ArgumentOutOfRangeException("")}}}const VF$2=Vex.Flow;class VexFlowOctaveShift extends GraphicalOctaveShift{constructor(e,t){switch(super(e,t),e.Type){case OctaveEnum.VA8:this.position=VF$2.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case OctaveEnum.MA15:this.position=VF$2.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case OctaveEnum.VB8:this.position=VF$2.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case OctaveEnum.MB15:this.position=VF$2.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:log$2.error("Unknown or NONE octaveshift. This should not be called!");break}}setStartNote(e){for(const t of e.graphicalVoiceEntries){const r=t;if(r!=null&&r.vfStaveNote)return this.startNote=r.vfStaveNote,!0}return!1}setEndNote(e){for(const t of e.graphicalVoiceEntries){const r=t;if(r!=null&&r.vfStaveNote)return this.endNote=r.vfStaveNote,!0}return!1}getTextBracket(){return new VF$2.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})}}class VexflowStafflineNoteCalculator{constructor(e){this.staffPitchListMapping=new Dictionary,this.baseLineNote=NoteEnum.B,this.baseLineOctave=1,this.rules=e}trackNote(e){if(!(e instanceof VexFlowGraphicalNote)||e.Clef().ClefType!==ClefEnum.percussion||e.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;const t=e.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let r;this.staffPitchListMapping.containsKey(t)||this.staffPitchListMapping.setValue(t,new Array),r=this.staffPitchListMapping.getValue(t);const s=e.sourceNote.Pitch;VexflowStafflineNoteCalculator.findOrInsert(r,s)}static PitchIndexOf(e,t,r=0){if(r>e.length-1)return-1;for(let s=r;sthis.rules.PercussionOneLineCutoff&&!s)return e;const o=e,a=e.sourceNote.Pitch;let l=this.baseLineNote,c=this.baseLineOctave;if(this.rules.PercussionUseXMLDisplayStep&&e.sourceNote.displayStepUnpitched!==void 0&&(l=e.sourceNote.displayStepUnpitched,c=e.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),r.length<=this.rules.PercussionForceVoicesOneLineCutoff)o.setAccidental(new Pitch(l,c,a.Accidental));else{const u=VexflowStafflineNoteCalculator.PitchIndexOf(r,a);if(u>-1){const m=Math.ceil(r.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(u>=m)switch(c=2,(u-m)%5){case 1:l=NoteEnum.E;break;case 2:l=NoteEnum.G;break;case 3:l=NoteEnum.B;break;case 4:l=NoteEnum.D,c=3;break;default:l=NoteEnum.C;break}else switch(u%5){case 1:l=NoteEnum.F;break;case 2:l=NoteEnum.D;break;case 3:l=NoteEnum.B,c=0;break;case 4:l=NoteEnum.G,c=0;break;default:l=NoteEnum.A;break}const d=new Pitch(l,c,a.Accidental);o.setAccidental(d);const y=o.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&y.Notes.length<2&&(d.Octave>this.baseLineOctave||d.FundamentalNote===this.baseLineNote&&d.Octave===this.baseLineOctave?o.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Up:o.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Down)}}return o}getStafflineUniquePositionCount(e){return this.staffPitchListMapping.containsKey(e)?this.staffPitchListMapping.getValue(e).length:0}}class SkyBottomLineCalculator{constructor(e){this.mStaffLineParent=e,this.mRules=e.ParentMusicSystem.rules}calculateLines(){const e=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];const t=new CanvasVexFlowBackend(this.StaffLineParent.ParentMusicSystem.rules);for(const a of this.StaffLineParent.Measures){a.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);const l=a.getVFStave();let c=l.getWidth();if(!(c>0)&&!a.IsExtraGraphicalMeasure&&(log$2.warn("SkyBottomLineCalculator: width not > 0 in measure "+a.MeasureNumber),c=50),!(c>=50)&&a.IsExtraGraphicalMeasure)continue;t.initializeHeadless(c);const u=t.getContext(),m=t.getCanvas();c=m.width;const d=m.height;this.mRules.DYMusicScoreType==="jianpu"?l.setY(l.y-50):l.setY(l.y+100);const y=l.getWidth();l.setWidth(c),a.format(),l.setWidth(y);try{a.draw(u)}catch(E){log$2.warn("SkyBottomLineCalculator.calculateLines.draw",E)}const b=u.getImageData(0,0,c,d),S=4,A=Math.max(Math.ceil(a.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),P=new Array(A),x=new Array(A);for(let E=0;E0){P[E]=_;break}}for(let _=d;_>0;_--){const C=_*c*S+E*S;if(b.data[C+3]>0){x[E]=_;break}}}for(let E=0;E(a-Math.max(...this.mSkyLine))/unitInPixels+this.StaffLineParent.TopLineOffset),this.mBottomLine=this.mBottomLine.map(a=>(a-Math.min(...this.mBottomLine))/unitInPixels+this.StaffLineParent.BottomLineOffset)}findPreviousValidNumber(e,t){for(let r=e;r>=0;r--)if(!isNaN(t[r]))return t[r];return 0}findNextValidNumber(e,t){if(e>=t.length)return t[e-1];for(let r=e;r=this.BottomLine.length&&(r=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.SkyLine[r]=e.y;for(let a=r+1;a=this.BottomLine.length&&(r=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.BottomLine[r]=e.y;for(let a=r+1;ae)}setBottomLineWithValue(e){this.BottomLine.forEach(t=>e)}getLeftIndexForPointX(e,t){const r=Math.floor(e*this.SamplingUnit);return r<0?0:r>=t?t-1:r}getRightIndexForPointX(e,t){const r=Math.ceil(e*this.SamplingUnit);return r<0?0:r>=t?t-1:r}updateStaffLineBorders(){this.mStaffLineParent.PositionAndShape.BorderTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderMarginTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderBottom=this.getBottomLineMax(),this.mStaffLineParent.PositionAndShape.BorderMarginBottom=this.getBottomLineMax()}getSkyLineMin(){return Math.min(...this.SkyLine.filter(e=>!isNaN(e)))}getSkyLineMinAtPoint(e){const t=Math.round(e*this.SamplingUnit);return this.mSkyLine[t]}getSkyLineMinInRange(e,t){return this.getMinInRange(this.SkyLine,e,t)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(e=>!isNaN(e)))}getBottomLineMaxAtPoint(e){const t=Math.round(e*this.SamplingUnit);return this.mBottomLine[t]}getBottomLineMaxInRange(e,t){return this.getMaxInRange(this.BottomLine,e,t)}getBottomLineMaxInBoundingBox(e){const t=Math.floor(e.AbsolutePosition.x+e.BorderLeft),r=Math.ceil(e.AbsolutePosition.x+e.BorderRight);return this.getMaxInRange(this.mBottomLine,t,r)}updateWithBoundingBoxRecursively(e){if(e.ChildElements&&e.ChildElements.length>0)for(const t of e.ChildElements)this.updateWithBoundingBoxRecursively(t);else{const t=e.BorderTop+e.AbsolutePosition.y,r=e.BorderBottom+e.AbsolutePosition.y;if(t<0){const s=Math.floor(e.AbsolutePosition.x+e.BorderLeft),o=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mSkyLine,s,o,t)}else if(r>this.StaffLineParent.StaffHeight){const s=Math.floor(e.AbsolutePosition.x+e.BorderLeft),o=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mBottomLine,s,o,r)}}}updateInRange(e,t=0,r=e.length,s=0){if(t=Math.floor(t*this.SamplingUnit),r=Math.ceil(r*this.SamplingUnit),re.length&&(r=e.length);for(let o=t;oMath.abs(e[o])?s:e[o]}setInRange(e,t=0,r=e.length,s=0){if(t=Math.floor(t*this.SamplingUnit),r=Math.ceil(r*this.SamplingUnit),re.length&&(r=e.length);for(let o=t;o=e.length&&(t=e.length-1),r<0&&(r=0),r>=e.length&&(r=e.length),t>=0&&r<=e.length)return Math.min(...e.slice(t,r+1))}getMaxInRange(e,t,r){if(t=Math.floor(t*this.SamplingUnit),r=Math.ceil(r*this.SamplingUnit),!e)return Number.MIN_VALUE;if(t<0&&(t=0),t>=e.length&&(t=e.length-1),r<0&&(r=0),r>=e.length&&(r=e.length),t>=0&&r<=e.length)return Math.max(...e.slice(t,r+1))}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}}var parser$2={exports:{}};/*! * d-path-parser - v1.0.0 * by Massimo Artizzu (MaxArt2501) * * https://github.com/MaxArt2501/d-path-parser * * Licensed under the MIT License * See LICENSE for details */(function(i,e){(function(t,r){i.exports=r()})(commonjsGlobal,function(){return function(r){for(var s={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},o={number:function(A){return+b("number",A)},"coordinate pair":function(A){var P=b("number",A);if(P===null&&!A)return null;b("comma");var x=b("number",!0);return{x:+P,y:+x}},"arc definition":function(A){var P=o["coordinate pair"](A);if(!P&&!A)return null;b("comma");var x=+b("number",!0);b("comma",!0);var E=!!+b("flag",!0);b("comma");var _=!!+b("flag",!0);b("comma");var T=o["coordinate pair"](!0);return{radii:P,rotation:x,large:E,clockwise:_,end:T}}},a=0,l=[];at.bottom)switch(e.tagName.toLowerCase()){case"g":for(const y of e.children)this.recursiveUpdate(y,t,r,s);break;case"circle":case"rect":case"line":case"path":let m=Math.floor((o.x-r.x)/unitInPixels*this.mRules.SamplingUnit);const d=m+Math.ceil(o.width/unitInPixels*this.mRules.SamplingUnit);if(e.parentElement.classList.contains("vf-beams")&&e.hasAttribute("d")){const y=parse$3(e.getAttribute("d"));if(y.length===5){const b=y[0],S=y[3],A=(S.end.y-b.end.y)/(S.end.x-b.end.x);let P=b.end.y/unitInPixels;for(m;m<=d;m++)Pu[m]&&(u[m]=P),P+=A/this.mRules.SamplingUnit}}else for(m;m<=d;m++)au[m]&&(u[m]=l);break}}calculateLinesForMeasure(e,t){var R,I,M;const r=t.getBBox(),s=Math.max(Math.round(e.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),o=r.height/unitInPixels,l=t.getElementsByClassName("vf-stave")[0].getBBox();let c=(l==null?void 0:l.height)/unitInPixels,u=(l==null?void 0:l.y)/unitInPixels;const m=e.getVFStave();let d=((R=m.options)!=null&&R.num_lines?m.options.num_lines:5)-1,y=-1,b=0;const S=[d];for(const D of(I=m.options)==null?void 0:I.line_config)D.visible?(y===-1&&(y=b),S.push(b)):d--,b++;const A=S.pop();y===-1&&(y=0),d=A-y;const P=(M=m.options)==null?void 0:M.spacing_between_lines_px,x=d*P/unitInPixels;c-x>.2&&(c=x,u=y*P/unitInPixels);const E=u+c,_=new Array(s).fill(u),T=new Array(s).fill(E),C=[_,T];if(o>c)for(const D of t.children)this.recursiveUpdate(D,{top:u,bottom:E},r,[_,T]);return C}calculateLines(){this.mSkyLine=[],this.mBottomLine=[];const e=document.createElement("div");document.body.append(e);const t=new SvgVexFlowBackend(this.mRules);t.initialize(e,1,"0");const r=t.getContext(),s=r.openGroup();s.classList.add("staffline");for(const o of this.StaffLineParent.Measures){o.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),o.setAbsoluteCoordinates(o.PositionAndShape.AbsolutePosition.x*unitInPixels,o.PositionAndShape.AbsolutePosition.y*unitInPixels);const a=o.draw(r),[l,c]=this.calculateLinesForMeasure(o,a);this.mSkyLine.push(...l),this.mBottomLine.push(...c)}r.closeGroup();for(const o of s.getElementsByClassName("vf-ties"))for(const a of o.childNodes)if(a.nodeName.toLowerCase()==="path"){const l=a.getBBox();let c=Math.floor(l.x/unitInPixels*this.mRules.SamplingUnit);const u=c+Math.ceil(l.width/unitInPixels*this.mRules.SamplingUnit),m=l.y/unitInPixels,d=l.height/unitInPixels+m;for(c;c<=u;c++)mthis.mBottomLine[c]&&(this.mBottomLine[c]=d)}t.clear(),e.remove()}}const VF$1=Vex.Flow;class VexFlowGraphicalSymbolFactory{constructor(){this.hasBBox=!1,document.createElementNS("http://www.w3.org/2000/svg","g").getBBox!==void 0&&(this.hasBBox=!0)}createMusicSystem(e,t){return new VexFlowMusicSystem(e,t)}createStaffLine(e,t){return new VexFlowStaffLine(e,t)}createSkyBottomLineCalculator(e){return e.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new SkyBottomLineCalculatorSVG(e):new SkyBottomLineCalculator(e)}createGraphicalMeasure(e,t,r=!1){return new VexFlowMeasure(t,e,void 0)}createMultiRestMeasure(e,t,r){return new VexFlowMultiRestMeasure(t,e,r)}createTabStaffMeasure(e,t){return new VexFlowTabMeasure(t,e)}createExtraGraphicalMeasure(e){const t=new VexFlowMeasure(e.ParentStaff,void 0,e);return t.IsExtraGraphicalMeasure=!0,t.ExtraGraphicalMeasurePreviousMeasure=e.Measures.last(),t}createStaffEntry(e,t){return new VexFlowStaffEntry(t,e,void 0)}createVoiceEntry(e,t){return new VexFlowVoiceEntry(e,t)}createNote(e,t,r,s=OctaveEnum.NONE,o,a=void 0){return new VexFlowGraphicalNote(e,t,r,s,o,a)}createGraceNote(e,t,r,s,o=OctaveEnum.NONE){return new VexFlowGraphicalNote(e,t,r,o,s)}addGraphicalAccidental(e,t){e.setAccidental(t)}addFermataAtTiedEndNote(e,t){}createInStaffClef(e,t){const r=e,s=VexFlowConverter.Clef(t,"small");r.vfClefBefore=new VF$1.ClefNote(s.type,s.size,s.annotation)}createChordSymbols(e,t,r,s){const o=t.parentMeasure.parentSourceMeasure.Rules;let a=0;const l=o.ChordSymbolXSpacing;for(const c of e.ChordContainers){const u=new GraphicalChordSymbolContainer(c,t.PositionAndShape,o.ChordSymbolTextHeight,r,s,t.parentMeasure.parentSourceMeasure.Rules),m=u.GraphicalLabel;m.PositionAndShape.RelativePosition.y-=o.ChordSymbolYOffset,m.PositionAndShape.RelativePosition.x+=a,m.setLabelPositionAndShapeBorders(),u.PositionAndShape.calculateBoundingBox(),t.graphicalChordContainers.push(u),a+=m.PositionAndShape.Size.width+l}}createGraphicalTechnicalInstruction(e,t){}}class GraphicalTie{constructor(e,t=void 0,r=void 0){this.tie=e,this.startNote=t,this.endNote=r}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(e){this.startNote=e}get EndNote(){return this.endNote}set EndNote(e){this.endNote=e}}class GraphicalLyricEntry{constructor(e,t,r,s){this.lyricsEntry=e,this.graphicalStaffEntry=t;const o=t.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;e.Text.length>=4&&e.Parent.Notes[0].Length.Denominator>4&&TextAlignmentEnum.LeftBottom;const a=new Label(e.Text);this.graphicalLabel=new GraphicalLabel(a,r,o,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,t.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(0,s),o===TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(e){this.graphicalLyricWord=e}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(e){this.graphicalLabel=e}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(e){this.graphicalStaffEntry=e}}class GraphicalLyricWord{constructor(e){this.graphicalLyricsEntries=[],this.lyricWord=e,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(e){this.graphicalLyricsEntries=e}isFilled(){for(let e=0;e=He.bezierCurveStepSize?new PointF2D:new PointF2D(He.oneMinusTPow3[t]*this.bezierStartPt.x+He.bezierFactorOne[t]*this.bezierStartControlPt.x+He.bezierFactorTwo[t]*this.bezierEndControlPt.x+He.tPow3[t]*this.bezierEndPt.x,He.oneMinusTPow3[t]*this.bezierStartPt.y+He.bezierFactorOne[t]*this.bezierStartControlPt.y+He.bezierFactorTwo[t]*this.bezierEndControlPt.y+He.tPow3[t]*this.bezierEndPt.y)}};_GraphicalCurve.bezierCurveStepSize=1e3;let GraphicalCurve=_GraphicalCurve;const _GraphicalSlur=class Bt extends GraphicalCurve{constructor(e,t){super(),this.staffEntries=[],this.slur=e,this.rules=t}static Compare(e,t){if(e.staffEntries.length<1)return-1;if(t.staffEntries.length<1)return 1;const r=Fraction$1.minus(e.staffEntries[e.staffEntries.length-1].getAbsoluteTimestamp(),e.staffEntries[0].getAbsoluteTimestamp()),s=Fraction$1.minus(t.staffEntries[t.staffEntries.length-1].getAbsoluteTimestamp(),t.staffEntries[0].getAbsoluteTimestamp());return r.RealValue>s.RealValue?1:s.RealValue>r.RealValue?-1:0}calculateCurve(e){const t=this.staffEntries[0],r=this.staffEntries[this.staffEntries.length-1];let s=t.findGraphicalNoteFromNote(this.slur.StartNote);!s&&this.graceStart&&(s=t.findGraphicalNoteFromGraceNote(this.slur.StartNote)),s||(s=t.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let o=r.findGraphicalNoteFromNote(this.slur.EndNote);!o&&this.graceEnd&&(o=r.findGraphicalNoteFromGraceNote(this.slur.EndNote));const a=t.parentMeasure.ParentStaffLine,l=a.SkyBottomLineCalculator;this.calculatePlacement(l,a);const c=this.calculateStartAndEnd(s,o,a,e,l),u=c.startX,m=c.endX;let d=c.startY,y=c.endY;const b=e.SlurTangentMinAngle,S=e.SlurTangentMaxAngle;let A;if(this.placement===PlacementEnum.Above){d-=e.SlurNoteHeadYOffset,y-=e.SlurNoteHeadYOffset;const P=new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,d);s?P.x+=this.staffEntries[0].PositionAndShape.BorderRight:P.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(P.x+=r.PositionAndShape.RelativePosition.x);const x=new PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,y);if(o?x.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:x.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(x.x+=r.staffEntryParent.PositionAndShape.RelativePosition.x),A=this.calculateTopPoints(P,x,a,l),A.length===0){const oe=new PointF2D((x.x-P.x)/2+P.x,(x.y-P.y)/2+P.y);A.push(oe)}const E=Math.atan((y-d)/(m-u)),_=new PointF2D(0,0);let T=new PointF2D(m-u,-(y-d));const C=Matrix2D.getRotationMatrix(E),R=C.getTransposeMatrix();T=C.vectorMultiplication(T);const I=this.calculateTranslatedAndRotatedPointListAbove(A,u,d,C);let M=this.calculateMaxLeftSlope(I,_,T),D=this.calculateMaxRightSlope(I,_,T);const H=_.y-_.x*M,W=T.y-T.x*D,O=new PointF2D;let z=!1;Math.abs(Math.abs(M)-Math.abs(D))<1e-4?(O.x=T.x/2,O.y=0,z=!0):(O.x=(W-H)/(M-D),O.y=M*O.x+H);const k=this.calculateHeightWidthRatio(T.x,I);let $=0,F=0;if(Math.abs(k)>.001){const oe=Math.abs(M/(k*2)),ue=Math.abs(M);$=Math.max(0,ue*(Math.min(10,oe-1)/10)),M-=$;const fe=Math.abs(D/(k*2)),be=Math.abs(D);F=Math.max(0,be*(Math.min(10,fe-1)/10)),D+=F}let G=b,N=-b;if(!z){const oe=this.calculateAngles(b,M,D,S);G=oe.startAngle,N=oe.endAngle}const V=this.calculateControlPoints(T.x,G,N,I,k,d,y);let K=V.startControlPoint,U=V.endControlPoint;K=R.vectorMultiplication(K),K.x+=u,K.y=-K.y+d,U=R.vectorMultiplication(U),U.x+=u,U.y=-U.y+d,this.bezierStartPt=new PointF2D(u,d-$),this.bezierStartControlPt=new PointF2D(K.x,K.y-$),this.bezierEndControlPt=new PointF2D(U.x,U.y-F),this.bezierEndPt=new PointF2D(m,y-F);const J=a.SkyLine.length,me=l.getLeftIndexForPointX(this.bezierStartPt.x,J),he=l.getLeftIndexForPointX(this.bezierEndPt.x,J),le=this.bezierEndPt.x-this.bezierStartPt.x,Se=l.SamplingUnit;for(let oe=me;oe=me&&(a.SkyLine[be]=Math.min(a.SkyLine[be],fe.y)),be++,be.001){const oe=Math.abs(M/(k*2)),ue=Math.abs(M);$=Math.max(0,ue*(Math.min(10,oe-1)/10)),M-=$;const fe=Math.abs(D/(k*2)),be=Math.abs(D);F=Math.max(0,be*(Math.min(10,fe-1)/10)),D+=F}let G=b,N=-b;if(!z){const oe=this.calculateAngles(b,M,D,S);G=oe.startAngle,N=oe.endAngle}const V=this.calculateControlPoints(T.x,G,N,I,k,d,y);let K=V.startControlPoint,U=V.endControlPoint;K=R.vectorMultiplication(K),K.x+=u,K.y+=d,U=R.vectorMultiplication(U),U.x+=u,U.y+=d,this.bezierStartPt=new PointF2D(u,d+$),this.bezierStartControlPt=new PointF2D(K.x,K.y+$),this.bezierEndControlPt=new PointF2D(U.x,U.y+F),this.bezierEndPt=new PointF2D(m,y+F);const J=a.BottomLine.length,me=l.getLeftIndexForPointX(this.bezierStartPt.x,J),he=l.getLeftIndexForPointX(this.bezierEndPt.x,J),le=this.bezierEndPt.x-this.bezierStartPt.x,Se=l.SamplingUnit;for(let oe=me;oe=me&&(a.BottomLine[be]=Math.max(a.BottomLine[be],fe.y)),be++,be0){this.placement=PlacementEnum.Above;return}const r=this.staffEntries[0],s=this.staffEntries[this.staffEntries.length-1],o=r.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection,a=s.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(o===a)this.placement=o===StemDirectionType.Up?PlacementEnum.Below:PlacementEnum.Above;else{let l=r.PositionAndShape.BorderLeft+r.PositionAndShape.RelativePosition.x+r.parentMeasure.PositionAndShape.RelativePosition.x,c=s.PositionAndShape.BorderRight+s.PositionAndShape.RelativePosition.x+s.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(l+=s.PositionAndShape.RelativePosition.x),this.graceEnd&&(c+=s.staffEntryParent.PositionAndShape.RelativePosition.x);const u=e.getSkyLineMinInRange(l,c)*-1;e.getBottomLineMaxInRange(l,c)-t.StaffHeight>u?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below}}calculateTopPoints(e,t,r,s){const o=[];let a=s.getRightIndexForPointX(e.x,r.SkyLine.length),l=s.getLeftIndexForPointX(t.x,r.SkyLine.length);a<0&&(a=0),l>=r.SkyLine.length&&(l=r.SkyLine.length-1);for(let c=a;c=r.BottomLine.length&&(l=r.BottomLine.length-1);for(let c=a;cm&&e>d&&(u+=e/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,u*=1+t/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,c/=u);const y=Math.min(.5,Math.max(.1,1.7*t/80*c*Math.pow(Math.max(o,.05),.4))),b=Math.min(.5,Math.max(.1,1.7*-r/80*c*Math.pow(Math.max(o,.05),.4))),S=new PointF2D;S.x=e*y*Math.cos(t*Bt.degreesToRadiansFactor),S.y=e*y*Math.sin(t*Bt.degreesToRadiansFactor);const A=new PointF2D;A.x=e-e*b*Math.cos(r*Bt.degreesToRadiansFactor),A.y=-(e*b*Math.sin(r*Bt.degreesToRadiansFactor));let P=S.y-A.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(P)>this.rules.SlurMaximumYControlPointDistance;)P<0?(S.y+=1,A.y-=1):(S.y-=1,A.y+=1),P=S.y-A.y;return{startControlPoint:S,endControlPoint:A}}calculateAngles(e,t,r,s){let a=Math.atan(t)/Bt.degreesToRadiansFactor;t>0?a+=20:a-=20;let l=Math.atan(r)/Bt.degreesToRadiansFactor;r<0?l-=20:l+=20;const c=Math.min(Math.max(e,a),s),u=Math.max(Math.min(-e,l),-s);return{startAngle:c,endAngle:u}}};_GraphicalSlur.degreesToRadiansFactor=Math.PI/180;let GraphicalSlur=_GraphicalSlur;class GraphicalPedal extends GraphicalObject{constructor(e,t){super(),this.getPedal=e,this.setSymbol(),this.PositionAndShape=new BoundingBox$1(this,t)}setSymbol(){!this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=MusicSymbol.PEDAL_SYMBOL:this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=MusicSymbol.PEDAL_MIXED:this.pedalSymbol=MusicSymbol.PEDAL_BRACKET}}class VexFlowPedal extends GraphicalPedal{constructor(e,t,r=!1,s=!1){switch(super(e,t),this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=e.ChangeBegin,this.ChangeEnd=e.ChangeEnd,this.pedalSymbol){case MusicSymbol.PEDAL_SYMBOL:this.vfStyle=Vex.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new BoundingBox$1(this,t);break;case MusicSymbol.PEDAL_MIXED:r&&s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:r?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED;break;case MusicSymbol.PEDAL_BRACKET:default:r&&s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:r?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET;break}}setStartNote(e){if(!e)return!1;for(const t of e.graphicalVoiceEntries){const r=t;if(r!=null&&r.vfStaveNote)return this.startNote=r.vfStaveNote,this.startVfVoiceEntry=r,!0}return!1}setEndNote(e){if(!e)return!1;for(const t of e.graphicalVoiceEntries){const r=t;if(r!=null&&r.vfStaveNote)return this.endNote=r.vfStaveNote,this.endVfVoiceEntry=r,!0}return!1}setEndMeasure(e){this.endMeasure=e}CalculateBoundingBox(){}setLine(e){this.line=e}getPedalMarking(){var t,r,s,o;const e=new Vex.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&e.setEndStave(this.endMeasure.getVFStave()),e.setStyle(this.vfStyle),e.setLine(this.line),e.setCustomText(this.DepressText,this.ReleaseText),(((t=this.endVfVoiceEntry)==null?void 0:t.parentStaffEntry)===((o=(s=(r=this.endVfVoiceEntry)==null?void 0:r.parentStaffEntry)==null?void 0:s.parentMeasure)==null?void 0:o.staffEntries.last())||!this.endVfVoiceEntry)&&(e.EndsStave=!0),e.ChangeBegin=this.ChangeBegin,e.ChangeEnd=this.ChangeEnd,e}}class GraphicalWavyLine extends GraphicalObject{constructor(e,t){super(),this.getWavyLine=e,this.PositionAndShape=new BoundingBox$1(this,t)}}class VexflowVibratoBracket extends GraphicalWavyLine{constructor(e,t,r=!1){super(e,t),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=r}get ToEndOfStopStave(){return this.toEndOfStopStave}setStartNote(e){for(const t of e.graphicalVoiceEntries){const r=t;if(r!=null&&r.vfStaveNote)return this.startNote=r.vfStaveNote,this.startVfVoiceEntry=r,!0}return!1}setEndNote(e){for(const t of e.graphicalVoiceEntries){const r=t;if(r!=null&&r.vfStaveNote){this.endNote=r.vfStaveNote,this.endVfVoiceEntry=r;const s=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,o=s[s.length-1];return this.toEndOfStopStave=o===this.endVfVoiceEntry.parentStaffEntry,!0}}return!1}CalculateBoundingBox(){const e=this.getVibratoBracket();this.boundingBox.Size.height=e.render_options.wave_height*.2}getVibratoBracket(){const e=new Vex.Flow.VibratoBracket({start:this.startNote,stop:this.endNote,toEndOfStopStave:this.toEndOfStopStave});return e.setLine(this.line),this.isVibrato?e.render_options.vibrato_width=20:e.render_options.wave_girth=4,e}}const VF=Vex.Flow;class VexFlowMusicSheetCalculator extends MusicSheetCalculator{constructor(e){var t,r,s,o,a,l,c,u;super(),this.beamsNeedUpdate=!1,this.rules=e,MusicSheetCalculator.symbolFactory=new VexFlowGraphicalSymbolFactory,MusicSheetCalculator.TextMeasurer=new VexFlowTextMeasurer(this.rules),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules),((t=this.rules.DefaultVexFlowNoteFont)==null?void 0:t.toLowerCase())==="gonville"?Vex.Flow.DEFAULT_FONT_STACK=[(r=Vex.Flow.Fonts)==null?void 0:r.Gonville,(s=Vex.Flow.Fonts)==null?void 0:s.Bravura,(o=Vex.Flow.Fonts)==null?void 0:o.Custom]:((a=this.rules.DefaultVexFlowNoteFont)==null?void 0:a.toLowerCase())==="petaluma"&&(Vex.Flow.DEFAULT_FONT_STACK=[(l=Vex.Flow.Fonts)==null?void 0:l.Petaluma,(c=Vex.Flow.Fonts)==null?void 0:c.Gonville,(u=Vex.Flow.Fonts)==null?void 0:u.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules);for(const e of this.graphicalMusicSheet.MeasureList)for(const t of e)t==null||t.clean()}formatMeasures(){for(const e of this.graphicalMusicSheet.MeasureList){if(!e||!e[0])continue;e[0].format();for(const r of e){for(const s of r.staffEntries)s.calculateXPosition();r.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(e){const t=[];for(const m of e)m&&t.push(m);if(t.length===0)return 0;e=t;const r=[],s=new VF.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let o=e[0].staffEntries.length,a=1;for(const m of e){if(!m)continue;let d=0;for(const S of m.staffEntries)d+=S.setMaxAccidentals();m.parentSourceMeasure.ImplicitMeasure&&(o=Math.max(m.staffEntries.length,o),a=Math.max(m.staffEntries.length+d,a));const y=m.vfVoices,b=[];for(const S in y)y.hasOwnProperty(S)&&(b.push(y[S]),r.push(y[S]));if(b.length===0){log$2.debug("Found a measure with no voices. Continuing anyway.",y);continue}s.joinVoices(b)}let l=12;const c=e[0].parentSourceMeasure,u=.3;if(r.length>0){l=s.preCalculateMinTotalWidth(r)/unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+o*u,c!=null&&c.ImplicitMeasure&&(l=c.Duration.RealValue/c.ActiveTimeSignature.RealValue*l,o>1&&(l+=a*u*1.5),l*=this.rules.PickupMeasureWidthMultiplier),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(e,l);const m=(y,b)=>{s.formatToStave(r,b.getVFStave())},d=(y,b)=>{s.formatToStave(r,b.getVFStave(),{align_rests:!0,context:void 0})};for(const y of e){if(this.rules.AlignRests===AlignRestOption.Never)y.formatVoices=m;else if(this.rules.AlignRests===AlignRestOption.Always)y.formatVoices=d;else if(this.rules.AlignRests===AlignRestOption.Auto){let b=!1;for(const S of y.staffEntries){let A=0,P=0;for(const x of S.graphicalVoiceEntries)if(x.parentVoiceEntry.IsGrace||x&&x.notes&&x.notes[0]&&x.notes[0].sourceNote&&x.notes[0].sourceNote.PrintObject&&A++,x&&x.notes&&x.notes[0]&&x.notes[0].sourceNote&&x.notes[0].sourceNote.isRest()&&x.notes[0].sourceNote.PrintObject&&P++,A>1&&P>=1){b=!0;break}if(b)break}b?y.formatVoices=d:y.formatVoices=m}if(y===e[0]){const b=y;b.formatVoices(l*unitInPixels,b)}}}for(const m of e)if(m)for(const d of m.staffEntries)d.calculateXPosition();for(const m of e){if(!m)continue;const d=m.vfVoices,y=[];for(const b in d)d.hasOwnProperty(b)&&y.push(d[b]);if(y.length===0){log$2.debug("Found a measure with no voices. Continuing anyway.",d);continue}s.joinVoices(y)}return l}calculateElongationFactor(e,t,r,s,o,a,l,c){let u=o,m=0;for(const d of e){const y=d.GraphicalLabel.Label.textAlignment;let b=l,S=c;if(d instanceof GraphicalLyricEntry&&d.ParentLyricWord){d.LyricsEntry.SyllableIndex>0&&(b=this.rules.BetweenSyllableMinimumDistance,TextAlignment.IsCenterAligned(y)&&(b+=1));const O=d.ParentLyricWord.GetLyricWord.Syllables;O.length>1&&d.LyricsEntry.SyllableIndex4&&(H*=1.1)}}else r[m]&&(H=_/T);M=Math.max(D,H),u=Math.max(u,M);let W=Math.max(_-T||0,0);r[m]&&(W+=r[m].cumulativeOverlap),r[m]={cumulativeOverlap:W,extend:d instanceof GraphicalLyricEntry?d.LyricsEntry.extend:!1,labelWidth:P,measureNumber:a,sourceNoteDuration:d instanceof GraphicalLyricEntry?d.LyricsEntry&&d.LyricsEntry.Parent.Notes[0].Length:!1,text:d instanceof GraphicalLyricEntry?d.LyricsEntry.Text:d.GraphicalLabel.Label.text,xPosition:E},m++}return u}calculateElongationFactorFromStaffEntries(e,t,r,s){let o=r;const a={},l={};for(const c of e)c.LyricsEntries.length>0&&(o=this.calculateElongationFactor(c.LyricsEntries,c,a,t,o,s,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),c.graphicalChordContainers.length>0&&(o=this.calculateElongationFactor(c.graphicalChordContainers,c,l,t,o,s,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return o}calculateMeasureWidthFromStaffEntries(e,t){var a;let r=1;if(!((a=window.GYM)==null?void 0:a.multitrack))for(const l of e)!l||l.staffEntries.length===0||(r=this.calculateElongationFactorFromStaffEntries(l.staffEntries,t,r,l.MeasureNumber),r=1);return r=Math.min(r,this.rules.MaximumLyricsElongationFactor),t*r}createGraphicalTie(e,t,r,s,o){return new GraphicalTie(e,s,o)}updateStaffLineBorders(e){e.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(e){e.rules=this.rules,e.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(e,t,r,s){for(let o=0;o=2&&(a=s.vfnote[0],l=s.vfnote[1]);let c,u=0;if(o&&o.vfnote&&o.vfnote.length>=2&&(c=o.vfnote[0],u=o.vfnote[1]),t){if(a){const P=new VF.StaveTie({first_indices:[l],first_note:a}),x=s.parentVoiceEntry.parentStaffEntry.parentMeasure;if(c){c.getDuration()==="w"&&((d=(m=c.keyProps)==null?void 0:m[0])==null?void 0:d.line)>=3&&c.setStemDirection(-1);let E=((y=window.GYM)==null?void 0:y.tieDirection)||0;Math.abs(E)===1&&(((S=(b=c.keyProps)==null?void 0:b[0])==null?void 0:S.line)>=3?c.setStemDirection(-E):c.setStemDirection(E)),P==null||P.setDirection(c.getStemDirection())}if(x.vfTies.length>0){const E=x.vfTies[0].direction;P==null||P.setDirection(E?-E:1)}x.addStaveTie(P,e)}if(c){const P=new VF.StaveTie({last_indices:[u],last_note:c}),x=o.parentVoiceEntry.parentStaffEntry.parentMeasure;if(x.vfTies.length>0){const E=x.vfTies[0].direction;P==null||P.setDirection(E?-E:1)}x.addStaveTie(P,e)}}else if(a||c){let P;if(r)if(e.Tie.Type==="S"){const _=e.StartNote.sourceNote,T=e.EndNote.sourceNote;let C=1;_.FretNumber>T.FretNumber&&(C=-1),P=new VF.TabSlide({first_indices:[l],first_note:a,last_indices:[u],last_note:c},C)}else P=new VF.TabTie({first_indices:[l],first_note:a,last_indices:[u],last_note:c},e.Tie.Type);else{P=new VF.StaveTie({first_indices:[l],first_note:a,last_indices:[u],last_note:c});const _=e.Tie.getTieDirection(s.sourceNote);_===PlacementEnum.Below?P.setDirection(1):_===PlacementEnum.Above&&P.setDirection(-1);try{Math.abs((a==null?void 0:a.getTieRightX())-(c==null?void 0:c.getTieLeftX()))<10&&(P.render_options.first_x_shift=-3,P.render_options.last_x_shift=3)}catch(T){console.log(T)}}const x=o.parentVoiceEntry.parentStaffEntry.parentMeasure,E=((A=window.GYM)==null?void 0:A.graceCustom)||!1;E&&P.setDirection(E.direction),x.addStaveTie(P,e)}}calculateDynamicExpressionsForMultiExpression(e,t,r){if(tthis.rules.MaxMeasureToDrawIndex)return;const s=e.AbsoluteTimestamp,o=this.graphicalMusicSheet.MeasureList[t],a=o[r].ParentStaffLine,l=o[r];if(!a)return;const c=this.getRelativePositionInStaffLineFromTimestamp(s,r,a,a==null?void 0:a.isPartOfMultiStaffInstrument());if(c.x<=0&&(c.x=l.beginInstructionsWidth+this.rules.RhythmRightMargin),e.InstantaneousDynamic){const u=new VexFlowInstantaneousDynamicExpression(e.InstantaneousDynamic,a,l);this.calculateGraphicalInstantaneousDynamicExpression(u,c,s),this.dynamicExpressionMap.set(s.RealValue,u.PositionAndShape)}if(e.StartingContinuousDynamic){const u=e.StartingContinuousDynamic,m=new VexFlowContinuousDynamicExpression(e.StartingContinuousDynamic,a,l.parentSourceMeasure);if(m.StartMeasure=l,!m.IsVerbal&&u.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(m,c),m.updateSkyBottomLine()}catch(d){}else m.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(m,c):log$2.warn("This continuous dynamic is not covered. measure"+e.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(e,t){var E,_,T,C,R,I,M,D,H;const r=Math.max(e.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),s=t||r,o=Math.max(e.StaffNumber-1,0),a=this.graphicalMusicSheet.MeasureList[s][o].getVFStave();let l="q";if(e.beatUnit){const W=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);l=VexFlowConverter.durations(W,!1)[0]}let c=this.rules.MetronomeMarkYShift,u=!1;const m=[];if(e.parentMeasure){for(const W of e.parentMeasure.StaffLinkedExpressions)for(const O of W)O&&O instanceof UnknownExpression&&m.push(O);for(const W of e.parentMeasure.TempoExpressions){const O=((E=W.InstantaneousTempo)==null?void 0:E.Enum)===TempoEnum.metronomeMark;if(!e.beatUnit&&W.InstantaneousTempo.beatUnit){const z=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);l=VexFlowConverter.durations(z,!1)[0]}if(W.getPlacementOfFirstEntry()===PlacementEnum.Above&&!O){u=!0;break}}}u&&(c-=1.4);const d=(_=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:_.SkyLine;let y=e.TempoInBpm,b="",S="",A="";for(const W of this.graphicalMusicSheet.MeasureList[s][o].parentSourceMeasure.TempoExpressions){if(S=W.CombinedExpressionsText,isSpecialMark(W.CombinedExpressionsText)){b=W.CombinedExpressionsText;break}if(isSpeedKeyword(W.CombinedExpressionsText)||isSpeedHiddenKeyword(W.CombinedExpressionsText)){b=formatSpeedKeyword(W.CombinedExpressionsText),y=W.sourceMeasure.TempoInBPM,isSpeedKeyword(W.CombinedExpressionsText)&&(A=l);break}}const P={bpm:e.TempoInBpm,dots:e.dotted,duration:l,name:b};b&&(P.bpm=y/(P.dots?1.5:1),isSpeedKeyword(S)?P.duration=A:(y===SpeedTag[b]||!SpeedTag[b])&&(P.duration=""));const x=((C=(T=this.graphicalMusicSheet.MeasureList[s][o].vfVoices)==null?void 0:T[1])==null?void 0:C.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(d){const k=((I=(R=this.graphicalMusicSheet.MeasureList[0])==null?void 0:R[o])==null?void 0:I.ParentStaffLine).Measures.map($=>$.MeasureNumber-1);if(x&&k.includes(s)&&(isSpeedKeyword(S)||isSpeedHiddenKeyword(S))){const $=d.slice(0,9);let F=Math.min(...$);F=F<0?F-1:F,c+=F}k.includes(s)&&m.length?d[0]=Math.min(d[0],-4.5+c-4):d[0]=Math.min(d[0],-4.5+c)}a.options.line_config.reduce((z,k)=>(k.visible&&z++,z),0)<5&&(c-=2),a.setTempo(P,c*unitInPixels);let O=0;try{const z=(H=(D=(M=this.graphicalMusicSheet.MeasureList[s][o])==null?void 0:M.vfVoices)==null?void 0:D[1])==null?void 0:H.getTickables();O+=z[e.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-a.getNoteStartX()}catch(z){}a.getModifiers()[a.getModifiers().length-1].setShiftX(O)}}calculateRehearsalMark(e){var u,m,d,y,b,S,A,P;const t=e.rehearsalExpression;if(!t)return;const r=(d=(m=(u=e.VerticalMeasureList)==null?void 0:u[0])==null?void 0:m.getVFStave)==null?void 0:d.call(m);if(!r)return;const s=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let o=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;e.IsSystemStartMeasure&&(o+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const a=this.rules.RehearsalMarkFontSize,l=r.getModifiers(),c=l.find(x=>x.getCategory().toLocaleLowerCase()==="repetitions");if(c&&c.setShiftY(c.y_shift-10),r.setSection(t.label,s,o,a),(b=(y=e.VerticalMeasureList)==null?void 0:y[0])!=null&&b.ParentStaffLine.AbstractExpressions){const x=l.find(E=>E.getCategory().toLocaleLowerCase()==="stavesection");for(let E of((P=(A=(S=e==null?void 0:e.VerticalMeasureList)==null?void 0:S[0])==null?void 0:A.ParentStaffLine)==null?void 0:P.AbstractExpressions)||[])E instanceof GraphicalUnknownExpression&&(x&&(E.Label.PositionAndShape.RelativePosition.y-=.5),c&&(E.Label.PositionAndShape.RelativePosition.y-=1.7))}}calculateSingleOctaveShift(e,t,r,s){var S;const o=t.OctaveShiftStart,a=o.ParentStartMultiExpression.Timestamp,l=(S=o.ParentEndMultiExpression)==null?void 0:S.Timestamp,c=this.rules.MinMeasureToDrawIndex,u=this.rules.MaxMeasureToDrawIndex;let m=this.graphicalMusicSheet.MeasureList[r][s].ParentStaffLine;m||(m=this.graphicalMusicSheet.MeasureList[c][s].ParentStaffLine);let d;o.ParentEndMultiExpression?d=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentEndMultiExpression.SourceMeasureParent,s):d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0),d.MeasureNumber>u+1&&(d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let y;if(o.ParentEndMultiExpression?y=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s):y=this.graphicalMusicSheet.MeasureList[c][s],y.MeasureNumberu||d.parentSourceMeasure.measureListIndexu)return;let b=d.ParentStaffLine;if(b||(b=m),d&&m&&b){const A=new VexFlowOctaveShift(o,m.PositionAndShape);if(!A.startNote){let E;for(const _ of y.staffEntries)if(_){E=_;break}if(!E||(A.setStartNote(E),!A.startNote))return}if(!A.endNote){let E;for(let _=d.staffEntries.length-1;_>=0;_++)if(d.staffEntries[_]){E=d.staffEntries[_];break}if(A.setEndNote(E),!A.endNote)return}let P=y.findGraphicalStaffEntryFromTimestamp(a);P||(P=y.staffEntries[0]);let x=d.findGraphicalStaffEntryFromTimestamp(l);if(x||(x=d.staffEntries[d.staffEntries.length-1]),A.setStartNote(P),b!==m){A.endsOnDifferentStaffLine=!0;let E=m.Measures[m.Measures.length-1];E===void 0&&(E=d);const _=E.staffEntries[E.staffEntries.length-1];A.setEndNote(_);const T=b.ParentMusicSystem.Id-m.ParentMusicSystem.Id;if(T>0)for(let C=m.ParentMusicSystem.Id;Cu+1&&(d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let y;if(o.ParentEndMultiExpression?y=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s):(y=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s),y||(y=this.graphicalMusicSheet.MeasureList[c][s])),y.MeasureNumberu||d.parentSourceMeasure.measureListIndexu)return;let b=d.ParentStaffLine;if(b||(b=m),d&&m&&b){let A=!1;m!==b&&(A=!0);const P=new VexFlowPedal(o,m.PositionAndShape,!1,A);let x=y.findGraphicalStaffEntryFromTimestamp(a);x||(x=y.staffEntries[0]);let E=d.findGraphicalStaffEntryFromTimestamp(l);if(E||(E=d.staffEntries[d.staffEntries.length-1]),!P.setStartNote(x))return;if(b!==m)if(P.pedalSymbol===MusicSymbol.PEDAL_SYMBOL){P.setEndNote(E),P.setEndMeasure(d),P.ReleaseText=" ",P.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(P.startVfVoiceEntry,P.endVfVoiceEntry,P,m);const _=b.Measures[0],T=new VexFlowPedal(o,_.PositionAndShape),C=_.staffEntries[0];if(!T.setStartNote(C))return;T.setEndNote(E),P.setEndMeasure(d),b.Pedals.push(T),T.CalculateBoundingBox(),T.DepressText=" ",this.calculatePedalSkyBottomLine(T.startVfVoiceEntry,T.endVfVoiceEntry,T,b)}else{let _=m.Measures[m.Measures.length-1];_===void 0&&(_=d);const T=_.staffEntries[_.staffEntries.length-1];P.setEndNote(T),P.setEndMeasure(d),P.ChangeEnd=!1;const C=b.ParentMusicSystem.Id-m.ParentMusicSystem.Id;if(C>0){let R=1;for(let I=m.ParentMusicSystem.Id;Iu+1&&(d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let y;if(o.ParentEndMultiExpression?y=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s):y=this.graphicalMusicSheet.MeasureList[c][s],y.MeasureNumberu||d.parentSourceMeasure.measureListIndexu)return;let b=d.ParentStaffLine;if(b||(b=m),d&&m&&b){const P=new VexflowVibratoBracket(o,m.PositionAndShape,y.ParentStaff.isTab);let x=y.findGraphicalStaffEntryFromTimestamp(a);x||(x=y.staffEntries[0]);let E=d.findGraphicalStaffEntryFromTimestamp(l);if(E||(E=d.staffEntries[d.staffEntries.length-1]),P.setStartNote(x),b!==m){let _=m.Measures[m.Measures.length-1];_===void 0&&(_=d);const T=_.staffEntries[_.staffEntries.length-1];if(P.setEndNote(T),b.ParentMusicSystem.Id-m.ParentMusicSystem.Id>0)for(let R=m.ParentMusicSystem.Id;Rd){const _=d;d=m,m=_}s.SkyBottomLineCalculator.updateBottomLineInRange(m,d,y+x)}for(const x of s.Pedals){const E=x,_=E.getPedalMarking(),T=_.line+3+(s.StaffLines.length-1);if(y>T){const C=_.render_options.text_margin_right/10;let R=E.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-C,I;E.setLine(y-3-(s.StaffLines.length-1));let M=(S=E.endVfVoiceEntry)==null?void 0:S.PositionAndShape;if(M||(M=E.endMeasure.PositionAndShape),E.EndSymbolPositionAndShape){const D=l.render_options.glyph_point_size/20;I=R+3.4;const H=M.AbsolutePosition.x-C,W=H+1.5;s.SkyBottomLineCalculator.updateBottomLineInRange(R,I,y+D),s.SkyBottomLineCalculator.updateBottomLineInRange(H,W,y+D)}else{const D=_.render_options.bracket_height/10;if(_.EndsStave)I=M.AbsolutePosition.x+M.Size.width-C;else switch(l.style){case a.BRACKET_OPEN_END:case a.BRACKET_OPEN_BOTH:case a.MIXED_OPEN_END:I=M.AbsolutePosition.x+M.BorderRight-C;break;default:I=M.AbsolutePosition.x+M.BorderLeft-C;break}const H=(P=(A=E.endVfVoiceEntry)==null?void 0:A.parentStaffEntry)==null?void 0:P.vfClefBefore;if(H){const W=H.getWidth()/10;I+=W}if(R>I){const W=R;R=I,I=W}s.SkyBottomLineCalculator.updateBottomLineInRange(R,I,y+D)}}}}calculateOctaveShiftSkyBottomLine(e,t,r,s){if(!t){log$2.warn("octaveshift: no endStaffEntry");return}let o=e.PositionAndShape.Size.width,a=t.PositionAndShape.Size.width;e.hasOnlyRests()?o=-o:o/=2,t.hasOnlyRests()?a*=2:a/=2,e===t&&(a*=2);const l=e.PositionAndShape.AbsolutePosition.x-o,c=t.PositionAndShape.AbsolutePosition.x+a;r.PositionAndShape.Size.width=l-c;const u=r.getTextBracket(),m=u.font.size/10;if(u.position===VF.TextBracket.Positions.TOP){const d=Math.ceil(s.SkyBottomLineCalculator.getSkyLineMinInRange(l,c));if(d===1/0)return;u.start.getStave().options.top_text_position=Math.abs(d),s.SkyBottomLineCalculator.updateSkyLineInRange(l,c,d-m*2)}else{const d=s.SkyBottomLineCalculator.getBottomLineMaxInRange(l,c);if(d===1/0)return;u.start.getStave().options.bottom_text_position=d,e.parentMeasure!==t.parentMeasure&&(u.stop.getStave().options.bottom_text_position=d),s.SkyBottomLineCalculator.updateBottomLineInRange(l,c,d+m*1.5)}}calculateWordRepetitionInstruction(e,t){let r;const s=this.graphicalMusicSheet.MeasureList[t];for(let o=0,a=s.length;o{r.updateSkyBottomLine()})}catch(r){}}handleTiedGraphicalNote(e,t,r,s,o,a,l,c){}handleBeam(e,t,r){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(e,t)}handleVoiceEntryLyrics(e,t,r){e.LyricsEntries.forEach((s,o)=>{const a=new GraphicalLyricEntry(o,t,this.rules.LyricsHeight,this.rules.StaffHeight);if(t.LyricsEntries.push(a),a.GraphicalLabel.setLabelPositionAndShapeBorders(),o.Word){const c=o.Word.Syllables.indexOf(o);let u=r.indexOf(o.Word);if(u===-1&&(r.push(o.Word),u=r.indexOf(o.Word)),this.graphicalLyricWords.length===0||u>this.graphicalLyricWords.length-1){const m=new GraphicalLyricWord(o.Word);a.ParentLyricWord=m,m.GraphicalLyricsEntries[c]=a,this.graphicalLyricWords.push(m)}else{const m=this.graphicalLyricWords[u];a.ParentLyricWord=m,m.GraphicalLyricsEntries[c]=a,m.isFilled()&&(r.splice(u,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(m),1))}}})}handleVoiceEntryOrnaments(e,t,r){}handleVoiceEntryArticulations(e,t,r){}handleVoiceEntryTechnicalInstructions(e,t,r){}handleTuplet(e,t,r){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(e,t)}findIndexGraphicalSlurFromSlur(e,t){for(let r=0;r=0){const d=s[m];d.staffEntries.indexOf(a)===-1&&d.staffEntries.push(a),s.splice(m,1)}}}for(const l of s)l.staffEntries.indexOf(a)===-1&&l.staffEntries.push(a)}}for(const t of this.musicSystems)for(const r of t.StaffLines){const s=r.GraphicalSlurs.sort(GraphicalSlur.Compare);for(const o of s)o.slur.isCrossed()||o.calculateCurve(this.rules)}}}class MusicPartManager{constructor(e){this.musicSheet=e}reInit(){this.init()}init(){this.parts=this.musicSheet.Repetitions.slice(),this.sheetStart=this.musicSheet.SelectionStart=new Fraction$1(0,1),this.sheetEnd=this.musicSheet.SelectionEnd=this.musicSheet.SheetEndTimestamp,this.calcMapping()}getCurrentRepetitionTimestampTransform(e){let t;for(let r=this.timestamps.length-1;r>=0;r--)if(t=this.timestamps[r],e.gte(t.from))return t;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(e){if(this.timestamps.length===0)return e;const t=this.getCurrentRepetitionTimestampTransform(e);return Fraction$1.plus(e,Fraction$1.minus(t.to,t.from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(e){return e?new MusicPartManagerIterator(this.musicSheet,e,void 0):new MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(e){this.musicSheet.SelectionStart=e,this.musicSheet.SelectionEnd=void 0}setSelectionRange(e,t){this.musicSheet.SelectionStart=e!=null?e:this.sheetStart,this.musicSheet.SelectionEnd=t!=null?t:this.sheetEnd}calcMapping(){this.timestamps=[];const e=this.getIterator();let t=e.CurrentRepetition,r=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(r);!e.EndReached;){if(e.JumpOccurred||t!==e.CurrentRepetition){if(t=e.CurrentRepetition,e.backJumpOccurred){const s=e.JumpResponsibleRepetition;r.nextBackJump=e.CurrentEnrolledTimestamp,r.curRepetition=s,r.curRepetitionIteration=e.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let o=this.timestamps.length-2;o>=0&&!(s.AbsoluteTimestamp.gt(this.timestamps[o].to)||this.timestamps[o].curRepetition);o--)this.timestamps[o].nextBackJump=r.nextBackJump,this.timestamps[o].curRepetition=s,this.timestamps[o].curRepetitionIteration=r.curRepetitionIteration}r=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(r)}e.moveToNext()}}}class TimestampTransform{constructor(e,t,r,s){this.from=e,this.to=t,this.curRepetition=r,this.curRepetitionIteration=s,this.nextBackJump=void 0,this.nextForwardJump=void 0}}class PartListEntry{constructor(e){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=e}get Visible(){return this.visible}set Visible(e){this.visible=e}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}}class SourceMusicPart extends PartListEntry{constructor(e,t,r){super(e),this.musicSheet=e,this.startIndex=t,this.endIndex=r}get MeasuresCount(){return this.endIndex-this.startIndex+1}get StartIndex(){return this.startIndex}get EndIndex(){return this.endIndex}get ParentRepetition(){return this.parentRepetition}set ParentRepetition(e){this.parentRepetition=e}get AbsoluteTimestamp(){return Fraction$1.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(e){this.startIndex=e}setEndIndex(e){this.endIndex=e}}class Repetition extends PartListEntry{constructor(e,t=!1){super(e),this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.userNumberOfRepetitions=0,this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=e,this.virtualOverallRepetition=t}get BackwardJumpInstructions(){return this.backwardJumpInstructions}get EndingIndexDict(){return this.endingIndexDict}get EndingParts(){return this.endingParts}get Visibles(){return this.visibles}set Visibles(e){this.visibles=e}get DefaultNumberOfRepetitions(){let e=2;return this.virtualOverallRepetition&&(e=1),Math.max(e,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}get UserNumberOfRepetitions(){return this.userNumberOfRepetitions}set UserNumberOfRepetitions(e){this.userNumberOfRepetitions=e,this.repetitonIterationOrder=[];const t=this.userNumberOfRepetitions-this.NumberOfEndings;for(let r=1;r<=this.userNumberOfRepetitions;r++)r<=t?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(r-t)}getForwardJumpTargetForIteration(e){const t=this.repetitonIterationOrder[e-1];return this.endingIndexDict[t]?this.endingIndexDict[t].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(e,t){const r=new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2,t,t));this.endingParts.push(r);for(const s of e)try{this.endingIndexDict[s]=r,r.endingIndices.push(s),this.numberOfEndings0&&(s=1),o.Add(new Fraction$1(s,t)),o}}class MusicSheet{constructor(){this.idString="random idString, not initialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new MusicSheetErrors,this.staves=[],this.playbackDataDict=new Dictionary,this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new Fraction$1(0,1),this.soundTempos=new Map,this.playbackSettings=new PlaybackSettings,this.playbackSettings.rhythm=new Fraction$1(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new MusicPartManager(this),this.hasBPMInfo=!1}get SoundTempos(){return this.soundTempos}set SoundTempos(e){this.soundTempos=e}static getIndexFromStaff(e){return e.idInMusicSheet}get CurrentKeyInstruction(){return this.currentKeyInstruction}set CurrentKeyInstruction(e){this.currentKeyInstruction=e}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(e){this.sourceMeasures=e}get Repetitions(){return this.repetitions}set Repetitions(e){this.repetitions=e}get DynListStaves(){return this.dynListStaves}get TimestampSortedTempoExpressionsList(){return this.timestampSortedTempoExpressionsList}get TimestampSortedDynamicExpressionsList(){return this.timestampSortedDynamicExpressionsList}get InstrumentalGroups(){return this.instrumentalGroups}get Parts(){return this.instruments}get Instruments(){return this.instruments}get SheetPlaybackSetting(){return this.playbackSettings}set SheetPlaybackSetting(e){this.playbackSettings=e}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(e){this.drawErroneousMeasures=e}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(e){this.hasBeenOpenedForTheFirstTime=e}InitializeStartTempoInBPM(e){this.playbackSettings.BeatsPerMinute=e,this.userStartTempoInBPM=e}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(e){this.defaultStartTempoInBpm=e,this.InitializeStartTempoInBPM(e)}get Path(){return this.path}set Path(e){this.path=e}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(e){this.Title=new Label(e)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(e){this.Subtitle=new Label(e)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(e){this.Composer=new Label(e)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(e){this.Lyricist=new Label(e)}get Title(){return this.title}set Title(e){this.title=e}get Subtitle(){return this.subtitle}set Subtitle(e){this.subtitle=e}get Composer(){return this.composer}set Composer(e){this.composer=e}get Lyricist(){return this.lyricist}set Lyricist(e){this.lyricist=e}get Rules(){return this.rules||(log$2.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new EngravingRules),this.rules}set Rules(e){this.rules=e}get SheetErrors(){return this.musicSheetErrors}get PlaybackDataDict(){return this.playbackDataDict}get SelectionStart(){return this.selectionStart}set SelectionStart(e){this.selectionStart=e.clone(),this.currentEnrolledPosition=e.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(e){this.selectionEnd=e}set HasBPMInfo(e){this.hasBPMInfo=e}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(e){this.sourceMeasures.push(e),e.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let e=0,t=this.instruments.length;e0){const e=this.TimestampSortedTempoExpressionsList[0];if(e.InstantaneousTempo)return e.InstantaneousTempo.TempoInBpm;if(e.ContinuousTempo)return e.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(e){return log$2.info("MusicSheet.FirstMeasureNumber: ",e),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(e){return log$2.info("MusicSheet.LastMeasureNumber: ",e),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(e){this.currentEnrolledPosition=e.clone()}get Transpose(){return this.transpose}set Transpose(e){this.transpose=e}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(e){this.idString=e}getEnrolledSelectionStartTimeStampWorkaround(){const e=this.MusicPartManager.getIterator(this.SelectionStart);return Fraction$1.createFromFraction(e.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const e=this.getLastSourceMeasure();return Fraction$1.plus(e.AbsoluteTimestamp,e.Duration)}getSourceMeasureFromTimeStamp(e){for(let t=0,r=this.sourceMeasures.length;t0&&s.Voices[0].Visible&&e.push(s)}return e}}MusicSheet.defaultTitle="[no title given]";class LyricWord{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(e){for(let t=0,r=this.Syllables.length;t=0&&(this.syllableIndex=o)}get Text(){return this.text}set Text(e){this.text=e}get Word(){return this.word}get Parent(){return this.parent}set Parent(e){this.parent=e}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}}class LyricsReader{constructor(e){this.openLyricWords={},this.musicSheet=e}addLyricEntry(e,t){var r,s;if(e){const o=e;for(let a=0,l=o.length;a0)for(let T=x;T1&&(b=parseInt(P[1],10))}catch(P){const x=ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(x);continue}}let A;if(u==="single"||u==="end"){if(this.openLyricWords[b]){this.currentLyricWord=this.openLyricWords[b];const P=this.currentLyricWord.Syllables.length;A=new LyricsEntry(d,b,this.currentLyricWord,t,P),this.currentLyricWord.Syllables.push(A),delete this.openLyricWords[b],this.currentLyricWord=void 0}else A=new LyricsEntry(d,b,void 0,t);A.extend=c.element("extend")!==void 0}else if(u==="begin")this.openLyricWords[b]&&(delete this.openLyricWords[b],this.currentLyricWord=void 0),this.currentLyricWord=new LyricWord,this.openLyricWords[b]=this.currentLyricWord,A=new LyricsEntry(d,b,this.currentLyricWord,t,0),this.currentLyricWord.Syllables.push(A);else if(u==="middle")if(this.openLyricWords[b]){this.currentLyricWord=this.openLyricWords[b];const P=this.currentLyricWord.Syllables.length;A=new LyricsEntry(d,b,this.currentLyricWord,t,P),this.currentLyricWord.Syllables.push(A)}else A=new LyricsEntry(d,b,void 0,t);A&&(t.LyricsEntries[b]||(t.LyricsEntries.setValue(b,A),(s=(r=t.ParentSourceStaffEntry)==null?void 0:r.VerticalContainerParent)!=null&&s.ParentMeasure&&(t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),t.ParentVoice.Parent.LyricVersesNumbers[b]||t.ParentVoice.Parent.LyricVersesNumbers.push(b))}}}catch(u){const m=ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(m);continue}}t.ParentVoice.Parent.LyricVersesNumbers=t.ParentVoice.Parent.LyricVersesNumbers.filter((a,l,c)=>c.indexOf(a)===l)}}}class Articulation{constructor(e,t){this.articulationEnum=e,this.placement=t}Equals(e){return e.articulationEnum===this.articulationEnum&&e.placement===this.placement}}class ArticulationReader{constructor(e){this.rules=e}getAccEnumFromString(e){switch(e){case"sharp":return AccidentalEnum.SHARP;case"flat":return AccidentalEnum.FLAT;case"natural":return AccidentalEnum.NATURAL;case"double-sharp":case"sharp-sharp":return AccidentalEnum.DOUBLESHARP;case"double-flat":case"flat-flat":return AccidentalEnum.DOUBLEFLAT;case"triple-sharp":return AccidentalEnum.TRIPLESHARP;case"triple-flat":return AccidentalEnum.TRIPLEFLAT;case"quarter-sharp":return AccidentalEnum.QUARTERTONESHARP;case"quarter-flat":return AccidentalEnum.QUARTERTONEFLAT;case"three-quarters-sharp":return AccidentalEnum.THREEQUARTERSSHARP;case"three-quarters-flat":return AccidentalEnum.THREEQUARTERSFLAT;case"slash-quarter-sharp":return AccidentalEnum.SLASHQUARTERSHARP;case"slash-sharp":return AccidentalEnum.SLASHSHARP;case"double-slash-flat":return AccidentalEnum.DOUBLESLASHFLAT;case"sori":return AccidentalEnum.SORI;case"koron":return AccidentalEnum.KORON;default:return AccidentalEnum.NONE}}addArticulationExpression(e,t){var r,s;if(e!==void 0&&e.elements().length>0){const o=e.elements();for(let a=0,l=o.length;a0&&t.Articulations[0].articulationEnum!==ArticulationEnum.staccato&&t.Articulations.splice(0,0,b),u==="strongaccent"){const S=(s=c==null?void 0:c.attribute("type"))==null?void 0:s.value;S==="up"?b.articulationEnum=ArticulationEnum.marcatoup:S==="down"&&(b.articulationEnum=ArticulationEnum.marcatodown)}if(u==="detachedlegato"){const S=new Articulation(ArticulationEnum.staccato,d),A=new Articulation(ArticulationEnum.tenuto,d);t.Articulations.push(S,A)}if(!t.hasArticulation(b))switch(t.Articulations.push(b),b.articulationEnum){case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:t.DurationModifier=b;break;case ArticulationEnum.accent:case ArticulationEnum.strongaccent:t.VolumeModifier=b;break;default:break}}}catch(m){const d="Invalid note articulation.";log$2.debug("addArticulationExpression",d,m);return}}}}addFermata(e,t){var o;let r=ArticulationEnum.fermata;e.attributes().length>0&&e.attribute("type")&&e.attribute("type").value==="inverted"&&(r=ArticulationEnum.invertedfermata);let s=PlacementEnum.Above;((o=e.attribute("placement"))==null?void 0:o.value)==="below"&&(s=PlacementEnum.Below),t.Articulations.push(new Articulation(r,s))}addTechnicalArticulations(e,t,r){var l,c;const s={bend:ArticulationEnum.bend,"down-bow":ArticulationEnum.downbow,"open-string":ArticulationEnum.naturalharmonic,"snap-pizzicato":ArticulationEnum.snappizzicato,stopped:ArticulationEnum.lefthandpizzicato,"up-bow":ArticulationEnum.upbow};for(const u in s){if(!s.hasOwnProperty(u))continue;const m=s[u],d=e.element(u);if(d){let y;((l=d.attribute("placement"))==null?void 0:l.value)==="above"&&(y=PlacementEnum.Above),((c=d.attribute("placement"))==null?void 0:c.value)==="below"&&(y=PlacementEnum.Below);const b=new Articulation(m,y);t.hasArticulation(b)||t.Articulations.push(b)}}const o=e.element("fingering");if(o){const u=this.createTechnicalInstruction(o,r);u.type=TechnicalInstructionType.Fingering,r.Fingering=u,t.TechnicalInstructions.push(u)}const a=e.element("string");if(a){const u=this.createTechnicalInstruction(a,r);u.type=TechnicalInstructionType.String,r.StringInstruction=u,t.TechnicalInstructions.push(u)}}createTechnicalInstruction(e,t){const r=new TechnicalInstruction;r.sourceNote=t,r.value=e.value;const s=e.attribute("placement");return this.rules.FingeringPositionFromXML&&(r.placement=this.getPlacement(s)),r}getPlacement(e,t=PlacementEnum.NotYetDefined){if(t!==PlacementEnum.NotYetDefined)return t;if(e)switch(e.value){case"above":return PlacementEnum.Above;case"below":return PlacementEnum.Below;case"left":return PlacementEnum.Left;case"right":return PlacementEnum.Right;default:return PlacementEnum.NotYetDefined}else return PlacementEnum.NotYetDefined}addOrnament(e,t){if(e){let r;const s={"delayed-inverted-turn":OrnamentEnum.DelayedInvertedTurn,"delayed-turn":OrnamentEnum.DelayedTurn,"inverted-mordent":OrnamentEnum.InvertedMordent,"inverted-turn":OrnamentEnum.InvertedTurn,mordent:OrnamentEnum.Mordent,"trill-mark":OrnamentEnum.Trill,turn:OrnamentEnum.Turn};for(const o in s){if(!s.hasOwnProperty(o))continue;const a=e.element(o);if(a){r=new OrnamentContainer(s[o]);const l=a.attribute("placement");l&&l.value==="below"&&(r.placement=PlacementEnum.Below)}}if(r){const o=e.elements("accidental-mark");if(o){let a=PlacementEnum.Below,l=AccidentalEnum.NONE;const c=o;for(let u=0,m=c.length;u0&&(this.currentVoiceEntry.GraceVoiceEntriesBefore=this.graceVoiceEntriesTempList,this.graceVoiceEntriesTempList=[]))}finalizeReadingMeasure(){this.graceVoiceEntriesTempList.length>0&&this.currentNormalVoiceEntry!==void 0&&this.currentNormalVoiceEntry.GraceVoiceEntriesAfter.concat(this.graceVoiceEntriesTempList),this.graceVoiceEntriesTempList=[],this.pluginManager.processVoiceMeasureReadPlugins(this.currMeasureVoiceEntries,this.activeKey,this.activeRhythm),this.currMeasureVoiceEntries.length=0,this.openBeams.length>1&&this.handleOpenBeam()}read(e,t,r,s,o,a,l,c,u,m,d,y,b,S,A,P,x,E,_,T,C,R,I){this.currentStaffEntry=l,this.currentMeasure=c;try{this.currentNote=a?this.addRestNote(e.element("rest"),t,s,o,b,S,_):this.addSingleNote(e,t,s,r,o,d,y,b,S,A,P,x,E,_,C,R,I),this.currentNote.DotsXml=T;const M=e.elements("lyric");this.lyricsReader!==void 0&&M&&(this.lyricsReader.addLyricEntry(M,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let D=!1;const H=e.element("notations");if(H){this.articulationReader&&this.readArticulations(H,this.currentVoiceEntry,this.currentNote);const W=H.elements("slur");this.slurReader!==void 0&&W.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(W,this.currentNote);const O=H.elements("tuplet");O.length>0&&(this.openTupletNumber=this.addTuplet(e,O),D=!0);const z=H.element("arpeggiate");if(z!==void 0){let G;if(this.currentVoiceEntry.Arpeggio)G=this.currentVoiceEntry.Arpeggio;else{let N=!1;for(const V of this.currentStaffEntry.VoiceEntries)if(V.Arpeggio){N=!0,G=V.Arpeggio;break}if(!N){let V=ArpeggioType.ARPEGGIO_DIRECTIONLESS;const K=z.attribute("direction");if(K)switch(K.value){case"up":V=ArpeggioType.ROLL_UP;break;case"down":V=ArpeggioType.ROLL_DOWN;break;default:V=ArpeggioType.ARPEGGIO_DIRECTIONLESS}G=new Arpeggio(this.currentVoiceEntry,V),this.currentVoiceEntry.Arpeggio=G}}G.addNote(this.currentNote)}const k=H.elements("tied");k.length>0&&this.addTie(k,u,m,TieTypes.SIMPLE);const $=H.elements("slide");$.length>0&&this.addTie($,u,m,TieTypes.SLIDE);const F=H.element("technical");if(F){const G=F.elements("hammer-on");G.length>0&&this.addTie(G,u,m,TieTypes.HAMMERON);const N=F.elements("pull-off");N.length>0&&this.addTie(N,u,m,TieTypes.PULLOFF)}}e.element("time-modification")!==void 0&&!D&&this.handleTimeModificationNode(e)}catch(M){log$2.warn(M);const D=ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(D),this.musicSheet.SheetErrors.pushMeasureError(M)}return this.currentNote}checkForStaffEntryLink(e,t,r,s){const o=new StaffEntryLink(this.currentVoiceEntry);o.LinkStaffEntries.push(r),r.Link=o;const a=this.currentVoiceEntry.Timestamp.clone(),l=s.getVerticalContainerByTimestamp(a);return r=l.StaffEntries[e],r||(r=new SourceStaffEntry(l,t),l.StaffEntries[e]=r),r.VoiceEntries.push(this.currentVoiceEntry),o.LinkStaffEntries.push(r),r.Link=o,r}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const e=this.openTieDict;for(const t in e)if(e.hasOwnProperty(t)){const r=e[t];Fraction$1.plus(r.StartNote.ParentStaffEntry.Timestamp,r.Duration).lt(r.StartNote.SourceMeasure.Duration)&&delete e[t]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(e,t,r){const s=e.element("articulations");s&&this.articulationReader.addArticulationExpression(s,t);const o=e.element("fermata");o&&this.articulationReader.addFermata(o,t);const a=e.element("technical");a&&this.articulationReader.addTechnicalArticulations(a,t,r);const l=e.element("ornaments");l&&this.articulationReader.addOrnament(l,t)}addSingleNote(e,t,r,s,o,a,l,c,u,m,d,y,b,S,A,P,x){let E=0,_,T=AccidentalEnum.NONE,C=NoteEnum.C,R=NoteEnum.C,I=0,M=0,D,H,W;const O=e.elements();for(let K=0,U=O.length;K0&&this.openBeams.last().ExtendedNoteList.push(S),S}addNoteInfo(e,t,r,s,o,a,l,c,u){e.NoteTypeXml=t,e.PrintObject=r,e.IsCueNote=s,e.NormalNotes=o,e.displayStepUnpitched=a,e.displayOctaveUnpitched=l,e.NoteheadColorXml=c,e.NoteheadColor=c}createBeam(e,t){var r;try{const s=e.element("beam");let o;if(s!==void 0&&s.hasAttributes&&(o=s.attribute("number")),o){let a=parseInt(o.value,10);const l=e.elements("beam"),c=l[0].value;l&&(c==="begin"?(a===((r=this.openBeams.last())==null?void 0:r.BeamNumber)?(this.beamNumberOffset++,a+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Beam(a,this.beamNumberOffset))):a+=this.beamNumberOffset);let u=!1;if(!(a>0&&a<=this.openBeams.length)||!this.openBeams[a-1]){log$2.debug("[OSMD] invalid beamnumber");return}for(let m=0,d=this.openBeams[a-1].Notes.length;m1){let s=e.element("time-modification");s&&(s=s.element("actual-notes"));const o=t;for(let a=0,l=o.length;a1&&this.openTupletNumber--),this.tupletDict[d]=b;const A=[];A.push(this.currentNote),b.Notes.push(A),b.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=b,this.openTupletNumber=d}else if(m.value==="stop"){let d=1;c.attribute("number")&&(d=parseInt(c.attribute("number").value,10));const y=this.tupletDict[d];if(y){const b=c.attribute("placement");b&&(b.value==="below"?y.tupletLabelNumberPlacement=PlacementEnum.Below:y.tupletLabelNumberPlacement=PlacementEnum.Above,y.PlacementFromXml=!0);const S=[];if(S.push(this.currentNote),y.Notes.push(S),!y.PlacementFromXml){let A=!1;for(const P of y.Notes){for(const x of P)if(!x.isRest()){x.StemDirectionXml===StemDirectionType.Down?y.tupletLabelNumberPlacement=PlacementEnum.Below:y.tupletLabelNumberPlacement=PlacementEnum.Above,A=!0;break}if(A)break}}y.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=y,delete this.tupletDict[d],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(t[0]){const s=t[0];if(s.hasAttributes){const o=s.attribute("type").value;let a=1;s.attribute("number")&&(a=parseInt(s.attribute("number").value,10));const l=isNaN(a),c=s.attribute("bracket");if(c&&c.value==="yes"&&(r=!0),o==="start"){let u=0,m=e.element("time-modification");if(m&&(m=m.element("actual-notes")),m&&(u=parseInt(m.value,10),isNaN(u))){const S=ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(S),new MusicSheetReadingException(S)}l&&(this.openTupletNumber++,a=this.openTupletNumber);let d=this.tupletDict[a];d||(d=this.tupletDict[a]=new Tuplet(u,r),d.tupletLabelNumberPlacement=PlacementEnum.Above);const y=s.attribute("placement");y&&(y.value==="below"?d.tupletLabelNumberPlacement=PlacementEnum.Below:d.tupletLabelNumberPlacement=PlacementEnum.Above,d.PlacementFromXml=!0);const b=[];b.push(this.currentNote),d.Notes.push(b),d.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=d,this.openTupletNumber=a}else if(o==="stop"){l&&(a=this.openTupletNumber);const u=this.tupletDict[this.openTupletNumber];if(u){const m=s.attribute("placement");m&&(m.value==="below"?u.tupletLabelNumberPlacement=PlacementEnum.Below:u.tupletLabelNumberPlacement=PlacementEnum.Above,u.PlacementFromXml=!0);const d=[];if(d.push(this.currentNote),u.Notes.push(d),!u.PlacementFromXml){let y=!1;for(const b of u.Notes){for(const S of b)if(!S.isRest()){S.StemDirectionXml===StemDirectionType.Down?u.tupletLabelNumberPlacement=PlacementEnum.Below:u.tupletLabelNumberPlacement=PlacementEnum.Above,y=!0;break}if(y)break}}u.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=u,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[a]}}}}return this.openTupletNumber}handleTimeModificationNode(e){if(this.tupletDict[this.openTupletNumber])try{const t=this.tupletDict[this.openTupletNumber],r=CollectionUtil.last(t.Notes),s=r[0].ParentVoiceEntry;let o;s.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?o=r:(o=[],t.Notes.push(o),t.Fractions.push(this.getTupletNoteDurationFromType(e))),o.push(this.currentNote),this.currentNote.NoteTuplet=t}catch(t){const r=ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(r),t}else if(this.currentVoiceEntry.Notes.length>0){const t=this.currentVoiceEntry.Notes[0];if(t.NoteTuplet){const r=t.NoteTuplet;CollectionUtil.last(r.Notes).push(this.currentNote),this.currentNote.NoteTuplet=r}}}addTie(e,t,r,s){if(e){if(e.length===1){const o=e[0];if(o!==void 0&&o.attributes()){const a=this.getTieDirection(o),l=o.attribute("type").value;try{if(l==="start"){const c=this.findCurrentNoteInTieDict(this.currentNote);c<0&&delete this.openTieDict[c];const u=this.getNextAvailableNumberForTie(),m=new Tie(this.currentNote,s);this.openTieDict[u]=m,m.TieNumber=u,m.TieDirection=a}else if(l==="stop"){const c=this.findCurrentNoteInTieDict(this.currentNote),u=this.openTieDict[c];u&&(u.AddNote(this.currentNote),delete this.openTieDict[c])}}catch(c){const u=ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(u)}}}else if(e.length===2){const o=this.findCurrentNoteInTieDict(this.currentNote);if(o>=0){const a=this.openTieDict[o];a.AddNote(this.currentNote);for(const l of e)if(l.attribute("type").value==="start"){const u=this.getTieDirection(l);a.NoteIndexToTieDirection[a.Notes.length-1]=u}}}}}getTieDirection(e){let t=PlacementEnum.NotYetDefined;const r=e.attribute("placement");r&&(r.value==="above"?t=PlacementEnum.Above:r.value==="below"&&(t=PlacementEnum.Below));const s=e.attribute("orientation");return s&&(s.value==="over"?t=PlacementEnum.Above:s.value==="under"&&(t=PlacementEnum.Below)),t}getNextAvailableNumberForTie(){const e=Object.keys(this.openTieDict);if(e.length===0)return 1;e.sort((t,r)=>+t-+r);for(let t=0;t0?s.RealValue>0?(u=Fraction$1.multiply(Fraction$1.minus(s,o),u),this.directionTimestamp=Fraction$1.plus(u,s)):this.directionTimestamp=Fraction$1.createFromFraction(u):this.offsetDivisions<0&&(s.RealValue>0?(u=Fraction$1.multiply(Fraction$1.minus(s,o),u),this.directionTimestamp=Fraction$1.minus(s,u)):this.directionTimestamp=Fraction$1.createFromFraction(u));const m=e.attribute("placement");if(m)try{const d=m.value;d==="below"?this.placement=PlacementEnum.Below:d==="above"&&(this.placement=PlacementEnum.Above)}catch(d){const y=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");log$2.debug("ExpressionReader.readExpressionParameters",y,d),this.musicSheet.SheetErrors.pushMeasureError(y),this.placement=PlacementEnum.Below}if(this.placement===PlacementEnum.NotYetDefined)try{const d=e.element("direction-type");if(d){const y=d.element("dynamics");if(y){const P=y.attribute("default-y");P&&this.readExpressionPlacement(P,"read dynamics y pos")}const b=d.element("wedge");if(b){const P=b.attribute("default-y");P&&this.readExpressionPlacement(P,"read wedge y pos")}const S=d.element("words");if(S){const P=S.attribute("default-y");P&&this.readExpressionPlacement(P,"read words y pos")}const A=d.element("rehearsal");if(A){const P=A.attribute("default-y");P&&this.readExpressionPlacement(P,"read rehearsal pos")}}}catch(d){const y=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");log$2.debug("ExpressionReader.readExpressionParameters",y,d),this.musicSheet.SheetErrors.pushMeasureError(y),this.placement=PlacementEnum.Below}this.placement===PlacementEnum.NotYetDefined&&(t.Staves.length>1?this.placement=PlacementEnum.Below:t.HasLyrics?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below)}read(e,t,r,s=void 0,o=0,a){let l=!1,c=!1;const u=e.element("sound");if(u){const y=u.attribute("tempo"),b=u.attribute("dynamics");if(y){const S=y.value.match(/^(\d+)(\.\d+)?$/);(S==null?void 0:S.length)>0?this.soundTempo=Math.round(Number.parseFloat(y.value)):(log$2.info("invalid xml tempo: "+y.value),this.soundTempo=100),t.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,l=!0}if(b){const S=b.value.match(/\d+/);this.soundDynamic=S!==void 0?parseInt(S[0],10):100,c=!0}}const m=e.element("direction-type");if(!m)return;let d=m.element("metronome");if(d){t.metronomeNoteIndex=o;const y=d.element("beat-unit"),b=d.element("beat-unit-dot")!==void 0,S=d.element("per-minute");if(y!==void 0&&S){d.hasAttributes&&d.attribute("default-x")!==void 0&&(this.directionTimestamp=Fraction$1.createFromFraction(r));const P=parseFloat(S.value);!a&&this.createNewTempoExpressionIfNeeded(t);const x=new InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,P,this.currentMultiTempoExpression,!0);x.parentMeasure=t,this.soundTempo=P,t.TempoInBPM=this.soundTempo*(b?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),t.MeasureNumberXML===1&&this.musicSheet.SourceMeasures.length===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,x.dotted=b,x.beatUnit=y.value,this.currentMultiTempoExpression.addExpression(x,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}return}if(d=m.element("dynamics"),d){const y=e.element("notations")!==void 0;this.interpretInstantaneousDynamics(d,t,r,y);return}if(d=m.element("words"),d){const y=m.elements("words");let b="";for(const S of y)b+=S.value;if(d.value=b,l||isSpeedKeyword(d.value)||isSpeedHiddenKeyword(d.value)){this.createNewTempoExpressionIfNeeded(t),this.currentMultiTempoExpression.CombinedExpressionsText=d.value,(isSpeedKeyword(d.value)||isSpeedHiddenKeyword(d.value))&&(d.value=void 0);const S=new InstantaneousTempoExpression(d.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(S,"")}else c||this.interpretWords(d,t,r);return}if(d=m.element("wedge"),d){this.interpretWedge(d,t,s,t.MeasureNumber);return}if(d=m.element("rehearsal"),d){this.interpretRehearsalMark(d,t,r,t.MeasureNumber);return}}closeOpenExpressions(e,t){for(const r of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(e,r.NumberXml,t),this.closeOpenContinuousDynamic(r,e,t);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(Fraction$1.plus(e.AbsoluteTimestamp,t))}addOctaveShift(e,t,r){var l;let s=1;const o=e.element("staff");if(o)try{s=parseInt(o.value,10)}catch(c){const u=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(u),s=1,log$2.debug("ExpressionReader.addOctaveShift",u,c)}const a=e.element("direction-type");if(a){const c=a.element("octave-shift"),u=this.readPlacement(e);if(c!==void 0&&c.hasAttributes)try{const m=this.readNumber(c);if(c.attribute("size")){const d=parseInt(c.attribute("size").value,10);let y=0;d===8?y=1:d===15&&(y=2);let b=(l=c.attribute("type"))==null?void 0:l.value;if(b||(u===PlacementEnum.Above?b="down":u===PlacementEnum.Below&&(b="up")),b==="up"||b==="down"){const S=new OctaveShift(b,y);S.StaffNumber=s,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,m),this.getMultiExpression.OctaveShiftStart=S,S.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=S}else if(b==="stop"){if(this.openOctaveShift){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,this.openOctaveShift.numberXml,r);const S=this.getMultiExpression;S.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}}else b||log$2.debug("octave-shift missing type in xml")}}catch(m){const d=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(d),log$2.debug("ExpressionReader.addOctaveShift",d,m)}}}addPedalMarking(e,t,r){var o,a,l,c;const s=e.element("direction-type");if(s){const u=s.element("pedal");if(u!==void 0&&u.hasAttributes){let m=!1,d=!1;try{switch(((o=u.attribute("line"))==null?void 0:o.value)==="yes"?d=!0:((a=u.attribute("line"))==null?void 0:a.value)==="no"&&(d=!1,m=!0),((l=u.attribute("sign"))==null?void 0:l.value)==="yes"?m=!0:((c=u.attribute("sign"))==null?void 0:c.value)==="no"&&(m=!1,d=!0),u.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(t),this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Pedal(d,m),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(t);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(t,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Pedal(d,m),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(y){const b=ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(b),log$2.debug("ExpressionReader.addPedalMarking",b,y)}}}}endOpenPedal(e){this.createNewMultiExpressionIfNeeded(e,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(e,t,r,s){if(e&&e.hasAttributes)try{switch(e.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(t,-1),this.openWavyLine=new WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(t,-1,r),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0);break;case"continue":break;default:break}}catch(o){const a=ITextTranslation.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(a),log$2.debug("ExpressionReader.addWavyLine",a,o)}}initialize(){this.placement=PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(e){var r;const t=(r=e.attribute("placement"))==null?void 0:r.value;return t==="above"?PlacementEnum.Above:t==="below"?PlacementEnum.Below:PlacementEnum.NotYetDefined}readExpressionPlacement(e,t){try{const r=parseInt(e.value,10);r<0?this.placement=PlacementEnum.Below:r>0&&(this.placement=PlacementEnum.Above)}catch(r){log$2.debug("ExpressionReader.readExpressionParameters",t,r)}}interpretInstantaneousDynamics(e,t,r,s){if(e.hasElements){e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(r));const o=this.readNumber(e);let a=e.elements()[0].name;if(a==="other-dynamics"&&(a=e.elements()[0].value),a){s?this.createNewMultiExpressionIfNeeded(t,o,Fraction$1.createFromFraction(r)):this.createNewMultiExpressionIfNeeded(t,o);const l=new InstantaneousDynamicExpression(a,this.soundDynamic,this.placement,this.staffNumber,t);l.InMeasureTimestamp=r.clone(),this.getMultiExpression.addExpression(l,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=l.DynEnum:this.activeInstantaneousDynamic=new InstantaneousDynamicExpression(a,0,PlacementEnum.NotYetDefined,1,t)}}}interpretWords(e,t,r){const s=e.value;let o;const a=e.attribute("font-style");if(a&&a.value==="italic"&&(o=FontStyles.Italic),s.length>0){if(e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(r)),this.checkIfWordsNodeIsRepetitionInstruction(s))return;this.fillMultiOrTempoExpression(s,t,r,o),this.initialize()}}readNumber(e){var s;let t=1;const r=(s=e.attribute("number"))==null?void 0:s.value;return r&&(t=Number.parseInt(r,10)),t}interpretWedge(e,t,r,s){var a,l;e!==void 0&&e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(r));const o=this.readNumber(e);((l=(a=e.attribute("type"))==null?void 0:a.value)==null?void 0:l.toLowerCase())==="stop"?this.createNewMultiExpressionIfNeeded(t,o,r):this.createNewMultiExpressionIfNeeded(t,o),this.addWedge(e,t,r),this.initialize()}interpretRehearsalMark(e,t,r,s){t.rehearsalExpression=new RehearsalExpression(e.value,this.placement)}createNewMultiExpressionIfNeeded(e,t,r=void 0){r||(r=this.directionTimestamp);let s=this.getMultiExpression;return(!s||s&&(s.SourceMeasureParent!==e||s.numberXml!==t||s.SourceMeasureParent===e&&s.Timestamp!==r))&&(this.getMultiExpression=s=new MultiExpression(e,Fraction$1.createFromFraction(r)),e.StaffLinkedExpressions[this.globalStaffIndex].push(s)),s}createNewTempoExpressionIfNeeded(e){(!this.currentMultiTempoExpression||this.currentMultiTempoExpression.SourceMeasureParent!==e||this.currentMultiTempoExpression.Timestamp!==this.directionTimestamp)&&(this.currentMultiTempoExpression=new MultiTempoExpression(e,Fraction$1.createFromFraction(this.directionTimestamp)),e.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(e,t,r){if(e!==void 0&&e.hasAttributes){const s=this.readNumber(e),o=e.attribute("type").value.toLowerCase();try{if(o==="crescendo"||o==="diminuendo"){const a=new ContinuousDynamicExpression(ContDynamicEnum[o],this.placement,this.staffNumber,t,this.activeInstantaneousDynamic,s);this.openContinuousDynamicExpressions.push(a);let l=this.getMultiExpression;l||(l=this.createNewMultiExpressionIfNeeded(t,s)),l.StartingContinuousDynamic=a,a.StartMultiExpression=l,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===a.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(o==="stop")for(const a of this.openContinuousDynamicExpressions)a.NumberXml===s&&a.NumberXml===s&&this.closeOpenContinuousDynamic(a,t,r)}catch(a){const l="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(l),log$2.debug("ExpressionReader.addWedge",l,a)}}}fillMultiOrTempoExpression(e,t,r,s){if(!e)return;const o=e.trim();this.createExpressionFromString("",o,t,r,e,s)}createExpressionFromString(e,t,r,s,o,a){if(InstantaneousTempoExpression.isInputStringInstantaneousTempo(t)||ContinuousTempoExpression.isInputStringContinuousTempo(t)){if(r.TempoExpressions.length>0)for(let m=0,d=r.TempoExpressions.length;m0)for(let m=0,d=r.TempoExpressions.length;m0&&!this.hasDigit(t)&&this.globalStaffIndex>0){if(y.EntriesList[0].label.indexOf(t)>=0)return!1;break}}let c=TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(c=TextAlignmentEnum.LeftBottom);const u=new UnknownExpression(t,this.placement,c,this.staffNumber);return u.fontStyle=a,l.addExpression(u,e),!1}closeOpenContinuousDynamic(e,t,r){if(!e)return;const s=e.NumberXml;e.EndMultiExpression=this.createNewMultiExpressionIfNeeded(t,s,r),e.StartMultiExpression.EndingContinuousDynamic=e,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(o=>o!==e)}closeOpenContinuousTempo(e){this.openContinuousTempoExpression.AbsoluteEndTimestamp=e,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(e){return e=e.trim().toLowerCase(),e==="coda"||e==="tocoda"||e==="to coda"||e==="fine"||e==="d.c."||e==="dacapo"||e==="da capo"||e==="d.s."||e==="dalsegno"||e==="dal segno"||e==="d.c. al fine"||e==="d.s. al fine"||e==="d.c. al coda"||e==="d.s. al coda"}hasDigit(e){return/\d/.test(e)}}class Slur{constructor(){}get StartNote(){return this.startNote}set StartNote(e){this.startNote=e}get EndNote(){return this.endNote}set EndNote(e){this.endNote=e}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let e=0,t=this.startNote.NoteSlurs.length;e0){const s=r.attribute("type").value;let o=1;try{r.attribute("number")&&(o=parseInt(r.attribute("number").value,10))}catch(u){log$2.debug("VoiceGenerator.addSlur number: ",u)}let a=PlacementEnum.NotYetDefined;const l=r.attribute("placement");l&&l.value&&(l.value==="above"?a=PlacementEnum.Above:l.value==="below"&&(a=PlacementEnum.Below));const c=r.attribute("orientation");if(c&&c.value&&(c.value==="over"?a=PlacementEnum.Above:c.value==="under"&&(a=PlacementEnum.Below)),s==="start"){let u=this.openSlurDict[o];u||(u=new Slur,this.openSlurDict[o]=u),u.StartNote=t,u.PlacementXml=a}else if(s==="stop"){const u=this.openSlurDict[o];u&&(u.EndNote=t,t.checkForDoubleSlur(u)||(t.NoteSlurs.push(u),u.StartNote.NoteSlurs.push(u)),delete this.openSlurDict[o])}}}}catch(r){const s=ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(s)}}}class InstrumentReader{constructor(e,t,r,s){this.voiceGeneratorsDict={},this.staffMainVoiceGeneratorDict={},this.divisions=0,this.currentClefNumber=1,this.currentXmlMeasureIndex=0,this.activeKeyHasBeenInitialized=!1,this.abstractInstructions=[],this.openChordSymbolContainers=[],this.soundTempos=new Map,this.xmlNotes=[],this.repetitionInstructionReader=t,this.xmlMeasureList=r,this.musicSheet=s.GetMusicSheet,this.instrument=s,this.activeClefs=new Array(s.Staves.length),this.activeClefsHaveBeenInitialized=new Array(s.Staves.length);for(let o=0;o=this.xmlMeasureList.length)return!1;this.currentMeasure=e,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(e,this.currentXmlMeasureIndex);let s=new Fraction$1(0,1),o=new Fraction$1(0,1),a=!1;this.maxTieNoteFraction=new Fraction$1(0,1);let l=!1;const c=[];let u=!1;try{const T=this.xmlMeasureList[this.currentXmlMeasureIndex],C=T.elements();if(e.Rules.UseXMLMeasureNumbers&&!Number.isInteger(e.MeasureNumberXML)){const I=parseInt((m=T.attribute("number"))==null?void 0:m.value,10);Number.isInteger(I)&&(e.MeasureNumberXML=I)}let R;for(let I=0;I0&&(R=C[I-1]),M.name==="print"){const D=M.attribute("new-system");(D==null?void 0:D.value)==="yes"&&(e.printNewSystemXml=!0);const H=M.attribute("new-page");(H==null?void 0:H.value)==="yes"&&(e.printNewPageXml=!0)}else if(M.name==="note"){M.element("grace")||(this.xmlNotes.push(M),c.push(M));let D=!0;((d=M.attribute("print-object"))==null?void 0:d.value)==="no"&&(D=!1);let H=1;this.instrument.Staves.length>1&&M.element("staff")&&(H=parseInt(M.element("staff").value,10),isNaN(H)&&(log$2.debug("InstrumentReader.readNextXmlMeasure.get staff number"),H=1)),this.currentStaff=this.instrument.Staves[H-1];const W=M.element("chord")!==void 0;if(M.element("voice")){const ne=parseInt(M.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(ne,H-1)}else(!W||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,H-1));let O=0,z=new Fraction$1(0,1),k=2,$,F=!1;if(M.element("duration")){if(O=parseInt(M.element("duration").value,10),isNaN(O)){const ne=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(ne),log$2.debug("InstrumentReader.readNextXmlMeasure",ne);continue}else if(z=new Fraction$1(O,4*this.divisions),O===0?z=this.getNoteDurationFromTypeNode(M):$=this.getNoteDurationFromTypeNode(M),M.element("time-modification")){z=this.getNoteDurationForTuplet(M);const ne=M.element("time-modification");ne!=null&&ne.element("normal-notes")&&(k=parseInt(ne.element("normal-notes").value,10)),F=!0}}const G=M.element("rest")!==void 0,N=M.element("notations"),V=M.element("grace")!==void 0||O===0||W&&l;let K=!1,U=!1;if(V){const ne=M.element("duration"),se=M.element("grace");se&&se.attributes()&&se.attribute("slash")&&se.attribute("slash").value==="yes"&&(K=!0),ne||(z=this.getNoteDurationFromTypeNode(M));const ce=M.element("notations");ce&&ce.element("slur")&&(U=!0)}let J=!1;M.element("cue")&&(J=!0);const he=M.element("type");let le=NoteType.UNDEFINED;if(he){const ne=he.attribute("size");(ne==null?void 0:ne.value)==="cue"&&(J=!0),le=NoteTypeHandler.StringToNoteType(he.value)}let Se=StemDirectionType.Undefined,oe;const ue=M.element("stem");if(ue){switch(ue.value){case"down":Se=StemDirectionType.Down;break;case"up":Se=StemDirectionType.Up;break;case"double":Se=StemDirectionType.Double;break;case"none":Se=StemDirectionType.None;break;default:Se=StemDirectionType.Undefined}const ne=ue.attribute("color");ne&&(oe=this.parseXmlColor(ne.value))}let fe=0,be="",Ee="",ee="";if(N){const ne=N.element("ornaments");if(ne){const ye=ne.element("tremolo");if(ye){const Pe=ye.attribute("type");if(be=Pe.value,Pe){const pe=parseInt(ye.value,10);pe>0&&(fe=pe),(Pe.value==="start"||Pe.value==="stop")&&(z=new Fraction$1(parseInt(M.element("duration").value,10),4*this.divisions))}}const ge=ne.elements("wavy-line");if(ge!==void 0)for(const Pe of ge){const pe=this.expressionReaders[this.readExpressionStaffNumber(M)-1];pe&&(pe.readExpressionParameters(Pe,this.instrument,this.divisions,s,o,this.currentMeasure.MeasureNumber,!1),pe.addWavyLine(Pe,this.currentMeasure,s,o))}}N.elements("glissando").find(ye=>ye.attribute("type").value==="start")&&(Ee="start"),N.elements("slide").find(ye=>ye.attribute("type").value==="start")&&(ee="start")}let te;const B=M.element("notehead");if(B){const ne=B.attribute("color");ne&&(te=this.parseXmlColor(ne.value))}let re;const Z=M.attribute("color");Z&&(re=this.parseXmlColor(Z.value),te||(te=re),oe||(oe=re));let Y=s.clone();W&&(Y=o.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(Y,this.inSourceMeasureInstrumentIndex+H-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!W&&!V&&!l||V&&!l||V&&!W||!V&&l)&&this.currentVoiceGenerator.createVoiceEntry(Y,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,V,K,U),!V&&!W&&(o=s.clone(),s.Add(z)),W&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+H-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const q=this.currentStaffEntry!==void 0&&this.currentStaffEntry.Timestamp!==void 0&&this.currentStaffEntry.Timestamp.Equals(new Fraction$1(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,q),this.openChordSymbolContainers.length!==0&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,!F&&!V&&(z=new Fraction$1(O,4*this.divisions));const ie=M.elements("dot").length;if(this.currentVoiceGenerator.read(M,z,$,le,k,G,this.currentStaffEntry,this.currentMeasure,t,this.maxTieNoteFraction,W,r,D,J,V,Se,fe,oe,te,ie,be,Ee,ee),N!==void 0&&N.element("dynamics")){const ne=this.expressionReaders[this.readExpressionStaffNumber(M)-1];ne&&(ne.readExpressionParameters(M,this.instrument,this.divisions,s,o,this.currentMeasure.MeasureNumber,!1),ne.read(M,this.currentMeasure,o,void 0,c.length))}l=V}else if(M.name==="attributes"){const D=M.element("divisions");if(D&&(this.divisions=parseInt(D.value,10),isNaN(this.divisions))){const z=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(log$2.debug("InstrumentReader.readNextXmlMeasure",z),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(z+this.instrument.Name);else throw a=!0,new MusicSheetReadingException(z+this.instrument.Name)}if(!M.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const z=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(z+this.instrument.Name);else throw a=!0,new MusicSheetReadingException(z+this.instrument.Name)}this.addAbstractInstruction(M,r,R,s.clone()),s.Equals(new Fraction$1(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],M)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],M)&&this.saveClefInstructionAtEndOfMeasure();const H=M.elements("staff-details");for(const z of H){const k=z.element("staff-lines");if(k){let $=1;const F=z.attribute("number");F&&($=parseInt(F.value,10)),this.instrument.Staves[$-1].StafflineCount=parseInt(k.value,10)}}const W=M.element("measure-style");if(W){const z=W.element("multiple-rest");if(z){const k=z.value;let $=0;try{$=Number.parseInt(k,10),e.multipleRestMeasures!==void 0&&$!==e.multipleRestMeasures?e.multipleRestMeasures=0:(e.multipleRestMeasures=$,this.currentMultirestStartMeasure=e,this.followingMultirestMeasures=$+1)}catch(F){console.log("multirest parse error: "+F)}}}const O=M.element("clef");if(O){const z=O.element("clef-octave-change");(!z||Number(z==null?void 0:z.value)===0)&&(window.needPitchVoice=!0)}}else if(M.name==="forward"){const D=parseInt(M.element("duration").value,10);s.Add(new Fraction$1(D,4*this.divisions))}else if(M.name==="backup"){const D=parseInt(M.element("duration").value,10);s.Sub(new Fraction$1(D,4*this.divisions)),s.IsNegative()&&(s=new Fraction$1(0,1)),o.Sub(new Fraction$1(D,4*this.divisions)),o.IsNegative()&&(o=new Fraction$1(0,1))}else if(M.name==="direction"){const D=M.elements("direction-type"),H=M.element("direction-type");let W=Math.min(1,s.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(W/=this.activeRhythm.Rhythm.RealValue);let O=!1;if(this.repetitionInstructionReader&&(O=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(H,W)),!O){let z=this.expressionReaders[0];const k=this.readExpressionStaffNumber(M)-1;if(kG==null?void 0:G.toLocaleLowerCase()).includes((y=$.value)==null?void 0:y.toLocaleLowerCase())&&(this.currentGradualChangeMeasure=this.currentMeasure,this.currentMeasure.speedInfo={startWord:(b=$.value)==null?void 0:b.toLocaleLowerCase(),startXmlNoteIndex:c.length,endXmlNoteIndex:0,resetXmlNoteIndex:0,startMeasureListIndex:this.currentXmlMeasureIndex,endMeasureListIndex:0,resetMeasureListIndex:0},this.xmlNotes=[]),$.value.startsWith(GRADIENT_SPEED_CLOSE_TAG)&&((S=this.currentGradualChangeMeasure)!=null&&S.speedInfo)&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:this.xmlNotes.length,endMeasureListIndex:this.currentXmlMeasureIndex}),((A=$.value)==null?void 0:A.toLocaleLowerCase())==="a tempo".toLocaleLowerCase()&&((P=this.currentGradualChangeMeasure)!=null&&P.speedInfo)){const{endXmlNoteIndex:G,resetXmlNoteIndex:N,endMeasureListIndex:V}=this.currentGradualChangeMeasure.speedInfo;N===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:G||this.xmlNotes.length,endMeasureListIndex:V||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}$.value&&$.value.toLocaleLowerCase()==="hiddenspeed"?u=!0:u=!1}if(D.find(F=>F.element("metronome"))&&((x=this.currentGradualChangeMeasure)!=null&&x.speedInfo)){const{endXmlNoteIndex:F,resetXmlNoteIndex:G,endMeasureListIndex:N}=this.currentGradualChangeMeasure.speedInfo;G===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:F||this.xmlNotes.length,endMeasureListIndex:N||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}z.readExpressionParameters(M,this.instrument,this.divisions,s,o,this.currentMeasure.MeasureNumber,!1),z.read(M,this.currentMeasure,s,o.clone(),c.length,u)}}}else if(M.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(M)&&(this.currentMeasure.HasEndLine=!0);const D=M.attribute("location");if(I===C.length-1||D&&D.value==="right"){const W=(E=M.element("bar-style"))==null?void 0:E.value;if(W&&(this.currentMeasure.endingBarStyleXml=W,this.currentMeasure.endingBarStyleEnum=SystemLinesEnumHelper.xmlBarlineStyleToSystemLinesEnum(W),(_=this.currentGradualChangeMeasure)!=null&&_.speedInfo)){const{endXmlNoteIndex:O,resetXmlNoteIndex:z,endMeasureListIndex:k}=this.currentGradualChangeMeasure.speedInfo;z===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:O||this.xmlNotes.length,endMeasureListIndex:k||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.currentGradualChangeMeasure=void 0,this.xmlNotes=[]}}}else if(M.name==="sound")try{if(M.attribute("tempo")){const D=parseFloat(M.attribute("tempo").value);M.element("offset")&&(this.soundTempos.has(this.currentXmlMeasureIndex)||this.soundTempos.set(this.currentXmlMeasureIndex,[]),this.soundTempos.get(this.currentXmlMeasureIndex).push(D)),this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=D,this.musicSheet.HasBPMInfo=!0)}}catch(D){log$2.debug("InstrumentReader.readTempoInstruction",D)}else M.name==="harmony"&&this.openChordSymbolContainers.push(ChordSymbolReader.readChordSymbol(M,this.musicSheet,this.activeKey))}for(const I in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(I)&&this.voiceGeneratorsDict[I].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let I=0;I{this.voiceGeneratorsDict[I].finalizeReadingMeasure()}),this.musicSheet.HasBPMInfo?e.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120,this.currentMeasure.TempoInBPM||(this.currentMeasure.TempoInBPM=this.musicSheet.DefaultStartTempoInBpm)}catch(T){if(a)throw new MusicSheetReadingException(T.Message);const C=ITextTranslation.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(C),log$2.debug("InstrumentReader.readNextXmlMeasure",C,T)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}parseXmlColor(e){if(e)return e.length===7?e:e.length===9?"#"+e.substr(3):void 0}doCalculationsAfterDurationHasBeenSet(){for(const e in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(e)&&this.voiceGeneratorsDict[e].checkOpenTies()}getOrCreateVoiceGenerator(e,t){const r=this.instrument.Staves[t];let s=this.voiceGeneratorsDict[e];if(s)r.Voices.indexOf(s.GetVoice)===-1&&r.Voices.push(s.GetVoice);else{const o=this.staffMainVoiceGeneratorDict[t];o?(s=new VoiceGenerator(this.pluginManager,r,e,this.slurReader,o.GetVoice),r.Voices.push(s.GetVoice),this.voiceGeneratorsDict[e]=s):(s=new VoiceGenerator(this.pluginManager,r,e,this.slurReader),r.Voices.push(s.GetVoice),this.voiceGeneratorsDict[e]=s,this.staffMainVoiceGeneratorDict[t]=s)}return s}createExpressionGenerators(e){this.expressionReaders=new Array(e);for(let t=0;t0?t=this.musicSheet.SourceMeasures[0]:t=this.currentMeasure;const r=new ClefInstruction(ClefEnum.G,0,2);let s;t.FirstInstructionsStaffEntries[e]?(s=t.FirstInstructionsStaffEntries[e],s.removeFirstInstructionOfTypeClefInstruction()):(s=new SourceStaffEntry(void 0,void 0),t.FirstInstructionsStaffEntries[e]=s),r.Parent=s,s.Instructions.splice(0,0,r)}createDefaultKeyInstruction(){let e;this.musicSheet.SourceMeasures.length>0?e=this.musicSheet.SourceMeasures[0]:e=this.currentMeasure;const t=new KeyInstruction(void 0,0,KeyEnum.major);for(let r=this.inSourceMeasureInstrumentIndex;r0&&r[s-1].name==="backup")return!0;let o=-1;for(let a=0;a0||o<0}isAttributesNodeAtEndOfMeasure(e,t){const r=e.elements().slice();let s=0;for(let a=0;ao}getNoteDurationFromTypeNode(e){const t=e.element("type");if(t){const r=t.value;return NoteTypeHandler.getNoteDurationFromType(r)}return new Fraction$1(0,4*this.divisions)}addAbstractInstruction(e,t,r,s){if(e.element("divisions")&&e.elements().length===1)return;const o=e.element("transpose");if(o){const c=o.element("chromatic");c&&(this.instrument.PlaybackTranspose=parseInt(c.value,10))}const a=e.elements("clef");let l;if(a.length>0)for(let c=0,u=a.length;c using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(l),y=2,log$2.debug("InstrumentReader.addAbstractInstruction",l,_)}const P=m.element("sign");if(P)try{d=ClefEnum[P.value],ClefInstruction.isSupportedClef(d)||(l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),d=ClefEnum.G,y=2),d===ClefEnum.TAB&&(S=-1)}catch(_){l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),d=ClefEnum.G,y=2,log$2.debug("InstrumentReader.addAbstractInstruction",l,_)}const x=m.element("clef-octave-change");if(x)try{S=parseInt(x.value,10)}catch(_){l=ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(l),S=0}if(m.hasAttributes&&m.attribute("number"))try{b=parseInt(m.attribute("number").value,10),b>this.currentClefNumber&&(b=this.currentClefNumber),this.currentClefNumber=b+1}catch(_){l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),b=1,this.currentClefNumber=b+1}const E=new ClefInstruction(d,S,y);this.abstractInstructions.push([b,E,s])}if(e.element("key")!==void 0&&this.instrument.MidiInstrumentId!==MidiInstrument.Percussion){let c=0;const u=e.element("key").element("fifths");if(u)try{c=parseInt(u.value,10)}catch(b){l=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),c=0,log$2.debug("InstrumentReader.addAbstractInstruction",l,b)}let m=KeyEnum.none,d=e.element("key");if(d&&(d=d.element("mode")),d)try{m=KeyEnum[d.value]}catch(b){l=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),m=KeyEnum.major,log$2.debug("InstrumentReader.addAbstractInstruction",l,b)}const y=new KeyInstruction(void 0,c,m);this.abstractInstructions.push([1,y,s])}if(e.element("time")){const c=e.element("time");let u=RhythmSymbolEnum.NONE,m=!0;if(c!==void 0&&c.hasAttributes){const x=c.attribute("symbol");x&&(x.value==="common"?u=RhythmSymbolEnum.COMMON:x.value==="cut"&&(u=RhythmSymbolEnum.CUT));const E=c.attribute("print-object");E&&E.value==="no"&&(m=!1)}let d=0,y=0;const b=c&&c.element("senza-misura")!==void 0,S=e.elements("time"),A=[],P=[];for(let x=0,E=S.length;x0&&P!==void 0&&A.length===P.length){const E=A.length,_=new Array(E);let T=0;for(let C=0;C set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),d=4,y=4,log$2.debug("InstrumentReader.addAbstractInstruction",l,E)}const x=new RhythmInstruction(new Fraction$1(d,y,0,!1),u);x.PrintObject=m,this.abstractInstructions.push([1,x,s])}}}saveAbstractInstructionList(e,t){for(let r=this.abstractInstructions.length-1;r>=0;r--){const s=this.abstractInstructions[r],o=s[0],a=s[1],l=s[2];if(a instanceof ClefInstruction){const c=a;if(this.currentXmlMeasureIndex===0||o<=this.activeClefs.length&&c!==this.activeClefs[o-1])if(!t&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&o-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){const u=c,m=this.currentStaffEntry;if(l&&Math.abs(l.RealValue-m.Timestamp.RealValue)>.01)continue;u.Parent=m,m.removeFirstInstructionOfTypeClefInstruction(),m.Instructions.push(u),this.activeClefs[o-1]=c,this.abstractInstructions.splice(r,1)}else if(t){if(l.RealValue!==0)continue;let u;if(this.currentMeasure){const m=c,d=this.inSourceMeasureInstrumentIndex+o-1,y=this.currentMeasure.FirstInstructionsStaffEntries[d];if(this.currentXmlMeasureIndex===0)if(!y)u=new SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[d]=u,m.Parent=u,u.Instructions.push(m),this.activeClefsHaveBeenInitialized[o-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[d]!==void 0&&!(y.Instructions[0]instanceof ClefInstruction))u=y,m.Parent=u,u.removeFirstInstructionOfTypeClefInstruction(),u.Instructions.splice(0,0,m),this.activeClefsHaveBeenInitialized[o-1]=!0;else{const b=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[d]=b,m.Parent=b,b.Instructions.push(m)}else if(this.activeClefsHaveBeenInitialized[o-1]){let b=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(b=this.currentMultirestStartMeasure);const S=new SourceStaffEntry(void 0,void 0);b.LastInstructionsStaffEntries[d]=S,m.Parent=S,S.Instructions.push(m)}else{const b=this.musicSheet.SourceMeasures[0];b.FirstInstructionsStaffEntries[d]?(u=b.FirstInstructionsStaffEntries[d],u.removeFirstInstructionOfTypeClefInstruction()):u=new SourceStaffEntry(void 0,void 0),m.Parent=u,u.Instructions.splice(0,0,m),this.activeClefsHaveBeenInitialized[o-1]=!0}this.activeClefs[o-1]=c,this.abstractInstructions.splice(r,1)}}else{let u;const m=this.activeRhythm.Rhythm;m.RealValue>0&&l.RealValue/m.RealValue>.9&&(this.currentMeasure.LastInstructionsStaffEntries[o-1]||(this.currentMeasure.LastInstructionsStaffEntries[o-1]=new SourceStaffEntry(void 0,this.instrument.Staves[o-1])),u=this.currentMeasure.LastInstructionsStaffEntries[o-1]),u&&(c.Parent=u,u.Instructions.push(c),this.activeClefs[o-1]=c,this.abstractInstructions.splice(r,1))}else o<=this.activeClefs.length&&c===this.activeClefs[o-1]&&this.abstractInstructions.splice(r,1)}if(a instanceof KeyInstruction){const c=a;if(!this.activeKey||this.activeKey.Key!==c.Key){this.activeKey=c,this.abstractInstructions.splice(r,1);let u;if(this.activeKeyHasBeenInitialized?u=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,this.currentXmlMeasureIndex>0?u=this.musicSheet.SourceMeasures[0]:u=this.currentMeasure),u)for(let m=this.inSourceMeasureInstrumentIndex;m=0;e--){const t=this.abstractInstructions[e][0],r=this.abstractInstructions[e][1];if(r instanceof ClefInstruction){const s=r;if(!this.activeClefs[t-1]||s.ClefType!==this.activeClefs[t-1].ClefType||s.ClefType===this.activeClefs[t-1].ClefType&&s.Line!==this.activeClefs[t-1].Line){const o=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+t-1]=o;const a=s;a.Parent=o,o.Instructions.push(a),this.activeClefs[t-1]=s,this.abstractInstructions.splice(e,1)}}}}getNoteDurationForTuplet(e){let t=new Fraction$1(0,1);const r=this.getNoteDurationFromTypeNode(e);if(e.element("time-modification")){const s=e.element("time-modification");if(s&&s.element("actual-notes")!==void 0&&s.element("normal-notes")){const o=s.element("actual-notes"),a=s.element("normal-notes");if(o!==void 0&&a){const l=parseInt(o.value,10),c=parseInt(a.value,10);t=new Fraction$1(c*r.Numerator,l*r.Denominator)}}}return t}readExpressionStaffNumber(e){let t=1;if(e.element("staff")){const r=e.element("staff");if(r)try{t=parseInt(r.value,10)}catch(s){const o=ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(o),t=1,log$2.debug("InstrumentReader.readExpressionStaffNumber",o,s)}}return t}readDivisionsFromNotes(){let e=0,t=this.currentXmlMeasureIndex,r=!1;for(;!r;){const s=this.xmlMeasureList[t].elements();for(let o=0,a=s.length;o0){r=!0;break}}if(e===0&&(t++,t===this.xmlMeasureList.length)){const o=ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new MusicSheetReadingException(o+this.instrument.Name)}}return e}}const _SubInstrument=class $t{constructor(e){this.parentInstrument=e,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=$t.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(e){return e===MidiInstrument.Acoustic_Grand_Piano||e===MidiInstrument.Bright_Acoustic_Piano||e===MidiInstrument.Electric_Grand_Piano||e===MidiInstrument.Electric_Piano_1||e===MidiInstrument.Electric_Piano_2}setMidiInstrument(e){this.midiInstrumentID=$t.midiInstrument[this.parseMidiInstrument(e)]}parseMidiInstrument(e){try{if(e){let t=e.toLowerCase().trim();t=t.replace(/\s+/g,"_");for(const r in $t.midiInstrument)if(t.indexOf(r)!==-1)return r}if(this.parentInstrument.Name){let t=this.parentInstrument.Name.toLowerCase().trim();t=t.replace(/\s+/g,"_");for(const r in $t.midiInstrument)if(t.indexOf(r)!==-1)return r}}catch(t){log$2.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}};_SubInstrument.midiInstrument={alto_saxophone:MidiInstrument.Alto_Sax,baritone_saxophone:MidiInstrument.Baritone_Sax,horn_in_f:MidiInstrument.French_Horn,english_horn:MidiInstrument.English_Horn,euphonium:MidiInstrument.Euphonium,clarinet_in_bb:MidiInstrument.clarinet_in_bb,clarinet_in_eb:MidiInstrument.clarinet_in_eb,clarinet:MidiInstrument.Clarinet,alto_clarinet:MidiInstrument.Alto_Clarinet,bass_clarinet:MidiInstrument.Bass_Clarinet,bassoon:MidiInstrument.Bassoon,bass_trombone:MidiInstrument.Bass_Trombone,alt:MidiInstrument.Synth_Voice,alto:MidiInstrument.Synth_Voice,banjo:MidiInstrument.Banjo,bariton:MidiInstrument.Synth_Voice,baritone:MidiInstrument.Synth_Voice,bass:MidiInstrument.Synth_Voice,blockflöte:MidiInstrument.Recorder,brass:MidiInstrument.Trombone,bratsche:MidiInstrument.Viola,cello:MidiInstrument.Cello,contrabass:MidiInstrument.Contrabass,drums:MidiInstrument.Percussion,flute:MidiInstrument.Flute,flöte:MidiInstrument.Flute,frenchhorn:MidiInstrument.French_Horn,gitarre:MidiInstrument.Acoustic_Guitar_nylon,guitar:MidiInstrument.Acoustic_Guitar_nylon,harfe:MidiInstrument.Orchestral_Harp,harp:MidiInstrument.Orchestral_Harp,klarinette:MidiInstrument.Clarinet,klavier:MidiInstrument.Acoustic_Grand_Piano,kontrabass:MidiInstrument.Contrabass,oboe:MidiInstrument.Oboe,organ:MidiInstrument.Church_Organ,orgel:MidiInstrument.Church_Organ,orgue:MidiInstrument.Church_Organ,percussion:MidiInstrument.Synth_Drum,小军鼓:MidiInstrument.Synth_Drum,snare_drum:MidiInstrument.Synth_Drum,bass_drum:MidiInstrument.Synth_Drum,side_drum:MidiInstrument.Synth_Drum,piano:MidiInstrument.Acoustic_Grand_Piano,piccolo:MidiInstrument.Piccolo,posaune:MidiInstrument.Trombone,recorder:MidiInstrument.Recorder,sax:MidiInstrument.Tenor_Sax,schlagwerk:MidiInstrument.Percussion,schlagzeug:MidiInstrument.Percussion,sopran:MidiInstrument.Synth_Voice,steeldrum:MidiInstrument.Steel_Drums,streicher:MidiInstrument.String_Ensemble_1,strings:MidiInstrument.String_Ensemble_1,tenor:MidiInstrument.Synth_Voice,tpt:MidiInstrument.Trumpet,trombone:MidiInstrument.Trombone,trompete:MidiInstrument.Trumpet,trumpet:MidiInstrument.Trumpet,tuba:MidiInstrument.Tuba,unnamed:MidiInstrument.Acoustic_Grand_Piano,viola:MidiInstrument.Viola,violin:MidiInstrument.Violin,"violon-c":MidiInstrument.Cello,"violon.":MidiInstrument.Violin,voice:MidiInstrument.Synth_Voice,woodblock:MidiInstrument.Woodblock,alto_clarinet_in_eb:MidiInstrument.AltoClarinetInEb,trumpet_in_bb:MidiInstrument.TrumpetInBb,tenor_saxophone:MidiInstrument.TenorSaxophone};let SubInstrument=_SubInstrument;class StringUtil{static StringContainsSeparatedWord(e,t,r=!1){return new RegExp("( |^)"+t+"([ .]|$)",r?"i":void 0).test(e)}}class RepetitionInstructionReader{set MusicSheet(e){this.musicSheet=e,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(e,t){this.currentMeasureIndex=t}handleLineRepetitionInstructions(e){let t=!1;if(e.elements().length>0){let r="",s=!1,o="",a="",l="";const c=[],u=e.element("bar-style");u&&(l=u.value),e.attributes().length>0&&e.attribute("location")?r=e.attribute("location").value:r="right";const m=e.elements();for(let d=0,y=m.length;d0)if(r==="left"){if(a==="start"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.Begin,void 0,c);this.addInstruction(this.repetitionInstructions,d)}if(o==="forward"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,d)}}else{if(a==="stop"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.End,void 0,c);this.addInstruction(this.repetitionInstructions,d)}if(o==="backward"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,d)}}}return t}handleRepetitionInstructionsFromWordsOrSymbols(e,t){const r=e.element("words"),s=this.currentMeasureIndex;if(r){const o="d\\s?\\.s\\.",a=r.value.trim().toLowerCase();if(StringUtil.StringContainsSeparatedWord(a,o+" al fine",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,o+" al coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,c),!0}const l="d\\.\\s?c\\.";if(StringUtil.StringContainsSeparatedWord(a,l+" al fine",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,l+" al coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,l)||StringUtil.StringContainsSeparatedWord(a,"da\\s?capo",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,o,!0)||StringUtil.StringContainsSeparatedWord(a,"dal\\s?segno",!0)){let c;return StringUtil.StringContainsSeparatedWord(a,"al\\s?coda",!0)?c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegnoAlCoda):c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(a,"a (la )?coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"fine",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"segno",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,c),!0}}else if(e.element("segno")){const o=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,o),!0}else if(e.element("coda")){const o=new RepetitionInstruction(s,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,o),!0}return!1}removeRedundantInstructions(){let e=0,t=0,r=0,s=0;for(let o=0;o0&&this.findInstructionInPreviousMeasure(o,a.measureIndex,RepetitionInstructionEnum.ToCoda)&&(a.type=RepetitionInstructionEnum.None),t===0&&r===0&&(a.type=RepetitionInstructionEnum.ToCoda,a.alignment=AlignmentType.End,a.measureIndex--);break;case RepetitionInstructionEnum.Segno:if(e-s>0){let l=!1;for(let c=0,u=this.repetitionInstructions.length;c0?m.type=RepetitionInstructionEnum.DalSegnoAlCoda:m.type=RepetitionInstructionEnum.DalSegno,a.type=RepetitionInstructionEnum.None,l=!0;break;case RepetitionInstructionEnum.DalSegno:case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:a.type=RepetitionInstructionEnum.None,l=!0;break}if(l)break}if(l)break;r-t>0?a.type=RepetitionInstructionEnum.DalSegnoAlCoda:a.type=RepetitionInstructionEnum.DalSegno,a.alignment=AlignmentType.End,a.measureIndex--}break}if(this.backwardSearchForPreviousIdenticalInstruction(o,a)||a.type===RepetitionInstructionEnum.None)this.repetitionInstructions.splice(o,1),o--;else switch(a.type){case RepetitionInstructionEnum.Fine:break;case RepetitionInstructionEnum.ToCoda:r++;break;case RepetitionInstructionEnum.Coda:t++;break;case RepetitionInstructionEnum.Segno:e++;break;case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:s++;break}}this.repetitionInstructions.sort(RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(e,t,r){for(let s=e-1;s>=0;s--){const o=this.repetitionInstructions[s];if(t-o.measureIndex===1&&o.type===r)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(e,t){for(let r=e-1;r>=0;r--)if(this.repetitionInstructions[r].equals(t))return!0;return!1}addInstruction(e,t){let r=!0;for(let s=0,o=e.length;s0;)try{const l=this.openRepetitions.last();if(l.RepetitonUnderConstruction.FromWords){if(l.WaitingForCoda){let c=l.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;c>=this.musicSheet.SourceMeasures.length&&(c=-1),l.RepetitonUnderConstruction.setEndingStartIndex(2,c)}else if(l.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(l.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){const c=r.length-1,u=new RepetitionInstruction(c,RepetitionInstructionEnum.BackJumpLine,AlignmentType.End,l.RepetitonUnderConstruction);l.RepetitonUnderConstruction.BackwardJumpInstructions.push(u),r[c].LastRepetitionInstructions.push(u)}this.finalizeRepetition(this.openRepetitions.last())}catch(l){try{const c=this.openRepetitions.last().RepetitonUnderConstruction;for(const u of this.repetitionInstructions)u.parentRepetition===c&&(u.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(c){log$2.error("RepetitionCalculator: calculateRepetitions2",c)}}let s=!1;const o=0,a=this.musicSheet.SourceMeasures.length-1;for(const l of this.musicSheet.Repetitions)if(l.StartIndex===o&&l.EndIndex===a){s=!0;break}if(!s){const l=new Repetition(this.musicSheet,!0);l.FromWords=!0,l.startMarker=new RepetitionInstruction(o,RepetitionInstructionEnum.StartLine),l.startMarker.parentRepetition=l,this.musicSheet.SourceMeasures[o].FirstRepetitionInstructions.push(l.startMarker),l.endMarker=new RepetitionInstruction(a,RepetitionInstructionEnum.BackJumpLine),l.endMarker.parentRepetition=l,l.BackwardJumpInstructions.push(l.endMarker),l.UserNumberOfRepetitions=l.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(l)}for(let l=0,c=this.musicSheet.SourceMeasures.length;l1&&u.FirstRepetitionInstructions.sort(RepetitionInstructionComparer.Compare),u.LastRepetitionInstructions.length>1&&u.LastRepetitionInstructions.sort(RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(e){let t;switch(e.type){case RepetitionInstructionEnum.StartLine:t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!1,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.BackJumpLine:t=this.getOrCreateCurrentRepetition2(!1),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case RepetitionInstructionEnum.Ending:if(t=this.getOrCreateCurrentRepetition(),e.parentRepetition=t.RepetitonUnderConstruction,e.endingIndices.contains(1)&&e.alignment===AlignmentType.Begin){if(t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){t=void 0;for(let s=this.openRepetitions.length-1;s>=0;s--){const o=this.openRepetitions[s];if(o.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(t=o;this.openRepetitions.length-1>s;){const a=this.openRepetitions.last();this.finalizeRepetition(a)}}t===void 0&&(t=this.createNewRepetition(0),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None))}t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex-1,RepetitionInstructionEnum.ForwardJump,AlignmentType.End,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction))}if(e.alignment===AlignmentType.Begin)t.RepetitonUnderConstruction.setEndingsStartIndex(e.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(e);else for(let s=0,o=e.endingIndices.length;s0&&Math.abs(t.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1||this.openRepetitions.length&&this.openRepetitions.find(s=>s.RepetitonUnderConstruction.startMarker.type===RepetitionInstructionEnum.StartLine).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.Fine:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(e)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Fine,AlignmentType.End,void 0));break;case RepetitionInstructionEnum.ToCoda:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,this.currentMeasure.LastRepetitionInstructions.push(e));break;case RepetitionInstructionEnum.Coda:if(this.openRepetitions.length===0)break;t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,t.WaitingForCoda?(t.CodaFound=!0,t.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(e),this.finalizeRepetition(t),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):t.ToCodaFound||(t.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.ToCoda,AlignmentType.End,t.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Coda,AlignmentType.Begin,void 0)));break;case RepetitionInstructionEnum.DaCapo:t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(t),t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case RepetitionInstructionEnum.DalSegno:if(t=this.getOrCreateCurrentRepetition2(!0),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0),t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction)),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);s>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);s>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.FineFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);s>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.Fine,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlFine:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.FineFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);s>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.Fine,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);s>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.ToCodaFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(s>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{const o=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);o>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(o,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[o].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlCoda:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(t),t=this.createNewRepetition(0)):t.RepetitonUnderConstruction.EndingParts.length===0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.ToCodaFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(s>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{const o=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);o>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(o,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[o].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.None:break;default:throw new ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(e,t){for(let r=this.repetitionInstructions.length-1;r>=0;r--){const s=this.repetitionInstructions[r];if(s.measureIndex<=t&&s.type===e)return s.measureIndex}return-1}finalizeRepetition(e){const t=e.RepetitonUnderConstruction;if(t.BackwardJumpInstructions.length>0){let r=!0;const s=this.getLastFinalizedRepetition();if(s!==void 0&&t.coversIdenticalMeasures(s)){if(t.NumberOfEndings>s.NumberOfEndings){const o=this.musicSheet.Repetitions.indexOf(s,0);o>-1&&this.musicSheet.Repetitions.splice(o,1),s.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(t)}r=!1,t.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(t);r&&(t.startMarker.type===RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[t.StartIndex].FirstRepetitionInstructions.push(t.startMarker),t.UserNumberOfRepetitions=t.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(e){let t;for(let r=this.openRepetitions.length-1;r>=0;r--)if(this.openRepetitions[r].RepetitonUnderConstruction.FromWords===e){for(t=this.openRepetitions[r];r0)return this.openRepetitions.last();const e=this.createNewRepetition(0);return e.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,e.RepetitonUnderConstruction),e}getOrCreateCurrentRepetition2(e){let t;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2){for(let s=this.openRepetitions.length-1;s>=0;s--)if(t=this.openRepetitions[s],t.RepetitonUnderConstruction.FromWords===e){for(;s0){const r=this.openRepetitions.last(),s=r.RepetitonUnderConstruction;if(s.BackwardJumpInstructions.length>0){const o=Object.keys(s.EndingIndexDict);(o.length===0||s.EndingIndexDict[o[o.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(r)}}const t=new RepetitionBuildingContainer(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=e,this.openRepetitions.push(t),t}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}}class RepetitionBuildingContainer{constructor(e){this.RepetitonUnderConstruction=new Repetition(e)}}class MusicSymbolModuleFactory{static createRepetitionInstructionReader(){return new RepetitionInstructionReader}static createRepetitionCalculator(){return new RepetitionCalculator}}class ReaderPluginManager{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(e){this.voiceMeasureReadPlugins.push(e)}processVoiceMeasureReadPlugins(e,t,r){for(const s of this.voiceMeasureReadPlugins)try{s.measureReadCalculations(e,t,r)}catch(o){log$2.info("VoiceGenerator.addSingleNote: ",o)}}}class MusicSheetReader{constructor(e=void 0,t=new EngravingRules){this.completeNumberOfStaves=0,this.pluginManager=new ReaderPluginManager,e?this.afterSheetReadingModules=e:this.afterSheetReadingModules=[],this.repetitionInstructionReader=MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=t}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(e){for(const t of e)t.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(e,t){try{return this._createMusicSheet(e,t)}catch(r){log$2.error("MusicSheetReader.CreateMusicSheet",r);return}}_removeFromArray(e,t){const r=e.indexOf(t);r!==-1&&e.splice(r,1)}trimString(e){return e.replace(/^\s+|\s+$/g,"")}_lastElement(e){return e[e.length-1]}_createMusicSheet(e,t){var d;const r=[];let s=0;if(this.musicSheet=new MusicSheet,this.musicSheet.Path=t,this.musicSheet.Rules=this.rules,!e)throw new MusicSheetReadingException("Undefined root element");this.pushSheetLabels(e,t);const o=e.element("part-list");if(!o)throw new MusicSheetReadingException("Undefined partListNode");const a=e.elements("part"),l=o.elements();this.initializeReading(l,a,r);let c=!0;this.currentFraction=new Fraction$1(0,1);let u=!1,m=e.element("identification");for(m&&(m=m.element("encoding")),m&&(m=m.element("software")),m!==void 0&&m.value==="Guitar Pro 5"&&(u=!0);c;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(s=0),this.currentMeasure=new SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const y of r)try{c=c&&y.readNextXmlMeasure(this.currentMeasure,this.currentFraction,u)}catch(b){const S=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new MusicSheetReadingException(S,b)}c&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(r),this.checkSourceMeasureForNullEntries(),s=this.setSourceMeasureDuration(r,s),MusicSheetReader.doCalculationsAfterDurationHasBeenSet(r),this.currentMeasure.AbsoluteTimestamp=this.currentFraction.clone(),this.musicSheet.SheetErrors.finalizeMeasure(this.currentMeasure.MeasureNumber),this.currentFraction.Add(this.currentMeasure.Duration),this.previousMeasure=this.currentMeasure,this.musicSheet.SoundTempos=(d=r[0])==null?void 0:d.SoundTempos)}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=100),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(let y=0,b=this.afterSheetReadingModules.length;yr){if(this.areRhythmInstructionsMixed(t)&&l.SymbolEnum!==RhythmSymbolEnum.NONE)continue;r=l.Rhythm.RealValue,s=t.indexOf(l)}}if(t.length>0&&t.lengthe.Denominator){const r=t.Denominator/e.Denominator;e.expand(r)}}checkIfMeasureIsImplicit(e,t){return!this.previousMeasure&&e.lt(t)?!0:this.previousMeasure?Fraction$1.plus(this.previousMeasure.Duration,e).Equals(t):!1}allInstrumentsHaveSameDuration(e,t){let r=0;for(let s=0,o=e.length;s=0;e--)for(let t=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length-1;t>=0;t--){const r=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t];if(r)for(let s=r.VoiceEntries.length-1;s>=0;s--){const o=r.VoiceEntries[s];o.Notes.length===0&&(this._removeFromArray(o.ParentVoice.VoiceEntries,o),this._removeFromArray(r.VoiceEntries,o))}r!==void 0&&r.VoiceEntries.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t]=void 0)}for(let e=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;e>=0;e--){let t=0;for(let r=0,s=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length;rt){if(!this.musicSheet.Title){const _=S.attribute("font-size").value,T=parseFloat(_);r0&&m.MidiInstrumentId!==MidiInstrument.Percussion&&(A.midiInstrumentID=Math.max(0,parseInt(_.value,10)-1));else if(_.name==="midi-unpitched")A.fixedKey=Math.max(0,parseInt(_.value,10));else if(_.name==="volume")try{const T=parseFloat(_.value);A.volume=T/127}catch(T){log$2.debug("ExpressionReader.readExpressionParameters","read volume",T)}else if(_.name==="pan")try{const T=parseFloat(_.value);A.pan=T/64}catch(T){log$2.debug("ExpressionReader.readExpressionParameters","read pan",T)}}catch(T){log$2.info("MusicSheetReader.createInstrumentGroups midi settings: ",T)}}}}catch(A){log$2.info("MusicSheetReader.createInstrumentGroups: ",A)}}if(m.SubInstruments.length===0){const y=new SubInstrument(m);m.SubInstruments.push(y)}r[u]=m,s?(s.InstrumentalGroups.push(m),this.musicSheet.Instruments.push(m)):(this.musicSheet.InstrumentalGroups.push(m),this.musicSheet.Instruments.push(m))}else if(c.name==="part-group"&&c.attribute("type").value==="start"){const u=new InstrumentalGroup("group",this.musicSheet,s);s?s.InstrumentalGroups.push(u):this.musicSheet.InstrumentalGroups.push(u),s=u}else if(c.name==="part-group"&&c.attribute("type").value==="stop"&&s){if(s.InstrumentalGroups.length===1){const u=s.InstrumentalGroups[0];s.Parent?(s.Parent.InstrumentalGroups.push(u),this._removeFromArray(s.Parent.InstrumentalGroups,s)):(this.musicSheet.InstrumentalGroups.push(u),this._removeFromArray(this.musicSheet.InstrumentalGroups,s))}s=s.Parent}}}catch(o){const a=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new MusicSheetReadingException(a,o)}for(let o=0,a=this.musicSheet.Instruments.length;o0){const o=s[0];if(o){let a=o.element("attributes");a&&(a=a.element("staves")),a?t+=parseInt(a.value,10):t++}}}if(isNaN(t)||t<=0){const r=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new MusicSheetReadingException(r)}return t}getInstrumentNumberOfStavesFromXml(e){let t=0;const r=e.element("measure");if(r){const s=r.element("attributes");let o;s&&(o=s.element("staves")),!s||!o?t=1:t=parseInt(o.value,10)}if(isNaN(t)||t<=0){const s=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new MusicSheetReadingException(s)}return t}}function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jszip_min={exports:{}};/*! JSZip v3.7.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE */(function(i,e){(function(t){i.exports=t()})(function(){return function t(r,s,o){function a(u,m){if(!s[u]){if(!r[u]){var d=typeof commonjsRequire=="function"&&commonjsRequire;if(!m&&d)return d(u,!0);if(l)return l(u,!0);var y=new Error("Cannot find module '"+u+"'");throw y.code="MODULE_NOT_FOUND",y}var b=s[u]={exports:{}};r[u][0].call(b.exports,function(S){var A=r[u][1][S];return a(A||S)},b,b.exports,t,r,s,o)}return s[u].exports}for(var l=typeof commonjsRequire=="function"&&commonjsRequire,c=0;c>2,b=(3&u)<<4|m>>4,S=1<_?(15&m)<<2|d>>6:64,A=2<_?63&d:64,P.push(l.charAt(y)+l.charAt(b)+l.charAt(S)+l.charAt(A));return P.join("")},s.decode=function(c){var u,m,d,y,b,S,A=0,P=0,x="data:";if(c.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var E,_=3*(c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&_--,c.charAt(c.length-2)===l.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(E=a.uint8array?new Uint8Array(0|_):new Array(0|_);A>4,m=(15&y)<<4|(b=l.indexOf(c.charAt(A++)))>>2,d=(3&b)<<6|(S=l.indexOf(c.charAt(A++))),E[P++]=u,b!==64&&(E[P++]=m),S!==64&&(E[P++]=d);return E}},{"./support":30,"./utils":32}],2:[function(t,r,s){var o=t("./external"),a=t("./stream/DataWorker"),l=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function u(m,d,y,b,S){this.compressedSize=m,this.uncompressedSize=d,this.crc32=y,this.compression=b,this.compressedContent=S}u.prototype={getContentWorker:function(){var m=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),d=this;return m.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),m},getCompressedWorker:function(){return new a(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(m,d,y){return m.pipe(new l).pipe(new c("uncompressedSize")).pipe(d.compressWorker(y)).pipe(new c("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,s){var o=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(a){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,s){var o=t("./utils"),a=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var m=0;m<8;m++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();r.exports=function(l,c){return l!==void 0&&l.length?o.getTypeOf(l)!=="string"?function(u,m,d,y){var b=a,S=y+d;u^=-1;for(var A=y;A>>8^b[255&(u^m[A])];return-1^u}(0|c,l,l.length,0):function(u,m,d,y){var b=a,S=y+d;u^=-1;for(var A=y;A>>8^b[255&(u^m.charCodeAt(A))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(t,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,r,s){var o=null;o=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:o}},{lie:37}],7:[function(t,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),l=t("./utils"),c=t("./stream/GenericWorker"),u=o?"uint8array":"array";function m(d,y){c.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=y,this.meta={}}s.magic="\b\0",l.inherits(m,c),m.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,d.data),!1)},m.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},m.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},m.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(y){d.push({data:y,meta:d.meta})}},s.compressWorker=function(d){return new m("Deflate",d)},s.uncompressWorker=function(){return new m("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,s){function o(b,S){var A,P="";for(A=0;A>>=8;return P}function a(b,S,A,P,x,E){var _,T,C=b.file,R=b.compression,I=E!==u.utf8encode,M=l.transformTo("string",E(C.name)),D=l.transformTo("string",u.utf8encode(C.name)),H=C.comment,W=l.transformTo("string",E(H)),O=l.transformTo("string",u.utf8encode(H)),z=D.length!==C.name.length,k=O.length!==H.length,$="",F="",G="",N=C.dir,V=C.date,K={crc32:0,compressedSize:0,uncompressedSize:0};S&&!A||(K.crc32=b.crc32,K.compressedSize=b.compressedSize,K.uncompressedSize=b.uncompressedSize);var U=0;S&&(U|=8),I||!z&&!k||(U|=2048);var J=0,me=0;N&&(J|=16),x==="UNIX"?(me=798,J|=function(le,Se){var oe=le;return le||(oe=Se?16893:33204),(65535&oe)<<16}(C.unixPermissions,N)):(me=20,J|=function(le){return 63&(le||0)}(C.dosPermissions)),_=V.getUTCHours(),_<<=6,_|=V.getUTCMinutes(),_<<=5,_|=V.getUTCSeconds()/2,T=V.getUTCFullYear()-1980,T<<=4,T|=V.getUTCMonth()+1,T<<=5,T|=V.getUTCDate(),z&&(F=o(1,1)+o(m(M),4)+D,$+="up"+o(F.length,2)+F),k&&(G=o(1,1)+o(m(W),4)+O,$+="uc"+o(G.length,2)+G);var he="";return he+="\n\0",he+=o(U,2),he+=R.magic,he+=o(_,2),he+=o(T,2),he+=o(K.crc32,4),he+=o(K.compressedSize,4),he+=o(K.uncompressedSize,4),he+=o(M.length,2),he+=o($.length,2),{fileRecord:d.LOCAL_FILE_HEADER+he+M+$,dirRecord:d.CENTRAL_FILE_HEADER+o(me,2)+he+o(W.length,2)+"\0\0\0\0"+o(J,4)+o(P,4)+M+$+W}}var l=t("../utils"),c=t("../stream/GenericWorker"),u=t("../utf8"),m=t("../crc32"),d=t("../signature");function y(b,S,A,P){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=A,this.encodeFileName=P,this.streamFiles=b,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(y,c),y.prototype.push=function(b){var S=b.meta.percent||0,A=this.entriesCount,P=this._sources.length;this.accumulate?this.contentBuffer.push(b):(this.bytesWritten+=b.data.length,c.prototype.push.call(this,{data:b.data,meta:{currentFile:this.currentFile,percent:A?(S+100*(A-P-1))/A:100}}))},y.prototype.openedSource=function(b){this.currentSourceOffset=this.bytesWritten,this.currentFile=b.file.name;var S=this.streamFiles&&!b.file.dir;if(S){var A=a(b,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:A.fileRecord,meta:{percent:0}})}else this.accumulate=!0},y.prototype.closedSource=function(b){this.accumulate=!1;var S=this.streamFiles&&!b.file.dir,A=a(b,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(A.dirRecord),S)this.push({data:function(P){return d.DATA_DESCRIPTOR+o(P.crc32,4)+o(P.compressedSize,4)+o(P.uncompressedSize,4)}(b),meta:{percent:100}});else for(this.push({data:A.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},y.prototype.flush=function(){for(var b=this.bytesWritten,S=0;S=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return o.transformTo("string",this.readData(l))},readData:function(l){},lastIndexOfSignature:function(l){},readAndCheckSignature:function(l){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=a},{"../utils":32}],19:[function(t,r,s){var o=t("./Uint8ArrayReader");function a(l){o.call(this,l)}t("../utils").inherits(a,o),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,s){var o=t("./DataReader");function a(l){o.call(this,l)}t("../utils").inherits(a,o),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,r,s){var o=t("./ArrayReader");function a(l){o.call(this,l)}t("../utils").inherits(a,o),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,s){var o=t("../utils"),a=t("../support"),l=t("./ArrayReader"),c=t("./StringReader"),u=t("./NodeBufferReader"),m=t("./Uint8ArrayReader");r.exports=function(d){var y=o.getTypeOf(d);return o.checkSupport(y),y!=="string"||a.uint8array?y==="nodebuffer"?new u(d):a.uint8array?new m(o.transformTo("uint8array",d)):new l(o.transformTo("array",d)):new c(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,s){var o=t("./GenericWorker"),a=t("../utils");function l(c){o.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,o),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,s){var o=t("./GenericWorker"),a=t("../crc32");function l(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(l,o),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,s){var o=t("../utils"),a=t("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(l,a),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,s){var o=t("../utils"),a=t("./GenericWorker");function l(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(m){u.dataIsReady=!0,u.data=m,u.max=m&&m.length||0,u.type=o.getTypeOf(m),u.isPaused||u._tickAndRepeat()},function(m){u.error(m)})}o.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,s){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c "+a:a}},r.exports=o},{}],29:[function(t,r,s){var o=t("../utils"),a=t("./ConvertWorker"),l=t("./GenericWorker"),c=t("../base64"),u=t("../support"),m=t("../external"),d=null;if(u.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch(S){}function y(S,A){return new m.Promise(function(P,x){var E=[],_=S._internalType,T=S._outputType,C=S._mimeType;S.on("data",function(R,I){E.push(R),A&&A(I)}).on("error",function(R){E=[],x(R)}).on("end",function(){try{var R=function(I,M,D){switch(I){case"blob":return o.newBlob(o.transformTo("arraybuffer",M),D);case"base64":return c.encode(M);default:return o.transformTo(I,M)}}(T,function(I,M){var D,H=0,W=null,O=0;for(D=0;D"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch(l){try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),s.blob=a.getBlob("application/zip").size===0}catch(c){s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch(l){s.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,s){for(var o=t("./utils"),a=t("./support"),l=t("./nodejsUtils"),c=t("./stream/GenericWorker"),u=new Array(256),m=0;m<256;m++)u[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;u[254]=u[254]=1;function d(){c.call(this,"utf-8 decode"),this.leftOver=null}function y(){c.call(this,"utf-8 encode")}s.utf8encode=function(b){return a.nodebuffer?l.newBufferFrom(b,"utf-8"):function(S){var A,P,x,E,_,T=S.length,C=0;for(E=0;E>>6:(P<65536?A[_++]=224|P>>>12:(A[_++]=240|P>>>18,A[_++]=128|P>>>12&63),A[_++]=128|P>>>6&63),A[_++]=128|63&P);return A}(b)},s.utf8decode=function(b){return a.nodebuffer?o.transformTo("nodebuffer",b).toString("utf-8"):function(S){var A,P,x,E,_=S.length,T=new Array(2*_);for(A=P=0;A<_;)if((x=S[A++])<128)T[P++]=x;else if(4<(E=u[x]))T[P++]=65533,A+=E-1;else{for(x&=E===2?31:E===3?15:7;1>10&1023,T[P++]=56320|1023&x)}return T.length!==P&&(T.subarray?T=T.subarray(0,P):T.length=P),o.applyFromCharCode(T)}(b=o.transformTo(a.uint8array?"uint8array":"array",b))},o.inherits(d,c),d.prototype.processChunk=function(b){var S=o.transformTo(a.uint8array?"uint8array":"array",b.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var A=S;(S=new Uint8Array(A.length+this.leftOver.length)).set(this.leftOver,0),S.set(A,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var P=function(E,_){var T;for((_=_||E.length)>E.length&&(_=E.length),T=_-1;0<=T&&(192&E[T])==128;)T--;return T<0||T===0?_:T+u[E[T]]>_?T:_}(S),x=S;P!==S.length&&(a.uint8array?(x=S.subarray(0,P),this.leftOver=S.subarray(P,S.length)):(x=S.slice(0,P),this.leftOver=S.slice(P,S.length))),this.push({data:s.utf8decode(x),meta:b.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,o.inherits(y,c),y.prototype.processChunk=function(b){this.push({data:s.utf8encode(b.data),meta:b.meta})},s.Utf8EncodeWorker=y},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,s){var o=t("./support"),a=t("./base64"),l=t("./nodejsUtils"),c=t("set-immediate-shim"),u=t("./external");function m(P){return P}function d(P,x){for(var E=0;E>8;this.dir=!!(16&this.externalFileAttributes),b==0&&(this.dosPermissions=63&this.externalFileAttributes),b==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(b){if(this.extraFields[1]){var S=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=S.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=S.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=S.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=S.readInt(4))}},readExtraFields:function(b){var S,A,P,x=b.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});b.index+4>>6:(b<65536?y[P++]=224|b>>>12:(y[P++]=240|b>>>18,y[P++]=128|b>>>12&63),y[P++]=128|b>>>6&63),y[P++]=128|63&b);return y},s.buf2binstring=function(d){return m(d,d.length)},s.binstring2buf=function(d){for(var y=new o.Buf8(d.length),b=0,S=y.length;b>10&1023,E[S++]=56320|1023&A)}return m(E,S)},s.utf8border=function(d,y){var b;for((y=y||d.length)>d.length&&(y=d.length),b=y-1;0<=b&&(192&d[b])==128;)b--;return b<0||b===0?y:b+c[d[b]]>y?b:y}},{"./common":41}],43:[function(t,r,s){r.exports=function(o,a,l,c){for(var u=65535&o|0,m=o>>>16&65535|0,d=0;l!==0;){for(l-=d=2e3>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l,c,u){var m=o,d=u+c;a^=-1;for(var y=u;y>>8^m[255&(a^l[y])];return-1^a}},{}],46:[function(t,r,s){var o,a=t("../utils/common"),l=t("./trees"),c=t("./adler32"),u=t("./crc32"),m=t("./messages"),d=0,y=4,b=0,S=-2,A=-1,P=4,x=2,E=8,_=9,T=286,C=30,R=19,I=2*T+1,M=15,D=3,H=258,W=H+D+1,O=42,z=113,k=1,$=2,F=3,G=4;function N(B,re){return B.msg=m[re],re}function V(B){return(B<<1)-(4B.avail_out&&(Z=B.avail_out),Z!==0&&(a.arraySet(B.output,re.pending_buf,re.pending_out,Z,B.next_out),B.next_out+=Z,re.pending_out+=Z,B.total_out+=Z,B.avail_out-=Z,re.pending-=Z,re.pending===0&&(re.pending_out=0))}function J(B,re){l._tr_flush_block(B,0<=B.block_start?B.block_start:-1,B.strstart-B.block_start,re),B.block_start=B.strstart,U(B.strm)}function me(B,re){B.pending_buf[B.pending++]=re}function he(B,re){B.pending_buf[B.pending++]=re>>>8&255,B.pending_buf[B.pending++]=255&re}function le(B,re){var Z,Y,q=B.max_chain_length,ie=B.strstart,ne=B.prev_length,se=B.nice_match,ce=B.strstart>B.w_size-W?B.strstart-(B.w_size-W):0,de=B.window,ve=B.w_mask,ye=B.prev,ge=B.strstart+H,Pe=de[ie+ne-1],pe=de[ie+ne];B.prev_length>=B.good_match&&(q>>=2),se>B.lookahead&&(se=B.lookahead);do if(de[(Z=re)+ne]===pe&&de[Z+ne-1]===Pe&&de[Z]===de[ie]&&de[++Z]===de[ie+1]){ie+=2,Z++;do;while(de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&de[++ie]===de[++Z]&&iece&&--q!=0);return ne<=B.lookahead?ne:B.lookahead}function Se(B){var re,Z,Y,q,ie,ne,se,ce,de,ve,ye=B.w_size;do{if(q=B.window_size-B.lookahead-B.strstart,B.strstart>=ye+(ye-W)){for(a.arraySet(B.window,B.window,ye,ye,0),B.match_start-=ye,B.strstart-=ye,B.block_start-=ye,re=Z=B.hash_size;Y=B.head[--re],B.head[re]=ye<=Y?Y-ye:0,--Z;);for(re=Z=ye;Y=B.prev[--re],B.prev[re]=ye<=Y?Y-ye:0,--Z;);q+=ye}if(B.strm.avail_in===0)break;if(ne=B.strm,se=B.window,ce=B.strstart+B.lookahead,de=q,ve=void 0,ve=ne.avail_in,de=D)for(ie=B.strstart-B.insert,B.ins_h=B.window[ie],B.ins_h=(B.ins_h<=D&&(B.ins_h=(B.ins_h<=D)if(Y=l._tr_tally(B,B.strstart-B.match_start,B.match_length-D),B.lookahead-=B.match_length,B.match_length<=B.max_lazy_match&&B.lookahead>=D){for(B.match_length--;B.strstart++,B.ins_h=(B.ins_h<=D&&(B.ins_h=(B.ins_h<=D&&B.match_length<=B.prev_length){for(q=B.strstart+B.lookahead-D,Y=l._tr_tally(B,B.strstart-1-B.prev_match,B.prev_length-D),B.lookahead-=B.prev_length-1,B.prev_length-=2;++B.strstart<=q&&(B.ins_h=(B.ins_h<B.pending_buf_size-5&&(Z=B.pending_buf_size-5);;){if(B.lookahead<=1){if(Se(B),B.lookahead===0&&re===d)return k;if(B.lookahead===0)break}B.strstart+=B.lookahead,B.lookahead=0;var Y=B.block_start+Z;if((B.strstart===0||B.strstart>=Y)&&(B.lookahead=B.strstart-Y,B.strstart=Y,J(B,!1),B.strm.avail_out===0)||B.strstart-B.block_start>=B.w_size-W&&(J(B,!1),B.strm.avail_out===0))return k}return B.insert=0,re===y?(J(B,!0),B.strm.avail_out===0?F:G):(B.strstart>B.block_start&&(J(B,!1),B.strm.avail_out),k)}),new fe(4,4,8,4,oe),new fe(4,5,16,8,oe),new fe(4,6,32,32,oe),new fe(4,4,16,16,ue),new fe(8,16,32,32,ue),new fe(8,16,128,128,ue),new fe(8,32,128,256,ue),new fe(32,128,258,1024,ue),new fe(32,258,258,4096,ue)],s.deflateInit=function(B,re){return te(B,re,E,15,8,0)},s.deflateInit2=te,s.deflateReset=ee,s.deflateResetKeep=Ee,s.deflateSetHeader=function(B,re){return B&&B.state?B.state.wrap!==2?S:(B.state.gzhead=re,b):S},s.deflate=function(B,re){var Z,Y,q,ie;if(!B||!B.state||5>8&255),me(Y,Y.gzhead.time>>16&255),me(Y,Y.gzhead.time>>24&255),me(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),me(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(me(Y,255&Y.gzhead.extra.length),me(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(B.adler=u(B.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(me(Y,0),me(Y,0),me(Y,0),me(Y,0),me(Y,0),me(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),me(Y,3),Y.status=z);else{var ne=E+(Y.w_bits-8<<4)<<8;ne|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(ne|=32),ne+=31-ne%31,Y.status=z,he(Y,ne),Y.strstart!==0&&(he(Y,B.adler>>>16),he(Y,65535&B.adler)),B.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(q=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>q&&(B.adler=u(B.adler,Y.pending_buf,Y.pending-q,q)),U(B),q=Y.pending,Y.pending!==Y.pending_buf_size));)me(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>q&&(B.adler=u(B.adler,Y.pending_buf,Y.pending-q,q)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){q=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>q&&(B.adler=u(B.adler,Y.pending_buf,Y.pending-q,q)),U(B),q=Y.pending,Y.pending===Y.pending_buf_size)){ie=1;break}ie=Y.gzindexq&&(B.adler=u(B.adler,Y.pending_buf,Y.pending-q,q)),ie===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){q=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>q&&(B.adler=u(B.adler,Y.pending_buf,Y.pending-q,q)),U(B),q=Y.pending,Y.pending===Y.pending_buf_size)){ie=1;break}ie=Y.gzindexq&&(B.adler=u(B.adler,Y.pending_buf,Y.pending-q,q)),ie===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&U(B),Y.pending+2<=Y.pending_buf_size&&(me(Y,255&B.adler),me(Y,B.adler>>8&255),B.adler=0,Y.status=z)):Y.status=z),Y.pending!==0){if(U(B),B.avail_out===0)return Y.last_flush=-1,b}else if(B.avail_in===0&&V(re)<=V(Z)&&re!==y)return N(B,-5);if(Y.status===666&&B.avail_in!==0)return N(B,-5);if(B.avail_in!==0||Y.lookahead!==0||re!==d&&Y.status!==666){var se=Y.strategy===2?function(ce,de){for(var ve;;){if(ce.lookahead===0&&(Se(ce),ce.lookahead===0)){if(de===d)return k;break}if(ce.match_length=0,ve=l._tr_tally(ce,0,ce.window[ce.strstart]),ce.lookahead--,ce.strstart++,ve&&(J(ce,!1),ce.strm.avail_out===0))return k}return ce.insert=0,de===y?(J(ce,!0),ce.strm.avail_out===0?F:G):ce.last_lit&&(J(ce,!1),ce.strm.avail_out===0)?k:$}(Y,re):Y.strategy===3?function(ce,de){for(var ve,ye,ge,Pe,pe=ce.window;;){if(ce.lookahead<=H){if(Se(ce),ce.lookahead<=H&&de===d)return k;if(ce.lookahead===0)break}if(ce.match_length=0,ce.lookahead>=D&&0ce.lookahead&&(ce.match_length=ce.lookahead)}if(ce.match_length>=D?(ve=l._tr_tally(ce,1,ce.match_length-D),ce.lookahead-=ce.match_length,ce.strstart+=ce.match_length,ce.match_length=0):(ve=l._tr_tally(ce,0,ce.window[ce.strstart]),ce.lookahead--,ce.strstart++),ve&&(J(ce,!1),ce.strm.avail_out===0))return k}return ce.insert=0,de===y?(J(ce,!0),ce.strm.avail_out===0?F:G):ce.last_lit&&(J(ce,!1),ce.strm.avail_out===0)?k:$}(Y,re):o[Y.level].func(Y,re);if(se!==F&&se!==G||(Y.status=666),se===k||se===F)return B.avail_out===0&&(Y.last_flush=-1),b;if(se===$&&(re===1?l._tr_align(Y):re!==5&&(l._tr_stored_block(Y,0,0,!1),re===3&&(K(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),U(B),B.avail_out===0))return Y.last_flush=-1,b}return re!==y?b:Y.wrap<=0?1:(Y.wrap===2?(me(Y,255&B.adler),me(Y,B.adler>>8&255),me(Y,B.adler>>16&255),me(Y,B.adler>>24&255),me(Y,255&B.total_in),me(Y,B.total_in>>8&255),me(Y,B.total_in>>16&255),me(Y,B.total_in>>24&255)):(he(Y,B.adler>>>16),he(Y,65535&B.adler)),U(B),0=Z.w_size&&(ie===0&&(K(Z.head),Z.strstart=0,Z.block_start=0,Z.insert=0),de=new a.Buf8(Z.w_size),a.arraySet(de,re,ve-Z.w_size,Z.w_size,0),re=de,ve=Z.w_size),ne=B.avail_in,se=B.next_in,ce=B.input,B.avail_in=ve,B.next_in=0,B.input=re,Se(Z);Z.lookahead>=D;){for(Y=Z.strstart,q=Z.lookahead-(D-1);Z.ins_h=(Z.ins_h<>>=D=M>>>24,_-=D,(D=M>>>16&255)===0)$[m++]=65535&M;else{if(!(16&D)){if(!(64&D)){M=T[(65535&M)+(E&(1<>>=D,_-=D),_<15&&(E+=k[c++]<<_,_+=8,E+=k[c++]<<_,_+=8),M=C[E&I];i:for(;;){if(E>>>=D=M>>>24,_-=D,!(16&(D=M>>>16&255))){if(!(64&D)){M=C[(65535&M)+(E&(1<>>=D,_-=D,(D=m-d)>3,E&=(1<<(_-=H<<3))-1,o.next_in=c,o.next_out=m,o.avail_in=c>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function E(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(O){var z;return O&&O.state?(z=O.state,O.total_in=O.total_out=z.total=0,O.msg="",z.wrap&&(O.adler=1&z.wrap),z.mode=S,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new o.Buf32(A),z.distcode=z.distdyn=new o.Buf32(P),z.sane=1,z.back=-1,y):b}function T(O){var z;return O&&O.state?((z=O.state).wsize=0,z.whave=0,z.wnext=0,_(O)):b}function C(O,z){var k,$;return O&&O.state?($=O.state,z<0?(k=0,z=-z):(k=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15=G.wsize?(o.arraySet(G.window,z,k-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):($<(F=G.wsize-G.wnext)&&(F=$),o.arraySet(G.window,z,k-$,F,G.wnext),($-=F)?(o.arraySet(G.window,z,k-$,$,0),G.wnext=$,G.whave=G.wsize):(G.wnext+=F,G.wnext===G.wsize&&(G.wnext=0),G.whave>>8&255,k.check=l(k.check,ie,2,0),J=U=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&U)<<8)+(U>>8))%31){O.msg="incorrect header check",k.mode=30;break}if((15&U)!=8){O.msg="unknown compression method",k.mode=30;break}if(J-=4,B=8+(15&(U>>>=4)),k.wbits===0)k.wbits=B;else if(B>k.wbits){O.msg="invalid window size",k.mode=30;break}k.dmax=1<>8&1),512&k.flags&&(ie[0]=255&U,ie[1]=U>>>8&255,k.check=l(k.check,ie,2,0)),J=U=0,k.mode=3;case 3:for(;J<32;){if(V===0)break e;V--,U+=$[G++]<>>8&255,ie[2]=U>>>16&255,ie[3]=U>>>24&255,k.check=l(k.check,ie,4,0)),J=U=0,k.mode=4;case 4:for(;J<16;){if(V===0)break e;V--,U+=$[G++]<>8),512&k.flags&&(ie[0]=255&U,ie[1]=U>>>8&255,k.check=l(k.check,ie,2,0)),J=U=0,k.mode=5;case 5:if(1024&k.flags){for(;J<16;){if(V===0)break e;V--,U+=$[G++]<>>8&255,k.check=l(k.check,ie,2,0)),J=U=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(V<(le=k.length)&&(le=V),le&&(k.head&&(B=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),o.arraySet(k.head.extra,$,G,le,B)),512&k.flags&&(k.check=l(k.check,$,le,G)),V-=le,G+=le,k.length-=le),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(V===0)break e;for(le=0;B=$[G+le++],k.head&&B&&k.length<65536&&(k.head.name+=String.fromCharCode(B)),B&&le>9&1,k.head.done=!0),O.adler=k.check=0,k.mode=12;break;case 10:for(;J<32;){if(V===0)break e;V--,U+=$[G++]<>>=7&J,J-=7&J,k.mode=27;break}for(;J<3;){if(V===0)break e;V--,U+=$[G++]<>>=1)){case 0:k.mode=14;break;case 1:if(H(k),k.mode=20,z!==6)break;U>>>=2,J-=2;break e;case 2:k.mode=17;break;case 3:O.msg="invalid block type",k.mode=30}U>>>=2,J-=2;break;case 14:for(U>>>=7&J,J-=7&J;J<32;){if(V===0)break e;V--,U+=$[G++]<>>16^65535)){O.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&U,J=U=0,k.mode=15,z===6)break e;case 15:k.mode=16;case 16:if(le=k.length){if(V>>=5,J-=5,k.ndist=1+(31&U),U>>>=5,J-=5,k.ncode=4+(15&U),U>>>=4,J-=4,286>>=3,J-=3}for(;k.have<19;)k.lens[ne[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,Z={bits:k.lenbits},re=u(0,k.lens,0,19,k.lencode,0,k.work,Z),k.lenbits=Z.bits,re){O.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have>>16&255,be=65535&q,!((ue=q>>>24)<=J);){if(V===0)break e;V--,U+=$[G++]<>>=ue,J-=ue,k.lens[k.have++]=be;else{if(be===16){for(Y=ue+2;J>>=ue,J-=ue,k.have===0){O.msg="invalid bit length repeat",k.mode=30;break}B=k.lens[k.have-1],le=3+(3&U),U>>>=2,J-=2}else if(be===17){for(Y=ue+3;J>>=ue)),U>>>=3,J-=3}else{for(Y=ue+7;J>>=ue)),U>>>=7,J-=7}if(k.have+le>k.nlen+k.ndist){O.msg="invalid bit length repeat",k.mode=30;break}for(;le--;)k.lens[k.have++]=B}}if(k.mode===30)break;if(k.lens[256]===0){O.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,Z={bits:k.lenbits},re=u(m,k.lens,0,k.nlen,k.lencode,0,k.work,Z),k.lenbits=Z.bits,re){O.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,Z={bits:k.distbits},re=u(d,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,Z),k.distbits=Z.bits,re){O.msg="invalid distances set",k.mode=30;break}if(k.mode=20,z===6)break e;case 20:k.mode=21;case 21:if(6<=V&&258<=K){O.next_out=N,O.avail_out=K,O.next_in=G,O.avail_in=V,k.hold=U,k.bits=J,c(O,he),N=O.next_out,F=O.output,K=O.avail_out,G=O.next_in,$=O.input,V=O.avail_in,U=k.hold,J=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;fe=(q=k.lencode[U&(1<>>16&255,be=65535&q,!((ue=q>>>24)<=J);){if(V===0)break e;V--,U+=$[G++]<>Ee)])>>>16&255,be=65535&q,!(Ee+(ue=q>>>24)<=J);){if(V===0)break e;V--,U+=$[G++]<>>=Ee,J-=Ee,k.back+=Ee}if(U>>>=ue,J-=ue,k.back+=ue,k.length=be,fe===0){k.mode=26;break}if(32&fe){k.back=-1,k.mode=12;break}if(64&fe){O.msg="invalid literal/length code",k.mode=30;break}k.extra=15&fe,k.mode=22;case 22:if(k.extra){for(Y=k.extra;J>>=k.extra,J-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;fe=(q=k.distcode[U&(1<>>16&255,be=65535&q,!((ue=q>>>24)<=J);){if(V===0)break e;V--,U+=$[G++]<>Ee)])>>>16&255,be=65535&q,!(Ee+(ue=q>>>24)<=J);){if(V===0)break e;V--,U+=$[G++]<>>=Ee,J-=Ee,k.back+=Ee}if(U>>>=ue,J-=ue,k.back+=ue,64&fe){O.msg="invalid distance code",k.mode=30;break}k.offset=be,k.extra=15&fe,k.mode=24;case 24:if(k.extra){for(Y=k.extra;J>>=k.extra,J-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){O.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(K===0)break e;if(le=he-K,k.offset>le){if((le=k.offset-le)>k.whave&&k.sane){O.msg="invalid distance too far back",k.mode=30;break}Se=le>k.wnext?(le-=k.wnext,k.wsize-le):k.wnext-le,le>k.length&&(le=k.length),oe=k.window}else oe=F,Se=N-k.offset,le=k.length;for(KI?(D=Se[oe+P[z]],J[me+P[z]]):(D=96,0),E=1<>N)+(_-=E)]=M<<24|D<<16|H|0,_!==0;);for(E=1<>=1;if(E!==0?(U&=E-1,U+=E):U=0,z++,--he[O]==0){if(O===$)break;O=d[y+P[z]]}if(F>>7)]}function me(q,ie){q.pending_buf[q.pending++]=255&ie,q.pending_buf[q.pending++]=ie>>>8&255}function he(q,ie,ne){q.bi_valid>x-ne?(q.bi_buf|=ie<>x-q.bi_valid,q.bi_valid+=ne-x):(q.bi_buf|=ie<>>=1,ne<<=1,0<--ie;);return ne>>>1}function oe(q,ie,ne){var se,ce,de=new Array(P+1),ve=0;for(se=1;se<=P;se++)de[se]=ve=ve+ne[se-1]<<1;for(ce=0;ce<=ie;ce++){var ye=q[2*ce+1];ye!==0&&(q[2*ce]=Se(de[ye]++,ye))}}function ue(q){var ie;for(ie=0;ie>1;1<=ne;ne--)Ee(q,de,ne);for(ce=ge;ne=q.heap[1],q.heap[1]=q.heap[q.heap_len--],Ee(q,de,1),se=q.heap[1],q.heap[--q.heap_max]=ne,q.heap[--q.heap_max]=se,de[2*ce]=de[2*ne]+de[2*se],q.depth[ce]=(q.depth[ne]>=q.depth[se]?q.depth[ne]:q.depth[se])+1,de[2*ne+1]=de[2*se+1]=ce,q.heap[1]=ce++,Ee(q,de,1),2<=q.heap_len;);q.heap[--q.heap_max]=q.heap[1],function(pe,Te){var Le,Ie,Re,Me,De,ke,Fe=Te.dyn_tree,qe=Te.max_code,Mt=Te.stat_desc.static_tree,kt=Te.stat_desc.has_stree,et=Te.stat_desc.extra_bits,gt=Te.stat_desc.extra_base,Qe=Te.stat_desc.max_length,ut=0;for(Me=0;Me<=P;Me++)pe.bl_count[Me]=0;for(Fe[2*pe.heap[pe.heap_max]+1]=0,Le=pe.heap_max+1;Le>=7;ce>>=1)if(1&Pe&&ye.dyn_ltree[2*ge]!==0)return a;if(ye.dyn_ltree[18]!==0||ye.dyn_ltree[20]!==0||ye.dyn_ltree[26]!==0)return l;for(ge=32;ge>>3,(de=q.static_len+3+7>>>3)<=ce&&(ce=de)):ce=de=ne+5,ne+4<=ce&&ie!==-1?Y(q,ie,ne,se):q.strategy===4||de===ce?(he(q,2+(se?1:0),3),ee(q,W,O)):(he(q,4+(se?1:0),3),function(ye,ge,Pe,pe){var Te;for(he(ye,ge-257,5),he(ye,Pe-1,5),he(ye,pe-4,4),Te=0;Te>>8&255,q.pending_buf[q.d_buf+2*q.last_lit+1]=255&ie,q.pending_buf[q.l_buf+q.last_lit]=255&ne,q.last_lit++,ie===0?q.dyn_ltree[2*ne]++:(q.matches++,ie--,q.dyn_ltree[2*(k[ne]+d+1)]++,q.dyn_dtree[2*J(ie)]++),q.last_lit===q.lit_bufsize-1},s._tr_align=function(q){he(q,2,3),le(q,_,W),function(ie){ie.bi_valid===16?(me(ie,ie.bi_buf),ie.bi_buf=0,ie.bi_valid=0):8<=ie.bi_valid&&(ie.pending_buf[ie.pending++]=255&ie.bi_buf,ie.bi_buf>>=8,ie.bi_valid-=8)}(q)}},{"../utils/common":41}],53:[function(t,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,s){r.exports=typeof setImmediate=="function"?setImmediate:function(){var o=[].slice.apply(arguments);o.splice(1,0,0),setTimeout.apply(null,o)}},{}]},{},[10])(10)})})(jszip_min);var jszip_minExports=jszip_min.exports;const JSZip=getDefaultExportFromCjs(jszip_minExports);class MXLHelper{static MXLtoIXmlElement(e){const t=new JSZip;return t.loadAsync(e).then(o=>t.file("META-INF/container.xml").async("text"),o=>{throw o}).then(o=>{const c=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return t.file(c).async("text")},o=>{throw o}).then(o=>{const l=new DOMParser().parseFromString(o,"text/xml"),c=new IXmlElement(l.documentElement);return Promise.resolve(c)},o=>{throw o}).then(o=>o,o=>{throw new Error("extractSheetFromMxl: "+o.message)})}static MXLtoXMLstring(e){const t=new JSZip;return t.loadAsync(e).then(r=>t.file("META-INF/container.xml").async("text"),r=>{throw log$2.error(r),r}).then(r=>{const a=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return t.file(a).async("text")},r=>{throw r})}}class PlaybackNoteGenerator{calculate(e){const t=new MusicPartManagerIterator(e);for(;!t.EndReached;){const r=t.CurrentEnrolledTimestamp,s=t.CurrentAudibleVoiceEntries();for(const o of s)this.handleVoiceEntry(e,o,r);t.moveToNext()}}handleVoiceEntry(e,t,r){if(t.IsGrace)return;const s=t.ParentVoice;let o;e.PlaybackDataDict.containsKey(s)?o=e.PlaybackDataDict.getValue(s):(o=[],e.PlaybackDataDict.setValue(s,o));for(const a of t.PlaybackEntries)if(a.HasNotes){for(const c of a.Notes)c.setLength();const l=Fraction$1.plus(r,a.TimestampShift);PlaybackNoteGenerator.addEntrySorted(o,a,l)}}static addEntrySorted(e,t,r){if(e.length===0)e.push({enrolledTimestamp:r,playbackEntry:t});else for(let s=e.length-1;s>=0;s--){const o=e[s];if(r.RealValue>o.enrolledTimestamp.RealValue)if(s===e.length-1){e.push({enrolledTimestamp:r,playbackEntry:t});break}else{e.splice(s+1,0,{enrolledTimestamp:r,playbackEntry:t});break}}}}class ScreenViewingRegion{constructor(e,t,r,s){this.psi=new BoundingBox$1(void 0),this.displaySizeInPixel=e,this.RelativeDisplaySize=t,this.RelativeDisplayPosition=r,this.WidthInUnits=s}static createWithRelativeDefaults(e,t){return new ScreenViewingRegion(e,new SizeF2D(1,1),new PointF2D(0,0),t)}static createWithDefaults(){return new ScreenViewingRegion(new SizeF2D(1,1),new SizeF2D(1,1),new PointF2D(0,0),1)}get UpperLeftPositionInUnits(){return this.psi.AbsolutePosition}set UpperLeftPositionInUnits(e){this.psi.AbsolutePosition=e}get DisplaySizeInPixel(){return this.displaySizeInPixel}set DisplaySizeInPixel(e){this.displaySizeInPixel=e,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RelativeDisplaySize(){return this.relativeRegionSize}set RelativeDisplaySize(e){this.relativeRegionSize=e,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RegionSizeInPixel(){return this.regionSizeInPixel}get WidthInUnits(){return this.psi.BorderRight}set WidthInUnits(e){this.psi.BorderRight=e,this.recalculateDependentVariables()}get ViewRegionInUnits(){return new SizeF2D(this.psi.BorderRight,this.psi.BorderBottom)}isVisible(e,t){const r=this.psi.collisionDetection(e);return this.psi.liesInsideBorders(e),r}isInsideDisplayArea(e,t){return this.RelativeDisplayPosition.x<=e&&e<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=t&&t<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}transformToUnitCoordinates(e){return new PointF2D(this.UpperLeftPositionInUnits.x+this.ViewRegionInUnits.width*((e.x-this.RelativeDisplayPosition.x)/this.RelativeDisplaySize.width),this.UpperLeftPositionInUnits.y+this.ViewRegionInUnits.height*((e.y-this.RelativeDisplayPosition.y)/this.RelativeDisplaySize.height))}transformLengthXToUnitCoordinates(e){return e/this.horizontalUnitToPixelRatio}transformLengthYToUnitCoordinates(e){return e/this.verticalUnitToPixelRatio}recalculateDependentVariables(){const e=this.regionSizeInPixel.width/this.regionSizeInPixel.height;this.psi.BorderBottom=this.psi.BorderRight/e,this.horizontalUnitToPixelRatio=this.regionSizeInPixel.width/this.ViewRegionInUnits.width,this.verticalUnitToPixelRatio=this.regionSizeInPixel.height/this.ViewRegionInUnits.height}}class AbstractZoomView{constructor(e){this.aspectRatio=1,this.zoomViews=[],this.mouseZoomMode=!1,this.autoScrollY=!0,this.displayInteractionManager=e,this.displayInteractionManager.addListener(this),this.offsetXMin=Number.MIN_VALUE,this.offsetYMin=Number.MIN_VALUE,this.rangeXMin=1,this.rangeYMin=1,this.offsetXMax=Number.MAX_VALUE,this.offsetYMax=Number.MAX_VALUE,this.rangeXMax=1e9,this.rangeYMax=1e9,this.XScrollingEnabled=!1,this.YScrollingEnabled=!0}positionTouched(e,t){if(!this.convertToUnitsReady())return;const r=this.getPositionInUnits(e,t);this.unitPosTouched(r,e,t)}get TouchActive(){return this.displayInteractionManager.TouchActive}get TouchMoving(){return this.displayInteractionManager.TouchMoving}positionDoubleTouched(e,t){if(!this.convertToUnitsReady())return;const r=this.getPositionInUnits(e,t);this.unitPosDoubleTouched(r,e,t)}get UsesManuallyControlledZoomMode(){return this.usesManuallyControlledZoomMode}set UsesManuallyControlledZoomMode(e){this.usesManuallyControlledZoomMode=e}mouseDown(e,t,r=!1){if(!this.convertToUnitsReady())return;this.selectScrollControllerY(!1),this.lastRangeX=Math.max(1,this.RangeX),this.lastRangeY=Math.max(1,this.RangeY),this.lastOffsetX=this.OffsetX,this.lastOffsetY=this.OffsetY;const s=this.getPositionInUnits(e,t);this.unitPosTouchDown(s,e,t),this.usesManuallyControlledZoomMode||(r?this.mouseZoomMode=!0:this.mouseZoomMode=!1)}mouseUp(e,t){const r=this.getPositionInUnits(e,t);this.unitPosTouchUp(r,e,t)}mouseMove(e,t,r,s){this.mouseZoomMode?(Math.abs(r-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+r))),!this.lockRanges&&Math.abs(s-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-s)))):(Math.abs(r-0)>1e-8&&(this.OffsetX=this.lastOffsetX-r*this.RangeX),Math.abs(s-0)>1e-8&&(this.OffsetY=this.lastOffsetY-s*this.RangeY));const o=this.getPositionInUnits(e,t);this.unitPosMove(o,e,t)}zoom(e){this.RangeX=Math.abs(this.lastRangeX/e)}addZoomView(e){this.zoomViews.push(e)}get OffsetX(){return this.offsetX}set OffsetX(e){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,e));for(const t of this.zoomViews)t.viewportXChanged(this.offsetX,this.RangeX)}get OffsetY(){return this.offsetY}set OffsetY(e){this.offsetY=e,this.offsetY>this.offsetYMax?this.offsetY=this.offsetYMax:this.offsetY(i[i.SingleTouch=0]="SingleTouch",i[i.DoubleTouch=1]="DoubleTouch",i[i.TouchUp=2]="TouchUp",i[i.TouchDown=3]="TouchDown",i[i.Move=4]="Move",i))(InteractionType||{});class VoiceEntryInteractionListener{constructor(e){this.renderingManager=e}userDisplayInteraction(e,t,r){var s,o;switch(r){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const a=this.renderingManager.GraphicalMusicSheet.GetNearestVoiceEntry(t);a&&a.parentStaffEntry.parentVerticalContainer!==void 0&&((s=a.notes[0])==null?void 0:s.sourceNote.Pitch)!==void 0&&((o=this.renderingManager.PlaybackManager)==null||o.playVoiceEntry(a.parentVoiceEntry));break}}}}class SheetRenderingManager extends AbstractZoomView{constructor(e,t){super(e),this.mainViewingRegion=ScreenViewingRegion.createWithDefaults(),this.tryAgainToRenderCount=0,this.yOffsetMouseDown=Number.MIN_VALUE,this.unlockCursorDistancePixel=50,this.relativeTopPosition=.06,this.internalPreviewImageScale=3,this.listeners=[],this.LockDisplayToCursor=!0,this.ZoomActive=!1,this.rules=t,this.addZoomView(this),this.lockRanges=!0,this.TopBarHeightInPixel=70,this.BottomBarHeightInPixel=0,this.rules.UseDefaultVoiceInteractionListener&&this.listeners.push(new VoiceEntryInteractionListener(this))}addListener(e){this.listeners.push(e)}get Listeners(){return this.listeners}convertToUnitsReady(){return this.graphicalMusicSheet!==void 0}unitPosTouched(e,t,r){if(!this.SingleTouchDisabled){const s=new PointF2D(t,r);this.handleUserDisplayInteraction(s,e,InteractionType.SingleTouch)}}unitPosDoubleTouched(e,t,r){if(!this.DoubleTouchDisabled){const s=new PointF2D(t,r);this.handleUserDisplayInteraction(s,e,InteractionType.DoubleTouch)}}unitPosTouchDown(e,t,r){const s=new PointF2D(t,r);this.handleUserDisplayInteraction(s,e,InteractionType.TouchDown),this.yOffsetMouseDown=e.y}unitPosTouchUp(e,t,r){const s=new PointF2D(t,r);this.handleUserDisplayInteraction(s,e,InteractionType.TouchUp),this.displayInteractionManager.WasZoomGestureActive===!1&&this.unlockFromCursorIfNecessary(e),this.yOffsetMouseDown=Number.MIN_VALUE}unitPosMove(e,t,r){const s=new PointF2D(t,r);this.handleUserDisplayInteraction(s,e,InteractionType.Move),this.unlockFromCursorIfNecessary(e)}get MainViewingRegion(){return this.mainViewingRegion}setMusicSheet(e){this.graphicalMusicSheet=e,this.adaptDisplayLimitsToSheet(),this.setYOffset(0,!0)}viewportXChanged(e,t){this.graphicalMusicSheet!==void 0&&this.horizontalViewportChanged(e,t)}viewportYChanged(e,t){this.graphicalMusicSheet!==void 0&&(this.yOffsetMouseDown<=Number.MIN_VALUE+.5&&(this.yOffsetMouseDown=e),this.verticalViewportChanged(e,t))}displaySizeChanged(e,t){super.viewSizeChanged(e,t),!(Math.abs(e-0)<1e-7||Math.abs(t-0)<1e-7)&&(this.graphicalMusicSheet!==void 0&&this.graphicalMusicSheet.EnforceRedrawOfMusicSystems(),this.mainViewingRegion.DisplaySizeInPixel=new SizeF2D(e,t),this.adaptDisplayLimitsToSheet())}calcDisplayYPosition(e){return e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderMarginTop-this.topBarHeightInUnits()-this.relativeTopPosition*this.heightWithoutTopBottomBarsInUnits()}yPositionForLastSystem(e){return e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderMarginBottom-this.topBarHeightInUnits()-(1-this.relativeTopPosition)*this.heightWithoutTopBottomBarsInUnits()}scorePositionChanged(e,t,r,s,o,a){const l=this.calcDisplayYPosition(s);this.setYPosition(l,a)}setXPosition(e,t){this.LockDisplayToCursor&&this.setXOffset(e,t)}setYPosition(e,t){this.LockDisplayToCursor&&this.setYOffset(e,t)}get DrawingParameters(){return this.musicSheetDrawer.drawingParameters}topBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.TopBarHeightInPixel)}bottomBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.BottomBarHeightInPixel)}heightWithoutTopBottomBarsInUnits(){return this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits()}activePositionToBottomBarHeight(){return(this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits())*(1-2*this.relativeTopPosition)}getClickPosition(e,t){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,t))}graphicalObjectIsVisible(e){return this.mainViewingRegion.isVisible(e,!1)}adaptDisplayLimitsToSheet(){if(this.graphicalMusicSheet===void 0||this.graphicalMusicSheet.MusicPages.length===0||this.graphicalMusicSheet.MusicPages[0].MusicSystems.length===0)return;this.offsetXMin=0,this.rangeXMin=this.graphicalMusicSheet.MinAllowedSystemWidth,this.rangeXMax=300,this.offsetYMin=-.3*this.RangeY;const e=this.graphicalMusicSheet.MusicPages.last().PositionAndShape;this.offsetYMax=Math.max(0,e.BorderMarginBottom-.7*this.RangeY),this.OffsetY>this.offsetYMax&&this.setYOffset(this.offsetYMax,!0)}horizontalViewportChanged(e,t){this.mainViewingRegion.WidthInUnits!==t&&(this.mainViewingRegion.WidthInUnits=t)}verticalViewportChanged(e,t){this.mainViewingRegion.UpperLeftPositionInUnits=new PointF2D(this.mainViewingRegion.UpperLeftPositionInUnits.x,e)}unlockFromCursorIfNecessary(e){if(this.LockDisplayToCursor===!1||this.ZoomActive||this.displayInteractionManager.ZoomGestureActive||this.displayInteractionManager.WasZoomGestureActive)return;Math.abs((e.y-this.yOffsetMouseDown)*this.mainViewingRegion.RegionSizeInPixel.height/this.mainViewingRegion.ViewRegionInUnits.height)>this.unlockCursorDistancePixel&&(this.LockDisplayToCursor=!1)}getPositionInUnits(e,t){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,t))}handleUserDisplayInteraction(e,t,r){switch(r){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const s=this.graphicalMusicSheet.GetNearestVoiceEntry(t);if(s){const o=new CustomEvent("note-click",{detail:{...s,setAvtivePlay:()=>{var a,l;if(s.parentStaffEntry.parentVerticalContainer!==void 0){const c=s.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;this.setStartPosition(c),((a=s.notes[0])==null?void 0:a.sourceNote.Pitch)!==void 0&&(console.log("playback clicked note",s.parentVoiceEntry),(l=this.PlaybackManager)==null||l.playVoiceEntry(s.parentVoiceEntry))}}}});window.dispatchEvent(o)}}case InteractionType.TouchUp:case InteractionType.TouchDown:case InteractionType.Move:for(const s of this.listeners)s.userDisplayInteraction(e,t,r);break;default:throw new Error("type")}}setStartPosition(e){var t;this.graphicalMusicSheet!==void 0&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=e,(t=this.PlaybackManager)==null||t.reset())}get GraphicalMusicSheet(){return this.graphicalMusicSheet}}class WebSheetRenderingManager extends SheetRenderingManager{mouseMove(e,t,r,s){const o=this.getPositionInUnits(e,t);this.unitPosMove(o,e,t)}}class AbstractDisplayInteractionManager{constructor(){this.listeners=[],this.zoomGestureActive=!1,this.touchCount=0,this.touchActive=!1,this.touchMoving=!1,this.displayWidth=1,this.displayHeight=1,this.displayDpi=96,this.maxNumerOfFingers=2,this.movementThreshInch=.075,this.interactionWasZoomGesture=!1}addListener(e){this.listeners.push(e)}get ZoomGestureActive(){return this.zoomGestureActive}get WasZoomGestureActive(){return this.interactionWasZoomGesture}displaySizeChanged(e,t){this.displayWidth=e,this.displayHeight=t;for(const r of this.listeners)r.displaySizeChanged(this.displayWidth,this.displayHeight)}Dispose(){this.dispose()}Initialize(){this.initialize()}get DisplayDpi(){return this.displayDpi}get TouchActive(){return this.touchActive}get TouchMoving(){return this.touchMoving}touchDown(e,t,r){this.interactionWasZoomGesture=!1;const s=e/this.displayWidth,o=t/this.displayHeight;this.lastRelPosX=s,this.lastRelPosY=o,this.lastPixelX=e,this.lastPixelY=t,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);for(const a of this.listeners)a.mouseDown(s,o,!r)}move(e,t){if(this.touchActive&&!this.zoomGestureActive){const r=e/this.displayWidth,s=t/this.displayHeight,o=r-this.lastRelPosX,a=s-this.lastRelPosY;this.touchMoving=!0;for(const l of this.listeners)l.mouseMove(r,s,o,a)}}zoomGestureStarted(){this.zoomGestureActive=!0}zoomGestureCompleted(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}zoomGestureMove(e){this.zoomGestureActive&&this.listeners.forEach(function(t){t.zoom(e)})}touchUp(e,t){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);const r=e/this.displayWidth,s=t/this.displayHeight;for(const o of this.listeners)o.mouseUp(r,s)}click(e,t){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,t)&&!this.ZoomGestureActive){const r=e/this.displayWidth,s=t/this.displayHeight;for(const o of this.listeners)o.positionTouched(r,s)}}doubleClick(e,t){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,t)&&!this.ZoomGestureActive){const r=e/this.displayWidth,s=t/this.displayHeight;for(const o of this.listeners)o.positionDoubleTouched(r,s)}}mouseDidMove(e,t,r,s){const o=Math.abs(e-t)/this.displayDpi,a=Math.abs(r-s)/this.displayDpi;return o>this.movementThreshInch||a>this.movementThreshInch}}class WebDisplayInteractionManager extends AbstractDisplayInteractionManager{constructor(e){super(),this.fullOffsetLeft=0,this.fullOffsetTop=0,this.fullScrollTop=0,this.fullScrollLeft=0,this.parentScrollMap=new Map,this.scrollCallbackMap=new Map,this.timeout=void 0,this.resizeObserver=void 0,this.EventCallbackMap=new Dictionary,this.DOUBLE_CLICK_WINDOW=200,this.lastClick=0,this.osmdSheetMusicContainer=e,this.listenForInteractions()}get FullOffsetTop(){return this.fullOffsetTop}get FullScrollTop(){return this.fullScrollTop}get FullOffsetLeft(){return this.fullOffsetLeft}get FullScrollLeft(){return this.fullScrollLeft}static resizeCallback(e,t){clearTimeout(t.timeout),t.timeout=setTimeout(()=>{t.fullOffsetLeft=0,t.fullOffsetTop=0;let r=t.osmdSheetMusicContainer;for(;r;)t.fullOffsetLeft+=r.offsetLeft,t.fullOffsetTop+=r.offsetTop,r=r.offsetParent;t.resizeEventListener(),t.deregisterScrollOffsets(),t.registerScrollOffsets()},500)}registerScrollOffsets(){let e=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;const t=this;for(;e&&e!==document.documentElement;){if(this.parentScrollMap.set(e,[e.scrollTop,e.scrollLeft]),this.fullScrollLeft+=e.scrollLeft,this.fullScrollTop+=e.scrollTop,e.scrollHeight>e.clientHeight){const r=function(s){const o=t.parentScrollMap.get(this),a=o[0],l=o[1];t.fullScrollTop=t.fullScrollTop-a+this.scrollTop,t.fullScrollLeft=t.fullScrollLeft-l+this.scrollLeft,t.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(e,r),e.addEventListener("scroll",r)}e=e.parentElement}}deregisterScrollOffsets(){for(const e of this.scrollCallbackMap.keys())e.removeEventListener("scroll",this.scrollCallbackMap.get(e));this.scrollCallbackMap.clear()}initialize(){this.fullOffsetLeft=0,this.fullOffsetTop=0;let e=this.osmdSheetMusicContainer;const t=[],r=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(s=>{WebDisplayInteractionManager.resizeCallback(s,r)}));e;)this.fullOffsetLeft+=e.offsetLeft,this.fullOffsetTop+=e.offsetTop,this.resizeObserver?this.resizeObserver.observe(e):t.push(e),e=e.offsetParent;if(this.resizeObserver)this.disposeResizeListener=()=>{r.resizeObserver.disconnect(),r.resizeObserver=void 0};else{let s=()=>{WebDisplayInteractionManager.resizeCallback(t,r)};window.addEventListener("resize",s),this.disposeResizeListener=()=>{window.removeEventListener("resize",s),s=void 0}}r.registerScrollOffsets()}dispose(){this.disposeResizeListener();for(const e of this.EventCallbackMap.keys()){const t=this.EventCallbackMap.getValue(e);t[0].removeEventListener(e,t[1])}this.EventCallbackMap.clear(),this.deregisterScrollOffsets(),this.scrollCallbackMap.clear(),this.parentScrollMap.clear()}isTouch(){if("ontouchstart"in window||window.DocumentTouch)return!0;if(!window.matchMedia)return!1;const t=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(t).matches}get downEventName(){return this.isTouch()?"touchstart":"mousedown"}get moveEventName(){return this.isTouch()?"touchmove":"mousemove"}listenForInteractions(){const e=this.downEventListener.bind(this),t=this.touchEndEventListener.bind(this),r=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",e),this.osmdSheetMusicContainer.addEventListener("touchend",t),document.addEventListener(this.moveEventName,r),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,e]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,t]),this.EventCallbackMap.setValue(this.moveEventName,[document,r])}downEventListener(e){const t=new Date().getTime(),r=t-this.lastClick;clearTimeout(this.clickTimeout);let s=0,o=0;this.isTouch()&&e instanceof TouchEvent?(s=e.touches[0].pageX,o=e.touches[0].pageY):e instanceof MouseEvent&&(s=e.pageX,o=e.pageY);const a=this.getOffsetCoordinates(s,o);if(r0)this.doubleClick(a.x,a.y);else{const l=this;this.clickTimeout=setTimeout(function(){clearTimeout(this.clickTimeout),l.isTouch()?l.touchDown(a.x,a.y,void 0):l.click(a.x,a.y)},this.DOUBLE_CLICK_WINDOW)}this.lastClick=t}moveEventListener(e){let t=0,r=0;if(this.isTouch()&&e instanceof TouchEvent){let o;e.touches&&e.touches.length>0?o=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(o=e.changedTouches[0]),t=o==null?void 0:o.clientX,r=o==null?void 0:o.clientY}else e instanceof MouseEvent&&(t=e.clientX,r=e.clientY);const s=this.getOffsetCoordinates(t,r);this.move(s.x,s.y)}touchEndEventListener(e){let t;e.touches&&e.touches.length>0?t=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(t=e.changedTouches[0]);const r=this.getOffsetCoordinates(t==null?void 0:t.pageX,t==null?void 0:t.pageY);this.touchUp(r.x,r.y)}resizeEventListener(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}getOffsetCoordinates(e,t){const r=e-this.fullOffsetLeft+this.fullScrollLeft,s=t-this.fullOffsetTop+this.fullScrollTop;return new PointF2D(r,s)}}class DynamicsCalculator{static fillDynamicsList(e,t,r){for(let s=0;s=0&&r[c].push(new DynamicsContainer(l.InstantaneousDynamic,c))}if(l.StartingContinuousDynamic!==void 0){r[s].push(new DynamicsContainer(l.StartingContinuousDynamic,l.StaffNumber));const c=this.getOtherStaffIndexIfLinkedStavesAreDetected(e,s,l.StartingContinuousDynamic.Placement);c>=0&&r[c].push(new DynamicsContainer(l.StartingContinuousDynamic,c))}}}}static getOtherStaffIndexIfLinkedStavesAreDetected(e,t,r){const s=e.getStaffFromIndex(t),o=s.ParentInstrument.Staves.indexOf(s),a=s.ParentInstrument.Staves.length;return a>1&&o===0&&r===PlacementEnum.Below?t+1:a>1&&o===1&&r===PlacementEnum.Above?t-1:-1}static fillDynamicExpressions(e){const t=e.DynListStaves,r=e.getCompleteNumberOfStaves(),s=e.TimestampSortedDynamicExpressionsList;for(let o=0;o{t(this.processStringXml(s))},s=>{log$2.error(new Error("[OSMD] Invalid MXL file: "+s)),r(new Error("[OSMD] Invalid MXL file: "+s))})}processStringXml(e){const t=new DOMParser;if(e.substr(0,3)==="")return log$2.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+e),t.parseFromString(e.substr(3),"application/xml");if(e.substr(0,6).includes("{r.isMxl(y)?r.processMxl(y,c,u):c(r.processStringXml(y))},y=>{throw u(y),y});else{const y=new Error("[OSMD] osmd.load(string): Could not process string. Did not find {t.init(this.sheet.MusicPartManager,this.graphic)}),this.renderingManager.setMusicSheet(this.graphic),this.interactionManager.Initialize()}render(){var t;if(!this.graphic)throw new Error("OpenSheetMusicDisplay: Before rendering a music sheet, please load a MusicXML file");(t=this.drawer)==null||t.clear();let e=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(e=this.rules.SheetMaximumWidth),this.sheet.pageWidth=e/this.zoom/10,this.renderingManager.MainViewingRegion.WidthInUnits=this.sheet.pageWidth,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?(this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio,log$2.debug("[OSMD] PageHeight: "+this.rules.PageHeight)):(log$2.debug("[OSMD] endless/undefined pageformat, id: "+this.rules.PageFormat.idString),this.rules.PageHeight=100001),this.graphic.reCalculate(),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(r=>{r.update()}),this.zoomUpdated=!1,this.interactionManager.displaySizeChanged(this.container.clientWidth,this.container.clientHeight)}createOrRefreshRenderBackend(){this.drawer&&this.drawer.Backends&&(this.drawer.Backends[0]&&this.drawer.Backends[0].removeAllChildrenFromContainer(this.container),this.drawer.Backends.clear()),this.drawingParameters.Rules=this.rules,this.drawer=new VexFlowMusicSheetDrawer(this.drawingParameters),this.drawer.drawableBoundingBoxElement=this.DrawBoundingBox,this.drawer.bottomLineVisible=this.drawBottomLine,this.drawer.skyLineVisible=this.drawSkyLine;let e=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(e=this.graphic.MusicPages[0].PositionAndShape.Size.width*10*this.zoom);let t;const r=32767;for(const s of this.graphic.MusicPages){if(s.PageNumber>this.rules.MaxPageToDrawNumber)break;const o=this.createBackend(this.backendType,s),a=" exceeds CanvasBackend limit of 32767. Cutting off score.";o.getOSMDBackendType()===BackendType.Canvas&&e>r&&(log$2.warn("[OSMD] Warning: width of "+e+a),e=r),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?t=e/this.rules.PageFormat.aspectRatio:(t=s.PositionAndShape.Size.height,t+=this.rules.PageBottomMargin,t+=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.rules.RenderTitle&&(t+=this.rules.TitleTopDistance),t*=this.zoom*10),o.getOSMDBackendType()===BackendType.Canvas&&t>r&&(log$2.warn("[OSMD] Warning: height of "+t+a),t=Math.min(t,r)),o.resize(e,t),o.clear(),this.drawer.Backends.push(o),this.graphic.drawer=this.drawer}}exportSVG(){var e;for(const t of(e=this.drawer)==null?void 0:e.Backends)t instanceof SvgVexFlowBackend&&t.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var e;(e=this.drawer)==null||e.clear(),this.reset()}dispose(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}setOptions(e){if(this.rules||(this.rules=new EngravingRules),this.drawingParameters||(this.drawingParameters=new DrawingParameters,this.drawingParameters.Rules=this.rules),e==null){log$2.warn("warning: osmd.setOptions() called without an options parameter, has no effect.\nexample usage: osmd.setOptions({drawCredits: false, drawPartNames: false})");return}this.OnXMLRead=function(o){return o},e.onXMLRead&&(this.OnXMLRead=e.onXMLRead),e.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=DrawingParametersEnum[e.drawingParameters.toLowerCase()]);let r=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(e.backend!==void 0){const o=OSMDOptions.BackendTypeFromString(e.backend);r=r||this.backendType!==o,this.backendType=o}this.needBackendUpdate=r,e.autoBeam!==void 0&&(this.rules.AutoBeamNotes=e.autoBeam);const s=e.autoBeamOptions;if(s&&(s.maintain_stem_directions===void 0&&(s.maintain_stem_directions=!1),this.rules.AutoBeamOptions=s,s.groups&&s.groups.length)){for(const o of s.groups)if(o.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}e.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=e.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&e.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=e.percussionForceVoicesOneLineCutoff),e.alignRests!==void 0&&(this.rules.AlignRests=e.alignRests),e.coloringMode!==void 0&&this.setColoringMode(e),e.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=e.coloringEnabled),e.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=e.colorStemsLikeNoteheads),e.disableCursor&&(this.drawingParameters.drawCursors=!1),e.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),e.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=e.drawCredits),e.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=e.drawComposer),e.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=e.drawTitle),e.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=e.drawSubtitle),e.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=e.drawLyricist),e.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=e.drawMetronomeMarks),e.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=e.drawPartNames,e.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=e.drawPartNames)),e.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=e.drawPartAbbreviations),e.drawFingerings===!1&&(this.rules.RenderFingerings=!1),e.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=e.drawMeasureNumbers),e.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=e.drawMeasureNumbersOnlyAtSystemStart),e.drawLyrics!==void 0&&(this.rules.RenderLyrics=e.drawLyrics),e.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=e.drawTimeSignatures),e.drawSlurs!==void 0&&(this.rules.RenderSlurs=e.drawSlurs),e.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=e.measureNumberInterval),e.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=e.useXMLMeasureNumbers),e.fingeringPosition!==void 0&&(this.rules.FingeringPosition=AbstractExpression.PlacementEnumFromString(e.fingeringPosition)),e.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=e.fingeringInsideStafflines),e.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=e.newSystemFromXML),e.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=e.newPageFromXML),e.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=e.fillEmptyMeasuresWithWholeRest),e.followCursor!==void 0&&(this.FollowCursor=e.followCursor),e.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=e.setWantedStemDirectionByXml),e.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):e.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),e.defaultColorMusic&&this.rules.applyDefaultColorMusic(e.defaultColorMusic),e.defaultColorNotehead&&(this.rules.DefaultColorNotehead=e.defaultColorNotehead),e.defaultColorRest&&(this.rules.DefaultColorRest=e.defaultColorRest),e.defaultColorStem&&(this.rules.DefaultColorStem=e.defaultColorStem),e.defaultColorLabel&&(this.rules.DefaultColorLabel=e.defaultColorLabel),e.defaultColorTitle&&(this.rules.DefaultColorTitle=e.defaultColorTitle),e.defaultFontFamily&&(this.rules.DefaultFontFamily=e.defaultFontFamily),e.defaultFontStyle&&(this.rules.DefaultFontStyle=e.defaultFontStyle),e.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=e.drawUpToMeasureNumber-1),e.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=e.drawFromMeasureNumber-1),e.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=e.drawUpToPageNumber),e.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=e.drawUpToSystemNumber),e.tupletsRatioed&&(this.rules.TupletsRatioed=!0),e.tupletsBracketed&&(this.rules.TupletsBracketed=!0),e.tripletsBracketed&&(this.rules.TripletsBracketed=!0),e.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):e.autoResize===!1&&(this.autoResizeEnabled=!1),e.pageFormat!==void 0&&this.setPageFormat(e.pageFormat),e.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=e.pageBackgroundColor),e.performanceMode!==void 0&&(this.rules.PerformanceMode=e.performanceMode),e.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=e.renderSingleHorizontalStaffline),e.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=e.spacingFactorSoftmax),e.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=e.spacingBetweenTextLines),e.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=e.stretchLastSystemLine),e.autoGenerateMutipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=e.autoGenerateMutipleRestMeasuresFromRestMeasures),e.cursorsOptions!==void 0?this.cursorsOptions=e.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}setColoringMode(e){if(e.coloringMode===ColoringModes.XML){this.rules.ColoringMode=ColoringModes.XML;return}const t=[NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B,-1];let r;if(e.coloringMode===ColoringModes.CustomColorSet){if(!e.coloringSetCustom||e.coloringSetCustom.length!==8)throw new Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter with 8 strings (C to B, rest note).");for(const o of e.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(o))throw new Error("One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:\n"+o);r=e.coloringSetCustom}else if(e.coloringMode===ColoringModes.AutoColoring){r=[];const o=Object.keys(AutoColorSet);for(let a=0;a{e.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1}autoResize(){const e=this;this.handleResize(()=>{},()=>{var t;((t=this.graphic)==null?void 0:t.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),e.IsReadyToRender()&&e.render()})}handleResize(e,t){let r,s;const a=this;function l(){a.AutoResizeEnabled&&(r=new Date().getTime(),s||(e(),r=new Date().getTime(),s=window.setTimeout(c,200)))}function c(){s=void 0,window.clearTimeout(s),new Date().getTime()-r<200?s=window.setTimeout(c,200):t()}window.attachEvent?window.attachEvent("onresize",l):window.addEventListener("resize",l),this.disposeResizeListener=()=>{window.detachEvent?window.detachEvent("onresize",l):window.removeEventListener("resize",l),this.resizeHandlerAttached=!1},this.resizeHandlerAttached=!0,window.setTimeout(e,0),window.setTimeout(t,1)}enableOrDisableCursors(e){var t,r,s,o,a,l;if(this.drawingParameters.drawCursors=e,e){for(let c=0;c{c.hide()})}createBackend(e,t){let r;return e===void 0||e===BackendType.SVG?r=new SvgVexFlowBackend(this.rules):r=new CanvasVexFlowBackend(this.rules),r.graphicalMusicPage=t,r.initialize(this.container,this.zoom),r.getContext().setFillStyle(this.rules.DefaultColorMusic),r.getContext().setStrokeStyle(this.rules.DefaultColorMusic),r}static StringToPageFormat(e){let t=PageFormat.UndefinedPageFormat;if(e.match("^[0-9]+x[0-9]+$")){const r=e.split("x"),s=Number.parseInt(r[0],10),o=Number.parseInt(r[1],10);s>0&&s<32768&&o>0&&o<32768&&(t=new PageFormat(s,o,"customPageFormat".concat(e)))}return e=e.replace(" ","_"),e=e.replace("Landscape","L"),e=e.replace("Portrait","P"),ei.PageFormatStandards.hasOwnProperty(e)&&(t=ei.PageFormatStandards[e]),t}setPageFormat(e){const t=ei.StringToPageFormat(e);this.needBackendUpdate=!t.Equals(this.rules.PageFormat),this.rules.PageFormat=t}setCustomPageFormat(e,t){if(e>0&&t>0){const r=new PageFormat(e,t);this.rules.PageFormat=r}}set DrawSkyLine(e){this.drawSkyLine=e,this.drawer&&(this.drawer.skyLineVisible=e)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(e){this.drawBottomLine=e,this.drawer&&(this.drawer.bottomLineVisible=e)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(e){this.setDrawBoundingBox(e,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(e,t=!1){this.drawBoundingBox=e,this.drawer&&(this.drawer.drawableBoundingBoxElement=e),t&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(e){this.autoResizeEnabled=e}get Zoom(){return this.zoom}set Zoom(e){var t;this.zoom=e,this.zoomUpdated=!0,((t=this.graphic)==null?void 0:t.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(e){this.followCursor=e}get FollowCursor(){return this.followCursor}set TransposeCalculator(e){MusicSheetCalculator.transposeCalculator=e}get TransposeCalculator(){return MusicSheetCalculator.transposeCalculator}get Sheet(){return this.sheet}get Drawer(){return this.drawer}get GraphicSheet(){return this.graphic}get DrawingParameters(){return this.drawingParameters}get EngravingRules(){return this.rules}get InteractionManager(){return this.interactionManager}get Version(){return this.version}};_OpenSheetMusicDisplay.PageFormatStandards={A3_L:new PageFormat(420,297,"A3_L"),A3_P:new PageFormat(297,420,"A3_P"),A4_L:new PageFormat(297,210,"A4_L"),A4_P:new PageFormat(210,297,"A4_P"),A5_L:new PageFormat(210,148,"A5_L"),A5_P:new PageFormat(148,210,"A5_P"),A6_L:new PageFormat(148,105,"A6_L"),A6_P:new PageFormat(105,148,"A6_P"),Endless:PageFormat.UndefinedPageFormat,Letter_L:new PageFormat(279.4,215.9,"Letter_L"),Letter_P:new PageFormat(215.9,279.4,"Letter_P")};let OpenSheetMusicDisplay=_OpenSheetMusicDisplay;var handlebars={exports:{}},handlebars_runtime={exports:{}},base$1={},utils={};utils.__esModule=!0;utils.extend=extend;utils.indexOf=indexOf;utils.escapeExpression=escapeExpression;utils.isEmpty=isEmpty;utils.createFrame=createFrame;utils.blockParams=blockParams;utils.appendContextPath=appendContextPath;var escape$1={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},badChars=/[&<>"'`=]/g,possible=/[&<>"'`=]/;function escapeChar(i){return escape$1[i]}function extend(i){for(var e=1;e0?(o.ids&&(o.ids=[o.name]),r.helpers.each(s,o)):a(this);if(o.data&&o.ids){var c=t.createFrame(o.data);c.contextPath=t.appendContextPath(o.data.contextPath,o.name),o={data:c}}return l(s,o)})},i.exports=e.default})(blockHelperMissing,blockHelperMissing.exports);var blockHelperMissingExports=blockHelperMissing.exports,each={exports:{}};(function(i,e){e.__esModule=!0;function t(a){return a&&a.__esModule?a:{default:a}}var r=utils,s=exceptionExports,o=t(s);e.default=function(a){a.registerHelper("each",function(l,c){if(!c)throw new o.default("Must pass iterator to #each");var u=c.fn,m=c.inverse,d=0,y="",b=void 0,S=void 0;c.data&&c.ids&&(S=r.appendContextPath(c.data.contextPath,c.ids[0])+"."),r.isFunction(l)&&(l=l.call(this)),c.data&&(b=r.createFrame(c.data));function A(T,C,R){b&&(b.key=T,b.index=C,b.first=C===0,b.last=!!R,S&&(b.contextPath=S+T)),y=y+u(l[T],{data:b,blockParams:r.blockParams([l[T],T],[S+T,null])})}if(l&&typeof l=="object")if(r.isArray(l))for(var P=l.length;d=0?o=a:o=parseInt(o,10)}return o},log:function(o){if(o=r.lookupLevel(o),typeof console<"u"&&r.lookupLevel(r.level)<=o){var a=r.methodMap[o];console[a]||(a="log");for(var l=arguments.length,c=Array(l>1?l-1:0),u=1;u= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};base$1.REVISION_CHANGES=REVISION_CHANGES;var objectType="[object Object]";function HandlebarsEnvironment(i,e,t){this.helpers=i||{},this.partials=e||{},this.decorators=t||{},_helpers$2.registerDefaultHelpers(this),_decorators.registerDefaultDecorators(this)}HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2.default,log:_logger2.default.log,registerHelper:function i(e,t){if(_utils$3.toString.call(e)===objectType){if(t)throw new _exception2$3.default("Arg not supported with multiple helpers");_utils$3.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function i(e){delete this.helpers[e]},registerPartial:function i(e,t){if(_utils$3.toString.call(e)===objectType)_utils$3.extend(this.partials,e);else{if(typeof t>"u")throw new _exception2$3.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function i(e){delete this.partials[e]},registerDecorator:function i(e,t){if(_utils$3.toString.call(e)===objectType){if(t)throw new _exception2$3.default("Arg not supported with multiple decorators");_utils$3.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function i(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function i(){_internalProtoAccess$1.resetLoggedProperties()}};var log=_logger2.default.log;base$1.log=log;base$1.createFrame=_utils$3.createFrame;base$1.logger=_logger2.default;var safeString={exports:{}};(function(i,e){e.__esModule=!0;function t(r){this.string=r}t.prototype.toString=t.prototype.toHTML=function(){return""+this.string},e.default=t,i.exports=e.default})(safeString,safeString.exports);var safeStringExports=safeString.exports,runtime={},wrapHelper$1={};wrapHelper$1.__esModule=!0;wrapHelper$1.wrapHelper=wrapHelper;function wrapHelper(i,e){if(typeof i!="function")return i;var t=function(){var s=arguments[arguments.length-1];return arguments[arguments.length-1]=e(s),i.apply(this,arguments)};return t}runtime.__esModule=!0;runtime.checkRevision=checkRevision;runtime.template=template;runtime.wrapProgram=wrapProgram;runtime.resolvePartial=resolvePartial;runtime.invokePartial=invokePartial;runtime.noop=noop;function _interopRequireDefault$3(i){return i&&i.__esModule?i:{default:i}}function _interopRequireWildcard$1(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}var _utils$2=utils,Utils=_interopRequireWildcard$1(_utils$2),_exception$2=exceptionExports,_exception2$2=_interopRequireDefault$3(_exception$2),_base=base$1,_helpers$1=helpers$1,_internalWrapHelper=wrapHelper$1,_internalProtoAccess=protoAccess;function checkRevision(i){var e=i&&i[0]||1,t=_base.COMPILER_REVISION;if(!(e>=_base.LAST_COMPATIBLE_COMPILER_REVISION&&e<=_base.COMPILER_REVISION))if(e<_base.LAST_COMPATIBLE_COMPILER_REVISION){var r=_base.REVISION_CHANGES[t],s=_base.REVISION_CHANGES[e];throw new _exception2$2.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+s+").")}else throw new _exception2$2.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+i[1]+").")}function template(i,e){if(!e)throw new _exception2$2.default("No environment passed to template");if(!i||!i.main)throw new _exception2$2.default("Unknown template object: "+typeof i);i.main.decorator=i.main_d,e.VM.checkRevision(i.compiler);var t=i.compiler&&i.compiler[0]===7;function r(a,l,c){c.hash&&(l=Utils.extend({},l,c.hash),c.ids&&(c.ids[0]=!0)),a=e.VM.resolvePartial.call(this,a,l,c);var u=Utils.extend({},c,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),m=e.VM.invokePartial.call(this,a,l,u);if(m==null&&e.compile&&(c.partials[c.name]=e.compile(a,i.compilerOptions,e),m=c.partials[c.name](l,u)),m!=null){if(c.indent){for(var d=m.split("\n"),y=0,b=d.length;y"u"&&(this.lexer.yylloc={});var P=this.lexer.yylloc;d.push(P);var x=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function E(){var z;return z=c.lexer.lex()||1,typeof z!="number"&&(z=c.symbols_[z]||z),z}for(var _,T,C,R,I={},M,D,H,W;;){if(T=u[u.length-1],this.defaultActions[T]?C=this.defaultActions[T]:((_===null||typeof _>"u")&&(_=E()),C=y[T]&&y[T][_]),typeof C>"u"||!C.length||!C[0]){var O="";{W=[];for(M in y[T])this.terminals_[M]&&M>2&&W.push("'"+this.terminals_[M]+"'");this.lexer.showPosition?O="Parse error on line "+(S+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+W.join(", ")+", got '"+(this.terminals_[_]||_)+"'":O="Parse error on line "+(S+1)+": Unexpected "+(_==1?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(O,{text:this.lexer.match,token:this.terminals_[_]||_,line:this.lexer.yylineno,loc:P,expected:W})}}if(C[0]instanceof Array&&C.length>1)throw new Error("Parse Error: multiple actions possible at state: "+T+", token: "+_);switch(C[0]){case 1:u.push(_),m.push(this.lexer.yytext),d.push(this.lexer.yylloc),u.push(C[1]),_=null,A=this.lexer.yyleng,b=this.lexer.yytext,S=this.lexer.yylineno,P=this.lexer.yylloc;break;case 2:if(D=this.productions_[C[1]][1],I.$=m[m.length-D],I._$={first_line:d[d.length-(D||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(D||1)].first_column,last_column:d[d.length-1].last_column},x&&(I._$.range=[d[d.length-(D||1)].range[0],d[d.length-1].range[1]]),R=this.performAction.call(I,b,A,S,this.yy,C[1],m,d),typeof R<"u")return R;D&&(u=u.slice(0,-1*D*2),m=m.slice(0,-1*D),d=d.slice(0,-1*D)),u.push(this.productions_[C[1]][0]),m.push(I.$),d.push(I._$),H=y[u[u.length-2]][u[u.length-1]],u.push(H);break;case 3:return!0}}return!0}},s=function(){var a={EOF:1,parseError:function(c,u){if(this.yy.parser)this.yy.parser.parseError(c,u);else throw new Error(c)},setInput:function(c){return this._input=c,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var u=c.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},unput:function(c){var u=c.length,m=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u-1),this.offset-=u;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1&&(this.yylineno-=m.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===d.length?this.yylloc.first_column:0)+d[d.length-m.length].length-m[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-u]),this},more:function(){return this._more=!0,this},less:function(c){this.unput(this.match.slice(c))},pastInput:function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var c=this.pastInput(),u=new Array(c.length+1).join("-");return c+this.upcomingInput()+"\n"+u+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var c,u,m,d,y;this._more||(this.yytext="",this.match="");for(var b=this._currentRules(),S=0;Su[0].length)&&(u=m,d=S,!this.options.flex)));S++);return u?(y=u[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+u[0].length},this.yytext+=u[0],this.match+=u[0],this.matches=u,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(u[0].length),this.matched+=u[0],c=this.performAction.call(this,this.yy,this,b[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var c=this.next();return typeof c<"u"?c:this.lex()},begin:function(c){this.conditionStack.push(c)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(c){this.begin(c)}};return a.options={},a.performAction=function(c,u,m,d){function y(b,S){return u.yytext=u.yytext.substring(b,u.yyleng-S+b)}switch(m){case 0:if(u.yytext.slice(-2)==="\\\\"?(y(0,1),this.begin("mu")):u.yytext.slice(-1)==="\\"?(y(0,1),this.begin("emu")):this.begin("mu"),u.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(y(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(u.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return u.yytext=y(1,2).replace(/\\"/g,'"'),80;case 32:return u.yytext=y(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return u.yytext=u.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},a}();r.lexer=s;function o(){this.yy={}}return o.prototype=r,r.Parser=o,new o}();e.default=t,i.exports=e.default})(parser$1,parser$1.exports);var parserExports=parser$1.exports,whitespaceControl={exports:{}},visitor={exports:{}};(function(i,e){e.__esModule=!0;function t(u){return u&&u.__esModule?u:{default:u}}var r=exceptionExports,s=t(r);function o(){this.parents=[]}o.prototype={constructor:o,mutating:!1,acceptKey:function(m,d){var y=this.accept(m[d]);if(this.mutating){if(y&&!o.prototype[y.type])throw new s.default('Unexpected node type "'+y.type+'" found when accepting '+d+" on "+m.type);m[d]=y}},acceptRequired:function(m,d){if(this.acceptKey(m,d),!m[d])throw new s.default(m.type+" requires "+d)},acceptArray:function(m){for(var d=0,y=m.length;d0)throw new _exception2$1.default("Invalid path: "+r,{loc:t});c===".."&&o++}else s.push(c)}return{type:"PathExpression",data:i,depth:o,parts:s,original:r,loc:t}}function prepareMustache(i,e,t,r,s,o){var a=r.charAt(3)||r.charAt(2),l=a!=="{"&&a!=="&",c=/\*/.test(r);return{type:c?"Decorator":"MustacheStatement",path:i,params:e,hash:t,escaped:l,strip:s,loc:this.locInfo(o)}}function prepareRawBlock(i,e,t,r){validateClose(i,t),r=this.locInfo(r);var s={type:"Program",body:e,strip:{},loc:r};return{type:"BlockStatement",path:i.path,params:i.params,hash:i.hash,program:s,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}}function prepareBlock(i,e,t,r,s,o){r&&r.path&&validateClose(i,r);var a=/\*/.test(i.open);e.blockParams=i.blockParams;var l=void 0,c=void 0;if(t){if(a)throw new _exception2$1.default("Unexpected inverse block on decorator",t);t.chain&&(t.program.body[0].closeStrip=r.strip),c=t.strip,l=t.program}return s&&(s=l,l=e,e=s),{type:a?"DecoratorBlock":"BlockStatement",path:i.path,params:i.params,hash:i.hash,program:e,inverse:l,openStrip:i.strip,inverseStrip:c,closeStrip:r&&r.strip,loc:this.locInfo(o)}}function prepareProgram(i,e){if(!e&&i.length){var t=i[0].loc,r=i[i.length-1].loc;t&&r&&(e={source:t.source,start:{line:t.start.line,column:t.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:i,strip:{},loc:e}}function preparePartialBlock(i,e,t,r){return validateClose(i,t),{type:"PartialBlockStatement",name:i.path,params:i.params,hash:i.hash,program:e,openStrip:i.strip,closeStrip:t&&t.strip,loc:this.locInfo(r)}}base.__esModule=!0;base.parseWithoutProcessing=parseWithoutProcessing;base.parse=parse$2;function _interopRequireWildcard(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t]);return e.default=i,e}function _interopRequireDefault$1(i){return i&&i.__esModule?i:{default:i}}var _parser=parserExports,_parser2=_interopRequireDefault$1(_parser),_whitespaceControl=whitespaceControlExports,_whitespaceControl2=_interopRequireDefault$1(_whitespaceControl),_helpers=helpers,Helpers=_interopRequireWildcard(_helpers),_utils$1=utils;base.parser=_parser2.default;var yy={};_utils$1.extend(yy,Helpers);function parseWithoutProcessing(i,e){if(i.type==="Program")return i;_parser2.default.yy=yy,yy.locInfo=function(r){return new yy.SourceLocation(e&&e.srcName,r)};var t=_parser2.default.parse(i);return t}function parse$2(i,e){var t=parseWithoutProcessing(i,e),r=new _whitespaceControl2.default(e);return r.accept(t)}var compiler={};compiler.__esModule=!0;compiler.Compiler=Compiler;compiler.precompile=precompile;compiler.compile=compile;function _interopRequireDefault(i){return i&&i.__esModule?i:{default:i}}var _exception=exceptionExports,_exception2=_interopRequireDefault(_exception),_utils=utils,_ast=astExports,_ast2=_interopRequireDefault(_ast),slice=[].slice;function Compiler(){}Compiler.prototype={compiler:Compiler,equals:function i(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var r=0;r1)throw new _exception2.default("Unsupported number of partial arguments: "+r.length,e);r.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):r.push({type:"PathExpression",parts:[],depth:0}));var s=e.name.original,o=e.name.type==="SubExpression";o&&this.accept(e.name),this.setupFullMustacheParams(e,t,void 0,!0);var a=e.indent||"";this.options.preventIndent&&a&&(this.opcode("appendContent",a),a=""),this.opcode("invokePartial",o,s,a),this.opcode("append")},PartialBlockStatement:function i(e){this.PartialStatement(e)},MustacheStatement:function i(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function i(e){this.DecoratorBlock(e)},ContentStatement:function i(e){e.value&&this.opcode("appendContent",e.value)},CommentStatement:function i(){},SubExpression:function i(e){transformLiteralToPath(e);var t=this.classifySexpr(e);t==="simple"?this.simpleSexpr(e):t==="helper"?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function i(e,t,r){var s=e.path,o=s.parts[0],a=t!=null||r!=null;this.opcode("getContext",s.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",r),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",o,a)},simpleSexpr:function i(e){var t=e.path;t.strict=!0,this.accept(t),this.opcode("resolvePossibleLambda")},helperSexpr:function i(e,t,r){var s=this.setupFullMustacheParams(e,t,r),o=e.path,a=o.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",s.length,a);else{if(this.options.knownHelpersOnly)throw new _exception2.default("You specified knownHelpersOnly, but used the unknown helper "+a,e);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",s.length,o.original,_ast2.default.helpers.simpleId(o))}},PathExpression:function i(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0],r=_ast2.default.helpers.scopedId(e),s=!e.depth&&!r&&this.blockParamIndex(t);s?this.opcode("lookupBlockParam",s,e.parts):t?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,r):this.opcode("pushContext")},StringLiteral:function i(e){this.opcode("pushString",e.value)},NumberLiteral:function i(e){this.opcode("pushLiteral",e.value)},BooleanLiteral:function i(e){this.opcode("pushLiteral",e.value)},UndefinedLiteral:function i(){this.opcode("pushLiteral","undefined")},NullLiteral:function i(){this.opcode("pushLiteral","null")},Hash:function i(e){var t=e.pairs,r=0,s=t.length;for(this.opcode("pushHash");r=0)return[t,o]}}};function precompile(i,e,t){if(i==null||typeof i!="string"&&i.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+i);e=e||{},"data"in e||(e.data=!0),e.compat&&(e.useDepths=!0);var r=t.parse(i,e),s=new t.Compiler().compile(r,e);return new t.JavaScriptCompiler().compile(s,e)}function compile(i,e,t){if(e===void 0&&(e={}),i==null||typeof i!="string"&&i.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+i);e=_utils.extend({},e),"data"in e||(e.data=!0),e.compat&&(e.useDepths=!0);var r=void 0;function s(){var a=t.parse(i,e),l=new t.Compiler().compile(a,e),c=new t.JavaScriptCompiler().compile(l,e,void 0,!0);return t.template(c)}function o(a,l){return r||(r=s()),r.call(this,a,l)}return o._setup=function(a){return r||(r=s()),r._setup(a)},o._child=function(a,l,c,u){return r||(r=s()),r._child(a,l,c,u)},o}function argEquals(i,e){if(i===e)return!0;if(_utils.isArray(i)&&_utils.isArray(e)&&i.length===e.length){for(var t=0;t>1;return c?-u:u}return base64Vlq.encode=function(c){var u="",m,d=o(c);do m=d&r,d>>>=e,d>0&&(m|=s),u+=i.encode(m);while(d>0);return u},base64Vlq.decode=function(c,u,m){var d=c.length,y=0,b=0,S,A;do{if(u>=d)throw new Error("Expected more digits in base 64 VLQ value.");if(A=i.decode(c.charCodeAt(u++)),A===-1)throw new Error("Invalid base64 digit: "+c.charAt(u-1));S=!!(A&s),A&=r,y=y+(A<=0;W--)D=M[W],D==="."?M.splice(W,1):D===".."?H++:H>0&&(D===""?(M.splice(W+1,H),H=0):(M.splice(W,2),H--));return C=M.join("/"),C===""&&(C=I?"/":"."),R?(R.path=C,o(R)):C}i.normalize=a;function l(T,C){T===""&&(T="."),C===""&&(C=".");var R=s(C),I=s(T);if(I&&(T=I.path||"/"),R&&!R.scheme)return I&&(R.scheme=I.scheme),o(R);if(R||C.match(r))return C;if(I&&!I.host&&!I.path)return I.host=C,o(I);var M=C.charAt(0)==="/"?C:a(T.replace(/\/+$/,"")+"/"+C);return I?(I.path=M,o(I)):M}i.join=l,i.isAbsolute=function(T){return T.charAt(0)==="/"||t.test(T)};function c(T,C){T===""&&(T="."),T=T.replace(/\/$/,"");for(var R=0;C.indexOf(T+"/")!==0;){var I=T.lastIndexOf("/");if(I<0||(T=T.slice(0,I),T.match(/^([^\/]+:\/)?\/*$/)))return C;++R}return Array(R+1).join("../")+C.substr(T.length+1)}i.relative=c;var u=function(){var T=Object.create(null);return!("__proto__"in T)}();function m(T){return T}function d(T){return b(T)?"$"+T:T}i.toSetString=u?m:d;function y(T){return b(T)?T.slice(1):T}i.fromSetString=u?m:y;function b(T){if(!T)return!1;var C=T.length;if(C<9||T.charCodeAt(C-1)!==95||T.charCodeAt(C-2)!==95||T.charCodeAt(C-3)!==111||T.charCodeAt(C-4)!==116||T.charCodeAt(C-5)!==111||T.charCodeAt(C-6)!==114||T.charCodeAt(C-7)!==112||T.charCodeAt(C-8)!==95||T.charCodeAt(C-9)!==95)return!1;for(var R=C-10;R>=0;R--)if(T.charCodeAt(R)!==36)return!1;return!0}function S(T,C,R){var I=P(T.source,C.source);return I!==0||(I=T.originalLine-C.originalLine,I!==0)||(I=T.originalColumn-C.originalColumn,I!==0||R)||(I=T.generatedColumn-C.generatedColumn,I!==0)||(I=T.generatedLine-C.generatedLine,I!==0)?I:P(T.name,C.name)}i.compareByOriginalPositions=S;function A(T,C,R){var I=T.generatedLine-C.generatedLine;return I!==0||(I=T.generatedColumn-C.generatedColumn,I!==0||R)||(I=P(T.source,C.source),I!==0)||(I=T.originalLine-C.originalLine,I!==0)||(I=T.originalColumn-C.originalColumn,I!==0)?I:P(T.name,C.name)}i.compareByGeneratedPositionsDeflated=A;function P(T,C){return T===C?0:T===null?1:C===null?-1:T>C?1:-1}function x(T,C){var R=T.generatedLine-C.generatedLine;return R!==0||(R=T.generatedColumn-C.generatedColumn,R!==0)||(R=P(T.source,C.source),R!==0)||(R=T.originalLine-C.originalLine,R!==0)||(R=T.originalColumn-C.originalColumn,R!==0)?R:P(T.name,C.name)}i.compareByGeneratedPositionsInflated=x;function E(T){return JSON.parse(T.replace(/^\)]}'[^\n]*\n/,""))}i.parseSourceMapInput=E;function _(T,C,R){if(C=C||"",T&&(T[T.length-1]!=="/"&&C[0]!=="/"&&(T+="/"),C=T+C),R){var I=s(R);if(!I)throw new Error("sourceMapURL could not be parsed");if(I.path){var M=I.path.lastIndexOf("/");M>=0&&(I.path=I.path.substring(0,M+1))}C=l(o(I),C)}return a(C)}i.computeSourceURL=_}(util)),util}var arraySet={},hasRequiredArraySet;function requireArraySet(){if(hasRequiredArraySet)return arraySet;hasRequiredArraySet=1;var i=requireUtil(),e=Object.prototype.hasOwnProperty,t=typeof Map<"u";function r(){this._array=[],this._set=t?new Map:Object.create(null)}return r.fromArray=function(o,a){for(var l=new r,c=0,u=o.length;c=0)return a}else{var l=i.toSetString(o);if(e.call(this._set,l))return this._set[l]}throw new Error('"'+o+'" is not in the set.')},r.prototype.at=function(o){if(o>=0&&oo||a==o&&c>=l||i.compareByGeneratedPositionsInflated(r,s)<=0}function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return t.prototype.unsortedForEach=function(s,o){this._array.forEach(s,o)},t.prototype.add=function(s){e(this._last,s)?(this._last=s,this._array.push(s)):(this._sorted=!1,this._array.push(s))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},mappingList.MappingList=t,mappingList}var hasRequiredSourceMapGenerator;function requireSourceMapGenerator(){if(hasRequiredSourceMapGenerator)return sourceMapGenerator;hasRequiredSourceMapGenerator=1;var i=requireBase64Vlq(),e=requireUtil(),t=requireArraySet().ArraySet,r=requireMappingList().MappingList;function s(o){o||(o={}),this._file=e.getArg(o,"file",null),this._sourceRoot=e.getArg(o,"sourceRoot",null),this._skipValidation=e.getArg(o,"skipValidation",!1),this._sources=new t,this._names=new t,this._mappings=new r,this._sourcesContents=null}return s.prototype._version=3,s.fromSourceMap=function(a){var l=a.sourceRoot,c=new s({file:a.file,sourceRoot:l});return a.eachMapping(function(u){var m={generated:{line:u.generatedLine,column:u.generatedColumn}};u.source!=null&&(m.source=u.source,l!=null&&(m.source=e.relative(l,m.source)),m.original={line:u.originalLine,column:u.originalColumn},u.name!=null&&(m.name=u.name)),c.addMapping(m)}),a.sources.forEach(function(u){var m=u;l!==null&&(m=e.relative(l,u)),c._sources.has(m)||c._sources.add(m);var d=a.sourceContentFor(u);d!=null&&c.setSourceContent(u,d)}),c},s.prototype.addMapping=function(a){var l=e.getArg(a,"generated"),c=e.getArg(a,"original",null),u=e.getArg(a,"source",null),m=e.getArg(a,"name",null);this._skipValidation||this._validateMapping(l,c,u,m),u!=null&&(u=String(u),this._sources.has(u)||this._sources.add(u)),m!=null&&(m=String(m),this._names.has(m)||this._names.add(m)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:c!=null&&c.line,originalColumn:c!=null&&c.column,source:u,name:m})},s.prototype.setSourceContent=function(a,l){var c=a;this._sourceRoot!=null&&(c=e.relative(this._sourceRoot,c)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(c)]=l):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(c)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(a,l,c){var u=l;if(l==null){if(a.file==null)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');u=a.file}var m=this._sourceRoot;m!=null&&(u=e.relative(m,u));var d=new t,y=new t;this._mappings.unsortedForEach(function(b){if(b.source===u&&b.originalLine!=null){var S=a.originalPositionFor({line:b.originalLine,column:b.originalColumn});S.source!=null&&(b.source=S.source,c!=null&&(b.source=e.join(c,b.source)),m!=null&&(b.source=e.relative(m,b.source)),b.originalLine=S.line,b.originalColumn=S.column,S.name!=null&&(b.name=S.name))}var A=b.source;A!=null&&!d.has(A)&&d.add(A);var P=b.name;P!=null&&!y.has(P)&&y.add(P)},this),this._sources=d,this._names=y,a.sources.forEach(function(b){var S=a.sourceContentFor(b);S!=null&&(c!=null&&(b=e.join(c,b)),m!=null&&(b=e.relative(m,b)),this.setSourceContent(b,S))},this)},s.prototype._validateMapping=function(a,l,c,u){if(l&&typeof l.line!="number"&&typeof l.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(a&&"line"in a&&"column"in a&&a.line>0&&a.column>=0&&!l&&!c&&!u)){if(a&&"line"in a&&"column"in a&&l&&"line"in l&&"column"in l&&a.line>0&&a.column>=0&&l.line>0&&l.column>=0&&c)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:c,original:l,name:u}))}},s.prototype._serializeMappings=function(){for(var a=0,l=1,c=0,u=0,m=0,d=0,y="",b,S,A,P,x=this._mappings.toArray(),E=0,_=x.length;E<_;E++){if(S=x[E],b="",S.generatedLine!==l)for(a=0;S.generatedLine!==l;)b+=";",l++;else if(E>0){if(!e.compareByGeneratedPositionsInflated(S,x[E-1]))continue;b+=","}b+=i.encode(S.generatedColumn-a),a=S.generatedColumn,S.source!=null&&(P=this._sources.indexOf(S.source),b+=i.encode(P-d),d=P,b+=i.encode(S.originalLine-1-u),u=S.originalLine-1,b+=i.encode(S.originalColumn-c),c=S.originalColumn,S.name!=null&&(A=this._names.indexOf(S.name),b+=i.encode(A-m),m=A)),y+=b}return y},s.prototype._generateSourcesContent=function(a,l){return a.map(function(c){if(!this._sourcesContents)return null;l!=null&&(c=e.relative(l,c));var u=e.toSetString(c);return Object.prototype.hasOwnProperty.call(this._sourcesContents,u)?this._sourcesContents[u]:null},this)},s.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(a.file=this._file),this._sourceRoot!=null&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},sourceMapGenerator.SourceMapGenerator=s,sourceMapGenerator}var sourceMapConsumer={},binarySearch={},hasRequiredBinarySearch;function requireBinarySearch(){return hasRequiredBinarySearch||(hasRequiredBinarySearch=1,function(i){i.GREATEST_LOWER_BOUND=1,i.LEAST_UPPER_BOUND=2;function e(t,r,s,o,a,l){var c=Math.floor((r-t)/2)+t,u=a(s,o[c],!0);return u===0?c:u>0?r-c>1?e(c,r,s,o,a,l):l==i.LEAST_UPPER_BOUND?r1?e(t,c,s,o,a,l):l==i.LEAST_UPPER_BOUND?c:t<0?-1:t}i.search=function(r,s,o,a){if(s.length===0)return-1;var l=e(-1,s.length,r,s,o,a||i.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&o(s[l],s[l-1],!0)===0;)--l;return l}}(binarySearch)),binarySearch}var quickSort={},hasRequiredQuickSort;function requireQuickSort(){if(hasRequiredQuickSort)return quickSort;hasRequiredQuickSort=1;function i(r,s,o){var a=r[s];r[s]=r[o],r[o]=a}function e(r,s){return Math.round(r+Math.random()*(s-r))}function t(r,s,o,a){if(o=0){var A=this._originalMappings[S];if(m.column===void 0)for(var P=A.originalLine;A&&A.originalLine===P;)b.push({line:i.getArg(A,"generatedLine",null),column:i.getArg(A,"generatedColumn",null),lastColumn:i.getArg(A,"lastGeneratedColumn",null)}),A=this._originalMappings[++S];else for(var x=A.originalColumn;A&&A.originalLine===d&&A.originalColumn==x;)b.push({line:i.getArg(A,"generatedLine",null),column:i.getArg(A,"generatedColumn",null),lastColumn:i.getArg(A,"lastGeneratedColumn",null)}),A=this._originalMappings[++S]}return b},sourceMapConsumer.SourceMapConsumer=o;function a(u,m){var d=u;typeof u=="string"&&(d=i.parseSourceMapInput(u));var y=i.getArg(d,"version"),b=i.getArg(d,"sources"),S=i.getArg(d,"names",[]),A=i.getArg(d,"sourceRoot",null),P=i.getArg(d,"sourcesContent",null),x=i.getArg(d,"mappings"),E=i.getArg(d,"file",null);if(y!=this._version)throw new Error("Unsupported version: "+y);A&&(A=i.normalize(A)),b=b.map(String).map(i.normalize).map(function(_){return A&&i.isAbsolute(A)&&i.isAbsolute(_)?i.relative(A,_):_}),this._names=t.fromArray(S.map(String),!0),this._sources=t.fromArray(b,!0),this._absoluteSources=this._sources.toArray().map(function(_){return i.computeSourceURL(A,_,m)}),this.sourceRoot=A,this.sourcesContent=P,this._mappings=x,this._sourceMapURL=m,this.file=E}a.prototype=Object.create(o.prototype),a.prototype.consumer=o,a.prototype._findSourceIndex=function(u){var m=u;if(this.sourceRoot!=null&&(m=i.relative(this.sourceRoot,m)),this._sources.has(m))return this._sources.indexOf(m);var d;for(d=0;d1&&(M.source=P+H[1],P+=H[1],M.originalLine=S+H[2],S=M.originalLine,M.originalLine+=1,M.originalColumn=A+H[3],A=M.originalColumn,H.length>4&&(M.name=x+H[4],x+=H[4])),I.push(M),typeof M.originalLine=="number"&&R.push(M)}s(I,i.compareByGeneratedPositionsDeflated),this.__generatedMappings=I,s(R,i.compareByOriginalPositions),this.__originalMappings=R},a.prototype._findMapping=function(m,d,y,b,S,A){if(m[y]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+m[y]);if(m[b]<0)throw new TypeError("Column must be greater than or equal to 0, got "+m[b]);return e.search(m,d,S,A)},a.prototype.computeColumnSpans=function(){for(var m=0;m=0){var b=this._generatedMappings[y];if(b.generatedLine===d.generatedLine){var S=i.getArg(b,"source",null);S!==null&&(S=this._sources.at(S),S=i.computeSourceURL(this.sourceRoot,S,this._sourceMapURL));var A=i.getArg(b,"name",null);return A!==null&&(A=this._names.at(A)),{source:S,line:i.getArg(b,"originalLine",null),column:i.getArg(b,"originalColumn",null),name:A}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(m){return m==null}):!1},a.prototype.sourceContentFor=function(m,d){if(!this.sourcesContent)return null;var y=this._findSourceIndex(m);if(y>=0)return this.sourcesContent[y];var b=m;this.sourceRoot!=null&&(b=i.relative(this.sourceRoot,b));var S;if(this.sourceRoot!=null&&(S=i.urlParse(this.sourceRoot))){var A=b.replace(/^file:\/\//,"");if(S.scheme=="file"&&this._sources.has(A))return this.sourcesContent[this._sources.indexOf(A)];if((!S.path||S.path=="/")&&this._sources.has("/"+b))return this.sourcesContent[this._sources.indexOf("/"+b)]}if(d)return null;throw new Error('"'+b+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(m){var d=i.getArg(m,"source");if(d=this._findSourceIndex(d),d<0)return{line:null,column:null,lastColumn:null};var y={source:d,originalLine:i.getArg(m,"line"),originalColumn:i.getArg(m,"column")},b=this._findMapping(y,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,i.getArg(m,"bias",o.GREATEST_LOWER_BOUND));if(b>=0){var S=this._originalMappings[b];if(S.source===y.source)return{line:i.getArg(S,"generatedLine",null),column:i.getArg(S,"generatedColumn",null),lastColumn:i.getArg(S,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},sourceMapConsumer.BasicSourceMapConsumer=a;function c(u,m){var d=u;typeof u=="string"&&(d=i.parseSourceMapInput(u));var y=i.getArg(d,"version"),b=i.getArg(d,"sections");if(y!=this._version)throw new Error("Unsupported version: "+y);this._sources=new t,this._names=new t;var S={line:-1,column:0};this._sections=b.map(function(A){if(A.url)throw new Error("Support for url field in sections not implemented.");var P=i.getArg(A,"offset"),x=i.getArg(P,"line"),E=i.getArg(P,"column");if(x=0;c--)this.prepend(l[c]);else if(l[s]||typeof l=="string")this.children.unshift(l);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+l);return this},o.prototype.walk=function(l){for(var c,u=0,m=this.children.length;u0){for(c=[],u=0;u0&&(A+=", "+P.join(", "));var x=0;Object.keys(this.aliases).forEach(function(T){var C=S.aliases[T];C.children&&C.referenceCount>1&&(A+=", alias"+ ++x+"="+T,C.children[0]="alias"+x)}),this.lookupPropertyFunctionIsUsed&&(A+=", "+this.lookupPropertyFunctionVarDeclaration());var E=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&E.push("blockParams"),this.useDepths&&E.push("depths");var _=this.mergeSource(A);return b?(E.push(_),Function.apply(this,E)):this.source.wrap(["function(",E.join(","),") {\n ",_,"}"])},mergeSource:function(b){var S=this.environment.isSimple,A=!this.forceBuffer,P=void 0,x=void 0,E=void 0,_=void 0;return this.source.each(function(T){T.appendToBuffer?(E?T.prepend(" + "):E=T,_=T):(E&&(x?E.prepend("buffer += "):P=!0,_.add(";"),E=_=void 0),x=!0,S||(A=!1))}),A?E?(E.prepend("return "),_.add(";")):x||this.source.push('return "";'):(b+=", buffer = "+(P?"":this.initializeBuffer()),E?(E.prepend("return buffer + "),_.add(";")):this.source.push("return buffer;")),b&&this.source.prepend("var "+b.substring(2)+(P?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(b){var S=this.aliasable("container.hooks.blockHelperMissing"),A=[this.contextName(0)];this.setupHelperArgs(b,0,A);var P=this.popStack();A.splice(1,0,P),this.push(this.source.functionCall(S,"call",A))},ambiguousBlockValue:function(){var b=this.aliasable("container.hooks.blockHelperMissing"),S=[this.contextName(0)];this.setupHelperArgs("",0,S,!0),this.flushInline();var A=this.topStack();S.splice(1,0,A),this.pushSource(["if (!",this.lastHelper,") { ",A," = ",this.source.functionCall(b,"call",S),"}"])},appendContent:function(b){this.pendingContent?b=this.pendingContent+b:this.pendingLocation=this.source.currentLocation,this.pendingContent=b},append:function(){if(this.isInline())this.replaceStack(function(S){return[" != null ? ",S,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var b=this.popStack();this.pushSource(["if (",b," != null) { ",this.appendToBuffer(b,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(b){this.lastContext=b},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(b,S,A,P){var x=0;!P&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(b[x++])):this.pushContext(),this.resolvePath("context",b,x,S,A)},lookupBlockParam:function(b,S){this.useBlockParams=!0,this.push(["blockParams[",b[0],"][",b[1],"]"]),this.resolvePath("context",S,1)},lookupData:function(b,S,A){b?this.pushStackLiteral("container.data(data, "+b+")"):this.pushStackLiteral("data"),this.resolvePath("data",S,0,!0,A)},resolvePath:function(b,S,A,P,x){var E=this;if(this.options.strict||this.options.assumeObjects){this.push(d(this.options.strict&&x,this,S,A,b));return}for(var _=S.length;A<_;A++)this.replaceStack(function(T){var C=E.nameLookup(T,S[A],b);return P?[" && ",C]:[" != null ? ",C," : ",T]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(b,S){this.pushContext(),this.pushString(S),S!=="SubExpression"&&(typeof b=="string"?this.pushString(b):this.pushStackLiteral(b))},emptyHash:function(b){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(b?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var b=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(b.ids)),this.stringParams&&(this.push(this.objectLiteral(b.contexts)),this.push(this.objectLiteral(b.types))),this.push(this.objectLiteral(b.values))},pushString:function(b){this.pushStackLiteral(this.quotedString(b))},pushLiteral:function(b){this.pushStackLiteral(b)},pushProgram:function(b){b!=null?this.pushStackLiteral(this.programExpression(b)):this.pushStackLiteral(null)},registerDecorator:function(b,S){var A=this.nameLookup("decorators",S,"decorator"),P=this.setupHelperArgs(S,b);this.decorators.push(["fn = ",this.decorators.functionCall(A,"",["fn","props","container",P])," || fn;"])},invokeHelper:function(b,S,A){var P=this.popStack(),x=this.setupHelper(b,S),E=[];A&&E.push(x.name),E.push(P),this.options.strict||E.push(this.aliasable("container.hooks.helperMissing"));var _=["(",this.itemsSeparatedBy(E,"||"),")"],T=this.source.functionCall(_,"call",x.callParams);this.push(T)},itemsSeparatedBy:function(b,S){var A=[];A.push(b[0]);for(var P=1;Pthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var b=this.inlineStack;this.inlineStack=[];for(var S=0,A=b.length;Si!==null&&i.isSecureContext,createNativeAudioBufferConstructor=i=>i===null?null:i.hasOwnProperty("AudioBuffer")?i.AudioBuffer:null,createNativeAudioContextConstructor=i=>i===null?null:i.hasOwnProperty("AudioContext")?i.AudioContext:i.hasOwnProperty("webkitAudioContext")?i.webkitAudioContext:null,createNativeAudioWorkletNodeConstructor=i=>i===null?null:i.hasOwnProperty("AudioWorkletNode")?i.AudioWorkletNode:null,createNativeOfflineAudioContextConstructor=i=>i===null?null:i.hasOwnProperty("OfflineAudioContext")?i.OfflineAudioContext:i.hasOwnProperty("webkitOfflineAudioContext")?i.webkitOfflineAudioContext:null,createWindow=()=>typeof window>"u"?null:window,window$1=createWindow();createNativeOfflineAudioContextConstructor(window$1);createNativeAudioContextConstructor(window$1);createNativeAudioWorkletNodeConstructor(window$1);createNativeAudioBufferConstructor(window$1);createIsSecureContext(window$1);var lib$2={exports:{}},lib$1={exports:{}};function b64ToUint6(i){return i>64&&i<91?i-65:i>96&&i<123?i-71:i>47&&i<58?i+4:i===43?62:i===47?63:0}function decode(i,e){for(var t=i.replace(/[^A-Za-z0-9\+\/]/g,""),r=t.length,s=e?Math.ceil((r*3+1>>2)/e)*e:r*3+1>>2,o=new Uint8Array(s),a,l,c=0,u=0,m=0;m>>(16>>>a&24)&255;c=0}return o}var base64={decode},fetch$1=function(i,e){return new Promise(function(t,r){var s=new XMLHttpRequest;e&&(s.responseType=e),s.open("GET",i),s.onload=function(){s.status===200?t(s.response):r(Error(s.statusText))},s.onerror=function(){r(Error("Network Error"))},s.send()})};(function(i){var e=base64,t=fetch$1;function r(I){return function(M){return typeof M=="string"&&I.test(M)}}function s(I,M){return typeof I=="string"?I+M:typeof I=="function"?I(M):M}function o(I,M,D,H){var W=a(M)?l:c(M)?u:m(M)?d:y(M)?b:S(M)?A:P(M)?x:E(M)?_:T(M)?C:null,O=D||{};return W?W(I,M,O):H?Promise.resolve(H):Promise.reject("Source not valid ("+M+")")}o.fetch=t;function a(I){return I instanceof ArrayBuffer}function l(I,M,D){return new Promise(function(H,W){I.decodeAudioData(M,function(O){H(O)},function(){W("Can't decode audio data ("+M.slice(0,30)+"...)")})})}var c=r(/\.(mp3|wav|ogg)(\?.*)?$/i);function u(I,M,D){var H=s(D.from,M);return o(I,o.fetch(H,"arraybuffer"),D)}function m(I){return I&&typeof I.then=="function"}function d(I,M,D){return M.then(function(H){return o(I,H,D)})}var y=Array.isArray;function b(I,M,D){return Promise.all(M.map(function(H){return o(I,H,D,H)}))}function S(I){return I&&typeof I=="object"}function A(I,M,D){var H={},W=Object.keys(M).map(function(O){if(D.only&&D.only.indexOf(O)===-1)return null;var z=M[O];return o(I,z,D,z).then(function(k){H[O]=k})});return Promise.all(W).then(function(){return H})}var P=r(/\.json(\?.*)?$/i);function x(I,M,D){var H=s(D.from,M);return o(I,o.fetch(H,"text").then(JSON.parse),D)}var E=r(/^data:audio/);function _(I,M,D){var H=M.indexOf(",");return o(I,e.decode(M.slice(H+1)).buffer,D)}var T=r(/\.js(\?.*)?$/i);function C(I,M,D){var H=s(D.from,M);return o(I,o.fetch(H,"text").then(R),D)}function R(I){var M=I.indexOf("MIDI.Soundfont.");if(M<0)throw Error("Invalid MIDI.js Soundfont format");M=I.indexOf("=",M)+2;var D=I.lastIndexOf(",");return JSON.parse(I.slice(M,D)+"}")}i.exports&&(i.exports=o),typeof window<"u"&&(window.loadAudio=o)})(lib$1);var libExports$1=lib$1.exports,lib={exports:{}},adsr=ADSR$1;function ADSR$1(i){var e=i.createGain(),t=e._voltage=getVoltage(i),r=scale(t),s=scale(t),o=scale(t);return e._startAmount=scale(s),e._endAmount=scale(o),e._multiplier=scale(r),e._multiplier.connect(e),e._startAmount.connect(e),e._endAmount.connect(e),e.value=r.gain,e.startValue=s.gain,e.endValue=o.gain,e.startValue.value=0,e.endValue.value=0,Object.defineProperties(e,props),e}var props={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(i){var e=this._multiplier.gain,t=this._startAmount.gain,r=this._endAmount.gain;this._voltage.start(i),this._decayFrom=this._decayFrom=i+this.attack,this._startedAt=i;var s=this.sustain;e.cancelScheduledValues(i),t.cancelScheduledValues(i),r.cancelScheduledValues(i),r.setValueAtTime(0,i),this.attack?(e.setValueAtTime(0,i),e.linearRampToValueAtTime(1,i+this.attack),t.setValueAtTime(1,i),t.linearRampToValueAtTime(0,i+this.attack)):(e.setValueAtTime(1,i),t.setValueAtTime(0,i)),this.decay&&e.setTargetAtTime(s,this._decayFrom,getTimeConstant(this.decay))}},stop:{value:function(i,e){e&&(i=i-this.release);var t=i+this.release;if(this.release){var r=this._multiplier.gain,s=this._startAmount.gain,o=this._endAmount.gain;r.cancelScheduledValues(i),s.cancelScheduledValues(i),o.cancelScheduledValues(i);var a=getTimeConstant(this.release);if(this.attack&&i=e&&(u=e),u}var ADSR=adsr,EMPTY={},DEFAULTS={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function SamplePlayer(i,e,t){var r=!1,s=0,o={},a=i.createGain();a.gain.value=1;var l=Object.assign({},DEFAULTS,t),c={context:i,out:a,opts:l};return e instanceof AudioBuffer?c.buffer=e:c.buffers=e,c.start=function(d,y,b){if(c.buffer&&d!==null)return c.start(null,d,y);var S=d?c.buffers[d]:c.buffer;if(S){if(!r){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+d+" not found.");return}var A=b||EMPTY;y=Math.max(i.currentTime,y||0),c.emit("start",y,d,A);var P=m(d,S,A);return P.id=u(d,P),P.env.start(y),P.source.start(y),c.emit("started",y,P.id,P),A.duration&&P.stop(y+A.duration),P},c.play=function(d,y,b){return c.start(d,y,b)},c.stop=function(d,y){var b;return y=y||Object.keys(o),y.map(function(S){return b=o[S],b?(b.stop(d),b.id):null})},c.connect=function(d){return r=!0,a.connect(d),c},c.emit=function(d,y,b,S){c.onevent&&c.onevent(d,y,b,S);var A=c["on"+d];A&&A(y,b,S)},c;function u(d,y){return y.id=s++,o[y.id]=y,y.source.onended=function(){var b=i.currentTime;y.source.disconnect(),y.env.disconnect(),y.disconnect(),c.emit("ended",b,y.id,y)},y.id}function m(d,y,b){var S=i.createGain();return S.gain.value=0,S.connect(a),S.env=envelope(i,b,l),S.env.connect(S.gain),S.source=i.createBufferSource(),S.source.buffer=y,S.source.connect(S),S.source.loop=b.loop||l.loop,S.source.playbackRate.value=centsToRate(b.cents||l.cents),S.source.loopStart=b.loopStart||l.loopStart,S.source.loopEnd=b.loopEnd||l.loopEnd,S.stop=function(A){var P=A||i.currentTime;c.emit("stop",P,d);var x=S.env.stop(P);S.source.stop(x)},S}}function isNum$1(i){return typeof i=="number"}var PARAMS=["attack","decay","sustain","release"];function envelope(i,e,t){var r=ADSR(i),s=e.adsr||t.adsr;return PARAMS.forEach(function(o,a){s?r[o]=s[a]:r[o]=e[o]||t[o]}),r.value.value=isNum$1(e.gain)?e.gain:isNum$1(t.gain)?t.gain:1,r}function centsToRate(i){return i?Math.pow(2,i/1200):1}var player=SamplePlayer,events=function(i){return i.on=function(e,t){if(arguments.length===1&&typeof e=="function")return i.on("event",e);var r="on"+e,s=i[r];return i[r]=s?chain(s,t):t,i},i};function chain(i,e){return function(t,r,s,o){i(t,r,s,o),e(t,r,s,o)}}var REGEX$1=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function regex$1(){return REGEX$1}var SEMITONES$1=[0,2,4,5,7,9,11];function parse$1(i,e,t){if(typeof i!="string")return null;var r=REGEX$1.exec(i);if(!r||!e&&r[4])return null;var s={letter:r[1].toUpperCase(),acc:r[2].replace(/x/g,"##")};return s.pc=s.letter+s.acc,s.step=(s.letter.charCodeAt(0)+3)%7,s.alt=s.acc[0]==="b"?-s.acc.length:s.acc.length,s.chroma=SEMITONES$1[s.step]+s.alt,r[3]&&(s.oct=+r[3],s.midi=s.chroma+12*(s.oct+1),s.freq=midiToFreq$1(s.midi,t)),e&&(s.tonicOf=r[4]),s}function midiToFreq$1(i,e){return Math.pow(2,(i-69)/12)*(e||440)}var parser={parse:parse$1,regex:regex$1,midiToFreq:midiToFreq$1},FNS=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];FNS.forEach(function(i){parser[i]=function(e){var t=parse$1(e);return t&&typeof t[i]<"u"?t[i]:null}});var noteParser$1=parser,note$1=noteParser$1,isMidi=function(i){return i!==null&&i!==[]&&i>=0&&i<129},toMidi=function(i){return isMidi(i)?+i:note$1.midi(i)},notes=function(i){if(i.buffers){var e=i.opts.map,t=typeof e=="function"?e:toMidi,r=function(o){return o?t(o)||o:null};i.buffers=mapBuffers(i.buffers,r);var s=i.start;i.start=function(o,a,l){var c=r(o),u=c%1;return u&&(c=Math.floor(c),l=Object.assign(l||{},{cents:Math.floor(u*100)})),s(c,a,l)}}return i};function mapBuffers(i,e){return Object.keys(i).reduce(function(t,r){return t[e(r)]=i[r],t},{})}var isArr=Array.isArray,isObj=function(i){return i&&typeof i=="object"},OPTS={},scheduler=function(i){return i.schedule=function(e,t){var r=i.context.currentTime,s=e"u"?null:i.step?build(i.step,i.alt,i.oct):i<0||i>6?null:LETTERS.charAt(i)+accStr(e)+octStr(t)}function midi(i){if((isNum(i)||isStr(i))&&i>=0&&i<128)return+i;var e=parse(i);return e&&isDef(e.midi)?e.midi:null}function freq(i,e){var t=midi(i);return t===null?null:midiToFreq(t,e)}function letter(i){return(parse(i)||{}).letter}function acc(i){return(parse(i)||{}).acc}function pc(i){return(parse(i)||{}).pc}function step(i){return(parse(i)||{}).step}function alt(i){return(parse(i)||{}).alt}function chroma(i){return(parse(i)||{}).chroma}function oct(i){return(parse(i)||{}).oct}const noteParser=Object.freeze(Object.defineProperty({__proto__:null,acc,alt,build,chroma,freq,letter,midi,oct,parse,pc,regex,step},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(noteParser);var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var i=require$$0;function e(s,o){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof e))return new e(s);this.nameToUrl=o||e.nameToUrl,this.ctx=s,this.instruments={},this.promises=[]}e.prototype.onready=function(s){console.warn("deprecated API"),console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"),Promise.all(this.promises).then(s)},e.prototype.instrument=function(s,o){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var a=this.ctx;if(s=s||"default",s in this.instruments)return this.instruments[s];var l={name:s,play:r(a,o)};if(this.instruments[s]=l,s!=="default"){var c=e.instrument(a,s,o).then(function(u){return l.play=u.play,l});this.promises.push(c),l.onready=function(u){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),c.then(u)}}else l.onready=function(u){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),u()};return l};function t(s,o,a){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),e.instrument(s,o,a).then(function(l){return l.buffers})}e.loadBuffers=t;function r(s,o){return o=o||{},function(a,l,c,u){console.warn("The oscillator player is deprecated."),console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");var m=a>0&&a<129?+a:i.midi(a),d=m?i.midiToFreq(m,440):null;if(d){c=c||.2,u=u||{};var y=u.destination||o.destination||s.destination,b=u.vcoType||o.vcoType||"sine",S=u.gain||o.gain||.4,A=s.createOscillator();A.type=b,A.frequency.value=d;var P=s.createGain();return P.gain.value=S,A.connect(P),P.connect(y),A.start(l),c>0&&A.stop(l+c),A}}}return e.noteToMidi=i.midi,legacy=e,legacy}(function(i){var e=libExports$1,t=libExports;function r(l,c,u){if(arguments.length===1)return function(S,A){return r(l,S,A)};var m=u||{},d=m.isSoundfontURL||s,y=m.nameToUrl||o,b=d(c)?c:y(c,m.soundfont,m.format);return e(l,b,{only:m.only||m.notes}).then(function(S){var A=t(l,S,m).connect(m.destination?m.destination:l.destination);return A.url=b,A.name=c,A})}function s(l){return/\.js(\?.*)?$/i.test(l)}function o(l,c,u){return u=u==="ogg"?u:"mp3",c=c==="FluidR3_GM"?c:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+c+"/"+l+"-"+u+".js"}var a=requireLegacy();a.instrument=r,a.nameToUrl=o,i.exports&&(i.exports=a),typeof window<"u"&&(window.Soundfont=a)})(lib$2);NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B;const speedInfo={"rall.":1.333333333,"poco rit.":1.333333333,"rit.":1.333333333,"molto rit.":1.333333333,"molto rall":1.333333333,molto:1.333333333,lentando:1.333333333,allargando:1.333333333,morendo:1.333333333,"accel.":.8,calando:2,"poco accel.":.8,"gradually slowing":1.333333333,slowing:1.333333333,slow:1.333333333,slowly:1.333333333,faster:1.333333333},getNextNote=(i,e)=>{var l;let t=0;const r=i.closest(e);let s=r;const o=r==null?void 0:r.closest("measure");let a=null;for(;!a&&t<((o==null?void 0:o.childNodes.length)||50);)t++,((l=s==null?void 0:s.nextElementSibling)==null?void 0:l.tagName)==="note"&&(a=s==null?void 0:s.nextElementSibling),s=s==null?void 0:s.nextElementSibling;return a},getGradualLengthByXml=i=>{var u,m,d,y;const e=new DOMParser().parseFromString(i,"text/xml"),t=Array.from(e.querySelectorAll("measure")),r=Array.from(e.querySelectorAll("note")),s=Array.from(e.querySelectorAll("words")),o=Array.from(e.querySelectorAll("metronome")),a=[];for(const b of[...s,...o]){const S=getNextNote(b,"direction");if(S){const A=S==null?void 0:S.closest("measure"),P=Array.from(A.querySelectorAll("note")),x=Array.from(A.childNodes).filter(T=>T.nodeName==="note").findIndex(T=>T===S);let E=0,_=0;for(let T=0;Tb.index-S.index);const c=Object.keys(speedInfo).map(b=>b.toLocaleLowerCase());for(const b of a){let S=!1,A=0;const P=(m=b.textContent)==null?void 0:m.toLocaleLowerCase().trim();b===a[a.length-1]&&((d=l[l.length-1])==null?void 0:d.length)===1&&(S=!0);const x=c.find(E=>{const _=E.split(" ");return P&&_.includes(P)});if(b.type==="metronome"||b.type==="words"&&(P.startsWith("a tempo")||x)||S){const E=l.findIndex(_=>_.length===1);E>-1&&b.index>((y=l[E])==null?void 0:y[0].start)&&(A=-1,l[E][1]={start:b.index,measureIndex:b.measureIndex,closedMeasureIndex:b.measureIndex,noteInMeasureIndex:b.noteInMeasureIndex,allDuration:b.allDuration,leftDuration:b.leftDuration,type:P})}b.type==="words"&&x&&l.push([{start:b.index,measureIndex:b.measureIndex,closedMeasureIndex:b.measureIndex+A,noteInMeasureIndex:b.noteInMeasureIndex,allDuration:b.allDuration,leftDuration:b.leftDuration,type:P}])}return l},browserInfo=browser();dayjs.extend(duration);const getFixTime=i=>{const e=getDuration(state$1.osmd);let t=e.numerator||0,r=e.denominator||4;const s=e.beatUnit||"quarter";return state$1.repeatedBeats&&(t=t*2),state$1.isOpenMetronome?60/i*formatBeatUnit(s)*(t/r):0},retain=i=>Math.ceil(i*1e6)/1e6,formatLyricsEntries=i=>{var r,s;const e=((r=i.parentStaffEntry)==null?void 0:r.voiceEntries)||[],t=[];for(const o of e)if((s=o.lyricsEntries)!=null&&s.table){const a=Object.values(o.lyricsEntries.table);for(const l of a)t.push(l==null?void 0:l.value.text)}return t},createSpeedInfo=(i,e)=>{var t,r;if(i&&speedInfo[(t=i.startWord)==null?void 0:t.toLocaleLowerCase()]){const s=Math.max(i.endXmlNoteIndex,3),o=[],a=e,l=e/speedInfo[(r=i.startWord)==null?void 0:r.toLocaleLowerCase()];for(let c=0;c{let e=i;const t=i.split(":");return t.length===1?e="00:".concat(t[0],":00"):t.length===2&&(e="00:".concat(t[0],":").concat(t[1])),"1970-01-01 00:".concat(e,"0")},getDuration=i=>{var t;if(i){const{Duration:r,TempoInBPM:s,ActiveTimeSignature:o,TempoExpressions:a}=(t=i.GraphicSheet.MeasureList[0][0])==null?void 0:t.parentSourceMeasure;if(r){let l="quarter";for(const u of a)l=u.InstantaneousTempo.beatUnit||"quarter";return{...formatDuration(o),TempoInBPM:s,beatUnit:l}}}return{...new Fraction$1,TempoInBPM:90,beatUnit:"quarter"}};function formatDuration(i,e){return i}function formatBeatUnit(i){let e=4;switch(i){case"1024th":e=1024;break;case"512th":e=512;break;case"256th":e=256;break;case"128th":e=128;break;case"64th":e=64;break;case"32nd":e=32;break;case"16th":e=16;break;case"eighth":e=8;break;case"quarter":e=4;break;case"half":e=2;break;case"whole":e=1;break;case"breve":e=.5;break;case"long":e=.25;break;case"maxima":e=.125;break}return e}function getTimeByBeatUnit(i,e,t){return t/formatBeatUnit(i)*e}const setElementNoteBefore=(i,e,t)=>{let r=0;if(e){for(let s=0;s0){let s=0;const o=Array.from(t.childNodes).filter(l=>l.nodeName==="note"),a=o[o.length-1];if(r>=o.length&&a){t.insertBefore(i,t.childNodes[Array.from(t.childNodes).indexOf(a)]);return}for(let l=0;l{if(i){const e=i.toLocaleLowerCase(),t="d\\s?\\.s\\.",r="d\\.\\s?c\\.";return e==="@"||StringUtil.StringContainsSeparatedWord(e,t+" al fine",!0)||StringUtil.StringContainsSeparatedWord(e,t+" al coda",!0)||StringUtil.StringContainsSeparatedWord(e,r+" al fine",!0)||StringUtil.StringContainsSeparatedWord(e,r+" al coda",!0)||StringUtil.StringContainsSeparatedWord(e,r)||StringUtil.StringContainsSeparatedWord(e,"da\\s?capo",!0)||StringUtil.StringContainsSeparatedWord(e,t,!0)||StringUtil.StringContainsSeparatedWord(e,"dal\\s?segno",!0)||StringUtil.StringContainsSeparatedWord(e,"al\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(e,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(e,"a (la )?coda",!0)||StringUtil.StringContainsSeparatedWord(e,"fine",!0)||StringUtil.StringContainsSeparatedWord(e,"coda",!0)||StringUtil.StringContainsSeparatedWord(e,"segno",!0)}return!1},onlyVisible=(i,e)=>{var b,S,A,P,x,E,_,T,C;if(!i)return"";const t=state$1.examSongId+"",r=new DOMParser().parseFromString(i,"text/xml"),s=((S=(b=r.getElementsByTagName("part-list"))==null?void 0:b[0])==null?void 0:S.getElementsByTagName("score-part"))||[],o=Array.from(s).map(R=>{var I,M,D;return((D=(M=(I=R.getElementsByTagName("part-name"))==null?void 0:I[0])==null?void 0:M.textContent)==null?void 0:D.trim())||""}),a=r.getElementsByTagName("part"),l=[...(A=a[0])==null?void 0:A.getElementsByTagName("measure")],c=[...(P=a[0])==null?void 0:P.getElementsByTagName("metronome")],u=[...(x=a[0])==null?void 0:x.getElementsByTagName("words")],m=[...(E=a[0])==null?void 0:E.getElementsByTagName("coda")],d=[...(_=a[0])==null?void 0:_.getElementsByTagName("rehearsal")];((C=(T=o[0])==null?void 0:T.toLocaleUpperCase)==null?void 0:C.call(T))==="COMMON"&&(e++,o.shift());const y=s[e];if(state$1.partListNames=o,y){const R=y.getAttribute("id");Array.from(a).forEach(I=>{var M,D,H,W,O;if(I&&I.getAttribute("id")!==R)(M=I.parentNode)==null||M.removeChild(I);else if(I&&I.getAttribute("id")!=="P1"){const z={};for(let k=0;k{var V;const $=(V=k.parentElement)==null?void 0:V.parentElement,F=$==null?void 0:$.parentElement,G=[...(F==null?void 0:F.childNodes)||[]],N=$?G.indexOf($):-1;if(F&&N>-1){const K=l.indexOf(F),U=I.getElementsByTagName("measure")[K];setElementNoteBefore($,F,U)}}),u.forEach(k=>{var F;let $=k.textContent||"";if($=["cresc."].includes($)?"":$,(isSpecialMark($)||isSpeedKeyword($)||isGradientWords($)||isRepeatWord($)||GRADIENT_SPEED_RESET_TAG)&&$){const G=(F=k.parentElement)==null?void 0:F.parentElement,N=G==null?void 0:G.parentElement,V=[...(N==null?void 0:N.childNodes)||[]],K=G?V.indexOf(G):-1;if(G&&N&&K>-1){const U=l.indexOf(N),J=I.getElementsByTagName("measure")[U];Array.from((J==null?void 0:J.getElementsByTagName("words"))||[]).reduce((le,Se)=>{var oe;return(oe=Se.textContent)!=null&&oe.includes($)&&le++,le},0)===0&&(["12280"].includes(t)?J==null||J.insertBefore(G.cloneNode(!0),J==null?void 0:J.childNodes[K]):setElementNoteBefore(G,N,J))}}}),m.forEach(k=>{var V;const $=(V=k.parentElement)==null?void 0:V.parentElement,F=$==null?void 0:$.parentElement,G=[...(F==null?void 0:F.childNodes)||[]],N=$?G.indexOf($):-1;if($&&F&&N>-1){const K=l.indexOf(F),U=I.getElementsByTagName("measure")[K];["12280"].includes(t)?U==null||U.insertBefore($.cloneNode(!0),U==null?void 0:U.childNodes[N]):setElementNoteBefore($,F,U)}}),d.forEach(k=>{var G,N;const $=(G=k.parentElement)==null?void 0:G.parentElement,F=$==null?void 0:$.parentElement;if(F){const V=l.indexOf(F);(N=I.getElementsByTagName("measure")[V])==null||N.appendChild($.cloneNode(!0))}})}else u.forEach((z,k)=>{var F,G,N;const $=z.textContent||"";if(isSpeedKeyword($)&&$){const V=(G=(F=z.parentElement)==null?void 0:F.parentElement)==null?void 0:G.parentElement;if(V&&V.firstElementChild&&V.firstElementChild!==z){const K=(N=z.parentElement)==null?void 0:N.parentElement,U=V.firstElementChild;V.insertBefore(K,U)}}});if(I&&I.getAttribute("id")===R){const z=I.getElementsByTagName("barline"),k=(W=z[z.length-1])==null?void 0:W.parentElement;if(((O=k==null?void 0:k.lastElementChild)==null?void 0:O.tagName)!=="barline"){const $=(k==null?void 0:k.children)||[];for(let F of $)if(F.tagName==="barline"){k==null||k.appendChild(F);break}}}}),Array.from(s).forEach(I=>{var M;I&&I.getAttribute("id")!==R&&((M=I.parentNode)==null||M.removeChild(I))})}return new XMLSerializer().serializeToString(appoggianceFormate(r))},appoggianceFormate=i=>{var r,s,o,a;if(!i)return i;const e=i.querySelectorAll("grace");if(!e.length)return i;const t=l=>l.querySelector("grace")?t(l==null?void 0:l.nextElementSibling):l;for(let l of e){const c=(r=l.parentElement)==null?void 0:r.querySelector("notations");if(c&&c.querySelectorAll("slur").length>1){let u=t((s=l.parentElement)==null?void 0:s.nextElementSibling);if(u&&u.querySelectorAll("slur").length>0){const m=Array.from(((o=u.querySelector("notations"))==null?void 0:o.children)||[]).map(y=>y.getAttribute("number")),d=c.querySelectorAll("slur");for(let y of d)m.includes(y.getAttribute("number"))||(a=u.querySelector("notations"))==null||a.appendChild(y)}}}return i},formatXML=i=>{var l,c,u;if(!i)return"";const e=new DOMParser().parseFromString(i,"text/xml"),t=Array.from(e.getElementsByTagName("measure")),r=Array.from(e.querySelectorAll("repeat"));compatibleXmlPitchVoice(e),parseXmlToRepeat(r);let s=-1,o=-1,a=-1;for(const m of t){o===-1&&m.getElementsByTagName("beats").length&&(o=parseInt(m.getElementsByTagName("beats")[0].textContent||"4")),a===-1&&m.getElementsByTagName("beat-type").length&&(a=parseInt(m.getElementsByTagName("beat-type")[0].textContent||"4")),s===-1&&m.getElementsByTagName("per-minute").length&&(s=Number((l=m.getElementsByTagName("per-minute")[0])==null?void 0:l.textContent));const d=parseInt(((c=m.getElementsByTagName("divisions")[0])==null?void 0:c.textContent)||"256");if(m.getElementsByTagName("note").length===0){const y=(u=m.getElementsByTagName("forward")[0])==null?void 0:u.getElementsByTagName("duration")[0];y&&(y.textContent="0"),m.innerHTML=m.innerHTML+'\n \n \n '.concat(d*o,"\n 1\n whole\n ")}}return state$1.originSpeed||(state$1.originSpeed=state$1.speed=s||100),new XMLSerializer().serializeToString(e)},formateTimes=i=>{var k,$,F,G,N,V,K,U,J,me,he,le,Se,oe,ue,fe,be,Ee,ee,te,B,re,Z,Y,q,ie,ne,se,ce,de,ve,ye;const e=customData.customNoteRealValue,t=customData.customNoteCurrentTime;state$1.examSongId+"",state$1.partIndex+"";let r=browserInfo.huawei?.08:0;const s=[],o=[],a=[],{originSpeed:l}=state$1,c=(ge,Pe)=>{var Ie,Re,Me,De,ke,Fe;return["906"].includes(state$1.cbsExamSongId)?((Ie=Pe.measures[0])==null?void 0:Ie.realKey)||ge:["782","784"].includes(state$1.cbsExamSongId)&&[14,16,30,32].includes((Re=Pe.firstVerticalMeasure)==null?void 0:Re.measureNumber)?((Me=s[s.length-1])==null?void 0:Me.realKey)||ge:["900","901","640","641","739","740","800","801","773","774","869","872","714","715"].includes(state$1.cbsExamSongId)&&(((De=Pe.firstVerticalMeasure)==null?void 0:De.measureNumber)===3||((ke=Pe.firstVerticalMeasure)==null?void 0:ke.measureNumber)===9)&&((Fe=Pe.measures[0])==null?void 0:Fe.realKey)||ge};if(!i.cursor)return[];const u=i.cursor.Iterator;console.time("音符跑完时间");let m=0,d=0,y=[],b=[],S=0,A=0,P=0,x="quarter",E,_,T=0,C=0,R=0;const I=[];state$1.gradualTimes&&console.log("后台设置的渐慢小节时间",state$1.gradual,state$1.gradualTimes);let M=u.currentTimeStamp.RealValue;const D=[];let H=!1,W=0;for(;!u.EndReached;){const ge=(k=u.CurrentVoiceEntries)!=null&&k[0]?[($=u.CurrentVoiceEntries)==null?void 0:$[0]]:[];let Pe=[];state$1.multitrack>0?Pe=[...u.CurrentVoiceEntries]:Pe=[...u.CurrentVoiceEntries].filter(Ie=>{var Re;return Ie&&((Re=Ie==null?void 0:Ie.ParentVoice)==null?void 0:Re.VoiceId)!=1});let pe=0,Te=!1,Le=!1;if(Pe.length&&!H){Te=!0;let Ie=[...u.CurrentVoiceEntries].reduce((Re,Me)=>(Re.push(...Me.Notes),Re),[]);if(Ie=Ie.sort((Re,Me)=>{var De,ke;return((De=Re==null?void 0:Re.length)==null?void 0:De.realValue)-((ke=Me==null?void 0:Me.length)==null?void 0:ke.realValue)}),pe=((G=(F=Ie==null?void 0:Ie[0])==null?void 0:F.length)==null?void 0:G.realValue)||0,state$1.multitrack>0&&Pe.length===2){const Re=((V=(N=Ie[0])==null?void 0:N.length)==null?void 0:V.realValue)||0;W=(((U=(K=Ie[Ie.length-1])==null?void 0:K.length)==null?void 0:U.realValue)||0)-Re,H=W!==0}}(J=I[I.length-1])!=null&&J.isDouble&&!Pe.length&&(Le=!0),state$1.multitrack>0&&!Te&&H&&(Te=!0,pe=W,H=!1,W=0),D.push(u.currentTimeStamp.realValue-M),M=u.currentTimeStamp.realValue;for(const Ie of ge){let Re=Ie.notes[0];if(Re.IsGraceNote&&(Re=Re.parentStaffEntry.voiceEntries.find(De=>!De.isGrace).notes[0]),Re.fixedKey=Re.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey||0,(me=Re==null?void 0:Re.voiceEntry)!=null&&me.isGrace){Te=!0;let Me=[...u.currentVoiceEntries].reduce((De,ke)=>(De.push(...ke.notes),De),[]);Me=Me.sort((De,ke)=>{var Fe,qe;return((Fe=ke==null?void 0:ke.length)==null?void 0:Fe.realValue)-((qe=De==null?void 0:De.length)==null?void 0:qe.realValue)}),pe=pe!=0?Math.min((le=(he=Me==null?void 0:Me[0])==null?void 0:he.length)==null?void 0:le.realValue,pe):(oe=(Se=Me==null?void 0:Me[0])==null?void 0:Se.length)==null?void 0:oe.realValue}state$1.multitrack>0&&pe>Re.length.realValue&&(pe=Re.length.realValue),I.push({note:Re,iterator:{...u},currentTime:pe,isDouble:Te,isMutileSubject:Le,measuresTempoInBPM:(ue=Re==null?void 0:Re.sourceMeasure)==null?void 0:ue.tempoInBPM})}u.moveToNextVisibleVoiceEntry(!1)}const O=I.some(ge=>ge.measuresTempoInBPM!==I[0].measuresTempoInBPM);console.log("变速曲子",O);for(let{note:ge,iterator:Pe,currentTime:pe,isDouble:Te,isMutileSubject:Le}of I){if(ge){if(d===0&&a.push(ge.sourceMeasure),d===0&&state$1.isSpecialBookCategory)for(const Ye of(fe=ge.sourceMeasure)==null?void 0:fe.TempoExpressions)(be=Ye==null?void 0:Ye.InstantaneousTempo)!=null&&be.beatUnit&&(x=Ye.InstantaneousTempo.beatUnit);let Ie=ge.sourceMeasure.tempoInBPM;const{metronomeNoteIndex:Re}=Pe.currentMeasure;Re!==0&&Re>d&&(Ie=((Ee=s[s.length-1])==null?void 0:Ee.speed)||100);const Me=[(ee=ge.sourceMeasure.verticalMeasureList)==null?void 0:ee[0]],{realValue:De}=Pe.currentTimeStamp,{RealValue:ke,Denominator:Fe}=formatDuration(Pe.currentMeasure.activeTimeSignature,Pe.currentMeasure.duration);let{wholeValue:qe,numerator:Mt,denominator:kt,realValue:et}=ge.length;e[m]&&(et=e[m]),Te&&pe>0&&pe!=et&&(console.log("小节 ".concat(ge.sourceMeasure.MeasureNumberXML," 替换: noteLength: ").concat(et,", 最小: ").concat(pe)),et=pe),t&&Le&&D[m+1]>0&&et>D[m+1]&&(console.log(et,D[m+1]),et=D[m+1]);let gt=A,Qe=0;Ie!==l&&!O?Qe=l||Ie||100:Qe=(state$1.isSpecialBookCategory?Ie:l)||1,m===0&&(r+=getFixTime(Qe),state$1.fixtime=r);let ut=0,ht=(state$1.isSpecialBookCategory?Ie:l)||1;_=Pe.currentMeasure.speedInfo||_,E=((te=i.Sheet.SoundTempos)==null?void 0:te.get(ge.sourceMeasure.measureListIndex))||E,(!E||E.length<2)&&(E=createSpeedInfo(_,ht));const nt=Pe.currentMeasure.measureListIndex;if(state$1.gradualTimes&&Object.keys(state$1.gradualTimes).length>0){const Ye=state$1.gradual.find((ze,tt)=>{var dt;const st=state$1.gradual[tt+1];return ze[0].measureIndex<=nt&&((dt=ze[1])==null?void 0:dt.measureIndex)>=nt&&(!st||(st==null?void 0:st[0].measureIndex)!==nt)}),[Xe,Ue]=Ye||[];if(Xe&&Ue){const ze=Ue.measureIndex-Xe.measureIndex,tt=Xe.closedMeasureIndex==nt&&d>=Xe.noteInMeasureIndex,st=Ue.closedMeasureIndex===nt&&d0)){const Ye=E[0]-(E[1]-E[0]),{resetXmlNoteIndex:Xe,endXmlNoteIndex:Ue}=_,ze=Ue;let tt=(E[E.length-1]-Ye)/ze;if(tt=ge.DotsXml?tt/1.5:tt,TT&&(ht=(B=s[m-1])==null?void 0:B.speed);Qe=(state$1.isSpecialBookCategory?getTimeByBeatUnit(x,ht,Pe.currentMeasure.activeTimeSignature.Denominator):l)||1;const st=!(TT);T++,st&&(T=0,_=void 0,E=void 0,b=[])}const Vt=et;let It=ut||Math.min(ke,et)*formatBeatUnit(x)*(60/Qe);const Nt=ke*Fe*(60/Qe);A+=It,P+=It;let Pt=It+gt;const zt=ge.fixedKey||0,Dt=(Z=(re=Me[0])==null?void 0:re.vfVoices["1"])==null?void 0:Z.tickables[d];if(s.length&&s[s.length-1].relativeTime===gt)continue;if(m===0&&!state$1.isAppPlay){let Ye=0;(((q=(Y=ge.sourceMeasure.verticalMeasureList)==null?void 0:Y[0])==null?void 0:q.staffEntries)||[]).forEach(Ue=>{var ze,tt,st,dt,pt,yt;(yt=(pt=(dt=(st=(tt=(ze=Ue==null?void 0:Ue.sourceStaffEntry)==null?void 0:ze.voiceEntries)==null?void 0:tt[0])==null?void 0:st.notes)==null?void 0:dt[0])==null?void 0:pt.length)!=null&&yt.realValue&&(Ye+=Ue.sourceStaffEntry.voiceEntries[0].notes[0].length.realValue)}),Ye0&&(r+=S)}let ti=(ie=Me[0])==null?void 0:ie.stave;ge.sourceMeasure.multipleRestMeasures&&(C=ge.sourceMeasure.multipleRestMeasures,R=0),Rge.relativeTime-Pe.relativeTime).map((ge,Pe)=>({...ge,i:Pe}));console.timeEnd("音符跑完时间");try{i.cursor.reset()}catch(ge){}return state$1.activeMeasureIndex=z[0].MeasureNumberXML,z},getNoteByMeasuresSlursStart=i=>{let e=i,t;if(i.noteElement.tie&&i.noteElement.tie.StartNote&&(t=i.noteElement.tie.StartNote),e&&t&&t!==e.noteElement){const r=[];for(const s of state$1.times)t===s.noteElement&&r.push(s);if(r.length)return r.find(s=>s.i===i.i-1)||r[0]}return e},parseXmlToRepeat=i=>{if(!i.length)return;let e=[],t=0,r=0;for(let s=0;s{let t=-1;if(state$1.repeatInfo.length){for(let r=state$1.repeatInfo.length-1;r>=0;r--){const{start:s,end:o}=state$1.repeatInfo[r];if(i<=s&&e>=o)return t=r,{repeatIdx:t,canRepeat:!0}}return{repeatIdx:t,canRepeat:!1}}else return{repeatIdx:t,canRepeat:!1}},compatibleXmlPitchVoice=i=>{var r,s,o;if(Array.from(i.getElementsByTagName("part-name")).map(a=>{var l,c;return((c=(l=a[0])==null?void 0:l.textContent)==null?void 0:c.trim().toLocaleUpperCase)!=="COMMON"}).length==1){const l=((o=(s=(r=(Array.from(i.getElementsByTagName("instrument-name"))||[])[0])==null?void 0:r.textContent)==null?void 0:s.trim())==null?void 0:o.toLocaleLowerCase())||"";let c=!1;switch(state$1.musicalCodeId){case 37:case 38:c=!!(!l||l.includes("solo")||l.includes("tenor recorder"));break;case 33:c=!!(!l||l.includes("solo")||l.includes("panpipes"));break;case 34:c=!!(!l||l.includes("solo")||l.includes("ocarina"));break;default:c=!!(!l||l.includes("solo"));break}window.xmlNeedAdjustVoice=c}},selectionContainer="_selectionContainer_1ofh0_1",position="_position_1ofh0_8",note="_note_1ofh0_11",staveBox="_staveBox_1ofh0_14",leftStaveBox="_leftStaveBox_1ofh0_17",rightStaveBox="_rightStaveBox_1ofh0_31",centerStaveBox="_centerStaveBox_1ofh0_45",prepareStaveBox="_prepareStaveBox_1ofh0_70",disable="_disable_1ofh0_73",line="_line_1ofh0_76",eyeLine="_eyeLine_1ofh0_88",lineStaff="_lineStaff_1ofh0_91",lineJianPu="_lineJianPu_1ofh0_94",scoreItem="_scoreItem_1ofh0_100",dotWrap="_dotWrap_1ofh0_137",noteFollow="_noteFollow_1ofh0_152",linePC="_linePC_1ofh0_188",noteDot="_noteDot_1ofh0_192",styles$2={selectionContainer,position,note,staveBox,leftStaveBox,rightStaveBox,centerStaveBox,prepareStaveBox,disable,line,eyeLine,lineStaff,lineJianPu,scoreItem,dotWrap,noteFollow,linePC,noteDot},noteMove="_noteMove_6dz5a_1",activeModel="_activeModel_6dz5a_14",toolBox="_toolBox_6dz5a_17",moveDisabled="_moveDisabled_6dz5a_33",hideTool="_hideTool_6dz5a_36",rightHideIcon$1="_rightHideIcon_6dz5a_39",styles$1={noteMove,activeModel,toolBox,moveDisabled,hideTool,rightHideIcon:rightHideIcon$1},tooltip="",TooltipSfc="",buttonGroup="",ButtonGroupSfc="",rightHideIcon="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAB4CAYAAACjK+FPAAAAAXNSR0IArs4c6QAAA9hJREFUeF7tnctrE1EUxr+J7wfqRsdCA2okIhMfNCXZVKyKWOzSZVbdCS5KcetON6J/RKEQBKFLwVWpUgvddNFVNkWbGrptSCsVm8otmTDpTDptb+49cx8Xumrn3PM735m5Z5r2HAf86zyAqwAuAjgF4HTr6xi/6Z5Z+Occ0dQZANdbgOeOaEPmZYcGPQHgJoAbAFIyPeXc61CgaQAeAAar2joQKEvv2wAyqtEF/I0FPQ4gD+CKwpDM9X1BmZJFAJcVh4wFZfcje+josLoqyh4893UgbDFEgp4E8AQAuz91WZGgOqWsL1QI9CyAxwCOWjElNQNCoHcAXEuqtxx+hUCftgpyDpuJvLQD9BKAB4l0k9+pDtBbALL8NhNpoQOUVUGql3rdotwB+hDAhUTqwe9UB+gzAKxY0HG1QdlL9KiOhHtLQPYyPWJB1Y9AO3WtouqLuUtgFdVEyDaGVdQqqmgEbOoqKlxXt62iVlFFI2BTV1Hh7MPIpq5NXUUjYFNXUeHsU9emLmnqzszMvCgUCqOO4zgLCwtfhoeHP3M6lDxFl5aWXuZyuecBsJ3Jycn3Y2NjPzhgkwUaAbnLtry8/D2TyXzQArQbJIObm5srDw0NfVIedD/IRqPx23XdV5ubm02lQWMga4ODgxOVSuUPByT9b+olQdKCSoSkA5UMSQNKACkflAhSLighpDxQYkg5oCsrK2/S6XQh6hxsNBq9OifjjlmxtW61Wn3T399PDSle0e3t7elUKhX6S+6NjY1aPp/vRcUTp6T/fbGKNpvNacdxQqD1er3qed7E6urq34N6yvlzYkFrtdrbvr6+e1FO1uv1X57nvZYEKxaUAa6trb1zXfcuMax4UAZYqVTGs9ks+8+L0JKkrBzQBMDKAyWGlQtKCCsflAiWBpQAlg5UMiwtqERYetA42PX19Z+u645vbW3tcJSByQCNg52dnZ3i/PwlOaD7wWr1kYSfllHlYrlc/lgqlb5pkbpBiPn5+dLAwMAI+9hwcXHxa7FYnOKAFP/izelcLy9P1j3aS7I9tiyowOCSmLaKkoRd4KZWUYHBJTFtFSUJu8BNraICg0ti2ipKEnaBm1pFBQaXxLRVlCTsAje1igoMLolpqyhJ2AVuahUVGFwS021FjWncxMJsRCsuBmpMczVj2uUZ0wDRmJaW7D41okkpA821JgqQHHYCN22fo/4erJHwI8WmChwkPiFQdpERraEZqDHNvhmsEe3b/ZzXKYUj71Ef1JgRCwzYiKEZQWW1H4MSPKO0H2wThDViVFEQWPvhU1HlVnCcGBsl5o8US9Q4sf9BGvvA8pV1NwAAAABJRU5ErkJggg==";let extStyleConfigJson={};window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;const showToolBox=ref(!0),moveData=reactive({open:!1,zoom:state$1.zoom,partIndex:"0",hasExtJson:!1,isWeb:!1,modelList:[],activeIndex:-1,sw:0,tool:{isAddAndSub:!1},noteCoords:[]}),initNoteCoord=()=>{const i=Array.from(document.querySelectorAll(".node-dot"));moveData.noteCoords=i.map(e=>{var r;const t=((r=e==null?void 0:e.getBoundingClientRect)==null?void 0:r.call(e))||{x:0,y:0};return{x:t.x,y:t.y}})},computedDistance=(i,e)=>{let t=-1,r=0,s,o,a;return moveData.noteCoords.forEach((l,c)=>{s=Math.abs(l.x-i),o=Math.abs(l.y-e),a=Math.sqrt(s*s+o*o),a=Number(a.toFixed(0)),a!==0&&(t===-1||a{setEleId(d,"temp"+a),a++});let l=1;[...t].forEach(d=>{setEleId(d,"text"+l),l++});let c=1;[...r].forEach(d=>{setEleId(d,"section"+c),c++});let u=1;[...s].forEach(d=>{setEleId(d,"repet"+u),u++});let m=1;[...o].forEach(d=>{setEleId(d,"line"+m),m++})}function setEleId(i,e){if(!i||!e)return;i.getAttribute("id")||i.setAttribute("id",e),createModelBox(i)}function createModelBox(i){var l;const e=((l=document.getElementById("musicAndSelection"))==null?void 0:l.getBoundingClientRect())||{x:0,y:0},t=e.x||0,r=e.y||0,s=i.getBoundingClientRect(),o={left:s.x-t+"px",top:s.y-r+"px",width:s.width+"px",height:s.height+"px"},a=i.getAttribute("class");moveData.modelList.push({id:i.getAttribute("id"),bbox:o,type:a,isMove:!1,left:s.left,top:s.top,width:s.width,height:s.height,x:0,y:0,zoom:state$1.zoom,isDelete:!1,d2:getLineGroupPathDx(i),dx:0})}function getBox(i){var o;if(!i)return{};const e=((o=document.getElementById("musicAndSelection"))==null?void 0:o.getBoundingClientRect())||{x:0,y:0},t=e.x||0,r=e.y||0,s=i.getBoundingClientRect();return{left:s.x-t,top:s.y-r,width:s.width,height:s.height}}const filterMoveData=async()=>{const i=state$1.examSongId;if(i){const e=window.fontSize,t=moveData.modelList.filter(s=>s.isMove).map(s=>{var d,y,b,S;const o=s.left+s.x,a=s.top+s.y,l=computedDistance(o,a),c=o-((d=moveData.noteCoords[l])==null?void 0:d.x),u=a-((y=moveData.noteCoords[l])==null?void 0:y.y);let m={id:s.id,isMove:s.isMove,isDelete:s.isDelete,x:s.x,y:s.y,xRem:Math.abs(s.x/e),yRem:Math.abs(s.y/e),zoom:s.zoom,w:moveData.sw,type:s.type,noteIdx:l,noteRelativeX:c,noteRelativeY:u};if(s.type==="vf-lineGroup"&&(m.dx=s.dx),s.id.includes("text")){const A=((S=(b=document.querySelector("#"+s.id))==null?void 0:b.querySelector("text"))==null?void 0:S.innerHTML)||"";m.textContent=A}return m});extStyleConfigJson[moveData.partIndex]=t,console.log("🚀 ~ extStyleConfigJson",extStyleConfigJson);const r=await request.post("/musicSheet/img",{requestType:"json",data:{id:i,extStyleConfigJson:JSON.stringify(extStyleConfigJson)}});r&&r.code==200&&showToast("保存成功"),clearActiveModel()}},dragData={open:!1,startX:0,startY:0,x:0,y:0,repeatEdit:!1},undoData=reactive({undoList:[],redoList:[],activeItem:null});function onDown(i){const e=i.target,t=moveData.modelList.findIndex(r=>r.id===e.dataset.id);if(t>-1){const r=moveData.modelList[t];moveData.activeIndex=t,dragData.startX=i.clientX,dragData.startY=i.clientY,dragData.x=r.x,dragData.y=r.y,dragData.repeatEdit=r.noteIdx>=0,document.onmousemove=onMove,document.onmouseup=onUp,dragData.open=!0,r.type==="vf-lineGroup"?moveData.tool.isAddAndSub=!0:moveData.tool.isAddAndSub=!1,undoData.activeItem={...r};return}moveData.activeIndex=-1}function onMove(i){if(dragData.open){const e=i.clientX-dragData.startX+dragData.x,t=i.clientY-dragData.startY+dragData.y;setModelPostion(moveData.modelList[moveData.activeIndex],e,t,dragData.repeatEdit)}}function onUp(i){document.onmousemove=null,document.onmouseup=null,dragData.open=!1;const e=i.clientX-dragData.startX+dragData.x,t=i.clientY-dragData.startY+dragData.y;(e||t)&&(moveData.modelList[moveData.activeIndex].isMove=!0,moveData.modelList[moveData.activeIndex].x=e,moveData.modelList[moveData.activeIndex].y=t,undoData.activeItem&&undoData.undoList.push({...undoData.activeItem})),undoData.activeItem=null}const renderSvgItem=i=>{if(setModelPostion(i,i.x,i.y),i.isDelete){const e=document.querySelector("#"+i.id);e&&(e.style.display="none")}else{const e=document.querySelector("#"+i.id);e&&(e.style.display="")}};async function setModelPostion(i,e,t,r){var s;if(i){const o=document.querySelector("#"+i.id),a=document.querySelector("[data-id=".concat(i.id,"]"));if(e===0&&t===0)o&&o.removeAttribute("transform"),a&&(a.style.transform="");else{let l=e,c=t;if(i.noteIdx>=0&&!r){moveData.noteCoords.length||await initNoteCoord();const u=moveData.noteCoords[i.noteIdx].x+i.noteRelativeX,m=moveData.noteCoords[i.noteIdx].y+i.noteRelativeY,d=((s=document.getElementById(i.id))==null?void 0:s.getBoundingClientRect())||{x:0,y:0};l=u-d.x,c=m-d.y,o&&o.setAttribute("transform","translate(".concat(l/moveData.zoom,", ").concat(c/moveData.zoom,")")),a&&(a.style.transform="translate(".concat(l,"px, ").concat(c,"px)"))}else o&&o.setAttribute("transform","translate(".concat(l/moveData.zoom,", ").concat(c/moveData.zoom,")")),a&&(a.style.transform="translate(".concat(l,"px, ").concat(c,"px)"))}}}const handleDeleteMoveNote=()=>{const i=moveData.modelList[moveData.activeIndex];if(i){moveData.modelList[moveData.activeIndex].isMove=!0,undoData.undoList.push({...moveData.modelList[moveData.activeIndex]}),moveData.modelList[moveData.activeIndex].isDelete=!i.isDelete;const e=document.querySelector("#"+i.id);e&&(e.style.display=moveData.modelList[moveData.activeIndex].isDelete?"none":"")}else showToast("选中需要删除的元素")},resetMoveNote=()=>{for(let i=0;i{if(!["add","sub"].includes(i))return;const e=moveData.modelList[moveData.activeIndex];if(!e||e.type!=="vf-lineGroup")return;e.isMove=!0;const t=i==="add"?10:-10;undoData.undoList.push({...moveData.modelList[moveData.activeIndex]}),moveData.modelList[moveData.activeIndex].dx=e.dx+t,renderLineGroup(moveData.modelList[moveData.activeIndex])};function getLineGroupPathDx(i){var t,r,s,o;if(!i)return 0;const e=i.querySelectorAll("path");if(e!=null&&e.length)for(let a=0;a{const i=undoData.undoList.pop();if(i){const e=moveData.modelList.findIndex(t=>t.id===i.id);e>-1&&(moveData.modelList[e]=i,renderSvgItem(moveData.modelList[e]),i.type==="vf-lineGroup"&&renderLineGroup(i))}},renderForMoveData=()=>{if(state$1.extStyleConfigJson)try{extStyleConfigJson=JSON.parse(state$1.extStyleConfigJson)}catch(e){extStyleConfigJson={}}if(!extStyleConfigJson||!(extStyleConfigJson!=null&&extStyleConfigJson[moveData.partIndex])){initSvgId();return}else initSvgId();const i=extStyleConfigJson==null?void 0:extStyleConfigJson[moveData.partIndex];i&&Array.isArray(i)&&nextTick(()=>{console.log("🚀 ~ list",i),i.forEach(e=>{var r,s,o,a,l,c;let t=moveData.modelList.findIndex(u=>u.id===e.id);if(e.type==="vf-text"&&e.textContent){let u=((s=(r=document.querySelector("#"+moveData.modelList[t].id))==null?void 0:r.querySelector("text"))==null?void 0:s.innerHTML)||"",m=t,d=!1,y=t,b=t;if(u!==e.textContent)for(;!d;){let S=moveData.modelList[y]&&((a=(o=document.querySelector("#"+moveData.modelList[y].id))==null?void 0:o.querySelector("text"))==null?void 0:a.innerHTML)||"",A=moveData.modelList[b]&&((c=(l=document.querySelector("#"+moveData.modelList[b].id))==null?void 0:l.querySelector("text"))==null?void 0:c.innerHTML)||"";S===e.textContent||A===e.textContent?(d=!0,m=S===e.textContent?y:b):(!S&&!A&&(d=!0,m=-1),y=y-1,b=b+1)}t=m,e.id="text".concat(m+1)}t>-1&&(moveData.modelList[t]={...moveData.modelList[t],...e},renderSvgItem(moveData.modelList[t]),e.type==="vf-lineGroup"&&renderLineGroup(moveData.modelList[t]))})})},MoveMusicScore=defineComponent({name:"move-music-score",setup(){const e=getQuery().isMove==="1";return console.log("🚀 ~ isOpen:",e),onMounted(()=>{nextTick(()=>initNoteCoord());const t=document.getElementById("toolBox");t&&document.body.appendChild(t)}),()=>createVNode("div",{class:[moveData.open?"":styles$1.moveDisabled]},[createVNode("div",{id:"toolBox"},[createVNode("div",{class:[styles$1.toolBox,!showToolBox.value&&styles$1.hideTool]},[createVNode(Switch,{modelValue:moveData.open,"onUpdate:modelValue":t=>moveData.open=t},null),moveData.open&&createVNode(Fragment,null,[moveData.tool.isAddAndSub&&createVNode(ButtonGroup,{size:"small",elevation:!1},{default:()=>[createVNode(Button,{onClick:()=>handleAddAndSub("add")},{default:()=>[createTextVNode("加")]}),createVNode(Button,{onClick:()=>handleAddAndSub("sub")},{default:()=>[createTextVNode("减")]})]}),createVNode(Button,{size:"small",onClick:handleUndo,disabled:!undoData.undoList.length},{default:()=>[createVNode(Icon,{name:"arrow-down",style:{transform:"rotate(90deg)"}},null)]}),createVNode(Button,{size:"small",onClick:handleDeleteMoveNote,disabled:!(moveData.activeIndex>-1)},{default:()=>{var t;return[(t=moveData.modelList[moveData.activeIndex])!=null&&t.isDelete?"显示元素":"删除元素"]}}),createVNode(Button,{size:"small",onClick:resetMoveNote},{default:()=>[createTextVNode("重置数据")]}),createVNode(Button,{size:"small",type:"primary",onClick:filterMoveData},{default:()=>[createTextVNode("保存数据")]}),createVNode(Button,{size:"small",type:"primary",onClick:()=>showToolBox.value=!1},{default:()=>[createTextVNode("收起")]})])]),!showToolBox.value&&createVNode("img",{class:[styles$1.rightHideIcon,showToolBox.value?"":styles$1.rightIconShow],src:rightHideIcon,onClick:()=>showToolBox.value=!0},null)]),moveData.modelList.map((t,r)=>createVNode("div",{class:[styles$1.noteMove,moveData.activeIndex===r&&styles$1.activeModel],style:t.bbox,"data-id":t.id,onMousedown:onDown},null))])}}),selectData=reactive({notes:[],staves:[],measureHeight:0}),calcNoteData=()=>{var a,l,c,u,m,d,y,b,S,A,P,x,E;const i=((a=document.getElementById("musicAndSelection"))==null?void 0:a.getBoundingClientRect())||{x:0,y:0},e=i.x||0,t=i.y||0,r=state$1.times,s=[],o=[];for(let _=0;_{var H;(H=D==null?void 0:D.style)==null||H.setProperty("display","none")})}catch(D){}const M=((E=R==null?void 0:R.getBoundingClientRect)==null?void 0:E.call(R))||{x:0,width:0,y:0,height:0};try{I.length&&I.forEach(D=>{var H;(H=D==null?void 0:D.style)==null||H.removeProperty("display")})}catch(D){}selectData.measureHeight=M.height,C.staveBox={left:M.x-e+"px",top:M.y-t+"px",width:M.width+"px",height:M.height+"px"},selectData.staves.push(C)}o.push(T.MeasureNumberXML)}else if(T.multipleRestMeasures){const R=selectData.staves.find(I=>I.MeasureNumberXML===T.MeasureNumberXML-1);R!=null&&R.staveBox&&(C.staveBox={left:R.staveBox.left,top:R.staveBox.top,width:R.staveBox.width},selectData.staves.push(C),o.push(T.MeasureNumberXML))}}}console.log("🚀 ~ selectData.notes:",selectData.notes,selectData.staves)},Selection=defineComponent({name:"selection",setup(){const i=useRoute$1(),e={...getQuery(),...i.query},t=computed(()=>state$1.sectionStatus||state$1.modeType!=="practise"),r=computed(()=>s=>{var o;if(state$1.sectionStatus){if(state$1.section.length===1&&s.MeasureNumberXML==state$1.section[0].MeasureNumberXML)return styles$2.leftStaveBox;if(state$1.section.length===2){const a=state$1.userChooseEndIndex>state$1.section[1].MeasureNumberXML?state$1.userChooseEndIndex:state$1.section[1].MeasureNumberXML;if(state$1.sectionFirst&&s.MeasureNumberXML===state$1.sectionFirst.MeasureNumberXML)return styles$2.prepareStaveBox;if(s.MeasureNumberXML>=state$1.section[0].MeasureNumberXML&&s.MeasureNumberXML<=a)return s.MeasureNumberXML==state$1.section[0].MeasureNumberXML&&s.MeasureNumberXML==a?styles$2.centerStaveBox:s.MeasureNumberXML==state$1.section[0].MeasureNumberXML?styles$2.leftStaveBox:s.MeasureNumberXML==a?((o=s.staveBox)!=null&&o.height||(s.staveBox.height=selectData.measureHeight+"px"),styles$2.rightStaveBox):styles$2.staveBox}}else if(state$1.activeMeasureIndex==s.MeasureNumberXML&&!state$1.isReport)return styles$2.staveBox});return onMounted(()=>{calcNoteData();try{moveData.partIndex=e["part-index"]||"0",nextTick(()=>renderForMoveData())}catch(s){}}),()=>createVNode("div",{id:"selectionBox",class:styles$2.selectionContainer,onClick:s=>s.stopPropagation()},[selectData.staves.map(s=>{var l;const o=s.id&&evaluatingData.evaluatings[s.measureListIndex],a=!state$1.isReport&&!state$1.times[state$1.activeNoteIndex].multipleRestMeasures&&metronomeData.cursorMode===2&&s.MeasureNumberXML===((l=metronomeData.activeMetro)==null?void 0:l.measureNumberXML)&&state$1.times[state$1.activeNoteIndex].MeasureNumberXML===s.MeasureNumberXML;return createVNode(Fragment,null,[s.staveBox&&createVNode("div",{class:[styles$2.position,r.value(s),o?"scoreItemLeve".concat(o.leve):"",state$1.platform===IPlatform.PC?styles$2.linePC:""],style:s.staveBox,onClick:()=>handleSelection(s)},[a&&createVNode("div",{class:[styles$2.line,state$1.setting.eyeProtection?styles$2.eyeLine:"",state$1.musicRenderType==EnumMusicRenderType.staff?styles$2.lineStaff:styles$2.lineJianPu],style:{left:metronomeData.activeMetro.left}},null),!state$1.isReport&&!!s.multipleRestMeasures&&state$1.activeMeasureIndex==s.MeasureNumberXML&&createVNode("div",{class:styles$2.dotWrap},[s.multipleRestMeasures]),createVNode(Transition,{name:"centerTop",onAfterEnter:()=>{o.show=!1}},{default:()=>{var c,u;return[(o==null?void 0:o.show)&&createVNode("div",{class:styles$2.scoreItem,style:{color:((c=leveByScoreMeasureIcons[o.leve])==null?void 0:c.color)||""}},[createVNode("img",{src:(u=leveByScoreMeasureIcons[o.leve])==null?void 0:u.icon},null),createVNode("span",null,[o.score])])]}})])])}),selectData.notes.map(s=>createVNode("div",{class:[styles$2.position,t.value&&styles$2.disable,styles$2.note,"noteIndex_".concat(s.index)],style:s.bbox,onClick:()=>skipNotePlay(s.index)},[createVNode("div",{class:styles$2.noteFollow,"data-vf":"vf"+s.id},[createVNode(Icon$1,{name:"success"},null),createVNode(Icon$1,{name:"cross"},null)]),createVNode("div",{class:[styles$2.noteDot,"node-dot"]},null)])),e.isMove=="1"&&createVNode(MoveMusicScore,null,null)])}}),inGradualRange="_inGradualRange_srp9d_25",styles={inGradualRange},query=getQuery(),container=ref(),resetGivenFormate=()=>{var t,r;const e={12200:[{parts:["0","1"],tieId:["1483"]},{parts:["2"],tieId:["1463"]},{parts:["10"],tieId:["1246"]},{parts:["11"],tieId:["2455"]},{parts:["13"],tieId:["1488","1688"]},{parts:["14","15"],tieId:["1272"]},{parts:["16"],tieId:["1264","1368"],staveSection:[{id:"section-0",y:-10}]}],12420:[{parts:["0"],tieId:["1298","1405","1998","2598","3229","2731","2617"]}],7729:[{parts:["3"],tieId:["1498","1660"]}],7439:[{parts:["23"],vfmodifiers:[{id:"modifiers-130",y:-18,isLast:!0}]}],12711:[{parts:["0"],voltas:-12},{parts:["4"],voltas:-8}],3581:[{parts:["0"],voltas:-8}],6244:[{parts:["15"],stavenote:[{id:"vf-auto1608",y:-15}]}],7473:[{parts:["0"],voltas:-8}]}[state$1.cbsExamSongId];if(e){const s=query["part-index"]||"0",o=e.find(a=>a.parts.includes(s));if(!o)return;if(o.tieId&&o.tieId.length)for(let a=0;a{l.classList.add("section-".concat(c))});for(let l=0;l{l.classList.add("modifiers-".concat(c))});for(let l=0;l{l.style.transform="translateY(".concat(o.voltas,"px)")}),o.stavenote&&o.stavenote.length)for(let a=0;a{var r,s,o;if(container.value=document.getElementById("scrollContainer"),state$1.extStyleConfigJson||!container.value)return;const i=Array.from(container.value.querySelectorAll(".staffline")),e=4,t=28;for(let a=0,l=i.length;a .vf-voices")),S=Array.from(c.querySelectorAll(".vf-measure > .vf-beams")),A=Array.from(c.querySelectorAll(".vf-ties")),P=Array.from(c.querySelectorAll(".vf-line")),x=Array.from(c.querySelectorAll(".vf-measure > .vf-stave text"));Array.from(c.querySelectorAll(".vf-measure > .vf-stave rect[fill=none]"));const E=Array.from(c.querySelectorAll(".vf-measure .vf-staveSection")),T=((r=Array.from(c.querySelectorAll(".vf-measure > .vf-stave path"))[0])==null?void 0:r.getBBox().y)||0,C=["To Coda","D.S. al Coda","Coda"];x.filter(k=>C.includes(k.textContent||"")).forEach(k=>{S.forEach($=>{var N;const F=collisionDetection(k,$),G=k==null?void 0:k.previousSibling;if(F.isCollision){const V=Number(k.getAttribute("y"))-(F.b1-F.t2)-e+"";k.setAttribute("y",V),G&&G.getAttribute("stroke-width")==="0.3"&&G.getAttribute("stroke")==="none"&&(((N=G.getAttribute("d"))==null?void 0:N.length)||0)>3e3&&(G.style.transform="translateY(".concat(-(F.b1-F.t2+e),"px)"))}}),b.forEach($=>{var N;const F=collisionDetection(k,$),G=k==null?void 0:k.previousSibling;if(F.isCollision){const V=Number(k.getAttribute("y"))-(F.b1-F.t2)-e+"";k.setAttribute("y",V),G&&G.getAttribute("stroke-width")==="0.3"&&G.getAttribute("stroke")==="none"&&(((N=G.getAttribute("d"))==null?void 0:N.length)||0)>3e3&&(G.style.transform="translateY(".concat(-(F.b1-F.t2+e),"px)"))}})}),E.forEach(k=>{let $=0;[...y,...A,...b].forEach(F=>{const G=collisionDetection(k,F);G.isCollision&&($=Math.min($,G.t2-G.b1-e))}),k.style.transform="translateY(".concat($,"px)")});let R=Array.from(c.querySelectorAll(".vf-text > text")).filter(k=>k.getBBox().y text")).filter(k=>k.getBBox().y{const $=k.getBBox();$.y1&&M.forEach(k=>{k.setAttribute("y",I+"")}),R.forEach(k=>{[...y,...d,...P].forEach($=>{let F=collisionDetection(k,$);if(F.isCollision&&F.b1{R.forEach($=>{if(k.parentNode!==$.parentNode&&!["marcato","legato"].includes(k.textContent))if(["marcato","legato"].includes($.textContent)){if(collisionDetection(k,$,30,30).isCollision){const G=k.getBBox();$.setAttribute("x",G.x+G.width+5+""),$.setAttribute("y",G.y+G.height-5+"")}}else{const F=collisionDetection(k,$);if(F.isCollision){const G=Number(k.getAttribute("y")),N=F.b2-F.t2<24?24:F.b2-F.t2;$.setAttribute("y",G-N-.5+"")}}})});const D=["C","G","D","A","E","B","F#","C#","G#","F","Bb","Eb","Ab","Db","Gb","Cb","Fb","D#","A#","E#"],H=["Bb","Eb","Ab","Db","Gb","Cb","Fb"],W=["F#","C#","G#","D#","A#","E#","B#"];R.forEach(k=>{const $=k.textContent;if(D.includes($)){const F=Number(k.getAttribute("y")),G=T?T-t:F;k.setAttribute("y",G)}H.includes($)&&(k.textContent=$.replace("b","♭")),W.includes($)&&(k.textContent=$.replace("#","♯"))});const O=Array.from(c.querySelectorAll(".vf-text > text")).filter(k=>k.getBBox().y>m),z=Array.from(c.querySelectorAll(".vf-line")).filter(k=>k.getBBox().y>m);for(let k=0;k{[...d].forEach($=>{let F=collisionDetection(k,$);F.isCollision&&k.setAttribute("y",F.b2+Math.abs(F.t1-Number(k.getAttribute("y")))+"")})}),z.forEach(k=>{var F;const $=[];if((F=k.nextElementSibling)!=null&&F.classList.contains("vf-line")&&O.forEach(G=>{let N=collisionDetection(k,G,20,20);N.isCollision&&$.push({text:G,result:N})}),$.length===1){const G=$[0].result,N=$[0].text;G.x2+G.w2G.x1+G.w1?Math.abs(G.y2-G.y1)>10&&N.setAttribute("y",G.y1+G.h2/2+""):Math.abs(G.x2-G.x1)10&&N.setAttribute("y",G.y1+G.h2/2+"")):(N.setAttribute("x",G.x1+G.w1+5+""),Math.abs(G.y2-G.y1)>10&&N.setAttribute("y",G.y1+G.h2/2+""))}else if($.length===2){const G=$[0].result,N=$[0].text,V=$[1].result,K=$[1].text;N.setAttribute("x",G.x1-G.w2-5+""),Math.abs(G.y2-G.y1)>10&&N.setAttribute("y",G.y1+G.h2/2+""),K.setAttribute("x",V.x1+V.w1+5+""),Math.abs(V.y2-V.y1)>10&&K.setAttribute("y",V.y1+V.h2/2+"")}}),O.forEach(k=>{O.forEach($=>{if(k.parentNode!==$.parentNode&&!["marcato","legato","cresc.","Cantabile"].includes(k.textContent))if(["marcato","legato","cresc.","Cantabile"].includes($.textContent)){if(collisionDetection(k,$,30,30).isCollision){const G=k.getBBox();$.setAttribute("x",G.x+G.width+5+""),$.setAttribute("y",G.y+G.height-5+"")}}else{const F=collisionDetection(k,$);F.isCollision&&$.setAttribute("y",F.y1+F.h1+F.h2+"")}})})}},collisionDetection=(i,e,t=0,r=0)=>{const s=i.getBBox(),o=e.getBBox();let a=s.y-r,l=s.x-t,c=s.x+s.width+t,u=s.y+s.height+r,m=o.y,d=o.x,y=o.x+o.width,b=o.y+o.height;return uy||a>b||c{const i=query["part-index"]||"0",t=[{id:"12644",part_index:"25",direction:1}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i);setGlobalData("tieDirection",t?t.direction:void 0);const s=[{id:"3509",part_index:"16",direction:1}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i);s&&setGlobalData("graceCustom",{direction:s.direction});const a=[{id:"3030",part_index:"17",line:4},{id:"12704",part_index:"23",line:3}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i);a&&setGlobalData("customBassDrum",a.line);const c=[{id:"11654",part_index:"16",stemNotes:[{id:124,direction:0},{id:125,direction:0},{id:126,direction:0},{id:127,direction:0},{id:128,direction:0}]},{id:"3581",part_index:"4",stemNotes:[{id:380,direction:1}]},{id:"3470",part_index:"0",stemNotes:[{id:36,direction:1},{id:37,direction:1}]},{id:"3470",part_index:"11",stemNotes:[{id:33,direction:1},{id:56,direction:1}]},{id:"12644",part_index:"22",stemNotes:[{id:22,direction:1},{id:26,direction:1},{id:135,direction:1},{id:163,direction:1},{id:199,direction:1},{id:204,direction:1},{id:206,direction:1},{id:208,direction:1},{id:210,direction:1},{id:213,direction:1}]},{id:"12303",part_index:"18",stemNotes:[{id:1,direction:1},{id:4,direction:1},{id:6,direction:1},{id:9,direction:1},{id:12,direction:1},{id:14,direction:1}]},{id:"12669",part_index:"24",stemNotes:[{id:65,direction:1},{id:296,direction:1},{id:298,direction:1},{id:300,direction:1},{id:338,direction:1}]},{id:"12420",part_index:"21",stemNotes:[{id:614,direction:0},{id:617,direction:0},{id:619,direction:0},{id:621,direction:0}]},{id:"12711",part_index:"22",stemNotes:[]},{id:"12973",part_index:"21",stemNotes:[{id:619,direction:1},{id:622,direction:1},{id:745,direction:1}]}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i);c&&setGlobalData("stemDirectionNote",c.stemNotes);const m=[{id:"12711",part_index:"4",vfcurve:[{MeasureNumberXML:25,index:1,bezierEndControlPt:{y:-2}},{MeasureNumberXML:33,index:1,bezierEndControlPt:{y:-2}}]},{id:"12059",part_index:"0",vfcurve:[{MeasureNumberXML:15,bezierEndControlPt:{y:2.8},bezierEndPt:{y:1.1}},{MeasureNumberXML:16,bezierEndControlPt:{y:-1}},{MeasureNumberXML:19,index:1,bezierEndControlPt:{y:2}},{MeasureNumberXML:20,bezierEndControlPt:{y:-1}},{MeasureNumberXML:42,index:1,bezierEndControlPt:{y:-1.5},bezierStartControlPt:{y:-1.5}},{MeasureNumberXML:46,index:3,bezierEndControlPt:{y:-1.5},bezierStartControlPt:{y:-1.5}}]},{id:"12668",part_index:"11",vfcurve:[{MeasureNumberXML:8,index:2,bezierEndControlPt:{y:-3},bezierStartControlPt:{y:-3},bezierEndPt:{y:-1}}]},{id:"11976",part_index:"0",vfcurve:[{MeasureNumberXML:14,index:4,bezierEndControlPt:{y:-3}},{MeasureNumberXML:14,index:1,bezierEndPt:{y:1.5},bezierEndControlPt:{y:1}}]}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i);m&&setGlobalData("vfcurveItem",m.vfcurve),[{id:"12644",part_index:"25"}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i)&&setGlobalData("customArtPosition",!0),[{id:"12645",part_index:"5"}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i)&&setGlobalData("customTenutoItem",!0),[{id:"12711",part_index:"22"},{id:"12711",part_index:"25"}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i)&&setGlobalData("customAccentItem",!0),[{id:"12711",part_index:"25"},{id:"7755",part_index:"10"},{id:"6226",part_index:"16"}].find(({id:_,part_index:T})=>_==state$1.cbsExamSongId&&T==i)&&setGlobalData("customLefthandpizzicatoItem",!0)},setCustomGradual=()=>{if(state$1.gradualTimes){const i=state$1.cbsExamSongId+"",e=state$1.partIndex+"";["12280"].includes(i)&&["24"].includes(e)&&(state$1.gradualTimes[8]="00:26:10",state$1.gradualTimes[66]="01:53:35",state$1.gradualTimes[90]="02:41:40")}},setCustomNoteRealValue=()=>{const i=state$1.cbsExamSongId+"",e=state$1.partIndex+"";["2670"].includes(i)&&(customData.customNoteRealValue={0:.03125}),["12673"].includes(i)&&["22"].includes(e)&&(customData.customNoteRealValue={208:.125}),["12667","12673"].includes(i)&&(customData.customNoteCurrentTime=!0)},musicRenderTypeKey="musicRenderType";let osmd=null;const musicData=reactive({showSelection:!1,isRenderLoading:!0,score:"",containerWidth:0}),resetMusicScore=()=>{var e;const i=((e=document.getElementById("musicAndSelection"))==null?void 0:e.offsetWidth)||625;state$1.musicZoom=i/musicData.containerWidth},resetRenderMusicScore=i=>{const e=queryString.parse(location.search),t=queryString.stringify({...e,_t:Date.now(),musicRenderType:i});location.search="?"+t},MusicScore=defineComponent({name:"music-score",emits:["rendered"],props:{showSelection:{type:Boolean,default:!0},renderTypeKey:{type:String,default:""},musicColor:{type:String,default:""}},setup(i,{emit:e}){const t=()=>{const l=sessionStorage.getItem(i.renderTypeKey||musicRenderTypeKey);l in EnumMusicRenderType&&(state$1.musicRenderType=l)},r=async()=>{const l=await fetch(state$1.xmlUrl).then(u=>u.text()),c=formatXML(l);musicData.score=state$1.isCombineRender?c:onlyVisible(c,state$1.partIndex),state$1.gradualTimes&&(state$1.gradual=getGradualLengthByXml(c))},s=async()=>{const l=document.getElementById("musicAndSelection");!l||!musicData.score||(setGlobalMusicSheet(),osmd=new OpenSheetMusicDisplay(l,{drawTitle:!1,drawSubtitle:!1,autoResize:!1,followCursor:!1,drawPartNames:!1,drawComposer:!1,defaultColorMusic:i.musicColor}),osmd.EngravingRules.PageRightMargin=2,osmd.EngravingRules.PageTopMargin=10,osmd.EngravingRules.PageTopMarginNarrow=3,osmd.EngravingRules.PageLeftMargin=2,osmd.EngravingRules.PageBottomMargin=2,osmd.EngravingRules.DYMusicScoreType=state$1.musicRenderType===EnumMusicRenderType.staff?"staff":"jianpu",state$1.musicRenderType===EnumMusicRenderType.fixedTone&&(window.sett={keySignature:!0}),osmd.EngravingRules.DYMusicScoreId=state$1.examSongId||"",await osmd.load(musicData.score),osmd.zoom=state$1.zoom,osmd.render(),e("rendered",osmd),resetFormate(),resetGivenFormate(),musicData.showSelection=!0)},o=()=>{var l;musicData.containerWidth=((l=document.getElementById("musicAndSelection"))==null?void 0:l.offsetWidth)||625};onMounted(async()=>{o(),t(),await r(),await s(),musicData.isRenderLoading=!1});const a=computed(()=>{var u;let l=!1;const c=((u=state$1.times[state$1.activeNoteIndex])==null?void 0:u.measureListIndex)||-1;for(const[m,d]of state$1.gradual)if(m&&d&&(l=m.measureIndex<=c&&ccreateVNode("div",{id:"musicAndSelection",style:{"--music-zoom":state$1.musicZoom},class:[a.value&&styles.inGradualRange,state$1.musicRenderType==EnumMusicRenderType.staff?"staff":"jianpuTone"]},[i.showSelection&&musicData.showSelection&&!state$1.isPreView&&!state$1.isEvaluatReport&&createVNode(Selection,null,null)])}}),Notfind=defineComponent({name:"notfund",render(){return createVNode(Empty,{image:"error",description:this.$route.path+" 路径不存在"},{default:()=>[createVNode(Button$1,{type:"primary",onClick:()=>this.$router.replace("/")},{default:()=>[createTextVNode("返回首页")]})]})}});export{closeToast as $,handleEndSoundCheck as A,connectWebsocket as B,handleViewReport as C,handleStartEvaluat as D,api_videoUpdate as E,Fragment as F,api_proxyServiceMessage as G,getNoteByMeasuresSlursStart as H,Icon$1 as I,handleSetSpeed as J,useClickAway as K,Button$1 as L,store as M,NoticeBar as N,api_openCamera as O,Popup as P,api_closeCamera as Q,RouterView as R,Snackbar$1 as S,TheError as T,toRefs as U,useRoute$1 as V,isVNode as W,api_cloudDestroy as X,postMessage as Y,showLoadingToast as Z,request$1$1 as _,setBehaviorId as a,debounce as a$,getBehaviorId as a0,getCampId as a1,useRouter as a2,onUnmounted as a3,handleChangeSection as a4,togglePlay as a5,metronomeData as a6,handleResetPlay as a7,Badge as a8,api_back as a9,Vue3Lottie as aA,api_savePicture as aB,musicRenderTypeKey as aC,resetRenderMusicScore as aD,handleRessetState as aE,toggleFollow as aF,getAudioCurrentTime as aG,handleFollowStart as aH,handleFollowEnd as aI,api_setEventTracking as aJ,Tick as aK,FollowPractice as aL,handleInitTick as aM,promisefiyPostMessage as aN,api_setCache as aO,getToken as aP,api_suspendPlay as aQ,followData as aR,hanldeDirectSelection as aS,api_openWebView as aT,musicscoresettingKey as aU,createNamespace$1 as aV,Comment as aW,Text as aX,withInstall$1 as aY,api_getToken as aZ,studentQueryUserInfo as a_,getSecondRPM as aa,customData as ab,setGlobalData as ac,api_setStatusBarVisibility as ad,nextTick as ae,resetMusicScore as af,onBeforeUnmount as ag,Skeleton as ah,Transition as ai,MusicScore as aj,AudioList as ak,Evaluating as al,isSpecialShapedScreen as am,mappingVoicePart as an,isRhythmicExercises as ao,subjectFingering as ap,formateTimes as aq,Metronome as ar,getStorageSpeed as as,api_cloudLoading as at,addMeasureScore as au,createRouter as av,createWebHashHistory as aw,Notfind as ax,setStoreData as ay,createApp as az,setCampId as b,usePlaceholder as b$,getAudioDuration as b0,api_musicPracticeRecordSave as b1,sendResult as b2,addCheckPlayEnd as b3,removeResult as b4,removeCheckPlayEnd as b5,api_toggleTune as b6,getEarphone as b7,startCheckDelay as b8,getSuggestionList as b9,extend$2 as bA,clamp as bB,numericProp as bC,makeRequiredProp as bD,makeArrayProp as bE,useTouch as bF,useParent$1 as bG,useExpose as bH,watchEffect as bI,useEventListener$1 as bJ,preventDefault as bK,HAPTICS_FEEDBACK as bL,makeNumericProp as bM,truthProp as bN,makeStringProp as bO,useChildren$1 as bP,unitToPx as bQ,isSameValue as bR,Loading$1 as bS,pick$1 as bT,mergeProps as bU,BORDER_UNSET_TOP_BOTTOM as bV,useScrollParent as bW,onUpdated as bX,useRect as bY,isHidden as bZ,addUnit as b_,sysSuggestionAdd as ba,api_goback as bb,usePageVisibility as bc,setSection as bd,api_lessonTrainingSubmitTraining as be,api_lessonTrainingTrainingStudentDetail as bf,IPlatform as bg,api_getDeviceDelay as bh,checkUseEarphone as bi,resetPlaybackToStart as bj,api_openAdjustRecording as bk,api_musicPracticeRecordVideoUpload as bl,api_musicSheetPage as bm,getDefaultExportFromCjs as bn,api_setRequestedOrientation as bo,getFingeringConfig as bp,api_subjectList as bq,howler as br,api_keepScreenLongLight as bs,getMusicDetail as bt,setCustomGradual as bu,setCustomNoteRealValue as bv,initMidi as bw,evaluatCreateMusicPlayer as bx,__vitePreload as by,isDef$1 as bz,onMounted as c,Teleport as c$,routeProps as c0,useRoute as c1,popupSharedProps as c2,unknownProp as c3,popupSharedPropKeys as c4,withKeys as c5,noop$1 as c6,isFunction$5 as c7,BORDER_LEFT as c8,BORDER_TOP as c9,normalizeClass as cA,stringifyStyle as cB,normalizeStyle as cC,getCurrentInstance as cD,vShow as cE,getRootScrollTop as cF,isObject$4 as cG,isPromise as cH,FORM_KEY as cI,toArray as cJ,formatNumber as cK,CUSTOM_FIELD_INJECTION_KEY as cL,resetScroll as cM,getSizeStyle as cN,makeNumberProp as cO,BORDER_RIGHT as cP,BORDER_BOTTOM as cQ,stopPropagation as cR,addNumber as cS,defineListenerProp as cT,useChildren as cU,useInitialized as cV,useZIndex as cW,useTeleport as cX,useLock as cY,call as cZ,useRouteListener as c_,callInterceptor as ca,inBrowser$2 as cb,mountComponent as cc,usePopupState as cd,useCustomFieldValue as ce,cancelRaf as cf,raf as cg,getScrollTop as ch,setScrollTop as ci,onBeforeUpdate as cj,onDeactivated as ck,onMountedOrActivated as cl,getZIndexStyle as cm,windowWidth as cn,windowHeight as co,onActivated as cp,onPopupReopen as cq,doubleRaf as cr,useId as cs,BORDER_TOP_BOTTOM as ct,setRootScrollTop as cu,getElementTop as cv,route as cw,inject as cx,provide as cy,withDirectives as cz,defineComponent as d,createNamespace as d0,withInstall as d1,commonjsGlobal as d2,EnumMusicRenderType as d3,api_musicPracticeRecordDetail as d4,computed as e,createVNode as f,getQuery as g,storeData as h,setUserInfo as i,getRandomKey as j,createTextVNode as k,ref as l,state$1 as m,reactive as n,onBeforeMount as o,evaluatingData as p,showToast as q,request as r,setToken as s,queryString as t,api_shareAchievements as u,browser as v,watch as w,handlePerformDetection as x,handleStartBegin as y,handleEndBegin as z};