import{i as ref,l as reactive,m as unref,n as inject,p as onUnmounted,q as computed,o as onMounted,v as nextTick,x as onActivated,y as onDeactivated,z as isRef,w as watch,A as getCurrentInstance,B as provide,C as isVNode,d as defineComponent,b as createVNode,D as onBeforeUnmount,T as Transition,E as withDirectives,G as vShow,H as Teleport,F as Fragment,I as mergeProps,j as createTextVNode,g as createApp,J as onBeforeUpdate,K as onUpdated,L as commonjsGlobal$1,M as queryString,N as getRequestHostname,h as browser,O as getRandomKey,P as commonjsRequire$1,Q as getAugmentedNamespace,R as watchEffect,f as formatZoom,s as state$3,_ as __vitePreload,S as open$2,e as close$2,c as createRouter,a as createWebHashHistory,k as state$4,t as toRefs,r as resolveComponent,U as resolveDirective,V as getPlatform,W as store_legacy,u as useRoute$1,X as formatTime,Y as TransitionGroup}from"./base.23532cc4.js";var replace=String.prototype.replace,percentTwenties=/%20/g,Format={RFC1738:"RFC1738",RFC3986:"RFC3986"},formats$3={default:Format.RFC3986,formatters:{RFC1738:function(B){return replace.call(B,percentTwenties,"+")},RFC3986:function(B){return String(B)}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986},formats$2=formats$3,has$2=Object.prototype.hasOwnProperty,isArray$4=Array.isArray,hexTable=function(){for(var B=[],D=0;D<256;++D)B.push("%"+((D<16?"0":"")+D.toString(16)).toUpperCase());return B}(),compactQueue=function(D){for(;D.length>1;){var R=D.pop(),F=R.obj[R.prop];if(isArray$4(F)){for(var G=[],j=0;j=48&&Q<=57||Q>=65&&Q<=90||Q>=97&&Q<=122||j===formats$2.RFC1738&&(Q===40||Q===41)){W+=U.charAt(Y);continue}if(Q<128){W=W+hexTable[Q];continue}if(Q<2048){W=W+(hexTable[192|Q>>6]+hexTable[128|Q&63]);continue}if(Q<55296||Q>=57344){W=W+(hexTable[224|Q>>12]+hexTable[128|Q>>6&63]+hexTable[128|Q&63]);continue}Y+=1,Q=65536+((Q&1023)<<10|U.charCodeAt(Y)&1023),W+=hexTable[240|Q>>18]+hexTable[128|Q>>12&63]+hexTable[128|Q>>6&63]+hexTable[128|Q&63]}return W},compact=function(D){for(var R=[{obj:{o:D},prop:"o"}],F=[],G=0;G0?ne.join(",")||null:void 0}];else if(isArray$3(W))oe=W;else{var le=Object.keys(ne);oe=Y?le.sort(Y):le}for(var fe=0;fe0?J+q:""},utils$1=utils$3,has=Object.prototype.hasOwnProperty,isArray$2=Array.isArray,defaults={allowDots:!1,allowPrototypes:!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(B){return B.replace(/&#(\d+);/g,function(D,R){return String.fromCharCode(parseInt(R,10))})},parseArrayValue=function(B,D){return B&&typeof B=="string"&&D.comma&&B.indexOf(",")>-1?B.split(","):B},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function(D,R){var F={},G=R.ignoreQueryPrefix?D.replace(/^\?/,""):D,j=R.parameterLimit===1/0?void 0:R.parameterLimit,U=G.split(R.delimiter,j),W=-1,Y,Q=R.charset;if(R.charsetSentinel)for(Y=0;Y-1&&(te=isArray$2(te)?[te]:te),has.call(F,K)?F[K]=utils$1.combine(F[K],te):F[K]=te}return F},parseObject=function(B,D,R,F){for(var G=F?D:parseArrayValue(D,R),j=B.length-1;j>=0;--j){var U,W=B[j];if(W==="[]"&&R.parseArrays)U=[].concat(G);else{U=R.plainObjects?Object.create(null):{};var Y=W.charAt(0)==="["&&W.charAt(W.length-1)==="]"?W.slice(1,-1):W,Q=parseInt(Y,10);!R.parseArrays&&Y===""?U={0:G}:!isNaN(Q)&&W!==Y&&String(Q)===Y&&Q>=0&&R.parseArrays&&Q<=R.arrayLimit?(U=[],U[Q]=G):U[Y]=G}G=U}return G},parseKeys=function(D,R,F,G){if(!!D){var j=F.allowDots?D.replace(/\.([^.[]+)/g,"[$1]"):D,U=/(\[[^[\]]*])/,W=/(\[[^[\]]*])/g,Y=F.depth>0&&U.exec(j),Q=Y?j.slice(0,Y.index):j,Z=[];if(Q){if(!F.plainObjects&&has.call(Object.prototype,Q)&&!F.allowPrototypes)return;Z.push(Q)}for(var q=0;F.depth>0&&(Y=W.exec(j))!==null&&q-1};function normalizeName(B){if(typeof B!="string"&&(B=String(B)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(B)||B==="")throw new TypeError('Invalid character in header field name: "'+B+'"');return B.toLowerCase()}function normalizeValue(B){return typeof B!="string"&&(B=String(B)),B}function iteratorFor(B){var D={next:function(){var R=B.shift();return{done:R===void 0,value:R}}};return support.iterable&&(D[Symbol.iterator]=function(){return D}),D}function Headers(B){this.map={},B instanceof Headers?B.forEach(function(D,R){this.append(R,D)},this):Array.isArray(B)?B.forEach(function(D){this.append(D[0],D[1])},this):B&&Object.getOwnPropertyNames(B).forEach(function(D){this.append(D,B[D])},this)}Headers.prototype.append=function(B,D){B=normalizeName(B),D=normalizeValue(D);var R=this.map[B];this.map[B]=R?R+", "+D:D};Headers.prototype.delete=function(B){delete this.map[normalizeName(B)]};Headers.prototype.get=function(B){return B=normalizeName(B),this.has(B)?this.map[B]:null};Headers.prototype.has=function(B){return this.map.hasOwnProperty(normalizeName(B))};Headers.prototype.set=function(B,D){this.map[normalizeName(B)]=normalizeValue(D)};Headers.prototype.forEach=function(B,D){for(var R in this.map)this.map.hasOwnProperty(R)&&B.call(D,this.map[R],R,this)};Headers.prototype.keys=function(){var B=[];return this.forEach(function(D,R){B.push(R)}),iteratorFor(B)};Headers.prototype.values=function(){var B=[];return this.forEach(function(D){B.push(D)}),iteratorFor(B)};Headers.prototype.entries=function(){var B=[];return this.forEach(function(D,R){B.push([R,D])}),iteratorFor(B)};support.iterable&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);function consumed(B){if(B.bodyUsed)return Promise.reject(new TypeError("Already read"));B.bodyUsed=!0}function fileReaderReady(B){return new Promise(function(D,R){B.onload=function(){D(B.result)},B.onerror=function(){R(B.error)}})}function readBlobAsArrayBuffer(B){var D=new FileReader,R=fileReaderReady(D);return D.readAsArrayBuffer(B),R}function readBlobAsText(B){var D=new FileReader,R=fileReaderReady(D);return D.readAsText(B),R}function readArrayBufferAsText(B){for(var D=new Uint8Array(B),R=new Array(D.length),F=0;F=0&&typeof this._bodyInit!="string"&&(this._bodyInit=this._bodyText):typeof B=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):support.searchParams&&URLSearchParams.prototype.isPrototypeOf(B)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8")},support.blob&&(this.blob=function(){var B=consumed(this);if(B)return B;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var B=consumed(this);return B||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var B=consumed(this);if(B)return B;if(this._bodyBlob)return readBlobAsText(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},support.formData&&(this.formData=function(){return this.text().then(decode$1)}),this.json=function(){return this.text().then(JSON.parse)},this}var methods=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function normalizeMethod(B){var D=B.toUpperCase();return methods.indexOf(D)>-1?D:B}function Request(B,D){if(!(this instanceof Request))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var R=D.body;if(B instanceof Request){if(B.bodyUsed)throw new TypeError("Already read");this.url=B.url,this.credentials=B.credentials,D.headers||(this.headers=new Headers(B.headers)),this.method=B.method,this.mode=B.mode,this.signal=B.signal,!R&&B._bodyInit!=null&&(R=B._bodyInit,B.bodyUsed=!0)}else this.url=String(B);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new Headers(D.headers)),this.method=normalizeMethod(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(R),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var F=/([?&])_=[^&]*/;if(F.test(this.url))this.url=this.url.replace(F,"$1_="+new Date().getTime());else{var G=/\?/;this.url+=(G.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode$1(B){var D=new FormData;return B.trim().split("&").forEach(function(R){if(R){var F=R.split("="),G=F.shift().replace(/\+/g," "),j=F.join("=").replace(/\+/g," ");D.append(decodeURIComponent(G),decodeURIComponent(j))}}),D}function parseHeaders(B){var D=new Headers,R=B.replace(/\r?\n[\t ]+/g," ");return R.split("\r").map(function(F){return F.indexOf(` `)===0?F.substr(1,F.length):F}).forEach(function(F){var G=F.split(":"),j=G.shift().trim();if(j){var U=G.join(":").trim();D.append(j,U)}}),D}Body.call(Request.prototype);function Response(B,D){if(!(this instanceof Response))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D||(D={}),this.type="default",this.status=D.status===void 0?200:D.status,this.ok=this.status>=200&&this.status<300,this.statusText=D.statusText===void 0?"":""+D.statusText,this.headers=new Headers(D.headers),this.url=D.url||"",this._initBody(B)}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 B=new Response(null,{status:0,statusText:""});return B.type="error",B};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(B,D){if(redirectStatuses.indexOf(D)===-1)throw new RangeError("Invalid status code");return new Response(null,{status:D,headers:{location:B}})};var DOMException=global$1.DOMException;try{new DOMException}catch{DOMException=function(D,R){this.message=D,this.name=R;var F=Error(D);this.stack=F.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$2(B,D){return new Promise(function(R,F){var G=new Request(B,D);if(G.signal&&G.signal.aborted)return F(new DOMException("Aborted","AbortError"));var j=new XMLHttpRequest;function U(){j.abort()}j.onload=function(){var Y={status:j.status,statusText:j.statusText,headers:parseHeaders(j.getAllResponseHeaders()||"")};Y.url="responseURL"in j?j.responseURL:Y.headers.get("X-Request-URL");var Q="response"in j?j.response:j.responseText;setTimeout(function(){R(new Response(Q,Y))},0)},j.onerror=function(){setTimeout(function(){F(new TypeError("Network request failed"))},0)},j.ontimeout=function(){setTimeout(function(){F(new TypeError("Network request failed"))},0)},j.onabort=function(){setTimeout(function(){F(new DOMException("Aborted","AbortError"))},0)};function W(Y){try{return Y===""&&global$1.location.href?global$1.location.href:Y}catch{return Y}}j.open(G.method,W(G.url),!0),G.credentials==="include"?j.withCredentials=!0:G.credentials==="omit"&&(j.withCredentials=!1),"responseType"in j&&(support.blob?j.responseType="blob":support.arrayBuffer&&G.headers.get("Content-Type")&&G.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(j.responseType="arraybuffer")),D&&typeof D.headers=="object"&&!(D.headers instanceof Headers)?Object.getOwnPropertyNames(D.headers).forEach(function(Y){j.setRequestHeader(Y,normalizeValue(D.headers[Y]))}):G.headers.forEach(function(Y,Q){j.setRequestHeader(Q,Y)}),G.signal&&(G.signal.addEventListener("abort",U),j.onreadystatechange=function(){j.readyState===4&&G.signal.removeEventListener("abort",U)}),j.send(typeof G._bodyInit=="undefined"?null:G._bodyInit)})}fetch$2.polyfill=!0;global$1.fetch||(global$1.fetch=fetch$2,global$1.Headers=Headers,global$1.Request=Request,global$1.Response=Response);self.fetch.bind(self);function _defineProperty(B,D,R){return D in B?Object.defineProperty(B,D,{value:R,enumerable:!0,configurable:!0,writable:!0}):B[D]=R,B}var defineProperty=_defineProperty;function _objectSpread(B){for(var D=1;D1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1,defaultInstance:!1},G=!1,j=!1,U=!1;if(typeof F=="number"?(process&&process.env,G=!0,j=!1):_typeof_1(F)==="object"&&F&&(j=F.global||!1,G=F.core||!1,U=F.defaultInstance||!1),j){B.globalMiddlewares.splice(B.globalMiddlewares.length-B.defaultGlobalMiddlewaresLength,0,R);return}if(G){B.coreMiddlewares.splice(B.coreMiddlewares.length-B.defaultCoreMiddlewaresLength,0,R);return}if(U){this.defaultMiddlewares.push(R);return}this.middlewares.push(R)}},{key:"execute",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,F=compose([].concat(toConsumableArray(this.middlewares),toConsumableArray(this.defaultMiddlewares),toConsumableArray(B.globalMiddlewares),toConsumableArray(B.coreMiddlewares)));return F(R)}}]),B}();Onion.globalMiddlewares=[];Onion.defaultGlobalMiddlewaresLength=0;Onion.coreMiddlewares=[];Onion.defaultCoreMiddlewaresLength=0;function _assertThisInitialized(B){if(B===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B}var assertThisInitialized=_assertThisInitialized;function _possibleConstructorReturn(B,D){return D&&(_typeof_1(D)==="object"||typeof D=="function")?D:assertThisInitialized(B)}var possibleConstructorReturn=_possibleConstructorReturn,getPrototypeOf=createCommonjsModule$1(function(B){function D(R){return B.exports=D=Object.setPrototypeOf?Object.getPrototypeOf:function(G){return G.__proto__||Object.getPrototypeOf(G)},D(R)}B.exports=D}),setPrototypeOf=createCommonjsModule$1(function(B){function D(R,F){return B.exports=D=Object.setPrototypeOf||function(j,U){return j.__proto__=U,j},D(R,F)}B.exports=D});function _inherits(B,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");B.prototype=Object.create(D&&D.prototype,{constructor:{value:B,writable:!0,configurable:!0}}),D&&setPrototypeOf(B,D)}var inherits=_inherits;function _isNativeFunction(B){return Function.toString.call(B).indexOf("[native code]")!==-1}var isNativeFunction=_isNativeFunction,construct=createCommonjsModule$1(function(B){function D(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function R(F,G,j){return D()?B.exports=R=Reflect.construct:B.exports=R=function(W,Y,Q){var Z=[null];Z.push.apply(Z,Y);var q=Function.bind.apply(W,Z),J=new q;return Q&&setPrototypeOf(J,Q.prototype),J},R.apply(null,arguments)}B.exports=R}),wrapNativeSuper=createCommonjsModule$1(function(B){function D(R){var F=typeof Map=="function"?new Map:void 0;return B.exports=D=function(j){if(j===null||!isNativeFunction(j))return j;if(typeof j!="function")throw new TypeError("Super expression must either be null or a function");if(typeof F!="undefined"){if(F.has(j))return F.get(j);F.set(j,U)}function U(){return construct(j,arguments,getPrototypeOf(this).constructor)}return U.prototype=Object.create(j.prototype,{constructor:{value:U,enumerable:!1,writable:!0,configurable:!0}}),setPrototypeOf(U,j)},D(R)}B.exports=D}),MapCache=function(){function B(D){classCallCheck(this,B),this.cache=new Map,this.timer={},this.extendOptions(D)}return createClass(B,[{key:"extendOptions",value:function(R){this.maxCache=R.maxCache||0}},{key:"get",value:function(R){return this.cache.get(JSON.stringify(R))}},{key:"set",value:function(R,F){var G=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var U=toConsumableArray(this.cache.keys())[0];this.cache.delete(U),this.timer[U]&&clearTimeout(this.timer[U])}var W=JSON.stringify(R);this.cache.set(W,F),j>0&&(this.timer[W]=setTimeout(function(){G.cache.delete(W),delete G.timer[W]},j))}},{key:"delete",value:function(R){var F=JSON.stringify(R);return delete this.timer[F],this.cache.delete(F)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),B}(),RequestError=function(B){inherits(D,B);function D(R,F){var G,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"RequestError";return classCallCheck(this,D),G=possibleConstructorReturn(this,getPrototypeOf(D).call(this,R)),G.name="RequestError",G.request=F,G.type=j,G}return D}(wrapNativeSuper(Error)),ResponseError=function(B){inherits(D,B);function D(R,F,G,j){var U,W=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"ResponseError";return classCallCheck(this,D),U=possibleConstructorReturn(this,getPrototypeOf(D).call(this,F||R.statusText)),U.name="ResponseError",U.data=G,U.response=R,U.request=j,U.type=W,U}return D}(wrapNativeSuper(Error));function readerGBK(B){return new Promise(function(D,R){var F=new FileReader;F.onload=function(){D(F.result)},F.onerror=R,F.readAsText(B,"GBK")})}function safeJsonParse(B){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,F=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;try{return JSON.parse(B)}catch{if(D)throw new ResponseError(R,"JSON.parse fail",B,F,"ParseError")}return B}function timeout2Throw(B,D){return new Promise(function(R,F){setTimeout(function(){F(new RequestError("timeout of ".concat(B,"ms exceeded"),D,"Timeout"))},B)})}function cancel2Throw(B){return new Promise(function(D,R){B.cancelToken&&B.cancelToken.promise.then(function(F){R(F)})})}var toString$2=Object.prototype.toString;function getEnv(){var B;return typeof process!="undefined"&&toString$2.call(process)==="[object process]"&&(B="NODE"),typeof XMLHttpRequest!="undefined"&&(B="BROWSER"),B}function isArray$1(B){return _typeof_1(B)==="object"&&Object.prototype.toString.call(B)==="[object Array]"}function isURLSearchParams(B){return typeof URLSearchParams!="undefined"&&B instanceof URLSearchParams}function isDate(B){return _typeof_1(B)==="object"&&Object.prototype.toString.call(B)==="[object Date]"}function isObject$1(B){return B!==null&&_typeof_1(B)==="object"}function forEach2ObjArr(B,D){if(!!B)if(_typeof_1(B)!=="object"&&(B=[B]),isArray$1(B))for(var R=0;R1&&arguments[1]!==void 0?arguments[1]:{},F=R.prefix,G=R.suffix;return F&&(D="".concat(F).concat(D)),G&&(D="".concat(D).concat(G)),{url:D,options:R}},warnedCoreType=!1;function __defaultValidateCache(B,D){var R=D.method,F=R===void 0?"get":R;return F.toLowerCase()==="get"}function fetchMiddleware(B,D){if(!B)return D();var R=B.req;R=R===void 0?{}:R;var F=R.options,G=F===void 0?{}:F,j=R.url,U=j===void 0?"":j,W=B.cache,Y=B.responseInterceptors,Q=G.timeout,Z=Q===void 0?0:Q,q=G.__umiRequestCoreType__,J=q===void 0?"normal":q,K=G.useCache,te=K===void 0?!1:K,ne=G.method,ie=ne===void 0?"get":ne,re=G.params,oe=G.ttl,le=G.validateCache,fe=le===void 0?__defaultValidateCache:le;if(J!=="normal")return process&&process.env,D();var he=fetch;if(!he)throw new Error("Global fetch not exist!");var ge=getEnv()==="BROWSER",ue=fe(U,G)&&te&≥if(ue){var me=W.get({url:U,params:re,method:ie});if(me)return me=me.clone(),me.useCache=!0,B.res=me,D()}var be;return Z>0?be=Promise.race([cancel2Throw(G),he(U,G),timeout2Throw(Z,B.req)]):be=Promise.race([cancel2Throw(G),he(U,G)]),Y.forEach(function(ve){be=be.then(function(pe){var ye=typeof pe.clone=="function"?pe.clone():pe;return ve(ye,G)})}),be.then(function(ve){if(ue&&ve.status===200){var pe=ve.clone();pe.useCache=!0,W.set({url:U,params:re,method:ie},pe,oe)}return B.res=ve,D()})}function parseResponseMiddleware(B,D){var R;return D().then(function(){if(!!B){var F=B.res,G=F===void 0?{}:F,j=B.req,U=j===void 0?{}:j,W=U||{},Y=W.options;Y=Y===void 0?{}:Y;var Q=Y.responseType,Z=Q===void 0?"json":Q,q=Y.charset,J=q===void 0?"utf8":q;Y.getResponse;var K=Y.throwErrIfParseFail,te=K===void 0?!1:K,ne=Y.parseResponse,ie=ne===void 0?!0:ne;if(!!ie&&!(!G||!G.clone)){if(R=getEnv()==="BROWSER"?G.clone():G,R.useCache=G.useCache||!1,J==="gbk")try{return G.blob().then(readerGBK).then(function(re){return safeJsonParse(re,!1,R,U)})}catch(re){throw new ResponseError(R,re.message,null,U,"ParseError")}else if(Z==="json")return G.text().then(function(re){return safeJsonParse(re,te,R,U)});try{return G[Z]()}catch{throw new ResponseError(R,"responseType not support",null,U,"ParseError")}}}}).then(function(F){if(!!B){B.res;var G=B.req,j=G===void 0?{}:G,U=j||{},W=U.options;W=W===void 0?{}:W;var Y=W.getResponse,Q=Y===void 0?!1:Y;if(!!R){if(R.status>=200&&R.status<300){if(Q){B.res={data:F,response:R};return}B.res=F;return}throw new ResponseError(R,"http error",F,j,"HttpError")}}}).catch(function(F){if(F instanceof RequestError||F instanceof ResponseError)throw F;var G=B.req,j=B.res;throw F.request=F.request||G,F.response=F.response||j,F.type=F.type||F.name,F.data=F.data||void 0,F})}function simplePostMiddleware(B,D){if(!B)return D();var R=B.req;R=R===void 0?{}:R;var F=R.options,G=F===void 0?{}:F,j=G.method,U=j===void 0?"get":j;if(["post","put","patch","delete"].indexOf(U.toLowerCase())===-1)return D();var W=G.requestType,Y=W===void 0?"json":W,Q=G.data;if(Q){var Z=Object.prototype.toString.call(Q);Z==="[object Object]"||Z==="[object Array]"?Y==="json"?(G.headers=objectSpread({Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},G.headers),G.body=JSON.stringify(Q)):Y==="form"&&(G.headers=objectSpread({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},G.headers),G.body=reqStringify(Q)):(G.headers=objectSpread({Accept:"application/json"},G.headers),G.body=Q)}return B.req.options=G,D()}function paramsSerialize(B,D){var R,F;if(B)if(D)R=D(B);else if(isURLSearchParams(B))R=B.toString();else if(isArray$1(B))F=[],forEach2ObjArr(B,function(j){j===null||typeof j=="undefined"?F.push(j):F.push(isObject$1(j)?JSON.stringify(j):j)}),R=reqStringify(F);else{F={},forEach2ObjArr(B,function(j,U){var W=j;j===null||typeof j=="undefined"?F[U]=j:isDate(j)?W=j.toISOString():isArray$1(j)?W=j:isObject$1(j)&&(W=JSON.stringify(j)),F[U]=W});var G=reqStringify(F);R=G}return R}function simpleGetMiddleware(B,D){if(!B)return D();var R=B.req;R=R===void 0?{}:R;var F=R.options,G=F===void 0?{}:F,j=G.paramsSerializer,U=G.params,W=B.req;W=W===void 0?{}:W;var Y=W.url,Q=Y===void 0?"":Y;G.method=G.method?G.method.toUpperCase():"GET",G.credentials=G.credentials||"same-origin";var Z=paramsSerialize(U,j);if(B.req.originUrl=Q,Z){var q=Q.indexOf("?")!==-1?"&":"?";B.req.url="".concat(Q).concat(q).concat(Z)}return B.req.options=G,D()}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 B(D){classCallCheck(this,B),this.onion=new Onion([]),this.fetchIndex=0,this.mapCache=new MapCache(D),this.initOptions=D,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return createClass(B,[{key:"use",value:function(R){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1};return this.onion.use(R,F),this}},{key:"extendOptions",value:function(R){this.initOptions=mergeRequestOptions(this.initOptions,R),this.mapCache.extendOptions(R)}},{key:"dealRequestInterceptors",value:function(R){var F=function(U,W){return U.then(function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return R.req.url=Y.url||R.req.url,R.req.options=Y.options||R.req.options,W(R.req.url,R.req.options)})},G=[].concat(toConsumableArray(B.requestInterceptors),toConsumableArray(this.instanceRequestInterceptors));return G.reduce(F,Promise.resolve()).then(function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return R.req.url=j.url||R.req.url,R.req.options=j.options||R.req.options,Promise.resolve()})}},{key:"request",value:function(R,F){var G=this,j=this.onion,U={req:{url:R,options:F},res:null,cache:this.mapCache,responseInterceptors:[].concat(toConsumableArray(B.responseInterceptors),toConsumableArray(this.instanceResponseInterceptors))};if(typeof R!="string")throw new Error("url MUST be a string");return new Promise(function(W,Y){G.dealRequestInterceptors(U).then(function(){return j.execute(U)}).then(function(){W(U.res)}).catch(function(Q){var Z=U.req.options.errorHandler;if(Z)try{var q=Z(Q);W(q)}catch(J){Y(J)}else Y(Q)})})}}],[{key:"requestUse",value:function(R){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof R!="function")throw new TypeError("Interceptor must be function!");F.global?B.requestInterceptors.push(R):this.instanceRequestInterceptors.push(R)}},{key:"responseUse",value:function(R){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof R!="function")throw new TypeError("Interceptor must be function!");F.global?B.responseInterceptors.push(R):this.instanceResponseInterceptors.push(R)}}]),B}();Core.requestInterceptors=[addfix];Core.responseInterceptors=[];function Cancel(B){this.message=B}Cancel.prototype.toString=function(){return this.message?"Cancel: ".concat(this.message):"Cancel"};Cancel.prototype.__CANCEL__=!0;function CancelToken(B){if(typeof B!="function")throw new TypeError("executor must be a function.");var D;this.promise=new Promise(function(G){D=G});var R=this;B(function(G){R.reason||(R.reason=new Cancel(G),D(R.reason))})}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};CancelToken.source=function(){var D,R=new CancelToken(function(G){D=G});return{token:R,cancel:D}};function isCancel(B){return!!(B&&B.__CANCEL__)}var request$1=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},R=new Core(D),F=function(U){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=mergeRequestOptions(R.initOptions,W);return R.request(U,Y)};F.use=R.use.bind(R),F.fetchIndex=R.fetchIndex,F.interceptors={request:{use:Core.requestUse.bind(R)},response:{use:Core.responseUse.bind(R)}};var G=["get","post","delete","put","patch","head","options","rpc"];return G.forEach(function(j){F[j]=function(U,W){return F(U,objectSpread({},W,{method:j}))}}),F.Cancel=Cancel,F.CancelToken=CancelToken,F.isCancel=isCancel,F.extendOptions=R.extendOptions.bind(R),F.middlewares={instance:R.onion.middlewares,defaultInstance:R.onion.defaultMiddlewares,global:Onion.globalMiddlewares,core:Onion.coreMiddlewares},F},extend$2=function(D){return request$1(D)};request$1({parseResponse:!1});var request$1$1=request$1({});function noop$2(){}var extend$1=Object.assign,inBrowser$1=typeof window!="undefined",unknownProp=null,truthProp={type:Boolean,default:!0};function get(B,D){var R=D.split("."),F=B;return R.forEach(G=>{var j;F=(j=F[G])!=null?j:""}),F}function pick(B,D,R){return D.reduce((F,G)=>((!R||B[G]!==void 0)&&(F[G]=B[G]),F),{})}function gen(B,D){return D?typeof D=="string"?" "+B+"--"+D:Array.isArray(D)?D.reduce((R,F)=>R+gen(B,F),""):Object.keys(D).reduce((R,F)=>R+(D[F]?gen(B,F):""),""):""}function createBEM(B){return function(D,R){return D&&typeof D!="string"&&(R=D,D=""),D=D?B+"__"+D:B,""+D+gen(D,R)}}var camelizeRE=/-(\w)/g;function camelize(B){return B.replace(camelizeRE,(D,R)=>R.toUpperCase())}function isDef$1(B){return B!=null}function isFunction$1(B){return typeof B=="function"}function isObject(B){return B!==null&&typeof B=="object"}function isPromise(B){return isObject(B)&&isFunction$1(B.then)&&isFunction$1(B.catch)}function isNumeric(B){return typeof B=="number"||/^\d+(\.\d+)?$/.test(B)}function isIOS$1(){return inBrowser$1?/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()):!1}var{hasOwnProperty:hasOwnProperty$1}=Object.prototype;function assignKey(B,D,R){var F=D[R];!isDef$1(F)||(!hasOwnProperty$1.call(B,R)||!isObject(F)?B[R]=F:B[R]=deepAssign(Object(B[R]),D[R]))}function deepAssign(B,D){return Object.keys(D).forEach(R=>{assignKey(B,D,R)}),B}var defaultMessages={name:"\u59D3\u540D",tel:"\u7535\u8BDD",save:"\u4FDD\u5B58",confirm:"\u786E\u8BA4",cancel:"\u53D6\u6D88",delete:"\u5220\u9664",complete:"\u5B8C\u6210",loading:"\u52A0\u8F7D\u4E2D...",telEmpty:"\u8BF7\u586B\u5199\u7535\u8BDD",nameEmpty:"\u8BF7\u586B\u5199\u59D3\u540D",nameInvalid:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u59D3\u540D",confirmDelete:"\u786E\u5B9A\u8981\u5220\u9664\u5417",telInvalid:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7",vanCalendar:{end:"\u7ED3\u675F",start:"\u5F00\u59CB",title:"\u65E5\u671F\u9009\u62E9",confirm:"\u786E\u5B9A",startEnd:"\u5F00\u59CB/\u7ED3\u675F",weekdays:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],monthTitle:(B,D)=>B+"\u5E74"+D+"\u6708",rangePrompt:B=>"\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 "+B+" \u5929"},vanCascader:{select:"\u8BF7\u9009\u62E9"},vanContactCard:{addText:"\u6DFB\u52A0\u8054\u7CFB\u4EBA"},vanContactList:{addText:"\u65B0\u5EFA\u8054\u7CFB\u4EBA"},vanPagination:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875"},vanPullRefresh:{pulling:"\u4E0B\u62C9\u5373\u53EF\u5237\u65B0...",loosing:"\u91CA\u653E\u5373\u53EF\u5237\u65B0..."},vanSubmitBar:{label:"\u5408\u8BA1\uFF1A"},vanCoupon:{unlimited:"\u65E0\u4F7F\u7528\u95E8\u69DB",discount:B=>B+"\u6298",condition:B=>"\u6EE1"+B+"\u5143\u53EF\u7528"},vanCouponCell:{title:"\u4F18\u60E0\u5238",tips:"\u6682\u65E0\u53EF\u7528",count:B=>B+"\u5F20\u53EF\u7528"},vanCouponList:{empty:"\u6682\u65E0\u4F18\u60E0\u5238",exchange:"\u5151\u6362",close:"\u4E0D\u4F7F\u7528\u4F18\u60E0\u5238",enable:"\u53EF\u7528",disabled:"\u4E0D\u53EF\u7528",placeholder:"\u8BF7\u8F93\u5165\u4F18\u60E0\u7801"},vanAddressEdit:{area:"\u5730\u533A",postal:"\u90AE\u653F\u7F16\u7801",areaEmpty:"\u8BF7\u9009\u62E9\u5730\u533A",addressEmpty:"\u8BF7\u586B\u5199\u8BE6\u7EC6\u5730\u5740",postalEmpty:"\u90AE\u653F\u7F16\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",defaultAddress:"\u8BBE\u4E3A\u9ED8\u8BA4\u6536\u8D27\u5730\u5740",telPlaceholder:"\u6536\u8D27\u4EBA\u624B\u673A\u53F7",namePlaceholder:"\u6536\u8D27\u4EBA\u59D3\u540D",areaPlaceholder:"\u9009\u62E9\u7701 / \u5E02 / \u533A"},vanAddressEditDetail:{label:"\u8BE6\u7EC6\u5730\u5740",placeholder:"\u8857\u9053\u95E8\u724C\u3001\u697C\u5C42\u623F\u95F4\u53F7\u7B49\u4FE1\u606F"},vanAddressList:{add:"\u65B0\u589E\u5730\u5740"}},lang=ref("zh-CN"),messages=reactive({"zh-CN":defaultMessages}),Locale={messages(){return messages[lang.value]},use(B,D){lang.value=B,this.add({[B]:D})},add(B={}){deepAssign(messages,B)}},locale=Locale;function createTranslate(B){var D=camelize(B)+".";return function(R,...F){var G=locale.messages(),j=get(G,D+R)||get(G,R);return isFunction$1(j)?j(...F):j}}function createNamespace(B){var D="van-"+B;return[D,createBEM(D),createTranslate(D)]}function withInstall(B){return B.install=D=>{var{name:R}=B;D.component(R,B),D.component(camelize("-"+R),B)},B}function addUnit(B){if(!!isDef$1(B))return isNumeric(B)?B+"px":String(B)}function getSizeStyle(B){if(isDef$1(B)){var D=addUnit(B);return{width:D,height:D}}}function getZIndexStyle(B){var D={};return B!==void 0&&(D.zIndex=+B),D}var rootFontSize;function getRootFontSize(){if(!rootFontSize){var B=document.documentElement,D=B.style.fontSize||window.getComputedStyle(B).fontSize;rootFontSize=parseFloat(D)}return rootFontSize}function convertRem(B){return B=B.replace(/rem/g,""),+B*getRootFontSize()}function convertVw(B){return B=B.replace(/vw/g,""),+B*window.innerWidth/100}function convertVh(B){return B=B.replace(/vh/g,""),+B*window.innerHeight/100}function unitToPx(B){if(typeof B=="number")return B;if(inBrowser$1){if(B.includes("rem"))return convertRem(B);if(B.includes("vw"))return convertVw(B);if(B.includes("vh"))return convertVh(B)}return parseFloat(B)}function clamp(B,D,R){return Math.min(Math.max(B,D),R)}function trimExtraChar(B,D,R){var F=B.indexOf(D);return F===-1?B:D==="-"&&F!==0?B.slice(0,F):B.slice(0,F+1)+B.slice(F).replace(R,"")}function formatNumber(B,D=!0,R=!0){D?B=trimExtraChar(B,".",/\./g):B=B.split(".")[0],R?B=trimExtraChar(B,"-",/-/g):B=B.replace(/-/,"");var F=D?/[^-0-9.]/g:/[^-0-9]/g;return B.replace(F,"")}function addNumber(B,D){var R=Math.pow(10,10);return Math.round((B+D)*R)/R}function isHidden(B){var D=unref(B);if(!D)return!1;var R=window.getComputedStyle(D),F=R.display==="none",G=D.offsetParent===null&&R.position!=="fixed";return F||G}function stopPropagation(B){B.stopPropagation()}function preventDefault(B,D){(typeof B.cancelable!="boolean"||B.cancelable)&&B.preventDefault(),D&&stopPropagation(B)}function trigger(B,D){var R=document.createEvent("HTMLEvents");R.initEvent(D,!0,!0),B.dispatchEvent(R)}function isWindow$1(B){return B===window}function getScrollTop(B){var D="scrollTop"in B?B.scrollTop:B.pageYOffset;return Math.max(D,0)}function setScrollTop(B,D){"scrollTop"in B?B.scrollTop=D:B.scrollTo(B.scrollX,D)}function getRootScrollTop(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function setRootScrollTop(B){setScrollTop(window,B),setScrollTop(document.body,B)}function getElementTop(B,D){if(isWindow$1(B))return 0;var R=D?getScrollTop(D):getRootScrollTop();return B.getBoundingClientRect().top+R}function getVisibleHeight(B){return isWindow$1(B)?B.innerHeight:B.getBoundingClientRect().height}function getVisibleTop(B){return isWindow$1(B)?0:B.getBoundingClientRect().top}var isIOS=isIOS$1();function resetScroll(){isIOS&&setRootScrollTop(getRootScrollTop())}const inBrowser=typeof window!="undefined";function raf$2(B){return inBrowser?requestAnimationFrame(B):-1}function cancelRaf(B){inBrowser&&cancelAnimationFrame(B)}function doubleRaf(B){raf$2(()=>raf$2(B))}const isWindow=B=>B===window,makeDOMRect=(B,D)=>({top:0,left:0,right:B,bottom:D,width:B,height:D}),useRect=B=>{const D=unref(B);if(isWindow(D)){const R=D.innerWidth,F=D.innerHeight;return makeDOMRect(R,F)}return D!=null&&D.getBoundingClientRect?D.getBoundingClientRect():makeDOMRect(0,0)};function useToggle(B=!1){const D=ref(B);return[D,(F=!D.value)=>{D.value=F}]}function useParent(B){const D=inject(B,null);if(D){const R=getCurrentInstance(),{link:F,unlink:G,internalChildren:j}=D;F(R),onUnmounted(()=>G(R));const U=computed(()=>j.indexOf(R));return{parent:D,index:U}}return{parent:null,index:ref(-1)}}function flattenVNodes(B){const D=[],R=F=>{Array.isArray(F)&&F.forEach(G=>{var j;isVNode(G)&&(D.push(G),(j=G.component)!=null&&j.subTree&&R(G.component.subTree.children),G.children&&R(G.children))})};return R(B),D}function sortChildren(B,D,R){const F=flattenVNodes(B.subTree.children);R.sort((j,U)=>F.indexOf(j.vnode)-F.indexOf(U.vnode));const G=R.map(j=>j.proxy);D.sort((j,U)=>{const W=G.indexOf(j),Y=G.indexOf(U);return W-Y})}function useChildren(B){const D=reactive([]),R=reactive([]),F=getCurrentInstance();return{children:D,linkChildren:j=>{provide(B,Object.assign({link:Y=>{Y.proxy&&(R.push(Y),D.push(Y.proxy),sortChildren(F,D,R))},unlink:Y=>{const Q=R.indexOf(Y);D.splice(Q,1),R.splice(Q,1)},children:D,internalChildren:R},j))}}}function onMountedOrActivated(B){let D;onMounted(()=>{B(),nextTick(()=>{D=!0})}),onActivated(()=>{D&&B()})}function useEventListener(B,D,R={}){if(!inBrowser)return;const{target:F=window,passive:G=!1,capture:j=!1}=R;let U;const W=Q=>{const Z=unref(Q);Z&&!U&&(Z.addEventListener(B,D,{capture:j,passive:G}),U=!0)},Y=Q=>{const Z=unref(Q);Z&&U&&(Z.removeEventListener(B,D,j),U=!1)};onUnmounted(()=>Y(F)),onDeactivated(()=>Y(F)),onMountedOrActivated(()=>W(F)),isRef(F)&&watch(F,(Q,Z)=>{Y(Z),W(Q)})}function useClickAway(B,D,R={}){if(!inBrowser)return;const{eventName:F="click"}=R;useEventListener(F,j=>{const U=unref(B);U&&!U.contains(j.target)&&D(j)},{target:document})}let width,height;function useWindowSize(){if(!width&&(width=ref(0),height=ref(0),inBrowser)){const B=()=>{width.value=window.innerWidth,height.value=window.innerHeight};B(),window.addEventListener("resize",B,{passive:!0}),window.addEventListener("orientationchange",B,{passive:!0})}return{width,height}}const overflowScrollReg=/scroll|auto/i,defaultRoot=inBrowser?window:void 0;function isElement$1(B){return B.tagName!=="HTML"&&B.tagName!=="BODY"&&B.nodeType===1}function getScrollParent$1(B,D=defaultRoot){let R=B;for(;R&&R!==D&&isElement$1(R);){const{overflowY:F}=window.getComputedStyle(R);if(overflowScrollReg.test(F))return R;R=R.parentNode}return D}function useScrollParent(B,D=defaultRoot){const R=ref();return onMounted(()=>{B.value&&(R.value=getScrollParent$1(B.value,D))}),R}let visibility;function usePageVisibility(){if(!visibility&&(visibility=ref("visible"),inBrowser)){const B=()=>{visibility.value=document.hidden?"hidden":"visible"};B(),window.addEventListener("visibilitychange",B)}return visibility}var[name$x,bem$x]=createNamespace("action-bar"),ACTION_BAR_KEY=Symbol(name$x),_ActionBar=defineComponent({name:name$x,props:{safeAreaInsetBottom:truthProp},setup(B,{slots:D}){var{linkChildren:R}=useChildren(ACTION_BAR_KEY);return R(),()=>createVNode("div",{class:bem$x({unfit:!B.safeAreaInsetBottom})},[D.default==null?void 0:D.default()])}}),ActionBar=withInstall(_ActionBar);function useExpose(B){var D=getCurrentInstance();D&&extend$1(D.proxy,B)}var routeProps={to:[String,Object],url:String,replace:Boolean};function route(B){var D=B.$router,{to:R,url:F,replace:G}=B;R&&D?D[G?"replace":"push"](R):F&&(G?location.replace(F):location.href=F)}function useRoute(){var B=getCurrentInstance().proxy;return()=>route(B)}var BORDER="van-hairline",BORDER_TOP=BORDER+"--top",BORDER_LEFT=BORDER+"--left",BORDER_BOTTOM=BORDER+"--bottom",BORDER_SURROUND=BORDER+"--surround",BORDER_TOP_BOTTOM=BORDER+"--top-bottom",BORDER_UNSET_TOP_BOTTOM=BORDER+"-unset--top-bottom",[name$w,bem$w]=createNamespace("badge"),_Badge=defineComponent({name:name$w,props:{dot:Boolean,max:[Number,String],color:String,offset:Array,content:[Number,String],showZero:truthProp,tag:{type:String,default:"div"}},setup(B,{slots:D}){var R=()=>{if(D.content)return!0;var{content:j,showZero:U}=B;return isDef$1(j)&&j!==""&&(U||j!==0)},F=()=>{var{dot:j,max:U,content:W}=B;if(!j&&R())return D.content?D.content():isDef$1(U)&&isNumeric(W)&&+W>U?U+"+":W},G=()=>{if(R()||B.dot){var j={background:B.color};if(B.offset){var[U,W]=B.offset;D.default?(j.top=addUnit(W),j.right="-"+addUnit(U)):(j.marginTop=addUnit(W),j.marginLeft=addUnit(U))}return createVNode("div",{class:bem$w({dot:B.dot,fixed:!!D.default}),style:j},[F()])}};return()=>{if(D.default){var{tag:j}=B;return createVNode(j,{class:bem$w("wrapper")},{default:()=>[D.default(),G()]})}return G()}}}),Badge=withInstall(_Badge),[name$v,bem$v]=createNamespace("icon");function isImage(B){return B?B.includes("/"):!1}var _Icon=defineComponent({name:name$v,props:{dot:Boolean,name:String,size:[Number,String],badge:[Number,String],color:String,tag:{type:String,default:"i"},classPrefix:{type:String,default:bem$v()}},setup(B,{slots:D}){return()=>{var{tag:R,dot:F,name:G,size:j,badge:U,color:W,classPrefix:Y}=B,Q=isImage(G);return createVNode(Badge,{dot:F,tag:R,content:U,class:[Y,Q?"":Y+"-"+G],style:{color:W,fontSize:addUnit(j)}},{default:()=>[D.default==null?void 0:D.default(),Q&&createVNode("img",{class:bem$v("image"),src:G},null)]})}}}),Icon=withInstall(_Icon),[name$u,bem$u]=createNamespace("loading"),SpinIcon=Array(12).fill(createVNode("i",null,null)),CircularIcon=createVNode("svg",{class:bem$u("circular"),viewBox:"25 25 50 50"},[createVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),_Loading=defineComponent({name:name$u,props:{size:[Number,String],color:String,vertical:Boolean,textSize:[Number,String],textColor:String,type:{type:String,default:"circular"}},setup(B,{slots:D}){var R=computed(()=>extend$1({color:B.color},getSizeStyle(B.size))),F=()=>{if(D.default){var G;return createVNode("span",{class:bem$u("text"),style:{fontSize:addUnit(B.textSize),color:(G=B.textColor)!=null?G:B.color}},[D.default()])}};return()=>{var{type:G,vertical:j}=B;return createVNode("div",{class:bem$u([G,{vertical:j}])},[createVNode("span",{class:bem$u("spinner",G),style:R.value},[G==="spinner"?SpinIcon:CircularIcon]),F()])}}}),Loading=withInstall(_Loading),[name$t,bem$t]=createNamespace("button"),_Button=defineComponent({name:name$t,props:extend$1({},routeProps,{text:String,icon:String,color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,loadingSize:String,loadingText:String,loadingType:String,tag:{type:String,default:"button"},type:{type:String,default:"default"},size:{type:String,default:"normal"},nativeType:{type:String,default:"button"},iconPosition:{type:String,default:"left"}}),emits:["click"],setup(B,{emit:D,slots:R}){var F=useRoute(),G=()=>R.loading?R.loading():createVNode(Loading,{size:B.loadingSize,type:B.loadingType,class:bem$t("loading")},null),j=()=>{if(B.loading)return G();if(R.icon)return createVNode("div",{class:bem$t("icon")},[R.icon()]);if(B.icon)return createVNode(Icon,{name:B.icon,class:bem$t("icon"),classPrefix:B.iconPrefix},null)},U=()=>{var Q;if(B.loading?Q=B.loadingText:Q=R.default?R.default():B.text,Q)return createVNode("span",{class:bem$t("text")},[Q])},W=()=>{var{color:Q,plain:Z}=B;if(Q){var q={color:Z?Q:"white"};return Z||(q.background=Q),Q.includes("gradient")?q.border=0:q.borderColor=Q,q}},Y=Q=>{B.loading?Q.preventDefault():B.disabled||(D("click",Q),F())};return()=>{var{tag:Q,type:Z,size:q,block:J,round:K,plain:te,square:ne,loading:ie,disabled:re,hairline:oe,nativeType:le,iconPosition:fe}=B,he=[bem$t([Z,q,{plain:te,block:J,round:K,square:ne,loading:ie,disabled:re,hairline:oe}]),{[BORDER_SURROUND]:oe}];return createVNode(Q,{type:le,class:he,style:W(),disabled:re,onClick:Y},{default:()=>[createVNode("div",{class:bem$t("content")},[fe==="left"&&j(),U(),fe==="right"&&j()])]})}}}),Button=withInstall(_Button),[name$s,bem$s]=createNamespace("action-bar-button"),_ActionBarButton=defineComponent({name:name$s,props:extend$1({},routeProps,{type:String,text:String,icon:String,color:String,loading:Boolean,disabled:Boolean}),setup(B,{slots:D}){var R=useRoute(),{parent:F,index:G}=useParent(ACTION_BAR_KEY),j=computed(()=>{if(F){var W=F.children[G.value-1];return!(W&&"isButton"in W)}}),U=computed(()=>{if(F){var W=F.children[G.value+1];return!(W&&"isButton"in W)}});return useExpose({isButton:!0}),()=>{var{type:W,icon:Y,text:Q,color:Z,loading:q,disabled:J}=B;return createVNode(Button,{class:bem$s([W,{last:U.value,first:j.value}]),size:"large",type:W,icon:Y,color:Z,loading:q,disabled:J,onClick:R},{default:()=>[D.default?D.default():Q]})}}}),ActionBarButton=withInstall(_ActionBarButton),popupSharedProps={show:Boolean,zIndex:[Number,String],overlay:truthProp,duration:[Number,String],teleport:[String,Object],lockScroll:truthProp,lazyRender:truthProp,overlayStyle:Object,overlayClass:unknownProp,transitionAppear:Boolean,closeOnClickOverlay:truthProp},popupSharedPropKeys=Object.keys(popupSharedProps),MIN_DISTANCE=10;function getDirection(B,D){return B>D&&B>MIN_DISTANCE?"horizontal":D>B&&D>MIN_DISTANCE?"vertical":""}function useTouch(){var B=ref(0),D=ref(0),R=ref(0),F=ref(0),G=ref(0),j=ref(0),U=ref(""),W=()=>U.value==="vertical",Y=()=>U.value==="horizontal",Q=()=>{R.value=0,F.value=0,G.value=0,j.value=0,U.value=""},Z=J=>{Q(),B.value=J.touches[0].clientX,D.value=J.touches[0].clientY},q=J=>{var K=J.touches[0];R.value=K.clientX<0?0:K.clientX-B.value,F.value=K.clientY-D.value,G.value=Math.abs(R.value),j.value=Math.abs(F.value),U.value||(U.value=getDirection(G.value,j.value))};return{move:q,start:Z,reset:Q,startX:B,startY:D,deltaX:R,deltaY:F,offsetX:G,offsetY:j,direction:U,isVertical:W,isHorizontal:Y}}var totalLockCount=0,BODY_LOCK_CLASS="van-overflow-hidden";function useLockScroll(B,D){var R=useTouch(),F=Y=>{R.move(Y);var Q=R.deltaY.value>0?"10":"01",Z=getScrollParent$1(Y.target,B.value),{scrollHeight:q,offsetHeight:J,scrollTop:K}=Z,te="11";K===0?te=J>=q?"00":"01":K+J>=q&&(te="10"),te!=="11"&&R.isVertical()&&!(parseInt(te,2)&parseInt(Q,2))&&preventDefault(Y,!0)},G=()=>{document.addEventListener("touchstart",R.start),document.addEventListener("touchmove",F,{passive:!1}),totalLockCount||document.body.classList.add(BODY_LOCK_CLASS),totalLockCount++},j=()=>{totalLockCount&&(document.removeEventListener("touchstart",R.start),document.removeEventListener("touchmove",F),totalLockCount--,totalLockCount||document.body.classList.remove(BODY_LOCK_CLASS))},U=()=>{D()&&G()},W=()=>{D()&&j()};onMountedOrActivated(U),onDeactivated(W),onBeforeUnmount(W),watch(D,Y=>{Y?G():j()})}function useLazyRender(B){var D=ref(!1);return watch(B,R=>{R&&(D.value=R)},{immediate:!0}),R=>()=>D.value?R():null}var POPUP_TOGGLE_KEY=Symbol();function onPopupReopen(B){var D=inject(POPUP_TOGGLE_KEY,null);D&&watch(D,R=>{R&&B()})}var[name$r,bem$r]=createNamespace("overlay"),_Overlay=defineComponent({name:name$r,props:{show:Boolean,zIndex:[Number,String],duration:[Number,String],className:unknownProp,lockScroll:truthProp,customStyle:Object},setup(B,{slots:D}){var R=useLazyRender(()=>B.show),F=j=>{preventDefault(j,!0)},G=R(()=>{var j=extend$1(getZIndexStyle(B.zIndex),B.customStyle);return isDef$1(B.duration)&&(j.animationDuration=B.duration+"s"),withDirectives(createVNode("div",{style:j,class:[bem$r(),B.className],onTouchmove:B.lockScroll?F:noop$2},[D.default==null?void 0:D.default()]),[[vShow,B.show]])});return()=>createVNode(Transition,{name:"van-fade"},{default:()=>[G()]})}}),Overlay=withInstall(_Overlay),[name$q,bem$q]=createNamespace("popup"),globalZIndex=2e3,_Popup=defineComponent({name:name$q,inheritAttrs:!1,props:extend$1({},popupSharedProps,{round:Boolean,closeable:Boolean,transition:String,iconPrefix:String,closeOnPopstate:Boolean,safeAreaInsetBottom:Boolean,position:{type:String,default:"center"},closeIcon:{type:String,default:"cross"},closeIconPosition:{type:String,default:"top-right"}}),emits:["open","close","click","opened","closed","update:show","click-overlay","click-close-icon"],setup(B,{emit:D,attrs:R,slots:F}){var G,j,U=ref(),W=ref(),Y=useLazyRender(()=>B.show||!B.lazyRender),Q=computed(()=>{var he={zIndex:U.value};if(isDef$1(B.duration)){var ge=B.position==="center"?"animationDuration":"transitionDuration";he[ge]=B.duration+"s"}return he}),Z=()=>{G||(B.zIndex!==void 0&&(globalZIndex=+B.zIndex),G=!0,U.value=++globalZIndex)},q=()=>{G&&(G=!1,D("update:show",!1))},J=he=>{D("click-overlay",he),B.closeOnClickOverlay&&q()},K=()=>{if(B.overlay)return createVNode(Overlay,{show:B.show,class:B.overlayClass,zIndex:U.value,duration:B.duration,customStyle:B.overlayStyle,onClick:J},{default:F["overlay-content"]})},te=he=>{D("click-close-icon",he),q()},ne=()=>{if(B.closeable)return createVNode(Icon,{role:"button",tabindex:0,name:B.closeIcon,class:bem$q("close-icon",B.closeIconPosition),classPrefix:B.iconPrefix,onClick:te},null)},ie=he=>D("click",he),re=()=>D("opened"),oe=()=>D("closed"),le=Y(()=>{var{round:he,position:ge,safeAreaInsetBottom:ue}=B;return withDirectives(createVNode("div",mergeProps({ref:W,style:Q.value,class:bem$q({round:he,[ge]:ge,"safe-area-inset-bottom":ue}),onClick:ie},R),[F.default==null?void 0:F.default(),ne()]),[[vShow,B.show]])}),fe=()=>{var{position:he,transition:ge,transitionAppear:ue}=B,me=he==="center"?"van-fade":"van-popup-slide-"+he;return createVNode(Transition,{name:ge||me,appear:ue,onAfterEnter:re,onAfterLeave:oe},{default:()=>[le()]})};return watch(()=>B.show,he=>{he?(Z(),D("open")):(q(),D("close"))}),useExpose({popupRef:W}),useLockScroll(W,()=>B.show&&B.lockScroll),useEventListener("popstate",()=>{B.closeOnPopstate&&(q(),j=!1)}),onMounted(()=>{B.show&&Z()}),onActivated(()=>{j&&(D("update:show",!0),j=!1)}),onDeactivated(()=>{B.show&&(q(),j=!0)}),provide(POPUP_TOGGLE_KEY,()=>B.show),()=>B.teleport?createVNode(Teleport,{to:B.teleport},{default:()=>[K(),fe()]}):createVNode(Fragment,null,[K(),fe()])}}),Popup=withInstall(_Popup),[name$p,bem$p]=createNamespace("cell"),cellProps={icon:String,size:String,title:[Number,String],value:[Number,String],label:[Number,String],center:Boolean,isLink:Boolean,border:truthProp,required:Boolean,iconPrefix:String,valueClass:unknownProp,labelClass:unknownProp,titleClass:unknownProp,titleStyle:null,arrowDirection:String,clickable:{type:Boolean,default:null}},_Cell=defineComponent({name:name$p,props:extend$1({},cellProps,routeProps),setup(B,{slots:D}){var R=useRoute(),F=()=>{var Y=D.label||isDef$1(B.label);if(Y)return createVNode("div",{class:[bem$p("label"),B.labelClass]},[D.label?D.label():B.label])},G=()=>{if(D.title||isDef$1(B.title))return createVNode("div",{class:[bem$p("title"),B.titleClass],style:B.titleStyle},[D.title?D.title():createVNode("span",null,[B.title]),F()])},j=()=>{var Y=D.default||isDef$1(B.value);if(Y){var Q=D.title||isDef$1(B.title);return createVNode("div",{class:[bem$p("value",{alone:!Q}),B.valueClass]},[D.default?D.default():createVNode("span",null,[B.value])])}},U=()=>{if(D.icon)return D.icon();if(B.icon)return createVNode(Icon,{name:B.icon,class:bem$p("left-icon"),classPrefix:B.iconPrefix},null)},W=()=>{if(D["right-icon"])return D["right-icon"]();if(B.isLink){var Y=B.arrowDirection?"arrow-"+B.arrowDirection:"arrow";return createVNode(Icon,{name:Y,class:bem$p("right-icon")},null)}};return()=>{var Y,{size:Q,center:Z,border:q,isLink:J,required:K}=B,te=(Y=B.clickable)!=null?Y:J,ne={center:Z,required:K,clickable:te,borderless:!q};return Q&&(ne[Q]=!!Q),createVNode("div",{class:bem$p(ne),role:te?"button":void 0,tabindex:te?0:void 0,onClick:R},[U(),G(),j(),W(),D.extra==null?void 0:D.extra()])}}}),Cell=withInstall(_Cell);function isEmptyValue(B){return Array.isArray(B)?!B.length:B===0?!1:!B}function runSyncRule(B,D){return!(D.required&&isEmptyValue(B)||D.pattern&&!D.pattern.test(String(B)))}function runRuleValidator(B,D){return new Promise(R=>{var F=D.validator(B,D);if(isPromise(F))return F.then(R);R(F)})}function getRuleMessage(B,D){var{message:R}=D;return isFunction$1(R)?R(B,D):R||""}function startComposing(B){B.target.composing=!0}function endComposing(B){var{target:D}=B;D.composing&&(D.composing=!1,trigger(D,"input"))}function resizeTextarea(B,D){B.style.height="auto";var R=B.scrollHeight;if(isObject(D)){var{maxHeight:F,minHeight:G}=D;F!==void 0&&(R=Math.min(R,F)),G!==void 0&&(R=Math.max(R,G))}R&&(B.style.height=R+"px")}function mapInputType(B){return B==="number"?{type:"text",inputmode:"decimal"}:B==="digit"?{type:"tel",inputmode:"numeric"}:{type:B}}var FORM_KEY=Symbol("van-form"),FIELD_KEY=Symbol("van-field");function useLinkField(B){var D=inject(FIELD_KEY,null);D&&!D.childFieldValue.value&&(D.childFieldValue.value=B,watch(B,()=>{D.resetValidation(),D.validateWithTrigger("onChange")}))}var[name$o,bem$o]=createNamespace("field"),fieldProps={formatter:Function,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:[Number,String],inputAlign:String,placeholder:String,errorMessage:String,error:{type:Boolean,default:null},disabled:{type:Boolean,default:null},readonly:{type:Boolean,default:null},clearIcon:{type:String,default:"clear"},modelValue:{type:[Number,String],default:""},clearTrigger:{type:String,default:"focus"},formatTrigger:{type:String,default:"onChange"}},_Field=defineComponent({name:name$o,props:extend$1({},cellProps,fieldProps,{rows:[Number,String],name:String,rules:Array,autosize:[Boolean,Object],labelWidth:[Number,String],labelClass:unknownProp,labelAlign:String,autocomplete:String,showWordLimit:Boolean,errorMessageAlign:String,type:{type:String,default:"text"},colon:{type:Boolean,default:null}}),emits:["blur","focus","clear","keypress","click-input","click-left-icon","click-right-icon","update:modelValue"],setup(B,{emit:D,slots:R}){var F=reactive({focused:!1,validateFailed:!1,validateMessage:""}),G=ref(),j=ref(),{parent:U}=useParent(FORM_KEY),W=()=>{var Pe;return String((Pe=B.modelValue)!=null?Pe:"")},Y=Pe=>{if(isDef$1(B[Pe]))return B[Pe];if(U&&isDef$1(U.props[Pe]))return U.props[Pe]},Q=computed(()=>{var Pe=Y("readonly");if(B.clearable&&!Pe){var Me=W()!=="",Se=B.clearTrigger==="always"||B.clearTrigger==="focus"&&F.focused;return Me&&Se}return!1}),Z=computed(()=>j.value&&R.input?j.value():B.modelValue),q=Pe=>Pe.reduce((Me,Se)=>Me.then(()=>{if(!F.validateFailed){var{value:Le}=Z;if(Se.formatter&&(Le=Se.formatter(Le,Se)),!runSyncRule(Le,Se)){F.validateFailed=!0,F.validateMessage=getRuleMessage(Le,Se);return}if(Se.validator)return runRuleValidator(Le,Se).then(ze=>{ze&&typeof ze=="string"?(F.validateFailed=!0,F.validateMessage=ze):ze===!1&&(F.validateFailed=!0,F.validateMessage=getRuleMessage(Le,Se))})}}),Promise.resolve()),J=()=>{F.validateFailed&&(F.validateFailed=!1,F.validateMessage="")},K=(Pe=B.rules)=>new Promise(Me=>{J(),Pe?q(Pe).then(()=>{F.validateFailed?Me({name:B.name,message:F.validateMessage}):Me()}):Me()}),te=Pe=>{if(U&&B.rules){var Me=U.props.validateTrigger===Pe,Se=B.rules.filter(Le=>Le.trigger?Le.trigger===Pe:Me);Se.length&&K(Se)}},ne=Pe=>{var{maxlength:Me}=B;if(isDef$1(Me)&&Pe.length>Me){var Se=W();return Se&&Se.length===+Me?Se:Pe.slice(0,+Me)}return Pe},ie=(Pe,Me="onChange")=>{if(Pe=ne(Pe),B.type==="number"||B.type==="digit"){var Se=B.type==="number";Pe=formatNumber(Pe,Se,Se)}B.formatter&&Me===B.formatTrigger&&(Pe=B.formatter(Pe)),G.value&&G.value.value!==Pe&&(G.value.value=Pe),Pe!==B.modelValue&&D("update:modelValue",Pe)},re=Pe=>{Pe.target.composing||ie(Pe.target.value)},oe=()=>{var Pe;return(Pe=G.value)==null?void 0:Pe.blur()},le=()=>{var Pe;return(Pe=G.value)==null?void 0:Pe.focus()},fe=Pe=>{F.focused=!0,D("focus",Pe);var Me=Y("readonly");Me&&oe()},he=Pe=>{F.focused=!1,ie(W(),"onBlur"),D("blur",Pe),te("onBlur"),resetScroll()},ge=Pe=>D("click-input",Pe),ue=Pe=>D("click-left-icon",Pe),me=Pe=>D("click-right-icon",Pe),be=Pe=>{preventDefault(Pe),D("update:modelValue",""),D("clear",Pe)},ve=computed(()=>{if(typeof B.error=="boolean")return B.error;if(U&&U.props.showError&&F.validateFailed)return!0}),pe=computed(()=>{var Pe=Y("labelWidth");if(Pe)return{width:addUnit(Pe)}}),ye=Pe=>{var Me=13;if(Pe.keyCode===Me){var Se=U&&U.props.submitOnEnter;!Se&&B.type!=="textarea"&&preventDefault(Pe),B.type==="search"&&oe()}D("keypress",Pe)},xe=()=>{var Pe=G.value;B.type==="textarea"&&B.autosize&&Pe&&resizeTextarea(Pe,B.autosize)},ce=()=>{var Pe=Y("inputAlign");if(R.input)return createVNode("div",{class:bem$o("control",[Pe,"custom"]),onClick:ge},[R.input()]);var Me={ref:G,name:B.name,rows:B.rows!==void 0?+B.rows:void 0,class:bem$o("control",Pe),value:B.modelValue,disabled:Y("disabled"),readonly:Y("readonly"),autofocus:B.autofocus,placeholder:B.placeholder,autocomplete:B.autocomplete,onBlur:he,onFocus:fe,onInput:re,onClick:ge,onChange:endComposing,onKeypress:ye,onCompositionend:endComposing,onCompositionstart:startComposing};return B.type==="textarea"?createVNode("textarea",Me,null):createVNode("input",mergeProps(mapInputType(B.type),Me),null)},we=()=>{var Pe=R["left-icon"];if(B.leftIcon||Pe)return createVNode("div",{class:bem$o("left-icon"),onClick:ue},[Pe?Pe():createVNode(Icon,{name:B.leftIcon,classPrefix:B.iconPrefix},null)])},Be=()=>{var Pe=R["right-icon"];if(B.rightIcon||Pe)return createVNode("div",{class:bem$o("right-icon"),onClick:me},[Pe?Pe():createVNode(Icon,{name:B.rightIcon,classPrefix:B.iconPrefix},null)])},Ae=()=>{if(B.showWordLimit&&B.maxlength){var Pe=W().length;return createVNode("div",{class:bem$o("word-limit")},[createVNode("span",{class:bem$o("word-num")},[Pe]),createTextVNode("/"),B.maxlength])}},Te=()=>{if(!(U&&U.props.showErrorMessage===!1)){var Pe=B.errorMessage||F.validateMessage;if(Pe){var Me=Y("errorMessageAlign");return createVNode("div",{class:bem$o("error-message",Me)},[Pe])}}},Ne=()=>{var Pe=Y("colon")?":":"";if(R.label)return[R.label(),Pe];if(B.label)return createVNode("span",null,[B.label+Pe])};return useExpose({blur:oe,focus:le,validate:K,formValue:Z,resetValidation:J}),provide(FIELD_KEY,{childFieldValue:j,resetValidation:J,validateWithTrigger:te}),watch(()=>B.modelValue,()=>{ie(W()),J(),te("onChange"),nextTick(xe)}),onMounted(()=>{ie(W(),B.formatTrigger),nextTick(xe)}),()=>{var Pe=Y("disabled"),Me=Y("labelAlign"),Se=Ne(),Le=we();return createVNode(Cell,{size:B.size,icon:B.leftIcon,class:bem$o({error:ve.value,disabled:Pe,["label-"+Me]:Me,"min-height":B.type==="textarea"&&!B.autosize}),center:B.center,border:B.border,isLink:B.isLink,required:B.required,clickable:B.clickable,titleStyle:pe.value,valueClass:bem$o("value"),titleClass:[bem$o("label",Me),B.labelClass],arrowDirection:B.arrowDirection},{default:()=>[createVNode("div",{class:bem$o("body")},[ce(),Q.value&&createVNode(Icon,{name:B.clearIcon,class:bem$o("clear"),onTouchstart:be},null),Be(),R.button&&createVNode("div",{class:bem$o("button")},[R.button()])]),Ae(),Te()],icon:Le?()=>Le:null,title:Se?()=>Se:null,extra:R.extra})}}}),Field=withInstall(_Field);function usePopupState(){var B=reactive({show:!1}),D=G=>{B.show=G},R=G=>{extend$1(B,G),nextTick(()=>D(!0))},F=()=>D(!1);return useExpose({open:R,close:F,toggle:D}),{open:R,close:F,state:B,toggle:D}}function mountComponent(B){var D=createApp(B),R=document.createElement("div");return document.body.appendChild(R),{instance:D.mount(R),unmount(){D.unmount(),document.body.removeChild(R)}}}var lockCount=0;function lockClick(B){B?(lockCount||document.body.classList.add("van-toast--unclickable"),lockCount++):lockCount&&(lockCount--,lockCount||document.body.classList.remove("van-toast--unclickable"))}var[name$n,bem$n]=createNamespace("toast"),VanToast=defineComponent({name:name$n,props:{icon:String,show:Boolean,overlay:Boolean,message:[Number,String],iconSize:[Number,String],className:unknownProp,iconPrefix:String,loadingType:String,forbidClick:Boolean,overlayClass:unknownProp,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,type:{type:String,default:"text"},duration:{type:Number,default:2e3},position:{type:String,default:"middle"},transition:{type:String,default:"van-fade"}},emits:["update:show"],setup(B,{emit:D}){var R,F=!1,G=()=>{var Z=B.show&&B.forbidClick;F!==Z&&(F=Z,lockClick(F))},j=Z=>D("update:show",Z),U=()=>{B.closeOnClick&&j(!1)},W=()=>{clearTimeout(R)},Y=()=>{var{icon:Z,type:q,iconSize:J,iconPrefix:K,loadingType:te}=B,ne=Z||q==="success"||q==="fail";if(ne)return createVNode(Icon,{name:Z||q,size:J,class:bem$n("icon"),classPrefix:K},null);if(q==="loading")return createVNode(Loading,{class:bem$n("loading"),size:J,type:te},null)},Q=()=>{var{type:Z,message:q}=B;if(isDef$1(q)&&q!=="")return Z==="html"?createVNode("div",{class:bem$n("text"),innerHTML:String(q)},null):createVNode("div",{class:bem$n("text")},[q])};return watch(()=>[B.show,B.forbidClick],G),watch(()=>[B.show,B.type,B.message,B.duration],()=>{W(),B.show&&B.duration>0&&(R=setTimeout(()=>{j(!1)},B.duration))}),onMounted(G),onUnmounted(G),()=>createVNode(Popup,mergeProps({show:B.show,class:[bem$n([B.position,{[B.type]:!B.icon}]),B.className],overlay:B.overlay,lockScroll:!1,transition:B.transition,overlayClass:B.overlayClass,overlayStyle:B.overlayStyle,closeOnClickOverlay:B.closeOnClickOverlay,onClick:U,onClosed:W},{"onUpdate:show":j}),{default:()=>[Y(),Q()]})}}),defaultOptions={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},queue$1=[],allowMultiple=!1,currentOptions=extend$1({},defaultOptions),defaultOptionsMap={};function parseOptions(B){return isObject(B)?B:{message:B}}function createInstance(){var{instance:B,unmount:D}=mountComponent({setup(){var R=ref(""),{open:F,state:G,close:j,toggle:U}=usePopupState(),W=()=>{allowMultiple&&(queue$1=queue$1.filter(Q=>Q!==B),D())},Y=()=>{var Q={onClosed:W,"onUpdate:show":U};return R.value&&(Q.message=R.value),createVNode(VanToast,mergeProps(G,Q),null)};return getCurrentInstance().render=Y,{open:F,clear:j,message:R}}});return B}function getInstance(){if(!queue$1.length||allowMultiple){var B=createInstance();queue$1.push(B)}return queue$1[queue$1.length-1]}function Toast(B={}){if(!inBrowser$1)return{};var D=getInstance(),R=parseOptions(B);return D.open(extend$1({},currentOptions,defaultOptionsMap[R.type||currentOptions.type],R)),D}var createMethod=B=>D=>Toast(extend$1({type:B},parseOptions(D)));Toast.loading=createMethod("loading");Toast.success=createMethod("success");Toast.fail=createMethod("fail");Toast.clear=B=>{queue$1.length&&(B?(queue$1.forEach(D=>{D.clear()}),queue$1=[]):allowMultiple?queue$1.shift().clear():queue$1[0].clear())};function setDefaultOptions(B,D){typeof B=="string"?defaultOptionsMap[B]=D:extend$1(currentOptions,B)}Toast.setDefaultOptions=setDefaultOptions;Toast.resetDefaultOptions=B=>{typeof B=="string"?defaultOptionsMap[B]=null:(currentOptions=extend$1({},defaultOptions),defaultOptionsMap={})};Toast.allowMultiple=(B=!0)=>{allowMultiple=B};Toast.install=B=>{B.use(withInstall(VanToast)),B.config.globalProperties.$toast=Toast};function callInterceptor(B){var{interceptor:D,args:R,done:F,canceled:G}=B;if(D){var j=D.apply(null,R||[]);isPromise(j)?j.then(U=>{U?F():G&&G()}).catch(noop$2):j?F():G&&G()}else F()}var[name$m,bem$m,t$4]=createNamespace("dialog"),popupKeys=[...popupSharedPropKeys,"transition","closeOnPopstate"],VanDialog=defineComponent({name:name$m,props:extend$1({},popupSharedProps,{title:String,theme:String,width:[Number,String],message:[String,Function],callback:Function,allowHtml:Boolean,className:unknownProp,beforeClose:Function,messageAlign:String,closeOnPopstate:truthProp,showCancelButton:Boolean,cancelButtonText:String,cancelButtonColor:String,confirmButtonText:String,confirmButtonColor:String,showConfirmButton:truthProp,closeOnClickOverlay:Boolean,transition:{type:String,default:"van-dialog-bounce"}}),emits:["confirm","cancel","update:show"],setup(B,{emit:D,slots:R}){var F=reactive({confirm:!1,cancel:!1}),G=ne=>D("update:show",ne),j=ne=>{G(!1),B.callback&&B.callback(ne)},U=ne=>()=>{!B.show||(D(ne),B.beforeClose?(F[ne]=!0,callInterceptor({interceptor:B.beforeClose,args:[ne],done(){j(ne),F[ne]=!1},canceled(){F[ne]=!1}})):j(ne))},W=U("cancel"),Y=U("confirm"),Q=()=>{var ne=R.title?R.title():B.title;if(ne)return createVNode("div",{class:bem$m("header",{isolated:!B.message&&!R.default})},[ne])},Z=ne=>{var{message:ie,allowHtml:re,messageAlign:oe}=B,le=bem$m("message",{"has-title":ne,[oe]:oe}),fe=isFunction$1(ie)?ie():ie;return re&&typeof fe=="string"?createVNode("div",{class:le,innerHTML:fe},null):createVNode("div",{class:le},[fe])},q=()=>{if(R.default)return createVNode("div",{class:bem$m("content")},[R.default()]);var{title:ne,message:ie,allowHtml:re}=B;if(ie){var oe=!!(ne||R.title);return createVNode("div",{key:re?1:0,class:bem$m("content",{isolated:!oe})},[Z(oe)])}},J=()=>createVNode("div",{class:[BORDER_TOP,bem$m("footer")]},[B.showCancelButton&&createVNode(Button,{size:"large",text:B.cancelButtonText||t$4("cancel"),class:bem$m("cancel"),style:{color:B.cancelButtonColor},loading:F.cancel,onClick:W},null),B.showConfirmButton&&createVNode(Button,{size:"large",text:B.confirmButtonText||t$4("confirm"),class:[bem$m("confirm"),{[BORDER_LEFT]:B.showCancelButton}],style:{color:B.confirmButtonColor},loading:F.confirm,onClick:Y},null)]),K=()=>createVNode(ActionBar,{class:bem$m("footer")},{default:()=>[B.showCancelButton&&createVNode(ActionBarButton,{type:"warning",text:B.cancelButtonText||t$4("cancel"),class:bem$m("cancel"),color:B.cancelButtonColor,loading:F.cancel,onClick:W},null),B.showConfirmButton&&createVNode(ActionBarButton,{type:"danger",text:B.confirmButtonText||t$4("confirm"),class:bem$m("confirm"),color:B.confirmButtonColor,loading:F.confirm,onClick:Y},null)]}),te=()=>R.footer?R.footer():B.theme==="round-button"?K():J();return()=>{var{width:ne,title:ie,theme:re,message:oe,className:le}=B;return createVNode(Popup,mergeProps({role:"dialog",class:[bem$m([re]),le],style:{width:addUnit(ne)},"aria-labelledby":ie||oe},pick(B,popupKeys),{"onUpdate:show":G}),{default:()=>[Q(),q(),te()]})}}}),instance$1;function initInstance(){var B={setup(){var{state:D,toggle:R}=usePopupState();return()=>createVNode(VanDialog,mergeProps(D,{"onUpdate:show":R}),null)}};({instance:instance$1}=mountComponent(B))}function Dialog(B){return inBrowser$1?new Promise((D,R)=>{instance$1||initInstance(),instance$1.open(extend$1({},Dialog.currentOptions,B,{callback:F=>{(F==="confirm"?D:R)(F)}}))}):Promise.resolve()}Dialog.defaultOptions={title:"",width:"",theme:null,message:"",overlay:!0,callback:null,teleport:"body",className:"",allowHtml:!1,lockScroll:!0,transition:"van-dialog-bounce",beforeClose:null,overlayClass:"",overlayStyle:void 0,messageAlign:"",cancelButtonText:"",cancelButtonColor:null,confirmButtonText:"",confirmButtonColor:null,showConfirmButton:!0,showCancelButton:!1,closeOnPopstate:!0,closeOnClickOverlay:!1};Dialog.currentOptions=extend$1({},Dialog.defaultOptions);Dialog.alert=Dialog;Dialog.confirm=B=>Dialog(extend$1({showCancelButton:!0},B));Dialog.close=()=>{instance$1&&instance$1.toggle(!1)};Dialog.setDefaultOptions=B=>{extend$1(Dialog.currentOptions,B)};Dialog.resetDefaultOptions=()=>{Dialog.currentOptions=extend$1({},Dialog.defaultOptions)};Dialog.install=B=>{B.use(withInstall(VanDialog)),B.config.globalProperties.$dialog=Dialog};Dialog.Component=withInstall(VanDialog);var[name$l,bem$l]=createNamespace("switch"),_Switch=defineComponent({name:name$l,props:{size:[Number,String],loading:Boolean,disabled:Boolean,modelValue:unknownProp,activeColor:String,inactiveColor:String,activeValue:{type:unknownProp,default:!0},inactiveValue:{type:unknownProp,default:!1}},emits:["change","update:modelValue"],setup(B,{emit:D}){var R=()=>B.modelValue===B.activeValue,F=()=>{if(!B.disabled&&!B.loading){var j=R()?B.inactiveValue:B.activeValue;D("update:modelValue",j),D("change",j)}},G=()=>{if(B.loading){var j=R()?B.activeColor:B.inactiveColor;return createVNode(Loading,{class:bem$l("loading"),color:j},null)}};return useLinkField(()=>B.modelValue),()=>{var{size:j,loading:U,disabled:W,activeColor:Y,inactiveColor:Q}=B,Z=R(),q={fontSize:addUnit(j),backgroundColor:Z?Y:Q};return createVNode("div",{role:"switch",class:bem$l({on:Z,loading:U,disabled:W}),style:q,"aria-checked":Z,onClick:F},[createVNode("div",{class:bem$l("node")},[G()])])}}}),Switch=withInstall(_Switch),[name$k,bem$k]=createNamespace("radio-group"),RADIO_KEY=Symbol(name$k),props$4={disabled:Boolean,iconSize:[Number,String],direction:String,modelValue:unknownProp,checkedColor:String},_RadioGroup=defineComponent({name:name$k,props:props$4,emits:["change","update:modelValue"],setup(B,{emit:D,slots:R}){var{linkChildren:F}=useChildren(RADIO_KEY),G=j=>D("update:modelValue",j);return watch(()=>B.modelValue,j=>D("change",j)),F({props:B,updateValue:G}),useLinkField(()=>B.modelValue),()=>createVNode("div",{class:bem$k([B.direction]),role:"radiogroup"},[R.default==null?void 0:R.default()])}}),RadioGroup=withInstall(_RadioGroup),[name$j,bem$j]=createNamespace("tag"),_Tag=defineComponent({name:name$j,props:{size:String,mark:Boolean,show:truthProp,color:String,plain:Boolean,round:Boolean,textColor:String,closeable:Boolean,type:{type:String,default:"default"}},emits:["close"],setup(B,{slots:D,emit:R}){var F=U=>{U.stopPropagation(),R("close",U)},G=()=>B.plain?{color:B.textColor||B.color,borderColor:B.color}:{color:B.textColor,background:B.color},j=()=>{var{type:U,mark:W,plain:Y,round:Q,size:Z,closeable:q}=B,J={mark:W,plain:Y,round:Q};Z&&(J[Z]=Z);var K=q&&createVNode(Icon,{name:"cross",class:bem$j("close"),onClick:F},null);return createVNode("span",{style:G(),class:bem$j([J,U])},[D.default==null?void 0:D.default(),K])};return()=>createVNode(Transition,{name:B.closeable?"van-fade":void 0},{default:()=>[B.show?j():null]})}}),Tag=withInstall(_Tag),checkerProps={name:unknownProp,disabled:Boolean,iconSize:[Number,String],modelValue:unknownProp,checkedColor:String,labelPosition:String,labelDisabled:Boolean,shape:{type:String,default:"round"}},Checker=defineComponent({props:extend$1({},checkerProps,{role:String,parent:Object,checked:Boolean,bindGroup:truthProp,bem:{type:Function,required:!0}}),emits:["click","toggle"],setup(B,{emit:D,slots:R}){var F=ref(),G=q=>{if(B.parent&&B.bindGroup)return B.parent.props[q]},j=computed(()=>G("disabled")||B.disabled),U=computed(()=>G("direction")),W=computed(()=>{var q=B.checkedColor||G("checkedColor");if(q&&B.checked&&!j.value)return{borderColor:q,backgroundColor:q}}),Y=q=>{var{target:J}=q,K=F.value,te=K===J||K.contains(J);!j.value&&(te||!B.labelDisabled)&&D("toggle"),D("click",q)},Q=()=>{var{bem:q,shape:J,checked:K}=B,te=B.iconSize||G("iconSize");return createVNode("div",{ref:F,class:q("icon",[J,{disabled:j.value,checked:K}]),style:{fontSize:addUnit(te)}},[R.icon?R.icon({checked:K,disabled:j.value}):createVNode(Icon,{name:"success",style:W.value},null)])},Z=()=>{if(R.default)return createVNode("span",{class:B.bem("label",[B.labelPosition,{disabled:j.value}])},[R.default()])};return()=>{var q=[Q()];return B.labelPosition==="left"?q.unshift(Z()):q.push(Z()),createVNode("div",{role:B.role,class:B.bem([{disabled:j.value,"label-disabled":B.labelDisabled},U.value]),tabindex:j.value?-1:0,"aria-checked":B.checked,onClick:Y},[q])}}}),[name$i,bem$i]=createNamespace("radio"),_Radio=defineComponent({name:name$i,props:checkerProps,emits:["update:modelValue"],setup(B,{emit:D,slots:R}){var{parent:F}=useParent(RADIO_KEY),G=()=>{var U=F?F.props.modelValue:B.modelValue;return U===B.name},j=()=>{F?F.updateValue(B.name):D("update:modelValue",B.name)};return()=>createVNode(Checker,mergeProps({bem:bem$i,role:"radio",parent:F,checked:G(),onToggle:j},B),pick(R,["default","icon"]))}}),Radio=withInstall(_Radio);function useRefs(){var B=ref([]);onBeforeUpdate(()=>{B.value=[]});var D=R=>F=>{B.value[R]=F};return[B,D]}var rafId;function scrollLeftTo(B,D,R){cancelRaf(rafId);var F=0,G=B.scrollLeft,j=R===0?1:Math.round(R*1e3/16);function U(){B.scrollLeft+=(D-G)/j,++FD||!j&&GD?raf$2(Y):F&&raf$2(F)}Y()}function useVisibilityChange(B,D){if(!(!inBrowser$1||!window.IntersectionObserver)){var R=new IntersectionObserver(j=>{D(j[0].intersectionRatio>0)},{root:document.body}),F=()=>{B.value&&R.observe(B.value)},G=()=>{B.value&&R.unobserve(B.value)};onDeactivated(G),onBeforeUnmount(G),onMountedOrActivated(F)}}var[name$h,bem$h]=createNamespace("sticky"),_Sticky=defineComponent({name:name$h,props:{zIndex:[Number,String],container:Object,offsetTop:{type:[Number,String],default:0},offsetBottom:{type:[Number,String],default:0},position:{type:String,default:"top"}},emits:["scroll","change"],setup(B,{emit:D,slots:R}){var F=ref(),G=useScrollParent(F),j=reactive({fixed:!1,width:0,height:0,transform:0}),U=computed(()=>unitToPx(B.position==="top"?B.offsetTop:B.offsetBottom)),W=computed(()=>{var{fixed:q,height:J,width:K}=j;if(q)return{width:K+"px",height:J+"px"}}),Y=computed(()=>{if(!!j.fixed){var q=extend$1(getZIndexStyle(B.zIndex),{width:j.width+"px",height:j.height+"px",[B.position]:U.value+"px"});return j.transform&&(q.transform="translate3d(0, "+j.transform+"px, 0)"),q}}),Q=q=>D("scroll",{scrollTop:q,isFixed:j.fixed}),Z=()=>{if(!(!F.value||isHidden(F))){var{container:q,position:J}=B,K=useRect(F),te=getScrollTop(window);if(j.width=K.width,j.height=K.height,J==="top")if(q){var ne=useRect(q),ie=ne.bottom-U.value-j.height;j.fixed=U.value>K.top&&ne.bottom>0,j.transform=ie<0?ie:0}else j.fixed=U.value>K.top;else{var{clientHeight:re}=document.documentElement;if(q){var oe=useRect(q),le=re-oe.top-U.value-j.height;j.fixed=re-U.valueoe.top,j.transform=le<0?-le:0}else j.fixed=re-U.valuej.fixed,q=>D("change",q)),useEventListener("scroll",Z,{target:G}),useVisibilityChange(F,Z),()=>createVNode("div",{ref:F,style:W.value},[createVNode("div",{class:bem$h({fixed:j.fixed}),style:Y.value},[R.default==null?void 0:R.default()])])}}),Sticky=withInstall(_Sticky),[name$g,bem$g]=createNamespace("tab"),TabsTitle=defineComponent({name:name$g,props:{dot:Boolean,type:String,color:String,title:String,badge:[Number,String],isActive:Boolean,disabled:Boolean,scrollable:Boolean,activeColor:String,renderTitle:Function,inactiveColor:String},setup(B){var D=computed(()=>{var F={},{type:G,color:j,disabled:U,isActive:W,activeColor:Y,inactiveColor:Q}=B,Z=G==="card";j&&Z&&(F.borderColor=j,U||(W?F.backgroundColor=j:F.color=j));var q=W?Y:Q;return q&&(F.color=q),F}),R=()=>{var F=createVNode("span",{class:bem$g("text",{ellipsis:!B.scrollable})},[B.renderTitle?B.renderTitle():B.title]);return B.dot||isDef$1(B.badge)&&B.badge!==""?createVNode(Badge,{dot:B.dot,content:B.badge},{default:()=>[F]}):F};return()=>createVNode("div",{role:"tab",class:[bem$g({active:B.isActive,disabled:B.disabled})],style:D.value,"aria-selected":B.isActive},[R()])}}),[name$f,bem$f]=createNamespace("swipe"),SWIPE_KEY=Symbol(name$f),props$3={loop:truthProp,width:[Number,String],height:[Number,String],vertical:Boolean,touchable:truthProp,lazyRender:Boolean,indicatorColor:String,showIndicators:truthProp,stopPropagation:truthProp,autoplay:{type:[Number,String],default:0},duration:{type:[Number,String],default:500},initialSwipe:{type:[Number,String],default:0}},_Swipe=defineComponent({name:name$f,props:props$3,emits:["change"],setup(B,{emit:D,slots:R}){var F=ref(),G=reactive({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),j=useTouch(),U=useWindowSize(),{children:W,linkChildren:Y}=useChildren(SWIPE_KEY),Q=computed(()=>W.length),Z=computed(()=>G[B.vertical?"height":"width"]),q=computed(()=>B.vertical?j.deltaY.value:j.deltaX.value),J=computed(()=>{if(G.rect){var Pe=B.vertical?G.rect.height:G.rect.width;return Pe-Z.value*Q.value}return 0}),K=computed(()=>Math.ceil(Math.abs(J.value)/Z.value)),te=computed(()=>Q.value*Z.value),ne=computed(()=>(G.active+Q.value)%Q.value),ie=computed(()=>{var Pe=B.vertical?"vertical":"horizontal";return j.direction.value===Pe}),re=computed(()=>{var Pe={transitionDuration:(G.swiping?0:B.duration)+"ms",transform:"translate"+(B.vertical?"Y":"X")+"("+G.offset+"px)"};if(Z.value){var Me=B.vertical?"height":"width",Se=B.vertical?"width":"height";Pe[Me]=te.value+"px",Pe[Se]=B[Se]?B[Se]+"px":""}return Pe}),oe=Pe=>{var{active:Me}=G;return Pe?B.loop?clamp(Me+Pe,-1,Q.value):clamp(Me+Pe,0,K.value):Me},le=(Pe,Me=0)=>{var Se=Pe*Z.value;B.loop||(Se=Math.min(Se,-J.value));var Le=Me-Se;return B.loop||(Le=clamp(Le,J.value,0)),Le},fe=({pace:Pe=0,offset:Me=0,emitChange:Se})=>{if(!(Q.value<=1)){var{active:Le}=G,ze=oe(Pe),ke=le(ze,Me);if(B.loop){if(W[0]&&ke!==J.value){var Ge=ke0;W[Q.value-1].setOffset(We?-te.value:0)}}G.active=ze,G.offset=ke,Se&&ze!==Le&&D("change",ne.value)}},he=()=>{G.swiping=!0,G.active<=-1?fe({pace:Q.value}):G.active>=Q.value&&fe({pace:-Q.value})},ge=()=>{he(),j.reset(),doubleRaf(()=>{G.swiping=!1,fe({pace:-1,emitChange:!0})})},ue=()=>{he(),j.reset(),doubleRaf(()=>{G.swiping=!1,fe({pace:1,emitChange:!0})})},me,be=()=>clearTimeout(me),ve=()=>{be(),B.autoplay>0&&Q.value>1&&(me=setTimeout(()=>{ue(),ve()},+B.autoplay))},pe=(Pe=+B.initialSwipe)=>{if(!!F.value){if(!isHidden(F)){var Me,Se,Le={width:F.value.offsetWidth,height:F.value.offsetHeight};G.rect=Le,G.width=+((Me=B.width)!=null?Me:Le.width),G.height=+((Se=B.height)!=null?Se:Le.height)}Q.value&&(Pe=Math.min(Q.value-1,Pe)),G.active=Pe,G.swiping=!0,G.offset=le(Pe),W.forEach(ze=>{ze.setOffset(0)})}},ye=()=>pe(G.active),xe,ce=Pe=>{!B.touchable||(j.start(Pe),xe=Date.now(),be(),he())},we=Pe=>{B.touchable&&G.swiping&&(j.move(Pe),ie.value&&(preventDefault(Pe,B.stopPropagation),fe({offset:q.value})))},Be=()=>{if(!(!B.touchable||!G.swiping)){var Pe=Date.now()-xe,Me=q.value/Pe,Se=Math.abs(Me)>.25||Math.abs(q.value)>Z.value/2;if(Se&&ie.value){var Le=B.vertical?j.offsetY.value:j.offsetX.value,ze=0;B.loop?ze=Le>0?q.value>0?-1:1:0:ze=-Math[q.value>0?"ceil":"floor"](q.value/Z.value),fe({pace:ze,emitChange:!0})}else q.value&&fe({pace:0});G.swiping=!1,ve()}},Ae=(Pe,Me={})=>{he(),j.reset(),doubleRaf(()=>{var Se;B.loop&&Pe===Q.value?Se=G.active===0?0:Pe:Se=Pe%Q.value,Me.immediate?doubleRaf(()=>{G.swiping=!1}):G.swiping=!1,fe({pace:Se-G.active,emitChange:!0})})},Te=(Pe,Me)=>{var Se=Me===ne.value,Le=Se?{backgroundColor:B.indicatorColor}:void 0;return createVNode("i",{style:Le,class:bem$f("indicator",{active:Se})},null)},Ne=()=>{if(R.indicator)return R.indicator({active:ne.value});if(B.showIndicators&&Q.value>1)return createVNode("div",{class:bem$f("indicators",{vertical:B.vertical})},[Array(Q.value).fill("").map(Te)])};return useExpose({prev:ge,next:ue,state:G,resize:ye,swipeTo:Ae}),Y({size:Z,props:B,count:Q,activeIndicator:ne}),watch(()=>B.initialSwipe,Pe=>pe(+Pe)),watch(Q,()=>pe(G.active)),watch([Q,()=>B.autoplay],ve),watch([U.width,U.height],ye),watch(usePageVisibility(),Pe=>{Pe==="visible"?ve():be()}),onMounted(pe),onActivated(()=>pe(G.active)),onPopupReopen(()=>pe(G.active)),onDeactivated(be),onBeforeUnmount(be),()=>createVNode("div",{ref:F,class:bem$f()},[createVNode("div",{style:re.value,class:bem$f("track",{vertical:B.vertical}),onTouchstart:ce,onTouchmove:we,onTouchend:Be,onTouchcancel:Be},[R.default==null?void 0:R.default()]),Ne()])}}),Swipe=withInstall(_Swipe),[name$e,bem$e]=createNamespace("tabs"),TabsContent=defineComponent({name:name$e,props:{inited:Boolean,animated:Boolean,swipeable:Boolean,lazyRender:Boolean,count:{type:Number,required:!0},duration:{type:[Number,String],required:!0},currentIndex:{type:Number,required:!0}},emits:["change"],setup(B,{emit:D,slots:R}){var F=ref(),G=W=>D("change",W),j=()=>{var W=R.default==null?void 0:R.default();return B.animated||B.swipeable?createVNode(Swipe,{ref:F,loop:!1,class:bem$e("track"),duration:+B.duration*1e3,touchable:B.swipeable,lazyRender:B.lazyRender,showIndicators:!1,onChange:G},{default:()=>[W]}):W},U=W=>{var Y=F.value;Y&&Y.state.active!==W&&Y.swipeTo(W,{immediate:!B.inited})};return watch(()=>B.currentIndex,U),onMounted(()=>{U(B.currentIndex)}),()=>createVNode("div",{class:bem$e("content",{animated:B.animated||B.swipeable})},[j()])}}),[name$d,bem$d]=createNamespace("tabs"),TABS_KEY=Symbol(name$d),props$2={color:String,border:Boolean,sticky:Boolean,animated:Boolean,ellipsis:truthProp,swipeable:Boolean,scrollspy:Boolean,background:String,lazyRender:truthProp,lineWidth:[Number,String],lineHeight:[Number,String],beforeChange:Function,titleActiveColor:String,titleInactiveColor:String,type:{type:String,default:"line"},active:{type:[Number,String],default:0},duration:{type:[Number,String],default:.3},offsetTop:{type:[Number,String],default:0},swipeThreshold:{type:[Number,String],default:5}},_Tabs=defineComponent({name:name$d,props:props$2,emits:["click","change","scroll","disabled","rendered","update:active"],setup(B,{emit:D,slots:R}){var F,G,j,U=ref(),W=ref(),Y=ref(),Q=useWindowSize(),Z=useScrollParent(U),[q,J]=useRefs(),{children:K,linkChildren:te}=useChildren(TABS_KEY),ne=reactive({inited:!1,position:"",lineStyle:{},currentIndex:-1}),ie=computed(()=>K.length>B.swipeThreshold||!B.ellipsis),re=computed(()=>({borderColor:B.color,background:B.background})),oe=(Me,Se)=>{var Le;return(Le=Me.name)!=null?Le:Se},le=computed(()=>{var Me=K[ne.currentIndex];if(Me)return oe(Me,ne.currentIndex)}),fe=computed(()=>unitToPx(B.offsetTop)),he=computed(()=>B.sticky?fe.value+F:0),ge=Me=>{var Se=W.value,Le=q.value;if(!(!ie.value||!Se||!Le||!Le[ne.currentIndex])){var ze=Le[ne.currentIndex].$el,ke=ze.offsetLeft-(Se.offsetWidth-ze.offsetWidth)/2;scrollLeftTo(Se,ke,Me?0:+B.duration)}},ue=()=>{var Me=ne.inited;nextTick(()=>{var Se=q.value;if(!(!Se||!Se[ne.currentIndex]||B.type!=="line"||isHidden(U.value))){var Le=Se[ne.currentIndex].$el,{lineWidth:ze,lineHeight:ke}=B,Ge=Le.offsetLeft+Le.offsetWidth/2,We={width:addUnit(ze),backgroundColor:B.color,transform:"translateX("+Ge+"px) translateX(-50%)"};if(Me&&(We.transitionDuration=B.duration+"s"),isDef$1(ke)){var Ve=addUnit(ke);We.height=Ve,We.borderRadius=Ve}ne.lineStyle=We}})},me=Me=>{for(var Se=Me=0&&Me{var Se=me(Me);if(!!isDef$1(Se)){var Le=K[Se],ze=oe(Le,Se),ke=ne.currentIndex!==null;ne.currentIndex=Se,ze!==B.active&&(D("update:active",ze),ke&&D("change",ze,Le.title))}},ve=Me=>{var Se=K.find((ze,ke)=>oe(ze,ke)===Me),Le=Se?K.indexOf(Se):0;be(Le)},pe=(Me=!1)=>{if(B.scrollspy){var Se=K[ne.currentIndex].$el;if(Se&&Z.value){var Le=getElementTop(Se,Z.value)-he.value;G=!0,scrollTopTo(Z.value,Le,Me?0:+B.duration,()=>{G=!1})}}},ye=(Me,Se)=>{var{title:Le,disabled:ze}=K[Se],ke=oe(K[Se],Se);ze?D("disabled",ke,Le):(callInterceptor({interceptor:B.beforeChange,args:[ke],done:()=>{be(Se),pe()}}),D("click",ke,Le),route(Me))},xe=Me=>{j=Me.isFixed,D("scroll",Me)},ce=Me=>{nextTick(()=>{ve(Me),pe(!0)})},we=()=>{for(var Me=0;Mehe.value)return Me===0?0:Me-1}return K.length-1},Be=()=>{if(B.scrollspy&&!G){var Me=we();be(Me)}},Ae=()=>K.map((Me,Se)=>createVNode(TabsTitle,{ref:J(Se),dot:Me.dot,type:B.type,badge:Me.badge,title:Me.title,color:B.color,style:Me.titleStyle,class:Me.titleClass,isActive:Se===ne.currentIndex,disabled:Me.disabled,scrollable:ie.value,renderTitle:Me.$slots.title,activeColor:B.titleActiveColor,inactiveColor:B.titleInactiveColor,onClick:()=>{ye(Me,Se)}},null)),Te=()=>{var Me,Se,{type:Le,border:ze}=B;return createVNode("div",{ref:Y,class:[bem$d("wrap",{scrollable:ie.value}),{[BORDER_TOP_BOTTOM]:Le==="line"&&ze}]},[createVNode("div",{ref:W,role:"tablist",class:bem$d("nav",[Le,{complete:ie.value}]),style:re.value},[(Me=R["nav-left"])==null?void 0:Me.call(R),Ae(),Le==="line"&&createVNode("div",{class:bem$d("line"),style:ne.lineStyle},null),(Se=R["nav-right"])==null?void 0:Se.call(R)])])};watch([()=>B.color,Q.width],ue),watch(()=>B.active,Me=>{Me!==le.value&&ve(Me)}),watch(()=>K.length,()=>{ne.inited&&(ve(B.active),ue(),nextTick(()=>{ge(!0)}))}),watch(()=>ne.currentIndex,()=>{ge(),ue(),j&&!B.scrollspy&&setRootScrollTop(Math.ceil(getElementTop(U.value)-fe.value))});var Ne=()=>{ve(B.active),nextTick(()=>{ne.inited=!0,F=getVisibleHeight(Y.value),ge(!0)})},Pe=(Me,Se)=>D("rendered",Me,Se);return useExpose({resize:ue,scrollTo:ce}),onActivated(ue),onPopupReopen(ue),onMountedOrActivated(Ne),useEventListener("scroll",Be,{target:Z}),te({props:B,setLine:ue,onRendered:Pe,currentName:le,scrollIntoView:ge}),()=>createVNode("div",{ref:U,class:bem$d([B.type])},[B.sticky?createVNode(Sticky,{container:U.value,offsetTop:fe.value,onScroll:xe},{default:()=>[Te()]}):Te(),createVNode(TabsContent,{count:K.length,inited:ne.inited,animated:B.animated,duration:B.duration,swipeable:B.swipeable,lazyRender:B.lazyRender,currentIndex:ne.currentIndex,onChange:be},{default:()=>[R.default==null?void 0:R.default()]})])}}),TAB_STATUS_KEY=Symbol();function useTabStatus(){return inject(TAB_STATUS_KEY,null)}var[name$c,bem$c]=createNamespace("swipe-item"),_SwipeItem=defineComponent({name:name$c,setup(B,{slots:D}){var R,F=reactive({offset:0,inited:!1,mounted:!1}),{parent:G,index:j}=useParent(SWIPE_KEY);if(!!G){var U=computed(()=>{var Q={},{vertical:Z}=G.props;return G.size.value&&(Q[Z?"height":"width"]=G.size.value+"px"),F.offset&&(Q.transform="translate"+(Z?"Y":"X")+"("+F.offset+"px)"),Q}),W=computed(()=>{var{loop:Q,lazyRender:Z}=G.props;if(!Z||R)return!0;if(!F.mounted)return!1;var q=G.activeIndicator.value,J=G.count.value-1,K=q===0&&Q?J:q-1,te=q===J&&Q?0:q+1;return R=j.value===q||j.value===K||j.value===te,R}),Y=Q=>{F.offset=Q};return onMounted(()=>{nextTick(()=>{F.mounted=!0})}),useExpose({setOffset:Y}),()=>createVNode("div",{class:bem$c(),style:U.value},[W.value?D.default==null?void 0:D.default():null])}}}),SwipeItem=withInstall(_SwipeItem),[name$b,bem$b]=createNamespace("tab"),_Tab=defineComponent({name:name$b,props:extend$1({},routeProps,{dot:Boolean,name:[Number,String],badge:[Number,String],title:String,disabled:Boolean,titleClass:unknownProp,titleStyle:[String,Object]}),setup(B,{slots:D}){var R=ref(!1),{parent:F,index:G}=useParent(TABS_KEY);if(!!F){var j=()=>{var Y;return(Y=B.name)!=null?Y:G.value},U=()=>{R.value=!0,F.props.lazyRender&&nextTick(()=>{F.onRendered(j(),B.title)})},W=computed(()=>{var Y=j()===F.currentName.value;return Y&&!R.value&&U(),Y});return watch(()=>B.title,()=>{F.setLine(),F.scrollIntoView()}),provide(TAB_STATUS_KEY,W),()=>{var{animated:Y,swipeable:Q,scrollspy:Z,lazyRender:q}=F.props;if(!(!D.default&&!Y)){var J=Z||W.value;if(Y||Q)return createVNode(SwipeItem,{role:"tabpanel","aria-hidden":!W.value,class:bem$b("pane-wrapper",{inactive:!W.value})},{default:()=>[createVNode("div",{class:bem$b("pane")},[D.default==null?void 0:D.default()])]});var K=R.value||Z||!q,te=K?D.default==null?void 0:D.default():null;return withDirectives(createVNode("div",{role:"tabpanel",class:bem$b("pane")},[te]),[[vShow,J]])}}}}}),Tab=withInstall(_Tab),Tabs=withInstall(_Tabs),[name$a,bem$a]=createNamespace("cell-group"),_CellGroup=defineComponent({name:name$a,inheritAttrs:!1,props:{title:String,inset:Boolean,border:truthProp},setup(B,{slots:D,attrs:R}){var F=()=>createVNode("div",mergeProps({class:[bem$a({inset:B.inset}),{[BORDER_TOP_BOTTOM]:B.border&&!B.inset}]},R),[D.default==null?void 0:D.default()]),G=()=>createVNode("div",{class:bem$a("title",{inset:B.inset})},[D.title?D.title():B.title]);return()=>B.title||D.title?createVNode(Fragment,null,[G(),F()]):F()}}),CellGroup=withInstall(_CellGroup),[name$9,bem$9]=createNamespace("row"),ROW_KEY=Symbol(name$9),_Row=defineComponent({name:name$9,props:{wrap:truthProp,align:String,justify:String,tag:{type:String,default:"div"},gutter:{type:[Number,String],default:0}},setup(B,{slots:D}){var{children:R,linkChildren:F}=useChildren(ROW_KEY),G=computed(()=>{var U=[[]],W=0;return R.forEach((Y,Q)=>{W+=Number(Y.span),W>24?(U.push([Q]),W-=24):U[U.length-1].push(Q)}),U}),j=computed(()=>{var U=Number(B.gutter),W=[];return U&&G.value.forEach(Y=>{var Q=U*(Y.length-1)/Y.length;Y.forEach((Z,q)=>{if(q===0)W.push({right:Q});else{var J=U-W[Z-1].right,K=Q-J;W.push({left:J,right:K})}})}),W});return F({spaces:j}),()=>{var{tag:U,wrap:W,align:Y,justify:Q}=B;return createVNode(U,{class:bem$9({["align-"+Y]:Y,["justify-"+Q]:Q,nowrap:!W})},{default:()=>[D.default==null?void 0:D.default()]})}}}),[name$8,bem$8]=createNamespace("col"),_Col=defineComponent({name:name$8,props:{offset:[Number,String],tag:{type:String,default:"div"},span:{type:[Number,String],default:0}},setup(B,{slots:D}){var{parent:R,index:F}=useParent(ROW_KEY),G=computed(()=>{if(!!R){var{spaces:j}=R;if(j&&j.value&&j.value[F.value]){var{left:U,right:W}=j.value[F.value];return{paddingLeft:U?U+"px":null,paddingRight:W?W+"px":null}}}});return()=>{var{tag:j,span:U,offset:W}=B;return createVNode(j,{style:G.value,class:bem$8({[U]:U,["offset-"+W]:W})},{default:()=>[D.default==null?void 0:D.default()]})}}}),Col=withInstall(_Col),[name$7,bem$7]=createNamespace("divider"),_Divider=defineComponent({name:name$7,props:{dashed:Boolean,hairline:truthProp,contentPosition:{type:String,default:"center"}},setup(B,{slots:D}){return()=>createVNode("div",{role:"separator",class:bem$7({dashed:B.dashed,hairline:B.hairline,["content-"+B.contentPosition]:!!D.default})},[D.default==null?void 0:D.default()])}}),Divider=withInstall(_Divider),prefix="van-empty-network-",renderStop=(B,D,R)=>createVNode("stop",{"stop-color":B,offset:D+"%","stop-opacity":R},null),Network=createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{id:prefix+"1",x1:"64.022%",y1:"100%",x2:"64.022%",y2:"0%"},[renderStop("#FFF",0,.5),renderStop("#F2F3F5",100)]),createVNode("linearGradient",{id:prefix+"2",x1:"50%",y1:"0%",x2:"50%",y2:"84.459%"},[renderStop("#EBEDF0",0),renderStop("#DCDEE0",100,0)]),createVNode("linearGradient",{id:prefix+"3",x1:"100%",y1:"0%",x2:"100%",y2:"100%"},[renderStop("#EAEDF0",0),renderStop("#DCDEE0",100)]),createVNode("linearGradient",{id:prefix+"4",x1:"100%",y1:"100%",x2:"100%",y2:"0%"},[renderStop("#EAEDF0",0),renderStop("#DCDEE0",100)]),createVNode("linearGradient",{id:prefix+"5",x1:"0%",y1:"43.982%",x2:"100%",y2:"54.703%"},[renderStop("#EAEDF0",0),renderStop("#DCDEE0",100)]),createVNode("linearGradient",{id:prefix+"6",x1:"94.535%",y1:"43.837%",x2:"5.465%",y2:"54.948%"},[renderStop("#EAEDF0",0),renderStop("#DCDEE0",100)]),createVNode("radialGradient",{id:prefix+"7",cx:"50%",cy:"0%",fx:"50%",fy:"0%",r:"100%",gradientTransform:"matrix(0 1 -.54835 0 .5 -.5)"},[renderStop("#EBEDF0",0),renderStop("#FFF",100,0)])]),createVNode("g",{fill:"none","fill-rule":"evenodd"},[createVNode("g",{opacity:".8"},[createVNode("path",{d:"M0 124V46h20v20h14v58H0z",fill:"url(#"+prefix+"1)",transform:"matrix(-1 0 0 1 36 7)"},null),createVNode("path",{d:"M121 8h22.231v14H152v77.37h-31V8z",fill:"url(#"+prefix+"1)",transform:"translate(2 7)"},null)]),createVNode("path",{fill:"url(#"+prefix+"7)",d:"M0 139h160v21H0z"},null),createVNode("path",{d:"M37 18a7 7 0 013 13.326v26.742c0 1.23-.997 2.227-2.227 2.227h-1.546A2.227 2.227 0 0134 58.068V31.326A7 7 0 0137 18z",fill:"url(#"+prefix+"2)","fill-rule":"nonzero",transform:"translate(43 36)"},null),createVNode("g",{opacity:".6","stroke-linecap":"round","stroke-width":"7"},[createVNode("path",{d:"M20.875 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",stroke:"url(#"+prefix+"3)",transform:"translate(43 36)"},null),createVNode("path",{d:"M9.849 0C3.756 6.225 0 14.747 0 24.146c0 9.398 3.756 17.92 9.849 24.145",stroke:"url(#"+prefix+"3)",transform:"translate(43 36)"},null),createVNode("path",{d:"M57.625 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",stroke:"url(#"+prefix+"4)",transform:"rotate(-180 76.483 42.257)"},null),createVNode("path",{d:"M73.216 0c-6.093 6.225-9.849 14.747-9.849 24.146 0 9.398 3.756 17.92 9.849 24.145",stroke:"url(#"+prefix+"4)",transform:"rotate(-180 89.791 42.146)"},null)]),createVNode("g",{transform:"translate(31 105)","fill-rule":"nonzero"},[createVNode("rect",{fill:"url(#"+prefix+"5)",width:"98",height:"34",rx:"2"},null),createVNode("rect",{fill:"#FFF",x:"9",y:"8",width:"80",height:"18",rx:"1.114"},null),createVNode("rect",{fill:"url(#"+prefix+"6)",x:"15",y:"12",width:"18",height:"6",rx:"1.114"},null)])])]),[name$6,bem$6]=createNamespace("empty"),PRESET_IMAGES=["error","search","default"],_Empty=defineComponent({name:name$6,props:{imageSize:[Number,String],description:String,image:{type:String,default:"default"}},setup(B,{slots:D}){var R=()=>{if(D.image)return D.image();var{image:j}=B;return j==="network"?Network:(PRESET_IMAGES.includes(j)&&(j="https://img.yzcdn.cn/vant/empty-image-"+j+".png"),createVNode("img",{src:j},null))},F=()=>{var j=D.description?D.description():B.description;if(j)return createVNode("p",{class:bem$6("description")},[j])},G=()=>{if(D.default)return createVNode("div",{class:bem$6("bottom")},[D.default()])};return()=>createVNode("div",{class:bem$6()},[createVNode("div",{class:bem$6("image"),style:getSizeStyle(B.imageSize)},[R()]),F(),G()])}}),Empty$1=withInstall(_Empty),[name$5,bem$5]=createNamespace("grid"),GRID_KEY=Symbol(name$5),props$1={square:Boolean,center:truthProp,border:truthProp,gutter:[Number,String],reverse:Boolean,iconSize:[Number,String],direction:String,clickable:Boolean,columnNum:{type:[Number,String],default:4}},_Grid=defineComponent({name:name$5,props:props$1,setup(B,{slots:D}){var{linkChildren:R}=useChildren(GRID_KEY);return R({props:B}),()=>createVNode("div",{style:{paddingLeft:addUnit(B.gutter)},class:[bem$5(),{[BORDER_TOP]:B.border&&!B.gutter}]},[D.default==null?void 0:D.default()])}}),Grid=withInstall(_Grid),[name$4,bem$4]=createNamespace("grid-item"),_GridItem=defineComponent({name:name$4,props:extend$1({},routeProps,{dot:Boolean,text:String,icon:String,badge:[Number,String],iconPrefix:String,iconColor:String}),setup(B,{slots:D}){var{parent:R,index:F}=useParent(GRID_KEY),G=useRoute();if(!!R){var j=computed(()=>{var{square:Z,gutter:q,columnNum:J}=R.props,K=100/+J+"%",te={flexBasis:K};if(Z)te.paddingTop=K;else if(q){var ne=addUnit(q);te.paddingRight=ne,F.value>=J&&(te.marginTop=ne)}return te}),U=computed(()=>{var{square:Z,gutter:q}=R.props;if(Z&&q){var J=addUnit(q);return{right:J,bottom:J,height:"auto"}}}),W=()=>{if(D.icon)return createVNode(Badge,{dot:B.dot,content:B.badge},{default:()=>[D.icon()]});if(B.icon)return createVNode(Icon,{dot:B.dot,name:B.icon,size:R.props.iconSize,badge:B.badge,class:bem$4("icon"),classPrefix:B.iconPrefix,color:B.iconColor},null)},Y=()=>{if(D.text)return D.text();if(B.text)return createVNode("span",{class:bem$4("text")},[B.text])},Q=()=>D.default?D.default():[W(),Y()];return()=>{var{center:Z,border:q,square:J,gutter:K,reverse:te,direction:ne,clickable:ie}=R.props,re=[bem$4("content",[ne,{center:Z,square:J,reverse:te,clickable:ie,surround:q&&K}]),{[BORDER]:q}];return createVNode("div",{class:[bem$4({square:J})],style:j.value},[createVNode("div",{role:ie?"button":void 0,class:re,style:U.value,tabindex:ie?0:void 0,onClick:G},[Q()])])}}}}),GridItem=withInstall(_GridItem),[name$3,bem$3,t$1]=createNamespace("list"),_List=defineComponent({name:name$3,props:{error:Boolean,loading:Boolean,finished:Boolean,errorText:String,loadingText:String,finishedText:String,immediateCheck:truthProp,offset:{type:[Number,String],default:300},direction:{type:String,default:"down"}},emits:["load","update:error","update:loading"],setup(B,{emit:D,slots:R}){var F=ref(!1),G=ref(),j=ref(),U=useTabStatus(),W=useScrollParent(G),Y=()=>{nextTick(()=>{if(!(F.value||B.finished||B.error||(U==null?void 0:U.value)===!1)){var{offset:K,direction:te}=B,ne=useRect(W);if(!(!ne.height||isHidden(G))){var ie=!1,re=useRect(j);te==="up"?ie=ne.top-re.top<=K:ie=re.bottom-ne.bottom<=K,ie&&(F.value=!0,D("update:loading",!0),D("load"))}}})},Q=()=>{if(B.finished){var K=R.finished?R.finished():B.finishedText;if(K)return createVNode("div",{class:bem$3("finished-text")},[K])}},Z=()=>{D("update:error",!1),Y()},q=()=>{if(B.error){var K=R.error?R.error():B.errorText;if(K)return createVNode("div",{class:bem$3("error-text"),onClick:Z},[K])}},J=()=>{if(F.value&&!B.finished)return createVNode("div",{class:bem$3("loading")},[R.loading?R.loading():createVNode(Loading,{class:bem$3("loading-icon")},{default:()=>[B.loadingText||t$1("loading")]})])};return watch([()=>B.loading,()=>B.finished,()=>B.error],Y),onUpdated(()=>{F.value=B.loading}),onMounted(()=>{B.immediateCheck&&Y()}),useExpose({check:Y}),useEventListener("scroll",Y,{target:W}),()=>{var K=R.default==null?void 0:R.default(),te=createVNode("div",{ref:j,class:bem$3("placeholder")},null);return createVNode("div",{ref:G,role:"feed",class:bem$3(),"aria-busy":F.value},[B.direction==="down"?K:te,J(),Q(),q(),B.direction==="up"?K:te])}}}),List$1=withInstall(_List),[name$2,bem$2]=createNamespace("notice-bar"),_NoticeBar=defineComponent({name:name$2,props:{text:String,mode:String,color:String,leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,default:null},delay:{type:[Number,String],default:1},speed:{type:[Number,String],default:60}},emits:["close","replay"],setup(B,{emit:D,slots:R}){var F=0,G=0,j,U=ref(),W=ref(),Y=reactive({show:!0,offset:0,duration:0}),Q=()=>{if(R["left-icon"])return R["left-icon"]();if(B.leftIcon)return createVNode(Icon,{class:bem$2("left-icon"),name:B.leftIcon},null)},Z=()=>{if(B.mode==="closeable")return"cross";if(B.mode==="link")return"arrow"},q=re=>{B.mode==="closeable"&&(Y.show=!1,D("close",re))},J=()=>{if(R["right-icon"])return R["right-icon"]();var re=Z();if(re)return createVNode(Icon,{name:re,class:bem$2("right-icon"),onClick:q},null)},K=()=>{Y.offset=F,Y.duration=0,raf$2(()=>{doubleRaf(()=>{Y.offset=-G,Y.duration=(G+F)/+B.speed,D("replay")})})},te=()=>{var re=B.scrollable===!1&&!B.wrapable,oe={transform:Y.offset?"translateX("+Y.offset+"px)":"",transitionDuration:Y.duration+"s"};return createVNode("div",{ref:U,role:"marquee",class:bem$2("wrap")},[createVNode("div",{ref:W,style:oe,class:[bem$2("content"),{"van-ellipsis":re}],onTransitionend:K},[R.default?R.default():B.text])])},ne=()=>{F=0,G=0,Y.offset=0,Y.duration=0},ie=()=>{var{delay:re,speed:oe,scrollable:le}=B,fe=isDef$1(re)?+re*1e3:0;ne(),clearTimeout(j),j=setTimeout(()=>{if(!(!U.value||!W.value||le===!1)){var he=useRect(U).width,ge=useRect(W).width;(le||ge>he)&&doubleRaf(()=>{F=he,G=ge,Y.offset=-G,Y.duration=G/+oe})}},fe)};return onPopupReopen(ie),onMountedOrActivated(ie),useEventListener("pageshow",ie),watch(()=>[B.text,B.scrollable],ie),()=>{var{color:re,wrapable:oe,background:le}=B;return withDirectives(createVNode("div",{role:"alert",class:bem$2({wrapable:oe}),style:{color:re,background:le}},[Q(),te(),J()]),[[vShow,Y.show]])}}}),NoticeBar=withInstall(_NoticeBar);function getBoundingClientRect(B){var D=B.getBoundingClientRect();return{width:D.width,height:D.height,top:D.top,right:D.right,bottom:D.bottom,left:D.left,x:D.left,y:D.top}}function getWindow(B){if(B==null)return window;if(B.toString()!=="[object Window]"){var D=B.ownerDocument;return D&&D.defaultView||window}return B}function getWindowScroll(B){var D=getWindow(B),R=D.pageXOffset,F=D.pageYOffset;return{scrollLeft:R,scrollTop:F}}function isElement(B){var D=getWindow(B).Element;return B instanceof D||B instanceof Element}function isHTMLElement(B){var D=getWindow(B).HTMLElement;return B instanceof D||B instanceof HTMLElement}function isShadowRoot(B){if(typeof ShadowRoot=="undefined")return!1;var D=getWindow(B).ShadowRoot;return B instanceof D||B instanceof ShadowRoot}function getHTMLElementScroll(B){return{scrollLeft:B.scrollLeft,scrollTop:B.scrollTop}}function getNodeScroll(B){return B===getWindow(B)||!isHTMLElement(B)?getWindowScroll(B):getHTMLElementScroll(B)}function getNodeName(B){return B?(B.nodeName||"").toLowerCase():null}function getDocumentElement(B){return((isElement(B)?B.ownerDocument:B.document)||window.document).documentElement}function getWindowScrollBarX(B){return getBoundingClientRect(getDocumentElement(B)).left+getWindowScroll(B).scrollLeft}function getComputedStyle(B){return getWindow(B).getComputedStyle(B)}function isScrollParent(B){var D=getComputedStyle(B),R=D.overflow,F=D.overflowX,G=D.overflowY;return/auto|scroll|overlay|hidden/.test(R+G+F)}function getCompositeRect(B,D,R){R===void 0&&(R=!1);var F=getDocumentElement(D),G=getBoundingClientRect(B),j=isHTMLElement(D),U={scrollLeft:0,scrollTop:0},W={x:0,y:0};return(j||!j&&!R)&&((getNodeName(D)!=="body"||isScrollParent(F))&&(U=getNodeScroll(D)),isHTMLElement(D)?(W=getBoundingClientRect(D),W.x+=D.clientLeft,W.y+=D.clientTop):F&&(W.x=getWindowScrollBarX(F))),{x:G.left+U.scrollLeft-W.x,y:G.top+U.scrollTop-W.y,width:G.width,height:G.height}}function getLayoutRect(B){var D=getBoundingClientRect(B),R=B.offsetWidth,F=B.offsetHeight;return Math.abs(D.width-R)<=1&&(R=D.width),Math.abs(D.height-F)<=1&&(F=D.height),{x:B.offsetLeft,y:B.offsetTop,width:R,height:F}}function getParentNode(B){return getNodeName(B)==="html"?B:B.assignedSlot||B.parentNode||(isShadowRoot(B)?B.host:null)||getDocumentElement(B)}function getScrollParent(B){return["html","body","#document"].indexOf(getNodeName(B))>=0?B.ownerDocument.body:isHTMLElement(B)&&isScrollParent(B)?B:getScrollParent(getParentNode(B))}function listScrollParents(B,D){var R;D===void 0&&(D=[]);var F=getScrollParent(B),G=F===((R=B.ownerDocument)==null?void 0:R.body),j=getWindow(F),U=G?[j].concat(j.visualViewport||[],isScrollParent(F)?F:[]):F,W=D.concat(U);return G?W:W.concat(listScrollParents(getParentNode(U)))}function isTableElement(B){return["table","td","th"].indexOf(getNodeName(B))>=0}function getTrueOffsetParent(B){return!isHTMLElement(B)||getComputedStyle(B).position==="fixed"?null:B.offsetParent}function getContainingBlock(B){var D=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,R=navigator.userAgent.indexOf("Trident")!==-1;if(R&&isHTMLElement(B)){var F=getComputedStyle(B);if(F.position==="fixed")return null}for(var G=getParentNode(B);isHTMLElement(G)&&["html","body"].indexOf(getNodeName(G))<0;){var j=getComputedStyle(G);if(j.transform!=="none"||j.perspective!=="none"||j.contain==="paint"||["transform","perspective"].indexOf(j.willChange)!==-1||D&&j.willChange==="filter"||D&&j.filter&&j.filter!=="none")return G;G=G.parentNode}return null}function getOffsetParent(B){for(var D=getWindow(B),R=getTrueOffsetParent(B);R&&isTableElement(R)&&getComputedStyle(R).position==="static";)R=getTrueOffsetParent(R);return R&&(getNodeName(R)==="html"||getNodeName(R)==="body"&&getComputedStyle(R).position==="static")?D:R||getContainingBlock(B)||D}var top$1="top",bottom$1="bottom",right="right",left$1="left",auto="auto",basePlacements=[top$1,bottom$1,right,left$1],start$4="start",end="end",placements=[].concat(basePlacements,[auto]).reduce(function(B,D){return B.concat([D,D+"-"+start$4,D+"-"+end])},[]),beforeRead="beforeRead",read="read",afterRead="afterRead",beforeMain="beforeMain",main="main",afterMain="afterMain",beforeWrite="beforeWrite",write="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read,afterRead,beforeMain,main,afterMain,beforeWrite,write,afterWrite];function order(B){var D=new Map,R=new Set,F=[];B.forEach(function(j){D.set(j.name,j)});function G(j){R.add(j.name);var U=[].concat(j.requires||[],j.requiresIfExists||[]);U.forEach(function(W){if(!R.has(W)){var Y=D.get(W);Y&&G(Y)}}),F.push(j)}return B.forEach(function(j){R.has(j.name)||G(j)}),F}function orderModifiers(B){var D=order(B);return modifierPhases.reduce(function(R,F){return R.concat(D.filter(function(G){return G.phase===F}))},[])}function debounce(B){var D;return function(){return D||(D=new Promise(function(R){Promise.resolve().then(function(){D=void 0,R(B())})})),D}}function getBasePlacement(B){return B.split("-")[0]}function mergeByName(B){var D=B.reduce(function(R,F){var G=R[F.name];return R[F.name]=G?Object.assign({},G,F,{options:Object.assign({},G.options,F.options),data:Object.assign({},G.data,F.data)}):F,R},{});return Object.keys(D).map(function(R){return D[R]})}var round=Math.round;function getVariation(B){return B.split("-")[1]}function getMainAxisFromPlacement(B){return["top","bottom"].indexOf(B)>=0?"x":"y"}function computeOffsets(B){var D=B.reference,R=B.element,F=B.placement,G=F?getBasePlacement(F):null,j=F?getVariation(F):null,U=D.x+D.width/2-R.width/2,W=D.y+D.height/2-R.height/2,Y;switch(G){case top$1:Y={x:U,y:D.y-R.height};break;case bottom$1:Y={x:U,y:D.y+D.height};break;case right:Y={x:D.x+D.width,y:W};break;case left$1:Y={x:D.x-R.width,y:W};break;default:Y={x:D.x,y:D.y}}var Q=G?getMainAxisFromPlacement(G):null;if(Q!=null){var Z=Q==="y"?"height":"width";switch(j){case start$4:Y[Q]=Y[Q]-(D[Z]/2-R[Z]/2);break;case end:Y[Q]=Y[Q]+(D[Z]/2-R[Z]/2);break}}return Y}var DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var B=arguments.length,D=new Array(B),R=0;R=0?-1:1,j=typeof R=="function"?R(Object.assign({},D,{placement:B})):R,U=j[0],W=j[1];return U=U||0,W=(W||0)*G,[left$1,right].indexOf(F)>=0?{x:W,y:U}:{x:U,y:W}}function offset(B){var D=B.state,R=B.options,F=B.name,G=R.offset,j=G===void 0?[0,0]:G,U=placements.reduce(function(Z,q){return Z[q]=distanceAndSkiddingToXY(q,D.rects,j),Z},{}),W=U[D.placement],Y=W.x,Q=W.y;D.modifiersData.popperOffsets!=null&&(D.modifiersData.popperOffsets.x+=Y,D.modifiersData.popperOffsets.y+=Q),D.modifiersData[F]=U}var offset$1={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset},[name$1,bem$1]=createNamespace("popover"),popupProps=["show","overlay","duration","teleport","overlayStyle","overlayClass","closeOnClickOverlay"],_Popover=defineComponent({name:name$1,props:{show:Boolean,overlay:Boolean,duration:[Number,String],iconPrefix:String,overlayClass:unknownProp,overlayStyle:Object,closeOnClickAction:truthProp,closeOnClickOverlay:truthProp,closeOnClickOutside:truthProp,offset:{type:Array,default:()=>[0,8]},theme:{type:String,default:"light"},trigger:{type:String,default:"click"},actions:{type:Array,default:()=>[]},placement:{type:String,default:"bottom"},teleport:{type:[String,Object],default:"body"}},emits:["select","touchstart","update:show"],setup(B,{emit:D,slots:R,attrs:F}){var G,j=ref(),U=ref(),W=()=>createPopper(j.value,U.value.popupRef.value,{placement:B.placement,modifiers:[{name:"computeStyles",options:{adaptive:!1,gpuAcceleration:!1}},extend$1({},offset$1,{options:{offset:B.offset}})]}),Y=()=>{nextTick(()=>{!B.show||(G?G.setOptions({placement:B.placement}):G=W())})},Q=ne=>D("update:show",ne),Z=()=>{B.trigger==="click"&&Q(!B.show)},q=ne=>{ne.stopPropagation(),D("touchstart",ne)},J=(ne,ie)=>{ne.disabled||(D("select",ne,ie),B.closeOnClickAction&&Q(!1))},K=()=>{B.closeOnClickOutside&&(!B.overlay||B.closeOnClickOverlay)&&Q(!1)},te=(ne,ie)=>{var{icon:re,text:oe,color:le,disabled:fe,className:he}=ne;return createVNode("div",{role:"menuitem",class:[bem$1("action",{disabled:fe,"with-icon":re}),he],style:{color:le},onClick:()=>J(ne,ie)},[re&&createVNode(Icon,{name:re,classPrefix:B.iconPrefix,class:bem$1("action-icon")},null),createVNode("div",{class:[bem$1("action-text"),BORDER_BOTTOM]},[oe])])};return onMounted(Y),onBeforeUnmount(()=>{G&&(G.destroy(),G=null)}),watch(()=>[B.show,B.placement],Y),useClickAway(j,K,{eventName:"touchstart"}),()=>createVNode(Fragment,null,[createVNode("span",{ref:j,class:bem$1("wrapper"),onClick:Z},[R.reference==null?void 0:R.reference()]),createVNode(Popup,mergeProps({ref:U,class:bem$1([B.theme]),position:"",transition:"van-popover-zoom",lockScroll:!1,onTouchstart:q},F,pick(B,popupProps),{"onUpdate:show":Q}),{default:()=>[createVNode("div",{class:bem$1("arrow")},null),createVNode("div",{role:"menu",class:bem$1("content")},[R.default?R.default():B.actions.map(te)])]})])}}),Popover=withInstall(_Popover),Row=withInstall(_Row),[name,bem]=createNamespace("slider"),_Slider=defineComponent({name,props:{range:Boolean,disabled:Boolean,readonly:Boolean,vertical:Boolean,barHeight:[Number,String],buttonSize:[Number,String],activeColor:String,inactiveColor:String,min:{type:[Number,String],default:0},max:{type:[Number,String],default:100},step:{type:[Number,String],default:1},modelValue:{type:[Number,Array],default:0}},emits:["change","drag-end","drag-start","update:modelValue"],setup(B,{emit:D,slots:R}){var F,G,j,U=ref(),W=ref(),Y=useTouch(),Q=computed(()=>Number(B.max)-Number(B.min)),Z=computed(()=>{var me=B.vertical?"width":"height";return{background:B.inactiveColor,[me]:addUnit(B.barHeight)}}),q=me=>!!B.range&&Array.isArray(me),J=()=>{var{modelValue:me,min:be}=B;return q(me)?(me[1]-me[0])*100/Q.value+"%":(me-Number(be))*100/Q.value+"%"},K=()=>{var{modelValue:me,min:be}=B;return q(me)?(me[0]-Number(be))*100/Q.value+"%":"0%"},te=computed(()=>{var me=B.vertical?"height":"width";return{[me]:J(),left:B.vertical?void 0:K(),top:B.vertical?K():void 0,background:B.activeColor,transition:W.value?"none":void 0}}),ne=me=>{var be=+B.min,ve=+B.max,pe=+B.step;me=clamp(me,be,ve);var ye=Math.round((me-be)/pe)*pe;return addNumber(be,ye)},ie=(me,be)=>JSON.stringify(me)===JSON.stringify(be),re=me=>me[0]>me[1]?me.slice(0).reverse():me,oe=(me,be)=>{q(me)?me=re(me).map(ne):me=ne(me),ie(me,B.modelValue)||D("update:modelValue",me),be&&!ie(me,G)&&D("change",me)},le=me=>{if(me.stopPropagation(),!(B.disabled||B.readonly)){var{min:be,vertical:ve,modelValue:pe}=B,ye=useRect(U),xe=ve?me.clientY-ye.top:me.clientX-ye.left,ce=ve?ye.height:ye.width,we=Number(be)+xe/ce*Q.value;if(q(pe)){var[Be,Ae]=pe,Te=(Be+Ae)/2;we<=Te?oe([we,Ae],!0):oe([Be,we],!0)}else oe(we,!0)}},fe=me=>{B.disabled||B.readonly||(Y.start(me),j=B.modelValue,q(j)?G=j.map(ne):G=ne(j),W.value="start")},he=me=>{if(!(B.disabled||B.readonly)){W.value==="start"&&D("drag-start"),preventDefault(me,!0),Y.move(me),W.value="draging";var be=useRect(U),ve=B.vertical?Y.deltaY.value:Y.deltaX.value,pe=B.vertical?be.height:be.width,ye=ve/pe*Q.value;q(G)?j[F]=G[F]+ye:j=G+ye,oe(j)}},ge=()=>{B.disabled||B.readonly||(W.value==="draging"&&(oe(j,!0),D("drag-end")),W.value="")},ue=me=>{var be=()=>{if(typeof me=="number"){var pe=["left","right"];return"button-wrapper-"+pe[me]}return"button-wrapper"},ve=typeof me=="number"?B.modelValue[me]:B.modelValue;return createVNode("div",{role:"slider",class:bem(be()),tabindex:B.disabled||B.readonly?-1:0,"aria-valuemin":+B.min,"aria-valuenow":ve,"aria-valuemax":+B.max,"aria-orientation":B.vertical?"vertical":"horizontal",onTouchstart:pe=>{typeof me=="number"&&(F=me),fe(pe)},onTouchmove:he,onTouchend:ge,onTouchcancel:ge,onClick:stopPropagation},[R.button?R.button():createVNode("div",{class:bem("button"),style:getSizeStyle(B.buttonSize)},null)])};return oe(B.modelValue),useLinkField(()=>B.modelValue),()=>createVNode("div",{ref:U,style:Z.value,class:bem({vertical:B.vertical,disabled:B.disabled}),onClick:le},[createVNode("div",{class:bem("bar"),style:te.value},[B.range?[ue(0),ue(1)]:ue()])])}}),Slider=withInstall(_Slider),lodash_isempty={exports:{}};(function(B,D){var R=9007199254740991,F="[object Arguments]",G="[object Function]",j="[object GeneratorFunction]",U="[object Map]",W="[object Object]",Y="[object Promise]",Q="[object Set]",Z="[object WeakMap]",q="[object DataView]",J=/[\\^$.*+?()[\]{}|]/g,K=/^\[object .+?Constructor\]$/,te=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,ne=typeof self=="object"&&self&&self.Object===Object&&self,ie=te||ne||Function("return this")(),re=D&&!D.nodeType&&D,oe=re&&!0&&B&&!B.nodeType&&B,le=oe&&oe.exports===re;function fe(st,xt){return st==null?void 0:st[xt]}function he(st){var xt=!1;if(st!=null&&typeof st.toString!="function")try{xt=!!(st+"")}catch{}return xt}function ge(st,xt){return function(Lt){return st(xt(Lt))}}var ue=Function.prototype,me=Object.prototype,be=ie["__core-js_shared__"],ve=function(){var st=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return st?"Symbol(src)_1."+st:""}(),pe=ue.toString,ye=me.hasOwnProperty,xe=me.toString,ce=RegExp("^"+pe.call(ye).replace(J,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=le?ie.Buffer:void 0,Be=me.propertyIsEnumerable,Ae=we?we.isBuffer:void 0,Te=ge(Object.keys,Object),Ne=ft(ie,"DataView"),Pe=ft(ie,"Map"),Me=ft(ie,"Promise"),Se=ft(ie,"Set"),Le=ft(ie,"WeakMap"),ze=!Be.call({valueOf:1},"valueOf"),ke=Qe(Ne),Ge=Qe(Pe),We=Qe(Me),Ve=Qe(Se),Ye=Qe(Le);function et(st){return xe.call(st)}function ot(st){if(!ut(st)||_e(st))return!1;var xt=rt(st)||he(st)?ce:K;return xt.test(Qe(st))}function ft(st,xt){var Lt=fe(st,xt);return ot(Lt)?Lt:void 0}var lt=et;(Ne&<(new Ne(new ArrayBuffer(1)))!=q||Pe&<(new Pe)!=U||Me&<(Me.resolve())!=Y||Se&<(new Se)!=Q||Le&<(new Le)!=Z)&&(lt=function(st){var xt=xe.call(st),Lt=xt==W?st.constructor:void 0,Gt=Lt?Qe(Lt):void 0;if(Gt)switch(Gt){case ke:return q;case Ge:return U;case We:return Y;case Ve:return Q;case Ye:return Z}return xt});function _e(st){return!!ve&&ve in st}function Xe(st){var xt=st&&st.constructor,Lt=typeof xt=="function"&&xt.prototype||me;return st===Lt}function Qe(st){if(st!=null){try{return pe.call(st)}catch{}try{return st+""}catch{}}return""}function Fe(st){return Je(st)&&ye.call(st,"callee")&&(!Be.call(st,"callee")||xe.call(st)==F)}var Re=Array.isArray;function He(st){return st!=null&&dt(st.length)&&!rt(st)}function Je(st){return yt(st)&&He(st)}var tt=Ae||Et;function qe(st){if(He(st)&&(Re(st)||typeof st=="string"||typeof st.splice=="function"||tt(st)||Fe(st)))return!st.length;var xt=lt(st);if(xt==U||xt==Q)return!st.size;if(ze||Xe(st))return!Te(st).length;for(var Lt in st)if(ye.call(st,Lt))return!1;return!0}function rt(st){var xt=ut(st)?xe.call(st):"";return xt==G||xt==j}function dt(st){return typeof st=="number"&&st>-1&&st%1==0&&st<=R}function ut(st){var xt=typeof st;return!!st&&(xt=="object"||xt=="function")}function yt(st){return!!st&&typeof st=="object"}function Et(){return!1}B.exports=qe})(lodash_isempty,lodash_isempty.exports);var objectTag="[object Object]";function isHostObject(B){var D=!1;if(B!=null&&typeof B.toString!="function")try{D=!!(B+"")}catch{}return D}function overArg(B,D){return function(R){return B(D(R))}}var funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object),objectToString=objectProto.toString,getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(B){return!!B&&typeof B=="object"}function isPlainObject$1(B){if(!isObjectLike(B)||objectToString.call(B)!=objectTag||isHostObject(B))return!1;var D=getPrototype(B);if(D===null)return!0;var R=hasOwnProperty.call(D,"constructor")&&D.constructor;return typeof R=="function"&&R instanceof R&&funcToString.call(R)==objectCtorString}var lodash_isplainobject=isPlainObject$1,lodash_transform={exports:{}};(function(B,D){var R=200,F="Expected a function",G="__lodash_hash_undefined__",j=1,U=2,W=1/0,Y=9007199254740991,Q="[object Arguments]",Z="[object Array]",q="[object Boolean]",J="[object Date]",K="[object Error]",te="[object Function]",ne="[object GeneratorFunction]",ie="[object Map]",re="[object Number]",oe="[object Object]",le="[object Promise]",fe="[object RegExp]",he="[object Set]",ge="[object String]",ue="[object Symbol]",me="[object WeakMap]",be="[object ArrayBuffer]",ve="[object DataView]",pe="[object Float32Array]",ye="[object Float64Array]",xe="[object Int8Array]",ce="[object Int16Array]",we="[object Int32Array]",Be="[object Uint8Array]",Ae="[object Uint8ClampedArray]",Te="[object Uint16Array]",Ne="[object Uint32Array]",Pe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Me=/^\w*$/,Se=/^\./,Le=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ze=/[\\^$.*+?()[\]{}|]/g,ke=/\\(\\)?/g,Ge=/^\[object .+?Constructor\]$/,We=/^(?:0|[1-9]\d*)$/,Ve={};Ve[pe]=Ve[ye]=Ve[xe]=Ve[ce]=Ve[we]=Ve[Be]=Ve[Ae]=Ve[Te]=Ve[Ne]=!0,Ve[Q]=Ve[Z]=Ve[be]=Ve[q]=Ve[ve]=Ve[J]=Ve[K]=Ve[te]=Ve[ie]=Ve[re]=Ve[oe]=Ve[fe]=Ve[he]=Ve[ge]=Ve[me]=!1;var Ye=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,et=typeof self=="object"&&self&&self.Object===Object&&self,ot=Ye||et||Function("return this")(),ft=D&&!D.nodeType&&D,lt=ft&&!0&&B&&!B.nodeType&&B,_e=lt&<.exports===ft,Xe=_e&&Ye.process,Qe=function(){try{return Xe&&Xe.binding("util")}catch{}}(),Fe=Qe&&Qe.isTypedArray;function Re(Ce,je){for(var nt=-1,gt=Ce?Ce.length:0;++nt-1}function ss(Ce,je){var nt=this.__data__,gt=os(nt,Ce);return gt<0?nt.push([Ce,je]):nt[gt][1]=je,this}Ri.prototype.clear=Ms,Ri.prototype.delete=io,Ri.prototype.get=no,Ri.prototype.has=so,Ri.prototype.set=ss;function Ki(Ce){var je=-1,nt=Ce?Ce.length:0;for(this.clear();++jeMt))return!1;var ei=St.get(Ce);if(ei&&St.get(je))return ei==je;var di=-1,hi=!0,oi=_t&j?new Bn:void 0;for(St.set(Ce,je),St.set(je,Ce);++di-1&&Ce%1==0&&Ce-1&&Ce%1==0&&Ce<=Y}function Ti(Ce){var je=typeof Ce;return!!Ce&&(je=="object"||je=="function")}function zn(Ce){return!!Ce&&typeof Ce=="object"}function Gn(Ce){return typeof Ce=="symbol"||zn(Ce)&&Jt.call(Ce)==ue}var Si=Fe?qe(Fe):Is;function dr(Ce){return Ce==null?"":ar(Ce)}function pr(Ce,je,nt){var gt=Ce==null?void 0:er(Ce,je);return gt===void 0?nt:gt}function mr(Ce,je){return Ce!=null&&yo(Ce,je,ir)}function jn(Ce){return Cs(Ce)?Ts(Ce):sr(Ce)}function gr(Ce,je,nt){var gt=en(Ce)||Si(Ce);if(je=Tn(je),nt==null)if(gt||Ti(Ce)){var _t=Ce.constructor;gt?nt=en(Ce)?new _t:[]:nt=ii(_t)?Ks(Zt(Ce)):{}}else nt={};return(gt?Re:Js)(Ce,function(St,Bt,Mt){return je(nt,St,Bt,Mt)}),nt}function yr(Ce){return Ce}function xi(Ce){return us(Ce)?Je(cs(Ce)):or(Ce)}B.exports=gr})(lodash_transform,lodash_transform.exports);const isEmpty$1=lodash_isempty.exports,isPlainObject=lodash_isplainobject,transform=lodash_transform.exports;var src=function B(D,{cleanKeys:R=[],cleanValues:F=[],emptyArrays:G=!0,emptyObjects:j=!0,emptyStrings:U=!0,NaNValues:W=!1,nullValues:Y=!0,undefinedValues:Q=!0}={}){return transform(D,(Z,q,J)=>{if(!R.includes(J)&&((Array.isArray(q)||isPlainObject(q))&&(q=B(q,{NaNValues:W,cleanKeys:R,cleanValues:F,emptyArrays:G,emptyObjects:j,emptyStrings:U,nullValues:Y,undefinedValues:Q})),!F.includes(q)&&!(j&&isPlainObject(q)&&isEmpty$1(q))&&!(G&&Array.isArray(q)&&!q.length)&&!(U&&q==="")&&!(W&&Number.isNaN(q))&&!(Y&&q===null)&&!(Q&&q===void 0))){if(Array.isArray(Z))return Z.push(q);Z[J]=q}})};const isManage=getRequestHostname()==="/api-web",parseSearch=queryString.parse(location.search);var ApiRouter={"/sysMusicScoreCategories/queryTree":isManage?"/eduMusicScore/queryTree":"/sysMusicScoreCategories/queryTree","/sysMusicScoreAccompaniment/queryPage":isManage&&!parseSearch.platform?"/eduMusicScore/queryPage":"/sysMusicScoreAccompaniment/queryPage","/sysMusicScoreAccompaniment/queryPageLimit":isManage?"/eduMusicScore/queryPageLimit":"/sysMusicScoreAccompaniment/queryPageLimit","/sysMusicScoreAccompaniment/querySubjectIds":isManage?"/eduMusicScore/querySubjectIds":"/sysMusicScoreAccompaniment/querySubjectIds"};const originalPostMessage=window.postMessage;window.postMessage=B=>{originalPostMessage(B,"*")};const loop=()=>{},calls={},browserInfo$6=browser();browserInfo$6.isApp&&window.addEventListener("message",B=>{var D,R,F;try{const G=B.data?typeof B.data=="object"?B.data:JSON.parse(B.data):{},j=((D=G.content)==null?void 0:D.uuid)||G.uuid;try{G.content&&(G.content=JSON.parse(G.content))}catch{}if((R=G==null?void 0:G.content)!=null&&R.uuid,!j){const Y=Object.keys(calls).filter(Q=>Q.indexOf(G.api)===0);for(const Q of Y){const Z=calls[Q]||loop;typeof Z=="function"&&Z(G),Array.isArray(Z)&&Z.forEach(q=>{typeof q=="function"&&q(G)})}return}const U=((F=G.content)==null?void 0:F.uuid)||G.uuid||G.api+G.uuid,W=calls[U]||loop;typeof W=="function"&&W(G)}catch{}});var yu,bu;const instance=window.COLEXIU||((bu=(yu=window.webkit)==null?void 0:yu.messageHandlers)==null?void 0:bu.COLEXIU),postMessage=(B,D)=>{if(browserInfo$6.isApp){const R=getRandomKey();calls[R]=D||loop,B.content=B.content?{...B.content,uuid:R}:{uuid:R},console.log(instance),instance.postMessage(JSON.stringify(B)),console.log("send:",JSON.stringify(B))}},listenerMessage=(B,D)=>{if(browserInfo$6.isApp){const R=B;calls[R]||(calls[R]=[]),calls[R].push(D||loop)}},removeListenerMessage=(B,D)=>{if(browserInfo$6.isApp){const R=B;if(Array.isArray(calls[R])){const F=calls[R].indexOf(D);calls[R].splice(F,1)}}},promisefiyPostMessage=B=>new Promise(D=>{postMessage(B,R=>D(R))});let isOpenLogin=!1;const request=extend$2({requestType:"form",timeout:1e4,prefix:getRequestHostname()});request.use(async(B,D)=>{const{url:R,options:F}=B.req,G=F.prefix||"",j=R.replace(G,"")||"",U=ApiRouter[j];U&&(B.req.url=G+U),await D()});request.interceptors.request.use((B,D)=>{const R=sessionStorage.getItem("Authorization")||"",F={};return R&&!["/api-auth/usernameLogin","/api-auth/smsLogin","/api-auth/code/sendSms"].includes(B)&&(F.Authorization=R),{url:B,options:{...D,params:src(D.params),headers:{...D.headers,...F}}}},{global:!1});request.interceptors.response.use(async(B,D)=>{if(new URL(B.url),B.status>299||B.status<200){const F="\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u72B6\u6001\u7801"+B.status;throw Toast(F),new Error(F)}const R=await B.clone().json();if(R.code!==200&&R.errCode!==0){const F=R.msg||"\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";R.code===403||R.code===401||Toast(F);const G=browser();throw R.code===403&&G.isApp&&!isOpenLogin&&(G.android?(postMessage({api:"login"}),window.DAYA.postMessage(JSON.stringify({api:"login"}))):G.iPhone&&window.webkit.messageHandlers.DAYA.postMessage(JSON.stringify({api:"login"}))),new Error(F)}return B},{global:!1});class AJAX{static ajax(D,R=9e3){let F;const G=D.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)F=new XMLHttpRequest;else if(ActiveXObject)F=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(new Error("XMLHttp not supported."));return F.timeout=R,new Promise((j,U)=>{F.onreadystatechange=()=>{F.readyState===XMLHttpRequest.DONE&&(F.status===200||F.status===0&&F.responseText?j(F.responseText):U(new Error("Could not retrieve requested URL "+F.status)))},F.ontimeout=W=>{U(new Error("Server request Timeout"))},F.overrideMimeType(G),F.open("GET",D,!0),F.send()})}}const _Fraction=class{constructor(B=0,D=1,R=0,F=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=B,this.denominator=D,this.wholeValue=R,F&&this.simplify(),this.setRealValue()}static max(B,D){return B.RealValue>D.RealValue?B:D}static Equal(B,D){return B.wholeValue===D.wholeValue&&B.Denominator===D.Denominator&&B.Numerator===D.Numerator}static createFromFraction(B){return new _Fraction(B.numerator,B.denominator,B.wholeValue,!1)}static plus(B,D){const R=B.clone();return R.Add(D),R}static minus(B,D){const R=B.clone();return R.Sub(D),R}static multiply(B,D){return new _Fraction((B.wholeValue*B.denominator+B.numerator)*(D.wholeValue*D.denominator+D.numerator),B.denominator*D.denominator)}static greatestCommonDenominator(B,D){if(B===0)return D;if(D===1)return 1;for(;Math.abs(D)>1e-8;)B>D?B-=D:D-=B;return Math.round(B)}toString(){let B=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(B=this.wholeValue+" "+B),B}clone(){return new _Fraction(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(B){this.numerator!==B&&(this.numerator=B,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(B){this.denominator!==B&&(this.denominator=B,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(B){this.wholeValue!==B&&(this.wholeValue=B,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let B=1,D=2;const R=this.GetExpandedNumerator();for(;DB;)D.Numerator++;if(this.numerator>this.denominator){const R=new _Fraction(this.numerator-1,this.denominator,this.wholeValue);for(;R.Denominator>B;)R.Numerator--;if(R.Denominator_Fraction.maximumAllowedNumber){const R=this.denominator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/R),this.denominator=Math.round(this.denominator/R)}if(this.numerator>_Fraction.maximumAllowedNumber){const R=this.numerator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/R),this.denominator=Math.round(this.denominator/R)}}isOnBeat(B){const D=this.distanceFromBeat(B);return Math.abs(D)<_Fraction.FloatInaccuracyTolerance}distanceFromBeat(B){const D=new _Fraction(1,B.Denominator);return this.RealValue%D.RealValue}};let Fraction$1=_Fraction;Fraction$1.maximumAllowedNumber=46340;Fraction$1.FloatInaccuracyTolerance=1e-4;class AbstractExpression{constructor(D){this.placement=D}static isStringInStringList(D,R){for(let F=0,G=D.length;F(B[B.Above=0]="Above",B[B.Below=1]="Below",B[B.Left=2]="Left",B[B.Right=3]="Right",B[B.NotYetDefined=4]="NotYetDefined",B[B.AboveOrBelow=5]="AboveOrBelow",B))(PlacementEnum||{});const _ContinuousDynamicExpression=class extends AbstractExpression{constructor(B,D,R,F,G,j,U=""){super(D),super.parentMeasure=F,this.NumberXml=j,this.dynamicType=B,this.label=U,this.staffNumber=R,this.activeInstantaneousDynamic=G,this.startVolume=1,this.endVolume=1,this.setStartAndEndVolume(),U!==""&&this.setType()}setStartAndEndVolume(){this.activeInstantaneousDynamic&&(this.dynamicType===ContDynamicEnum.crescendo&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*1.2),this.dynamicType===ContDynamicEnum.diminuendo&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*.8))}get DynamicType(){return this.dynamicType}set DynamicType(B){this.dynamicType=B}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(B){this.startMultiExpression=B}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(B){this.endMultiExpression=B}get Placement(){return this.placement}set Placement(B){this.placement=B}get StartVolume(){return this.startVolume}set StartVolume(B){this.startVolume=B}get EndVolume(){return this.endVolume}set EndVolume(B){this.endVolume=B}get StaffNumber(){return this.staffNumber}set StaffNumber(B){this.staffNumber=B}get Label(){return this.label}set Label(B){this.label=B,this.setType()}static isInputStringContinuousDynamic(B){return B?_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,B)||_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,B):!1}getInterpolatedDynamic(B){const D=this.StartMultiExpression.AbsoluteTimestamp;let R;if(this.EndMultiExpression?R=this.EndMultiExpression.AbsoluteTimestamp:R=Fraction$1.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),B.lt(D))return-1;if(R.lt(B))return-2;const F=Fraction$1.minus(B,D).RealValue/Fraction$1.minus(R,D).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*F))}isWedge(){return!this.label}setType(){_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,this.label)?this.dynamicType=ContDynamicEnum.crescendo:_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=ContDynamicEnum.diminuendo)}};let ContinuousDynamicExpression=_ContinuousDynamicExpression;ContinuousDynamicExpression.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."];ContinuousDynamicExpression.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];var ContDynamicEnum=(B=>(B[B.crescendo=0]="crescendo",B[B.diminuendo=1]="diminuendo",B))(ContDynamicEnum||{}),DynamicExpressionSymbolEnum=(B=>(B[B.p=0]="p",B[B.f=1]="f",B[B.s=2]="s",B[B.z=3]="z",B[B.m=4]="m",B[B.r=5]="r",B))(DynamicExpressionSymbolEnum||{});class MusicSheetReadingException{constructor(D,R){this.message=D,R&&(this.message+=" "+R.toString())}}class ArgumentOutOfRangeException{constructor(D){this.message=D}}class InvalidEnumArgumentException{constructor(D){this.message=D}}var loglevel={exports:{}};(function(B){(function(D,R){B.exports?B.exports=R():D.log=R()})(commonjsGlobal$1,function(){var D=function(){},R="undefined",F=typeof window!==R&&typeof window.navigator!==R&&/Trident\/|MSIE /.test(window.navigator.userAgent),G=["trace","debug","info","warn","error"];function j(ne,ie){var re=ne[ie];if(typeof re.bind=="function")return re.bind(ne);try{return Function.prototype.bind.call(re,ne)}catch{return function(){return Function.prototype.apply.apply(re,[ne,arguments])}}}function U(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function W(ne){return ne==="debug"&&(ne="log"),typeof console===R?!1:ne==="trace"&&F?U:console[ne]!==void 0?j(console,ne):console.log!==void 0?j(console,"log"):D}function Y(ne,ie){for(var re=0;re=0&&be<=oe.levels.SILENT){if(le=be,ve!==!1&&he(be),Y.call(oe,be,ne),typeof console===R&&be=0;j--)if(F(B[j],D))return j;return-1}arrays$4.lastIndexOf=lastIndexOf;function contains(B,D,R){return indexOf$1(B,D,R)>=0}arrays$4.contains=contains;function remove(B,D,R){var F=indexOf$1(B,D,R);return F<0?!1:(B.splice(F,1),!0)}arrays$4.remove=remove;function frequency(B,D,R){for(var F=R||util$9.defaultEquals,G=B.length,j=0,U=0;U=B.length||R<0||R>=B.length)return!1;var F=B[D];return B[D]=B[R],B[R]=F,!0}arrays$4.swap=swap;function toString$1(B){return"["+B.toString()+"]"}arrays$4.toString=toString$1;function forEach(B,D){for(var R=0,F=B;RD.size())return!1;var R=!0;return this.forEach(function(F){return D.contains(F)?!0:(R=!1,!1)}),R},B.prototype.remove=function(D){return this.contains(D)?(this.dictionary.remove(D),!0):!1},B.prototype.forEach=function(D){this.dictionary.forEach(function(R,F){return D(F)})},B.prototype.toArray=function(){return this.dictionary.values()},B.prototype.isEmpty=function(){return this.dictionary.isEmpty()},B.prototype.size=function(){return this.dictionary.size()},B.prototype.clear=function(){this.dictionary.clear()},B.prototype.toString=function(){return arrays$3.toString(this.toArray())},B}();_Set.default=Set$1;Object.defineProperty(Bag$1,"__esModule",{value:!0});var util$6=util$a,Dictionary_1$4=Dictionary$2,Set_1$1=_Set,Bag=function(){function B(D){this.toStrF=D||util$6.defaultToString,this.dictionary=new Dictionary_1$4.default(this.toStrF),this.nElements=0}return B.prototype.add=function(D,R){if(R===void 0&&(R=1),util$6.isUndefined(D)||R<=0)return!1;if(this.contains(D))this.dictionary.getValue(D).copies+=R;else{var F={value:D,copies:R};this.dictionary.setValue(D,F)}return this.nElements+=R,!0},B.prototype.count=function(D){return this.contains(D)?this.dictionary.getValue(D).copies:0},B.prototype.contains=function(D){return this.dictionary.containsKey(D)},B.prototype.remove=function(D,R){if(R===void 0&&(R=1),util$6.isUndefined(D)||R<=0)return!1;if(this.contains(D)){var F=this.dictionary.getValue(D);return R>F.copies?this.nElements-=F.copies:this.nElements-=R,F.copies-=R,F.copies<=0&&this.dictionary.remove(D),!0}else return!1},B.prototype.toArray=function(){for(var D=[],R=this.dictionary.values(),F=0,G=R;Fthis.nElements||util$5.isUndefined(D))return!1;var F=this.createNode(D);if(this.nElements===0||this.lastNode===null)this.firstNode=F,this.lastNode=F;else if(R===this.nElements)this.lastNode.next=F,this.lastNode=F;else if(R===0)F.next=this.firstNode,this.firstNode=F;else{var G=this.nodeAtIndex(R-1);if(G===null)return!1;F.next=G.next,G.next=F}return this.nElements++,!0},B.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},B.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},B.prototype.elementAtIndex=function(D){var R=this.nodeAtIndex(D);if(R!==null)return R.element},B.prototype.indexOf=function(D,R){var F=R||util$5.defaultEquals;if(util$5.isUndefined(D))return-1;for(var G=this.firstNode,j=0;G!==null;){if(F(G.element,D))return j;j++,G=G.next}return-1},B.prototype.contains=function(D,R){return this.indexOf(D,R)>=0},B.prototype.remove=function(D,R){var F=R||util$5.defaultEquals;if(this.nElements<1||util$5.isUndefined(D))return!1;for(var G=null,j=this.firstNode;j!==null;){if(F(j.element,D))return G===null?(this.firstNode=j.next,j===this.lastNode&&(this.lastNode=null)):j===this.lastNode?(this.lastNode=G,G.next=j.next,j.next=null):(G.next=j.next,j.next=null),this.nElements--,!0;G=j,j=j.next}return!1},B.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},B.prototype.equals=function(D,R){var F=R||util$5.defaultEquals;return!(D instanceof B)||this.size()!==D.size()?!1:this.equalsAux(this.firstNode,D.firstNode,F)},B.prototype.equalsAux=function(D,R,F){for(;D!==null&&R!==null;){if(!F(D.element,R.element))return!1;D=D.next,R=R.next}return!0},B.prototype.removeElementAtIndex=function(D){if(!(D<0||D>=this.nElements||this.firstNode===null||this.lastNode===null)){var R;if(this.nElements===1)R=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var F=this.nodeAtIndex(D-1);F===null?(R=this.firstNode.element,this.firstNode=this.firstNode.next):F.next===this.lastNode&&(R=this.lastNode.element,this.lastNode=F),F!==null&&F.next!==null&&(R=F.next.element,F.next=F.next.next)}return this.nElements--,R}},B.prototype.forEach=function(D){for(var R=this.firstNode;R!==null&&D(R.element)!==!1;)R=R.next},B.prototype.reverse=function(){for(var D=null,R=this.firstNode,F=null;R!==null;)F=R.next,R.next=D,D=R,R=F;F=this.firstNode,this.firstNode=this.lastNode,this.lastNode=F},B.prototype.toArray=function(){for(var D=[],R=this.firstNode;R!==null;)D.push(R.element),R=R.next;return D},B.prototype.size=function(){return this.nElements},B.prototype.isEmpty=function(){return this.nElements<=0},B.prototype.toString=function(){return arrays$2.toString(this.toArray())},B.prototype.nodeAtIndex=function(D){if(D<0||D>=this.nElements)return null;if(D===this.nElements-1)return this.lastNode;for(var R=this.firstNode,F=0;F0&&(D=D.rightCh);return D},B.prototype.transplant=function(D,R){D.parent===null?this.root=R:D===D.parent.leftCh?D.parent.leftCh=R:D.parent.rightCh=R,R!==null&&(R.parent=D.parent)},B.prototype.removeNode=function(D){if(D.leftCh===null)this.transplant(D,D.rightCh);else if(D.rightCh===null)this.transplant(D,D.leftCh);else{var R=this.minimumAux(D.rightCh);R.parent!==D&&(this.transplant(R,R.rightCh),R.rightCh=D.rightCh,R.rightCh.parent=R),this.transplant(D,R),R.leftCh=D.leftCh,R.leftCh.parent=R}},B.prototype.inorderTraversalAux=function(D,R,F){D===null||F.stop||(this.inorderTraversalAux(D.leftCh,R,F),!F.stop&&(F.stop=R(D.element)===!1,!F.stop&&this.inorderTraversalAux(D.rightCh,R,F)))},B.prototype.levelTraversalAux=function(D,R){var F=new Queue_1$1.default;for(D!==null&&F.enqueue(D),D=F.dequeue()||null;D!=null;){if(R(D.element)===!1)return;D.leftCh!==null&&F.enqueue(D.leftCh),D.rightCh!==null&&F.enqueue(D.rightCh),D=F.dequeue()||null}},B.prototype.preorderTraversalAux=function(D,R,F){D===null||F.stop||(F.stop=R(D.element)===!1,!F.stop&&(this.preorderTraversalAux(D.leftCh,R,F),!F.stop&&this.preorderTraversalAux(D.rightCh,R,F)))},B.prototype.postorderTraversalAux=function(D,R,F){D===null||F.stop||(this.postorderTraversalAux(D.leftCh,R,F),!F.stop&&(this.postorderTraversalAux(D.rightCh,R,F),!F.stop&&(F.stop=R(D.element)===!1)))},B.prototype.minimumAux=function(D){for(;D!=null&&D.leftCh!==null;)D=D.leftCh;return D},B.prototype.maximumAux=function(D){for(;D!=null&&D.rightCh!==null;)D=D.rightCh;return D},B.prototype.heightAux=function(D){return D===null?-1:Math.max(this.heightAux(D.leftCh),this.heightAux(D.rightCh))+1},B.prototype.insertNode=function(D){for(var R=null,F=this.root;F!==null;){var G=this.compare(D.element,F.element);if(G===0)return null;G<0?(R=F,F=F.leftCh):(R=F,F=F.rightCh)}return D.parent=R,R===null?this.root=D:this.compare(D.element,R.element)<0?R.leftCh=D:R.rightCh=D,D},B.prototype.createNode=function(D){return{element:D,leftCh:null,rightCh:null,parent:null}},B}();BSTreeKV$1.default=BSTreeKV;var __extends$2=commonjsGlobal$1&&commonjsGlobal$1.__extends||function(){var B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,R){D.__proto__=R}||function(D,R){for(var F in R)R.hasOwnProperty(F)&&(D[F]=R[F])};return function(D,R){B(D,R);function F(){this.constructor=D}D.prototype=R===null?Object.create(R):(F.prototype=R.prototype,new F)}}();Object.defineProperty(BSTree$1,"__esModule",{value:!0});var BSTreeKV_1$1=BSTreeKV$1,BSTree=function(B){__extends$2(D,B);function D(){return B!==null&&B.apply(this,arguments)||this}return D}(BSTreeKV_1$1.default);BSTree$1.default=BSTree;var Heap$1={};Object.defineProperty(Heap$1,"__esModule",{value:!0});var collections=util$a,arrays$1=arrays$4,Heap=function(){function B(D){this.data=[],this.compare=D||collections.defaultCompare}return B.prototype.leftChildIndex=function(D){return 2*D+1},B.prototype.rightChildIndex=function(D){return 2*D+2},B.prototype.parentIndex=function(D){return Math.floor((D-1)/2)},B.prototype.minIndex=function(D,R){return R>=this.data.length?D>=this.data.length?-1:D:this.compare(this.data[D],this.data[R])<=0?D:R},B.prototype.siftUp=function(D){for(var R=this.parentIndex(D);D>0&&this.compare(this.data[R],this.data[D])>0;)arrays$1.swap(this.data,R,D),D=R,R=this.parentIndex(D)},B.prototype.siftDown=function(D){for(var R=this.minIndex(this.leftChildIndex(D),this.rightChildIndex(D));R>=0&&this.compare(this.data[D],this.data[R])>0;)arrays$1.swap(this.data,R,D),D=R,R=this.minIndex(this.leftChildIndex(D),this.rightChildIndex(D))},B.prototype.peek=function(){if(this.data.length>0)return this.data[0]},B.prototype.add=function(D){return collections.isUndefined(D)?!1:(this.data.push(D),this.siftUp(this.data.length-1),!0)},B.prototype.removeRoot=function(){if(this.data.length>0){var D=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),D}},B.prototype.contains=function(D){var R=collections.compareToEquals(this.compare);return arrays$1.contains(this.data,D,R)},B.prototype.size=function(){return this.data.length},B.prototype.isEmpty=function(){return this.data.length<=0},B.prototype.clear=function(){this.data.length=0},B.prototype.forEach=function(D){arrays$1.forEach(this.data,D)},B}();Heap$1.default=Heap;var LinkedDictionary$1={},__extends$1=commonjsGlobal$1&&commonjsGlobal$1.__extends||function(){var B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,R){D.__proto__=R}||function(D,R){for(var F in R)R.hasOwnProperty(F)&&(D[F]=R[F])};return function(D,R){B(D,R);function F(){this.constructor=D}D.prototype=R===null?Object.create(R):(F.prototype=R.prototype,new F)}}();Object.defineProperty(LinkedDictionary$1,"__esModule",{value:!0});var Dictionary_1$3=Dictionary$2,util$3=util$a,LinkedDictionaryPair=function(){function B(D,R){this.key=D,this.value=R}return B.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},B}(),HeadOrTailLinkedDictionaryPair=function(){function B(){this.key=null,this.value=null}return B.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},B}();function isHeadOrTailLinkedDictionaryPair(B){return!B.next}var LinkedDictionary=function(B){__extends$1(D,B);function D(R){var F=B.call(this,R)||this;return F.head=new HeadOrTailLinkedDictionaryPair,F.tail=new HeadOrTailLinkedDictionaryPair,F.head.next=F.tail,F.tail.prev=F.head,F}return D.prototype.appendToTail=function(R){var F=this.tail.prev;F.next=R,R.prev=F,R.next=this.tail,this.tail.prev=R},D.prototype.getLinkedDictionaryPair=function(R){if(!util$3.isUndefined(R)){var F="$"+this.toStr(R),G=this.table[F];return G}},D.prototype.getValue=function(R){var F=this.getLinkedDictionaryPair(R);if(!util$3.isUndefined(F))return F.value},D.prototype.remove=function(R){var F=this.getLinkedDictionaryPair(R);if(!util$3.isUndefined(F))return B.prototype.remove.call(this,R),F.unlink(),F.value},D.prototype.clear=function(){B.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},D.prototype.replace=function(R,F){var G="$"+this.toStr(F.key);F.next=R.next,F.prev=R.prev,this.remove(R.key),F.prev.next=F,F.next.prev=F,this.table[G]=F,++this.nElements},D.prototype.setValue=function(R,F){if(!(util$3.isUndefined(R)||util$3.isUndefined(F))){var G=this.getLinkedDictionaryPair(R),j=new LinkedDictionaryPair(R,F),U="$"+this.toStr(R);if(util$3.isUndefined(G)){this.appendToTail(j),this.table[U]=j,++this.nElements;return}else return this.replace(G,j),G.value}},D.prototype.keys=function(){var R=[];return this.forEach(function(F,G){R.push(F)}),R},D.prototype.values=function(){var R=[];return this.forEach(function(F,G){R.push(G)}),R},D.prototype.forEach=function(R){for(var F=this.head.next;!isHeadOrTailLinkedDictionaryPair(F);){var G=R(F.key,F.value);if(G===!1)return;F=F.next}},D}(Dictionary_1$3.default);LinkedDictionary$1.default=LinkedDictionary;var MultiDictionary$1={};Object.defineProperty(MultiDictionary$1,"__esModule",{value:!0});var util$2=util$a,Dictionary_1$2=Dictionary$2,arrays=arrays$4,MultiDictionary=function(){function B(D,R,F){F===void 0&&(F=!1),this.dict=new Dictionary_1$2.default(D),this.equalsF=R||util$2.defaultEquals,this.allowDuplicate=F}return B.prototype.getValue=function(D){var R=this.dict.getValue(D);return util$2.isUndefined(R)?[]:arrays.copy(R)},B.prototype.setValue=function(D,R){if(util$2.isUndefined(D)||util$2.isUndefined(R))return!1;var F=this.dict.getValue(D);return util$2.isUndefined(F)?(this.dict.setValue(D,[R]),!0):!this.allowDuplicate&&arrays.contains(F,R,this.equalsF)?!1:(F.push(R),!0)},B.prototype.remove=function(D,R){if(util$2.isUndefined(R)){var F=this.dict.remove(D);return!util$2.isUndefined(F)}var G=this.dict.getValue(D);return!util$2.isUndefined(G)&&arrays.remove(G,R,this.equalsF)?(G.length===0&&this.dict.remove(D),!0):!1},B.prototype.keys=function(){return this.dict.keys()},B.prototype.values=function(){for(var D=this.dict.values(),R=[],F=0,G=D;F-1&&this.insertIdIntoRoot(R,F);for(var G in this.nodes)if(this.nodes.hasOwnProperty(G)){var j=this.findNodeId(G,D);j>-1&&this.insertIdIntoNode(G,R,j)}},B.prototype.insertIdAfterId=function(D,R){var F=this.findRootId(D);F>-1&&this.insertIdIntoRoot(R,F+1);for(var G in this.nodes)if(this.nodes.hasOwnProperty(G)){var j=this.findNodeId(G,D);j>-1&&this.insertIdIntoNode(G,R,j+1)}},B.prototype.insertIdIntoId=function(D,R){this.nodeInsertAtEnd(D,R),this.nodes[R]=[]},B.prototype.insertIdIntoRoot=function(D,R){if(R===void 0)this.rootInsertAtEnd(D);else if(R<0){var F=this.rootIds.length;this.rootIds.splice(R+F+1,0,D)}else this.rootIds.splice(R,0,D);this.nodes[D]=this.nodes[D]||[]},B.prototype.insertIdIntoNode=function(D,R,F){if(this.nodes[D]=this.nodes[D]||[],this.nodes[R]=this.nodes[R]||[],F===void 0)this.nodeInsertAtEnd(D,R);else if(F<0){var G=this.nodes[D].length;this.nodes[D].splice(F+G+1,0,R)}else this.nodes[D].splice(F,0,R)},B.prototype.moveId=function(D,R,F){var G=D,j=this.findRootId(G);this.nodes[R];for(var U in this.nodes)if(this.nodes.hasOwnProperty(U)){this.findNodeId(U,R);break}var W=R,Y=this.findRootId(W);this.nodes[R];for(var U in this.nodes)if(this.nodes.hasOwnProperty(U)){this.findNodeId(U,R);break}if(j>-1)if(Y>-1)switch(this.rootDelete(j),Y>j&&Y--,F){case Direction.BEFORE:this.insertIdIntoRoot(G,Y);break;case Direction.AFTER:this.insertIdIntoRoot(G,Y+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(W,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(W,G);break}else{this.rootDelete(j);for(var U in this.nodes)if(this.nodes.hasOwnProperty(U)){var Q=this.findNodeId(U,W);if(Q>-1){switch(F){case Direction.BEFORE:this.insertIdIntoNode(U,G,Q);break;case Direction.AFTER:this.insertIdIntoNode(U,G,Q+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(W,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(W,G);break}break}}}else if(Y>-1){for(var U in this.nodes)if(this.nodes.hasOwnProperty(U)){var Q=this.findNodeId(U,G);if(Q>-1){this.nodeDeleteAtIndex(U,Q);break}}switch(F){case Direction.BEFORE:this.insertIdIntoRoot(G,Y);break;case Direction.AFTER:this.insertIdIntoRoot(G,Y+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(W,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(W,G);break}}else{for(var U in this.nodes)if(this.nodes.hasOwnProperty(U)){var Q=this.findNodeId(U,G);if(Q>-1){this.nodeDeleteAtIndex(U,Q);break}}for(var U in this.nodes)if(this.nodes.hasOwnProperty(U)){var Q=this.findNodeId(U,W);if(Q>-1){switch(F){case Direction.BEFORE:this.insertIdIntoNode(U,G,Q);break;case Direction.AFTER:this.insertIdIntoNode(U,G,Q+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(W,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(W,G);break}break}}}},B.prototype.swapArrayElements=function(D,R,F){var G=D[R];return D[R]=D[F],D[F]=G,D},B.prototype.rootDeleteId=function(D){var R=this.findRootId(D);R>-1&&this.rootDelete(R)},B.prototype.nodeAndSubNodesDelete=function(D){for(var R=[],F=0;F(B[B.pppppp=0]="pppppp",B[B.ppppp=1]="ppppp",B[B.pppp=2]="pppp",B[B.ppp=3]="ppp",B[B.pp=4]="pp",B[B.p=5]="p",B[B.mp=6]="mp",B[B.mf=7]="mf",B[B.f=8]="f",B[B.ff=9]="ff",B[B.fff=10]="fff",B[B.ffff=11]="ffff",B[B.fffff=12]="fffff",B[B.ffffff=13]="ffffff",B[B.sf=14]="sf",B[B.sff=15]="sff",B[B.sfp=16]="sfp",B[B.sfpp=17]="sfpp",B[B.fp=18]="fp",B[B.rf=19]="rf",B[B.rfz=20]="rfz",B[B.sfz=21]="sfz",B[B.sffz=22]="sffz",B[B.fz=23]="fz",B[B.other=24]="other",B))(DynamicEnum||{});InstantaneousDynamicExpression.staticConstructor();class DynamicsContainer{constructor(D,R){D instanceof ContinuousDynamicExpression?this.continuousDynamicExpression=D:D instanceof InstantaneousDynamicExpression&&(this.instantaneousDynamicExpression=D),this.staffNumber=R}static Compare(D,R){return D.parMultiExpression().AbsoluteTimestamp.CompareTo(R.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){if(this.continuousDynamicExpression)return this.continuousDynamicExpression.StartMultiExpression;if(this.instantaneousDynamicExpression)return this.instantaneousDynamicExpression.ParentMultiExpression}}class AbstractNotationInstruction{constructor(D){this.printObject=!0,this.parent=D}get Parent(){return this.parent}set Parent(D){this.parent=D}get PrintObject(){return this.printObject}set PrintObject(D){this.printObject=D}}class RhythmInstruction extends AbstractNotationInstruction{constructor(D,R){super(void 0),this.rhythm=D,this.numerator=D.Numerator,this.denominator=D.Denominator,this.symbolEnum=R}get Rhythm(){return this.rhythm}set Rhythm(D){this.rhythm=D}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(D){this.symbolEnum=D}clone(){return new RhythmInstruction(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(D){const R=this;return R===D?!0:!R||!D?!1:R.numerator===D.numerator&&R.denominator===D.denominator}OperatorNotEqual(D){return this!==D}ToString(){return"Rhythm: "+this.rhythm.toString()}}var RhythmSymbolEnum=(B=>(B[B.NONE=0]="NONE",B[B.COMMON=1]="COMMON",B[B.CUT=2]="CUT",B))(RhythmSymbolEnum||{});class MusicPartManagerIterator{constructor(D,R,F){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=D,this.currentBpm=D.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const G of this.musicSheet.Repetitions)this.setRepetitionIterationCount(G,1);for(let G=0;G=this.JumpResponsibleRepetition.StartIndex&&G.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(G)}}handleRepetitionsAtMeasureEnd(){for(let D=0,R=this.currentMeasure.LastRepetitionInstructions.length;D-1&&this.getRepetitionIterationCount(G)=this.JumpResponsibleRepetition.StartIndex&&G.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(G),this.repetitionIterationCountDictKeys.contains(G))){const j=G.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(G));if(j>=0){this.currentMeasureIndex=j,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=G,this.forwardJumpOccurred=!0;return}j===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(D){this.currentMeasureIndex=D.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(D),this.jumpResponsibleRepetition=D,this.backJumpOccurred=!0}activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){const D=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let R=0,F=D.length;R0&&(this.currentDynamicEntryIndex>=D.length||D[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=R.length||R[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!D)return!0;for(let F=0,G=R.length;FR&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[R].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>F){const j=this.openSheetMusicDisplay.Sheet.SourceMeasures[F];this.openSheetMusicDisplay.Sheet.SelectionEnd=Fraction$1.plus(j.AbsoluteTimestamp,j.Duration)}this.iterator=this.manager.getIterator()}getStaffEntryFromVoiceEntry(D){const R=D.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,F=D.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(F,R,D.ParentSourceStaffEntry)}updateWithTimestamp(D){const R=this.manager.absoluteEnrolledToSheetTimestamp(D),F=this.graphic.calculateXPositionFromTimestamp(R),G=F[0],j=F[1];this.updateCurrentPageFromSystem(j);const U=F[2];if(!U)return;const W=Math.max(U.parentMeasure.MeasureNumber,1);let Y;for(const J of this.graphic.MeasureList[W-1])if(J){Y=J;break}const Q=this.graphic.calculateCursorPoints(G,j),Z=Q[0].y,q=Q[1].y-Z;if(!!Y){if(this.updateWidthAndStyle(Y.PositionAndShape,G,Z,q),this.openSheetMusicDisplay.FollowCursor){const J=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:J<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();const D=this.Iterator,R=D.CurrentVisibleVoiceEntries();if(D.EndReached||!D.CurrentVoiceEntries||R.length===0)return;let F=0,G=0,j=0,U;if(D.CurrentMeasure.isReducedToMultiRest){const Z=this.graphic.findGraphicalMeasure(D.CurrentMeasureIndex,0),q=Z.parentSourceMeasure.multipleRestMeasures,K=D.CurrentMeasure.multipleRestMeasureNumber/(q+1),te=Z.PositionAndShape.Size.width-Z.beginInstructionsWidth;F=Z.PositionAndShape.AbsolutePosition.x+Z.beginInstructionsWidth+K*te,U=Z.ParentMusicSystem}else{const q=R.map(J=>this.getStaffEntryFromVoiceEntry(J)).sort((J,K)=>{var te,ne,ie,re;return((ne=(te=J==null?void 0:J.PositionAndShape)==null?void 0:te.AbsolutePosition)==null?void 0:ne.x)<=((re=(ie=K==null?void 0:K.PositionAndShape)==null?void 0:ie.AbsolutePosition)==null?void 0:re.x)?-1:1})[0];q&&(F=q.PositionAndShape.AbsolutePosition.x,U=q.parentMeasure.ParentMusicSystem)}if(!U)return;G=U.PositionAndShape.AbsolutePosition.y+U.StaffLines[0].PositionAndShape.RelativePosition.y;const W=U.StaffLines[U.StaffLines.length-1];j=U.PositionAndShape.AbsolutePosition.y+W.PositionAndShape.RelativePosition.y+W.StaffHeight-G;const Q=this.graphic.findGraphicalMeasure(D.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(Q,F,G,j),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{const Z=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:Z<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}updateWidthAndStyle(D,R,F,G){const j=this.cursorElement;let U=0,W=G;switch(this.cursorOptions.type){case 1:j.style.top=F*10*this.openSheetMusicDisplay.zoom+"px",j.style.left=(R-1.5)*10*this.openSheetMusicDisplay.zoom+"px",W=G*10*this.openSheetMusicDisplay.zoom,j.height=W,j.style.height=W+"px",U=5*this.openSheetMusicDisplay.zoom;break;case 2:j.style.top=(F-2.5)*10*this.openSheetMusicDisplay.zoom+"px",j.style.left=R*10*this.openSheetMusicDisplay.zoom+"px",W=1.5*10*this.openSheetMusicDisplay.zoom,j.height=W,j.style.height=W+"px",U=5*this.openSheetMusicDisplay.zoom;break;case 3:j.style.top=D.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",j.style.left=D.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",W=G*10*this.openSheetMusicDisplay.zoom,j.height=W,j.style.height=W+"px",U=D.Size.width*10*this.openSheetMusicDisplay.zoom;break;case 4:j.style.top=D.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",j.style.left=D.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",W=G*10*this.openSheetMusicDisplay.zoom,j.height=W,j.style.height=W+"px",U=(R-D.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:j.style.top=F*10*this.openSheetMusicDisplay.zoom+"px",j.style.left=(R-1.5)*10*this.openSheetMusicDisplay.zoom+"px",W=G*10*this.openSheetMusicDisplay.zoom,j.height=W,j.style.height=W+"px",U=3*10*this.openSheetMusicDisplay.zoom;break}U!==j.width&&(j.width=U,this.updateStyle(U,this.cursorOptions))}hide(){this.cursorElement.style.display="none",this.hidden=!0}next(){this.Iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator();const D=this.manager.getIterator(this.graphic.ParentMusicSheet.SelectionStart);this.updateWithTimestamp(D.CurrentEnrolledTimestamp)}updateStyle(D,R=void 0){R!==void 0&&(this.cursorOptions=R);const F=document.createElement("canvas");F.width=this.cursorElement.width,F.height=1;const G=F.getContext("2d");G.globalAlpha=this.cursorOptions.alpha;const j=G.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case 1:case 2:case 3:case 4:j.addColorStop(1,this.cursorOptions.color);break;default:j.addColorStop(0,"white"),j.addColorStop(.2,this.cursorOptions.color),j.addColorStop(.8,this.cursorOptions.color),j.addColorStop(1,"white");break}G.fillStyle=j,G.fillRect(0,0,D,1),this.cursorElement.src=F.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(D){return this.Iterator.CurrentVisibleVoiceEntries(D)}NotesUnderCursor(D){const R=this.VoicesUnderCursor(D),F=[];return R.forEach(G=>{F.push.apply(F,G.Notes)}),F}GNotesUnderCursor(D){const R=this.VoicesUnderCursor(D),F=[];return R.forEach(G=>{F.push(...G.Notes.map(j=>this.rules.GNote(j)))}),F}updateCurrentPage(){const D=this.Iterator.currentTimeStamp;for(const R of this.graphic.MusicPages)if(R.MusicSystems.last().GetSystemsLastTimeStamp().gt(D)){const G=R.PageNumber;return G!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+G),this.container.appendChild(this.cursorElement)),this.currentPageNumber=G}return 1}updateCurrentPageFromSystem(D){if(D!=null&&D.Parent){const R=D.Parent.PageNumber;return R!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+R),this.container.appendChild(this.cursorElement)),this.currentPageNumber=R}return 1}}class PointF2D{constructor(D=0,R=0){this.x=0,this.y=0,this.x=D,this.y=R}static get Empty(){return new PointF2D}static pointsAreEqual(D,R){return D.x===R.x&&D.y===R.y}ToString(){return"["+this.x+", "+this.y+"]"}}class SizeF2D{constructor(D=0,R=0){this.width=D,this.height=R}}class RectangleF2D{constructor(D,R,F,G){this.x=0,this.y=0,this.width=0,this.height=0,this.x=D,this.y=R,this.width=F,this.height=G}static createFromLocationAndSize(D,R){return new RectangleF2D(D.x,D.y,R.width,R.height)}get Location(){return new PointF2D(this.x,this.y)}get Size(){return new SizeF2D(this.width,this.height)}}class AClassHierarchyTrackable{isInstanceOfClass(D){let R=this.constructor.prototype;for(;R;){if(D===R.constructor.name)return!0;R=R.__proto__}return!1}}class GraphicalObject extends AClassHierarchyTrackable{get PositionAndShape(){return this.boundingBox}set PositionAndShape(D){this.boundingBox=D}}class StaffLineActivitySymbol extends GraphicalObject{constructor(D){super(),this.parentStaffLine=D;const R=D.PositionAndShape;this.boundingBox=new BoundingBox$2(this,R),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}class Clickable extends GraphicalObject{}class BoundingBox$2{constructor(D=void 0,R=void 0,F=!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=R,this.dataObject=D,this.isSymbol=F,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,R&&(this.Parent=R)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(D){this.xBordersHaveBeenSet=D}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(D){this.yBordersHaveBeenSet=D}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(D){this.absolutePosition=D}get RelativePosition(){return this.relativePosition}set RelativePosition(D){this.relativePosition=D,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(D){this.size=D}get MarginSize(){return this.marginSize}get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(D){this.borderLeft=D,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(D){this.borderRight=D,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(D){this.borderTop=D,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(D){this.borderBottom=D,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(D){this.borderMarginLeft=D,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(D){this.borderMarginTop=D,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(U,1)}this.parent=D,((F=(R=this.parent)==null?void 0:R.ChildElements)==null?void 0:F.indexOf(this))>-1?log$2.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):(j=(G=this.parent)==null?void 0:G.ChildElements)==null||j.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 D=this.parent;for(;D;)this.absolutePosition.x+=D.relativePosition.x,this.absolutePosition.y+=D.relativePosition.y,D=D.parent}calculateAbsolutePositionsRecursiveWithoutTopelement(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(let D=0,R=this.ChildElements.length;D.001;break;case ColDirEnum.Up:case ColDirEnum.Down:G=this.relativePosition.y,D.calculateMarginPositionAlongDirection(this,R),j=Math.abs(G-this.relativePosition.y)>.001;break;default:throw new ArgumentOutOfRangeException("direction")}while(j)}collisionDetection(D){const R=Math.min(this.AbsolutePosition.x+this.borderRight,D.absolutePosition.x+D.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,D.absolutePosition.x+D.borderLeft),F=Math.min(this.AbsolutePosition.y+this.borderBottom,D.absolutePosition.y+D.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,D.absolutePosition.y+D.borderTop);return R>0&&F>0}liesInsideBorders(D){const R=this.AbsolutePosition.x+this.borderLeft<=D.absolutePosition.x+D.borderLeft&&D.absolutePosition.x+D.borderLeft<=this.AbsolutePosition.x+this.borderRight,F=this.AbsolutePosition.x+this.borderLeft<=D.absolutePosition.x+D.borderRight&&D.absolutePosition.x+D.borderRight<=this.AbsolutePosition.x+this.borderRight;if(R&&F){const G=this.AbsolutePosition.y+this.borderTop<=D.absolutePosition.y+D.borderTop&&D.absolutePosition.y+D.borderTop<=this.AbsolutePosition.y+this.borderBottom,j=this.AbsolutePosition.y+this.borderTop<=D.absolutePosition.y+D.borderBottom&&D.absolutePosition.y+D.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(G&&j)return!0}return!1}pointLiesInsideBorders(D){return this.AbsolutePosition.x+this.borderLeft<=D.x&&D.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=D.y&&D.y<=this.AbsolutePosition.y+this.borderBottom}marginCollisionDetection(D){const R=Math.min(this.AbsolutePosition.x+this.borderMarginRight,D.absolutePosition.x+D.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,D.absolutePosition.x+D.borderMarginLeft),F=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,D.absolutePosition.y+D.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,D.absolutePosition.y+D.borderMarginTop);return R>0&&F>0}liesInsideMargins(D){const R=this.AbsolutePosition.x+this.borderMarginLeft<=D.absolutePosition.x+D.borderMarginLeft&&D.absolutePosition.x+D.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,F=this.AbsolutePosition.x+this.borderMarginLeft<=D.absolutePosition.x+D.borderMarginRight&&D.absolutePosition.x+D.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(R&&F){const G=this.AbsolutePosition.y+this.borderMarginTop<=D.absolutePosition.y+D.borderMarginTop&&D.absolutePosition.y+D.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,j=this.AbsolutePosition.y+this.borderMarginTop<=D.absolutePosition.y+D.borderMarginBottom&&D.absolutePosition.y+D.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(G&&j)return!0}return!1}pointLiesInsideMargins(D){return this.AbsolutePosition.x+this.borderMarginLeft<=D.x&&D.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=D.y&&D.y<=this.AbsolutePosition.y+this.borderMarginBottom}computeNonOverlappingPosition(D,R,F){this.RelativePosition=new PointF2D(F.x,F.y),this.setAbsolutePositionFromParent();let G=0,j=!1;do switch(R){case ColDirEnum.Left:case ColDirEnum.Right:G=this.relativePosition.x,D.calculatePositionAlongDirection(this,R),j=Math.abs(G-this.relativePosition.x)>1e-4;break;case ColDirEnum.Up:case ColDirEnum.Down:G=this.relativePosition.y,D.calculatePositionAlongDirection(this,R),j=Math.abs(G-this.relativePosition.y)>1e-4;break;default:throw new ArgumentOutOfRangeException("direction")}while(j)}getClickedObjectOfType(D){const R=this.dataObject;if(this.pointLiesInsideBorders(D)&&R)return R;for(let F=0,G=this.childElements.length;F(B[B.Left=0]="Left",B[B.Right=1]="Right",B[B.Up=2]="Up",B[B.Down=3]="Down",B))(ColDirEnum||{});class GraphicalMusicPage extends GraphicalObject{constructor(D){super(),this.musicSystems=[],this.labels=[],this.parent=D,this.boundingBox=new BoundingBox$2(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(D){this.musicSystems=D}get Labels(){return this.labels}set Labels(D){this.labels=D}get Parent(){return this.parent}set Parent(D){this.parent=D}get PageNumber(){return this.pageNumber}set PageNumber(D){this.pageNumber=D}setMusicPageAbsolutePosition(D,R){return new PointF2D(0,0)}}var PagePlacementEnum=(B=>(B[B.Down=0]="Down",B[B.Right=1]="Right",B[B.RightDown=2]="RightDown",B))(PagePlacementEnum||{}),TextAlignmentEnum=(B=>(B[B.LeftTop=0]="LeftTop",B[B.LeftCenter=1]="LeftCenter",B[B.LeftBottom=2]="LeftBottom",B[B.CenterTop=3]="CenterTop",B[B.CenterCenter=4]="CenterCenter",B[B.CenterBottom=5]="CenterBottom",B[B.RightTop=6]="RightTop",B[B.RightCenter=7]="RightCenter",B[B.RightBottom=8]="RightBottom",B))(TextAlignmentEnum||{});class TextAlignment{static IsLeft(D){return D===0||D===1||D===2}static IsCenterAligned(D){return D===3||D===4||D===5}static IsRight(D){return D===6||D===7||D===8}}var FontStyles=(B=>(B[B.Regular=0]="Regular",B[B.Bold=1]="Bold",B[B.Italic=2]="Italic",B[B.BoldItalic=3]="BoldItalic",B[B.Underlined=4]="Underlined",B))(FontStyles||{}),Fonts=(B=>(B[B.TimesNewRoman=0]="TimesNewRoman",B[B.Kokila=1]="Kokila",B[B.Gonville=2]="Gonville",B))(Fonts||{});const FontStringNames={0:"Times New Roman",1:"Kokila",2:"Gonville"};var TieTypes=(B=>(B.SIMPLE="",B.HAMMERON="H",B.PULLOFF="P",B.SLIDE="S",B.TAPPING="T",B))(TieTypes||{});const Additional={"-2":[4,12,23],"-7":[13],"-9":[6]};var NoteEnum=(B=>(B[B.C=0]="C",B[B.D=2]="D",B[B.E=4]="E",B[B.F=5]="F",B[B.G=7]="G",B[B.A=9]="A",B[B.B=11]="B",B))(NoteEnum||{}),AccidentalEnum=(B=>(B[B.SHARP=0]="SHARP",B[B.FLAT=1]="FLAT",B[B.NONE=2]="NONE",B[B.NATURAL=3]="NATURAL",B[B.DOUBLESHARP=4]="DOUBLESHARP",B[B.DOUBLEFLAT=5]="DOUBLEFLAT",B[B.TRIPLESHARP=6]="TRIPLESHARP",B[B.TRIPLEFLAT=7]="TRIPLEFLAT",B[B.QUARTERTONESHARP=8]="QUARTERTONESHARP",B[B.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",B[B.SLASHFLAT=10]="SLASHFLAT",B[B.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",B[B.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",B[B.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",B[B.SLASHSHARP=14]="SLASHSHARP",B[B.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",B[B.SORI=16]="SORI",B[B.KORON=17]="KORON",B))(AccidentalEnum||{});const _Pitch=class{constructor(B,D,R,F=void 0){this.accidental=2,this.fundamentalNote=B,this.octave=D,this.accidental=R,this.accidentalXml=F,this.halfTone=B+(D+_Pitch.octXmlDiff)*12+_Pitch.HalfTonesFromAccidental(R),this.frequency=_Pitch.calcFrequency(this),this.nextFrequency=_Pitch.calcFrequency(this,"next"),this.prevFrequency=_Pitch.calcFrequency(this,"prev")}static getNoteEnumString(B){switch(B){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(B,D){if(D===0)return[B,0];const R=_Pitch.pitchEnumValues,F=R.indexOf(B);let G=0,j=(F+D)%R.length;return F+D>R.length-1&&(G=1),j<0&&(j=R.length+j,G=-1),[R[j],G]}static CalculateTransposedHalfTone(B,D){const R=B.fundamentalNote+B.AccidentalHalfTones+D;return _Pitch.WrapAroundCheck(R,12)}static WrapAroundCheck(B,D){let R=0;for(;B<0;)B+=D,R--;for(;B>=D;)B-=D,R++;return{overflow:R,halftone:B}}static calcFrequency(B,D){let R=0,F;if(B instanceof _Pitch){const W=B;R=W.octave-1,F=W.fundamentalNote-9+W.AccidentalHalfTones}else typeof B=="number"&&(F=B-57);const G=window.DYSubjectId;let j=0;window.DYEnvironment==="COLEXIU"&&(Additional[12]=[120]);for(const W in Additional)if(Object.prototype.hasOwnProperty.call(Additional,W)&&Additional[W].includes(G)){j=parseFloat(W);break}let U=F+j;return D==="next"&&U++,D==="prev"&&U--,442*Math.pow(2,R)*Math.pow(2,U/12)}static calcFractionalKey(B){return Math.log(B/440)/Math.LN10*_Pitch.halftoneFactor+57}static fromFrequency(B){const D=_Pitch.calcFractionalKey(B)+.5,R=Math.floor(D/12)-_Pitch.octXmlDiff,F=Math.floor(D)%12;let G=F,j=2;return this.pitchEnumValues.indexOf(G)===-1&&(G=F-1,j=0),new _Pitch(G,R,j)}static fromHalftone(B){const D=Math.floor(B/12)-_Pitch.octXmlDiff,R=B%12;let F=R,G=2;return this.pitchEnumValues.indexOf(F)===-1&&(F=R-1,G=0),new _Pitch(F,D,G)}static ceiling(B){B=B%12;let D=B;return this.pitchEnumValues.indexOf(D)===-1&&(D=B+1),D}static floor(B){B=B%12;let D=B;return this.pitchEnumValues.indexOf(D)===-1&&(D=B-1),D}static HalfTonesFromAccidental(B){switch(B){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(B){switch(B){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 B>0&&B<1?8:B<0&&B>-1?9:8}}static accidentalVexflow(B){let D;switch(B){case 3:D="n";break;case 1:D="b";break;case 0:D="#";break;case 4:D="##";break;case 6:D="###";break;case 5:D="bb";break;case 7:D="bbs";break;case 8:D="+";break;case 9:D="d";break;case 10:D="bs";break;case 11:D="++";break;case 12:D="db";break;case 13:D="+-";break;case 14:D="++-";break;case 15:D="bss";break;case 16:D="o";break;case 17:D="k";break}return D}get AccidentalHalfTones(){return _Pitch.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 _Pitch.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(B){if(B>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return B>0?this.getHigherPitchByTransposeFactor(B):B<0?this.getLowerPitchByTransposeFactor(-B):this}DoEnharmonicChange(){switch(this.accidental){case 1:case 5:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=_Pitch.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_Pitch.octXmlDiff)*12));break;case 0:case 4:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=_Pitch.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_Pitch.octXmlDiff)*12));break;default:return}}ToString(){let B=_Pitch.accidentalVexflow(this.accidental);return B||(B=""),"Key: "+_Pitch.getNoteEnumString(this.fundamentalNote)+B+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(B){const D=this;return!D||!B?!1:D.FundamentalNote===B.FundamentalNote&&D.Octave===B.Octave&&D.Accidental===B.Accidental}OperatorNotEqual(B){return this!==B}OperatorFundamentalGreaterThan(B){const D=this;return D.Octave===B.Octave?D.FundamentalNote>B.FundamentalNote:D.Octave>B.Octave}OperatorFundamentalLessThan(B){const D=this;return D.Octave===B.Octave?D.FundamentalNote_Pitch.pitchEnumValues.length-1?(F=_Pitch.pitchEnumValues[D+B-_Pitch.pitchEnumValues.length],R++):F=_Pitch.pitchEnumValues[D+B],new _Pitch(F,R,2)}getLowerPitchByTransposeFactor(B){const D=_Pitch.pitchEnumValues.indexOf(this.fundamentalNote);let R=this.octave,F;return D-B<0?(F=_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length+D-B],R--):F=_Pitch.pitchEnumValues[D-B],new _Pitch(F,R,2)}getNextFundamentalNote(B){let D=_Pitch.pitchEnumValues.indexOf(B);return D=(D+1)%_Pitch.pitchEnumValues.length,_Pitch.pitchEnumValues[D]}getPreviousFundamentalNote(B){const D=_Pitch.pitchEnumValues.indexOf(B);return D>0?_Pitch.pitchEnumValues[D-1]:_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length-1]}};let Pitch=_Pitch;Pitch.pitchEnumValues=[0,2,4,5,7,9,11];Pitch.halftoneFactor=12/(Math.LN2/Math.LN10);Pitch.octXmlDiff=3;class VerticalGraphicalStaffEntryContainer{constructor(D,R){this.staffEntries=[],this.absoluteTimestamp=R,this.staffEntries=new Array(D)}get Index(){return this.index}set Index(D){this.index=D}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(D){this.staffEntries=D}static compareByTimestamp(D,R){const F=D.absoluteTimestamp.RealValue,G=R.absoluteTimestamp.RealValue;return FG?1:0}getFirstNonNullStaffEntry(){for(let D=0,R=this.staffEntries.length;D(B[B.BaseWritingColor=0]="BaseWritingColor",B[B.FollowingCursor=1]="FollowingCursor",B[B.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",B[B.PlaybackCursor=3]="PlaybackCursor",B[B.Highlighted=4]="Highlighted",B[B.ErrorUnderlay=5]="ErrorUnderlay",B[B.Selected=6]="Selected",B[B.SelectionSymbol=7]="SelectionSymbol",B[B.DebugColor1=8]="DebugColor1",B[B.DebugColor2=9]="DebugColor2",B[B.DebugColor3=10]="DebugColor3",B[B.SplitScreenDivision=11]="SplitScreenDivision",B[B.GreyTransparentOverlay=12]="GreyTransparentOverlay",B[B.MarkedArea1=13]="MarkedArea1",B[B.MarkedArea2=14]="MarkedArea2",B[B.MarkedArea3=15]="MarkedArea3",B[B.MarkedArea4=16]="MarkedArea4",B[B.MarkedArea5=17]="MarkedArea5",B[B.MarkedArea6=18]="MarkedArea6",B[B.MarkedArea7=19]="MarkedArea7",B[B.MarkedArea8=20]="MarkedArea8",B[B.MarkedArea9=21]="MarkedArea9",B[B.MarkedArea10=22]="MarkedArea10",B[B.Comment1=23]="Comment1",B[B.Comment2=24]="Comment2",B[B.Comment3=25]="Comment3",B[B.Comment4=26]="Comment4",B[B.Comment5=27]="Comment5",B[B.Comment6=28]="Comment6",B[B.Comment7=29]="Comment7",B[B.Comment8=30]="Comment8",B[B.Comment9=31]="Comment9",B[B.Comment10=32]="Comment10",B))(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=(B=>(B[B.Background=0]="Background",B[B.Highlight=1]="Highlight",B[B.MeasureError=2]="MeasureError",B[B.SelectionSymbol=3]="SelectionSymbol",B[B.Cursor=4]="Cursor",B[B.PSI_Debug=5]="PSI_Debug",B[B.Notes=6]="Notes",B[B.Comment=7]="Comment",B[B.Debug_above=8]="Debug_above",B))(GraphicalLayers||{}),NoteState=(B=>(B[B.Normal=0]="Normal",B[B.Selected=1]="Selected",B[B.Follow_Confirmed=2]="Follow_Confirmed",B[B.QFeedback_NotFound=3]="QFeedback_NotFound",B[B.QFeedback_OK=4]="QFeedback_OK",B[B.QFeedback_Perfect=5]="QFeedback_Perfect",B[B.Debug1=6]="Debug1",B[B.Debug2=7]="Debug2",B[B.Debug3=8]="Debug3",B))(NoteState||{}),AutoColorSet=(B=>(B.C="#d82c6b",B.D="#F89D15",B.E="#FFE21A",B.F="#4dbd5c",B.G="#009D96",B.A="#43469d",B.B="#76429c",B.Rest="#000000",B))(AutoColorSet||{});class GraphicalLine{constructor(D,R,F=0,G=OutlineAndFillStyleEnum.BaseWritingColor,j=void 0){this.start=D,this.end=R,this.width=F,this.styleId=G,this.colorHex=j}get Start(){return this.start}set Start(D){this.start=D}get End(){return this.end}set End(D){this.end=D}get Width(){return this.width}set Width(D){this.width=D}}class ClefInstruction extends AbstractNotationInstruction{constructor(D=ClefEnum.G,R=0,F=2){super(void 0),this.clefType=ClefEnum.G,this.line=2,this.octaveOffset=0,this.line=F,this.clefType=D,this.octaveOffset=R,this.calcParameters()}static getDefaultClefFromMidiInstrument(D){switch(D){case MidiInstrument.Acoustic_Grand_Piano:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Electric_Bass_finger:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Electric_Bass_pick:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Fretless_Bass:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Slap_Bass_1:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Slap_Bass_2:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Synth_Bass_1:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Synth_Bass_2:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Contrabass:return new ClefInstruction(ClefEnum.F,0,4);default:return new ClefInstruction(ClefEnum.G,0,2)}}static getAllPossibleClefs(){const D=[];for(let R=0;R<=2;R++){const F=new ClefInstruction(ClefEnum.G,R,2);D.push(F)}for(let R=-2;R<=0;R++){const F=new ClefInstruction(ClefEnum.F,R,4);D.push(F)}return D}static isSupportedClef(D){switch(D){case ClefEnum.G:case ClefEnum.F:case ClefEnum.C:case ClefEnum.percussion:case ClefEnum.TAB:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(D){this.clefType=D}get Line(){return this.line}set Line(D){this.line=D}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(D){this.octaveOffset=D}get ClefPitch(){return this.clefPitch}set ClefPitch(D){this.clefPitch=D}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(D){this.referenceCyPosition=D}Equals(D){return this===D?!0:!this||!D?!1:this.clefPitch===D.clefPitch&&this.Line===D.Line}NotEqual(D){return!this.Equals(D)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case ClefEnum.G:this.clefPitch=new Pitch(NoteEnum.G,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case ClefEnum.F:this.clefPitch=new Pitch(NoteEnum.F,0+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case ClefEnum.C:this.clefPitch=new Pitch(NoteEnum.C,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case ClefEnum.percussion:this.clefPitch=new Pitch(NoteEnum.C,2,AccidentalEnum.NONE),this.referenceCyPosition=2;break;case ClefEnum.TAB:this.clefPitch=new Pitch(NoteEnum.G,0,AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new ArgumentOutOfRangeException("clefType")}}}var ClefEnum=(B=>(B[B.G=0]="G",B[B.F=1]="F",B[B.C=2]="C",B[B.percussion=3]="percussion",B[B.TAB=4]="TAB",B))(ClefEnum||{}),MidiInstrument=(B=>(B[B.None=-1]="None",B[B.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",B[B.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",B[B.Electric_Grand_Piano=2]="Electric_Grand_Piano",B[B.Honky_tonk_Piano=3]="Honky_tonk_Piano",B[B.Electric_Piano_1=4]="Electric_Piano_1",B[B.Electric_Piano_2=5]="Electric_Piano_2",B[B.Harpsichord=6]="Harpsichord",B[B.Clavinet=7]="Clavinet",B[B.Celesta=8]="Celesta",B[B.Glockenspiel=9]="Glockenspiel",B[B.Music_Box=10]="Music_Box",B[B.Vibraphone=11]="Vibraphone",B[B.Marimba=12]="Marimba",B[B.Xylophone=13]="Xylophone",B[B.Tubular_Bells=14]="Tubular_Bells",B[B.Dulcimer=15]="Dulcimer",B[B.Drawbar_Organ=16]="Drawbar_Organ",B[B.Percussive_Organ=17]="Percussive_Organ",B[B.Rock_Organ=18]="Rock_Organ",B[B.Church_Organ=19]="Church_Organ",B[B.Reed_Organ=20]="Reed_Organ",B[B.Accordion=21]="Accordion",B[B.Harmonica=22]="Harmonica",B[B.Tango_Accordion=23]="Tango_Accordion",B[B.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",B[B.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",B[B.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",B[B.Electric_Guitar_clean=27]="Electric_Guitar_clean",B[B.Electric_Guitar_muted=28]="Electric_Guitar_muted",B[B.Overdriven_Guitar=29]="Overdriven_Guitar",B[B.Distortion_Guitar=30]="Distortion_Guitar",B[B.Guitar_harmonics=31]="Guitar_harmonics",B[B.Acoustic_Bass=32]="Acoustic_Bass",B[B.Electric_Bass_finger=33]="Electric_Bass_finger",B[B.Electric_Bass_pick=34]="Electric_Bass_pick",B[B.Fretless_Bass=35]="Fretless_Bass",B[B.Slap_Bass_1=36]="Slap_Bass_1",B[B.Slap_Bass_2=37]="Slap_Bass_2",B[B.Synth_Bass_1=38]="Synth_Bass_1",B[B.Synth_Bass_2=39]="Synth_Bass_2",B[B.Violin=40]="Violin",B[B.Viola=41]="Viola",B[B.Cello=42]="Cello",B[B.Contrabass=43]="Contrabass",B[B.Tremolo_Strings=44]="Tremolo_Strings",B[B.Pizzicato_Strings=45]="Pizzicato_Strings",B[B.Orchestral_Harp=46]="Orchestral_Harp",B[B.Timpani=47]="Timpani",B[B.String_Ensemble_1=48]="String_Ensemble_1",B[B.String_Ensemble_2=49]="String_Ensemble_2",B[B.Synth_Strings_1=50]="Synth_Strings_1",B[B.Synth_Strings_2=51]="Synth_Strings_2",B[B.Choir_Aahs=52]="Choir_Aahs",B[B.Voice_Oohs=53]="Voice_Oohs",B[B.Synth_Voice=54]="Synth_Voice",B[B.Orchestra_Hit=55]="Orchestra_Hit",B[B.Trumpet=56]="Trumpet",B[B.Trombone=57]="Trombone",B[B.Tuba=58]="Tuba",B[B.Muted_Trumpet=59]="Muted_Trumpet",B[B.French_Horn=60]="French_Horn",B[B.Brass_Section=61]="Brass_Section",B[B.Synth_Brass_1=62]="Synth_Brass_1",B[B.Synth_Brass_2=63]="Synth_Brass_2",B[B.Soprano_Sax=64]="Soprano_Sax",B[B.Alto_Sax=65]="Alto_Sax",B[B.Tenor_Sax=66]="Tenor_Sax",B[B.Baritone_Sax=67]="Baritone_Sax",B[B.Oboe=68]="Oboe",B[B.English_Horn=69]="English_Horn",B[B.Bassoon=70]="Bassoon",B[B.Clarinet=71]="Clarinet",B[B.Piccolo=72]="Piccolo",B[B.Flute=73]="Flute",B[B.Recorder=74]="Recorder",B[B.Pan_Flute=75]="Pan_Flute",B[B.Blown_Bottle=76]="Blown_Bottle",B[B.Shakuhachi=77]="Shakuhachi",B[B.Whistle=78]="Whistle",B[B.Ocarina=79]="Ocarina",B[B.Lead_1_square=80]="Lead_1_square",B[B.Lead_2_sawtooth=81]="Lead_2_sawtooth",B[B.Lead_3_calliope=82]="Lead_3_calliope",B[B.Lead_4_chiff=83]="Lead_4_chiff",B[B.Lead_5_charang=84]="Lead_5_charang",B[B.Lead_6_voice=85]="Lead_6_voice",B[B.Lead_7_fifths=86]="Lead_7_fifths",B[B.Lead_8_bass_lead=87]="Lead_8_bass_lead",B[B.Pad_1_new_age=88]="Pad_1_new_age",B[B.Pad_2_warm=89]="Pad_2_warm",B[B.Pad_3_polysynth=90]="Pad_3_polysynth",B[B.Pad_4_choir=91]="Pad_4_choir",B[B.Pad_5_bowed=92]="Pad_5_bowed",B[B.Pad_6_metallic=93]="Pad_6_metallic",B[B.Pad_7_halo=94]="Pad_7_halo",B[B.Pad_8_sweep=95]="Pad_8_sweep",B[B.FX_1_rain=96]="FX_1_rain",B[B.FX_2_soundtrack=97]="FX_2_soundtrack",B[B.FX_3_crystal=98]="FX_3_crystal",B[B.FX_4_atmosphere=99]="FX_4_atmosphere",B[B.FX_5_brightness=100]="FX_5_brightness",B[B.FX_6_goblins=101]="FX_6_goblins",B[B.FX_7_echoes=102]="FX_7_echoes",B[B.FX_8_scifi=103]="FX_8_scifi",B[B.Sitar=104]="Sitar",B[B.Banjo=105]="Banjo",B[B.Shamisen=106]="Shamisen",B[B.Koto=107]="Koto",B[B.Kalimba=108]="Kalimba",B[B.Bag_pipe=109]="Bag_pipe",B[B.Fiddle=110]="Fiddle",B[B.Shanai=111]="Shanai",B[B.Tinkle_Bell=112]="Tinkle_Bell",B[B.Agogo=113]="Agogo",B[B.Steel_Drums=114]="Steel_Drums",B[B.Woodblock=115]="Woodblock",B[B.Taiko_Drum=116]="Taiko_Drum",B[B.Melodic_Tom=117]="Melodic_Tom",B[B.Synth_Drum=118]="Synth_Drum",B[B.Reverse_Cymbal=119]="Reverse_Cymbal",B[B.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",B[B.Breath_Noise=121]="Breath_Noise",B[B.Seashore=122]="Seashore",B[B.Bird_Tweet=123]="Bird_Tweet",B[B.Telephone_Ring=124]="Telephone_Ring",B[B.Helicopter=125]="Helicopter",B[B.Applause=126]="Applause",B[B.Gunshot=127]="Gunshot",B[B.euphonium=128]="euphonium",B[B.AltoClarinetInEb=200]="AltoClarinetInEb",B[B.TrumpetInBb=201]="TrumpetInBb",B[B.BaritoneSaxophone=202]="BaritoneSaxophone",B[B.TenorSaxophone=203]="TenorSaxophone",B[B.ClarinetInEb=204]="ClarinetInEb",B[B.Euphonium=205]="Euphonium",B[B.Alto_Clarinet=206]="Alto_Clarinet",B[B.Bass_Clarinet=207]="Bass_Clarinet",B[B.Bass_Trombone=208]="Bass_Trombone",B[B.clarinet_in_bb=209]="clarinet_in_bb",B[B.clarinet_in_eb=210]="clarinet_in_eb",B[B.Percussion=135]="Percussion",B))(MidiInstrument||{});const _KeyInstruction=class extends AbstractNotationInstruction{constructor(B=void 0,D=0,R=KeyEnum.major){super(B),this.isTransposedBy=0,this.Key=D,this.keyTypeOriginal=D,this.mode=R,this.alteratedNotes=this.calcAlteratedNotes()}static copy(B){const D=new _KeyInstruction(B.parent,B.Key,B.Mode);return D.keyTypeOriginal=B.keyTypeOriginal,D}static getAllPossibleMajorKeyInstructions(){const B=[];for(let D=-7;D<7;D++){const R=new _KeyInstruction(void 0,D,KeyEnum.major);B.push(R)}return B}get Key(){return this.keyType}set Key(B){this.keyType=B,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(B){this.mode=B}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const B=[];if(this.keyType>0)for(let D=0;D=0}getAlterationForPitch(B){return this.keyType>0&&this.alteratedNotes.indexOf(B.FundamentalNote)<=this.keyType?AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(B.FundamentalNote)<=Math.abs(this.keyType)?AccidentalEnum.FLAT:AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(B){const D=this;return D===B?!0:!D||!B?!1:D.Key===B.Key&&D.Mode===B.Mode}OperatorNotEqual(B){return!this.OperatorEquals(B)}};let KeyInstruction=_KeyInstruction;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];var KeyEnum=(B=>(B[B.major=0]="major",B[B.minor=1]="minor",B[B.none=2]="none",B[B.dorian=3]="dorian",B[B.phrygian=4]="phrygian",B[B.lydian=5]="lydian",B[B.mixolydian=6]="mixolydian",B[B.aeolian=7]="aeolian",B[B.ionian=8]="ionian",B[B.locrian=9]="locrian",B))(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(B){return this.indexOf(B)!==-1}});class CollectionUtil{static contains2(D,R){for(let F=0;F{var F,G,j,U;return((G=(F=R.sourceNote.Pitch)==null?void 0:F.getHalfTone())!=null?G:0)-((U=(j=D.sourceNote.Pitch)==null?void 0:j.getHalfTone())!=null?U:0)}),this.notes}sortForVexflow(){return this.notes.sort((D,R)=>{var F,G,j;return((G=(F=D.sourceNote.Pitch)==null?void 0:F.getHalfTone())!=null?G:0)-((j=R.sourceNote.Pitch.getHalfTone())!=null?j:0)}),this.notes}color(){}}class GraphicalMusicSheet{constructor(D,R){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=D,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=R,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get JianpuKeySignature(){return this.jianpuKeySignature}set JianpuKeySignature(D){this.jianpuKeySignature=D}get MusicPages(){return this.musicPages}set MusicPages(D){this.musicPages=D}get MeasureList(){return this.measureList}set MeasureList(D){this.measureList=D}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(D){this.verticalGraphicalStaffEntryContainers=D}get Title(){return this.title}set Title(D){this.title=D}get Subtitle(){return this.subtitle}set Subtitle(D){this.subtitle=D}get Composer(){return this.composer}set Composer(D){this.composer=D}get Lyricist(){return this.lyricist}set Lyricist(D){this.lyricist=D}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(D){this.minAllowedSystemWidth=D}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(D){this.leadSheet=D}static transformRelativeToAbsolutePosition(D){for(let R=0;R=0;F--){const G=this.measureList[F][R];if(G)return G}}findGraphicalStaffEntryFromMeasureList(D,R,F){for(let G=R;G0)return U.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(D,R){const F=[],G=this.measureList[0].length;for(let j=D;j<=R;j++)for(let U=0;U=0;R--){if(this.verticalGraphicalStaffEntryContainers[R].AbsoluteTimestamp.lt(D)){const F=new VerticalGraphicalStaffEntryContainer(this.numberOfStaves,D);return this.verticalGraphicalStaffEntryContainers.splice(R+1,0,F),F}if(this.verticalGraphicalStaffEntryContainers[R].AbsoluteTimestamp.Equals(D))return this.verticalGraphicalStaffEntryContainers[R]}}GetVerticalContainerFromTimestamp(D,R=0){const F=CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new VerticalGraphicalStaffEntryContainer(0,D),VerticalGraphicalStaffEntryContainer.compareByTimestamp,R);if(F>=0)return this.verticalGraphicalStaffEntryContainers[F]}GetInterpolatedIndexInVerticalContainers(D){const R=this.verticalGraphicalStaffEntryContainers;let F=0,G=R.length-1,j,U;if(D.lte(R[R.length-1].AbsoluteTimestamp)){for(;G-F>1;){const Z=Math.floor((G+F)/2);if(R[F].AbsoluteTimestamp.Equals(D)){G=F;break}else if(R[G].AbsoluteTimestamp.Equals(D)){F=G;break}else{if(R[Z].AbsoluteTimestamp.Equals(D))return this.verticalGraphicalStaffEntryContainers.indexOf(R[Z]);D.lt(R[Z].AbsoluteTimestamp)?G=Z:F=Z}}if(F===G)return this.verticalGraphicalStaffEntryContainers.indexOf(R[F]);j=R[F].AbsoluteTimestamp,U=R[G].AbsoluteTimestamp}else j=R[R.length-1].AbsoluteTimestamp,U=Fraction$1.plus(this.getLongestStaffEntryDuration(R.length-1),j),G=R.length;const W=U.RealValue-j.RealValue,Y=U.RealValue-D.RealValue,Q=G-Y/W;return Math.min(Q,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(D){const R=[],F=[];for(let G=0,j=D.length;G{var F;return((F=R.parentStaffEntry)==null?void 0:F.relInMeasureTimestamp)!==void 0})}GetNearestNote(D,R){const F=this.GetNearestVoiceEntry(D);if(!F)return;let G,j=Number.MAX_SAFE_INTEGER;for(const U of F.notes){const W=U.PositionAndShape.AbsolutePosition.y,Y=Math.abs(U.PositionAndShape.AbsolutePosition.x-D.x),Q=Math.abs(W-D.y);Y+QU.PositionAndShape.RelativePosition.x&&(F=U):F=U)}}catch(G){log$2.info("GraphicalMusicSheet.getStaffEntry",G)}return F}GetPreviousVisibleContainerIndex(D){for(let R=D-1;R>=0;R--){const F=this.verticalGraphicalStaffEntryContainers[R].StaffEntries;for(let G=0,j=F.length;G=0;j--)if(F=this.getStaffEntry(j),F)if(R){if(F.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return F}else return F}findClosestRightStaffEntry(D,R){let F;const G=Math.max(0,Math.ceil(D));for(let j=G;j{};Vex.L=(B,D)=>{if(!D)return;const R=Array.prototype.slice.call(D).join(" ");window.console.log(B+": "+R)};Vex.MakeException=B=>class extends Error{constructor(R,F){super(R),this.name=B,this.message=R,this.data=F}};class RuntimeError{constructor(D,R){this.code=D,this.message=R}toString(){return"[RuntimeError] "+this.code+":"+this.message}}Vex.RuntimeError=RuntimeError;Vex.RERR=Vex.RuntimeError;Vex.Merge=(B,D)=>{for(const R in D)B[R]=D[R];return B};Vex.Min=Math.min;Vex.Max=Math.max;Vex.forEach=(B,D)=>{for(let R=0;RB%D>=D/2?parseInt(B/D,10)*D+D:parseInt(B/D,10)*D;Vex.MidLine=(B,D)=>{let R=D+(B-D)/2;return R%2>0&&(R=Vex.RoundN(R*10,5)/10),R};Vex.SortAndUnique=(B,D,R)=>{if(B.length>1){const F=[];let G;B.sort(D);for(let j=0;j{let R=B.length;for(;R--;)if(B[R]===D)return!0;return!1};Vex.getCanvasContext=B=>{if(!B)throw new Vex.RERR("BadArgument","Invalid canvas selector: "+B);const D=document.getElementById(B);if(!(D&&D.getContext))throw new Vex.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return D.getContext("2d")};Vex.drawDot=(B,D,R,F="#55")=>{B.save(),B.setFillStyle(F),B.beginPath(),B.arc(D,R,3,0,Math.PI*2,!0),B.closePath(),B.fill(),B.restore()};Vex.BM=(B,D)=>{const R=new Date().getTime();D();const F=new Date().getTime()-R;Vex.L(B+F+"ms")};Vex.StackTrace=()=>new Error().stack;Vex.W=(...B)=>{const D=B.join(" ");window.console.log("Warning: ",D,Vex.StackTrace())};Vex.Prefix=B=>Vex.Prefix.prefix+B;Vex.Prefix.prefix="vf-";class Fraction{static GCD(D,R){if(typeof D!="number"||typeof R!="number")throw new Vex.RERR("BadArgument",`Invalid numbers: ${D}, ${R}`);let F;for(;R!==0;)F=R,R=D%R,D=F;return D}static LCM(D,R){return D*R/Fraction.GCD(D,R)}static LCMM(D){if(D.length===0)return 0;if(D.length===1)return D[0];if(D.length===2)return Fraction.LCM(D[0],D[1]);{const R=D[0];return D.shift(),Fraction.LCM(R,Fraction.LCMM(D))}}constructor(D,R){this.set(D,R)}set(D,R){return this.numerator=D===void 0?1:D,this.denominator=R===void 0?1:R,this}value(){return this.numerator/this.denominator}simplify(){let D=this.numerator,R=this.denominator;const F=Fraction.GCD(D,R);return D/=F,R/=F,R<0&&(R=-R,D=-D),this.set(D,R)}add(D,R){let F,G;D instanceof Fraction?(F=D.numerator,G=D.denominator):(D!==void 0?F=D:F=0,R!==void 0?G=R:G=1);const j=Fraction.LCM(this.denominator,G),U=j/this.denominator,W=j/G,Y=this.numerator*U+F*W;return this.set(Y,j)}subtract(D,R){let F,G;D instanceof Fraction?(F=D.numerator,G=D.denominator):(D!==void 0?F=D:F=0,R!==void 0?G=R:G=1);const j=Fraction.LCM(this.denominator,G),U=j/this.denominator,W=j/G,Y=this.numerator*U-F*W;return this.set(Y,j)}multiply(D,R){let F,G;return D instanceof Fraction?(F=D.numerator,G=D.denominator):(D!==void 0?F=D:F=1,R!==void 0?G=R:G=1),this.set(this.numerator*F,this.denominator*G)}divide(D,R){let F,G;return D instanceof Fraction?(F=D.numerator,G=D.denominator):(D!==void 0?F=D:F=1,R!==void 0?G=R:G=1),this.set(this.numerator*G,this.denominator*F)}equals(D){const R=Fraction.__compareA.copy(D).simplify(),F=Fraction.__compareB.copy(this).simplify();return R.numerator===F.numerator&&R.denominator===F.denominator}greaterThan(D){const R=Fraction.__compareB.copy(this);return R.subtract(D),R.numerator>0}greaterThanEquals(D){const R=Fraction.__compareB.copy(this);return R.subtract(D),R.numerator>=0}lessThan(D){return!this.greaterThanEquals(D)}lessThanEquals(D){return!this.greaterThan(D)}clone(){return new Fraction(this.numerator,this.denominator)}copy(D){return typeof D=="number"?this.set(D||0,1):this.set(D.numerator,D.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 D="";const R=this.quotient(),F=Fraction.__tmp.copy(this);return R<0?F.abs().fraction():F.fraction(),R!==0?(D+=R,F.numerator!==0&&(D+=" "+F.toSimplifiedString())):F.numerator===0?D="0":D=F.toSimplifiedString(),D}parse(D){const R=D.split("/"),F=parseInt(R[0],10),G=R[1]?parseInt(R[1],10):1;return this.set(F,G)}}Fraction.__compareA=new Fraction;Fraction.__compareB=new Fraction;Fraction.__tmp=new Fraction;const X$3=Vex.MakeException("RegistryError");function setIndexValue(B,D,R,F,G){B[D][R]||(B[D][R]={}),B[D][R][F]=G}class Registry{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(D){Registry.defaultRegistry=D}static getDefaultRegistry(){return Registry.defaultRegistry}static disableDefaultRegistry(){Registry.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:D,name:R,value:F,oldValue:G}){const j=this.getElementById(D);G!==null&&this.index[R][G]&&delete this.index[R][G][D],F!==null&&setIndexValue(this.index,R,F,j.getAttribute("id"),j)}register(D,R){if(R=R||D.getAttribute("id"),!R)throw new X$3("Can't add element without `id` attribute to registry",D);return D.setAttribute("id",R),setIndexValue(this.index,"id",R,R,D),Registry.INDEXES.forEach(F=>{this.updateIndex({id:R,name:F,value:D.getAttribute(F),oldValue:null})}),D.onRegister(this),this}getElementById(D){return this.index.id[D]?this.index.id[D][D]:null}getElementsByAttribute(D,R){const F=this.index[D];return F&&F[R]?Object.keys(F[R]).map(G=>F[R][G]):[]}getElementsByType(D){return this.getElementsByAttribute("type",D)}getElementsByClass(D){return this.getElementsByAttribute("class",D)}onUpdate({id:D,name:R,value:F,oldValue:G}){function j(U,W){return U.filter(Y=>Y===W).length>0}return j(Registry.INDEXES.concat(["id","class"]),R)?(this.updateIndex({id:D,name:R,value:F,oldValue:G}),this):this}}Registry.defaultRegistry=null;class Element$2{static newID(){return"auto"+Element$2.ID++}constructor({type:D}={}){this.attrs={id:Element$2.newID(),el:null,type:D||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,Registry.getDefaultRegistry()&&Registry.getDefaultRegistry().register(this)}setStyle(D){return this.style=D,this}getStyle(){return this.style}applyStyle(D=this.context,R=this.getStyle()){return R?(D.save(),R.shadowColor&&D.setShadowColor(R.shadowColor),R.shadowBlur&&D.setShadowBlur(R.shadowBlur),R.fillStyle&&D.setFillStyle(R.fillStyle),R.strokeStyle&&D.setStrokeStyle(R.strokeStyle),R.lineWidth&&D.setLineWidth(R.lineWidth),this):this}restoreStyle(D=this.context,R=this.getStyle()){return R?(D.restore(),this):this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(D){return this.attrs.classes[D]===!0}addClass(D){return this.attrs.classes[D]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:D,oldValue:null}),this}removeClass(D){return delete this.attrs.classes[D],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:D}),this}onRegister(D){return this.registry=D,this}isRendered(){return this.rendered}setRendered(D=!0){return this.rendered=D,this}getAttributes(){return this.attrs}getAttribute(D){return this.attrs[D]}setAttribute(D,R){const F=this.attrs.id,G=this.attrs[D];return this.attrs[D]=R,this.registry&&this.registry.onUpdate({id:F,name:D,value:R,oldValue:G}),this}getContext(){return this.context}setContext(D){return this.context=D,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new Vex.RERR("NoContext","No rendering context attached to instance");return this.context}}Element$2.ID=1e3;class BoundingBoxComputation{constructor(D,R,F,G){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(D,R),this.addPoint(F,G)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(D,R){D!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=D,this.x2=D),Dthis.x2&&(this.x2=D)),R!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=R,this.y2=R),Rthis.y2&&(this.y2=R))}addX(D){this.addPoint(D,null)}addY(D){this.addPoint(null,D)}addQuadraticCurve(D,R,F,G,j,U){const W=D+.6666666666666666*(F-D),Y=R+2/3*(G-R),Q=W+1/3*(j-D),Z=Y+1/3*(U-R);this.addBezierCurve(D,R,W,Y,Q,Z,j,U)}addBezierCurve(D,R,F,G,j,U,W,Y){const Q=[D,R],Z=[F,G],q=[j,U],J=[W,Y];let K;this.addPoint(Q[0],Q[1]),this.addPoint(J[0],J[1]);const te=(ne,ie)=>Math.pow(1-ne,3)*Q[ie]+3*Math.pow(1-ne,2)*ne*Z[ie]+3*(1-ne)*Math.pow(ne,2)*q[ie]+Math.pow(ne,3)*J[ie];for(K=0;K<=1;K++){const ne=6*Q[K]-12*Z[K]+6*q[K],ie=-3*Q[K]+9*Z[K]-9*q[K]+3*J[K],re=3*Z[K]-3*Q[K];if(ie===0){if(ne===0)continue;const he=-re/ne;0{if(!B)throw new Vex.RERR("BadArgument","Invalid clef: "+B);const D=Flow.clefProperties.values[B];if(!D)throw new Vex.RERR("BadArgument","Invalid clef: "+B);return D};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=(B,D,R)=>{D===void 0&&(D="treble");const F={octave_shift:0};typeof R=="object"&&Vex.Merge(F,R);const G=B.split("/");if(G.length<2)throw new Vex.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${B}`);const j=G[0].toUpperCase(),U=Flow.keyProperties.note_values[j];if(!U)throw new Vex.RERR("BadArguments","Invalid key name: "+j);U.octave&&(G[1]=U.octave);let W=parseInt(G[1],10);W+=-1*F.octave_shift;let Q=(W*7-4*7+U.index)/2;Q+=Flow.clefProperties(D).line_shift;let Z=0;Q<=0&&Q*2%2===0&&(Z=1),Q>=6&&Q*2%2===0&&(Z=-1);const q=typeof U.int_val!="undefined"?W*12+U.int_val:null,J=U.code,K=U.shift_right;let te={};if(G.length>2&&G[2]){const ne=G[2].toUpperCase();te=Flow.keyProperties.customNoteHeads[ne]||{}}return{key:j,octave:W,line:Q,int_value:q,accidental:U.accidental,code:J,stroke:Z,shift_right:K,displaced:!1,...te}};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=B=>{if(typeof B=="undefined")throw new Vex.RERR("BadArguments","Undefined integer for integerToNote");if(B<-2)throw new Vex.RERR("BadArguments",`integerToNote requires integer > -2: ${B}`);const D=Flow.integerToNote.table[B];if(!D)throw new Vex.RERR("BadArguments",`Unknown note value for integer: ${B}`);return D};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=(B,D=1)=>{let R=null,F=0,G=0;if(B.toString().toUpperCase()==="X"){const j=new Glyph("v7f",Flow.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();R="v7f",F=j.width,G=-j.height/2}else F=Flow.textWidth(B.toString());return{text:B,code:R,getWidth:()=>F*D,shift_y:G}};Flow.textWidth=B=>7*B.toString().length;Flow.articulationCodes=B=>Flow.articulationCodes.articulations[B];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=B=>Flow.accidentalCodes.accidentals[B];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=B=>Flow.ornamentCodes.ornaments[B];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=B=>{const D=Flow.keySignature.keySpecs[B];if(!D)throw new Vex.RERR("BadKeySignature",`Bad key signature spec: '${B}'`);if(!D.acc)return[];const R=Flow.keySignature.accidentalList(D.acc),F=[];for(let G=0;G({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[B];Flow.parseNoteDurationString=B=>{if(typeof B!="string")return null;const R=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(B);if(!R)return null;const F=R[1],G=R[2].length;let j=R[3];return j.length===0&&(j="n"),{duration:F,dots:G,type:j}};Flow.parseNoteStruct=B=>{const D=B.duration,R=Flow.parseNoteDurationString(D);if(!R)return null;let F=Flow.durationToTicks(R.duration);if(F==null)return null;let G=B.type;const j=[];if(G){if(!Flow.getGlyphProps.validTypes[G])return null}else G=R.type||"n",B.keys!==void 0&&B.keys.forEach((Y,Q)=>{const Z=Y.split("/");Z&&Z.length===3&&(j[Q]=Z[2])});const U=B.dots?B.dots:R.dots;if(typeof U!="number")return null;let W=F;for(let Y=0;Y{const D=Flow.durationAliases[B];if(D!==void 0&&(B=D),Flow.durationToTicks.durations[B]===void 0)throw new Vex.RERR("BadArguments",`The provided duration is not valid: ${B}`);return B};Flow.durationToFraction=B=>new Fraction().parse(Flow.sanitizeDuration(B));Flow.durationToNumber=B=>Flow.durationToFraction(B).value();Flow.durationToTicks=B=>{B=Flow.sanitizeDuration(B);const D=Flow.durationToTicks.durations[B];return D===void 0?null:D};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=(B,D)=>{B=Flow.sanitizeDuration(B);const R=Flow.getGlyphProps.duration_codes[B];if(R===void 0)return null;D||(D="n");let F=R.type[D];if(F===void 0){const G=Flow.keyProperties.customNoteHeads[D.toUpperCase()];if(G===void 0)return null;F={code_head:G.code,...G}}return{...R.common,...F}};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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v53",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v1d",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v81",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).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(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).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(D,R){return Math.max(D,R)>this.CANVAS_BROWSER_SIZE_LIMIT&&(Vex.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),D>this.CANVAS_BROWSER_SIZE_LIMIT&&(D=this.CANVAS_BROWSER_SIZE_LIMIT),R>this.CANVAS_BROWSER_SIZE_LIMIT&&(R=this.CANVAS_BROWSER_SIZE_LIMIT)),[D,R]}constructor(D){this.vexFlowCanvasContext=D,D.canvas?this.canvas=D.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(D,R,F){return this.vexFlowCanvasContext.font=(F||"")+" "+R+"pt "+D,this}setRawFont(D){return this.vexFlowCanvasContext.font=D,this}setFillStyle(D){return this.vexFlowCanvasContext.fillStyle=D,this}setBackgroundFillStyle(D){return this.background_fillStyle=D,this}setStrokeStyle(D){return this.vexFlowCanvasContext.strokeStyle=D,this}setShadowColor(D){return this.vexFlowCanvasContext.shadowColor=D,this}setShadowBlur(D){return this.vexFlowCanvasContext.shadowBlur=D,this}setLineWidth(D){return this.vexFlowCanvasContext.lineWidth=D,this}setLineCap(D){return this.vexFlowCanvasContext.lineCap=D,this}setLineDash(D){return this.vexFlowCanvasContext.lineDash=D,this}scale(D,R){return this.vexFlowCanvasContext.scale(parseFloat(D),parseFloat(R))}resize(D,R){return[D,R]=this.SanitizeCanvasDims(parseInt(D,10),parseInt(R,10)),this.vexFlowCanvasContext.resize(D,R)}rect(D,R,F,G){return this.vexFlowCanvasContext.rect(D,R,F,G)}fillRect(D,R,F,G){return this.vexFlowCanvasContext.fillRect(D,R,F,G)}clearRect(D,R,F,G){return this.vexFlowCanvasContext.clearRect(D,R,F,G)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(D,R){return this.vexFlowCanvasContext.moveTo(D,R)}lineTo(D,R){return this.vexFlowCanvasContext.lineTo(D,R)}bezierCurveTo(D,R,F,G,j,U){return this.vexFlowCanvasContext.bezierCurveTo(D,R,F,G,j,U)}quadraticCurveTo(D,R,F,G){return this.vexFlowCanvasContext.quadraticCurveTo(D,R,F,G)}arc(D,R,F,G,j,U){return this.vexFlowCanvasContext.arc(D,R,F,G,j,U)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(D){return this.vexFlowCanvasContext.measureText(D)}fillText(D,R,F){return this.vexFlowCanvasContext.fillText(D,R,F)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}}class RaphaelContext{constructor(D){this.element=D,this.paper=Raphael(D),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(D,R,F){return this.state.font_family=D,this.state.font_size=R,this.state.font_weight=F,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(D){return this.attributes.font=D,this}setFillStyle(D){return this.attributes.fill=D,this}setBackgroundFillStyle(D){return this.background_attributes.fill=D,this.background_attributes.stroke=D,this}setStrokeStyle(D){return this.attributes.stroke=D,this}setShadowColor(D){return this.shadow_attributes.color=D,this}setShadowBlur(D){return this.shadow_attributes.width=D,this}setLineWidth(D){this.attributes["stroke-width"]=D,this.lineWidth=D}setLineDash(){return this}setLineCap(){return this}scale(D,R){return this.state.scale={x:D,y:R},this.attributes.transform="S"+D+","+R+",0,0",this.attributes.scale=D+","+R+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+D+","+R+",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(D,R){return this.element.style.width=D,this.paper.setSize(D,R),this}setViewBox(D){this.paper.canvas.setAttribute("viewBox",D)}rect(D,R,F,G){return G<0&&(R+=G,G=-G),this.paper.rect(D,R,F-.5,G-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(D,R,F,G){return G<0&&(R+=G,G=-G),this.paper.rect(D,R,F-.5,G-.5).attr(this.attributes),this}clearRect(D,R,F,G){return G<0&&(R+=G,G=-G),this.paper.rect(D,R,F-.5,G-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(D,R){return this.path+="M"+D+","+R,this.pen.x=D,this.pen.y=R,this}lineTo(D,R){return this.path+="L"+D+","+R,this.pen.x=D,this.pen.y=R,this}bezierCurveTo(D,R,F,G,j,U){return this.path+="C"+D+","+R+","+F+","+G+","+j+","+U,this.pen.x=j,this.pen.y=U,this}quadraticCurveTo(D,R,F,G){return this.path+="Q"+D+","+R+","+F+","+G,this.pen.x=F,this.pen.y=G,this}arc(D,R,F,G,j,U){function W(Q){for(;Q<0;)Q+=Math.PI*2;for(;Q>Math.PI*2;)Q-=Math.PI*2;return Q}if(G=W(G),j=W(j),G>j){const Q=G;G=j,j=Q,U=!U}const Y=j-G;return Y>Math.PI?(this.arcHelper(D,R,F,G,G+Y/2,U),this.arcHelper(D,R,F,G+Y/2,j,U)):this.arcHelper(D,R,F,G,j,U),this}arcHelper(D,R,F,G,j,U){const W=D+F*Math.cos(G),Y=R+F*Math.sin(G),Q=D+F*Math.cos(j),Z=R+F*Math.sin(j);let q=0,J=0;U?(J=1,j-GMath.PI&&(q=1),this.path+="M"+W+","+Y+",A"+F+","+F+",0,"+q+","+J+","+Q+","+Z+"M"+this.pen.x+","+this.pen.y}glow(){const D=this.paper.set();if(this.shadow_attributes.width>0){const R=this.shadow_attributes,F=R.width/2;for(let G=1;G<=F;G++)D.push(this.paper.path(this.path).attr({stroke:R.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(R.width/F*G).toFixed(3),opacity:+((R.opacity||.3)/F).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return D}fill(){const D=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(D),this}stroke(){const D=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,R=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",D);return this.glow(R),this}closePath(){return this.path+="Z",this}measureText(D){const R=this.paper.text(0,0,D).attr(this.attributes).attr("fill","none").attr("stroke","none"),F=R.getBBox();return R.remove(),{width:F.width,height:F.height}}fillText(D,R,F){return this.paper.text(R+this.measureText(D).width/2,F-this.state.font_size/(2.25*this.state.scale.y),D).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 D=this.state_stack.pop();return this.state.font_family=D.state.font_family,this.attributes.font=D.attributes.font,this.attributes.fill=D.attributes.fill,this.attributes.stroke=D.attributes.stroke,this.attributes["stroke-width"]=D.attributes["stroke-width"],this.shadow_attributes.width=D.shadow_attributes.width,this.shadow_attributes.color=D.shadow_attributes.color,this}}const attrNamesToIgnoreMap={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const B={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};Vex.Merge(attrNamesToIgnoreMap.rect,B),Vex.Merge(attrNamesToIgnoreMap.path,B)}class SVGContext{constructor(D){this.element=D,this.svgNS="http://www.w3.org/2000/svg";const R=this.create("svg");this.element.appendChild(R),this.svg=R,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(D){return document.createElementNS(this.svgNS,D)}openGroup(D,R,F){const G=this.create("g");return this.groups.push(G),this.parent.appendChild(G),this.parent=G,D&&G.setAttribute("class",Vex.Prefix(D)),R&&G.setAttribute("id",Vex.Prefix(R)),F&&F.pointerBBox&&G.setAttribute("pointer-events","bounding-box"),G}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(D){this.parent.appendChild(D)}iePolyfill(){typeof navigator!="undefined"&&(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(D,R,F){let G=!1,j=!1,U="normal";typeof F=="string"&&(F.indexOf("italic")!==-1&&(F=F.replace(/italic/g,""),j=!0),F.indexOf("bold")!==-1&&(F=F.replace(/bold/g,""),G=!0),F=F.replace(/ /g,"")),F=G?"bold":F,F=typeof F=="undefined"||F===""?"normal":F,U=j?"italic":U;const W={"font-family":D,"font-size":R+"pt","font-weight":F,"font-style":U};return this.fontSize=Number(R),Vex.Merge(this.attributes,W),Vex.Merge(this.state,W),this}setRawFont(D){D=D.trim();const R=D.split(" ");return this.attributes["font-family"]=R[1],this.state["font-family"]=R[1],this.attributes["font-size"]=R[0],this.state["font-size"]=R[0],this.fontSize=Number(R[0].match(/\d+/)),this}setFillStyle(D){return this.attributes.fill=D,this}setBackgroundFillStyle(D){return this.background_attributes.fill=D,this.background_attributes.stroke=D,this}setStrokeStyle(D){return this.attributes.stroke=D,this}setShadowColor(D){return this.shadow_attributes.color=D,this}setShadowBlur(D){return this.shadow_attributes.width=D,this}setLineWidth(D){this.attributes["stroke-width"]=D,this.lineWidth=D}setLineDash(D){if(Object.prototype.toString.call(D)==="[object Array]")return D=D.join(", "),this.attributes["stroke-dasharray"]=D,this;throw new Vex.RERR("ArgumentError","lineDash must be an array of integers.")}setLineCap(D){return this.attributes["stroke-linecap"]=D,this}resize(D,R){this.width=D,this.height=R,this.element.style.width=D;const F={width:D,height:R};return this.applyAttributes(this.svg,F),this.scale(this.state.scale.x,this.state.scale.y),this}scale(D,R){this.state.scale={x:D,y:R};const F=this.width/D,G=this.height/R;return this.setViewBox(0,0,F,G),this}setViewBox(...D){if(D.length===1){const[R]=D;this.svg.setAttribute("viewBox",R)}else{const[R,F,G,j]=D,U=R+" "+F+" "+G+" "+j;this.svg.setAttribute("viewBox",U)}}applyAttributes(D,R){const F=attrNamesToIgnoreMap[D.nodeName];return Object.keys(R).forEach(G=>{var j;F&&F[G]||!G||!R[G]||G==="d"&&((j=R[G])==null?void 0:j.indexOf("NaN"))>-1||D.setAttributeNS(null,G,R[G])}),D}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(D,R,F,G,j){G<0&&(R+=G,G*=-1);const U=this.create("rect");return typeof j=="undefined"&&(j={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),Vex.Merge(j,{x:D,y:R,width:F,height:G}),this.applyAttributes(U,j),this.add(U),this}fillRect(D,R,F,G){return G<0&&(R+=G,G*=-1),this.rect(D,R,F,G,this.attributes),this}clearRect(D,R,F,G){return this.rect(D,R,F,G,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(D,R){return this.path+="M"+D+" "+R,this.pen.x=D,this.pen.y=R,this}lineTo(D,R){return this.path+="L"+D+" "+R,this.pen.x=D,this.pen.y=R,this}bezierCurveTo(D,R,F,G,j,U){return this.path+="C"+D+" "+R+","+F+" "+G+","+j+" "+U,this.pen.x=j,this.pen.y=U,this}quadraticCurveTo(D,R,F,G){return this.path+="Q"+D+" "+R+","+F+" "+G,this.pen.x=F,this.pen.y=G,this}arc(D,R,F,G,j,U){function W(Q){for(;Q<0;)Q+=Math.PI*2;for(;Q>Math.PI*2;)Q-=Math.PI*2;return Q}if(G=W(G),j=W(j),G>j){const Q=G;G=j,j=Q,U=!U}const Y=j-G;return Y>Math.PI?(this.arcHelper(D,R,F,G,G+Y/2,U),this.arcHelper(D,R,F,G+Y/2,j,U)):this.arcHelper(D,R,F,G,j,U),this}arcHelper(D,R,F,G,j,U){const W=D+F*Math.cos(G),Y=R+F*Math.sin(G),Q=D+F*Math.cos(j),Z=R+F*Math.sin(j);let q=0,J=0;U?(J=1,j-GMath.PI&&(q=1),this.path+="M"+W+" "+Y+" A"+F+" "+F+" 0 "+q+" "+J+" "+Q+" "+Z,!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 D=this.shadow_attributes,R=D.width/2;for(let F=1;F<=R;F++){const G={stroke:D.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(D.width*.4/R*F).toFixed(3),opacity:+((D.opacity||.3)/R).toFixed(3)},j=this.create("path");G.d=this.path,this.applyAttributes(j,G),this.add(j)}}return this}fill(D){this.glow();const R=this.create("path");let F=D;return typeof D=="undefined"?(D={},Vex.Merge(D,this.attributes),D.stroke="none",F=D):(F=D,Vex.Merge(F,this.attributes),D.class&&(F.class=D.class),D.id&&(F.id=D.id)),D.d=this.path,this.applyAttributes(R,D),this.add(R),this}stroke(D=void 0){this.glow();const R=this.create("path"),F={};return Vex.Merge(F,this.attributes),D&&Vex.Merge(F,D),F.fill="none",F["stroke-width"]=this.lineWidth,F.d=this.path,this.applyAttributes(R,F),this.add(R),this}measureText(D){const R=this.create("text");if(typeof R.getBBox!="function")return{x:0,y:0,width:0,height:0};R.textContent=D,this.applyAttributes(R,this.attributes),this.svg.appendChild(R);let F=R.getBBox();return this.ie&&D!==""&&this.attributes["font-style"]==="italic"&&(F=this.ieMeasureTextFix(F,D)),this.svg.removeChild(R),F}ieMeasureTextFix(D){const R=Number(this.fontSize),F=1.196,G=1.9598,j=F*R+G,U=D.width-j,W=D.height-1.5;return{x:D.x,y:D.y,width:U,height:W}}fillText(D,R,F){if(!D||D.length<=0)return;const G={};Vex.Merge(G,this.attributes),G.stroke="none",G.x=R,G.y=F;const j=this.create("text");j.textContent=D,this.applyAttributes(j,G),this.add(j)}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 D=this.state_stack.pop();return this.state["font-family"]=D.state["font-family"],this.state["font-weight"]=D.state["font-weight"],this.state["font-style"]=D.state["font-style"],this.state["font-size"]=D.state["font-size"],this.state.scale=D.state.scale,this.attributes["font-family"]=D.attributes["font-family"],this.attributes["font-weight"]=D.attributes["font-weight"],this.attributes["font-style"]=D.attributes["font-style"],this.attributes["font-size"]=D.attributes["font-size"],this.attributes.fill=D.attributes.fill,this.attributes.stroke=D.attributes.stroke,this.attributes["stroke-width"]=D.attributes["stroke-width"],this.attributes["stroke-dasharray"]=D.attributes["stroke-dasharray"],this.shadow_attributes.width=D.shadow_attributes.width,this.shadow_attributes.color=D.shadow_attributes.color,this.lineWidth=D.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(D){lastContext=D}static buildContext(D,R,F,G,j){const U=new Renderer(D,R);F&&G&&U.resize(F,G),j||(j="#FFF");const W=U.getContext();return W.setBackgroundFillStyle(j),Renderer.lastContext=W,W}static getCanvasContext(D,R,F,G){return Renderer.buildContext(D,Renderer.Backends.CANVAS,R,F,G)}static getRaphaelContext(D,R,F,G){return Renderer.buildContext(D,Renderer.Backends.RAPHAEL,R,F,G)}static getSVGContext(D,R,F,G){return Renderer.buildContext(D,Renderer.Backends.SVG,R,F,G)}static bolsterCanvasContext(D){if(Renderer.USE_CANVAS_PROXY)return new CanvasContext(D);const R=["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"];return D.vexFlowCanvasContext=D,R.forEach(F=>{D[F]=D[F]||CanvasContext.prototype[F]}),D}static drawDashedLine(D,R,F,G,j,U){D.beginPath();const W=G-R,Y=j-F,Q=Math.atan2(Y,W);let Z=R,q=F;D.moveTo(R,F);let J=0,K=!0;for(;!((W<0?Z<=G:Z>=G)&&(Y<0?q<=j:q>=j));){const te=U[J++%U.length],ne=Z+Math.cos(Q)*te;Z=W<0?Math.max(G,ne):Math.min(G,ne);const ie=q+Math.sin(Q)*te;q=Y<0?Math.max(j,ie):Math.min(j,ie),K?D.lineTo(Z,q):D.moveTo(Z,q),K=!K}D.closePath(),D.stroke()}constructor(D,R){if(this.elementId=D,!this.elementId)throw new Vex.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(D),this.element||(this.element=D),this.ctx=null,this.paper=null,this.backend=R,this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement",`Can't get canvas context from element: ${D}`);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: ${this.backend}`)}resize(D,R){if(this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[D,R]=CanvasContext.SanitizeCanvasDims(D,R);const F=window.devicePixelRatio||1;this.element.width=D*F,this.element.height=R*F,this.element.style.width=D+"px",this.element.style.height=R+"px",this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(F,F)}else this.ctx.resize(D,R);return this}getContext(){return this.ctx}}function L$k(...B){Stem.DEBUG&&Vex.L("Vex.Flow.Stem",B)}class Stem extends Element$2{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(D={}){super(),this.setAttribute("type","Stem"),this.x_begin=D.x_begin||0,this.x_end=D.x_end||0,this.y_top=D.y_top||0,this.y_bottom=D.y_bottom||0,this.stem_extension=D.stem_extension||0,this.stem_direction=D.stem_direction||0,this.hide=D.hide||!1,this.isStemlet=D.isStemlet||!1,this.stemletHeight=D.stemletHeight||0,this.resetHeight=0,this.renderHeightAdjustment=0,this.setOptions(D)}setResetHeight(D){this.resetHeight=D}setOptions(D){this.stem_up_y_offset=D.stem_up_y_offset||0,this.stem_down_y_offset=D.stem_down_y_offset||0}setNoteHeadXBounds(D,R){return this.x_begin=D,this.x_end=R,this}setDirection(D){this.stem_direction=D}setExtension(D){this.stem_extension=D}getExtension(){return this.stem_extension}setYBounds(D,R){this.y_top=D,this.y_bottom=R}getCategory(){return Stem.CATEGORY}getHeight(){const D=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-D+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new Vex.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const D=this.stem_direction===Stem.UP,R=[this.y_top,this.y_bottom],F=Stem.HEIGHT+this.stem_extension,G=(D?Math.min:Math.max)(...R),j=(D?Math.max:Math.min)(...R);return{topY:G+F*-this.stem_direction+this.resetHeight*-this.stem_direction,baseY:j}}setVisibility(D){return this.hide=!D,this}setStemlet(D,R){return this.isStemlet=D,this.stemletHeight=R,this}draw(){if(this.setRendered(),this.hide)return;const D=this.checkContext();let R,F;const G=this.stem_direction;G===Stem.DOWN?(R=this.x_begin,F=this.y_top+this.stem_down_y_offset):(R=this.x_end,F=this.y_bottom-this.stem_up_y_offset);const j=this.getHeight();L$k("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const U=this.isStemlet?j-this.stemletHeight*this.stem_direction:0;if(D.save(),this.applyStyle(D),D.beginPath(),D.setLineWidth(Stem.WIDTH),D.moveTo(R,F-U),D.lineTo(R,F-j-this.renderHeightAdjustment*G-this.resetHeight*G),D.svg){const W={class:Vex.Prefix("stem")};this.id&&(W.id=this.id),D.stroke(W)}else D.stroke();this.restoreStyle(D),D.restore()}}class Tuplet$1 extends Element$2{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(D,R){if(super(),this.setAttribute("type","Tuplet"),!D||!D.length)throw new Vex.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=Vex.Merge({},R),this.notes=D,this.num_notes="num_notes"in this.options?this.options.num_notes:D.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=D.some(F=>F.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||Tuplet$1.LOCATION_TOP,Formatter.AlignRestsToNotes(D,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let D=0;D=1;)this.numerator_glyphs.unshift(new Glyph("v"+D%10,this.point)),D=parseInt(D/10,10);for(this.denom_glyphs=[],D=this.notes_occupied;D>=1;)this.denom_glyphs.unshift(new Glyph("v"+D%10,this.point)),D=parseInt(D/10,10)}getNestedTupletCount(){const D=this.location,R=this.notes[0];let F=j(R,D),G=j(R,D);function j(U,W){return U.tupletStack.filter(Y=>Y.location===W).length}return this.notes.forEach(U=>{const W=j(U,D);F=W>F?W:F,G=WG&&(G=U)}}return G+D+R}draw(){this.checkContext(),this.setRendered();const D=this.notes[0],R=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=D.getTieLeftX()-5,this.width=R.getTieRightX()-this.x_pos+5):(this.x_pos=D.getStemX(),this.width=R.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const F=(Y,Q)=>Y+Q.getMetrics().width;let G=this.numerator_glyphs.reduce(F,0);this.ratioed&&(G=this.denom_glyphs.reduce(F,G),G+=this.point*.32);const U=this.x_pos+this.width/2-G/2;if(this.bracketed){const Y=this.width/2-G/2-5;Y>0&&(this.context.fillRect(this.x_pos,this.y_pos,Y,1),this.context.fillRect(this.x_pos+this.width/2+G/2+5,this.y_pos,Y,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===Tuplet$1.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===Tuplet$1.LOCATION_BOTTOM),1,this.location*10))}let W=0;if(this.numerator_glyphs.forEach(Y=>{Y.render(this.context,U+W,this.y_pos+this.point/3-2),W+=Y.getMetrics().width}),this.ratioed){const Y=U+W+this.point*.16,Q=this.point*.06;this.context.beginPath(),this.context.arc(Y,this.y_pos-this.point*.08,Q,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(Y,this.y_pos+this.point*.12,Q,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),W+=this.point*.32,this.denom_glyphs.forEach(Z=>{Z.render(this.context,U+W,this.y_pos+this.point/3-2),W+=Z.getMetrics().width})}}}function calculateStemDirection(B){let D=0;return B.forEach(R=>{R.keyProps&&R.keyProps.forEach(F=>{D+=F.line-3})}),D>=0?Stem.DOWN:Stem.UP}const getStemSlope=(B,D)=>{const R=B.getStemExtents().topY,F=B.getStemX(),G=D.getStemExtents().topY,j=D.getStemX();return(G-R)/(j-F)},BEAM_LEFT="L",BEAM_RIGHT="R",BEAM_BOTH="B";class Beam$1 extends Element$2{static getDefaultBeamGroups(D){(!D||D==="c")&&(D="4/4");const F={"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"]}[D];if(F===void 0){const G=parseInt(D.split("/")[0],10),j=parseInt(D.split("/")[1],10);if(G%3===0)return[new Fraction(3,j)];if(j>4)return[new Fraction(2,j)];if(j<=4)return[new Fraction(1,j)]}else return F.map(G=>new Fraction().parse(G));return[new Fraction(1,4)]}static applyAndGetBeams(D,R,F){return Beam$1.generateBeams(D.getTickables(),{groups:F,stem_direction:R})}static generateBeams(D,R){R||(R={}),(!R.groups||!R.groups.length)&&(R.groups=[new Fraction(2,8)]);const F=R.groups.map(fe=>{if(!fe.multiply)throw new Vex.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return fe.clone().multiply(Flow.RESOLUTION,1)}),G=D;let j=0,U=[],W=[];function Y(fe){return fe.reduce((he,ge)=>ge.getTicks().clone().add(he),new Fraction(0,1))}function Q(){F.length-1>j?j+=1:j=0}function Z(){let fe=[];G.forEach(he=>{if(fe=[],he.shouldIgnoreTicks()){U.push(W),W=fe;return}W.push(he);const ge=F[j].clone(),ue=Y(W),me=Flow.durationToNumber(he.duration)<8;me&&he.tuplet&&(ge.numerator*=2),ue.greaterThan(ge)?(me||fe.push(W.pop()),U.push(W),W=fe,Q()):ue.equals(ge)&&(U.push(W),W=fe,Q())}),W.length>0&&U.push(W)}function q(){return U.filter(fe=>{if(fe.length>1){let he=!0;return fe.forEach(ge=>{ge.getIntrinsicTicks()>=Flow.durationToTicks("4")&&(he=!1)}),he}return!1})}function J(){const fe=[];U.forEach(he=>{let ge=[];he.forEach((ue,me,be)=>{const ve=me===0||me===be.length-1,pe=be[me-1],ye=!R.beam_rests&&ue.isRest(),xe=R.beam_rests&&R.beam_middle_only&&ue.isRest()&&ve;let ce=!1;if(R.maintain_stem_directions&&pe&&!ue.isRest()&&!pe.isRest()){const Ae=pe.getStemDirection();ce=ue.getStemDirection()!==Ae}const we=parseInt(ue.duration,10)<8;ye||xe||ce||we?(ge.length>0&&fe.push(ge),ge=ce?[ue]:[]):ge.push(ue)}),ge.length>0&&fe.push(ge)}),U=fe}function K(){U.forEach(fe=>{let he;if(R.maintain_stem_directions){const ge=te(fe);he=ge?ge.getStemDirection():Stem.UP}else R.stem_direction?he=R.stem_direction:he=calculateStemDirection(fe);ne(fe,he)})}function te(fe){for(let he=0;he{ge.setStemDirection(he)})}function ie(){const fe=[];return U.forEach(he=>{let ge=null;he.forEach(ue=>{ue.tuplet&&ge!==ue.tuplet&&(ge=ue.tuplet,fe.push(ge))})}),fe}Z(),J(),K();const re=q(),oe=ie(),le=[];return re.forEach(fe=>{const he=new Beam$1(fe);R.show_stemlets&&(he.render_options.show_stemlets=!0),R.secondary_breaks&&(he.render_options.secondary_break_ticks=Flow.durationToTicks(R.secondary_breaks)),R.flat_beams===!0&&(he.render_options.flat_beams=!0,he.render_options.flat_beam_offset=R.flat_beam_offset),le.push(he)}),oe.forEach(fe=>{const he=fe.notes[0].stem_direction===Stem.DOWN?Tuplet$1.LOCATION_BOTTOM:Tuplet$1.LOCATION_TOP;fe.setTupletLocation(he);let ge=!1;for(let ue=0;ue=Flow.durationToTicks("4"))throw new Vex.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let F,G;for(this.stem_direction=Stem.UP,F=0;FW+Y.stem_direction,0)>-1?Stem.UP:Stem.DOWN),F=0;FF.getGlyph().beam_count).reduce((F,G)=>G>F?G:F)}breakSecondaryAt(D){return this.break_on_indices=D,this}getSlopeY(D,R,F,G){return F+(D-R)*G}calculateSlope(){const{notes:D,stem_direction:R,render_options:{max_slope:F,min_slope:G,slope_iterations:j,slope_cost:U}}=this,W=D[0],Y=getStemSlope(W,D[D.length-1]),Q=(F-G)/j;let Z=Number.MAX_VALUE,q=0,J=0;for(let K=G;K<=F;K+=Q){let te=0,ne=0;for(let le=1;leie)&&(Q=ie,W=Math.min(...ne.getYs()),Y=ne.getBeamCount())}let Z=U/D.length;const q=F*1.5,J=G+Y*q,K=W+J*-R;R===Stem.DOWN&&ZK&&(Z=W-J),j+this.render_options.flat_beam_offset_per_beam>0?R===Stem.DOWN&&Z>j&&!this.render_options.flat_beams?this.render_options.flat_beam_offset=Z:R===Stem.UP&&Z0){let G=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(G+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let j=this.notes[0].note_heads[0].y;const U=this.stem_direction>0?Math.min:Math.max;for(const W of this.notes)for(const Y of W.note_heads)j=U(j,Y.y);F=j+G*-this.stem_direction}return F}applyStemExtensions(){const{notes:D,slope:R,y_shift:F,stem_direction:G,beam_count:j,render_options:{show_stemlets:U,stemlet_extension:W,beam_width:Y}}=this,Q=D[0],Z=this.getBeamYToDraw(),q=Q.getStemX();for(let J=0;J=8&&(K=this.break_on_indices.indexOf(Z)!==-1,this.render_options.secondary_break_ticks&&Y>=this.render_options.secondary_break_ticks&&(Y=0,K=!0));const te=q.getIntrinsicTicks(){D.getStem()&&(this.context.openGroup("stem",D.getAttribute("id")+"-stem"),D.getStem().setContext(this.context).draw(),this.context.closeGroup())},this)}drawBeamLines(){this.checkContext();const D=["4","8","16","32","64"],R=this.notes[0];let F=this.getBeamYToDraw();const G=R.getStemX(),j=this.render_options.beam_width*this.stem_direction,U={};for(const W of this.notes)U[W.getAttribute("id")]=0;for(let W=0;W{D.getStave()||D.setStave(this.stave)}),this.preFormatted=!0,this)}draw(D=this.context,R=this.stave){this.setRendered();let F=null;for(let G=0;G0&&F){const U=j.getBoundingBox();U&&F.mergeWith(U)}j.setContext(D),j.drawWithStyle()}this.boundingBox=F}}function drawBoldDoubleLine(B,D,R,F,G){if(D!==StaveConnector.type.BOLD_DOUBLE_LEFT&&D!==StaveConnector.type.BOLD_DOUBLE_RIGHT)throw new Vex.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let j=3,U=3.5;const W=2;D===StaveConnector.type.BOLD_DOUBLE_RIGHT&&(j=-5,U=3),B.fillRect(R+j,F,1,G-F),B.fillRect(R-W,F,U,G-F)}class StaveConnector extends Element$2{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(D,R){super(),this.setAttribute("type","StaveConnector"),this.thickness=Flow.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=D,this.bottom_stave=R,this.type=StaveConnector.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(D){return D=typeof D=="string"?StaveConnector.typeString[D]:D,D>=StaveConnector.type.SINGLE_RIGHT&&D<=StaveConnector.type.NONE&&(this.type=D),this}setText(D,R){return this.texts.push({content:D,options:Vex.Merge({shift_x:0,shift_y:0},R)}),this}setFont(D){Vex.Merge(this.font,D)}setXShift(D){if(typeof D!="number")throw Vex.RERR("InvalidType","x_shift must be a Number");return this.x_shift=D,this}draw(){const D=this.checkContext();this.setRendered();let R=this.top_stave.getYForLine(0),F=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,G=this.width,j=this.top_stave.getX();(this.type===StaveConnector.type.SINGLE_RIGHT||this.type===StaveConnector.type.BOLD_DOUBLE_RIGHT||this.type===StaveConnector.type.THIN_DOUBLE)&&(j=this.top_stave.getX()+this.top_stave.width);let W=F-R;switch(this.type){case StaveConnector.type.SINGLE:G=1;break;case StaveConnector.type.SINGLE_LEFT:G=1;break;case StaveConnector.type.SINGLE_RIGHT:G=1;break;case StaveConnector.type.DOUBLE:j-=this.width+2;break;case StaveConnector.type.BRACE:{G=12;const Y=this.top_stave.getX()-2+this.x_shift,Q=R,Z=Y,q=F,J=Y-G,K=Q+W/2,te=J-.9*G,ne=Q+.2*W,ie=Y+1.1*G,re=K-.135*W,oe=ie,le=K+.135*W,fe=te,he=q-.2*W,ge=J-G,ue=he,me=Y+.4*G,be=K+.135*W,ve=me,pe=K-.135*W,ye=ge,xe=ne;D.beginPath(),D.moveTo(Y,Q),D.bezierCurveTo(te,ne,ie,re,J,K),D.bezierCurveTo(oe,le,fe,he,Z,q),D.bezierCurveTo(ge,ue,me,be,J,K),D.bezierCurveTo(ve,pe,ye,xe,Y,Q),D.fill(),D.stroke();break}case StaveConnector.type.BRACKET:R-=4,F+=4,W=F-R,Glyph.renderGlyph(D,j-5,R-3,40,"v1b",!0),Glyph.renderGlyph(D,j-5,F+3,40,"v10",!0),j-=this.width+2;break;case StaveConnector.type.BOLD_DOUBLE_LEFT:drawBoldDoubleLine(D,this.type,j+this.x_shift,R,F);break;case StaveConnector.type.BOLD_DOUBLE_RIGHT:drawBoldDoubleLine(D,this.type,j,R,F);break;case StaveConnector.type.THIN_DOUBLE:G=1;break;case StaveConnector.type.NONE:break;default:throw new Vex.RERR("InvalidType",`The provided StaveConnector.type (${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&&D.fillRect(j,R,G,W),this.type===StaveConnector.type.THIN_DOUBLE&&D.fillRect(j-3,R,G,W),D.save(),D.lineWidth=2,D.setFont(this.font.family,this.font.size,this.font.weight);for(let Y=0;Y0){const ie=ne.space.deviation,re=ie>=0?"+":"";D.setFillStyle("red"),D.fillText(re+Math.round(ie),W+R.getXShift(),F-10)}D.restore()}constructor(D){if(super(),this.setAttribute("type","Note"),!D)throw new Vex.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const R=Flow.parseNoteStruct(D);if(!R)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(D)}`);if(this.duration=R.duration,this.dots=R.dots,this.noteType=R.type,this.customTypes=R.customTypes,this.DYMusicScoreType=D.DYMusicScoreType,D.duration_override?this.setDuration(D.duration_override):this.setIntrinsicTicks(R.ticks),this.modifiers=[],this.glyph=Flow.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(F=>Flow.getGlyphProps(this.duration,F)),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=[],D.align_center&&this.setCenterAlignment(D.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:Note.STAVEPADDING}}getPlayNote(){return this.playNote}setPlayNote(D){return this.playNote=D,this}isRest(){return!1}addStroke(D,R){return R.setNote(this),R.setIndex(D),this.modifiers.push(R),this.setPreFormatted(!1),this}getStave(){return this.stave}setStave(D){return this.stave=D,this.setYs([D.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return Note.CATEGORY}setContext(D){return this.context=D,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(D){return this.extraLeftPx=D,this}setExtraRightPx(D){return this.extraRightPx=D,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(D){return this.ys=D,this}getYs(){if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(D){if(!this.stave)throw new Vex.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(D)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new Vex.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(D){return this.voice=D,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(D){return this.tickContext=D,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(D){return this.modifierContext=D,this}addModifier(D,R=0){return D.setNote(this),D.setIndex(R),this.modifiers.push(D),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 D=0,R=0;this.modifierContext!=null&&(D=this.modifierContext.state.left_shift,R=this.modifierContext.state.right_shift);const F=this.getWidth();return{width:F,noteWidth:F-D-R-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:D,modRightPx:R,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(D){this.width=D}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(D){return this.x_shift=D,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 D=this.tickContext.getX();return this.stave&&(D+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(this.DYMusicScoreType==="jianpu"||(D+=this.getCenterXShift())),D}setPreFormatted(D){if(this.preFormatted=D,this.preFormatted){const R=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,R.left),this.right_modPx=Math.max(this.right_modPx,R.right)}}}function L$j(...B){NoteHead.DEBUG&&Vex.L("Vex.Flow.NoteHead",B)}function drawSlashNoteHead(B,D,R,F,G,j){const U=Flow.SLASH_NOTEHEAD_WIDTH;B.save(),B.setLineWidth(Flow.STEM_WIDTH);let W=!1;if(Flow.durationToNumber(D)>2&&(W=!0),W||(R-=Flow.STEM_WIDTH/2*G),B.beginPath(),B.moveTo(R,F+j),B.lineTo(R,F+1),B.lineTo(R+U,F-j),B.lineTo(R+U,F),B.lineTo(R,F+j),B.closePath(),W?B.fill():B.stroke(),Flow.durationToFraction(D).equals(.5)){const Y=[-3,-1,U+1,U+3];for(let Q=0;Q{const W=U.getTickContext();U.setStave(R.stave),W.setXOffset(j)})}}class Dot extends Modifier{static get CATEGORY(){return"dots"}static format(D,R){const F=R.right_shift,G=1;if(!D||D.length===0)return!1;const j=[],U={};for(let K=0;Kte.line-K.line);let W=F,Y=0,Q=null,Z=null,q=null,J=0;for(let K=0;KY?W:Y,Q=re,Z=ne}return R.right_shift+=Y,!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(D){this.note=D,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(D){return this.dot_shiftY=D,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 D=this.note.stave.options.spacing_between_lines_px,R=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(R.y=this.note.getStemExtents().baseY+1);const F=R.x+this.x_shift+this.width-this.radius,G=R.y+this.y_shift+this.dot_shiftY*D,j=this.context;j.beginPath(),j.arc(F,G,this.radius,0,Math.PI*2,!1),j.fill()}}function L$i(...B){StaveNote.DEBUG&&Vex.L("Vex.Flow.StaveNote",B)}const getStemAdjustment=B=>Stem.WIDTH/(2*-B.getStemDirection()),isInnerNoteIndex=(B,D)=>D===(B.getStemDirection()===Stem.UP?B.keyProps.length-1:0);function shiftRestVertical(B,D,R){const F=(D.isrest?0:1)*R;B.line+=F,B.maxLine+=F,B.minLine+=F,B.note.setKeyLine(0,B.note.getKeyLine(0)+F)}function centerRest(B,D,R){const F=B.line-Vex.MidLine(D.minLine,R.maxLine);B.note.setKeyLine(0,B.note.getKeyLine(0)-F),B.line-=F,B.maxLine-=F,B.minLine-=F}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(D,R,F,G,j){const{vibrato_width:U,wave_width:W,wave_girth:Y,wave_height:Q}=G,Z=U/W,q=Math.abs(j-F)/Z+2;D.beginPath();let J;for(D.moveTo(R,F+Y),J=0;J2?F[1]:null;let Y=j>2?F[2]:F[1];j===2&&U.stemDirection===-1&&Y.stemDirection===1&&(U=F[1],Y=F[0]);const Q=Math.max(U.voice_shift,Y.voice_shift);let Z=0,q;if(j===2){const J=U.stemDirection===Y.stemDirection?0:.5;if(U.stemDirection===Y.stemDirection&&U.minLine<=Y.maxLine&&(U.isrest||(q=Math.abs(U.line-(Y.maxLine+.5)),q=Math.max(q,U.stemMin),U.minLine=U.line-q,U.note.setStemLength(q*10))),U.minLine<=Y.maxLine+J)if(U.isrest)shiftRestVertical(U,Y,1);else if(Y.isrest)shiftRestVertical(Y,U,-1);else{Z=Q;const K=Math.abs(U.line-Y.line);let te=0,ne=0;U.note.duration==="h"?te++:U.note.duration==="w"&&ne++,Y.note.duration==="h"?te++:Y.note.duration==="w"&&ne++;let ie=te===1||ne===1||U.note.dots!==Y.note.dots;if(G&&(ie=ie||ne===2),K===0&&ie){if(Y.note.setXShift(Z),U.note.dots>0){let re=0;for(const oe of U.note.modifiers)if(oe instanceof Dot&&(re++,oe.setYShift(-10*(Y.maxLine-U.line+1)),re===U.note.dots))break}}else K<1&&K>0?Y.note.setXShift(Z):U.note.voice!==Y.note.voice&&U.stemDirection===Y.stemDirection&&(U.line>Y.line?U.stemDirection===1?Y.note.renderFlag=!1:U.note.renderFlag=!1:Y.line>U.line?Y.stemDirection===1?U.note.renderFlag=!1:Y.note.renderFlag=!1:Y.stemDirection===1&&(Y.stemDirection=-1,Y.note.setStemDirection(-1)))}return!0}if(W!==null&&W.minLineR.postFormat()),!0):!1}constructor(D){if(super(D),this.setAttribute("type","StaveNote"),this.keys=D.keys,this.clef=D.clef,this.octave_shift=D.octave_shift,this.beam=null,this.vibrato=null,this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(D)}`);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:D.glyph_font_scale||Flow.DEFAULT_NOTATION_FONT_SCALE,stroke_px:D.stroke_px||StaveNote.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),D.auto_stem?this.autoStem():this.setStemDirection(D.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();const D=this.note_heads.map(R=>R.getStyle());this.buildNoteHeads(),this.note_heads.forEach((R,F)=>R.setStyle(D[F])),this.stave&&this.note_heads.forEach(R=>R.setStave(this.stave)),this.calcExtraPx()}setBeam(D){return this.beam=D,this.calcExtraPx(),this}setVibrato(D){this.vibrato=D}getCategory(){return StaveNote.CATEGORY}buildStem(){this.setStem(new Stem({hide:!!this.isRest()})),this.stem.id=Vex.Prefix(`${this.getAttribute("id")}-stem`)}buildNoteHeads(){this.note_heads=[];const D=this.getStemDirection(),R=this.getKeys();let F=null,G=null,j=!1,U,W,Y;D===Stem.UP?(U=0,W=R.length,Y=1):D===Stem.DOWN&&(U=R.length-1,W=-1,Y=-1);for(let Q=U;Q!==W;Q+=Y){const Z=this.keyProps[Q],q=Z.line;F===null?F=q:(G=Math.abs(F-q),G===0||G===.5?j=!j:(j=!1,this.use_default_head_x=!0)),F=q;const J=new NoteHead({duration:this.duration,note_type:this.noteType,displaced:j,stem_direction:D,custom_glyph_code:Z.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:Z.shift_right,stem_up_x_offset:Z.stem_up_x_offset,stem_down_x_offset:Z.stem_down_x_offset,line:Z.line});this.note_heads[Q]=J}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const D=3,F=(this.minLine+this.maxLine)/20&&(this.keyProps[R-1].displaced=!0)),D=U,this.keyProps.push(j)}D=-1/0,this.keyProps.forEach(R=>{R.lineR.line-F.line)}getBoundingBox(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:D,modLeftPx:R,extraLeftPx:F}=this.getMetrics(),G=this.getAbsoluteX()-R-F;let j=0,U=0;const W=this.getStave().getSpacingBetweenLines()/2,Y=W*2;if(this.isRest()){const Q=this.ys[0],Z=Flow.durationToFraction(this.duration);Z.equals(1)||Z.equals(2)?(j=Q-W,U=Q+W):(j=Q-this.glyph.line_above*Y,U=Q+this.glyph.line_below*Y)}else if(this.glyph.stem){const Q=this.getStemExtents();Q.baseY+=W*this.stem_direction,j=Math.min(Q.topY,Q.baseY),U=Math.max(Q.topY,Q.baseY)}else{j=null,U=null;for(let Q=0;QR&&(R=G):G1}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(D){const R=this.getStemExtents();return Math.min(this.stave.getYForTopText(D),R.topY-this.render_options.annotation_spacing*(D+1))}getYForBottomText(D){const R=this.getStemExtents();return Math.max(this.stave.getYForTopText(D),R.baseY+this.render_options.annotation_spacing*D)}setStave(D){super.setStave(D);const R=this.note_heads.map(F=>(F.setStave(D),F.getY()));if(this.setYs(R),this.stem){const{y_top:F,y_bottom:G}=this.getNoteHeadBounds();this.stem.setYBounds(F,G)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(D){return this.displaced=D,this}getTieRightX(){let D=this.getAbsoluteX();return D+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(D+=this.modifierContext.getExtraRightPx()),D}getTieLeftX(){let D=this.getAbsoluteX();return D+=this.x_shift-this.extraLeftPx,D}getLineForRest(){let D=this.keyProps[0].line;if(this.keyProps.length>1){const R=this.keyProps[this.keyProps.length-1].line,F=Math.max(D,R),G=Math.min(D,R);D=Vex.MidLine(F,G)}return D}getModifierStartXY(D,R,F){if(F=F||{},!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:G,BELOW:j,LEFT:U,RIGHT:W}=Modifier.Position;let Y=0;return D===U?Y=-1*2:D===W?(Y=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===Stem.UP&&this.hasFlag()&&(F.forceFlagRight||isInnerNoteIndex(this,R))&&(Y+=this.flag.getMetrics().width)):(D===j||D===G)&&(Y=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+Y,y:this.ys[R]}}setStyle(D){super.setStyle(D),this.note_heads.forEach(R=>R.setStyle(D)),this.stem&&this.stem.setStyle(D)}setStemStyle(D){this.stem&&this.getStem().setStyle(D)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(D){this.ledgerLineStyle=D}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(D){this.flagStyle=D}getFlagStyle(){return this.flagStyle}setKeyStyle(D,R){return this.note_heads[D].setStyle(R),this}setKeyLine(D,R){return(this.glyph.code_head=="va5"||this.glyph.code_head=="v3c")&&(R=3),this.keyProps[D].line=R,this.reset(),this}getKeyLine(D){return this.keyProps[D].line}addToModifierContext(D){this.setModifierContext(D);for(let R=0;R{const J=q.getLine(),K=q.getY();(D===null||KR)&&(R=K),G===null&&q.isDisplaced()&&(G=q.getAbsoluteX()),F===null&&!q.isDisplaced()&&(F=q.getAbsoluteX()),j=J>j?J:j,U=J{let he;fe&&le?he=ne-F:le?he=te-F:he=K-F;const ge=le&&fe?U:j;G.beginPath(),G.moveTo(he,oe),G.lineTo(he+ge,oe),G.stroke()},re={...D.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(G,re);for(let oe=6;oe<=W;++oe){const le=te!==null&&oe<=Z,fe=K!==null&&oe<=Q;ie(D.getYForNote(oe),le,fe)}for(let oe=0;oe>=Y;--oe){const le=te!==null&&oe>=J,fe=K!==null&&oe>=q;ie(D.getYForNote(oe),le,fe)}this.restoreStyle(G,re)}drawVibrato(){if(this.vibrato){const D=this.context;D.openGroup("vibrato");const R=this.vibrato.getNoteHeadEndX()+2,{y_top:F}=this.vibrato.getNoteHeadBounds();let{y_bottom:G}=this.getNoteHeadBounds(),j=Math.abs(this.getNoteHeadBeginX()-R)-10;this.vibrato.stave.y!==this.stave.y&&(j=30,G=F+10),StaveNote.renderVibrato(this.context,R,F,{harsh:!0,vibrato_width:j,wave_height:6,wave_width:4,wave_girth:2},G),D.closeGroup()}}drawModifiers(){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");const D=this.context;D.openGroup("modifiers");for(let R=0;R6.5||q<-.5)&&(Z=Z+(q>6.5?(q-6.5)*10:(q+.5)*10))}F.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(F,this.getFlagStyle()||!1),this.flag.render(F,Q,Z),this.restoreStyle(F,this.getFlagStyle()||!1),F.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(D=>{this.context.openGroup("notehead",null,{pointerBBox:!0});try{if(this.isRest()&&this.duration==="w"){const R=this.stave.options.line_config.filter(G=>G.visible).length;this.keyProps[0].line===4&&R<5&&D.setY(D.getY()+10),R===1&&D.setLine(3)}}catch{}D.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(D){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");D&&this.setStem(new Stem(D)),this.stem.id=Vex.Prefix(`${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 D=this.stave.getLines();if(D===2||D===3||D===4)for(let G=0;GG.setX(R)),this.stem){let G=this.getStemX();const j=this.keyProps[0].line;(j>6.5||j<-.5)&&(this.beam||(this.stem.renderHeightAdjustment=j>6.5?(j-6.5)*10:Math.abs(j+.5)*10)),this.stem.setNoteHeadXBounds(G,G)}L$i("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}),F&&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(D,R){const{left_shift:F,right_shift:G}=R,j=1;if(!D||D.length===0)return!1;const U=[];let W=null,Y=0,Q=0;for(let ie=0;iere.line-ie.line);let Z=0,q=0,J=0,K=0,te=null,ne=null;for(let ie=0;ieJ?re:J):le===Modifier.Position.RIGHT&&(fe.setXShift(q),re=Q+me,K=re>K?re:K),te=he,ne=oe}return R.left_shift+=J,R.right_shift+=K,!0}constructor(D){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=D,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(D){return this.finger=D,this}setOffsetX(D){return this.x_offset=D,this}setOffsetY(D){return this.y_offset=D,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 D=this.context,R=this.note.getModifierStartXY(this.position,this.index);let F=R.x+this.x_shift+this.x_offset,G=R.y+this.y_shift+this.y_offset+5;switch(this.position){case Modifier.Position.ABOVE:F-=4,G-=12;break;case Modifier.Position.BELOW:F-=2,G+=10;break;case Modifier.Position.LEFT:F-=this.width;break;case Modifier.Position.RIGHT:F+=1;break;default:throw new Vex.RERR("InvalidPostion",`The position ${this.position} does not exist`)}D.save(),D.setFont(this.font.family,this.font.size,this.font.weight),D.fillText(""+this.finger,F,G),D.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(D){return!(D==null||D<0||D>=Music.NUM_TONES)}isValidIntervalValue(D){return this.isValidNoteValue(D)}getNoteParts(D){if(!D||D.length<1)throw new Vex.RERR("BadArguments","Invalid note name: "+D);if(D.length>3)throw new Vex.RERR("BadArguments","Invalid note name: "+D);const R=D.toLowerCase(),G=/^([cdefgab])(b|bb|n|#|##)?$/.exec(R);if(G!=null){const j=G[1],U=G[2];return{root:j,accidental:U}}else throw new Vex.RERR("BadArguments","Invalid note name: "+D)}getKeyParts(D){if(!D||D.length<1)throw new Vex.RERR("BadArguments","Invalid key: "+D);const R=D.toLowerCase(),G=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(R);if(G!=null){const j=G[1],U=G[2];let W=G[3];return W||(W="M"),{root:j,accidental:U,type:W}}else throw new Vex.RERR("BadArguments",`Invalid key: ${D}`)}getNoteValue(D){const R=Music.noteValues[D];if(R==null)throw new Vex.RERR("BadArguments",`Invalid note name: ${D}`);return R.int_val}getIntervalValue(D){const R=Music.intervals[D];if(R==null)throw new Vex.RERR("BadArguments",`Invalid interval name: ${D}`);return R}getCanonicalNoteName(D){if(!this.isValidNoteValue(D))throw new Vex.RERR("BadArguments",`Invalid note value: ${D}`);return Music.canonical_notes[D]}getCanonicalIntervalName(D){if(!this.isValidIntervalValue(D))throw new Vex.RERR("BadArguments",`Invalid interval value: ${D}`);return Music.diatonic_intervals[D]}getRelativeNoteValue(D,R,F){if(F==null&&(F=1),F!==1&&F!==-1)throw new Vex.RERR("BadArguments",`Invalid direction: ${F}`);let G=(D+F*R)%Music.NUM_TONES;return G<0&&(G+=Music.NUM_TONES),G}getRelativeNoteName(D,R){const F=this.getNoteParts(D),G=this.getNoteValue(F.root);let j=R-G;if(Math.abs(j)>Music.NUM_TONES-3){let W=1;j>0&&(W=-1);const Y=(R+1+(G+1))%Music.NUM_TONES*W;if(Math.abs(Y)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${D}, ${R})`);j=Y}if(Math.abs(j)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${D}, ${R})`);let U=F.root;if(j>0)for(let W=1;W<=j;++W)U+="#";else if(j<0)for(let W=-1;W>=j;--W)U+="b";return U}getScaleTones(D,R){const F=[D];let G=D;for(let j=0;jB.getMetrics().width;class Accidental extends Modifier{static get CATEGORY(){return"accidentals"}static format(D,R){const G=R.left_shift+1,j=3;if(!D||D.length===0)return;const U=[];let W=null,Y=0,Q;for(let oe=0;oele.line-oe.line);const Z=[];let q=0,J=null;for(let oe=0;oeq?le.shift:q,J=le.line}let K=0;for(let oe=0;oeZ[fe+ce],ue=ce=>ce.map(ge),me=(ce,we)=>{const[Be,Ae]=ue([ce,we]).map(Te=>Te.line);return Be-Ae},be=(...ce)=>ce.map(ue).every(we=>!this.checkCollision(...we)),ve=he-fe+1;let pe=this.checkCollision(Z[fe],Z[he])?"a":"b";switch(ve){case 3:pe==="a"&&me(1,2)===.5&&me(0,1)!==.5&&(pe="second_on_bottom");break;case 4:be([0,2],[1,3])&&(pe="spaced_out_tetrachord");break;case 5:pe==="b"&&be([1,3])&&(pe="spaced_out_pentachord",be([0,2],[2,4])&&(pe="very_spaced_out_pentachord"));break;case 6:be([0,3],[1,4],[2,5])&&(pe="spaced_out_hexachord"),be([0,2],[2,4],[1,3],[3,5])&&(pe="very_spaced_out_hexachord");break}let ye,xe;if(ve>=7){let ce=2,we=!0;for(;we===!0;){we=!1;for(let Be=0;Be+cexe?K:xe}else for(ye=oe;ye<=he;ye++)xe=Flow.accidentalColumnsTable[ve][pe][ye-oe],Z[ye].column=xe,K=K>xe?K:xe;oe=he}const te=[],ne=[];for(let oe=0;oe<=K;oe++)te[oe]=0,ne[oe]=0;te[0]=q+G,ne[0]=q+G,Z.forEach(oe=>{oe.width>te[oe.column]&&(te[oe.column]=oe.width)});for(let oe=1;oe{let le=0;const fe=re+oe.numAcc;for(re;re0?(G=R.flatLine||R.dblSharpLine?2.5:3,D.dblSharpLine&&(F-=.5)):(G=D.flatLine||D.dblSharpLine?2.5:3,R.dblSharpLine&&(F-=.5));const j=Math.abs(F){const Y=new Fraction(0,1);W.getTickables().forEach(Z=>{if(Z.shouldIgnoreTicks())return;const q=G[Y.value()];q?q.push(Z):(F.push(Y.value()),G[Y.value()]=[Z]),Y.add(Z.getTicks())})});const j=new Music;R||(R="C");const U=j.createScaleMap(R);F.forEach(W=>{const Y=G[W],Q=[],Z=q=>{q.isRest()||q.shouldIgnoreTicks()||(q.keys.forEach((J,K)=>{const te=j.getNoteParts(J.split("/")[0]),ne=te.accidental||"n",ie=te.root+ne,re=U[te.root]===ie,oe=Q.indexOf(ie)>-1;if(!re||re&&oe){U[te.root]=ie;const le=new Accidental(ne);q.addAccidental(K,le),Q.push(ie)}}),q.getModifiers().forEach(J=>{J.getCategory()==="gracenotegroups"&&J.getGraceNotes().forEach(Z)}))};Y.forEach(Z)})}constructor(D=null){if(super(),this.setAttribute("type","Accidental"),L$h("New accidental: ",D),this.note=null,this.index=null,this.type=D,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: ${D}`);this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){const D=this.render_options.font_scale;this.glyph=new Glyph(this.accidental.code,D),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new Glyph(Flow.accidentalCodes("{").code,D),this.parenRight=new Glyph(Flow.accidentalCodes("}").code,D),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return Accidental.CATEGORY}getWidth(){const D=this.cautionary?getGlyphWidth(this.parenLeft)+getGlyphWidth(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return getGlyphWidth(this.glyph)+D}setNote(D){if(!D)throw new Vex.RERR("ArgumentError",`Bad note value: ${D}`);this.note=D,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:D,type:R,position:F,note:G,index:j,cautionary:U,x_shift:W,y_shift:Y,glyph:Q,parenLeft:Z,parenRight:q,render_options:{parenLeftPadding:J,parenRightPadding:K}}=this;if(this.checkContext(),!(G&&j!=null))throw new Vex.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const te=G.getModifierStartXY(F,j);let ne=te.x+W;const ie=te.y+Y;L$h("Rendering: ",R,ne,ie),U?(q.render(D,ne,ie),ne-=getGlyphWidth(q),ne-=K,ne-=this.accidental.parenRightPaddingAdjustment,Q.render(D,ne,ie),ne-=getGlyphWidth(Q),ne-=J,Z.render(D,ne,ie)):Q.render(D,ne,ie),this.setRendered()}}class NoteSubGroup$1 extends Modifier{static get CATEGORY(){return"notesubgroup"}static format(D,R){if(!D||D.length===0)return!1;let F=0;for(let G=0;G{R.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 NoteSubGroup$1.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(D){this.note=D}setWidth(D){this.width=D}getWidth(){return this.width}draw(){this.checkContext();const D=this.getNote();if(!(D&&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,D),this.subNotes.forEach(R=>R.setContext(this.context).drawWithStyle())}}class StaveTie extends Element$2{constructor(D,R){super(),this.setAttribute("type","StaveTie"),this.notes=D,this.context=null,this.text=R,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(D)}setFont(D){return this.font=D,this}setDirection(D){return this.direction=D,this}setNotes(D){if(!D.first_note&&!D.last_note)throw new Vex.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(D.first_indices||(D.first_indices=[0]),D.last_indices||(D.last_indices=[0]),D.first_indices.length!==D.last_indices.length)throw new Vex.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=D.first_note,this.first_indices=D.first_indices,this.last_note=D.last_note,this.last_indices=D.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(D){if(D.first_ys.length===0||D.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const R=this.context;let F=this.render_options.cp1,G=this.render_options.cp2;Math.abs(D.last_x_px-D.first_x_px)<10&&(F=2,G=8);const j=this.render_options.first_x_shift,U=this.render_options.last_x_shift,W=this.render_options.y_shift*D.direction;for(let Y=0;YJ&&Math.abs(Z-J)<10?-6:0;if(this.first_note&&this.first_note.DYMusicScoreType==="jianpu"){if(this.getAttribute("type")==="TabTie")continue;Z1){const R=new Beam$1(D);R.render_options.beam_width=3,R.render_options.partial_beam_length=4,this.beams.push(R)}return this}setNote(D){this.note=D}setWidth(D){this.width=D}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();const D=this.getNote();if(L$g("Drawing grace note group for:",D),!(D&&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(),D),this.grace_notes.forEach(R=>{R.setContext(this.context).draw()}),this.beams.forEach(R=>{R.setContext(this.context).draw()}),this.show_slur){const R=this.getNote().getCategory()===StaveNote.CATEGORY,F=R?StaveTie:TabTie;this.slur=new F({last_note:this.grace_notes[0],first_note:D,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(R?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(D,R){const F=R.left_shift,G=0;if(!D||D.length===0)return this;const j=D.map(Y=>{const Q=Y.getNote();if(Q instanceof StaveNote){const{line:Z,displaced:q}=Q.getKeyProps()[Y.getIndex()],J=q?Q.getExtraLeftPx():0;return{line:Z,shift:J,stroke:Y}}else{const{str:Z}=Q.getPositions()[Y.getIndex()];return{line:Z,shift:0,stroke:Y}}}),U=F,W=j.reduce((Y,{stroke:Q,shift:Z})=>(Q.setXShift(U+Z),Math.max(Q.getWidth()+G,Y)),0);return R.left_shift+=W,!0}constructor(D,R){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=Vex.Merge({},R),this.all_voices="all_voices"in this.options?this.options.all_voices:!0,this.note_end=null,this.index=null,this.type=D,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(D){return this.note_end=D,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 D=this.note.getModifierStartXY(this.position,this.index);let R=this.note.getYs(),F=D.y,G=D.y;const j=D.x-5,U=this.note.stave.options.spacing_between_lines_px,W=this.getModifierContext().getModifiers(this.note.getCategory());for(let K=0;Khe.line-fe.line);let ne=0,ie=0,re=0,oe=null,le=null;for(Z=0;Zie?fe:ie):K===Modifier.Position.RIGHT&&(q.setXShift(ne),fe+=ue,re=fe>re?fe:re),oe=he,le=J}return R.left_shift+=ie,R.right_shift+=re,!0}constructor(D){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=D,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(D){return this.note=D,this}getIndex(){return this.index}setIndex(D){return this.index=D,this}setLineEndType(D){return D>=Renderer.LineEndType.NONE&&D<=Renderer.LineEndType.DOWN&&(this.leg=D),this}setStringNumber(D){return this.string_number=D,this}setOffsetX(D){return this.x_offset=D,this}setOffsetY(D){return this.y_offset=D,this}setLastNote(D){return this.last_note=D,this}setDashed(D){return this.dashed=D,this}draw(){const D=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 R=this.note.stave.options.spacing_between_lines_px,F=this.note.getModifierStartXY(this.position,this.index);let G=F.x+this.x_shift+this.x_offset,j=F.y+this.y_shift+this.y_offset;switch(this.position){case Modifier.Position.ABOVE:case Modifier.Position.BELOW:{const W=this.note.getStemExtents();let Y=W.topY,Q=W.baseY+2;this.note.stem_direction===StaveNote.STEM_DOWN&&(Y=W.baseY,Q=W.topY-2),this.position===Modifier.Position.ABOVE?j=this.note.hasStem()?Y-R*1.75:F.y-R*1.75:j=this.note.hasStem()?Q+R*1.5:F.y+R*1.75,j+=this.y_shift+this.y_offset;break}case Modifier.Position.LEFT:G-=this.radius/2+5;break;case Modifier.Position.RIGHT:G+=this.radius/2+6;break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}D.save(),D.beginPath(),D.arc(G,j,this.radius,0,Math.PI*2,!1),D.lineWidth=1.5,D.stroke(),D.setFont(this.font.family,this.font.size,this.font.weight);const U=G-D.measureText(this.string_number).width/2;if(D.fillText(""+this.string_number,U,j+4.5),this.last_note!=null){const W=this.last_note.getStemX()-this.note.getX()+5;D.strokeStyle="#000000",D.lineCap="round",D.lineWidth=.6,this.dashed?Renderer.drawDashedLine(D,G+10,j,G+W,j,[3,3]):Renderer.drawDashedLine(D,G+10,j,G+W,j,[3,0]);let Y,Q;switch(this.leg){case Renderer.LineEndType.UP:Y=-10,Q=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(D,G+W,j,G+W,j+Y,Q);break;case Renderer.LineEndType.DOWN:Y=10,Q=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(D,G+W,j,G+W,j+Y,Q);break}}D.restore()}}function L$f(...B){Articulation$1.DEBUG&&Vex.L("Vex.Flow.Articulation",B)}const{ABOVE,BELOW}=Modifier.Position,roundToNearestHalf=(B,D)=>B(D/.5)*.5,isWithinLines=(B,D)=>D===ABOVE?B<=5:B>=1,getRoundingFunction=(B,D)=>isWithinLines(B,D)?D===ABOVE?Math.ceil:Math.floor:Math.round,snapLineToStaff=(B,D,R,F)=>{const G=roundToNearestHalf(getRoundingFunction(D,R),D),j=B&&isWithinLines(G,R),U=G%1===0;return j&&U?G+.5*-F:G},isStaveNote=B=>{const D=B.getCategory();return D==="stavenotes"||D==="gracenotes"},isTabNote=B=>{const D=B.getCategory();return D==="tabnotes"||D==="numberednotes"},getTopY=(B,D)=>{const R=B.getStave(),F=B.getStemDirection(),{topY:G,baseY:j}=B.getStemExtents();if(isStaveNote(B))return B.hasStem()?F===Stem.UP?G:j:Math.min(...B.getYs());if(isTabNote(B))return B.hasStem()&&F===Stem.UP?G:R.getYForTopText(D);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getBottomY=(B,D)=>{const R=B.getStave(),F=B.getStemDirection(),{topY:G,baseY:j}=B.getStemExtents();if(isStaveNote(B))return B.hasStem()?F===Stem.UP?j:G:Math.max(...B.getYs());if(isTabNote(B))return B.hasStem()?F===Stem.UP?R.getYForBottomText(D):G:R.getYForBottomText(D);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getInitialOffset=(B,D)=>{const R=D===ABOVE&&B.getStemDirection()===Stem.UP||D===BELOW&&B.getStemDirection()===Stem.DOWN;return isStaveNote(B)?B.hasStem()&&R?.5:1:B.hasStem()&&R?1:0};class Articulation$1 extends Modifier{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(D,R){if(!D||D.length===0)return!1;const F=Y=>Y.getPosition()===ABOVE,G=Y=>Y.getPosition()===BELOW,j=.5,U=(Y,Q,Z)=>roundToNearestHalf(getRoundingFunction(Q,Z),Y.glyph.getMetrics().height/10+j);D.filter(F).forEach(Y=>{Y.setTextLine(R.top_text_line),R.top_text_line+=U(Y,R.top_text_line,ABOVE)}),D.filter(G).forEach(Y=>{Y.setTextLine(R.text_line),R.text_line+=U(Y,R.text_line,BELOW)});const W=D.map(Y=>Y.getWidth()).reduce((Y,Q)=>Math.max(Q,Y));return R.left_shift+=W/2,R.right_shift+=W/2,!0}static easyScoreHook({articulations:D},R,F){if(!D)return;const G={staccato:"a.",tenuto:"a-"};D.split(",").map(j=>j.trim().split(".")).map(([j,U])=>{const W={type:G[j]};return U&&(W.position=Modifier.PositionString[U]),F.getFactory().Articulation(W)}).map(j=>R.addModifier(0,j))}constructor(D){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=D,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: ${this.type}`);this.glyph=new Glyph(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return Articulation$1.CATEGORY}draw(){const{note:D,index:R,position:F,glyph:G,articulation:{between_lines:j},text_line:U,context:W}=this;if(this.checkContext(),!D||R==null)throw new Vex.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const Y=D.getStave(),Q=Y.getSpacingBetweenLines(),Z=D.getCategory()==="tabnotes",{x:q}=D.getModifierStartXY(F,R),J=!j||Z,K=getInitialOffset(D,F);let te={[ABOVE]:()=>{G.setOrigin(.5,1);const ne=getTopY(D,U)-(U+K)*Q+(this.y_shift||0);return J?Math.min(Y.getYForTopText(Articulation$1.INITIAL_OFFSET),ne):ne},[BELOW]:()=>{G.setOrigin(.5,0);const ne=getBottomY(D,U)+(U+K)*Q;return J?Math.max(Y.getYForBottomText(Articulation$1.INITIAL_OFFSET),ne):ne}}[F]();if(!Z){const ne=F===ABOVE?-1:1,ie=Z?D.positions[R].str:D.getKeyProps()[R].line,oe=(D.getYs()[R]-te)/Q+ie,le=snapLineToStaff(j,oe,F,ne);isWithinLines(le,F)&&G.setOrigin(.5,.5),te+=Math.abs(le-oe)*Q*ne}L$f(`Rendering articulation at (x: ${q}, y: ${te})`),G.render(W,q,te)}}class TickContext extends Tickable{static getNextContext(D){const R=D.tContexts,F=R.indexOf(D);return R[F+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(D){return this.x=D,this.xBase=D,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(D){this.xBase=D,this.x=D+this.xOffset}getXOffset(){return this.xOffset}setXOffset(D){this.xOffset=D,this.x=this.xBase+D}getWidth(){return this.width+this.padding*2}setPadding(D){return this.padding=D,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(D=>D.isCenterAligned())}getMetrics(){const{width:D,notePx:R,extraLeftPx:F,extraRightPx:G}=this;return{width:D,notePx:R,extraLeftPx:F,extraRightPx:G}}getCurrentTick(){return this.currentTick}setCurrentTick(D){this.currentTick=D,this.preFormatted=!1}getExtraPx(){let D=0,R=0,F=0,G=0;for(let j=0;j0&&G--;for(let Y=0;Y{L$c("Preformatting ModifierContext: ",D.CATEGORY),D.format(this.getModifiers(D.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(D=>{L$c("Postformatting ModifierContext: ",D.CATEGORY),D.postFormat(this.getModifiers(D.CATEGORY),this)})}}function L$b(...B){Formatter.DEBUG&&Vex.L("Vex.Flow.Formatter",B)}function getNext(B,D){var F,G;const R=B[D+1];return R&&((F=R==null?void 0:R.keys)==null?void 0:F.includes("b/4"))||((G=R==null?void 0:R.keys)==null?void 0:G.includes("r/4"))?getNext(B,D+1):R}function lookAhead(B,D,R,F,G=0){let j=D;for(R+=1;R4.5||j<1.5)){const W=B[R].stem;if(W)if(W.stem_direction>0){const Y=j<1.5?Math.abs(j-1.5)*G:0;W.setResetHeight(Y)}else{const Y=j>4.5?Math.abs(j-4.5)*G:0;W.setResetHeight(Y)}}return j}function createContexts(B,D,R){if(!B||!B.length)throw new Vex.RERR("BadArgument","No voices to format");const F=B[0].getTotalTicks(),G=B.reduce((Y,Q)=>{if(!Q.getTotalTicks().equals(F))throw new Vex.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(Q.getMode()===Voice$1.Mode.STRICT&&!Q.isComplete())throw new Vex.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(Y,Fraction.LCM(Y,Q.getResolutionMultiplier()))},1),j={},U=[],W=[];return B.forEach(Y=>{const Q=new Fraction(0,G);Y.getTickables().forEach(Z=>{const q=Q.numerator;if(!j[q]){const J=new D;W.push(J),j[q]=J}R(Z,j[q]),U.push(q),Q.add(Z.getTicks())})}),{map:j,array:W,list:Vex.SortAndUnique(U,(Y,Q)=>Y-Q,(Y,Q)=>Y===Q),resolutionMultiplier:G}}class Formatter{static SimpleFormat(D,R=0,{paddingBetween:F=10}={}){D.reduce((G,j)=>{j.addToModifierContext(new ModifierContext);const U=new TickContext().addTickable(j).preFormat(),W=U.getExtraPx();return U.setX(G+W.left),G+U.getWidth()+W.right+F},R)}static plotDebugging(D,R,F,G,j){const U=F+Note.STAVEPADDING,W=R.contextGaps;function Y(Q,Z,q){D.beginPath(),D.setStrokeStyle(q),D.setFillStyle(q),D.setLineWidth(1),D.fillRect(Q,G,Z-Q,j-G)}D.save(),D.setFont("Arial",8,""),W.gaps.forEach(Q=>{Y(U+Q.x1,U+Q.x2,"#aaa"),D.fillText(Math.round(Q.x2-Q.x1),U+Q.x1,j+12)}),D.fillText(Math.round(W.total)+"px",U-20,j+12),D.setFillStyle("red"),D.fillText("Loss: "+R.lossHistory.map(Q=>Math.round(Q)),U-20,j+22),D.restore()}static FormatAndDraw(D,R,F,G){const j={auto_beam:!1,align_rests:!1};typeof G=="object"?Vex.Merge(j,G):typeof G=="boolean"&&(j.auto_beam=G);const U=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(F),W=j.auto_beam?Beam$1.applyAndGetBeams(U):[];return new Formatter().joinVoices([U],{align_rests:j.align_rests}).formatToStave([U],R,{align_rests:j.align_rests,stave:R}),U.setStave(R).draw(D,R),W.forEach(Y=>Y.setContext(D).draw()),U.getBoundingBox()}static FormatAndDrawTab(D,R,F,G,j,U,W){const Y={auto_beam:U,align_rests:!1};typeof W=="object"?Vex.Merge(Y,W):typeof W=="boolean"&&(Y.auto_beam=W);const Q=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(j),Z=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(G),q=Y.auto_beam?Beam$1.applyAndGetBeams(Q):[];new Formatter().joinVoices([Q],{align_rests:Y.align_rests}).joinVoices([Z]).formatToStave([Q,Z],F,{align_rests:Y.align_rests}),Q.draw(D,F),Z.draw(D,R),q.forEach(J=>J.setContext(D).draw()),new StaveConnector(F,R).setContext(D).draw()}static AlignRestsToNotes(D,R,F){return D.forEach((G,j)=>{if(G instanceof StaveNote&&G.isRest()){if(G.tuplet&&!F)return;if(G.getGlyph().position.toUpperCase(),G.glyph.code_head==="va5"||G.glyph.code_head==="v3c"){const U=G.glyph.code_head==="va5"?10:20,W=D[j-1],Y=getNext(D,j);let Q=!1;if(W&&Y&&W.beam&&Y.beam&&(Q=W.beam.notes.includes(Y)),R||G.beam!=null||Q){const Z=G.getKeyProps()[0];if(j===0)Z.line=lookAhead(D,Z.line,j,!1,U),G.setKeyLine(0,Z.line);else if(j>0&&jFormatter.AlignRestsToNotes(F.getTickables(),R))}preCalculateMinTotalWidth(D){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!D)throw new Vex.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(D)}const{list:R,map:F}=this.tickContexts;return this.minTotalWidth=R.map(G=>{const j=F[G];return j.preFormat(),j.getWidth()}).reduce((G,j)=>G+j,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(D){const R=createContexts(D,ModifierContext,(F,G)=>F.addToModifierContext(G));return this.modiferContexts=R,R}createTickContexts(D){const R=createContexts(D,TickContext,(F,G)=>G.addTickable(F));return R.array.forEach(F=>{F.tContexts=R.array}),this.totalTicks=D[0].getTicksUsed().clone(),this.tickContexts=R,R}preFormat(D=0,R,F,G){const j=this.tickContexts,{list:U,map:W,resolutionMultiplier:Y}=j;F&&G&&F.forEach(ne=>ne.setStave(G).preFormat());let Q=0,Z=0;const q=D/2;if(this.minTotalWidth=0,U.forEach(ne=>{const ie=W[ne];R&&ie.setContext(R),ie.preFormat();const re=ie.getWidth();this.minTotalWidth+=re;const oe=ie.getMetrics();Q=Q+Z+oe.extraLeftPx,ie.setX(Q),Z=re-oe.extraLeftPx}),this.minTotalWidth=Q+Z,this.hasMinTotalWidth=!0,D<=0)return;const K=(D-this.minTotalWidth)/(this.totalTicks.value()*Y);let te=0;U.forEach((ne,ie)=>{const re=U[ie-1]||0,oe=W[ne];te+=(ne-re)*K,oe.setX(oe.getX()+te),oe.getCenterAlignedTickables().forEach(fe=>{fe.center_x_shift=q-oe.getX()})}),U.length!==1&&(this.justifyWidth=D,this.lossHistory=[],this.evaluate())}evaluate(){const D=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((j,U)=>{if(U===0)return;const W=this.tickContexts.list[U-1],Y=this.tickContexts.map[W],Q=this.tickContexts.map[j],Z=Y.getMetrics(),q=Y.getX()+Z.width,J=Q.getX(),K=J-q;this.contextGaps.total+=K,this.contextGaps.gaps.push({x1:q,x2:J}),Q.getFormatterMetrics().freedom.left=K,Y.getFormatterMetrics().freedom.right=K});const R=this.durationStats={};function F(j,U){const W=R[j];W===void 0?R[j]={mean:U,count:1}:(W.count+=1,W.mean=(W.mean+U)/2)}this.voices.forEach(j=>{j.getTickables().forEach((U,W,Y)=>{const Q=U.getTicks().clone().simplify().toString(),Z=U.getMetrics(),q=U.getFormatterMetrics(),J=U.getX()+Z.noteWidth+Z.modRightPx+Z.extraRightPx;let K=0;if(W{j.getTickables().forEach(U=>{const W=U.getTicks().clone().simplify().toString(),Y=U.getFormatterMetrics();Y.iterations+=1,Y.space.deviation=Y.space.used-R[W].mean,Y.duration=W,Y.space.mean=R[W].mean,G+=Math.pow(R[W].mean,2)})}),this.totalCost=Math.sqrt(G),this.lossHistory.push(this.totalCost),this}tune(){const D=G=>G.reduce((j,U)=>j+U);function R(G,j,U,W){G.setX(G.getX()+W),G.getFormatterMetrics().freedom.left+=W,G.getFormatterMetrics().freedom.right-=W,j&&(j.getFormatterMetrics().freedom.right+=W),U&&(U.getFormatterMetrics().freedom.left-=W)}let F=0;return this.tickContexts.list.forEach((G,j,U)=>{const W=this.tickContexts.map[G],Y=j>0?this.tickContexts.map[U[j-1]]:null,Q=jJ.getFormatterMetrics().space.deviation));Z>0?F=-Math.min(W.getFormatterMetrics().freedom.right,Math.abs(Z)):Z<0&&(Q?F=Math.min(Q.getFormatterMetrics().freedom.right,Math.abs(Z)):F=0);const q=Math.min(5,Math.abs(F));F=F>0?q:-q}),this.evaluate()}postFormat(){const D=R=>R.list.forEach(F=>R.map[F].postFormat());return D(this.modiferContexts),D(this.tickContexts),this}joinVoices(D){return this.createModifierContexts(D),this.hasMinTotalWidth=!1,this}format(D,R,F){const G={align_rests:!1,context:null,stave:null};return Vex.Merge(G,F),this.voices=D,this.alignRests(D,G.align_rests),this.createTickContexts(D),this.preFormat(R,G.context,D,G.stave),G.stave&&this.postFormat(),this}formatToStave(D,R,F){const G=R.getNoteEndX()-R.getNoteStartX()-10;L$b("Formatting voices to width: ",G);const j={context:R.getContext()};return Vex.Merge(j,F),this.format(D,G,j)}}class StaveModifier extends Element$2{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(D){return this.position=D,this}getStave(){return this.stave}setStave(D){return this.stave=D,this}getWidth(){return this.width}setWidth(D){return this.width=D,this}getX(){return this.x}setX(D){return this.x=D,this}getCategory(){return""}makeSpacer(D){return{getContext(){return!0},setStave(){},renderToStave(){},getMetrics(){return{width:D}}}}placeGlyphOnLine(D,R,F){D.setYShift(R.getYForLine(F)-R.getYForGlyphs())}getPadding(D){return D!==void 0&&D<2?0:this.padding}setPadding(D){return this.padding=D,this}setLayoutMetrics(D){return this.layoutMetrics=D,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(D){super(),this.setAttribute("type","Barline"),this.thickness=Flow.STAVE_LINE_THICKNESS;const R=Barline.type;this.widths={},this.widths[R.SINGLE]=5,this.widths[R.DOUBLE]=5,this.widths[R.END]=5,this.widths[R.REPEAT_BEGIN]=5,this.widths[R.REPEAT_END]=5,this.widths[R.REPEAT_BOTH]=5,this.widths[R.NONE]=5,this.paddings={},this.paddings[R.SINGLE]=0,this.paddings[R.DOUBLE]=0,this.paddings[R.END]=0,this.paddings[R.REPEAT_BEGIN]=15,this.paddings[R.REPEAT_END]=15,this.paddings[R.REPEAT_BOTH]=15,this.paddings[R.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[R.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[R.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[R.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[R.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[R.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[R.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[R.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(StaveModifier.Position.BEGIN),this.setType(D)}getCategory(){return Barline.CATEGORY}getType(){return this.type}setType(D){return this.type=typeof D=="string"?Barline.typeString[D]:D,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(D){switch(D.checkContext(),this.setRendered(),this.type){case Barline.type.SINGLE:this.drawVerticalBar(D,this.x,!1);break;case Barline.type.DOUBLE:this.drawVerticalBar(D,this.x,!0);break;case Barline.type.END:this.drawVerticalEndBar(D,this.x);break;case Barline.type.REPEAT_BEGIN:this.drawRepeatBar(D,this.x,!0),D.getX()!==this.x&&this.drawVerticalBar(D,D.getX());break;case Barline.type.REPEAT_END:this.drawRepeatBar(D,this.x,!1);break;case Barline.type.REPEAT_BOTH:this.drawRepeatBar(D,this.x,!1),this.drawRepeatBar(D,this.x,!0);break}}drawVerticalBar(D,R,F){D.checkContext();const G=D.getTopLineTopY(),j=D.getBottomLineBottomY();F&&D.context.fillRect(R-3,G,1,j-G),D.context.fillRect(R,G,1,j-G)}drawVerticalEndBar(D,R){D.checkContext();const F=D.getTopLineTopY(),G=D.getBottomLineBottomY();D.context.fillRect(R-5,F,1,G-F),D.context.fillRect(R-2,F,3,G-F)}drawRepeatBar(D,R,F){D.checkContext();const G=D.getTopLineTopY(),j=D.getBottomLineBottomY();let U=3;F||(U=-5),D.context.fillRect(R+U,G,1,j-G),D.context.fillRect(R-2,G,3,j-G);const W=2;F?U+=4:U-=4;const Y=R+U+W/2;let Q=(D.getNumLines()-1)*D.getSpacingBetweenLines();Q=Q/2-D.getSpacingBetweenLines()/2;let Z=G+Q+W/2;D.context.beginPath(),D.context.arc(Y,Z,W,0,Math.PI*2,!1),D.context.fill(),Z+=D.getSpacingBetweenLines(),D.context.beginPath(),D.context.arc(Y,Z,W,0,Math.PI*2,!1),D.context.fill()}}class Repetition$1 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(D,R,F){super(),this.setAttribute("type","Repetition"),this.symbol_type=D,this.x=R,this.x_shift=0,this.y_shift=F,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Repetition$1.CATEGORY}setShiftX(D){return this.x_shift=D,this}setShiftY(D){return this.y_shift=D,this}setX(D){return this.x=D,this}draw(D,R){switch(this.setRendered(),this.symbol_type){case Repetition$1.type.CODA_RIGHT:this.drawCodaFixed(D,R+D.width);break;case Repetition$1.type.CODA_LEFT:this.drawSymbolText(D,R,"Coda",!1);break;case Repetition$1.type.SEGNO_LEFT:this.drawSignoFixed(D,R);break;case Repetition$1.type.SEGNO_RIGHT:this.drawSignoFixed(D,R+D.width);break;case Repetition$1.type.DC:this.drawSymbolText(D,R,"D.C.",!1);break;case Repetition$1.type.DC_AL_CODA:this.drawSymbolText(D,R,"D.C. al Coda",!0);break;case Repetition$1.type.DC_AL_FINE:this.drawSymbolText(D,R,"D.C. al Fine",!1);break;case Repetition$1.type.DS:this.drawSymbolText(D,R,"D.S.",!1);break;case Repetition$1.type.DS_AL_CODA:this.drawSymbolText(D,R,"D.S. al Coda",!0);break;case Repetition$1.type.DS_AL_FINE:this.drawSymbolText(D,R,"D.S. al Fine",!1);break;case Repetition$1.type.FINE:this.drawSymbolText(D,R,"Fine",!1);break;case Repetition$1.type.TO_CODA:this.drawSymbolText(D,R,"To Coda",!0);break}return this}drawCodaFixed(D,R){const F=D.getYForTopText(D.options.num_lines)+this.y_shift;return Glyph.renderGlyph(D.context,this.x+R+this.x_shift,F+25,40,"v4d",!0),this}drawSignoFixed(D,R){const F=D.getYForTopText(D.options.num_lines)+this.y_shift;return Glyph.renderGlyph(D.context,this.x+R+this.x_shift,F+25,30,"v8c",!0),this}drawSymbolText(D,R,F,G){const j=D.checkContext();j.save(),j.setFont(this.font.family,this.font.size,this.font.weight);let U=0+this.x_shift,W=R+this.x_shift;this.symbol_type===Repetition$1.type.CODA_LEFT?(U=this.x+D.options.vertical_bar_width,W=U+j.measureText(F).width+12):(this.x_shift=-(U+j.measureText(F).width+12+D.options.vertical_bar_width+12),U=this.x+this.x_shift+D.options.vertical_bar_width,W=U+j.measureText(F).width+12);const Y=D.getYForTopText(D.options.num_lines)+this.y_shift+25;return G&&Glyph.renderGlyph(j,W,Y,40,"v4d",!0),j.fillText(F,U,Y+5),j.restore(),this}}class StaveSection extends StaveModifier{static get CATEGORY(){return"stavesection"}constructor(D,R,F){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=D,this.x=R,this.shift_x=0,this.shift_y=F,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return StaveSection.CATEGORY}setStaveSection(D){return this.section=D,this}setShiftX(D){return this.shift_x=D,this}setShiftY(D){return this.shift_y=D,this}draw(D,R){const F=D.checkContext();this.setRendered(),F.save(),F.lineWidth=2,F.setFont(this.font.family,this.font.size,this.font.weight);const G=F.measureText(""+this.section),j=G.width,U=G.height;let W=j+6;W<18&&(W=18);const Y=U,Q=D.getYForTopText(3)+this.shift_y;let Z=this.x+R;return F.beginPath(),F.lineWidth=2,F.rect(Z,Q+U/4,W,Y),F.stroke(),Z+=(W-j)/2,F.fillText(""+this.section,Z,Q+16),F.restore(),this}}class StaveTempo extends StaveModifier{static get CATEGORY(){return"stavetempo"}constructor(D,R,F){super(),this.setAttribute("type","StaveTempo"),this.tempo=D,this.position=Modifier.Position.ABOVE,this.x=R,this.shift_x=10,this.shift_y=F,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return StaveTempo.CATEGORY}setTempo(D){return this.tempo=D,this}setShiftX(D){return this.shift_x=D,this}setShiftY(D){return this.shift_y=D,this}draw(D,R){const F=D.checkContext();this.setRendered();const G=this.render_options,j=G.glyph_font_scale/38,U=this.tempo.name,W=this.tempo.duration,Y=this.tempo.dots,Q=this.tempo.bpm,Z=this.font;let q=this.x+this.shift_x+R;const J=D.getYForTopText(1)+this.shift_y;if(F.save(),F.openGroup("stavetempo",null,{}),U&&(F.setFont(Z.family,Z.size,Z.weight),F.fillText(U,q,J),q+=F.measureText(U).width),W&&Q){F.setFont(Z.family,Z.size,"normal"),U&&(q+=F.measureText(" ").width,F.fillText("(",q,J),q+=F.measureText("(").width);const K=Flow.getGlyphProps(W);if(q+=3*j,Glyph.renderGlyph(F,q,J,G.glyph_font_scale,K.code_head),q+=K.getWidth()*j,K.stem){let te=30;K.beam_count&&(te+=3*(K.beam_count-1)),te*=j;const ne=J-te;F.fillRect(q-j,ne,j,te),K.flag&&(Glyph.renderGlyph(F,q,ne,G.glyph_font_scale,K.code_flag_upstem),Y||(q+=6*j))}for(let te=0;te=D.line?Y.above:Y.below)}this.placeGlyphOnLine(G,this.stave,D.line),this.glyphs.push(G);const U=this.xPositions[this.xPositions.length-1],W=G.getMetrics().width+j;this.xPositions.push(U+W),this.width+=W}cancelKey(D){return this.formatted=!1,this.cancelKeySpec=D,this}convertToCancelAccList(D){const R=Flow.keySignature(D),F=this.accList.length>0&&R.length>0&&R[0].type!==this.accList[0].type,G=F?R.length:R.length-this.accList.length;if(G<1)return;const j=[];for(let U=0;U0?D[0].type:null;let F;if(this.cancelKeySpec&&(F=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const G=(this.position===StaveModifier.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;F&&this.convertAccLines(G,F.type,F.accList),this.convertAccLines(G,R,D);for(let j=0;j0){this.stave.context.openGroup("keysignature");for(let D=0;D{const D=B.split("/").filter(R=>R!=="");if(D.length!==2)throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${B}. Must be in the form "/"`);D.forEach(R=>{if(isNaN(Number(R)))throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${B}. 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(D=null,R=15,F=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=F,D===null)return;const G=R;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(StaveModifier.Position.BEGIN),this.setTimeSig(D),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(G)}getCategory(){return TimeSignature.CATEGORY}parseTimeSpec(D){if(D==="C"||D==="C|"){const{line:G,code:j,point:U}=TimeSignature.glyphs[D];return{line:G,num:!1,glyph:new Glyph(j,U)}}this.validate_args&&assertIsValidFraction(D);const[R,F]=D.split("/").map(G=>G.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(R,F)}}makeTimeSignatureGlyph(D,R){const F=new Glyph("v0",this.point);F.topGlyphs=[],F.botGlyphs=[];let G=0;for(let q=0;qj?G:j,W=F.getMetrics().x_min;F.getMetrics=()=>({x_min:W,x_max:W+U,width:U});const Y=(U-G)/2,Q=(U-j)/2,Z=this;return F.renderToStave=function(J){let K=J+Y;for(let te=0;teR.visible).filter(Boolean).length}getOptions(){return this.options}setNoteStartX(D){this.formatted||this.format(),this.setStartX(D);const R=this.modifiers[0];return R.setX(this.start_x-R.getWidth()),this}setStartX(D){this.start_x=D}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(D){return this.options.num_lines=parseInt(D,10),this.resetLines(),this}setY(D){return this.y=D,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(D){const R=D-this.x;this.formatted=!1,this.x=D,this.start_x+=R,this.end_x+=R;for(let F=0;FF.getWidth()&&(R-=F.getWidth()),R}setRepetitionTypeLeft(D,R){return this.modifiers.push(new Repetition$1(D,this.x,R)),this}setRepetitionTypeRight(D,R){return this.modifiers.push(new Repetition$1(D,this.x,R)),this}setVoltaType(D,R,F){if(D===2)volta.type===2&&volta.stave.modifiers.push(new Volta(volta.type,volta.number_t,volta.x,volta.y)),volta={stave:this,type:D,number_t:R,MeasureNumber:this.MeasureNumber,y:F,x:this.x};else if(D===4){let G=this.MeasureNumber-volta.MeasureNumber,j=Math.max(volta.y,F);for(let U=0;U<=G;U++)voltaMeasureNumber[volta.MeasureNumber+U]={type:U===0?2:U===G?4:0,number_t:R,y:j};volta={}}else this.modifiers.push(new Volta(D,R,this.x,F));return this}drawVolta(){let D=voltaMeasureNumber[this.MeasureNumber];D&&(this.modifiers.push(new Volta(D.type,D.number_t,this.x,D.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(D,R,F=0,G=12){const j=new StaveSection(D,this.x+F,R);return j.font.size=G,this.modifiers.push(j),this}setTempo(D,R){return this.modifiers.push(new StaveTempo(D,this.x,R)),this}setText(D,R,F){let G=new StaveText(D,R,F);return G.setFont({family:"Arial",size:14,weight:"normal"}),this.modifiers.push(G),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new BoundingBox$1(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const D=this.options,R=D.spacing_between_lines_px;return this.getYForLine(D.num_lines)+D.space_below_staff_ln*R}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(D){const R=this.options,F=R.spacing_between_lines_px,G=R.space_above_staff_ln;return this.y+D*F+G*F}getLineForY(D){const R=this.options,F=R.spacing_between_lines_px,G=R.space_above_staff_ln;return(D-this.y)/F-G}getYForTopText(D){const R=D||0;return this.getYForLine(-R-this.options.top_text_position)}getYForBottomText(D){const R=D||0;return this.getYForLine(this.options.bottom_text_position+R)}getYForNote(D){const R=this.options,F=R.spacing_between_lines_px,G=R.space_above_staff_ln;return this.y+G*F+5*F-D*F}getYForGlyphs(){return this.getYForLine(3)}addModifier(D,R,F){return R!==void 0&&D.setPosition(R),F&&(this.timeSignature.numerator=F.numerator,this.timeSignature.denominator=F.denominator),D.setStave(this),this.formatted=!1,this.modifiers.push(D),this}addEndModifier(D){return this.addModifier(D,StaveModifier.Position.END),this}setBegBarType(D){const{SINGLE:R,REPEAT_BEGIN:F,NONE:G}=Barline.type;return(D===R||D===F||D===G)&&(this.modifiers[0].setType(D),this.formatted=!1),this}setEndBarType(D){return D!==Barline.type.REPEAT_BEGIN&&(this.modifiers[1].setType(D),this.formatted=!1),this}setClef(D,R,F,G){G===void 0&&(G=StaveModifier.Position.BEGIN),G===StaveModifier.Position.END?this.endClef=D:this.clef=D;const j=this.getModifiers(G,Clef.CATEGORY);return j.length===0?this.addClef(D,R,F,G):j[0].setType(D,R,F),this}setEndClef(D,R,F){return this.setClef(D,R,F,StaveModifier.Position.END),this}setKeySignature(D,R,F){this.options.keySignature=D,F===void 0&&(F=StaveModifier.Position.BEGIN);const G=this.getModifiers(F,KeySignature.CATEGORY);return G.length===0?this.options.DYMusicScoreType!=="jianpu"&&this.addKeySignature(D,R,F):G[0].setKeySig(D,R),this}setEndKeySignature(D,R){return this.setKeySignature(D,R,StaveModifier.Position.END),this}setTimeSignature(D,R,F){F===void 0&&(F=StaveModifier.Position.BEGIN);const G=this.getModifiers(F,TimeSignature.CATEGORY);return G.length===0?this.addTimeSignature(D,R,F):G[0].setTimeSig(D),this}setEndTimeSignature(D,R){return this.setTimeSignature(D,R,StaveModifier.Position.END),this}addKeySignature(D,R,F){return F===void 0&&(F=StaveModifier.Position.BEGIN),this.addModifier(new KeySignature(D,R).setPosition(F),F),this}addClef(D,R,F,G){return G===void 0||G===StaveModifier.Position.BEGIN?this.clef=D:G===StaveModifier.Position.END&&(this.endClef=D),this.addModifier(new Clef(D,R,F),G),this}addEndClef(D,R,F){return this.addClef(D,R,F,StaveModifier.Position.END),this}addTimeSignature(D,R,F){return this.addModifier(new TimeSignature(D,R),F),this}addEndTimeSignature(D,R){return this.addTimeSignature(D,R,StaveModifier.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(D,R){return D===void 0&&R===void 0?this.modifiers:this.modifiers.filter(F=>(D===void 0||D===F.getPosition())&&(R===void 0||R===F.getCategory()))}sortByCategory(D,R){for(let F=D.length-1;F>=0;F--)for(let G=0;GR[D[G+1].getCategory()]){const j=D[G];D[G]=D[G+1],D[G+1]=j}}format(){const D=this.modifiers[0],R=this.modifiers[1],F=this.getModifiers(StaveModifier.Position.BEGIN),G=this.getModifiers(StaveModifier.Position.END);this.sortByCategory(F,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(G,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),F.length>1&&D.getType()===Barline.type.REPEAT_BEGIN&&(F.push(F.splice(0,1)[0]),F.splice(0,0,new Barline(Barline.type.SINGLE))),G.indexOf(R)>0&&G.splice(0,0,new Barline(Barline.type.NONE));let j,U,W,Y=0,Q=this.x;for(let J=0;J{U.includes(Y)?W.visible=!0:W.visible=!1})}for(let U=0;Uthis.drawStaveTempo()),this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const U=this.context.measureText(""+this.measure).width;G=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-U/2,G),this.context.restore()}return this}drawStaveTempo(){if(!this.staveTempos.length)return;const D=document.querySelector(`#${this.attrs.id}`);if(!D)return;const R=D.parentElement.getBBox(),F=this.getYForLine(0),G=D.parentElement.parentElement.querySelectorAll(".vf-curve");if(G.length){const j=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),U=this.getYForTopText(1)+R.y-F+5;G.forEach(W=>{const Y=W.getBBox();Y.x-10j&&Y.y-10U&&(R.y=Y.y+5)})}for(let j=0;j=0&&this.timeSignature.numerator){let D=40,R=0;this.MeasureNumber<2&&(D=70,R=-72),this.setText(`${this.timeSignature.numerator}`,1,{justification:1,shift_x:D,shift_y:R-13}),this.setText("\u1173",1,{justification:1,shift_x:D+3,shift_y:R-2}),this.setText(`${this.timeSignature.denominator}`,1,{justification:1,shift_x:D,shift_y:R+8})}}drawVertical(D,R){this.drawVerticalFixed(this.x+D,R)}drawVerticalFixed(D,R){this.checkContext();const F=this.getYForLine(0),G=this.getYForLine(this.options.num_lines-1);R&&this.context.fillRect(D-3,F,1,G-F+1),this.context.fillRect(D,F,1,G-F+1)}drawVerticalBar(D){this.drawVerticalBarFixed(this.x+D,!1)}drawVerticalBarFixed(D){this.checkContext();const R=this.getYForLine(0),F=this.getYForLine(this.options.num_lines-1);this.context.fillRect(D,R,1,F-R+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(D,R){if(D>=this.options.num_lines||D<0)throw new Vex.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(R.visible===void 0)throw new Vex.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof R.visible!="boolean")throw new Vex.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[D]=R,this}setConfigForLines(D){if(D.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 R in D)D[R]||(D[R]=this.options.line_config[R]),Vex.Merge(this.options.line_config[R],D[R]);return this.options.line_config=D,this}}class TabStave extends Stave{constructor(D,R,F,G){const j={spacing_between_lines_px:13,num_lines:6,top_text_position:1};Vex.Merge(j,G),super(D,R,F,j),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}function getUnusedStringGroups(B,D){const R=[];let F=[];for(let G=1;G<=B;G++)D.indexOf(G)>-1?(R.push(F),F=[]):F.push(G);return F.length>0&&R.push(F),R}function getPartialStemLines(B,D,R,F){const G=F!==1,j=F!==-1,U=R.getSpacingBetweenLines(),W=R.getNumLines(),Y=[];return D.forEach(Q=>{const Z=Q.indexOf(W)>-1,q=Q.indexOf(1)>-1;if(G&&q||j&&Z)return;Q.length===1&&Q.push(Q[0]);const J=[];Q.forEach((K,te,ne)=>{const ie=K===1,re=K===W;let oe=R.getYForLine(K-1);te===0&&!ie?oe-=U/2-1:te===ne.length-1&&!re&&(oe+=U/2-1),J.push(oe),F===1&&ie?J.push(B-2):F===-1&&re&&J.push(B+2)}),Y.push(J.sort((K,te)=>K-te))}),Y}class TabNote$1 extends StemmableNote{static get CATEGORY(){return"tabnotes"}constructor(D,R){if(super(D),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=D.positions,Vex.Merge(this.render_options,{glyph_font_scale:Flow.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:R,draw_dots:R,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): ${JSON.stringify(D)}`);this.buildStem(),D.stem_direction?this.setStemDirection(D.stem_direction):this.setStemDirection(Stem.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return TabNote$1.CATEGORY}setGhost(D){return this.ghost=D,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const D=this.getGlyph();return this.stem_extension_override!=null?this.stem_extension_override:D?this.getStemDirection()===1?D.tabnote_stem_up_extension:D.tabnote_stem_down_extension:0}addDot(){const D=new Dot;return this.dots+=1,this.addModifier(D,0)}updateWidth(){this.glyphs=[],this.width=0;for(let D=0;Dthis.width}setStave(D){super.setStave(D),this.context=D.context;let R;if(this.context){const G=this.context;for(this.width=0,R=0;Rj.width),this.width=Math.max(j.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const F=this.positions.map(({str:G})=>D.getYForLine(G-1));return this.setYs(F),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(D){this.setModifierContext(D);for(let R=0;R{D.getCategory()==="dots"&&!this.render_options.draw_dots||(D.setContext(this.context),D.drawWithStyle())})}drawStemThrough(){const D=this.getStemX(),R=this.getStemY(),F=this.context,G=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&G){const U=this.stave.getNumLines(),W=this.positions.map(Z=>Z.str),Y=getUnusedStringGroups(U,W),Q=getPartialStemLines(R,Y,this.getStave(),this.getStemDirection());F.save(),F.setLineWidth(Stem.WIDTH),Q.forEach(Z=>{Z.length!==0&&(F.beginPath(),F.moveTo(D,Z[0]),F.lineTo(D,Z[Z.length-1]),F.stroke(),F.closePath())}),F.restore()}}drawPositions(){const D=this.context,R=this.getAbsoluteX(),F=this.ys;for(let G=0;GparseInt(G,10)?TabSlide.SLIDE_DOWN:TabSlide.SLIDE_UP}this.slide_direction=R,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(D)}renderTie(D){if(D.first_ys.length===0||D.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const R=this.context,F=D.first_x_px,G=D.first_ys,j=D.last_x_px,U=this.slide_direction;if(U!==TabSlide.SLIDE_UP&&U!==TabSlide.SLIDE_DOWN)throw new Vex.RERR("BadSlide","Invalid slide direction");for(let W=0;Wthis.numStrings)throw new Vex.RERR("BadArguments",`String number must be between 1 and ${this.numStrings}:${D}`);return this.tuningValues[R-1]}getValueForFret(D,R){const F=this.getValueForString(R),G=parseInt(D,10);if(G<0)throw new Vex.RERR("BadArguments","Fret number must be 0 or higher: "+D);return F+G}getNoteForFret(D,R){const F=this.getValueForFret(D,R),G=Math.floor(F/12),j=F%12;return Flow.integerToNote(j)+"/"+G}}class KeyManager{constructor(D){this.music=new Music,this.setKey(D)}setKey(D){return this.key=D,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: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),Music.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const R=Music.root_indices[this.keyParts.root];for(let F=0;F{const F=TextDynamics.GLYPHS[R];if(!F)throw new Vex.RERR("Invalid dynamics character: "+R);const G=this.render_options.glyph_font_size,j=new Glyph(F.code,G);this.glyphs.push(j),D+=F.width}),this.setWidth(D),this.preFormatted=!0,this}draw(){this.setRendered();const D=this.getAbsoluteX(),R=this.stave.getYForLine(this.line+-3);L$8("Rendering Dynamics: ",this.sequence);let F=D;this.glyphs.forEach((G,j)=>{const U=this.sequence[j];G.render(this.context,F,R),F+=TextDynamics.GLYPHS[U].width})}}function drawArrowHead(B,D,R,F,G,j,U){B.beginPath(),B.moveTo(D,R),B.lineTo(F,G),B.lineTo(j,U),B.lineTo(D,R),B.closePath(),B.fill()}function drawArrowLine(B,D,R,F){const G=F.draw_start_arrow&&F.draw_end_arrow,j=D.x,U=D.y,W=R.x,Y=R.y,Q=Math.sqrt((W-j)*(W-j)+(Y-U)*(Y-U)),Z=(Q-F.arrowhead_length/3)/Q;let q,J,K,te;F.draw_end_arrow||G?(q=Math.round(j+(W-j)*Z),J=Math.round(U+(Y-U)*Z)):(q=W,J=Y),F.draw_start_arrow||G?(K=j+(W-j)*(1-Z),te=U+(Y-U)*(1-Z)):(K=j,te=U),F.color&&(B.setStrokeStyle(F.color),B.setFillStyle(F.color)),B.beginPath(),B.moveTo(K,te),B.lineTo(q,J),B.stroke(),B.closePath();const ne=Math.atan2(Y-U,W-j),ie=Math.abs(F.arrowhead_length/Math.cos(F.arrowhead_angle));let re,oe,le,fe,he,ge;(F.draw_end_arrow||G)&&(re=ne+Math.PI+F.arrowhead_angle,le=W+Math.cos(re)*ie,fe=Y+Math.sin(re)*ie,oe=ne+Math.PI-F.arrowhead_angle,he=W+Math.cos(oe)*ie,ge=Y+Math.sin(oe)*ie,drawArrowHead(B,le,fe,W,Y,he,ge)),(F.draw_start_arrow||G)&&(re=ne+F.arrowhead_angle,le=j+Math.cos(re)*ie,fe=U+Math.sin(re)*ie,oe=ne-F.arrowhead_angle,he=j+Math.cos(oe)*ie,ge=U+Math.sin(oe)*ie,drawArrowHead(B,le,fe,j,U,he,ge))}class StaveLine extends Element$2{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(D){super(),this.setAttribute("type","StaveLine"),this.notes=D,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(D)}setFont(D){return this.font=D,this}setText(D){return this.text=D,this}setNotes(D){if(!D.first_note&&!D.last_note)throw new Vex.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(D.first_indices||(D.first_indices=[0]),D.last_indices||(D.last_indices=[0]),D.first_indices.length!==D.last_indices.length)throw new Vex.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=D.first_note,this.first_indices=D.first_indices,this.last_note=D.last_note,this.last_indices=D.last_indices,this}applyLineStyle(){const D=this.checkContext(),R=this.render_options;R.line_dash&&D.setLineDash(R.line_dash),R.line_width&&D.setLineWidth(R.line_width),R.rounded_end?D.setLineCap("round"):D.setLineCap("square")}applyFontStyle(){const D=this.checkContext();this.font&&D.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(D.setStrokeStyle(this.render_options.color),D.setFillStyle(this.render_options.color))}draw(){const D=this.checkContext();this.setRendered();const R=this.first_note,F=this.last_note,G=this.render_options;D.save(),this.applyLineStyle();let j,U;this.first_indices.forEach((J,K)=>{const te=this.last_indices[K];j=R.getModifierStartXY(2,J),U=F.getModifierStartXY(1,te);const ne=j.y>U.y;j.x+=R.getMetrics().modRightPx+G.padding_left,U.x-=F.getMetrics().modLeftPx+G.padding_right;const ie=R.getGlyph().getWidth();R.getKeyProps()[J].displaced&&R.getStemDirection()===1&&(j.x+=ie+G.padding_left),F.getKeyProps()[te].displaced&&F.getStemDirection()===-1&&(U.x-=ie+G.padding_right),j.y+=ne?-3:1,U.y+=ne?2:0,drawArrowLine(D,j,U,this.render_options)}),D.restore();const W=D.measureText(this.text).width,Y=G.text_justification;let Q=0;Y===StaveLine.TextJustification.LEFT?Q=j.x:Y===StaveLine.TextJustification.CENTER?Q=(U.x-j.x)/2+j.x-W/2:Y===StaveLine.TextJustification.RIGHT&&(Q=U.x-W);let Z;const q=G.text_position_vertical;return q===StaveLine.TextVerticalPosition.TOP?Z=R.getStave().getYForTopText():q===StaveLine.TextVerticalPosition.BOTTOM&&(Z=R.getStave().getYForBottomText(Flow.TEXT_HEIGHT_OFFSET_HACK)),D.save(),this.applyFontStyle(),D.fillText(this.text,Q,Z),D.restore(),this}}function L$7(...B){PedalMarking.DEBUG&&Vex.L("Vex.Flow.PedalMarking",B)}function drawPedalGlyph(B,D,R,F,G){const j=PedalMarking.GLYPHS[B];new Glyph(j.code,G).render(D,R+j.x_shift,F+j.y_shift)}class PedalMarking extends Element$2{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(D){return new PedalMarking(D)}static createSostenuto(D){const R=new PedalMarking(D);return R.setStyle(PedalMarking.Styles.MIXED),R.setCustomText("Sost. Ped."),R}static createUnaCorda(D){const R=new PedalMarking(D);return R.setStyle(PedalMarking.Styles.TEXT),R.setCustomText("una corda","tre corda"),R}constructor(D){super(),this.setAttribute("type","PedalMarking"),this.EndsStave=!1,this.ChangeBegin=!1,this.ChangeEnd=!1,this.notes=D,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(D){if(this.endStave=D,this.endStaveAddedWidth=0,this.startMargin=0,this.endMargin=0,Array.isArray(this.endStave.modifiers))for(let R=0;R3)throw new Vex.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=D,this}setLine(D){return this.line=D,this}drawBracketed(){const D=this.context;let R=!1,F,G;const j=this;this.notes.forEach((U,W,Y)=>{R=!R;let Q=0;if(U?Q=U.getNoteHeadBeginX():Q=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)R?this.ChangeBegin&&(Q=U.getAbsoluteX()):(U?this.ChangeEnd?Q=U.getAbsoluteX():Q=U.getStave().end_x+this.endStaveAddedWidth-j.render_options.text_margin_right:Q=this.endStave.end_x+this.endStaveAddedWidth-j.render_options.text_margin_right,this.endMargin=-j.render_options.text_margin_right);else if(U)if(R)this.ChangeBegin&&(Q=U.getAbsoluteX());else switch(j.style){case PedalMarking.Styles.BRACKET_OPEN_END:case PedalMarking.Styles.BRACKET_OPEN_BOTH:case PedalMarking.Styles.MIXED_OPEN_END:Q=U.getNoteHeadEndX();break;default:this.ChangeEnd?Q=U.getAbsoluteX():(Q=U.getNoteHeadBeginX()-j.render_options.text_margin_right,this.startMargin=-j.render_options.text_margin_right);break}let Z=this.endStave;U&&(Z=U.getStave());let q=Z.getYForBottomText(j.line+3);G&&G>q&&(q=G);const J=Y[W+1]===U,K=Y[W-1]===U;let te=0;if(R)if(te=K?5:0,(j.style===PedalMarking.Styles.MIXED||j.style===PedalMarking.Styles.MIXED_OPEN_END)&&!K)if(j.custom_depress_text){const ne=D.measureText(j.custom_depress_text).width;D.fillText(j.custom_depress_text,Q-ne/2,q),te=ne/2+j.render_options.text_margin_right}else drawPedalGlyph("pedal_depress",D,Q,q,j.render_options.glyph_point_size),te=20+j.render_options.text_margin_right;else D.beginPath(),j.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||j.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?D.moveTo(Q+te,q):(this.ChangeBegin&&(Q+=5),D.moveTo(Q,q-j.render_options.bracket_height),this.ChangeBegin&&(Q+=5),D.lineTo(Q+te,q)),D.stroke(),D.closePath();else te=J&&!this.EndsStave?-5:0,D.beginPath(),D.moveTo(F,G),D.lineTo(Q+te,q),j.style!==PedalMarking.Styles.BRACKET_OPEN_END&&j.style!==PedalMarking.Styles.MIXED_OPEN_END&&j.style!==PedalMarking.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(Q+=5),D.lineTo(Q,q-j.render_options.bracket_height)),D.stroke(),D.closePath();F=Q+te,G=q})}drawText(){const D=this.context;let R=!1;const F=this,G=F.render_options.glyph_point_size;this.notes.forEach(j=>{R=!R;const U=j.getStave(),W=j.getAbsoluteX(),Y=U.getYForBottomText(F.line+3);let Q=0;R?F.custom_depress_text?(Q=D.measureText(F.custom_depress_text).width,D.fillText(F.custom_depress_text,W-Q/2,Y)):drawPedalGlyph("pedal_depress",D,W,Y,G):F.custom_release_text?(Q=D.measureText(F.custom_release_text).width,D.fillText(F.custom_release_text,W-Q/2,Y)):drawPedalGlyph("pedal_release",D,W,Y,G)})}draw(){const D=this.checkContext();this.setRendered(),D.save(),D.setStrokeStyle(this.render_options.color),D.setFillStyle(this.render_options.color),D.setFont(this.font.family,this.font.size,this.font.weight),L$7("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?(D.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===PedalMarking.Styles.TEXT&&this.drawText(),D.restore()}}function L$6(...B){TextBracket.DEBUG&&Vex.L("Vex.Flow.TextBracket",B)}class TextBracket extends Element$2{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:TextBracket.Positions.TOP,bottom:TextBracket.Positions.BOTTOM}}constructor({start:D,stop:R,text:F="",superscript:G="",position:j=TextBracket.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=D,this.stop=R,this.text=F,this.superscript=G,this.position=typeof j=="string"?TextBracket.PositionString[j]:j,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(D){return D.setFont(this.font.family,this.font.size,this.font.weight),D.setStrokeStyle(this.render_options.color),D.setFillStyle(this.render_options.color),D.setLineWidth(this.render_options.line_width),this}setDashed(D,R){return this.render_options.dashed=D,R&&(this.render_options.dash=R),this}setFont(D){return this.font={...this.font,...D},this}setLine(D){return this.line=D,this}draw(){const D=this.context;this.setRendered();let R=0;switch(this.position){case TextBracket.Positions.TOP:R=this.start.getStave().getYForTopText(this.line);break;case TextBracket.Positions.BOTTOM:R=this.start.getStave().getYForBottomText(this.line+Flow.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}const F={x:this.start.getAbsoluteX(),y:R},G={x:this.stop.getAbsoluteX(),y:R};L$6("Rendering TextBracket: start:",F,"stop:",G,"y:",R);const j=this.render_options.bracket_height*this.position;D.save(),this.applyStyle(D),D.fillText(this.text,F.x,F.y);const U=D.measureText(this.text).width,W=D.measureText("M").width,Y=F.y-W/2.5;D.setFont(this.font.family,this.font.size/1.4,this.font.weight),D.fillText(this.superscript,F.x+U+1,Y);const Q=D.measureText(this.superscript).width,Z=D.measureText("M").width;let q=F.x,J=Y;const K=G.x+this.stop.getGlyph().getWidth();this.position===TextBracket.Positions.TOP?(q+=U+Q+5,J-=Z/2.7):this.position===TextBracket.Positions.BOTTOM&&(J+=Z/2.7,q+=U+2,this.render_options.underline_superscript||(q+=Q)),this.render_options.dashed?(Renderer.drawDashedLine(D,q,J,K,J,this.render_options.dash),this.render_options.show_bracket&&Renderer.drawDashedLine(D,K,J+1*this.position,K,J+j,this.render_options.dash)):(D.beginPath(),D.moveTo(q,J),D.lineTo(K,J),this.render_options.show_bracket&&D.lineTo(K,J+j),D.stroke(),D.closePath()),D.restore()}}function L$5(...B){BarNote.DEBUG&&Vex.L("Vex.Flow.BarNote",B)}class BarNote extends Note{constructor(D=Barline.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const R=Barline.type;this.metrics.widths={[R.SINGLE]:8,[R.DOUBLE]:12,[R.END]:15,[R.REPEAT_BEGIN]:14,[R.REPEAT_END]:14,[R.REPEAT_BOTH]:18,[R.NONE]:0},this.ignore_ticks=!0,this.setType(D)}getType(){return this.type}setType(D){return this.type=typeof D=="string"?Barline.typeString[D]:D,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$5("Rendering bar line at: ",this.getAbsoluteX());const D=new Barline(this.type);D.setX(this.getAbsoluteX()),D.draw(this.stave),this.setRendered()}}class GhostNote extends StemmableNote{constructor(D){if(!D)throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let R;if(typeof D=="string")R={duration:D};else if(typeof D=="object")R=D;else throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");super(R),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(D){super.setStave(D)}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 D=0;D0||R===!0;return R&&!(j>0)&&(this.pos=G),W?this.matchSuccess():this.matchFail(G),{success:W,results:F,numMatches:j}}expectZeroOrMore(D){return this.expectOneOrMore(D,!0)}expect(D){L$3("Evaluating rules:",D);let R;if(!D)throw new X$2("Invalid Rule: "+D,D);const F=D.bind(this.grammar)();if(F.token)R=this.matchToken(F.token,F.noSpace===!0),R.success&&(this.pos+=R.incrementPos);else if(F.expect)F.oneOrMore?R=this.expectOneOrMore(F):F.zeroOrMore?R=this.expectZeroOrMore(F):R=this.expectOne(F);else throw new X$2("Bad grammar! No `token` or `expect` property",F);return R.matches=[],R.results&&R.results.forEach(G=>R.matches.push(flattenMatches(G))),F.run&&R.success&&F.run(R),R}}function L$2(...B){EasyScore.DEBUG&&Vex.L("Vex.Flow.EasyScore",B)}const X$1=Vex.MakeException("EasyScoreError");class Grammar{constructor(D){this.builder=D}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:D=>this.builder.addChord(D.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:D=>this.builder.addSingleNote(D.matches[0],D.matches[1],D.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:D=>this.builder.setNoteDots(D.matches[0])}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:D=>this.builder.setNoteType(D.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:D=>this.builder.setNoteDuration(D.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 D=R=>R.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:R=>this.builder.addNoteOption(R.matches[0],D(R.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(D){this.factory=D,this.commitHooks=[],this.reset()}reset(D={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,D)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(D){this.commitHooks.push(D)}resetPiece(){L$2("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(D){L$2("setNoteDots:",D),D&&(this.piece.dots=D.length)}setNoteDuration(D){L$2("setNoteDuration:",D),this.rollingDuration=this.piece.duration=D||this.rollingDuration}setNoteType(D){L$2("setNoteType:",D),D&&(this.piece.type=D)}addNoteOption(D,R){L$2("addNoteOption: key:",D,"value:",R),this.piece.options[D]=R}addNote(D,R,F){L$2("addNote:",D,R,F),this.piece.chord.push({key:D,accid:R,octave:F})}addSingleNote(D,R,F){L$2("addSingleNote:",D,R,F),this.addNote(D,R,F)}addChord(D){L$2("startChord"),typeof D[0]!="object"?this.addSingleNote(D[0]):D.forEach(R=>{R&&this.addNote(...R)}),L$2("endChord")}commitPiece(){L$2("commitPiece");const{factory:D}=this;if(!D)return;const R={...this.options,...this.piece.options},{stem:F,clef:G}=R,j=F.toLowerCase()==="auto",U=!j&&F.toLowerCase()==="up"?StaveNote.STEM_UP:StaveNote.STEM_DOWN,{chord:W,duration:Y,dots:Q,type:Z}=this.piece,q=W.map(te=>te.key+"/"+te.octave),J=D.StaveNote({keys:q,duration:Y,dots:Q,type:Z,clef:G,auto_stem:j});j||J.setStemDirection(U);const K=W.map(te=>te.accid||null);K.forEach((te,ne)=>{te&&J.addAccidental(ne,D.Accidental({type:te}))});for(let te=0;tete(R,J,this)),this.elements.notes.push(J),this.elements.accidentals.concat(K),this.resetPiece()}}function setId({id:B},D){B!==void 0&&D.setAttribute("id",B)}function setClass(B,D){if(!B.class)return;const R=/\s*,\s*/;B.class.split(R).forEach(F=>D.addClass(F))}class EasyScore{constructor(D={}){this.setOptions(D),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(D){return Object.assign(this.defaults,D),this}setOptions(D){return this.options={factory:null,builder:null,commitHooks:[setId,setClass,Articulation$1.easyScoreHook],throwOnError:!1,...D},this.factory=this.options.factory,this.builder=this.options.builder||new Builder(this.factory),this.grammar=new Grammar(this.builder),this.parser=new Parser$1(this.grammar),this.options.commitHooks.forEach(R=>this.addCommitHook(R)),this}setContext(D){return this.factory&&this.factory.setContext(D),this}parse(D,R={}){this.builder.reset(R);const F=this.parser.parse(D);if(!F.success&&this.options.throwOnError)throw new X$1("Error parsing line: "+D,F);return F}beam(D,R={}){return this.factory.Beam({notes:D,options:R}),D}tuplet(D,R={}){return this.factory.Tuplet({notes:D,options:R}),D}notes(D,R={}){return R={clef:this.defaults.clef,stem:this.defaults.stem,...R},this.parse(D,R),this.builder.getElements().notes}voice(D,R){return R={time:this.defaults.time,...R},this.factory.Voice(R).addTickables(D)}addCommitHook(D){return this.builder.addCommitHook(D)}}function initGroup(){return{notes:[],finish:!1,total:0,staveId:""}}let _text_width=null,tone="C",group$1=initGroup(),_denominator="",_numerator="",ornamentGroup="";class NumberedNote extends StaveNote{static get CATEGORY(){return"numberednotes"}static accidentalAndKey(D){switch(D){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(D){switch(D){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(D){super(D),this.setAttribute("type","NumberedNote"),tone=D.keyString,this.ornament=!!D.ornament,this.line=0,this.keys=D.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=D.note_size||16;const R=Flow.sanitizeDuration(this.duration);var F=NumberedNote.numberedDurationLine[R.toString()];if(F&&(this.duration_lines=F),F=NumberedNote.longDurationLine[R.toString()],F&&(this.long_duration_lines=F),!_text_width){var G="__$text_wraper$$__";let U=document.createElement("canvas");U.id=G,document.body.append(U);const W=document.getElementById(G),Y=W.getContext("2d");Y.font="Arial 22px";var j=Y.measureText("5");_text_width=j.width+2,document.body.removeChild(W)}}getCategory(){return NumberedNote.CATEGORY}setKeySignature(D){this.keySignature=D}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 D=NumberedNote.accidentalMap(tone);if(!D)return;const R=NumberedNote.noteLift;if(!R)return;var F=this.keys[0].split("/"),G=F[0];G==="b"&&(G="R"),G=G.replaceAll("#",""),G=G.replaceAll("n",""),G.length>1&&(G=G.replaceAll("b",""));const j=NumberedNoteHead.numberedNotationMapping[G.toUpperCase()];if(R.includes(j))for(let U=0;U{switch(F.getAttribute("type")){case"Accidental":F.render_options.font_scale=this.note_width*1.4,F.x_shift=2,F.y_shift=this.unit_height/2,this.ornament&&(F.render_options.font_scale=this.note_width,F.x_shift=14,F.y_shift=-10);break;case"Stroke":F.x_shift=-1*D,F.y_shift=1*this.unit_height;break;case"Dot":F.x_shift=R*this.duration_dot_width+7,F.y_shift=1*this.unit_height,R++;break;case"Ornament":F.y_shift=-3;break;default:F.y_shift=1*this.unit_height}F.reset&&F.reset(),D+=F.getWidth()/2})}handleDeleteDot(){for(let D=0;DU),F=R.length?R[0]/R[1]:0;if(this.ornament)return;if(F===0)return this.long_duration_lines=this.intrinsicTicks/D-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$1=initGroup();let G={lines:this.duration_lines,duration:F,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,y:this.y,width:this.full_width};F>D*2&&(this.long_duration_lines=parseInt(F/D)-1,this.handleDeleteDot()),ornamentGroup&&(G.x+=this.note_width),group$1.notes.push(G);let j=group$1.notes.reduce((U,W)=>U+W.duration,0);j=parseInt(j),j>D&&(j-=D),j>D-10&&jW.lines===0).length&&(this.drawDurationLoneLine(),group$1=initGroup()))}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");let D=this.context;D.save(),D.setFont("Arial",this.note_height,"normal"),this.setAttribute("el",D.openGroup("stavenote",this.getAttribute("id"))),D.openGroup("note",null,{pointerBBox:!0});let R=this.getAbsoluteX()+2.5;this.x=R;let F=this.stave.getYForLine(2)+this.note_height/2;this.y=F,this.buildToneHeads(),this.preFormatModifier(),this.applyStyle(),this.note_tones.forEach(G=>{G.draw(D)}),D.openGroup("modifier",null,{pointerBBox:!0}),this.drawModifiers(),D.closeGroup(),D.closeGroup(),D.closeGroup(),this.calcGroup(),group$1.staveId=this.stave.attrs.id,this.drawDurationLine(D,{}),this.drawLongDurationLines(D),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(D,R){D=D||this.context;let F=R||this.y+this.duration_line_space;for(let G=0;G<5;G++){let j=[],U=0;for(let W=0;WG)j.push(Y),U++;else{if(j.length>1){let Q=j.length-1;F=j[0].y+this.duration_line_space,D.rect(j[0].x,F+G*3,j[Q].x-j[0].x+j[Q].width,.5)}j=[],U=W+1}}if(j.length>1){let W=j.length-1;F=j[0].y+this.duration_line_space,D.rect(j[0].x,F+G*3,j[W].x-j[0].x+j[W].width,.5)}}}draw_dot(D,R,F,G){D.openGroup("numbered-note-dot"),D.beginPath(),D.arc(R,F,G,0,2*Math.PI),D.closePath(),D.fill(),D.closeGroup()}drawDurationLine(D,R){var F=this.attrs.id+"-lines";D.openGroup("numbered_note_lines",F);var G,j;if(this.duration_lines>0){const Y=this.duration_line_space;var U=this.full_width;if(R&&R.width&&(U=R.width),U<0&&(U=this.note_width),!R||typeof R.startX=="undefined"?G=this.x-Y/2-this.left_width:G=R.startX,!R||typeof R.startY=="undefined"?j=this.y+this.duration_line_space:j=R.startY,group$1.finish&&(this.drawDurationLoneLine(D,j),group$1=initGroup()),this.ornament?(G+=12,j-=22,U=15,ornamentGroup&&(G-=10,U+=10)):ornamentGroup&&(G+=this.note_width,U-=this.note_width),U>0){for(var W=0;WW.getAttribute("type")==="Accidental"),U=this.modifiers.findIndex(W=>W.getAttribute("type")==="Accidental");G&&U>-1?this.modifiers[U].accidental.code=G==="#"?"v18":"v44":this.modifiers.splice(U,1)}}catch(G){console.log("\u{1F680} ~ error",G)}}this.setYs(D)}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 D=this;return(this.y||0)-(D.note_tones.map(F=>(F.td+F.bd)*(D.dot_space+D.dot_width)).reduce((F,G)=>F+G,0)+this.note_height*this.note_tones.length-this.unit_height-this.note_tones[0].bd*(D.dot_space+D.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(D){var R=[];return this.modifiers.forEach(F=>{F.getCategory()===D&&R.push(F)}),R}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 D=0;return this.modifiers.forEach(R=>{D+=R.getWidth()}),D}}class NumberedNoteHead{static get numberedNotationMapping(){let D=tone;switch(window&&window.sett&&window.sett.keySignature&&(D="C"),D){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 D=this.key.split("/"),R=D[0];R==="b"&&(R="R"),R=R.replaceAll("#",""),R=R.replaceAll("n",""),R.length>1&&(R=R.replaceAll("b",""));let F=0,G=0;this.note.stave&&this.note.stave.options&&this.note.stave.options.keySignature&&(tone=this.note.stave.options.keySignature);const j=this.note.getLine();return jNumberedNoteHead.numberedNotationMapping.max&&(G=Math.ceil((j-NumberedNoteHead.numberedNotationMapping.max)/3.5)),R.toUpperCase()==="R"&&(F=0,G=0),{key:NumberedNoteHead.numberedNotationMapping[R.toUpperCase()],td:G,bd:F}}constructor(D){this.key=D.key,this.x=D.x||0,this.y=D.y||0,this.idx=D.idx||0,this.note=D.note||0,this.meta=this.tone_to_numbered_key(),this.noteSize=D.noteSize||16,this.td=this.meta.td,this.bd=this.meta.bd}draw(D){let R=this.y;D.openGroup("numbered-note-head");var F=this.x+(this.note.ornament?-2:0);let G=R-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2);for(let U=0;U1&&(W-=this.note.duration_line_space),R+=W}this.draw_dot(D,F+_text_width,R,this.note.dot_width),R+=this.note.dot_width+this.note.dot_space}D.closeGroup()}get height(){return this.note.note_height+(this.meta.bd+this.meta.td)*(this.note.dot_width+this.note.dot_space)}draw_dot(D,R,F,G){D.openGroup("numbered-note-dot"),D.beginPath(),D.arc(R,F,G,0,2*Math.PI),D.closePath(),D.fill(),D.closeGroup()}}function L$1(...B){Factory.DEBUG&&Vex.L("Vex.Flow.Factory",B)}const X=Vex.MakeException("FactoryError");function setDefaults$1(B={},D){const R=D.options;return B=Object.assign(D,B),B.options=Object.assign(R,B.options),B}class Factory{constructor(D){L$1("New factory: ",D);const R={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=R,this.setOptions(D)}static newFromElementId(D,R=500,F=200){return new Factory({renderer:{elementId:D,width:R,height:F}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(D){for(const R of["stave","renderer","font"])Object.assign(this.options[R],D[R]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:D,backend:R,width:F,height:G,background:j}=this.options.renderer;if(D==="")throw new X("HTML DOM element not set in Factory");this.context=Renderer.buildContext(D,R,F,G,j)}getContext(){return this.context}setContext(D){return this.context=D,this}getStave(){return this.stave}getVoices(){return this.voices}space(D){return this.options.stave.space*D}Stave(D){D=setDefaults$1(D,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});const R=new Stave(D.x,D.y,D.width,D.options);return this.staves.push(R),R.setContext(this.context),this.stave=R,R}TabStave(D){D=setDefaults$1(D,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space*1.3}});const R=new TabStave(D.x,D.y,D.width,D.options);return this.staves.push(R),R.setContext(this.context),this.stave=R,R}StaveNote(D){const R=new StaveNote(D);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}GhostNote(D){const R=new GhostNote(D);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}TextNote(D){const R=new TextNote(D);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}NumberedNote(D){const R=new NumberedNote(D);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}BarNote(D){D=setDefaults$1(D,{type:"single",options:{}});const R=new BarNote(D.type);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}ClefNote(D){D=setDefaults$1(D,{type:"treble",options:{size:"default"}});const R=new ClefNote(D.type,D.options.size,D.options.annotation);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}TimeSigNote(D){D=setDefaults$1(D,{time:"4/4",options:{}});const R=new TimeSigNote(D.time);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}KeySigNote(D){const R=new KeySigNote(D.key,D.cancelKey,D.alterKey);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}TabNote(D){const R=new TabNote$1(D);return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}GraceNote(D){const R=new GraceNote(D);return this.stave&&R.setStave(this.stave),R.setContext(this.context),R}GraceNoteGroup(D){const R=new GraceNoteGroup(D.notes,D.slur);return R.setContext(this.context),R}Accidental(D){D=setDefaults$1(D,{type:null,options:{}});const R=new Accidental(D.type);return R.setContext(this.context),R}Annotation(D){D=setDefaults$1(D,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const R=new Annotation(D.text);return R.setJustification(D.hJustify),R.setVerticalJustification(D.vJustify),R.setFont(D.fontFamily,D.fontSize,D.fontWeight),R.setContext(this.context),R}Articulation(D){D=setDefaults$1(D,{type:"a.",position:"above",options:{}});const R=new Articulation$1(D.type);return R.setPosition(D.position),R.setContext(this.context),R}TextDynamics(D){D=setDefaults$1(D,{text:"p",duration:"q",dots:0,line:0,options:{}});const R=new TextDynamics({text:D.text,line:D.line,duration:D.duration,dots:D.dots});return this.stave&&R.setStave(this.stave),R.setContext(this.context),this.renderQ.push(R),R}Fingering(D){D=setDefaults$1(D,{number:"0",position:"left",options:{}});const R=new FretHandFinger(D.number);return R.setPosition(D.position),R.setContext(this.context),R}StringNumber(D){D=setDefaults$1(D,{number:"0",position:"left",options:{}});const R=new StringNumber(D.number);return R.setPosition(D.position),R.setContext(this.context),R}TickContext(){return new TickContext().setContext(this.context)}ModifierContext(){return new ModifierContext}MultiMeasureRest(D){const R=new MultiMeasureRest(D.number_of_measures,D);return R.setContext(this.context),this.renderQ.push(R),R}Voice(D){D=setDefaults$1(D,{time:"4/4",options:{}});const R=new Voice$1(D.time);return this.voices.push(R),R}StaveConnector(D){D=setDefaults$1(D,{top_stave:null,bottom_stave:null,type:"double",options:{}});const R=new StaveConnector(D.top_stave,D.bottom_stave);return R.setType(D.type).setContext(this.context),this.renderQ.push(R),R}Formatter(){return new Formatter}Tuplet(D){D=setDefaults$1(D,{notes:[],options:{}});const R=new Tuplet$1(D.notes,D.options).setContext(this.context);return this.renderQ.push(R),R}Beam(D){D=setDefaults$1(D,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const R=new Beam$1(D.notes,D.options.autoStem).setContext(this.context);return R.breakSecondaryAt(D.options.secondaryBeamBreaks),this.renderQ.push(R),R}Curve(D){D=setDefaults$1(D,{from:null,to:null,options:{}});const R=new Curve(D.from,D.to,D.options).setContext(this.context);return this.renderQ.push(R),R}StaveTie(D){D=setDefaults$1(D,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const R=new StaveTie({first_note:D.from,last_note:D.to,first_indices:D.first_indices,last_indices:D.last_indices},D.text);return D.options.direction&&R.setDirection(D.options.direction),R.setContext(this.context),this.renderQ.push(R),R}StaveLine(D){D=setDefaults$1(D,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const R=new StaveLine({first_note:D.from,last_note:D.to,first_indices:D.first_indices,last_indices:D.last_indices});return D.options.text&&R.setText(D.options.text),D.options.font&&R.setFont(D.options.font),R.setContext(this.context),this.renderQ.push(R),R}VibratoBracket(D){D=setDefaults$1(D,{from:null,to:null,options:{harsh:!1}});const R=new VibratoBracket({start:D.from,stop:D.to});return D.options.line&&R.setLine(D.options.line),D.options.harsh&&R.setHarsh(D.options.harsh),R.setContext(this.context),this.renderQ.push(R),R}TextBracket(D){D=setDefaults$1(D,{from:null,to:null,text:"",options:{superscript:"",position:1}});const R=new TextBracket({start:D.from,stop:D.to,text:D.text,superscript:D.options.superscript,position:D.options.position});return D.options.line&&R.setLine(D.options.line),D.options.font&&R.setFont(D.options.font),R.setContext(this.context),this.renderQ.push(R),R}System(D={}){D.factory=this;const R=new System(D).setContext(this.context);return this.systems.push(R),R}EasyScore(D={}){return D.factory=this,new EasyScore(D)}PedalMarking(D={}){D=setDefaults$1(D,{notes:[],options:{style:"mixed"}});const R=new PedalMarking(D.notes);return R.setStyle(PedalMarking.StylesString[D.options.style]),R.setContext(this.context),this.renderQ.push(R),R}NoteSubGroup(D={}){D=setDefaults$1(D,{notes:[],options:{}});const R=new NoteSubGroup$1(D.notes);return R.setContext(this.context),R}draw(){this.systems.forEach(D=>D.setContext(this.context).format()),this.staves.forEach(D=>D.setContext(this.context).draw()),this.voices.forEach(D=>D.setContext(this.context).draw()),this.renderQ.forEach(D=>{D.isRendered()||D.setContext(this.context).draw()}),this.systems.forEach(D=>D.setContext(this.context).draw()),this.reset()}}function setDefaults(B,D){const R=D.options;return B=Object.assign(D,B),B.options=Object.assign(R,B.options),B}class System extends Element$2{constructor(D={}){super(),this.setAttribute("type","System"),this.setOptions(D),this.parts=[]}setOptions(D={}){this.options=setDefaults(D,{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(D){return super.setContext(D),this.factory.setContext(D),this}addConnector(D="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:D}),this.connector}addStave(D){return D=setDefaults(D,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}}),D.stave||(D.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:D.options})),D.voices.forEach(R=>R.setContext(this.context).setStave(D.stave).getTickables().forEach(F=>F.setStave(D.stave))),this.parts.push(D),D.stave}format(){const D=new Formatter;this.formatter=D;let R=this.options.y,F=0,G=[];const j=[];this.parts.forEach(W=>{R=R+W.stave.space(W.spaceAbove),W.stave.setY(R),D.joinVoices(W.voices),R=R+W.stave.space(W.spaceBelow),R=R+W.stave.space(this.options.spaceBetweenStaves),W.debugNoteMetrics&&(j.push({y:R,voice:W.voices[0]}),R+=15),G=G.concat(W.voices),F=Math.max(F,W.stave.getNoteStartX())}),this.parts.forEach(W=>W.stave.setNoteStartX(F));const U=this.options.width-(F-this.options.x)-Note.STAVEPADDING;D.format(G,U);for(let W=0;W{R.voice.getTickables().forEach(F=>Note.plotMetrics(D,F,R.y))})}}Vex.Flow=Flow;Vex.Flow.Element=Element$2;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$1;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$1;Vex.Flow.System=System;Vex.Flow.Factory=Factory;Vex.Flow.Parser=Parser$1;Vex.Flow.EasyScore=EasyScore;Vex.Flow.Registry=Registry;var SystemLinesEnum=(B=>(B[B.SingleThin=0]="SingleThin",B[B.DoubleThin=1]="DoubleThin",B[B.ThinBold=2]="ThinBold",B[B.BoldThinDots=3]="BoldThinDots",B[B.DotsThinBold=4]="DotsThinBold",B[B.DotsBoldBoldDots=5]="DotsBoldBoldDots",B[B.None=6]="None",B[B.Dotted=7]="Dotted",B[B.Dashed=8]="Dashed",B[B.Bold=9]="Bold",B[B.BoldThin=10]="BoldThin",B[B.DoubleBold=11]="DoubleBold",B[B.Tick=12]="Tick",B[B.Short=13]="Short",B))(SystemLinesEnum||{});class SystemLinesEnumHelper{static xmlBarlineStyleToSystemLinesEnum(D){return D==="regular"?0:D==="dotted"?7:D==="dashed"?8:D==="heavy"?9:D==="light-light"?1:D==="light-heavy"?2:D==="heavy-light"?10:D==="heavy-heavy"?11:D==="tick"?12:D==="short"?13:D==="none"?6:0}}class Matrix2D{constructor(){this.matrix=[];for(let D=0;D<2;D++){this.matrix[D]=[];for(let R=0;R<2;R++)this.matrix[D][R]=0}}static getRotationMatrix(D){const R=new Matrix2D,F=Math.cos(D),G=Math.sin(D);return R.matrix[0][0]=F,R.matrix[0][1]=-G,R.matrix[1][0]=G,R.matrix[1][1]=F,R}scalarMultiplication(D){for(let R=0;R<2;R++)for(let F=0;F<2;F++)this.matrix[R][F]*=D}getTransposeMatrix(){const D=new Matrix2D;for(let R=0;R<2;R++)for(let F=0;F<2;F++)D.matrix[R][F]=this.matrix[F][R];return D}vectorMultiplication(D){const R=new PointF2D;return R.x=D.x*this.matrix[0][0]+D.y*this.matrix[0][1],R.y=D.x*this.matrix[1][0]+D.y*this.matrix[1][1],R}}class MusicSheetErrors{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(D){let R=this.measureErrors[D];R||(R=[]),this.measureErrors[D]=R.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(D){this.tempErrors.push(D)}push(D){this.errors.push(D)}}class Arpeggio{constructor(D,R=ArpeggioType.ARPEGGIO_DIRECTIONLESS){this.parentVoiceEntry=D,this.type=R,this.notes=[]}addNote(D){this.notes.push(D),D.Arpeggio=this}}var ArpeggioType=(B=>(B[B.BRUSH_DOWN=1]="BRUSH_DOWN",B[B.BRUSH_UP=2]="BRUSH_UP",B[B.ROLL_DOWN=3]="ROLL_DOWN",B[B.ROLL_UP=4]="ROLL_UP",B[B.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",B[B.RASQUEDO_UP=6]="RASQUEDO_UP",B[B.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",B))(ArpeggioType||{});class Beam{constructor(D=1,R=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=D,this.BeamNumberOffsetToXML=R}get Notes(){return this.notes}set Notes(D){this.notes=D}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(D){this.extendedNoteList=D}addNoteToBeam(D){D&&(D.NoteBeam=this,this.notes.push(D),this.extendedNoteList.push(D))}}class Voice{constructor(D,R){this.voiceEntries=[],this.volume=1,this.parent=D,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=R,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(D){this.visible=D}get Audible(){return this.audible}set Audible(D){this.audible=D}get Following(){return this.following}set Following(D){this.following=D}get Solo(){return this.solo}set Solo(D){this.solo=D}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(D){this.volume=D}toString(){return this.uniqueVoiceId}}class LinkedVoice extends Voice{constructor(D,R,F){super(D,R),this.master=F}get Master(){return this.master}}class Notehead{constructor(D,R,F=void 0){this.sourceNote=D,this.setShapeFromXml(R,F)}setShapeFromXml(D,R=void 0){this.shape=Notehead.ShapeTypeXmlToShape(D);let F=R;F===void 0&&(this.sourceNote?F=this.sourceNote.Length.Denominator>2:(log$2.warn("notehead: sourceNote and filledXmlAttribute undefined."),F=!0)),this.filled=F}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(D){switch(D.toLowerCase()){case"normal":return NoteHeadShape.NORMAL;case"x":return NoteHeadShape.X;case"slash":return NoteHeadShape.SLASH;case"diamond":return NoteHeadShape.DIAMOND;case"square":return NoteHeadShape.SQUARE;case"la":return NoteHeadShape.SQUARE;case"do":case"triangle":return NoteHeadShape.TRIANGLE;case"rectangle":return NoteHeadShape.RECTANGLE;case"circle-x":return NoteHeadShape.CIRCLEX;default:return log$2.info("unsupported/unhandled xml notehead '"+D+"'. Using normal notehead."),NoteHeadShape.NORMAL}}}var NoteHeadShape=(B=>(B[B.CIRCLEX=0]="CIRCLEX",B[B.DIAMOND=1]="DIAMOND",B[B.NORMAL=2]="NORMAL",B[B.RECTANGLE=3]="RECTANGLE",B[B.SLASH=4]="SLASH",B[B.SQUARE=5]="SQUARE",B[B.TRIANGLE=6]="TRIANGLE",B[B.X=7]="X",B))(NoteHeadShape||{});class ITextTranslation{static translateText(D,R){if(!this.defaultTextTranslation)return R}}var NoteType=(B=>(B[B.UNDEFINED=0]="UNDEFINED",B[B._1024th=1]="_1024th",B[B._512th=2]="_512th",B[B._256th=3]="_256th",B[B._128th=4]="_128th",B[B._64th=5]="_64th",B[B._32nd=6]="_32nd",B[B._16th=7]="_16th",B[B.EIGTH=8]="EIGTH",B[B.QUARTER=9]="QUARTER",B[B.HALF=10]="HALF",B[B.WHOLE=11]="WHOLE",B[B.BREVE=12]="BREVE",B[B.LONG=13]="LONG",B[B.MAXIMA=14]="MAXIMA",B))(NoteType||{});class NoteTypeHandler{static NoteTypeToString(D){return this.NoteTypeXmlValues[D]}static StringToNoteType(D){const R=this.NoteTypeXmlValues.indexOf(D);return R!==-1?R:0}static getNoteDurationFromType(D){switch(D){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 R=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new MusicSheetReadingException(R)}}}}NoteTypeHandler.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];class OrnamentContainer{constructor(D){this.placement=PlacementEnum.Above,this.accidentalAbove=AccidentalEnum.NONE,this.accidentalBelow=AccidentalEnum.NONE,this.ornament=D}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(D){this.accidentalAbove=D}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(D){this.accidentalBelow=D}}var OrnamentEnum=(B=>(B[B.Trill=0]="Trill",B[B.Turn=1]="Turn",B[B.InvertedTurn=2]="InvertedTurn",B[B.DelayedTurn=3]="DelayedTurn",B[B.DelayedInvertedTurn=4]="DelayedInvertedTurn",B[B.Mordent=5]="Mordent",B[B.InvertedMordent=6]="InvertedMordent",B))(OrnamentEnum||{});class VerticalSourceStaffEntryContainer{constructor(D,R,F){this.staffEntries=[],this.comments=[],this.timestamp=R,this.staffEntries=new Array(F),this.parentMeasure=D}$get$(D){return this.staffEntries[D]}$set$(D,R){this.staffEntries[D]=R}get Timestamp(){return this.timestamp}set Timestamp(D){this.timestamp=D}get StaffEntries(){return this.staffEntries}set StaffEntries(D){this.staffEntries=D}get Comments(){return this.comments}set Comments(D){this.comments=D}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(D){this.parentMeasure=D}getAbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}class SourceStaffEntry{constructor(D,R){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=D,this.parentStaff=R}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(D){this.voiceEntries=D}get Link(){return this.staffEntryLink}set Link(D){this.staffEntryLink=D}get Instructions(){return this.instructions}set Instructions(D){this.instructions=D}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(D){this.chordSymbolContainers=D}removeAllInstructionsOfTypeClefInstruction(){let D=0,R=0;for(;D0)return!0;return!1}hasTie(){for(let D=0,R=this.VoiceEntries.length;DR.parentRepetition.StartIndex)return-1}if(D.alignment===AlignmentType.Begin&&R.alignment===AlignmentType.Begin){if(D.parentRepetition.EndIndexR.parentRepetition.EndIndex)return-1}}return 0}}class RepetitionInstruction{constructor(D,R,F=AlignmentType.End,G=void 0,j=void 0){this.endingIndices=void 0,this.measureIndex=D,j&&(this.endingIndices=j.slice()),this.type=R,this.alignment=F,this.parentRepetition=G}CompareTo(D){const R=D;if(this.measureIndex>R.measureIndex)return 1;if(this.measureIndex(B[B.StartLine=0]="StartLine",B[B.ForwardJump=1]="ForwardJump",B[B.BackJumpLine=2]="BackJumpLine",B[B.Ending=3]="Ending",B[B.DaCapo=4]="DaCapo",B[B.DalSegno=5]="DalSegno",B[B.Fine=6]="Fine",B[B.ToCoda=7]="ToCoda",B[B.DalSegnoAlFine=8]="DalSegnoAlFine",B[B.DaCapoAlFine=9]="DaCapoAlFine",B[B.DalSegnoAlCoda=10]="DalSegnoAlCoda",B[B.DaCapoAlCoda=11]="DaCapoAlCoda",B[B.Coda=12]="Coda",B[B.Segno=13]="Segno",B[B.None=14]="None",B))(RepetitionInstructionEnum||{}),AlignmentType=(B=>(B[B.Begin=0]="Begin",B[B.End=1]="End",B))(AlignmentType||{});let prevSourceMeasure=null;class SourceMeasure{constructor(D,R){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=D,this.implicitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=SystemLinesEnum.SingleThin,this.firstInstructionsStaffEntries=new Array(D),this.lastInstructionsStaffEntries=new Array(D),this.rules=R,this.TempoInBPM=0;for(let F=0;F1)return D[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(D){this.verticalMeasureList=D}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(D){this.tempoInBPM=D}findOrCreateStaffEntry(D,R,F){let G,j;for(const W of this.verticalSourceStaffEntryContainers)if(W.Timestamp.Equals(D)){j=W;break}if(j)return j.StaffEntries[R]?G=j.StaffEntries[R]:(G=new SourceStaffEntry(j,F),j.StaffEntries[R]=G),{createdNewContainer:!1,staffEntry:G};const U=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||U.Timestamp.lt(D)){const W=new VerticalSourceStaffEntryContainer(this,D.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(W),G=new SourceStaffEntry(W,F),W.StaffEntries[R]=G}else for(let W=this.verticalSourceStaffEntryContainers.length-1;W>=0;W--){if(this.verticalSourceStaffEntryContainers[W].Timestamp.lt(D)){const Y=new VerticalSourceStaffEntryContainer(this,D.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(W+1,0,Y),G=new SourceStaffEntry(Y,F),Y.StaffEntries[R]=G;break}if(W===0){const Y=new VerticalSourceStaffEntryContainer(this,D.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(W,0,Y),G=new SourceStaffEntry(Y,F),Y.StaffEntries[R]=G;break}}return{createdNewContainer:!0,staffEntry:G}}findOrCreateVoiceEntry(D,R){let F,G=!1;for(const j of D.VoiceEntries)if(j.ParentVoice===R){F=j;break}return F||(F=new VoiceEntry(D.Timestamp,R,D),G=!0),{createdVoiceEntry:G,voiceEntry:F}}getPreviousSourceStaffEntryFromIndex(D,R){for(let F=R-1;F>=0;F--)if(this.verticalSourceStaffEntryContainers[F][D])return this.verticalSourceStaffEntryContainers[F][D]}getVerticalContainerIndexByTimestamp(D){for(let R=0,F=this.VerticalSourceStaffEntryContainers.length;R=0;q--){const J=this.verticalSourceStaffEntryContainers[q][W+Y];if(J!==void 0&&J.hasTie()&&U.lt(Fraction$1.plus(J.Timestamp,J.calculateMaxNoteLength()))){U=Fraction$1.plus(J.Timestamp,J.calculateMaxNoteLength());break}}}}G.push(U)}for(let j=0,U=G.length;j0)return!0}return!1}beginsWithLineRepetition(){for(let D=0,R=this.FirstRepetitionInstructions.length;D=0&&(R=this.verticalSourceStaffEntryContainers[F].StaffEntries[D],!R);F--);return R}canBeReducedToMultiRest(){var F,G,j,U,W,Y;let D=!0,R=!1;for(const Q of this.verticalSourceStaffEntryContainers)if(!!Q){for(const Z of Q.StaffEntries)if(!(!Z||!Z.ParentStaff.ParentInstrument.Visible)){if(Z.ChordContainers.length>0||(Z.ParentStaff.hasLyrics&&(R=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0))return!1;for(const q of Z.VoiceEntries){for(const J of q.Notes)if(!J.isRest()){D=!1;break}if(!D)break}}}if(!D||R||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const Q of this.staffLinkedExpressions)if(Q.length>0)return!1;for(const Q of this.lastInstructionsStaffEntries)for(let Z=0,q=Q==null?void 0:Q.Instructions.length;Z=0;R--)for(let F=0;F(B[B.Fingering=0]="Fingering",B[B.String=1]="String",B))(TechnicalInstructionType||{});class TechnicalInstruction{}class PlaybackNote{constructor(D,R){this.parentEntry=D,this.parentNote=R,this.ParentNote.PlaybackNote=this,this.Length=this.ParentNote.Length,R.Pitch!==void 0?this.ParentNote.ParentStaff.ParentInstrument.MidiInstrumentId===MidiInstrument.Percussion?this.MidiKey=PlaybackNote.noteToMidiDrumKey(R):this.MidiKey=R.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(D){var G;const R=D.Pitch.getHalfTone()-12,F=(G=D.Notehead)==null?void 0:G.Shape;switch(D.Pitch.Octave){case 1:switch(D.Pitch.FundamentalNote){case NoteEnum.D:switch(F){default:return 44}case NoteEnum.E:switch(F){default:return 35}case NoteEnum.F:switch(F){default:return 36}case NoteEnum.G:switch(F){default:return 41}case NoteEnum.A:switch(F){default:return 43}case NoteEnum.B:switch(F){case NoteHeadShape.TRIANGLE:return 54;default:return 47}default:return R}case 2:switch(D.Pitch.FundamentalNote){case NoteEnum.C:switch(F){case NoteHeadShape.X:return 37;default:return 38}case NoteEnum.D:switch(F){case NoteHeadShape.X:return 59;default:return 48}case NoteEnum.E:switch(F){case NoteHeadShape.X:return 42;case NoteHeadShape.CIRCLEX:return 46;case NoteHeadShape.TRIANGLE:return 56;default:return 50}case NoteEnum.F:switch(F){case NoteHeadShape.DIAMOND:return 53;default:return 51}case NoteEnum.G:switch(F){case NoteHeadShape.CIRCLEX:case NoteHeadShape.DIAMOND:return 46;default:return 42}case NoteEnum.A:switch(F){default:return 49}case NoteEnum.B:switch(F){default:return 57}default:return R}case 3:switch(D.Pitch.FundamentalNote){case NoteEnum.C:switch(F){case NoteHeadShape.CIRCLEX:return 52;default:return 55}default:return R}default:return R}}}class PlaybackEntry{constructor(D){this.notes=[],this.TimestampShift=new Fraction$1,this.parentVoiceEntry=D;for(const R of D.Notes)this.Notes.push(new PlaybackNote(this,R))}get ParentVoiceEntry(){return this.parentVoiceEntry}get Notes(){return this.notes}get Length(){if(this.Notes.length>0)return this.Notes[0].Length}set Length(D){for(const R of this.Notes)R.Length=D}get HasNotes(){return this.Notes.length>0}}class VoiceEntry{constructor(D,R,F,G=!0,j=!1,U=!1,W=!1){if(this.notes=[],this.graceVoiceEntriesBefore=[],this.graceVoiceEntriesAfter=[],this.articulations=[],this.playbackEntries=[],this.technicalInstructions=[],this.lyricsEntries=new Dictionary,this.wantedStemDirection=StemDirectionType.Undefined,this.stemDirectionXml=StemDirectionType.Undefined,this.stemDirection=StemDirectionType.Undefined,this.timestamp=D,this.parentVoice=R,this.parentSourceStaffEntry=F,this.isGrace=j,this.graceAfterMainNote=!1,this.graceNoteSlash=U,this.graceSlur=W,j||R.VoiceEntries.push(this),G&&F!==void 0){const Y=F.VoiceEntries;Y.indexOf(this)===-1&&Y.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(D){this.timestamp=D}get Notes(){return this.notes}addNote(D){this.notes.push(D),!D.isRest()&&(D.NoteTie===void 0||D.NoteTie.StartNote===D)&&this.MainPlaybackEntry.Notes.push(new PlaybackNote(this.MainPlaybackEntry,D))}get GraceVoiceEntriesBefore(){return this.graceVoiceEntriesBefore}set GraceVoiceEntriesBefore(D){this.graceVoiceEntriesBefore=D;for(const R of this.graceVoiceEntriesBefore)R.parentSourceStaffEntry=this.ParentSourceStaffEntry}get GraceVoiceEntriesAfter(){return this.graceVoiceEntriesAfter}set GraceVoiceEntriesAfter(D){this.graceVoiceEntriesAfter=D;for(const R of this.graceVoiceEntriesAfter)R.parentSourceStaffEntry=this.ParentSourceStaffEntry}get IsGrace(){return this.isGrace}set IsGrace(D){this.isGrace=D}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(D){this.graceAfterMainNote=D}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(D){this.graceNoteSlash=D}get GraceSlur(){return this.graceSlur}set GraceSlur(D){this.graceSlur=D}get Articulations(){return this.articulations}get PlaybackEntries(){return this.playbackEntries}get Fermata(){return this.fermata}get MainPlaybackEntry(){return this.mainPlaybackEntry}set MainPlaybackEntry(D){this.mainPlaybackEntry=D}removeMainPlaybackEntry(){this.mainPlaybackEntry!==void 0&&this.removePlaybackEntry(this.mainPlaybackEntry)}removePlaybackEntry(D){this.mainPlaybackEntry===D&&(this.mainPlaybackEntry=void 0);const R=this.playbackEntries.indexOf(D);R>-1&&this.playbackEntries.splice(R,1)}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(D){this.arpeggio=D}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(D){this.ornamentContainer=D}set WantedStemDirection(D){this.wantedStemDirection=D}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(D){this.stemDirectionXml=D}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(D){this.stemDirection=D}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(D){this.stemColorXml=D}get StemColor(){return this.stemColor}set StemColor(D){this.stemColor=D}get VolumeModifier(){return this.volumeModifier}set VolumeModifier(D){this.volumeModifier=D}get DurationModifier(){return this.durationModifier}set DurationModifier(D){this.durationModifier=D}hasArticulation(D){for(const R of this.articulations)if(R.Equals(D))return!0;return!1}static isSupportedArticulation(D){switch(D){case ArticulationEnum.accent:case ArticulationEnum.strongaccent:case ArticulationEnum.invertedstrongaccent:case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:case ArticulationEnum.spiccato:case ArticulationEnum.tenuto:case ArticulationEnum.fermata:case ArticulationEnum.invertedfermata:case ArticulationEnum.breathmark:case ArticulationEnum.caesura:case ArticulationEnum.lefthandpizzicato:case ArticulationEnum.naturalharmonic:case ArticulationEnum.snappizzicato:case ArticulationEnum.upbow:case ArticulationEnum.downbow:case ArticulationEnum.bend:case ArticulationEnum.detachedlegato:return!0;default:return!1}}hasTie(){for(let D=0,R=this.Notes.length;D0)return!0;return!1}isStaccato(){for(const D of this.Articulations)if(D.articulationEnum===ArticulationEnum.staccato)return!0;return!1}isAccent(){for(const D of this.Articulations)if(D.articulationEnum===ArticulationEnum.accent||D.articulationEnum===ArticulationEnum.strongaccent)return!0;return!1}getVerseNumberForLyricEntry(D){let R=1;return this.lyricsEntries.forEach((F,G)=>{D===G&&(R=F)}),R}}var ArticulationEnum=(B=>(B[B.accent=0]="accent",B[B.strongaccent=1]="strongaccent",B[B.marcatoup=2]="marcatoup",B[B.marcatodown=3]="marcatodown",B[B.invertedstrongaccent=4]="invertedstrongaccent",B[B.staccato=5]="staccato",B[B.staccatissimo=6]="staccatissimo",B[B.spiccato=7]="spiccato",B[B.tenuto=8]="tenuto",B[B.fermata=9]="fermata",B[B.invertedfermata=10]="invertedfermata",B[B.breathmark=11]="breathmark",B[B.caesura=12]="caesura",B[B.lefthandpizzicato=13]="lefthandpizzicato",B[B.naturalharmonic=14]="naturalharmonic",B[B.snappizzicato=15]="snappizzicato",B[B.upbow=16]="upbow",B[B.downbow=17]="downbow",B[B.scoop=18]="scoop",B[B.plop=19]="plop",B[B.doit=20]="doit",B[B.falloff=21]="falloff",B[B.stress=22]="stress",B[B.unstress=23]="unstress",B[B.detachedlegato=24]="detachedlegato",B[B.otherarticulation=25]="otherarticulation",B[B.bend=26]="bend",B))(ArticulationEnum||{}),StemDirectionType=(B=>(B[B.Undefined=-1]="Undefined",B[B.Up=0]="Up",B[B.Down=1]="Down",B[B.None=2]="None",B[B.Double=3]="Double",B))(StemDirectionType||{}),SystemLinePosition=(B=>(B[B.MeasureBegin=0]="MeasureBegin",B[B.MeasureEnd=1]="MeasureEnd",B))(SystemLinePosition||{});class GraphicalLabel extends Clickable{constructor(D,R,F,G,j=void 0){super(),this.label=D,this.boundingBox=new BoundingBox$2(this,j),this.label.fontHeight=R,this.label.textAlignment=F,this.rules=G,this.rules.MpatMode&&this.label.text==="TRIO"&&(this.label.fontFamily="Arial")}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){var W,Y;if(this.Label.text.trim()==="")return;this.TextLines=[];const D=(Y=(W=this.rules)==null?void 0:W.LabelMarginBorderFactor)!=null?Y:.1,R=this.Label.text.split(/[\n\r]+/g),F=R.length;let G=0;for(let Q=0;Q0&&this.TextLines.length>1&&(j+=this.rules.SpacingBetweenTextLines*F/10);const U=this.PositionAndShape;switch(this.Label.textAlignment){case TextAlignmentEnum.CenterBottom:U.BorderTop=-j,U.BorderLeft=-G/2,U.BorderBottom=0,U.BorderRight=G/2;break;case TextAlignmentEnum.CenterCenter:U.BorderTop=-j/2,U.BorderLeft=-G/2,U.BorderBottom=j/2,U.BorderRight=G/2;break;case TextAlignmentEnum.CenterTop:U.BorderTop=0,U.BorderLeft=-G/2,U.BorderBottom=j,U.BorderRight=G/2;break;case TextAlignmentEnum.LeftBottom:U.BorderTop=-j,U.BorderLeft=0,U.BorderBottom=0,U.BorderRight=G;break;case TextAlignmentEnum.LeftCenter:U.BorderTop=-j/2,U.BorderLeft=0,U.BorderBottom=j/2,U.BorderRight=G;break;case TextAlignmentEnum.LeftTop:U.BorderTop=0,U.BorderLeft=0,U.BorderBottom=j,U.BorderRight=G;break;case TextAlignmentEnum.RightBottom:U.BorderTop=-j,U.BorderLeft=-G,U.BorderBottom=0,U.BorderRight=0;break;case TextAlignmentEnum.RightCenter:U.BorderTop=-j/2,U.BorderLeft=-G,U.BorderBottom=j/2,U.BorderRight=0;break;case TextAlignmentEnum.RightTop:U.BorderTop=0,U.BorderLeft=-G,U.BorderBottom=j,U.BorderRight=0;break}U.BorderMarginTop=U.BorderTop-j*D,U.BorderMarginLeft=U.BorderLeft-j*D,U.BorderMarginBottom=U.BorderBottom+j*D,U.BorderMarginRight=U.BorderRight+j*D}}class Label{constructor(D="",R=TextAlignmentEnum.CenterBottom,F=void 0,G=!0){this.IsCreditLabel=!1,this.text=D,this.print=G,this.textAlignment=R,this.font=F,this.fontFamily=void 0}set font(D){this.fontEnumValue=D,this.fontFamily=FontStringNames[D]}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=["\u7EAF\u5F8B","\u7EAF\u5F8B\u7ED3\u675F"],HideWords=["\u8DF3\u8FC7\u4E0B\u4E00\u4E2A","b","#","\xA7","\xBA","X"],GradientWords=["poco rit.","rall.","rit.","accel.","molto rit.","molto rall","lentando","poco accel.","calando"],GRADIENT_SPEED_CLOSE_TAG="\u7ED3\u675F\u8303\u56F4\u901F\u5EA6",GRADIENT_SPEED_RESET_TAG="a tempo",SpecialWords=[GRADIENT_SPEED_CLOSE_TAG],SpeedKeyword="\u901F\u5EA6 ",SpeedHiddenKeyword="\u4EC5\u6587\u672C\u901F\u5EA6 ";function isSpeedKeyword(B){return B.indexOf(SpeedKeyword)===0}function isSpeedHiddenKeyword(B){return B.indexOf(SpeedHiddenKeyword)===0}function formatSpeedKeyword(B){return B.replace(SpeedHiddenKeyword,"").replace(SpeedKeyword,"")}function isGradientWords(B){return GradientWords.includes(B)}function isSpecialMark(B){return[...Object.keys(SpeedTag),...SpecialMarks,...SpecialWords,...HideWords].map(D=>D.trim().toLocaleUpperCase()).includes(B.toLocaleUpperCase().trim())}function isTopFont(B){return[TextAlignmentEnum.CenterTop,TextAlignmentEnum.RightTop].includes(B)}var MusicSymbol=(B=>(B[B.Unused_first_Symbol=0]="Unused_first_Symbol",B[B.BLACK_HEAD=1]="BLACK_HEAD",B[B.UPWARDS_TAIL=2]="UPWARDS_TAIL",B[B.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",B[B.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",B[B.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",B[B.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",B[B.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",B[B.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",B[B.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",B[B.ROUND_HEAD=10]="ROUND_HEAD",B[B.WHITE_HEAD=11]="WHITE_HEAD",B[B.G_CLEF=12]="G_CLEF",B[B.F_CLEF=13]="F_CLEF",B[B.C_CLEF=14]="C_CLEF",B[B.BREVE=15]="BREVE",B[B.BREVE_REST=16]="BREVE_REST",B[B.COMMON_TIME=17]="COMMON_TIME",B[B.CUT_TIME=18]="CUT_TIME",B[B.WHOLE_REST=19]="WHOLE_REST",B[B.HALF_REST=20]="HALF_REST",B[B.QUARTER_REST=21]="QUARTER_REST",B[B.EIGHTH_REST=22]="EIGHTH_REST",B[B.SIXTEENTH_REST=23]="SIXTEENTH_REST",B[B.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",B[B.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",B[B.FLAT=26]="FLAT",B[B.SHARP=27]="SHARP",B[B.NATURAL=28]="NATURAL",B[B.DOUBLE_FLAT=29]="DOUBLE_FLAT",B[B.DOUBLE_SHARP=30]="DOUBLE_SHARP",B[B.ZERO=31]="ZERO",B[B.ONE=32]="ONE",B[B.TWO=33]="TWO",B[B.THREE=34]="THREE",B[B.FOUR=35]="FOUR",B[B.FIVE=36]="FIVE",B[B.SIX=37]="SIX",B[B.SEVEN=38]="SEVEN",B[B.EIGHT=39]="EIGHT",B[B.NINE=40]="NINE",B[B.DOT=41]="DOT",B[B.FERMATA=42]="FERMATA",B[B.INVERTED_FERMATA=43]="INVERTED_FERMATA",B[B.SPICCATO=44]="SPICCATO",B[B.TENUTO=45]="TENUTO",B[B.MARCATO=46]="MARCATO",B[B.MARCATISSIMO=47]="MARCATISSIMO",B[B.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",B[B.P=49]="P",B[B.F=50]="F",B[B.S=51]="S",B[B.Z=52]="Z",B[B.M=53]="M",B[B.R=54]="R",B[B.SEGNO=55]="SEGNO",B[B.CODA=56]="CODA",B[B.DRUM_CLEF=57]="DRUM_CLEF",B[B.G_CLEF_SUB8=58]="G_CLEF_SUB8",B[B.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",B[B.G_CLEF_SUB15=60]="G_CLEF_SUB15",B[B.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",B[B.F_CLEF_SUB8=62]="F_CLEF_SUB8",B[B.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",B[B.F_CLEF_SUB15=64]="F_CLEF_SUB15",B[B.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",B[B.DOWN_BOW=66]="DOWN_BOW",B[B.MORDENT=67]="MORDENT",B[B.INVERTED_MORDENT=68]="INVERTED_MORDENT",B[B.TURN=69]="TURN",B[B.INVERTED_TURN=70]="INVERTED_TURN",B[B.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",B[B.RELEASE_PED=72]="RELEASE_PED",B[B.ENGAGE_PED=73]="ENGAGE_PED",B[B.VA8=74]="VA8",B[B.VB8=75]="VB8",B[B.TRILL=76]="TRILL",B[B.MA15=77]="MA15",B[B.MB15=78]="MB15",B[B.HIGH=79]="HIGH",B[B.PLAY=80]="PLAY",B[B.MIC=81]="MIC",B[B.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",B[B.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",B[B.EditPen=84]="EditPen",B[B.PEDAL_BRACKET=85]="PEDAL_BRACKET",B[B.PEDAL_MIXED=86]="PEDAL_MIXED",B[B.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",B))(MusicSymbol||{}),MusicSymbolDrawingStyle=(B=>(B[B.Normal=0]="Normal",B[B.Disabled=1]="Disabled",B[B.Selected=2]="Selected",B[B.Clickable=3]="Clickable",B[B.PlaybackSymbols=4]="PlaybackSymbols",B[B.FollowSymbols=5]="FollowSymbols",B[B.QFeedbackNotFound=6]="QFeedbackNotFound",B[B.QFeedbackOk=7]="QFeedbackOk",B[B.QFeedbackPerfect=8]="QFeedbackPerfect",B[B.Debug1=9]="Debug1",B[B.Debug2=10]="Debug2",B[B.Debug3=11]="Debug3",B))(MusicSymbolDrawingStyle||{}),PhonicScoreModes=(B=>(B[B.Following=0]="Following",B[B.Midi=1]="Midi",B[B.Manual=2]="Manual",B))(PhonicScoreModes||{});class LabelRenderSpecs{}class MusicSheetDrawer{constructor(D,R){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=PhonicScoreModes.Manual,this.textMeasurer=D,this.splitScreenLineColor=-1,this.drawingParameters=R,this.rules=R.Rules}set Mode(D){this.phonicScoreMode=D}drawSheet(D){if(this.graphicalMusicSheet=D,this.rules=D.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(const F of D.Cursors){if(!F)continue;const G=new BoundingBox$2(F);G.AbsolutePosition=F.Start,G.BorderBottom=F.End.y-F.Start.y,G.BorderRight=F.Width/2,G.BorderLeft=-F.Width/2,this.isVisible(G)&&this.drawLineAsVerticalRectangle(F,GraphicalLayers.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const R=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let F=0;F0&&(isTopFont(D.Label.textAlignment)||[TextAlignmentEnum.CenterBottom].includes(D.Label.textAlignment))){let ie=-1,re=!1;for(const oe of(W==null?void 0:W.AbstractExpressions)||[])if(oe.Label===D?ie=(te=oe==null?void 0:oe.parentMeasure)==null?void 0:te.measureListIndex:(ne=oe.expression)!=null&&ne.TempoInBpm&&(re=oe.expression.TempoInBpm>0),re&&ie>-1){j.ScreenPosition.y-=4*10;break}}this.rules.DYMusicScoreType==="jianpu"?isNaN(parseInt(D.Label.text,10))&&this.renderLabel(D,R,j):this.renderLabel(D,R,j)}calculateLabel(D){const R=new LabelRenderSpecs,F=D.Label,G=new BoundingBox$2(this);G.AbsolutePosition.x=D.PositionAndShape.AbsolutePosition.x,G.AbsolutePosition.y=D.PositionAndShape.AbsolutePosition.y||D.PositionAndShape.Parent.AbsolutePosition.y,R.ScreenPosition=this.applyScreenTransformation(G.AbsolutePosition),R.FontHeightInPixel=this.calculatePixelDistance(F.fontHeight);const j=this.calculatePixelDistance(D.PositionAndShape.Size.width);switch(R.BitmapWidth=Math.ceil(j),R.BitmapHeight=D.TextLines?Math.ceil(R.FontHeightInPixel*(.2+D.TextLines.length)):10,F.textAlignment){case TextAlignmentEnum.LeftTop:R.ScreenPosition.x-=R.BitmapWidth/2,R.ScreenPosition.y+=R.BitmapHeight*1.5;break;case TextAlignmentEnum.LeftCenter:R.ScreenPosition.y-=R.BitmapHeight/2;break;case TextAlignmentEnum.LeftBottom:R.ScreenPosition.y-=R.BitmapHeight;break;case TextAlignmentEnum.CenterTop:R.ScreenPosition.x-=R.BitmapWidth/2;break;case TextAlignmentEnum.CenterCenter:R.ScreenPosition.x-=R.BitmapWidth/2,R.ScreenPosition.y-=R.BitmapHeight/2;break;case TextAlignmentEnum.CenterBottom:R.ScreenPosition.x-=R.BitmapWidth/2,R.ScreenPosition.y-=R.BitmapHeight;break;case TextAlignmentEnum.RightTop:R.ScreenPosition.x-=R.BitmapWidth;break;case TextAlignmentEnum.RightCenter:R.ScreenPosition.x-=R.BitmapWidth,R.ScreenPosition.y-=R.BitmapHeight/2;break;case TextAlignmentEnum.RightBottom:R.ScreenPosition.x-=R.BitmapWidth,R.ScreenPosition.y-=R.BitmapHeight;break;default:throw new ArgumentOutOfRangeException("")}return R}applyScreenTransformations(D){const R=[];for(const F of D)R.push(this.applyScreenTransformation(F));return R}drawSplitScreenLine(){}renderRectangle(D,R,F,G=void 0,j=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(D){}drawSelectionEndSymbol(D){}renderLabel(D,R,F){throw new Error("not implemented")}renderSystemToScreen(D,R,F){}drawSkyLine(D){}drawBottomLine(D){}drawInstrumentBrace(D,R){}drawGroupBracket(D,R){}isVisible(D){return!0}drawMusicSystem(D){const R=this.getSystemAbsBoundingRect(D),F=this.getSytemBoundingBoxInPixels(R);this.drawMusicSystemComponents(D,F,R)}getSytemBoundingBoxInPixels(D){const R=this.applyScreenTransformationForRect(D);return R.x=Math.round(R.x),R.y=Math.round(R.y),R}getSystemAbsBoundingRect(D){const R=D.PositionAndShape.BoundingRectangle;return new RectangleF2D(D.PositionAndShape.AbsolutePosition.x+D.PositionAndShape.BorderLeft-1,D.PositionAndShape.AbsolutePosition.y+D.PositionAndShape.BorderTop-1,R.width+6,R.height+2)}drawMusicSystemComponents(D,R,F){const G=this.graphicalMusicSheet.SelectionStartSymbol,j=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&G!==void 0&&this.isVisible(G.PositionAndShape)&&this.drawSelectionStartSymbol(G),this.drawingParameters.drawSelectionEndSymbol&&j!==void 0&&this.isVisible(j.PositionAndShape)&&this.drawSelectionEndSymbol(j);for(const Y of D.StaffLines)this.drawStaffLine(Y),this.rules.RenderLyrics&&(Y.LyricsDashes.length>0&&this.drawDashes(Y.LyricsDashes),Y.LyricLines.length>0&&this.drawLyricLines(Y.LyricLines,Y));for(const Y of D.SystemLines)this.drawSystemLineObject(Y);if(D.Parent===D.Parent.Parent.MusicPages[0])for(const Y of D.Labels)Y.SVGNode=this.drawLabel(Y,GraphicalLayers.Notes);const U=this.graphicalMusicSheet.ParentMusicSheet.Instruments,W=U.filter(Y=>Y.Visible).length;for(const Y of D.InstrumentBrackets)this.drawInstrumentBrace(Y,D);if(U.length>0)if(W>1)for(const Y of D.GroupBrackets)this.drawGroupBracket(Y,D);else for(const Y of D.GroupBrackets)Y.Visible=!1;if(!this.leadSheet)for(const Y of D.MeasureNumberLabels)Y.SVGNode=this.drawLabel(Y,GraphicalLayers.Notes);for(const Y of D.StaffLines)this.drawStaffLineSymbols(Y);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(D)}activateSystemRendering(D,R,F,G){return!0}drawSystemLineObject(D){}drawStaffLine(D){for(const R of D.Measures)this.drawMeasure(R);this.rules.RenderLyrics&&D.LyricsDashes.length>0&&this.drawDashes(D.LyricsDashes),this.drawOctaveShifts(D),this.drawPedals(D),this.drawWavyLines(D),this.drawExpressions(D),this.skyLineVisible&&this.drawSkyLine(D),this.bottomLineVisible&&this.drawBottomLine(D)}drawLyricLines(D,R){R.LyricLines.forEach(F=>{F.Start.y+=R.PositionAndShape.AbsolutePosition.y,F.End.y+=R.PositionAndShape.AbsolutePosition.y,F.Start.x+=R.PositionAndShape.AbsolutePosition.x,F.End.x+=R.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(F,this.rules.LyricUnderscoreLineWidth)})}drawExpressions(D){}drawGraphicalLine(D,R,F="black"){return this.drawLine(D.Start,D.End,F,R)}drawLine(D,R,F="#FF0000FF",G){}drawDashes(D){D.forEach(R=>R.SVGNode=this.drawLabel(R,GraphicalLayers.Notes))}drawOctaveShifts(D){}drawStaffLines(D){if(D.StaffLines){const R=D.PositionAndShape.AbsolutePosition;for(let F=0;F<5;F++)this.drawLineAsHorizontalRectangleWithOffset(D.StaffLines[F],R,GraphicalLayers.Notes)}}drawSymbol(D,R,F,G=1,j=GraphicalLayers.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(D){this.graphicalMusicSheet.LeadSheet=D}drawPage(D){if(!!this.isVisible(D.PositionAndShape)){for(const R of D.MusicSystems)this.isVisible(R.PositionAndShape)&&this.drawMusicSystem(R);if(D===D.Parent.MusicPages[0])for(const R of D.Labels)R.SVGNode=this.drawLabel(R,GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(D.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(D,R=0,F="all"){const G=D.DataObject.constructor.name;let j=!1;F==="all"&&(j=!0),(j||G===F)&&this.drawBoundingBox(D,void 0,!0,G,R),R++,D.ChildElements.forEach(U=>this.drawBoundingBoxes(U,R,F))}drawBoundingBox(D,R=void 0,F=!1,G=void 0,j=0){let U=new RectangleF2D(D.AbsolutePosition.x+D.BorderMarginLeft,D.AbsolutePosition.y+D.BorderMarginTop,D.BorderMarginRight-D.BorderMarginLeft,D.BorderMarginBottom-D.BorderMarginTop);F&&(this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(D.AbsolutePosition.x-1,D.AbsolutePosition.y),new PointF2D(D.AbsolutePosition.x+1,D.AbsolutePosition.y),.1,OutlineAndFillStyleEnum.BaseWritingColor,R),j-1),this.drawLineAsVerticalRectangle(new GraphicalLine(new PointF2D(D.AbsolutePosition.x,D.AbsolutePosition.y-1),new PointF2D(D.AbsolutePosition.x,D.AbsolutePosition.y+1),.1,OutlineAndFillStyleEnum.BaseWritingColor,R),j-1)),U=this.applyScreenTransformationForRect(U);const W=this.renderRectangle(U,GraphicalLayers.Background,j,R,.5);if(G){const Y=new Label(G),Q=new LabelRenderSpecs;Q.BitmapWidth=U.width,Q.BitmapHeight=U.height,Q.FontHeightInPixel=U.height,Q.ScreenPosition=new PointF2D(U.x,U.y+12),this.renderLabel(new GraphicalLabel(Y,.8,TextAlignmentEnum.CenterCenter,this.rules),j,Q)}return W}drawMarkedAreas(D){for(const R of D.GraphicalMarkedAreas)R&&(R.systemRectangle&&this.drawRectangle(R.systemRectangle,GraphicalLayers.Background),R.settings&&(R.settings.SVGNode=this.drawLabel(R.settings,GraphicalLayers.Comment)),R.labelRectangle&&this.drawRectangle(R.labelRectangle,GraphicalLayers.Background),R.label&&(R.label.SVGNode=this.drawLabel(R.label,GraphicalLayers.Comment)))}drawStaffLineSymbols(D){const R=D.ParentStaff.ParentInstrument,F=D.PositionAndShape.AbsolutePosition.x,G=D.PositionAndShape.AbsolutePosition.y+2,j=D.PositionAndShape.BorderRight;R.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(F,G),new PointF2D(F+j,G),4,OutlineAndFillStyleEnum.Highlighted),GraphicalLayers.Highlight);let U=MusicSymbolDrawingStyle.Disabled,W=MusicSymbol.PLAY,Y=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case PhonicScoreModes.Midi:W=MusicSymbol.PLAY,this.midiPlaybackAvailable&&D.ParentStaff.audible&&(U=MusicSymbolDrawingStyle.PlaybackSymbols);break;case PhonicScoreModes.Following:W=MusicSymbol.MIC,D.ParentStaff.following&&(U=MusicSymbolDrawingStyle.FollowSymbols);break;default:Y=!1;break}if(Y){const Q=new PointF2D(F+j+2,G);this.drawSymbol(W,U,Q)}if(this.drawingParameters.drawErrors)for(const Q of D.Measures){const Z=Q.PositionAndShape,q=Z.AbsolutePosition.x,J=Z.AbsolutePosition.y+2;Q.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(q,J),new PointF2D(q+Z.BorderRight,J),4,OutlineAndFillStyleEnum.ErrorUnderlay),GraphicalLayers.MeasureError)}}}class VexFlowTextMeasurer{constructor(D){this.fontSize=20,this.fontSizeStandard=this.fontSize;const R=document.createElement("canvas");this.context=R.getContext("2d"),this.rules=D}computeTextWidthToHeightRatio(D,R,F,G=void 0,j=this.fontSize){return this.context.font=VexFlowConverter.font(j,F,R,this.rules,G),this.context.measureText(D).width/j}setFontSize(D=this.fontSizeStandard){return this.fontSize=D,D}}class AbstractGraphicalExpression extends GraphicalObject{constructor(D,R,F){super(),this.expression=R,this.parentMeasure=F,this.boundingBox=new BoundingBox$2(this,D.PositionAndShape),this.parentStaffLine=D,this.parentStaffLine.AbstractExpressions.push(this),this.rules=D.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(D,R){super(R.PositionAndShape.Parent.DataObject,D,D.parentMeasure),this.label=R}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}class GraphicalInstantaneousDynamicExpression extends AbstractGraphicalExpression{constructor(D,R,F){super(R,D,F.parentSourceMeasure),this.mInstantaneousDynamicExpression=D,this.mMeasure=F}updateSkyBottomLine(){const D=this.parentStaffLine.SkyBottomLineCalculator,R=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,F=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let G=0;switch(this.Placement){case PlacementEnum.Above:G=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,D.updateSkyLineInRange(R,F,G);break;case PlacementEnum.Below:G=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,D.updateBottomLineInRange(R,F,G);break;default:log$2.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpression{constructor(D,R,F){super(R,D,F),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(D){this.startMeasure=D}get EndMeasure(){return this.endMeasure}set EndMeasure(D){this.endMeasure=D}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(D){this.isSplittedPart=D}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(D){this.notToBeRemoved=D}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){var G;const D=this.parentStaffLine.SkyBottomLineCalculator,R=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,F=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: "+((G=this.startMeasure)==null?void 0:G.MeasureNumber)),this.Placement){case PlacementEnum.Above:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?D.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&D.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);else{const j=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;D.updateSkyLineInRange(R,F,j)}break;case PlacementEnum.Below:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?D.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&D.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);else{const j=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;D.updateBottomLineInRange(R,F,j)}break;default:log$2.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(D,R,F,G=this.rules.WedgeOpeningLength,j=this.rules.WedgeLineWidth){const U=new PointF2D(D,F),W=new PointF2D(R,F-G/2),Y=new PointF2D(R,F+G/2);this.addWedgeLines(U,W,Y,j)}createFirstHalfCrescendoLines(D,R,F,G=this.rules.WedgeMeasureEndOpeningLength,j=this.rules.WedgeLineWidth){const U=new PointF2D(D,F),W=new PointF2D(R,F-G/2),Y=new PointF2D(R,F+G/2);this.addWedgeLines(U,W,Y,j)}createSecondHalfCrescendoLines(D,R,F,G=this.rules.WedgeMeasureBeginOpeningLength,j=this.rules.WedgeOpeningLength,U=this.rules.WedgeLineWidth){const W=new PointF2D(D,F-G/2),Y=new PointF2D(D,F+G/2),Q=new PointF2D(R,F-j/2),Z=new PointF2D(R,F+j/2);this.addDoubleLines(W,Q,Y,Z,U)}recalculateCrescendoLines(D,R,F){const G=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),G?this.createSecondHalfCrescendoLines(D,R,F):this.isSplittedPart?this.createFirstHalfCrescendoLines(D,R,F):this.createCrescendoLines(D,R,F)}createDiminuendoLines(D,R,F,G=this.rules.WedgeOpeningLength,j=this.rules.WedgeLineWidth){const U=new PointF2D(D,F-G/2),W=new PointF2D(D,F+G/2),Y=new PointF2D(R,F);this.addWedgeLines(Y,U,W,j)}createFirstHalfDiminuendoLines(D,R,F,G=this.rules.WedgeOpeningLength,j=this.rules.WedgeMeasureEndOpeningLength,U=this.rules.WedgeLineWidth){const W=new PointF2D(D,F-G/2),Y=new PointF2D(D,F+G/2),Q=new PointF2D(R,F-j/2),Z=new PointF2D(R,F+j/2);this.addDoubleLines(W,Q,Y,Z,U)}createSecondHalfDiminuendoLines(D,R,F,G=this.rules.WedgeMeasureBeginOpeningLength,j=this.rules.WedgeLineWidth){const U=new PointF2D(D,F-G/2),W=new PointF2D(D,F+G/2),Y=new PointF2D(R,F);this.addWedgeLines(Y,U,W,j)}recalculateDiminuendoLines(D,R,F){const G=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),G?this.createFirstHalfDiminuendoLines(D,R,F):this.isSplittedPart?this.createSecondHalfDiminuendoLines(D,R,F):this.createDiminuendoLines(D,R,F)}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(D){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=D,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=D,this.lines[0].End.y+=D,this.lines[1].End.y+=D)}squeeze(D){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)0?this.lines[0].Start.x+=D:(this.lines[0].End.x+=D,this.lines[1].End.x+=D):D<0?this.lines[0].Start.x+=D:(this.lines[0].End.x+=D,this.lines[1].End.x+=D),this.calcPsi())}addWedgeLines(D,R,F,G){const j=new GraphicalLine(D,R,G),U=new GraphicalLine(D,F,G);this.lines.push(j),this.lines.push(U)}addDoubleLines(D,R,F,G,j){const U=new GraphicalLine(D,R,j),W=new GraphicalLine(F,G,j);this.lines.push(U),this.lines.push(W)}}class GraphicalUnknownExpression extends AbstractGraphicalExpression{constructor(D,R,F,G,j=void 0){super(D,new AbstractExpression(F),G),this.label=R,this.sourceMultiExpression=j}updateSkyBottomLine(){const D=this.parentStaffLine.SkyBottomLineCalculator,R=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,F=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case PlacementEnum.Above:const G=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;D.updateSkyLineInRange(R,F,G);break;case PlacementEnum.Below:const j=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;D.updateBottomLineInRange(R,F,j);break;default:log$2.error("Placement for GraphicalUnknownExpression is unknown")}}}Vex.Flow;const unitInPixels=10;class VexFlowMusicSheetDrawer extends MusicSheetDrawer{constructor(D=new DrawingParameters){super(new VexFlowTextMeasurer(D.Rules),D),this.backends=[],this.zoom=1,this.pageIdx=0,this.getDotId=(R,F)=>F?String(R.Label.PositionAndShape.RelativePosition[F]):String(R.Label.PositionAndShape.RelativePosition.x)+String(R.Label.PositionAndShape.RelativePosition.y),this.hasDot=(R,F,G,j)=>{const U=F||Object.values(j);for(const W of U){if(G)return R.x===W.x&&R.y===W.y;if(R.x===W.x)return!0}return!1}}get Zoom(){return this.zoom}get Backends(){return this.backends}initializeBackendForPage(D){this.backend=this.backends[D.PageNumber-1]}drawSheet(D){var R,F,G;this.rules.DefaultVexFlowNoteFont==="gonville"&&(Vex.Flow.DEFAULT_FONT_STACK=[(R=Vex.Flow.Fonts)==null?void 0:R.Gonville,(F=Vex.Flow.Fonts)==null?void 0:F.Bravura,(G=Vex.Flow.Fonts)==null?void 0:G.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 j of D.MusicPages){if(j.PageNumber>this.rules.MaxPageToDrawNumber)break;const U=this.backends[this.pageIdx];U.graphicalMusicPage=j,U.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(D)}drawPage(D){!D||(this.backend=this.backends[D.PageNumber-1],super.drawPage(D),this.pageIdx+=1)}clear(){for(const D of this.backends)D.clear()}setZoom(D){this.zoom=D}calculatePixelDistance(D){return D*unitInPixels}drawStaffLine(D){const R=this.backend.getContext().openGroup();R&&R.classList.add("staffline"),super.drawStaffLine(D);const F=D.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(D,F),this.backend.getContext().closeGroup()}drawSlurs(D,R){for(const F of D.GraphicalSlurs)F.slur.isCrossed()||this.drawSlur(F,R)}drawSlur(D,R){const F=[];let G,j,U,W;this.rules.DYMusicScoreType==="jianpu"?((D.placement>0||D.bezierStartPt.y>0)&&(D.bezierStartPt.y=-.8,D.bezierStartControlPt.y=-2.5),G=new PointF2D(D.bezierStartPt.x+R.x,D.bezierStartPt.y+R.y),j=new PointF2D(D.bezierStartControlPt.x+R.x,D.bezierStartControlPt.y+R.y),U=new PointF2D(D.bezierEndControlPt.x+R.x,D.bezierStartControlPt.y+R.y),W=new PointF2D(D.bezierEndPt.x+R.x,D.bezierStartPt.y+R.y)):(G=new PointF2D(D.bezierStartPt.x+R.x,D.bezierStartPt.y+R.y),j=new PointF2D(D.bezierStartControlPt.x+R.x,D.bezierStartControlPt.y+R.y),U=new PointF2D(D.bezierEndControlPt.x+R.x,D.bezierEndControlPt.y+R.y),W=new PointF2D(D.bezierEndPt.x+R.x,D.bezierEndPt.y+R.y)),F.push(this.applyScreenTransformation(G)),F.push(this.applyScreenTransformation(j)),F.push(this.applyScreenTransformation(U)),F.push(this.applyScreenTransformation(W)),D.placement===PlacementEnum.Above?(G.y-=.05,j.y-=.3,U.y-=.3,W.y-=.05):(G.y+=.05,j.y+=.3,U.y+=.3,W.y+=.05),F.push(this.applyScreenTransformation(G)),F.push(this.applyScreenTransformation(j)),F.push(this.applyScreenTransformation(U)),F.push(this.applyScreenTransformation(W)),D.SVGElement=this.backend.renderCurve(F)}drawMeasure(D){D.setAbsoluteCoordinates(D.PositionAndShape.AbsolutePosition.x*unitInPixels,D.PositionAndShape.AbsolutePosition.y*unitInPixels);const R=this.backend.getContext();try{D.draw(R)}catch(F){log$2.warn("VexFlowMusicSheetDrawer.drawMeasure",F)}for(const F of D.staffEntries)this.drawStaffEntry(F)}drawLine(D,R,F="#FF0000FF",G=.2){return D=this.applyScreenTransformation(D),R=this.applyScreenTransformation(R),this.backend.renderLine(D,R,F,G*unitInPixels)}DrawOverlayLine(D,R,F,G="#FF0000FF",j=.2){if(!F.PageNumber||F.PageNumber>this.backends.length||F.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}const U=F.PageNumber-1,W=this.backends[U];return D=this.applyScreenTransformation(D),R=this.applyScreenTransformation(R),W.renderLine(D,R,G,j*unitInPixels)}drawSkyLine(D){const R=D.PositionAndShape.AbsolutePosition,F=D.PositionAndShape.Size.width;this.drawSampledLine(D.SkyLine,R,F)}drawBottomLine(D){const R=new PointF2D(D.PositionAndShape.AbsolutePosition.x,D.PositionAndShape.AbsolutePosition.y),F=D.PositionAndShape.Size.width;this.drawSampledLine(D.BottomLine,R,F,"#0000FFFF")}drawSampledLine(D,R,F,G="#FF0000FF"){const j=[];let U=0;for(let Y=0;Y0){const Y=this.rules.SamplingUnit;let Q=new PointF2D(W.x,W.y),Z=new PointF2D(j[0]/Y+W.x,W.y);this.drawLine(Q,Z,G);let q,J;D[0]>=0&&(q=new PointF2D(j[0]/Y+W.x,W.y),J=new PointF2D(j[0]/Y+W.x,W.y+D[j[0]]),this.drawLine(q,J,G));for(let K=1;K0)for(const R of D.FingeringEntries)R.SVGNode=this.drawLabel(R,GraphicalLayers.Notes);if(D.graphicalChordContainers!==void 0&&D.graphicalChordContainers.length>0)for(const R of D.graphicalChordContainers){const F=R.GraphicalLabel;F.SVGNode=this.drawLabel(F,GraphicalLayers.Notes)}this.rules.RenderLyrics&&D.LyricsEntries.length>0&&this.drawLyrics(D.LyricsEntries,GraphicalLayers.Notes)}drawLyrics(D,R){D.forEach(F=>{const G=F.GraphicalLabel;G.SVGNode=this.drawLabel(G,R)})}drawInstrumentBrace(D,R){D.draw(this.backend.getContext())}drawGroupBracket(D,R){D.draw(this.backend.getContext())}drawOctaveShifts(D){for(const R of D.OctaveShifts)if(R){const F=R,G=this.backend.getContext(),j=F.getTextBracket();j.setContext(G);try{j.draw()}catch(U){log$2.warn(U)}}}drawPedals(D){for(const R of D.Pedals)if(R){const F=R,G=this.backend.getContext(),j=F.getPedalMarking();j.setContext(G),j.draw()}}drawWavyLines(D){for(const R of D.WavyLines)if(R){const F=R,G=this.backend.getContext(),j=F.getVibratoBracket();j.setContext(G),j.draw()}}getMaxExpressionsYAndDots(D){var Y,Q;const R=[];let F=0;for(const Z of D.measures)R.push(Z.measureNumber);const G={},j={},U={};for(const Z of D.AbstractExpressions)if(Z instanceof GraphicalUnknownExpression&&R.includes(Z.parentMeasure.MeasureNumber)){const q=this.getDotId(Z),J=this.getDotId(Z,"x");j[q]||(j[q]=[]),U[J]||(U[J]=[]),this.hasDot(Z.Label.PositionAndShape.RelativePosition,j[q],!0)||(j[q].push(Z.Label.PositionAndShape.RelativePosition),U[J].push(Z.Label.PositionAndShape.RelativePosition)),G[q]=Z.Label.PositionAndShape.RelativePosition}let W=0;for(const Z of D.AbstractExpressions){const q=(Y=Z.parentMeasure)==null?void 0:Y.MeasureNumber;if(Z instanceof GraphicalUnknownExpression&&R.includes(q)){const J=(Q=Z.parentMeasure.verticalMeasureList[0])==null?void 0:Q.stave,K=(J==null?void 0:J.end_x)-(J==null?void 0:J.x),te=this.getDotId(Z,"x");if((U[te]||[]).length===1&&W!==q){const ne=Z.Label.PositionAndShape.AbsolutePosition.y;F=F===0?ne:Math.min(F,ne)}(U[te]||[]).length!==1&&K/101){let F=Math.min(...D.Lines.map(G=>G.Start.x));D.Lines[0].Start.x=F,D.Lines[1].Start.x=F,[D.Lines[0].Start.y,D.Lines[1].Start.y]=[D.Lines[1].Start.y,D.Lines[0].Start.y],D.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,D.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch{}const R=this.backend.getContext();R.openGroup("lineGroup");for(const F of D.Lines){const G=new PointF2D(D.ParentStaffLine.PositionAndShape.AbsolutePosition.x+F.Start.x,D.ParentStaffLine.PositionAndShape.AbsolutePosition.y+F.Start.y),j=new PointF2D(D.ParentStaffLine.PositionAndShape.AbsolutePosition.x+F.End.x,D.ParentStaffLine.PositionAndShape.AbsolutePosition.y+F.End.y);this.drawLine(G,j,"black",F.Width)}R.closeGroup()}}renderLabel(D,R,F){return this._renderLabel(D,F)}_renderLabel(D,R){var Q;if(!D.Label.print)return;const F=D.Label.fontHeight*unitInPixels,{font:G}=D.Label;let j;this.rules.ColoringEnabled&&(j=D.Label.colorDefault,D.Label.color&&(j=D.Label.color.toString()),j||(j=this.rules.DefaultColorLabel));let{fontStyle:U,fontFamily:W}=D.Label;U||(U=this.rules.DefaultFontStyle),W||(W=this.rules.DefaultFontFamily);let Y;for(let Z=0;Z<((Q=D.TextLines)==null?void 0:Q.length);Z++){const q=D.TextLines[Z],J=this.calculatePixelDistance(q.xOffset),K=new PointF2D(R.ScreenPosition.x+J,R.ScreenPosition.y),te=this.backend.renderText(F,U,G,q.text,R.FontHeightInPixel,K,j,D.Label.fontFamily);Y?Y.appendChild(te):Y=te,R.ScreenPosition.y=R.ScreenPosition.y+R.FontHeightInPixel,D.TextLines.length>1&&(R.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return Y}renderRectangle(D,R,F,G,j){return this.backend.renderRectangle(D,F,G,j)}applyScreenTransformation(D){return new PointF2D(D.x*unitInPixels,D.y*unitInPixels)}applyScreenTransformationForRect(D){return new RectangleF2D(D.x*unitInPixels,D.y*unitInPixels,D.width*unitInPixels,D.height*unitInPixels)}}const VF$c=Vex.Flow,_VexFlowConverter=class{static durations(B,D){const R=[],F=B.clone();for(;F.RealValue>0;){const G=F.RealValue;if(G>=2)R.push("1/2"),F.Sub(new Fraction$1(2,1));else if(G>=1)R.push("w"),F.Sub(new Fraction$1(1,1));else if(G<1&&G>=.5){if(D&&G>.5)return["w"];R.push("h"),F.Sub(new Fraction$1(1,2))}else if(G<.5&&G>=.25){if(D&&G>.25)return["h"];R.push("q"),F.Sub(new Fraction$1(1,4))}else if(G<.25&&G>=.125){if(D&&G>.125)return["q"];R.push("8"),F.Sub(new Fraction$1(1,8))}else if(G<.125&&G>=.0625){if(D&&G>.0625)return["8"];R.push("16"),F.Sub(new Fraction$1(1,16))}else if(G<.0625&&G>=.03125){if(D&&G>.03125)return["16"];R.push("32"),F.Sub(new Fraction$1(1,32))}else if(G<.03125&&G>=.015625){if(D&&G>.015625)return["32"];R.push("64"),F.Sub(new Fraction$1(1,64))}else{if(D)return["64"];R.push("128"),F.Sub(new Fraction$1(1,128))}}return R}static pitch(B,D,R,F=void 0,G=void 0){let j=G;G===void 0&&(j=3),D&&G===void 0&&(j=0,R.ClefType===ClefEnum.F&&(j=2),R.ClefType===ClefEnum.C&&(j=2));const U=NoteEnum[B.FundamentalNote].toLowerCase(),W=Pitch.accidentalVexflow(B.Accidental),Y=B.Octave-R.OctaveOffset+j;let Q="";return F&&(Q=this.NoteHeadCode(F)),[U+"n/"+Y+Q,W,R]}static restToNotePitch(B,D){let R=B.Octave;switch(D){case ClefEnum.C:case ClefEnum.F:{R+=2;break}case ClefEnum.G:}return new Pitch(B.FundamentalNote,R,AccidentalEnum.NONE)}static NoteHeadCode(B){const D="/",R=B.Filled?"2":"1";switch(B.Shape){case NoteHeadShape.NORMAL:return"";case NoteHeadShape.DIAMOND:return D+"D"+R;case NoteHeadShape.TRIANGLE:return D+"T"+R;case NoteHeadShape.X:return D+"X"+R;case NoteHeadShape.CIRCLEX:return D+"X3";case NoteHeadShape.RECTANGLE:return D+"R"+R;case NoteHeadShape.SQUARE:return D+"S"+R;case NoteHeadShape.SLASH:return"";default:return""}}static GhostNotes(B){const D=[],R=_VexFlowConverter.durations(B,!1);for(const F of R)D.push(new VF$c.GhostNote({duration:F}));return D}static StaveNote(B){var he,ge,ue,me,be,ve,pe,ye,xe,ce,we,Be,Ae,Te,Ne,Pe;B.sortForVexflow();const D=B.notes,R=B.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,F=D[0];let G=[],j;const U=[],W=F.graphicalNoteLength,Y=F.sourceNote.NoteTuplet!==void 0;let Q=_VexFlowConverter.durations(W,Y)[0];F.sourceNote.TypeLength!==void 0&&F.sourceNote.TypeLength!==W&&F.sourceNote.TypeLength.RealValue!==0&&(Q=_VexFlowConverter.durations(F.sourceNote.TypeLength,Y)[0],F.numberOfDots=F.sourceNote.DotsXml);let Z,q=F.numberOfDots,J=!1,K=0,te=!1,ne=!1,ie;for(const Me of D){if(q=1&&Ge.length-1>=Ye+1&&(We=(be=(me=Ge[Ye-1])==null?void 0:me.graphicalVoiceEntries[0])==null?void 0:be.parentVoiceEntry,Ve=(pe=(ve=Ge[Ye+1])==null?void 0:ve.graphicalVoiceEntries[0])==null?void 0:pe.parentVoiceEntry,We&&Ve)){const et=We.Notes[0],ot=Ve.Notes[0];if(((ye=et.NoteBeam)==null?void 0:ye.Notes.includes(ot))&&ot.ParentStaffEntry.ParentStaff.StafflineCount!==1){const ft=We.Notes.last().Pitch,lt=Me.Clef(),_e=_VexFlowConverter.pitch(_VexFlowConverter.restToNotePitch(ft.getTransposedPitch(-2),lt.ClefType),!1,lt);ft.FundamentalNote===4&&(G=[_e[0]])}}}}if(W.RealValue===Me.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(G=R.DYMusicScoreType==="staff"?["d/5"]:["R/5"],Q="w",q=0,J=!0,K=R.WholeRestXShiftVexflow*unitInPixels),[...Me.sourceNote.ParentStaff.Voices].filter(ke=>(ke==null?void 0:ke.VoiceId)!=1).length){const ke=Me.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,Ge=Me.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let We,Ve;for(const Ye of ke)for(const et of Ye.notes){if(et===Me||et.sourceNote.isRest()||!et.sourceNote.PrintObject){Me.lineShift=-2;continue}const ot=et.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,ft=Ge===1||Ge===5,lt=ft?1:-1,Xe=et.sourceNote.Pitch.getHalfTone(),Qe=lt===1&&Xe>We,Fe=lt===-1&&Xe0){let Ye=3;const et=Me.Clef();switch(et.ClefType){case ClefEnum.F:Ye=5;break;case ClefEnum.C:Ye=4;break}ie=Pitch.fromHalftone(We),G=[_VexFlowConverter.pitch(ie,!0,et,void 0,Ye)[0]]}}break}Me.sourceNote.Notehead&&Me.sourceNote.Notehead.Shape===NoteHeadShape.SLASH&&(te=!0);const Se=Me.vfpitch;if((ce=(xe=Se[2])==null?void 0:xe.Parent)!=null&&ce.Instructions)for(let Le=0,ze=Se[2].Parent.Instructions.length;LeB.notes[Se].staffLine=Me),(R.LedgerLineWidth||R.LedgerLineStrokeStyle)&&(re.ledgerLineStyle||(re.ledgerLineStyle={}),R.LedgerLineWidth&&(re.ledgerLineStyle.lineWidth=R.LedgerLineWidth),R.LedgerLineStrokeStyle&&(re.ledgerLineStyle.strokeStyle=R.LedgerLineStrokeStyle)),R.ColoringEnabled){const Me=R.DefaultColorStem;let Se=B.parentVoiceEntry.StemColor;!Se&&Me&&(Se=Me);const Le={fillStyle:Se,strokeStyle:Se};Se&&(re.setStemStyle(Le),re.flag&&R.ColorFlags&&re.setFlagStyle(Le))}if(re.x_shift=K,B.parentVoiceEntry.IsGrace&&B.notes[0].sourceNote.NoteBeam&&(B.parentVoiceEntry.WantedStemDirection=B.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),B.parentVoiceEntry)switch(B.parentVoiceEntry.WantedStemDirection){case StemDirectionType.Up:re.setStemDirection(VF$c.Stem.UP),B.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case StemDirectionType.Down:re.setStemDirection(VF$c.Stem.DOWN),B.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}for(let Me=0,Se=D.length;Me0&&ze==="single"){const ke=new VF$c.Tremolo(Le);ke.extra_stroke_scale=R.TremoloStrokeScale,ke.y_spacing_scale=R.TremoloYSpacingScale,re&&re.duration==="w"&&re.stem.setExtension(-9),re.addModifier(Me,ke)}if(Le>0&&ze==="start"&&this.noteTremoloList.push(re),Le>0&&ze==="stop"){this.noteTremoloList.push(re);const ke=new VF$c.Tremolo(Le,[...this.noteTremoloList]);ke.extra_stroke_scale=1.2,ke.y_spacing_scale=1.2,ke.x_shift=-30,re.addModifier(Me,ke),this.noteTremoloList=[]}this.glissandoList.length&&(re.setVibrato(this.glissandoList[0].vfnote[0]),((Ae=(Be=(we=this.glissandoList[0])==null?void 0:we.sourceNote)==null?void 0:Be.SourceMeasure)==null?void 0:Ae.MeasureNumberXML)!=((Pe=(Ne=(Te=D[Me])==null?void 0:Te.sourceNote)==null?void 0:Ne.SourceMeasure)==null?void 0:Pe.MeasureNumberXML),this.glissandoList=[]),D[Me].sourceNote.glissandoType==="start"&&this.glissandoList.push(D[Me])}if(le.Length.RealValue===.25&&le.Notehead&&le.Notehead.Filled===!1){const Me=re.getKeyProps();for(let Se=0;Se1&&re.getKeyProps().filter(Se=>!Se.code&&Se.line>3).length===G.length&&re.setStemDirection(-1),R.DYMusicScoreType==="jianpu"&&window&&window.sett&&window.sett.keySignature&&re.addAccidental(0,new VF$c.Accidental("#"));try{const Me=["b","#","\xA7","\xBA","X"],Se={b:"b","#":"#","\xA7":"n",\u00BA:"bb",X:"##"};for(const Le of D){const ze=Le.sourceNote.voiceEntry.Timestamp;for(const ke of Le.sourceNote.SourceMeasure.StaffLinkedExpressions)for(const Ge of ke){const We=Fraction$1.Equal(ze,Ge.Timestamp),Ye=Ge.EntriesList.map(et=>et.label).filter(et=>Me.includes(et)).map(et=>Se[et]);if(We){for(const et of Ye)et&&re.addAnnotation(0,new VF$c.Annotation(et));break}}}}catch{}return re}static generateArticulations(B,D,R){var F,G;if(!(!B||B.getAttribute("type")==="GhostNote"))for(const j of D){let U=VF$c.Modifier.Position.ABOVE;B.getStemDirection()===VF$c.Stem.UP&&(U=VF$c.Modifier.Position.BELOW);let W;const Y=j.articulationEnum;switch(R.ArticulationPlacementFromXML&&(j.placement===PlacementEnum.Above?U=VF$c.Modifier.Position.ABOVE:j.placement===PlacementEnum.Below&&(U=VF$c.Modifier.Position.BELOW)),Y){case ArticulationEnum.accent:{W=new VF$c.Articulation("a>");break}case ArticulationEnum.downbow:{W=new VF$c.Articulation("am"),j.placement===void 0&&(U=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.fermata:{W=new VF$c.Articulation("a@a"),U=VF$c.Modifier.Position.ABOVE;break}case ArticulationEnum.marcatodown:{W=new VF$c.Articulation("a|");break}case ArticulationEnum.marcatoup:{W=new VF$c.Articulation("a^");break}case ArticulationEnum.invertedfermata:{W=new VF$c.Articulation("a@u"),U=VF$c.Modifier.Position.BELOW;break}case ArticulationEnum.lefthandpizzicato:{W=new VF$c.Articulation("a+");break}case ArticulationEnum.naturalharmonic:{W=new VF$c.Articulation("ah");break}case ArticulationEnum.snappizzicato:{W=new VF$c.Articulation("ao");break}case ArticulationEnum.staccatissimo:{W=new VF$c.Articulation("av");break}case ArticulationEnum.staccato:{W=new VF$c.Articulation("a.");break}case ArticulationEnum.tenuto:{W=new VF$c.Articulation("a-");break}case ArticulationEnum.upbow:{W=new VF$c.Articulation("a|"),j.placement===void 0&&(U=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.strongaccent:{W=new VF$c.Articulation("a^");break}}W&&(!B.hasStem()&&!B.isRest()&&Y==ArticulationEnum.accent&&B.getLineNumber()>=3&&(U=VF$c.Modifier.Position.ABOVE,(G=(F=B==null?void 0:B.modifiers)==null?void 0:F.filter(Q=>["TREMOLO"].includes(Q.getCategory().toLocaleUpperCase())))!=null&&G.length&&W.setYShift(-16)),Y===ArticulationEnum.strongaccent&&(U=VF$c.Modifier.Position.ABOVE),W.setPosition(U),B.addModifier(0,W))}}static generateOrnaments(B,D){let R=VF$c.Modifier.Position.ABOVE;D.placement===PlacementEnum.Below&&(R=VF$c.Modifier.Position.BELOW);let F;switch(D.GetOrnament){case OrnamentEnum.DelayedInvertedTurn:{F=new VF$c.Ornament("turn_inverted"),F.setDelayed(!0);break}case OrnamentEnum.DelayedTurn:{F=new VF$c.Ornament("turn"),F.setDelayed(!0);break}case OrnamentEnum.InvertedMordent:{F=new VF$c.Ornament("mordent"),F.setDelayed(!1);break}case OrnamentEnum.InvertedTurn:{F=new VF$c.Ornament("turn_inverted"),F.setDelayed(!1);break}case OrnamentEnum.Mordent:{F=new VF$c.Ornament("mordent_inverted"),F.setDelayed(!1);break}case OrnamentEnum.Trill:{F=new VF$c.Ornament("tr"),F.setDelayed(!1);break}case OrnamentEnum.Turn:{F=new VF$c.Ornament("turn"),F.setDelayed(!1);break}default:{log$2.warn("unhandled OrnamentEnum type: "+D.GetOrnament);return}}F&&(D.AccidentalBelow!==AccidentalEnum.NONE&&F.setLowerAccidental(Pitch.accidentalVexflow(D.AccidentalBelow)),D.AccidentalAbove!==AccidentalEnum.NONE&&F.setUpperAccidental(Pitch.accidentalVexflow(D.AccidentalAbove)),F.setPosition(R),B.addModifier(0,F))}static StrokeTypeFromArpeggioType(B){switch(B){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(B){const D=[],R=B.notes.reverse(),F=[],G=B.notes[0].graphicalNoteLength,j=B.notes[0].sourceNote.NoteTuplet!==void 0;let U=_VexFlowConverter.durations(G,j)[0],W=0;for(const Q of B.notes){const Z=Q.sourceNote,q={str:Z.StringNumberTab,fret:Z.FretNumber};D.push(q),Z.BendArray&&Z.BendArray.forEach(function(J){let K;const te=J.bendalter-q.fret;te>1?K="Full":te===1?K="1/2":K="1/4",J.direction==="up"?F.push({type:VF$c.Bend.UP,text:K,width:10}):F.push({type:VF$c.Bend.DOWN,text:K,width:10})}),W(B[B.VA8=0]="VA8",B[B.VB8=1]="VB8",B[B.MA15=2]="MA15",B[B.MB15=3]="MB15",B[B.NONE=4]="NONE",B))(OctaveEnum||{});class AbstractTempoExpression extends AbstractExpression{constructor(D,R,F,G){super(R),this.label=D,this.staffNumber=F,this.parentMultiTempoExpression=G}get Label(){return this.label}set Label(D){this.label=D}get Placement(){return this.placement}set Placement(D){this.placement=D}get StaffNumber(){return this.staffNumber}set StaffNumber(D){this.staffNumber=D}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}static isStringInStringList(D,R){for(const F of D)if(AbstractTempoExpression.stringContainsSeparatedWord(R.toLowerCase().trim(),F.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(D,R){return D===R||D.indexOf(" "+R)!==-1||D.indexOf(R+" ")!==-1}}const _InstantaneousTempoExpression=class extends AbstractTempoExpression{constructor(B,D,R,F,G,j=!1){super(B,D,R,G),this.setTempoAndTempoType(F)}static getDefaultValueForTempoType(B){switch(B){case TempoEnum.larghissimo:return 20;case TempoEnum.grave:return 30;case TempoEnum.lento:return 48;case TempoEnum.largo:return 52;case TempoEnum.larghetto:return 63;case TempoEnum.adagio:return 70;case TempoEnum.adagietto:return 75;case TempoEnum.andanteModerato:return 88;case TempoEnum.andante:return 92;case TempoEnum.andantino:return 96;case TempoEnum.moderato:return 106;case TempoEnum.allegretto:return 112;case TempoEnum.allegroModerato:return 118;case TempoEnum.allegro:return 130;case TempoEnum.vivace:return 140;case TempoEnum.vivacissimo:return 155;case TempoEnum.allegrissimo:return 170;case TempoEnum.presto:return 184;case TempoEnum.prestissimo:return 200;default:throw new ArgumentOutOfRangeException("tempoEnum")}}static isInputStringInstantaneousTempo(B){return B?_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,B):!1}get Label(){return this.label}set Label(B){this.label=B}get Placement(){return this.placement}set Placement(B){this.placement=B}get StaffNumber(){return this.staffNumber}set StaffNumber(B){this.staffNumber=B}get Enum(){return this.tempoEnum}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(B){this.tempoInBpm=B}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(B){if(!this.label){this.tempoInBpm=B,this.tempoEnum=TempoEnum.metronomeMark;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.larghissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.larghissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.grave)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.grave;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.lento)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.lento;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.largo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.largo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.larghetto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.larghetto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.adagio)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.adagio;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.adagietto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.adagietto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.andanteModerato)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.andanteModerato;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.andante)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.andante;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.andantino)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.andantino;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.moderato)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.moderato;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegretto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegretto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegroModerato)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegroModerato;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegro)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegro;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.vivace)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.vivace;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.vivacissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.vivacissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegrissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegrissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.presto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.presto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.prestissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.prestissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAddons,this.label)){this.tempoInBpm=0,this.tempoEnum=TempoEnum.addon;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,this.label)){this.tempoInBpm=0,this.tempoEnum=TempoEnum.changes;return}}};let InstantaneousTempoExpression=_InstantaneousTempoExpression;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\xE4\xDFig","Mod\uFFFDr\uFFFD","moderately"];InstantaneousTempoExpression.listInstantaneousTempoAllegretto=["Allegretto","fast"];InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato=["Allegro moderato"];InstantaneousTempoExpression.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fr\uFFFDhlich"];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","\xE4u\xDFerst 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\xF6s","gesanglich","mit Schwung","mit Feuer","mit Schmerz","mit Ausdruck","mit Bewegung","geistvoll","ausdrucksvoll","freudig","verspielt","angemessen","grazi\xF6s","mit Grazie","flink","beh\xE4nde","traurig","klagend","majest\xE4tisch","aber nicht zu sehr","markant","gem\xE4\xDFigt","viel","sehr","ersterbend","bewegt","nicht zu sehr","mehr","ein wenig","gleichsam","entschlossen","zupackend","heiter","nachdr\xFCcklich","getragen","gewichtig","zart","z\xE4rtlich","im angemessenen Zeitma\xDF","ruhig","ein wenig","alla marcia","ad libitum","alla breve"];var TempoEnum=(B=>(B[B.none=0]="none",B[B.larghissimo=1]="larghissimo",B[B.grave=2]="grave",B[B.lento=3]="lento",B[B.largo=4]="largo",B[B.larghetto=5]="larghetto",B[B.adagio=6]="adagio",B[B.adagietto=7]="adagietto",B[B.andanteModerato=8]="andanteModerato",B[B.andante=9]="andante",B[B.andantino=10]="andantino",B[B.moderato=11]="moderato",B[B.allegretto=12]="allegretto",B[B.allegroModerato=13]="allegroModerato",B[B.allegro=14]="allegro",B[B.vivace=15]="vivace",B[B.vivacissimo=16]="vivacissimo",B[B.allegrissimo=17]="allegrissimo",B[B.presto=18]="presto",B[B.prestissimo=19]="prestissimo",B[B.lastRealTempo=20]="lastRealTempo",B[B.addon=21]="addon",B[B.changes=22]="changes",B[B.metronomeMark=23]="metronomeMark",B))(TempoEnum||{});const _MoodExpression=class extends AbstractExpression{constructor(B,D,R){super(D),this.label=B,this.staffNumber=R,this.setMoodType()}static isInputStringMood(B){return B?_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,B):!1}get Label(){return this.label}set Label(B){this.label=B}get Mood(){return this.moodType}set Mood(B){this.moodType=B}get StaffNumber(){return this.staffNumber}set StaffNumber(B){this.staffNumber=B}get Placement(){return this.placement}set Placement(B){this.placement=B}setMoodType(){_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,this.label)?this.moodType=MoodEnum.Affettuoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,this.label)?this.moodType=MoodEnum.Agitato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,this.label)?this.moodType=MoodEnum.Animato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,this.label)?this.moodType=MoodEnum.Appassionato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,this.label)?this.moodType=MoodEnum.Brillante:_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,this.label)?this.moodType=MoodEnum.Cantabile:_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,this.label)?this.moodType=MoodEnum.Dolce:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,this.label)?this.moodType=MoodEnum.Energico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,this.label)?this.moodType=MoodEnum.Eroico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,this.label)?this.moodType=MoodEnum.Espressivo:_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,this.label)?this.moodType=MoodEnum.Furioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,this.label)?this.moodType=MoodEnum.Giocoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,this.label)?this.moodType=MoodEnum.Gioioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,this.label)?this.moodType=MoodEnum.Grandioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,this.label)?this.moodType=MoodEnum.Grazioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,this.label)?this.moodType=MoodEnum.Lacrimoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,this.label)?this.moodType=MoodEnum.Leggiero:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,this.label)?this.moodType=MoodEnum.Maestoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,this.label)?this.moodType=MoodEnum.Malinconico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,this.label)?this.moodType=MoodEnum.Marcato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,this.label)?this.moodType=MoodEnum.Marziale:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,this.label)?this.moodType=MoodEnum.Mesto:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,this.label)?this.moodType=MoodEnum.Morendo:_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,this.label)?this.moodType=MoodEnum.Nobilmente:_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,this.label)?this.moodType=MoodEnum.Patetico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,this.label)?this.moodType=MoodEnum.Pesante:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,this.label)?this.moodType=MoodEnum.Saltando:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,this.label)?this.moodType=MoodEnum.Sautille:_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,this.label)?this.moodType=MoodEnum.Scherzando:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,this.label)?this.moodType=MoodEnum.Sostenuto:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,this.label)?this.moodType=MoodEnum.Spiccato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,this.label)?this.moodType=MoodEnum.Tenerezza:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,this.label)?this.moodType=MoodEnum.Tranquillamente:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,this.label)&&(this.moodType=MoodEnum.Trionfante)}};let MoodExpression=_MoodExpression;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"];var MoodEnum=(B=>(B[B.Affettuoso=0]="Affettuoso",B[B.Agitato=1]="Agitato",B[B.Appassionato=2]="Appassionato",B[B.Animato=3]="Animato",B[B.Brillante=4]="Brillante",B[B.Cantabile=5]="Cantabile",B[B.Dolce=6]="Dolce",B[B.Energico=7]="Energico",B[B.Eroico=8]="Eroico",B[B.Espressivo=9]="Espressivo",B[B.Furioso=10]="Furioso",B[B.Giocoso=11]="Giocoso",B[B.Gioioso=12]="Gioioso",B[B.Lacrimoso=13]="Lacrimoso",B[B.Grandioso=14]="Grandioso",B[B.Grazioso=15]="Grazioso",B[B.Leggiero=16]="Leggiero",B[B.Maestoso=17]="Maestoso",B[B.Malinconico=18]="Malinconico",B[B.Marcato=19]="Marcato",B[B.Marziale=20]="Marziale",B[B.Mesto=21]="Mesto",B[B.Morendo=22]="Morendo",B[B.Nobilmente=23]="Nobilmente",B[B.Patetico=24]="Patetico",B[B.Pesante=25]="Pesante",B[B.Sautille=26]="Sautille",B[B.Saltando=27]="Saltando",B[B.Scherzando=28]="Scherzando",B[B.Sostenuto=29]="Sostenuto",B[B.Spiccato=30]="Spiccato",B[B.Tenerezza=31]="Tenerezza",B[B.Tranquillamente=32]="Tranquillamente",B[B.Trionfante=33]="Trionfante",B[B.Vivace=34]="Vivace",B))(MoodEnum||{});class UnknownExpression extends AbstractExpression{constructor(D,R,F,G){super(R),this.label=D,this.staffNumber=G,F===void 0&&(F=TextAlignmentEnum.LeftBottom),this.textAlignment=F}get Label(){return this.label}get Placement(){return this.placement}set Placement(D){this.placement=D}get StaffNumber(){return this.staffNumber}set StaffNumber(D){this.staffNumber=D}get TextAlignment(){return this.textAlignment}}class MultiExpression{constructor(D,R){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=D,this.timestamp=R}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(D){this.sourceMeasure=D}get StaffNumber(){return this.staffNumber}set StaffNumber(D){this.staffNumber=D}get Timestamp(){return this.timestamp}set Timestamp(D){this.timestamp=D}get AbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}get InstantaneousDynamic(){return this.instantaneousDynamic}set InstantaneousDynamic(D){this.instantaneousDynamic=D}get EndingContinuousDynamic(){return this.endingContinuousDynamic}set EndingContinuousDynamic(D){this.endingContinuousDynamic=D}get StartingContinuousDynamic(){return this.startingContinuousDynamic}set StartingContinuousDynamic(D){this.startingContinuousDynamic=D}get MoodList(){return this.moodList}get UnknownList(){return this.unknownList}get EntriesList(){return this.expressions}get OctaveShiftStart(){return this.octaveShiftStart}set OctaveShiftStart(D){this.octaveShiftStart=D}get OctaveShiftEnd(){return this.octaveShiftEnd}set OctaveShiftEnd(D){this.octaveShiftEnd=D}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(D){this.combinedExpressionsText=D}getPlacementOfFirstEntry(){let D=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof InstantaneousDynamicExpression?D=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof ContinuousDynamicExpression?D=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof MoodExpression?D=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof UnknownExpression&&(D=this.expressions[0].expression.Placement)),D}getFontstyleOfFirstEntry(){var R;let D=FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof ContinuousDynamicExpression||this.expressions[0].expression instanceof MoodExpression?D=FontStyles.Italic:this.expressions[0].expression instanceof UnknownExpression&&(D=(R=this.expressions[0].expression.fontStyle)!=null?R:FontStyles.Regular)),D}addExpression(D,R){D instanceof InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=D,this.instantaneousDynamic.ParentMultiExpression=this):D instanceof ContinuousDynamicExpression?this.startingContinuousDynamic=D:D instanceof MoodExpression?this.moodList.push(D):D instanceof UnknownExpression&&this.unknownList.push(D),this.addExpressionToEntryList(D,R)}CompareTo(D){return this.Timestamp.RealValue>D.Timestamp.RealValue?1:this.Timestamp.RealValue=ContinuousTempoType.allargando&&B<=ContinuousTempoType.ritenuto}get TempoType(){return this.tempoType}set TempoType(B){this.tempoType=B}get StartTempo(){return this.startTempo}set StartTempo(B){this.startTempo=B}get EndTempo(){return this.endTempo}set EndTempo(B){this.endTempo=B}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(B){this.absoluteEndTimestamp=B}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(B){const D=Fraction$1.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(B.lt(D))return-1;if(this.absoluteEndTimestamp.lt(B))return-2;const R=Fraction$1.minus(B,D).RealValue/Fraction$1.minus(this.absoluteEndTimestamp,D).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*R))}setTempoType(){_ContinuousTempoExpression.isStringInStringList(_ContinuousTempoExpression.listContinuousTempoFaster,this.label)?this.tempoType=ContinuousTempoType.accelerando:_ContinuousTempoExpression.isStringInStringList(_ContinuousTempoExpression.listContinuousTempoSlower,this.label)&&(this.tempoType=ContinuousTempoType.ritardando)}};let ContinuousTempoExpression=_ContinuousTempoExpression;ContinuousTempoExpression.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"];ContinuousTempoExpression.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","rallentando","ritardando","ritenuto","ritard.","ritard","riten.","riten"];var ContinuousTempoType=(B=>(B[B.accelerando=0]="accelerando",B[B.stretto=1]="stretto",B[B.stringendo=2]="stringendo",B[B.mosso=3]="mosso",B[B.piuMosso=4]="piuMosso",B[B.allargando=5]="allargando",B[B.calando=6]="calando",B[B.menoMosso=7]="menoMosso",B[B.rallentando=8]="rallentando",B[B.ritardando=9]="ritardando",B[B.ritard=10]="ritard",B[B.rit=11]="rit",B[B.ritenuto=12]="ritenuto",B[B.rubato=13]="rubato",B[B.precipitando=14]="precipitando",B))(ContinuousTempoType||{});class MultiTempoExpression{constructor(D,R){this.expressions=[],this.sourceMeasure=D,this.timestamp=R}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return Fraction$1.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(D){this.sourceMeasure=D}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(D){this.combinedExpressionsText=D}getPlacementOfFirstEntry(){let D=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof InstantaneousTempoExpression?D=this.expressions[0].Expression.Placement:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(D=this.expressions[0].Expression.Placement)),D}getFontstyleOfFirstEntry(){let D=FontStyles.Regular;return this.expressions[0].Expression instanceof InstantaneousTempoExpression?D=FontStyles.Bold:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(D=FontStyles.Italic),D}addExpression(D,R){if(this.checkIfAlreadyExists(D))return;D instanceof InstantaneousTempoExpression?this.instantaneousTempo=D:D instanceof ContinuousTempoExpression&&(this.continuousTempo=D);const F=new TempoExpressionEntry;F.prefix=R,F.Expression=D,F.label=D.Label,this.expressions.push(F)}CompareTo(D){return this.Timestamp.RealValue>D.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 D of this.musicSystems)this.optimizeDistanceBetweenStaffLines(D);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(D,R,F,G){for(let j=0,U=D.length;j0&&(W.beginInstructionsWidth=F),G>0&&(W.endInstructionsWidth=G)}}finalizeCurrentAndCreateNewSystem(D,R=!1,F=!0,G=!1){this.finalizeCurrentSystem(D,R,F,G),this.currentSystemParams=new SystemBuildParameters,D!==void 0&&this.measureListIndex=1){const R=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let F=0;const G=D[D.length-1];G.endLine===SystemLinesEnum.DotsBoldBoldDots&&(G.endLine=SystemLinesEnum.DotsThinBold,F=R[0].getLineWidth(SystemLinesEnum.DotsBoldBoldDots)/2-R[0].getLineWidth(SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=F;for(let j=0,U=R.length;j1){U=!0;break}}let W=0;for(let Y=0;Y=0&&this.measureList[ie]){const oe=(K=this.measureList[ie][0])==null?void 0:K.parentSourceMeasure;(oe==null?void 0:oe.ImplicitMeasure)&&(oe==null?void 0:oe.RhythmPrinted)&&(te=!1)}te&&(R.addRhythmAtBegin(Q),R.parentSourceMeasure.RhythmPrinted=Q,J=!0)}return(Z||q||J)&&(U+=R.beginInstructionsWidth,J&&(U+=this.rules.RhythmRightMargin)),U}addInstructionsAtMeasureEnd(D,R,F){if(!D||!D.Instructions||D.Instructions.length===0)return 0;for(let G=0,j=D.Instructions.length;G0&&(this.currentSystemParams.systemMeasures.push({beginLine:SystemLinesEnum.None,endLine:SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=G,this.currentSystemParams.currentSystemFixWidth+=G)}addExtraInstructionMeasure(D,R,F){const G=this.currentSystemParams.currentSystem,j=MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(G.StaffLines[D]);R&&j.addKeyAtBegin(R,this.activeKeys[D],this.activeClefs[D]),F!==void 0&&F.PrintObject&&j.addRhythmAtBegin(F),j.PositionAndShape.BorderLeft=0,j.PositionAndShape.BorderTop=0,j.PositionAndShape.BorderBottom=this.rules.StaffHeight;const U=this.rules.MeasureLeftMargin+j.beginInstructionsWidth+this.rules.MeasureRightMargin;return j.PositionAndShape.BorderRight=U,G.StaffLines[D].Measures.push(j),U}addStaveMeasuresToSystem(D){if(D[0]){const R=[];for(let G=0;G1){const W=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,D.measureListIndex+D.multipleRestMeasures-1);D=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[W]}}finally{}const R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,F=R[this.measureListIndex];let G=!1;return F.allRests&&(G=(U=(j=R[this.measureListIndex+F.multipleRestMeasures-1])==null?void 0:j.endsWithLineRepetition)==null?void 0:U.call(j)),this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||G?SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?SystemLinesEnum.DoubleThin:D&&D.endingBarStyleEnum!==void 0?D.endingBarStyleEnum:SystemLinesEnum.SingleThin}getLineWidth(D,R,F){let G=D.getLineWidth(R);return R===SystemLinesEnum.DotsBoldBoldDots&&(G/=2),F&&R===SystemLinesEnum.BoldThinDots&&(G+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),G}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let D=0,R=this.measureList[this.measureListIndex-1].length;D=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[D])return!1;for(let R=0,F=this.measureList[D].length;R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||D>this.measureList.length-1)return!1;for(let R=0,F=this.measureList[D].length;R1)for(let W=1;Wj&&(j=Z)}for(let W=0;Wthis.rules.PageHeight-this.rules.PageBottomMargin&&(G++,G<=4&&console.log(`warning: could not fit a single system on page ${D.PageNumber} and measure number ${F.GraphicalMeasures[0][0].MeasureNumber}. The PageFormat may be too small for this sheet." Will not give further warnings for all pages, only total.`))}else{const Y=this.musicSystems[W-1],Q=Y.StaffLines[Y.StaffLines.length-1],Z=Q.PositionAndShape;let q=this.findRequiredDistanceWithSkyBottomLine(Y,F);q=Math.max(j,q),q+=this.rules.MinSkyBottomDistBetweenSystems,((U=window==null?void 0:window.appName)==null?void 0:U.toLocaleUpperCase())==="GYM"&&(q=q<16?16:q);const J=this.hasExpressionCounts(F);J.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(q+=2),J.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(q+=2),q=Math.max(q,this.rules.MinimumDistanceBetweenSystems+Q.StaffHeight);const K=R+Z.RelativePosition.y+q,te=K+F.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&Y.breaksPage)&&te0&&console.log(`total amount of pages that couldn't fit a single music system: ${G} of ${D.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(D,R){const F=D.StaffLines[D.StaffLines.length-1],G=R.StaffLines[0],j=F.BottomLine,U=G.SkyLine,W=F.PositionAndShape,Y=G.PositionAndShape,Q=1/this.rules.SamplingUnit;let Z=0;for(let q=0;q=U.length)break;const te=Math.max(0,K-6),ne=Math.min(U.length-1,K+6);let ie=0;for(let oe=te;oe<=ne;oe++)ie=Math.min(ie,U[oe]);const re=J-ie;Z=Math.max(re,Z)}return Z===0&&(Z=W.BorderBottom-Y.BorderTop),Z}}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(D,R,F){this.getOpenOctaveShift=D,this.getAbsoluteStartTimestamp=R,this.getAbsoluteEndTimestamp=F}}class AccidentalCalculator{constructor(){this.keySignatureNoteAlterationsDict=new Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new Dictionary}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(D){this.activeKeyInstruction=D,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(const D of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(D,this.keySignatureNoteAlterationsDict.getValue(D))}checkAccidental(D,R){if(!R)return;const F=R.FundamentalNote+R.Octave*12,G=this.currentAlterationsComparedToKeyInstructionList.indexOf(F)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(F)){if(G&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(F),1),this.currentInMeasureNoteAlterationsDict.getValue(F)!==R.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(F)&&this.keySignatureNoteAlterationsDict.getValue(F)!==R.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(F),this.currentInMeasureNoteAlterationsDict.setValue(F,R.AccidentalHalfTones)):R.Accidental!==AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(F);const j=this.currentInMeasureNoteAlterationsDict.getValue(F);if(R.Accidental===AccidentalEnum.NONE&&(Math.abs(j)===.5?R=new Pitch(R.FundamentalNote,R.Octave,AccidentalEnum.NONE):R=new Pitch(R.FundamentalNote,R.Octave,AccidentalEnum.NATURAL)),this.isAlterAmbiguousAccidental(R.Accidental)&&!R.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(D,R)}}else if(R.Accidental!==AccidentalEnum.NONE){if(G||this.currentAlterationsComparedToKeyInstructionList.push(F),this.currentInMeasureNoteAlterationsDict.setValue(F,R.AccidentalHalfTones),this.isAlterAmbiguousAccidental(R.Accidental)&&!R.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(D,R)}else G&&(R=new Pitch(R.FundamentalNote,R.Octave,AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(F),1),MusicSheetCalculator.symbolFactory.addGraphicalAccidental(D,R))}isAlterAmbiguousAccidental(D){return D===AccidentalEnum.SLASHFLAT||D===AccidentalEnum.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const D=this.activeKeyInstruction.AlteratedNotes;let R;this.activeKeyInstruction.Key>0?R=AccidentalEnum.SHARP:R=AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let F=-9;F<9;F++)for(let G=0;G0?(F=Q-1,D.push({startIndex:R,endIndex:F}),R=Q):J.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(F=Q,D.push({startIndex:R,endIndex:F}),R=Q+1)}Rte&&fe%2===0?(j.push(fe),le=ue,fe=1):fe++:le>te?(j.push(fe),le=ue,fe=1):fe++,ue>te?be=he+1:be=Math.ceil(be),re===be?oe+=1:(G.push(oe),re=be,oe=1)}G.push(oe),j.push(fe),j=j.filter(Boolean),console.log(j,G)}return this.buildPreparedMusicSystems(j)}buildPreparedMusicSystems(D){let R=!1;this.currentSystemParams=new SystemBuildParameters,this.currentSystemParams.currentSystem=this.initMusicSystem();for(let F=0,G=this.measureList.length;F0&&this.rules.RenderMultipleRestMeasures){q.isReducedToMultiRest=!0,q.multipleRestMeasureNumber=1;const K=q.multipleRestMeasures-1;Q+=K;for(let te=1;te<=K;te++){const ne=D.SourceMeasures[q.MeasureNumber-1+te];ne.multipleRestMeasureNumber=te+1,ne.isReducedToMultiRest=!0,R.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let Q,Z=0;for(let q=0,J=D.SourceMeasures.length;q0){Q.isReducedToMultiRest=!0,Q.multipleRestMeasureNumber=1,Z++,K.multipleRestMeasureNumber=Z,K.isReducedToMultiRest=!0;for(let te=0;te1){Q.multipleRestMeasures=Z;const te=this.createGraphicalMeasuresForSourceMeasure(Q,F,j,W,G);R[Q.measureListIndex]=te,Z=0,Q=void 0}else Z=0,Q=void 0}if(Z>1){Q.multipleRestMeasures=Z,Q.isReducedToMultiRest=!0;const q=this.createGraphicalMeasuresForSourceMeasure(Q,F,j,W,G);R[Q.measureListIndex]=q,Z=0,Q=void 0}}const Y=G.map(Q=>Q.ClefType===ClefEnum.percussion);this.handleStaffEntries(Y),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(D,R){let F=0;const G=this.rules.MaxInstructionsConstValue;if(this.graphicalMusicSheet.MeasureList.length>0){let j=this.graphicalMusicSheet.MeasureList[0],U=this.calculateMeasureXLayout(j);U=this.calculateMeasureWidthFromStaffEntries(j,U),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(j,U),F=U*1.2+R+G;for(let W=1;W0)return;const U=R.Measures[j];(U.MeasureNumber===0||U.MeasureNumber===1)&&(F=U.MeasureNumber),U!==R.Measures[0]&&this.rules.MeasureNumberLabelXOffset?G=this.rules.MeasureNumberLabelXOffset:G=0;const W=this.rules.UseXMLMeasureNumbers&&U.MeasureNumber===1&&U.parentSourceMeasure.getPrintedMeasureNumber()!==1;((U.MeasureNumber===F||U.MeasureNumber>=F+this.rules.MeasureNumberLabelOffset)&&!U.parentSourceMeasure.ImplicitMeasure||W)&&((U.MeasureNumber!==1||U.MeasureNumber===1&&U!==R.Measures[0]||W)&&this.calculateSingleMeasureNumberPlacement(U,R,D,G),F=U.MeasureNumber)}}calculateSingleMeasureNumberPlacement(D,R,F,G=0){const j=D.parentSourceMeasure.getPrintedMeasureNumber().toString(),U=new Label(j),W=new GraphicalLabel(U,this.rules.MeasureNumberLabelHeight,TextAlignmentEnum.LeftBottom,this.rules),Y=R.SkyBottomLineCalculator;W.setLabelPositionAndShapeBorders(),W.PositionAndShape.Parent=F.PositionAndShape;const Q=R.PositionAndShape.RelativePosition.x+D.PositionAndShape.RelativePosition.x-W.PositionAndShape.BorderMarginLeft+G;let Z,q=Q,J=Q-W.PositionAndShape.BorderLeft+W.PositionAndShape.BorderRight;q-=R.PositionAndShape.RelativePosition.x,J-=R.PositionAndShape.RelativePosition.x;const K=q+.5,te=J-.5,ne=Y.getSkyLineMinInRange(K,te);if(D===R.Measures[0]){let ie=0;if(F.GroupBrackets.length>0)for(const re of F.GroupBrackets)ie=Math.min(ie,re.PositionAndShape.BorderTop);Z=Math.min(ne,ie)}else Z=ne;Z=Math.min(0,Z),W.PositionAndShape.RelativePosition=new PointF2D(Q,Z),F.MeasureNumberLabels.push(W)}calculateMeasureNumberSkyline(D){const R=D.StaffLines[0];for(const F of D.MeasureNumberLabels){let G=F.PositionAndShape.RelativePosition.x,j=G-F.PositionAndShape.BorderLeft+F.PositionAndShape.BorderRight;G-=R.PositionAndShape.RelativePosition.x,j-=R.PositionAndShape.RelativePosition.x,R.SkyBottomLineCalculator.updateSkyLineInRange(G,j,F.PositionAndShape.RelativePosition.y+F.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(D,R,F){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(D,R){let F=0,G=this.rules.StaffHeight;const j=[],U=D.SkyBottomLineCalculator;let W=D.Measures.length;for(let Q=0;Q0){j.push(te),F=Math.max(F,te.LyricsEntries.length);const ne=te.PositionAndShape.RelativePosition.x+q.x;let ie=Number.MAX_VALUE,re=Number.MIN_VALUE;for(let le=0;le0){const Q=D.PositionAndShape.Size.width;let Z=j[0].PositionAndShape.RelativePosition.x+j[0].PositionAndShape.BorderMarginLeft+j[0].parentMeasure.PositionAndShape.RelativePosition.x;Z=Z>Q?Q:Z,U.updateBottomLineInRange(Z,Q,Y)}return j}calculateLyricsExtendsAndDashes(D){for(let R=0,F=D.length;R0||D.UnknownList.length>0){let Y="";for(let K=0,te=D.EntriesList.length;KD.length-1&&(log$2.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=D.length-1);const R=[];for(let U=this.rules.MinMeasureToDrawIndex,W=D.length;U0)&&(G=F.getSkyLineMinInRange(q,J));let K=0;W===0?(K+=this.rules.ChordSymbolYOffset,K+=.1):K+=this.rules.ChordSymbolYPadding,K*=-1;const te=Y.GraphicalLabel;te.PositionAndShape.RelativePosition.y=G+K,te.setLabelPositionAndShapeBorders(),te.PositionAndShape.calculateBoundingBox(),F.updateSkyLineInRange(q,J,G+te.PositionAndShape.BorderMarginTop)}}}}calculateAlignedChordSymbolsOffset(D,R){let F=Number.MAX_SAFE_INTEGER;for(const G of D)for(const j of G.graphicalChordContainers){const U=G.PositionAndShape,W=j.PositionAndShape,Y=W.BorderMarginLeft+U.AbsolutePosition.x,Q=W.BorderMarginRight+U.AbsolutePosition.x;F=Math.min(F,R.getSkyLineMinInRange(Y,Q))}return F}layoutMeasureWithWholeRest(D,R,F){}layoutBeams(D){}layoutArticulationMarks(D,R,F){}layoutOrnament(D,R,F){}calculateRestNotePlacementWithinGraphicalBeam(D,R,F,G,j){}calculateTupletNumbers(){}calculateSlurs(){}calculateDynamicExpressionsForMultiExpression(D,R,F){}calculateGraphicalVerbalContinuousDynamic(D,R){const F=D.Label,G=R.x+F.PositionAndShape.BorderMarginLeft,j=R.x+F.PositionAndShape.BorderMarginRight,U=D.ContinuousDynamic.Placement,Y=D.ParentStaffLine.SkyBottomLineCalculator;let Q;U===PlacementEnum.Below?(Q=Y.getBottomLineMaxInRange(G,j),F.PositionAndShape.RelativePosition=new PointF2D(R.x,Q-F.PositionAndShape.BorderMarginTop)):(Q=Y.getSkyLineMinInRange(G,j),F.PositionAndShape.RelativePosition=new PointF2D(R.x,Q-F.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(D,R){var ce,we,Be;const F=D.ParentStaffLine.ParentStaff.idInMusicSheet,G=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(D.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,F);if(!G){log$2.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}D.EndMeasure=G;const j=D.ParentStaffLine,U=G.ParentStaffLine,W=U&&j===U;let Y=!1;U?Y=U==null?void 0:U.isPartOfMultiStaffInstrument():j&&(Y=j==null?void 0:j.isPartOfMultiStaffInstrument());const Q=Fraction$1.createFromFraction(D.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),Z=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(Q),q=Z.getFirstNonNullStaffEntry().parentMeasure,J=q.PositionAndShape.AbsolutePosition.x+q.PositionAndShape.BorderRight;let K=new Fraction$1(0,0,0);for(const Ae of Z.StaffEntries){const Te=(ce=Ae==null?void 0:Ae.sourceStaffEntry)==null?void 0:ce.calculateMaxNoteLength();Te!=null&&Te.gt(K)&&(K=Te)}const te=this.getRelativePositionInStaffLineFromTimestamp(Q,F,U,Y,0),ne=Fraction$1.plus(Q,K),ie=this.getRelativePositionInStaffLineFromTimestamp(ne,F,U,Y,0);ie.x>te.x&&ie.xle){const Pe=oe.StaffLines[Ae].PositionAndShape.RelativePosition.y-j.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;ye=this.rules.StaffHeight+Pe/2}else ye=this.rules.WedgePlacementBelowY;ye-=this.rules.WedgeOpeningLength/2,W||(xe=ye);let Te=fe.getBottomLineMaxInRange(me,ve);if(Te>ye&&(ye=Te),lexe&&(xe=Te),xe+=this.rules.WedgeOpeningLength/2,xe+=this.rules.WedgeVerticalMargin),ye+=this.rules.WedgeOpeningLength/2,ye+=this.rules.WedgeVerticalMargin}else if(he===PlacementEnum.Above){if(j.ParentStaff.ParentInstrument.Staves.length===1)ye=this.rules.WedgePlacementAboveY;else{let Te=0;le>0&&(Te=le-1);const Ne=oe.StaffLines[Te];ye=-(j.PositionAndShape.RelativePosition.y-Ne.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}ye+=this.rules.WedgeOpeningLength/2,W||(xe=ye);let Ae=fe.getSkyLineMinInRange(me,ve);if(Ae1&&le>0){const Te=j.findClosestStaffEntry(me),Ne=j.findClosestStaffEntry(ve);Te&&Ne&&Te.parentVerticalContainer}W||(Ae=U.SkyBottomLineCalculator.getSkyLineMinInRange(be,pe),Ae-q/2?Y=-q/2:Y=Q-D.PositionAndShape.BorderMarginBottom}else Y=Q-D.PositionAndShape.BorderMarginBottom;D.PositionAndShape.RelativePosition=new PointF2D(R.x,Y)}else if(D.Placement===PlacementEnum.Below){const Q=W.getBottomLineMaxInRange(j,U),Z=G.ParentStaff.ParentInstrument.Staves[G.ParentStaff.ParentInstrument.Staves.length-1];if(G.isPartOfMultiStaffInstrument()&&G.ParentStaff!==Z){const J=G.ParentMusicSystem.StaffLines[G.ParentMusicSystem.StaffLines.indexOf(G)+1].PositionAndShape.RelativePosition.y-G.PositionAndShape.RelativePosition.y-this.rules.StaffHeight,K=D.PositionAndShape.BorderMarginBottom;Q+KD.PositionAndShape.Size.width&&(J=D.PositionAndShape.Size.width-this.rules.MeasureRightMargin,q=J-Q.PositionAndShape.MarginSize.width,R.x=q-Q.PositionAndShape.BorderMarginLeft);let K;const te=D.SkyBottomLineCalculator;return j===PlacementEnum.Below?K=te.getBottomLineMaxInRange(q,J):K=te.getSkyLineMinInRange(q,J),Q.PositionAndShape.RelativePosition=new PointF2D(R.x,K),j===PlacementEnum.Below?te.updateBottomLineInRange(q,J,Q.PositionAndShape.BorderMarginBottom+K):te.updateSkyLineInRange(q,J,Q.PositionAndShape.BorderMarginTop+K),Q}calculateTempoExpressionsForMultiTempoExpression(D,R,F,G){metronomeMarks={};const j=Fraction$1.plus(D.AbsoluteTimestamp,R.Timestamp),U=this.graphicalMusicSheet.MeasureList[F];let W=new PointF2D;if(R.ContinuousTempo||R.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!U[0])return;let Y=U[0].ParentStaffLine,Q=U[0].PositionAndShape.RelativePosition.x,Z=0;for(let q=0;q0){Y=U[q].ParentStaffLine,Q=U[q].PositionAndShape.RelativePosition.x,Z=q;break}if(W=this.getRelativePositionInStaffLineFromTimestamp(j,Z,Y,Y.isPartOfMultiStaffInstrument(),Q),R.EntriesList.length>0&&R.EntriesList[0].Expression instanceof InstantaneousTempoExpression){const q=R.EntriesList[0].Expression;if(q.Placement=PlacementEnum.Above,Y.Measures[0].staffEntries.length>0&&Math.abs(W.x-Y.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&Y.ParentMusicSystem===this.musicSystems[0]){const J=Y.Measures[0].FirstInstructionStaffEntry;if(J){const K=J.GraphicalInstructions.last();W.x=K.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(W.x=Y.PositionAndShape.RelativePosition.x+Y.Measures[0].PositionAndShape.RelativePosition.x)}}for(const q of R.EntriesList){let J=TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(J=TextAlignmentEnum.LeftBottom);const K=this.calculateLabel(Y,W,q.label,R.getFontstyleOfFirstEntry(),q.Expression.Placement,this.rules.UnknownTextHeight,J);if(q.Expression instanceof InstantaneousTempoExpression){for(const ne of Y.AbstractExpressions)ne instanceof GraphicalInstantaneousTempoExpression&&(ne.SourceExpression.Label,q.Expression.Label);new GraphicalInstantaneousTempoExpression(q.Expression,K).ParentStaffLine||log$2.warn("Adding staffline didn't work"),q.Expression.Enum===TempoEnum.metronomeMark&&(metronomeMarks[F]=q.Expression)}else q.Expression instanceof ContinuousTempoExpression;if(G===D.TempoExpressions.length-1)for(const te of Object.values(metronomeMarks))this.createMetronomeMark(te,F)}}}createMetronomeMark(D,R){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(D){}clearSystemsAndMeasures(){for(let D=0,R=this.graphicalMusicSheet.MusicPages.length;D-1&&J.PositionAndShape.ChildElements.splice(K,1),J.FirstInstructionStaffEntry=void 0,J.beginInstructionsWidth=0}if(J.LastInstructionStaffEntry){const K=J.PositionAndShape.ChildElements.indexOf(J.LastInstructionStaffEntry.PositionAndShape);K>-1&&J.PositionAndShape.ChildElements.splice(K,1),J.LastInstructionStaffEntry=void 0,J.endInstructionsWidth=0}}Q.Measures=[],Q.PositionAndShape.ChildElements=[]}U.StaffLines.length=0,U.PositionAndShape.ChildElements=[]}F.MusicSystems=[],F.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(D,R,F,G,j,U,W,Y,Q,Z=void 0,q=void 0){D.StemDirectionXml!==StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&D.StemDirectionXml!==void 0?D.WantedStemDirection=D.StemDirectionXml:this.calculateStemDirectionFromVoices(D);const J=R.findOrCreateGraphicalVoiceEntry(D);J.octaveShiftValue=Y;const K=R.tabStaffEntry;let te;K&&(te=K.findOrCreateGraphicalVoiceEntry(D));for(let ne=0,ie=D.Notes.length;ne-1)continue;let oe;if(D.IsGrace?oe=MusicSheetCalculator.symbolFactory.createGraceNote(re,J,j,this.rules,Y):(oe=MusicSheetCalculator.symbolFactory.createNote(re,J,j,Y,this.rules,void 0),MusicSheetCalculator.stafflineNoteCalculator.trackNote(oe)),re.Pitch&&this.checkNoteForAccidental(oe,F,j,Y),this.resetYPositionForLeadSheet(oe.PositionAndShape),R.addGraphicalNoteToListAtCorrectYPosition(J,oe),oe.PositionAndShape.calculateBoundingBox(),this.leadSheet||(re.NoteBeam!==void 0&&re.PrintObject&&this.handleBeam(oe,re.NoteBeam,W),re.NoteTuplet!==void 0&&re.PrintObject&&this.handleTuplet(oe,re.NoteTuplet,U)),te){const le=MusicSheetCalculator.symbolFactory.createNote(re,te,j,Y,this.rules,void 0);K.addGraphicalNoteToListAtCorrectYPosition(te,le),le.PositionAndShape.calculateBoundingBox(),this.leadSheet||re.NoteTuplet&&this.handleTuplet(le,re.NoteTuplet,U)}}return D.Articulations.length>0&&this.handleVoiceEntryArticulations(D.Articulations,D,R),D.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(D.TechnicalInstructions,D,R),D.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(D,R,G),D.OrnamentContainer&&this.handleVoiceEntryOrnaments(D.OrnamentContainer,D,R),Y}resetYPositionForLeadSheet(D){this.leadSheet&&(D.RelativePosition=new PointF2D(D.RelativePosition.x,0))}layoutVoiceEntries(D,R){if(D.PositionAndShape.RelativePosition=new PointF2D(0,0),!this.leadSheet)for(const F of D.graphicalVoiceEntries){const G=F.notes;if(G.length===0)continue;const j=G[0].sourceNote.ParentVoiceEntry,U=G[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(j,G,D,U)}}maxInstrNameLabelLength(){var R;let D=0;for(const F of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if(((R=F.NameLabel)==null?void 0:R.print)&&F.Voices.length>0&&F.Voices[0].Visible){let G=F.NameLabel;this.rules.RenderPartNames||(G=new Label("",G.textAlignment,G.font));const j=new GraphicalLabel(G,this.rules.InstrumentLabelTextHeight,TextAlignmentEnum.LeftCenter,this.rules);j.setLabelPositionAndShapeBorders(),D=Math.max(D,j.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?D:0}calculateSheetLabelBoundingBoxes(){var G;const D=this.graphicalMusicSheet.ParentMusicSheet,R=this.rules.DefaultColorTitle;if(D.Title!==void 0&&this.rules.RenderTitle){const j=new GraphicalLabel(D.Title,this.rules.SheetTitleHeight,TextAlignmentEnum.CenterBottom,this.rules);j.Label.IsCreditLabel=!0,j.Label.colorDefault=R,this.graphicalMusicSheet.Title=j,j.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(D.Subtitle!==void 0&&this.rules.RenderSubtitle){const j=new GraphicalLabel(D.Subtitle,this.rules.SheetSubtitleHeight,TextAlignmentEnum.CenterCenter,this.rules);j.Label.IsCreditLabel=!0,j.Label.colorDefault=R,this.graphicalMusicSheet.Subtitle=j,j.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(D.Composer!==void 0&&this.rules.RenderComposer){const j=new GraphicalLabel(D.Composer,this.rules.SheetComposerHeight,TextAlignmentEnum.RightCenter,this.rules);j.Label.IsCreditLabel=!0,j.Label.colorDefault=R,this.graphicalMusicSheet.Composer=j,j.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(D.Lyricist!==void 0&&this.rules.RenderLyricist){const j=new GraphicalLabel(D.Lyricist,this.rules.SheetAuthorHeight,TextAlignmentEnum.LeftCenter,this.rules);j.Label.IsCreditLabel=!0,j.Label.colorDefault=R,this.graphicalMusicSheet.Lyricist=j,j.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);const F=(G=this.graphicalMusicSheet.musicSheet.sourceMeasures)==null?void 0:G[0];if(F&&F.FirstInstructionsStaffEntries.length>0){const j=F.FirstInstructionsStaffEntries[0];let U,W;for(let Y=0,Q=j.Instructions.length;Y0&&Z.graphicalVoiceEntries[0].notes.length===1){const q=Z.graphicalVoiceEntries[0].notes[0];!q.sourceNote.Pitch&&new Fraction$1(1,2).lt(q.sourceNote.Length)&&this.layoutMeasureWithWholeRest(q,Z,Q)}}}}}}optimizeRestNotePlacement(D,R){if(D.graphicalVoiceEntries.length===0)return;const F=D.graphicalVoiceEntries[0].notes;if(F.length===0)return;const G=F[0],j=G.sourceNote.isRest();if(D.graphicalVoiceEntries.length===2){let U=!1;const W=D.graphicalVoiceEntries[1].notes;W.length>0&&(U=W[0].sourceNote.isRest()),j&&U?this.calculateTwoRestNotesPlacementWithCollisionDetection(D):(j||U)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(D)}else if(j&&D!==R.staffEntries[0]&&D!==R.staffEntries[R.staffEntries.length-1]){const U=R.staffEntries.indexOf(D),W=R.staffEntries[U-1],Y=R.staffEntries[U+1];if(W.graphicalVoiceEntries.length===1){const Q=W.graphicalVoiceEntries[0].notes[0];if(Q.sourceNote.NoteBeam!==void 0&&Y.graphicalVoiceEntries.length===1){const Z=Y.graphicalVoiceEntries[0].notes[0];Z.sourceNote.NoteBeam!==void 0&&Q.sourceNote.NoteBeam===Z.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(D,G,Q,Y,Z),D.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(D,R,F,G,j=0){let U=new PointF2D,W,Y;const Q=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,Z=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(D),q=Math.min(Math.floor(Z),Q-1),J=Math.min(Math.ceil(Z),Q-1);if(q<0||R<0)return U;if(W=this.getFirstLeftNotNullStaffEntryFromContainer(q,R,G),Y=this.getFirstRightNotNullStaffEntryFromContainer(J,R,G),W&&Y){let K=W.parentMeasure.PositionAndShape.RelativePosition.x;j>0&&(K=j);let te=W.PositionAndShape.RelativePosition.x+K,ne=Y.PositionAndShape.RelativePosition.x+Y.parentMeasure.PositionAndShape.RelativePosition.x;j>0&&(ne=Y.PositionAndShape.RelativePosition.x+K);let ie=0;if(W!==Y){const re=W.getAbsoluteTimestamp(),oe=Y.getAbsoluteTimestamp();ie=Fraction$1.minus(D,re).RealValue/Fraction$1.minus(oe,re).RealValue}W.parentMeasure.ParentStaffLine!==Y.parentMeasure.ParentStaffLine&&(W.parentMeasure.ParentStaffLine===F?ne=F.PositionAndShape.Size.width:te=F.PositionAndShape.RelativePosition.x),U=new PointF2D(te+(ne-te)*ie,0)}return U}getRelativeXPositionFromTimestamp(D){const R=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,F=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(D),G=Math.max(0,Math.min(Math.round(F),R-1)),j=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[G].getFirstNonNullStaffEntry();return j.PositionAndShape.RelativePosition.x+j.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(D){var U;this.rules.RenderSingleHorizontalStaffline&&(D.PositionAndShape.BorderRight=D.PositionAndShape.Size.width,D.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=D.PositionAndShape.Size.width);let R=10;if(D.MusicSystems.length>0){const W=D.MusicSystems[0];R=W.PositionAndShape.RelativePosition.y+W.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){const W=this.graphicalMusicSheet.Title;W.PositionAndShape.Parent=D.PositionAndShape;const Y=new PointF2D;Y.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,Y.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,W.PositionAndShape.RelativePosition=Y,D.Labels.push(W)}if(this.graphicalMusicSheet.Subtitle){const W=this.graphicalMusicSheet.Subtitle;W.PositionAndShape.Parent=D.PositionAndShape;const Y=new PointF2D;Y.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,Y.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,W.PositionAndShape.RelativePosition=Y,D.Labels.push(W)}const F=this.graphicalMusicSheet.Composer;let G;if(F){F.PositionAndShape.Parent=D.PositionAndShape,F.setLabelPositionAndShapeBorders();const W=new PointF2D;W.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,W.y=R,W.y-=this.rules.SystemComposerDistance;const Y=(U=F.TextLines)==null?void 0:U.length;Y>1&&(W.y-=F.PositionAndShape.BorderBottom*(Y-1)/Y),G=W.y,F.PositionAndShape.RelativePosition=W,D.Labels.push(F)}const j=this.graphicalMusicSheet.Lyricist;if(j){j.PositionAndShape.Parent=D.PositionAndShape,j.setLabelPositionAndShapeBorders();const W=new PointF2D;W.x=this.rules.PageLeftMargin,W.y=R,W.y+=j.PositionAndShape.BorderBottom,W.y=Math.min(W.y,G!=null?G:Number.MAX_SAFE_INTEGER),j.PositionAndShape.RelativePosition=W,D.Labels.push(j)}}createGraphicalTies(){for(let D=0;D=0&&this.staffEntriesWithGraphicalTies.push(j)}j=W}}setTieDirections(D){if(!D)return;const R=D.ties;if(R.length>1){let F;for(const G of R){const j=G.Notes[0];(!F||j.Pitch.getHalfTone()>F.Pitch.getHalfTone())&&(F=j)}for(const G of R)G.TieDirection===PlacementEnum.NotYetDefined&&(G.Notes[0]===F?G.TieDirection=PlacementEnum.Above:G.TieDirection=PlacementEnum.Below)}}createAccidentalCalculators(){const D=[],R=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(R)for(let F=0;F1)return;q=MusicSheetCalculator.symbolFactory.createGraphicalMeasure(D,Z)}if(q.hasError=D.getErrorInMeasure(Y),D.FirstInstructionsStaffEntries[Y])for(let le=0,fe=D.FirstInstructionsStaffEntries[Y].Instructions.length;le0){const me=fe.Instructions[0];MusicSheetCalculator.symbolFactory.createInStaffClef(he,me)}this.rules.RenderChordSymbols&&((oe=fe.ChordContainers)==null?void 0:oe.length)>0&&(fe.ParentStaff.ParentInstrument.HasChordSymbols=!0,MusicSheetCalculator.symbolFactory.createChordSymbols(fe,he,G.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(G.doCalculationsAtEndOfMeasure(),D.LastInstructionsStaffEntries[Y]){const le=D.LastInstructionsStaffEntries[Y];for(let fe=0,he=le.Instructions.length;fe=1&&q.staffEntries.length===0){const le=new SourceStaffEntry(new VerticalSourceStaffEntryContainer(q.parentSourceMeasure,q.parentSourceMeasure.AbsoluteTimestamp,q.parentSourceMeasure.CompleteNumberOfStaves),Z),fe=new VoiceEntry(new Fraction$1(0,1),Z.Voices[0],le),he=new Note$1(fe,le,Fraction$1.createFromFraction(D.Duration),void 0,D);he.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===FillEmptyMeasuresWithWholeRests.YesVisible,fe.addNote(he);const ge=MusicSheetCalculator.symbolFactory.createStaffEntry(le,q);q.addGraphicalStaffEntry(ge),ge.relInMeasureTimestamp=fe.Timestamp;const ue=MusicSheetCalculator.symbolFactory.createVoiceEntry(fe,ge);ge.graphicalVoiceEntries.push(ue);const me=MusicSheetCalculator.symbolFactory.createNote(he,ue,new ClefInstruction,OctaveEnum.NONE,void 0);MusicSheetCalculator.stafflineNoteCalculator.trackNote(me),ue.notes.push(me)}q.hasOnlyRests=!0;for(const le of q.staffEntries)if(q.hasOnlyRests=le.hasOnlyRests(),!q.hasOnlyRests)break;return q}checkNoteForAccidental(D,R,F,G){let j=D.sourceNote.Pitch;const U=D.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();U!==0&&D.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==MidiInstrument.Percussion&&(j=D.Transpose(R.ActiveKeyInstruction,F,U,G),D.sourceNote.TransposedPitch=j),D.sourceNote.halfTone=j.getHalfTone(),R.checkAccidental(D,j)}handleStaffEntries(D){for(let R=0,F=this.graphicalMusicSheet.MeasureList.length;R0&&Y.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(Y,j),this.layoutStaffEntry(Y));this.graphicalMeasureCreatedCalculations(W)}}}}calculateSkyBottomLines(){for(const D of this.musicSystems)for(const R of D.StaffLines)R.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let D=0,R=this.musicSystems.length;D0&&this.layoutArticulationMarks(ne.Articulations,ne,J)}}}}}}calculateOrnaments(){for(let D=0,R=this.musicSystems.length;D0&&G.LyricVersesNumbers.sort()}for(let R=0,F=this.musicSystems.length;R=0&&(G=R.GraphicalLyricsEntries[F+1]),!G)return;const j=D.StaffEntryParent.parentMeasure.ParentStaffLine,U=G.StaffEntryParent.parentMeasure.ParentStaffLine,W=D.StaffEntryParent,Y=G.StaffEntryParent;if(D.StaffEntryParent.parentMeasure.ParentStaffLine===G.StaffEntryParent.parentMeasure.ParentStaffLine){const Q=W.parentMeasure.PositionAndShape.RelativePosition.x+W.PositionAndShape.RelativePosition.x+D.GraphicalLabel.PositionAndShape.RelativePosition.x+D.GraphicalLabel.PositionAndShape.BorderMarginRight,Z=Y.parentMeasure.PositionAndShape.RelativePosition.x+Y.PositionAndShape.RelativePosition.x+D.GraphicalLabel.PositionAndShape.RelativePosition.x+G.GraphicalLabel.PositionAndShape.BorderMarginLeft,q=D.GraphicalLabel.PositionAndShape.RelativePosition.y;let J=1;Z-Q>this.rules.MinimumDistanceBetweenDashes*3&&(J=Math.floor((Z-Q)/this.rules.MinimumDistanceBetweenDashes)-1),J===1?this.calculateSingleDashForLyricWord(j,Q,Z,q):this.calculateDashes(j,Q,Z,q)}else{const Q=W.parentMeasure.PositionAndShape.RelativePosition.x+W.PositionAndShape.RelativePosition.x+D.GraphicalLabel.PositionAndShape.BorderMarginRight,Z=j.Measures[j.Measures.length-1],q=Z.PositionAndShape.RelativePosition.x+Z.PositionAndShape.Size.width;let J=D.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(j,Q,q,J),U&&U.Measures[0]&&Y.parentMeasure.ParentStaffLine&&!(Y===Y.parentMeasure.staffEntries[0]&&Y.parentMeasure===Y.parentMeasure.ParentStaffLine.Measures[0])){const K=U.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,te=Y.parentMeasure.PositionAndShape.RelativePosition.x+Y.PositionAndShape.RelativePosition.x+G.GraphicalLabel.PositionAndShape.BorderMarginLeft;J=G.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(U,K,te,J)}}}calculateDashes(D,R,F,G){let j=F-R;if(jR;)j=this.calculateRightAndLeftDashesForLyricWord(D,R,F,G),R+=W,F-=W,Y++;j>W*2&&this.calculateSingleDashForLyricWord(D,R,F,G)}}calculateSingleDashForLyricWord(D,R,F,G){const j=new Label("-"),U=new GraphicalLabel(j,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);U.setLabelPositionAndShapeBorders(),D.LyricsDashes.push(U),this.staffLinesWithLyricWords.indexOf(D)===-1&&this.staffLinesWithLyricWords.push(D),U.PositionAndShape.Parent=D.PositionAndShape;const W=new PointF2D(R+(F-R)/2,G);U.PositionAndShape.RelativePosition=W}calculateLyricExtend(D){let R=D.GraphicalLabel.PositionAndShape.RelativePosition.y;const F=D.StaffEntryParent,G=F.parentMeasure.ParentStaffLine;let j,U;const W=F.parentMeasure.ParentStaff.idInMusicSheet;for(let Y=F.parentVerticalContainer.Index+1;Y0)break;j=Q,U=j.parentMeasure.ParentStaffLine,U||(U=F.parentMeasure.ParentStaffLine)}}if(!(!j||!U))if(G===U&&j.parentMeasure.ParentStaffLine){const Y=F.parentMeasure.PositionAndShape.RelativePosition.x+F.PositionAndShape.RelativePosition.x+D.GraphicalLabel.PositionAndShape.BorderMarginRight,Q=j.parentMeasure.PositionAndShape.RelativePosition.x+j.PositionAndShape.RelativePosition.x+j.PositionAndShape.BorderMarginRight;R-=D.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(G,Y,Q,R)}else{const Y=G.Measures[G.Measures.length-1].PositionAndShape,Q=F.parentMeasure.PositionAndShape.RelativePosition.x+F.PositionAndShape.RelativePosition.x+D.GraphicalLabel.PositionAndShape.BorderMarginRight,Z=Y.RelativePosition.x+Y.Size.width;if(R-=D.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(G,Q,Z,R),!j)return;if(j.parentMeasure.ParentStaffLine&&j.parentMeasure.staffEntries&&!(j===j.parentMeasure.staffEntries[0]&&j.parentMeasure===j.parentMeasure.ParentStaffLine.Measures[0])){const q=U.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,J=j.parentMeasure.PositionAndShape.RelativePosition.x+j.PositionAndShape.RelativePosition.x+j.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(U,q,J,R)}}}calculateSingleLyricWordWithUnderscore(D,R,F,G){const j=new PointF2D(R,G),U=new PointF2D(F,G),W=new GraphicalLine(j,U,this.rules.LyricUnderscoreLineWidth);D.LyricLines.push(W),this.staffLinesWithLyricWords.indexOf(D)===-1&&this.staffLinesWithLyricWords.push(D)}calculateRightAndLeftDashesForLyricWord(D,R,F,G){const j=new Label("-"),U=new GraphicalLabel(j,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);U.setLabelPositionAndShapeBorders(),D.LyricsDashes.push(U),this.staffLinesWithLyricWords.indexOf(D)===-1&&this.staffLinesWithLyricWords.push(D),U.PositionAndShape.Parent=D.PositionAndShape;const W=new PointF2D(R,G);U.PositionAndShape.RelativePosition=W;const Y=new Label("-"),Q=new GraphicalLabel(Y,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);Q.setLabelPositionAndShapeBorders(),D.LyricsDashes.push(Q),Q.PositionAndShape.Parent=D.PositionAndShape;const Z=new PointF2D(F,G);return Q.PositionAndShape.RelativePosition=Z,Q.PositionAndShape.RelativePosition.x-U.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const D=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),R=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let F=R;F<=D;F++){const G=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[F];this.dynamicExpressionMap.clear();for(let j=0;j=0;U--)if((j=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U])!=null&&j.StaffEntries[R])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U].StaffEntries[R]}getFirstRightNotNullStaffEntryFromContainer(D,R,F){var G,j;if((G=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[D])!=null&&G.StaffEntries[R])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[D].StaffEntries[R];for(let U=D+1;U0||R.StaffLinkedExpressions[F][G].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(R.StaffLinkedExpressions[F][G],D,F)}}calculateStemDirectionFromVoices(D){if(D.ParentSourceStaffEntry.Link!==void 0)if(D===D.ParentSourceStaffEntry.VoiceEntries[0]){D.WantedStemDirection=StemDirectionType.Up;return}else{D.WantedStemDirection=StemDirectionType.Down;return}else D.ParentVoice instanceof LinkedVoice?D.WantedStemDirection=StemDirectionType.Down:D.ParentSourceStaffEntry.VoiceEntries.length>1&&(D.WantedStemDirection=StemDirectionType.Up)}setBeamNotesWantedStemDirections(D){if(!(D.Notes.length>0))return;const R=D.Notes[0].NoteBeam;if(R){for(const F of R.Notes)if(F.ParentVoiceEntry.WantedStemDirection!==StemDirectionType.Undefined&&F.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===D.ParentSourceStaffEntry.ParentStaff.Id){D.WantedStemDirection=F.ParentVoiceEntry.WantedStemDirection;break}}}}class ChordSymbolContainer{constructor(D,R,F,G,j){this.rootPitch=D,this.chordKind=R,this.bassPitch=F,this.degrees=G,this.rules=j}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(D,R,F){let G=D.RootPitch;if(MusicSheetCalculator.transposeCalculator&&(G=MusicSheetCalculator.transposeCalculator.transposePitch(D.RootPitch,F,R)),D.ChordKind===ChordSymbolEnum.none)return D.getTextFromChordKindEnum(D.ChordKind);let j=Pitch.getNoteEnumString(G.FundamentalNote);G.Accidental!==AccidentalEnum.NONE&&(j+=this.getTextForAccidental(G.Accidental));const U={adds:[],alts:[],subs:[]};for(const Z of D.ChordDegrees)if(Z){let q="";switch(Z.alteration!==AccidentalEnum.NONE&&(q+=this.getTextForAccidental(Z.alteration)),q+=Z.value,Z.text){case ChordDegreeText.add:U.adds.push(q);break;case ChordDegreeText.alter:U.alts.push(q);break;case ChordDegreeText.subtract:U.subs.push(q);break}}let W=D.getTextFromChordKindEnum(D.ChordKind);const Y=["adds","alts","subs"],Q=D.rules.CustomChords;for(const Z of Q){if(Z.chordKind!==D.chordKind)continue;let q=!0;for(const J of Y){for(const K of Z.degrees[J]||[])if(U[J].indexOf(K)<0){q=!1;break}if(!q)break}if(q){for(const J of Y)for(const K of Z.degrees[J]||[])U[J].splice(U[J].indexOf(K),1);W=Z.alternateName}}if(j+=W,U.adds.length>0&&(j+="("+U.adds.join(",")+")"),U.alts.length>0&&(j+="(alt "+U.alts.join(",")+")"),U.subs.length>0&&(j+="(omit "+U.subs.join(",")+")"),D.BassPitch){let Z=D.BassPitch;MusicSheetCalculator.transposeCalculator&&(Z=MusicSheetCalculator.transposeCalculator.transposePitch(D.BassPitch,F,R)),j+="/",j+=Pitch.getNoteEnumString(Z.FundamentalNote),j+=this.getTextForAccidental(Z.Accidental)}return j}static getTextForAccidental(D){let R="";switch(D){case AccidentalEnum.DOUBLEFLAT:R+="bb";break;case AccidentalEnum.FLAT:R+="b";break;case AccidentalEnum.SHARP:R+="#";break;case AccidentalEnum.DOUBLESHARP:R+="x";break}return R}getTextFromChordKindEnum(D){var R;return(R=this.rules.ChordSymbolLabelTexts.getValue(D))!=null?R:""}}class Degree{constructor(D,R,F){this.value=D,this.alteration=R,this.text=F}}class CustomChord{constructor(D,R,F){this.alternateName=D,this.chordKind=R,this.degrees=F}static createCustomChord(D,R,F){return new CustomChord(D,R,F)}static renameCustomChord(D,R,F){for(const G of F)G.alternateName===D&&(G.alternateName=R)}}var ChordDegreeText=(B=>(B[B.add=0]="add",B[B.alter=1]="alter",B[B.subtract=2]="subtract",B))(ChordDegreeText||{}),ChordSymbolEnum=(B=>(B[B.major=0]="major",B[B.minor=1]="minor",B[B.augmented=2]="augmented",B[B.diminished=3]="diminished",B[B.dominant=4]="dominant",B[B.majorseventh=5]="majorseventh",B[B.minorseventh=6]="minorseventh",B[B.diminishedseventh=7]="diminishedseventh",B[B.augmentedseventh=8]="augmentedseventh",B[B.halfdiminished=9]="halfdiminished",B[B.majorminor=10]="majorminor",B[B.majorsixth=11]="majorsixth",B[B.minorsixth=12]="minorsixth",B[B.dominantninth=13]="dominantninth",B[B.majorninth=14]="majorninth",B[B.minorninth=15]="minorninth",B[B.dominant11th=16]="dominant11th",B[B.major11th=17]="major11th",B[B.minor11th=18]="minor11th",B[B.dominant13th=19]="dominant13th",B[B.major13th=20]="major13th",B[B.minor13th=21]="minor13th",B[B.suspendedsecond=22]="suspendedsecond",B[B.suspendedfourth=23]="suspendedfourth",B[B.Neapolitan=24]="Neapolitan",B[B.Italian=25]="Italian",B[B.French=26]="French",B[B.German=27]="German",B[B.pedal=28]="pedal",B[B.power=29]="power",B[B.Tristan=30]="Tristan",B[B.none=31]="none",B))(ChordSymbolEnum||{});class GraphicalNote extends GraphicalObject{constructor(D,R,F,G=void 0){super(),this.DrawnAccidental=AccidentalEnum.NONE,this.lineShift=0,this.sourceNote=D,this.parentVoiceEntry=R,this.PositionAndShape=new BoundingBox$2(this,R.PositionAndShape),G?this.graphicalNoteLength=G:this.graphicalNoteLength=D.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=F,this.rules.addGraphicalNoteToNoteMap(D,this)}Transpose(D,R,F,G){let j=this.sourceNote.Pitch;return MusicSheetCalculator.transposeCalculator&&(j=MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,D,F)),j}calculateNumberOfNeededDots(D){return!this.sourceNote||!this.sourceNote.NoteTuplet?D.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}static FromNote(D,R){return R.NoteToGraphicalNoteMap.getValue(D.NoteToGraphicalNoteObjectId)}}const _EngravingRules=class{constructor(){this.DYSlursStartingAtSameStaffEntryYOffset=0,this.DYMinNoteWidth=0,this.DYWorkId=0,this.DYWorkSpecial=!1,this.DYContainerId="osmdCanvasPage",this.DYSVGContainerId="osmdSvgPage",this.DYMusicScoreType="staff",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=_EngravingRules.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=_EngravingRules.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=_EngravingRules.unit/2,this.BeamSpaceWidth=_EngravingRules.unit/3,this.BeamForwardLength=1.25*_EngravingRules.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*_EngravingRules.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*_EngravingRules.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=_EngravingRules.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=_EngravingRules.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=_EngravingRules.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,_EngravingRules.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(B){log$2.info("EngravingRules()",B)}this.MpatMode&&(this.NewPartAndSystemAfterFinalBarline=!0)}applyDefaultColorMusic(B){this.DefaultColorMusic=B,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(B,D){B.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(B.NoteToGraphicalNoteObjectId,D),this.NoteToGraphicalNoteMapObjectCount++}GNote(B){return GraphicalNote.FromNote(B,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(B,D){this.ChordSymbolLabelTexts.setValue(B,D)}resetChordSymbolLabelTexts(B){return B.setValue(ChordSymbolEnum.minor,"m"),B.setValue(ChordSymbolEnum.augmented,"aug"),B.setValue(ChordSymbolEnum.diminished,"dim"),B.setValue(ChordSymbolEnum.dominant,"7"),B.setValue(ChordSymbolEnum.majorseventh,"maj7"),B.setValue(ChordSymbolEnum.minorseventh,"m7"),B.setValue(ChordSymbolEnum.diminishedseventh,"dim7"),B.setValue(ChordSymbolEnum.augmentedseventh,"aug7"),B.setValue(ChordSymbolEnum.halfdiminished,"m7b5"),B.setValue(ChordSymbolEnum.majorminor,"m(maj7)"),B.setValue(ChordSymbolEnum.majorsixth,"maj6"),B.setValue(ChordSymbolEnum.minorsixth,"m6"),B.setValue(ChordSymbolEnum.dominantninth,"9"),B.setValue(ChordSymbolEnum.majorninth,"maj9"),B.setValue(ChordSymbolEnum.minorninth,"m9"),B.setValue(ChordSymbolEnum.dominant11th,"11"),B.setValue(ChordSymbolEnum.major11th,"maj11"),B.setValue(ChordSymbolEnum.minor11th,"m11"),B.setValue(ChordSymbolEnum.dominant13th,"13"),B.setValue(ChordSymbolEnum.major13th,"maj13"),B.setValue(ChordSymbolEnum.minor13th,"m13"),B.setValue(ChordSymbolEnum.suspendedsecond,"sus2"),B.setValue(ChordSymbolEnum.suspendedfourth,"sus4"),B.setValue(ChordSymbolEnum.power,"5"),B.setValue(ChordSymbolEnum.none,"N.C."),B}addChordName(B,D,R,F,G){if(ChordSymbolEnum[D]!==void 0){const j={adds:R,alts:F,subs:G};this.CustomChords.push(CustomChord.createCustomChord(B,ChordSymbolEnum[D],j))}}renameChord(B,D){CustomChord.renameCustomChord(B,D,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 B=0;B(B[B.XML=0]="XML",B[B.AutoColoring=1]="AutoColoring",B[B.CustomColorSet=2]="CustomColorSet",B))(ColoringModes||{}),DrawingParametersEnum=(B=>(B.allon="allon",B.compact="compact",B.compacttight="compacttight",B.default="default",B.leadsheet="leadsheet",B.preview="preview",B.thumbnail="thumbnail",B))(DrawingParametersEnum||{});class DrawingParameters{constructor(D="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=D}set DrawingParametersEnum(D){switch(this.drawingParametersEnum=D,D){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(D){this.drawCredits=D,this.DrawComposer=D,this.DrawTitle=D,this.DrawSubtitle=D,this.DrawLyricist=D}get DrawTitle(){return this.drawTitle}set DrawTitle(D){this.drawTitle=D,this.rules.RenderTitle=D,D||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(D){this.drawSubtitle=D,this.rules.RenderSubtitle=D,D&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(D){this.drawComposer=D,this.rules.RenderComposer=D}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(D){this.drawLyricist=D,this.rules.RenderLyricist=D}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(D){this.drawPartNames=D,this.rules.RenderPartNames=D,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(D){this.fingeringPosition=D,this.rules.FingeringPosition=D}get Rules(){return this.rules}set Rules(D){this.rules=D}}var AlignRestOption=(B=>(B[B.Never=0]="Never",B[B.Always=1]="Always",B[B.Auto=2]="Auto",B))(AlignRestOption||{}),FillEmptyMeasuresWithWholeRests=(B=>(B[B.No=0]="No",B[B.YesVisible=1]="YesVisible",B[B.YesInvisible=2]="YesInvisible",B))(FillEmptyMeasuresWithWholeRests||{}),BackendType=(B=>(B[B.SVG=0]="SVG",B[B.Canvas=1]="Canvas",B))(BackendType||{});class OSMDOptions{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:DrawingParametersEnum.default}}static BackendTypeFromString(D){return D&&D.toLowerCase()==="canvas"?1:0}}class IXmlElement{constructor(D){if(this.hasAttributes=!1,!D)throw new Error("IXmlElement: expected Element, got undefined");this.elem=D,this.name=D.nodeName.toLowerCase(),D.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=D.attributes[0]),this.hasElements=D.hasChildNodes(),D.childNodes.length===1&&D.childNodes[0].nodeType===Node.TEXT_NODE?this.value=D.childNodes[0].nodeValue:this.value=""}attribute(D){return this.elem.attributes.getNamedItem(D)}attributes(){if(!this.attrs){const D=this.elem.attributes,R=[];for(let F=0;F0?this.Voices[0].Visible:!1}set Visible(D){for(let R=0,F=this.Voices.length;R-1&&this.parent.MusicSystems.splice(R,1)}this.parent=D,this.boundingBox.Parent=D.PositionAndShape}get NextSystem(){const D=this.Parent.MusicSystems.indexOf(this);return D!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[D+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(D,R,F){let G=-D/2;F&&(G=this.maxLabelLength+R-D/2);const j=this.staffLines[0].Measures[0];let U;this.staffLines.length>1&&(U=this.staffLines[this.staffLines.length-1].Measures[0]);const W=this.createSystemLine(G,D,SystemLinesEnum.SingleThin,SystemLinePosition.MeasureBegin,this,j,U);this.SystemLines.push(W),W.PositionAndShape.RelativePosition=new PointF2D(G,0),W.PositionAndShape.BorderLeft=0,W.PositionAndShape.BorderRight=D,W.PositionAndShape.BorderTop=0,W.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(W)}createVerticalLineForMeasure(D,R,F,G,j,U){const W=U.ParentStaffLine,Y=new PointF2D(W.PositionAndShape.RelativePosition.x,W.PositionAndShape.RelativePosition.y),Q=W.ParentStaff.ParentInstrument.Staves;if(W.ParentStaff===Q[0]){let Z;Q.length>1&&(Z=this.getBottomStaffLine(W).Measures[j]);const q=this.createSystemLine(D,R,F,G,this,U,Z),J=Y.x+D;q.PositionAndShape.RelativePosition=new PointF2D(J,0),q.PositionAndShape.BorderLeft=0,q.PositionAndShape.BorderRight=R,this.SystemLines.push(q)}}setYPositionsToVerticalLineObjectsAndCreateLines(D){}calculateBorders(D){}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(D){for(let R=0,F=D.length;R1){let U,W;for(let Y=0,Q=this.staffLines.length;Ythis.maxLabelLength&&(this.maxLabelLength=Z.PositionAndShape.Size.width,R=j)}this.updateMusicSystemStaffLineXPosition(R)}setMusicSystemLabelsYPosition(){this.labels.forEach((D,R)=>{let F=0,G=0;for(let j=0;j0&&(R.PositionAndShape.RelativePosition=new PointF2D(0,F/G+2))})}checkStaffEntriesForStaffEntryLink(){let D=!1,R=!1;for(let F=0;F=0;F--){if(R=D.InstrumentalGroups[F],R instanceof Instrument){if(R.Visible===!0)return R;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(R)}}updateMusicSystemStaffLineXPosition(D){for(let R=0,F=this.StaffLines.length;R1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let D=new Fraction$1(0,1);const R=[];for(let F=0,G=this.staffEntries.length;F0&&U.Add(Y.notes[0].graphicalNoteLength);D.lt(U)&&(D=Fraction$1.createFromFraction(U))}return D}addGraphicalStaffEntry(D){this.staffEntries.push(D)}addGraphicalStaffEntryAtTimestamp(D){if(D)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(D.relInMeasureTimestamp))this.staffEntries.push(D);else for(let R=this.staffEntries.length-1;R>=0;R--){if(this.staffEntries[R].relInMeasureTimestamp.lt(D.relInMeasureTimestamp)){this.staffEntries.splice(R+1,0,D);break}R===0&&this.staffEntries.splice(R,0,D)}}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 D=this.parentSourceMeasure;return D?D.beginsWithLineRepetition():!1}endsWithLineRepetition(){const D=this.parentSourceMeasure;return D?D.endsWithLineRepetition():!1}beginsWithWordRepetition(){const D=this.parentSourceMeasure;return D?D.beginsWithWordRepetition():!1}endsWithWordRepetition(){const D=this.parentSourceMeasure;return D?D.endsWithWordRepetition():!1}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}Vex.Flow;class VexFlowVoiceEntry extends GraphicalVoiceEntry{constructor(D,R){super(D,R)}applyBordersFromVexflow(){const D=this.vfStaveNote;if(!D.getNoteHeadBeginX)return;const R=D.getBoundingBox(),F=D.getNoteHeadBeginX()-R.x;this.PositionAndShape.RelativePosition.y=R.y/unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=R.h/unitInPixels,this.PositionAndShape.BorderLeft=-(F+D.width/2)/unitInPixels,this.PositionAndShape.BorderRight=(R.w-F)/unitInPixels}set vfStaveNote(D){this.mVexFlowStaveNote=D}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var J;const D=this.rules.DefaultColorNotehead,R=this.rules.DefaultColorRest,F=this.rules.DefaultColorStem,G="#00000000";let j,U;const W=this.vfStaveNote;for(let K=0;KY.symbol_type===R))return;const W=new VF$9.Repetition(R,G,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(W,F);return}this.addVolta(D)}addVolta(D){var F;let R=VF$9.Volta.type.BEGIN;if(D.type===RepetitionInstructionEnum.Ending){switch(D.alignment){case AlignmentType.Begin:this.parentSourceMeasure.endsRepetitionEnding()?R=VF$9.Volta.type.BEGIN_END:R=VF$9.Volta.type.BEGIN;break;case AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;R=VF$9.Volta.type.END;break}const G=this.ParentStaffLine.SkyBottomLineCalculator,j=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,U=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,j+.4),W=G.getSkyLineMinInRange(j,U)-2;let Y=-6.1+this.rules.VoltaOffset,Q=this.rules.VoltaOffset;W0){log$2.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const q=this.createGhostGves(Z);F.splice(U,0,...q),U+=q.length}}else{const Z=Fraction$1.minus(Y,this.parentSourceMeasure.AbsoluteTimestamp);if(Z.RealValue>0){log$2.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);const q=this.createGhostGves(Z);F.splice(0,0,...q),U+=q.length}}R=Q}const G=Fraction$1.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),j=Fraction$1.minus(G,R);if(j.RealValue>0){log$2.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const U=this.createGhostGves(j);F=F.concat(U)}return F}createGhostGves(D){const R=VexFlowConverter.GhostNotes(D),F=[];for(const G of R){const j=new VexFlowVoiceEntry(void 0,void 0);j.vfStaveNote=G,F.push(j)}return F}handleBeam(D,R){const F=D.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let G=this.beams[F];G||(G=this.beams[F]=[]);let j;for(const W of G)W[0]===R&&(j=W);j||(j=[R,[]],G.push(j));const U=D.parentVoiceEntry;j[1].indexOf(U)<0&&j[1].push(U)}handleTuplet(D,R){const F=D.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;R=D.sourceNote.NoteTuplet;let G=this.tuplets[F];G||(G=this.tuplets[F]=[]);let j;for(const W of G)W[0]===R&&(j=W);j||(j=[R,[]],G.push(j));const U=D.parentVoiceEntry;j[1].indexOf(U)<0&&j[1].push(U)}finalizeBeams(){this.vfbeams={};const D=[];for(const R in this.beams)if(this.beams.hasOwnProperty(R)){let F=this.vfbeams[R];F||(F=this.vfbeams[R]=[]);for(const G of this.beams[R]){let j=!1;for(const K of G[0].Notes)if(K.Length.RealValue>=new Fraction$1(1,4).RealValue&&(!K.TypeLength||K.TypeLength.RealValue>.125)){j=!0;break}if(j){log$2.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const U=[],W=G[0],Y=G[1];let Q=!0;for(const K of Y)K.parentVoiceEntry.ParentVoice===W.Notes[0].ParentVoiceEntry.ParentVoice&&(Q=K.parentVoiceEntry.WantedStemDirection===StemDirectionType.Undefined);let Z=!1,q;const J=[];for(const K of Y){const te=K.vfStaveNote;te&&(U.push(te),D.push(te)),K.parentVoiceEntry.IsGrace&&(Z=!0),K.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&J.push(K.parentVoiceEntry.StemColor)}if(U.length>1){const K=new VF$9.Beam(U,Q);if(Z&&(K.render_options.beam_width=3,K.render_options.partial_beam_length=4),J.length>=2&&this.rules.ColorBeams){q=J[0];for(const te of J)if(te!==q){q=void 0;break}K.setStyle({fillStyle:q,strokeStyle:q})}this.rules.FlatBeams&&(K.render_options.flat_beams=!0,K.render_options.flat_beam_offset=this.rules.FlatBeamOffset,K.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),F.push(K)}else log$2.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(D)}autoBeamNotes(D){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let R=[],F=[],G,j=[];this.autoTupletVfBeams=[];const U=[];this.autoVfBeams=[];let W=this.parentSourceMeasure.ActiveTimeSignature;W||(W=this.parentSourceMeasure.Duration);for(const Z of this.staffEntries)for(const q of Z.graphicalVoiceEntries){const J=q.vfStaveNote,K=q.notes[0],te=Z.relInMeasureTimestamp.isOnBeat(W),ne=F.length>=2,ie=K.sourceNote.Length.RealValue-new Fraction$1(1,4).RealValue>-Fraction$1.FloatInaccuracyTolerance,re=q.parentVoiceEntry.IsGrace||ie||D.contains(J);if(re||te){if(ne){for(const le of F)R.push(le);U.push(R.slice()),R=[]}if(F=[],re)continue}const oe=q.notes[0].sourceNote.NoteTuplet;if(oe){let le=!1;for(const fe of oe.Notes){for(const he of fe)if(he.NoteTypeXml>=NoteType.QUARTER||he.ParentVoiceEntry.IsGrace||he.isRest()&&!this.rules.AutoBeamOptions.beam_rests){le=!0;break}if(le)break}if(!G)G=oe;else if(G!==oe){if(j.length>1){const fe=new VF$9.Beam(j,!0);this.rules.FlatBeams&&(fe.render_options.flat_beams=!0,fe.render_options.flat_beam_offset=this.rules.FlatBeamOffset,fe.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(fe)}j=[],G=oe}le||j.push(J);continue}else G=void 0;F.push(J)}if(j.length>=2){const Z=new VF$9.Beam(j,!0);this.rules.FlatBeams&&(Z.render_options.flat_beams=!0,Z.render_options.flat_beam_offset=this.rules.FlatBeamOffset,Z.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(Z)}if(F.length>=2){for(const Z of F)R.push(Z);U.push(R)}const Y=this.rules.AutoBeamOptions,Q={beam_middle_only:Y.beam_middle_rests_only,beam_rests:Y.beam_rests,maintain_stem_directions:Y.maintain_stem_directions};if(Y.groups&&Y.groups.length){const Z=[];for(const q of Y.groups)Z.push(new VF$9.Fraction(q[0],q[1]));Q.groups=Z}for(const Z of U){const q=VF$9.Beam.generateBeams(Z,Q);for(const J of q)this.rules.FlatBeams&&(J.render_options.flat_beams=!0,J.render_options.flat_beam_offset=this.rules.FlatBeamOffset,J.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(J)}}finalizeTuplets(){this.vftuplets={};for(const D in this.tuplets)if(this.tuplets.hasOwnProperty(D)){let R=this.vftuplets[D];R||(R=this.vftuplets[D]=[]);for(const F of this.tuplets[D]){const G=[],j=F[1];for(const U of j)G.push(U.vfStaveNote);if(G.length>1){const U=F[0],W=U.Notes[0][0].NormalNotes,Y=U.Bracket||U.TupletLabelNumber===3&&this.rules.TripletsBracketed||U.TupletLabelNumber!==3&&this.rules.TupletsBracketed;let Q=VF$9.Tuplet.LOCATION_TOP;U.tupletLabelNumberPlacement===PlacementEnum.Below&&(Q=VF$9.Tuplet.LOCATION_BOTTOM),R.push(new VF$9.Tuplet(G,{bracketed:Y,location:Q,notes_occupied:W,num_notes:U.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else log$2.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(D){}graphicalMeasureCreatedCalculations(){let D,R=[];const F=[];for(const j of this.staffEntries){D=!1,R=[];for(const U of j.graphicalVoiceEntries){if(U.parentVoiceEntry.IsGrace){R.push(U),F.push(U),D||(D=U.parentVoiceEntry.GraceSlur);continue}if(U.vfStaveNote=VexFlowConverter.StaveNote(U),R.length>0){const W=[];for(let Q=0;Q0&&(Z.GraceSlash=!1);const q=VexFlowConverter.StaveNote(Z);Z.vfStaveNote=q,W.push(q)}const Y=new VF$9.GraceNoteGroup(W,D);U.vfStaveNote.addModifier(0,Y),R=[]}}}if(R.length>0)for(const j of R)j.vfStaveNote=VexFlowConverter.StaveNote(j),j.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const G=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const j of this.staffEntries)j.setModifierXOffsets();for(const j of G){if(!j)continue;this.vfVoices[j.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 U=this.getRestFilledVexFlowStaveNotesPerVoice(j);for(const W of U){if(W.parentVoiceEntry&&W.parentVoiceEntry.IsGrace&&!W.parentVoiceEntry.GraceAfterMainNote)continue;const Y=W;if(Y.vfStaveNote.ticks.denominator===0)continue;if(W.notes.length===0||!W.notes[0]||!W.notes[0].sourceNote.PrintObject){this.vfVoices[j.VoiceId].addTickable(Y.vfStaveNote);continue}const Q=Y.parentStaffEntry;if(Q&&Q.vfClefBefore){const Z=new NoteSubGroup([Q.vfClefBefore]);Y.vfStaveNote.getCategory&&Y.vfStaveNote.getCategory()==="stavenotes"&&Y.vfStaveNote.addModifier(0,Z)}W.parentVoiceEntry&&this.rules.RenderFingerings&&((this.rules.FingeringPosition===PlacementEnum.Left||this.rules.FingeringPosition===PlacementEnum.Right)&&this.createFingerings(W),this.createStringNumber(W)),this.createArpeggio(W),this.vfVoices[j.VoiceId].addTickable(Y.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(const j of F)this.createFingerings(j),this.createStringNumber(j),this.createArpeggio(j);this.createArticulations(),this.createOrnaments()}createArpeggio(D){if(D.parentVoiceEntry&&D.parentVoiceEntry.Arpeggio){const R=D.parentVoiceEntry.Arpeggio;if(D.notes&&D.notes.length>1){const F=VexFlowConverter.StrokeTypeFromArpeggioType(R.type),G=new VF$9.Stroke(F,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&D.vfStaveNote.addStroke(0,G)}else log$2.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}}setStemDirectionFromVexFlow(){for(const D of this.staffEntries)for(const R of D.graphicalVoiceEntries)for(const F of R.notes){const G=F.vfnote;if(!G||!G[0])continue;switch(G[0].getStemDirection()){case VF$9.Stem.UP:R.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case VF$9.Stem.DOWN:R.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}}createArticulations(){for(let D=0,R=this.staffEntries.length;D1||D.parentStaffEntry.graphicalVoiceEntries.length>1?Q=VF$9.StaveModifier.Position.LEFT:q.idInMusicSheet===0?(Q=VF$9.StaveModifier.Position.ABOVE,W=PlacementEnum.Above):(Q=VF$9.StaveModifier.Position.BELOW,W=PlacementEnum.Below)}const Z=new VF$9.FretHandFinger(U.value);if(Z.setPosition(Q),Z.setOffsetX(Y),W===PlacementEnum.Above||W===PlacementEnum.Below){const q=W===PlacementEnum.Above?-1:1,J=W===PlacementEnum.Above?G:F-1-G;if(this.rules.FingeringInsideStafflines&&F>1){const K=Z.getWidth()/2,te=F*2.5;Z.setOffsetY(q*(J+te)*K)}else if(!this.rules.FingeringInsideStafflines){const K=new VF$9.StringNumber(U.value);K.radius=0,K.setPosition(Q),K.setOffsetY(q*J*K.getWidth()*2/3),R.vfStaveNote.addModifier(G,K);continue}}R.vfStaveNote.addModifier(G,Z)}}createStringNumber(D){if(!this.rules.RenderStringNumbersClassical)return;const R=D;D.notes.forEach((F,G)=>{const j=F.sourceNote.StringInstruction;if(j){let U=j.value;switch(U){case"1":U="I";break;case"2":U="II";break;case"3":U="III";break;case"4":U="IV";break;case"5":U="V";break;case"6":U="VI";break}const W=new VF$9.StringNumber(U);W.radius=0;const Y=-this.rules.StringNumberOffsetY;D.notes.length>1||D.parentStaffEntry.graphicalVoiceEntries.length>1?(W.setOffsetX(F.baseStringNumberXOffset*13),W.setPosition(VF$9.Modifier.Position.RIGHT)):W.setPosition(VF$9.Modifier.Position.ABOVE),W.setOffsetY(Y),R.vfStaveNote.addModifier(G,W)}})}lineTo(D,R){const F=new VF$9.StaveConnector(D.getVFStave(),this.stave);F.setType(R),this.connectors.push(F)}getVFStave(){return this.stave}updateInstructionWidth(){let D=0,R=0;const F=this.stave.getModifiers();for(const G of F)G.getPosition()===StavePositionEnum.BEGIN?D+=G.getWidth()+G.getPadding(void 0):G.getPosition()===StavePositionEnum.END&&(R+=G.getWidth()+G.getPadding(void 0));this.beginInstructionsWidth=(D!=null?D:0)/unitInPixels,this.endInstructionsWidth=(R!=null?R:0)/unitInPixels}addStaveTie(D,R){this.vfTies.push(D),R.vfTie=D}}var StavePositionEnum=(B=>(B[B.LEFT=1]="LEFT",B[B.RIGHT=2]="RIGHT",B[B.ABOVE=3]="ABOVE",B[B.BELOW=4]="BELOW",B[B.BEGIN=5]="BEGIN",B[B.END=6]="END",B))(StavePositionEnum||{});class GraphicalStaffEntry extends GraphicalObject{constructor(D,R=void 0,F=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=D,this.graphicalVoiceEntries=[],this.sourceStaffEntry=R,F?(this.staffEntryParent=F,this.parentVerticalContainer=F.parentVerticalContainer,this.PositionAndShape=new BoundingBox$2(this,F.PositionAndShape)):this.PositionAndShape=new BoundingBox$2(this,D.PositionAndShape),R&&(this.relInMeasureTimestamp=R.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(D){this.lyricsEntries=D}getAbsoluteTimestamp(){const D=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&D.Add(this.relInMeasureTimestamp),D}findTieGraphicalNoteFromNote(D){for(const R of this.graphicalVoiceEntries)for(const F of R.notes){const G=F.sourceNote;if(!G.isRest()&&G.Pitch.FundamentalNote===D.Pitch.FundamentalNote&&G.Pitch.Octave===D.Pitch.Octave&&G.getAbsoluteTimestamp().Equals(D.getAbsoluteTimestamp()))return F}}findEndTieGraphicalNoteFromNoteWithStartingSlur(D,R){if(!!D){for(const F of this.graphicalVoiceEntries)if(F.parentVoiceEntry===D.ParentVoiceEntry)for(const G of F.notes){const j=G.sourceNote;if(j.NoteTie&&j.NoteSlurs.indexOf(R)!==-1)return G}}}findGraphicalNoteFromGraceNote(D){if(!!D){for(const R of this.graphicalVoiceEntries)if(R.parentVoiceEntry===D.ParentVoiceEntry){for(const F of R.notes)if(F.sourceNote===D)return F}}}findGraphicalNoteFromNote(D){if(!!D){for(const R of this.graphicalVoiceEntries)if(R.parentVoiceEntry===D.ParentVoiceEntry){for(const F of R.notes)if(F.sourceNote===D&&this.getAbsoluteTimestamp().Equals(D.getAbsoluteTimestamp()))return F}}}getGraphicalNoteDurationFromVoice(D){for(const R of this.graphicalVoiceEntries)if(R.parentVoiceEntry.ParentVoice===D)return R.notes[0].graphicalNoteLength;return new Fraction$1(0,1)}findVoiceEntryGraphicalNotes(D){for(const R of this.graphicalVoiceEntries)if(R.parentVoiceEntry===D)return R.notes}isVoiceEntryPartOfLinkedVoiceEntry(D){if(this.sourceStaffEntry.Link)for(let R=0,F=this.sourceStaffEntry.Link.LinkStaffEntries.length;R0&&(D=G)}return D}findStaffEntryMaxNoteLength(){let D=new Fraction$1(0,1);for(const R of this.graphicalVoiceEntries)for(const F of R.notes){const G=F.graphicalNoteLength;D.lt(G)&&G.GetExpandedNumerator()>0&&(D=G)}return D}findOrCreateGraphicalVoiceEntry(D){for(const F of this.graphicalVoiceEntries)if(F.parentVoiceEntry===D)return F;const R=MusicSheetCalculator.symbolFactory.createVoiceEntry(D,this);return this.graphicalVoiceEntries.push(R),R}findOrCreateGraphicalVoiceEntryFromGraphicalNote(D){for(const F of this.graphicalVoiceEntries)if(F===D.parentVoiceEntry)return F;const R=MusicSheetCalculator.symbolFactory.createVoiceEntry(D.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(R),R}addGraphicalNoteToListAtCorrectYPosition(D,R){const F=D.notes;if(F.length===0||R.PositionAndShape.RelativePosition.y=0;G--){if(F[G].PositionAndShape.RelativePosition.y>R.PositionAndShape.RelativePosition.y){F.splice(G+1,0,R);break}if(G===0){F.splice(0,0,R);break}}}hasOnlyRests(){for(const R of this.graphicalVoiceEntries)for(const F of R.notes)if(!F.sourceNote.isRest())return!1;return!0}getSkylineMin(){var G;const D=(G=this.parentMeasure)==null?void 0:G.ParentStaffLine.SkyBottomLineCalculator;if(!D)return;const[R,F]=this.getAbsoluteStartAndEnd();return D.getSkyLineMinInRange(R,F)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var G;const D=(G=this.parentMeasure)==null?void 0:G.ParentStaffLine.SkyBottomLineCalculator;if(!D)return;const[R,F]=this.getAbsoluteStartAndEnd();return D.getBottomLineMaxInRange(R,F)}getAbsoluteStartAndEnd(){let D=this.PositionAndShape.AbsolutePosition.x;D-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;const R=D+this.PositionAndShape.Size.width;return[D,R]}}const VF$8=Vex.Flow;class VexFlowStaffEntry extends GraphicalStaffEntry{constructor(D,R,F){super(D,R,F)}calculateXPosition(){const D=this.parentMeasure.getVFStave();let R=0;for(const F of this.graphicalVoiceEntries)if(F.vfStaveNote){if(F.vfStaveNote.setStave(D),D&&D.getLines&&D.getLines()===1&&F.vfStaveNote.getStemDirection()<0&&(F.vfStaveNote.setStemDirection(VF$8.Stem.UP),F.parentVoiceEntry.StemDirection=StemDirectionType.Up),!F.vfStaveNote.preFormatted)continue;F.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(F.vfStaveNote.getAbsoluteX()+F.vfStaveNote.glyph.getWidth())/unitInPixels:this.PositionAndShape.RelativePosition.x=F.vfStaveNote.getBoundingBox().getX()/unitInPixels;const G=F.notes[0].sourceNote;G.isRest()&&G.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,F.PositionAndShape.BorderLeft=-.7,F.PositionAndShape.BorderRight=.7),F.PositionAndShape.BorderLeftj.staffLine),F=this.calculateModifierXOffsets(R,1),G=this.calculateModifierXOffsets(R,.5);D.forEach((j,U)=>{j.baseFingeringXOffset=G[U],j.baseStringNumberXOffset=F[U]})}calculateModifierXOffsets(D,R){const F=[];for(let G=0;G=0;W--){if(Math.abs(D[G]-D[W])<=R&&j===F[W]){j++,U=!0;break}U=!1}F.push(j)}return F}}Vex.Flow;class VexFlowGraphicalNote extends GraphicalNote{constructor(D,R,F,G=OctaveEnum.NONE,j,U=void 0){if(super(D,R,j,U),this.clef=F,this.octaveShift=G,D.Pitch){const W=D.isRest()?D.Pitch:OctaveShift.getPitchFromOctaveShift(D.Pitch,G);this.vfpitch=VexFlowConverter.pitch(W,D.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(D){const R=this.drawPitch(D);this.vfpitch=VexFlowConverter.pitch(R,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=R.Accidental}drawPitch(D){return OctaveShift.getPitchFromOctaveShift(D,this.octaveShift)}Transpose(D,R,F,G){const j=super.Transpose(D,R,F,G),U=OctaveShift.getPitchFromOctaveShift(j,this.octaveShift);return this.vfpitch=VexFlowConverter.pitch(U,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,U}setIndex(D,R){this.vfnote=[D,R],this.vfnoteIndex=R}notehead(D=void 0){let R=D;R||(R=this.vfnote[0]);const F=R.note_heads;return F&&F.length>this.vfnoteIndex&&F[this.vfnoteIndex]?R.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 D=[];for(let R=0;;R++){const F=document.getElementById(`vf-${this.getSVGId()}-beam${R}`);if(!F)break;D.push(F)}return D}}class GraphicalChordSymbolContainer extends GraphicalObject{constructor(D,R,F,G,j,U){super(),this.chordSymbolContainer=D,this.boundingBox=new BoundingBox$2(this,R),this.rules=U,this.calculateLabel(F,j,G)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(D,R,F){const G=ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,R,F);this.graphicalLabel=new GraphicalLabel(new Label(G),D,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(D,R=void 0,F=void 0){super(D,R,F),this.isTabMeasure=!0}resetLayout(){var R;const D=(R=this.ParentStaff.StafflineCount)!=null?R:6;this.stave=new VF$7.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:D}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let R=0,F=this.staffEntries.length;R1){const W=VexFlowConverter.StrokeTypeFromArpeggioType(U.type),Y=new VF$7.Stroke(W,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&j.vfStaveNote.addStroke(0,Y)}else log$2.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}this.vfVoices[R.VoiceId].addTickable(j.vfStaveNote)}}}}class StaffLine extends GraphicalObject{constructor(D,R){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.Pedals=[],this.WavyLines=[],this.parentMusicSystem=D,this.parentStaff=R,this.boundingBox=new BoundingBox$2(this,D.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(D){this.measures=D}get StaffLines(){return this.staffLines}set StaffLines(D){this.staffLines=D}get Index(){return this.parentMusicSystem.StaffLines.indexOf(this)}get NextStaffLine(){const D=this.Index;return D!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[D+1]:void 0}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(D){this.abstractExpressions=D}set LyricLines(D){this.lyricLines=D}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(D){this.lyricsDashes=D}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(D){this.parentMusicSystem=D}get ParentStaff(){return this.parentStaff}set ParentStaff(D){this.parentStaff=D}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(D){this.octaveShifts=D}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}addSlurToStaffline(D){this.graphicalSlurs.push(D)}addActivitySymbolClickArea(){const D=new StaffLineActivitySymbol(this),R=this.PositionAndShape;D.PositionAndShape.RelativePosition=new PointF2D(R.RelativePosition.x+R.BorderRight+.5,R.RelativePosition.y+.5),D.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(D){let R;for(let F=0,G=this.Measures.length;F0){const U=j.map(Y=>Y.PositionAndShape.Center.y),W=Math.max(...U);for(let Y=0;Y0?j[Y-1]:void 0;if(q){const K=this.getOverlap(Q.PositionAndShape,q.PositionAndShape);Q.squeeze(-(K.x+this.rules.DynamicExpressionSpacer))}if(J){const K=this.getOverlap(J.PositionAndShape,Q.PositionAndShape);Q.squeeze(K.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(D,R){const F=D.RelativePosition.x+D.BorderMarginRight,G=R.RelativePosition.x+R.BorderMarginLeft,j=D.RelativePosition.y+D.BorderMarginBottom,U=R.RelativePosition.y+R.BorderMarginTop;return new PointF2D(G-F,U-j)}getOverlap(D,R){return new PointF2D(D.RelativePosition.x+D.BorderMarginRight-(R.RelativePosition.x+R.BorderMarginLeft),D.RelativePosition.y+D.BorderMarginBottom-(R.RelativePosition.y+R.BorderMarginTop))}}class VexFlowStaffLine extends StaffLine{constructor(D,R){super(D,R),this.slursInVFStaffLine=[],this.alignmentManager=new AlignmentManager(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(D){this.slursInVFStaffLine.push(D)}get AlignmentManager(){return this.alignmentManager}}const VF$6=Vex.Flow;class VexFlowMultiRestMeasure extends VexFlowMeasure{constructor(D,R=void 0,F=void 0){super(D,R,F),this.minimumStaffEntriesWidth=-1,F?this.rules=F.ParentMusicSystem.rules:R&&(this.rules=R.Rules),this.resetLayout(),this.multiRestElement=new VF$6.MultiMeasureRest(R.multipleRestMeasures,{})}draw(D){var j,U,W,Y,Q;const R=D.openGroup();(j=R==null?void 0:R.classList)==null||j.add("vf-measure");const F=D.openGroup();(U=F==null?void 0:F.classList)==null||U.add("vf-stave"),F==null||F.setAttribute("id",(Y=(W=this.stave)==null?void 0:W.attrs)==null?void 0:Y.id),this.stave.setContext(D).draw(),D.closeGroup();const G=D.openGroup();(Q=G==null?void 0:G.classList)==null||Q.add("vf-voices"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(D),this.multiRestElement.draw(),D.closeGroup();for(const Z of this.connectors)Z.setContext(D).draw();return D.closeGroup(),R}format(){}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(D){return[]}getRestFilledVexFlowStaveNotesPerVoice(D){return[]}handleBeam(D,R){}handleTuplet(D,R){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(D){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(D){}getVFStave(){return this.stave}}const VF$5=Vex.Flow;class VexFlowBackend{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let D=this.canvas;return this.getVexflowBackendType()===VF$5.Renderer.Backends.CANVAS&&(D=this.inner),D}getRenderer(){return this.renderer}removeAllChildrenFromContainer(D){for(;D.children.length!==0;)D.removeChild(D.children.item(0))}removeFromContainer(D){const R=this.getRenderElement();for(let F=0;F \r<`)),j.download="opensheetmusicdisplay_download.svg",j.innerHTML=window.location.href+"/download",document.body.appendChild(j)}}class VexFlowInstantaneousDynamicExpression extends GraphicalInstantaneousDynamicExpression{constructor(D,R,F){super(D,R,F);const G=new Label(this.Expression);this.label=new GraphicalLabel(G,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(D,R){super(),this.getOctaveShift=D,this.setSymbol(),this.PositionAndShape=new BoundingBox$2(this,R)}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(D,R){switch(super(D,R),D.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(D){for(const R of D.graphicalVoiceEntries){const F=R;if(F!=null&&F.vfStaveNote)return this.startNote=F.vfStaveNote,!0}return!1}setEndNote(D){for(const R of D.graphicalVoiceEntries){const F=R;if(F!=null&&F.vfStaveNote)return this.endNote=F.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})}}Vex.Flow;class VexflowStafflineNoteCalculator{constructor(D){this.staffPitchListMapping=new Dictionary,this.baseLineNote=NoteEnum.B,this.baseLineOctave=1,this.rules=D}trackNote(D){if(!(D instanceof VexFlowGraphicalNote)||D.Clef().ClefType!==ClefEnum.percussion||D.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;const R=D.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let F;this.staffPitchListMapping.containsKey(R)||this.staffPitchListMapping.setValue(R,new Array),F=this.staffPitchListMapping.getValue(R);const G=D.sourceNote.Pitch;VexflowStafflineNoteCalculator.findOrInsert(F,G)}static PitchIndexOf(D,R,F=0){if(F>D.length-1)return-1;for(let G=F;Gthis.rules.PercussionOneLineCutoff&&!G)return D;const j=D,U=D.sourceNote.Pitch;let W=this.baseLineNote,Y=this.baseLineOctave;if(this.rules.PercussionUseXMLDisplayStep&&D.sourceNote.displayStepUnpitched!==void 0&&(W=D.sourceNote.displayStepUnpitched,Y=D.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),F.length<=this.rules.PercussionForceVoicesOneLineCutoff)j.setAccidental(new Pitch(W,Y,U.Accidental));else{const Q=VexflowStafflineNoteCalculator.PitchIndexOf(F,U);if(Q>-1){const Z=Math.ceil(F.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(Q>=Z)switch(Y=2,(Q-Z)%5){case 1:W=NoteEnum.E;break;case 2:W=NoteEnum.G;break;case 3:W=NoteEnum.B;break;case 4:W=NoteEnum.D,Y=3;break;default:W=NoteEnum.C;break}else switch(Q%5){case 1:W=NoteEnum.F;break;case 2:W=NoteEnum.D;break;case 3:W=NoteEnum.B,Y=0;break;case 4:W=NoteEnum.G,Y=0;break;default:W=NoteEnum.A;break}const q=new Pitch(W,Y,U.Accidental);j.setAccidental(q);const J=j.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&J.Notes.length<2&&(q.Octave>this.baseLineOctave||q.FundamentalNote===this.baseLineNote&&q.Octave===this.baseLineOctave?j.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Up:j.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Down)}}return j}getStafflineUniquePositionCount(D){return this.staffPitchListMapping.containsKey(D)?this.staffPitchListMapping.getValue(D).length:0}}class SkyBottomLineCalculator{constructor(D){this.mStaffLineParent=D,this.mRules=D.ParentMusicSystem.rules}calculateLines(){const D=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];const R=new CanvasVexFlowBackend(this.StaffLineParent.ParentMusicSystem.rules);for(const U of this.StaffLineParent.Measures){U.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);const W=U.getVFStave();let Y=W.getWidth();if(!(Y>0)&&!U.IsExtraGraphicalMeasure&&(log$2.warn("SkyBottomLineCalculator: width not > 0 in measure "+U.MeasureNumber),Y=50),!(Y>=50)&&U.IsExtraGraphicalMeasure)continue;R.initializeHeadless(Y);const Q=R.getContext(),Z=R.getCanvas();Y=Z.width;const q=Z.height;this.mRules.DYMusicScoreType==="jianpu"?W.setY(W.y-50):W.setY(W.y+100);const J=W.getWidth();W.setWidth(Y),U.format(),W.setWidth(J);try{U.draw(Q)}catch(oe){log$2.warn("SkyBottomLineCalculator.calculateLines.draw",oe)}const K=Q.getImageData(0,0,Y,q),te=4,ne=Math.max(Math.ceil(U.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),ie=new Array(ne),re=new Array(ne);for(let oe=0;oe0){ie[oe]=le;break}}for(let le=q;le>0;le--){const he=le*Y*te+oe*te;if(K.data[he+3]>0){re[oe]=le;break}}}for(let oe=0;oe(U-Math.max(...this.mSkyLine))/unitInPixels+this.StaffLineParent.TopLineOffset),this.mBottomLine=this.mBottomLine.map(U=>(U-Math.min(...this.mBottomLine))/unitInPixels+this.StaffLineParent.BottomLineOffset)}findPreviousValidNumber(D,R){for(let F=D;F>=0;F--)if(!isNaN(R[F]))return R[F];return 0}findNextValidNumber(D,R){if(D>=R.length)return R[D-1];for(let F=D;F=this.BottomLine.length&&(F=this.BottomLine.length-1),G<0&&(G=0),G>=this.BottomLine.length&&(G=this.BottomLine.length),this.SkyLine[F]=D.y;for(let U=F+1;U=this.BottomLine.length&&(F=this.BottomLine.length-1),G<0&&(G=0),G>=this.BottomLine.length&&(G=this.BottomLine.length),this.BottomLine[F]=D.y;for(let U=F+1;UD)}setBottomLineWithValue(D){this.BottomLine.forEach(R=>D)}getLeftIndexForPointX(D,R){const F=Math.floor(D*this.SamplingUnit);return F<0?0:F>=R?R-1:F}getRightIndexForPointX(D,R){const F=Math.ceil(D*this.SamplingUnit);return F<0?0:F>=R?R-1:F}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(D=>!isNaN(D)))}getSkyLineMinAtPoint(D){const R=Math.round(D*this.SamplingUnit);return this.mSkyLine[R]}getSkyLineMinInRange(D,R){return this.getMinInRange(this.SkyLine,D,R)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(D=>!isNaN(D)))}getBottomLineMaxAtPoint(D){const R=Math.round(D*this.SamplingUnit);return this.mBottomLine[R]}getBottomLineMaxInRange(D,R){return this.getMaxInRange(this.BottomLine,D,R)}getBottomLineMaxInBoundingBox(D){const R=Math.floor(D.AbsolutePosition.x+D.BorderLeft),F=Math.ceil(D.AbsolutePosition.x+D.BorderRight);return this.getMaxInRange(this.mBottomLine,R,F)}updateWithBoundingBoxRecursively(D){if(D.ChildElements&&D.ChildElements.length>0)for(const R of D.ChildElements)this.updateWithBoundingBoxRecursively(R);else{const R=D.BorderTop+D.AbsolutePosition.y,F=D.BorderBottom+D.AbsolutePosition.y;if(R<0){const G=Math.floor(D.AbsolutePosition.x+D.BorderLeft),j=Math.ceil(D.AbsolutePosition.x+D.BorderRight);this.updateInRange(this.mSkyLine,G,j,R)}else if(F>this.StaffLineParent.StaffHeight){const G=Math.floor(D.AbsolutePosition.x+D.BorderLeft),j=Math.ceil(D.AbsolutePosition.x+D.BorderRight);this.updateInRange(this.mBottomLine,G,j,F)}}}updateInRange(D,R=0,F=D.length,G=0){if(R=Math.floor(R*this.SamplingUnit),F=Math.ceil(F*this.SamplingUnit),FD.length&&(F=D.length);for(let j=R;jMath.abs(D[j])?G:D[j]}setInRange(D,R=0,F=D.length,G=0){if(R=Math.floor(R*this.SamplingUnit),F=Math.ceil(F*this.SamplingUnit),FD.length&&(F=D.length);for(let j=R;j=D.length&&(R=D.length-1),F<0&&(F=0),F>=D.length&&(F=D.length),R>=0&&F<=D.length)return Math.min(...D.slice(R,F+1))}getMaxInRange(D,R,F){if(R=Math.floor(R*this.SamplingUnit),F=Math.ceil(F*this.SamplingUnit),!D)return Number.MIN_VALUE;if(R<0&&(R=0),R>=D.length&&(R=D.length-1),F<0&&(F=0),F>=D.length&&(F=D.length),R>=0&&F<=D.length)return Math.max(...D.slice(R,F+1))}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}}var parser$3={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(B,D){(function(R,F){B.exports=F()})(commonjsGlobal$1,function(){return function(F){for(var G={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},j={number:function(ne){return+K("number",ne)},"coordinate pair":function(ne){var ie=K("number",ne);if(ie===null&&!ne)return null;K("comma");var re=K("number",!0);return{x:+ie,y:+re}},"arc definition":function(ne){var ie=j["coordinate pair"](ne);if(!ie&&!ne)return null;K("comma");var re=+K("number",!0);K("comma",!0);var oe=!!+K("flag",!0);K("comma");var le=!!+K("flag",!0);K("comma");var fe=j["coordinate pair"](!0);return{radii:ie,rotation:re,large:oe,clockwise:le,end:fe}}},U=0,W=[];UR.bottom)switch(D.tagName.toLowerCase()){case"g":for(const J of D.children)this.recursiveUpdate(J,R,F,G);break;case"circle":case"rect":case"line":case"path":let Z=Math.floor((j.x-F.x)/unitInPixels*this.mRules.SamplingUnit);const q=Z+Math.ceil(j.width/unitInPixels*this.mRules.SamplingUnit);if(D.parentElement.classList.contains("vf-beams")&&D.hasAttribute("d")){const J=parse$3(D.getAttribute("d"));if(J.length===5){const K=J[0],te=J[3],ne=(te.end.y-K.end.y)/(te.end.x-K.end.x);let ie=K.end.y/unitInPixels;for(Z;Z<=q;Z++)ieQ[Z]&&(Q[Z]=ie),ie+=ne/this.mRules.SamplingUnit}}else for(Z;Z<=q;Z++)UQ[Z]&&(Q[Z]=W);break}}calculateLinesForMeasure(D,R){var ge,ue,me;const F=R.getBBox(),G=Math.max(Math.round(D.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),j=F.height/unitInPixels,W=R.getElementsByClassName("vf-stave")[0].getBBox();let Y=(W==null?void 0:W.height)/unitInPixels,Q=(W==null?void 0:W.y)/unitInPixels;const Z=D.getVFStave();let q=((ge=Z.options)!=null&&ge.num_lines?Z.options.num_lines:5)-1,J=-1,K=0;const te=[q];for(const be of(ue=Z.options)==null?void 0:ue.line_config)be.visible?(J===-1&&(J=K),te.push(K)):q--,K++;const ne=te.pop();J===-1&&(J=0),q=ne-J;const ie=(me=Z.options)==null?void 0:me.spacing_between_lines_px,re=q*ie/unitInPixels;Y-re>.2&&(Y=re,Q=J*ie/unitInPixels);const oe=Q+Y,le=new Array(G).fill(Q),fe=new Array(G).fill(oe),he=[le,fe];if(j>Y)for(const be of R.children)this.recursiveUpdate(be,{top:Q,bottom:oe},F,[le,fe]);return he}calculateLines(){this.mSkyLine=[],this.mBottomLine=[];const D=document.createElement("div");document.body.append(D);const R=new SvgVexFlowBackend(this.mRules);R.initialize(D,1,"0");const F=R.getContext(),G=F.openGroup();G.classList.add("staffline");for(const j of this.StaffLineParent.Measures){j.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),j.setAbsoluteCoordinates(j.PositionAndShape.AbsolutePosition.x*unitInPixels,j.PositionAndShape.AbsolutePosition.y*unitInPixels);const U=j.draw(F),[W,Y]=this.calculateLinesForMeasure(j,U);this.mSkyLine.push(...W),this.mBottomLine.push(...Y)}F.closeGroup();for(const j of G.getElementsByClassName("vf-ties"))for(const U of j.childNodes)if(U.nodeName.toLowerCase()==="path"){const W=U.getBBox();let Y=Math.floor(W.x/unitInPixels*this.mRules.SamplingUnit);const Q=Y+Math.ceil(W.width/unitInPixels*this.mRules.SamplingUnit),Z=W.y/unitInPixels,q=W.height/unitInPixels+Z;for(Y;Y<=Q;Y++)Zthis.mBottomLine[Y]&&(this.mBottomLine[Y]=q)}R.clear(),D.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(D,R){return new VexFlowMusicSystem(D,R)}createStaffLine(D,R){return new VexFlowStaffLine(D,R)}createSkyBottomLineCalculator(D){return D.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new SkyBottomLineCalculatorSVG(D):new SkyBottomLineCalculator(D)}createGraphicalMeasure(D,R,F=!1){return new VexFlowMeasure(R,D,void 0)}createMultiRestMeasure(D,R,F){return new VexFlowMultiRestMeasure(R,D,F)}createTabStaffMeasure(D,R){return new VexFlowTabMeasure(R,D)}createExtraGraphicalMeasure(D){const R=new VexFlowMeasure(D.ParentStaff,void 0,D);return R.IsExtraGraphicalMeasure=!0,R.ExtraGraphicalMeasurePreviousMeasure=D.Measures.last(),R}createStaffEntry(D,R){return new VexFlowStaffEntry(R,D,void 0)}createVoiceEntry(D,R){return new VexFlowVoiceEntry(D,R)}createNote(D,R,F,G=OctaveEnum.NONE,j,U=void 0){return new VexFlowGraphicalNote(D,R,F,G,j,U)}createGraceNote(D,R,F,G,j=OctaveEnum.NONE){return new VexFlowGraphicalNote(D,R,F,j,G)}addGraphicalAccidental(D,R){D.setAccidental(R)}addFermataAtTiedEndNote(D,R){}createInStaffClef(D,R){const F=D,G=VexFlowConverter.Clef(R,"small");F.vfClefBefore=new VF$1.ClefNote(G.type,G.size,G.annotation)}createChordSymbols(D,R,F,G){const j=R.parentMeasure.parentSourceMeasure.Rules;let U=0;const W=j.ChordSymbolXSpacing;for(const Y of D.ChordContainers){const Q=new GraphicalChordSymbolContainer(Y,R.PositionAndShape,j.ChordSymbolTextHeight,F,G,R.parentMeasure.parentSourceMeasure.Rules),Z=Q.GraphicalLabel;Z.PositionAndShape.RelativePosition.y-=j.ChordSymbolYOffset,Z.PositionAndShape.RelativePosition.x+=U,Z.setLabelPositionAndShapeBorders(),Q.PositionAndShape.calculateBoundingBox(),R.graphicalChordContainers.push(Q),U+=Z.PositionAndShape.Size.width+W}}createGraphicalTechnicalInstruction(D,R){}}Vex.Flow;class GraphicalTie{constructor(D,R=void 0,F=void 0){this.tie=D,this.startNote=R,this.endNote=F}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(D){this.startNote=D}get EndNote(){return this.endNote}set EndNote(D){this.endNote=D}}class GraphicalLyricEntry{constructor(D,R,F,G){this.lyricsEntry=D,this.graphicalStaffEntry=R;const j=R.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;D.Text.length>=4&&D.Parent.Notes[0].Length.Denominator>4&&TextAlignmentEnum.LeftBottom;const U=new Label(D.Text);this.graphicalLabel=new GraphicalLabel(U,F,j,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,R.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(0,G),j===TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(D){this.graphicalLyricWord=D}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(D){this.graphicalLabel=D}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(D){this.graphicalStaffEntry=D}}class GraphicalLyricWord{constructor(D){this.graphicalLyricsEntries=[],this.lyricWord=D,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(D){this.graphicalLyricsEntries=D}isFilled(){for(let D=0;D=_GraphicalCurve.bezierCurveStepSize?new PointF2D:new PointF2D(_GraphicalCurve.oneMinusTPow3[D]*this.bezierStartPt.x+_GraphicalCurve.bezierFactorOne[D]*this.bezierStartControlPt.x+_GraphicalCurve.bezierFactorTwo[D]*this.bezierEndControlPt.x+_GraphicalCurve.tPow3[D]*this.bezierEndPt.x,_GraphicalCurve.oneMinusTPow3[D]*this.bezierStartPt.y+_GraphicalCurve.bezierFactorOne[D]*this.bezierStartControlPt.y+_GraphicalCurve.bezierFactorTwo[D]*this.bezierEndControlPt.y+_GraphicalCurve.tPow3[D]*this.bezierEndPt.y)}};let GraphicalCurve=_GraphicalCurve;GraphicalCurve.bezierCurveStepSize=1e3;const _GraphicalSlur=class extends GraphicalCurve{constructor(B,D){super(),this.staffEntries=[],this.slur=B,this.rules=D}static Compare(B,D){if(B.staffEntries.length<1)return-1;if(D.staffEntries.length<1)return 1;const R=Fraction$1.minus(B.staffEntries[B.staffEntries.length-1].getAbsoluteTimestamp(),B.staffEntries[0].getAbsoluteTimestamp()),F=Fraction$1.minus(D.staffEntries[D.staffEntries.length-1].getAbsoluteTimestamp(),D.staffEntries[0].getAbsoluteTimestamp());return R.RealValue>F.RealValue?1:F.RealValue>R.RealValue?-1:0}calculateCurve(B){const D=this.staffEntries[0],R=this.staffEntries[this.staffEntries.length-1];let F=D.findGraphicalNoteFromNote(this.slur.StartNote);!F&&this.graceStart&&(F=D.findGraphicalNoteFromGraceNote(this.slur.StartNote)),F||(F=D.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let G=R.findGraphicalNoteFromNote(this.slur.EndNote);!G&&this.graceEnd&&(G=R.findGraphicalNoteFromGraceNote(this.slur.EndNote));const j=D.parentMeasure.ParentStaffLine,U=j.SkyBottomLineCalculator;this.calculatePlacement(U,j);const W=this.calculateStartAndEnd(F,G,j,B,U),Y=W.startX,Q=W.endX;let Z=W.startY,q=W.endY;const J=B.SlurTangentMinAngle,K=B.SlurTangentMaxAngle;let te;if(this.placement===PlacementEnum.Above){Z-=B.SlurNoteHeadYOffset,q-=B.SlurNoteHeadYOffset;const ne=new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,Z);F?ne.x+=this.staffEntries[0].PositionAndShape.BorderRight:ne.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(ne.x+=R.PositionAndShape.RelativePosition.x);const ie=new PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,q);if(G?ie.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:ie.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(ie.x+=R.staffEntryParent.PositionAndShape.RelativePosition.x),te=this.calculateTopPoints(ne,ie,j,U),te.length===0){const Ge=new PointF2D((ie.x-ne.x)/2+ne.x,(ie.y-ne.y)/2+ne.y);te.push(Ge)}const re=Math.atan((q-Z)/(Q-Y)),oe=new PointF2D(0,0);let le=new PointF2D(Q-Y,-(q-Z));const fe=Matrix2D.getRotationMatrix(re),he=fe.getTransposeMatrix();le=fe.vectorMultiplication(le);const ge=this.calculateTranslatedAndRotatedPointListAbove(te,Y,Z,fe);let ue=this.calculateMaxLeftSlope(ge,oe,le),me=this.calculateMaxRightSlope(ge,oe,le);const be=oe.y-oe.x*ue,ve=le.y-le.x*me,pe=new PointF2D;let ye=!1;Math.abs(Math.abs(ue)-Math.abs(me))<1e-4?(pe.x=le.x/2,pe.y=0,ye=!0):(pe.x=(ve-be)/(ue-me),pe.y=ue*pe.x+be);const xe=this.calculateHeightWidthRatio(le.x,ge);let ce=0,we=0;if(Math.abs(xe)>.001){const Ge=Math.abs(ue/(xe*2)),We=Math.abs(ue);ce=Math.max(0,We*(Math.min(10,Ge-1)/10)),ue-=ce;const Ve=Math.abs(me/(xe*2)),Ye=Math.abs(me);we=Math.max(0,Ye*(Math.min(10,Ve-1)/10)),me+=we}let Be=J,Ae=-J;if(!ye){const Ge=this.calculateAngles(J,ue,me,K);Be=Ge.startAngle,Ae=Ge.endAngle}const Te=this.calculateControlPoints(le.x,Be,Ae,ge,xe,Z,q);let Ne=Te.startControlPoint,Pe=Te.endControlPoint;Ne=he.vectorMultiplication(Ne),Ne.x+=Y,Ne.y=-Ne.y+Z,Pe=he.vectorMultiplication(Pe),Pe.x+=Y,Pe.y=-Pe.y+Z,this.bezierStartPt=new PointF2D(Y,Z-ce),this.bezierStartControlPt=new PointF2D(Ne.x,Ne.y-ce),this.bezierEndControlPt=new PointF2D(Pe.x,Pe.y-we),this.bezierEndPt=new PointF2D(Q,q-we);const Me=j.SkyLine.length,Se=U.getLeftIndexForPointX(this.bezierStartPt.x,Me),Le=U.getLeftIndexForPointX(this.bezierEndPt.x,Me),ze=this.bezierEndPt.x-this.bezierStartPt.x,ke=U.SamplingUnit;for(let Ge=Se;Ge=Se&&(j.SkyLine[Ye]=Math.min(j.SkyLine[Ye],Ve.y)),Ye++,Ye.001){const Ge=Math.abs(ue/(xe*2)),We=Math.abs(ue);ce=Math.max(0,We*(Math.min(10,Ge-1)/10)),ue-=ce;const Ve=Math.abs(me/(xe*2)),Ye=Math.abs(me);we=Math.max(0,Ye*(Math.min(10,Ve-1)/10)),me+=we}let Be=J,Ae=-J;if(!ye){const Ge=this.calculateAngles(J,ue,me,K);Be=Ge.startAngle,Ae=Ge.endAngle}const Te=this.calculateControlPoints(le.x,Be,Ae,ge,xe,Z,q);let Ne=Te.startControlPoint,Pe=Te.endControlPoint;Ne=he.vectorMultiplication(Ne),Ne.x+=Y,Ne.y+=Z,Pe=he.vectorMultiplication(Pe),Pe.x+=Y,Pe.y+=Z,this.bezierStartPt=new PointF2D(Y,Z+ce),this.bezierStartControlPt=new PointF2D(Ne.x,Ne.y+ce),this.bezierEndControlPt=new PointF2D(Pe.x,Pe.y+we),this.bezierEndPt=new PointF2D(Q,q+we);const Me=j.BottomLine.length,Se=U.getLeftIndexForPointX(this.bezierStartPt.x,Me),Le=U.getLeftIndexForPointX(this.bezierEndPt.x,Me),ze=this.bezierEndPt.x-this.bezierStartPt.x,ke=U.SamplingUnit;for(let Ge=Se;Ge=Se&&(j.BottomLine[Ye]=Math.max(j.BottomLine[Ye],Ve.y)),Ye++,Ye0){this.placement=PlacementEnum.Above;return}const R=this.staffEntries[0],F=this.staffEntries[this.staffEntries.length-1],G=R.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection,j=F.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(G===j)this.placement=G===StemDirectionType.Up?PlacementEnum.Below:PlacementEnum.Above;else{let U=R.PositionAndShape.BorderLeft+R.PositionAndShape.RelativePosition.x+R.parentMeasure.PositionAndShape.RelativePosition.x,W=F.PositionAndShape.BorderRight+F.PositionAndShape.RelativePosition.x+F.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(U+=F.PositionAndShape.RelativePosition.x),this.graceEnd&&(W+=F.staffEntryParent.PositionAndShape.RelativePosition.x);const Y=B.getSkyLineMinInRange(U,W)*-1;B.getBottomLineMaxInRange(U,W)-D.StaffHeight>Y?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below}}calculateTopPoints(B,D,R,F){const G=[];let j=F.getRightIndexForPointX(B.x,R.SkyLine.length),U=F.getLeftIndexForPointX(D.x,R.SkyLine.length);j<0&&(j=0),U>=R.SkyLine.length&&(U=R.SkyLine.length-1);for(let W=j;W=R.BottomLine.length&&(U=R.BottomLine.length-1);for(let W=j;WQ&&B>Z&&(Y+=B/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,Y*=1+D/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,W/=Y);const q=Math.min(.5,Math.max(.1,1.7*D/80*W*Math.pow(Math.max(G,.05),.4))),J=Math.min(.5,Math.max(.1,1.7*-R/80*W*Math.pow(Math.max(G,.05),.4))),K=new PointF2D;K.x=B*q*Math.cos(D*_GraphicalSlur.degreesToRadiansFactor),K.y=B*q*Math.sin(D*_GraphicalSlur.degreesToRadiansFactor);const te=new PointF2D;te.x=B-B*J*Math.cos(R*_GraphicalSlur.degreesToRadiansFactor),te.y=-(B*J*Math.sin(R*_GraphicalSlur.degreesToRadiansFactor));let ne=K.y-te.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(ne)>this.rules.SlurMaximumYControlPointDistance;)ne<0?(K.y+=1,te.y-=1):(K.y-=1,te.y+=1),ne=K.y-te.y;return{startControlPoint:K,endControlPoint:te}}calculateAngles(B,D,R,F){let j=Math.atan(D)/_GraphicalSlur.degreesToRadiansFactor;D>0?j+=20:j-=20;let U=Math.atan(R)/_GraphicalSlur.degreesToRadiansFactor;R<0?U-=20:U+=20;const W=Math.min(Math.max(B,j),F),Y=Math.max(Math.min(-B,U),-F);return{startAngle:W,endAngle:Y}}};let GraphicalSlur=_GraphicalSlur;GraphicalSlur.degreesToRadiansFactor=Math.PI/180;class GraphicalPedal extends GraphicalObject{constructor(D,R){super(),this.getPedal=D,this.setSymbol(),this.PositionAndShape=new BoundingBox$2(this,R)}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(D,R,F=!1,G=!1){switch(super(D,R),this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=D.ChangeBegin,this.ChangeEnd=D.ChangeEnd,this.pedalSymbol){case MusicSymbol.PEDAL_SYMBOL:this.vfStyle=Vex.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new BoundingBox$2(this,R);break;case MusicSymbol.PEDAL_MIXED:F&&G?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:F?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:G?this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED;break;case MusicSymbol.PEDAL_BRACKET:default:F&&G?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:F?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:G?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET;break}}setStartNote(D){if(!D)return!1;for(const R of D.graphicalVoiceEntries){const F=R;if(F!=null&&F.vfStaveNote)return this.startNote=F.vfStaveNote,this.startVfVoiceEntry=F,!0}return!1}setEndNote(D){if(!D)return!1;for(const R of D.graphicalVoiceEntries){const F=R;if(F!=null&&F.vfStaveNote)return this.endNote=F.vfStaveNote,this.endVfVoiceEntry=F,!0}return!1}setEndMeasure(D){this.endMeasure=D}CalculateBoundingBox(){}setLine(D){this.line=D}getPedalMarking(){var R,F,G,j;const D=new Vex.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&D.setEndStave(this.endMeasure.getVFStave()),D.setStyle(this.vfStyle),D.setLine(this.line),D.setCustomText(this.DepressText,this.ReleaseText),(((R=this.endVfVoiceEntry)==null?void 0:R.parentStaffEntry)===((j=(G=(F=this.endVfVoiceEntry)==null?void 0:F.parentStaffEntry)==null?void 0:G.parentMeasure)==null?void 0:j.staffEntries.last())||!this.endVfVoiceEntry)&&(D.EndsStave=!0),D.ChangeBegin=this.ChangeBegin,D.ChangeEnd=this.ChangeEnd,D}}class GraphicalWavyLine extends GraphicalObject{constructor(D,R){super(),this.getWavyLine=D,this.PositionAndShape=new BoundingBox$2(this,R)}}class VexflowVibratoBracket extends GraphicalWavyLine{constructor(D,R,F=!1){super(D,R),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=F}get ToEndOfStopStave(){return this.toEndOfStopStave}setStartNote(D){for(const R of D.graphicalVoiceEntries){const F=R;if(F!=null&&F.vfStaveNote)return this.startNote=F.vfStaveNote,this.startVfVoiceEntry=F,!0}return!1}setEndNote(D){for(const R of D.graphicalVoiceEntries){const F=R;if(F!=null&&F.vfStaveNote){this.endNote=F.vfStaveNote,this.endVfVoiceEntry=F;const G=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,j=G[G.length-1];return this.toEndOfStopStave=j===this.endVfVoiceEntry.parentStaffEntry,!0}}return!1}CalculateBoundingBox(){const D=this.getVibratoBracket();this.boundingBox.Size.height=D.render_options.wave_height*.2}getVibratoBracket(){const D=new Vex.Flow.VibratoBracket({start:this.startNote,stop:this.endNote,toEndOfStopStave:this.toEndOfStopStave});return D.setLine(this.line),this.isVibrato?D.render_options.vibrato_width=20:D.render_options.wave_girth=4,D}}const VF=Vex.Flow;class VexFlowMusicSheetCalculator extends MusicSheetCalculator{constructor(D){var R,F,G,j,U,W,Y,Q;super(),this.beamsNeedUpdate=!1,this.rules=D,MusicSheetCalculator.symbolFactory=new VexFlowGraphicalSymbolFactory,MusicSheetCalculator.TextMeasurer=new VexFlowTextMeasurer(this.rules),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules),((R=this.rules.DefaultVexFlowNoteFont)==null?void 0:R.toLowerCase())==="gonville"?Vex.Flow.DEFAULT_FONT_STACK=[(F=Vex.Flow.Fonts)==null?void 0:F.Gonville,(G=Vex.Flow.Fonts)==null?void 0:G.Bravura,(j=Vex.Flow.Fonts)==null?void 0:j.Custom]:((U=this.rules.DefaultVexFlowNoteFont)==null?void 0:U.toLowerCase())==="petaluma"&&(Vex.Flow.DEFAULT_FONT_STACK=[(W=Vex.Flow.Fonts)==null?void 0:W.Petaluma,(Y=Vex.Flow.Fonts)==null?void 0:Y.Gonville,(Q=Vex.Flow.Fonts)==null?void 0:Q.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules);for(const D of this.graphicalMusicSheet.MeasureList)for(const R of D)R==null||R.clean()}formatMeasures(){for(const D of this.graphicalMusicSheet.MeasureList){if(!D||!D[0])continue;D[0].format();for(const F of D){for(const G of F.staffEntries)G.calculateXPosition();F.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(D){const R=[];for(const Z of D)Z&&R.push(Z);if(R.length===0)return 0;D=R;const F=[],G=new VF.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let j=D[0].staffEntries.length,U=1;for(const Z of D){if(!Z)continue;let q=0;for(const te of Z.staffEntries)q+=te.setMaxAccidentals();Z.parentSourceMeasure.ImplicitMeasure&&(j=Math.max(Z.staffEntries.length,j),U=Math.max(Z.staffEntries.length+q,U));const J=Z.vfVoices,K=[];for(const te in J)J.hasOwnProperty(te)&&(K.push(J[te]),F.push(J[te]));if(K.length===0){log$2.debug("Found a measure with no voices. Continuing anyway.",J);continue}G.joinVoices(K)}let W=12;const Y=D[0].parentSourceMeasure,Q=.3;if(F.length>0){W=G.preCalculateMinTotalWidth(F)/unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+j*Q,Y!=null&&Y.ImplicitMeasure&&(W=Y.Duration.RealValue/Y.ActiveTimeSignature.RealValue*W,j>1&&(W+=U*Q*1.5),W*=this.rules.PickupMeasureWidthMultiplier),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(D,W);const Z=(J,K)=>{G.formatToStave(F,K.getVFStave())},q=(J,K)=>{G.formatToStave(F,K.getVFStave(),{align_rests:!0,context:void 0})};for(const J of D){if(this.rules.AlignRests===AlignRestOption.Never)J.formatVoices=Z;else if(this.rules.AlignRests===AlignRestOption.Always)J.formatVoices=q;else if(this.rules.AlignRests===AlignRestOption.Auto){let K=!1;for(const te of J.staffEntries){let ne=0,ie=0;for(const re of te.graphicalVoiceEntries)if(re.parentVoiceEntry.IsGrace||re&&re.notes&&re.notes[0]&&re.notes[0].sourceNote&&re.notes[0].sourceNote.PrintObject&&ne++,re&&re.notes&&re.notes[0]&&re.notes[0].sourceNote&&re.notes[0].sourceNote.isRest()&&re.notes[0].sourceNote.PrintObject&&ie++,ne>1&&ie>=1){K=!0;break}if(K)break}K?J.formatVoices=q:J.formatVoices=Z}if(J===D[0]){const K=J;K.formatVoices(W*unitInPixels,K)}}}for(const Z of D)if(!!Z)for(const q of Z.staffEntries)q.calculateXPosition();for(const Z of D){if(!Z)continue;const q=Z.vfVoices,J=[];for(const K in q)q.hasOwnProperty(K)&&J.push(q[K]);if(J.length===0){log$2.debug("Found a measure with no voices. Continuing anyway.",q);continue}G.joinVoices(J)}return W}calculateElongationFactor(D,R,F,G,j,U,W,Y){let Q=j,Z=0;for(const q of D){const J=q.GraphicalLabel.Label.textAlignment;let K=W,te=Y;if(q instanceof GraphicalLyricEntry&&q.ParentLyricWord){q.LyricsEntry.SyllableIndex>0&&(K=this.rules.BetweenSyllableMinimumDistance,TextAlignment.IsCenterAligned(J)&&(K+=1));const ye=q.ParentLyricWord.GetLyricWord.Syllables;ye.length>1&&q.LyricsEntry.SyllableIndex4&&(ve*=1.1)}}else F[Z]&&(ve=le/fe);me=Math.max(be,ve),Q=Math.max(Q,me);let pe=Math.max(le-fe||0,0);F[Z]&&(pe+=F[Z].cumulativeOverlap),F[Z]={cumulativeOverlap:pe,extend:q instanceof GraphicalLyricEntry?q.LyricsEntry.extend:!1,labelWidth:ie,measureNumber:U,sourceNoteDuration:q instanceof GraphicalLyricEntry?q.LyricsEntry&&q.LyricsEntry.Parent.Notes[0].Length:!1,text:q instanceof GraphicalLyricEntry?q.LyricsEntry.Text:q.GraphicalLabel.Label.text,xPosition:oe},Z++}return Q}calculateElongationFactorFromStaffEntries(D,R,F,G){let j=F;const U={},W={};for(const Y of D)Y.LyricsEntries.length>0&&(j=this.calculateElongationFactor(Y.LyricsEntries,Y,U,R,j,G,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),Y.graphicalChordContainers.length>0&&(j=this.calculateElongationFactor(Y.graphicalChordContainers,Y,W,R,j,G,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return j}calculateMeasureWidthFromStaffEntries(D,R){let F=1;for(const j of D)!j||j.staffEntries.length===0||(F=this.calculateElongationFactorFromStaffEntries(j.staffEntries,R,F,j.MeasureNumber));return F=Math.min(F,this.rules.MaximumLyricsElongationFactor),R*F}createGraphicalTie(D,R,F,G,j){return new GraphicalTie(D,G,j)}updateStaffLineBorders(D){D.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(D){D.rules=this.rules,D.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(D,R,F,G){for(let j=0;j=2&&(U=G.vfnote[0],W=G.vfnote[1]);let Y,Q=0;if(j&&j.vfnote&&j.vfnote.length>=2&&(Y=j.vfnote[0],Q=j.vfnote[1]),R){if(U){const Z=new VF.StaveTie({first_indices:[W],first_note:U});G.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(Z,D)}if(Y){const Z=new VF.StaveTie({last_indices:[Q],last_note:Y});j.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(Z,D)}}else if(U||Y){let Z;if(F)if(D.Tie.Type==="S"){const J=D.StartNote.sourceNote,K=D.EndNote.sourceNote;let te=1;J.FretNumber>K.FretNumber&&(te=-1),Z=new VF.TabSlide({first_indices:[W],first_note:U,last_indices:[Q],last_note:Y},te)}else Z=new VF.TabTie({first_indices:[W],first_note:U,last_indices:[Q],last_note:Y},D.Tie.Type);else{Z=new VF.StaveTie({first_indices:[W],first_note:U,last_indices:[Q],last_note:Y});const J=D.Tie.getTieDirection(G.sourceNote);J===PlacementEnum.Below?Z.setDirection(1):J===PlacementEnum.Above&&Z.setDirection(-1);try{Math.abs((U==null?void 0:U.getTieRightX())-(Y==null?void 0:Y.getTieLeftX()))<10&&(Z.render_options.first_x_shift=-3,Z.render_options.last_x_shift=3)}catch(K){console.log(K)}}j.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(Z,D)}}calculateDynamicExpressionsForMultiExpression(D,R,F){if(Rthis.rules.MaxMeasureToDrawIndex)return;const G=D.AbsoluteTimestamp,j=this.graphicalMusicSheet.MeasureList[R],U=j[F].ParentStaffLine,W=j[F];if(!U)return;const Y=this.getRelativePositionInStaffLineFromTimestamp(G,F,U,U==null?void 0:U.isPartOfMultiStaffInstrument());if(Y.x<=0&&(Y.x=W.beginInstructionsWidth+this.rules.RhythmRightMargin),D.InstantaneousDynamic){const Q=new VexFlowInstantaneousDynamicExpression(D.InstantaneousDynamic,U,W);this.calculateGraphicalInstantaneousDynamicExpression(Q,Y,G),this.dynamicExpressionMap.set(G.RealValue,Q.PositionAndShape)}if(D.StartingContinuousDynamic){const Q=D.StartingContinuousDynamic,Z=new VexFlowContinuousDynamicExpression(D.StartingContinuousDynamic,U,W.parentSourceMeasure);if(Z.StartMeasure=W,!Z.IsVerbal&&Q.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(Z,Y),Z.updateSkyBottomLine()}catch{}else Z.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(Z,Y):log$2.warn("This continuous dynamic is not covered. measure"+D.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(D,R){var oe,le,fe,he,ge,ue,me,be,ve;const F=Math.max(D.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),G=R||F,j=Math.max(D.StaffNumber-1,0),U=this.graphicalMusicSheet.MeasureList[G][j].getVFStave();let W="q";if(D.beatUnit){const pe=NoteTypeHandler.getNoteDurationFromType(D.beatUnit);W=VexFlowConverter.durations(pe,!1)[0]}let Y=this.rules.MetronomeMarkYShift,Q=!1;const Z=[];if(D.parentMeasure){for(const pe of D.parentMeasure.StaffLinkedExpressions)for(const ye of pe)ye&&ye instanceof UnknownExpression&&Z.push(ye);for(const pe of D.parentMeasure.TempoExpressions){const ye=((oe=pe.InstantaneousTempo)==null?void 0:oe.Enum)===TempoEnum.metronomeMark;if(!D.beatUnit&&pe.InstantaneousTempo.beatUnit){const xe=NoteTypeHandler.getNoteDurationFromType(D.beatUnit);W=VexFlowConverter.durations(xe,!1)[0]}if(pe.getPlacementOfFirstEntry()===PlacementEnum.Above&&!ye){Q=!0;break}}}Q&&(Y-=1.4);const q=(le=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:le.SkyLine;let J=D.TempoInBpm,K="",te="",ne="";for(const pe of this.graphicalMusicSheet.MeasureList[G][j].parentSourceMeasure.TempoExpressions){if(te=pe.CombinedExpressionsText,isSpecialMark(pe.CombinedExpressionsText)){K=pe.CombinedExpressionsText;break}if(isSpeedKeyword(pe.CombinedExpressionsText)||isSpeedHiddenKeyword(pe.CombinedExpressionsText)){K=formatSpeedKeyword(pe.CombinedExpressionsText),J=pe.sourceMeasure.TempoInBPM,isSpeedKeyword(pe.CombinedExpressionsText)&&(ne=W);break}}const ie={bpm:D.TempoInBpm,dots:D.dotted,duration:W,name:K};K&&(ie.bpm=J/(ie.dots?1.5:1),isSpeedKeyword(te)?ie.duration=ne:(J===SpeedTag[K]||!SpeedTag[K])&&(ie.duration=""));const re=((he=(fe=this.graphicalMusicSheet.MeasureList[G][j].vfVoices)==null?void 0:fe[1])==null?void 0:he.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(q){const ce=((ue=(ge=this.graphicalMusicSheet.MeasureList[0])==null?void 0:ge[j])==null?void 0:ue.ParentStaffLine).Measures.map(we=>we.MeasureNumber-1);if(re&&ce.includes(G)&&(isSpeedKeyword(te)||isSpeedHiddenKeyword(te))){const we=q.slice(0,9);let Be=Math.min(...we);Be=Be<0?Be-1:Be,Y+=Be}ce.includes(G)&&Z.length?q[0]=Math.min(q[0],-4.5+Y-4):q[0]=Math.min(q[0],-4.5+Y)}U.options.line_config.reduce((xe,ce)=>(ce.visible&&xe++,xe),0)<5&&(Y-=2),U.setTempo(ie,Y*unitInPixels);let ye=0;try{ye+=((ve=(be=(me=this.graphicalMusicSheet.MeasureList[G][j])==null?void 0:me.vfVoices)==null?void 0:be[1])==null?void 0:ve.getTickables())[D.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-U.getNoteStartX()}catch{}U.getModifiers()[U.getModifiers().length-1].setShiftX(ye)}}calculateRehearsalMark(D){var J,K,te,ne,ie;const R=D.rehearsalExpression;if(!R)return;const F=this.graphicalMusicSheet.MeasureList[0][0].MeasureNumber,G=Math.max(D.measureListIndex+1-F,0),j=0,U=(J=this.graphicalMusicSheet.MeasureList[G][j])==null?void 0:J.getVFStave();if(!U)return;const W=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let Y=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;D.IsSystemStartMeasure&&(Y+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const Q=this.rules.RehearsalMarkFontSize,Z=U.getModifiers(),q=Z.find(re=>re.getCategory().toLocaleLowerCase()==="repetitions");if(q&&q.setShiftY(q.y_shift-10),U.setSection(R.label,W,Y,Q),(K=this.graphicalMusicSheet.MeasureList[G][j])!=null&&K.ParentStaffLine.AbstractExpressions){const re=Z.find(oe=>oe.getCategory().toLocaleLowerCase()==="stavesection");for(let oe of((ie=(ne=(te=D==null?void 0:D.VerticalMeasureList)==null?void 0:te[0])==null?void 0:ne.ParentStaffLine)==null?void 0:ie.AbstractExpressions)||[])oe instanceof GraphicalUnknownExpression&&(re&&(oe.Label.PositionAndShape.RelativePosition.y-=.5),q&&(oe.Label.PositionAndShape.RelativePosition.y-=1.7))}}calculateSingleOctaveShift(D,R,F,G){var te;const j=R.OctaveShiftStart,U=j.ParentStartMultiExpression.Timestamp,W=(te=j.ParentEndMultiExpression)==null?void 0:te.Timestamp,Y=this.rules.MinMeasureToDrawIndex,Q=this.rules.MaxMeasureToDrawIndex;let Z=this.graphicalMusicSheet.MeasureList[F][G].ParentStaffLine;Z||(Z=this.graphicalMusicSheet.MeasureList[Y][G].ParentStaffLine);let q;j.ParentEndMultiExpression?q=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(j.ParentEndMultiExpression.SourceMeasureParent,G):q=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0),q.MeasureNumber>Q+1&&(q=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0));let J;if(j.ParentEndMultiExpression?J=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(j.ParentStartMultiExpression.SourceMeasureParent,G):J=this.graphicalMusicSheet.MeasureList[Y][G],J.MeasureNumberQ||q.parentSourceMeasure.measureListIndexQ)return;let K=q.ParentStaffLine;if(K||(K=Z),q&&Z&&K){const ne=new VexFlowOctaveShift(j,Z.PositionAndShape);if(!ne.startNote){let oe;for(const le of J.staffEntries)if(le){oe=le;break}if(!oe||(ne.setStartNote(oe),!ne.startNote))return}if(!ne.endNote){let oe;for(let le=q.staffEntries.length-1;le>=0;le++)if(q.staffEntries[le]){oe=q.staffEntries[le];break}if(ne.setEndNote(oe),!ne.endNote)return}let ie=J.findGraphicalStaffEntryFromTimestamp(U);ie||(ie=J.staffEntries[0]);let re=q.findGraphicalStaffEntryFromTimestamp(W);if(re||(re=q.staffEntries[q.staffEntries.length-1]),ne.setStartNote(ie),K!==Z){ne.endsOnDifferentStaffLine=!0;let oe=Z.Measures[Z.Measures.length-1];oe===void 0&&(oe=q);const le=oe.staffEntries[oe.staffEntries.length-1];ne.setEndNote(le);const fe=K.ParentMusicSystem.Id-Z.ParentMusicSystem.Id;if(fe>0)for(let he=Z.ParentMusicSystem.Id;heQ+1&&(q=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0));let J;if(j.ParentEndMultiExpression?J=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(j.ParentStartMultiExpression.SourceMeasureParent,G):(J=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(j.ParentStartMultiExpression.SourceMeasureParent,G),J||(J=this.graphicalMusicSheet.MeasureList[Y][G])),J.MeasureNumberQ||q.parentSourceMeasure.measureListIndexQ)return;let K=q.ParentStaffLine;if(K||(K=Z),q&&Z&&K){let ne=!1;Z!==K&&(ne=!0);const ie=new VexFlowPedal(j,Z.PositionAndShape,!1,ne);let re=J.findGraphicalStaffEntryFromTimestamp(U);re||(re=J.staffEntries[0]);let oe=q.findGraphicalStaffEntryFromTimestamp(W);if(oe||(oe=q.staffEntries[q.staffEntries.length-1]),!ie.setStartNote(re))return;if(K!==Z)if(ie.pedalSymbol===MusicSymbol.PEDAL_SYMBOL){ie.setEndNote(oe),ie.setEndMeasure(q),ie.ReleaseText=" ",ie.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(ie.startVfVoiceEntry,ie.endVfVoiceEntry,ie,Z);const le=K.Measures[0],fe=new VexFlowPedal(j,le.PositionAndShape),he=le.staffEntries[0];if(!fe.setStartNote(he))return;fe.setEndNote(oe),ie.setEndMeasure(q),K.Pedals.push(fe),fe.CalculateBoundingBox(),fe.DepressText=" ",this.calculatePedalSkyBottomLine(fe.startVfVoiceEntry,fe.endVfVoiceEntry,fe,K)}else{let le=Z.Measures[Z.Measures.length-1];le===void 0&&(le=q);const fe=le.staffEntries[le.staffEntries.length-1];ie.setEndNote(fe),ie.setEndMeasure(q),ie.ChangeEnd=!1;const he=K.ParentMusicSystem.Id-Z.ParentMusicSystem.Id;if(he>0){let ge=1;for(let ue=Z.ParentMusicSystem.Id;ueQ+1&&(q=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0));let J;if(j.ParentEndMultiExpression?J=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(j.ParentStartMultiExpression.SourceMeasureParent,G):J=this.graphicalMusicSheet.MeasureList[Y][G],J.MeasureNumberQ||q.parentSourceMeasure.measureListIndexQ)return;let K=q.ParentStaffLine;if(K||(K=Z),q&&Z&&K){const ie=new VexflowVibratoBracket(j,Z.PositionAndShape,J.ParentStaff.isTab);let re=J.findGraphicalStaffEntryFromTimestamp(U);re||(re=J.staffEntries[0]);let oe=q.findGraphicalStaffEntryFromTimestamp(W);if(oe||(oe=q.staffEntries[q.staffEntries.length-1]),ie.setStartNote(re),K!==Z){let le=Z.Measures[Z.Measures.length-1];le===void 0&&(le=q);const fe=le.staffEntries[le.staffEntries.length-1];if(ie.setEndNote(fe),K.ParentMusicSystem.Id-Z.ParentMusicSystem.Id>0)for(let ge=Z.ParentMusicSystem.Id;geq){const le=q;q=Z,Z=le}G.SkyBottomLineCalculator.updateBottomLineInRange(Z,q,J+re)}for(const re of G.Pedals){const oe=re,le=oe.getPedalMarking(),fe=le.line+3+(G.StaffLines.length-1);if(J>fe){const he=le.render_options.text_margin_right/10;let ge=oe.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-he,ue;oe.setLine(J-3-(G.StaffLines.length-1));let me=(te=oe.endVfVoiceEntry)==null?void 0:te.PositionAndShape;if(me||(me=oe.endMeasure.PositionAndShape),oe.EndSymbolPositionAndShape){const be=W.render_options.glyph_point_size/20;ue=ge+3.4;const ve=me.AbsolutePosition.x-he,pe=ve+1.5;G.SkyBottomLineCalculator.updateBottomLineInRange(ge,ue,J+be),G.SkyBottomLineCalculator.updateBottomLineInRange(ve,pe,J+be)}else{const be=le.render_options.bracket_height/10;if(le.EndsStave)ue=me.AbsolutePosition.x+me.Size.width-he;else switch(W.style){case U.BRACKET_OPEN_END:case U.BRACKET_OPEN_BOTH:case U.MIXED_OPEN_END:ue=me.AbsolutePosition.x+me.BorderRight-he;break;default:ue=me.AbsolutePosition.x+me.BorderLeft-he;break}const ve=(ie=(ne=oe.endVfVoiceEntry)==null?void 0:ne.parentStaffEntry)==null?void 0:ie.vfClefBefore;if(ve&&(ue+=ve.getWidth()/10),ge>ue){const pe=ge;ge=ue,ue=pe}G.SkyBottomLineCalculator.updateBottomLineInRange(ge,ue,J+be)}}}}calculateOctaveShiftSkyBottomLine(D,R,F,G){if(!R){log$2.warn("octaveshift: no endStaffEntry");return}let j=D.PositionAndShape.Size.width,U=R.PositionAndShape.Size.width;D.hasOnlyRests()?j=-j:j/=2,R.hasOnlyRests()?U*=2:U/=2,D===R&&(U*=2);const W=D.PositionAndShape.AbsolutePosition.x-j,Y=R.PositionAndShape.AbsolutePosition.x+U;F.PositionAndShape.Size.width=W-Y;const Q=F.getTextBracket(),Z=Q.font.size/10;if(Q.position===VF.TextBracket.Positions.TOP){const q=Math.ceil(G.SkyBottomLineCalculator.getSkyLineMinInRange(W,Y));if(q===1/0)return;Q.start.getStave().options.top_text_position=Math.abs(q),G.SkyBottomLineCalculator.updateSkyLineInRange(W,Y,q-Z*2)}else{const q=G.SkyBottomLineCalculator.getBottomLineMaxInRange(W,Y);if(q===1/0)return;Q.start.getStave().options.bottom_text_position=q,D.parentMeasure!==R.parentMeasure&&(Q.stop.getStave().options.bottom_text_position=q),G.SkyBottomLineCalculator.updateBottomLineInRange(W,Y,q+Z*1.5)}}calculateWordRepetitionInstruction(D,R){let F;const G=this.graphicalMusicSheet.MeasureList[R];for(let j=0,U=G.length;j{F.updateSkyBottomLine()})}catch{}}handleTiedGraphicalNote(D,R,F,G,j,U,W,Y){}handleBeam(D,R,F){D.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(D,R)}handleVoiceEntryLyrics(D,R,F){D.LyricsEntries.forEach((G,j)=>{const U=new GraphicalLyricEntry(j,R,this.rules.LyricsHeight,this.rules.StaffHeight);if(R.LyricsEntries.push(U),U.GraphicalLabel.setLabelPositionAndShapeBorders(),j.Word){const Y=j.Word.Syllables.indexOf(j);let Q=F.indexOf(j.Word);if(Q===-1&&(F.push(j.Word),Q=F.indexOf(j.Word)),this.graphicalLyricWords.length===0||Q>this.graphicalLyricWords.length-1){const Z=new GraphicalLyricWord(j.Word);U.ParentLyricWord=Z,Z.GraphicalLyricsEntries[Y]=U,this.graphicalLyricWords.push(Z)}else{const Z=this.graphicalLyricWords[Q];U.ParentLyricWord=Z,Z.GraphicalLyricsEntries[Y]=U,Z.isFilled()&&(F.splice(Q,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(Z),1))}}})}handleVoiceEntryOrnaments(D,R,F){}handleVoiceEntryArticulations(D,R,F){}handleVoiceEntryTechnicalInstructions(D,R,F){}handleTuplet(D,R,F){D.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(D,R)}findIndexGraphicalSlurFromSlur(D,R){for(let F=0;F=0){const q=G[Z];q.staffEntries.indexOf(U)===-1&&q.staffEntries.push(U),G.splice(Z,1)}}}for(const W of G)W.staffEntries.indexOf(U)===-1&&W.staffEntries.push(U)}}for(const R of this.musicSystems)for(const F of R.StaffLines){const G=F.GraphicalSlurs.sort(GraphicalSlur.Compare);for(const j of G)j.slur.isCrossed()||j.calculateCurve(this.rules)}}}class MusicPartManager{constructor(D){this.musicSheet=D}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(D){let R;for(let F=this.timestamps.length-1;F>=0;F--)if(R=this.timestamps[F],D.gte(R.from))return R;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(D){if(this.timestamps.length===0)return D;const R=this.getCurrentRepetitionTimestampTransform(D);return Fraction$1.plus(D,Fraction$1.minus(R.to,R.from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(D){return D?new MusicPartManagerIterator(this.musicSheet,D,void 0):new MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(D){this.musicSheet.SelectionStart=D,this.musicSheet.SelectionEnd=void 0}setSelectionRange(D,R){this.musicSheet.SelectionStart=D!=null?D:this.sheetStart,this.musicSheet.SelectionEnd=R!=null?R:this.sheetEnd}calcMapping(){this.timestamps=[];const D=this.getIterator();let R=D.CurrentRepetition,F=new TimestampTransform(D.CurrentEnrolledTimestamp.clone(),D.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(F);!D.EndReached;){if(D.JumpOccurred||R!==D.CurrentRepetition){if(R=D.CurrentRepetition,D.backJumpOccurred){const G=D.JumpResponsibleRepetition;F.nextBackJump=D.CurrentEnrolledTimestamp,F.curRepetition=G,F.curRepetitionIteration=D.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let j=this.timestamps.length-2;j>=0&&!(G.AbsoluteTimestamp.gt(this.timestamps[j].to)||this.timestamps[j].curRepetition);j--)this.timestamps[j].nextBackJump=F.nextBackJump,this.timestamps[j].curRepetition=G,this.timestamps[j].curRepetitionIteration=F.curRepetitionIteration}F=new TimestampTransform(D.CurrentEnrolledTimestamp.clone(),D.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(F)}D.moveToNext()}}}class TimestampTransform{constructor(D,R,F,G){this.from=D,this.to=R,this.curRepetition=F,this.curRepetitionIteration=G,this.nextBackJump=void 0,this.nextForwardJump=void 0}}class PartListEntry{constructor(D){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=D}get Visible(){return this.visible}set Visible(D){this.visible=D}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}}class SourceMusicPart extends PartListEntry{constructor(D,R,F){super(D),this.musicSheet=D,this.startIndex=R,this.endIndex=F}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(D){this.parentRepetition=D}get AbsoluteTimestamp(){return Fraction$1.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(D){this.startIndex=D}setEndIndex(D){this.endIndex=D}}class Repetition extends PartListEntry{constructor(D,R=!1){super(D),this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.userNumberOfRepetitions=0,this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=D,this.virtualOverallRepetition=R}get BackwardJumpInstructions(){return this.backwardJumpInstructions}get EndingIndexDict(){return this.endingIndexDict}get EndingParts(){return this.endingParts}get Visibles(){return this.visibles}set Visibles(D){this.visibles=D}get DefaultNumberOfRepetitions(){let D=2;return this.virtualOverallRepetition&&(D=1),Math.max(D,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}get UserNumberOfRepetitions(){return this.userNumberOfRepetitions}set UserNumberOfRepetitions(D){this.userNumberOfRepetitions=D,this.repetitonIterationOrder=[];const R=this.userNumberOfRepetitions-this.NumberOfEndings;for(let F=1;F<=this.userNumberOfRepetitions;F++)F<=R?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(F-R)}getForwardJumpTargetForIteration(D){const R=this.repetitonIterationOrder[D-1];return this.endingIndexDict[R]?this.endingIndexDict[R].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(D,R){const F=new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2,R,R));this.endingParts.push(F);for(const G of D)try{this.endingIndexDict[G]=F,F.endingIndices.push(G),this.numberOfEndings0&&(G=1),j.Add(new Fraction$1(G,R)),j}}class MusicSheet$1{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(D){this.soundTempos=D}static getIndexFromStaff(D){return D.idInMusicSheet}get CurrentKeyInstruction(){return this.currentKeyInstruction}set CurrentKeyInstruction(D){this.currentKeyInstruction=D}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(D){this.sourceMeasures=D}get Repetitions(){return this.repetitions}set Repetitions(D){this.repetitions=D}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(D){this.playbackSettings=D}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(D){this.drawErroneousMeasures=D}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(D){this.hasBeenOpenedForTheFirstTime=D}InitializeStartTempoInBPM(D){this.playbackSettings.BeatsPerMinute=D,this.userStartTempoInBPM=D}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(D){this.defaultStartTempoInBpm=D,this.InitializeStartTempoInBPM(D)}get Path(){return this.path}set Path(D){this.path=D}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(D){this.Title=new Label(D)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(D){this.Subtitle=new Label(D)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(D){this.Composer=new Label(D)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(D){this.Lyricist=new Label(D)}get Title(){return this.title}set Title(D){this.title=D}get Subtitle(){return this.subtitle}set Subtitle(D){this.subtitle=D}get Composer(){return this.composer}set Composer(D){this.composer=D}get Lyricist(){return this.lyricist}set Lyricist(D){this.lyricist=D}get Rules(){return this.rules||(log$2.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new EngravingRules),this.rules}set Rules(D){this.rules=D}get SheetErrors(){return this.musicSheetErrors}get PlaybackDataDict(){return this.playbackDataDict}get SelectionStart(){return this.selectionStart}set SelectionStart(D){this.selectionStart=D.clone(),this.currentEnrolledPosition=D.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(D){this.selectionEnd=D}set HasBPMInfo(D){this.hasBPMInfo=D}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(D){this.sourceMeasures.push(D),D.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let D=0,R=this.instruments.length;D0){const D=this.TimestampSortedTempoExpressionsList[0];if(D.InstantaneousTempo)return D.InstantaneousTempo.TempoInBpm;if(D.ContinuousTempo)return D.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(D){return log$2.info("MusicSheet.FirstMeasureNumber: ",D),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(D){return log$2.info("MusicSheet.LastMeasureNumber: ",D),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(D){this.currentEnrolledPosition=D.clone()}get Transpose(){return this.transpose}set Transpose(D){this.transpose=D}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(D){this.idString=D}getEnrolledSelectionStartTimeStampWorkaround(){const D=this.MusicPartManager.getIterator(this.SelectionStart);return Fraction$1.createFromFraction(D.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const D=this.getLastSourceMeasure();return Fraction$1.plus(D.AbsoluteTimestamp,D.Duration)}getSourceMeasureFromTimeStamp(D){for(let R=0,F=this.sourceMeasures.length;R0&&G.Voices[0].Visible&&D.push(G)}return D}}MusicSheet$1.defaultTitle="[no title given]";class LyricWord{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(D){for(let R=0,F=this.Syllables.length;R=0&&(this.syllableIndex=j)}get Text(){return this.text}set Text(D){this.text=D}get Word(){return this.word}get Parent(){return this.parent}set Parent(D){this.parent=D}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}}class LyricsReader{constructor(D){this.openLyricWords={},this.musicSheet=D}addLyricEntry(D,R){var F,G;if(D){const j=D;for(let U=0,W=j.length;U0)for(let fe=re;fe1&&(K=parseInt(ie[1],10))}catch{const re=ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(re);continue}}let ne;if(Q==="single"||Q==="end"){if(this.openLyricWords[K]){this.currentLyricWord=this.openLyricWords[K];const ie=this.currentLyricWord.Syllables.length;ne=new LyricsEntry(q,K,this.currentLyricWord,R,ie),this.currentLyricWord.Syllables.push(ne),delete this.openLyricWords[K],this.currentLyricWord=void 0}else ne=new LyricsEntry(q,K,void 0,R);ne.extend=Y.element("extend")!==void 0}else if(Q==="begin")this.openLyricWords[K]&&(delete this.openLyricWords[K],this.currentLyricWord=void 0),this.currentLyricWord=new LyricWord,this.openLyricWords[K]=this.currentLyricWord,ne=new LyricsEntry(q,K,this.currentLyricWord,R,0),this.currentLyricWord.Syllables.push(ne);else if(Q==="middle")if(this.openLyricWords[K]){this.currentLyricWord=this.openLyricWords[K];const ie=this.currentLyricWord.Syllables.length;ne=new LyricsEntry(q,K,this.currentLyricWord,R,ie),this.currentLyricWord.Syllables.push(ne)}else ne=new LyricsEntry(q,K,void 0,R);ne&&(R.LyricsEntries[K]||(R.LyricsEntries.setValue(K,ne),(G=(F=R.ParentSourceStaffEntry)==null?void 0:F.VerticalContainerParent)!=null&&G.ParentMeasure&&(R.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),R.ParentVoice.Parent.LyricVersesNumbers[K]||R.ParentVoice.Parent.LyricVersesNumbers.push(K))}}}catch{const Z=ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(Z);continue}}R.ParentVoice.Parent.LyricVersesNumbers=R.ParentVoice.Parent.LyricVersesNumbers.filter((U,W,Y)=>Y.indexOf(U)===W)}}}class Articulation{constructor(D,R){this.articulationEnum=D,this.placement=R}Equals(D){return D.articulationEnum===this.articulationEnum&&D.placement===this.placement}}class ArticulationReader{constructor(D){this.rules=D}getAccEnumFromString(D){switch(D){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(D,R){var F,G;if(D!==void 0&&D.elements().length>0){const j=D.elements();for(let U=0,W=j.length;U0&&R.Articulations[0].articulationEnum!==ArticulationEnum.staccato&&R.Articulations.splice(0,0,K),Q==="strongaccent"){const te=(G=Y==null?void 0:Y.attribute("type"))==null?void 0:G.value;te==="up"?K.articulationEnum=ArticulationEnum.marcatoup:te==="down"&&(K.articulationEnum=ArticulationEnum.marcatodown)}if(Q==="detachedlegato"){const te=new Articulation(ArticulationEnum.staccato,q),ne=new Articulation(ArticulationEnum.tenuto,q);R.Articulations.push(te,ne)}if(!R.hasArticulation(K))switch(R.Articulations.push(K),K.articulationEnum){case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:R.DurationModifier=K;break;case ArticulationEnum.accent:case ArticulationEnum.strongaccent:R.VolumeModifier=K;break;default:break}}}catch(Z){const q="Invalid note articulation.";log$2.debug("addArticulationExpression",q,Z);return}}}}addFermata(D,R){var j;let F=ArticulationEnum.fermata;D.attributes().length>0&&D.attribute("type")&&D.attribute("type").value==="inverted"&&(F=ArticulationEnum.invertedfermata);let G=PlacementEnum.Above;((j=D.attribute("placement"))==null?void 0:j.value)==="below"&&(G=PlacementEnum.Below),R.Articulations.push(new Articulation(F,G))}addTechnicalArticulations(D,R,F){var W,Y;const G={bend:ArticulationEnum.bend,"down-bow":ArticulationEnum.downbow,"open-string":ArticulationEnum.naturalharmonic,"snap-pizzicato":ArticulationEnum.snappizzicato,stopped:ArticulationEnum.lefthandpizzicato,"up-bow":ArticulationEnum.upbow};for(const Q in G){if(!G.hasOwnProperty(Q))continue;const Z=G[Q],q=D.element(Q);if(q){let J;((W=q.attribute("placement"))==null?void 0:W.value)==="above"&&(J=PlacementEnum.Above),((Y=q.attribute("placement"))==null?void 0:Y.value)==="below"&&(J=PlacementEnum.Below);const K=new Articulation(Z,J);R.hasArticulation(K)||R.Articulations.push(K)}}const j=D.element("fingering");if(j){const Q=this.createTechnicalInstruction(j,F);Q.type=TechnicalInstructionType.Fingering,F.Fingering=Q,R.TechnicalInstructions.push(Q)}const U=D.element("string");if(U){const Q=this.createTechnicalInstruction(U,F);Q.type=TechnicalInstructionType.String,F.StringInstruction=Q,R.TechnicalInstructions.push(Q)}}createTechnicalInstruction(D,R){const F=new TechnicalInstruction;F.sourceNote=R,F.value=D.value;const G=D.attribute("placement");return this.rules.FingeringPositionFromXML&&(F.placement=this.getPlacement(G)),F}getPlacement(D,R=PlacementEnum.NotYetDefined){if(R!==PlacementEnum.NotYetDefined)return R;if(D)switch(D.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(D,R){if(D){let F;const G={"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 j in G){if(!G.hasOwnProperty(j))continue;const U=D.element(j);if(U){F=new OrnamentContainer(G[j]);const W=U.attribute("placement");W&&W.value==="below"&&(F.placement=PlacementEnum.Below)}}if(F){const j=D.elements("accidental-mark");if(j){let U=PlacementEnum.Below,W=AccidentalEnum.NONE;const Y=j;for(let Q=0,Z=Y.length;Q0&&(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(D,R,F,G,j,U,W,Y,Q,Z,q,J,K,te,ne,ie,re,oe,le,fe,he,ge){this.currentStaffEntry=W,this.currentMeasure=Y;try{this.currentNote=U?this.addRestNote(D.element("rest"),R,G,j,K,te,le):this.addSingleNote(D,R,G,F,j,q,J,K,te,ne,ie,re,oe,le,he,ge),this.currentNote.DotsXml=fe;const ue=D.elements("lyric");this.lyricsReader!==void 0&&ue&&(this.lyricsReader.addLyricEntry(ue,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let me=!1;const be=D.element("notations");if(be){this.articulationReader&&this.readArticulations(be,this.currentVoiceEntry,this.currentNote);const ve=be.elements("slur");this.slurReader!==void 0&&ve.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(ve,this.currentNote);const pe=be.elements("tuplet");pe.length>0&&(this.openTupletNumber=this.addTuplet(D,pe),me=!0);const ye=be.element("arpeggiate");if(ye!==void 0){let Be;if(this.currentVoiceEntry.Arpeggio)Be=this.currentVoiceEntry.Arpeggio;else{let Ae=!1;for(const Te of this.currentStaffEntry.VoiceEntries)if(Te.Arpeggio){Ae=!0,Be=Te.Arpeggio;break}if(!Ae){let Te=ArpeggioType.ARPEGGIO_DIRECTIONLESS;const Ne=ye.attribute("direction");if(Ne)switch(Ne.value){case"up":Te=ArpeggioType.ROLL_UP;break;case"down":Te=ArpeggioType.ROLL_DOWN;break;default:Te=ArpeggioType.ARPEGGIO_DIRECTIONLESS}Be=new Arpeggio(this.currentVoiceEntry,Te),this.currentVoiceEntry.Arpeggio=Be}}Be.addNote(this.currentNote)}const xe=be.elements("tied");xe.length>0&&this.addTie(xe,Q,Z,TieTypes.SIMPLE);const ce=be.elements("slide");ce.length>0&&this.addTie(ce,Q,Z,TieTypes.SLIDE);const we=be.element("technical");if(we){const Be=we.elements("hammer-on");Be.length>0&&this.addTie(Be,Q,Z,TieTypes.HAMMERON);const Ae=we.elements("pull-off");Ae.length>0&&this.addTie(Ae,Q,Z,TieTypes.PULLOFF)}}D.element("time-modification")!==void 0&&!me&&this.handleTimeModificationNode(D)}catch(ue){log$2.warn(ue);const me=ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(me),this.musicSheet.SheetErrors.pushMeasureError(ue)}return this.currentNote}checkForStaffEntryLink(D,R,F,G){const j=new StaffEntryLink(this.currentVoiceEntry);j.LinkStaffEntries.push(F),F.Link=j;const U=this.currentVoiceEntry.Timestamp.clone(),W=G.getVerticalContainerByTimestamp(U);return F=W.StaffEntries[D],F||(F=new SourceStaffEntry(W,R),W.StaffEntries[D]=F),F.VoiceEntries.push(this.currentVoiceEntry),j.LinkStaffEntries.push(F),F.Link=j,F}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const D=this.openTieDict;for(const R in D)if(D.hasOwnProperty(R)){const F=D[R];Fraction$1.plus(F.StartNote.ParentStaffEntry.Timestamp,F.Duration).lt(F.StartNote.SourceMeasure.Duration)&&delete D[R]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(D,R,F){const G=D.element("articulations");G&&this.articulationReader.addArticulationExpression(G,R);const j=D.element("fermata");j&&this.articulationReader.addFermata(j,R);const U=D.element("technical");U&&this.articulationReader.addTechnicalArticulations(U,R,F);const W=D.element("ornaments");W&&this.articulationReader.addOrnament(W,R)}addSingleNote(D,R,F,G,j,U,W,Y,Q,Z,q,J,K,te,ne,ie){let re=0,oe,le=AccidentalEnum.NONE,fe=NoteEnum.C,he=NoteEnum.C,ge=0,ue=0,me,be,ve;const pe=D.elements();for(let Ne=0,Pe=pe.length;Ne0&&this.openBeams.last().ExtendedNoteList.push(te),te}addNoteInfo(D,R,F,G,j,U,W,Y,Q){D.NoteTypeXml=R,D.PrintObject=F,D.IsCueNote=G,D.NormalNotes=j,D.displayStepUnpitched=U,D.displayOctaveUnpitched=W,D.NoteheadColorXml=Y,D.NoteheadColor=Y}createBeam(D,R){var F;try{const G=D.element("beam");let j;if(G!==void 0&&G.hasAttributes&&(j=G.attribute("number")),j){let U=parseInt(j.value,10);const W=D.elements("beam"),Y=W[0].value;W&&(Y==="begin"?(U===((F=this.openBeams.last())==null?void 0:F.BeamNumber)?(this.beamNumberOffset++,U+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Beam(U,this.beamNumberOffset))):U+=this.beamNumberOffset);let Q=!1;if(!(U>0&&U<=this.openBeams.length)||!this.openBeams[U-1]){log$2.debug("[OSMD] invalid beamnumber");return}for(let Z=0,q=this.openBeams[U-1].Notes.length;Z1){let G=D.element("time-modification");G&&(G=G.element("actual-notes"));const j=R;for(let U=0,W=j.length;U1&&this.openTupletNumber--),this.tupletDict[q]=K;const ne=[];ne.push(this.currentNote),K.Notes.push(ne),K.Fractions.push(this.getTupletNoteDurationFromType(D)),this.currentNote.NoteTuplet=K,this.openTupletNumber=q}else if(Z.value==="stop"){let q=1;Y.attribute("number")&&(q=parseInt(Y.attribute("number").value,10));const J=this.tupletDict[q];if(J){const K=Y.attribute("placement");K&&(K.value==="below"?J.tupletLabelNumberPlacement=PlacementEnum.Below:J.tupletLabelNumberPlacement=PlacementEnum.Above,J.PlacementFromXml=!0);const te=[];if(te.push(this.currentNote),J.Notes.push(te),!J.PlacementFromXml){let ne=!1;for(const ie of J.Notes){for(const re of ie)if(!re.isRest()){re.StemDirectionXml===StemDirectionType.Down?J.tupletLabelNumberPlacement=PlacementEnum.Below:J.tupletLabelNumberPlacement=PlacementEnum.Above,ne=!0;break}if(ne)break}}J.Fractions.push(this.getTupletNoteDurationFromType(D)),this.currentNote.NoteTuplet=J,delete this.tupletDict[q],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(R[0]){const G=R[0];if(G.hasAttributes){const j=G.attribute("type").value;let U=1;G.attribute("number")&&(U=parseInt(G.attribute("number").value,10));const W=isNaN(U),Y=G.attribute("bracket");if(Y&&Y.value==="yes"&&(F=!0),j==="start"){let Q=0,Z=D.element("time-modification");if(Z&&(Z=Z.element("actual-notes")),Z&&(Q=parseInt(Z.value,10),isNaN(Q))){const te=ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(te),new MusicSheetReadingException(te)}W&&(this.openTupletNumber++,U=this.openTupletNumber);let q=this.tupletDict[U];q||(q=this.tupletDict[U]=new Tuplet(Q,F),q.tupletLabelNumberPlacement=PlacementEnum.Above);const J=G.attribute("placement");J&&(J.value==="below"?q.tupletLabelNumberPlacement=PlacementEnum.Below:q.tupletLabelNumberPlacement=PlacementEnum.Above,q.PlacementFromXml=!0);const K=[];K.push(this.currentNote),q.Notes.push(K),q.Fractions.push(this.getTupletNoteDurationFromType(D)),this.currentNote.NoteTuplet=q,this.openTupletNumber=U}else if(j==="stop"){W&&(U=this.openTupletNumber);const Q=this.tupletDict[this.openTupletNumber];if(Q){const Z=G.attribute("placement");Z&&(Z.value==="below"?Q.tupletLabelNumberPlacement=PlacementEnum.Below:Q.tupletLabelNumberPlacement=PlacementEnum.Above,Q.PlacementFromXml=!0);const q=[];if(q.push(this.currentNote),Q.Notes.push(q),!Q.PlacementFromXml){let J=!1;for(const K of Q.Notes){for(const te of K)if(!te.isRest()){te.StemDirectionXml===StemDirectionType.Down?Q.tupletLabelNumberPlacement=PlacementEnum.Below:Q.tupletLabelNumberPlacement=PlacementEnum.Above,J=!0;break}if(J)break}}Q.Fractions.push(this.getTupletNoteDurationFromType(D)),this.currentNote.NoteTuplet=Q,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[U]}}}}return this.openTupletNumber}handleTimeModificationNode(D){if(this.tupletDict[this.openTupletNumber])try{const R=this.tupletDict[this.openTupletNumber],F=CollectionUtil.last(R.Notes),G=F[0].ParentVoiceEntry;let j;G.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?j=F:(j=[],R.Notes.push(j),R.Fractions.push(this.getTupletNoteDurationFromType(D))),j.push(this.currentNote),this.currentNote.NoteTuplet=R}catch(R){const F=ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(F),R}else if(this.currentVoiceEntry.Notes.length>0){const R=this.currentVoiceEntry.Notes[0];if(R.NoteTuplet){const F=R.NoteTuplet;CollectionUtil.last(F.Notes).push(this.currentNote),this.currentNote.NoteTuplet=F}}}addTie(D,R,F,G){if(D){if(D.length===1){const j=D[0];if(j!==void 0&&j.attributes()){const U=this.getTieDirection(j),W=j.attribute("type").value;try{if(W==="start"){const Y=this.findCurrentNoteInTieDict(this.currentNote);Y<0&&delete this.openTieDict[Y];const Q=this.getNextAvailableNumberForTie(),Z=new Tie(this.currentNote,G);this.openTieDict[Q]=Z,Z.TieNumber=Q,Z.TieDirection=U}else if(W==="stop"){const Y=this.findCurrentNoteInTieDict(this.currentNote),Q=this.openTieDict[Y];Q&&(Q.AddNote(this.currentNote),delete this.openTieDict[Y])}}catch{const Q=ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(Q)}}}else if(D.length===2){const j=this.findCurrentNoteInTieDict(this.currentNote);if(j>=0){const U=this.openTieDict[j];U.AddNote(this.currentNote);for(const W of D)if(W.attribute("type").value==="start"){const Q=this.getTieDirection(W);U.NoteIndexToTieDirection[U.Notes.length-1]=Q}}}}}getTieDirection(D){let R=PlacementEnum.NotYetDefined;const F=D.attribute("placement");F&&(F.value==="above"?R=PlacementEnum.Above:F.value==="below"&&(R=PlacementEnum.Below));const G=D.attribute("orientation");return G&&(G.value==="over"?R=PlacementEnum.Above:G.value==="under"&&(R=PlacementEnum.Below)),R}getNextAvailableNumberForTie(){const D=Object.keys(this.openTieDict);if(D.length===0)return 1;D.sort((R,F)=>+R-+F);for(let R=0;R0?G.RealValue>0?(Q=Fraction$1.multiply(Fraction$1.minus(G,j),Q),this.directionTimestamp=Fraction$1.plus(Q,G)):this.directionTimestamp=Fraction$1.createFromFraction(Q):this.offsetDivisions<0&&(G.RealValue>0?(Q=Fraction$1.multiply(Fraction$1.minus(G,j),Q),this.directionTimestamp=Fraction$1.minus(G,Q)):this.directionTimestamp=Fraction$1.createFromFraction(Q));const Z=D.attribute("placement");if(Z)try{const q=Z.value;q==="below"?this.placement=PlacementEnum.Below:q==="above"&&(this.placement=PlacementEnum.Above)}catch(q){const J=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");log$2.debug("ExpressionReader.readExpressionParameters",J,q),this.musicSheet.SheetErrors.pushMeasureError(J),this.placement=PlacementEnum.Below}if(this.placement===PlacementEnum.NotYetDefined)try{const q=D.element("direction-type");if(q){const J=q.element("dynamics");if(J){const ie=J.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read dynamics y pos")}const K=q.element("wedge");if(K){const ie=K.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read wedge y pos")}const te=q.element("words");if(te){const ie=te.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read words y pos")}const ne=q.element("rehearsal");if(ne){const ie=ne.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read rehearsal pos")}}}catch(q){const J=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");log$2.debug("ExpressionReader.readExpressionParameters",J,q),this.musicSheet.SheetErrors.pushMeasureError(J),this.placement=PlacementEnum.Below}this.placement===PlacementEnum.NotYetDefined&&(R.Staves.length>1?this.placement=PlacementEnum.Below:R.HasLyrics?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below)}read(D,R,F,G=void 0,j=0){let U=!1,W=!1;const Y=D.element("sound");if(Y){const q=Y.attribute("tempo"),J=Y.attribute("dynamics");if(q){const K=q.value.match(/^(\d+)(\.\d+)?$/);(K==null?void 0:K.length)>0?this.soundTempo=Math.round(Number.parseFloat(q.value)):(log$2.info("invalid xml tempo: "+q.value),this.soundTempo=100),R.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,U=!0}if(J){const K=J.value.match(/\d+/);this.soundDynamic=K!==void 0?parseInt(K[0],10):100,W=!0}}const Q=D.element("direction-type");if(!Q)return;let Z=Q.element("metronome");if(Z){R.metronomeNoteIndex=j;const q=Z.element("beat-unit"),J=Z.element("beat-unit-dot")!==void 0,K=Z.element("per-minute");if(q!==void 0&&K){Z.hasAttributes&&Z.attribute("default-x")!==void 0&&(this.directionTimestamp=Fraction$1.createFromFraction(F));const ne=parseFloat(K.value);this.createNewTempoExpressionIfNeeded(R);const ie=new InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,ne,this.currentMultiTempoExpression,!0);ie.parentMeasure=R,this.soundTempo=ne,R.TempoInBPM=this.soundTempo*(J?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),R.MeasureNumberXML===1&&this.musicSheet.SourceMeasures.length===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,ie.dotted=J,ie.beatUnit=q.value,this.currentMultiTempoExpression.addExpression(ie,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}return}if(Z=Q.element("dynamics"),Z){const q=D.element("notations")!==void 0;this.interpretInstantaneousDynamics(Z,R,F,q);return}if(Z=Q.element("words"),Z){const q=Q.elements("words");let J="";for(const K of q)J+=K.value;if(Z.value=J,U||isSpeedKeyword(Z.value)||isSpeedHiddenKeyword(Z.value)){this.createNewTempoExpressionIfNeeded(R),this.currentMultiTempoExpression.CombinedExpressionsText=Z.value,(isSpeedKeyword(Z.value)||isSpeedHiddenKeyword(Z.value))&&(Z.value=void 0);const K=new InstantaneousTempoExpression(Z.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(K,"")}else W||this.interpretWords(Z,R,F);return}if(Z=Q.element("wedge"),Z){this.interpretWedge(Z,R,G,R.MeasureNumber);return}if(Z=Q.element("rehearsal"),Z){this.interpretRehearsalMark(Z,R,F,R.MeasureNumber);return}}closeOpenExpressions(D,R){for(const F of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(D,F.NumberXml,R),this.closeOpenContinuousDynamic(F,D,R);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(Fraction$1.plus(D.AbsoluteTimestamp,R))}addOctaveShift(D,R,F){var W;let G=1;const j=D.element("staff");if(j)try{G=parseInt(j.value,10)}catch(Y){const Q=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(Q),G=1,log$2.debug("ExpressionReader.addOctaveShift",Q,Y)}const U=D.element("direction-type");if(U){const Y=U.element("octave-shift"),Q=this.readPlacement(D);if(Y!==void 0&&Y.hasAttributes)try{const Z=this.readNumber(Y);if(Y.attribute("size")){const q=parseInt(Y.attribute("size").value,10);let J=0;q===8?J=1:q===15&&(J=2);let K=(W=Y.attribute("type"))==null?void 0:W.value;if(K||(Q===PlacementEnum.Above?K="down":Q===PlacementEnum.Below&&(K="up")),K==="up"||K==="down"){const te=new OctaveShift(K,J);te.StaffNumber=G,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(R,Z),this.getMultiExpression.OctaveShiftStart=te,te.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=te}else if(K==="stop"){if(this.openOctaveShift){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(R,this.openOctaveShift.numberXml,F);const te=this.getMultiExpression;te.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}}else K||log$2.debug("octave-shift missing type in xml")}}catch(Z){const q=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(q),log$2.debug("ExpressionReader.addOctaveShift",q,Z)}}}addPedalMarking(D,R,F){var j,U,W,Y;const G=D.element("direction-type");if(G){const Q=G.element("pedal");if(Q!==void 0&&Q.hasAttributes){let Z=!1,q=!1;try{switch(((j=Q.attribute("line"))==null?void 0:j.value)==="yes"?q=!0:((U=Q.attribute("line"))==null?void 0:U.value)==="no"&&(q=!1,Z=!0),((W=Q.attribute("sign"))==null?void 0:W.value)==="yes"?Z=!0:((Y=Q.attribute("sign"))==null?void 0:Y.value)==="no"&&(Z=!1,q=!0),Q.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(R),this.createNewMultiExpressionIfNeeded(R,-1),this.openPedal=new Pedal(q,Z),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(R);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(R,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(R,-1),this.openPedal=new Pedal(q,Z),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(J){const K=ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(K),log$2.debug("ExpressionReader.addPedalMarking",K,J)}}}}endOpenPedal(D){this.createNewMultiExpressionIfNeeded(D,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(D,R,F,G){if(D&&D.hasAttributes)try{switch(D.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(R,-1),this.openWavyLine=new WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(R,-1,F),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0);break;case"continue":break;default:break}}catch(j){const U=ITextTranslation.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(U),log$2.debug("ExpressionReader.addWavyLine",U,j)}}initialize(){this.placement=PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(D){var F;const R=(F=D.attribute("placement"))==null?void 0:F.value;return R==="above"?PlacementEnum.Above:R==="below"?PlacementEnum.Below:PlacementEnum.NotYetDefined}readExpressionPlacement(D,R){try{const F=parseInt(D.value,10);F<0?this.placement=PlacementEnum.Below:F>0&&(this.placement=PlacementEnum.Above)}catch(F){log$2.debug("ExpressionReader.readExpressionParameters",R,F)}}interpretInstantaneousDynamics(D,R,F,G){if(D.hasElements){D.hasAttributes&&D.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(F));const j=this.readNumber(D);let U=D.elements()[0].name;if(U==="other-dynamics"&&(U=D.elements()[0].value),U){G?this.createNewMultiExpressionIfNeeded(R,j,Fraction$1.createFromFraction(F)):this.createNewMultiExpressionIfNeeded(R,j);const W=new InstantaneousDynamicExpression(U,this.soundDynamic,this.placement,this.staffNumber,R);W.InMeasureTimestamp=F.clone(),this.getMultiExpression.addExpression(W,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=W.DynEnum:this.activeInstantaneousDynamic=new InstantaneousDynamicExpression(U,0,PlacementEnum.NotYetDefined,1,R)}}}interpretWords(D,R,F){const G=D.value;let j;const U=D.attribute("font-style");if(U&&U.value==="italic"&&(j=FontStyles.Italic),G.length>0){if(D.hasAttributes&&D.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(F)),this.checkIfWordsNodeIsRepetitionInstruction(G))return;this.fillMultiOrTempoExpression(G,R,F,j),this.initialize()}}readNumber(D){var G;let R=1;const F=(G=D.attribute("number"))==null?void 0:G.value;return F&&(R=Number.parseInt(F,10)),R}interpretWedge(D,R,F,G){var U,W;D!==void 0&&D.hasAttributes&&D.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(F));const j=this.readNumber(D);((W=(U=D.attribute("type"))==null?void 0:U.value)==null?void 0:W.toLowerCase())==="stop"?this.createNewMultiExpressionIfNeeded(R,j,F):this.createNewMultiExpressionIfNeeded(R,j),this.addWedge(D,R,F),this.initialize()}interpretRehearsalMark(D,R,F,G){R.rehearsalExpression=new RehearsalExpression(D.value,this.placement)}createNewMultiExpressionIfNeeded(D,R,F=void 0){F||(F=this.directionTimestamp);let G=this.getMultiExpression;return(!G||G&&(G.SourceMeasureParent!==D||G.numberXml!==R||G.SourceMeasureParent===D&&G.Timestamp!==F))&&(this.getMultiExpression=G=new MultiExpression(D,Fraction$1.createFromFraction(F)),D.StaffLinkedExpressions[this.globalStaffIndex].push(G)),G}createNewTempoExpressionIfNeeded(D){(!this.currentMultiTempoExpression||this.currentMultiTempoExpression.SourceMeasureParent!==D||this.currentMultiTempoExpression.Timestamp!==this.directionTimestamp)&&(this.currentMultiTempoExpression=new MultiTempoExpression(D,Fraction$1.createFromFraction(this.directionTimestamp)),D.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(D,R,F){if(D!==void 0&&D.hasAttributes){const G=this.readNumber(D),j=D.attribute("type").value.toLowerCase();try{if(j==="crescendo"||j==="diminuendo"){const U=new ContinuousDynamicExpression(ContDynamicEnum[j],this.placement,this.staffNumber,R,this.activeInstantaneousDynamic,G);this.openContinuousDynamicExpressions.push(U);let W=this.getMultiExpression;W||(W=this.createNewMultiExpressionIfNeeded(R,G)),W.StartingContinuousDynamic=U,U.StartMultiExpression=W,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===U.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(j==="stop")for(const U of this.openContinuousDynamicExpressions)U.NumberXml===G&&U.NumberXml===G&&this.closeOpenContinuousDynamic(U,R,F)}catch(U){const W="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(W),log$2.debug("ExpressionReader.addWedge",W,U)}}}fillMultiOrTempoExpression(D,R,F,G){if(!D)return;const j=D.trim();this.createExpressionFromString("",j,R,F,D,G)}createExpressionFromString(D,R,F,G,j,U){if(InstantaneousTempoExpression.isInputStringInstantaneousTempo(R)||ContinuousTempoExpression.isInputStringContinuousTempo(R)){if(F.TempoExpressions.length>0)for(let Z=0,q=F.TempoExpressions.length;Z0)for(let Z=0,q=F.TempoExpressions.length;Z0&&!this.hasDigit(R)&&this.globalStaffIndex>0){if(J.EntriesList[0].label.indexOf(R)>=0)return!1;break}}let Y=TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(Y=TextAlignmentEnum.LeftBottom);const Q=new UnknownExpression(R,this.placement,Y,this.staffNumber);return Q.fontStyle=U,W.addExpression(Q,D),!1}closeOpenContinuousDynamic(D,R,F){if(!D)return;const G=D.NumberXml;D.EndMultiExpression=this.createNewMultiExpressionIfNeeded(R,G,F),D.StartMultiExpression.EndingContinuousDynamic=D,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(j=>j!==D)}closeOpenContinuousTempo(D){this.openContinuousTempoExpression.AbsoluteEndTimestamp=D,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(D){return D=D.trim().toLowerCase(),D==="coda"||D==="tocoda"||D==="to coda"||D==="fine"||D==="d.c."||D==="dacapo"||D==="da capo"||D==="d.s."||D==="dalsegno"||D==="dal segno"||D==="d.c. al fine"||D==="d.s. al fine"||D==="d.c. al coda"||D==="d.s. al coda"}hasDigit(D){return/\d/.test(D)}}class Slur{constructor(){}get StartNote(){return this.startNote}set StartNote(D){this.startNote=D}get EndNote(){return this.endNote}set EndNote(D){this.endNote=D}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let D=0,R=this.startNote.NoteSlurs.length;D0){const G=F.attribute("type").value;let j=1;try{F.attribute("number")&&(j=parseInt(F.attribute("number").value,10))}catch(Q){log$2.debug("VoiceGenerator.addSlur number: ",Q)}let U=PlacementEnum.NotYetDefined;const W=F.attribute("placement");W&&W.value&&(W.value==="above"?U=PlacementEnum.Above:W.value==="below"&&(U=PlacementEnum.Below));const Y=F.attribute("orientation");if(Y&&Y.value&&(Y.value==="over"?U=PlacementEnum.Above:Y.value==="under"&&(U=PlacementEnum.Below)),G==="start"){let Q=this.openSlurDict[j];Q||(Q=new Slur,this.openSlurDict[j]=Q),Q.StartNote=R,Q.PlacementXml=U}else if(G==="stop"){const Q=this.openSlurDict[j];Q&&(Q.EndNote=R,R.checkForDoubleSlur(Q)||(R.NoteSlurs.push(Q),Q.StartNote.NoteSlurs.push(Q)),delete this.openSlurDict[j])}}}}catch{const G=ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(G)}}}class InstrumentReader{constructor(D,R,F,G){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=R,this.xmlMeasureList=F,this.musicSheet=G.GetMusicSheet,this.instrument=G,this.activeClefs=new Array(G.Staves.length),this.activeClefsHaveBeenInitialized=new Array(G.Staves.length);for(let j=0;j=this.xmlMeasureList.length)return!1;this.currentMeasure=D,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(D,this.currentXmlMeasureIndex);let G=new Fraction$1(0,1),j=new Fraction$1(0,1),U=!1;this.maxTieNoteFraction=new Fraction$1(0,1);let W=!1;const Y=[];try{const le=this.xmlMeasureList[this.currentXmlMeasureIndex],fe=le.elements();if(D.Rules.UseXMLMeasureNumbers&&!Number.isInteger(D.MeasureNumberXML)){const ge=parseInt((Q=le.attribute("number"))==null?void 0:Q.value,10);Number.isInteger(ge)&&(D.MeasureNumberXML=ge)}let he;for(let ge=0;ge0&&(he=fe[ge-1]),ue.name==="print"){const me=ue.attribute("new-system");(me==null?void 0:me.value)==="yes"&&(D.printNewSystemXml=!0);const be=ue.attribute("new-page");(be==null?void 0:be.value)==="yes"&&(D.printNewPageXml=!0)}else if(ue.name==="note"){ue.element("grace")||(this.xmlNotes.push(ue),Y.push(ue));let me=!0;((Z=ue.attribute("print-object"))==null?void 0:Z.value)==="no"&&(me=!1);let be=1;this.instrument.Staves.length>1&&ue.element("staff")&&(be=parseInt(ue.element("staff").value,10),isNaN(be)&&(log$2.debug("InstrumentReader.readNextXmlMeasure.get staff number"),be=1)),this.currentStaff=this.instrument.Staves[be-1];const ve=ue.element("chord")!==void 0;if(ue.element("voice")){const Re=parseInt(ue.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(Re,be-1)}else(!ve||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,be-1));let pe=0,ye=new Fraction$1(0,1),xe=2,ce,we=!1;if(ue.element("duration")){if(pe=parseInt(ue.element("duration").value,10),isNaN(pe)){const Re=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(Re),log$2.debug("InstrumentReader.readNextXmlMeasure",Re);continue}else if(ye=new Fraction$1(pe,4*this.divisions),pe===0?ye=this.getNoteDurationFromTypeNode(ue):ce=this.getNoteDurationFromTypeNode(ue),ue.element("time-modification")){ye=this.getNoteDurationForTuplet(ue);const Re=ue.element("time-modification");Re!=null&&Re.element("normal-notes")&&(xe=parseInt(Re.element("normal-notes").value,10)),we=!0}}const Be=ue.element("rest")!==void 0,Ae=ue.element("notations"),Te=ue.element("grace")!==void 0||pe===0||ve&&W;let Ne=!1,Pe=!1;if(Te){const Re=ue.element("duration"),He=ue.element("grace");He&&He.attributes()&&He.attribute("slash")&&He.attribute("slash").value==="yes"&&(Ne=!0),Re||(ye=this.getNoteDurationFromTypeNode(ue));const Je=ue.element("notations");Je&&Je.element("slur")&&(Pe=!0)}let Me=!1;ue.element("cue")&&(Me=!0);const Le=ue.element("type");let ze=NoteType.UNDEFINED;if(Le){const Re=Le.attribute("size");(Re==null?void 0:Re.value)==="cue"&&(Me=!0),ze=NoteTypeHandler.StringToNoteType(Le.value)}let ke=StemDirectionType.Undefined,Ge;const We=ue.element("stem");if(We){switch(We.value){case"down":ke=StemDirectionType.Down;break;case"up":ke=StemDirectionType.Up;break;case"double":ke=StemDirectionType.Double;break;case"none":ke=StemDirectionType.None;break;default:ke=StemDirectionType.Undefined}const Re=We.attribute("color");Re&&(Ge=this.parseXmlColor(Re.value))}let Ve=0,Ye="",et="";if(Ae){const Re=Ae.element("ornaments");if(Re){const Je=Re.element("tremolo");if(Je){const qe=Je.attribute("type");if(Ye=qe.value,qe){const rt=parseInt(Je.value,10);rt>0&&(Ve=rt),(qe.value==="start"||qe.value==="stop")&&(ye=new Fraction$1(parseInt(ue.element("duration").value,10),4*this.divisions))}}const tt=Re.elements("wavy-line");if(tt!==void 0)for(const qe of tt){const rt=this.expressionReaders[this.readExpressionStaffNumber(ue)-1];rt&&(rt.readExpressionParameters(qe,this.instrument,this.divisions,G,j,this.currentMeasure.MeasureNumber,!1),rt.addWavyLine(qe,this.currentMeasure,G,j))}}const He=Ae.element("glissando");He&&He.attribute("type").value==="start"&&(et="start")}let ot;const ft=ue.element("notehead");if(ft){const Re=ft.attribute("color");Re&&(ot=this.parseXmlColor(Re.value))}let lt;const _e=ue.attribute("color");_e&&(lt=this.parseXmlColor(_e.value),ot||(ot=lt),Ge||(Ge=lt));let Xe=G.clone();ve&&(Xe=j.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(Xe,this.inSourceMeasureInstrumentIndex+be-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!ve&&!Te&&!W||Te&&!W||Te&&!ve||!Te&&W)&&this.currentVoiceGenerator.createVoiceEntry(Xe,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,Te,Ne,Pe),!Te&&!ve&&(j=G.clone(),G.Add(ye)),ve&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+be-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const Qe=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,Qe),this.openChordSymbolContainers.length!==0&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,!we&&!Te&&(ye=new Fraction$1(pe,4*this.divisions));const Fe=ue.elements("dot").length;if(this.currentVoiceGenerator.read(ue,ye,ce,ze,xe,Be,this.currentStaffEntry,this.currentMeasure,R,this.maxTieNoteFraction,ve,F,me,Me,Te,ke,Ve,Ge,ot,Fe,Ye,et),Ae!==void 0&&Ae.element("dynamics")){const Re=this.expressionReaders[this.readExpressionStaffNumber(ue)-1];Re&&(Re.readExpressionParameters(ue,this.instrument,this.divisions,G,j,this.currentMeasure.MeasureNumber,!1),Re.read(ue,this.currentMeasure,j,void 0,Y.length))}W=Te}else if(ue.name==="attributes"){const me=ue.element("divisions");if(me&&(this.divisions=parseInt(me.value,10),isNaN(this.divisions))){const pe=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(log$2.debug("InstrumentReader.readNextXmlMeasure",pe),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(pe+this.instrument.Name);else throw U=!0,new MusicSheetReadingException(pe+this.instrument.Name)}if(!ue.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const pe=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(pe+this.instrument.Name);else throw U=!0,new MusicSheetReadingException(pe+this.instrument.Name)}this.addAbstractInstruction(ue,F,he,G.clone()),G.Equals(new Fraction$1(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],ue)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],ue)&&this.saveClefInstructionAtEndOfMeasure();const be=ue.elements("staff-details");for(const pe of be){const ye=pe.element("staff-lines");if(ye){let xe=1;const ce=pe.attribute("number");ce&&(xe=parseInt(ce.value,10)),this.instrument.Staves[xe-1].StafflineCount=parseInt(ye.value,10)}}const ve=ue.element("measure-style");if(ve){const pe=ve.element("multiple-rest");if(pe){const ye=pe.value;let xe=0;try{xe=Number.parseInt(ye,10),D.multipleRestMeasures!==void 0&&xe!==D.multipleRestMeasures?D.multipleRestMeasures=0:(D.multipleRestMeasures=xe,this.currentMultirestStartMeasure=D,this.followingMultirestMeasures=xe+1)}catch(ce){console.log("multirest parse error: "+ce)}}}}else if(ue.name==="forward"){const me=parseInt(ue.element("duration").value,10);G.Add(new Fraction$1(me,4*this.divisions))}else if(ue.name==="backup"){const me=parseInt(ue.element("duration").value,10);G.Sub(new Fraction$1(me,4*this.divisions)),G.IsNegative()&&(G=new Fraction$1(0,1)),j.Sub(new Fraction$1(me,4*this.divisions)),j.IsNegative()&&(j=new Fraction$1(0,1))}else if(ue.name==="direction"){const me=ue.elements("direction-type"),be=ue.element("direction-type");let ve=Math.min(1,G.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(ve/=this.activeRhythm.Rhythm.RealValue);let pe=!1;if(this.repetitionInstructionReader&&(pe=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(be,ve)),!pe){let ye=this.expressionReaders[0];const xe=this.readExpressionStaffNumber(ue)-1;if(xeBe==null?void 0:Be.toLocaleLowerCase()).includes((q=ce.value)==null?void 0:q.toLocaleLowerCase())&&(this.currentGradualChangeMeasure=this.currentMeasure,this.currentMeasure.speedInfo={startWord:(J=ce.value)==null?void 0:J.toLocaleLowerCase(),startXmlNoteIndex:Y.length,endXmlNoteIndex:0,resetXmlNoteIndex:0,startMeasureListIndex:this.currentXmlMeasureIndex,endMeasureListIndex:0,resetMeasureListIndex:0},this.xmlNotes=[]),ce.value.startsWith(GRADIENT_SPEED_CLOSE_TAG)&&((K=this.currentGradualChangeMeasure)==null?void 0:K.speedInfo)&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:this.xmlNotes.length,endMeasureListIndex:this.currentXmlMeasureIndex}),((te=ce.value)==null?void 0:te.toLocaleLowerCase())==="a tempo".toLocaleLowerCase()&&((ne=this.currentGradualChangeMeasure)==null?void 0:ne.speedInfo))){const{endXmlNoteIndex:Be,resetXmlNoteIndex:Ae,endMeasureListIndex:Te}=this.currentGradualChangeMeasure.speedInfo;Ae===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:Be||this.xmlNotes.length,endMeasureListIndex:Te||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}if(me.find(we=>we.element("metronome"))&&((ie=this.currentGradualChangeMeasure)==null?void 0:ie.speedInfo)){const{endXmlNoteIndex:we,resetXmlNoteIndex:Be,endMeasureListIndex:Ae}=this.currentGradualChangeMeasure.speedInfo;Be===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:we||this.xmlNotes.length,endMeasureListIndex:Ae||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}ye.readExpressionParameters(ue,this.instrument,this.divisions,G,j,this.currentMeasure.MeasureNumber,!1),ye.read(ue,this.currentMeasure,G,j.clone(),Y.length)}}}else if(ue.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(ue)&&(this.currentMeasure.HasEndLine=!0);const me=ue.attribute("location");if(ge===fe.length-1||me&&me.value==="right"){const ve=(re=ue.element("bar-style"))==null?void 0:re.value;if(ve&&(this.currentMeasure.endingBarStyleXml=ve,this.currentMeasure.endingBarStyleEnum=SystemLinesEnumHelper.xmlBarlineStyleToSystemLinesEnum(ve),(oe=this.currentGradualChangeMeasure)!=null&&oe.speedInfo)){const{endXmlNoteIndex:pe,resetXmlNoteIndex:ye,endMeasureListIndex:xe}=this.currentGradualChangeMeasure.speedInfo;ye===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:pe||this.xmlNotes.length,endMeasureListIndex:xe||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.currentGradualChangeMeasure=void 0,this.xmlNotes=[]}}}else if(ue.name==="sound")try{if(ue.attribute("tempo")){const me=parseFloat(ue.attribute("tempo").value);ue.element("offset")&&(this.soundTempos.has(this.currentXmlMeasureIndex)||this.soundTempos.set(this.currentXmlMeasureIndex,[]),this.soundTempos.get(this.currentXmlMeasureIndex).push(me)),this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=me,this.musicSheet.HasBPMInfo=!0)}}catch(me){log$2.debug("InstrumentReader.readTempoInstruction",me)}else ue.name==="harmony"&&this.openChordSymbolContainers.push(ChordSymbolReader.readChordSymbol(ue,this.musicSheet,this.activeKey))}for(const ge in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(ge)&&this.voiceGeneratorsDict[ge].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let ge=0;ge{this.voiceGeneratorsDict[ge].finalizeReadingMeasure()}),this.musicSheet.HasBPMInfo?D.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120,this.currentMeasure.TempoInBPM||(this.currentMeasure.TempoInBPM=this.musicSheet.DefaultStartTempoInBpm)}catch(le){if(U)throw new MusicSheetReadingException(le.Message);const fe=ITextTranslation.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(fe),log$2.debug("InstrumentReader.readNextXmlMeasure",fe,le)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}parseXmlColor(D){if(!!D)return D.length===7?D:D.length===9?"#"+D.substr(3):void 0}doCalculationsAfterDurationHasBeenSet(){for(const D in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(D)&&this.voiceGeneratorsDict[D].checkOpenTies()}getOrCreateVoiceGenerator(D,R){const F=this.instrument.Staves[R];let G=this.voiceGeneratorsDict[D];if(G)F.Voices.indexOf(G.GetVoice)===-1&&F.Voices.push(G.GetVoice);else{const j=this.staffMainVoiceGeneratorDict[R];j?(G=new VoiceGenerator(this.pluginManager,F,D,this.slurReader,j.GetVoice),F.Voices.push(G.GetVoice),this.voiceGeneratorsDict[D]=G):(G=new VoiceGenerator(this.pluginManager,F,D,this.slurReader),F.Voices.push(G.GetVoice),this.voiceGeneratorsDict[D]=G,this.staffMainVoiceGeneratorDict[R]=G)}return G}createExpressionGenerators(D){this.expressionReaders=new Array(D);for(let R=0;R0?R=this.musicSheet.SourceMeasures[0]:R=this.currentMeasure;const F=new ClefInstruction(ClefEnum.G,0,2);let G;R.FirstInstructionsStaffEntries[D]?(G=R.FirstInstructionsStaffEntries[D],G.removeFirstInstructionOfTypeClefInstruction()):(G=new SourceStaffEntry(void 0,void 0),R.FirstInstructionsStaffEntries[D]=G),F.Parent=G,G.Instructions.splice(0,0,F)}createDefaultKeyInstruction(){let D;this.musicSheet.SourceMeasures.length>0?D=this.musicSheet.SourceMeasures[0]:D=this.currentMeasure;const R=new KeyInstruction(void 0,0,KeyEnum.major);for(let F=this.inSourceMeasureInstrumentIndex;F0&&F[G-1].name==="backup")return!0;let j=-1;for(let U=0;U0||j<0}isAttributesNodeAtEndOfMeasure(D,R){const F=D.elements().slice();let G=0;for(let U=0;Uj}getNoteDurationFromTypeNode(D){const R=D.element("type");if(R){const F=R.value;return NoteTypeHandler.getNoteDurationFromType(F)}return new Fraction$1(0,4*this.divisions)}addAbstractInstruction(D,R,F,G){if(D.element("divisions")&&D.elements().length===1)return;const j=D.element("transpose");if(j){const Y=j.element("chromatic");Y&&(this.instrument.PlaybackTranspose=parseInt(Y.value,10))}const U=D.elements("clef");let W;if(U.length>0)for(let Y=0,Q=U.length;Y using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(W),J=2,log$2.debug("InstrumentReader.addAbstractInstruction",W,le)}const ie=Z.element("sign");if(ie)try{q=ClefEnum[ie.value],ClefInstruction.isSupportedClef(q)||(W=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(W),q=ClefEnum.G,J=2),q===ClefEnum.TAB&&(te=-1)}catch(le){W=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(W),q=ClefEnum.G,J=2,log$2.debug("InstrumentReader.addAbstractInstruction",W,le)}const re=Z.element("clef-octave-change");if(re)try{te=parseInt(re.value,10)}catch{W=ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(W),te=0}if(Z.hasAttributes&&Z.attribute("number"))try{K=parseInt(Z.attribute("number").value,10),K>this.currentClefNumber&&(K=this.currentClefNumber),this.currentClefNumber=K+1}catch{W=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(W),K=1,this.currentClefNumber=K+1}const oe=new ClefInstruction(q,te,J);this.abstractInstructions.push([K,oe,G])}if(D.element("key")!==void 0&&this.instrument.MidiInstrumentId!==MidiInstrument.Percussion){let Y=0;const Q=D.element("key").element("fifths");if(Q)try{Y=parseInt(Q.value,10)}catch(K){W=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(W),Y=0,log$2.debug("InstrumentReader.addAbstractInstruction",W,K)}let Z=KeyEnum.none,q=D.element("key");if(q&&(q=q.element("mode")),q)try{Z=KeyEnum[q.value]}catch(K){W=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(W),Z=KeyEnum.major,log$2.debug("InstrumentReader.addAbstractInstruction",W,K)}const J=new KeyInstruction(void 0,Y,Z);this.abstractInstructions.push([1,J,G])}if(D.element("time")){const Y=D.element("time");let Q=RhythmSymbolEnum.NONE,Z=!0;if(Y!==void 0&&Y.hasAttributes){const re=Y.attribute("symbol");re&&(re.value==="common"?Q=RhythmSymbolEnum.COMMON:re.value==="cut"&&(Q=RhythmSymbolEnum.CUT));const oe=Y.attribute("print-object");oe&&oe.value==="no"&&(Z=!1)}let q=0,J=0;const K=Y&&Y.element("senza-misura")!==void 0,te=D.elements("time"),ne=[],ie=[];for(let re=0,oe=te.length;re0&&ie!==void 0&&ne.length===ie.length){const oe=ne.length,le=new Array(oe);let fe=0;for(let he=0;he set to default."),this.musicSheet.SheetErrors.pushMeasureError(W),q=4,J=4,log$2.debug("InstrumentReader.addAbstractInstruction",W,oe)}const re=new RhythmInstruction(new Fraction$1(q,J,0,!1),Q);re.PrintObject=Z,this.abstractInstructions.push([1,re,G])}}}saveAbstractInstructionList(D,R){for(let F=this.abstractInstructions.length-1;F>=0;F--){const G=this.abstractInstructions[F],j=G[0],U=G[1],W=G[2];if(U instanceof ClefInstruction){const Y=U;if(this.currentXmlMeasureIndex===0||j<=this.activeClefs.length&&Y!==this.activeClefs[j-1])if(!R&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&j-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){const Q=Y,Z=this.currentStaffEntry;if(W&&Math.abs(W.RealValue-Z.Timestamp.RealValue)>.01)continue;Q.Parent=Z,Z.removeFirstInstructionOfTypeClefInstruction(),Z.Instructions.push(Q),this.activeClefs[j-1]=Y,this.abstractInstructions.splice(F,1)}else if(R){if(W.RealValue!==0)continue;let Q;if(this.currentMeasure){const Z=Y,q=this.inSourceMeasureInstrumentIndex+j-1,J=this.currentMeasure.FirstInstructionsStaffEntries[q];if(this.currentXmlMeasureIndex===0)if(!J)Q=new SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[q]=Q,Z.Parent=Q,Q.Instructions.push(Z),this.activeClefsHaveBeenInitialized[j-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[q]!==void 0&&!(J.Instructions[0]instanceof ClefInstruction))Q=J,Z.Parent=Q,Q.removeFirstInstructionOfTypeClefInstruction(),Q.Instructions.splice(0,0,Z),this.activeClefsHaveBeenInitialized[j-1]=!0;else{const K=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[q]=K,Z.Parent=K,K.Instructions.push(Z)}else if(this.activeClefsHaveBeenInitialized[j-1]){let K=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(K=this.currentMultirestStartMeasure);const te=new SourceStaffEntry(void 0,void 0);K.LastInstructionsStaffEntries[q]=te,Z.Parent=te,te.Instructions.push(Z)}else{const K=this.musicSheet.SourceMeasures[0];K.FirstInstructionsStaffEntries[q]?(Q=K.FirstInstructionsStaffEntries[q],Q.removeFirstInstructionOfTypeClefInstruction()):Q=new SourceStaffEntry(void 0,void 0),Z.Parent=Q,Q.Instructions.splice(0,0,Z),this.activeClefsHaveBeenInitialized[j-1]=!0}this.activeClefs[j-1]=Y,this.abstractInstructions.splice(F,1)}}else{let Q;const Z=this.activeRhythm.Rhythm;Z.RealValue>0&&W.RealValue/Z.RealValue>.9&&(this.currentMeasure.LastInstructionsStaffEntries[j-1]||(this.currentMeasure.LastInstructionsStaffEntries[j-1]=new SourceStaffEntry(void 0,this.instrument.Staves[j-1])),Q=this.currentMeasure.LastInstructionsStaffEntries[j-1]),Q&&(Y.Parent=Q,Q.Instructions.push(Y),this.activeClefs[j-1]=Y,this.abstractInstructions.splice(F,1))}else j<=this.activeClefs.length&&Y===this.activeClefs[j-1]&&this.abstractInstructions.splice(F,1)}if(U instanceof KeyInstruction){const Y=U;if(!this.activeKey||this.activeKey.Key!==Y.Key){this.activeKey=Y,this.abstractInstructions.splice(F,1);let Q;if(this.activeKeyHasBeenInitialized?Q=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,this.currentXmlMeasureIndex>0?Q=this.musicSheet.SourceMeasures[0]:Q=this.currentMeasure),Q)for(let Z=this.inSourceMeasureInstrumentIndex;Z=0;D--){const R=this.abstractInstructions[D][0],F=this.abstractInstructions[D][1];if(F instanceof ClefInstruction){const G=F;if(!this.activeClefs[R-1]||G.ClefType!==this.activeClefs[R-1].ClefType||G.ClefType===this.activeClefs[R-1].ClefType&&G.Line!==this.activeClefs[R-1].Line){const j=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+R-1]=j;const U=G;U.Parent=j,j.Instructions.push(U),this.activeClefs[R-1]=G,this.abstractInstructions.splice(D,1)}}}}getNoteDurationForTuplet(D){let R=new Fraction$1(0,1);const F=this.getNoteDurationFromTypeNode(D);if(D.element("time-modification")){const G=D.element("time-modification");if(G&&G.element("actual-notes")!==void 0&&G.element("normal-notes")){const j=G.element("actual-notes"),U=G.element("normal-notes");if(j!==void 0&&U){const W=parseInt(j.value,10),Y=parseInt(U.value,10);R=new Fraction$1(Y*F.Numerator,W*F.Denominator)}}}return R}readExpressionStaffNumber(D){let R=1;if(D.element("staff")){const F=D.element("staff");if(F)try{R=parseInt(F.value,10)}catch(G){const j=ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(j),R=1,log$2.debug("InstrumentReader.readExpressionStaffNumber",j,G)}}return R}readDivisionsFromNotes(){let D=0,R=this.currentXmlMeasureIndex,F=!1;for(;!F;){const G=this.xmlMeasureList[R].elements();for(let j=0,U=G.length;j0){F=!0;break}}if(D===0&&(R++,R===this.xmlMeasureList.length)){const j=ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new MusicSheetReadingException(j+this.instrument.Name)}}return D}}const _SubInstrument=class{constructor(B){this.parentInstrument=B,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=_SubInstrument.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(B){return B===MidiInstrument.Acoustic_Grand_Piano||B===MidiInstrument.Bright_Acoustic_Piano||B===MidiInstrument.Electric_Grand_Piano||B===MidiInstrument.Electric_Piano_1||B===MidiInstrument.Electric_Piano_2}setMidiInstrument(B){this.midiInstrumentID=_SubInstrument.midiInstrument[this.parseMidiInstrument(B)]}parseMidiInstrument(B){try{if(B){let D=B.toLowerCase().trim();D=D.replace(/\s+/g,"_");for(const R in _SubInstrument.midiInstrument)if(D.indexOf(R)!==-1)return R}if(this.parentInstrument.Name){let D=this.parentInstrument.Name.toLowerCase().trim();D=D.replace(/\s+/g,"_");for(const R in _SubInstrument.midiInstrument)if(D.indexOf(R)!==-1)return R}}catch{log$2.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}};let SubInstrument=_SubInstrument;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\u00F6te:MidiInstrument.Recorder,brass:MidiInstrument.Trombone,bratsche:MidiInstrument.Viola,cello:MidiInstrument.Cello,contrabass:MidiInstrument.Contrabass,drums:MidiInstrument.Percussion,flute:MidiInstrument.Flute,fl\u00F6te: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,\u5C0F\u519B\u9F13: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};class StringUtil{static StringContainsSeparatedWord(D,R,F=!1){return new RegExp("( |^)"+R+"([ .]|$)",F?"i":void 0).test(D)}}class RepetitionInstructionReader{set MusicSheet(D){this.musicSheet=D,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(D,R){this.currentMeasureIndex=R}handleLineRepetitionInstructions(D){let R=!1;if(D.elements().length>0){let F="",G=!1,j="",U="",W="";const Y=[],Q=D.element("bar-style");Q&&(W=Q.value),D.attributes().length>0&&D.attribute("location")?F=D.attribute("location").value:F="right";const Z=D.elements();for(let q=0,J=Z.length;q0)if(F==="left"){if(U==="start"){const q=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.Begin,void 0,Y);this.addInstruction(this.repetitionInstructions,q)}if(j==="forward"){const q=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,q)}}else{if(U==="stop"){const q=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.End,void 0,Y);this.addInstruction(this.repetitionInstructions,q)}if(j==="backward"){const q=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,q)}}}return R}handleRepetitionInstructionsFromWordsOrSymbols(D,R){const F=D.element("words"),G=this.currentMeasureIndex;if(F){const j="d\\s?\\.s\\.",U=F.value.trim().toLowerCase();if(StringUtil.StringContainsSeparatedWord(U,j+" al fine",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,j+" al coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,Y),!0}const W="d\\.\\s?c\\.";if(StringUtil.StringContainsSeparatedWord(U,W+" al fine",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,W+" al coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,W)||StringUtil.StringContainsSeparatedWord(U,"da\\s?capo",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,j,!0)||StringUtil.StringContainsSeparatedWord(U,"dal\\s?segno",!0)){let Y;return StringUtil.StringContainsSeparatedWord(U,"al\\s?coda",!0)?Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegnoAlCoda):Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(U,"a (la )?coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,"fine",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,"coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(U,"segno",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,Y),!0}}else if(D.element("segno")){const j=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,j),!0}else if(D.element("coda")){const j=new RepetitionInstruction(G,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,j),!0}return!1}removeRedundantInstructions(){let D=0,R=0,F=0,G=0;for(let j=0;j0&&this.findInstructionInPreviousMeasure(j,U.measureIndex,RepetitionInstructionEnum.ToCoda)&&(U.type=RepetitionInstructionEnum.None),R===0&&F===0&&(U.type=RepetitionInstructionEnum.ToCoda,U.alignment=AlignmentType.End,U.measureIndex--);break;case RepetitionInstructionEnum.Segno:if(D-G>0){let W=!1;for(let Y=0,Q=this.repetitionInstructions.length;Y0?Z.type=RepetitionInstructionEnum.DalSegnoAlCoda:Z.type=RepetitionInstructionEnum.DalSegno,U.type=RepetitionInstructionEnum.None,W=!0;break;case RepetitionInstructionEnum.DalSegno:case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:U.type=RepetitionInstructionEnum.None,W=!0;break}if(W)break}if(W)break;F-R>0?U.type=RepetitionInstructionEnum.DalSegnoAlCoda:U.type=RepetitionInstructionEnum.DalSegno,U.alignment=AlignmentType.End,U.measureIndex--}break}if(this.backwardSearchForPreviousIdenticalInstruction(j,U)||U.type===RepetitionInstructionEnum.None)this.repetitionInstructions.splice(j,1),j--;else switch(U.type){case RepetitionInstructionEnum.Fine:break;case RepetitionInstructionEnum.ToCoda:F++;break;case RepetitionInstructionEnum.Coda:R++;break;case RepetitionInstructionEnum.Segno:D++;break;case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:G++;break}}this.repetitionInstructions.sort(RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(D,R,F){for(let G=D-1;G>=0;G--){const j=this.repetitionInstructions[G];if(R-j.measureIndex===1&&j.type===F)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(D,R){for(let F=D-1;F>=0;F--)if(this.repetitionInstructions[F].equals(R))return!0;return!1}addInstruction(D,R){let F=!0;for(let G=0,j=D.length;G0;)try{const W=this.openRepetitions.last();if(W.RepetitonUnderConstruction.FromWords){if(W.WaitingForCoda){let Y=W.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;Y>=this.musicSheet.SourceMeasures.length&&(Y=-1),W.RepetitonUnderConstruction.setEndingStartIndex(2,Y)}else if(W.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(W.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){const Y=F.length-1,Q=new RepetitionInstruction(Y,RepetitionInstructionEnum.BackJumpLine,AlignmentType.End,W.RepetitonUnderConstruction);W.RepetitonUnderConstruction.BackwardJumpInstructions.push(Q),F[Y].LastRepetitionInstructions.push(Q)}this.finalizeRepetition(this.openRepetitions.last())}catch{try{const Y=this.openRepetitions.last().RepetitonUnderConstruction;for(const Q of this.repetitionInstructions)Q.parentRepetition===Y&&(Q.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(Y){log$2.error("RepetitionCalculator: calculateRepetitions2",Y)}}let G=!1;const j=0,U=this.musicSheet.SourceMeasures.length-1;for(const W of this.musicSheet.Repetitions)if(W.StartIndex===j&&W.EndIndex===U){G=!0;break}if(!G){const W=new Repetition(this.musicSheet,!0);W.FromWords=!0,W.startMarker=new RepetitionInstruction(j,RepetitionInstructionEnum.StartLine),W.startMarker.parentRepetition=W,this.musicSheet.SourceMeasures[j].FirstRepetitionInstructions.push(W.startMarker),W.endMarker=new RepetitionInstruction(U,RepetitionInstructionEnum.BackJumpLine),W.endMarker.parentRepetition=W,W.BackwardJumpInstructions.push(W.endMarker),W.UserNumberOfRepetitions=W.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(W)}for(let W=0,Y=this.musicSheet.SourceMeasures.length;W1&&Q.FirstRepetitionInstructions.sort(RepetitionInstructionComparer.Compare),Q.LastRepetitionInstructions.length>1&&Q.LastRepetitionInstructions.sort(RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(D){let R;switch(D.type){case RepetitionInstructionEnum.StartLine:R=this.createNewRepetition(this.currentMeasureIndex),D.parentRepetition=R.RepetitonUnderConstruction,R.RepetitonUnderConstruction.FromWords=!1,R.RepetitonUnderConstruction.startMarker=D,this.currentMeasure.FirstRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.BackJumpLine:R=this.getOrCreateCurrentRepetition2(!1),D.parentRepetition=R.RepetitonUnderConstruction,R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D),R.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(R);break;case RepetitionInstructionEnum.Ending:if(R=this.getOrCreateCurrentRepetition(),D.parentRepetition=R.RepetitonUnderConstruction,D.endingIndices.contains(1)&&D.alignment===AlignmentType.Begin){if(R.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||R.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){R=void 0;for(let G=this.openRepetitions.length-1;G>=0;G--){const j=this.openRepetitions[G];if(j.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(R=j;this.openRepetitions.length-1>G;){const U=this.openRepetitions.last();this.finalizeRepetition(U)}}R===void 0&&(R=this.createNewRepetition(0),R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None))}R.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex-1,RepetitionInstructionEnum.ForwardJump,AlignmentType.End,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(R.RepetitonUnderConstruction.forwardJumpInstruction))}if(D.alignment===AlignmentType.Begin)R.RepetitonUnderConstruction.setEndingsStartIndex(D.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(D);else for(let G=0,j=D.endingIndices.length;G0&&Math.abs(R.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1||this.openRepetitions.length&&this.openRepetitions.find(G=>G.RepetitonUnderConstruction.startMarker.type===RepetitionInstructionEnum.StartLine).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;R=this.createNewRepetition(this.currentMeasureIndex),D.parentRepetition=R.RepetitonUnderConstruction,R.RepetitonUnderConstruction.FromWords=!0,R.SegnoFound=!0,R.RepetitonUnderConstruction.startMarker=D,this.currentMeasure.FirstRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.Fine:if(this.openRepetitions.length===0||(R=this.getCurrentRepetition(!0),R===void 0))break;D.parentRepetition=R.RepetitonUnderConstruction,R.RepetitonUnderConstruction.FromWords=!0,R.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(R.FineFound=!0,R.RepetitonUnderConstruction.forwardJumpInstruction=D,R.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(D)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Fine,AlignmentType.End,void 0));break;case RepetitionInstructionEnum.ToCoda:if(this.openRepetitions.length===0||(R=this.getCurrentRepetition(!0),R===void 0))break;R.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(D.parentRepetition=R.RepetitonUnderConstruction,R.RepetitonUnderConstruction.FromWords=!0,R.ToCodaFound=!0,R.RepetitonUnderConstruction.forwardJumpInstruction=D,this.currentMeasure.LastRepetitionInstructions.push(D));break;case RepetitionInstructionEnum.Coda:if(this.openRepetitions.length===0)break;R=this.getOrCreateCurrentRepetition2(!0),D.parentRepetition=R.RepetitonUnderConstruction,R.WaitingForCoda?(R.CodaFound=!0,R.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(D),this.finalizeRepetition(R),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):R.ToCodaFound||(R.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(R.ToCodaFound=!0,R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.ToCoda,AlignmentType.End,R.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(R.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Coda,AlignmentType.Begin,void 0)));break;case RepetitionInstructionEnum.DaCapo:R=this.getOrCreateCurrentRepetition(),R.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(R),R.RepetitonUnderConstruction.StartIndex!==0&&(R=this.createNewRepetition(0)),D.parentRepetition=R.RepetitonUnderConstruction,R.RepetitonUnderConstruction.FromWords=!0,R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,R.RepetitonUnderConstruction),R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D),R.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(R);break;case RepetitionInstructionEnum.DalSegno:if(R=this.getOrCreateCurrentRepetition2(!0),R.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(R),R=this.createNewRepetition(0),R.RepetitonUnderConstruction.FromWords=!0,R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,R.RepetitonUnderConstruction)),D.parentRepetition=R.RepetitonUnderConstruction,!R.SegnoFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,D.measureIndex);G>=0&&(R.SegnoFound=!0,R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].FirstRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.startMarker))}R.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&R.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(R=this.getOrCreateCurrentRepetition2(!0),D.parentRepetition=R.RepetitonUnderConstruction,!R.SegnoFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,D.measureIndex);G>=0&&(R.SegnoFound=!0,R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].FirstRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.startMarker))}if(!R.FineFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,D.measureIndex);G>=0&&(R.FineFound=!0,R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.Fine,AlignmentType.Begin,R.RepetitonUnderConstruction),R.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.forwardJumpInstruction))}R.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||R.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.DaCapoAlFine:if(R=this.getOrCreateCurrentRepetition(),R.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(R),R=this.createNewRepetition(0)),R.RepetitonUnderConstruction.startMarker!==void 0&&R.RepetitonUnderConstruction.StartIndex!==0&&(R=this.createNewRepetition(0)),R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,R.RepetitonUnderConstruction),R.RepetitonUnderConstruction.FromWords=!0,D.parentRepetition=R.RepetitonUnderConstruction,!R.FineFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,D.measureIndex);G>=0&&(R.FineFound=!0,R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.Fine,AlignmentType.Begin,R.RepetitonUnderConstruction),R.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.forwardJumpInstruction))}R.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||R.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(R=this.getOrCreateCurrentRepetition2(!0),D.parentRepetition=R.RepetitonUnderConstruction,!R.SegnoFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,D.measureIndex);G>=0&&(R.SegnoFound=!0,R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].FirstRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.startMarker))}if(!R.ToCodaFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,D.measureIndex);if(G>=0)R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.forwardJumpInstruction),R.ToCodaFound=!0;else{const j=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,D.measureIndex);j>=0&&(R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(j,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[j].LastRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.forwardJumpInstruction),R.ToCodaFound=!0)}}R.ToCodaFound&&(R.WaitingForCoda=!0),R.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||R.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.DaCapoAlCoda:if(R=this.getOrCreateCurrentRepetition(),R.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(R),R=this.createNewRepetition(0)):R.RepetitonUnderConstruction.EndingParts.length===0&&(this.finalizeRepetition(R),R=this.createNewRepetition(0)),R.RepetitonUnderConstruction.startMarker!==void 0&&R.RepetitonUnderConstruction.StartIndex!==0&&(R=this.createNewRepetition(0)),R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,R.RepetitonUnderConstruction),R.RepetitonUnderConstruction.FromWords=!0,D.parentRepetition=R.RepetitonUnderConstruction,!R.ToCodaFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,D.measureIndex);if(G>=0)R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.forwardJumpInstruction),R.ToCodaFound=!0;else{const j=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,D.measureIndex);j>=0&&(R.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(j,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,R.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[j].LastRepetitionInstructions.splice(0,0,R.RepetitonUnderConstruction.forwardJumpInstruction),R.ToCodaFound=!0)}}R.ToCodaFound&&(R.WaitingForCoda=!0),R.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||R.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),R.RepetitonUnderConstruction.BackwardJumpInstructions.push(D),this.currentMeasure.LastRepetitionInstructions.push(D);break;case RepetitionInstructionEnum.None:break;default:throw new ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(D,R){for(let F=this.repetitionInstructions.length-1;F>=0;F--){const G=this.repetitionInstructions[F];if(G.measureIndex<=R&&G.type===D)return G.measureIndex}return-1}finalizeRepetition(D){const R=D.RepetitonUnderConstruction;if(R.BackwardJumpInstructions.length>0){let F=!0;const G=this.getLastFinalizedRepetition();if(G!==void 0&&R.coversIdenticalMeasures(G)){if(R.NumberOfEndings>G.NumberOfEndings){const j=this.musicSheet.Repetitions.indexOf(G,0);j>-1&&this.musicSheet.Repetitions.splice(j,1),G.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(R)}F=!1,R.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(R);F&&(R.startMarker.type===RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[R.StartIndex].FirstRepetitionInstructions.push(R.startMarker),R.UserNumberOfRepetitions=R.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(D){let R;for(let F=this.openRepetitions.length-1;F>=0;F--)if(this.openRepetitions[F].RepetitonUnderConstruction.FromWords===D){for(R=this.openRepetitions[F];F0)return this.openRepetitions.last();const D=this.createNewRepetition(0);return D.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,D.RepetitonUnderConstruction),D}getOrCreateCurrentRepetition2(D){let R;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2){for(let G=this.openRepetitions.length-1;G>=0;G--)if(R=this.openRepetitions[G],R.RepetitonUnderConstruction.FromWords===D){for(;G0){const F=this.openRepetitions.last(),G=F.RepetitonUnderConstruction;if(G.BackwardJumpInstructions.length>0){const j=Object.keys(G.EndingIndexDict);(j.length===0||G.EndingIndexDict[j[j.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(F)}}const R=new RepetitionBuildingContainer(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=D,this.openRepetitions.push(R),R}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}}class RepetitionBuildingContainer{constructor(D){this.RepetitonUnderConstruction=new Repetition(D)}}class MusicSymbolModuleFactory{static createRepetitionInstructionReader(){return new RepetitionInstructionReader}static createRepetitionCalculator(){return new RepetitionCalculator}}class ReaderPluginManager{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(D){this.voiceMeasureReadPlugins.push(D)}processVoiceMeasureReadPlugins(D,R,F){for(const G of this.voiceMeasureReadPlugins)try{G.measureReadCalculations(D,R,F)}catch(j){log$2.info("VoiceGenerator.addSingleNote: ",j)}}}class MusicSheetReader{constructor(D=void 0,R=new EngravingRules){this.completeNumberOfStaves=0,this.pluginManager=new ReaderPluginManager,D?this.afterSheetReadingModules=D:this.afterSheetReadingModules=[],this.repetitionInstructionReader=MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=R}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(D){for(const R of D)R.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(D,R){try{return this._createMusicSheet(D,R)}catch(F){log$2.error("MusicSheetReader.CreateMusicSheet",F);return}}_removeFromArray(D,R){const F=D.indexOf(R);F!==-1&&D.splice(F,1)}trimString(D){return D.replace(/^\s+|\s+$/g,"")}_lastElement(D){return D[D.length-1]}_createMusicSheet(D,R){var q;const F=[];let G=0;if(this.musicSheet=new MusicSheet$1,this.musicSheet.Path=R,this.musicSheet.Rules=this.rules,!D)throw new MusicSheetReadingException("Undefined root element");this.pushSheetLabels(D,R);const j=D.element("part-list");if(!j)throw new MusicSheetReadingException("Undefined partListNode");const U=D.elements("part"),W=j.elements();this.initializeReading(W,U,F);let Y=!0;this.currentFraction=new Fraction$1(0,1);let Q=!1,Z=D.element("identification");for(Z&&(Z=Z.element("encoding")),Z&&(Z=Z.element("software")),Z!==void 0&&Z.value==="Guitar Pro 5"&&(Q=!0);Y;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(G=0),this.currentMeasure=new SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const J of F)try{Y=Y&&J.readNextXmlMeasure(this.currentMeasure,this.currentFraction,Q)}catch(K){const te=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new MusicSheetReadingException(te,K)}Y&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(F),this.checkSourceMeasureForNullEntries(),G=this.setSourceMeasureDuration(F,G),MusicSheetReader.doCalculationsAfterDurationHasBeenSet(F),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=(q=F[0])==null?void 0:q.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 J=0,K=this.afterSheetReadingModules.length;JF){if(this.areRhythmInstructionsMixed(R)&&W.SymbolEnum!==RhythmSymbolEnum.NONE)continue;F=W.Rhythm.RealValue,G=R.indexOf(W)}}if(R.length>0&&R.lengthD.Denominator){const F=R.Denominator/D.Denominator;D.expand(F)}}checkIfMeasureIsImplicit(D,R){return!this.previousMeasure&&D.lt(R)?!0:this.previousMeasure?Fraction$1.plus(this.previousMeasure.Duration,D).Equals(R):!1}allInstrumentsHaveSameDuration(D,R){let F=0;for(let G=0,j=D.length;G=0;D--)for(let R=this.currentMeasure.VerticalSourceStaffEntryContainers[D].StaffEntries.length-1;R>=0;R--){const F=this.currentMeasure.VerticalSourceStaffEntryContainers[D].StaffEntries[R];if(F)for(let G=F.VoiceEntries.length-1;G>=0;G--){const j=F.VoiceEntries[G];j.Notes.length===0&&(this._removeFromArray(j.ParentVoice.VoiceEntries,j),this._removeFromArray(F.VoiceEntries,j))}F!==void 0&&F.VoiceEntries.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[D].StaffEntries[R]=void 0)}for(let D=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;D>=0;D--){let R=0;for(let F=0,G=this.currentMeasure.VerticalSourceStaffEntryContainers[D].StaffEntries.length;FR){if(!this.musicSheet.Title){const le=te.attribute("font-size").value,fe=parseFloat(le);F0&&Z.MidiInstrumentId!==MidiInstrument.Percussion&&(ne.midiInstrumentID=Math.max(0,parseInt(le.value,10)-1));else if(le.name==="midi-unpitched")ne.fixedKey=Math.max(0,parseInt(le.value,10));else if(le.name==="volume")try{const fe=parseFloat(le.value);ne.volume=fe/127}catch(fe){log$2.debug("ExpressionReader.readExpressionParameters","read volume",fe)}else if(le.name==="pan")try{const fe=parseFloat(le.value);ne.pan=fe/64}catch(fe){log$2.debug("ExpressionReader.readExpressionParameters","read pan",fe)}}catch(fe){log$2.info("MusicSheetReader.createInstrumentGroups midi settings: ",fe)}}}}catch(ne){log$2.info("MusicSheetReader.createInstrumentGroups: ",ne)}}if(Z.SubInstruments.length===0){const J=new SubInstrument(Z);Z.SubInstruments.push(J)}F[Q]=Z,G?(G.InstrumentalGroups.push(Z),this.musicSheet.Instruments.push(Z)):(this.musicSheet.InstrumentalGroups.push(Z),this.musicSheet.Instruments.push(Z))}else if(Y.name==="part-group"&&Y.attribute("type").value==="start"){const Q=new InstrumentalGroup("group",this.musicSheet,G);G?G.InstrumentalGroups.push(Q):this.musicSheet.InstrumentalGroups.push(Q),G=Q}else if(Y.name==="part-group"&&Y.attribute("type").value==="stop"&&G){if(G.InstrumentalGroups.length===1){const Q=G.InstrumentalGroups[0];G.Parent?(G.Parent.InstrumentalGroups.push(Q),this._removeFromArray(G.Parent.InstrumentalGroups,G)):(this.musicSheet.InstrumentalGroups.push(Q),this._removeFromArray(this.musicSheet.InstrumentalGroups,G))}G=G.Parent}}}catch(j){const U=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new MusicSheetReadingException(U,j)}for(let j=0,U=this.musicSheet.Instruments.length;j0){const j=G[0];if(j){let U=j.element("attributes");U&&(U=U.element("staves")),U?R+=parseInt(U.value,10):R++}}}if(isNaN(R)||R<=0){const F=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new MusicSheetReadingException(F)}return R}getInstrumentNumberOfStavesFromXml(D){let R=0;const F=D.element("measure");if(F){const G=F.element("attributes");let j;G&&(j=G.element("staves")),!G||!j?R=1:R=parseInt(j.value,10)}if(isNaN(R)||R<=0){const G=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new MusicSheetReadingException(G)}return R}}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(B,D){(function(R){B.exports=R()})(function(){return function R(F,G,j){function U(Q,Z){if(!G[Q]){if(!F[Q]){var q=typeof commonjsRequire$1=="function"&&commonjsRequire$1;if(!Z&&q)return q(Q,!0);if(W)return W(Q,!0);var J=new Error("Cannot find module '"+Q+"'");throw J.code="MODULE_NOT_FOUND",J}var K=G[Q]={exports:{}};F[Q][0].call(K.exports,function(te){var ne=F[Q][1][te];return U(ne||te)},K,K.exports,R,F,G,j)}return G[Q].exports}for(var W=typeof commonjsRequire$1=="function"&&commonjsRequire$1,Y=0;Y>2,K=(3&Q)<<4|Z>>4,te=1>6:64,ne=2>4,Z=(15&J)<<4|(K=W.indexOf(Y.charAt(ne++)))>>2,q=(3&K)<<6|(te=W.indexOf(Y.charAt(ne++))),oe[ie++]=Q,K!==64&&(oe[ie++]=Z),te!==64&&(oe[ie++]=q);return oe}},{"./support":30,"./utils":32}],2:[function(R,F,G){var j=R("./external"),U=R("./stream/DataWorker"),W=R("./stream/Crc32Probe"),Y=R("./stream/DataLengthProbe");function Q(Z,q,J,K,te){this.compressedSize=Z,this.uncompressedSize=q,this.crc32=J,this.compression=K,this.compressedContent=te}Q.prototype={getContentWorker:function(){var Z=new U(j.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Y("data_length")),q=this;return Z.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),Z},getCompressedWorker:function(){return new U(j.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},Q.createWorkerFrom=function(Z,q,J){return Z.pipe(new W).pipe(new Y("uncompressedSize")).pipe(q.compressWorker(J)).pipe(new Y("compressedSize")).withStreamInfo("compression",q)},F.exports=Q},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(R,F,G){var j=R("./stream/GenericWorker");G.STORE={magic:"\0\0",compressWorker:function(U){return new j("STORE compression")},uncompressWorker:function(){return new j("STORE decompression")}},G.DEFLATE=R("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(R,F,G){var j=R("./utils"),U=function(){for(var W,Y=[],Q=0;Q<256;Q++){W=Q;for(var Z=0;Z<8;Z++)W=1&W?3988292384^W>>>1:W>>>1;Y[Q]=W}return Y}();F.exports=function(W,Y){return W!==void 0&&W.length?j.getTypeOf(W)!=="string"?function(Q,Z,q,J){var K=U,te=J+q;Q^=-1;for(var ne=J;ne>>8^K[255&(Q^Z[ne])];return-1^Q}(0|Y,W,W.length,0):function(Q,Z,q,J){var K=U,te=J+q;Q^=-1;for(var ne=J;ne>>8^K[255&(Q^Z.charCodeAt(ne))];return-1^Q}(0|Y,W,W.length,0):0}},{"./utils":32}],5:[function(R,F,G){G.base64=!1,G.binary=!1,G.dir=!1,G.createFolders=!0,G.date=null,G.compression=null,G.compressionOptions=null,G.comment=null,G.unixPermissions=null,G.dosPermissions=null},{}],6:[function(R,F,G){var j=null;j=typeof Promise!="undefined"?Promise:R("lie"),F.exports={Promise:j}},{lie:37}],7:[function(R,F,G){var j=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",U=R("pako"),W=R("./utils"),Y=R("./stream/GenericWorker"),Q=j?"uint8array":"array";function Z(q,J){Y.call(this,"FlateWorker/"+q),this._pako=null,this._pakoAction=q,this._pakoOptions=J,this.meta={}}G.magic="\b\0",W.inherits(Z,Y),Z.prototype.processChunk=function(q){this.meta=q.meta,this._pako===null&&this._createPako(),this._pako.push(W.transformTo(Q,q.data),!1)},Z.prototype.flush=function(){Y.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},Z.prototype.cleanUp=function(){Y.prototype.cleanUp.call(this),this._pako=null},Z.prototype._createPako=function(){this._pako=new U[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var q=this;this._pako.onData=function(J){q.push({data:J,meta:q.meta})}},G.compressWorker=function(q){return new Z("Deflate",q)},G.uncompressWorker=function(){return new Z("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(R,F,G){function j(K,te){var ne,ie="";for(ne=0;ne>>=8;return ie}function U(K,te,ne,ie,re,oe){var le,fe,he=K.file,ge=K.compression,ue=oe!==Q.utf8encode,me=W.transformTo("string",oe(he.name)),be=W.transformTo("string",Q.utf8encode(he.name)),ve=he.comment,pe=W.transformTo("string",oe(ve)),ye=W.transformTo("string",Q.utf8encode(ve)),xe=be.length!==he.name.length,ce=ye.length!==ve.length,we="",Be="",Ae="",Te=he.dir,Ne=he.date,Pe={crc32:0,compressedSize:0,uncompressedSize:0};te&&!ne||(Pe.crc32=K.crc32,Pe.compressedSize=K.compressedSize,Pe.uncompressedSize=K.uncompressedSize);var Me=0;te&&(Me|=8),ue||!xe&&!ce||(Me|=2048);var Se=0,Le=0;Te&&(Se|=16),re==="UNIX"?(Le=798,Se|=function(ke,Ge){var We=ke;return ke||(We=Ge?16893:33204),(65535&We)<<16}(he.unixPermissions,Te)):(Le=20,Se|=function(ke){return 63&(ke||0)}(he.dosPermissions)),le=Ne.getUTCHours(),le<<=6,le|=Ne.getUTCMinutes(),le<<=5,le|=Ne.getUTCSeconds()/2,fe=Ne.getUTCFullYear()-1980,fe<<=4,fe|=Ne.getUTCMonth()+1,fe<<=5,fe|=Ne.getUTCDate(),xe&&(Be=j(1,1)+j(Z(me),4)+be,we+="up"+j(Be.length,2)+Be),ce&&(Ae=j(1,1)+j(Z(pe),4)+ye,we+="uc"+j(Ae.length,2)+Ae);var ze="";return ze+=` \0`,ze+=j(Me,2),ze+=ge.magic,ze+=j(le,2),ze+=j(fe,2),ze+=j(Pe.crc32,4),ze+=j(Pe.compressedSize,4),ze+=j(Pe.uncompressedSize,4),ze+=j(me.length,2),ze+=j(we.length,2),{fileRecord:q.LOCAL_FILE_HEADER+ze+me+we,dirRecord:q.CENTRAL_FILE_HEADER+j(Le,2)+ze+j(pe.length,2)+"\0\0\0\0"+j(Se,4)+j(ie,4)+me+we+pe}}var W=R("../utils"),Y=R("../stream/GenericWorker"),Q=R("../utf8"),Z=R("../crc32"),q=R("../signature");function J(K,te,ne,ie){Y.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=te,this.zipPlatform=ne,this.encodeFileName=ie,this.streamFiles=K,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}W.inherits(J,Y),J.prototype.push=function(K){var te=K.meta.percent||0,ne=this.entriesCount,ie=this._sources.length;this.accumulate?this.contentBuffer.push(K):(this.bytesWritten+=K.data.length,Y.prototype.push.call(this,{data:K.data,meta:{currentFile:this.currentFile,percent:ne?(te+100*(ne-ie-1))/ne:100}}))},J.prototype.openedSource=function(K){this.currentSourceOffset=this.bytesWritten,this.currentFile=K.file.name;var te=this.streamFiles&&!K.file.dir;if(te){var ne=U(K,te,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:ne.fileRecord,meta:{percent:0}})}else this.accumulate=!0},J.prototype.closedSource=function(K){this.accumulate=!1;var te=this.streamFiles&&!K.file.dir,ne=U(K,te,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(ne.dirRecord),te)this.push({data:function(ie){return q.DATA_DESCRIPTOR+j(ie.crc32,4)+j(ie.compressedSize,4)+j(ie.uncompressedSize,4)}(K),meta:{percent:100}});else for(this.push({data:ne.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},J.prototype.flush=function(){for(var K=this.bytesWritten,te=0;te=this.index;Y--)Q=(Q<<8)+this.byteAt(Y);return this.index+=W,Q},readString:function(W){return j.transformTo("string",this.readData(W))},readData:function(W){},lastIndexOfSignature:function(W){},readAndCheckSignature:function(W){},readDate:function(){var W=this.readInt(4);return new Date(Date.UTC(1980+(W>>25&127),(W>>21&15)-1,W>>16&31,W>>11&31,W>>5&63,(31&W)<<1))}},F.exports=U},{"../utils":32}],19:[function(R,F,G){var j=R("./Uint8ArrayReader");function U(W){j.call(this,W)}R("../utils").inherits(U,j),U.prototype.readData=function(W){this.checkOffset(W);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(R,F,G){var j=R("./DataReader");function U(W){j.call(this,W)}R("../utils").inherits(U,j),U.prototype.byteAt=function(W){return this.data.charCodeAt(this.zero+W)},U.prototype.lastIndexOfSignature=function(W){return this.data.lastIndexOf(W)-this.zero},U.prototype.readAndCheckSignature=function(W){return W===this.readData(4)},U.prototype.readData=function(W){this.checkOffset(W);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./DataReader":18}],21:[function(R,F,G){var j=R("./ArrayReader");function U(W){j.call(this,W)}R("../utils").inherits(U,j),U.prototype.readData=function(W){if(this.checkOffset(W),W===0)return new Uint8Array(0);var Y=this.data.subarray(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./ArrayReader":17}],22:[function(R,F,G){var j=R("../utils"),U=R("../support"),W=R("./ArrayReader"),Y=R("./StringReader"),Q=R("./NodeBufferReader"),Z=R("./Uint8ArrayReader");F.exports=function(q){var J=j.getTypeOf(q);return j.checkSupport(J),J!=="string"||U.uint8array?J==="nodebuffer"?new Q(q):U.uint8array?new Z(j.transformTo("uint8array",q)):new W(j.transformTo("array",q)):new Y(q)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(R,F,G){G.LOCAL_FILE_HEADER="PK",G.CENTRAL_FILE_HEADER="PK",G.CENTRAL_DIRECTORY_END="PK",G.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",G.ZIP64_CENTRAL_DIRECTORY_END="PK",G.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(R,F,G){var j=R("./GenericWorker"),U=R("../utils");function W(Y){j.call(this,"ConvertWorker to "+Y),this.destType=Y}U.inherits(W,j),W.prototype.processChunk=function(Y){this.push({data:U.transformTo(this.destType,Y.data),meta:Y.meta})},F.exports=W},{"../utils":32,"./GenericWorker":28}],25:[function(R,F,G){var j=R("./GenericWorker"),U=R("../crc32");function W(){j.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}R("../utils").inherits(W,j),W.prototype.processChunk=function(Y){this.streamInfo.crc32=U(Y.data,this.streamInfo.crc32||0),this.push(Y)},F.exports=W},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(R,F,G){var j=R("../utils"),U=R("./GenericWorker");function W(Y){U.call(this,"DataLengthProbe for "+Y),this.propName=Y,this.withStreamInfo(Y,0)}j.inherits(W,U),W.prototype.processChunk=function(Y){if(Y){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+Y.data.length}U.prototype.processChunk.call(this,Y)},F.exports=W},{"../utils":32,"./GenericWorker":28}],27:[function(R,F,G){var j=R("../utils"),U=R("./GenericWorker");function W(Y){U.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Y.then(function(Z){Q.dataIsReady=!0,Q.data=Z,Q.max=Z&&Z.length||0,Q.type=j.getTypeOf(Z),Q.isPaused||Q._tickAndRepeat()},function(Z){Q.error(Z)})}j.inherits(W,U),W.prototype.cleanUp=function(){U.prototype.cleanUp.call(this),this.data=null},W.prototype.resume=function(){return!!U.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,j.delay(this._tickAndRepeat,[],this)),!0)},W.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(j.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},W.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Y=null,Q=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":Y=this.data.substring(this.index,Q);break;case"uint8array":Y=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":Y=this.data.slice(this.index,Q)}return this.index=Q,this.push({data:Y,meta:{percent:this.max?this.index/this.max*100:0}})},F.exports=W},{"../utils":32,"./GenericWorker":28}],28:[function(R,F,G){function j(U){this.name=U||"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}j.prototype={push:function(U){this.emit("data",U)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(U){this.emit("error",U)}return!0},error:function(U){return!this.isFinished&&(this.isPaused?this.generatedError=U:(this.isFinished=!0,this.emit("error",U),this.previous&&this.previous.error(U),this.cleanUp()),!0)},on:function(U,W){return this._listeners[U].push(W),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(U,W){if(this._listeners[U])for(var Y=0;Y "+U:U}},F.exports=j},{}],29:[function(R,F,G){var j=R("../utils"),U=R("./ConvertWorker"),W=R("./GenericWorker"),Y=R("../base64"),Q=R("../support"),Z=R("../external"),q=null;if(Q.nodestream)try{q=R("../nodejs/NodejsStreamOutputAdapter")}catch{}function J(te,ne){return new Z.Promise(function(ie,re){var oe=[],le=te._internalType,fe=te._outputType,he=te._mimeType;te.on("data",function(ge,ue){oe.push(ge),ne&&ne(ue)}).on("error",function(ge){oe=[],re(ge)}).on("end",function(){try{var ge=function(ue,me,be){switch(ue){case"blob":return j.newBlob(j.transformTo("arraybuffer",me),be);case"base64":return Y.encode(me);default:return j.transformTo(ue,me)}}(fe,function(ue,me){var be,ve=0,pe=null,ye=0;for(be=0;be>>6:(ie<65536?ne[le++]=224|ie>>>12:(ne[le++]=240|ie>>>18,ne[le++]=128|ie>>>12&63),ne[le++]=128|ie>>>6&63),ne[le++]=128|63&ie);return ne}(K)},G.utf8decode=function(K){return U.nodebuffer?j.transformTo("nodebuffer",K).toString("utf-8"):function(te){var ne,ie,re,oe,le=te.length,fe=new Array(2*le);for(ne=ie=0;ne>10&1023,fe[ie++]=56320|1023&re)}return fe.length!==ie&&(fe.subarray?fe=fe.subarray(0,ie):fe.length=ie),j.applyFromCharCode(fe)}(K=j.transformTo(U.uint8array?"uint8array":"array",K))},j.inherits(q,Y),q.prototype.processChunk=function(K){var te=j.transformTo(U.uint8array?"uint8array":"array",K.data);if(this.leftOver&&this.leftOver.length){if(U.uint8array){var ne=te;(te=new Uint8Array(ne.length+this.leftOver.length)).set(this.leftOver,0),te.set(ne,this.leftOver.length)}else te=this.leftOver.concat(te);this.leftOver=null}var ie=function(oe,le){var fe;for((le=le||oe.length)>oe.length&&(le=oe.length),fe=le-1;0<=fe&&(192&oe[fe])==128;)fe--;return fe<0||fe===0?le:fe+Q[oe[fe]]>le?fe:le}(te),re=te;ie!==te.length&&(U.uint8array?(re=te.subarray(0,ie),this.leftOver=te.subarray(ie,te.length)):(re=te.slice(0,ie),this.leftOver=te.slice(ie,te.length))),this.push({data:G.utf8decode(re),meta:K.meta})},q.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:G.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},G.Utf8DecodeWorker=q,j.inherits(J,Y),J.prototype.processChunk=function(K){this.push({data:G.utf8encode(K.data),meta:K.meta})},G.Utf8EncodeWorker=J},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(R,F,G){var j=R("./support"),U=R("./base64"),W=R("./nodejsUtils"),Y=R("set-immediate-shim"),Q=R("./external");function Z(ie){return ie}function q(ie,re){for(var oe=0;oe>8;this.dir=!!(16&this.externalFileAttributes),K==0&&(this.dosPermissions=63&this.externalFileAttributes),K==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(K){if(this.extraFields[1]){var te=j(this.extraFields[1].value);this.uncompressedSize===U.MAX_VALUE_32BITS&&(this.uncompressedSize=te.readInt(8)),this.compressedSize===U.MAX_VALUE_32BITS&&(this.compressedSize=te.readInt(8)),this.localHeaderOffset===U.MAX_VALUE_32BITS&&(this.localHeaderOffset=te.readInt(8)),this.diskNumberStart===U.MAX_VALUE_32BITS&&(this.diskNumberStart=te.readInt(4))}},readExtraFields:function(K){var te,ne,ie,re=K.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});K.index+4>>6:(K<65536?J[ie++]=224|K>>>12:(J[ie++]=240|K>>>18,J[ie++]=128|K>>>12&63),J[ie++]=128|K>>>6&63),J[ie++]=128|63&K);return J},G.buf2binstring=function(q){return Z(q,q.length)},G.binstring2buf=function(q){for(var J=new j.Buf8(q.length),K=0,te=J.length;K>10&1023,oe[te++]=56320|1023&ne)}return Z(oe,te)},G.utf8border=function(q,J){var K;for((J=J||q.length)>q.length&&(J=q.length),K=J-1;0<=K&&(192&q[K])==128;)K--;return K<0||K===0?J:K+Y[q[K]]>J?K:J}},{"./common":41}],43:[function(R,F,G){F.exports=function(j,U,W,Y){for(var Q=65535&j|0,Z=j>>>16&65535|0,q=0;W!==0;){for(W-=q=2e3>>1:U>>>1;W[Y]=U}return W}();F.exports=function(U,W,Y,Q){var Z=j,q=Q+Y;U^=-1;for(var J=Q;J>>8^Z[255&(U^W[J])];return-1^U}},{}],46:[function(R,F,G){var j,U=R("../utils/common"),W=R("./trees"),Y=R("./adler32"),Q=R("./crc32"),Z=R("./messages"),q=0,J=4,K=0,te=-2,ne=-1,ie=4,re=2,oe=8,le=9,fe=286,he=30,ge=19,ue=2*fe+1,me=15,be=3,ve=258,pe=ve+be+1,ye=42,xe=113,ce=1,we=2,Be=3,Ae=4;function Te(_e,Xe){return _e.msg=Z[Xe],Xe}function Ne(_e){return(_e<<1)-(4<_e?9:0)}function Pe(_e){for(var Xe=_e.length;0<=--Xe;)_e[Xe]=0}function Me(_e){var Xe=_e.state,Qe=Xe.pending;Qe>_e.avail_out&&(Qe=_e.avail_out),Qe!==0&&(U.arraySet(_e.output,Xe.pending_buf,Xe.pending_out,Qe,_e.next_out),_e.next_out+=Qe,Xe.pending_out+=Qe,_e.total_out+=Qe,_e.avail_out-=Qe,Xe.pending-=Qe,Xe.pending===0&&(Xe.pending_out=0))}function Se(_e,Xe){W._tr_flush_block(_e,0<=_e.block_start?_e.block_start:-1,_e.strstart-_e.block_start,Xe),_e.block_start=_e.strstart,Me(_e.strm)}function Le(_e,Xe){_e.pending_buf[_e.pending++]=Xe}function ze(_e,Xe){_e.pending_buf[_e.pending++]=Xe>>>8&255,_e.pending_buf[_e.pending++]=255&Xe}function ke(_e,Xe){var Qe,Fe,Re=_e.max_chain_length,He=_e.strstart,Je=_e.prev_length,tt=_e.nice_match,qe=_e.strstart>_e.w_size-pe?_e.strstart-(_e.w_size-pe):0,rt=_e.window,dt=_e.w_mask,ut=_e.prev,yt=_e.strstart+ve,Et=rt[He+Je-1],st=rt[He+Je];_e.prev_length>=_e.good_match&&(Re>>=2),tt>_e.lookahead&&(tt=_e.lookahead);do if(rt[(Qe=Xe)+Je]===st&&rt[Qe+Je-1]===Et&&rt[Qe]===rt[He]&&rt[++Qe]===rt[He+1]){He+=2,Qe++;do;while(rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&rt[++He]===rt[++Qe]&&Heqe&&--Re!=0);return Je<=_e.lookahead?Je:_e.lookahead}function Ge(_e){var Xe,Qe,Fe,Re,He,Je,tt,qe,rt,dt,ut=_e.w_size;do{if(Re=_e.window_size-_e.lookahead-_e.strstart,_e.strstart>=ut+(ut-pe)){for(U.arraySet(_e.window,_e.window,ut,ut,0),_e.match_start-=ut,_e.strstart-=ut,_e.block_start-=ut,Xe=Qe=_e.hash_size;Fe=_e.head[--Xe],_e.head[Xe]=ut<=Fe?Fe-ut:0,--Qe;);for(Xe=Qe=ut;Fe=_e.prev[--Xe],_e.prev[Xe]=ut<=Fe?Fe-ut:0,--Qe;);Re+=ut}if(_e.strm.avail_in===0)break;if(Je=_e.strm,tt=_e.window,qe=_e.strstart+_e.lookahead,rt=Re,dt=void 0,dt=Je.avail_in,rt=be)for(He=_e.strstart-_e.insert,_e.ins_h=_e.window[He],_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[He+1])&_e.hash_mask;_e.insert&&(_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[He+be-1])&_e.hash_mask,_e.prev[He&_e.w_mask]=_e.head[_e.ins_h],_e.head[_e.ins_h]=He,He++,_e.insert--,!(_e.lookahead+_e.insert=be&&(_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[_e.strstart+be-1])&_e.hash_mask,Qe=_e.prev[_e.strstart&_e.w_mask]=_e.head[_e.ins_h],_e.head[_e.ins_h]=_e.strstart),Qe!==0&&_e.strstart-Qe<=_e.w_size-pe&&(_e.match_length=ke(_e,Qe)),_e.match_length>=be)if(Fe=W._tr_tally(_e,_e.strstart-_e.match_start,_e.match_length-be),_e.lookahead-=_e.match_length,_e.match_length<=_e.max_lazy_match&&_e.lookahead>=be){for(_e.match_length--;_e.strstart++,_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[_e.strstart+be-1])&_e.hash_mask,Qe=_e.prev[_e.strstart&_e.w_mask]=_e.head[_e.ins_h],_e.head[_e.ins_h]=_e.strstart,--_e.match_length!=0;);_e.strstart++}else _e.strstart+=_e.match_length,_e.match_length=0,_e.ins_h=_e.window[_e.strstart],_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[_e.strstart+1])&_e.hash_mask;else Fe=W._tr_tally(_e,0,_e.window[_e.strstart]),_e.lookahead--,_e.strstart++;if(Fe&&(Se(_e,!1),_e.strm.avail_out===0))return ce}return _e.insert=_e.strstart=be&&(_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[_e.strstart+be-1])&_e.hash_mask,Qe=_e.prev[_e.strstart&_e.w_mask]=_e.head[_e.ins_h],_e.head[_e.ins_h]=_e.strstart),_e.prev_length=_e.match_length,_e.prev_match=_e.match_start,_e.match_length=be-1,Qe!==0&&_e.prev_length<_e.max_lazy_match&&_e.strstart-Qe<=_e.w_size-pe&&(_e.match_length=ke(_e,Qe),_e.match_length<=5&&(_e.strategy===1||_e.match_length===be&&4096<_e.strstart-_e.match_start)&&(_e.match_length=be-1)),_e.prev_length>=be&&_e.match_length<=_e.prev_length){for(Re=_e.strstart+_e.lookahead-be,Fe=W._tr_tally(_e,_e.strstart-1-_e.prev_match,_e.prev_length-be),_e.lookahead-=_e.prev_length-1,_e.prev_length-=2;++_e.strstart<=Re&&(_e.ins_h=(_e.ins_h<<_e.hash_shift^_e.window[_e.strstart+be-1])&_e.hash_mask,Qe=_e.prev[_e.strstart&_e.w_mask]=_e.head[_e.ins_h],_e.head[_e.ins_h]=_e.strstart),--_e.prev_length!=0;);if(_e.match_available=0,_e.match_length=be-1,_e.strstart++,Fe&&(Se(_e,!1),_e.strm.avail_out===0))return ce}else if(_e.match_available){if((Fe=W._tr_tally(_e,0,_e.window[_e.strstart-1]))&&Se(_e,!1),_e.strstart++,_e.lookahead--,_e.strm.avail_out===0)return ce}else _e.match_available=1,_e.strstart++,_e.lookahead--}return _e.match_available&&(Fe=W._tr_tally(_e,0,_e.window[_e.strstart-1]),_e.match_available=0),_e.insert=_e.strstart_e.pending_buf_size-5&&(Qe=_e.pending_buf_size-5);;){if(_e.lookahead<=1){if(Ge(_e),_e.lookahead===0&&Xe===q)return ce;if(_e.lookahead===0)break}_e.strstart+=_e.lookahead,_e.lookahead=0;var Fe=_e.block_start+Qe;if((_e.strstart===0||_e.strstart>=Fe)&&(_e.lookahead=_e.strstart-Fe,_e.strstart=Fe,Se(_e,!1),_e.strm.avail_out===0)||_e.strstart-_e.block_start>=_e.w_size-pe&&(Se(_e,!1),_e.strm.avail_out===0))return ce}return _e.insert=0,Xe===J?(Se(_e,!0),_e.strm.avail_out===0?Be:Ae):(_e.strstart>_e.block_start&&(Se(_e,!1),_e.strm.avail_out),ce)}),new Ye(4,4,8,4,We),new Ye(4,5,16,8,We),new Ye(4,6,32,32,We),new Ye(4,4,16,16,Ve),new Ye(8,16,32,32,Ve),new Ye(8,16,128,128,Ve),new Ye(8,32,128,256,Ve),new Ye(32,128,258,1024,Ve),new Ye(32,258,258,4096,Ve)],G.deflateInit=function(_e,Xe){return lt(_e,Xe,oe,15,8,0)},G.deflateInit2=lt,G.deflateReset=ft,G.deflateResetKeep=ot,G.deflateSetHeader=function(_e,Xe){return _e&&_e.state?_e.state.wrap!==2?te:(_e.state.gzhead=Xe,K):te},G.deflate=function(_e,Xe){var Qe,Fe,Re,He;if(!_e||!_e.state||5>8&255),Le(Fe,Fe.gzhead.time>>16&255),Le(Fe,Fe.gzhead.time>>24&255),Le(Fe,Fe.level===9?2:2<=Fe.strategy||Fe.level<2?4:0),Le(Fe,255&Fe.gzhead.os),Fe.gzhead.extra&&Fe.gzhead.extra.length&&(Le(Fe,255&Fe.gzhead.extra.length),Le(Fe,Fe.gzhead.extra.length>>8&255)),Fe.gzhead.hcrc&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending,0)),Fe.gzindex=0,Fe.status=69):(Le(Fe,0),Le(Fe,0),Le(Fe,0),Le(Fe,0),Le(Fe,0),Le(Fe,Fe.level===9?2:2<=Fe.strategy||Fe.level<2?4:0),Le(Fe,3),Fe.status=xe);else{var Je=oe+(Fe.w_bits-8<<4)<<8;Je|=(2<=Fe.strategy||Fe.level<2?0:Fe.level<6?1:Fe.level===6?2:3)<<6,Fe.strstart!==0&&(Je|=32),Je+=31-Je%31,Fe.status=xe,ze(Fe,Je),Fe.strstart!==0&&(ze(Fe,_e.adler>>>16),ze(Fe,65535&_e.adler)),_e.adler=1}if(Fe.status===69)if(Fe.gzhead.extra){for(Re=Fe.pending;Fe.gzindex<(65535&Fe.gzhead.extra.length)&&(Fe.pending!==Fe.pending_buf_size||(Fe.gzhead.hcrc&&Fe.pending>Re&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending-Re,Re)),Me(_e),Re=Fe.pending,Fe.pending!==Fe.pending_buf_size));)Le(Fe,255&Fe.gzhead.extra[Fe.gzindex]),Fe.gzindex++;Fe.gzhead.hcrc&&Fe.pending>Re&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending-Re,Re)),Fe.gzindex===Fe.gzhead.extra.length&&(Fe.gzindex=0,Fe.status=73)}else Fe.status=73;if(Fe.status===73)if(Fe.gzhead.name){Re=Fe.pending;do{if(Fe.pending===Fe.pending_buf_size&&(Fe.gzhead.hcrc&&Fe.pending>Re&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending-Re,Re)),Me(_e),Re=Fe.pending,Fe.pending===Fe.pending_buf_size)){He=1;break}He=Fe.gzindexRe&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending-Re,Re)),He===0&&(Fe.gzindex=0,Fe.status=91)}else Fe.status=91;if(Fe.status===91)if(Fe.gzhead.comment){Re=Fe.pending;do{if(Fe.pending===Fe.pending_buf_size&&(Fe.gzhead.hcrc&&Fe.pending>Re&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending-Re,Re)),Me(_e),Re=Fe.pending,Fe.pending===Fe.pending_buf_size)){He=1;break}He=Fe.gzindexRe&&(_e.adler=Q(_e.adler,Fe.pending_buf,Fe.pending-Re,Re)),He===0&&(Fe.status=103)}else Fe.status=103;if(Fe.status===103&&(Fe.gzhead.hcrc?(Fe.pending+2>Fe.pending_buf_size&&Me(_e),Fe.pending+2<=Fe.pending_buf_size&&(Le(Fe,255&_e.adler),Le(Fe,_e.adler>>8&255),_e.adler=0,Fe.status=xe)):Fe.status=xe),Fe.pending!==0){if(Me(_e),_e.avail_out===0)return Fe.last_flush=-1,K}else if(_e.avail_in===0&&Ne(Xe)<=Ne(Qe)&&Xe!==J)return Te(_e,-5);if(Fe.status===666&&_e.avail_in!==0)return Te(_e,-5);if(_e.avail_in!==0||Fe.lookahead!==0||Xe!==q&&Fe.status!==666){var tt=Fe.strategy===2?function(qe,rt){for(var dt;;){if(qe.lookahead===0&&(Ge(qe),qe.lookahead===0)){if(rt===q)return ce;break}if(qe.match_length=0,dt=W._tr_tally(qe,0,qe.window[qe.strstart]),qe.lookahead--,qe.strstart++,dt&&(Se(qe,!1),qe.strm.avail_out===0))return ce}return qe.insert=0,rt===J?(Se(qe,!0),qe.strm.avail_out===0?Be:Ae):qe.last_lit&&(Se(qe,!1),qe.strm.avail_out===0)?ce:we}(Fe,Xe):Fe.strategy===3?function(qe,rt){for(var dt,ut,yt,Et,st=qe.window;;){if(qe.lookahead<=ve){if(Ge(qe),qe.lookahead<=ve&&rt===q)return ce;if(qe.lookahead===0)break}if(qe.match_length=0,qe.lookahead>=be&&0qe.lookahead&&(qe.match_length=qe.lookahead)}if(qe.match_length>=be?(dt=W._tr_tally(qe,1,qe.match_length-be),qe.lookahead-=qe.match_length,qe.strstart+=qe.match_length,qe.match_length=0):(dt=W._tr_tally(qe,0,qe.window[qe.strstart]),qe.lookahead--,qe.strstart++),dt&&(Se(qe,!1),qe.strm.avail_out===0))return ce}return qe.insert=0,rt===J?(Se(qe,!0),qe.strm.avail_out===0?Be:Ae):qe.last_lit&&(Se(qe,!1),qe.strm.avail_out===0)?ce:we}(Fe,Xe):j[Fe.level].func(Fe,Xe);if(tt!==Be&&tt!==Ae||(Fe.status=666),tt===ce||tt===Be)return _e.avail_out===0&&(Fe.last_flush=-1),K;if(tt===we&&(Xe===1?W._tr_align(Fe):Xe!==5&&(W._tr_stored_block(Fe,0,0,!1),Xe===3&&(Pe(Fe.head),Fe.lookahead===0&&(Fe.strstart=0,Fe.block_start=0,Fe.insert=0))),Me(_e),_e.avail_out===0))return Fe.last_flush=-1,K}return Xe!==J?K:Fe.wrap<=0?1:(Fe.wrap===2?(Le(Fe,255&_e.adler),Le(Fe,_e.adler>>8&255),Le(Fe,_e.adler>>16&255),Le(Fe,_e.adler>>24&255),Le(Fe,255&_e.total_in),Le(Fe,_e.total_in>>8&255),Le(Fe,_e.total_in>>16&255),Le(Fe,_e.total_in>>24&255)):(ze(Fe,_e.adler>>>16),ze(Fe,65535&_e.adler)),Me(_e),0=Qe.w_size&&(He===0&&(Pe(Qe.head),Qe.strstart=0,Qe.block_start=0,Qe.insert=0),rt=new U.Buf8(Qe.w_size),U.arraySet(rt,Xe,dt-Qe.w_size,Qe.w_size,0),Xe=rt,dt=Qe.w_size),Je=_e.avail_in,tt=_e.next_in,qe=_e.input,_e.avail_in=dt,_e.next_in=0,_e.input=Xe,Ge(Qe);Qe.lookahead>=be;){for(Fe=Qe.strstart,Re=Qe.lookahead-(be-1);Qe.ins_h=(Qe.ins_h<>>=be=me>>>24,le-=be,(be=me>>>16&255)===0)we[Z++]=65535&me;else{if(!(16&be)){if((64&be)==0){me=fe[(65535&me)+(oe&(1<>>=be,le-=be),le<15&&(oe+=ce[Y++]<>>=be=me>>>24,le-=be,!(16&(be=me>>>16&255))){if((64&be)==0){me=he[(65535&me)+(oe&(1<>>=be,le-=be,(be=Z-q)>3,oe&=(1<<(le-=ve<<3))-1,j.next_in=Y,j.next_out=Z,j.avail_in=Y>>24&255)+(ye>>>8&65280)+((65280&ye)<<8)+((255&ye)<<24)}function oe(){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 j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function le(ye){var xe;return ye&&ye.state?(xe=ye.state,ye.total_in=ye.total_out=xe.total=0,ye.msg="",xe.wrap&&(ye.adler=1&xe.wrap),xe.mode=te,xe.last=0,xe.havedict=0,xe.dmax=32768,xe.head=null,xe.hold=0,xe.bits=0,xe.lencode=xe.lendyn=new j.Buf32(ne),xe.distcode=xe.distdyn=new j.Buf32(ie),xe.sane=1,xe.back=-1,J):K}function fe(ye){var xe;return ye&&ye.state?((xe=ye.state).wsize=0,xe.whave=0,xe.wnext=0,le(ye)):K}function he(ye,xe){var ce,we;return ye&&ye.state?(we=ye.state,xe<0?(ce=0,xe=-xe):(ce=1+(xe>>4),xe<48&&(xe&=15)),xe&&(xe<8||15=Ae.wsize?(j.arraySet(Ae.window,xe,ce-Ae.wsize,Ae.wsize,0),Ae.wnext=0,Ae.whave=Ae.wsize):(we<(Be=Ae.wsize-Ae.wnext)&&(Be=we),j.arraySet(Ae.window,xe,ce-we,Be,Ae.wnext),(we-=Be)?(j.arraySet(Ae.window,xe,ce-we,we,0),Ae.wnext=we,Ae.whave=Ae.wsize):(Ae.wnext+=Be,Ae.wnext===Ae.wsize&&(Ae.wnext=0),Ae.whave>>8&255,ce.check=W(ce.check,He,2,0),Se=Me=0,ce.mode=2;break}if(ce.flags=0,ce.head&&(ce.head.done=!1),!(1&ce.wrap)||(((255&Me)<<8)+(Me>>8))%31){ye.msg="incorrect header check",ce.mode=30;break}if((15&Me)!=8){ye.msg="unknown compression method",ce.mode=30;break}if(Se-=4,_e=8+(15&(Me>>>=4)),ce.wbits===0)ce.wbits=_e;else if(_e>ce.wbits){ye.msg="invalid window size",ce.mode=30;break}ce.dmax=1<<_e,ye.adler=ce.check=1,ce.mode=512&Me?10:12,Se=Me=0;break;case 2:for(;Se<16;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>8&1),512&ce.flags&&(He[0]=255&Me,He[1]=Me>>>8&255,ce.check=W(ce.check,He,2,0)),Se=Me=0,ce.mode=3;case 3:for(;Se<32;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>8&255,He[2]=Me>>>16&255,He[3]=Me>>>24&255,ce.check=W(ce.check,He,4,0)),Se=Me=0,ce.mode=4;case 4:for(;Se<16;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>8),512&ce.flags&&(He[0]=255&Me,He[1]=Me>>>8&255,ce.check=W(ce.check,He,2,0)),Se=Me=0,ce.mode=5;case 5:if(1024&ce.flags){for(;Se<16;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>8&255,ce.check=W(ce.check,He,2,0)),Se=Me=0}else ce.head&&(ce.head.extra=null);ce.mode=6;case 6:if(1024&ce.flags&&(Ne<(ke=ce.length)&&(ke=Ne),ke&&(ce.head&&(_e=ce.head.extra_len-ce.length,ce.head.extra||(ce.head.extra=new Array(ce.head.extra_len)),j.arraySet(ce.head.extra,we,Ae,ke,_e)),512&ce.flags&&(ce.check=W(ce.check,we,ke,Ae)),Ne-=ke,Ae+=ke,ce.length-=ke),ce.length))break e;ce.length=0,ce.mode=7;case 7:if(2048&ce.flags){if(Ne===0)break e;for(ke=0;_e=we[Ae+ke++],ce.head&&_e&&ce.length<65536&&(ce.head.name+=String.fromCharCode(_e)),_e&&ke>9&1,ce.head.done=!0),ye.adler=ce.check=0,ce.mode=12;break;case 10:for(;Se<32;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>=7&Se,Se-=7&Se,ce.mode=27;break}for(;Se<3;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>=1)){case 0:ce.mode=14;break;case 1:if(ve(ce),ce.mode=20,xe!==6)break;Me>>>=2,Se-=2;break e;case 2:ce.mode=17;break;case 3:ye.msg="invalid block type",ce.mode=30}Me>>>=2,Se-=2;break;case 14:for(Me>>>=7&Se,Se-=7&Se;Se<32;){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>16^65535)){ye.msg="invalid stored block lengths",ce.mode=30;break}if(ce.length=65535&Me,Se=Me=0,ce.mode=15,xe===6)break e;case 15:ce.mode=16;case 16:if(ke=ce.length){if(Ne>>=5,Se-=5,ce.ndist=1+(31&Me),Me>>>=5,Se-=5,ce.ncode=4+(15&Me),Me>>>=4,Se-=4,286>>=3,Se-=3}for(;ce.have<19;)ce.lens[Je[ce.have++]]=0;if(ce.lencode=ce.lendyn,ce.lenbits=7,Qe={bits:ce.lenbits},Xe=Q(0,ce.lens,0,19,ce.lencode,0,ce.work,Qe),ce.lenbits=Qe.bits,Xe){ye.msg="invalid code lengths set",ce.mode=30;break}ce.have=0,ce.mode=19;case 19:for(;ce.have>>16&255,et=65535&Re,!((Ve=Re>>>24)<=Se);){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>=Ve,Se-=Ve,ce.lens[ce.have++]=et;else{if(et===16){for(Fe=Ve+2;Se>>=Ve,Se-=Ve,ce.have===0){ye.msg="invalid bit length repeat",ce.mode=30;break}_e=ce.lens[ce.have-1],ke=3+(3&Me),Me>>>=2,Se-=2}else if(et===17){for(Fe=Ve+3;Se>>=Ve)),Me>>>=3,Se-=3}else{for(Fe=Ve+7;Se>>=Ve)),Me>>>=7,Se-=7}if(ce.have+ke>ce.nlen+ce.ndist){ye.msg="invalid bit length repeat",ce.mode=30;break}for(;ke--;)ce.lens[ce.have++]=_e}}if(ce.mode===30)break;if(ce.lens[256]===0){ye.msg="invalid code -- missing end-of-block",ce.mode=30;break}if(ce.lenbits=9,Qe={bits:ce.lenbits},Xe=Q(Z,ce.lens,0,ce.nlen,ce.lencode,0,ce.work,Qe),ce.lenbits=Qe.bits,Xe){ye.msg="invalid literal/lengths set",ce.mode=30;break}if(ce.distbits=6,ce.distcode=ce.distdyn,Qe={bits:ce.distbits},Xe=Q(q,ce.lens,ce.nlen,ce.ndist,ce.distcode,0,ce.work,Qe),ce.distbits=Qe.bits,Xe){ye.msg="invalid distances set",ce.mode=30;break}if(ce.mode=20,xe===6)break e;case 20:ce.mode=21;case 21:if(6<=Ne&&258<=Pe){ye.next_out=Te,ye.avail_out=Pe,ye.next_in=Ae,ye.avail_in=Ne,ce.hold=Me,ce.bits=Se,Y(ye,ze),Te=ye.next_out,Be=ye.output,Pe=ye.avail_out,Ae=ye.next_in,we=ye.input,Ne=ye.avail_in,Me=ce.hold,Se=ce.bits,ce.mode===12&&(ce.back=-1);break}for(ce.back=0;Ye=(Re=ce.lencode[Me&(1<>>16&255,et=65535&Re,!((Ve=Re>>>24)<=Se);){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>ot)])>>>16&255,et=65535&Re,!(ot+(Ve=Re>>>24)<=Se);){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>=ot,Se-=ot,ce.back+=ot}if(Me>>>=Ve,Se-=Ve,ce.back+=Ve,ce.length=et,Ye===0){ce.mode=26;break}if(32&Ye){ce.back=-1,ce.mode=12;break}if(64&Ye){ye.msg="invalid literal/length code",ce.mode=30;break}ce.extra=15&Ye,ce.mode=22;case 22:if(ce.extra){for(Fe=ce.extra;Se>>=ce.extra,Se-=ce.extra,ce.back+=ce.extra}ce.was=ce.length,ce.mode=23;case 23:for(;Ye=(Re=ce.distcode[Me&(1<>>16&255,et=65535&Re,!((Ve=Re>>>24)<=Se);){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>ot)])>>>16&255,et=65535&Re,!(ot+(Ve=Re>>>24)<=Se);){if(Ne===0)break e;Ne--,Me+=we[Ae++]<>>=ot,Se-=ot,ce.back+=ot}if(Me>>>=Ve,Se-=Ve,ce.back+=Ve,64&Ye){ye.msg="invalid distance code",ce.mode=30;break}ce.offset=et,ce.extra=15&Ye,ce.mode=24;case 24:if(ce.extra){for(Fe=ce.extra;Se>>=ce.extra,Se-=ce.extra,ce.back+=ce.extra}if(ce.offset>ce.dmax){ye.msg="invalid distance too far back",ce.mode=30;break}ce.mode=25;case 25:if(Pe===0)break e;if(ke=ze-Pe,ce.offset>ke){if((ke=ce.offset-ke)>ce.whave&&ce.sane){ye.msg="invalid distance too far back",ce.mode=30;break}Ge=ke>ce.wnext?(ke-=ce.wnext,ce.wsize-ke):ce.wnext-ke,ke>ce.length&&(ke=ce.length),We=ce.window}else We=Be,Ge=Te-ce.offset,ke=ce.length;for(Peue?(be=Ge[We+ie[xe]],Se[Le+ie[xe]]):(be=96,0),oe=1<>Te)+(le-=oe)]=me<<24|be<<16|ve|0,le!==0;);for(oe=1<>=1;if(oe!==0?(Me&=oe-1,Me+=oe):Me=0,xe++,--ze[ye]==0){if(ye===we)break;ye=q[J+ie[xe]]}if(Be>>7)]}function Le(Re,He){Re.pending_buf[Re.pending++]=255&He,Re.pending_buf[Re.pending++]=He>>>8&255}function ze(Re,He,Je){Re.bi_valid>re-Je?(Re.bi_buf|=He<>re-Re.bi_valid,Re.bi_valid+=Je-re):(Re.bi_buf|=He<>>=1,Je<<=1,0<--He;);return Je>>>1}function We(Re,He,Je){var tt,qe,rt=new Array(ie+1),dt=0;for(tt=1;tt<=ie;tt++)rt[tt]=dt=dt+Je[tt-1]<<1;for(qe=0;qe<=He;qe++){var ut=Re[2*qe+1];ut!==0&&(Re[2*qe]=Ge(rt[ut]++,ut))}}function Ve(Re){var He;for(He=0;He>1;1<=Je;Je--)ot(Re,rt,Je);for(qe=yt;Je=Re.heap[1],Re.heap[1]=Re.heap[Re.heap_len--],ot(Re,rt,1),tt=Re.heap[1],Re.heap[--Re.heap_max]=Je,Re.heap[--Re.heap_max]=tt,rt[2*qe]=rt[2*Je]+rt[2*tt],Re.depth[qe]=(Re.depth[Je]>=Re.depth[tt]?Re.depth[Je]:Re.depth[tt])+1,rt[2*Je+1]=rt[2*tt+1]=qe,Re.heap[1]=qe++,ot(Re,rt,1),2<=Re.heap_len;);Re.heap[--Re.heap_max]=Re.heap[1],function(st,xt){var Lt,Gt,ai,Ft,Qt,Jt,mt=xt.dyn_tree,ri=xt.max_code,ci=xt.stat_desc.static_tree,Zt=xt.stat_desc.has_stree,Gi=xt.stat_desc.extra_bits,bi=xt.stat_desc.extra_base,Wt=xt.stat_desc.max_length,Qi=0;for(Ft=0;Ft<=ie;Ft++)st.bl_count[Ft]=0;for(mt[2*st.heap[st.heap_max]+1]=0,Lt=st.heap_max+1;Lt>=7;qe>>=1)if(1&Et&&ut.dyn_ltree[2*yt]!==0)return U;if(ut.dyn_ltree[18]!==0||ut.dyn_ltree[20]!==0||ut.dyn_ltree[26]!==0)return W;for(yt=32;yt>>3,(rt=Re.static_len+3+7>>>3)<=qe&&(qe=rt)):qe=rt=Je+5,Je+4<=qe&&He!==-1?Fe(Re,He,Je,tt):Re.strategy===4||rt===qe?(ze(Re,2+(tt?1:0),3),ft(Re,pe,ye)):(ze(Re,4+(tt?1:0),3),function(ut,yt,Et,st){var xt;for(ze(ut,yt-257,5),ze(ut,Et-1,5),ze(ut,st-4,4),xt=0;xt>>8&255,Re.pending_buf[Re.d_buf+2*Re.last_lit+1]=255&He,Re.pending_buf[Re.l_buf+Re.last_lit]=255&Je,Re.last_lit++,He===0?Re.dyn_ltree[2*Je]++:(Re.matches++,He--,Re.dyn_ltree[2*(ce[Je]+q+1)]++,Re.dyn_dtree[2*Se(He)]++),Re.last_lit===Re.lit_bufsize-1},G._tr_align=function(Re){ze(Re,2,3),ke(Re,le,pe),function(He){He.bi_valid===16?(Le(He,He.bi_buf),He.bi_buf=0,He.bi_valid=0):8<=He.bi_valid&&(He.pending_buf[He.pending++]=255&He.bi_buf,He.bi_buf>>=8,He.bi_valid-=8)}(Re)}},{"../utils/common":41}],53:[function(R,F,G){F.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(R,F,G){F.exports=typeof setImmediate=="function"?setImmediate:function(){var j=[].slice.apply(arguments);j.splice(1,0,0),setTimeout.apply(null,j)}},{}]},{},[10])(10)})})(jszip_min);var JSZip=jszip_min.exports;class MXLHelper{static MXLtoIXmlElement(D){const R=new JSZip;return R.loadAsync(D).then(j=>R.file("META-INF/container.xml").async("text"),j=>{throw j}).then(j=>{const Y=new DOMParser().parseFromString(j,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return R.file(Y).async("text")},j=>{throw j}).then(j=>{const W=new DOMParser().parseFromString(j,"text/xml"),Y=new IXmlElement(W.documentElement);return Promise.resolve(Y)},j=>{throw j}).then(j=>j,j=>{throw new Error("extractSheetFromMxl: "+j.message)})}static MXLtoXMLstring(D){const R=new JSZip;return R.loadAsync(D).then(F=>R.file("META-INF/container.xml").async("text"),F=>{throw log$2.error(F),F}).then(F=>{const U=new DOMParser().parseFromString(F,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return R.file(U).async("text")},F=>{throw F})}}class PlaybackNoteGenerator{calculate(D){const R=new MusicPartManagerIterator(D);for(;!R.EndReached;){const F=R.CurrentEnrolledTimestamp,G=R.CurrentAudibleVoiceEntries();for(const j of G)this.handleVoiceEntry(D,j,F);R.moveToNext()}}handleVoiceEntry(D,R,F){if(R.IsGrace)return;const G=R.ParentVoice;let j;D.PlaybackDataDict.containsKey(G)?j=D.PlaybackDataDict.getValue(G):(j=[],D.PlaybackDataDict.setValue(G,j));for(const U of R.PlaybackEntries)if(U.HasNotes){for(const Y of U.Notes)Y.setLength();const W=Fraction$1.plus(F,U.TimestampShift);PlaybackNoteGenerator.addEntrySorted(j,U,W)}}static addEntrySorted(D,R,F){if(D.length===0)D.push({enrolledTimestamp:F,playbackEntry:R});else for(let G=D.length-1;G>=0;G--){const j=D[G];if(F.RealValue>j.enrolledTimestamp.RealValue)if(G===D.length-1){D.push({enrolledTimestamp:F,playbackEntry:R});break}else{D.splice(G+1,0,{enrolledTimestamp:F,playbackEntry:R});break}}}}class ScreenViewingRegion{constructor(D,R,F,G){this.psi=new BoundingBox$2(void 0),this.displaySizeInPixel=D,this.RelativeDisplaySize=R,this.RelativeDisplayPosition=F,this.WidthInUnits=G}static createWithRelativeDefaults(D,R){return new ScreenViewingRegion(D,new SizeF2D(1,1),new PointF2D(0,0),R)}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(D){this.psi.AbsolutePosition=D}get DisplaySizeInPixel(){return this.displaySizeInPixel}set DisplaySizeInPixel(D){this.displaySizeInPixel=D,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(D){this.relativeRegionSize=D,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(D){this.psi.BorderRight=D,this.recalculateDependentVariables()}get ViewRegionInUnits(){return new SizeF2D(this.psi.BorderRight,this.psi.BorderBottom)}isVisible(D,R){const F=this.psi.collisionDetection(D);return this.psi.liesInsideBorders(D),F}isInsideDisplayArea(D,R){return this.RelativeDisplayPosition.x<=D&&D<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=R&&R<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}transformToUnitCoordinates(D){return new PointF2D(this.UpperLeftPositionInUnits.x+this.ViewRegionInUnits.width*((D.x-this.RelativeDisplayPosition.x)/this.RelativeDisplaySize.width),this.UpperLeftPositionInUnits.y+this.ViewRegionInUnits.height*((D.y-this.RelativeDisplayPosition.y)/this.RelativeDisplaySize.height))}transformLengthXToUnitCoordinates(D){return D/this.horizontalUnitToPixelRatio}transformLengthYToUnitCoordinates(D){return D/this.verticalUnitToPixelRatio}recalculateDependentVariables(){const D=this.regionSizeInPixel.width/this.regionSizeInPixel.height;this.psi.BorderBottom=this.psi.BorderRight/D,this.horizontalUnitToPixelRatio=this.regionSizeInPixel.width/this.ViewRegionInUnits.width,this.verticalUnitToPixelRatio=this.regionSizeInPixel.height/this.ViewRegionInUnits.height}}class AbstractZoomView{constructor(D){this.aspectRatio=1,this.zoomViews=[],this.mouseZoomMode=!1,this.autoScrollY=!0,this.displayInteractionManager=D,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(D,R){if(!this.convertToUnitsReady())return;const F=this.getPositionInUnits(D,R);this.unitPosTouched(F,D,R)}get TouchActive(){return this.displayInteractionManager.TouchActive}get TouchMoving(){return this.displayInteractionManager.TouchMoving}positionDoubleTouched(D,R){if(!this.convertToUnitsReady())return;const F=this.getPositionInUnits(D,R);this.unitPosDoubleTouched(F,D,R)}get UsesManuallyControlledZoomMode(){return this.usesManuallyControlledZoomMode}set UsesManuallyControlledZoomMode(D){this.usesManuallyControlledZoomMode=D}mouseDown(D,R,F=!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 G=this.getPositionInUnits(D,R);this.unitPosTouchDown(G,D,R),this.usesManuallyControlledZoomMode||(F?this.mouseZoomMode=!0:this.mouseZoomMode=!1)}mouseUp(D,R){const F=this.getPositionInUnits(D,R);this.unitPosTouchUp(F,D,R)}mouseMove(D,R,F,G){this.mouseZoomMode?(Math.abs(F-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+F))),!this.lockRanges&&Math.abs(G-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-G)))):(Math.abs(F-0)>1e-8&&(this.OffsetX=this.lastOffsetX-F*this.RangeX),Math.abs(G-0)>1e-8&&(this.OffsetY=this.lastOffsetY-G*this.RangeY));const j=this.getPositionInUnits(D,R);this.unitPosMove(j,D,R)}zoom(D){this.RangeX=Math.abs(this.lastRangeX/D)}addZoomView(D){this.zoomViews.push(D)}get OffsetX(){return this.offsetX}set OffsetX(D){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,D));for(const R of this.zoomViews)R.viewportXChanged(this.offsetX,this.RangeX)}get OffsetY(){return this.offsetY}set OffsetY(D){this.offsetY=D,this.offsetY>this.offsetYMax?this.offsetY=this.offsetYMax:this.offsetY(B[B.SingleTouch=0]="SingleTouch",B[B.DoubleTouch=1]="DoubleTouch",B[B.TouchUp=2]="TouchUp",B[B.TouchDown=3]="TouchDown",B[B.Move=4]="Move",B))(InteractionType||{});class VoiceEntryInteractionListener{constructor(D){this.renderingManager=D}userDisplayInteraction(D,R,F){var G,j;switch(F){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const U=this.renderingManager.GraphicalMusicSheet.GetNearestVoiceEntry(R);U&&U.parentStaffEntry.parentVerticalContainer!==void 0&&((G=U.notes[0])==null?void 0:G.sourceNote.Pitch)!==void 0&&((j=this.renderingManager.PlaybackManager)==null||j.playVoiceEntry(U.parentVoiceEntry));break}}}}class SheetRenderingManager extends AbstractZoomView{constructor(D,R){super(D),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=R,this.addZoomView(this),this.lockRanges=!0,this.TopBarHeightInPixel=70,this.BottomBarHeightInPixel=0,this.rules.UseDefaultVoiceInteractionListener&&this.listeners.push(new VoiceEntryInteractionListener(this))}addListener(D){this.listeners.push(D)}get Listeners(){return this.listeners}convertToUnitsReady(){return this.graphicalMusicSheet!==void 0}unitPosTouched(D,R,F){if(!this.SingleTouchDisabled){const G=new PointF2D(R,F);this.handleUserDisplayInteraction(G,D,InteractionType.SingleTouch)}}unitPosDoubleTouched(D,R,F){if(!this.DoubleTouchDisabled){const G=new PointF2D(R,F);this.handleUserDisplayInteraction(G,D,InteractionType.DoubleTouch)}}unitPosTouchDown(D,R,F){const G=new PointF2D(R,F);this.handleUserDisplayInteraction(G,D,InteractionType.TouchDown),this.yOffsetMouseDown=D.y}unitPosTouchUp(D,R,F){const G=new PointF2D(R,F);this.handleUserDisplayInteraction(G,D,InteractionType.TouchUp),this.displayInteractionManager.WasZoomGestureActive===!1&&this.unlockFromCursorIfNecessary(D),this.yOffsetMouseDown=Number.MIN_VALUE}unitPosMove(D,R,F){const G=new PointF2D(R,F);this.handleUserDisplayInteraction(G,D,InteractionType.Move),this.unlockFromCursorIfNecessary(D)}get MainViewingRegion(){return this.mainViewingRegion}setMusicSheet(D){this.graphicalMusicSheet=D,this.adaptDisplayLimitsToSheet(),this.setYOffset(0,!0)}viewportXChanged(D,R){this.graphicalMusicSheet!==void 0&&this.horizontalViewportChanged(D,R)}viewportYChanged(D,R){this.graphicalMusicSheet!==void 0&&(this.yOffsetMouseDown<=Number.MIN_VALUE+.5&&(this.yOffsetMouseDown=D),this.verticalViewportChanged(D,R))}displaySizeChanged(D,R){super.viewSizeChanged(D,R),!(Math.abs(D-0)<1e-7||Math.abs(R-0)<1e-7)&&(this.graphicalMusicSheet!==void 0&&this.graphicalMusicSheet.EnforceRedrawOfMusicSystems(),this.mainViewingRegion.DisplaySizeInPixel=new SizeF2D(D,R),this.adaptDisplayLimitsToSheet())}calcDisplayYPosition(D){return D.PositionAndShape.AbsolutePosition.y+D.PositionAndShape.BorderMarginTop-this.topBarHeightInUnits()-this.relativeTopPosition*this.heightWithoutTopBottomBarsInUnits()}yPositionForLastSystem(D){return D.PositionAndShape.AbsolutePosition.y+D.PositionAndShape.BorderMarginBottom-this.topBarHeightInUnits()-(1-this.relativeTopPosition)*this.heightWithoutTopBottomBarsInUnits()}scorePositionChanged(D,R,F,G,j,U){const W=this.calcDisplayYPosition(G);this.setYPosition(W,U)}setXPosition(D,R){this.LockDisplayToCursor&&this.setXOffset(D,R)}setYPosition(D,R){this.LockDisplayToCursor&&this.setYOffset(D,R)}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(D,R){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(D,R))}graphicalObjectIsVisible(D){return this.mainViewingRegion.isVisible(D,!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 D=this.graphicalMusicSheet.MusicPages.last().PositionAndShape;this.offsetYMax=Math.max(0,D.BorderMarginBottom-.7*this.RangeY),this.OffsetY>this.offsetYMax&&this.setYOffset(this.offsetYMax,!0)}horizontalViewportChanged(D,R){this.mainViewingRegion.WidthInUnits!==R&&(this.mainViewingRegion.WidthInUnits=R)}verticalViewportChanged(D,R){this.mainViewingRegion.UpperLeftPositionInUnits=new PointF2D(this.mainViewingRegion.UpperLeftPositionInUnits.x,D)}unlockFromCursorIfNecessary(D){if(this.LockDisplayToCursor===!1||this.ZoomActive||this.displayInteractionManager.ZoomGestureActive||this.displayInteractionManager.WasZoomGestureActive)return;Math.abs((D.y-this.yOffsetMouseDown)*this.mainViewingRegion.RegionSizeInPixel.height/this.mainViewingRegion.ViewRegionInUnits.height)>this.unlockCursorDistancePixel&&(this.LockDisplayToCursor=!1)}getPositionInUnits(D,R){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(D,R))}handleUserDisplayInteraction(D,R,F){switch(F){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const G=this.graphicalMusicSheet.GetNearestVoiceEntry(R);if(G){const j=new CustomEvent("note-click",{detail:{...G,setAvtivePlay:()=>{var U,W;if(G.parentStaffEntry.parentVerticalContainer!==void 0){const Y=G.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;this.setStartPosition(Y),((U=G.notes[0])==null?void 0:U.sourceNote.Pitch)!==void 0&&(console.log("playback clicked note",G.parentVoiceEntry),(W=this.PlaybackManager)==null||W.playVoiceEntry(G.parentVoiceEntry))}}}});window.dispatchEvent(j)}}case InteractionType.TouchUp:case InteractionType.TouchDown:case InteractionType.Move:for(const G of this.listeners)G.userDisplayInteraction(D,R,F);break;default:throw new Error("type")}}setStartPosition(D){var R;this.graphicalMusicSheet!==void 0&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=D,(R=this.PlaybackManager)==null||R.reset())}get GraphicalMusicSheet(){return this.graphicalMusicSheet}}class WebSheetRenderingManager extends SheetRenderingManager{mouseMove(D,R,F,G){const j=this.getPositionInUnits(D,R);this.unitPosMove(j,D,R)}}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(D){this.listeners.push(D)}get ZoomGestureActive(){return this.zoomGestureActive}get WasZoomGestureActive(){return this.interactionWasZoomGesture}displaySizeChanged(D,R){this.displayWidth=D,this.displayHeight=R;for(const F of this.listeners)F.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(D,R,F){this.interactionWasZoomGesture=!1;const G=D/this.displayWidth,j=R/this.displayHeight;this.lastRelPosX=G,this.lastRelPosY=j,this.lastPixelX=D,this.lastPixelY=R,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);for(const U of this.listeners)U.mouseDown(G,j,!F)}move(D,R){if(this.touchActive&&!this.zoomGestureActive){const F=D/this.displayWidth,G=R/this.displayHeight,j=F-this.lastRelPosX,U=G-this.lastRelPosY;this.touchMoving=!0;for(const W of this.listeners)W.mouseMove(F,G,j,U)}}zoomGestureStarted(){this.zoomGestureActive=!0}zoomGestureCompleted(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}zoomGestureMove(D){this.zoomGestureActive&&this.listeners.forEach(function(R){R.zoom(D)})}touchUp(D,R){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);const F=D/this.displayWidth,G=R/this.displayHeight;for(const j of this.listeners)j.mouseUp(F,G)}click(D,R){if(!this.mouseDidMove(this.lastPixelX,D,this.lastPixelY,R)&&!this.ZoomGestureActive){const F=D/this.displayWidth,G=R/this.displayHeight;for(const j of this.listeners)j.positionTouched(F,G)}}doubleClick(D,R){if(!this.mouseDidMove(this.lastPixelX,D,this.lastPixelY,R)&&!this.ZoomGestureActive){const F=D/this.displayWidth,G=R/this.displayHeight;for(const j of this.listeners)j.positionDoubleTouched(F,G)}}mouseDidMove(D,R,F,G){const j=Math.abs(D-R)/this.displayDpi,U=Math.abs(F-G)/this.displayDpi;return j>this.movementThreshInch||U>this.movementThreshInch}}class WebDisplayInteractionManager extends AbstractDisplayInteractionManager{constructor(D){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=D,this.listenForInteractions()}get FullOffsetTop(){return this.fullOffsetTop}get FullScrollTop(){return this.fullScrollTop}get FullOffsetLeft(){return this.fullOffsetLeft}get FullScrollLeft(){return this.fullScrollLeft}static resizeCallback(D,R){clearTimeout(R.timeout),R.timeout=setTimeout(()=>{R.fullOffsetLeft=0,R.fullOffsetTop=0;let F=R.osmdSheetMusicContainer;for(;F;)R.fullOffsetLeft+=F.offsetLeft,R.fullOffsetTop+=F.offsetTop,F=F.offsetParent;R.resizeEventListener(),R.deregisterScrollOffsets(),R.registerScrollOffsets()},500)}registerScrollOffsets(){let D=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;const R=this;for(;D&&D!==document.documentElement;){if(this.parentScrollMap.set(D,[D.scrollTop,D.scrollLeft]),this.fullScrollLeft+=D.scrollLeft,this.fullScrollTop+=D.scrollTop,D.scrollHeight>D.clientHeight){const F=function(G){const j=R.parentScrollMap.get(this),U=j[0],W=j[1];R.fullScrollTop=R.fullScrollTop-U+this.scrollTop,R.fullScrollLeft=R.fullScrollLeft-W+this.scrollLeft,R.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(D,F),D.addEventListener("scroll",F)}D=D.parentElement}}deregisterScrollOffsets(){for(const D of this.scrollCallbackMap.keys())D.removeEventListener("scroll",this.scrollCallbackMap.get(D));this.scrollCallbackMap.clear()}initialize(){this.fullOffsetLeft=0,this.fullOffsetTop=0;let D=this.osmdSheetMusicContainer;const R=[],F=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(G=>{WebDisplayInteractionManager.resizeCallback(G,F)}));D;)this.fullOffsetLeft+=D.offsetLeft,this.fullOffsetTop+=D.offsetTop,this.resizeObserver?this.resizeObserver.observe(D):R.push(D),D=D.offsetParent;if(this.resizeObserver)this.disposeResizeListener=()=>{F.resizeObserver.disconnect(),F.resizeObserver=void 0};else{let G=()=>{WebDisplayInteractionManager.resizeCallback(R,F)};window.addEventListener("resize",G),this.disposeResizeListener=()=>{window.removeEventListener("resize",G),G=void 0}}F.registerScrollOffsets()}dispose(){this.disposeResizeListener();for(const D of this.EventCallbackMap.keys()){const R=this.EventCallbackMap.getValue(D);R[0].removeEventListener(D,R[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 R=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(R).matches}get downEventName(){return this.isTouch()?"touchstart":"mousedown"}get moveEventName(){return this.isTouch()?"touchmove":"mousemove"}listenForInteractions(){const D=this.downEventListener.bind(this),R=this.touchEndEventListener.bind(this),F=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",D),this.osmdSheetMusicContainer.addEventListener("touchend",R),document.addEventListener(this.moveEventName,F),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,D]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,R]),this.EventCallbackMap.setValue(this.moveEventName,[document,F])}downEventListener(D){const R=new Date().getTime(),F=R-this.lastClick;clearTimeout(this.clickTimeout);let G=0,j=0;this.isTouch()&&D instanceof TouchEvent?(G=D.touches[0].pageX,j=D.touches[0].pageY):D instanceof MouseEvent&&(G=D.pageX,j=D.pageY);const U=this.getOffsetCoordinates(G,j);if(F0)this.doubleClick(U.x,U.y);else{const W=this;this.clickTimeout=setTimeout(function(){clearTimeout(this.clickTimeout),W.isTouch()?W.touchDown(U.x,U.y,void 0):W.click(U.x,U.y)},this.DOUBLE_CLICK_WINDOW)}this.lastClick=R}moveEventListener(D){let R=0,F=0;if(this.isTouch()&&D instanceof TouchEvent){let j;D.touches&&D.touches.length>0?j=D.touches[0]:D.changedTouches&&D.changedTouches.length>0&&(j=D.changedTouches[0]),R=j==null?void 0:j.clientX,F=j==null?void 0:j.clientY}else D instanceof MouseEvent&&(R=D.clientX,F=D.clientY);const G=this.getOffsetCoordinates(R,F);this.move(G.x,G.y)}touchEndEventListener(D){let R;D.touches&&D.touches.length>0?R=D.touches[0]:D.changedTouches&&D.changedTouches.length>0&&(R=D.changedTouches[0]);const F=this.getOffsetCoordinates(R==null?void 0:R.pageX,R==null?void 0:R.pageY);this.touchUp(F.x,F.y)}resizeEventListener(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}getOffsetCoordinates(D,R){const F=D-this.fullOffsetLeft+this.fullScrollLeft,G=R-this.fullOffsetTop+this.fullScrollTop;return new PointF2D(F,G)}}class DynamicsCalculator{static fillDynamicsList(D,R,F){for(let G=0;G=0&&F[Y].push(new DynamicsContainer(W.InstantaneousDynamic,Y))}if(W.StartingContinuousDynamic!==void 0){F[G].push(new DynamicsContainer(W.StartingContinuousDynamic,W.StaffNumber));const Y=this.getOtherStaffIndexIfLinkedStavesAreDetected(D,G,W.StartingContinuousDynamic.Placement);Y>=0&&F[Y].push(new DynamicsContainer(W.StartingContinuousDynamic,Y))}}}}static getOtherStaffIndexIfLinkedStavesAreDetected(D,R,F){const G=D.getStaffFromIndex(R),j=G.ParentInstrument.Staves.indexOf(G),U=G.ParentInstrument.Staves.length;return U>1&&j===0&&F===PlacementEnum.Below?R+1:U>1&&j===1&&F===PlacementEnum.Above?R-1:-1}static fillDynamicExpressions(D){const R=D.DynListStaves,F=D.getCompleteNumberOfStaves(),G=D.TimestampSortedDynamicExpressionsList;for(let j=0;j{D(this.processStringXml(F))},F=>{log$2.error(new Error("[OSMD] Invalid MXL file: "+F)),R(new Error("[OSMD] Invalid MXL file: "+F))})}processStringXml(B){const D=new DOMParser;if(B.substr(0,3)==="\uF7EF\uF7BB\uF7BF")return log$2.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+B),D.parseFromString(B.substr(3),"application/xml");if(B.substr(0,6).includes("{R.isMxl(q)?R.processMxl(q,W,Y):W(R.processStringXml(q))},q=>{throw Y(q),q});else{const q=new Error("[OSMD] osmd.load(string): Could not process string. Did not find {D.init(this.sheet.MusicPartManager,this.graphic)}),this.renderingManager.setMusicSheet(this.graphic),this.interactionManager.Initialize()}render(){var D;if(!this.graphic)throw new Error("OpenSheetMusicDisplay: Before rendering a music sheet, please load a MusicXML file");(D=this.drawer)==null||D.clear();let B=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(B=this.rules.SheetMaximumWidth),this.sheet.pageWidth=B/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 B=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(B=this.graphic.MusicPages[0].PositionAndShape.Size.width*10*this.zoom);let D;const R=32767;for(const F of this.graphic.MusicPages){if(F.PageNumber>this.rules.MaxPageToDrawNumber)break;const G=this.createBackend(this.backendType,F),j=" exceeds CanvasBackend limit of 32767. Cutting off score.";G.getOSMDBackendType()===BackendType.Canvas&&B>R&&(log$2.warn("[OSMD] Warning: width of "+B+j),B=R),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?D=B/this.rules.PageFormat.aspectRatio:(D=F.PositionAndShape.Size.height,D+=this.rules.PageBottomMargin,D+=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.rules.RenderTitle&&(D+=this.rules.TitleTopDistance),D*=this.zoom*10),G.getOSMDBackendType()===BackendType.Canvas&&D>R&&(log$2.warn("[OSMD] Warning: height of "+D+j),D=Math.min(D,R)),G.resize(B,D),G.clear(),this.drawer.Backends.push(G),this.graphic.drawer=this.drawer}}exportSVG(){var B;for(const D of(B=this.drawer)==null?void 0:B.Backends)D instanceof SvgVexFlowBackend&&D.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var B;(B=this.drawer)==null||B.clear(),this.reset()}dispose(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}setOptions(B){if(this.rules||(this.rules=new EngravingRules),this.drawingParameters||(this.drawingParameters=new DrawingParameters,this.drawingParameters.Rules=this.rules),B==null){log$2.warn(`warning: osmd.setOptions() called without an options parameter, has no effect. example usage: osmd.setOptions({drawCredits: false, drawPartNames: false})`);return}this.OnXMLRead=function(G){return G},B.onXMLRead&&(this.OnXMLRead=B.onXMLRead),B.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=DrawingParametersEnum[B.drawingParameters.toLowerCase()]);let R=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(B.backend!==void 0){const G=OSMDOptions.BackendTypeFromString(B.backend);R=R||this.backendType!==G,this.backendType=G}this.needBackendUpdate=R,B.autoBeam!==void 0&&(this.rules.AutoBeamNotes=B.autoBeam);const F=B.autoBeamOptions;if(F&&(F.maintain_stem_directions===void 0&&(F.maintain_stem_directions=!1),this.rules.AutoBeamOptions=F,F.groups&&F.groups.length)){for(const G of F.groups)if(G.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}B.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=B.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&B.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=B.percussionForceVoicesOneLineCutoff),B.alignRests!==void 0&&(this.rules.AlignRests=B.alignRests),B.coloringMode!==void 0&&this.setColoringMode(B),B.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=B.coloringEnabled),B.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=B.colorStemsLikeNoteheads),B.disableCursor&&(this.drawingParameters.drawCursors=!1),B.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),B.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=B.drawCredits),B.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=B.drawComposer),B.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=B.drawTitle),B.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=B.drawSubtitle),B.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=B.drawLyricist),B.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=B.drawMetronomeMarks),B.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=B.drawPartNames,B.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=B.drawPartNames)),B.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=B.drawPartAbbreviations),B.drawFingerings===!1&&(this.rules.RenderFingerings=!1),B.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=B.drawMeasureNumbers),B.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=B.drawMeasureNumbersOnlyAtSystemStart),B.drawLyrics!==void 0&&(this.rules.RenderLyrics=B.drawLyrics),B.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=B.drawTimeSignatures),B.drawSlurs!==void 0&&(this.rules.RenderSlurs=B.drawSlurs),B.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=B.measureNumberInterval),B.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=B.useXMLMeasureNumbers),B.fingeringPosition!==void 0&&(this.rules.FingeringPosition=AbstractExpression.PlacementEnumFromString(B.fingeringPosition)),B.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=B.fingeringInsideStafflines),B.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=B.newSystemFromXML),B.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=B.newPageFromXML),B.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=B.fillEmptyMeasuresWithWholeRest),B.followCursor!==void 0&&(this.FollowCursor=B.followCursor),B.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=B.setWantedStemDirectionByXml),B.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):B.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),B.defaultColorMusic&&this.rules.applyDefaultColorMusic(B.defaultColorMusic),B.defaultColorNotehead&&(this.rules.DefaultColorNotehead=B.defaultColorNotehead),B.defaultColorRest&&(this.rules.DefaultColorRest=B.defaultColorRest),B.defaultColorStem&&(this.rules.DefaultColorStem=B.defaultColorStem),B.defaultColorLabel&&(this.rules.DefaultColorLabel=B.defaultColorLabel),B.defaultColorTitle&&(this.rules.DefaultColorTitle=B.defaultColorTitle),B.defaultFontFamily&&(this.rules.DefaultFontFamily=B.defaultFontFamily),B.defaultFontStyle&&(this.rules.DefaultFontStyle=B.defaultFontStyle),B.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=B.drawUpToMeasureNumber-1),B.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=B.drawFromMeasureNumber-1),B.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=B.drawUpToPageNumber),B.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=B.drawUpToSystemNumber),B.tupletsRatioed&&(this.rules.TupletsRatioed=!0),B.tupletsBracketed&&(this.rules.TupletsBracketed=!0),B.tripletsBracketed&&(this.rules.TripletsBracketed=!0),B.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):B.autoResize===!1&&(this.autoResizeEnabled=!1),B.pageFormat!==void 0&&this.setPageFormat(B.pageFormat),B.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=B.pageBackgroundColor),B.performanceMode!==void 0&&(this.rules.PerformanceMode=B.performanceMode),B.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=B.renderSingleHorizontalStaffline),B.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=B.spacingFactorSoftmax),B.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=B.spacingBetweenTextLines),B.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=B.stretchLastSystemLine),B.autoGenerateMutipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=B.autoGenerateMutipleRestMeasuresFromRestMeasures),B.cursorsOptions!==void 0?this.cursorsOptions=B.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}setColoringMode(B){if(B.coloringMode===ColoringModes.XML){this.rules.ColoringMode=ColoringModes.XML;return}const D=[NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B,-1];let R;if(B.coloringMode===ColoringModes.CustomColorSet){if(!B.coloringSetCustom||B.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 G of B.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(G))throw new Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color: `+G);R=B.coloringSetCustom}else if(B.coloringMode===ColoringModes.AutoColoring){R=[];const G=Object.keys(AutoColorSet);for(let j=0;j{B.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1}autoResize(){const B=this;this.handleResize(()=>{},()=>{var D;((D=this.graphic)==null?void 0:D.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),B.IsReadyToRender()&&B.render()})}handleResize(B,D){let R,F;const j=this;function U(){!j.AutoResizeEnabled||(R=new Date().getTime(),F||(B(),R=new Date().getTime(),F=window.setTimeout(W,200)))}function W(){F=void 0,window.clearTimeout(F),new Date().getTime()-R<200?F=window.setTimeout(W,200):D()}window.attachEvent?window.attachEvent("onresize",U):window.addEventListener("resize",U),this.disposeResizeListener=()=>{window.detachEvent?window.detachEvent("onresize",U):window.removeEventListener("resize",U),this.resizeHandlerAttached=!1},this.resizeHandlerAttached=!0,window.setTimeout(B,0),window.setTimeout(D,1)}enableOrDisableCursors(B){var D,R,F,G,j,U;if(this.drawingParameters.drawCursors=B,B){for(let W=0;W{W.hide()})}createBackend(B,D){let R;return B===void 0||B===BackendType.SVG?R=new SvgVexFlowBackend(this.rules):R=new CanvasVexFlowBackend(this.rules),R.graphicalMusicPage=D,R.initialize(this.container,this.zoom),R.getContext().setFillStyle(this.rules.DefaultColorMusic),R.getContext().setStrokeStyle(this.rules.DefaultColorMusic),R}static StringToPageFormat(B){let D=PageFormat.UndefinedPageFormat;if(B.match("^[0-9]+x[0-9]+$")){const R=B.split("x"),F=Number.parseInt(R[0],10),G=Number.parseInt(R[1],10);F>0&&F<32768&&G>0&&G<32768&&(D=new PageFormat(F,G,`customPageFormat${B}`))}return B=B.replace(" ","_"),B=B.replace("Landscape","L"),B=B.replace("Portrait","P"),_OpenSheetMusicDisplay.PageFormatStandards.hasOwnProperty(B)&&(D=_OpenSheetMusicDisplay.PageFormatStandards[B]),D}setPageFormat(B){const D=_OpenSheetMusicDisplay.StringToPageFormat(B);this.needBackendUpdate=!D.Equals(this.rules.PageFormat),this.rules.PageFormat=D}setCustomPageFormat(B,D){if(B>0&&D>0){const R=new PageFormat(B,D);this.rules.PageFormat=R}}set DrawSkyLine(B){this.drawSkyLine=B,this.drawer&&(this.drawer.skyLineVisible=B)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(B){this.drawBottomLine=B,this.drawer&&(this.drawer.bottomLineVisible=B)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(B){this.setDrawBoundingBox(B,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(B,D=!1){this.drawBoundingBox=B,this.drawer&&(this.drawer.drawableBoundingBoxElement=B),D&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(B){this.autoResizeEnabled=B}get Zoom(){return this.zoom}set Zoom(B){var D;this.zoom=B,this.zoomUpdated=!0,((D=this.graphic)==null?void 0:D.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(B){this.followCursor=B}get FollowCursor(){return this.followCursor}set TransposeCalculator(B){MusicSheetCalculator.transposeCalculator=B}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}};let OpenSheetMusicDisplay=_OpenSheetMusicDisplay;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")};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(B){return escape$1[B]}function extend(B){for(var D=1;D0?(j.ids&&(j.ids=[j.name]),F.helpers.each(G,j)):U(this);if(j.data&&j.ids){var Y=R.createFrame(j.data);Y.contextPath=R.appendContextPath(j.data.contextPath,j.name),j={data:Y}}return W(G,j)})},B.exports=D.default})(blockHelperMissing,blockHelperMissing.exports);var each={exports:{}};(function(B,D){D.__esModule=!0;function R(U){return U&&U.__esModule?U:{default:U}}var F=utils,G=exception.exports,j=R(G);D.default=function(U){U.registerHelper("each",function(W,Y){if(!Y)throw new j.default("Must pass iterator to #each");var Q=Y.fn,Z=Y.inverse,q=0,J="",K=void 0,te=void 0;Y.data&&Y.ids&&(te=F.appendContextPath(Y.data.contextPath,Y.ids[0])+"."),F.isFunction(W)&&(W=W.call(this)),Y.data&&(K=F.createFrame(Y.data));function ne(fe,he,ge){K&&(K.key=fe,K.index=he,K.first=he===0,K.last=!!ge,te&&(K.contextPath=te+fe)),J=J+Q(W[fe],{data:K,blockParams:F.blockParams([W[fe],fe],[te+fe,null])})}if(W&&typeof W=="object")if(F.isArray(W))for(var ie=W.length;q=0?j=U:j=parseInt(j,10)}return j},log:function(j){if(j=F.lookupLevel(j),typeof console!="undefined"&&F.lookupLevel(F.level)<=j){var U=F.methodMap[j];console[U]||(U="log");for(var W=arguments.length,Y=Array(W>1?W-1:0),Q=1;Q= 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(B,D,R){this.helpers=B||{},this.partials=D||{},this.decorators=R||{},_helpers$2.registerDefaultHelpers(this),_decorators.registerDefaultDecorators(this)}HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2.default,log:_logger2.default.log,registerHelper:function(D,R){if(_utils$3.toString.call(D)===objectType){if(R)throw new _exception2$3.default("Arg not supported with multiple helpers");_utils$3.extend(this.helpers,D)}else this.helpers[D]=R},unregisterHelper:function(D){delete this.helpers[D]},registerPartial:function(D,R){if(_utils$3.toString.call(D)===objectType)_utils$3.extend(this.partials,D);else{if(typeof R=="undefined")throw new _exception2$3.default('Attempting to register a partial called "'+D+'" as undefined');this.partials[D]=R}},unregisterPartial:function(D){delete this.partials[D]},registerDecorator:function(D,R){if(_utils$3.toString.call(D)===objectType){if(R)throw new _exception2$3.default("Arg not supported with multiple decorators");_utils$3.extend(this.decorators,D)}else this.decorators[D]=R},unregisterDecorator:function(D){delete this.decorators[D]},resetLoggedPropertyAccesses:function(){_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(B,D){D.__esModule=!0;function R(F){this.string=F}R.prototype.toString=R.prototype.toHTML=function(){return""+this.string},D.default=R,B.exports=D.default})(safeString,safeString.exports);var runtime={},wrapHelper$1={};wrapHelper$1.__esModule=!0;wrapHelper$1.wrapHelper=wrapHelper;function wrapHelper(B,D){if(typeof B!="function")return B;var R=function(){var G=arguments[arguments.length-1];return arguments[arguments.length-1]=D(G),B.apply(this,arguments)};return R}runtime.__esModule=!0;runtime.checkRevision=checkRevision;runtime.template=template;runtime.wrapProgram=wrapProgram;runtime.resolvePartial=resolvePartial;runtime.invokePartial=invokePartial;runtime.noop=noop$1;function _interopRequireDefault$3(B){return B&&B.__esModule?B:{default:B}}function _interopRequireWildcard$1(B){if(B&&B.__esModule)return B;var D={};if(B!=null)for(var R in B)Object.prototype.hasOwnProperty.call(B,R)&&(D[R]=B[R]);return D.default=B,D}var _utils$2=utils,Utils=_interopRequireWildcard$1(_utils$2),_exception$2=exception.exports,_exception2$2=_interopRequireDefault$3(_exception$2),_base=base$1,_helpers$1=helpers$1,_internalWrapHelper=wrapHelper$1,_internalProtoAccess=protoAccess;function checkRevision(B){var D=B&&B[0]||1,R=_base.COMPILER_REVISION;if(!(D>=_base.LAST_COMPATIBLE_COMPILER_REVISION&&D<=_base.COMPILER_REVISION))if(D<_base.LAST_COMPATIBLE_COMPILER_REVISION){var F=_base.REVISION_CHANGES[R],G=_base.REVISION_CHANGES[D];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 ("+F+") or downgrade your runtime to an older version ("+G+").")}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 ("+B[1]+").")}function template(B,D){if(!D)throw new _exception2$2.default("No environment passed to template");if(!B||!B.main)throw new _exception2$2.default("Unknown template object: "+typeof B);B.main.decorator=B.main_d,D.VM.checkRevision(B.compiler);var R=B.compiler&&B.compiler[0]===7;function F(U,W,Y){Y.hash&&(W=Utils.extend({},W,Y.hash),Y.ids&&(Y.ids[0]=!0)),U=D.VM.resolvePartial.call(this,U,W,Y);var Q=Utils.extend({},Y,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),Z=D.VM.invokePartial.call(this,U,W,Q);if(Z==null&&D.compile&&(Y.partials[Y.name]=D.compile(U,B.compilerOptions,D),Z=Y.partials[Y.name](W,Q)),Z!=null){if(Y.indent){for(var q=Z.split(` `),J=0,K=q.length;J2&&pe.push("'"+this.terminals_[me]+"'");this.lexer.showPosition?ye="Parse error on line "+(te+1)+`: `+this.lexer.showPosition()+` Expecting `+pe.join(", ")+", got '"+(this.terminals_[le]||le)+"'":ye="Parse error on line "+(te+1)+": Unexpected "+(le==1?"end of input":"'"+(this.terminals_[le]||le)+"'"),this.parseError(ye,{text:this.lexer.match,token:this.terminals_[le]||le,line:this.lexer.yylineno,loc:ie,expected:pe})}}if(he[0]instanceof Array&&he.length>1)throw new Error("Parse Error: multiple actions possible at state: "+fe+", token: "+le);switch(he[0]){case 1:Q.push(le),Z.push(this.lexer.yytext),q.push(this.lexer.yylloc),Q.push(he[1]),le=null,ne=this.lexer.yyleng,K=this.lexer.yytext,te=this.lexer.yylineno,ie=this.lexer.yylloc;break;case 2:if(be=this.productions_[he[1]][1],ue.$=Z[Z.length-be],ue._$={first_line:q[q.length-(be||1)].first_line,last_line:q[q.length-1].last_line,first_column:q[q.length-(be||1)].first_column,last_column:q[q.length-1].last_column},re&&(ue._$.range=[q[q.length-(be||1)].range[0],q[q.length-1].range[1]]),ge=this.performAction.call(ue,K,ne,te,this.yy,he[1],Z,q),typeof ge!="undefined")return ge;be&&(Q=Q.slice(0,-1*be*2),Z=Z.slice(0,-1*be),q=q.slice(0,-1*be)),Q.push(this.productions_[he[1]][0]),Z.push(ue.$),q.push(ue._$),ve=J[Q[Q.length-2]][Q[Q.length-1]],Q.push(ve);break;case 3:return!0}}return!0}},G=function(){var U={EOF:1,parseError:function(Y,Q){if(this.yy.parser)this.yy.parser.parseError(Y,Q);else throw new Error(Y)},setInput:function(Y){return this._input=Y,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 Y=this._input[0];this.yytext+=Y,this.yyleng++,this.offset++,this.match+=Y,this.matched+=Y;var Q=Y.match(/(?:\r\n?|\n).*/g);return Q?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Y},unput:function(Y){var Q=Y.length,Z=Y.split(/(?:\r\n?|\n)/g);this._input=Y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Q-1),this.offset-=Q;var q=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),Z.length-1&&(this.yylineno-=Z.length-1);var J=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:Z?(Z.length===q.length?this.yylloc.first_column:0)+q[q.length-Z.length].length-Z[0].length:this.yylloc.first_column-Q},this.options.ranges&&(this.yylloc.range=[J[0],J[0]+this.yyleng-Q]),this},more:function(){return this._more=!0,this},less:function(Y){this.unput(this.match.slice(Y))},pastInput:function(){var Y=this.matched.substr(0,this.matched.length-this.match.length);return(Y.length>20?"...":"")+Y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var Y=this.match;return Y.length<20&&(Y+=this._input.substr(0,20-Y.length)),(Y.substr(0,20)+(Y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var Y=this.pastInput(),Q=new Array(Y.length+1).join("-");return Y+this.upcomingInput()+` `+Q+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Y,Q,Z,q,J;this._more||(this.yytext="",this.match="");for(var K=this._currentRules(),te=0;teQ[0].length)&&(Q=Z,q=te,!this.options.flex)));te++);return Q?(J=Q[0].match(/(?:\r\n?|\n).*/g),J&&(this.yylineno+=J.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:J?J[J.length-1].length-J[J.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Q[0].length},this.yytext+=Q[0],this.match+=Q[0],this.matches=Q,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(Q[0].length),this.matched+=Q[0],Y=this.performAction.call(this,this.yy,this,K[q],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Y||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var Y=this.next();return typeof Y!="undefined"?Y:this.lex()},begin:function(Y){this.conditionStack.push(Y)},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(Y){this.begin(Y)}};return U.options={},U.performAction=function(Y,Q,Z,q){function J(K,te){return Q.yytext=Q.yytext.substring(K,Q.yyleng-te+K)}switch(Z){case 0:if(Q.yytext.slice(-2)==="\\\\"?(J(0,1),this.begin("mu")):Q.yytext.slice(-1)==="\\"?(J(0,1),this.begin("emu")):this.begin("mu"),Q.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:(J(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(Q.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 Q.yytext=J(1,2).replace(/\\"/g,'"'),80;case 32:return Q.yytext=J(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 Q.yytext=Q.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},U.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\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],U.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}},U}();F.lexer=G;function j(){this.yy={}}return j.prototype=F,F.Parser=j,new j}();D.default=R,B.exports=D.default})(parser$2,parser$2.exports);var whitespaceControl={exports:{}},visitor={exports:{}};(function(B,D){D.__esModule=!0;function R(Q){return Q&&Q.__esModule?Q:{default:Q}}var F=exception.exports,G=R(F);function j(){this.parents=[]}j.prototype={constructor:j,mutating:!1,acceptKey:function(Z,q){var J=this.accept(Z[q]);if(this.mutating){if(J&&!j.prototype[J.type])throw new G.default('Unexpected node type "'+J.type+'" found when accepting '+q+" on "+Z.type);Z[q]=J}},acceptRequired:function(Z,q){if(this.acceptKey(Z,q),!Z[q])throw new G.default(Z.type+" requires "+q)},acceptArray:function(Z){for(var q=0,J=Z.length;q0)throw new _exception2$1.default("Invalid path: "+F,{loc:R});Y===".."&&j++}else G.push(Y)}return{type:"PathExpression",data:B,depth:j,parts:G,original:F,loc:R}}function prepareMustache(B,D,R,F,G,j){var U=F.charAt(3)||F.charAt(2),W=U!=="{"&&U!=="&",Y=/\*/.test(F);return{type:Y?"Decorator":"MustacheStatement",path:B,params:D,hash:R,escaped:W,strip:G,loc:this.locInfo(j)}}function prepareRawBlock(B,D,R,F){validateClose(B,R),F=this.locInfo(F);var G={type:"Program",body:D,strip:{},loc:F};return{type:"BlockStatement",path:B.path,params:B.params,hash:B.hash,program:G,openStrip:{},inverseStrip:{},closeStrip:{},loc:F}}function prepareBlock(B,D,R,F,G,j){F&&F.path&&validateClose(B,F);var U=/\*/.test(B.open);D.blockParams=B.blockParams;var W=void 0,Y=void 0;if(R){if(U)throw new _exception2$1.default("Unexpected inverse block on decorator",R);R.chain&&(R.program.body[0].closeStrip=F.strip),Y=R.strip,W=R.program}return G&&(G=W,W=D,D=G),{type:U?"DecoratorBlock":"BlockStatement",path:B.path,params:B.params,hash:B.hash,program:D,inverse:W,openStrip:B.strip,inverseStrip:Y,closeStrip:F&&F.strip,loc:this.locInfo(j)}}function prepareProgram(B,D){if(!D&&B.length){var R=B[0].loc,F=B[B.length-1].loc;R&&F&&(D={source:R.source,start:{line:R.start.line,column:R.start.column},end:{line:F.end.line,column:F.end.column}})}return{type:"Program",body:B,strip:{},loc:D}}function preparePartialBlock(B,D,R,F){return validateClose(B,R),{type:"PartialBlockStatement",name:B.path,params:B.params,hash:B.hash,program:D,openStrip:B.strip,closeStrip:R&&R.strip,loc:this.locInfo(F)}}base.__esModule=!0;base.parseWithoutProcessing=parseWithoutProcessing;base.parse=parse$2;function _interopRequireWildcard(B){if(B&&B.__esModule)return B;var D={};if(B!=null)for(var R in B)Object.prototype.hasOwnProperty.call(B,R)&&(D[R]=B[R]);return D.default=B,D}function _interopRequireDefault$1(B){return B&&B.__esModule?B:{default:B}}var _parser=parser$2.exports,_parser2=_interopRequireDefault$1(_parser),_whitespaceControl=whitespaceControl.exports,_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(B,D){if(B.type==="Program")return B;_parser2.default.yy=yy,yy.locInfo=function(F){return new yy.SourceLocation(D&&D.srcName,F)};var R=_parser2.default.parse(B);return R}function parse$2(B,D){var R=parseWithoutProcessing(B,D),F=new _whitespaceControl2.default(D);return F.accept(R)}var compiler={};compiler.__esModule=!0;compiler.Compiler=Compiler;compiler.precompile=precompile;compiler.compile=compile;function _interopRequireDefault(B){return B&&B.__esModule?B:{default:B}}var _exception=exception.exports,_exception2=_interopRequireDefault(_exception),_utils=utils,_ast=ast.exports,_ast2=_interopRequireDefault(_ast),slice=[].slice;function Compiler(){}Compiler.prototype={compiler:Compiler,equals:function(D){var R=this.opcodes.length;if(D.opcodes.length!==R)return!1;for(var F=0;F1)throw new _exception2.default("Unsupported number of partial arguments: "+F.length,D);F.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):F.push({type:"PathExpression",parts:[],depth:0}));var G=D.name.original,j=D.name.type==="SubExpression";j&&this.accept(D.name),this.setupFullMustacheParams(D,R,void 0,!0);var U=D.indent||"";this.options.preventIndent&&U&&(this.opcode("appendContent",U),U=""),this.opcode("invokePartial",j,G,U),this.opcode("append")},PartialBlockStatement:function(D){this.PartialStatement(D)},MustacheStatement:function(D){this.SubExpression(D),D.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(D){this.DecoratorBlock(D)},ContentStatement:function(D){D.value&&this.opcode("appendContent",D.value)},CommentStatement:function(){},SubExpression:function(D){transformLiteralToPath(D);var R=this.classifySexpr(D);R==="simple"?this.simpleSexpr(D):R==="helper"?this.helperSexpr(D):this.ambiguousSexpr(D)},ambiguousSexpr:function(D,R,F){var G=D.path,j=G.parts[0],U=R!=null||F!=null;this.opcode("getContext",G.depth),this.opcode("pushProgram",R),this.opcode("pushProgram",F),G.strict=!0,this.accept(G),this.opcode("invokeAmbiguous",j,U)},simpleSexpr:function(D){var R=D.path;R.strict=!0,this.accept(R),this.opcode("resolvePossibleLambda")},helperSexpr:function(D,R,F){var G=this.setupFullMustacheParams(D,R,F),j=D.path,U=j.parts[0];if(this.options.knownHelpers[U])this.opcode("invokeKnownHelper",G.length,U);else{if(this.options.knownHelpersOnly)throw new _exception2.default("You specified knownHelpersOnly, but used the unknown helper "+U,D);j.strict=!0,j.falsy=!0,this.accept(j),this.opcode("invokeHelper",G.length,j.original,_ast2.default.helpers.simpleId(j))}},PathExpression:function(D){this.addDepth(D.depth),this.opcode("getContext",D.depth);var R=D.parts[0],F=_ast2.default.helpers.scopedId(D),G=!D.depth&&!F&&this.blockParamIndex(R);G?this.opcode("lookupBlockParam",G,D.parts):R?D.data?(this.options.data=!0,this.opcode("lookupData",D.depth,D.parts,D.strict)):this.opcode("lookupOnContext",D.parts,D.falsy,D.strict,F):this.opcode("pushContext")},StringLiteral:function(D){this.opcode("pushString",D.value)},NumberLiteral:function(D){this.opcode("pushLiteral",D.value)},BooleanLiteral:function(D){this.opcode("pushLiteral",D.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(D){var R=D.pairs,F=0,G=R.length;for(this.opcode("pushHash");F=0)return[R,j]}}};function precompile(B,D,R){if(B==null||typeof B!="string"&&B.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+B);D=D||{},"data"in D||(D.data=!0),D.compat&&(D.useDepths=!0);var F=R.parse(B,D),G=new R.Compiler().compile(F,D);return new R.JavaScriptCompiler().compile(G,D)}function compile(B,D,R){if(D===void 0&&(D={}),B==null||typeof B!="string"&&B.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+B);D=_utils.extend({},D),"data"in D||(D.data=!0),D.compat&&(D.useDepths=!0);var F=void 0;function G(){var U=R.parse(B,D),W=new R.Compiler().compile(U,D),Y=new R.JavaScriptCompiler().compile(W,D,void 0,!0);return R.template(Y)}function j(U,W){return F||(F=G()),F.call(this,U,W)}return j._setup=function(U){return F||(F=G()),F._setup(U)},j._child=function(U,W,Y,Q){return F||(F=G()),F._child(U,W,Y,Q)},j}function argEquals(B,D){if(B===D)return!0;if(_utils.isArray(B)&&_utils.isArray(D)&&B.length===D.length){for(var R=0;R0&&(ne+=", "+ie.join(", "));var re=0;Object.keys(this.aliases).forEach(function(fe){var he=te.aliases[fe];he.children&&he.referenceCount>1&&(ne+=", alias"+ ++re+"="+fe,he.children[0]="alias"+re)}),this.lookupPropertyFunctionIsUsed&&(ne+=", "+this.lookupPropertyFunctionVarDeclaration());var oe=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&oe.push("blockParams"),this.useDepths&&oe.push("depths");var le=this.mergeSource(ne);return K?(oe.push(le),Function.apply(this,oe)):this.source.wrap(["function(",oe.join(","),`) { `,le,"}"])},mergeSource:function(K){var te=this.environment.isSimple,ne=!this.forceBuffer,ie=void 0,re=void 0,oe=void 0,le=void 0;return this.source.each(function(fe){fe.appendToBuffer?(oe?fe.prepend(" + "):oe=fe,le=fe):(oe&&(re?oe.prepend("buffer += "):ie=!0,le.add(";"),oe=le=void 0),re=!0,te||(ne=!1))}),ne?oe?(oe.prepend("return "),le.add(";")):re||this.source.push('return "";'):(K+=", buffer = "+(ie?"":this.initializeBuffer()),oe?(oe.prepend("return buffer + "),le.add(";")):this.source.push("return buffer;")),K&&this.source.prepend("var "+K.substring(2)+(ie?"":`; `)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return` lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined } `.trim()},blockValue:function(K){var te=this.aliasable("container.hooks.blockHelperMissing"),ne=[this.contextName(0)];this.setupHelperArgs(K,0,ne);var ie=this.popStack();ne.splice(1,0,ie),this.push(this.source.functionCall(te,"call",ne))},ambiguousBlockValue:function(){var K=this.aliasable("container.hooks.blockHelperMissing"),te=[this.contextName(0)];this.setupHelperArgs("",0,te,!0),this.flushInline();var ne=this.topStack();te.splice(1,0,ne),this.pushSource(["if (!",this.lastHelper,") { ",ne," = ",this.source.functionCall(K,"call",te),"}"])},appendContent:function(K){this.pendingContent?K=this.pendingContent+K:this.pendingLocation=this.source.currentLocation,this.pendingContent=K},append:function(){if(this.isInline())this.replaceStack(function(te){return[" != null ? ",te,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var K=this.popStack();this.pushSource(["if (",K," != null) { ",this.appendToBuffer(K,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(K){this.lastContext=K},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(K,te,ne,ie){var re=0;!ie&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(K[re++])):this.pushContext(),this.resolvePath("context",K,re,te,ne)},lookupBlockParam:function(K,te){this.useBlockParams=!0,this.push(["blockParams[",K[0],"][",K[1],"]"]),this.resolvePath("context",te,1)},lookupData:function(K,te,ne){K?this.pushStackLiteral("container.data(data, "+K+")"):this.pushStackLiteral("data"),this.resolvePath("data",te,0,!0,ne)},resolvePath:function(K,te,ne,ie,re){var oe=this;if(this.options.strict||this.options.assumeObjects){this.push(q(this.options.strict&&re,this,te,K));return}for(var le=te.length;nethis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var K=this.inlineStack;this.inlineStack=[];for(var te=0,ne=K.length;teB!==null&&B.isSecureContext,createNativeAudioBufferConstructor=B=>B===null?null:B.hasOwnProperty("AudioBuffer")?B.AudioBuffer:null,createNativeAudioContextConstructor=B=>B===null?null:B.hasOwnProperty("AudioContext")?B.AudioContext:B.hasOwnProperty("webkitAudioContext")?B.webkitAudioContext:null,createNativeAudioWorkletNodeConstructor=B=>B===null?null:B.hasOwnProperty("AudioWorkletNode")?B.AudioWorkletNode:null,createNativeOfflineAudioContextConstructor=B=>B===null?null:B.hasOwnProperty("OfflineAudioContext")?B.OfflineAudioContext:B.hasOwnProperty("webkitOfflineAudioContext")?B.webkitOfflineAudioContext:null,createWindow=()=>typeof window=="undefined"?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(B){return B>64&&B<91?B-65:B>96&&B<123?B-71:B>47&&B<58?B+4:B===43?62:B===47?63:0}function decode(B,D){for(var R=B.replace(/[^A-Za-z0-9\+\/]/g,""),F=R.length,G=D?Math.ceil((F*3+1>>2)/D)*D:F*3+1>>2,j=new Uint8Array(G),U,W,Y=0,Q=0,Z=0;Z>>(16>>>U&24)&255;Y=0}return j}var base64={decode},fetch$1=function(B,D){return new Promise(function(R,F){var G=new XMLHttpRequest;D&&(G.responseType=D),G.open("GET",B),G.onload=function(){G.status===200?R(G.response):F(Error(G.statusText))},G.onerror=function(){F(Error("Network Error"))},G.send()})};(function(B){var D=base64,R=fetch$1;function F(ue){return function(me){return typeof me=="string"&&ue.test(me)}}function G(ue,me){return typeof ue=="string"?ue+me:typeof ue=="function"?ue(me):me}function j(ue,me,be,ve){var pe=U(me)?W:Y(me)?Q:Z(me)?q:J(me)?K:te(me)?ne:ie(me)?re:oe(me)?le:fe(me)?he:null,ye=be||{};return pe?pe(ue,me,ye):ve?Promise.resolve(ve):Promise.reject("Source not valid ("+me+")")}j.fetch=R;function U(ue){return ue instanceof ArrayBuffer}function W(ue,me,be){return new Promise(function(ve,pe){ue.decodeAudioData(me,function(ye){ve(ye)},function(){pe("Can't decode audio data ("+me.slice(0,30)+"...)")})})}var Y=F(/\.(mp3|wav|ogg)(\?.*)?$/i);function Q(ue,me,be){var ve=G(be.from,me);return j(ue,j.fetch(ve,"arraybuffer"),be)}function Z(ue){return ue&&typeof ue.then=="function"}function q(ue,me,be){return me.then(function(ve){return j(ue,ve,be)})}var J=Array.isArray;function K(ue,me,be){return Promise.all(me.map(function(ve){return j(ue,ve,be,ve)}))}function te(ue){return ue&&typeof ue=="object"}function ne(ue,me,be){var ve={},pe=Object.keys(me).map(function(ye){if(be.only&&be.only.indexOf(ye)===-1)return null;var xe=me[ye];return j(ue,xe,be,xe).then(function(ce){ve[ye]=ce})});return Promise.all(pe).then(function(){return ve})}var ie=F(/\.json(\?.*)?$/i);function re(ue,me,be){var ve=G(be.from,me);return j(ue,j.fetch(ve,"text").then(JSON.parse),be)}var oe=F(/^data:audio/);function le(ue,me,be){var ve=me.indexOf(",");return j(ue,D.decode(me.slice(ve+1)).buffer,be)}var fe=F(/\.js(\?.*)?$/i);function he(ue,me,be){var ve=G(be.from,me);return j(ue,j.fetch(ve,"text").then(ge),be)}function ge(ue){var me=ue.indexOf("MIDI.Soundfont.");if(me<0)throw Error("Invalid MIDI.js Soundfont format");me=ue.indexOf("=",me)+2;var be=ue.lastIndexOf(",");return JSON.parse(ue.slice(me,be)+"}")}B.exports&&(B.exports=j),typeof window!="undefined"&&(window.loadAudio=j)})(lib$1);var lib={exports:{}},adsr=ADSR$1;function ADSR$1(B){var D=B.createGain(),R=D._voltage=getVoltage(B),F=scale(R),G=scale(R),j=scale(R);return D._startAmount=scale(G),D._endAmount=scale(j),D._multiplier=scale(F),D._multiplier.connect(D),D._startAmount.connect(D),D._endAmount.connect(D),D.value=F.gain,D.startValue=G.gain,D.endValue=j.gain,D.startValue.value=0,D.endValue.value=0,Object.defineProperties(D,props),D}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(B){var D=this._multiplier.gain,R=this._startAmount.gain,F=this._endAmount.gain;this._voltage.start(B),this._decayFrom=this._decayFrom=B+this.attack,this._startedAt=B;var G=this.sustain;D.cancelScheduledValues(B),R.cancelScheduledValues(B),F.cancelScheduledValues(B),F.setValueAtTime(0,B),this.attack?(D.setValueAtTime(0,B),D.linearRampToValueAtTime(1,B+this.attack),R.setValueAtTime(1,B),R.linearRampToValueAtTime(0,B+this.attack)):(D.setValueAtTime(1,B),R.setValueAtTime(0,B)),this.decay&&D.setTargetAtTime(G,this._decayFrom,getTimeConstant(this.decay))}},stop:{value:function(B,D){D&&(B=B-this.release);var R=B+this.release;if(this.release){var F=this._multiplier.gain,G=this._startAmount.gain,j=this._endAmount.gain;F.cancelScheduledValues(B),G.cancelScheduledValues(B),j.cancelScheduledValues(B);var U=getTimeConstant(this.release);if(this.attack&&B=D&&(Q=D),Q}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(B,D,R){var F=!1,G=0,j={},U=B.createGain();U.gain.value=1;var W=Object.assign({},DEFAULTS,R),Y={context:B,out:U,opts:W};return D instanceof AudioBuffer?Y.buffer=D:Y.buffers=D,Y.start=function(q,J,K){if(Y.buffer&&q!==null)return Y.start(null,q,J);var te=q?Y.buffers[q]:Y.buffer;if(te){if(!F){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+q+" not found.");return}var ne=K||EMPTY;J=Math.max(B.currentTime,J||0),Y.emit("start",J,q,ne);var ie=Z(q,te,ne);return ie.id=Q(q,ie),ie.env.start(J),ie.source.start(J),Y.emit("started",J,ie.id,ie),ne.duration&&ie.stop(J+ne.duration),ie},Y.play=function(q,J,K){return Y.start(q,J,K)},Y.stop=function(q,J){var K;return J=J||Object.keys(j),J.map(function(te){return K=j[te],K?(K.stop(q),K.id):null})},Y.connect=function(q){return F=!0,U.connect(q),Y},Y.emit=function(q,J,K,te){Y.onevent&&Y.onevent(q,J,K,te);var ne=Y["on"+q];ne&&ne(J,K,te)},Y;function Q(q,J){return J.id=G++,j[J.id]=J,J.source.onended=function(){var K=B.currentTime;J.source.disconnect(),J.env.disconnect(),J.disconnect(),Y.emit("ended",K,J.id,J)},J.id}function Z(q,J,K){var te=B.createGain();return te.gain.value=0,te.connect(U),te.env=envelope(B,K,W),te.env.connect(te.gain),te.source=B.createBufferSource(),te.source.buffer=J,te.source.connect(te),te.source.loop=K.loop||W.loop,te.source.playbackRate.value=centsToRate(K.cents||W.cents),te.source.loopStart=K.loopStart||W.loopStart,te.source.loopEnd=K.loopEnd||W.loopEnd,te.stop=function(ne){var ie=ne||B.currentTime;Y.emit("stop",ie,q);var re=te.env.stop(ie);te.source.stop(re)},te}}function isNum$1(B){return typeof B=="number"}var PARAMS=["attack","decay","sustain","release"];function envelope(B,D,R){var F=ADSR(B),G=D.adsr||R.adsr;return PARAMS.forEach(function(j,U){G?F[j]=G[U]:F[j]=D[j]||R[j]}),F.value.value=isNum$1(D.gain)?D.gain:isNum$1(R.gain)?R.gain:1,F}function centsToRate(B){return B?Math.pow(2,B/1200):1}var player$1=SamplePlayer,events=function(B){return B.on=function(D,R){if(arguments.length===1&&typeof D=="function")return B.on("event",D);var F="on"+D,G=B[F];return B[F]=G?chain(G,R):R,B},B};function chain(B,D){return function(R,F,G,j){B(R,F,G,j),D(R,F,G,j)}}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(B,D,R){if(typeof B!="string")return null;var F=REGEX$1.exec(B);if(!F||!D&&F[4])return null;var G={letter:F[1].toUpperCase(),acc:F[2].replace(/x/g,"##")};return G.pc=G.letter+G.acc,G.step=(G.letter.charCodeAt(0)+3)%7,G.alt=G.acc[0]==="b"?-G.acc.length:G.acc.length,G.chroma=SEMITONES$1[G.step]+G.alt,F[3]&&(G.oct=+F[3],G.midi=G.chroma+12*(G.oct+1),G.freq=midiToFreq$1(G.midi,R)),D&&(G.tonicOf=F[4]),G}function midiToFreq$1(B,D){return Math.pow(2,(B-69)/12)*(D||440)}var parser$1={parse:parse$1,regex:regex$1,midiToFreq:midiToFreq$1},FNS=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];FNS.forEach(function(B){parser$1[B]=function(D){var R=parse$1(D);return R&&typeof R[B]!="undefined"?R[B]:null}});var noteParser$1=parser$1,note=noteParser$1,isMidi=function(B){return B!==null&&B!==[]&&B>=0&&B<129},toMidi=function(B){return isMidi(B)?+B:note.midi(B)},notes=function(B){if(B.buffers){var D=B.opts.map,R=typeof D=="function"?D:toMidi,F=function(j){return j?R(j)||j:null};B.buffers=mapBuffers(B.buffers,F);var G=B.start;B.start=function(j,U,W){var Y=F(j),Q=Y%1;return Q&&(Y=Math.floor(Y),W=Object.assign(W||{},{cents:Math.floor(Q*100)})),G(Y,U,W)}}return B};function mapBuffers(B,D){return Object.keys(B).reduce(function(R,F){return R[D(F)]=B[F],R},{})}var isArr=Array.isArray,isObj=function(B){return B&&typeof B=="object"},OPTS={},scheduler=function(B){return B.schedule=function(D,R){var F=B.context.currentTime,G=D6?null:LETTERS.charAt(B)+accStr(D)+octStr(R)}function midi(B){if((isNum(B)||isStr(B))&&B>=0&&B<128)return+B;var D=parse(B);return D&&isDef(D.midi)?D.midi:null}function freq(B,D){var R=midi(B);return R===null?null:midiToFreq(R,D)}function letter(B){return(parse(B)||{}).letter}function acc(B){return(parse(B)||{}).acc}function pc(B){return(parse(B)||{}).pc}function step(B){return(parse(B)||{}).step}function alt(B){return(parse(B)||{}).alt}function chroma(B){return(parse(B)||{}).chroma}function oct(B){return(parse(B)||{}).oct}var noteParser=Object.freeze(Object.defineProperty({__proto__:null,regex,parse,build,midi,freq,letter,acc,pc,step,alt,chroma,oct},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(noteParser),parser=require$$0;function Soundfont(B,D){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof Soundfont))return new Soundfont(B);this.nameToUrl=D||Soundfont.nameToUrl,this.ctx=B,this.instruments={},this.promises=[]}Soundfont.prototype.onready=function(B){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(B)};Soundfont.prototype.instrument=function(B,D){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var R=this.ctx;if(B=B||"default",B in this.instruments)return this.instruments[B];var F={name:B,play:oscillatorPlayer(R,D)};if(this.instruments[B]=F,B!=="default"){var G=Soundfont.instrument(R,B,D).then(function(j){return F.play=j.play,F});this.promises.push(G),F.onready=function(j){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),G.then(j)}}else F.onready=function(j){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),j()};return F};function loadBuffers(B,D,R){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),Soundfont.instrument(B,D,R).then(function(F){return F.buffers})}Soundfont.loadBuffers=loadBuffers;function oscillatorPlayer(B,D){return D=D||{},function(R,F,G,j){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 U=R>0&&R<129?+R:parser.midi(R),W=U?parser.midiToFreq(U,440):null;if(!!W){G=G||.2,j=j||{};var Y=j.destination||D.destination||B.destination,Q=j.vcoType||D.vcoType||"sine",Z=j.gain||D.gain||.4,q=B.createOscillator();q.type=Q,q.frequency.value=W;var J=B.createGain();return J.gain.value=Z,q.connect(J),J.connect(Y),q.start(F),G>0&&q.stop(F+G),q}}}Soundfont.noteToMidi=parser.midi;var legacy=Soundfont;(function(B){var D=lib$1.exports,R=lib.exports;function F(W,Y,Q){if(arguments.length===1)return function(te,ne){return F(W,te,ne)};var Z=Q||{},q=Z.isSoundfontURL||G,J=Z.nameToUrl||j,K=q(Y)?Y:J(Y,Z.soundfont,Z.format);return D(W,K,{only:Z.only||Z.notes}).then(function(te){var ne=R(W,te,Z).connect(Z.destination?Z.destination:W.destination);return ne.url=K,ne.name=Y,ne})}function G(W){return/\.js(\?.*)?$/i.test(W)}function j(W,Y,Q){return Q=Q==="ogg"?Q:"mp3",Y=Y==="FluidR3_GM"?Y:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+Y+"/"+W+"-"+Q+".js"}var U=legacy;U.instrument=F,U.nameToUrl=j,B.exports&&(B.exports=U),typeof window!="undefined"&&(window.Soundfont=U)})(lib$2);NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B;const state$2=reactive({sectionStatus:!1,maskStatus:!1,section:[],times:[],timesById:{},sectionBoundingBoxs:[],activeTick:-1,activeTickRepeat:1,showTick:!1,isSpecialShapedScreen:!1,notchHeight:0,fixedKey:0,renderLoading:!1,evaluatings:{},isPauseRecording:!1,feeShow:!1,vipShow:!1,mode:"contact",subjectId:0,activeSpeed:90,baseSpeed:90,activeDetail:null,needTick:!1,skipTick:!1,repeatedBeats:!0,sectionFlash:!1,befireSection:null,isPercussion:!1,enableEvaluation:!0,isAppPlay:!1,partListNames:[],partIndex:0,midiPlayIniting:!1,isSpecialBookCategory:!1,code:"",frozenMode:!1,initRendered:!1,setting:null,activeNote:"",freeRate:.1,zoom:1,renderType:"native"});let toastItem=null;watchEffect(()=>{const B={};for(const D of state$2.times)D.id&&(B[D.id]=D);state$2.timesById=B,state$2.subjectId>0&&(state$2.isPercussion=state$2.subjectId==23||state$2.subjectId==113),state$2.renderLoading?toastItem=Toast({duration:0,message:"\u52A0\u8F7D\u4E2D..."}):toastItem&&(toastItem.close(),toastItem=null)});var eventemitter3={exports:{}};(function(B){var D=Object.prototype.hasOwnProperty,R="~";function F(){}Object.create&&(F.prototype=Object.create(null),new F().__proto__||(R=!1));function G(Y,Q,Z){this.fn=Y,this.context=Q,this.once=Z||!1}function j(Y,Q,Z,q,J){if(typeof Z!="function")throw new TypeError("The listener must be a function");var K=new G(Z,q||Y,J),te=R?R+Q:Q;return Y._events[te]?Y._events[te].fn?Y._events[te]=[Y._events[te],K]:Y._events[te].push(K):(Y._events[te]=K,Y._eventsCount++),Y}function U(Y,Q){--Y._eventsCount===0?Y._events=new F:delete Y._events[Q]}function W(){this._events=new F,this._eventsCount=0}W.prototype.eventNames=function(){var Q=[],Z,q;if(this._eventsCount===0)return Q;for(q in Z=this._events)D.call(Z,q)&&Q.push(R?q.slice(1):q);return Object.getOwnPropertySymbols?Q.concat(Object.getOwnPropertySymbols(Z)):Q},W.prototype.listeners=function(Q){var Z=R?R+Q:Q,q=this._events[Z];if(!q)return[];if(q.fn)return[q.fn];for(var J=0,K=q.length,te=new Array(K);J{var D;B.EngravingRules.CompactMode=!0,B.EngravingRules.DYMinNoteWidth=3,B.EngravingRules.VoiceSpacingMultiplierVexflow=.65,B.EngravingRules.VoiceSpacingAddendVexflow=2,B.EngravingRules.MinSkyBottomDistBetweenStaves=2,B.EngravingRules.MinSkyBottomDistBetweenSystems=2,B.EngravingRules.MinimumStaffLineDistance=4,B.EngravingRules.BetweenStaffDistance=2.5,B.EngravingRules.StaffDistance=3.5,B.EngravingRules.MinimumDistanceBetweenSystems=1,B.EngravingRules.PageBottomMargin=0,B.EngravingRules.PageLeftMargin=2,B.EngravingRules.PageRightMargin=2,B.EngravingRules.PageTopMarginNarrow=3,B.EngravingRules.WedgeEndDistanceBetweenTimestampsFactor=1,B.EngravingRules.RehearsalMarkXOffset=-18,B.EngravingRules.RehearsalMarkYOffset=10,B.EngravingRules.DYWorkId=((D=state$2.activeDetail)==null?void 0:D.parentCategoriesId)||0},useEngravingRules=(B,D)=>{onMounted(()=>{setEngravingRules(B);for(const R in D)if(Object.prototype.hasOwnProperty.call(D,R)){let F=R;const G=D[F];B.EngravingRules[F]=G}})},useOsmd=(B,D,R={})=>{const F=ref();if(B.value){const G=new EngravingRules;for(const[j,U]of Object.entries(R))G[j]=U;F.value=new OpenSheetMusicDisplay(B.value,{followCursor:!1,autoResize:!0,drawSubtitle:!1,drawTitle:!1,autoBeam:!0,drawMetronomeMarks:!1,drawMeasureNumbers:!1,drawComposer:!1,drawLyricist:!1,...D},G)}return F},useOsmdLoader=async(B,D)=>{if(!D)throw"score is required";const R=Toast("\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E...");try{D&&B&&(await B.load(D),B.zoom=formatZoom(),await B.render())}catch{}R.close()},container$3="_container_15puc_1",eyeProtection="_eyeProtection_15puc_22";var styles$h={container:container$3,eyeProtection},lodash={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */(function(B,D){(function(){var R,F="4.17.21",G=200,j="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",U="Expected a function",W="Invalid `variable` option passed into `_.template`",Y="__lodash_hash_undefined__",Q=500,Z="__lodash_placeholder__",q=1,J=2,K=4,te=1,ne=2,ie=1,re=2,oe=4,le=8,fe=16,he=32,ge=64,ue=128,me=256,be=512,ve=30,pe="...",ye=800,xe=16,ce=1,we=2,Be=3,Ae=1/0,Te=9007199254740991,Ne=17976931348623157e292,Pe=0/0,Me=4294967295,Se=Me-1,Le=Me>>>1,ze=[["ary",ue],["bind",ie],["bindKey",re],["curry",le],["curryRight",fe],["flip",be],["partial",he],["partialRight",ge],["rearg",me]],ke="[object Arguments]",Ge="[object Array]",We="[object AsyncFunction]",Ve="[object Boolean]",Ye="[object Date]",et="[object DOMException]",ot="[object Error]",ft="[object Function]",lt="[object GeneratorFunction]",_e="[object Map]",Xe="[object Number]",Qe="[object Null]",Fe="[object Object]",Re="[object Promise]",He="[object Proxy]",Je="[object RegExp]",tt="[object Set]",qe="[object String]",rt="[object Symbol]",dt="[object Undefined]",ut="[object WeakMap]",yt="[object WeakSet]",Et="[object ArrayBuffer]",st="[object DataView]",xt="[object Float32Array]",Lt="[object Float64Array]",Gt="[object Int8Array]",ai="[object Int16Array]",Ft="[object Int32Array]",Qt="[object Uint8Array]",Jt="[object Uint8ClampedArray]",mt="[object Uint16Array]",ri="[object Uint32Array]",ci=/\b__p \+= '';/g,Zt=/\b(__p \+=) '' \+/g,Gi=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bi=/&(?:amp|lt|gt|quot|#39);/g,Wt=/[&<>"']/g,Qi=RegExp(bi.source),an=RegExp(Wt.source),ln=/<%-([\s\S]+?)%>/g,Jn=/<%([\s\S]+?)%>/g,Zi=/<%=([\s\S]+?)%>/g,ji=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pn=/^\w*$/,Mi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,un=/[\\^$.*+?()[\]{}|]/g,Es=RegExp(un.source),Mn=/^\s+/,es=/\s/,mi=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,vi=/\{\n\/\* \[wrapped with (.+)\] \*/,ts=/,? & /,Ui=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vt=/[()=,{}\[\]\/\s]/,is=/\\(\\)?/g,Rn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ns=/\w*$/,_s=/^[-+]0x[0-9a-f]+$/i,Ri=/^0b[01]+$/i,Ms=/^\[object .+?Constructor\]$/,io=/^0o[0-7]+$/i,no=/^(?:0|[1-9]\d*)$/,so=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ss=/($^)/,Ki=/['\n\r\u2028\u2029\\]/g,rs="\\ud800-\\udfff",ro="\\u0300-\\u036f",oo="\\ufe20-\\ufe2f",ao="\\u20d0-\\u20ff",$s=ro+oo+ao,Bn="\\u2700-\\u27bf",qs="a-z\\xdf-\\xf6\\xf8-\\xff",lo="\\xac\\xb1\\xd7\\xf7",Ji="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",uo="\\u2000-\\u206f",co=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Xs="A-Z\\xc0-\\xd6\\xd8-\\xde",Qs="\\ufe0e\\ufe0f",Zs=lo+Ji+uo+co,Ts="['\u2019]",os="["+rs+"]",Ks="["+Zs+"]",as="["+$s+"]",Js="\\d+",er="["+Bn+"]",tr="["+qs+"]",ir="[^"+rs+Zs+Js+Bn+qs+Xs+"]",On="\\ud83c[\\udffb-\\udfff]",ho="(?:"+as+"|"+On+")",nr="[^"+rs+"]",As="(?:\\ud83c[\\udde6-\\uddff]){2}",Is="[\\ud800-\\udbff][\\udc00-\\udfff]",Tn="["+Xs+"]",sr="\\u200d",rr="(?:"+tr+"|"+ir+")",fo="(?:"+Tn+"|"+ir+")",or="(?:"+Ts+"(?:d|ll|m|re|s|t|ve))?",ar="(?:"+Ts+"(?:D|LL|M|RE|S|T|VE))?",Ps=ho+"?",lr="["+Qs+"]?",ur="(?:"+sr+"(?:"+[nr,As,Is].join("|")+")"+lr+Ps+")*",po="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fn=lr+Ps+ur,go="(?:"+[er,As,Is].join("|")+")"+Fn,An="(?:"+[nr+as+"?",as,As,Is,os].join("|")+")",cn=RegExp(Ts,"g"),yo=RegExp(as,"g"),ls=RegExp(On+"(?="+On+")|"+An+Fn,"g"),us=RegExp([Tn+"?"+tr+"+"+or+"(?="+[Ks,Tn,"$"].join("|")+")",fo+"+"+ar+"(?="+[Ks,Tn+rr,"$"].join("|")+")",Tn+"?"+rr+"+"+or,Tn+"+"+ar,mo,po,Js,go].join("|"),"g"),bo=RegExp("["+sr+rs+$s+Qs+"]"),vo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,So=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],cr=-1,$t={};$t[xt]=$t[Lt]=$t[Gt]=$t[ai]=$t[Ft]=$t[Qt]=$t[Jt]=$t[mt]=$t[ri]=!0,$t[ke]=$t[Ge]=$t[Et]=$t[Ve]=$t[st]=$t[Ye]=$t[ot]=$t[ft]=$t[_e]=$t[Xe]=$t[Fe]=$t[Je]=$t[tt]=$t[qe]=$t[ut]=!1;var qt={};qt[ke]=qt[Ge]=qt[Et]=qt[st]=qt[Ve]=qt[Ye]=qt[xt]=qt[Lt]=qt[Gt]=qt[ai]=qt[Ft]=qt[_e]=qt[Xe]=qt[Fe]=qt[Je]=qt[tt]=qt[qe]=qt[rt]=qt[Qt]=qt[Jt]=qt[mt]=qt[ri]=!0,qt[ot]=qt[ft]=qt[ut]=!1;var cs={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},mn={"&":"&","<":"<",">":">",'"':""","'":"'"},Ns={"&":"&","<":"<",">":">",""":'"',"'":"'"},hr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},fr=parseFloat,en=parseInt,Cs=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,xo=typeof self=="object"&&self&&self.Object===Object&&self,ii=Cs||xo||Function("return this")(),Vn=D&&!D.nodeType&&D,Ti=Vn&&!0&&B&&!B.nodeType&&B,zn=Ti&&Ti.exports===Vn,Gn=zn&&Cs.process,Si=function(){try{var Ze=Ti&&Ti.require&&Ti.require("util").types;return Ze||Gn&&Gn.binding&&Gn.binding("util")}catch{}}(),dr=Si&&Si.isArrayBuffer,pr=Si&&Si.isDate,mr=Si&&Si.isMap,jn=Si&&Si.isRegExp,gr=Si&&Si.isSet,yr=Si&&Si.isTypedArray;function xi(Ze,at,it){switch(it.length){case 0:return Ze.call(at);case 1:return Ze.call(at,it[0]);case 2:return Ze.call(at,it[0],it[1]);case 3:return Ze.call(at,it[0],it[1],it[2])}return Ze.apply(at,it)}function Ce(Ze,at,it,vt){for(var Pt=-1,Ut=Ze==null?0:Ze.length;++Pt-1}function Bt(Ze,at,it){for(var vt=-1,Pt=Ze==null?0:Ze.length;++vt-1;);return it}function Ma(Ze,at){for(var it=Ze.length;it--&&Ni(at,Ze[it],0)>-1;);return it}function xu(Ze,at){for(var it=Ze.length,vt=0;it--;)Ze[it]===at&&++vt;return vt}var wu=Eo(cs),Eu=Eo(mn);function _u(Ze){return"\\"+hr[Ze]}function Mu(Ze,at){return Ze==null?R:Ze[at]}function hs(Ze){return bo.test(Ze)}function Tu(Ze){return vo.test(Ze)}function Au(Ze){for(var at,it=[];!(at=Ze.next()).done;)it.push(at.value);return it}function Ao(Ze){var at=-1,it=Array(Ze.size);return Ze.forEach(function(vt,Pt){it[++at]=[Pt,vt]}),it}function Ta(Ze,at){return function(it){return Ze(at(it))}}function In(Ze,at){for(var it=-1,vt=Ze.length,Pt=0,Ut=[];++it-1}function mc(se,ae){var de=this.__data__,Ee=kr(de,se);return Ee<0?(++this.size,de.push([se,ae])):de[Ee][1]=ae,this}gn.prototype.clear=cc,gn.prototype.delete=hc,gn.prototype.get=fc,gn.prototype.has=dc,gn.prototype.set=mc;function yn(se){var ae=-1,de=se==null?0:se.length;for(this.clear();++ae=ae?se:ae)),se}function Yi(se,ae,de,Ee,Ie,Oe){var Ue,$e=ae&q,Ke=ae&J,ct=ae&K;if(de&&(Ue=Ie?de(se,Ee,Ie,Oe):de(se)),Ue!==R)return Ue;if(!Kt(se))return se;var ht=Nt(se);if(ht){if(Ue=vh(se),!$e)return Ci(se,Ue)}else{var pt=yi(se),bt=pt==ft||pt==lt;if(kn(se))return ll(se,$e);if(pt==Fe||pt==ke||bt&&!Ie){if(Ue=Ke||bt?{}:Al(se),!$e)return Ke?lh(se,Cc(Ue,se)):ah(se,Fa(Ue,se))}else{if(!qt[pt])return Ie?se:{};Ue=Sh(se,pt,$e)}}Oe||(Oe=new sn);var wt=Oe.get(se);if(wt)return wt;Oe.set(se,Ue),iu(se)?se.forEach(function(It){Ue.add(Yi(It,ae,de,It,se,Oe))}):eu(se)&&se.forEach(function(It,Rt){Ue.set(Rt,Yi(It,ae,de,Rt,se,Oe))});var At=ct?Ke?Jo:Ko:Ke?Di:fi,Dt=ht?R:At(se);return je(Dt||se,function(It,Rt){Dt&&(Rt=It,It=se[Rt]),Fs(Ue,Rt,Yi(It,ae,de,Rt,se,Oe))}),Ue}function Lc(se){var ae=fi(se);return function(de){return Va(de,se,ae)}}function Va(se,ae,de){var Ee=de.length;if(se==null)return!Ee;for(se=Xt(se);Ee--;){var Ie=de[Ee],Oe=ae[Ie],Ue=se[Ie];if(Ue===R&&!(Ie in se)||!Oe(Ue))return!1}return!0}function za(se,ae,de){if(typeof se!="function")throw new Wi(U);return Hs(function(){se.apply(R,de)},ae)}function Vs(se,ae,de,Ee){var Ie=-1,Oe=St,Ue=!0,$e=se.length,Ke=[],ct=ae.length;if(!$e)return Ke;de&&(ae=Mt(ae,Bi(de))),Ee?(Oe=Bt,Ue=!1):ae.length>=G&&(Oe=Ls,Ue=!1,ae=new $n(ae));e:for(;++Ie<$e;){var ht=se[Ie],pt=de==null?ht:de(ht);if(ht=Ee||ht!==0?ht:0,Ue&&pt===pt){for(var bt=ct;bt--;)if(ae[bt]===pt)continue e;Ke.push(ht)}else Oe(ae,pt,Ee)||Ke.push(ht)}return Ke}var Nn=dl(hn),Ga=dl(Ro,!0);function Dc(se,ae){var de=!0;return Nn(se,function(Ee,Ie,Oe){return de=!!ae(Ee,Ie,Oe),de}),de}function Rr(se,ae,de){for(var Ee=-1,Ie=se.length;++EeIe?0:Ie+de),Ee=Ee===R||Ee>Ie?Ie:Ct(Ee),Ee<0&&(Ee+=Ie),Ee=de>Ee?0:su(Ee);de0&&de($e)?ae>1?pi($e,ae-1,de,Ee,Ie):jt(Ie,$e):Ee||(Ie[Ie.length]=$e)}return Ie}var ko=pl(),Ua=pl(!0);function hn(se,ae){return se&&ko(se,ae,fi)}function Ro(se,ae){return se&&Ua(se,ae,fi)}function Br(se,ae){return _t(ae,function(de){return wn(se[de])})}function Xn(se,ae){ae=Ln(ae,se);for(var de=0,Ee=ae.length;se!=null&&deae}function Rc(se,ae){return se!=null&&Yt.call(se,ae)}function Bc(se,ae){return se!=null&&ae in Xt(se)}function Oc(se,ae,de){return se>=gi(ae,de)&&se=120&&ht.length>=120)?new $n(Ue&&ht):R}ht=se[0];var pt=-1,bt=$e[0];e:for(;++pt-1;)$e!==se&&Ar.call($e,Ke,1),Ar.call(se,Ke,1);return se}function el(se,ae){for(var de=se?ae.length:0,Ee=de-1;de--;){var Ie=ae[de];if(de==Ee||Ie!==Oe){var Oe=Ie;xn(Ie)?Ar.call(se,Ie,1):Ho(se,Ie)}}return se}function jo(se,ae){return se+Nr(ka()*(ae-se+1))}function Qc(se,ae,de,Ee){for(var Ie=-1,Oe=ui(Pr((ae-se)/(de||1)),0),Ue=it(Oe);Oe--;)Ue[Ee?Oe:++Ie]=se,se+=de;return Ue}function Uo(se,ae){var de="";if(!se||ae<1||ae>Te)return de;do ae%2&&(de+=se),ae=Nr(ae/2),ae&&(se+=se);while(ae);return de}function kt(se,ae){return oa(Nl(se,ae,ki),se+"")}function Zc(se){return Oa(ws(se))}function Kc(se,ae){var de=ws(se);return $r(de,qn(ae,0,de.length))}function js(se,ae,de,Ee){if(!Kt(se))return se;ae=Ln(ae,se);for(var Ie=-1,Oe=ae.length,Ue=Oe-1,$e=se;$e!=null&&++IeIe?0:Ie+ae),de=de>Ie?Ie:de,de<0&&(de+=Ie),Ie=ae>de?0:de-ae>>>0,ae>>>=0;for(var Oe=it(Ie);++Ee>>1,Ue=se[Oe];Ue!==null&&!Fi(Ue)&&(de?Ue<=ae:Ue=G){var ct=ae?null:fh(se);if(ct)return vr(ct);Ue=!1,Ie=Ls,Ke=new $n}else Ke=ae?[]:$e;e:for(;++Ee=Ee?se:$i(se,ae,de)}var al=ju||function(se){return ii.clearTimeout(se)};function ll(se,ae){if(ae)return se.slice();var de=se.length,Ee=Pa?Pa(de):new se.constructor(de);return se.copy(Ee),Ee}function Xo(se){var ae=new se.constructor(se.byteLength);return new Mr(ae).set(new Mr(se)),ae}function nh(se,ae){var de=ae?Xo(se.buffer):se.buffer;return new se.constructor(de,se.byteOffset,se.byteLength)}function sh(se){var ae=new se.constructor(se.source,ns.exec(se));return ae.lastIndex=se.lastIndex,ae}function rh(se){return Os?Xt(Os.call(se)):{}}function ul(se,ae){var de=ae?Xo(se.buffer):se.buffer;return new se.constructor(de,se.byteOffset,se.length)}function cl(se,ae){if(se!==ae){var de=se!==R,Ee=se===null,Ie=se===se,Oe=Fi(se),Ue=ae!==R,$e=ae===null,Ke=ae===ae,ct=Fi(ae);if(!$e&&!ct&&!Oe&&se>ae||Oe&&Ue&&Ke&&!$e&&!ct||Ee&&Ue&&Ke||!de&&Ke||!Ie)return 1;if(!Ee&&!Oe&&!ct&&se=$e)return Ke;var ct=de[Ee];return Ke*(ct=="desc"?-1:1)}}return se.index-ae.index}function hl(se,ae,de,Ee){for(var Ie=-1,Oe=se.length,Ue=de.length,$e=-1,Ke=ae.length,ct=ui(Oe-Ue,0),ht=it(Ke+ct),pt=!Ee;++$e1?de[Ie-1]:R,Ue=Ie>2?de[2]:R;for(Oe=se.length>3&&typeof Oe=="function"?(Ie--,Oe):R,Ue&&Ei(de[0],de[1],Ue)&&(Oe=Ie<3?R:Oe,Ie=1),ae=Xt(ae);++Ee-1?Ie[Oe?ae[Ue]:Ue]:R}}function yl(se){return Sn(function(ae){var de=ae.length,Ee=de,Ie=Hi.prototype.thru;for(se&&ae.reverse();Ee--;){var Oe=ae[Ee];if(typeof Oe!="function")throw new Wi(U);if(Ie&&!Ue&&Hr(Oe)=="wrapper")var Ue=new Hi([],!0)}for(Ee=Ue?Ee:de;++Ee1&&zt.reverse(),ht&&Ke$e))return!1;var ct=Oe.get(se),ht=Oe.get(ae);if(ct&&ht)return ct==ae&&ht==se;var pt=-1,bt=!0,wt=de&ne?new $n:R;for(Oe.set(se,ae),Oe.set(ae,se);++pt<$e;){var At=se[pt],Dt=ae[pt];if(Ee)var It=Ue?Ee(Dt,At,pt,ae,se,Oe):Ee(At,Dt,pt,se,ae,Oe);if(It!==R){if(It)continue;bt=!1;break}if(wt){if(!hi(ae,function(Rt,zt){if(!Ls(wt,zt)&&(At===Rt||Ie(At,Rt,de,Ee,Oe)))return wt.push(zt)})){bt=!1;break}}else if(!(At===Dt||Ie(At,Dt,de,Ee,Oe))){bt=!1;break}}return Oe.delete(se),Oe.delete(ae),bt}function ph(se,ae,de,Ee,Ie,Oe,Ue){switch(de){case st:if(se.byteLength!=ae.byteLength||se.byteOffset!=ae.byteOffset)return!1;se=se.buffer,ae=ae.buffer;case Et:return!(se.byteLength!=ae.byteLength||!Oe(new Mr(se),new Mr(ae)));case Ve:case Ye:case Xe:return rn(+se,+ae);case ot:return se.name==ae.name&&se.message==ae.message;case Je:case qe:return se==ae+"";case _e:var $e=Ao;case tt:var Ke=Ee&te;if($e||($e=vr),se.size!=ae.size&&!Ke)return!1;var ct=Ue.get(se);if(ct)return ct==ae;Ee|=ne,Ue.set(se,ae);var ht=_l($e(se),$e(ae),Ee,Ie,Oe,Ue);return Ue.delete(se),ht;case rt:if(Os)return Os.call(se)==Os.call(ae)}return!1}function mh(se,ae,de,Ee,Ie,Oe){var Ue=de&te,$e=Ko(se),Ke=$e.length,ct=Ko(ae),ht=ct.length;if(Ke!=ht&&!Ue)return!1;for(var pt=Ke;pt--;){var bt=$e[pt];if(!(Ue?bt in ae:Yt.call(ae,bt)))return!1}var wt=Oe.get(se),At=Oe.get(ae);if(wt&&At)return wt==ae&&At==se;var Dt=!0;Oe.set(se,ae),Oe.set(ae,se);for(var It=Ue;++pt1?"& ":"")+ae[Ee],ae=ae.join(de>2?", ":" "),se.replace(mi,`{ /* [wrapped with `+ae+`] */ `)}function wh(se){return Nt(se)||Kn(se)||!!(La&&se&&se[La])}function xn(se,ae){var de=typeof se;return ae=ae==null?Te:ae,!!ae&&(de=="number"||de!="symbol"&&no.test(se))&&se>-1&&se%1==0&&se0){if(++ae>=ye)return arguments[0]}else ae=0;return se.apply(R,arguments)}}function $r(se,ae){var de=-1,Ee=se.length,Ie=Ee-1;for(ae=ae===R?Ee:ae;++de1?se[ae-1]:R;return de=typeof de=="function"?(se.pop(),de):R,jl(se,de)});function Ul(se){var ae=De(se);return ae.__chain__=!0,ae}function kf(se,ae){return ae(se),se}function qr(se,ae){return ae(se)}var Rf=Sn(function(se){var ae=se.length,de=ae?se[0]:0,Ee=this.__wrapped__,Ie=function(Oe){return Do(Oe,se)};return ae>1||this.__actions__.length||!(Ee instanceof Ot)||!xn(de)?this.thru(Ie):(Ee=Ee.slice(de,+de+(ae?1:0)),Ee.__actions__.push({func:qr,args:[Ie],thisArg:R}),new Hi(Ee,this.__chain__).thru(function(Oe){return ae&&!Oe.length&&Oe.push(R),Oe}))});function Bf(){return Ul(this)}function Of(){return new Hi(this.value(),this.__chain__)}function Ff(){this.__values__===R&&(this.__values__=nu(this.value()));var se=this.__index__>=this.__values__.length,ae=se?R:this.__values__[this.__index__++];return{done:se,value:ae}}function Vf(){return this}function zf(se){for(var ae,de=this;de instanceof Dr;){var Ee=Bl(de);Ee.__index__=0,Ee.__values__=R,ae?Ie.__wrapped__=Ee:ae=Ee;var Ie=Ee;de=de.__wrapped__}return Ie.__wrapped__=se,ae}function Gf(){var se=this.__wrapped__;if(se instanceof Ot){var ae=se;return this.__actions__.length&&(ae=new Ot(this)),ae=ae.reverse(),ae.__actions__.push({func:qr,args:[aa],thisArg:R}),new Hi(ae,this.__chain__)}return this.thru(aa)}function jf(){return rl(this.__wrapped__,this.__actions__)}var Uf=zr(function(se,ae,de){Yt.call(se,de)?++se[de]:bn(se,de,1)});function Wf(se,ae,de){var Ee=Nt(se)?gt:Dc;return de&&Ei(se,ae,de)&&(ae=R),Ee(se,Tt(ae,3))}function Hf(se,ae){var de=Nt(se)?_t:ja;return de(se,Tt(ae,3))}var Yf=gl(Ol),$f=gl(Fl);function qf(se,ae){return pi(Xr(se,ae),1)}function Xf(se,ae){return pi(Xr(se,ae),Ae)}function Qf(se,ae,de){return de=de===R?1:Ct(de),pi(Xr(se,ae),de)}function Wl(se,ae){var de=Nt(se)?je:Nn;return de(se,Tt(ae,3))}function Hl(se,ae){var de=Nt(se)?nt:Ga;return de(se,Tt(ae,3))}var Zf=zr(function(se,ae,de){Yt.call(se,de)?se[de].push(ae):bn(se,de,[ae])});function Kf(se,ae,de,Ee){se=Li(se)?se:ws(se),de=de&&!Ee?Ct(de):0;var Ie=se.length;return de<0&&(de=ui(Ie+de,0)),eo(se)?de<=Ie&&se.indexOf(ae,de)>-1:!!Ie&&Ni(se,ae,de)>-1}var Jf=kt(function(se,ae,de){var Ee=-1,Ie=typeof ae=="function",Oe=Li(se)?it(se.length):[];return Nn(se,function(Ue){Oe[++Ee]=Ie?xi(ae,Ue,de):zs(Ue,ae,de)}),Oe}),ed=zr(function(se,ae,de){bn(se,de,ae)});function Xr(se,ae){var de=Nt(se)?Mt:qa;return de(se,Tt(ae,3))}function td(se,ae,de,Ee){return se==null?[]:(Nt(ae)||(ae=ae==null?[]:[ae]),de=Ee?R:de,Nt(de)||(de=de==null?[]:[de]),Ka(se,ae,de))}var nd=zr(function(se,ae,de){se[de?0:1].push(ae)},function(){return[[],[]]});function sd(se,ae,de){var Ee=Nt(se)?ei:wa,Ie=arguments.length<3;return Ee(se,Tt(ae,4),de,Ie,Nn)}function rd(se,ae,de){var Ee=Nt(se)?di:wa,Ie=arguments.length<3;return Ee(se,Tt(ae,4),de,Ie,Ga)}function od(se,ae){var de=Nt(se)?_t:ja;return de(se,Kr(Tt(ae,3)))}function ad(se){var ae=Nt(se)?Oa:Zc;return ae(se)}function ld(se,ae,de){(de?Ei(se,ae,de):ae===R)?ae=1:ae=Ct(ae);var Ee=Nt(se)?Ic:Kc;return Ee(se,ae)}function ud(se){var ae=Nt(se)?Pc:eh;return ae(se)}function cd(se){if(se==null)return 0;if(Li(se))return eo(se)?fs(se):se.length;var ae=yi(se);return ae==_e||ae==tt?se.size:Vo(se).length}function hd(se,ae,de){var Ee=Nt(se)?hi:th;return de&&Ei(se,ae,de)&&(ae=R),Ee(se,Tt(ae,3))}var fd=kt(function(se,ae){if(se==null)return[];var de=ae.length;return de>1&&Ei(se,ae[0],ae[1])?ae=[]:de>2&&Ei(ae[0],ae[1],ae[2])&&(ae=[ae[0]]),Ka(se,pi(ae,1),[])}),Qr=Uu||function(){return ii.Date.now()};function dd(se,ae){if(typeof ae!="function")throw new Wi(U);return se=Ct(se),function(){if(--se<1)return ae.apply(this,arguments)}}function Yl(se,ae,de){return ae=de?R:ae,ae=se&&ae==null?se.length:ae,vn(se,ue,R,R,R,R,ae)}function $l(se,ae){var de;if(typeof ae!="function")throw new Wi(U);return se=Ct(se),function(){return--se>0&&(de=ae.apply(this,arguments)),se<=1&&(ae=R),de}}var ua=kt(function(se,ae,de){var Ee=ie;if(de.length){var Ie=In(de,Ss(ua));Ee|=he}return vn(se,Ee,ae,de,Ie)}),ql=kt(function(se,ae,de){var Ee=ie|re;if(de.length){var Ie=In(de,Ss(ql));Ee|=he}return vn(ae,Ee,se,de,Ie)});function Xl(se,ae,de){ae=de?R:ae;var Ee=vn(se,le,R,R,R,R,R,ae);return Ee.placeholder=Xl.placeholder,Ee}function Ql(se,ae,de){ae=de?R:ae;var Ee=vn(se,fe,R,R,R,R,R,ae);return Ee.placeholder=Ql.placeholder,Ee}function Zl(se,ae,de){var Ee,Ie,Oe,Ue,$e,Ke,ct=0,ht=!1,pt=!1,bt=!0;if(typeof se!="function")throw new Wi(U);ae=Xi(ae)||0,Kt(de)&&(ht=!!de.leading,pt="maxWait"in de,Oe=pt?ui(Xi(de.maxWait)||0,ae):Oe,bt="trailing"in de?!!de.trailing:bt);function wt(si){var on=Ee,_n=Ie;return Ee=Ie=R,ct=si,Ue=se.apply(_n,on),Ue}function At(si){return ct=si,$e=Hs(Rt,ae),ht?wt(si):Ue}function Dt(si){var on=si-Ke,_n=si-ct,gu=ae-on;return pt?gi(gu,Oe-_n):gu}function It(si){var on=si-Ke,_n=si-ct;return Ke===R||on>=ae||on<0||pt&&_n>=Oe}function Rt(){var si=Qr();if(It(si))return zt(si);$e=Hs(Rt,Dt(si))}function zt(si){return $e=R,bt&&Ee?wt(si):(Ee=Ie=R,Ue)}function Vi(){$e!==R&&al($e),ct=0,Ee=Ke=Ie=$e=R}function _i(){return $e===R?Ue:zt(Qr())}function zi(){var si=Qr(),on=It(si);if(Ee=arguments,Ie=this,Ke=si,on){if($e===R)return At(Ke);if(pt)return al($e),$e=Hs(Rt,ae),wt(Ke)}return $e===R&&($e=Hs(Rt,ae)),Ue}return zi.cancel=Vi,zi.flush=_i,zi}var pd=kt(function(se,ae){return za(se,1,ae)}),md=kt(function(se,ae,de){return za(se,Xi(ae)||0,de)});function gd(se){return vn(se,be)}function Zr(se,ae){if(typeof se!="function"||ae!=null&&typeof ae!="function")throw new Wi(U);var de=function(){var Ee=arguments,Ie=ae?ae.apply(this,Ee):Ee[0],Oe=de.cache;if(Oe.has(Ie))return Oe.get(Ie);var Ue=se.apply(this,Ee);return de.cache=Oe.set(Ie,Ue)||Oe,Ue};return de.cache=new(Zr.Cache||yn),de}Zr.Cache=yn;function Kr(se){if(typeof se!="function")throw new Wi(U);return function(){var ae=arguments;switch(ae.length){case 0:return!se.call(this);case 1:return!se.call(this,ae[0]);case 2:return!se.call(this,ae[0],ae[1]);case 3:return!se.call(this,ae[0],ae[1],ae[2])}return!se.apply(this,ae)}}function yd(se){return $l(2,se)}var bd=ih(function(se,ae){ae=ae.length==1&&Nt(ae[0])?Mt(ae[0],Bi(Tt())):Mt(pi(ae,1),Bi(Tt()));var de=ae.length;return kt(function(Ee){for(var Ie=-1,Oe=gi(Ee.length,de);++Ie=ae}),Kn=Ha(function(){return arguments}())?Ha:function(se){return ti(se)&&Yt.call(se,"callee")&&!Ca.call(se,"callee")},Nt=it.isArray,Dd=dr?Bi(dr):Vc;function Li(se){return se!=null&&Jr(se.length)&&!wn(se)}function ni(se){return ti(se)&&Li(se)}function kd(se){return se===!0||se===!1||ti(se)&&wi(se)==Ve}var kn=Hu||xa,Rd=pr?Bi(pr):zc;function Bd(se){return ti(se)&&se.nodeType===1&&!Ys(se)}function Od(se){if(se==null)return!0;if(Li(se)&&(Nt(se)||typeof se=="string"||typeof se.splice=="function"||kn(se)||xs(se)||Kn(se)))return!se.length;var ae=yi(se);if(ae==_e||ae==tt)return!se.size;if(Ws(se))return!Vo(se).length;for(var de in se)if(Yt.call(se,de))return!1;return!0}function Fd(se,ae){return Gs(se,ae)}function Vd(se,ae,de){de=typeof de=="function"?de:R;var Ee=de?de(se,ae):R;return Ee===R?Gs(se,ae,R,de):!!Ee}function ha(se){if(!ti(se))return!1;var ae=wi(se);return ae==ot||ae==et||typeof se.message=="string"&&typeof se.name=="string"&&!Ys(se)}function zd(se){return typeof se=="number"&&Da(se)}function wn(se){if(!Kt(se))return!1;var ae=wi(se);return ae==ft||ae==lt||ae==We||ae==He}function Jl(se){return typeof se=="number"&&se==Ct(se)}function Jr(se){return typeof se=="number"&&se>-1&&se%1==0&&se<=Te}function Kt(se){var ae=typeof se;return se!=null&&(ae=="object"||ae=="function")}function ti(se){return se!=null&&typeof se=="object"}var eu=mr?Bi(mr):jc;function Gd(se,ae){return se===ae||Fo(se,ae,ta(ae))}function jd(se,ae,de){return de=typeof de=="function"?de:R,Fo(se,ae,ta(ae),de)}function Ud(se){return tu(se)&&se!=+se}function Wd(se){if(Mh(se))throw new Pt(j);return Ya(se)}function Hd(se){return se===null}function Yd(se){return se==null}function tu(se){return typeof se=="number"||ti(se)&&wi(se)==Xe}function Ys(se){if(!ti(se)||wi(se)!=Fe)return!1;var ae=Tr(se);if(ae===null)return!0;var de=Yt.call(ae,"constructor")&&ae.constructor;return typeof de=="function"&&de instanceof de&&wr.call(de)==Vu}var fa=jn?Bi(jn):Uc;function $d(se){return Jl(se)&&se>=-Te&&se<=Te}var iu=gr?Bi(gr):Wc;function eo(se){return typeof se=="string"||!Nt(se)&&ti(se)&&wi(se)==qe}function Fi(se){return typeof se=="symbol"||ti(se)&&wi(se)==rt}var xs=yr?Bi(yr):Hc;function qd(se){return se===R}function Xd(se){return ti(se)&&yi(se)==ut}function Qd(se){return ti(se)&&wi(se)==yt}var Zd=Wr(zo),Kd=Wr(function(se,ae){return se<=ae});function nu(se){if(!se)return[];if(Li(se))return eo(se)?nn(se):Ci(se);if(Ds&&se[Ds])return Au(se[Ds]());var ae=yi(se),de=ae==_e?Ao:ae==tt?vr:ws;return de(se)}function En(se){if(!se)return se===0?se:0;if(se=Xi(se),se===Ae||se===-Ae){var ae=se<0?-1:1;return ae*Ne}return se===se?se:0}function Ct(se){var ae=En(se),de=ae%1;return ae===ae?de?ae-de:ae:0}function su(se){return se?qn(Ct(se),0,Me):0}function Xi(se){if(typeof se=="number")return se;if(Fi(se))return Pe;if(Kt(se)){var ae=typeof se.valueOf=="function"?se.valueOf():se;se=Kt(ae)?ae+"":ae}if(typeof se!="string")return se===0?se:+se;se=Ea(se);var de=Ri.test(se);return de||io.test(se)?en(se.slice(2),de?2:8):_s.test(se)?Pe:+se}function ru(se){return fn(se,Di(se))}function Jd(se){return se?qn(Ct(se),-Te,Te):se===0?se:0}function Ht(se){return se==null?"":Oi(se)}var ep=bs(function(se,ae){if(Ws(ae)||Li(ae)){fn(ae,fi(ae),se);return}for(var de in ae)Yt.call(ae,de)&&Fs(se,de,ae[de])}),ou=bs(function(se,ae){fn(ae,Di(ae),se)}),to=bs(function(se,ae,de,Ee){fn(ae,Di(ae),se,Ee)}),tp=bs(function(se,ae,de,Ee){fn(ae,fi(ae),se,Ee)}),ip=Sn(Do);function np(se,ae){var de=ys(se);return ae==null?de:Fa(de,ae)}var sp=kt(function(se,ae){se=Xt(se);var de=-1,Ee=ae.length,Ie=Ee>2?ae[2]:R;for(Ie&&Ei(ae[0],ae[1],Ie)&&(Ee=1);++de1),Oe}),fn(se,Jo(se),de),Ee&&(de=Yi(de,q|J|K,dh));for(var Ie=ae.length;Ie--;)Ho(de,ae[Ie]);return de});function wp(se,ae){return lu(se,Kr(Tt(ae)))}var Ep=Sn(function(se,ae){return se==null?{}:qc(se,ae)});function lu(se,ae){if(se==null)return{};var de=Mt(Jo(se),function(Ee){return[Ee]});return ae=Tt(ae),Ja(se,de,function(Ee,Ie){return ae(Ee,Ie[0])})}function _p(se,ae,de){ae=Ln(ae,se);var Ee=-1,Ie=ae.length;for(Ie||(Ie=1,se=R);++Eeae){var Ee=se;se=ae,ae=Ee}if(de||se%1||ae%1){var Ie=ka();return gi(se+Ie*(ae-se+fr("1e-"+((Ie+"").length-1))),ae)}return jo(se,ae)}var Rp=vs(function(se,ae,de){return ae=ae.toLowerCase(),se+(de?hu(ae):ae)});function hu(se){return ma(Ht(se).toLowerCase())}function fu(se){return se=Ht(se),se&&se.replace(so,wu).replace(yo,"")}function Bp(se,ae,de){se=Ht(se),ae=Oi(ae);var Ee=se.length;de=de===R?Ee:qn(Ct(de),0,Ee);var Ie=de;return de-=ae.length,de>=0&&se.slice(de,Ie)==ae}function Op(se){return se=Ht(se),se&&an.test(se)?se.replace(Wt,Eu):se}function Fp(se){return se=Ht(se),se&&Es.test(se)?se.replace(un,"\\$&"):se}var Vp=vs(function(se,ae,de){return se+(de?"-":"")+ae.toLowerCase()}),zp=vs(function(se,ae,de){return se+(de?" ":"")+ae.toLowerCase()}),Gp=ml("toLowerCase");function jp(se,ae,de){se=Ht(se),ae=Ct(ae);var Ee=ae?fs(se):0;if(!ae||Ee>=ae)return se;var Ie=(ae-Ee)/2;return Ur(Nr(Ie),de)+se+Ur(Pr(Ie),de)}function Up(se,ae,de){se=Ht(se),ae=Ct(ae);var Ee=ae?fs(se):0;return ae&&Ee>>0,de?(se=Ht(se),se&&(typeof ae=="string"||ae!=null&&!fa(ae))&&(ae=Oi(ae),!ae&&hs(se))?Dn(nn(se),0,de):se.split(ae,de)):[]}var Qp=vs(function(se,ae,de){return se+(de?" ":"")+ma(ae)});function Zp(se,ae,de){return se=Ht(se),de=de==null?0:qn(Ct(de),0,se.length),ae=Oi(ae),se.slice(de,de+ae.length)==ae}function Kp(se,ae,de){var Ee=De.templateSettings;de&&Ei(se,ae,de)&&(ae=R),se=Ht(se),ae=to({},ae,Ee,wl);var Ie=to({},ae.imports,Ee.imports,wl),Oe=fi(Ie),Ue=To(Ie,Oe),$e,Ke,ct=0,ht=ae.interpolate||ss,pt="__p += '",bt=Io((ae.escape||ss).source+"|"+ht.source+"|"+(ht===Zi?Rn:ss).source+"|"+(ae.evaluate||ss).source+"|$","g"),wt="//# sourceURL="+(Yt.call(ae,"sourceURL")?(ae.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cr+"]")+` `;se.replace(bt,function(It,Rt,zt,Vi,_i,zi){return zt||(zt=Vi),pt+=se.slice(ct,zi).replace(Ki,_u),Rt&&($e=!0,pt+=`' + __e(`+Rt+`) + '`),_i&&(Ke=!0,pt+=`'; `+_i+`; __p += '`),zt&&(pt+=`' + ((__t = (`+zt+`)) == null ? '' : __t) + '`),ct=zi+It.length,It}),pt+=`'; `;var At=Yt.call(ae,"variable")&&ae.variable;if(!At)pt=`with (obj) { `+pt+` } `;else if(Vt.test(At))throw new Pt(W);pt=(Ke?pt.replace(ci,""):pt).replace(Zt,"$1").replace(Gi,"$1;"),pt="function("+(At||"obj")+`) { `+(At?"":`obj || (obj = {}); `)+"var __t, __p = ''"+($e?", __e = _.escape":"")+(Ke?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+pt+`return __p }`;var Dt=pu(function(){return Ut(Oe,wt+"return "+pt).apply(R,Ue)});if(Dt.source=pt,ha(Dt))throw Dt;return Dt}function Jp(se){return Ht(se).toLowerCase()}function em(se){return Ht(se).toUpperCase()}function tm(se,ae,de){if(se=Ht(se),se&&(de||ae===R))return Ea(se);if(!se||!(ae=Oi(ae)))return se;var Ee=nn(se),Ie=nn(ae),Oe=_a(Ee,Ie),Ue=Ma(Ee,Ie)+1;return Dn(Ee,Oe,Ue).join("")}function im(se,ae,de){if(se=Ht(se),se&&(de||ae===R))return se.slice(0,Aa(se)+1);if(!se||!(ae=Oi(ae)))return se;var Ee=nn(se),Ie=Ma(Ee,nn(ae))+1;return Dn(Ee,0,Ie).join("")}function nm(se,ae,de){if(se=Ht(se),se&&(de||ae===R))return se.replace(Mn,"");if(!se||!(ae=Oi(ae)))return se;var Ee=nn(se),Ie=_a(Ee,nn(ae));return Dn(Ee,Ie).join("")}function sm(se,ae){var de=ve,Ee=pe;if(Kt(ae)){var Ie="separator"in ae?ae.separator:Ie;de="length"in ae?Ct(ae.length):de,Ee="omission"in ae?Oi(ae.omission):Ee}se=Ht(se);var Oe=se.length;if(hs(se)){var Ue=nn(se);Oe=Ue.length}if(de>=Oe)return se;var $e=de-fs(Ee);if($e<1)return Ee;var Ke=Ue?Dn(Ue,0,$e).join(""):se.slice(0,$e);if(Ie===R)return Ke+Ee;if(Ue&&($e+=Ke.length-$e),fa(Ie)){if(se.slice($e).search(Ie)){var ct,ht=Ke;for(Ie.global||(Ie=Io(Ie.source,Ht(ns.exec(Ie))+"g")),Ie.lastIndex=0;ct=Ie.exec(ht);)var pt=ct.index;Ke=Ke.slice(0,pt===R?$e:pt)}}else if(se.indexOf(Oi(Ie),$e)!=$e){var bt=Ke.lastIndexOf(Ie);bt>-1&&(Ke=Ke.slice(0,bt))}return Ke+Ee}function rm(se){return se=Ht(se),se&&Qi.test(se)?se.replace(bi,Cu):se}var om=vs(function(se,ae,de){return se+(de?" ":"")+ae.toUpperCase()}),ma=ml("toUpperCase");function du(se,ae,de){return se=Ht(se),ae=de?R:ae,ae===R?Tu(se)?ku(se):Ii(se):se.match(ae)||[]}var pu=kt(function(se,ae){try{return xi(se,R,ae)}catch(de){return ha(de)?de:new Pt(de)}}),am=Sn(function(se,ae){return je(ae,function(de){de=dn(de),bn(se,de,ua(se[de],se))}),se});function lm(se){var ae=se==null?0:se.length,de=Tt();return se=ae?Mt(se,function(Ee){if(typeof Ee[1]!="function")throw new Wi(U);return[de(Ee[0]),Ee[1]]}):[],kt(function(Ee){for(var Ie=-1;++IeTe)return[];var de=Me,Ee=gi(se,Me);ae=Tt(ae),se-=Me;for(var Ie=Mo(Ee,ae);++de0||ae<0)?new Ot(de):(se<0?de=de.takeRight(-se):se&&(de=de.drop(se)),ae!==R&&(ae=Ct(ae),de=ae<0?de.dropRight(-ae):de.take(ae-se)),de)},Ot.prototype.takeRightWhile=function(se){return this.reverse().takeWhile(se).reverse()},Ot.prototype.toArray=function(){return this.take(Me)},hn(Ot.prototype,function(se,ae){var de=/^(?:filter|find|map|reject)|While$/.test(ae),Ee=/^(?:head|last)$/.test(ae),Ie=De[Ee?"take"+(ae=="last"?"Right":""):ae],Oe=Ee||/^find/.test(ae);!Ie||(De.prototype[ae]=function(){var Ue=this.__wrapped__,$e=Ee?[1]:arguments,Ke=Ue instanceof Ot,ct=$e[0],ht=Ke||Nt(Ue),pt=function(Rt){var zt=Ie.apply(De,jt([Rt],$e));return Ee&&bt?zt[0]:zt};ht&&de&&typeof ct=="function"&&ct.length!=1&&(Ke=ht=!1);var bt=this.__chain__,wt=!!this.__actions__.length,At=Oe&&!bt,Dt=Ke&&!wt;if(!Oe&&ht){Ue=Dt?Ue:new Ot(this);var It=se.apply(Ue,$e);return It.__actions__.push({func:qr,args:[pt],thisArg:R}),new Hi(It,bt)}return At&&Dt?se.apply(this,$e):(It=this.thru(pt),At?Ee?It.value()[0]:It.value():It)})}),je(["pop","push","shift","sort","splice","unshift"],function(se){var ae=Sr[se],de=/^(?:push|sort|unshift)$/.test(se)?"tap":"thru",Ee=/^(?:pop|shift)$/.test(se);De.prototype[se]=function(){var Ie=arguments;if(Ee&&!this.__chain__){var Oe=this.value();return ae.apply(Nt(Oe)?Oe:[],Ie)}return this[de](function(Ue){return ae.apply(Nt(Ue)?Ue:[],Ie)})}}),hn(Ot.prototype,function(se,ae){var de=De[ae];if(de){var Ee=de.name+"";Yt.call(gs,Ee)||(gs[Ee]=[]),gs[Ee].push({name:ae,func:de})}}),gs[Gr(R,re).name]=[{name:"wrapper",func:R}],Ot.prototype.clone=ic,Ot.prototype.reverse=nc,Ot.prototype.value=sc,De.prototype.at=Rf,De.prototype.chain=Bf,De.prototype.commit=Of,De.prototype.next=Ff,De.prototype.plant=zf,De.prototype.reverse=Gf,De.prototype.toJSON=De.prototype.valueOf=De.prototype.value=jf,De.prototype.first=De.prototype.head,Ds&&(De.prototype[Ds]=Vf),De},ds=Ru();Ti?((Ti.exports=ds)._=ds,Vn._=ds):ii._=ds}).call(commonjsGlobal$1)})(lodash,lodash.exports);const browserInfo$5=browser(),getLinkId$1=()=>location.hash.split("?")[0].split("/").pop()||"",retain=B=>Math.ceil(B*1e6)/1e6,formatLyricsEntries=B=>{var F,G;const D=((F=B.parentStaffEntry)==null?void 0:F.voiceEntries)||[],R=[];for(const j of D)if((G=j.lyricsEntries)!=null&&G.table){const U=Object.values(j.lyricsEntries.table);for(const W of U)R.push(W==null?void 0:W.value.text)}return R},getMeasureDurationDiff=B=>{const{realValue:D}=B.activeTimeSignature,{realValue:R}=B.duration;return D-R},getAllNodes=B=>{var Q,Z,q,J,K,te,ne,ie,re,oe,le,fe,he,ge,ue,me,be,ve,pe,ye,xe,ce,we,Be,Ae,Te,Ne,Pe,Me,Se,Le,ze,ke,Ge,We,Ve,Ye,et,ot,ft,lt;const D=getLinkId$1();let R=browserInfo$5.huawei?.08:0;const F=[],G=[],j=[],{baseSpeed:U=100}=state$2,W=(_e,Xe)=>{var He,Je,tt,qe,rt,dt;return["906"].includes(D)?((He=Xe.measures[0])==null?void 0:He.realKey)||_e:["782","784"].includes(D)&&[14,16,30,32].includes((Je=Xe.firstVerticalMeasure)==null?void 0:Je.measureNumber)?((tt=F[F.length-1])==null?void 0:tt.realKey)||_e:["900","901","640","641","739","740","800","801","773","774","869","872","714","715"].includes(D)&&(((qe=Xe.firstVerticalMeasure)==null?void 0:qe.measureNumber)===3||((rt=Xe.firstVerticalMeasure)==null?void 0:rt.measureNumber)===9)&&((dt=Xe.measures[0])==null?void 0:dt.realKey)||_e};if(B!=null&&B.cursor){try{B.cursor.reset()}catch{}const _e=B.cursor.iterator;let Xe=0,Qe=0,Fe=[],Re=[],He=0,Je=0,tt=0,qe="quarter",rt=1,dt=0,ut=0,yt=0,Et=0,st=!1,xt=0;for(;!_e.endReached;){const Lt=B.cursor.cursorElement,Gt={move:!1};Lt&&(Gt.move=!0,Gt.x=Lt.offsetLeft,Gt.y=Lt.offsetTop,Gt.w=Lt.offsetWidth,Gt.h=Lt.offsetHeight);const ai=(Q=_e.currentVoiceEntries)!=null&&Q[0]?[(Z=_e.currentVoiceEntries)==null?void 0:Z[0]]:[],Ft=(q=_e.currentVoiceEntries)==null?void 0:q[1];let Qt=!1;for(const Jt of ai){let mt=Jt.notes[0];if(["Piano"].includes((J=state$2.activeDetail)==null?void 0:J.code)){let ri=[];try{ri=(K=_e.currentVoiceEntries)==null?void 0:K.map(ci=>ci.notes).flat().sort((ci,Zt)=>ci.Length.realValue-Zt.Length.realValue),mt=ri[0]}catch{}}if(mt){if(Qe===0&&j.push(mt.sourceMeasure),Qe===0&&state$2.isSpecialBookCategory)for(const Vt of(te=mt.sourceMeasure)==null?void 0:te.TempoExpressions)(ne=Vt==null?void 0:Vt.InstantaneousTempo)!=null&&ne.beatUnit&&(qe=Vt.InstantaneousTempo.beatUnit);rt=(ie=mt.sourceMeasure)==null?void 0:ie.MeasureNumberXML,ut==((re=mt.sourceMeasure)==null?void 0:re.MeasureNumberXML)?yt++:(ut=(oe=mt.sourceMeasure)==null?void 0:oe.MeasureNumberXML,yt=0);let ri=mt.sourceMeasure.tempoInBPM;const{metronomeNoteIndex:ci}=_e.currentMeasure;ci!==0&&ci>Qe&&(ri=((le=F[F.length-1])==null?void 0:le.speed)||100);const Zt=[(fe=mt.sourceMeasure.verticalMeasureList)==null?void 0:fe[0]],{realValue:Gi}=_e.currentTimeStamp,{RealValue:bi,Denominator:Wt}=formatDuration(_e.currentMeasure.activeTimeSignature,_e.currentMeasure.duration);let{wholeValue:Qi,numerator:an,denominator:ln,realValue:Jn}=mt.length,Zi=He,ji=(state$2.isSpecialBookCategory?getTimeByBeatUnit(qe,ri,_e.currentMeasure.activeTimeSignature.Denominator):U)||1,pn=(state$2.isSpecialBookCategory?ri:U)||1;Xe===0&&(R+=getFixTime(ji));let Mi=(an===0&&mt.isRestFlag?bi:(Qi+an)/ln)*Wt*(60/ji);const un=bi*Wt*(60/ji);["Piano"].includes((he=state$2.activeDetail)==null?void 0:he.code)&&(Mi=(_e.currentTimeStamp.realValue-Et||(an===0?bi:(Qi+an)/ln))*Wt*(60/ji)),mt.isRestFlag&&((ge=mt==null?void 0:mt.sourceMeasure)==null?void 0:ge.allRests)&&(xt=(ue=mt==null?void 0:mt.sourceMeasure)==null?void 0:ue.multipleRestMeasures),xt>0&&(xt-=1,Mi=un),mt.isRestFlag&&Mi>un&&(Mi=un),mt.DotsXml&&mt.tuplet&&(Mi=Mi*1.5),st&&(Mi=1e-7,st=!1,Qt=!0);const Es=(me=mt.sourceMeasure.staffLinkedExpressions)==null?void 0:me[0];for(const Vt of Es||[])if(Vt&&((be=Vt.expressions)==null?void 0:be.find(Rn=>Rn.label==="\u8DF3\u8FC7\u4E0B\u4E00\u4E2A"))&&Fraction$1.Equal((ve=mt.voiceEntry)==null?void 0:ve.Timestamp,Vt.Timestamp)){st=!0;break}Et=_e.currentTimeStamp.realValue,He+=Mi,Je+=Mi;let Mn=Mi+Zi;const es=mt.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey||0,mi=(ye=(pe=Zt[0])==null?void 0:pe.vfVoices["1"])==null?void 0:ye.tickables[yt];if(F.length&&F[F.length-1].relativeTime===Zi)continue;if(Xe===0){const Vt=getMeasureDurationDiff(_e.currentMeasure);console.log("diff",Vt),Vt>0&&(tt=Vt*Wt*(60/ji),((xe=state$2.activeDetail)==null?void 0:xe.audioType)==="MIDI"&&(tt=0),R+=tt)}const vi={skipMode:Qt,NoteToGraphicalNoteObjectId:mt.NoteToGraphicalNoteObjectId,cursorBox:Gt,skipNextNote:st,measureNumberPrinted:rt,difftime:tt,octaveOffset:(ce=Zt[0])==null?void 0:ce.octaveOffset,frequency:(we=mt.pitch)==null?void 0:we.frequency,speed:pn,beatSpeed:ji,i:Xe,si:Qe,stepSpeeds:Re,indexOfMeasures:dt,measureOpenIndex:j.length-1,measures:Fe,tempoInBPM:mt.sourceMeasure.tempoInBPM,measureLength:un,relaMeasureLength:Je,id:mi==null?void 0:mi.attrs.id,note:mt.halfTone+12,relativeTime:retain(Zi),time:retain(Zi+R),endtime:retain(Mn+R),relaEndtime:retain(Mn),realValue:Gi,halfTone:mt.halfTone,voiceEntry:{isStaccato:mt.voiceEntry.isStaccato(),Timestamp:{...mt.voiceEntry.Timestamp},ornamentContainer:mt.voiceEntry.ornamentContainer?{...mt.voiceEntry.ornamentContainer}:""},noteElement:{NoteToGraphicalNoteObjectId:mt.NoteToGraphicalNoteObjectId,notehead:mt.notehead?{filled:mt.notehead.filled,shape:mt.notehead.shape,sourceNote:(Be=mt.notehead.sourceNote)==null?void 0:Be.NoteToGraphicalNoteObjectId}:"",noteheadColor:mt.noteheadColor,isRestFlag:mt.isRestFlag,sourceMeasure:{measureListIndex:(Ae=mt==null?void 0:mt.SourceMeasure)==null?void 0:Ae.measureListIndex,MeasureNumberXML:(Te=mt==null?void 0:mt.SourceMeasure)==null?void 0:Te.MeasureNumberXML,allRests:(Ne=mt==null?void 0:mt.SourceMeasure)==null?void 0:Ne.allRests,isRestFlag:(Pe=mt==null?void 0:mt.SourceMeasure)==null?void 0:Pe.isRestFlag,multipleRestMeasures:(Me=mt==null?void 0:mt.SourceMeasure)==null?void 0:Me.multipleRestMeasures,verticalMeasureList:Array.isArray((Se=mt==null?void 0:mt.SourceMeasure)==null?void 0:Se.verticalMeasureList)?mt.SourceMeasure.verticalMeasureList.map(Vt=>{const{x:is,y:Rn,width:ns,height:_s,start_x:Ri,end_x:Ms}=(Vt==null?void 0:Vt.stave)||{};return Vt?{stave:{x:is,y:Rn,width:ns,height:_s,start_x:Ri,end_x:Ms},boundingBox:Vt&&Vt.boundingBox?{absolutePosition:{...Vt.boundingBox.absolutePosition},size:{...Vt.boundingBox.size}}:""}:void 0}):[],activeTimeSignature:{...mt.activeTimeSignature}},tie:mt.tie?{StartNote:{NoteToGraphicalNoteObjectId:mt.tie.StartNote.NoteToGraphicalNoteObjectId},notes:Array.isArray(mt.tie.notes)&&((Le=mt.tie.notes)==null?void 0:Le.map(Vt=>({NoteToGraphicalNoteObjectId:Vt.NoteToGraphicalNoteObjectId})))||[]}:"",slurs:Array.isArray(mt.slurs)?mt.slurs.map(Vt=>({startNote:{NoteToGraphicalNoteObjectId:Vt.startNote.NoteToGraphicalNoteObjectId},endNote:{NoteToGraphicalNoteObjectId:Vt.endNote.NoteToGraphicalNoteObjectId}})):[],pitch:{prevFrequency:(ze=mt.pitch)==null?void 0:ze.prevFrequency,nextFrequency:(ke=mt.pitch)==null?void 0:ke.nextFrequency,frequency:(Ge=mt.pitch)==null?void 0:Ge.frequency},Length:{...mt.Length}},svgElelent:mi?{bbox:((We=mi.getBoundingBox)==null?void 0:We.call(mi))||"",top_y:mi.top_y,note_height:mi.note_height}:"",fixedKey:es,realKey:0,duration:0,formatLyricsEntries:formatLyricsEntries(mt),stave:Zt[0]&&Zt[0].stave?{attrs:Zt[0].stave?{...Zt[0].stave.attrs}:{}}:"",firstVerticalMeasure:{measureNumber:(Ve=Zt==null?void 0:Zt[0])==null?void 0:Ve.measureNumber},noteLength:1,halfTone1:Array.isArray(Jt.notes)?Jt.notes.map(Vt=>Vt.halfTone+12).filter(Boolean):[],halfTone2:Ft&&Array.isArray(Ft.notes)?Ft.notes.map(Vt=>Vt.halfTone+12).filter(Boolean):[]};vi.realKey=W(mt.halfTone-es*12,vi),vi.duration=vi.endtime-vi.time;const ts=((et=(Ye=Zt[0])==null?void 0:Ye.vfVoices["1"])==null?void 0:et.tickables)||[],Ui=((lt=(ft=(ot=mt.sourceMeasure.verticalMeasureList)==null?void 0:ot[0])==null?void 0:ft.staffEntries)==null?void 0:lt.length)||ts.length;vi.noteLength=Ui||1,F.push(vi),G.push(vi.id),Fe.push({realKey:vi.realKey,NoteToGraphicalNoteObjectId:mt.NoteToGraphicalNoteObjectId}),Qe_e.relativeTime-Xe.relativeTime).map((_e,Xe)=>({..._e,i:Xe}));for(let _e=0;_e{if(B.product){if(D||D===0)if(R&&D-R===1)B.cursor.setPosition({...state$2.times[D].cursorBox});else if(R&&D-R>0)for(;D-R>0;)R++,D-R>0&&B.cursor.setPosition({...state$2.times[R].cursorBox});else B.cursor.setPosition({...state$2.times[D].cursorBox})}else if(D||D===0)if(R&&D-R===1)B.cursor.next();else if(R&&D-R>0)for(;D-R>0;)R++,B.cursor.next();else{let F=0;for(B.cursor.reset();F{if(D>state$2.times[state$2.times.length-1].endtime)return-1;let R=0;const F=B.filter((G,j)=>{const U=B[j-1];return(U==null?void 0:U.skipNextNote)===!1});for(let G=0;G=j.time)(!U||j.time!=U.time)&&(R=j.i);else break}if(state$2.sectionStatus&&state$2.section.length===2){const G=state$2.befireSection||state$2.section[0];R=Math.min(Math.max(R,G.i),state$2.section[1].i),console.log("endIndex",R)}return R},getSlursNote=(B,D)=>{var F,G;let R=D==="end"?(F=B.noteElement.slurs[0])==null?void 0:F.endNote:(G=B.noteElement.slurs[0])==null?void 0:G.startNote;if(!!R)return state$2.times.find(j=>j.NoteToGraphicalNoteObjectId==R.NoteToGraphicalNoteObjectId)},getNoteBySlursStart=(B,D,R)=>{let F=B,G=getSlursNote(F,R);if(!G&&D)for(const j of F.measures){const U=state$2.times.find(W=>W.NoteToGraphicalNoteObjectId==j.NoteToGraphicalNoteObjectId);console.log("\u{1F680} ~ item",U),U.noteElement.slurs.length&&(G=getSlursNote(U,R),F=U)}if(F&&G!==F.noteElement){for(const j of state$2.times)if(G===j.noteElement)return j}return F},getParentNote=B=>{let D;if(B){for(const R of state$2.times)if(B.NoteToGraphicalNoteObjectId===R.noteElement.NoteToGraphicalNoteObjectId)return R}return D},getNoteByMeasuresSlursStart=B=>{let D=B,R;if(B.noteElement.tie&&B.noteElement.tie.StartNote&&(R=B.noteElement.tie.StartNote),D&&R&&R!==D.noteElement){for(const F of state$2.times)if(R.NoteToGraphicalNoteObjectId===F.noteElement.NoteToGraphicalNoteObjectId)return F}return D},getActtiveNoteByTimes=B=>{var G;const D=(G=B.target)==null?void 0:G.dataset,R={};for(const j of state$2.times)j.id&&(R[j.id]=j);return R[D.id||""]},getPrevHasSourceNote=B=>{const D=Math.max(state$2.times.indexOf(B)-1,0);for(let R=D;R>=0;R--){const F=state$2.times[R];if(F!=null&&F.stave)return F}},getBoundingBoxByverticalNote=B=>{var F,G,j,U,W,Y,Q,Z,q;let D=(G=(F=B==null?void 0:B.noteElement)==null?void 0:F.sourceMeasure)==null?void 0:G.verticalMeasureList;D=!D||!D[0]?((j=B==null?void 0:B.noteElement)==null?void 0:j.isRestFlag)&&((Y=(W=(U=getPrevHasSourceNote(B))==null?void 0:U.noteElement)==null?void 0:W.sourceMeasure)==null?void 0:Y.verticalMeasureList):D;let R=0;if(D){const J=D[state.partIndex];for(let K=0;K0&&(R+=(Q=D[K-1])==null?void 0:Q.stave.height),R+=ne;const{x:ie,y:re,width:oe,context:le,start_x:fe,end_x:he}=J==null?void 0:J.stave;return{measureIndex:((Z=B==null?void 0:B.noteElement)==null?void 0:Z.sourceMeasure.measureListIndex)||0,MeasureNumberXML:((q=B==null?void 0:B.noteElement)==null?void 0:q.sourceMeasure.MeasureNumberXML)||1,start_x:fe,end_x:he,height:R,x:ie,y:re,width:oe,context:le}}}}return{measureIndex:0,height:R,start_x:0,end_x:0,x:0,y:0,width:0,context:{element:null}}},getDuration=B=>{var D;if(B){const R=(D=B==null?void 0:B.graphic)==null?void 0:D.measureList[0][0];if(R){const{duration:F,tempoInBPM:G,activeTimeSignature:j}=R==null?void 0:R.parentSourceMeasure;if(F)return{...formatDuration(j),tempoInBPM:G}}}return{}},formatDuration=(B,D)=>B,getTimeByBeatUnit=(B,D,R)=>{let F=4;switch(B){case"1024th":F=1024;break;case"512th":F=512;break;case"256th":F=256;break;case"128th":F=128;break;case"64th":F=64;break;case"32nd":F=32;break;case"16th":F=16;break;case"eighth":F=8;break;case"quarter":F=4;break;case"half":F=2;break;case"whole":F=1;break;case"breve":F=.5;break;case"long":F=.25;break;case"maxima":F=.125;break}return R/F*D},getEnvHostname=()=>location.origin.indexOf("online")>-1?"https://mstuonline.dayaedu.com":location.origin.indexOf("dev")>-1?"http://mstudev.dayaedu.com":"https://mstutest.dayaedu.com",getTvIconUrl=()=>location.origin.indexOf("online")>-1?"https://mteaonline.dayaedu.com/#/guide":location.origin.indexOf("dev")>-1?"http://mteadev.dayaedu.com/#/guide":"https://mteatest.dayaedu.com/#/guide",setPrefix=B=>B?"?"+B:"",formatXML=(B,D)=>{var Y,Q,Z;if(!B)return"";const R=new DOMParser().parseFromString(B,"text/xml"),F=R.getElementsByTagName("measure");let G=-1,j=-1;const U=document.createElement("direction"),W=` quarter 100 1 1`;U.innerHTML=W,R.getElementsByTagName("per-minute").length===0&&((Y=F[0])==null||Y.insertAdjacentElement("afterbegin",U));for(const q of F){G===-1&&q.getElementsByTagName("beats").length&&(G=parseInt(q.getElementsByTagName("beats")[0].textContent||"4")),j===-1&&q.getElementsByTagName("beat-type").length&&(j=parseInt(q.getElementsByTagName("beat-type")[0].textContent||"4"));const J=parseInt(((Q=q.getElementsByTagName("divisions")[0])==null?void 0:Q.textContent)||"256");if(q.getElementsByTagName("note").length===0){const K=(Z=q.getElementsByTagName("forward")[0])==null?void 0:Z.getElementsByTagName("duration")[0];K&&(K.textContent="0"),q.innerHTML=q.innerHTML+` ${J*G} 1 whole `}}if(D){const q=R.querySelector("work-title");q&&D.title&&(q.textContent=D.title)}return new XMLSerializer().serializeToString(R)},getCustomInfo=B=>{var G,j,U;const D={showSpeed:!0,parsedXML:B,code:""},R=new DOMParser().parseFromString(B,"text/xml"),F=R.getElementsByTagName("words");for(const W of F)W&&((G=W.textContent)==null?void 0:G.trim())==="\u9690\u85CF\u901F\u5EA6"&&(D.showSpeed=!1,W.textContent=""),W&&((j=W.textContent)==null?void 0:j.trim())==="@"&&(W.textContent="segno");return D.parsedXML=new XMLSerializer().serializeToString(R),D.code=((U=R.querySelector("part-name"))==null?void 0:U.innerHTML)||"",D},setElementNoteBefore=(B,D,R)=>{let F=0;if(!!D){for(let G=0;G0){let G=0;for(let j=0;j{if(B){const D=B.toLocaleLowerCase(),R="d\\s?\\.s\\.",F="d\\.\\s?c\\.";return D==="@"||StringUtil.StringContainsSeparatedWord(D,R+" al fine",!0)||StringUtil.StringContainsSeparatedWord(D,R+" al coda",!0)||StringUtil.StringContainsSeparatedWord(D,F+" al fine",!0)||StringUtil.StringContainsSeparatedWord(D,F+" al coda",!0)||StringUtil.StringContainsSeparatedWord(D,F)||StringUtil.StringContainsSeparatedWord(D,"da\\s?capo",!0)||StringUtil.StringContainsSeparatedWord(D,R,!0)||StringUtil.StringContainsSeparatedWord(D,"dal\\s?segno",!0)||StringUtil.StringContainsSeparatedWord(D,"al\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(D,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(D,"a (la )?coda",!0)||StringUtil.StringContainsSeparatedWord(D,"fine",!0)||StringUtil.StringContainsSeparatedWord(D,"coda",!0)||StringUtil.StringContainsSeparatedWord(D,"segno",!0)}return!1},onlyVisible=(B,D)=>{var q,J,K,te,ne,ie;if(!B)return"";const R=new DOMParser().parseFromString(B,"text/xml"),F=((J=(q=R.getElementsByTagName("part-list"))==null?void 0:q[0])==null?void 0:J.getElementsByTagName("score-part"))||[],G=Array.from(F).map(re=>{var oe;return((oe=re.getElementsByTagName("part-name"))==null?void 0:oe[0].textContent)||""}),j=R.getElementsByTagName("part")||[];if(!j.length)return"";const U=[...(K=j[0])==null?void 0:K.getElementsByTagName("measure")],W=[...(te=j[0])==null?void 0:te.getElementsByTagName("metronome")],Y=[...(ne=j[0])==null?void 0:ne.getElementsByTagName("words")],Q=[...(ie=j[0])==null?void 0:ie.getElementsByTagName("rehearsal")],Z=F[D];if(state$2.partListNames=G,Z){const re=Z.getAttribute("id");Array.from(j).forEach(fe=>{var he,ge,ue,me,be;if(fe&&fe.getAttribute("id")!==re)(he=fe.parentNode)==null||he.removeChild(fe);else if(fe&&fe.getAttribute("id")!=="P1"){const ve={};for(let pe=0;pe{var Be;const ye=(Be=pe.parentElement)==null?void 0:Be.parentElement,xe=ye==null?void 0:ye.parentElement,ce=[...(xe==null?void 0:xe.childNodes)||[]],we=ye?ce.indexOf(ye):-1;if(xe&&we>-1){const Ae=U.indexOf(xe),Te=fe.getElementsByTagName("measure")[Ae];setElementNoteBefore(ye,xe,Te)}}),Y.forEach(pe=>{var xe;const ye=pe.textContent||"";if((isSpecialMark(ye)||isSpeedKeyword(ye)||isGradientWords(ye)||isRepeatWord(ye)||GRADIENT_SPEED_RESET_TAG)&&ye){const ce=(xe=pe.parentElement)==null?void 0:xe.parentElement,we=ce==null?void 0:ce.parentElement,Be=[...(we==null?void 0:we.childNodes)||[]],Ae=ce?Be.indexOf(ce):-1;if(ce&&we&&Ae>-1){const Te=U.indexOf(we),Ne=fe.getElementsByTagName("measure")[Te];setElementNoteBefore(ce,we,Ne)}}}),Q.forEach(pe=>{var ce,we;const ye=(ce=pe.parentElement)==null?void 0:ce.parentElement,xe=ye==null?void 0:ye.parentElement;if(xe){const Be=U.indexOf(xe);(we=fe.getElementsByTagName("measure")[Be])==null||we.appendChild(ye.cloneNode(!0))}})}if(fe&&fe.getAttribute("id")===re){const ve=fe.getElementsByTagName("barline"),pe=(me=ve[ve.length-1])==null?void 0:me.parentElement;if(((be=pe==null?void 0:pe.lastElementChild)==null?void 0:be.tagName)!=="barline"){const ye=(pe==null?void 0:pe.children)||[];for(let xe of ye)if(xe.tagName==="barline"){pe==null||pe.appendChild(xe);break}}}}),Array.from(F).forEach(fe=>{var he;fe&&fe.getAttribute("id")!==re&&((he=fe.parentNode)==null||he.removeChild(fe))});const oe=R.getElementsByTagName("note"),le=fe=>{var ue;let he=oe[fe+1];for(let me=fe;me{var ue;const ge=fe.getElementsByTagName("grace");ge&&ge.length&&fe.appendChild((ue=le(he))==null?void 0:ue.cloneNode(!0))})}return new XMLSerializer().serializeToString(R)},appoggianceFormate=B=>{var G,j,U,W;if(!B)return B;const D=new DOMParser().parseFromString(B,"text/xml"),R=D.querySelectorAll("grace");if(!R.length)return B;const F=Y=>Y.querySelector("grace")?F(Y==null?void 0:Y.nextElementSibling):Y;for(let Y of R){const Q=(G=Y.parentElement)==null?void 0:G.querySelector("notations");if(Q&&Q.querySelectorAll("slur").length>1){let Z=F((j=Y.parentElement)==null?void 0:j.nextElementSibling);if(Z&&Z.querySelectorAll("slur").length>0){const q=Array.from(((U=Z.querySelector("notations"))==null?void 0:U.children)||[]).map(K=>K.getAttribute("number")),J=Q.querySelectorAll("slur");for(let K of J)q.includes(K.getAttribute("number"))||(W=Z.querySelector("notations"))==null||W.appendChild(K)}}}return new XMLSerializer().serializeToString(D)},getVoicePartInfo=()=>{const{MusicalInstrumentClassification:B,chinesePartName:D}=state$3;let R=-1;const{partListNames:F,partIndex:G}=state$2;if(F.filter(U=>(U||"").trim()!=="").length)for(const U of Object.entries(B)){const[W,Y]=U,Q=F[G],Z=Y.filter(q=>q&&Q.indexOf(q||"")>-1);if(Q&&(Z.length||Y.includes(Q)))return isNaN(+W)||(R=+W),{realPartListNames:F,subjectId:R,partListNames:Y,partName:Q,chinesePartName:D[Q]||Q}}return{subjectId:R,partListNames:[]}},classids=[1,30],idIsInClassIds=(B,D,R=!1)=>{if(!B)return!1;let F=!1;for(const G of B){if(G.id===D&&(R||classids.includes(G.id))){F=!0;break}if(G.sysMusicScoreCategoriesList&&(F=idIsInClassIds(G.sysMusicScoreCategoriesList,D,R||classids.includes(G.id)),F))break}return F};class SectionHint{constructor(){this.currentNote=null,this.el=document.createElement("div"),this.span=document.createElement("span"),this.init()}init(){this.el.id="section-hint"+Math.floor(Math.random()*1e5),this.hide()}showForElement(D){var G;if(this.currentNote===D)return;this.el||(this.el=document.createElement("div"),this.init(),this.show()),this.currentNote=D;const R=getBoundingBoxByverticalNote(D),F=document.querySelector("#osmdSvgPage1");if(R){const{x:j,y:U,width:W,height:Y}=R;this.el.id="custom-cursor-bg-hint",this.el.style.position="absolute",this.el.style.top=formatZoom(U)+"px",this.el.style.left=formatZoom(j)+"px",this.el.style.width=formatZoom(W)+"px",this.el.style.height=formatZoom(Y)+"px",this.el.style.zIndex="-1",(G=F==null?void 0:F.parentNode)==null||G.appendChild(this.el)}}hide(){this.el.style.display="none"}show(){this.el.style.display=""}destroy(){this.currentNote=null,this.hide()}}function __variableDynamicImportRuntime0__(B){switch(B){case"../src/pages/baseClass/index.tsx":return __vitePreload(()=>import("./index.451f1881.js"),["assets/index.451f1881.js","assets/index.4b7cbd62.css","assets/base.23532cc4.js","assets/base.0757ff9b.css","assets/index.bb630a89.js"]);case"../src/pages/classify/index.tsx":return __vitePreload(()=>import("./index.0d9ed189.js"),["assets/index.0d9ed189.js","assets/index.f442919d.css","assets/base.23532cc4.js","assets/base.0757ff9b.css","assets/index.bb630a89.js"]);case"../src/pages/detail/index.tsx":return __vitePreload(()=>import("./index.c43aa906.js"),["assets/index.c43aa906.js","assets/index.9dacf812.css","assets/base.23532cc4.js","assets/base.0757ff9b.css","assets/index.8794bc3a.js","assets/index.bb630a89.js","assets/index.434e3602.js","assets/index.93438080.css","assets/index.69e123be.js","assets/index.06f6a16d.css","assets/music.b35eb5be.js","assets/state.315d1f1b.js","assets/vip.15651f6b.js","assets/vip.838f4afe.css","assets/index.1d389b0a.js"]);case"../src/pages/list/index.tsx":return __vitePreload(()=>import("./index.d5402996.js"),["assets/index.d5402996.js","assets/index.f746a31c.css","assets/base.23532cc4.js","assets/base.0757ff9b.css","assets/state.315d1f1b.js","assets/vip.15651f6b.js","assets/vip.838f4afe.css","assets/music.b35eb5be.js"]);case"../src/pages/notfund/index.tsx":return __vitePreload(()=>import("./index.98a9c9e2.js"),["assets/index.98a9c9e2.js","assets/base.23532cc4.js","assets/base.0757ff9b.css"]);case"../src/pages/render-test/index.tsx":return __vitePreload(()=>import("./index.1a2c5206.js"),["assets/index.1a2c5206.js","assets/base.23532cc4.js","assets/base.0757ff9b.css"]);case"../src/pages/report/index.tsx":return __vitePreload(()=>import("./index.0337d001.js").then(function(D){return D.i}),["assets/index.0337d001.js","assets/index.007e2b62.css","assets/base.23532cc4.js","assets/base.0757ff9b.css","assets/index.69e123be.js","assets/index.06f6a16d.css","assets/music.b35eb5be.js","assets/index.443bc957.js","assets/index.fba0bdd7.css","assets/index.8794bc3a.js","assets/index.1d389b0a.js"]);default:return new Promise(function(D,R){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(R.bind(null,new Error("Unknown variable dynamic import: "+B)))})}}const getRouterComponent=B=>async()=>{const D=setTimeout(()=>{open$2()},300);let R=Promise.resolve(null);try{R=await __variableDynamicImportRuntime0__(`../src/pages/${B}/index.tsx`)}catch{R=Promise.reject()}return clearTimeout(D),close$2(),R};var routes=[{path:"/",component:getRouterComponent("baseClass")},{path:"/classify",component:getRouterComponent("classify")},{path:"/list/:id",component:getRouterComponent("list"),meta:{keepAlive:!0}},{path:"/detail/:id",component:getRouterComponent("detail")},{path:"/evaluating/:id",component:getRouterComponent("detail")},{path:"/report",component:getRouterComponent("report")},{path:"/report/:id",component:getRouterComponent("report")},{path:"/render-test",component:getRouterComponent("render-test")},{path:"/vexflow-test",component:__vitePreload(()=>import("./index.50ced30f.js"),["assets/index.50ced30f.js","assets/base.23532cc4.js","assets/base.0757ff9b.css"])},{path:"/:pathMatch(.*)*",component:getRouterComponent("notfund"),meta:{title:"404 Not Fund"}}];createRouter({history:createWebHashHistory(),routes});const tock="SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAGAAAKmwA6Ojo6Ojo6Ojo6Ojo6Ojo6YmJiYmJiYmJiYmJiYmJiYmKJiYmJiYmJiYmJiYmJiYmJsbGxsbGxsbGxsbGxsbGxsbHY2NjY2NjY2NjY2NjY2NjY2P////////////////////8AAAAATGF2YzU4LjU0AAAAAAAAAAAAAAAAJAQUAAAAAAAACpv9GcQ9AAAAAAAAAAAAAAAAAAAAAP/7kGQAAALJHFAdPeAAMs13wKAUABOVWUYZ2gAA1UIigwBQAAAAUlDQQxklOcnZOydj1iYIxFj1oWbgRwYhdwAgBMLA1q+Ech0QS2HREhx5GBklTjJq98QImWB5q9/SmXkQa8gJAxrBDlDn/l/D5d9cH9pd/D/Ln+H+XP8P////////////kIQhCf6EIz////5z8hCf//////85CEqc5zkqcPh8Ph8DgAAAABwOBwUIYigkYzAOBgVYUoT0xxC8ypKoLAmYGA34OAo4Ukoel04PoEw+AY5KXwIIcD4SwNeeCwQnPAyAEDKEQAQwphNGfC10AQCF6hESOSROeGNRFBPYnkVxbUW+KTH8ZQZcmyCUWWj/HPJ8iBBy2SxPrRrRr/lYqlcnidNieLpsuvXr/5eMTIvHThkdMDIz///8wUmYIJoIHzRj6ALf/8Ahz/////////////09fPP/f++v91/qp///0FCCor/MeqOQV9OtjKwvETiP///4gLFJ///+PYKZAAAJSMgAAwRYCBMBIAIRYAFgJiRgCoBwYDiBGGAvgP/7kmQPjfQJHkZXfqAANq14YOAUAE0JqxIN/oiIvTZhgACj2SxgDYAkYBOAeGAtgzRh5IwEZAKX5HH4nhRqcw/qYc4EGmBlAeBgu4K8BuRvgZYEQGQRwBjkZDiS0cxRbUuZOZHpixkiipJJ1OpaqzJIe4kJfb////////6heitNxprnDpIJ//////////+/r+tfuy37W7+d1rTu37oi36V//p/RGntSvLdowxnDgeONKh1jhpihwTMDCAwcPO8CRICfmLS0OAAxDCIU1kuNRoDAEATswDwKMME9IWzYyOJsxDwZfMBUCPDAYwSEwHACiA8jwD2hwLkAGpwxG//9///t/q//////7+////+r/////99mu7qqdT6Dp6KtS3WmpaJso5oG//zU/y9j4VkE5l+sBkvmkX+v///acWnV2trA0mrZlJKphkD4zD4UYeaLigSkDKVVAAAABoOjRLAYlW2pbW0TjAQPMMiYxoNTLhlNAqA29QTCARHAylZ+yMpzCeDB0ANUwLUBKIgHkGugOHwNbgAFkXS1+v/V/p/6/9f+3/7/+5JkJojzkmvFa5+akiqtWGAAJfZPNa0MDn6KSMy2IUAAm6HV66am7/9qv9JO3S/1f/7dPr7V1/1/QrqtqWt9StPTTTSQrNUm/8ud1+NUvMOdbX4+j4aaz6f//rVfa9U1dtasIILnUYQ4o4wTDo87xIDzyBiBbaW9wIQKKCAVG5gEUGSwkaiBx005mGcAmRt6ItsZhME5GFGgZpglAD8YFGA6gce2BpnwGLRgAECDP//6////////11dkWu1S67La+tnr2t1UPo9f1vt//71alvXrqRmSlo60EkkVLTdzxdQLhmeLyRqo+ZmhaOQf9f/FXojkaky22YJvJz9bAcF9zk0p8v/+X752Zmbu+7Tqr5l8j+aexVdmLCHIEz0WejhSGgDmLY5Yp0A4ATFgDgwCcAEMAVATgCBZmAuAwRgoIoKaUNEAmBeh/5rCvGZViZSMxjwUGPQOGEgiDcJ////3/////+/9P0k8taNNRqKfI7qhlYqGY7/ZPyVb9v+vfVDEkVkKZHrOwgVhUUQa6iRRrChlDwrFFDwkOFwoTKKEfr/5//uSZECP8/BswoP8KyAurYhgACb2TnWxCg38qoi3NiGAAJvZyyeZe+GTlsyDkIzns5w///+v+3z/7fmPsPpsRc5J09lTsJmEllkDIC0CMKkQLax/q7iyphogZAOmcI5pr0cF/mCYhxRiJDJgY4CESGCQAW5gMoCIYAgAAg0AAMAMABzABwAAtiH///////////911rt5im0a6NR1t6satH2VVWyp1///+nofRUZHQimYpSmHWZw8cYoTYCDxgmIi6CqIv/TvkZdRYEQDg7m7Uuyzf0qz//////63ds8PL1uNTm7nWYRtHt0hJrgT3SKaqWg5c/2AGAUAwBgATARAbMDQCwwIASzEfGVMWUpU75zHTcSLAMIYFQweADDBFAnA4/AWYG2ABAMv//////////9er32U7V2vruldDdWvVZaqkEXe9f7W/+/f60ek6DpqVRQSRSpsiipA4UCfNjExMjxoXlLSNCZMhf//////////9P/17cln97tv9GIhOVro9PTf//9U19ao0qO5FTUGEDmO4CcoYUgyiwoZVQEcAAABCv/7kmRYgAPBbEKFemACNK14YKAIAB2aEQc56gAB1UIgwwLQAAgAAAABq3tm9gKW2Bgcic+KisAoBQwGBTT7kslMXcNU7Q9oDDGDANzjkkwCwpVFWbApcBEnr8DMCgNMCE59VTQbwB2hOINj//cBpGKiDY+IJl7q/XKgLABYguYC9hbW6aCaDKrUggkLIHoiIpcLljtEEzdNEwm6RspVN3OJUxcZeMBMCJCCAcYbjMGiZcVUZou6LGa1F51prqLxBSDh9yqKXGTYzGwRJSqjk1L54rn0Cbm2szRPolE4R5Ml0dBDyDi4BPh8cDonxH5OiAZLmQ5pOE2RcZwfJc////LY1Y2////xzRDBpCyP1/////////79v9F0GWupdNNadM2SZSe7TWdQOJUETFkEzdRmgYWTc6by8q9lsaGi2UZLWihMzVdaJ916OiZFBiSYpmJwiDHFxdJB0zp4vmRgiS8fmR0UWXJpqRROx6l00HsO4Lr///+PY6MUMf///5ONCIOekEgAFo2Hw+Gw1EYYCAHPFMMT2N4KpAjHDGwyfhUkKHP/+5JkEAAEs0PYbkMkhDDs+DDAHAAAAAGkHAAAIAAANIOAAARJeX/IDTYPBUSlUNQD/+eBQG8NtczGGFOFF6L//zBYBCY0cDrhKStLnRiNT///LXqrpGMbRVUuksRopVlS////p8LMTDUAXkvl1pqtnzWVX////5dRRunlFeU005/7///9f/////3reGruVrlsHP/iUgZCDTTzlv//////zf/+qt//+x1HNHnGv//6OOqz0Op////ORzh4qUHiTiMM/////kABRAf/+qpMQU1FMy4xMDCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",tick="SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAGAAAKmwA6Ojo6Ojo6Ojo6Ojo6Ojo6YmJiYmJiYmJiYmJiYmJiYmKJiYmJiYmJiYmJiYmJiYmJsbGxsbGxsbGxsbGxsbGxsbHY2NjY2NjY2NjY2NjY2NjY2P////////////////////8AAAAATGF2YzU4LjU0AAAAAAAAAAAAAAAAJAQUAAAAAAAACpsJoXZ7AAAAAAAAAAAAAAAAAAAAAP/7kGQAAALmINEVPeAAOA1nwKAUAFJpV1I5moAAxMIiwwAgAAAJdWKyJljOc0zrZ9UpVjOc0ydibhICwL5OzLXhuEsSYKQMBGN7PInFA1lsOiJDj4ePJU4yavfFKXVjzWb+msvIg0/EgY4If/D/E58P7S7+H+X8H+X8H+XeUDH+U///////////////+d/oQjZCEIQjZCEJ85zv/////8hCEI1CEIQhCHExc7oIBwOAGAYBgGAYfD48ACQIWDrWCzEHeEXm6Qvl/frHQSfa7Wyi4qArEA3m2QMdkQDHnDAyqJQROEFN0BhgEgYaCoAIEAWABAi+FrGF/QbVDIQppKJLOeHoisC1jGjOWr/HLJUgBAzMnK2Wv+Rc3KhPny0V1rrXX/KxqfLxqbF4xS169f/LxiZF46cMjpgcT///8wUmggmgg6DHwRPf/6AW//////////////317pa6/09U///7//ndTuIUN/ldtifykKtKygv///41n////DBRxSpwEjjYIBpwgmIASlzATXqOy+0WbkkUn6YKEJjwqmVBma4nxv/7kmQRhvRLLEe/cuAALs14cOAIAE0lqRIPgFVIsjYhgACb2aAtG1x8BggIP4Bg7YQ+BrcLKgBiv4oEBiIYYEBg5oIEBgPYAWBgNQDaBgKACSBgFIBMBgD4AQKTGRrZ1mKB9jFB0mUkkl3S2LyToGyXq6q0FqelU9VR9SYlO/6vXV//2//yvh3ubf/////////////5P/N+V6fauunX+v31//67c+Z2P6ldBAIyshGO5jAhgqiAhHFyGBSAA6Iz801nLGtGX9dpgKAoCADZgD4EgYICFfmCmAjZgcYHAYLCDOGGCDeZ0W0QOY54C9mDtgUxgbgCqYDuASAIB9DAC8VAA0QmU03un0/Ru30/////t6//r/a3UYivlU12BHnIolcGP+p/9YNArFgyKNS7cofI88/////P28923u73DxbZ0lFImJUdrVhd6t8DsRiWCALVe0ttc7rdNLoy5S5QaABGALAKJgJgRkYIKBSGBVASpgcwJ+YOSK7G9ZqIBiYoLgYJQBKmBBgJBgIQBCYA6ABIwqdLCu9Z//bb/v6/pe1q/Zv/+5JkKY/zZWrEA+AVQjHNqFAARvYN8bEOD4C1CL22YUAAm9j/t//+n/tNRX0Y6tRxaOo9DBJFa7WHABUQuuuiX+37brMiv9QRXvqfsaTl7d/X///8/2t147te2ihqbNj6UUiJ7XI3TrhLAVDlhRuiQCzA1nL/3ljS00Ou8iqYAeARGADA1JgYACmYDuAtGBGgcxgeQgqaxkVzmF+Am5gVYDsYCIAbmANgCxgAgACzp/WvQ7l/9Pv/XtW+tNUZ3qzdtG27////678qXQx9dEsIB8p0I4mUcqIZFIIioYcsXg/7rKY4sEx/yskQCv1sODfXqX/fk3bfrN/u97+wUUxZrxqMvrRBxjrHQcDMzkIqHgIZ7H//96ysz0VacYAgApgZiYGEKA4YJgGJgmBPmDGXUfuKWRjeh4GCkCuYDIEhgAAFoCnpk8Cz3P/t7y3vfL1yEvXoldaK/0/N//9fru/QrGFio7EGIRmKzDzlY7g4kHR4sOHD3D5Rhx39lwVz0WozDO36Ye8RGSizLItOzh/+P/1V78uv/F++XnVXODau4y+V//uSZEmP81dsQwPALUIyzZhQACn2C6GzDA8AVQC4NiGAAKPZWbabe2ImyAcS6WJ42uf//+/7eo4SmsYFgWIYEaYEYBhgMgqAAb05CgQTDCCXMBMC4GAGohM9gCckV7v/b3VS6sk6I3Kpcy/k3pXei/p//3//u+y5lkXUOimYQIMHiqoKdzmIEFiVCDf/znuaM4Q1fF52ict/xk/y/////8172vq6sNjqCmui3ZhonD5BHUYMDLiEaeitExf/ZM0JMTADBeIIFgxgDAlAwBA5AwEFKA9IoNAwph4AcCEGoBA8otA5ZPlo+3///////v+pwNTH8GyDFIyKIfORswWXNnSIIDnbM9++/zvHfPFvmHrVupOT56+1XG6XRMNOjlFhkVyQIyMMvy6nrD2uJnhq6JZSI2Nll5SuVhL/v/WH7z3n+eof23Ocu7SuuSyl/Ol3zNs9SB1pxgZNUBASDtc/99+vSbzvsojBvbkVpvmgYKAnAQGOBtCPoBgXBKBgoBUGkiCAYDHwK3Efm6kGTL5fNGWm6jBAzHMJxk01FwuMgg30C//7kmR0BfNla8ICwV3yMw2oUAAp9hRBsQkVmwAIvLYhwoBQAOnQZaaai+n6aboVvUhWaGFNakEGZkLu1SZ+gqmkp3SdGnSUzr2agpV1MhQQUmrst9Vb3W77prrWtearQRubpqRTdZupM0MEDdFZsznETcrEWLRfNDI6mWjYl////////////76/ttT9NE9F+7f27/0///r0rpQt2ucqMVqq6WEkFkERykEwkPItGggAAASKvjNixlEu4N8A55LwruB3AB+uOSUMLDgDjBsI/l05xH44xcgy5ZMWfxySBEsO0idEySX8cwoEecIsTqlOjV+T5XJwmyiUjVaPZX8qlsnDAzMC8XTdVSvX/z5oXzpxE1PmiBmv1alf/mBkYnz5obnTizU2NEDPr/1f//QSm//9YAEAAACRVvkHHeYo4YgA30vCu4GXAAaAuOSUMLDgDgwbCP5dOcQDHGLkGXLJiz+OSQIlh2kTomSS/jmFAjzhFidUp0avyfK5OE2USkarR7K/lUtk4YGZwvF03VUr1/8+XC+dOImp80QM1+rUr/8wMkT/+5JEeoAEI2hHLk5gAIZNCOXJUAAAAAGkHAAAIAAANIOAAAT580L504iamxogn1/Vq//+cSLqf/9aTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",b64toBlob=(B,D="",R=512)=>{const F=atob(B),G=[];for(let U=0;U=0&&q<=1){if(J._volume=q,J._muted)return J;J.usingWebAudio&&J.masterGain.gain.setValueAtTime(q,R.ctx.currentTime);for(var K=0;K=0;J--)q._howls[J].unload();return q.usingWebAudio&&q.ctx&&typeof q.ctx.close!="undefined"&&(q.ctx.close(),q.ctx=null,Z()),q},codecs:function(q){return(this||R)._codecs[q.replace(/^x-/,"")]},_setup:function(){var q=this||R;if(q.state=q.ctx&&q.ctx.state||"suspended",q._autoSuspend(),!q.usingWebAudio)if(typeof Audio!="undefined")try{var J=new Audio;typeof J.oncanplaythrough=="undefined"&&(q._canPlayEvent="canplay")}catch{q.noAudio=!0}else q.noAudio=!0;try{var J=new Audio;J.muted&&(q.noAudio=!0)}catch{}return q.noAudio||q._setupCodecs(),q},_setupCodecs:function(){var q=this||R,J=null;try{J=typeof Audio!="undefined"?new Audio:null}catch{return q}if(!J||typeof J.canPlayType!="function")return q;var K=J.canPlayType("audio/mpeg;").replace(/^no$/,""),te=q._navigator?q._navigator.userAgent:"",ne=te.match(/OPR\/([0-6].)/g),ie=ne&&parseInt(ne[0].split("/")[1],10)<33,re=te.indexOf("Safari")!==-1&&te.indexOf("Chrome")===-1,oe=te.match(/Version\/(.*?) /),le=re&&oe&&parseInt(oe[1],10)<15;return q._codecs={mp3:!!(!ie&&(K||J.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!K,opus:!!J.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!J.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!J.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(J.canPlayType('audio/wav; codecs="1"')||J.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!J.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!J.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(J.canPlayType("audio/x-m4a;")||J.canPlayType("audio/m4a;")||J.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(J.canPlayType("audio/x-m4b;")||J.canPlayType("audio/m4b;")||J.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(J.canPlayType("audio/x-mp4;")||J.canPlayType("audio/mp4;")||J.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!le&&J.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!le&&J.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!J.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(J.canPlayType("audio/x-flac;")||J.canPlayType("audio/flac;")).replace(/^no$/,"")},q},_unlockAudio:function(){var q=this||R;if(!(q._audioUnlocked||!q.ctx)){q._audioUnlocked=!1,q.autoUnlock=!1,!q._mobileUnloaded&&q.ctx.sampleRate!==44100&&(q._mobileUnloaded=!0,q.unload()),q._scratchBuffer=q.ctx.createBuffer(1,1,22050);var J=function(K){for(;q._html5AudioPool.length0?re._seek:K._sprite[q][0]/1e3),fe=Math.max(0,(K._sprite[q][0]+K._sprite[q][1])/1e3-le),he=fe*1e3/Math.abs(re._rate),ge=K._sprite[q][0]/1e3,ue=(K._sprite[q][0]+K._sprite[q][1])/1e3;re._sprite=q,re._ended=!1;var me=function(){re._paused=!1,re._seek=le,re._start=ge,re._stop=ue,re._loop=!!(re._loop||K._sprite[q][2])};if(le>=ue){K._ended(re);return}var be=re._node;if(K._webAudio){var ve=function(){K._playLock=!1,me(),K._refreshBuffer(re);var ce=re._muted||K._muted?0:re._volume;be.gain.setValueAtTime(ce,R.ctx.currentTime),re._playStart=R.ctx.currentTime,typeof be.bufferSource.start=="undefined"?re._loop?be.bufferSource.noteGrainOn(0,le,86400):be.bufferSource.noteGrainOn(0,le,fe):re._loop?be.bufferSource.start(0,le,86400):be.bufferSource.start(0,le,fe),he!==1/0&&(K._endTimers[re._id]=setTimeout(K._ended.bind(K,re),he)),J||setTimeout(function(){K._emit("play",re._id),K._loadQueue()},0)};R.state==="running"&&R.ctx.state!=="interrupted"?ve():(K._playLock=!0,K.once("resume",ve),K._clearTimer(re._id))}else{var pe=function(){be.currentTime=le,be.muted=re._muted||K._muted||R._muted||be.muted,be.volume=re._volume*R.volume(),be.playbackRate=re._rate;try{var ce=be.play();if(ce&&typeof Promise!="undefined"&&(ce instanceof Promise||typeof ce.then=="function")?(K._playLock=!0,me(),ce.then(function(){K._playLock=!1,be._unlocked=!0,J?K._loadQueue():K._emit("play",re._id)}).catch(function(){K._playLock=!1,K._emit("playerror",re._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."),re._ended=!0,re._paused=!0})):J||(K._playLock=!1,me(),K._emit("play",re._id)),be.playbackRate=re._rate,be.paused){K._emit("playerror",re._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}q!=="__default"||re._loop?K._endTimers[re._id]=setTimeout(K._ended.bind(K,re),he):(K._endTimers[re._id]=function(){K._ended(re),be.removeEventListener("ended",K._endTimers[re._id],!1)},be.addEventListener("ended",K._endTimers[re._id],!1))}catch(we){K._emit("playerror",re._id,we)}};be.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(be.src=K._src,be.load());var ye=window&&window.ejecta||!be.readyState&&R._navigator.isCocoonJS;if(be.readyState>=3||ye)pe();else{K._playLock=!0,K._state="loading";var xe=function(){K._state="loaded",pe(),be.removeEventListener(R._canPlayEvent,xe,!1)};be.addEventListener(R._canPlayEvent,xe,!1),K._clearTimer(re._id)}}return re._id},pause:function(q){var J=this;if(J._state!=="loaded"||J._playLock)return J._queue.push({event:"pause",action:function(){J.pause(q)}}),J;for(var K=J._getSoundIds(q),te=0;te=0?te=parseInt(J[0],10):K=parseFloat(J[0])}else J.length>=2&&(K=parseFloat(J[0]),te=parseInt(J[1],10));var re;if(typeof K!="undefined"&&K>=0&&K<=1){if(q._state!=="loaded"||q._playLock)return q._queue.push({event:"volume",action:function(){q.volume.apply(q,J)}}),q;typeof te=="undefined"&&(q._volume=K),te=q._getSoundIds(te);for(var oe=0;oe0?te/fe:te),ge=Date.now();q._fadeTo=K,q._interval=setInterval(function(){var ue=(Date.now()-ge)/te;ge=Date.now(),oe+=le*ue,oe=Math.round(oe*100)/100,le<0?oe=Math.max(K,oe):oe=Math.min(K,oe),re._webAudio?q._volume=oe:re.volume(oe,q._id,!0),ie&&(re._volume=oe),(KJ&&oe>=K)&&(clearInterval(q._interval),q._interval=null,q._fadeTo=null,re.volume(K,q._id),re._emit("fade",q._id))},he)},_stopFade:function(q){var J=this,K=J._soundById(q);return K&&K._interval&&(J._webAudio&&K._node.gain.cancelScheduledValues(R.ctx.currentTime),clearInterval(K._interval),K._interval=null,J.volume(K._fadeTo,q),K._fadeTo=null,J._emit("fade",q)),J},loop:function(){var q=this,J=arguments,K,te,ne;if(J.length===0)return q._loop;if(J.length===1)if(typeof J[0]=="boolean")K=J[0],q._loop=K;else return ne=q._soundById(parseInt(J[0],10)),ne?ne._loop:!1;else J.length===2&&(K=J[0],te=parseInt(J[1],10));for(var ie=q._getSoundIds(te),re=0;re=0?te=parseInt(J[0],10):K=parseFloat(J[0])}else J.length===2&&(K=parseFloat(J[0]),te=parseInt(J[1],10));var re;if(typeof K=="number"){if(q._state!=="loaded"||q._playLock)return q._queue.push({event:"rate",action:function(){q.rate.apply(q,J)}}),q;typeof te=="undefined"&&(q._rate=K),te=q._getSoundIds(te);for(var oe=0;oe=0?te=parseInt(J[0],10):q._sounds.length&&(te=q._sounds[0]._id,K=parseFloat(J[0]))}else J.length===2&&(K=parseFloat(J[0]),te=parseInt(J[1],10));if(typeof te=="undefined")return 0;if(typeof K=="number"&&(q._state!=="loaded"||q._playLock))return q._queue.push({event:"seek",action:function(){q.seek.apply(q,J)}}),q;var re=q._soundById(te);if(re)if(typeof K=="number"&&K>=0){var oe=q.playing(te);oe&&q.pause(te,!0),re._seek=K,re._ended=!1,q._clearTimer(te),!q._webAudio&&re._node&&!isNaN(re._node.duration)&&(re._node.currentTime=K);var le=function(){oe&&q.play(te,!0),q._emit("seek",te)};if(oe&&!q._webAudio){var fe=function(){q._playLock?setTimeout(fe,0):le()};setTimeout(fe,0)}else le()}else if(q._webAudio){var he=q.playing(te)?R.ctx.currentTime-re._playStart:0,ge=re._rateSeek?re._rateSeek-re._seek:0;return re._seek+(ge+he*Math.abs(re._rate))}else return re._node.currentTime;return q},playing:function(q){var J=this;if(typeof q=="number"){var K=J._soundById(q);return K?!K._paused:!1}for(var te=0;te=0&&R._howls.splice(te,1);var ne=!0;for(K=0;K=0){ne=!1;break}return j&&ne&&delete j[q._src],R.noAudio=!1,q._state="unloaded",q._sounds=[],q=null,null},on:function(q,J,K,te){var ne=this,ie=ne["_on"+q];return typeof J=="function"&&ie.push(te?{id:K,fn:J,once:te}:{id:K,fn:J}),ne},off:function(q,J,K){var te=this,ne=te["_on"+q],ie=0;if(typeof J=="number"&&(K=J,J=null),J||K)for(ie=0;ie=0;ie--)(!ne[ie].id||ne[ie].id===J||q==="load")&&(setTimeout(function(re){re.call(this,J,K)}.bind(te,ne[ie].fn),0),ne[ie].once&&te.off(q,ne[ie].fn,ne[ie].id));return te._loadQueue(q),te},_loadQueue:function(q){var J=this;if(J._queue.length>0){var K=J._queue[0];K.event===q&&(J._queue.shift(),J._loadQueue()),q||K.action()}return J},_ended:function(q){var J=this,K=q._sprite;if(!J._webAudio&&q._node&&!q._node.paused&&!q._node.ended&&q._node.currentTime=0;te--){if(K<=J)return;q._sounds[te]._ended&&(q._webAudio&&q._sounds[te]._node&&q._sounds[te]._node.disconnect(0),q._sounds.splice(te,1),K--)}}},_getSoundIds:function(q){var J=this;if(typeof q=="undefined"){for(var K=[],te=0;te=0;if(R._scratchBuffer&&q.bufferSource&&(q.bufferSource.onended=null,q.bufferSource.disconnect(0),K))try{q.bufferSource.buffer=R._scratchBuffer}catch{}return q.bufferSource=null,J},_clearSound:function(q){var J=/MSIE |Trident\//.test(R._navigator&&R._navigator.userAgent);J||(q.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var G=function(q){this._parent=q,this.init()};G.prototype={init:function(){var q=this,J=q._parent;return q._muted=J._muted,q._loop=J._loop,q._volume=J._volume,q._rate=J._rate,q._seek=0,q._paused=!0,q._ended=!0,q._sprite="__default",q._id=++R._counter,J._sounds.push(q),q.create(),q},create:function(){var q=this,J=q._parent,K=R._muted||q._muted||q._parent._muted?0:q._volume;return J._webAudio?(q._node=typeof R.ctx.createGain=="undefined"?R.ctx.createGainNode():R.ctx.createGain(),q._node.gain.setValueAtTime(K,R.ctx.currentTime),q._node.paused=!0,q._node.connect(R.masterGain)):R.noAudio||(q._node=R._obtainHtml5Audio(),q._errorFn=q._errorListener.bind(q),q._node.addEventListener("error",q._errorFn,!1),q._loadFn=q._loadListener.bind(q),q._node.addEventListener(R._canPlayEvent,q._loadFn,!1),q._endFn=q._endListener.bind(q),q._node.addEventListener("ended",q._endFn,!1),q._node.src=J._src,q._node.preload=J._preload===!0?"auto":J._preload,q._node.volume=K*R.volume(),q._node.load()),q},reset:function(){var q=this,J=q._parent;return q._muted=J._muted,q._loop=J._loop,q._volume=J._volume,q._rate=J._rate,q._seek=0,q._rateSeek=0,q._paused=!0,q._ended=!0,q._sprite="__default",q._id=++R._counter,q},_errorListener:function(){var q=this;q._parent._emit("loaderror",q._id,q._node.error?q._node.error.code:0),q._node.removeEventListener("error",q._errorFn,!1)},_loadListener:function(){var q=this,J=q._parent;J._duration=Math.ceil(q._node.duration*10)/10,Object.keys(J._sprite).length===0&&(J._sprite={__default:[0,J._duration*1e3]}),J._state!=="loaded"&&(J._state="loaded",J._emit("load"),J._loadQueue()),q._node.removeEventListener(R._canPlayEvent,q._loadFn,!1)},_endListener:function(){var q=this,J=q._parent;J._duration===1/0&&(J._duration=Math.ceil(q._node.duration*10)/10,J._sprite.__default[1]===1/0&&(J._sprite.__default[1]=J._duration*1e3),J._ended(q)),q._node.removeEventListener("ended",q._endFn,!1)}};var j={},U=function(q){var J=q._src;if(j[J]){q._duration=j[J].duration,Q(q);return}if(/^data:[^;]+;base64,/.test(J)){for(var K=atob(J.split(",")[1]),te=new Uint8Array(K.length),ne=0;ne0?(j[J._src]=ne,Q(J,ne)):K()};typeof Promise!="undefined"&&R.ctx.decodeAudioData.length===1?R.ctx.decodeAudioData(q).then(te).catch(K):R.ctx.decodeAudioData(q,te,K)},Q=function(q,J){J&&!q._duration&&(q._duration=J.duration),Object.keys(q._sprite).length===0&&(q._sprite={__default:[0,q._duration*1e3]}),q._state!=="loaded"&&(q._state="loaded",q._emit("load"),q._loadQueue())},Z=function(){if(!!R.usingWebAudio){try{typeof AudioContext!="undefined"?R.ctx=new AudioContext:typeof webkitAudioContext!="undefined"?R.ctx=new webkitAudioContext:R.usingWebAudio=!1}catch{R.usingWebAudio=!1}R.ctx||(R.usingWebAudio=!1);var q=/iP(hone|od|ad)/.test(R._navigator&&R._navigator.platform),J=R._navigator&&R._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),K=J?parseInt(J[1],10):null;if(q&&K&&K<9){var te=/safari/.test(R._navigator&&R._navigator.userAgent.toLowerCase());R._navigator&&!te&&(R.usingWebAudio=!1)}R.usingWebAudio&&(R.masterGain=typeof R.ctx.createGain=="undefined"?R.ctx.createGainNode():R.ctx.createGain(),R.masterGain.gain.setValueAtTime(R._muted?0:R._volume,R.ctx.currentTime),R.masterGain.connect(R.ctx.destination)),R._setup()}};B.Howler=R,B.Howl=F,typeof commonjsGlobal$1!="undefined"?(commonjsGlobal$1.HowlerGlobal=D,commonjsGlobal$1.Howler=R,commonjsGlobal$1.Howl=F,commonjsGlobal$1.Sound=G):typeof window!="undefined"&&(window.HowlerGlobal=D,window.Howler=R,window.Howl=F,window.Sound=G)})();/*! * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. * * howler.js v2.2.3 * 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(R){var F=this;if(!F.ctx||!F.ctx.listener)return F;for(var G=F._howls.length-1;G>=0;G--)F._howls[G].stereo(R);return F},HowlerGlobal.prototype.pos=function(R,F,G){var j=this;if(!j.ctx||!j.ctx.listener)return j;if(F=typeof F!="number"?j._pos[1]:F,G=typeof G!="number"?j._pos[2]:G,typeof R=="number")j._pos=[R,F,G],typeof j.ctx.listener.positionX!="undefined"?(j.ctx.listener.positionX.setTargetAtTime(j._pos[0],Howler.ctx.currentTime,.1),j.ctx.listener.positionY.setTargetAtTime(j._pos[1],Howler.ctx.currentTime,.1),j.ctx.listener.positionZ.setTargetAtTime(j._pos[2],Howler.ctx.currentTime,.1)):j.ctx.listener.setPosition(j._pos[0],j._pos[1],j._pos[2]);else return j._pos;return j},HowlerGlobal.prototype.orientation=function(R,F,G,j,U,W){var Y=this;if(!Y.ctx||!Y.ctx.listener)return Y;var Q=Y._orientation;if(F=typeof F!="number"?Q[1]:F,G=typeof G!="number"?Q[2]:G,j=typeof j!="number"?Q[3]:j,U=typeof U!="number"?Q[4]:U,W=typeof W!="number"?Q[5]:W,typeof R=="number")Y._orientation=[R,F,G,j,U,W],typeof Y.ctx.listener.forwardX!="undefined"?(Y.ctx.listener.forwardX.setTargetAtTime(R,Howler.ctx.currentTime,.1),Y.ctx.listener.forwardY.setTargetAtTime(F,Howler.ctx.currentTime,.1),Y.ctx.listener.forwardZ.setTargetAtTime(G,Howler.ctx.currentTime,.1),Y.ctx.listener.upX.setTargetAtTime(j,Howler.ctx.currentTime,.1),Y.ctx.listener.upY.setTargetAtTime(U,Howler.ctx.currentTime,.1),Y.ctx.listener.upZ.setTargetAtTime(W,Howler.ctx.currentTime,.1)):Y.ctx.listener.setOrientation(R,F,G,j,U,W);else return Q;return Y},Howl.prototype.init=function(R){return function(F){var G=this;return G._orientation=F.orientation||[1,0,0],G._stereo=F.stereo||null,G._pos=F.pos||null,G._pannerAttr={coneInnerAngle:typeof F.coneInnerAngle!="undefined"?F.coneInnerAngle:360,coneOuterAngle:typeof F.coneOuterAngle!="undefined"?F.coneOuterAngle:360,coneOuterGain:typeof F.coneOuterGain!="undefined"?F.coneOuterGain:0,distanceModel:typeof F.distanceModel!="undefined"?F.distanceModel:"inverse",maxDistance:typeof F.maxDistance!="undefined"?F.maxDistance:1e4,panningModel:typeof F.panningModel!="undefined"?F.panningModel:"HRTF",refDistance:typeof F.refDistance!="undefined"?F.refDistance:1,rolloffFactor:typeof F.rolloffFactor!="undefined"?F.rolloffFactor:1},G._onstereo=F.onstereo?[{fn:F.onstereo}]:[],G._onpos=F.onpos?[{fn:F.onpos}]:[],G._onorientation=F.onorientation?[{fn:F.onorientation}]:[],R.call(this,F)}}(Howl.prototype.init),Howl.prototype.stereo=function(R,F){var G=this;if(!G._webAudio)return G;if(G._state!=="loaded")return G._queue.push({event:"stereo",action:function(){G.stereo(R,F)}}),G;var j=typeof Howler.ctx.createStereoPanner=="undefined"?"spatial":"stereo";if(typeof F=="undefined")if(typeof R=="number")G._stereo=R,G._pos=[R,0,0];else return G._stereo;for(var U=G._getSoundIds(F),W=0;W(browserInfo$4.huawei?.2:.1)/B*1e3;let htick=new howler.Howl({src:tickUrl,format:["mp3"]}),htock=new howler.Howl({src:tockUrl,format:["mp3"]});class Player{constructor(D,R){this.ticks=[],this.event=new EventEmitter,this.isRuning=!1,this.isNeedStop=!1,this.getTickByDots=(F,G)=>Array.from(Array(F)).map((j,U)=>({time:`0:${(G+U)*1.4}`,note:U===0?"C5":"c4",velocity:1,index:U+G})),this.formatTick=(F,G)=>{const j=[];for(let U=0;U{const Y=j%D.length===0?htick:htock;this.isNeedStop||(Y.play(),console.log(Y)),j{var Q;this.isRuning=!1,this.event.emit("stop"),console.log("tick stop"),(Q=this.part)==null||Q.clear()},450/R),j++},W=()=>{this.isNeedStop||setTimeout(()=>{try{U()}catch(Y){console.log("timeTickError",Y)}},700/R)};U()}async setAudioMode(D,R,F=1){if(await nextTick(),this.isRuning)return;this.isRuning=!0;const G=this.formatTick(D,F);this.startTick(G,R,D,F)}async start(D,R,F=1){this.isNeedStop=!1,this.setAudioMode(D,R,F)}destroy(){this.ticks=[],this.event.emit("destroy"),console.log("destroy"),state$2.activeTick=-1,state$2.activeTickRepeat=1,this.event.removeAllListeners(),this.isRuning=!1,this.isNeedStop=!0,this.part&&(this.part.clear(),this.part=null)}}const useOriginSearch=()=>{const B=location.search||location.hash.replaceAll("#/",""),D=queryString.parse(B);if(D.Authorization&&sessionStorage.setItem("Authorization",D.Authorization||""),D.setting)try{D.setting=JSON.parse(decodeURIComponent(D.setting))}catch{}return D},useReload=()=>{const B=useOriginSearch(),D=queryString.stringify({...B,_t:Date.now()},{});location.search="?"+D},useMenu=()=>{const B=ref(!0);return useEventListener("click",D=>{const R=D.path||D.composedPath(),F=R[0];if(F){const G=F.dataset.id&&F.dataset.id.indexOf("auto")>-1,j=R.find(U=>{var W;return U.tagName==="BUTTON"||((W=U.getAttribute)==null?void 0:W.call(U,"role"))==="button"});if(G||j)return}B.value=!B.value},{target:document.body.querySelector("#app")}),watch(()=>state.playState,(D,R)=>{console.log("newRuntime",R);let F=R;F==="suspend"&&(F="pause"),B.value=F!=="pause"}),[B]};var dayjs_min={exports:{}};(function(B,D){(function(R,F){B.exports=F()})(commonjsGlobal$1,function(){var R=1e3,F=6e4,G=36e5,j="millisecond",U="second",W="minute",Y="hour",Q="day",Z="week",q="month",J="quarter",K="year",te="date",ne="Invalid Date",ie=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,re=/\[([^\]]+)]|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,oe={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("_")},le=function(xe,ce,we){var Be=String(xe);return!Be||Be.length>=ce?xe:""+Array(ce+1-Be.length).join(we)+xe},fe={s:le,z:function(xe){var ce=-xe.utcOffset(),we=Math.abs(ce),Be=Math.floor(we/60),Ae=we%60;return(ce<=0?"+":"-")+le(Be,2,"0")+":"+le(Ae,2,"0")},m:function xe(ce,we){if(ce.date()1)return xe(Ne[0])}else{var Pe=ce.name;ge[Pe]=ce,Ae=Pe}return!Be&&Ae&&(he=Ae),Ae||!Be&&he},be=function(xe,ce){if(ue(xe))return xe.clone();var we=typeof ce=="object"?ce:{};return we.date=xe,we.args=arguments,new pe(we)},ve=fe;ve.l=me,ve.i=ue,ve.w=function(xe,ce){return be(xe,{locale:ce.$L,utc:ce.$u,x:ce.$x,$offset:ce.$offset})};var pe=function(){function xe(we){this.$L=me(we.locale,null,!0),this.parse(we)}var ce=xe.prototype;return ce.parse=function(we){this.$d=function(Be){var Ae=Be.date,Te=Be.utc;if(Ae===null)return new Date(NaN);if(ve.u(Ae))return new Date;if(Ae instanceof Date)return new Date(Ae);if(typeof Ae=="string"&&!/Z$/i.test(Ae)){var Ne=Ae.match(ie);if(Ne){var Pe=Ne[2]-1||0,Me=(Ne[7]||"0").substring(0,3);return Te?new Date(Date.UTC(Ne[1],Pe,Ne[3]||1,Ne[4]||0,Ne[5]||0,Ne[6]||0,Me)):new Date(Ne[1],Pe,Ne[3]||1,Ne[4]||0,Ne[5]||0,Ne[6]||0,Me)}}return new Date(Ae)}(we),this.$x=we.x||{},this.init()},ce.init=function(){var we=this.$d;this.$y=we.getFullYear(),this.$M=we.getMonth(),this.$D=we.getDate(),this.$W=we.getDay(),this.$H=we.getHours(),this.$m=we.getMinutes(),this.$s=we.getSeconds(),this.$ms=we.getMilliseconds()},ce.$utils=function(){return ve},ce.isValid=function(){return this.$d.toString()!==ne},ce.isSame=function(we,Be){var Ae=be(we);return this.startOf(Be)<=Ae&&Ae<=this.endOf(Be)},ce.isAfter=function(we,Be){return be(we)B==12||B==4?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.3 1292 61.2 61.5 379.6 61.3 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 0 major G 2 C 5 15360 1 whole `,text:""}:B==5||B==6?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 1 major G 2 C 5 15360 1 whole `,text:"C"}:B==13?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 -1 major G 2 F 4 15360 1 whole `,text:"F"}:B==14||B==15?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 -2 major F 4 B -1 2 15360 1 whole `,text:"S"}:B==120?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.3 1292 61.2 61.5 379.6 61.3 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 0 major G 2 A 5 15360 1 whole `,text:"A"}:{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 -2 major G 2 B -1 4 15360 1 whole `,text:"Bb"};const checkStatus=ref("checking"),checkFrequency=ref(0),dotIcons=ref([iconWhite,iconWhite,iconWhite]),trend=ref(-1),time=ref(0),useStart=B=>{const D=getAllNodes(B);checkFrequency.value=D[0].frequency,postMessage({api:"proxyServiceMessage",content:{header:{status:200,commond:"xmlInfo",type:"SOUND_CHECK"},body:{frequency:checkFrequency.value}}}),postMessage({api:"startSoundCheck"},()=>{checkStatus.value="checking";try{localStorage.setItem(storeKeys.lastCheckTime,""+new Date().valueOf())}catch{}})},useEnd=()=>{postMessage({api:"endSoundCheck"})},useLister=()=>{const B=D=>{var F;const R=(F=D==null?void 0:D.content)==null?void 0:F.body.frequency;console.log("frequency",R,checkFrequency.value),trend.value=Math.abs(R-checkFrequency.value)<=5?0:R-checkFrequency.value>0?1:-1,dotIcons.value=[iconWhite,iconWhite,iconWhite],dotIcons.value[trend.value+1]=trend.value===0?iconGreen:iconRed,trend.value!==0&&(time.value=new Date().getTime()),new Date().getTime()-time.value>3e3&&(useEnd(),checkStatus.value="success",dotIcons.value=[iconGreen,iconGreen,iconGreen],setTimeout(()=>{soundEffectShow.value=!1},1e3))};onMounted(()=>{listenerMessage("sendResult",B)}),onBeforeUnmount(()=>{removeListenerMessage("sendResult",B)})},soundEffectShow=ref(!1);var SoundEffect=defineComponent({name:"ColexiuSoundEffect",emits:["success","close","pass","fail"],setup(B,{emit:D}){const R=ref(!1),F=ref(!1),G=j=>{j.text==="\u5173\u95ED\u6821\u97F3"&&(state$4.sett.tuning=!1),D("pass"),soundEffectShow.value=!1};return useLister(),watch([soundEffectShow,checkStatus],()=>{checkStatus.value==="success"&&D("success"),checkStatus.value==="fail"&&D("fail"),soundEffectShow.value===!1&&(R.value=!1,D("close"),useEnd())}),()=>{const j=score(2),U=(j==null?void 0:j.xml)||"";return createVNode(Popup,{position:"bottom",show:soundEffectShow.value,"onUpdate:show":W=>soundEffectShow.value=W,onOpen:()=>R.value=!0,onClosed:()=>R.value=!1,teleport:"body"},{default:()=>[createVNode("div",{class:styles$g.box},[createVNode("img",{class:styles$g.iconSound,src:iconSound$1},null),createVNode("div",{class:styles$g.wrap},[createVNode("div",{class:styles$g.staff},[R.value&&createVNode(MusicSheet,{isSoundEffect:!0,opotions:{stretchLastSystemLine:!0,drawMetronomeMarks:!1,drawPartAbbreviations:!1,drawPartNames:!1,drawSlurs:!1,drawTimeSignatures:!1,followCursor:!1},score:U,showSection:!1,onRerender:useStart},null)]),createVNode("div",{class:styles$g.des},[createTextVNode("\u8BF7\u6F14\u594F "),createVNode("span",{style:{color:"var(--primary-color)"}},[j.text]),createTextVNode("\u76F4\u5230\u7EFF\u706F\u5168\u90E8\u4EAE\u8D77")]),createVNode("div",{class:styles$g.lampWrap},[dotIcons.value.map((W,Y)=>createVNode("div",{class:styles$g.lamp,key:Y},[createVNode("img",{class:[checkStatus.value==="checking"&&styles$g.flickerAnimate],src:W},null)]))])]),createVNode("img",{class:styles$g.bottom,src:iconBottom},null),createVNode(Button,{class:styles$g.button,icon:backIcon,onClick:()=>soundEffectShow.value=!1},null),createVNode(Popover,{class:styles$g.skepItems,show:F.value,"onUpdate:show":W=>F.value=W,actions:[{text:"\u8DF3\u8FC7\u672C\u6B21"},{text:"\u5173\u95ED\u6821\u97F3"}],onSelect:W=>G(W),showArrow:!1},{reference:()=>createVNode(Button,{class:styles$g.skepBtn,icon:iconArrow,iconPosition:"right"},{default:()=>[createTextVNode("\u8DF3\u8FC7\u672C\u6B21")]})})])]})}}});const box="_box_1k6sl_1",bg$2="_bg_1k6sl_8",button$2="_button_1k6sl_15",iconSound="_iconSound_1k6sl_32",skepBtn="_skepBtn_1k6sl_38",sharBtn="_sharBtn_1k6sl_56",wrap$4="_wrap_1k6sl_60",top="_top_1k6sl_76",title$6="_title_1k6sl_83",line="_line_1k6sl_90",num="_num_1k6sl_100",txt="_txt_1k6sl_103",iconLeft="_iconLeft_1k6sl_109",iconTop="_iconTop_1k6sl_113",evaluatWrap="_evaluatWrap_1k6sl_117",evaluatTitle="_evaluatTitle_1k6sl_145",evaluatIcon="_evaluatIcon_1k6sl_150",fraction="_fraction_1k6sl_156",tips="_tips_1k6sl_168",btns="_btns_1k6sl_177",btnIcon="_btnIcon_1k6sl_188",confirm="_confirm_1k6sl_193",iconTitle$1="_iconTitle_1k6sl_199",footer="_footer_1k6sl_204",sbtn="_sbtn_1k6sl_233";var styles$f={box,bg:bg$2,button:button$2,iconSound,skepBtn,sharBtn,wrap:wrap$4,top,title:title$6,line,num,txt,iconLeft,iconTop,evaluatWrap,evaluatTitle,evaluatIcon,fraction,tips,btns,btnIcon,confirm,iconTitle:iconTitle$1,footer,sbtn},iconTitle="./assets/title.26d31e69.svg",iconCancel="./assets/cancel.79fe3f5e.svg",iconConfirm="./assets/confirm.8050789e.svg",iconBadge="./assets/icon-badge.28fcacad.svg",iconLianxi="./assets/icon-lianxi.104eeb83.svg",iconReport="./assets/icon-report.7c7e9fcf.svg",TryIcon="./assets/try.8a1d0eec.svg",IntegrityIcon="./assets/integrity.845eab90.svg",IntonationIcon="./assets/intonation.89ac38bc.svg",CadenceIcon="./assets/cadence.89569b23.svg",Image1$1="./assets/5.d8bfbf51.png",Image2$1="./assets/4.cfa387c7.png",Image3$1="./assets/3.d02c685a.png",Image4$1="./assets/2.5c4c2ef5.png",Image5$1="./assets/1.a0d5037d.png",IconBad="./assets/bad.d9395829.png",IconGood="./assets/good.b0fbfb32.png",IconGreat="./assets/great.55272f0a.png",IconPerfect="./assets/perfect.ab44b0e5.png";const icons={1:{icon:IconBad,text:"bad"},2:{icon:IconGood,text:"good"},3:{icon:IconGreat,text:"great"},4:{icon:IconPerfect,text:"perfect"}};var constant={1:{img:Image1$1,tips:"\u4F60\u7684\u6F14\u594F\u4E0D\u592A\u597D\uFF0C\u518D\u7EC3\u4E00\u7EC3\u5427\uFF5E",mome:"\u6562\u4E8E\u5C1D\u8BD5"},2:{img:Image2$1,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u719F\u7EC3\uFF0C\u52A0\u7D27\u8BAD\u7EC3\u624D\u80FD\u6709\u597D\u6210\u7EE9\u54E6\uFF5E",mome:"\u8FD8\u8981\u52A0\u6CB9\u54E6\uFF5E"},3:{img:Image3$1,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u6D41\u7545\uFF0C\u79D1\u5B66\u7684\u7EC3\u4E60\u624D\u80FD\u66F4\u5B8C\u7F8E\u54E6\uFF5E",mome:"\u7A81\u7834\u81EA\u6211"},4:{img:Image4$1,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u9519\uFF0C\u7EE7\u7EED\u52A0\u6CB9\u5427\uFF0C\u79BB\u5B8C\u7F8E\u5C31\u5DEE\u4E00\u6B65\u5566\uFF5E",mome:"\u5D2D\u9732\u5934\u89D2"},5:{img:Image5$1,tips:"\u4F60\u7684\u6F14\u594F\u5B8C\u7F8E\u65E0\u7F3A\uFF0C\u7EE7\u7EED\u52AA\u529B\u5427\uFF5E",mome:"\u4F60\u5F88\u68D2"}};const getLeveByScoreId=B=>{if(!B&&typeof B!="number")return{};let D=1;return B>20&&B<=40?D=2:B>40&&B<=60?D=3:B>60&&B<=80?D=4:B>80&&(D=5),D},getLeveByScore=B=>{if(!B&&typeof B!="number")return{};let D=getLeveByScoreId(B);return constant[D]},getLeveByScoreMeasure=B=>{if(!B&&typeof B!="number")return{};let D=1;return B>=40&&B<70?D=2:B>=70&&B<90?D=3:B>=90&&(D=4),icons[D]};var Image1="./assets/5.b3331931.svg",Image2="./assets/4.7a8a1657.svg",Image3="./assets/3.82262a8a.svg",Image4="./assets/2.99f2ced3.svg",Image5="./assets/1.3d063166.svg",accompaniment="./assets/accompaniment.b83f0e6e.svg",__glob_2_0=Object.freeze(Object.defineProperty({__proto__:null,default:accompaniment},Symbol.toStringTag,{value:"Module"})),back$1="./assets/back.0e8784e6.svg",__glob_2_1=Object.freeze(Object.defineProperty({__proto__:null,default:back$1},Symbol.toStringTag,{value:"Module"})),backgroundClose="./assets/background-close.292949ba.svg",__glob_2_2=Object.freeze(Object.defineProperty({__proto__:null,default:backgroundClose},Symbol.toStringTag,{value:"Module"})),background$2="./assets/background.66e3a94f.svg",__glob_2_3=Object.freeze(Object.defineProperty({__proto__:null,default:background$2},Symbol.toStringTag,{value:"Module"})),camera="./assets/camera.7fe532f1.svg",__glob_2_4=Object.freeze(Object.defineProperty({__proto__:null,default:camera},Symbol.toStringTag,{value:"Module"})),equilibrium="./assets/equilibrium.f9043cf5.svg",__glob_2_5=Object.freeze(Object.defineProperty({__proto__:null,default:equilibrium},Symbol.toStringTag,{value:"Module"})),evaluating$2="./assets/evaluating.9eb5cfac.svg",__glob_2_6=Object.freeze(Object.defineProperty({__proto__:null,default:evaluating$2},Symbol.toStringTag,{value:"Module"})),fingeringOff="./assets/fingeringOff.b63542d4.svg",__glob_2_7=Object.freeze(Object.defineProperty({__proto__:null,default:fingeringOff},Symbol.toStringTag,{value:"Module"})),fingeringOn="./assets/fingeringOn.32644085.svg",__glob_2_8=Object.freeze(Object.defineProperty({__proto__:null,default:fingeringOn},Symbol.toStringTag,{value:"Module"})),gudingActive="./assets/guding-active.ffb42216.svg",__glob_2_9=Object.freeze(Object.defineProperty({__proto__:null,default:gudingActive},Symbol.toStringTag,{value:"Module"})),guding="./assets/guding.a3ea7233.svg",__glob_2_10=Object.freeze(Object.defineProperty({__proto__:null,default:guding},Symbol.toStringTag,{value:"Module"})),iconBack="./assets/icon-back.f7c9eb40.svg",__glob_2_11=Object.freeze(Object.defineProperty({__proto__:null,default:iconBack},Symbol.toStringTag,{value:"Module"})),iconEvaluatingEnd="./assets/icon-evaluatingEnd.438e3cc0.svg",__glob_2_12=Object.freeze(Object.defineProperty({__proto__:null,default:iconEvaluatingEnd},Symbol.toStringTag,{value:"Module"})),iconEvaluatingStart="./assets/icon-evaluatingStart.ef7aea8e.svg",__glob_2_13=Object.freeze(Object.defineProperty({__proto__:null,default:iconEvaluatingStart},Symbol.toStringTag,{value:"Module"})),iconStaffActive="./assets/icon-staff-active.c1d6b682.svg",__glob_2_14=Object.freeze(Object.defineProperty({__proto__:null,default:iconStaffActive},Symbol.toStringTag,{value:"Module"})),iconStaff="./assets/icon-staff.5a2b7c94.svg",__glob_2_15=Object.freeze(Object.defineProperty({__proto__:null,default:iconStaff},Symbol.toStringTag,{value:"Module"})),iconZhuanpu="./assets/icon-zhuanpu.1a6e0bcb.svg",__glob_2_16=Object.freeze(Object.defineProperty({__proto__:null,default:iconZhuanpu},Symbol.toStringTag,{value:"Module"})),jia="./assets/jia.362e133d.svg",__glob_2_17=Object.freeze(Object.defineProperty({__proto__:null,default:jia},Symbol.toStringTag,{value:"Module"})),jian="./assets/jian.ce0820a8.svg",__glob_2_18=Object.freeze(Object.defineProperty({__proto__:null,default:jian},Symbol.toStringTag,{value:"Module"})),jianpu="./assets/jianpu.70310e35.svg",__glob_2_19=Object.freeze(Object.defineProperty({__proto__:null,default:jianpu},Symbol.toStringTag,{value:"Module"})),model1="./assets/model-1.5cdc3b59.svg",__glob_2_20=Object.freeze(Object.defineProperty({__proto__:null,default:model1},Symbol.toStringTag,{value:"Module"})),model2="./assets/model-2.aedda1e7.svg",__glob_2_21=Object.freeze(Object.defineProperty({__proto__:null,default:model2},Symbol.toStringTag,{value:"Module"})),model3="./assets/model-3.f6cc2e96.svg",__glob_2_22=Object.freeze(Object.defineProperty({__proto__:null,default:model3},Symbol.toStringTag,{value:"Module"})),modelType$1="./assets/modelType.7dff5016.svg",__glob_2_23=Object.freeze(Object.defineProperty({__proto__:null,default:modelType$1},Symbol.toStringTag,{value:"Module"})),musicList="./assets/music-list.8ad9f128.svg",__glob_2_24=Object.freeze(Object.defineProperty({__proto__:null,default:musicList},Symbol.toStringTag,{value:"Module"})),musicList1="./assets/music-list1.16180b5c.svg",__glob_2_25=Object.freeze(Object.defineProperty({__proto__:null,default:musicList1},Symbol.toStringTag,{value:"Module"})),music$1="./assets/music.855d26de.svg",__glob_2_26=Object.freeze(Object.defineProperty({__proto__:null,default:music$1},Symbol.toStringTag,{value:"Module"})),part="./assets/part.7184ecd4.svg",__glob_2_27=Object.freeze(Object.defineProperty({__proto__:null,default:part},Symbol.toStringTag,{value:"Module"})),pause$2="./assets/pause.1f3a158e.svg",__glob_2_28=Object.freeze(Object.defineProperty({__proto__:null,default:pause$2},Symbol.toStringTag,{value:"Module"})),play$2="./assets/play.4cb46bbb.svg",__glob_2_29=Object.freeze(Object.defineProperty({__proto__:null,default:play$2},Symbol.toStringTag,{value:"Module"})),practice="./assets/practice.a1fec217.svg",__glob_2_30=Object.freeze(Object.defineProperty({__proto__:null,default:practice},Symbol.toStringTag,{value:"Module"})),practise="./assets/practise.cdd135b3.svg",__glob_2_31=Object.freeze(Object.defineProperty({__proto__:null,default:practise},Symbol.toStringTag,{value:"Module"})),record="./assets/record.214e6a6d.svg",__glob_2_32=Object.freeze(Object.defineProperty({__proto__:null,default:record},Symbol.toStringTag,{value:"Module"})),resetShengyin="./assets/reset-shengyin.af688c9a.svg",__glob_2_33=Object.freeze(Object.defineProperty({__proto__:null,default:resetShengyin},Symbol.toStringTag,{value:"Module"})),reset="./assets/reset.8f0314cd.svg",__glob_2_34=Object.freeze(Object.defineProperty({__proto__:null,default:reset},Symbol.toStringTag,{value:"Module"})),restore="./assets/restore.3a4a6db3.svg",__glob_2_35=Object.freeze(Object.defineProperty({__proto__:null,default:restore},Symbol.toStringTag,{value:"Module"})),section$1="./assets/section.f9765b45.svg",__glob_2_36=Object.freeze(Object.defineProperty({__proto__:null,default:section$1},Symbol.toStringTag,{value:"Module"})),section1$1="./assets/section1.8f6086dd.svg",__glob_2_37=Object.freeze(Object.defineProperty({__proto__:null,default:section1$1},Symbol.toStringTag,{value:"Module"})),section2$1="./assets/section2.7715197f.svg",__glob_2_38=Object.freeze(Object.defineProperty({__proto__:null,default:section2$1},Symbol.toStringTag,{value:"Module"})),setting$2="./assets/setting.d2c48eac.svg",__glob_2_39=Object.freeze(Object.defineProperty({__proto__:null,default:setting$2},Symbol.toStringTag,{value:"Module"})),shuodiaoActive="./assets/shuodiao-active.6b157b93.svg",__glob_2_40=Object.freeze(Object.defineProperty({__proto__:null,default:shuodiaoActive},Symbol.toStringTag,{value:"Module"})),shuodiao="./assets/shuodiao.da855d30.svg",__glob_2_41=Object.freeze(Object.defineProperty({__proto__:null,default:shuodiao},Symbol.toStringTag,{value:"Module"})),speed$2="./assets/speed.256b84ef.svg",__glob_2_42=Object.freeze(Object.defineProperty({__proto__:null,default:speed$2},Symbol.toStringTag,{value:"Module"})),staff="./assets/staff.f226ff22.svg",__glob_2_43=Object.freeze(Object.defineProperty({__proto__:null,default:staff},Symbol.toStringTag,{value:"Module"})),start$3="./assets/start.7b27072b.svg",__glob_2_44=Object.freeze(Object.defineProperty({__proto__:null,default:start$3},Symbol.toStringTag,{value:"Module"})),stop="./assets/stop.e36ceb44.svg",__glob_2_45=Object.freeze(Object.defineProperty({__proto__:null,default:stop},Symbol.toStringTag,{value:"Module"})),taskBg="./assets/task-bg.859300d7.svg",__glob_2_46=Object.freeze(Object.defineProperty({__proto__:null,default:taskBg},Symbol.toStringTag,{value:"Module"})),tuning="./assets/tuning.4b86afaf.svg",__glob_2_47=Object.freeze(Object.defineProperty({__proto__:null,default:tuning},Symbol.toStringTag,{value:"Module"})),volPlus="./assets/vol-plus.8301fc70.svg",__glob_2_48=Object.freeze(Object.defineProperty({__proto__:null,default:volPlus},Symbol.toStringTag,{value:"Module"})),vol="./assets/vol.4b3b0407.svg",__glob_2_49=Object.freeze(Object.defineProperty({__proto__:null,default:vol},Symbol.toStringTag,{value:"Module"})),____="./assets/\u8BC4\u6D4B\u8BB0\u5F55.5949e468.svg",__glob_2_50=Object.freeze(Object.defineProperty({__proto__:null,default:____},Symbol.toStringTag,{value:"Module"}));const getAssetsHomeFile=B=>{var F;const D=`./icons/${B}.svg`;return(F={"./icons/accompaniment.svg":__glob_2_0,"./icons/back.svg":__glob_2_1,"./icons/background-close.svg":__glob_2_2,"./icons/background.svg":__glob_2_3,"./icons/camera.svg":__glob_2_4,"./icons/equilibrium.svg":__glob_2_5,"./icons/evaluating.svg":__glob_2_6,"./icons/fingeringOff.svg":__glob_2_7,"./icons/fingeringOn.svg":__glob_2_8,"./icons/guding-active.svg":__glob_2_9,"./icons/guding.svg":__glob_2_10,"./icons/icon-back.svg":__glob_2_11,"./icons/icon-evaluatingEnd.svg":__glob_2_12,"./icons/icon-evaluatingStart.svg":__glob_2_13,"./icons/icon-staff-active.svg":__glob_2_14,"./icons/icon-staff.svg":__glob_2_15,"./icons/icon-zhuanpu.svg":__glob_2_16,"./icons/jia.svg":__glob_2_17,"./icons/jian.svg":__glob_2_18,"./icons/jianpu.svg":__glob_2_19,"./icons/model-1.svg":__glob_2_20,"./icons/model-2.svg":__glob_2_21,"./icons/model-3.svg":__glob_2_22,"./icons/modelType.svg":__glob_2_23,"./icons/music-list.svg":__glob_2_24,"./icons/music-list1.svg":__glob_2_25,"./icons/music.svg":__glob_2_26,"./icons/part.svg":__glob_2_27,"./icons/pause.svg":__glob_2_28,"./icons/play.svg":__glob_2_29,"./icons/practice.svg":__glob_2_30,"./icons/practise.svg":__glob_2_31,"./icons/record.svg":__glob_2_32,"./icons/reset-shengyin.svg":__glob_2_33,"./icons/reset.svg":__glob_2_34,"./icons/restore.svg":__glob_2_35,"./icons/section.svg":__glob_2_36,"./icons/section1.svg":__glob_2_37,"./icons/section2.svg":__glob_2_38,"./icons/setting.svg":__glob_2_39,"./icons/shuodiao-active.svg":__glob_2_40,"./icons/shuodiao.svg":__glob_2_41,"./icons/speed.svg":__glob_2_42,"./icons/staff.svg":__glob_2_43,"./icons/start.svg":__glob_2_44,"./icons/stop.svg":__glob_2_45,"./icons/task-bg.svg":__glob_2_46,"./icons/tuning.svg":__glob_2_47,"./icons/vol-plus.svg":__glob_2_48,"./icons/vol.svg":__glob_2_49,"./icons/\u8BC4\u6D4B\u8BB0\u5F55.svg":__glob_2_50}[D])==null?void 0:F.default};var ButtonIcon=defineComponent({name:"ButtonIcon",props:{name:{type:String}},setup(B){return()=>B.name?createVNode("img",{src:getAssetsHomeFile(B.name)},null):null}}),classnames$1={exports:{}};/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */(function(B){(function(){var D={}.hasOwnProperty;function R(){for(var F=[],G=0;G{}},updateSpeed:{type:Function,default:B=>{}},mode:{type:String},changeMode:{type:Function,default:B=>{}},lib:{type:Object}},setup(B){var Y;const{lib:D}=toRefs(B);state$1.speed=(Y=D.value)==null?void 0:Y.speed;const R=()=>{state$1.showHint=!0},F=()=>{state$1.showHint=!1},G=Q=>{state$1.speed=Q,B.changed(state$1.speed)},j=Q=>{state$1.speed=Q,B.updateSpeed(state$1.speed)},U=()=>{state$1.speed=Math.max(state$1.speed-1,45),B.changed(state$1.speed)},W=()=>{state$1.speed=Math.min(state$1.speed+1,270),B.changed(state$1.speed)};return()=>createVNode("div",{class:styles$e["speed-change"]},[createVNode("div",{class:styles$e.speed},[createVNode("div",null,[createVNode(Button,{color:"#01C1B5",icon:Icons.plus,type:"primary",size:"mini",round:!0,disabled:state$1.speed==270,onClick:W},null),createVNode(Slider,{class:styles$e.slider,max:270,min:45,barHeight:"3px",buttonSize:"18px",modelValue:315-state$1.speed,"onUpdate:modelValue":Q=>j(315-Q),step:"1",vertical:!0,activeColor:"#ebedf0",onChange:Q=>G(315-Q),onDragStart:R,onDragEnd:F},{button:()=>createVNode("div",{class:styles$e["custom-button"]},[createVNode("span",null,[state$1.speed]),createVNode("div",{class:classnames(styles$e.title)},[createVNode("span",{class:styles$e.strong},[state$1.speed])])])}),createVNode(Button,{class:styles$e.min,color:"#01C1B5",icon:Icons.minus,type:"primary",size:"mini",round:!0,disabled:state$1.speed==45,onClick:U},null),createVNode(Button,{class:styles$e.reset,color:"#01C1B5",icon:Icons.minus,type:"primary",size:"mini",round:!0,onClick:()=>{var Q;state$2.activeDetail&&G((Q=state$2.activeDetail)==null?void 0:Q.originalSpeed)}},null)])])])},methods:{resetSpeed(){var B,D;state$1.speed=(B=this.lib)==null?void 0:B.speed,this.changed((D=this.lib)==null?void 0:D.speed)},refUpdateSpeed(B){state$1.speed=B,this.updateSpeed(state$1.speed)}}});const close$1="_close_1xean_1",bg$1="_bg_1xean_12";var styles$d={close:close$1,bg:bg$1},iconColse="./assets/close.c15efc4b.svg",Popups=defineComponent({name:"ColexiuPopup",props:{data:{type:Object,default:()=>null},zIndex:{type:Number,default:void 0},closeable:{type:Boolean,default:!0},overlay:{type:Boolean,default:!0},style:{type:Object}},setup(B,{slots:D,expose:R}){const F=ref(!1),G=ref(!1),j=()=>{F.value=!0,G.value=!0},U=()=>{F.value=!1},W=()=>{G.value=!1};return R({show:F,close:()=>{F.value=!1},onShow:j,onClose:U,onClosed:W}),()=>createVNode(Popup,{show:F.value,zIndex:B.zIndex,onClose:U,onClosed:W,teleport:"body",onClickOverlay:U,overlay:B.overlay,round:!0,closeable:!1,style:{...B.style},class:styles$d.bg},{default:()=>[G.value&&D.default&&D.default(B),B.closeable&&createVNode(Icon,{class:styles$d.close,name:iconColse,onClick:U},null)]})}});const title$4="_title_184ej_1",wrap$3="_wrap_184ej_8",item$1="_item_184ej_14",label$1="_label_184ej_18";var styles$c={title:title$4,wrap:wrap$3,item:item$1,label:label$1};const sliderClass={"active-color":"#FFB871","inactive-color":"#EAEAEA","button-size":"14"};var Equalizer=defineComponent({name:"ColexiuEqualizer",setup(){const B=ref(10);return()=>createVNode("div",{class:"containerPopups"},[createVNode("div",{class:styles$c.title},[createTextVNode("\u5747\u8861\u5668")]),createVNode("div",{class:styles$c.wrap},[createVNode("div",{class:styles$c.item},[createVNode("span",{class:styles$c.label},[createTextVNode("\u8282\u62CD\u5668")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":D=>B.value=D},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$c.item},[createVNode("span",{class:styles$c.label},[createTextVNode("\u4F34\u594F")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":D=>B.value=D},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$c.item},[createVNode("span",{class:styles$c.label},[createTextVNode("\u957F\u7B1B")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":D=>B.value=D},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$c.item},[createVNode("span",{class:styles$c.label},[createTextVNode("\u8428\u514B\u65AF")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":D=>B.value=D},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$c.item},[createVNode("span",{class:styles$c.label},[createTextVNode("\u5355\u7C27\u7BA1")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":D=>B.value=D},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$c.item},[createVNode("span",{class:styles$c.label},[createTextVNode("\u957F\u53F7")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":D=>B.value=D},sliderClass),null)])])])}});const container$2="_container_la5im_1",title$3="_title_la5im_5",practiseBtn="_practiseBtn_la5im_12",wrap$2="_wrap_la5im_21";var styles$b={container:container$2,title:title$3,practiseBtn,wrap:wrap$2};function _isSlot$3(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}const search$6=useOriginSearch();var Part=defineComponent({name:"ColexiuPart",setup(){const B=Number(search$6["part-index"])||0,D=ref(state$2.partListNames[B]),R=()=>{const F=state$2.partListNames.indexOf(D.value);D.value=state$2.partListNames[F];const G=queryString.stringify({...search$6,"part-index":F});location.search=G};return()=>{let F;return createVNode("div",{class:["containerPopups",styles$b.container]},[createVNode("div",{class:styles$b.title},[createTextVNode("\u58F0\u90E8\u9009\u62E9")]),createVNode("div",{class:styles$b.wrap},[createVNode(RadioGroup,{modelValue:D.value,"onUpdate:modelValue":G=>D.value=G},_isSlot$3(F=state$2.partListNames.map(G=>createVNode(Radio,{name:G},_isSlot$3(G)?G:{default:()=>[G]})))?F:{default:()=>[F]})]),createVNode("div",{style:{display:"flex",justifyContent:"center"}},[createVNode(Button,{class:styles$b.practiseBtn,onClick:R},null)])])}}});const partPopup=ref(null),equalizerPopup=ref(null);var FloatWraper=defineComponent({name:"ColuxiuFloatWraper",setup(){return()=>createVNode(Fragment,null,[createVNode(Popups,{ref:partPopup,style:{borderRadius:"8px"}},{default:()=>[createVNode(Part,null,null)]}),createVNode(Popups,{ref:equalizerPopup,style:{borderRadius:"8px"}},{default:()=>[createVNode(Equalizer,null,null)]})])}});function _taggedTemplateLiteral(B,D){return D||(D=B.slice(0)),Object.freeze(Object.defineProperties(B,{raw:{value:Object.freeze(D)}}))}function __decorate(B,D,R,F){var G,j=arguments.length,U=j<3?D:F===null?F=Object.getOwnPropertyDescriptor(D,R):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(B,D,R,F);else for(var W=B.length-1;W>=0;W--)(G=B[W])&&(U=(j<3?G(U):j>3?G(D,R,U):G(D,R))||U);return j>3&&U&&Object.defineProperty(D,R,U),U}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const t$3=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e$8=Symbol(),n$5=new Map;class s$3{constructor(D,R){if(this._$cssResult$=!0,R!==e$8)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=D}get styleSheet(){let D=n$5.get(this.cssText);return t$3&&D===void 0&&(n$5.set(this.cssText,D=new CSSStyleSheet),D.replaceSync(this.cssText)),D}toString(){return this.cssText}}const o$5=B=>new s$3(typeof B=="string"?B:B+"",e$8),r$3=(B,...D)=>{const R=B.length===1?B[0]:D.reduce((F,G,j)=>F+(U=>{if(U._$cssResult$===!0)return U.cssText;if(typeof U=="number")return U;throw Error("Value passed to 'css' function must be a 'css' function result: "+U+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(G)+B[j+1],B[0]);return new s$3(R,e$8)},i$3=(B,D)=>{t$3?B.adoptedStyleSheets=D.map(R=>R instanceof CSSStyleSheet?R:R.styleSheet):D.forEach(R=>{const F=document.createElement("style"),G=window.litNonce;G!==void 0&&F.setAttribute("nonce",G),F.textContent=R.cssText,B.appendChild(F)})},S$1=t$3?B=>B:B=>B instanceof CSSStyleSheet?(D=>{let R="";for(const F of D.cssRules)R+=F.cssText;return o$5(R)})(B):B;var s$2;const e$7=window.trustedTypes,r$2=e$7?e$7.emptyScript:"",h$2=window.reactiveElementPolyfillSupport,o$4={toAttribute(B,D){switch(D){case Boolean:B=B?r$2:null;break;case Object:case Array:B=B==null?B:JSON.stringify(B)}return B},fromAttribute(B,D){let R=B;switch(D){case Boolean:R=B!==null;break;case Number:R=B===null?null:Number(B);break;case Object:case Array:try{R=JSON.parse(B)}catch{R=null}}return R}},n$4=(B,D)=>D!==B&&(D==D||B==B),l$3={attribute:!0,type:String,converter:o$4,reflect:!1,hasChanged:n$4};class a$1 extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(D){var R;(R=this.l)!==null&&R!==void 0||(this.l=[]),this.l.push(D)}static get observedAttributes(){this.finalize();const D=[];return this.elementProperties.forEach((R,F)=>{const G=this._$Eh(F,R);G!==void 0&&(this._$Eu.set(G,F),D.push(G))}),D}static createProperty(D,R=l$3){if(R.state&&(R.attribute=!1),this.finalize(),this.elementProperties.set(D,R),!R.noAccessor&&!this.prototype.hasOwnProperty(D)){const F=typeof D=="symbol"?Symbol():"__"+D,G=this.getPropertyDescriptor(D,F,R);G!==void 0&&Object.defineProperty(this.prototype,D,G)}}static getPropertyDescriptor(D,R,F){return{get(){return this[R]},set(G){const j=this[D];this[R]=G,this.requestUpdate(D,j,F)},configurable:!0,enumerable:!0}}static getPropertyOptions(D){return this.elementProperties.get(D)||l$3}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const D=Object.getPrototypeOf(this);if(D.finalize(),this.elementProperties=new Map(D.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const R=this.properties,F=[...Object.getOwnPropertyNames(R),...Object.getOwnPropertySymbols(R)];for(const G of F)this.createProperty(G,R[G])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(D){const R=[];if(Array.isArray(D)){const F=new Set(D.flat(1/0).reverse());for(const G of F)R.unshift(S$1(G))}else D!==void 0&&R.push(S$1(D));return R}static _$Eh(D,R){const F=R.attribute;return F===!1?void 0:typeof F=="string"?F:typeof D=="string"?D.toLowerCase():void 0}o(){var D;this._$Ep=new Promise(R=>this.enableUpdating=R),this._$AL=new Map,this._$Em(),this.requestUpdate(),(D=this.constructor.l)===null||D===void 0||D.forEach(R=>R(this))}addController(D){var R,F;((R=this._$Eg)!==null&&R!==void 0?R:this._$Eg=[]).push(D),this.renderRoot!==void 0&&this.isConnected&&((F=D.hostConnected)===null||F===void 0||F.call(D))}removeController(D){var R;(R=this._$Eg)===null||R===void 0||R.splice(this._$Eg.indexOf(D)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach((D,R)=>{this.hasOwnProperty(R)&&(this._$Et.set(R,this[R]),delete this[R])})}createRenderRoot(){var D;const R=(D=this.shadowRoot)!==null&&D!==void 0?D:this.attachShadow(this.constructor.shadowRootOptions);return i$3(R,this.constructor.elementStyles),R}connectedCallback(){var D;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(D=this._$Eg)===null||D===void 0||D.forEach(R=>{var F;return(F=R.hostConnected)===null||F===void 0?void 0:F.call(R)})}enableUpdating(D){}disconnectedCallback(){var D;(D=this._$Eg)===null||D===void 0||D.forEach(R=>{var F;return(F=R.hostDisconnected)===null||F===void 0?void 0:F.call(R)})}attributeChangedCallback(D,R,F){this._$AK(D,F)}_$ES(D,R,F=l$3){var G,j;const U=this.constructor._$Eh(D,F);if(U!==void 0&&F.reflect===!0){const W=((j=(G=F.converter)===null||G===void 0?void 0:G.toAttribute)!==null&&j!==void 0?j:o$4.toAttribute)(R,F.type);this._$Ei=D,W==null?this.removeAttribute(U):this.setAttribute(U,W),this._$Ei=null}}_$AK(D,R){var F,G,j;const U=this.constructor,W=U._$Eu.get(D);if(W!==void 0&&this._$Ei!==W){const Y=U.getPropertyOptions(W),Q=Y.converter,Z=(j=(G=(F=Q)===null||F===void 0?void 0:F.fromAttribute)!==null&&G!==void 0?G:typeof Q=="function"?Q:null)!==null&&j!==void 0?j:o$4.fromAttribute;this._$Ei=W,this[W]=Z(R,Y.type),this._$Ei=null}}requestUpdate(D,R,F){let G=!0;D!==void 0&&(((F=F||this.constructor.getPropertyOptions(D)).hasChanged||n$4)(this[D],R)?(this._$AL.has(D)||this._$AL.set(D,R),F.reflect===!0&&this._$Ei!==D&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(D,F))):G=!1),!this.isUpdatePending&&G&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(R){Promise.reject(R)}const D=this.scheduleUpdate();return D!=null&&await D,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var D;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((G,j)=>this[j]=G),this._$Et=void 0);let R=!1;const F=this._$AL;try{R=this.shouldUpdate(F),R?(this.willUpdate(F),(D=this._$Eg)===null||D===void 0||D.forEach(G=>{var j;return(j=G.hostUpdate)===null||j===void 0?void 0:j.call(G)}),this.update(F)):this._$EU()}catch(G){throw R=!1,this._$EU(),G}R&&this._$AE(F)}willUpdate(D){}_$AE(D){var R;(R=this._$Eg)===null||R===void 0||R.forEach(F=>{var G;return(G=F.hostUpdated)===null||G===void 0?void 0:G.call(F)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(D)),this.updated(D)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(D){return!0}update(D){this._$EC!==void 0&&(this._$EC.forEach((R,F)=>this._$ES(F,this[F],R)),this._$EC=void 0),this._$EU()}updated(D){}firstUpdated(D){}}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */var t$2;a$1.finalized=!0,a$1.elementProperties=new Map,a$1.elementStyles=[],a$1.shadowRootOptions={mode:"open"},h$2==null||h$2({ReactiveElement:a$1}),((s$2=globalThis.reactiveElementVersions)!==null&&s$2!==void 0?s$2:globalThis.reactiveElementVersions=[]).push("1.3.1");const i$2=globalThis.trustedTypes,s$1=i$2?i$2.createPolicy("lit-html",{createHTML:B=>B}):void 0,e$6=`lit$${(Math.random()+"").slice(9)}$`,o$3="?"+e$6,n$3=`<${o$3}>`,l$2=document,h$1=(B="")=>l$2.createComment(B),r$1=B=>B===null||typeof B!="object"&&typeof B!="function",d=Array.isArray,u$1=B=>{var D;return d(B)||typeof((D=B)===null||D===void 0?void 0:D[Symbol.iterator])=="function"},c$2=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v$1=/-->/g,a$2=/>/g,f$1=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_$1=/'/g,m$2=/"/g,g=/^(?:script|style|textarea|title)$/i,p$1=B=>(D,...R)=>({_$litType$:B,strings:D,values:R}),$=p$1(1),b=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),T$1=new WeakMap,x=(B,D,R)=>{var F,G;const j=(F=R==null?void 0:R.renderBefore)!==null&&F!==void 0?F:D;let U=j._$litPart$;if(U===void 0){const W=(G=R==null?void 0:R.renderBefore)!==null&&G!==void 0?G:null;j._$litPart$=U=new N$1(D.insertBefore(h$1(),W),W,void 0,R!=null?R:{})}return U._$AI(B),U},A=l$2.createTreeWalker(l$2,129,null,!1),C=(B,D)=>{const R=B.length-1,F=[];let G,j=D===2?"":"",U=c$2;for(let Y=0;Y"?(U=G!=null?G:c$2,J=-1):q[1]===void 0?J=-2:(J=U.lastIndex-q[2].length,Z=q[1],U=q[3]===void 0?f$1:q[3]==='"'?m$2:_$1):U===m$2||U===_$1?U=f$1:U===v$1||U===a$2?U=c$2:(U=f$1,G=void 0);const te=U===f$1&&B[Y+1].startsWith("/>")?" ":"";j+=U===c$2?Q+n$3:J>=0?(F.push(Z),Q.slice(0,J)+"$lit$"+Q.slice(J)+e$6+te):Q+e$6+(J===-2?(F.push(void 0),Y):te)}const W=j+(B[R]||"")+(D===2?"":"");if(!Array.isArray(B)||!B.hasOwnProperty("raw"))throw Error("invalid template strings array");return[s$1!==void 0?s$1.createHTML(W):W,F]};class E{constructor({strings:D,_$litType$:R},F){let G;this.parts=[];let j=0,U=0;const W=D.length-1,Y=this.parts,[Q,Z]=C(D,R);if(this.el=E.createElement(Q,F),A.currentNode=this.el.content,R===2){const q=this.el.content,J=q.firstChild;J.remove(),q.append(...J.childNodes)}for(;(G=A.nextNode())!==null&&Y.length0){G.textContent=i$2?i$2.emptyScript:"";for(let K=0;K2||F[0]!==""||F[1]!==""?(this._$AH=Array(F.length-1).fill(new String),this.strings=F):this._$AH=w}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(D,R=this,F,G){const j=this.strings;let U=!1;if(j===void 0)D=P(this,D,R,0),U=!r$1(D)||D!==this._$AH&&D!==b,U&&(this._$AH=D);else{const W=D;let Y,Q;for(D=j[0],Y=0;YD=>typeof D=="function"?((R,F)=>(window.customElements.define(R,F),F))(B,D):((R,F)=>{const{kind:G,elements:j}=F;return{kind:G,elements:j,finisher(U){window.customElements.define(R,U)}}})(B,D),i$1$1=(B,D)=>D.kind==="method"&&D.descriptor&&!("value"in D.descriptor)?{...D,finisher(R){R.createProperty(D.key,B)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:D.key,initializer(){typeof D.initializer=="function"&&(this[D.key]=D.initializer.call(this))},finisher(R){R.createProperty(D.key,B)}};function e$5(B){return(D,R)=>R!==void 0?((F,G,j)=>{G.constructor.createProperty(j,F)})(B,D,R):i$1$1(B,D);/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const o$1=({finisher:B,descriptor:D})=>(R,F)=>{var G;if(F===void 0){const j=(G=R.originalKey)!==null&&G!==void 0?G:R.key,U=D!=null?{kind:"method",placement:"prototype",key:j,descriptor:D(R.key)}:{...R,key:j};return B!=null&&(U.finisher=function(W){B(W,j)}),U}{const j=R.constructor;D!==void 0&&Object.defineProperty(R,F,D(F)),B==null||B(j,F)}};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function i$4(B,D){return o$1({descriptor:R=>{const F={get(){var G,j;return(j=(G=this.renderRoot)===null||G===void 0?void 0:G.querySelector(B))!==null&&j!==void 0?j:null},enumerable:!0,configurable:!0};if(D){const G=typeof R=="symbol"?Symbol():"__"+R;F.get=function(){var j,U;return this[G]===void 0&&(this[G]=(U=(j=this.renderRoot)===null||j===void 0?void 0:j.querySelector(B))!==null&&U!==void 0?U:null),this[G]}}return F}})}/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */var n$6;((n$6=window.HTMLSlotElement)===null||n$6===void 0?void 0:n$6.prototype.assignedElements)!=null;var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function createCommonjsModule(B,D,R){return B(R={path:D,exports:{},require:function(F,G){return commonjsRequire(F,G==null?R.path:G)}},R.exports),R.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var lottie_svg=createCommonjsModule(function(module,exports){typeof navigator!="undefined"&&function(B,D){module.exports=D()}(0,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(B){_useWebWorker=!!B},getWebWorker=function(){return _useWebWorker},setLocationHref=function(B){locationHref=B},getLocationHref=function(){return locationHref};function createTag(B){return document.createElement(B)}function extendPrototype(B,D){var R,F,G=B.length;for(R=0;R1?R[1]=1:R[1]<=0&&(R[1]=0),HSVtoRGB(R[0],R[1],R[2])}function addBrightnessToRGB(B,D){var R=RGBtoHSV(255*B[0],255*B[1],255*B[2]);return R[2]+=D,R[2]>1?R[2]=1:R[2]<0&&(R[2]=0),HSVtoRGB(R[0],R[1],R[2])}function addHueToRGB(B,D){var R=RGBtoHSV(255*B[0],255*B[1],255*B[2]);return R[0]+=D/360,R[0]>1?R[0]-=1:R[0]<0&&(R[0]+=1),HSVtoRGB(R[0],R[1],R[2])}var rgbToHex=function(){var B,D,R=[];for(B=0;B<256;B+=1)D=B.toString(16),R[B]=D.length===1?"0"+D:D;return function(F,G,j){return F<0&&(F=0),G<0&&(G=0),j<0&&(j=0),"#"+R[F]+R[G]+R[j]}}(),setSubframeEnabled=function(B){subframeEnabled=!!B},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(B){expressionsPlugin=B},getExpressionsPlugin=function(){return expressionsPlugin},setDefaultCurveSegments=function(B){defaultCurveSegments=B},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(B){idPrefix=B};function createNS(B){return document.createElementNS(svgNS,B)}function _typeof$5(B){return(_typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D})(B)}var dataManager=function(){var B,D,R=1,F=[],G={onmessage:function(){},postMessage:function(Y){B({data:Y})}},j={postMessage:function(Y){G.onmessage({data:Y})}};function U(){D||((D=function(Y){if(window.Worker&&window.Blob&&getWebWorker()){var Q=new Blob(["var _workerSelf = self; self.onmessage = ",Y.toString()],{type:"text/javascript"}),Z=URL.createObjectURL(Q);return new Worker(Z)}return B=Y,G}(function(Y){if(j.dataManager||(j.dataManager=function(){function Z(ue,me){var be,ve,pe,ye,xe,ce,we=ue.length;for(ve=0;ve=0;me-=1)if(ue[me].ty==="sh")if(ue[me].ks.k.i)K(ue[me].ks.k);else for(ve=ue[me].ks.k.length,be=0;bebe[0]||!(be[0]>ue[0])&&(ue[1]>be[1]||!(be[1]>ue[1])&&(ue[2]>be[2]||!(be[2]>ue[2])&&null))}var ne,ie=function(){var ue=[4,4,14];function me(be){var ve,pe,ye,xe=be.length;for(ve=0;ve=0;pe-=1)if(ve[pe].ty==="sh")if(ve[pe].ks.k.i)ve[pe].ks.k.c=ve[pe].closed;else for(xe=ve[pe].ks.k.length,ye=0;ye500)&&(this._imageLoaded(),clearInterval(Q)),Y+=1}.bind(this),50)}function j(W){var Y={assetData:W},Q=F(W,this.assetsPath,this.path);return dataManager.loadData(Q,function(Z){Y.img=Z,this._footageLoaded()}.bind(this),function(){Y.img={},this._footageLoaded()}.bind(this)),Y}function U(){this._imageLoaded=D.bind(this),this._footageLoaded=R.bind(this),this.testImageLoaded=G.bind(this),this.createFootageData=j.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return U.prototype={loadAssets:function(W,Y){var Q;this.imagesLoadedCb=Y;var Z=W.length;for(Q=0;Qthis.animationData.op&&(this.animationData.op=B.op,this.totalFrames=Math.floor(B.op-this.animationData.ip));var D,R,F=this.animationData.layers,G=F.length,j=B.layers,U=j.length;for(R=0;Rthis.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.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(B){this.triggerRenderFrameError(B)}},AnimationItem.prototype.play=function(B){B&&this.name!==B||this.isPaused===!0&&(this.isPaused=!1,this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(B){B&&this.name!==B||this.isPaused===!1&&(this.isPaused=!0,this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(B){B&&this.name!==B||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(B){B&&this.name!==B||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(B){for(var D,R=0;R=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?D>=this.totalFrames?(this.playCount+=1,this.checkSegments(D%this.totalFrames)||(this.setCurrentRawFrameValue(D%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(D):this.checkSegments(D>this.totalFrames?D%this.totalFrames:0)||(R=!0,D=this.totalFrames-1):D<0?this.checkSegments(D%this.totalFrames)||(!this.loop||this.playCount--<=0&&this.loop!==!0?(R=!0,D=0):(this.setCurrentRawFrameValue(this.totalFrames+D%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(D),R&&(this.setCurrentRawFrameValue(D),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(B,D){this.playCount=0,B[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=B[0]-B[1],this.timeCompleted=this.totalFrames,this.firstFrame=B[1],this.setCurrentRawFrameValue(this.totalFrames-.001-D)):B[1]>B[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=B[1]-B[0],this.timeCompleted=this.totalFrames,this.firstFrame=B[0],this.setCurrentRawFrameValue(.001+D)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(B,D){var R=-1;this.isPaused&&(this.currentRawFrame+this.firstFrameD&&(R=D-B)),this.firstFrame=B,this.totalFrames=D-B,this.timeCompleted=this.totalFrames,R!==-1&&this.goToAndStop(R,!0)},AnimationItem.prototype.playSegments=function(B,D){if(D&&(this.segments.length=0),_typeof$4(B[0])==="object"){var R,F=B.length;for(R=0;R=0;ie-=1)D[ie].animation.destroy(ne)},B.freeze=function(){U=!0},B.unfreeze=function(){U=!1,te()},B.setVolume=function(ne,ie){var re;for(re=0;re=.001?function(re,oe,le,fe){for(var he=0;he<4;++he){var ge=W(oe,le,fe);if(ge===0)return oe;oe-=(U(oe,le,fe)-re)/ge}return oe}(Q,ne,Z,q):ie===0?ne:function(re,oe,le,fe,he){var ge,ue,me=0;do(ge=U(ue=oe+(le-oe)/2,fe,he)-re)>0?le=ue:oe=ue;while(Math.abs(ge)>1e-7&&++me<10);return ue}(Q,K,K+.1,Z,q)}},B}(),pooling={double:function(B){return B.concat(createSizedArray(B.length))}},poolFactory=function(B,D,R){var F=0,G=B,j=createSizedArray(G);return{newElement:function(){return F?j[F-=1]:D()},release:function(U){F===G&&(j=pooling.double(j),G*=2),R&&R(U),j[F]=U,F+=1}}},bezierLengthPool=poolFactory(8,function(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}),segmentsLengthPool=poolFactory(8,function(){return{lengths:[],totalLength:0}},function(B){var D,R=B.lengths.length;for(D=0;D-.001&&ne<.001}var R=function(Q,Z,q,J){var K,te,ne,ie,re,oe,le=getDefaultCurveSegments(),fe=0,he=[],ge=[],ue=bezierLengthPool.newElement();for(ne=q.length,K=0;Kne?-1:1,oe=!0;oe;)if(J[te]<=ne&&J[te+1]>ne?(ie=(ne-J[te])/(J[te+1]-J[te]),oe=!1):te+=re,te<0||te>=K-1){if(te===K-1)return q[te];oe=!1}return q[te]+(q[te+1]-q[te])*ie}var Y=createTypedArray("float32",8);return{getSegmentsLength:function(Q){var Z,q=segmentsLengthPool.newElement(),J=Q.c,K=Q.v,te=Q.o,ne=Q.i,ie=Q._length,re=q.lengths,oe=0;for(Z=0;Z1&&(K=1);var ie,re=W(K,ne),oe=W(te=te>1?1:te,ne),le=Q.length,fe=1-re,he=1-oe,ge=fe*fe*fe,ue=re*fe*fe*3,me=re*re*fe*3,be=re*re*re,ve=fe*fe*he,pe=re*fe*he+fe*re*he+fe*fe*oe,ye=re*re*he+fe*re*oe+re*fe*oe,xe=re*re*oe,ce=fe*he*he,we=re*he*he+fe*oe*he+fe*he*oe,Be=re*oe*he+fe*oe*oe+re*he*oe,Ae=re*oe*oe,Te=he*he*he,Ne=oe*he*he+he*oe*he+he*he*oe,Pe=oe*oe*he+he*oe*oe+oe*he*oe,Me=oe*oe*oe;for(ie=0;iefe?le>he?le-fe-he:he-fe-le:he>fe?he-fe-le:fe-le-he)>-1e-4&&oe<1e-4}}}var bez=bezFunction(),PropertyFactory=function(){var B=initialDefaultFrame,D=Math.abs;function R(J,K){var te,ne=this.offsetTime;this.propType==="multidimensional"&&(te=createTypedArray("float32",this.pv.length));for(var ie,re,oe,le,fe,he,ge,ue,me,be=K.lastIndex,ve=be,pe=this.keyframes.length-1,ye=!0;ye;){if(ie=this.keyframes[ve],re=this.keyframes[ve+1],ve===pe-1&&J>=re.t-ne){ie.h&&(ie=re),be=0;break}if(re.t-ne>J){be=ve;break}ve=ce||J=ce?Be.points.length-1:0;for(fe=Be.points[Ae].point.length,le=0;le=Pe&&Ne=ce?(te[0]=xe[0],te[1]=xe[1],te[2]=xe[2]):J<=we?(te[0]=ie.s[0],te[1]=ie.s[1],te[2]=ie.s[2]):function(Ge,We){var Ve=We[0],Ye=We[1],et=We[2],ot=We[3],ft=Math.atan2(2*Ye*ot-2*Ve*et,1-2*Ye*Ye-2*et*et),lt=Math.asin(2*Ve*Ye+2*et*ot),_e=Math.atan2(2*Ve*ot-2*Ye*et,1-2*Ve*Ve-2*et*et);Ge[0]=ft/degToRads,Ge[1]=lt/degToRads,Ge[2]=_e/degToRads}(te,function(Ge,We,Ve){var Ye,et,ot,ft,lt,_e=[],Xe=Ge[0],Qe=Ge[1],Fe=Ge[2],Re=Ge[3],He=We[0],Je=We[1],tt=We[2],qe=We[3];return(et=Xe*He+Qe*Je+Fe*tt+Re*qe)<0&&(et=-et,He=-He,Je=-Je,tt=-tt,qe=-qe),1-et>1e-6?(Ye=Math.acos(et),ot=Math.sin(Ye),ft=Math.sin((1-Ve)*Ye)/ot,lt=Math.sin(Ve*Ye)/ot):(ft=1-Ve,lt=Ve),_e[0]=ft*Xe+lt*He,_e[1]=ft*Qe+lt*Je,_e[2]=ft*Fe+lt*tt,_e[3]=ft*Re+lt*qe,_e}(F(ie.s),F(xe),(J-we)/(ce-we)));else for(ve=0;ve=ce?he=1:J=te&&J>=te||this._caching.lastFrame=J&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var ne=this.interpolateValue(J,this._caching);this.pv=ne}return this._caching.lastFrame=J,this.pv}function j(J){var K;if(this.propType==="unidimensional")K=J*this.mult,D(this.v-K)>1e-5&&(this.v=K,this._mdf=!0);else for(var te=0,ne=this.v.length;te1e-5&&(this.v[te]=K,this._mdf=!0),te+=1}function U(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var J;this.lock=!0,this._mdf=this._isFirstFrame;var K=this.effectsSequence.length,te=this.kf?this.pv:this.data.k;for(J=0;J=this._maxLength&&this.doubleArrayLength(),R){case"v":j=this.v;break;case"i":j=this.i;break;case"o":j=this.o;break;default:j=[]}(!j[F]||j[F]&&!G)&&(j[F]=pointPool.newElement()),j[F][0]=B,j[F][1]=D},ShapePath.prototype.setTripleAt=function(B,D,R,F,G,j,U,W){this.setXYAt(B,D,"v",U,W),this.setXYAt(R,F,"o",U,W),this.setXYAt(G,j,"i",U,W)},ShapePath.prototype.reverse=function(){var B=new ShapePath;B.setPathData(this.c,this._length);var D=this.v,R=this.o,F=this.i,G=0;this.c&&(B.setTripleAt(D[0][0],D[0][1],F[0][0],F[0][1],R[0][0],R[0][1],0,!1),G=1);var j,U=this._length-1,W=this._length;for(j=G;j=be[be.length-1].t-this.offsetTime)ne=be[be.length-1].s?be[be.length-1].s[0]:be[be.length-2].e[0],re=!0;else{for(var ve,pe,ye,xe=me,ce=be.length-1,we=!0;we&&(ve=be[xe],!((pe=be[xe+1]).t-this.offsetTime>J));)xe=pe.t-this.offsetTime)ge=1;else if(Jte&&J>te)||(this._caching.lastIndex=ne0||Ae>-1e-6&&Ae<0?F(1e4*Ae)/1e4:Ae}function Be(){var Ae=this.props;return"matrix("+we(Ae[0])+","+we(Ae[1])+","+we(Ae[4])+","+we(Ae[5])+","+we(Ae[12])+","+we(Ae[13])+")"}return function(){this.reset=G,this.rotate=j,this.rotateX=U,this.rotateY=W,this.rotateZ=Y,this.skew=Z,this.skewFromAxis=q,this.shear=Q,this.scale=J,this.setTransform=K,this.translate=te,this.transform=ne,this.applyToPoint=fe,this.applyToX=he,this.applyToY=ge,this.applyToZ=ue,this.applyToPointArray=ye,this.applyToTriplePoints=pe,this.applyToPointStringified=xe,this.toCSS=ce,this.to2dCSS=Be,this.clone=oe,this.cloneFromProps=le,this.equals=re,this.inversePoints=ve,this.inversePoint=be,this.getInverseMatrix=me,this._t=this.transform,this.isIdentity=ie,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(B){return(_typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D})(B)}var lottie={},standalone="__[STANDALONE]__",queryString;function setLocation(B){setLocationHref(B)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(B){setSubframeEnabled(B)}function setPrefix(B){setIdPrefix(B)}function loadAnimation(B){return animationManager.loadAnimation(B)}function setQuality(B){if(typeof B=="string")switch(B){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10)}else!isNaN(B)&&B>1&&setDefaultCurveSegments(B)}function inBrowser(){return typeof navigator!="undefined"}function installPlugin(B,D){B==="expressions"&&setExpressionsPlugin(D)}function getFactory(B){switch(B){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(B){for(var D=queryString.split("&"),R=0;R=1?j.push({s:B-1,e:D-1}):(j.push({s:B,e:1}),j.push({s:0,e:D-1}));var U,W,Y=[],Q=j.length;for(U=0;UF+R||(Z=W.s*G<=F?0:(W.s*G-F)/R,q=W.e*G>=F+R?1:(W.e*G-F)/R,Y.push([Z,q]))}return Y.length||Y.push([0,0]),Y},TrimModifier.prototype.releasePathsData=function(B){var D,R=B.length;for(D=0;D1?1+j:this.s.v<0?0+j:this.s.v+j)>(R=this.e.v>1?1+j:this.e.v<0?0+j:this.e.v+j)){var U=D;D=R,R=U}D=1e-4*Math.round(1e4*D),R=1e-4*Math.round(1e4*R),this.sValue=D,this.eValue=R}else D=this.sValue,R=this.eValue;var W,Y,Q,Z,q,J=this.shapes.length,K=0;if(R===D)for(G=0;G=0;G-=1)if((te=this.shapes[G]).shape._mdf){for((ne=te.localShapeCollection).releaseShapes(),this.m===2&&J>1?(re=this.calculateShapeEdges(D,R,te.totalShapeLength,fe,K),fe+=te.totalShapeLength):re=[[oe,le]],Y=re.length,W=0;W=1?ie.push({s:te.totalShapeLength*(oe-1),e:te.totalShapeLength*(le-1)}):(ie.push({s:te.totalShapeLength*oe,e:te.totalShapeLength}),ie.push({s:0,e:te.totalShapeLength*(le-1)}));var he=this.addShapes(te,ie[0]);if(ie[0].s!==ie[0].e){if(ie.length>1)if(te.shape.paths.shapes[te.shape.paths._length-1].c){var ge=he.pop();this.addPaths(he,ne),he=this.addShapes(te,ie[1],ge)}else this.addPaths(he,ne),he=this.addShapes(te,ie[1]);this.addPaths(he,ne)}}te.shape.paths=ne}}},TrimModifier.prototype.addPaths=function(B,D){var R,F=B.length;for(R=0;RD.e){R.c=!1;break}D.s<=te&&D.e>=te+U.addedLength?(this.addSegment(J[F].v[G-1],J[F].o[G-1],J[F].i[G],J[F].v[G],R,W,ie),ie=!1):(Q=bez.getNewSegment(J[F].v[G-1],J[F].v[G],J[F].o[G-1],J[F].i[G],(D.s-te)/U.addedLength,(D.e-te)/U.addedLength,Y[G-1]),this.addSegmentFromArray(Q,R,W,ie),ie=!1,R.c=!1),te+=U.addedLength,W+=1}if(J[F].c&&Y.length){if(U=Y[G-1],te<=D.e){var re=Y[G-1].addedLength;D.s<=te&&D.e>=te+re?(this.addSegment(J[F].v[G-1],J[F].o[G-1],J[F].i[0],J[F].v[0],R,W,ie),ie=!1):(Q=bez.getNewSegment(J[F].v[G-1],J[F].v[0],J[F].o[G-1],J[F].i[0],(D.s-te)/re,(D.e-te)/re,Y[G-1]),this.addSegmentFromArray(Q,R,W,ie),ie=!1,R.c=!1)}else R.c=!1;te+=U.addedLength,W+=1}if(R._length&&(R.setXYAt(R.v[Z][0],R.v[Z][1],"i",Z),R.setXYAt(R.v[R._length-1][0],R.v[R._length-1][1],"o",R._length-1)),te>D.e)break;F=this.p.keyframes[this.p.keyframes.length-1].t?(G=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/F,0),j=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/F,0)):(G=this.p.pv,j=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/F,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){G=[],j=[];var U=this.px,W=this.py;U._caching.lastFrame+U.offsetTime<=U.keyframes[0].t?(G[0]=U.getValueAtTime((U.keyframes[0].t+.01)/F,0),G[1]=W.getValueAtTime((W.keyframes[0].t+.01)/F,0),j[0]=U.getValueAtTime(U.keyframes[0].t/F,0),j[1]=W.getValueAtTime(W.keyframes[0].t/F,0)):U._caching.lastFrame+U.offsetTime>=U.keyframes[U.keyframes.length-1].t?(G[0]=U.getValueAtTime(U.keyframes[U.keyframes.length-1].t/F,0),G[1]=W.getValueAtTime(W.keyframes[W.keyframes.length-1].t/F,0),j[0]=U.getValueAtTime((U.keyframes[U.keyframes.length-1].t-.01)/F,0),j[1]=W.getValueAtTime((W.keyframes[W.keyframes.length-1].t-.01)/F,0)):(G=[U.pv,W.pv],j[0]=U.getValueAtTime((U._caching.lastFrame+U.offsetTime-.01)/F,U.offsetTime),j[1]=W.getValueAtTime((W._caching.lastFrame+W.offsetTime-.01)/F,W.offsetTime))}else G=j=B;this.v.rotate(-Math.atan2(G[1]-j[1],G[0]-j[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}},precalculateMatrix:function(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}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)}},autoOrient:function(){}},extendPrototype([DynamicPropertyContainer],D),D.prototype.addDynamicProperty=function(R){this._addDynamicProperty(R),this.elem.addDynamicProperty(R),this._isDirty=!0},D.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty,{getTransformProperty:function(R,F,G){return new D(R,F,G)}}}();function RepeaterModifier(){}function RoundCornersModifier(){}function getFontProperties(B){for(var D=B.fStyle?B.fStyle.split(" "):[],R="normal",F="normal",G=D.length,j=0;j0;)R-=1,this._elements.unshift(D[R]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(B){var D,R=B.length;for(D=0;D0?Math.floor(J):Math.ceil(J),ne=this.pMatrix.props,ie=this.rMatrix.props,re=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var oe,le,fe=0;if(J>0){for(;fete;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),fe-=1;K&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-K,!0),fe-=K)}for(F=this.data.m===1?0:this._currentCopies-1,G=this.data.m===1?1:-1,j=this._currentCopies;j;){if(le=(R=(D=this.elemsData[F].it)[D.length-1].transform.mProps.v.props).length,D[D.length-1].transform.mProps._mdf=!0,D[D.length-1].transform.op._mdf=!0,D[D.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(F/(this._currentCopies-1)),fe!==0){for((F!==0&&G===1||F!==this._currentCopies-1&&G===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(ie[0],ie[1],ie[2],ie[3],ie[4],ie[5],ie[6],ie[7],ie[8],ie[9],ie[10],ie[11],ie[12],ie[13],ie[14],ie[15]),this.matrix.transform(re[0],re[1],re[2],re[3],re[4],re[5],re[6],re[7],re[8],re[9],re[10],re[11],re[12],re[13],re[14],re[15]),this.matrix.transform(ne[0],ne[1],ne[2],ne[3],ne[4],ne[5],ne[6],ne[7],ne[8],ne[9],ne[10],ne[11],ne[12],ne[13],ne[14],ne[15]),oe=0;oe0&&(ne=!1),ne){var ie=createTag("style");ie.setAttribute("f-forigin",Z[Q].fOrigin),ie.setAttribute("f-origin",Z[Q].origin),ie.setAttribute("f-family",Z[Q].fFamily),ie.type="text/css",ie.innerText="@font-face {font-family: "+Z[Q].fFamily+"; font-style: normal; src: url('"+Z[Q].fPath+"');}",Y.appendChild(ie)}}else if(Z[Q].fOrigin==="g"||Z[Q].origin===1){for(K=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),te=0;teB?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 B,D=this.renderableComponents.length;for(B=0;B0&&(this.maskElement.setAttribute("id",ie),this.element.maskedElement.setAttribute(oe,"url("+getLocationHref()+"#"+ie+")"),j.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){this.layerInterface=FootageInterface(this)},FootageElement.prototype.getFootageData=function(){return this.footageData},AudioElement.prototype.prepareFrame=function(B){if(this.prepareRenderableFrame(B,!0),this.prepareProperties(B,!0),this.tm._placeholder)this._currentTime=B/this.data.sr;else{var D=this.tm.v;this._currentTime=D}},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.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(B){this.audio.rate(B)},AudioElement.prototype.volume=function(B){this.audio.volume(B)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){},BaseRenderer.prototype.checkLayers=function(B){var D,R,F=this.layers.length;for(this.completeLayers=!0,D=F-1;D>=0;D-=1)this.elements[D]||(R=this.layers[D]).ip-R.st<=B-this.layers[D].st&&R.op-R.st>B-this.layers[D].st&&this.buildItem(D),this.completeLayers=!!this.elements[D]&&this.completeLayers;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(B){switch(B.ty){case 2:return this.createImage(B);case 0:return this.createComp(B);case 1:return this.createSolid(B);case 3:return this.createNull(B);case 4:return this.createShape(B);case 5:return this.createText(B);case 6:return this.createAudio(B);case 13:return this.createCamera(B);case 15:return this.createFootage(B);default:return this.createNull(B)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(B){return new AudioElement(B,this.globalData,this)},BaseRenderer.prototype.createFootage=function(B){return new FootageElement(B,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var B,D=this.layers.length;for(B=0;B1&&(j+=" C"+D.o[F-1][0]+","+D.o[F-1][1]+" "+D.i[0][0]+","+D.i[0][1]+" "+D.v[0][0]+","+D.v[0][1]),R.lastPath!==j){var U="";R.elem&&(D.c&&(U=B.inv?this.solidPath+j:j),R.elem.setAttribute("d",U)),R.lastPath=j}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var B={};return B.createFilter=function(D,R){var F=createNS("filter");return F.setAttribute("id",D),R!==!0&&(F.setAttribute("filterUnits","objectBoundingBox"),F.setAttribute("x","0%"),F.setAttribute("y","0%"),F.setAttribute("width","100%"),F.setAttribute("height","100%")),F},B.createAlphaToLuminanceFilter=function(){var D=createNS("feColorMatrix");return D.setAttribute("type","matrix"),D.setAttribute("color-interpolation-filters","sRGB"),D.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),D},B}(),featureSupport=function(){var B={maskType:!0};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))&&(B.maskType=!1),B}();function SVGTintFilter(B,D){this.filterManager=D;var R=createNS("feColorMatrix");if(R.setAttribute("type","matrix"),R.setAttribute("color-interpolation-filters","linearRGB"),R.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),R.setAttribute("result","f1"),B.appendChild(R),(R=createNS("feColorMatrix")).setAttribute("type","matrix"),R.setAttribute("color-interpolation-filters","sRGB"),R.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),R.setAttribute("result","f2"),B.appendChild(R),this.matrixFilter=R,D.effectElements[2].p.v!==100||D.effectElements[2].p.k){var F,G=createNS("feMerge");B.appendChild(G),(F=createNS("feMergeNode")).setAttribute("in","SourceGraphic"),G.appendChild(F),(F=createNS("feMergeNode")).setAttribute("in","f2"),G.appendChild(F)}}function SVGFillFilter(B,D){this.filterManager=D;var R=createNS("feColorMatrix");R.setAttribute("type","matrix"),R.setAttribute("color-interpolation-filters","sRGB"),R.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),B.appendChild(R),this.matrixFilter=R}function SVGStrokeEffect(B,D){this.initialized=!1,this.filterManager=D,this.elem=B,this.paths=[]}function SVGTritoneFilter(B,D){this.filterManager=D;var R=createNS("feColorMatrix");R.setAttribute("type","matrix"),R.setAttribute("color-interpolation-filters","linearRGB"),R.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),R.setAttribute("result","f1"),B.appendChild(R);var F=createNS("feComponentTransfer");F.setAttribute("color-interpolation-filters","sRGB"),B.appendChild(F),this.matrixFilter=F;var G=createNS("feFuncR");G.setAttribute("type","table"),F.appendChild(G),this.feFuncR=G;var j=createNS("feFuncG");j.setAttribute("type","table"),F.appendChild(j),this.feFuncG=j;var U=createNS("feFuncB");U.setAttribute("type","table"),F.appendChild(U),this.feFuncB=U}function SVGProLevelsFilter(B,D){this.filterManager=D;var R=this.filterManager.effectElements,F=createNS("feComponentTransfer");(R[10].p.k||R[10].p.v!==0||R[11].p.k||R[11].p.v!==1||R[12].p.k||R[12].p.v!==1||R[13].p.k||R[13].p.v!==0||R[14].p.k||R[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",F)),(R[17].p.k||R[17].p.v!==0||R[18].p.k||R[18].p.v!==1||R[19].p.k||R[19].p.v!==1||R[20].p.k||R[20].p.v!==0||R[21].p.k||R[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",F)),(R[24].p.k||R[24].p.v!==0||R[25].p.k||R[25].p.v!==1||R[26].p.k||R[26].p.v!==1||R[27].p.k||R[27].p.v!==0||R[28].p.k||R[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",F)),(R[31].p.k||R[31].p.v!==0||R[32].p.k||R[32].p.v!==1||R[33].p.k||R[33].p.v!==1||R[34].p.k||R[34].p.v!==0||R[35].p.k||R[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",F)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(F.setAttribute("color-interpolation-filters","sRGB"),B.appendChild(F),F=createNS("feComponentTransfer")),(R[3].p.k||R[3].p.v!==0||R[4].p.k||R[4].p.v!==1||R[5].p.k||R[5].p.v!==1||R[6].p.k||R[6].p.v!==0||R[7].p.k||R[7].p.v!==1)&&(F.setAttribute("color-interpolation-filters","sRGB"),B.appendChild(F),this.feFuncRComposed=this.createFeFunc("feFuncR",F),this.feFuncGComposed=this.createFeFunc("feFuncG",F),this.feFuncBComposed=this.createFeFunc("feFuncB",F))}function SVGDropShadowEffect(B,D){var R=D.container.globalData.renderConfig.filterSize;B.setAttribute("x",R.x),B.setAttribute("y",R.y),B.setAttribute("width",R.width),B.setAttribute("height",R.height),this.filterManager=D;var F=createNS("feGaussianBlur");F.setAttribute("in","SourceAlpha"),F.setAttribute("result","drop_shadow_1"),F.setAttribute("stdDeviation","0"),this.feGaussianBlur=F,B.appendChild(F);var G=createNS("feOffset");G.setAttribute("dx","25"),G.setAttribute("dy","0"),G.setAttribute("in","drop_shadow_1"),G.setAttribute("result","drop_shadow_2"),this.feOffset=G,B.appendChild(G);var j=createNS("feFlood");j.setAttribute("flood-color","#00ff00"),j.setAttribute("flood-opacity","1"),j.setAttribute("result","drop_shadow_3"),this.feFlood=j,B.appendChild(j);var U=createNS("feComposite");U.setAttribute("in","drop_shadow_3"),U.setAttribute("in2","drop_shadow_2"),U.setAttribute("operator","in"),U.setAttribute("result","drop_shadow_4"),B.appendChild(U);var W,Y=createNS("feMerge");B.appendChild(Y),W=createNS("feMergeNode"),Y.appendChild(W),(W=createNS("feMergeNode")).setAttribute("in","SourceGraphic"),this.feMergeNode=W,this.feMerge=Y,this.originalNodeAdded=!1,Y.appendChild(W)}SVGTintFilter.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){var D=this.filterManager.effectElements[0].p.v,R=this.filterManager.effectElements[1].p.v,F=this.filterManager.effectElements[2].p.v/100;this.matrixFilter.setAttribute("values",R[0]-D[0]+" 0 0 0 "+D[0]+" "+(R[1]-D[1])+" 0 0 0 "+D[1]+" "+(R[2]-D[2])+" 0 0 0 "+D[2]+" 0 0 0 "+F+" 0")}},SVGFillFilter.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){var D=this.filterManager.effectElements[2].p.v,R=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+D[0]+" 0 0 0 0 "+D[1]+" 0 0 0 0 "+D[2]+" 0 0 0 "+R+" 0")}},SVGStrokeEffect.prototype.initialize=function(){var B,D,R,F,G=this.elem.layerElement.children||this.elem.layerElement.childNodes;for(this.filterManager.effectElements[1].p.v===1?(F=this.elem.maskManager.masksProperties.length,R=0):F=(R=this.filterManager.effectElements[0].p.v-1)+1,(D=createNS("g")).setAttribute("fill","none"),D.setAttribute("stroke-linecap","round"),D.setAttribute("stroke-dashoffset",1);R=Q?K<0?F:G:F+J*Math.pow((j-B)/K,1/R),Z[q]=U,q+=1,W+=256/255;return Z.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){var D,R=this.filterManager.effectElements;this.feFuncRComposed&&(B||R[3].p._mdf||R[4].p._mdf||R[5].p._mdf||R[6].p._mdf||R[7].p._mdf)&&(D=this.getTableValue(R[3].p.v,R[4].p.v,R[5].p.v,R[6].p.v,R[7].p.v),this.feFuncRComposed.setAttribute("tableValues",D),this.feFuncGComposed.setAttribute("tableValues",D),this.feFuncBComposed.setAttribute("tableValues",D)),this.feFuncR&&(B||R[10].p._mdf||R[11].p._mdf||R[12].p._mdf||R[13].p._mdf||R[14].p._mdf)&&(D=this.getTableValue(R[10].p.v,R[11].p.v,R[12].p.v,R[13].p.v,R[14].p.v),this.feFuncR.setAttribute("tableValues",D)),this.feFuncG&&(B||R[17].p._mdf||R[18].p._mdf||R[19].p._mdf||R[20].p._mdf||R[21].p._mdf)&&(D=this.getTableValue(R[17].p.v,R[18].p.v,R[19].p.v,R[20].p.v,R[21].p.v),this.feFuncG.setAttribute("tableValues",D)),this.feFuncB&&(B||R[24].p._mdf||R[25].p._mdf||R[26].p._mdf||R[27].p._mdf||R[28].p._mdf)&&(D=this.getTableValue(R[24].p.v,R[25].p.v,R[26].p.v,R[27].p.v,R[28].p.v),this.feFuncB.setAttribute("tableValues",D)),this.feFuncA&&(B||R[31].p._mdf||R[32].p._mdf||R[33].p._mdf||R[34].p._mdf||R[35].p._mdf)&&(D=this.getTableValue(R[31].p.v,R[32].p.v,R[33].p.v,R[34].p.v,R[35].p.v),this.feFuncA.setAttribute("tableValues",D))}},SVGDropShadowEffect.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){if((B||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),B||this.filterManager.effectElements[0].p._mdf){var D=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(255*D[0]),Math.round(255*D[1]),Math.round(255*D[2])))}if((B||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),B||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var R=this.filterManager.effectElements[3].p.v,F=(this.filterManager.effectElements[2].p.v-90)*degToRads,G=R*Math.cos(F),j=R*Math.sin(F);this.feOffset.setAttribute("dx",G),this.feOffset.setAttribute("dy",j)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(B,D,R){this.initialized=!1,this.filterManager=D,this.filterElem=B,this.elem=R,R.matteElement=createNS("g"),R.matteElement.appendChild(R.layerElement),R.matteElement.appendChild(R.transformedElement),R.baseElement=R.matteElement}function SVGGaussianBlurEffect(B,D){B.setAttribute("x","-100%"),B.setAttribute("y","-100%"),B.setAttribute("width","300%"),B.setAttribute("height","300%"),this.filterManager=D;var R=createNS("feGaussianBlur");B.appendChild(R),this.feGaussianBlur=R}SVGMatte3Effect.prototype.findSymbol=function(B){for(var D=0,R=_svgMatteSymbols.length;D=0&&!this.shapeModifiers[B].processShapes(this._isFirstFrame);B-=1);}},searchProcessedElement:function(B){for(var D=this.processedElements,R=0,F=D.length;R.01)return!1;R+=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 B=0,D=this.data.k.k.length;B0;)ne=Z.transformers[ge].mProps._mdf||ne,he-=1,ge-=1;if(ne)for(he=me-Z.styles[re].lvl,ge=Z.transformers.length-1;he>0;)fe=Z.transformers[ge].mProps.v.props,le.transform(fe[0],fe[1],fe[2],fe[3],fe[4],fe[5],fe[6],fe[7],fe[8],fe[9],fe[10],fe[11],fe[12],fe[13],fe[14],fe[15]),he-=1,ge-=1}else le=B;if(K=(oe=Z.sh.paths)._length,ne){for(te="",J=0;J=1?pe=.99:pe<=-1&&(pe=-.99);var ye=ie*pe,xe=Math.cos(ve+Z.a.v)*ye+le[0],ce=Math.sin(ve+Z.a.v)*ye+le[1];re.setAttribute("fx",xe),re.setAttribute("fy",ce),oe&&!Z.g._collapsable&&(Z.of.setAttribute("fx",xe),Z.of.setAttribute("fy",ce))}}function Y(Q,Z,q){var J=Z.style,K=Z.d;K&&(K._mdf||q)&&K.dashStr&&(J.pElem.setAttribute("stroke-dasharray",K.dashStr),J.pElem.setAttribute("stroke-dashoffset",K.dashoffset[0])),Z.c&&(Z.c._mdf||q)&&J.pElem.setAttribute("stroke","rgb("+bmFloor(Z.c.v[0])+","+bmFloor(Z.c.v[1])+","+bmFloor(Z.c.v[2])+")"),(Z.o._mdf||q)&&J.pElem.setAttribute("stroke-opacity",Z.o.v),(Z.w._mdf||q)&&(J.pElem.setAttribute("stroke-width",Z.w.v),J.msElem&&J.msElem.setAttribute("stroke-width",Z.w.v))}return{createRenderFunction:function(Q){switch(Q.ty){case"fl":return j;case"gf":return W;case"gs":return U;case"st":return Y;case"sh":case"el":case"rc":case"sr":return G;case"tr":return R;case"no":return F;default:return null}}}}();function SVGShapeElement(B,D,R){this.shapes=[],this.shapesData=B.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(B,D,R),this.prevViewData=[]}function LetterProps(B,D,R,F,G,j){this.o=B,this.sw=D,this.sc=R,this.fc=F,this.m=G,this.p=j,this._mdf={o:!0,sw:!!D,sc:!!R,fc:!!F,m:!0,p:!0}}function TextProperty(B,D){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,this.data=D,this.elem=B,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}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 B,D,R,F,G=this.shapes.length,j=this.stylesList.length,U=[],W=!1;for(R=0;R1&&W&&this.setShapesAsAnimated(U)}},SVGShapeElement.prototype.setShapesAsAnimated=function(B){var D,R=B.length;for(D=0;D=0;W-=1){if((J=this.searchProcessedElement(B[W]))?D[W]=R[J-1]:B[W]._render=U,B[W].ty==="fl"||B[W].ty==="st"||B[W].ty==="gf"||B[W].ty==="gs"||B[W].ty==="no")J?D[W].style.closed=!1:D[W]=this.createStyleElement(B[W],G),B[W]._render&&D[W].style.pElem.parentNode!==F&&F.appendChild(D[W].style.pElem),ne.push(D[W].style);else if(B[W].ty==="gr"){if(J)for(Q=D[W].it.length,Y=0;Y1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(B){this.effectsSequence.push(B),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(B){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||B){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var D=this.currentData,R=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{var F;this.lock=!0,this._mdf=!1;var G=this.effectsSequence.length,j=B||this.data.d.k[this.keysIndex].s;for(F=0;FD);)R+=1;return this.keysIndex!==R&&(this.keysIndex=R),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(B){for(var D,R,F=[],G=0,j=B.length,U=!1;G=55296&&D<=56319?(R=B.charCodeAt(G+1))>=56320&&R<=57343?(U||FontManager.isModifier(D,R)?(F[F.length-1]+=B.substr(G,2),U=!1):F.push(B.substr(G,2)),G+=1):F.push(B.charAt(G)):D>56319?(R=B.charCodeAt(G+1),FontManager.isZeroWidthJoiner(D,R)?(U=!0,F[F.length-1]+=B.substr(G,2),G+=1):F.push(B.charAt(G))):FontManager.isZeroWidthJoiner(D)?(F[F.length-1]+=B.charAt(G),U=!0):F.push(B.charAt(G)),G+=1;return F},TextProperty.prototype.completeTextData=function(B){B.__complete=!0;var D,R,F,G,j,U,W,Y=this.elem.globalData.fontManager,Q=this.data,Z=[],q=0,J=Q.m.g,K=0,te=0,ne=0,ie=[],re=0,oe=0,le=Y.getFontByName(B.f),fe=0,he=getFontProperties(le);B.fWeight=he.weight,B.fStyle=he.style,B.finalSize=B.s,B.finalText=this.buildFinalText(B.t),R=B.finalText.length,B.finalLineHeight=B.lh;var ge,ue=B.tr/1e3*B.finalSize;if(B.sz)for(var me,be,ve=!0,pe=B.sz[0],ye=B.sz[1];ve;){me=0,re=0,R=(be=this.buildFinalText(B.t)).length,ue=B.tr/1e3*B.finalSize;var xe=-1;for(D=0;Dpe&&be[D]!==" "?(xe===-1?R+=1:D=xe,me+=B.finalLineHeight||1.2*B.finalSize,be.splice(D,xe===D?1:0,"\r"),xe=-1,re=0):(re+=fe,re+=ue);me+=le.ascent*B.finalSize/100,this.canResize&&B.finalSize>this.minimumFontSize&&yeoe?re:oe,re=-2*ue,G="",F=!0,ne+=1):G=ce,Y.chars?(W=Y.getCharData(ce,le.fStyle,Y.getFontByName(B.f).fFamily),fe=F?0:W.w*B.finalSize/100):fe=Y.measureText(G,B.f,B.finalSize),ce===" "?we+=fe+ue:(re+=fe+ue+we,we=0),Z.push({l:fe,an:fe,add:K,n:F,anIndexes:[],val:G,line:ne,animatorJustifyOffset:0}),J==2){if(K+=fe,G===""||G===" "||D===R-1){for(G!==""&&G!==" "||(K-=fe);te<=D;)Z[te].an=K,Z[te].ind=q,Z[te].extra=fe,te+=1;q+=1,K=0}}else if(J==3){if(K+=fe,G===""||D===R-1){for(G===""&&(K-=fe);te<=D;)Z[te].an=K,Z[te].ind=q,Z[te].extra=fe,te+=1;K=0,q+=1}}else Z[q].ind=q,Z[q].extra=0,q+=1;if(B.l=Z,oe=re>oe?re:oe,ie.push(re),B.sz)B.boxWidth=B.sz[0],B.justifyOffset=0;else switch(B.boxWidth=oe,B.j){case 1:B.justifyOffset=-B.boxWidth;break;case 2:B.justifyOffset=-B.boxWidth/2;break;default:B.justifyOffset=0}B.lineWidths=ie;var Be,Ae,Te,Ne,Pe=Q.a;U=Pe.length;var Me=[];for(j=0;j0?j=this.ne.v/100:U=-this.ne.v/100,this.xe.v>0?W=1-this.xe.v/100:Y=1+this.xe.v/100;var Q=BezierFactory.getBezierEasing(j,U,W,Y).get,Z=0,q=this.finalS,J=this.finalE,K=this.data.sh;if(K===2)Z=Q(Z=J===q?G>=J?1:0:B(0,D(.5/(J-q)+(G-q)/(J-q),1)));else if(K===3)Z=Q(Z=J===q?G>=J?0:1:1-B(0,D(.5/(J-q)+(G-q)/(J-q),1)));else if(K===4)J===q?Z=0:(Z=B(0,D(.5/(J-q)+(G-q)/(J-q),1)))<.5?Z*=2:Z=1-2*(Z-.5),Z=Q(Z);else if(K===5){if(J===q)Z=0;else{var te=J-q,ne=-te/2+(G=D(B(0,G+.5-q),J-q)),ie=te/2;Z=Math.sqrt(1-ne*ne/(ie*ie))}Z=Q(Z)}else K===6?(J===q?Z=0:(G=D(B(0,G+.5-q),J-q),Z=(1+Math.cos(Math.PI+2*Math.PI*G/(J-q)))/2),Z=Q(Z)):(G>=R(q)&&(Z=B(0,D(G-q<0?D(J,1)-(q-G):J-G,1))),Z=Q(Z));if(this.sm.v!==100){var re=.01*this.sm.v;re===0&&(re=1e-8);var oe=.5-.5*re;Z1&&(Z=1)}return Z*this.a.v},getValue:function(G){this.iterateDynamicProperties(),this._mdf=G||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,G&&this.data.r===2&&(this.e.v=this._currentTextLength);var j=this.data.r===2?1:100/this.data.totalChars,U=this.o.v/j,W=this.s.v/j+U,Y=this.e.v/j+U;if(W>Y){var Q=W;W=Y,Y=Q}this.finalS=W,this.finalE=Y}},extendPrototype([DynamicPropertyContainer],F),{getTextSelectorProp:function(G,j,U){return new F(G,j)}}}();function TextAnimatorDataProperty(B,D,R){var F={propType:!1},G=PropertyFactory.getProp,j=D.a;this.a={r:j.r?G(B,j.r,0,degToRads,R):F,rx:j.rx?G(B,j.rx,0,degToRads,R):F,ry:j.ry?G(B,j.ry,0,degToRads,R):F,sk:j.sk?G(B,j.sk,0,degToRads,R):F,sa:j.sa?G(B,j.sa,0,degToRads,R):F,s:j.s?G(B,j.s,1,.01,R):F,a:j.a?G(B,j.a,1,0,R):F,o:j.o?G(B,j.o,0,.01,R):F,p:j.p?G(B,j.p,1,0,R):F,sw:j.sw?G(B,j.sw,0,0,R):F,sc:j.sc?G(B,j.sc,1,0,R):F,fc:j.fc?G(B,j.fc,1,0,R):F,fh:j.fh?G(B,j.fh,0,0,R):F,fs:j.fs?G(B,j.fs,0,.01,R):F,fb:j.fb?G(B,j.fb,0,.01,R):F,t:j.t?G(B,j.t,0,0,R):F},this.s=TextSelectorProp.getTextSelectorProp(B,D.s,R),this.s.t=D.s.t}function TextAnimatorProperty(B,D,R){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=B,this._renderType=D,this._elem=R,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(R)}function ITextElement(){}TextAnimatorProperty.prototype.searchProperties=function(){var B,D,R=this._textData.a.length,F=PropertyFactory.getProp;for(B=0;B=W+ut||!te?(oe=(W+ut-Q)/Y.partialLength,Se=K.point[0]+(Y.point[0]-K.point[0])*oe,Le=K.point[1]+(Y.point[1]-K.point[1])*oe,me.translate(-he[0]*pe[G].an*.005,-he[1]*Ne*.01),Z=!1):te&&(Q+=Y.partialLength,(q+=1)>=te.length&&(q=0,ne[J+=1]?te=ne[J].points:fe.v.c?(q=0,te=ne[J=0].points):(Q-=Y.partialLength,te=null)),te&&(K=Y,ie=(Y=te[q]).partialLength));Me=pe[G].an/2-pe[G].add,me.translate(-Me,0,0)}else Me=pe[G].an/2-pe[G].add,me.translate(-Me,0,0),me.translate(-he[0]*pe[G].an*.005,-he[1]*Ne*.01,0);for(we=0;weB?this.textSpans[B].span:createNS(Y?"g":"text"),ie<=B){if(U.setAttribute("stroke-linecap","butt"),U.setAttribute("stroke-linejoin","round"),U.setAttribute("stroke-miterlimit","4"),this.textSpans[B].span=U,Y){var re=createNS("g");U.appendChild(re),this.textSpans[B].childSpan=re}this.textSpans[B].span=U,this.layerElement.appendChild(U)}U.style.display="inherit"}if(Q.reset(),Q.scale(R.finalSize/100,R.finalSize/100),Z&&(W[B].n&&(q=-te,J+=R.yOffset,J+=K?1:0,K=!1),this.applyTextPropertiesToMatrix(R,Q,W[B].line,q,J),q+=W[B].l||0,q+=te),Y){var oe;if((ne=this.globalData.fontManager.getCharData(R.finalText[B],F.fStyle,this.globalData.fontManager.getFontByName(R.f).fFamily)).t===1)oe=new SVGCompElement(ne.data,this.globalData,this);else{var le=emptyShapeData;ne.data&&ne.data.shapes&&(le=ne.data),oe=new SVGShapeElement(le,this.globalData,this)}this.textSpans[B].glyph=oe,oe._debug=!0,oe.prepareFrame(0),oe.renderFrame(),this.textSpans[B].childSpan.appendChild(oe.layerElement),this.textSpans[B].childSpan.setAttribute("transform","scale("+R.finalSize/100+","+R.finalSize/100+")")}else Z&&U.setAttribute("transform","translate("+Q.props[12]+","+Q.props[13]+")"),U.textContent=W[B].val,U.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}Z&&U&&U.setAttribute("d","")}else{var fe=this.textContainer,he="start";switch(R.j){case 1:he="end";break;case 2:he="middle";break;default:he="start"}fe.setAttribute("text-anchor",he),fe.setAttribute("letter-spacing",te);var ge=this.buildTextContents(R.finalText);for(D=ge.length,J=R.ps?R.ps[1]+R.ascent:0,B=0;B=0;D-=1)(this.completeLayers||this.elements[D])&&this.elements[D].prepareFrame(B-this.layers[D].st);if(this.globalData._mdf)for(D=0;D=0;R-=1)(this.completeLayers||this.elements[R])&&(this.elements[R].prepareFrame(this.renderedFrame-this.layers[R].st),this.elements[R]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var B,D=this.layers.length;for(B=0;B=j;)re/=2,oe/=2,le>>>=1;return(re+le)/oe};return ie.int32=function(){return 0|ne.g(4)},ie.quick=function(){return ne.g(4)/4294967296},ie.double=ie,Y(Q(ne.S),B),(q.pass||J||function(re,oe,le,fe){return fe&&(fe.S&&W(fe,ne),re.state=function(){return W(ne,{})}),le?(D.random=re,oe):re})(ie,te,"global"in q?q.global:this==D,q.state)},Y(D.random(),B)}function initialize$2(B){seedRandom([],B)}var propTypes={SHAPE:"shape"};function _typeof(B){return(_typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D})(B)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null;function $bm_isInstanceOfArray(B){return B.constructor===Array||B.constructor===Float32Array}function isNumerable(B,D){return B==="number"||B==="boolean"||B==="string"||D instanceof Number}function $bm_neg(B){var D=_typeof(B);if(D==="number"||D==="boolean"||B instanceof Number)return-B;if($bm_isInstanceOfArray(B)){var R,F=B.length,G=[];for(R=0;RR){var F=R;R=D,D=F}return Math.min(Math.max(B,D),R)}function radiansToDegrees(B){return B/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(B){return B*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(B,D){if(typeof B=="number"||B instanceof Number)return D=D||0,Math.abs(B-D);var R;D||(D=helperLengthArray);var F=Math.min(B.length,D.length),G=0;for(R=0;R.5?Q/(2-U-W):Q/(U+W),U){case F:D=(G-j)/Q+(G1&&(R-=1),R<1/6?B+6*(D-B)*R:R<.5?D:R<2/3?B+(D-B)*(2/3-R)*6:B}function hslToRgb(B){var D,R,F,G=B[0],j=B[1],U=B[2];if(j===0)D=U,F=U,R=U;else{var W=U<.5?U*(1+j):U+j-U*j,Y=2*U-W;D=hue2rgb(Y,W,G+1/3),R=hue2rgb(Y,W,G),F=hue2rgb(Y,W,G-1/3)}return[D,R,F,B[3]]}function linear(B,D,R,F,G){if(F!==void 0&&G!==void 0||(F=D,G=R,D=0,R=1),R=R)return G;var U,W=R===D?0:(B-D)/(R-D);if(!F.length)return F+(G-F)*W;var Y=F.length,Q=createTypedArray("float32",Y);for(U=0;U1){for(F=0;F1?D=1:D<0&&(D=0);var U=B(D);if($bm_isInstanceOfArray(G)){var W,Y=G.length,Q=createTypedArray("float32",Y);for(W=0;Wdata.k[D].t&&Bdata.k[D+1].t-B?(R=D+2,F=data.k[D+1].t):(R=D+1,F=data.k[D].t);break}}R===-1&&(R=D+1,F=data.k[D].t)}else R=0,F=0;var j={};return j.index=R,j.time=F/elem.comp.globalData.frameRate,j}function key(B){var D,R,F;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+B);B-=1,D={time:data.k[B].t/elem.comp.globalData.frameRate,value:[]};var G=Object.prototype.hasOwnProperty.call(data.k[B],"s")?data.k[B].s:data.k[B-1].e;for(F=G.length,R=0;Rfe.length-1)&&(J=fe.length-1),te=he-(ne=fe[fe.length-1-J].t)),q==="pingpong"){if(Math.floor((le-ne)/te)%2!=0)return this.getValueAtTime((te-(le-ne)%te+ne)/this.comp.globalData.frameRate,0)}else{if(q==="offset"){var ge=this.getValueAtTime(ne/this.comp.globalData.frameRate,0),ue=this.getValueAtTime(he/this.comp.globalData.frameRate,0),me=this.getValueAtTime(((le-ne)%te+ne)/this.comp.globalData.frameRate,0),be=Math.floor((le-ne)/te);if(this.pv.length){for(re=(oe=new Array(ge.length)).length,ie=0;ie=he)return this.pv;if(K?ne=he+(te=J?Math.abs(this.elem.comp.globalData.frameRate*J):Math.max(0,this.elem.data.op-he)):((!J||J>fe.length-1)&&(J=fe.length-1),te=(ne=fe[J].t)-he),q==="pingpong"){if(Math.floor((he-le)/te)%2==0)return this.getValueAtTime(((he-le)%te+he)/this.comp.globalData.frameRate,0)}else{if(q==="offset"){var ge=this.getValueAtTime(he/this.comp.globalData.frameRate,0),ue=this.getValueAtTime(ne/this.comp.globalData.frameRate,0),me=this.getValueAtTime((te-(he-le)%te+he)/this.comp.globalData.frameRate,0),be=Math.floor((he-le)/te)+1;if(this.pv.length){for(re=(oe=new Array(ge.length)).length,ie=0;ie1?(ne+q-ie)/(J-1):1,oe=0,le=0;for(K=this.pv.length?createTypedArray("float32",this.pv.length):0;oere){var he=oe,ge=K.c&&oe===le-1?0:oe+1,ue=(re-fe)/ie[oe].addedLength;te=bez.getPointInSegment(K.v[he],K.v[ge],K.o[he],K.i[ge],ue,ie[oe]);break}fe+=ie[oe].addedLength,oe+=1}return te||(te=K.c?[K.v[0][0],K.v[0][1]]:[K.v[K._length-1][0],K.v[K._length-1][1]]),te},vectorOnPath:function(q,J,K){q==1?q=this.v.c:q==0&&(q=.999);var te=this.pointOnPath(q,J),ne=this.pointOnPath(q+.001,J),ie=ne[0]-te[0],re=ne[1]-te[1],oe=Math.sqrt(Math.pow(ie,2)+Math.pow(re,2));return oe===0?[0,0]:K==="tangent"?[ie/oe,re/oe]:[-re/oe,ie/oe]},tangentOnPath:function(q,J){return this.vectorOnPath(q,J,"tangent")},normalOnPath:function(q,J){return this.vectorOnPath(q,J,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([Q],W),extendPrototype([Q],Y),Y.prototype.getValueAtTime=function(q){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),q*=this.elem.globalData.frameRate,(q-=this.offsetTime)!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(R){B.exports=R()})(function(){return function R(F,G,j){function U(Q,Z){if(!G[Q]){if(!F[Q]){var q=typeof commonjsRequire=="function"&&commonjsRequire;if(!Z&&q)return q(Q,!0);if(W)return W(Q,!0);var J=new Error("Cannot find module '"+Q+"'");throw J.code="MODULE_NOT_FOUND",J}var K=G[Q]={exports:{}};F[Q][0].call(K.exports,function(te){var ne=F[Q][1][te];return U(ne||te)},K,K.exports,R,F,G,j)}return G[Q].exports}for(var W=typeof commonjsRequire=="function"&&commonjsRequire,Y=0;Y>2,K=(3&Q)<<4|Z>>4,te=le>1?(15&Z)<<2|q>>6:64,ne=le>2?63&q:64,ie.push(W.charAt(J)+W.charAt(K)+W.charAt(te)+W.charAt(ne));return ie.join("")},G.decode=function(Y){var Q,Z,q,J,K,te,ne=0,ie=0;if(Y.substr(0,5)==="data:")throw new Error("Invalid base64 input, it looks like a data url.");var re,oe=3*(Y=Y.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(Y.charAt(Y.length-1)===W.charAt(64)&&oe--,Y.charAt(Y.length-2)===W.charAt(64)&&oe--,oe%1!=0)throw new Error("Invalid base64 input, bad content length.");for(re=U.uint8array?new Uint8Array(0|oe):new Array(0|oe);ne>4,Z=(15&J)<<4|(K=W.indexOf(Y.charAt(ne++)))>>2,q=(3&K)<<6|(te=W.indexOf(Y.charAt(ne++))),re[ie++]=Q,K!==64&&(re[ie++]=Z),te!==64&&(re[ie++]=q);return re}},{"./support":30,"./utils":32}],2:[function(R,F,G){var j=R("./external"),U=R("./stream/DataWorker"),W=R("./stream/Crc32Probe"),Y=R("./stream/DataLengthProbe");function Q(Z,q,J,K,te){this.compressedSize=Z,this.uncompressedSize=q,this.crc32=J,this.compression=K,this.compressedContent=te}Q.prototype={getContentWorker:function(){var Z=new U(j.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Y("data_length")),q=this;return Z.on("end",function(){if(this.streamInfo.data_length!==q.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),Z},getCompressedWorker:function(){return new U(j.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},Q.createWorkerFrom=function(Z,q,J){return Z.pipe(new W).pipe(new Y("uncompressedSize")).pipe(q.compressWorker(J)).pipe(new Y("compressedSize")).withStreamInfo("compression",q)},F.exports=Q},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(R,F,G){var j=R("./stream/GenericWorker");G.STORE={magic:"\0\0",compressWorker:function(U){return new j("STORE compression")},uncompressWorker:function(){return new j("STORE decompression")}},G.DEFLATE=R("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(R,F,G){var j=R("./utils"),U=function(){for(var W,Y=[],Q=0;Q<256;Q++){W=Q;for(var Z=0;Z<8;Z++)W=1&W?3988292384^W>>>1:W>>>1;Y[Q]=W}return Y}();F.exports=function(W,Y){return W!==void 0&&W.length?j.getTypeOf(W)!=="string"?function(Q,Z,q,J){var K=U,te=J+q;Q^=-1;for(var ne=J;ne>>8^K[255&(Q^Z[ne])];return-1^Q}(0|Y,W,W.length,0):function(Q,Z,q,J){var K=U,te=J+q;Q^=-1;for(var ne=J;ne>>8^K[255&(Q^Z.charCodeAt(ne))];return-1^Q}(0|Y,W,W.length,0):0}},{"./utils":32}],5:[function(R,F,G){G.base64=!1,G.binary=!1,G.dir=!1,G.createFolders=!0,G.date=null,G.compression=null,G.compressionOptions=null,G.comment=null,G.unixPermissions=null,G.dosPermissions=null},{}],6:[function(R,F,G){var j=null;j=typeof Promise!="undefined"?Promise:R("lie"),F.exports={Promise:j}},{lie:37}],7:[function(R,F,G){var j=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",U=R("pako"),W=R("./utils"),Y=R("./stream/GenericWorker"),Q=j?"uint8array":"array";function Z(q,J){Y.call(this,"FlateWorker/"+q),this._pako=null,this._pakoAction=q,this._pakoOptions=J,this.meta={}}G.magic="\b\0",W.inherits(Z,Y),Z.prototype.processChunk=function(q){this.meta=q.meta,this._pako===null&&this._createPako(),this._pako.push(W.transformTo(Q,q.data),!1)},Z.prototype.flush=function(){Y.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},Z.prototype.cleanUp=function(){Y.prototype.cleanUp.call(this),this._pako=null},Z.prototype._createPako=function(){this._pako=new U[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var q=this;this._pako.onData=function(J){q.push({data:J,meta:q.meta})}},G.compressWorker=function(q){return new Z("Deflate",q)},G.uncompressWorker=function(){return new Z("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(R,F,G){var j=R("../utils"),U=R("../stream/GenericWorker"),W=R("../utf8"),Y=R("../crc32"),Q=R("../signature"),Z=function(te,ne){var ie,re="";for(ie=0;ie>>=8;return re},q=function(te,ne,ie,re,oe,le){var fe,he,ge=te.file,ue=te.compression,me=le!==W.utf8encode,be=j.transformTo("string",le(ge.name)),ve=j.transformTo("string",W.utf8encode(ge.name)),pe=ge.comment,ye=j.transformTo("string",le(pe)),xe=j.transformTo("string",W.utf8encode(pe)),ce=ve.length!==ge.name.length,we=xe.length!==pe.length,Be="",Ae="",Te="",Ne=ge.dir,Pe=ge.date,Me={crc32:0,compressedSize:0,uncompressedSize:0};ne&&!ie||(Me.crc32=te.crc32,Me.compressedSize=te.compressedSize,Me.uncompressedSize=te.uncompressedSize);var Se=0;ne&&(Se|=8),me||!ce&&!we||(Se|=2048);var Le,ze,ke,Ge=0,We=0;Ne&&(Ge|=16),oe==="UNIX"?(We=798,Ge|=(Le=ge.unixPermissions,ze=Ne,ke=Le,Le||(ke=ze?16893:33204),(65535&ke)<<16)):(We=20,Ge|=63&(ge.dosPermissions||0)),fe=Pe.getUTCHours(),fe<<=6,fe|=Pe.getUTCMinutes(),fe<<=5,fe|=Pe.getUTCSeconds()/2,he=Pe.getUTCFullYear()-1980,he<<=4,he|=Pe.getUTCMonth()+1,he<<=5,he|=Pe.getUTCDate(),ce&&(Ae=Z(1,1)+Z(Y(be),4)+ve,Be+="up"+Z(Ae.length,2)+Ae),we&&(Te=Z(1,1)+Z(Y(ye),4)+xe,Be+="uc"+Z(Te.length,2)+Te);var Ve="";return Ve+=` \0`,Ve+=Z(Se,2),Ve+=ue.magic,Ve+=Z(fe,2),Ve+=Z(he,2),Ve+=Z(Me.crc32,4),Ve+=Z(Me.compressedSize,4),Ve+=Z(Me.uncompressedSize,4),Ve+=Z(be.length,2),Ve+=Z(Be.length,2),{fileRecord:Q.LOCAL_FILE_HEADER+Ve+be+Be,dirRecord:Q.CENTRAL_FILE_HEADER+Z(We,2)+Ve+Z(ye.length,2)+"\0\0\0\0"+Z(Ge,4)+Z(re,4)+be+Be+ye}},J=function(te){return Q.DATA_DESCRIPTOR+Z(te.crc32,4)+Z(te.compressedSize,4)+Z(te.uncompressedSize,4)};function K(te,ne,ie,re){U.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=ne,this.zipPlatform=ie,this.encodeFileName=re,this.streamFiles=te,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}j.inherits(K,U),K.prototype.push=function(te){var ne=te.meta.percent||0,ie=this.entriesCount,re=this._sources.length;this.accumulate?this.contentBuffer.push(te):(this.bytesWritten+=te.data.length,U.prototype.push.call(this,{data:te.data,meta:{currentFile:this.currentFile,percent:ie?(ne+100*(ie-re-1))/ie:100}}))},K.prototype.openedSource=function(te){this.currentSourceOffset=this.bytesWritten,this.currentFile=te.file.name;var ne=this.streamFiles&&!te.file.dir;if(ne){var ie=q(te,ne,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:ie.fileRecord,meta:{percent:0}})}else this.accumulate=!0},K.prototype.closedSource=function(te){this.accumulate=!1;var ne=this.streamFiles&&!te.file.dir,ie=q(te,ne,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(ie.dirRecord),ne)this.push({data:J(te),meta:{percent:100}});else for(this.push({data:ie.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},K.prototype.flush=function(){for(var te=this.bytesWritten,ne=0;ne0?he.substring(0,ge):""},re=function(he){return he.slice(-1)!=="/"&&(he+="/"),he},oe=function(he,ge){return ge=ge!==void 0?ge:Q.createFolders,he=re(he),this.files[he]||ne.call(this,he,null,{dir:!0,createFolders:ge}),this.files[he]};function le(he){return Object.prototype.toString.call(he)==="[object RegExp]"}var fe={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(he){var ge,ue,me;for(ge in this.files)me=this.files[ge],(ue=ge.slice(this.root.length,ge.length))&&ge.slice(0,this.root.length)===this.root&&he(ue,me)},filter:function(he){var ge=[];return this.forEach(function(ue,me){he(ue,me)&&ge.push(me)}),ge},file:function(he,ge,ue){if(arguments.length===1){if(le(he)){var me=he;return this.filter(function(ve,pe){return!pe.dir&&me.test(ve)})}var be=this.files[this.root+he];return be&&!be.dir?be:null}return he=this.root+he,ne.call(this,he,ge,ue),this},folder:function(he){if(!he)return this;if(le(he))return this.filter(function(be,ve){return ve.dir&&he.test(be)});var ge=this.root+he,ue=oe.call(this,ge),me=this.clone();return me.root=ue.name,me},remove:function(he){he=this.root+he;var ge=this.files[he];if(ge||(he.slice(-1)!=="/"&&(he+="/"),ge=this.files[he]),ge&&!ge.dir)delete this.files[he];else for(var ue=this.filter(function(be,ve){return ve.name.slice(0,he.length)===he}),me=0;me=0;--J)if(this.data[J]===Y&&this.data[J+1]===Q&&this.data[J+2]===Z&&this.data[J+3]===q)return J-this.zero;return-1},U.prototype.readAndCheckSignature=function(W){var Y=W.charCodeAt(0),Q=W.charCodeAt(1),Z=W.charCodeAt(2),q=W.charCodeAt(3),J=this.readData(4);return Y===J[0]&&Q===J[1]&&Z===J[2]&&q===J[3]},U.prototype.readData=function(W){if(this.checkOffset(W),W===0)return[];var Y=this.data.slice(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./DataReader":18}],18:[function(R,F,G){var j=R("../utils");function U(W){this.data=W,this.length=W.length,this.index=0,this.zero=0}U.prototype={checkOffset:function(W){this.checkIndex(this.index+W)},checkIndex:function(W){if(this.length=this.index;Y--)Q=(Q<<8)+this.byteAt(Y);return this.index+=W,Q},readString:function(W){return j.transformTo("string",this.readData(W))},readData:function(W){},lastIndexOfSignature:function(W){},readAndCheckSignature:function(W){},readDate:function(){var W=this.readInt(4);return new Date(Date.UTC(1980+(W>>25&127),(W>>21&15)-1,W>>16&31,W>>11&31,W>>5&63,(31&W)<<1))}},F.exports=U},{"../utils":32}],19:[function(R,F,G){var j=R("./Uint8ArrayReader");function U(W){j.call(this,W)}R("../utils").inherits(U,j),U.prototype.readData=function(W){this.checkOffset(W);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(R,F,G){var j=R("./DataReader");function U(W){j.call(this,W)}R("../utils").inherits(U,j),U.prototype.byteAt=function(W){return this.data.charCodeAt(this.zero+W)},U.prototype.lastIndexOfSignature=function(W){return this.data.lastIndexOf(W)-this.zero},U.prototype.readAndCheckSignature=function(W){return W===this.readData(4)},U.prototype.readData=function(W){this.checkOffset(W);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./DataReader":18}],21:[function(R,F,G){var j=R("./ArrayReader");function U(W){j.call(this,W)}R("../utils").inherits(U,j),U.prototype.readData=function(W){if(this.checkOffset(W),W===0)return new Uint8Array(0);var Y=this.data.subarray(this.zero+this.index,this.zero+this.index+W);return this.index+=W,Y},F.exports=U},{"../utils":32,"./ArrayReader":17}],22:[function(R,F,G){var j=R("../utils"),U=R("../support"),W=R("./ArrayReader"),Y=R("./StringReader"),Q=R("./NodeBufferReader"),Z=R("./Uint8ArrayReader");F.exports=function(q){var J=j.getTypeOf(q);return j.checkSupport(J),J!=="string"||U.uint8array?J==="nodebuffer"?new Q(q):U.uint8array?new Z(j.transformTo("uint8array",q)):new W(j.transformTo("array",q)):new Y(q)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(R,F,G){G.LOCAL_FILE_HEADER="PK",G.CENTRAL_FILE_HEADER="PK",G.CENTRAL_DIRECTORY_END="PK",G.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",G.ZIP64_CENTRAL_DIRECTORY_END="PK",G.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(R,F,G){var j=R("./GenericWorker"),U=R("../utils");function W(Y){j.call(this,"ConvertWorker to "+Y),this.destType=Y}U.inherits(W,j),W.prototype.processChunk=function(Y){this.push({data:U.transformTo(this.destType,Y.data),meta:Y.meta})},F.exports=W},{"../utils":32,"./GenericWorker":28}],25:[function(R,F,G){var j=R("./GenericWorker"),U=R("../crc32");function W(){j.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}R("../utils").inherits(W,j),W.prototype.processChunk=function(Y){this.streamInfo.crc32=U(Y.data,this.streamInfo.crc32||0),this.push(Y)},F.exports=W},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(R,F,G){var j=R("../utils"),U=R("./GenericWorker");function W(Y){U.call(this,"DataLengthProbe for "+Y),this.propName=Y,this.withStreamInfo(Y,0)}j.inherits(W,U),W.prototype.processChunk=function(Y){if(Y){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+Y.data.length}U.prototype.processChunk.call(this,Y)},F.exports=W},{"../utils":32,"./GenericWorker":28}],27:[function(R,F,G){var j=R("../utils"),U=R("./GenericWorker");function W(Y){U.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Y.then(function(Z){Q.dataIsReady=!0,Q.data=Z,Q.max=Z&&Z.length||0,Q.type=j.getTypeOf(Z),Q.isPaused||Q._tickAndRepeat()},function(Z){Q.error(Z)})}j.inherits(W,U),W.prototype.cleanUp=function(){U.prototype.cleanUp.call(this),this.data=null},W.prototype.resume=function(){return!!U.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,j.delay(this._tickAndRepeat,[],this)),!0)},W.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(j.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},W.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Y=null,Q=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":Y=this.data.substring(this.index,Q);break;case"uint8array":Y=this.data.subarray(this.index,Q);break;case"array":case"nodebuffer":Y=this.data.slice(this.index,Q)}return this.index=Q,this.push({data:Y,meta:{percent:this.max?this.index/this.max*100:0}})},F.exports=W},{"../utils":32,"./GenericWorker":28}],28:[function(R,F,G){function j(U){this.name=U||"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}j.prototype={push:function(U){this.emit("data",U)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(U){this.emit("error",U)}return!0},error:function(U){return!this.isFinished&&(this.isPaused?this.generatedError=U:(this.isFinished=!0,this.emit("error",U),this.previous&&this.previous.error(U),this.cleanUp()),!0)},on:function(U,W){return this._listeners[U].push(W),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(U,W){if(this._listeners[U])for(var Y=0;Y "+U:U}},F.exports=j},{}],29:[function(R,F,G){var j=R("../utils"),U=R("./ConvertWorker"),W=R("./GenericWorker"),Y=R("../base64"),Q=R("../support"),Z=R("../external"),q=null;if(Q.nodestream)try{q=R("../nodejs/NodejsStreamOutputAdapter")}catch{}function J(te,ne){return new Z.Promise(function(ie,re){var oe=[],le=te._internalType,fe=te._outputType,he=te._mimeType;te.on("data",function(ge,ue){oe.push(ge),ne&&ne(ue)}).on("error",function(ge){oe=[],re(ge)}).on("end",function(){try{var ge=function(ue,me,be){switch(ue){case"blob":return j.newBlob(j.transformTo("arraybuffer",me),be);case"base64":return Y.encode(me);default:return j.transformTo(ue,me)}}(fe,function(ue,me){var be,ve=0,pe=null,ye=0;for(be=0;be=252?6:Z>=248?5:Z>=240?4:Z>=224?3:Z>=192?2:1;Q[254]=Q[254]=1;function q(){Y.call(this,"utf-8 decode"),this.leftOver=null}function J(){Y.call(this,"utf-8 encode")}G.utf8encode=function(K){return U.nodebuffer?W.newBufferFrom(K,"utf-8"):function(te){var ne,ie,re,oe,le,fe=te.length,he=0;for(oe=0;oe>>6,ne[le++]=128|63&ie):ie<65536?(ne[le++]=224|ie>>>12,ne[le++]=128|ie>>>6&63,ne[le++]=128|63&ie):(ne[le++]=240|ie>>>18,ne[le++]=128|ie>>>12&63,ne[le++]=128|ie>>>6&63,ne[le++]=128|63&ie);return ne}(K)},G.utf8decode=function(K){return U.nodebuffer?j.transformTo("nodebuffer",K).toString("utf-8"):function(te){var ne,ie,re,oe,le=te.length,fe=new Array(2*le);for(ie=0,ne=0;ne4)fe[ie++]=65533,ne+=oe-1;else{for(re&=oe===2?31:oe===3?15:7;oe>1&&ne1?fe[ie++]=65533:re<65536?fe[ie++]=re:(re-=65536,fe[ie++]=55296|re>>10&1023,fe[ie++]=56320|1023&re)}return fe.length!==ie&&(fe.subarray?fe=fe.subarray(0,ie):fe.length=ie),j.applyFromCharCode(fe)}(K=j.transformTo(U.uint8array?"uint8array":"array",K))},j.inherits(q,Y),q.prototype.processChunk=function(K){var te=j.transformTo(U.uint8array?"uint8array":"array",K.data);if(this.leftOver&&this.leftOver.length){if(U.uint8array){var ne=te;(te=new Uint8Array(ne.length+this.leftOver.length)).set(this.leftOver,0),te.set(ne,this.leftOver.length)}else te=this.leftOver.concat(te);this.leftOver=null}var ie=function(oe,le){var fe;for((le=le||oe.length)>oe.length&&(le=oe.length),fe=le-1;fe>=0&&(192&oe[fe])==128;)fe--;return fe<0||fe===0?le:fe+Q[oe[fe]]>le?fe:le}(te),re=te;ie!==te.length&&(U.uint8array?(re=te.subarray(0,ie),this.leftOver=te.subarray(ie,te.length)):(re=te.slice(0,ie),this.leftOver=te.slice(ie,te.length))),this.push({data:G.utf8decode(re),meta:K.meta})},q.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:G.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},G.Utf8DecodeWorker=q,j.inherits(J,Y),J.prototype.processChunk=function(K){this.push({data:G.utf8encode(K.data),meta:K.meta})},G.Utf8EncodeWorker=J},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(R,F,G){var j=R("./support"),U=R("./base64"),W=R("./nodejsUtils"),Y=R("./external");function Q(ne){return ne}function Z(ne,ie){for(var re=0;re1;)try{return q.stringifyByChunk(ne,re,ie)}catch{ie=Math.floor(ie/2)}return q.stringifyByChar(ne)}function K(ne,ie){for(var re=0;re1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var q,J;for(q=0;q0)this.isSignature(J,W.CENTRAL_FILE_HEADER)||(this.reader.zero=te);else if(te<0)throw new Error("Corrupted zip: missing "+Math.abs(te)+" bytes.")},prepareReader:function(q){this.reader=j(q)},load:function(q){this.prepareReader(q),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},F.exports=Z},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(R,F,G){var j=R("./reader/readerFor"),U=R("./utils"),W=R("./compressedObject"),Y=R("./crc32"),Q=R("./utf8"),Z=R("./compressions"),q=R("./support");function J(K,te){this.options=K,this.loadOptions=te}J.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(K){var te,ne;if(K.skip(22),this.fileNameLength=K.readInt(2),ne=K.readInt(2),this.fileName=K.readData(this.fileNameLength),K.skip(ne),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((te=function(ie){for(var re in Z)if(Z.hasOwnProperty(re)&&Z[re].magic===ie)return Z[re];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+U.pretty(this.compressionMethod)+" unknown (inner file : "+U.transformTo("string",this.fileName)+")");this.decompressed=new W(this.compressedSize,this.uncompressedSize,this.crc32,te,K.readData(this.compressedSize))},readCentralPart:function(K){this.versionMadeBy=K.readInt(2),K.skip(2),this.bitFlag=K.readInt(2),this.compressionMethod=K.readString(2),this.date=K.readDate(),this.crc32=K.readInt(4),this.compressedSize=K.readInt(4),this.uncompressedSize=K.readInt(4);var te=K.readInt(2);if(this.extraFieldsLength=K.readInt(2),this.fileCommentLength=K.readInt(2),this.diskNumberStart=K.readInt(2),this.internalFileAttributes=K.readInt(2),this.externalFileAttributes=K.readInt(4),this.localHeaderOffset=K.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");K.skip(te),this.readExtraFields(K),this.parseZIP64ExtraField(K),this.fileComment=K.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var K=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),K===0&&(this.dosPermissions=63&this.externalFileAttributes),K===3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(K){if(this.extraFields[1]){var te=j(this.extraFields[1].value);this.uncompressedSize===U.MAX_VALUE_32BITS&&(this.uncompressedSize=te.readInt(8)),this.compressedSize===U.MAX_VALUE_32BITS&&(this.compressedSize=te.readInt(8)),this.localHeaderOffset===U.MAX_VALUE_32BITS&&(this.localHeaderOffset=te.readInt(8)),this.diskNumberStart===U.MAX_VALUE_32BITS&&(this.diskNumberStart=te.readInt(4))}},readExtraFields:function(K){var te,ne,ie,re=K.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});K.index+40?te.windowBits=-te.windowBits:te.gzip&&te.windowBits>0&&te.windowBits<16&&(te.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Q,this.strm.avail_out=0;var ne=j.deflateInit2(this.strm,te.level,te.method,te.windowBits,te.memLevel,te.strategy);if(ne!==0)throw new Error(Y[ne]);if(te.header&&j.deflateSetHeader(this.strm,te.header),te.dictionary){var ie;if(ie=typeof te.dictionary=="string"?W.string2buf(te.dictionary):Z.call(te.dictionary)==="[object ArrayBuffer]"?new Uint8Array(te.dictionary):te.dictionary,(ne=j.deflateSetDictionary(this.strm,ie))!==0)throw new Error(Y[ne]);this._dict_set=!0}}function J(K,te){var ne=new q(te);if(ne.push(K,!0),ne.err)throw ne.msg||Y[ne.err];return ne.result}q.prototype.push=function(K,te){var ne,ie,re=this.strm,oe=this.options.chunkSize;if(this.ended)return!1;ie=te===~~te?te:te===!0?4:0,typeof K=="string"?re.input=W.string2buf(K):Z.call(K)==="[object ArrayBuffer]"?re.input=new Uint8Array(K):re.input=K,re.next_in=0,re.avail_in=re.input.length;do{if(re.avail_out===0&&(re.output=new U.Buf8(oe),re.next_out=0,re.avail_out=oe),(ne=j.deflate(re,ie))!==1&&ne!==0)return this.onEnd(ne),this.ended=!0,!1;re.avail_out!==0&&(re.avail_in!==0||ie!==4&&ie!==2)||(this.options.to==="string"?this.onData(W.buf2binstring(U.shrinkBuf(re.output,re.next_out))):this.onData(U.shrinkBuf(re.output,re.next_out)))}while((re.avail_in>0||re.avail_out===0)&&ne!==1);return ie===4?(ne=j.deflateEnd(this.strm),this.onEnd(ne),this.ended=!0,ne===0):ie!==2||(this.onEnd(0),re.avail_out=0,!0)},q.prototype.onData=function(K){this.chunks.push(K)},q.prototype.onEnd=function(K){K===0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=U.flattenChunks(this.chunks)),this.chunks=[],this.err=K,this.msg=this.strm.msg},G.Deflate=q,G.deflate=J,G.deflateRaw=function(K,te){return(te=te||{}).raw=!0,J(K,te)},G.gzip=function(K,te){return(te=te||{}).gzip=!0,J(K,te)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(R,F,G){var j=R("./zlib/inflate"),U=R("./utils/common"),W=R("./utils/strings"),Y=R("./zlib/constants"),Q=R("./zlib/messages"),Z=R("./zlib/zstream"),q=R("./zlib/gzheader"),J=Object.prototype.toString;function K(ne){if(!(this instanceof K))return new K(ne);this.options=U.assign({chunkSize:16384,windowBits:0,to:""},ne||{});var ie=this.options;ie.raw&&ie.windowBits>=0&&ie.windowBits<16&&(ie.windowBits=-ie.windowBits,ie.windowBits===0&&(ie.windowBits=-15)),!(ie.windowBits>=0&&ie.windowBits<16)||ne&&ne.windowBits||(ie.windowBits+=32),ie.windowBits>15&&ie.windowBits<48&&(15&ie.windowBits)==0&&(ie.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Z,this.strm.avail_out=0;var re=j.inflateInit2(this.strm,ie.windowBits);if(re!==Y.Z_OK)throw new Error(Q[re]);this.header=new q,j.inflateGetHeader(this.strm,this.header)}function te(ne,ie){var re=new K(ie);if(re.push(ne,!0),re.err)throw re.msg||Q[re.err];return re.result}K.prototype.push=function(ne,ie){var re,oe,le,fe,he,ge,ue=this.strm,me=this.options.chunkSize,be=this.options.dictionary,ve=!1;if(this.ended)return!1;oe=ie===~~ie?ie:ie===!0?Y.Z_FINISH:Y.Z_NO_FLUSH,typeof ne=="string"?ue.input=W.binstring2buf(ne):J.call(ne)==="[object ArrayBuffer]"?ue.input=new Uint8Array(ne):ue.input=ne,ue.next_in=0,ue.avail_in=ue.input.length;do{if(ue.avail_out===0&&(ue.output=new U.Buf8(me),ue.next_out=0,ue.avail_out=me),(re=j.inflate(ue,Y.Z_NO_FLUSH))===Y.Z_NEED_DICT&&be&&(ge=typeof be=="string"?W.string2buf(be):J.call(be)==="[object ArrayBuffer]"?new Uint8Array(be):be,re=j.inflateSetDictionary(this.strm,ge)),re===Y.Z_BUF_ERROR&&ve===!0&&(re=Y.Z_OK,ve=!1),re!==Y.Z_STREAM_END&&re!==Y.Z_OK)return this.onEnd(re),this.ended=!0,!1;ue.next_out&&(ue.avail_out!==0&&re!==Y.Z_STREAM_END&&(ue.avail_in!==0||oe!==Y.Z_FINISH&&oe!==Y.Z_SYNC_FLUSH)||(this.options.to==="string"?(le=W.utf8border(ue.output,ue.next_out),fe=ue.next_out-le,he=W.buf2string(ue.output,le),ue.next_out=fe,ue.avail_out=me-fe,fe&&U.arraySet(ue.output,ue.output,le,fe,0),this.onData(he)):this.onData(U.shrinkBuf(ue.output,ue.next_out)))),ue.avail_in===0&&ue.avail_out===0&&(ve=!0)}while((ue.avail_in>0||ue.avail_out===0)&&re!==Y.Z_STREAM_END);return re===Y.Z_STREAM_END&&(oe=Y.Z_FINISH),oe===Y.Z_FINISH?(re=j.inflateEnd(this.strm),this.onEnd(re),this.ended=!0,re===Y.Z_OK):oe!==Y.Z_SYNC_FLUSH||(this.onEnd(Y.Z_OK),ue.avail_out=0,!0)},K.prototype.onData=function(ne){this.chunks.push(ne)},K.prototype.onEnd=function(ne){ne===Y.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=U.flattenChunks(this.chunks)),this.chunks=[],this.err=ne,this.msg=this.strm.msg},G.Inflate=K,G.inflate=te,G.inflateRaw=function(ne,ie){return(ie=ie||{}).raw=!0,te(ne,ie)},G.ungzip=te},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(R,F,G){var j=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";G.assign=function(Y){for(var Q=Array.prototype.slice.call(arguments,1);Q.length;){var Z=Q.shift();if(Z){if(typeof Z!="object")throw new TypeError(Z+"must be non-object");for(var q in Z)Z.hasOwnProperty(q)&&(Y[q]=Z[q])}}return Y},G.shrinkBuf=function(Y,Q){return Y.length===Q?Y:Y.subarray?Y.subarray(0,Q):(Y.length=Q,Y)};var U={arraySet:function(Y,Q,Z,q,J){if(Q.subarray&&Y.subarray)Y.set(Q.subarray(Z,Z+q),J);else for(var K=0;K=252?6:Q>=248?5:Q>=240?4:Q>=224?3:Q>=192?2:1;function Z(q,J){if(J<65537&&(q.subarray&&W||!q.subarray&&U))return String.fromCharCode.apply(null,j.shrinkBuf(q,J));for(var K="",te=0;te>>6,J[ie++]=128|63&K):K<65536?(J[ie++]=224|K>>>12,J[ie++]=128|K>>>6&63,J[ie++]=128|63&K):(J[ie++]=240|K>>>18,J[ie++]=128|K>>>12&63,J[ie++]=128|K>>>6&63,J[ie++]=128|63&K);return J},G.buf2binstring=function(q){return Z(q,q.length)},G.binstring2buf=function(q){for(var J=new j.Buf8(q.length),K=0,te=J.length;K4)oe[te++]=65533,K+=ie-1;else{for(ne&=ie===2?31:ie===3?15:7;ie>1&&K1?oe[te++]=65533:ne<65536?oe[te++]=ne:(ne-=65536,oe[te++]=55296|ne>>10&1023,oe[te++]=56320|1023&ne)}return Z(oe,te)},G.utf8border=function(q,J){var K;for((J=J||q.length)>q.length&&(J=q.length),K=J-1;K>=0&&(192&q[K])==128;)K--;return K<0||K===0?J:K+Y[q[K]]>J?K:J}},{"./common":41}],43:[function(R,F,G){F.exports=function(j,U,W,Y){for(var Q=65535&j|0,Z=j>>>16&65535|0,q=0;W!==0;){W-=q=W>2e3?2e3:W;do Z=Z+(Q=Q+U[Y++]|0)|0;while(--q);Q%=65521,Z%=65521}return Q|Z<<16|0}},{}],44:[function(R,F,G){F.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(R,F,G){var j=function(){for(var U,W=[],Y=0;Y<256;Y++){U=Y;for(var Q=0;Q<8;Q++)U=1&U?3988292384^U>>>1:U>>>1;W[Y]=U}return W}();F.exports=function(U,W,Y,Q){var Z=j,q=Q+Y;U^=-1;for(var J=Q;J>>8^Z[255&(U^W[J])];return-1^U}},{}],46:[function(R,F,G){var j,U=R("../utils/common"),W=R("./trees"),Y=R("./adler32"),Q=R("./crc32"),Z=R("./messages");function q(pe,ye){return pe.msg=Z[ye],ye}function J(pe){return(pe<<1)-(pe>4?9:0)}function K(pe){for(var ye=pe.length;--ye>=0;)pe[ye]=0}function te(pe){var ye=pe.state,xe=ye.pending;xe>pe.avail_out&&(xe=pe.avail_out),xe!==0&&(U.arraySet(pe.output,ye.pending_buf,ye.pending_out,xe,pe.next_out),pe.next_out+=xe,ye.pending_out+=xe,pe.total_out+=xe,pe.avail_out-=xe,ye.pending-=xe,ye.pending===0&&(ye.pending_out=0))}function ne(pe,ye){W._tr_flush_block(pe,pe.block_start>=0?pe.block_start:-1,pe.strstart-pe.block_start,ye),pe.block_start=pe.strstart,te(pe.strm)}function ie(pe,ye){pe.pending_buf[pe.pending++]=ye}function re(pe,ye){pe.pending_buf[pe.pending++]=ye>>>8&255,pe.pending_buf[pe.pending++]=255&ye}function oe(pe,ye){var xe,ce,we=pe.max_chain_length,Be=pe.strstart,Ae=pe.prev_length,Te=pe.nice_match,Ne=pe.strstart>pe.w_size-262?pe.strstart-(pe.w_size-262):0,Pe=pe.window,Me=pe.w_mask,Se=pe.prev,Le=pe.strstart+258,ze=Pe[Be+Ae-1],ke=Pe[Be+Ae];pe.prev_length>=pe.good_match&&(we>>=2),Te>pe.lookahead&&(Te=pe.lookahead);do if(Pe[(xe=ye)+Ae]===ke&&Pe[xe+Ae-1]===ze&&Pe[xe]===Pe[Be]&&Pe[++xe]===Pe[Be+1]){Be+=2,xe++;do;while(Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&Pe[++Be]===Pe[++xe]&&BeAe){if(pe.match_start=ye,Ae=ce,ce>=Te)break;ze=Pe[Be+Ae-1],ke=Pe[Be+Ae]}}while((ye=Se[ye&Me])>Ne&&--we!=0);return Ae<=pe.lookahead?Ae:pe.lookahead}function le(pe){var ye,xe,ce,we,Be,Ae,Te,Ne,Pe,Me,Se=pe.w_size;do{if(we=pe.window_size-pe.lookahead-pe.strstart,pe.strstart>=Se+(Se-262)){U.arraySet(pe.window,pe.window,Se,Se,0),pe.match_start-=Se,pe.strstart-=Se,pe.block_start-=Se,ye=xe=pe.hash_size;do ce=pe.head[--ye],pe.head[ye]=ce>=Se?ce-Se:0;while(--xe);ye=xe=Se;do ce=pe.prev[--ye],pe.prev[ye]=ce>=Se?ce-Se:0;while(--xe);we+=Se}if(pe.strm.avail_in===0)break;if(Ae=pe.strm,Te=pe.window,Ne=pe.strstart+pe.lookahead,Pe=we,Me=void 0,(Me=Ae.avail_in)>Pe&&(Me=Pe),xe=Me===0?0:(Ae.avail_in-=Me,U.arraySet(Te,Ae.input,Ae.next_in,Me,Ne),Ae.state.wrap===1?Ae.adler=Y(Ae.adler,Te,Me,Ne):Ae.state.wrap===2&&(Ae.adler=Q(Ae.adler,Te,Me,Ne)),Ae.next_in+=Me,Ae.total_in+=Me,Me),pe.lookahead+=xe,pe.lookahead+pe.insert>=3)for(Be=pe.strstart-pe.insert,pe.ins_h=pe.window[Be],pe.ins_h=(pe.ins_h<=3&&(pe.ins_h=(pe.ins_h<=3)if(ce=W._tr_tally(pe,pe.strstart-pe.match_start,pe.match_length-3),pe.lookahead-=pe.match_length,pe.match_length<=pe.max_lazy_match&&pe.lookahead>=3){pe.match_length--;do pe.strstart++,pe.ins_h=(pe.ins_h<=3&&(pe.ins_h=(pe.ins_h<4096)&&(pe.match_length=2)),pe.prev_length>=3&&pe.match_length<=pe.prev_length){we=pe.strstart+pe.lookahead-3,ce=W._tr_tally(pe,pe.strstart-1-pe.prev_match,pe.prev_length-3),pe.lookahead-=pe.prev_length-1,pe.prev_length-=2;do++pe.strstart<=we&&(pe.ins_h=(pe.ins_h<15&&(Ae=2,ce-=16),we<1||we>9||xe!==8||ce<8||ce>15||ye<0||ye>9||Be<0||Be>4)return q(pe,-2);ce===8&&(ce=9);var Te=new ue;return pe.state=Te,Te.strm=pe,Te.wrap=Ae,Te.gzhead=null,Te.w_bits=ce,Te.w_size=1<pe.pending_buf_size-5&&(xe=pe.pending_buf_size-5);;){if(pe.lookahead<=1){if(le(pe),pe.lookahead===0&&ye===0)return 1;if(pe.lookahead===0)break}pe.strstart+=pe.lookahead,pe.lookahead=0;var ce=pe.block_start+xe;if((pe.strstart===0||pe.strstart>=ce)&&(pe.lookahead=pe.strstart-ce,pe.strstart=ce,ne(pe,!1),pe.strm.avail_out===0)||pe.strstart-pe.block_start>=pe.w_size-262&&(ne(pe,!1),pe.strm.avail_out===0))return 1}return pe.insert=0,ye===4?(ne(pe,!0),pe.strm.avail_out===0?3:4):(pe.strstart>pe.block_start&&(ne(pe,!1),pe.strm.avail_out),1)}),new ge(4,4,8,4,fe),new ge(4,5,16,8,fe),new ge(4,6,32,32,fe),new ge(4,4,16,16,he),new ge(8,16,32,32,he),new ge(8,16,128,128,he),new ge(8,32,128,256,he),new ge(32,128,258,1024,he),new ge(32,258,258,4096,he)],G.deflateInit=function(pe,ye){return ve(pe,ye,8,15,8,0)},G.deflateInit2=ve,G.deflateReset=be,G.deflateResetKeep=me,G.deflateSetHeader=function(pe,ye){return pe&&pe.state?pe.state.wrap!==2?-2:(pe.state.gzhead=ye,0):-2},G.deflate=function(pe,ye){var xe,ce,we,Be;if(!pe||!pe.state||ye>5||ye<0)return pe?q(pe,-2):-2;if(ce=pe.state,!pe.output||!pe.input&&pe.avail_in!==0||ce.status===666&&ye!==4)return q(pe,pe.avail_out===0?-5:-2);if(ce.strm=pe,xe=ce.last_flush,ce.last_flush=ye,ce.status===42)if(ce.wrap===2)pe.adler=0,ie(ce,31),ie(ce,139),ie(ce,8),ce.gzhead?(ie(ce,(ce.gzhead.text?1:0)+(ce.gzhead.hcrc?2:0)+(ce.gzhead.extra?4:0)+(ce.gzhead.name?8:0)+(ce.gzhead.comment?16:0)),ie(ce,255&ce.gzhead.time),ie(ce,ce.gzhead.time>>8&255),ie(ce,ce.gzhead.time>>16&255),ie(ce,ce.gzhead.time>>24&255),ie(ce,ce.level===9?2:ce.strategy>=2||ce.level<2?4:0),ie(ce,255&ce.gzhead.os),ce.gzhead.extra&&ce.gzhead.extra.length&&(ie(ce,255&ce.gzhead.extra.length),ie(ce,ce.gzhead.extra.length>>8&255)),ce.gzhead.hcrc&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending,0)),ce.gzindex=0,ce.status=69):(ie(ce,0),ie(ce,0),ie(ce,0),ie(ce,0),ie(ce,0),ie(ce,ce.level===9?2:ce.strategy>=2||ce.level<2?4:0),ie(ce,3),ce.status=113);else{var Ae=8+(ce.w_bits-8<<4)<<8;Ae|=(ce.strategy>=2||ce.level<2?0:ce.level<6?1:ce.level===6?2:3)<<6,ce.strstart!==0&&(Ae|=32),Ae+=31-Ae%31,ce.status=113,re(ce,Ae),ce.strstart!==0&&(re(ce,pe.adler>>>16),re(ce,65535&pe.adler)),pe.adler=1}if(ce.status===69)if(ce.gzhead.extra){for(we=ce.pending;ce.gzindex<(65535&ce.gzhead.extra.length)&&(ce.pending!==ce.pending_buf_size||(ce.gzhead.hcrc&&ce.pending>we&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending-we,we)),te(pe),we=ce.pending,ce.pending!==ce.pending_buf_size));)ie(ce,255&ce.gzhead.extra[ce.gzindex]),ce.gzindex++;ce.gzhead.hcrc&&ce.pending>we&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending-we,we)),ce.gzindex===ce.gzhead.extra.length&&(ce.gzindex=0,ce.status=73)}else ce.status=73;if(ce.status===73)if(ce.gzhead.name){we=ce.pending;do{if(ce.pending===ce.pending_buf_size&&(ce.gzhead.hcrc&&ce.pending>we&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending-we,we)),te(pe),we=ce.pending,ce.pending===ce.pending_buf_size)){Be=1;break}Be=ce.gzindexwe&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending-we,we)),Be===0&&(ce.gzindex=0,ce.status=91)}else ce.status=91;if(ce.status===91)if(ce.gzhead.comment){we=ce.pending;do{if(ce.pending===ce.pending_buf_size&&(ce.gzhead.hcrc&&ce.pending>we&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending-we,we)),te(pe),we=ce.pending,ce.pending===ce.pending_buf_size)){Be=1;break}Be=ce.gzindexwe&&(pe.adler=Q(pe.adler,ce.pending_buf,ce.pending-we,we)),Be===0&&(ce.status=103)}else ce.status=103;if(ce.status===103&&(ce.gzhead.hcrc?(ce.pending+2>ce.pending_buf_size&&te(pe),ce.pending+2<=ce.pending_buf_size&&(ie(ce,255&pe.adler),ie(ce,pe.adler>>8&255),pe.adler=0,ce.status=113)):ce.status=113),ce.pending!==0){if(te(pe),pe.avail_out===0)return ce.last_flush=-1,0}else if(pe.avail_in===0&&J(ye)<=J(xe)&&ye!==4)return q(pe,-5);if(ce.status===666&&pe.avail_in!==0)return q(pe,-5);if(pe.avail_in!==0||ce.lookahead!==0||ye!==0&&ce.status!==666){var Te=ce.strategy===2?function(Ne,Pe){for(var Me;;){if(Ne.lookahead===0&&(le(Ne),Ne.lookahead===0)){if(Pe===0)return 1;break}if(Ne.match_length=0,Me=W._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,Me&&(ne(Ne,!1),Ne.strm.avail_out===0))return 1}return Ne.insert=0,Pe===4?(ne(Ne,!0),Ne.strm.avail_out===0?3:4):Ne.last_lit&&(ne(Ne,!1),Ne.strm.avail_out===0)?1:2}(ce,ye):ce.strategy===3?function(Ne,Pe){for(var Me,Se,Le,ze,ke=Ne.window;;){if(Ne.lookahead<=258){if(le(Ne),Ne.lookahead<=258&&Pe===0)return 1;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=3&&Ne.strstart>0&&(Se=ke[Le=Ne.strstart-1])===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]){ze=Ne.strstart+258;do;while(Se===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]&&Se===ke[++Le]&&LeNe.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=3?(Me=W._tr_tally(Ne,1,Ne.match_length-3),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(Me=W._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),Me&&(ne(Ne,!1),Ne.strm.avail_out===0))return 1}return Ne.insert=0,Pe===4?(ne(Ne,!0),Ne.strm.avail_out===0?3:4):Ne.last_lit&&(ne(Ne,!1),Ne.strm.avail_out===0)?1:2}(ce,ye):j[ce.level].func(ce,ye);if(Te!==3&&Te!==4||(ce.status=666),Te===1||Te===3)return pe.avail_out===0&&(ce.last_flush=-1),0;if(Te===2&&(ye===1?W._tr_align(ce):ye!==5&&(W._tr_stored_block(ce,0,0,!1),ye===3&&(K(ce.head),ce.lookahead===0&&(ce.strstart=0,ce.block_start=0,ce.insert=0))),te(pe),pe.avail_out===0))return ce.last_flush=-1,0}return ye!==4?0:ce.wrap<=0?1:(ce.wrap===2?(ie(ce,255&pe.adler),ie(ce,pe.adler>>8&255),ie(ce,pe.adler>>16&255),ie(ce,pe.adler>>24&255),ie(ce,255&pe.total_in),ie(ce,pe.total_in>>8&255),ie(ce,pe.total_in>>16&255),ie(ce,pe.total_in>>24&255)):(re(ce,pe.adler>>>16),re(ce,65535&pe.adler)),te(pe),ce.wrap>0&&(ce.wrap=-ce.wrap),ce.pending!==0?0:1)},G.deflateEnd=function(pe){var ye;return pe&&pe.state?(ye=pe.state.status)!==42&&ye!==69&&ye!==73&&ye!==91&&ye!==103&&ye!==113&&ye!==666?q(pe,-2):(pe.state=null,ye===113?q(pe,-3):0):-2},G.deflateSetDictionary=function(pe,ye){var xe,ce,we,Be,Ae,Te,Ne,Pe,Me=ye.length;if(!pe||!pe.state||(Be=(xe=pe.state).wrap)===2||Be===1&&xe.status!==42||xe.lookahead)return-2;for(Be===1&&(pe.adler=Y(pe.adler,ye,Me,0)),xe.wrap=0,Me>=xe.w_size&&(Be===0&&(K(xe.head),xe.strstart=0,xe.block_start=0,xe.insert=0),Pe=new U.Buf8(xe.w_size),U.arraySet(Pe,ye,Me-xe.w_size,xe.w_size,0),ye=Pe,Me=xe.w_size),Ae=pe.avail_in,Te=pe.next_in,Ne=pe.input,pe.avail_in=Me,pe.next_in=0,pe.input=ye,le(xe);xe.lookahead>=3;){ce=xe.strstart,we=xe.lookahead-2;do xe.ins_h=(xe.ins_h<>>=be=me>>>24,le-=be,(be=me>>>16&255)===0)we[Z++]=65535&me;else{if(!(16&be)){if((64&be)==0){me=fe[(65535&me)+(oe&(1<>>=be,le-=be),le<15&&(oe+=ce[Y++]<>>=be=me>>>24,le-=be,!(16&(be=me>>>16&255))){if((64&be)==0){me=he[(65535&me)+(oe&(1<K){j.msg="invalid distance too far back",W.mode=30;break e}if(oe>>>=be,le-=be,pe>(be=Z-q)){if((be=pe-be)>ne&&W.sane){j.msg="invalid distance too far back",W.mode=30;break e}if(ye=0,xe=re,ie===0){if(ye+=te-be,be2;)we[Z++]=xe[ye++],we[Z++]=xe[ye++],we[Z++]=xe[ye++],ve-=3;ve&&(we[Z++]=xe[ye++],ve>1&&(we[Z++]=xe[ye++]))}else{ye=Z-pe;do we[Z++]=we[ye++],we[Z++]=we[ye++],we[Z++]=we[ye++],ve-=3;while(ve>2);ve&&(we[Z++]=we[ye++],ve>1&&(we[Z++]=we[ye++]))}break}}break}}while(Y>3,oe&=(1<<(le-=ve<<3))-1,j.next_in=Y,j.next_out=Z,j.avail_in=Y>>24&255)+(he>>>8&65280)+((65280&he)<<8)+((255&he)<<24)}function q(){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 j.Buf16(320),this.work=new j.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function J(he){var ge;return he&&he.state?(ge=he.state,he.total_in=he.total_out=ge.total=0,he.msg="",ge.wrap&&(he.adler=1&ge.wrap),ge.mode=1,ge.last=0,ge.havedict=0,ge.dmax=32768,ge.head=null,ge.hold=0,ge.bits=0,ge.lencode=ge.lendyn=new j.Buf32(852),ge.distcode=ge.distdyn=new j.Buf32(592),ge.sane=1,ge.back=-1,0):-2}function K(he){var ge;return he&&he.state?((ge=he.state).wsize=0,ge.whave=0,ge.wnext=0,J(he)):-2}function te(he,ge){var ue,me;return he&&he.state?(me=he.state,ge<0?(ue=0,ge=-ge):(ue=1+(ge>>4),ge<48&&(ge&=15)),ge&&(ge<8||ge>15)?-2:(me.window!==null&&me.wbits!==ge&&(me.window=null),me.wrap=ue,me.wbits=ge,K(he))):-2}function ne(he,ge){var ue,me;return he?(me=new q,he.state=me,me.window=null,(ue=te(he,ge))!==0&&(he.state=null),ue):-2}var ie,re,oe=!0;function le(he){if(oe){var ge;for(ie=new j.Buf32(512),re=new j.Buf32(32),ge=0;ge<144;)he.lens[ge++]=8;for(;ge<256;)he.lens[ge++]=9;for(;ge<280;)he.lens[ge++]=7;for(;ge<288;)he.lens[ge++]=8;for(Q(1,he.lens,0,288,ie,0,he.work,{bits:9}),ge=0;ge<32;)he.lens[ge++]=5;Q(2,he.lens,0,32,re,0,he.work,{bits:5}),oe=!1}he.lencode=ie,he.lenbits=9,he.distcode=re,he.distbits=5}function fe(he,ge,ue,me){var be,ve=he.state;return ve.window===null&&(ve.wsize=1<=ve.wsize?(j.arraySet(ve.window,ge,ue-ve.wsize,ve.wsize,0),ve.wnext=0,ve.whave=ve.wsize):((be=ve.wsize-ve.wnext)>me&&(be=me),j.arraySet(ve.window,ge,ue-me,be,ve.wnext),(me-=be)?(j.arraySet(ve.window,ge,ue-me,me,0),ve.wnext=me,ve.whave=ve.wsize):(ve.wnext+=be,ve.wnext===ve.wsize&&(ve.wnext=0),ve.whave>>8&255,ue.check=W(ue.check,ft,2,0),ce=0,we=0,ue.mode=2;break}if(ue.flags=0,ue.head&&(ue.head.done=!1),!(1&ue.wrap)||(((255&ce)<<8)+(ce>>8))%31){he.msg="incorrect header check",ue.mode=30;break}if((15&ce)!=8){he.msg="unknown compression method",ue.mode=30;break}if(we-=4,We=8+(15&(ce>>>=4)),ue.wbits===0)ue.wbits=We;else if(We>ue.wbits){he.msg="invalid window size",ue.mode=30;break}ue.dmax=1<>8&1),512&ue.flags&&(ft[0]=255&ce,ft[1]=ce>>>8&255,ue.check=W(ue.check,ft,2,0)),ce=0,we=0,ue.mode=3;case 3:for(;we<32;){if(ye===0)break e;ye--,ce+=me[ve++]<>>8&255,ft[2]=ce>>>16&255,ft[3]=ce>>>24&255,ue.check=W(ue.check,ft,4,0)),ce=0,we=0,ue.mode=4;case 4:for(;we<16;){if(ye===0)break e;ye--,ce+=me[ve++]<>8),512&ue.flags&&(ft[0]=255&ce,ft[1]=ce>>>8&255,ue.check=W(ue.check,ft,2,0)),ce=0,we=0,ue.mode=5;case 5:if(1024&ue.flags){for(;we<16;){if(ye===0)break e;ye--,ce+=me[ve++]<>>8&255,ue.check=W(ue.check,ft,2,0)),ce=0,we=0}else ue.head&&(ue.head.extra=null);ue.mode=6;case 6:if(1024&ue.flags&&((Te=ue.length)>ye&&(Te=ye),Te&&(ue.head&&(We=ue.head.extra_len-ue.length,ue.head.extra||(ue.head.extra=new Array(ue.head.extra_len)),j.arraySet(ue.head.extra,me,ve,Te,We)),512&ue.flags&&(ue.check=W(ue.check,me,Te,ve)),ye-=Te,ve+=Te,ue.length-=Te),ue.length))break e;ue.length=0,ue.mode=7;case 7:if(2048&ue.flags){if(ye===0)break e;Te=0;do We=me[ve+Te++],ue.head&&We&&ue.length<65536&&(ue.head.name+=String.fromCharCode(We));while(We&&Te>9&1,ue.head.done=!0),he.adler=ue.check=0,ue.mode=12;break;case 10:for(;we<32;){if(ye===0)break e;ye--,ce+=me[ve++]<>>=7&we,we-=7&we,ue.mode=27;break}for(;we<3;){if(ye===0)break e;ye--,ce+=me[ve++]<>>=1)){case 0:ue.mode=14;break;case 1:if(le(ue),ue.mode=20,ge===6){ce>>>=2,we-=2;break e}break;case 2:ue.mode=17;break;case 3:he.msg="invalid block type",ue.mode=30}ce>>>=2,we-=2;break;case 14:for(ce>>>=7&we,we-=7&we;we<32;){if(ye===0)break e;ye--,ce+=me[ve++]<>>16^65535)){he.msg="invalid stored block lengths",ue.mode=30;break}if(ue.length=65535&ce,ce=0,we=0,ue.mode=15,ge===6)break e;case 15:ue.mode=16;case 16:if(Te=ue.length){if(Te>ye&&(Te=ye),Te>xe&&(Te=xe),Te===0)break e;j.arraySet(be,me,ve,Te,pe),ye-=Te,ve+=Te,xe-=Te,pe+=Te,ue.length-=Te;break}ue.mode=12;break;case 17:for(;we<14;){if(ye===0)break e;ye--,ce+=me[ve++]<>>=5,we-=5,ue.ndist=1+(31&ce),ce>>>=5,we-=5,ue.ncode=4+(15&ce),ce>>>=4,we-=4,ue.nlen>286||ue.ndist>30){he.msg="too many length or distance symbols",ue.mode=30;break}ue.have=0,ue.mode=18;case 18:for(;ue.have>>=3,we-=3}for(;ue.have<19;)ue.lens[lt[ue.have++]]=0;if(ue.lencode=ue.lendyn,ue.lenbits=7,Ye={bits:ue.lenbits},Ve=Q(0,ue.lens,0,19,ue.lencode,0,ue.work,Ye),ue.lenbits=Ye.bits,Ve){he.msg="invalid code lengths set",ue.mode=30;break}ue.have=0,ue.mode=19;case 19:for(;ue.have>>16&255,Le=65535&ot,!((Me=ot>>>24)<=we);){if(ye===0)break e;ye--,ce+=me[ve++]<>>=Me,we-=Me,ue.lens[ue.have++]=Le;else{if(Le===16){for(et=Me+2;we>>=Me,we-=Me,ue.have===0){he.msg="invalid bit length repeat",ue.mode=30;break}We=ue.lens[ue.have-1],Te=3+(3&ce),ce>>>=2,we-=2}else if(Le===17){for(et=Me+3;we>>=Me)),ce>>>=3,we-=3}else{for(et=Me+7;we>>=Me)),ce>>>=7,we-=7}if(ue.have+Te>ue.nlen+ue.ndist){he.msg="invalid bit length repeat",ue.mode=30;break}for(;Te--;)ue.lens[ue.have++]=We}}if(ue.mode===30)break;if(ue.lens[256]===0){he.msg="invalid code -- missing end-of-block",ue.mode=30;break}if(ue.lenbits=9,Ye={bits:ue.lenbits},Ve=Q(1,ue.lens,0,ue.nlen,ue.lencode,0,ue.work,Ye),ue.lenbits=Ye.bits,Ve){he.msg="invalid literal/lengths set",ue.mode=30;break}if(ue.distbits=6,ue.distcode=ue.distdyn,Ye={bits:ue.distbits},Ve=Q(2,ue.lens,ue.nlen,ue.ndist,ue.distcode,0,ue.work,Ye),ue.distbits=Ye.bits,Ve){he.msg="invalid distances set",ue.mode=30;break}if(ue.mode=20,ge===6)break e;case 20:ue.mode=21;case 21:if(ye>=6&&xe>=258){he.next_out=pe,he.avail_out=xe,he.next_in=ve,he.avail_in=ye,ue.hold=ce,ue.bits=we,Y(he,Ae),pe=he.next_out,be=he.output,xe=he.avail_out,ve=he.next_in,me=he.input,ye=he.avail_in,ce=ue.hold,we=ue.bits,ue.mode===12&&(ue.back=-1);break}for(ue.back=0;Se=(ot=ue.lencode[ce&(1<>>16&255,Le=65535&ot,!((Me=ot>>>24)<=we);){if(ye===0)break e;ye--,ce+=me[ve++]<>ze)])>>>16&255,Le=65535&ot,!(ze+(Me=ot>>>24)<=we);){if(ye===0)break e;ye--,ce+=me[ve++]<>>=ze,we-=ze,ue.back+=ze}if(ce>>>=Me,we-=Me,ue.back+=Me,ue.length=Le,Se===0){ue.mode=26;break}if(32&Se){ue.back=-1,ue.mode=12;break}if(64&Se){he.msg="invalid literal/length code",ue.mode=30;break}ue.extra=15&Se,ue.mode=22;case 22:if(ue.extra){for(et=ue.extra;we>>=ue.extra,we-=ue.extra,ue.back+=ue.extra}ue.was=ue.length,ue.mode=23;case 23:for(;Se=(ot=ue.distcode[ce&(1<>>16&255,Le=65535&ot,!((Me=ot>>>24)<=we);){if(ye===0)break e;ye--,ce+=me[ve++]<>ze)])>>>16&255,Le=65535&ot,!(ze+(Me=ot>>>24)<=we);){if(ye===0)break e;ye--,ce+=me[ve++]<>>=ze,we-=ze,ue.back+=ze}if(ce>>>=Me,we-=Me,ue.back+=Me,64&Se){he.msg="invalid distance code",ue.mode=30;break}ue.offset=Le,ue.extra=15&Se,ue.mode=24;case 24:if(ue.extra){for(et=ue.extra;we>>=ue.extra,we-=ue.extra,ue.back+=ue.extra}if(ue.offset>ue.dmax){he.msg="invalid distance too far back",ue.mode=30;break}ue.mode=25;case 25:if(xe===0)break e;if(Te=Ae-xe,ue.offset>Te){if((Te=ue.offset-Te)>ue.whave&&ue.sane){he.msg="invalid distance too far back",ue.mode=30;break}Te>ue.wnext?(Te-=ue.wnext,Ne=ue.wsize-Te):Ne=ue.wnext-Te,Te>ue.length&&(Te=ue.length),Pe=ue.window}else Pe=be,Ne=pe-ue.offset,Te=ue.length;Te>xe&&(Te=xe),xe-=Te,ue.length-=Te;do be[pe++]=Pe[Ne++];while(--Te);ue.length===0&&(ue.mode=21);break;case 26:if(xe===0)break e;be[pe++]=ue.length,xe--,ue.mode=21;break;case 27:if(ue.wrap){for(;we<32;){if(ye===0)break e;ye--,ce|=me[ve++]<=1&&ze[we]===0;we--);if(Be>we&&(Be=we),we===0)return te[ne++]=20971520,te[ne++]=20971520,re.bits=1,0;for(ce=1;ce0&&(Z===0||we!==1))return-1;for(ke[1]=0,ye=1;ye<15;ye++)ke[ye+1]=ke[ye]+ze[ye];for(xe=0;xe852||Z===2&&Pe>592)return 1;for(;;){me=ye-Te,ie[xe]ue?(be=Ge[We+ie[xe]],ve=Se[Le+ie[xe]]):(be=96,ve=0),oe=1<>Te)+(le-=oe)]=me<<24|be<<16|ve|0;while(le!==0);for(oe=1<>=1;if(oe!==0?(Me&=oe-1,Me+=oe):Me=0,xe++,--ze[ye]==0){if(ye===we)break;ye=q[J+ie[xe]]}if(ye>Be&&(Me&he)!==fe){for(Te===0&&(Te=Be),ge+=ce,Ne=1<<(Ae=ye-Te);Ae+Te852||Z===2&&Pe>592)return 1;te[fe=Me&he]=Be<<24|Ae<<16|ge-ne|0}}return Me!==0&&(te[ge+Me]=ye-Te<<24|64<<16|0),re.bits=Be,0}},{"../utils/common":41}],51:[function(R,F,G){F.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(R,F,G){var j=R("../utils/common");function U(Se){for(var Le=Se.length;--Le>=0;)Se[Le]=0}var W=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Y=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(576);U(q);var J=new Array(60);U(J);var K=new Array(512);U(K);var te=new Array(256);U(te);var ne=new Array(29);U(ne);var ie,re,oe,le=new Array(30);function fe(Se,Le,ze,ke,Ge){this.static_tree=Se,this.extra_bits=Le,this.extra_base=ze,this.elems=ke,this.max_length=Ge,this.has_stree=Se&&Se.length}function he(Se,Le){this.dyn_tree=Se,this.max_code=0,this.stat_desc=Le}function ge(Se){return Se<256?K[Se]:K[256+(Se>>>7)]}function ue(Se,Le){Se.pending_buf[Se.pending++]=255&Le,Se.pending_buf[Se.pending++]=Le>>>8&255}function me(Se,Le,ze){Se.bi_valid>16-ze?(Se.bi_buf|=Le<>16-Se.bi_valid,Se.bi_valid+=ze-16):(Se.bi_buf|=Le<>>=1,ze<<=1;while(--Le>0);return ze>>>1}function pe(Se,Le,ze){var ke,Ge,We=new Array(16),Ve=0;for(ke=1;ke<=15;ke++)We[ke]=Ve=Ve+ze[ke-1]<<1;for(Ge=0;Ge<=Le;Ge++){var Ye=Se[2*Ge+1];Ye!==0&&(Se[2*Ge]=ve(We[Ye]++,Ye))}}function ye(Se){var Le;for(Le=0;Le<286;Le++)Se.dyn_ltree[2*Le]=0;for(Le=0;Le<30;Le++)Se.dyn_dtree[2*Le]=0;for(Le=0;Le<19;Le++)Se.bl_tree[2*Le]=0;Se.dyn_ltree[512]=1,Se.opt_len=Se.static_len=0,Se.last_lit=Se.matches=0}function xe(Se){Se.bi_valid>8?ue(Se,Se.bi_buf):Se.bi_valid>0&&(Se.pending_buf[Se.pending++]=Se.bi_buf),Se.bi_buf=0,Se.bi_valid=0}function ce(Se,Le,ze,ke){var Ge=2*Le,We=2*ze;return Se[Ge]>1;ze>=1;ze--)we(Se,We,ze);Ge=et;do ze=Se.heap[1],Se.heap[1]=Se.heap[Se.heap_len--],we(Se,We,1),ke=Se.heap[1],Se.heap[--Se.heap_max]=ze,Se.heap[--Se.heap_max]=ke,We[2*Ge]=We[2*ze]+We[2*ke],Se.depth[Ge]=(Se.depth[ze]>=Se.depth[ke]?Se.depth[ze]:Se.depth[ke])+1,We[2*ze+1]=We[2*ke+1]=Ge,Se.heap[1]=Ge++,we(Se,We,1);while(Se.heap_len>=2);Se.heap[--Se.heap_max]=Se.heap[1],function(ft,lt){var _e,Xe,Qe,Fe,Re,He,Je=lt.dyn_tree,tt=lt.max_code,qe=lt.stat_desc.static_tree,rt=lt.stat_desc.has_stree,dt=lt.stat_desc.extra_bits,ut=lt.stat_desc.extra_base,yt=lt.stat_desc.max_length,Et=0;for(Fe=0;Fe<=15;Fe++)ft.bl_count[Fe]=0;for(Je[2*ft.heap[ft.heap_max]+1]=0,_e=ft.heap_max+1;_e<573;_e++)(Fe=Je[2*Je[2*(Xe=ft.heap[_e])+1]+1]+1)>yt&&(Fe=yt,Et++),Je[2*Xe+1]=Fe,Xe>tt||(ft.bl_count[Fe]++,Re=0,Xe>=ut&&(Re=dt[Xe-ut]),He=Je[2*Xe],ft.opt_len+=He*(Fe+Re),rt&&(ft.static_len+=He*(qe[2*Xe+1]+Re)));if(Et!==0){do{for(Fe=yt-1;ft.bl_count[Fe]===0;)Fe--;ft.bl_count[Fe]--,ft.bl_count[Fe+1]+=2,ft.bl_count[yt]--,Et-=2}while(Et>0);for(Fe=yt;Fe!==0;Fe--)for(Xe=ft.bl_count[Fe];Xe!==0;)(Qe=ft.heap[--_e])>tt||(Je[2*Qe+1]!==Fe&&(ft.opt_len+=(Fe-Je[2*Qe+1])*Je[2*Qe],Je[2*Qe+1]=Fe),Xe--)}}(Se,Le),pe(We,ot,Se.bl_count)}function Te(Se,Le,ze){var ke,Ge,We=-1,Ve=Le[1],Ye=0,et=7,ot=4;for(Ve===0&&(et=138,ot=3),Le[2*(ze+1)+1]=65535,ke=0;ke<=ze;ke++)Ge=Ve,Ve=Le[2*(ke+1)+1],++Ye>=7;Ge<30;Ge++)for(le[Ge]=We<<7,Le=0;Le<1<0?(Se.strm.data_type===2&&(Se.strm.data_type=function(Ye){var et,ot=4093624447;for(et=0;et<=31;et++,ot>>>=1)if(1&ot&&Ye.dyn_ltree[2*et]!==0)return 0;if(Ye.dyn_ltree[18]!==0||Ye.dyn_ltree[20]!==0||Ye.dyn_ltree[26]!==0)return 1;for(et=32;et<256;et++)if(Ye.dyn_ltree[2*et]!==0)return 1;return 0}(Se)),Ae(Se,Se.l_desc),Ae(Se,Se.d_desc),Ve=function(Ye){var et;for(Te(Ye,Ye.dyn_ltree,Ye.l_desc.max_code),Te(Ye,Ye.dyn_dtree,Ye.d_desc.max_code),Ae(Ye,Ye.bl_desc),et=18;et>=3&&Ye.bl_tree[2*Z[et]+1]===0;et--);return Ye.opt_len+=3*(et+1)+5+5+4,et}(Se),Ge=Se.opt_len+3+7>>>3,(We=Se.static_len+3+7>>>3)<=Ge&&(Ge=We)):Ge=We=ze+5,ze+4<=Ge&&Le!==-1?Me(Se,Le,ze,ke):Se.strategy===4||We===Ge?(me(Se,2+(ke?1:0),3),Be(Se,q,J)):(me(Se,4+(ke?1:0),3),function(Ye,et,ot,ft){var lt;for(me(Ye,et-257,5),me(Ye,ot-1,5),me(Ye,ft-4,4),lt=0;lt>>8&255,Se.pending_buf[Se.d_buf+2*Se.last_lit+1]=255&Le,Se.pending_buf[Se.l_buf+Se.last_lit]=255&ze,Se.last_lit++,Le===0?Se.dyn_ltree[2*ze]++:(Se.matches++,Le--,Se.dyn_ltree[2*(te[ze]+256+1)]++,Se.dyn_dtree[2*ge(Le)]++),Se.last_lit===Se.lit_bufsize-1},G._tr_align=function(Se){me(Se,2,3),be(Se,256,q),function(Le){Le.bi_valid===16?(ue(Le,Le.bi_buf),Le.bi_buf=0,Le.bi_valid=0):Le.bi_valid>=8&&(Le.pending_buf[Le.pending++]=255&Le.bi_buf,Le.bi_buf>>=8,Le.bi_valid-=8)}(Se)}},{"../utils/common":41}],53:[function(R,F,G){F.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(R,F,G){(function(j){(function(U,W){if(!U.setImmediate){var Y,Q,Z,q,J,K=1,te={},ne=!1,ie=U.document,re=Object.getPrototypeOf&&Object.getPrototypeOf(U);re=re&&re.setTimeout?re:U,{}.toString.call(U.process)==="[object process]"?Y=function(fe){process.nextTick(function(){le(fe)})}:function(){if(U.postMessage&&!U.importScripts){var fe=!0,he=U.onmessage;return U.onmessage=function(){fe=!1},U.postMessage("","*"),U.onmessage=he,fe}}()?(q="setImmediate$"+Math.random()+"$",J=function(fe){fe.source===U&&typeof fe.data=="string"&&fe.data.indexOf(q)===0&&le(+fe.data.slice(q.length))},U.addEventListener?U.addEventListener("message",J,!1):U.attachEvent("onmessage",J),Y=function(fe){U.postMessage(q+fe,"*")}):U.MessageChannel?((Z=new MessageChannel).port1.onmessage=function(fe){le(fe.data)},Y=function(fe){Z.port2.postMessage(fe)}):ie&&"onreadystatechange"in ie.createElement("script")?(Q=ie.documentElement,Y=function(fe){var he=ie.createElement("script");he.onreadystatechange=function(){le(fe),he.onreadystatechange=null,Q.removeChild(he),he=null},Q.appendChild(he)}):Y=function(fe){setTimeout(le,0,fe)},re.setImmediate=function(fe){typeof fe!="function"&&(fe=new Function(""+fe));for(var he=new Array(arguments.length-1),ge=0;ge{const F=new XMLHttpRequest;F.open("GET",B,!0),F.responseType="arraybuffer",F.send(),F.onreadystatechange=function(){F.readyState==4&&F.status==200&&jszip.loadAsync(F.response).then(G=>{G.file("manifest.json").async("string").then(j=>{const U=JSON.parse(j);if(!("animations"in U))throw new Error("Manifest not found");if(U.animations.length===0)throw new Error("No animations listed in the manifest");const W=U.animations[0];G.file("animations/".concat(W.id,".json")).async("string").then(Y=>{const Q=JSON.parse(Y);"assets"in Q&&Promise.all(Q.assets.map(Z=>{if(Z.p&&G.file("images/".concat(Z.p))!=null)return new Promise(q=>{const J=Z.p.split(".").pop();G.file("images/".concat(Z.p)).async("base64").then(K=>{Z.p=J==="svg"||J==="svg+xml"?"data:image/svg+xml;base64,"+K:"data:;base64,"+K,Z.e=1,q()})})})).then(()=>{D(Q)})})})}).catch(G=>{R(G)})}})}(function(B){B.Loading="loading",B.Playing="playing",B.Paused="paused",B.Stopped="stopped",B.Frozen="frozen",B.Error="error"})(PlayerState||(PlayerState={})),function(B){B.Normal="normal",B.Bounce="bounce"}(PlayMode||(PlayMode={})),function(B){B.Load="load",B.Error="error",B.Ready="ready",B.Play="play",B.Pause="pause",B.Stop="stop",B.Freeze="freeze",B.Loop="loop",B.Complete="complete",B.Frame="frame"}(PlayerEvents||(PlayerEvents={}));let DotLottiePlayer=class extends s$4{constructor(){super(...arguments),this.mode=PlayMode.Normal,this.autoplay=!1,this.background="transparent",this.controls=!1,this.direction=1,this.hover=!1,this.loop=!1,this.renderer="svg",this.speed=1,this.currentState=PlayerState.Loading,this.intermission=1,this._counter=0}_onVisibilityChange(){document.hidden&&this.currentState===PlayerState.Playing?this.freeze():this.currentState===PlayerState.Frozen&&this.play()}_handleSeekChange(B){if(!this._lottie||isNaN(B.target.value))return;const D=B.target.value/100*this._lottie.totalFrames;this.seek(D)}async load(B){if(!this.shadowRoot)return;const D={container:this.container,loop:!1,autoplay:!1,renderer:this.renderer,rendererSettings:{scaleMode:"noScale",clearCanvas:!1,progressiveLoad:!0,hideOnTransparent:!0}};try{const R=await fetchPath(B);this._lottie&&this._lottie.destroy(),this._lottie=lottie_svg.loadAnimation(Object.assign(Object.assign({},D),{animationData:R}))}catch{return this.currentState=PlayerState.Error,void this.dispatchEvent(new CustomEvent(PlayerEvents.Error))}this._lottie&&(this._lottie.addEventListener("enterFrame",()=>{this.seeker=this._lottie.currentFrame/this._lottie.totalFrames*100,this.dispatchEvent(new CustomEvent(PlayerEvents.Frame,{detail:{frame:this._lottie.currentFrame,seeker:this.seeker}}))}),this._lottie.addEventListener("complete",()=>{this.currentState===PlayerState.Playing?!this.loop||this.count&&this._counter>=this.count?this.dispatchEvent(new CustomEvent(PlayerEvents.Complete)):this.mode===PlayMode.Bounce?(this.count&&(this._counter+=.5),setTimeout(()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Loop)),this.currentState===PlayerState.Playing&&(this._lottie.setDirection(-1*this._lottie.playDirection),this._lottie.play())},this.intermission)):(this.count&&(this._counter+=1),window.setTimeout(()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Loop)),this.currentState===PlayerState.Playing&&(this._lottie.stop(),this._lottie.play())},this.intermission)):this.dispatchEvent(new CustomEvent(PlayerEvents.Complete))}),this._lottie.addEventListener("DOMLoaded",()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Ready))}),this._lottie.addEventListener("data_ready",()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Load))}),this._lottie.addEventListener("data_failed",()=>{this.currentState=PlayerState.Error,this.dispatchEvent(new CustomEvent(PlayerEvents.Error))}),this.container.addEventListener("mouseenter",()=>{this.hover&&this.currentState!==PlayerState.Playing&&this.play()}),this.container.addEventListener("mouseleave",()=>{this.hover&&this.currentState===PlayerState.Playing&&this.stop()}),this.setSpeed(this.speed),this.setDirection(this.direction),this.autoplay&&this.play())}getLottie(){return this._lottie}play(){this._lottie&&(this._lottie.play(),this.currentState=PlayerState.Playing,this.dispatchEvent(new CustomEvent(PlayerEvents.Play)))}pause(){this._lottie&&(this._lottie.pause(),this.currentState=PlayerState.Paused,this.dispatchEvent(new CustomEvent(PlayerEvents.Pause)))}stop(){this._lottie&&(this._counter=0,this._lottie.stop(),this.currentState=PlayerState.Stopped,this.dispatchEvent(new CustomEvent(PlayerEvents.Stop)))}seek(B){if(!this._lottie)return;const D=B.toString().match(/^([0-9]+)(%?)$/);if(!D)return;const R=D[2]==="%"?this._lottie.totalFrames*Number(D[1])/100:D[1];this.seeker=R,this.currentState===PlayerState.Playing?this._lottie.goToAndPlay(R,!0):(this._lottie.goToAndStop(R,!0),this._lottie.pause())}snapshot(){let B=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];if(!this.shadowRoot)return;const D=this.shadowRoot.querySelector(".animation svg"),R=new XMLSerializer().serializeToString(D);if(B){const F=document.createElement("a");F.href="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(R),F.download="download_"+this.seeker+".svg",document.body.appendChild(F),F.click(),document.body.removeChild(F)}return R}freeze(){this._lottie&&(this._lottie.pause(),this.currentState=PlayerState.Frozen,this.dispatchEvent(new CustomEvent(PlayerEvents.Freeze)))}setSpeed(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this._lottie&&this._lottie.setSpeed(B)}setDirection(B){this._lottie&&this._lottie.setDirection(B)}setLooping(B){this._lottie&&(this.loop=B,this._lottie.loop=B)}togglePlay(){return this.currentState===PlayerState.Playing?this.pause():this.play()}toggleLooping(){this.setLooping(!this.loop)}static get styles(){return styles$a}async firstUpdated(){"IntersectionObserver"in window&&(this._io=new IntersectionObserver(B=>{B[0].isIntersecting?this.currentState===PlayerState.Frozen&&this.play():this.currentState===PlayerState.Playing&&this.freeze()}),this._io.observe(this.container)),document.hidden!==void 0&&document.addEventListener("visibilitychange",()=>this._onVisibilityChange()),this.src&&await this.load(this.src)}disconnectedCallback(){this._io&&(this._io.disconnect(),this._io=void 0),document.removeEventListener("visibilitychange",()=>this._onVisibilityChange())}renderControls(){const B=this.currentState===PlayerState.Playing,D=this.currentState===PlayerState.Paused,R=this.currentState===PlayerState.Stopped;return $(_templateObject||(_templateObject=_taggedTemplateLiteral([`
`])),this.togglePlay,B||D?"active":"",$(B?_templateObject2||(_templateObject2=_taggedTemplateLiteral([` `])):_templateObject3||(_templateObject3=_taggedTemplateLiteral([` `]))),this.stop,R?"active":"",this.seeker,this._handleSeekChange,()=>{this._prevState=this.currentState,this.freeze()},()=>{this._prevState===PlayerState.Playing&&this.play()},this.seeker,this.toggleLooping,this.loop?"active":"")}render(){const B=this.controls?"main controls":"main",D=this.controls?"animation controls":"animation";return $(_templateObject4||(_templateObject4=_taggedTemplateLiteral([` `])),B,D,this.background,this.currentState===PlayerState.Error?$(_templateObject5||(_templateObject5=_taggedTemplateLiteral([`
\u26A0\uFE0F
`]))):void 0,this.controls?this.renderControls():void 0)}};__decorate([i$4(".animation")],DotLottiePlayer.prototype,"container",void 0),__decorate([e$5()],DotLottiePlayer.prototype,"mode",void 0),__decorate([e$5({type:Boolean})],DotLottiePlayer.prototype,"autoplay",void 0),__decorate([e$5({type:String,reflect:!0})],DotLottiePlayer.prototype,"background",void 0),__decorate([e$5({type:Boolean})],DotLottiePlayer.prototype,"controls",void 0),__decorate([e$5({type:Number})],DotLottiePlayer.prototype,"count",void 0),__decorate([e$5({type:Number})],DotLottiePlayer.prototype,"direction",void 0),__decorate([e$5({type:Boolean})],DotLottiePlayer.prototype,"hover",void 0),__decorate([e$5({type:Boolean,reflect:!0})],DotLottiePlayer.prototype,"loop",void 0),__decorate([e$5({type:String})],DotLottiePlayer.prototype,"renderer",void 0),__decorate([e$5({type:Number})],DotLottiePlayer.prototype,"speed",void 0),__decorate([e$5({type:String})],DotLottiePlayer.prototype,"src",void 0),__decorate([e$5({type:String})],DotLottiePlayer.prototype,"currentState",void 0),__decorate([e$5()],DotLottiePlayer.prototype,"seeker",void 0),__decorate([e$5()],DotLottiePlayer.prototype,"intermission",void 0),DotLottiePlayer=__decorate([n$1("dotlottie-player")],DotLottiePlayer);const container$1="_container_5qx0e_1",moreButton="_moreButton_5qx0e_30",centerButton="_centerButton_5qx0e_34",leftButton="_leftButton_5qx0e_39",title$2="_title_5qx0e_51",album="_album_5qx0e_55",button$1="_button_5qx0e_59",hasText$1="_hasText_5qx0e_67",bigIcon$1="_bigIcon_5qx0e_90",evaluatBtn="_evaluatBtn_5qx0e_97",start$2="_start_5qx0e_100",icon="_icon_5qx0e_115",onShow="_onShow_5qx0e_118",popover="_popover_5qx0e_121",backbtn="_backbtn_5qx0e_128",titleWrap="_titleWrap_5qx0e_134",speed="_speed_5qx0e_137",schedule="_schedule_5qx0e_185",ring="_ring_5qx0e_191",speedButton="_speedButton_5qx0e_201",label="_label_5qx0e_204",player="_player_5qx0e_215",fullbtn="_fullbtn_5qx0e_223",finish="_finish_5qx0e_232",dialogueBox="_dialogueBox_5qx0e_282",dialogue="_dialogue_5qx0e_282",inRadio="_inRadio_5qx0e_308",animation="_animation_5qx0e_324",btnMusicList="_btnMusicList_5qx0e_329",toggleMusicType="_toggleMusicType_5qx0e_341",slider$1="_slider_5qx0e_374",followEndBtn="_followEndBtn_5qx0e_401";var styles$9={container:container$1,moreButton,centerButton,leftButton,title:title$2,album,button:button$1,hasText:hasText$1,bigIcon:bigIcon$1,evaluatBtn,start:start$2,icon,onShow,popover,backbtn,titleWrap,speed,schedule,ring,speedButton,label,player,fullbtn,finish,dialogueBox,dialogue,inRadio,animation,btnMusicList,toggleMusicType,slider:slider$1,followEndBtn},StartEvaluating="./assets/start-evaluating.7994767f.lottie",Recording="./assets/recording2.feb0931b.lottie";let backtime=0;const search$5=useOriginSearch(),initBehaviorId$2=""+new Date().valueOf(),evaluating=ref(!1),playStatus=ref("stop"),endloading=ref(!1),connentLoading=ref(!1),playUrl=ref(""),endResult=ref(null),animate$1={mounted:B=>{B.addEventListener("click",D=>{D.target.classList.add("animate__animated","animate__tada")}),B.addEventListener("animationend",D=>{D.target.classList.remove("animate__animated","animate__tada")})}},browserInfo$3=browser(),formatPitch=B=>B?state$4.sett.hertz&&state$4.sett.hertz!==442?B/442*state$4.sett.hertz:B:-1,formatTimes=()=>{var j,U,W,Y,Q,Z,q,J,K,te;const B=((U=(j=state$2.times)==null?void 0:j[0])==null?void 0:U.difftime)||0;let D=!1,R=!1,F=!1;const G=[];for(let ne=0;ne{var j,U,W,Y;connentLoading.value=!0;const B=sessionStorage.getItem("behaviorId")||search$5.behaviorId||initBehaviorId$2,D=state.speed/state$2.baseSpeed,R={musicXmlInfos:formatTimes(),subjectId:state$2.subjectId,detailId:(j=state$2.activeDetail)==null?void 0:j.id,examSongId:search$5.id,xmlUrl:(U=state$2==null?void 0:state$2.activeDetail)==null?void 0:U.xmlUrl,partIndex:state$2.partIndex,behaviorId:B,platform:"WEB",clientId:"student",hertz:state$4.sett.hertz,reactionTimeMs:parseFloat(""+state$4.eva.reactionTimeMs)||0,speed:state.speed,heardLevel:state$4.eva.difficulty,beatLength:Math.round(getFixTime(state$2.times[0].beatSpeed)*1e3/D)},F=useClientType();F==="student"?R.clientId="student":F==="teacher"?R.clientId="teacher":R.clientId="education",browserInfo$3.android&&(R.platform="ANDROID"),browserInfo$3.ios&&(R.platform="IOS");const G=await promisefiyPostMessage({api:"startEvaluating",content:R});if((W=G==null?void 0:G.content)!=null&&W.reson)throw Toast.fail({message:(Y=G==null?void 0:G.content)==null?void 0:Y.reson}),connentLoading.value=!1,G;connentLoading.value=!1},sendOffsetTime=B=>{postMessage({api:"proxyServiceMessage",content:{header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:B}}},()=>{backtime=0})},cancelTheEvaluation=()=>{resetPlayStatus(),clearIntervalTimeline(),setCurrentTime(0),playStatus.value="stop",postMessage({api:"endEvaluating",content:{musicScoreId:search$5.id}},B=>{evaluating.value=!1,Toast.clear()})},stopPlay=(B=!0)=>{console.log("\u8C03\u7528stopPlay"),startButtonShow.value=!0,cancelTheEvaluation()},evaluatStopPlay=stopPlay,startPlay=()=>{console.log("\u8FDE\u63A5\u670D\u52A1\u6210\u529F,\u5F00\u59CB\u64AD\u653E",new Date().getTime()-state.clickTime),state$4.eva.mute?changeMode("background"):changeAllMode(),startButtonShow.value=!1,setPlayState()},setPlayer=async()=>{if(console.log("\u8C03\u7528setPlayer"),state.clickTime=new Date().getTime(),resetPlayStatus(),state.evaluatingTips=!1,state$2.isPauseRecording){evaluating.value=!1,startPlay();return}state$2.evaluatings={},setCurrentTime(0);const B=Toast({duration:0,message:"\u670D\u52A1\u8FDE\u63A5\u4E2D...",type:"loading"});try{await connect(),startPlay(),setTimeout(()=>{Toast.clear(),B.close()},100)}catch{state.evaluatingStatus=!1,Toast.clear()}},togglePlay=()=>{if(state$2.isPauseRecording){evaluating.value=!1,startPlay();return}evaluating.value?stopPlay():setPlayer()},cancelEvaluating=B=>{B!=null&&B.content.reson&&stopPlay()},timeupdate=()=>{var B;if(console.log("\u64AD\u653E\u4E8B\u4EF6\u88AB\u89E6\u53D1",playUrl.value,evaluating.value),playUrl.value){const D=new Date().getTime();console.log("\u7B2C\u4E00\u6B21\u64AD\u653E\u65F6\u95F4",D);const R=(B=state.audiosInstance)==null?void 0:B.audios[playUrl.value].currentTime;console.log("\u5DF2\u64AD\u653E\u65F6\u957F: ",R*1e3),console.log("\u4E0D\u51CF\u6389\u5DF2\u64AD\u653E\u65F6\u95F4: ",D-backtime);const F=D-backtime-R*1e3;console.log("\u771F\u6B63\u64AD\u653E\u5EF6\u8FDF",F),setTimeout(()=>{sendOffsetTime(F)},220)}},playerStop=()=>{console.log("playerStop\u64AD\u653E\u5668\u505C\u6B62\u4E8B\u4EF6",endloading.value),!endloading.value&&(playStatus.value="stop",endloading.value=!0,startButtonShow.value=!0,resetPlayStatus(),clearIntervalTimeline(),setCurrentTime(0),Toast({duration:0,message:"\u8BC4\u5206\u4E2D...",type:"loading"}),postMessage({api:"endEvaluating",content:{musicScoreId:useOriginSearch().id}},B=>{console.log("\u8C03\u7528endEvaluating\u7ED3\u675F",B),endloading.value=!1,evaluating.value=!1}))},evaluatPlayerStop=playerStop,endevent=B=>{var D;((D=B.target)==null?void 0:D.src)===playUrl.value&&playStatus.value==="play"&&(playerStop(),canSubmit.value=!0),state$2.isAppPlay&&(playerStop(),canSubmit.value=!0)},start$1=()=>{if(playStatus.value="play",state$2.isPauseRecording){postMessage({api:"resumeRecording"},()=>{evaluating.value=!0,state$2.isPauseRecording=!1,setCaptureMode()});return}console.log("\u5F00\u59CB\u5F55\u97F3",new Date().getTime()),postMessage({api:"startRecording"},()=>{var B,D;console.log("\u5F00\u59CB\u5F55\u97F3\u56DE\u8C03\u65F6\u95F4",new Date().getTime()),backtime=new Date().getTime(),evaluating.value=!0,console.log("midiUrl",(B=state$2.activeDetail)==null?void 0:B.midiUrl),(D=state$2.activeDetail)!=null&&D.midiUrl&&setTimeout(()=>{sendOffsetTime(0)},220)})},submitEvaluationScore=async B=>{if(state$2.setting&&state$2.setting.mode==="EVALUATING"){if(!canSubmit.value){Toast("\u8BF7\u5B8C\u6210\u6574\u9996\u66F2\u76EE\u8BC4\u6D4B\uFF01");return}try{await request.post("/activity/evaluationScore",{requestType:"json",data:{userId:state$3.user.userId,score:B.score,...state$2.setting.submitData}})}catch{}canSubmit.value=!1}},canSubmit=ref(!1),sendResult=B=>{var D,R;if(B!=null&&B.content){const F=(D=B==null?void 0:B.content)==null?void 0:D.body;if((B==null?void 0:B.content.header.commond)==="overall")console.log("\u7ED3\u675F\u8BC4\u6D4B\u8FD4\u56DE",F),console.log(B),Toast.clear(),endResult.value=F,evaluatingShow.value=!0,submitEvaluationScore(F);else if((B==null?void 0:B.content.header.commond)!=="checkDone"){if((B==null?void 0:B.content.header.commond)!=="checking"){const G=U=>{for(;U>=0;){const W=state$2.times[U];if(W.stave)return W;U--}},j=(U,W,Y=!1)=>{const Q=getBoundingBoxByverticalNote(U);console.log(state$2.evaluatings,Q),state$2.evaluatings={...state$2.evaluatings,[Q.measureIndex]:{...Q,...getLeveByScoreMeasure(W.score),score:W.score,dontTransition:Y}}};for(let U=0;U{var B;state.currentTimeNum>=((B=state$2.times[state$2.times.length-1])==null?void 0:B.time)-2&&(canSubmit.value=!0)},cloudMetronome=B=>{startButtonShow.value=!0};var Evaluating$1=defineComponent({name:"ColexiuEvaluating",directives:{animate:animate$1},setup(B,{expose:D}){return onMounted(async()=>{var R,F,G,j;state.evaluatingTips=!0,state$2.section=[],state$2.sectionStatus=!1,changeAllMode(),playUrl.value=state.songs.background||state.songs.music,(F=(R=state.audiosInstance)==null?void 0:R.audios[playUrl.value])==null||F.addEventListener("play",timeupdate),(j=(G=state.audiosInstance)==null?void 0:G.audios[playUrl.value])==null||j.addEventListener("timeupdate",onProgress),event.on("next-click",playerStop),event.on("ended",endevent),listenerMessage("sendResult",sendResult),listenerMessage("cancelEvaluating",cancelEvaluating),listenerMessage("cloudTimeUpdae",onProgress),event.on("tickDestroy",cloudMetronome),event.on("tickEnd",start$1),await pause(),setCurrentTime(0)}),onBeforeUnmount(()=>{var R,F,G,j;(F=(R=state.audiosInstance)==null?void 0:R.audios[playUrl.value])==null||F.removeEventListener("play",timeupdate),(j=(G=state.audiosInstance)==null?void 0:G.audios[playUrl.value])==null||j.removeEventListener("timeupdate",onProgress),event.off("next-click",playerStop),event.off("ended",endevent),event.off("tickDestroy",cloudMetronome),removeListenerMessage("sendResult",sendResult),removeListenerMessage("cancelEvaluating",cancelEvaluating),removeListenerMessage("cloudTimeUpdae",onProgress),event.off("tickEnd",start$1)}),D({setPlayer,startPlay,stopPlay,togglePlay,playerStop,evaluating,connentLoading,playStatus,cancelTheEvaluation}),()=>createVNode(Fragment,null,[withDirectives(createVNode(Button,{class:[styles$9.button,styles$9.hasText],style:{display:state$2.frozenMode?"none":""},onClick:()=>{state.evaluatingStatus=!1,(playStatus.value==="play"||playStatus.value==="connecting")&&cancelTheEvaluation()}},{default:()=>[createVNode(ButtonIcon,{name:"practise"},null),createVNode("span",null,[createTextVNode("\u7EC3\u4E60")])]}),[[resolveDirective("animate")]]),createVNode(Evaluating,{data:endResult.value},null),evaluating.value?createVNode(Teleport,{to:"body",key:"Recording"},{default:()=>[createVNode("div",{class:styles$9.dialogueBox},[createVNode("div",{class:styles$9.inRadio},[createTextVNode("\u6536\u97F3\u4E2D...")]),createVNode(resolveComponent("dotlottie-player"),{src:Recording,autoplay:!0,loop:!0,class:styles$9.animation},null)])]}):createVNode(Teleport,{to:"body",key:"StartEvaluating"},{default:()=>[createVNode("div",{class:styles$9.dialogueBox},[createVNode("div",{class:styles$9.dialogue},[createVNode("div",null,[createTextVNode("\u6F14\u594F\u524D\u8BF7\u8C03\u6574\u597D\u4E50\u5668\uFF0C\u4FDD\u8BC1\u6700\u4F73\u6F14\u594F\u72B6\u6001\u3002"),createVNode("span",{class:styles$9.triangle},null)])]),createVNode(resolveComponent("dotlottie-player"),{src:StartEvaluating,autoplay:!0,loop:!0,class:styles$9.animation},null)])]})])}}),ErrorIcon="./assets/error.4d7eb6c9.svg",Empty=defineComponent({name:"ColexiuEmpty",props:{description:{type:String,default:"\u7F51\u7EDC\u9519\u8BEF"},imageSize:{type:Number,default:200},image:{type:String,default:ErrorIcon}},setup(B,{slots:D}){const R=()=>postMessage({api:"back"}),{image:F,imageSize:G,description:j}=toRefs(B);return()=>createVNode(Empty$1,{image:F.value,imageSize:G.value,description:j.value},{default:()=>[D.default?D.default():createVNode(Button,{type:"primary",onClick:R},{default:()=>[createTextVNode("\u8FD4\u56DE")]})]})}});const item="_item_6tre7_1",tag="_tag_6tre7_23",tabs$1="_tabs_6tre7_60",list="_list_6tre7_105",tab="_tab_6tre7_60";var styles$8={item,tag,tabs:tabs$1,list,tab};const chargeType={VIP:"\u4F1A\u5458",CHARGE:"\u70B9\u64AD",FREE:"\u514D\u8D39"},SwitchTag=defineComponent({name:"SwitchTag",props:{type:String},setup(B){return()=>createVNode(Tag,{plain:!0,class:[styles$8.tag,B.type,"van-hairline--surround"]},{default:()=>[chargeType[B.type]]})}});var Item=defineComponent({name:"MusicList-MusicScore-Item",props:{item:{type:Object}},setup(B){const D=useOriginSearch(),R=sessionStorage.getItem("behaviorId")||""+new Date().valueOf(),F=()=>{var G;pause(),postMessage({api:"cloudDestroy"}),postMessage({api:"cloudLoading",content:{show:!0,type:"fullscreen"}}),location.href=location.origin+location.pathname+"?"+queryString.stringify({...D,behaviorId:R,id:(G=B.item)==null?void 0:G.id,_t:new Date().valueOf()})};return()=>{var G,j,U;return createVNode("div",{class:[styles$8.item,{active:((G=B.item)==null?void 0:G.id)==D.id}],onClick:()=>F()},[createVNode("div",{style:{display:"flex"}},[(((j=B.item)==null?void 0:j.paymentType)||"").split(",").map(W=>createVNode(SwitchTag,{key:W,type:W},null))]),createVNode("p",null,[(U=B.item)==null?void 0:U.musicSheetName])])}}});function _isSlot$2(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}var List=defineComponent({name:"MusicList-MusicScore-List",props:{list:{type:Array,default:()=>[]},url:{type:String,default:""},moreSearch:{type:Object,default:()=>({})}},emits:["refresh"],setup(B,{emit:D}){const R=ref(!1),F=ref(!1),G=ref(1),j=ref([]),U=ref(),W=async()=>{if(!!B.url){R.value=!0;try{const Q=await request(B.url,{params:{page:G.value,...B.moreSearch}});j.value=[...j.value,...Q.data.rows],F.value=Q.data.totalPage{!R.value&&!F.value&&(G.value=G.value+1,W())};return()=>{let Q;return!j.value.length&&!R.value?createVNode(Empty,{description:"\u6682\u65E0\u66F2\u76EE"},{default:()=>[createVNode("span",null,null)]}):createVNode("div",{class:styles$8.tab},[createVNode(List$1,{ref:U,class:styles$8.list,loading:R.value,finished:F.value,onLoad:Y},_isSlot$2(Q=j.value.map(Z=>createVNode(Item,{item:Z,key:Z.id},null)))?Q:{default:()=>[Q]})])}}});const search$4=useOriginSearch();var MusicScore=defineComponent({name:"MusicList-MusicScore",setup(){return()=>createVNode(List,{url:"/music/sheet/queryRelatedList",moreSearch:{albumId:search$4.albumId,musicSheetId:search$4.id}},null)}}),Collection=defineComponent({name:"MusicList-MusicScore",setup(){return()=>createVNode(List,{url:"/music/sheet/favorite"},null)}}),Practice=defineComponent({name:"MusicList-Practice",setup(){return()=>createVNode(List,{url:"/music/sheet/practice"},null)}}),Content$1=defineComponent({name:"MusicListContent",setup(){return()=>createVNode(Tabs,{class:styles$8.tabs},{default:()=>[createVNode(Tab,{title:"\u5176\u4ED6\u66F2\u8C31"},{default:()=>[createVNode(MusicScore,null,null)]}),createVNode(Tab,{title:"\u6700\u8FD1\u7EC3\u4E60"},{default:()=>[createVNode(Practice,null,null)]}),createVNode(Tab,{class:styles$8.tab,title:"\u6211\u7684\u6536\u85CF"},{default:()=>[createVNode(Collection,null,null)]})]})}});const visible=ref(!1),survive=ref(!1),open$1=()=>{visible.value=!0,survive.value=!0},close=()=>{visible.value=!1},closed=()=>{survive.value=!1};var MusicList=defineComponent({name:"MusicList",setup(B){return()=>createVNode(Popup,{show:visible.value,onClickOverlay:close,onClosed:closed,position:"right",teleport:"body",style:{height:"100vh",width:"55vw",borderRadius:"5px 0 0 5px",overflow:"hidden"}},{default:()=>[survive.value&&createVNode(Content$1,B,null)]})}}),InfoIcon="./assets/info.ba658f25.svg",iconTv="./assets/tv.e0e4a552.svg",iconYijian="./assets/yijian.93a8e5bd.svg";const setting="_setting_y55es_1",sliderWrap="_sliderWrap_y55es_45",slider="_slider_y55es_45",noticebar="_noticebar_y55es_68",groupBox="_groupBox_y55es_74",btnsbar="_btnsbar_y55es_93",btn="_btn_y55es_93",radioGroup="_radioGroup_y55es_124";var styles$7={setting,sliderWrap,slider,noticebar,groupBox,btnsbar,btn,radioGroup};const tabs="_tabs_e40bs_1";var styles$6={tabs};const show=ref(!1);var HelperPopup=defineComponent({name:"HelperPopup",setup(){return()=>createVNode(Popup,{show:show.value,position:"right",round:!0,teleport:"body",onClickOverlay:()=>show.value=!1,style:{height:"100vh",width:"40vw",overflow:"hidden"}},{default:()=>[createVNode(Tabs,{class:styles$6.tabs},{default:()=>[createVNode(Tab,{title:"\u6295\u5C4F"},{default:()=>[createVNode("iframe",{src:location.origin+"/student/#/guide"},null)]}),createVNode(Tab,{title:"\u5E2E\u52A9"},{default:()=>[createVNode("iframe",{src:location.origin+"/student/#/helpCenter?platformType=ANALYSIS"},null)]})]})]})}}),raf$1={exports:{}},performanceNow={exports:{}};(function(){var B,D,R,F,G,j;typeof performance!="undefined"&&performance!==null&&performance.now?performanceNow.exports=function(){return performance.now()}:typeof process!="undefined"&&process!==null&&process.hrtime?(performanceNow.exports=function(){return(B()-G)/1e6},D=process.hrtime,B=function(){var U;return U=D(),U[0]*1e9+U[1]},F=B(),j=process.uptime()*1e9,G=F-j):Date.now?(performanceNow.exports=function(){return Date.now()-R},R=Date.now()):(performanceNow.exports=function(){return new Date().getTime()-R},R=new Date().getTime())}).call(commonjsGlobal$1);var now=performanceNow.exports,root=typeof window=="undefined"?commonjsGlobal$1:window,vendors=["moz","webkit"],suffix="AnimationFrame",raf=root["request"+suffix],caf=root["cancel"+suffix]||root["cancelRequest"+suffix];for(var i$1=0;!raf&&i$13&&(this.alpha=W[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var Y=this.r.toString(16),Q=this.g.toString(16),Z=this.b.toString(16);return Y.length==1&&(Y="0"+Y),Q.length==1&&(Q="0"+Q),Z.length==1&&(Z="0"+Z),"#"+Y+Q+Z},this.getHelpXML=function(){for(var Y=new Array,Q=0;Q "+ne.toRGB()+" -> "+ne.toHex());te.appendChild(ie),te.appendChild(re),K.appendChild(te)}catch{}return K}};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var t=function(B,D){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,F){R.__proto__=F}||function(R,F){for(var G in F)Object.prototype.hasOwnProperty.call(F,G)&&(R[G]=F[G])})(B,D)};function r(B,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function R(){this.constructor=B}t(B,D),B.prototype=D===null?Object.create(D):(R.prototype=D.prototype,new R)}function e(B){var D="";Array.isArray(B)||(B=[B]);for(var R=0;RB.phi1&&(B.phi2-=2*n),B.sweepFlag===1&&B.phi2F)return[];if(F===0)return[[B*R/(B*B+D*D),D*R/(B*B+D*D)]];var G=Math.sqrt(F);return[[(B*R+D*G)/(B*B+D*D),(D*R-B*G)/(B*B+D*D)],[(B*R-D*G)/(B*B+D*D),(D*R+B*G)/(B*B+D*D)]]}var u,h=Math.PI/180;function c$1(B,D,R){return(1-R)*B+R*D}function y(B,D,R,F){return B+Math.cos(F/180*n)*D+Math.sin(F/180*n)*R}function p(B,D,R,F){var G=1e-6,j=D-B,U=R-D,W=3*j+3*(F-R)-6*U,Y=6*(U-j),Q=3*j;return Math.abs(W)ue&&(K.sweepFlag=+!K.sweepFlag),K})}function U(){return function(W){var Y={};for(var Q in W)Y[Q]=W[Q];return Y}}B.ROUND=function(W){function Y(Q){return Math.round(Q*W)/W}return W===void 0&&(W=1e13),a(W),function(Q){return Q.x1!==void 0&&(Q.x1=Y(Q.x1)),Q.y1!==void 0&&(Q.y1=Y(Q.y1)),Q.x2!==void 0&&(Q.x2=Y(Q.x2)),Q.y2!==void 0&&(Q.y2=Y(Q.y2)),Q.x!==void 0&&(Q.x=Y(Q.x)),Q.y!==void 0&&(Q.y=Y(Q.y)),Q.rX!==void 0&&(Q.rX=Y(Q.rX)),Q.rY!==void 0&&(Q.rY=Y(Q.rY)),Q}},B.TO_ABS=D,B.TO_REL=function(){return G(function(W,Y,Q){return W.relative||(W.x1!==void 0&&(W.x1-=Y),W.y1!==void 0&&(W.y1-=Q),W.x2!==void 0&&(W.x2-=Y),W.y2!==void 0&&(W.y2-=Q),W.x!==void 0&&(W.x-=Y),W.y!==void 0&&(W.y-=Q),W.relative=!0),W})},B.NORMALIZE_HVZ=function(W,Y,Q){return W===void 0&&(W=!0),Y===void 0&&(Y=!0),Q===void 0&&(Q=!0),G(function(Z,q,J,K,te){if(isNaN(K)&&!(Z.type&_.MOVE_TO))throw new Error("path must start with moveto");return Y&&Z.type&_.HORIZ_LINE_TO&&(Z.type=_.LINE_TO,Z.y=Z.relative?0:J),Q&&Z.type&_.VERT_LINE_TO&&(Z.type=_.LINE_TO,Z.x=Z.relative?0:q),W&&Z.type&_.CLOSE_PATH&&(Z.type=_.LINE_TO,Z.x=Z.relative?K-q:K,Z.y=Z.relative?te-J:te),Z.type&_.ARC&&(Z.rX===0||Z.rY===0)&&(Z.type=_.LINE_TO,delete Z.rX,delete Z.rY,delete Z.xRot,delete Z.lArcFlag,delete Z.sweepFlag),Z})},B.NORMALIZE_ST=R,B.QT_TO_C=F,B.INFO=G,B.SANITIZE=function(W){W===void 0&&(W=0),a(W);var Y=NaN,Q=NaN,Z=NaN,q=NaN;return G(function(J,K,te,ne,ie){var re=Math.abs,oe=!1,le=0,fe=0;if(J.type&_.SMOOTH_CURVE_TO&&(le=isNaN(Y)?0:K-Y,fe=isNaN(Q)?0:te-Q),J.type&(_.CURVE_TO|_.SMOOTH_CURVE_TO)?(Y=J.relative?K+J.x2:J.x2,Q=J.relative?te+J.y2:J.y2):(Y=NaN,Q=NaN),J.type&_.SMOOTH_QUAD_TO?(Z=isNaN(Z)?K:2*K-Z,q=isNaN(q)?te:2*te-q):J.type&_.QUAD_TO?(Z=J.relative?K+J.x1:J.x1,q=J.relative?te+J.y1:J.y2):(Z=NaN,q=NaN),J.type&_.LINE_COMMANDS||J.type&_.ARC&&(J.rX===0||J.rY===0||!J.lArcFlag)||J.type&_.CURVE_TO||J.type&_.SMOOTH_CURVE_TO||J.type&_.QUAD_TO||J.type&_.SMOOTH_QUAD_TO){var he=J.x===void 0?0:J.relative?J.x:J.x-K,ge=J.y===void 0?0:J.relative?J.y:J.y-te;le=isNaN(Z)?J.x1===void 0?le:J.relative?J.x:J.x1-K:Z-K,fe=isNaN(q)?J.y1===void 0?fe:J.relative?J.y:J.y1-te:q-te;var ue=J.x2===void 0?0:J.relative?J.x:J.x2-K,me=J.y2===void 0?0:J.relative?J.y:J.y2-te;re(he)<=W&&re(ge)<=W&&re(le)<=W&&re(fe)<=W&&re(ue)<=W&&re(me)<=W&&(oe=!0)}return J.type&_.CLOSE_PATH&&re(K-ne)<=W&&re(te-ie)<=W&&(oe=!0),oe?[]:J})},B.MATRIX=j,B.ROTATE=function(W,Y,Q){Y===void 0&&(Y=0),Q===void 0&&(Q=0),a(W,Y,Q);var Z=Math.sin(W),q=Math.cos(W);return j(q,Z,-Z,q,Y-Y*q+Q*Z,Q-Y*Z-Q*q)},B.TRANSLATE=function(W,Y){return Y===void 0&&(Y=0),a(W,Y),j(1,0,0,1,W,Y)},B.SCALE=function(W,Y){return Y===void 0&&(Y=W),a(W,Y),j(W,0,0,Y,0,0)},B.SKEW_X=function(W){return a(W),j(1,0,Math.atan(W),1,0,0)},B.SKEW_Y=function(W){return a(W),j(1,Math.atan(W),0,1,0,0)},B.X_AXIS_SYMMETRY=function(W){return W===void 0&&(W=0),a(W),j(-1,0,0,1,W,0)},B.Y_AXIS_SYMMETRY=function(W){return W===void 0&&(W=0),a(W),j(1,0,0,-1,0,W)},B.A_TO_C=function(){return G(function(W,Y,Q){return _.ARC===W.type?function(Z,q,J){var K,te,ne,ie;Z.cX||o(Z,q,J);for(var re=Math.min(Z.phi1,Z.phi2),oe=Math.max(Z.phi1,Z.phi2)-re,le=Math.ceil(oe/90),fe=new Array(le),he=q,ge=J,ue=0;ueq.maxX&&(q.maxX=Pe),Peq.maxY&&(q.maxY=Pe),PeNe&&ie(m$1(K,ne.x1,ne.x2,ne.x,Ne));for(var fe=0,he=p(te,ne.y1,ne.y2,ne.y);feNe&&re(m$1(te,ne.y1,ne.y2,ne.y,Ne))}if(ne.type&_.ARC){ie(ne.x),re(ne.y),o(ne,K,te);for(var ge=ne.xRot/180*Math.PI,ue=Math.cos(ge)*ne.rX,me=Math.sin(ge)*ne.rX,be=-Math.sin(ge)*ne.rY,ve=Math.cos(ge)*ne.rY,pe=ne.phi1ne.phi2?[ne.phi2+360,ne.phi1+360]:[ne.phi2,ne.phi1],ye=pe[0],xe=pe[1],ce=function(Pe){var Me=Pe[0],Se=Pe[1],Le=180*Math.atan2(Se,Me)/Math.PI;return Leye&&Neye&&NeZ)throw new SyntaxError('Expected positive number, got "'+Z+'" at index "'+U+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+U+'"')}this.curArgs.push(Z),this.curArgs.length===N[this.curCommandType]&&(_.HORIZ_LINE_TO===this.curCommandType?j({type:_.HORIZ_LINE_TO,relative:this.curCommandRelative,x:Z}):_.VERT_LINE_TO===this.curCommandType?j({type:_.VERT_LINE_TO,relative:this.curCommandRelative,y:Z}):this.curCommandType===_.MOVE_TO||this.curCommandType===_.LINE_TO||this.curCommandType===_.SMOOTH_QUAD_TO?(j({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),_.MOVE_TO===this.curCommandType&&(this.curCommandType=_.LINE_TO)):this.curCommandType===_.CURVE_TO?j({type:_.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===_.SMOOTH_CURVE_TO?j({type:_.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.QUAD_TO?j({type:_.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.ARC&&j({type:_.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!T(W))if(W===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(W!=="+"&&W!=="-"&&W!==".")if(Q)this.curNumber=W,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+U+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+W+'" at index '+U+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,W!=="z"&&W!=="Z")if(W==="h"||W==="H")this.curCommandType=_.HORIZ_LINE_TO,this.curCommandRelative=W==="h";else if(W==="v"||W==="V")this.curCommandType=_.VERT_LINE_TO,this.curCommandRelative=W==="v";else if(W==="m"||W==="M")this.curCommandType=_.MOVE_TO,this.curCommandRelative=W==="m";else if(W==="l"||W==="L")this.curCommandType=_.LINE_TO,this.curCommandRelative=W==="l";else if(W==="c"||W==="C")this.curCommandType=_.CURVE_TO,this.curCommandRelative=W==="c";else if(W==="s"||W==="S")this.curCommandType=_.SMOOTH_CURVE_TO,this.curCommandRelative=W==="s";else if(W==="q"||W==="Q")this.curCommandType=_.QUAD_TO,this.curCommandRelative=W==="q";else if(W==="t"||W==="T")this.curCommandType=_.SMOOTH_QUAD_TO,this.curCommandRelative=W==="t";else{if(W!=="a"&&W!=="A")throw new SyntaxError('Unexpected character "'+W+'" at index '+U+".");this.curCommandType=_.ARC,this.curCommandRelative=W==="a"}else F.push({type:_.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=W,this.curNumberHasDecimal=W==="."}else this.curNumber+=W,this.curNumberHasDecimal=!0;else this.curNumber+=W;else this.curNumber+=W,this.curNumberHasExp=!0;else this.curNumber+=W,this.curNumberHasExpDigits=this.curNumberHasExp}return F},D.prototype.transform=function(R){return Object.create(this,{parse:{value:function(F,G){G===void 0&&(G=[]);for(var j=0,U=Object.getPrototypeOf(this).parse.call(this,F);j>he;if(U[le+3]=ft,ft!==0){var lt=255/ft;U[le]=(Pe*fe>>he)*lt,U[le+1]=(Me*fe>>he)*lt,U[le+2]=(Se*fe>>he)*lt}else U[le]=U[le+1]=U[le+2]=0;Pe-=Be,Me-=Ae,Se-=Te,Le-=Ne,Be-=ie.r,Ae-=ie.g,Te-=ie.b,Ne-=ie.a;var _e=ot+j+1;_e=oe+(_e>he,dt>0?(dt=255/dt,U[Wt]=(xt*fe>>he)*dt,U[Wt+1]=(Lt*fe>>he)*dt,U[Wt+2]=(Gt*fe>>he)*dt):U[Wt]=U[Wt+1]=U[Wt+2]=0,xt-=ut,Lt-=yt,Gt-=Et,ai-=st,ut-=ie.r,yt-=ie.g,Et-=ie.b,st-=ie.a,Wt=Je+((Wt=bi+Z)0&&arguments[0]!==void 0?arguments[0]:{};const D={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:B,createCanvas(R,F){return new OffscreenCanvas(R,F)},async createImage(R){const G=await(await fetch(R)).blob();return await createImageBitmap(G)}};return(typeof globalThis.DOMParser!="undefined"||typeof B=="undefined")&&Reflect.deleteProperty(D,"DOMParser"),D}function node(B){let{DOMParser:D,canvas:R,fetch:F}=B;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:D,fetch:F,createCanvas:R.createCanvas,createImage:R.loadImage}}var index=Object.freeze({__proto__:null,offscreen,node});function compressSpaces(B){return B.replace(/(?!\u3000)\s+/gm," ")}function trimLeft(B){return B.replace(/^[\n \t]+/,"")}function trimRight(B){return B.replace(/[\n \t]+$/,"")}function toNumbers(B){const D=B.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return D?D.map(parseFloat):[]}function toMatrixValue(B){const D=toNumbers(B);return[D[0]||0,D[1]||0,D[2]||0,D[3]||0,D[4]||0,D[5]||0]}const allUppercase=/^[A-Z-]+$/;function normalizeAttributeName(B){return allUppercase.test(B)?B.toLowerCase():B}function parseExternalUrl(B){const D=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(B);return D&&(D[2]||D[3]||D[4])||""}function normalizeColor(B){if(!B.startsWith("rgb"))return B;let D=3;return B.replace(/\d+(\.\d+)?/g,(F,G)=>D--&&G?String(Math.round(parseFloat(F))):F)}const attributeRegex=/(\[[^\]]+\])/g,idRegex=/(#[^\s+>~.[:]+)/g,classRegex=/(\.[^\s+>~.[:]+)/g,pseudoElementRegex=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,pseudoClassWithBracketsRegex=/(:[\w-]+\([^)]*\))/gi,pseudoClassRegex=/(:[^\s+>~.[:]+)/g,elementRegex=/([^\s+>~.[:]+)/g;function findSelectorMatch(B,D){const R=D.exec(B);return R?[B.replace(D," "),R.length]:[B,0]}function getSelectorSpecificity(B){const D=[0,0,0];let R=B.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),F=0;return[R,F]=findSelectorMatch(R,attributeRegex),D[1]+=F,[R,F]=findSelectorMatch(R,idRegex),D[0]+=F,[R,F]=findSelectorMatch(R,classRegex),D[1]+=F,[R,F]=findSelectorMatch(R,pseudoElementRegex),D[2]+=F,[R,F]=findSelectorMatch(R,pseudoClassWithBracketsRegex),D[1]+=F,[R,F]=findSelectorMatch(R,pseudoClassRegex),D[1]+=F,R=R.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[R,F]=findSelectorMatch(R,elementRegex),D[2]+=F,D.join("")}const PSEUDO_ZERO=1e-8;function vectorMagnitude(B){return Math.sqrt(Math.pow(B[0],2)+Math.pow(B[1],2))}function vectorsRatio(B,D){return(B[0]*D[0]+B[1]*D[1])/(vectorMagnitude(B)*vectorMagnitude(D))}function vectorsAngle(B,D){return(B[0]*D[1]0&&arguments[0]!==void 0?arguments[0]:" ";const{document:R,name:F}=this;return compressSpaces(this.getString()).trim().split(D).map(G=>new Property(R,F,G))}hasValue(D){const R=this.value;return R!==null&&R!==""&&(D||R!==0)&&typeof R!="undefined"}isString(D){const{value:R}=this,F=typeof R=="string";return!F||!D?F:D.test(R)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const D=this.getString();switch(!0){case D.endsWith("px"):case/^[0-9]+$/.test(D):return!0;default:return!1}}setValue(D){return this.value=D,this}getValue(D){return typeof D=="undefined"||this.hasValue()?this.value:D}getNumber(D){if(!this.hasValue())return typeof D=="undefined"?0:parseFloat(D);const{value:R}=this;let F=parseFloat(R);return this.isString(/%$/)&&(F/=100),F}getString(D){return typeof D=="undefined"||this.hasValue()?typeof this.value=="undefined"?"":String(this.value):String(D)}getColor(D){let R=this.getString(D);return this.isNormalizedColor||(this.isNormalizedColor=!0,R=normalizeColor(R),this.value=R),R}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[F,G]=typeof D=="boolean"?[void 0,D]:[D],{viewPort:j}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(j.computeSize("x"),j.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(j.computeSize("x"),j.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*j.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*j.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return this.getNumber()*15;case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case(this.isString(/%$/)&&G):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*j.computeSize(F);default:{const U=this.getNumber();return R&&U<1?U*j.computeSize(F):U}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3:0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const D=this.getString(),R=/#([^)'"]+)/.exec(D),F=(R==null?void 0:R[1])||D;return this.document.definitions[F]}getFillStyleDefinition(D,R){let F=this.getDefinition();if(!F)return null;if(typeof F.createGradient=="function"&&"getBoundingBox"in D)return F.createGradient(this.document.ctx,D,R);if(typeof F.createPattern=="function"){if(F.getHrefAttribute().hasValue()){const G=F.getAttribute("patternTransform");F=F.getHrefAttribute().getDefinition(),F&&G.hasValue()&&F.getAttribute("patternTransform",!0).setValue(G.value)}if(F)return F.createPattern(this.document.ctx,D,R)}return null}getTextBaseline(){if(!this.hasValue())return null;const D=this.getString();return Property.textBaselineMapping[D]||null}addOpacity(D){let R=this.getColor();const F=R.length;let G=0;for(let j=0;j1&&arguments[1]!==void 0?arguments[1]:0;const[F=R,G=R]=toNumbers(D);return new Point(F,G)}static parseScale(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[F=R,G=F]=toNumbers(D);return new Point(F,G)}static parsePath(D){const R=toNumbers(D),F=R.length,G=[];for(let j=0;j0}runEvents(){if(!this.working)return;const{screen:D,events:R,eventElements:F}=this,{style:G}=D.ctx.canvas;let j;G&&(G.cursor=""),R.forEach((U,W)=>{let{run:Y}=U;for(j=F[W];j;)Y(j),j=j.parent}),this.events=[],this.eventElements=[]}checkPath(D,R){if(!this.working||!R)return;const{events:F,eventElements:G}=this;F.forEach((j,U)=>{let{x:W,y:Y}=j;!G[U]&&R.isPointInPath&&R.isPointInPath(W,Y)&&(G[U]=D)})}checkBoundingBox(D,R){if(!this.working||!R)return;const{events:F,eventElements:G}=this;F.forEach((j,U)=>{let{x:W,y:Y}=j;!G[U]&&R.isPointInBox(W,Y)&&(G[U]=D)})}mapXY(D,R){const{window:F,ctx:G}=this.screen,j=new Point(D,R);let U=G.canvas;for(;U;)j.x-=U.offsetLeft,j.y-=U.offsetTop,U=U.offsetParent;return F!=null&&F.scrollX&&(j.x+=F.scrollX),F!=null&&F.scrollY&&(j.y+=F.scrollY),j}onClick(D){const{x:R,y:F}=this.mapXY(D.clientX,D.clientY);this.events.push({type:"onclick",x:R,y:F,run(G){G.onClick&&G.onClick()}})}onMouseMove(D){const{x:R,y:F}=this.mapXY(D.clientX,D.clientY);this.events.push({type:"onmousemove",x:R,y:F,run(G){G.onMouseMove&&G.onMouseMove()}})}constructor(D){this.screen=D,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const defaultWindow=typeof window!="undefined"?window:null,defaultFetch$1=typeof fetch!="undefined"?fetch.bind(void 0):void 0;class Screen{wait(D){this.waits.push(D)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const D=this.waits.every(R=>R());return D&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=D,D}setDefaults(D){D.strokeStyle="rgba(0,0,0,0)",D.lineCap="butt",D.lineJoin="miter",D.miterLimit=4}setViewBox(D){let{document:R,ctx:F,aspectRatio:G,width:j,desiredWidth:U,height:W,desiredHeight:Y,minX:Q=0,minY:Z=0,refX:q,refY:J,clip:K=!1,clipX:te=0,clipY:ne=0}=D;const ie=compressSpaces(G).replace(/^defer\s/,""),[re,oe]=ie.split(" "),le=re||"xMidYMid",fe=oe||"meet",he=j/U,ge=W/Y,ue=Math.min(he,ge),me=Math.max(he,ge);let be=U,ve=Y;fe==="meet"&&(be*=ue,ve*=ue),fe==="slice"&&(be*=me,ve*=me);const pe=new Property(R,"refX",q),ye=new Property(R,"refY",J),xe=pe.hasValue()&&ye.hasValue();if(xe&&F.translate(-ue*pe.getPixels("x"),-ue*ye.getPixels("y")),K){const ce=ue*te,we=ue*ne;F.beginPath(),F.moveTo(ce,we),F.lineTo(j,we),F.lineTo(j,W),F.lineTo(ce,W),F.closePath(),F.clip()}if(!xe){const ce=fe==="meet"&&ue===ge,we=fe==="slice"&&me===ge,Be=fe==="meet"&&ue===he,Ae=fe==="slice"&&me===he;le.startsWith("xMid")&&(ce||we)&&F.translate(j/2-be/2,0),le.endsWith("YMid")&&(Be||Ae)&&F.translate(0,W/2-ve/2),le.startsWith("xMax")&&(ce||we)&&F.translate(j-be,0),le.endsWith("YMax")&&(Be||Ae)&&F.translate(0,W-ve)}switch(!0){case le==="none":F.scale(he,ge);break;case fe==="meet":F.scale(ue,ue);break;case fe==="slice":F.scale(me,me);break}F.translate(-Q,-Z)}start(D){let{enableRedraw:R=!1,ignoreMouse:F=!1,ignoreAnimation:G=!1,ignoreDimensions:j=!1,ignoreClear:U=!1,forceRedraw:W,scaleWidth:Y,scaleHeight:Q,offsetX:Z,offsetY:q}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:J}=this,K=1e3/Screen.FRAMERATE;if(this.frameDuration=K,this.readyPromise=new Promise(oe=>{this.resolveReady=oe}),this.isReady()&&this.render(D,j,U,Y,Q,Z,q),!R)return;let te=Date.now(),ne=te,ie=0;const re=()=>{te=Date.now(),ie=te-ne,ie>=K&&(ne=te-ie%K,this.shouldUpdate(G,W)&&(this.render(D,j,U,Y,Q,Z,q),J.runEvents())),this.intervalId=requestAnimationFrame$1(re)};F||J.start(),this.intervalId=requestAnimationFrame$1(re)}stop(){this.intervalId&&(requestAnimationFrame$1.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(D,R){if(!D){const{frameDuration:F}=this;if(this.animations.reduce((j,U)=>U.update(F)||j,!1))return!0}return!!(typeof R=="function"&&R()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(D,R,F,G,j,U,W){const{viewPort:Y,ctx:Q,isFirstRender:Z}=this,q=Q.canvas;Y.clear(),q.width&&q.height&&Y.setCurrent(q.width,q.height);const J=D.getStyle("width"),K=D.getStyle("height");!R&&(Z||typeof G!="number"&&typeof j!="number")&&(J.hasValue()&&(q.width=J.getPixels("x"),q.style&&(q.style.width="".concat(q.width,"px"))),K.hasValue()&&(q.height=K.getPixels("y"),q.style&&(q.style.height="".concat(q.height,"px"))));let te=q.clientWidth||q.width,ne=q.clientHeight||q.height;if(R&&J.hasValue()&&K.hasValue()&&(te=J.getPixels("x"),ne=K.getPixels("y")),Y.setCurrent(te,ne),typeof U=="number"&&D.getAttribute("x",!0).setValue(U),typeof W=="number"&&D.getAttribute("y",!0).setValue(W),typeof G=="number"||typeof j=="number"){const ie=toNumbers(D.getAttribute("viewBox").getString());let re=0,oe=0;if(typeof G=="number"){const fe=D.getStyle("width");fe.hasValue()?re=fe.getPixels("x")/G:ie[2]&&!isNaN(ie[2])&&(re=ie[2]/G)}if(typeof j=="number"){const fe=D.getStyle("height");fe.hasValue()?oe=fe.getPixels("y")/j:ie[3]&&!isNaN(ie[3])&&(oe=ie[3]/j)}re||(re=oe),oe||(oe=re),D.getAttribute("width",!0).setValue(G),D.getAttribute("height",!0).setValue(j);const le=D.getStyle("transform",!0,!0);le.setValue("".concat(le.getString()," scale(").concat(1/re,", ").concat(1/oe,")"))}F||Q.clearRect(0,0,te,ne),D.render(Q),Z&&(this.isFirstRender=!1)}constructor(D,{fetch:R=defaultFetch$1,window:F=defaultWindow}={}){if(this.ctx=D,this.viewPort=new ViewPort,this.mouse=new Mouse(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=F,!R)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=R}}Screen.defaultWindow=defaultWindow;Screen.defaultFetch=defaultFetch$1;Screen.FRAMERATE=30;Screen.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch}=Screen,DefaultDOMParser=typeof DOMParser!="undefined"?DOMParser:void 0;class Parser{async parse(D){return D.startsWith("<")?this.parseFromString(D):this.load(D)}parseFromString(D){const R=new this.DOMParser;try{return this.checkDocument(R.parseFromString(D,"image/svg+xml"))}catch{return this.checkDocument(R.parseFromString(D,"text/xml"))}}checkDocument(D){const R=D.getElementsByTagName("parsererror")[0];if(R)throw new Error(R.textContent||"Unknown parse error");return D}async load(D){const F=await(await this.fetch(D)).text();return this.parseFromString(F)}constructor({fetch:D=defaultFetch,DOMParser:R=DefaultDOMParser}={}){if(!D)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!R)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=D,this.DOMParser=R}}class Translate{apply(D){const{x:R,y:F}=this.point;D.translate(R||0,F||0)}unapply(D){const{x:R,y:F}=this.point;D.translate(-1*R||0,-1*F||0)}applyToPoint(D){const{x:R,y:F}=this.point;D.applyTransform([1,0,0,1,R||0,F||0])}constructor(D,R){this.type="translate",this.point=Point.parse(R)}}class Rotate{apply(D){const{cx:R,cy:F,originX:G,originY:j,angle:U}=this,W=R+G.getPixels("x"),Y=F+j.getPixels("y");D.translate(W,Y),D.rotate(U.getRadians()),D.translate(-W,-Y)}unapply(D){const{cx:R,cy:F,originX:G,originY:j,angle:U}=this,W=R+G.getPixels("x"),Y=F+j.getPixels("y");D.translate(W,Y),D.rotate(-1*U.getRadians()),D.translate(-W,-Y)}applyToPoint(D){const{cx:R,cy:F,angle:G}=this,j=G.getRadians();D.applyTransform([1,0,0,1,R||0,F||0]),D.applyTransform([Math.cos(j),Math.sin(j),-Math.sin(j),Math.cos(j),0,0]),D.applyTransform([1,0,0,1,-R||0,-F||0])}constructor(D,R,F){this.type="rotate";const G=toNumbers(R);this.angle=new Property(D,"angle",G[0]),this.originX=F[0],this.originY=F[1],this.cx=G[1]||0,this.cy=G[2]||0}}class Scale{apply(D){const{scale:{x:R,y:F},originX:G,originY:j}=this,U=G.getPixels("x"),W=j.getPixels("y");D.translate(U,W),D.scale(R,F||R),D.translate(-U,-W)}unapply(D){const{scale:{x:R,y:F},originX:G,originY:j}=this,U=G.getPixels("x"),W=j.getPixels("y");D.translate(U,W),D.scale(1/R,1/F||R),D.translate(-U,-W)}applyToPoint(D){const{x:R,y:F}=this.scale;D.applyTransform([R||0,0,0,F||0,0,0])}constructor(D,R,F){this.type="scale";const G=Point.parseScale(R);(G.x===0||G.y===0)&&(G.x=PSEUDO_ZERO,G.y=PSEUDO_ZERO),this.scale=G,this.originX=F[0],this.originY=F[1]}}class Matrix{apply(D){const{originX:R,originY:F,matrix:G}=this,j=R.getPixels("x"),U=F.getPixels("y");D.translate(j,U),D.transform(G[0],G[1],G[2],G[3],G[4],G[5]),D.translate(-j,-U)}unapply(D){const{originX:R,originY:F,matrix:G}=this,j=G[0],U=G[2],W=G[4],Y=G[1],Q=G[3],Z=G[5],q=0,J=0,K=1,te=1/(j*(Q*K-Z*J)-U*(Y*K-Z*q)+W*(Y*J-Q*q)),ne=R.getPixels("x"),ie=F.getPixels("y");D.translate(ne,ie),D.transform(te*(Q*K-Z*J),te*(Z*q-Y*K),te*(W*J-U*K),te*(j*K-W*q),te*(U*Z-W*Q),te*(W*Y-j*Z)),D.translate(-ne,-ie)}applyToPoint(D){D.applyTransform(this.matrix)}constructor(D,R,F){this.type="matrix",this.matrix=toMatrixValue(R),this.originX=F[0],this.originY=F[1]}}class Skew extends Matrix{constructor(D,R,F){super(D,R,F),this.type="skew",this.angle=new Property(D,"angle",R)}}class SkewX extends Skew{constructor(D,R,F){super(D,R,F),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class SkewY extends Skew{constructor(D,R,F){super(D,R,F),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function parseTransforms(B){return compressSpaces(B).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function parseTransform(B){const[D="",R=""]=B.split("(");return[D.trim(),R.trim().replace(")","")]}class Transform{static fromElement(D,R){const F=R.getStyle("transform",!1,!0);if(F.hasValue()){const[G,j=G]=R.getStyle("transform-origin",!1,!0).split();if(G&&j){const U=[G,j];return new Transform(D,F.getString(),U)}}return null}apply(D){this.transforms.forEach(R=>R.apply(D))}unapply(D){this.transforms.forEach(R=>R.unapply(D))}applyToPoint(D){this.transforms.forEach(R=>R.applyToPoint(D))}constructor(D,R,F){this.document=D,this.transforms=[],parseTransforms(R).forEach(j=>{if(j==="none")return;const[U,W]=parseTransform(j),Y=Transform.transformTypes[U];Y&&this.transforms.push(new Y(this.document,W,F))})}}Transform.transformTypes={translate:Translate,rotate:Rotate,scale:Scale,matrix:Matrix,skewX:SkewX,skewY:SkewY};class Element$1{getAttribute(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const F=this.attributes[D];if(!F&&R){const G=new Property(this.document,D,"");return this.attributes[D]=G,G}return F||Property.empty(this.document)}getHrefAttribute(){let D;for(const R in this.attributes)if(R==="href"||R.endsWith(":href")){D=this.attributes[R];break}return D||Property.empty(this.document)}getStyle(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const G=this.styles[D];if(G)return G;const j=this.getAttribute(D);if(j.hasValue())return this.styles[D]=j,j;if(!F){const{parent:U}=this;if(U){const W=U.getStyle(D);if(W.hasValue())return W}}if(R){const U=new Property(this.document,D,"");return this.styles[D]=U,U}return Property.empty(this.document)}render(D){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(D.save(),this.getStyle("mask").hasValue()){const R=this.getStyle("mask").getDefinition();R&&(this.applyEffects(D),R.apply(D,this))}else if(this.getStyle("filter").getValue("none")!=="none"){const R=this.getStyle("filter").getDefinition();R&&(this.applyEffects(D),R.apply(D,this))}else this.setContext(D),this.renderChildren(D),this.clearContext(D);D.restore()}}setContext(D){}applyEffects(D){const R=Transform.fromElement(this.document,this);R&&R.apply(D);const F=this.getStyle("clip-path",!1,!0);if(F.hasValue()){const G=F.getDefinition();G&&G.apply(D)}}clearContext(D){}renderChildren(D){this.children.forEach(R=>{R.render(D)})}addChild(D){const R=D instanceof Element$1?D:this.document.createElement(D);R.parent=this,Element$1.ignoreChildTypes.includes(R.type)||this.children.push(R)}matchesSelector(D){var R;const{node:F}=this;if(typeof F.matches=="function")return F.matches(D);const G=(R=F.getAttribute)===null||R===void 0?void 0:R.call(F,"class");return!G||G===""?!1:G.split(" ").some(j=>".".concat(j)===D)}addStylesFromStyleDefinition(){const{styles:D,stylesSpecificity:R}=this.document;let F;for(const G in D)if(!G.startsWith("@")&&this.matchesSelector(G)){const j=D[G],U=R[G];if(j)for(const W in j){let Y=this.stylesSpecificity[W];typeof Y=="undefined"&&(Y="000"),U&&U>=Y&&(F=j[W],F&&(this.styles[W]=F),this.stylesSpecificity[W]=U)}}}removeStyles(D,R){return R.reduce((G,j)=>{const U=D.getStyle(j);if(!U.hasValue())return G;const W=U.getString();return U.setValue(""),[...G,[j,W]]},[])}restoreStyles(D,R){R.forEach(F=>{let[G,j]=F;D.getStyle(G,!0).setValue(j)})}isFirstChild(){var D;return((D=this.parent)===null||D===void 0?void 0:D.children.indexOf(this))===0}constructor(D,R,F=!1){if(this.document=D,this.node=R,this.captureTextNodes=F,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!R||R.nodeType!==1)return;Array.from(R.attributes).forEach(U=>{const W=normalizeAttributeName(U.nodeName);this.attributes[W]=new Property(D,W,U.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(W=>W.trim()).forEach(W=>{if(!W)return;const[Y,Q]=W.split(":").map(Z=>Z.trim());Y&&(this.styles[Y]=new Property(D,Y,Q))});const{definitions:G}=D,j=this.getAttribute("id");j.hasValue()&&(G[j.getString()]||(G[j.getString()]=this)),Array.from(R.childNodes).forEach(U=>{if(U.nodeType===1)this.addChild(U);else if(F&&(U.nodeType===3||U.nodeType===4)){const W=D.createTextNode(U);W.getText().length>0&&this.addChild(W)}})}}Element$1.ignoreChildTypes=["title"];class UnknownElement extends Element$1{constructor(D,R,F){super(D,R,F)}}function wrapFontFamily(B){const D=B.trim();return/^('|")/.test(D)?D:'"'.concat(D,'"')}function prepareFontFamily(B){return typeof process=="undefined"?B:B.trim().split(",").map(wrapFontFamily).join(",")}function prepareFontStyle(B){if(!B)return"";const D=B.trim().toLowerCase();switch(D){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return D;default:return/^oblique\s+(-|)\d+deg$/.test(D)?D:""}}function prepareFontWeight(B){if(!B)return"";const D=B.trim().toLowerCase();switch(D){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return D;default:return/^[\d.]+$/.test(D)?D:""}}class Font{static parse(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1?arguments[1]:void 0,F="",G="",j="",U="",W="";const Y=compressSpaces(D).trim().split(" "),Q={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return Y.forEach(Z=>{switch(!0){case(!Q.fontStyle&&Font.styles.includes(Z)):Z!=="inherit"&&(F=Z),Q.fontStyle=!0;break;case(!Q.fontVariant&&Font.variants.includes(Z)):Z!=="inherit"&&(G=Z),Q.fontStyle=!0,Q.fontVariant=!0;break;case(!Q.fontWeight&&Font.weights.includes(Z)):Z!=="inherit"&&(j=Z),Q.fontStyle=!0,Q.fontVariant=!0,Q.fontWeight=!0;break;case!Q.fontSize:Z!=="inherit"&&(U=Z.split("/")[0]||""),Q.fontStyle=!0,Q.fontVariant=!0,Q.fontWeight=!0,Q.fontSize=!0;break;default:Z!=="inherit"&&(W+=Z)}}),new Font(F,G,j,U,W,R)}toString(){return[prepareFontStyle(this.fontStyle),this.fontVariant,prepareFontWeight(this.fontWeight),this.fontSize,prepareFontFamily(this.fontFamily)].join(" ").trim()}constructor(D,R,F,G,j,U){const W=U?typeof U=="string"?Font.parse(U):U:{};this.fontFamily=j||W.fontFamily,this.fontSize=G||W.fontSize,this.fontStyle=D||W.fontStyle,this.fontWeight=F||W.fontWeight,this.fontVariant=R||W.fontVariant}}Font.styles="normal|italic|oblique|inherit";Font.variants="normal|small-caps|inherit";Font.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class BoundingBox{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(D,R){typeof D!="undefined"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=D,this.x2=D),Dthis.x2&&(this.x2=D)),typeof R!="undefined"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=R,this.y2=R),Rthis.y2&&(this.y2=R))}addX(D){this.addPoint(D,0)}addY(D){this.addPoint(0,D)}addBoundingBox(D){if(!D)return;const{x1:R,y1:F,x2:G,y2:j}=D;this.addPoint(R,F),this.addPoint(G,j)}sumCubic(D,R,F,G,j){return Math.pow(1-D,3)*R+3*Math.pow(1-D,2)*D*F+3*(1-D)*Math.pow(D,2)*G+Math.pow(D,3)*j}bezierCurveAdd(D,R,F,G,j){const U=6*R-12*F+6*G,W=-3*R+9*F-9*G+3*j,Y=3*F-3*R;if(W===0){if(U===0)return;const J=-Y/U;01&&arguments[1]!==void 0?arguments[1]:!1;if(!R){const F=this.getStyle("fill"),G=this.getStyle("fill-opacity"),j=this.getStyle("stroke"),U=this.getStyle("stroke-opacity");if(F.isUrlDefinition()){const K=F.getFillStyleDefinition(this,G);K&&(D.fillStyle=K)}else if(F.hasValue()){F.getString()==="currentColor"&&F.setValue(this.getStyle("color").getColor());const K=F.getColor();K!=="inherit"&&(D.fillStyle=K==="none"?"rgba(0,0,0,0)":K)}if(G.hasValue()){const K=new Property(this.document,"fill",D.fillStyle).addOpacity(G).getColor();D.fillStyle=K}if(j.isUrlDefinition()){const K=j.getFillStyleDefinition(this,U);K&&(D.strokeStyle=K)}else if(j.hasValue()){j.getString()==="currentColor"&&j.setValue(this.getStyle("color").getColor());const K=j.getString();K!=="inherit"&&(D.strokeStyle=K==="none"?"rgba(0,0,0,0)":K)}if(U.hasValue()){const K=new Property(this.document,"stroke",D.strokeStyle).addOpacity(U).getString();D.strokeStyle=K}const W=this.getStyle("stroke-width");if(W.hasValue()){const K=W.getPixels();D.lineWidth=K||PSEUDO_ZERO}const Y=this.getStyle("stroke-linecap"),Q=this.getStyle("stroke-linejoin"),Z=this.getStyle("stroke-miterlimit"),q=this.getStyle("stroke-dasharray"),J=this.getStyle("stroke-dashoffset");if(Y.hasValue()&&(D.lineCap=Y.getString()),Q.hasValue()&&(D.lineJoin=Q.getString()),Z.hasValue()&&(D.miterLimit=Z.getNumber()),q.hasValue()&&q.getString()!=="none"){const K=toNumbers(q.getString());typeof D.setLineDash!="undefined"?D.setLineDash(K):typeof D.webkitLineDash!="undefined"?D.webkitLineDash=K:typeof D.mozDash!="undefined"&&!(K.length===1&&K[0]===0)&&(D.mozDash=K);const te=J.getPixels();typeof D.lineDashOffset!="undefined"?D.lineDashOffset=te:typeof D.webkitLineDashOffset!="undefined"?D.webkitLineDashOffset=te:typeof D.mozDashOffset!="undefined"&&(D.mozDashOffset=te)}}if(this.modifiedEmSizeStack=!1,typeof D.font!="undefined"){const F=this.getStyle("font"),G=this.getStyle("font-style"),j=this.getStyle("font-variant"),U=this.getStyle("font-weight"),W=this.getStyle("font-size"),Y=this.getStyle("font-family"),Q=new Font(G.getString(),j.getString(),U.getString(),W.hasValue()?"".concat(W.getPixels(!0),"px"):"",Y.getString(),Font.parse(F.getString(),D.font));G.setValue(Q.fontStyle),j.setValue(Q.fontVariant),U.setValue(Q.fontWeight),W.setValue(Q.fontSize),Y.setValue(Q.fontFamily),D.font=Q.toString(),W.isPixels()&&(this.document.emSize=W.getPixels(),this.modifiedEmSizeStack=!0)}R||(this.applyEffects(D),D.globalAlpha=this.calculateOpacity())}clearContext(D){super.clearContext(D),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...D){super(...D),this.modifiedEmSizeStack=!1}}class TextElement extends RenderedElement{setContext(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(D,R);const F=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();F&&(D.textBaseline=F)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(D){if(this.type!=="text")return this.getTElementBoundingBox(D);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(D);let R=null;return this.children.forEach((F,G)=>{const j=this.getChildBoundingBox(D,this,this,G);R?R.addBoundingBox(j):R=j}),R}getFontSize(){const{document:D,parent:R}=this,F=Font.parse(D.ctx.font).fontSize;return R.getStyle("font-size").getNumber(F)}getTElementBoundingBox(D){const R=this.getFontSize();return new BoundingBox(this.x,this.y-R,this.x+this.measureText(D),this.y)}getGlyph(D,R,F){const G=R[F];let j;if(D.isArabic){var U;const W=R.length,Y=R[F-1],Q=R[F+1];let Z="isolated";(F===0||Y===" ")&&F0&&Y!==" "&&F0&&Y!==" "&&(F===W-1||Q===" ")&&(Z="initial"),j=((U=D.arabicGlyphs[G])===null||U===void 0?void 0:U[Z])||D.glyphs[G]}else j=D.glyphs[G];return j||(j=D.missingGlyph),j}getText(){return""}getTextFromNode(D){const R=D||this.node,F=Array.from(R.parentNode.childNodes),G=F.indexOf(R),j=F.length-1;let U=compressSpaces(R.textContent||"");return G===0&&(U=trimLeft(U)),G===j&&(U=trimRight(U)),U}renderChildren(D){if(this.type!=="text"){this.renderTElementChildren(D);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(D),this.children.forEach((F,G)=>{this.renderChild(D,this,this,G)});const{mouse:R}=this.document.screen;R.isWorking()&&R.checkBoundingBox(this,this.getBoundingBox(D))}renderTElementChildren(D){const{document:R,parent:F}=this,G=this.getText(),j=F.getStyle("font-family").getDefinition();if(j){const{unitsPerEm:Y}=j.fontFace,Q=Font.parse(R.ctx.font),Z=F.getStyle("font-size").getNumber(Q.fontSize),q=F.getStyle("font-style").getString(Q.fontStyle),J=Z/Y,K=j.isRTL?G.split("").reverse().join(""):G,te=toNumbers(F.getAttribute("dx").getString()),ne=K.length;for(let ie=0;ie=this.leafTexts.length)return;const D=this.leafTexts[this.textChunkStart],R=D.getStyle("text-anchor").getString("start"),F=!1;let G=0;R==="start"&&!F||R==="end"&&F?G=D.x-this.minX:R==="end"&&!F||R==="start"&&F?G=D.x-this.maxX:G=D.x-(this.minX+this.maxX)/2;for(let j=this.textChunkStart;j{this.adjustChildCoordinatesRecursiveCore(D,this,this,F)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(D,R,F,G){const j=F.children[G];j.children.length>0?j.children.forEach((U,W)=>{R.adjustChildCoordinatesRecursiveCore(D,R,j,W)}):this.adjustChildCoordinates(D,R,F,G)}adjustChildCoordinates(D,R,F,G){const j=F.children[G];if(typeof j.measureText!="function")return j;D.save(),j.setContext(D,!0);const U=j.getAttribute("x"),W=j.getAttribute("y"),Y=j.getAttribute("dx"),Q=j.getAttribute("dy"),Z=j.getStyle("font-family").getDefinition(),q=Boolean(Z==null?void 0:Z.isRTL);G===0&&(U.hasValue()||U.setValue(j.getInheritedAttribute("x")),W.hasValue()||W.setValue(j.getInheritedAttribute("y")),Y.hasValue()||Y.setValue(j.getInheritedAttribute("dx")),Q.hasValue()||Q.setValue(j.getInheritedAttribute("dy")));const J=j.measureText(D);return q&&(R.x-=J),U.hasValue()?(R.applyAnchoring(),j.x=U.getPixels("x"),Y.hasValue()&&(j.x+=Y.getPixels("x"))):(Y.hasValue()&&(R.x+=Y.getPixels("x")),j.x=R.x),R.x=j.x,q||(R.x+=J),W.hasValue()?(j.y=W.getPixels("y"),Q.hasValue()&&(j.y+=Q.getPixels("y"))):(Q.hasValue()&&(R.y+=Q.getPixels("y")),j.y=R.y),R.y=j.y,R.leafTexts.push(j),R.minX=Math.min(R.minX,j.x,j.x+J),R.maxX=Math.max(R.maxX,j.x,j.x+J),j.clearContext(D),D.restore(),j}getChildBoundingBox(D,R,F,G){const j=F.children[G];if(typeof j.getBoundingBox!="function")return null;const U=j.getBoundingBox(D);return U&&j.children.forEach((W,Y)=>{const Q=R.getChildBoundingBox(D,R,j,Y);U.addBoundingBox(Q)}),U}renderChild(D,R,F,G){const j=F.children[G];j.render(D),j.children.forEach((U,W)=>{R.renderChild(D,R,j,W)})}measureText(D){const{measureCache:R}=this;if(~R)return R;const F=this.getText(),G=this.measureTargetText(D,F);return this.measureCache=G,G}measureTargetText(D,R){if(!R.length)return 0;const{parent:F}=this,G=F.getStyle("font-family").getDefinition();if(G){const U=this.getFontSize(),W=G.isRTL?R.split("").reverse().join(""):R,Y=toNumbers(F.getAttribute("dx").getString()),Q=W.length;let Z=0;for(let q=0;q0?"":this.getTextFromNode()}}class TextNode extends TSpanElement{constructor(...D){super(...D),this.type="textNode"}}class PathParser extends _{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Point(0,0),this.control=new Point(0,0),this.current=new Point(0,0),this.points=[],this.angles=[]}isEnd(){const{i:D,commands:R}=this;return D>=R.length-1}next(){const D=this.commands[++this.i];return this.previousCommand=this.command,this.command=D,D}getPoint(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const F=new Point(this.command[D],this.command[R]);return this.makeAbsolute(F)}getAsControlPoint(D,R){const F=this.getPoint(D,R);return this.control=F,F}getAsCurrentPoint(D,R){const F=this.getPoint(D,R);return this.current=F,F}getReflectedControlPoint(){const D=this.previousCommand.type;if(D!==_.CURVE_TO&&D!==_.SMOOTH_CURVE_TO&&D!==_.QUAD_TO&&D!==_.SMOOTH_QUAD_TO)return this.current;const{current:{x:R,y:F},control:{x:G,y:j}}=this;return new Point(2*R-G,2*F-j)}makeAbsolute(D){if(this.command.relative){const{x:R,y:F}=this.current;D.x+=R,D.y+=F}return D}addMarker(D,R,F){const{points:G,angles:j}=this;F&&j.length>0&&!j[j.length-1]&&(j[j.length-1]=G[G.length-1].angleTo(F)),this.addMarkerAngle(D,R?R.angleTo(D):null)}addMarkerAngle(D,R){this.points.push(D),this.angles.push(R)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:D}=this,R=D.length;for(let F=0;F[j,F[U]])}renderChildren(D){this.path(D),this.document.screen.mouse.checkPath(this,D);const R=this.getStyle("fill-rule");D.fillStyle!==""&&(R.getString("inherit")!=="inherit"?D.fill(R.getString()):D.fill()),D.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(D.save(),D.setTransform(1,0,0,1,0,0),D.stroke(),D.restore()):D.stroke());const F=this.getMarkers();if(F){const G=F.length-1,j=this.getStyle("marker-start"),U=this.getStyle("marker-mid"),W=this.getStyle("marker-end");if(j.isUrlDefinition()){const Y=j.getDefinition(),[Q,Z]=F[0];Y.render(D,Q,Z)}if(U.isUrlDefinition()){const Y=U.getDefinition();for(let Q=1;Q1&&(G*=Math.sqrt(J),j*=Math.sqrt(J));let K=(W===Y?-1:1)*Math.sqrt((Math.pow(G,2)*Math.pow(j,2)-Math.pow(G,2)*Math.pow(q.y,2)-Math.pow(j,2)*Math.pow(q.x,2))/(Math.pow(G,2)*Math.pow(q.y,2)+Math.pow(j,2)*Math.pow(q.x,2)));isNaN(K)&&(K=0);const te=new Point(K*G*q.y/j,K*-j*q.x/G),ne=new Point((R.x+Z.x)/2+Math.cos(Q)*te.x-Math.sin(Q)*te.y,(R.y+Z.y)/2+Math.sin(Q)*te.x+Math.cos(Q)*te.y),ie=vectorsAngle([1,0],[(q.x-te.x)/G,(q.y-te.y)/j]),re=[(q.x-te.x)/G,(q.y-te.y)/j],oe=[(-q.x-te.x)/G,(-q.y-te.y)/j];let le=vectorsAngle(re,oe);return vectorsRatio(re,oe)<=-1&&(le=Math.PI),vectorsRatio(re,oe)>=1&&(le=0),{currentPoint:Z,rX:G,rY:j,sweepFlag:Y,xAxisRotation:Q,centp:ne,a1:ie,ad:le}}pathA(D,R){const{pathParser:F}=this,{currentPoint:G,rX:j,rY:U,sweepFlag:W,xAxisRotation:Y,centp:Q,a1:Z,ad:q}=PathElement.pathA(F),J=1-W?1:-1,K=Z+J*(q/2),te=new Point(Q.x+j*Math.cos(K),Q.y+U*Math.sin(K));if(F.addMarkerAngle(te,K-J*Math.PI/2),F.addMarkerAngle(G,K-J*Math.PI),R.addPoint(G.x,G.y),D&&!isNaN(Z)&&!isNaN(q)){const ne=j>U?j:U,ie=j>U?1:j/U,re=j>U?U/j:1;D.translate(Q.x,Q.y),D.rotate(Y),D.scale(ie,re),D.arc(0,0,ne,Z,Z+q,Boolean(1-W)),D.scale(1/ie,1/re),D.rotate(-Y),D.translate(-Q.x,-Q.y)}}static pathZ(D){D.current=D.start}pathZ(D,R){PathElement.pathZ(this.pathParser),D&&R.x1!==R.x2&&R.y1!==R.y2&&D.closePath()}constructor(D,R,F){super(D,R,F),this.type="path",this.pathParser=new PathParser(this.getAttribute("d").getString())}}class SVGElement extends RenderedElement{setContext(D){var R;const{document:F}=this,{screen:G,window:j}=F,U=D.canvas;if(G.setDefaults(D),"style"in U&&typeof D.font!="undefined"&&j&&typeof j.getComputedStyle!="undefined"){D.font=j.getComputedStyle(U).getPropertyValue("font");const oe=new Property(F,"fontSize",Font.parse(D.font).fontSize);oe.hasValue()&&(F.rootEmSize=oe.getPixels("y"),F.emSize=F.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:W,height:Y}=G.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const Q=this.getAttribute("refX"),Z=this.getAttribute("refY"),q=this.getAttribute("viewBox"),J=q.hasValue()?toNumbers(q.getString()):null,K=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let te=0,ne=0,ie=0,re=0;J&&(te=J[0],ne=J[1]),this.root||(W=this.getStyle("width").getPixels("x"),Y=this.getStyle("height").getPixels("y"),this.type==="marker"&&(ie=te,re=ne,te=0,ne=0)),G.viewPort.setCurrent(W,Y),this.node&&(!this.parent||((R=this.node.parentNode)===null||R===void 0?void 0:R.nodeName)==="foreignObject")&&this.getStyle("transform",!1,!0).hasValue()&&!this.getStyle("transform-origin",!1,!0).hasValue()&&this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(D),D.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),J&&(W=J[2],Y=J[3]),F.setViewBox({ctx:D,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:G.viewPort.width,desiredWidth:W,height:G.viewPort.height,desiredHeight:Y,minX:te,minY:ne,refX:Q.getValue(),refY:Z.getValue(),clip:K,clipX:ie,clipY:re}),J&&(G.viewPort.removeCurrent(),G.viewPort.setCurrent(W,Y))}clearContext(D){super.clearContext(D),this.document.screen.viewPort.removeCurrent()}resize(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:D,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const G=this.getAttribute("width",!0),j=this.getAttribute("height",!0),U=this.getAttribute("viewBox"),W=this.getAttribute("style"),Y=G.getNumber(0),Q=j.getNumber(0);if(F)if(typeof F=="string")this.getAttribute("preserveAspectRatio",!0).setValue(F);else{const Z=this.getAttribute("preserveAspectRatio");Z.hasValue()&&Z.setValue(Z.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(G.setValue(D),j.setValue(R),U.hasValue()||U.setValue("0 0 ".concat(Y||D," ").concat(Q||R)),W.hasValue()){const Z=this.getStyle("width"),q=this.getStyle("height");Z.hasValue()&&Z.setValue("".concat(D,"px")),q.hasValue()&&q.setValue("".concat(R,"px"))}}constructor(...D){super(...D),this.type="svg",this.root=!1}}class RectElement extends PathElement{path(D){const R=this.getAttribute("x").getPixels("x"),F=this.getAttribute("y").getPixels("y"),G=this.getStyle("width",!1,!0).getPixels("x"),j=this.getStyle("height",!1,!0).getPixels("y"),U=this.getAttribute("rx"),W=this.getAttribute("ry");let Y=U.getPixels("x"),Q=W.getPixels("y");if(U.hasValue()&&!W.hasValue()&&(Q=Y),W.hasValue()&&!U.hasValue()&&(Y=Q),Y=Math.min(Y,G/2),Q=Math.min(Q,j/2),D){const Z=4*((Math.sqrt(2)-1)/3);D.beginPath(),j>0&&G>0&&(D.moveTo(R+Y,F),D.lineTo(R+G-Y,F),D.bezierCurveTo(R+G-Y+Z*Y,F,R+G,F+Q-Z*Q,R+G,F+Q),D.lineTo(R+G,F+j-Q),D.bezierCurveTo(R+G,F+j-Q+Z*Q,R+G-Y+Z*Y,F+j,R+G-Y,F+j),D.lineTo(R+Y,F+j),D.bezierCurveTo(R+Y-Z*Y,F+j,R,F+j-Q+Z*Q,R,F+j-Q),D.lineTo(R,F+Q),D.bezierCurveTo(R,F+Q-Z*Q,R+Y-Z*Y,F,R+Y,F),D.closePath())}return new BoundingBox(R,F,R+G,F+j)}getMarkers(){return null}constructor(...D){super(...D),this.type="rect"}}class CircleElement extends PathElement{path(D){const R=this.getAttribute("cx").getPixels("x"),F=this.getAttribute("cy").getPixels("y"),G=this.getAttribute("r").getPixels();return D&&G>0&&(D.beginPath(),D.arc(R,F,G,0,Math.PI*2,!1),D.closePath()),new BoundingBox(R-G,F-G,R+G,F+G)}getMarkers(){return null}constructor(...D){super(...D),this.type="circle"}}class EllipseElement extends PathElement{path(D){const R=4*((Math.sqrt(2)-1)/3),F=this.getAttribute("rx").getPixels("x"),G=this.getAttribute("ry").getPixels("y"),j=this.getAttribute("cx").getPixels("x"),U=this.getAttribute("cy").getPixels("y");return D&&F>0&&G>0&&(D.beginPath(),D.moveTo(j+F,U),D.bezierCurveTo(j+F,U+R*G,j+R*F,U+G,j,U+G),D.bezierCurveTo(j-R*F,U+G,j-F,U+R*G,j-F,U),D.bezierCurveTo(j-F,U-R*G,j-R*F,U-G,j,U-G),D.bezierCurveTo(j+R*F,U-G,j+F,U-R*G,j+F,U),D.closePath()),new BoundingBox(j-F,U-G,j+F,U+G)}getMarkers(){return null}constructor(...D){super(...D),this.type="ellipse"}}class LineElement extends PathElement{getPoints(){return[new Point(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Point(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(D){const[{x:R,y:F},{x:G,y:j}]=this.getPoints();return D&&(D.beginPath(),D.moveTo(R,F),D.lineTo(G,j)),new BoundingBox(R,F,G,j)}getMarkers(){const[D,R]=this.getPoints(),F=D.angleTo(R);return[[D,F],[R,F]]}constructor(...D){super(...D),this.type="line"}}class PolylineElement extends PathElement{path(D){const{points:R}=this,[{x:F,y:G}]=R,j=new BoundingBox(F,G);return D&&(D.beginPath(),D.moveTo(F,G)),R.forEach(U=>{let{x:W,y:Y}=U;j.addPoint(W,Y),D&&D.lineTo(W,Y)}),j}getMarkers(){const{points:D}=this,R=D.length-1,F=[];return D.forEach((G,j)=>{j!==R&&F.push([G,G.angleTo(D[j+1])])}),F.length>0&&F.push([D[D.length-1],F[F.length-1][1]]),F}constructor(D,R,F){super(D,R,F),this.type="polyline",this.points=[],this.points=Point.parsePath(this.getAttribute("points").getString())}}class PolygonElement extends PolylineElement{path(D){const R=super.path(D),[{x:F,y:G}]=this.points;return D&&(D.lineTo(F,G),D.closePath()),R}constructor(...D){super(...D),this.type="polygon"}}class PatternElement extends Element$1{createPattern(D,R,F){const G=this.getStyle("width").getPixels("x",!0),j=this.getStyle("height").getPixels("y",!0),U=new SVGElement(this.document,null);U.attributes.viewBox=new Property(this.document,"viewBox",this.getAttribute("viewBox").getValue()),U.attributes.width=new Property(this.document,"width","".concat(G,"px")),U.attributes.height=new Property(this.document,"height","".concat(j,"px")),U.attributes.transform=new Property(this.document,"transform",this.getAttribute("patternTransform").getValue()),U.children=this.children;const W=this.document.createCanvas(G,j),Y=W.getContext("2d"),Q=this.getAttribute("x"),Z=this.getAttribute("y");Q.hasValue()&&Z.hasValue()&&Y.translate(Q.getPixels("x",!0),Z.getPixels("y",!0)),F.hasValue()?this.styles["fill-opacity"]=F:Reflect.deleteProperty(this.styles,"fill-opacity");for(let J=-1;J<=1;J++)for(let K=-1;K<=1;K++)Y.save(),U.attributes.x=new Property(this.document,"x",J*W.width),U.attributes.y=new Property(this.document,"y",K*W.height),U.render(Y),Y.restore();return D.createPattern(W,"repeat")}constructor(...D){super(...D),this.type="pattern"}}class MarkerElement extends Element$1{render(D,R,F){if(!R)return;const{x:G,y:j}=R,U=this.getAttribute("orient").getString("auto"),W=this.getAttribute("markerUnits").getString("strokeWidth");D.translate(G,j),U==="auto"&&D.rotate(F),W==="strokeWidth"&&D.scale(D.lineWidth,D.lineWidth),D.save();const Y=new SVGElement(this.document);Y.type=this.type,Y.attributes.viewBox=new Property(this.document,"viewBox",this.getAttribute("viewBox").getValue()),Y.attributes.refX=new Property(this.document,"refX",this.getAttribute("refX").getValue()),Y.attributes.refY=new Property(this.document,"refY",this.getAttribute("refY").getValue()),Y.attributes.width=new Property(this.document,"width",this.getAttribute("markerWidth").getValue()),Y.attributes.height=new Property(this.document,"height",this.getAttribute("markerHeight").getValue()),Y.attributes.overflow=new Property(this.document,"overflow",this.getAttribute("overflow").getValue()),Y.attributes.fill=new Property(this.document,"fill",this.getAttribute("fill").getColor("black")),Y.attributes.stroke=new Property(this.document,"stroke",this.getAttribute("stroke").getValue("none")),Y.children=this.children,Y.render(D),D.restore(),W==="strokeWidth"&&D.scale(1/D.lineWidth,1/D.lineWidth),U==="auto"&&D.rotate(-F),D.translate(-G,-j)}constructor(...D){super(...D),this.type="marker"}}class DefsElement extends Element$1{render(){}constructor(...D){super(...D),this.type="defs"}}class GElement extends RenderedElement{getBoundingBox(D){const R=new BoundingBox;return this.children.forEach(F=>{R.addBoundingBox(F.getBoundingBox(D))}),R}constructor(...D){super(...D),this.type="g"}}class GradientElement extends Element$1{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(D,R,F){let G=this;this.getHrefAttribute().hasValue()&&(G=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(G));const{stops:j}=G,U=this.getGradient(D,R);if(!U)return this.addParentOpacity(F,j[j.length-1].color);if(j.forEach(W=>{U.addColorStop(W.offset,this.addParentOpacity(F,W.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:W}=this,{MAX_VIRTUAL_PIXELS:Y}=Screen,{viewPort:Q}=W.screen,Z=Q.getRoot(),q=new RectElement(W);q.attributes.x=new Property(W,"x",-Y/3),q.attributes.y=new Property(W,"y",-Y/3),q.attributes.width=new Property(W,"width",Y),q.attributes.height=new Property(W,"height",Y);const J=new GElement(W);J.attributes.transform=new Property(W,"transform",this.getAttribute("gradientTransform").getValue()),J.children=[q];const K=new SVGElement(W);K.attributes.x=new Property(W,"x",0),K.attributes.y=new Property(W,"y",0),K.attributes.width=new Property(W,"width",Z.width),K.attributes.height=new Property(W,"height",Z.height),K.children=[J];const te=W.createCanvas(Z.width,Z.height),ne=te.getContext("2d");return ne.fillStyle=U,K.render(ne),ne.createPattern(te,"no-repeat")}return U}inheritStopContainer(D){this.attributesToInherit.forEach(R=>{!this.getAttribute(R).hasValue()&&D.getAttribute(R).hasValue()&&this.getAttribute(R,!0).setValue(D.getAttribute(R).getValue())})}addParentOpacity(D,R){return D.hasValue()?new Property(this.document,"color",R).addOpacity(D).getColor():R}constructor(D,R,F){super(D,R,F),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:G,children:j}=this;j.forEach(U=>{U.type==="stop"&&G.push(U)})}}class LinearGradientElement extends GradientElement{getGradient(D,R){const F=this.getGradientUnits()==="objectBoundingBox",G=F?R.getBoundingBox(D):null;if(F&&!G)return null;!this.getAttribute("x1").hasValue()&&!this.getAttribute("y1").hasValue()&&!this.getAttribute("x2").hasValue()&&!this.getAttribute("y2").hasValue()&&(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const j=F?G.x+G.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),U=F?G.y+G.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),W=F?G.x+G.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),Y=F?G.y+G.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return j===W&&U===Y?null:D.createLinearGradient(j,U,W,Y)}constructor(D,R,F){super(D,R,F),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class RadialGradientElement extends GradientElement{getGradient(D,R){const F=this.getGradientUnits()==="objectBoundingBox",G=R.getBoundingBox(D);if(F&&!G)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const j=F?G.x+G.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),U=F?G.y+G.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let W=j,Y=U;this.getAttribute("fx").hasValue()&&(W=F?G.x+G.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(Y=F?G.y+G.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const Q=F?(G.width+G.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),Z=this.getAttribute("fr").getPixels();return D.createRadialGradient(W,Y,Z,j,U,Q)}constructor(D,R,F){super(D,R,F),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class StopElement extends Element$1{constructor(D,R,F){super(D,R,F),this.type="stop";const G=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),j=this.getStyle("stop-opacity");let U=this.getStyle("stop-color",!0);U.getString()===""&&U.setValue("#000"),j.hasValue()&&(U=U.addOpacity(j)),this.offset=G,this.color=U.getColor()}}class AnimateElement extends Element$1{getProperty(){const D=this.getAttribute("attributeType").getString(),R=this.getAttribute("attributeName").getString();return D==="CSS"?this.parent.getStyle(R,!0):this.parent.getAttribute(R,!0)}calcValue(){const{initialUnits:D}=this,{progress:R,from:F,to:G}=this.getProgress();let j=F.getNumber()+(G.getNumber()-F.getNumber())*R;return D==="%"&&(j*=100),"".concat(j).concat(D)}update(D){const{parent:R}=this,F=this.getProperty();if(this.initialValue||(this.initialValue=F.getString(),this.initialUnits=F.getUnits()),this.duration>this.maxDuration){const j=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(j==="freeze"&&!this.frozen)this.frozen=!0,R&&F&&(R.animationFrozen=!0,R.animationFrozenValue=F.getString());else if(j==="remove"&&!this.removed)return this.removed=!0,R&&F&&F.setValue(R.animationFrozen?R.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=D;let G=!1;if(this.begin{const Q=j[Y];return W+(Q-W)*D}).join(" ")}constructor(...D){super(...D),this.type="animateTransform"}}class FontFaceElement extends Element$1{constructor(D,R,F){super(D,R,F),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class GlyphElement extends PathElement{constructor(D,R,F){super(D,R,F),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class MissingGlyphElement extends GlyphElement{constructor(...D){super(...D),this.type="missing-glyph",this.horizAdvX=0}}class FontElement extends Element$1{render(){}constructor(D,R,F){super(D,R,F),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:G}=D,{children:j}=this;for(const U of j)if(U instanceof FontFaceElement){this.fontFace=U;const W=U.getStyle("font-family");W.hasValue()&&(G[W.getString()]=this)}else if(U instanceof MissingGlyphElement)this.missingGlyph=U;else if(U instanceof GlyphElement)if(U.arabicForm){this.isRTL=!0,this.isArabic=!0;const W=this.arabicGlyphs[U.unicode];typeof W=="undefined"?this.arabicGlyphs[U.unicode]={[U.arabicForm]:U}:W[U.arabicForm]=U}else this.glyphs[U.unicode]=U}}class TRefElement extends TextElement{getText(){const D=this.getHrefAttribute().getDefinition();if(D){const R=D.children[0];if(R)return R.getText()}return""}constructor(...D){super(...D),this.type="tref"}}class AElement extends TextElement{getText(){return this.text}renderChildren(D){if(this.hasText){super.renderChildren(D);const{document:R,x:F,y:G}=this,{mouse:j}=R.screen,U=new Property(R,"fontSize",Font.parse(R.ctx.font).fontSize);j.isWorking()&&j.checkBoundingBox(this,new BoundingBox(F,G-U.getPixels("y"),F+this.measureText(D),G))}else if(this.children.length>0){const R=new GElement(this.document);R.children=this.children,R.parent=this,R.render(D)}}onClick(){const{window:D}=this.document;D&&D.open(this.getHrefAttribute().getString())}onMouseMove(){const D=this.document.ctx;D.canvas.style.cursor="pointer"}constructor(D,R,F){super(D,R,F),this.type="a";const{childNodes:G}=R,j=G[0],U=G.length>0&&Array.from(G).every(W=>W.nodeType===3);this.hasText=U,this.text=U?this.getTextFromNode(j):""}}class TextPathElement extends TextElement{getText(){return this.text}path(D){const{dataArray:R}=this;D&&D.beginPath(),R.forEach(F=>{let{type:G,points:j}=F;switch(G){case PathParser.LINE_TO:D&&D.lineTo(j[0],j[1]);break;case PathParser.MOVE_TO:D&&D.moveTo(j[0],j[1]);break;case PathParser.CURVE_TO:D&&D.bezierCurveTo(j[0],j[1],j[2],j[3],j[4],j[5]);break;case PathParser.QUAD_TO:D&&D.quadraticCurveTo(j[0],j[1],j[2],j[3]);break;case PathParser.ARC:{const[U,W,Y,Q,Z,q,J,K]=j,te=Y>Q?Y:Q,ne=Y>Q?1:Y/Q,ie=Y>Q?Q/Y:1;D&&(D.translate(U,W),D.rotate(J),D.scale(ne,ie),D.arc(0,0,te,Z,Z+q,Boolean(1-K)),D.scale(1/ne,1/ie),D.rotate(-J),D.translate(-U,-W));break}case PathParser.CLOSE_PATH:D&&D.closePath();break}})}renderChildren(D){this.setTextData(D),D.save();const R=this.parent.getStyle("text-decoration").getString(),F=this.getFontSize(),{glyphInfo:G}=this,j=D.fillStyle;R==="underline"&&D.beginPath(),G.forEach((U,W)=>{const{p0:Y,p1:Q,rotation:Z,text:q}=U;D.save(),D.translate(Y.x,Y.y),D.rotate(Z),D.fillStyle&&D.fillText(q,0,0),D.strokeStyle&&D.strokeText(q,0,0),D.restore(),R==="underline"&&(W===0&&D.moveTo(Y.x,Y.y+F/8),D.lineTo(Q.x,Q.y+F/5))}),R==="underline"&&(D.lineWidth=F/20,D.strokeStyle=j,D.stroke(),D.closePath()),D.restore()}getLetterSpacingAt(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[D]||0}findSegmentToFitChar(D,R,F,G,j,U,W,Y,Q){let Z=U,q=this.measureText(D,Y);Y===" "&&R==="justify"&&F-1&&(Z+=this.getLetterSpacingAt(Q));const J=this.textHeight/20,K=this.getEquidistantPointOnPath(Z,J,0),te=this.getEquidistantPointOnPath(Z+q,J,0),ne={p0:K,p1:te},ie=K&&te?Math.atan2(te.y-K.y,te.x-K.x):0;if(W){const re=Math.cos(Math.PI/2+ie)*W,oe=Math.cos(-ie)*W;ne.p0={...K,x:K.x+re,y:K.y+oe},ne.p1={...te,x:te.x+re,y:te.y+oe}}return Z+=q,{offset:Z,segment:ne,rotation:ie}}measureText(D,R){const{measuresCache:F}=this,G=R||this.getText();if(F.has(G))return F.get(G);const j=this.measureTargetText(D,G);return F.set(G,j),j}setTextData(D){if(this.glyphInfo)return;const R=this.getText(),F=R.split(""),G=R.split(" ").length-1,j=this.parent.getAttribute("dx").split().map(le=>le.getPixels("x")),U=this.parent.getAttribute("dy").getPixels("y"),W=this.parent.getStyle("text-anchor").getString("start"),Y=this.getStyle("letter-spacing"),Q=this.parent.getStyle("letter-spacing");let Z=0;!Y.hasValue()||Y.getValue()==="inherit"?Z=Q.getPixels():Y.hasValue()&&Y.getValue()!=="initial"&&Y.getValue()!=="unset"&&(Z=Y.getPixels());const q=[],J=R.length;this.letterSpacingCache=q;for(let le=0;lehe===0?0:le+fe||0,0),te=this.measureText(D),ne=Math.max(te+K,0);this.textWidth=te,this.textHeight=this.getFontSize(),this.glyphInfo=[];const ie=this.getPathLength(),re=this.getStyle("startOffset").getNumber(0)*ie;let oe=0;(W==="middle"||W==="center")&&(oe=-ne/2),(W==="end"||W==="right")&&(oe=-ne),oe+=re,F.forEach((le,fe)=>{const{offset:he,segment:ge,rotation:ue}=this.findSegmentToFitChar(D,W,ne,ie,G,oe,U,le,fe);oe=he,!(!ge.p0||!ge.p1)&&this.glyphInfo.push({text:F[fe],p0:ge.p0,p1:ge.p1,rotation:ue})})}parsePathData(D){if(this.pathLength=-1,!D)return[];const R=[],{pathParser:F}=D;for(F.reset();!F.isEnd();){const{current:G}=F,j=G?G.x:0,U=G?G.y:0,W=F.next();let Y=W.type,Q=[];switch(W.type){case PathParser.MOVE_TO:this.pathM(F,Q);break;case PathParser.LINE_TO:Y=this.pathL(F,Q);break;case PathParser.HORIZ_LINE_TO:Y=this.pathH(F,Q);break;case PathParser.VERT_LINE_TO:Y=this.pathV(F,Q);break;case PathParser.CURVE_TO:this.pathC(F,Q);break;case PathParser.SMOOTH_CURVE_TO:Y=this.pathS(F,Q);break;case PathParser.QUAD_TO:this.pathQ(F,Q);break;case PathParser.SMOOTH_QUAD_TO:Y=this.pathT(F,Q);break;case PathParser.ARC:Q=this.pathA(F);break;case PathParser.CLOSE_PATH:PathElement.pathZ(F);break}W.type!==PathParser.CLOSE_PATH?R.push({type:Y,points:Q,start:{x:j,y:U},pathLength:this.calcLength(j,U,Y,Q)}):R.push({type:PathParser.CLOSE_PATH,points:[],pathLength:0})}return R}pathM(D,R){const{x:F,y:G}=PathElement.pathM(D).point;R.push(F,G)}pathL(D,R){const{x:F,y:G}=PathElement.pathL(D).point;return R.push(F,G),PathParser.LINE_TO}pathH(D,R){const{x:F,y:G}=PathElement.pathH(D).point;return R.push(F,G),PathParser.LINE_TO}pathV(D,R){const{x:F,y:G}=PathElement.pathV(D).point;return R.push(F,G),PathParser.LINE_TO}pathC(D,R){const{point:F,controlPoint:G,currentPoint:j}=PathElement.pathC(D);R.push(F.x,F.y,G.x,G.y,j.x,j.y)}pathS(D,R){const{point:F,controlPoint:G,currentPoint:j}=PathElement.pathS(D);return R.push(F.x,F.y,G.x,G.y,j.x,j.y),PathParser.CURVE_TO}pathQ(D,R){const{controlPoint:F,currentPoint:G}=PathElement.pathQ(D);R.push(F.x,F.y,G.x,G.y)}pathT(D,R){const{controlPoint:F,currentPoint:G}=PathElement.pathT(D);return R.push(F.x,F.y,G.x,G.y),PathParser.QUAD_TO}pathA(D){let{rX:R,rY:F,sweepFlag:G,xAxisRotation:j,centp:U,a1:W,ad:Y}=PathElement.pathA(D);return G===0&&Y>0&&(Y-=2*Math.PI),G===1&&Y<0&&(Y+=2*Math.PI),[U.x,U.y,R,F,W,Y,j,G]}calcLength(D,R,F,G){let j=0,U=null,W=null,Y=0;switch(F){case PathParser.LINE_TO:return this.getLineLength(D,R,G[0],G[1]);case PathParser.CURVE_TO:for(j=0,U=this.getPointOnCubicBezier(0,D,R,G[0],G[1],G[2],G[3],G[4],G[5]),Y=.01;Y<=1;Y+=.01)W=this.getPointOnCubicBezier(Y,D,R,G[0],G[1],G[2],G[3],G[4],G[5]),j+=this.getLineLength(U.x,U.y,W.x,W.y),U=W;return j;case PathParser.QUAD_TO:for(j=0,U=this.getPointOnQuadraticBezier(0,D,R,G[0],G[1],G[2],G[3]),Y=.01;Y<=1;Y+=.01)W=this.getPointOnQuadraticBezier(Y,D,R,G[0],G[1],G[2],G[3]),j+=this.getLineLength(U.x,U.y,W.x,W.y),U=W;return j;case PathParser.ARC:{j=0;const Q=G[4],Z=G[5],q=G[4]+Z;let J=Math.PI/180;if(Math.abs(Q-q)q;Y-=J)W=this.getPointOnEllipticalArc(G[0],G[1],G[2],G[3],Y,0),j+=this.getLineLength(U.x,U.y,W.x,W.y),U=W;else for(Y=Q+J;Y5&&arguments[5]!==void 0?arguments[5]:R,W=arguments.length>6&&arguments[6]!==void 0?arguments[6]:F;const Y=(j-F)/(G-R+PSEUDO_ZERO);let Q=Math.sqrt(D*D/(1+Y*Y));GR)return null;const{dataArray:j}=this;for(const U of j){if(U&&(U.pathLength<5e-5||F+U.pathLength+5e-5=0&&Y>q)break;G=this.getPointOnEllipticalArc(U.points[0],U.points[1],U.points[2],U.points[3],Y,U.points[6]);break}case PathParser.CURVE_TO:Y=W/U.pathLength,Y>1&&(Y=1),G=this.getPointOnCubicBezier(Y,U.start.x,U.start.y,U.points[0],U.points[1],U.points[2],U.points[3],U.points[4],U.points[5]);break;case PathParser.QUAD_TO:Y=W/U.pathLength,Y>1&&(Y=1),G=this.getPointOnQuadraticBezier(Y,U.start.x,U.start.y,U.points[0],U.points[1],U.points[2],U.points[3]);break}if(G)return G;break}return null}getLineLength(D,R,F,G){return Math.sqrt((F-D)*(F-D)+(G-R)*(G-R))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((D,R)=>R.pathLength>0?D+R.pathLength:D,0)),this.pathLength}getPointOnCubicBezier(D,R,F,G,j,U,W,Y,Q){const Z=Y*CB1(D)+U*CB2(D)+G*CB3(D)+R*CB4(D),q=Q*CB1(D)+W*CB2(D)+j*CB3(D)+F*CB4(D);return{x:Z,y:q}}getPointOnQuadraticBezier(D,R,F,G,j,U,W){const Y=U*QB1(D)+G*QB2(D)+R*QB3(D),Q=W*QB1(D)+j*QB2(D)+F*QB3(D);return{x:Y,y:Q}}getPointOnEllipticalArc(D,R,F,G,j,U){const W=Math.cos(U),Y=Math.sin(U),Q={x:F*Math.cos(j),y:G*Math.sin(j)};return{x:D+(Q.x*W-Q.y*Y),y:R+(Q.x*Y+Q.y*W)}}buildEquidistantCache(D,R){const F=this.getPathLength(),G=R||.25,j=D||F/100;if(!this.equidistantCache||this.equidistantCache.step!==j||this.equidistantCache.precision!==G){this.equidistantCache={step:j,precision:G,points:[]};let U=0;for(let W=0;W<=F;W+=G){const Y=this.getPointOnPath(W),Q=this.getPointOnPath(W+G);!Y||!Q||(U+=this.getLineLength(Y.x,Y.y,Q.x,Q.y),U>=j&&(this.equidistantCache.points.push({x:Y.x,y:Y.y,distance:W}),U-=j))}}}getEquidistantPointOnPath(D,R,F){if(this.buildEquidistantCache(R,F),D<0||D-this.getPathLength()>5e-5)return null;const G=Math.round(D/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[G]||null}constructor(D,R,F){super(D,R,F),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const G=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(G)}}const dataUriRegex=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ImageElement extends RenderedElement{async loadImage(D){try{const R=await this.document.createImage(D);this.image=R}catch(R){console.error('Error while loading image "'.concat(D,'":'),R)}this.loaded=!0}async loadSvg(D){const R=dataUriRegex.exec(D);if(R){const F=R[5];F&&(R[4]==="base64"?this.image=atob(F):this.image=decodeURIComponent(F))}else try{const G=await(await this.document.fetch(D)).text();this.image=G}catch(F){console.error('Error while loading image "'.concat(D,'":'),F)}this.loaded=!0}renderChildren(D){const{document:R,image:F,loaded:G}=this,j=this.getAttribute("x").getPixels("x"),U=this.getAttribute("y").getPixels("y"),W=this.getStyle("width").getPixels("x"),Y=this.getStyle("height").getPixels("y");if(!(!G||!F||!W||!Y)){if(D.save(),D.translate(j,U),typeof F=="string"){const Q=R.canvg.forkString(D,F,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:W,scaleHeight:Y}),{documentElement:Z}=Q.document;Z&&(Z.parent=this),Q.render()}else R.setViewBox({ctx:D,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:W,desiredWidth:F.width,height:Y,desiredHeight:F.height}),this.loaded&&(!("complete"in F)||F.complete)&&D.drawImage(F,0,0);D.restore()}}getBoundingBox(){const D=this.getAttribute("x").getPixels("x"),R=this.getAttribute("y").getPixels("y"),F=this.getStyle("width").getPixels("x"),G=this.getStyle("height").getPixels("y");return new BoundingBox(D,R,D+F,R+G)}constructor(D,R,F){super(D,R,F),this.type="image",this.loaded=!1;const G=this.getHrefAttribute().getString();if(!G)return;const j=G.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(G);D.images.push(this),j?this.loadSvg(G):this.loadImage(G)}}class SymbolElement extends RenderedElement{render(D){}constructor(...D){super(...D),this.type="symbol"}}class SVGFontLoader{async load(D,R){try{const{document:F}=this,j=(await F.canvg.parser.load(R)).getElementsByTagName("font");Array.from(j).forEach(U=>{const W=F.createElement(U);F.definitions[D]=W})}catch(F){console.error('Error while loading font "'.concat(R,'":'),F)}this.loaded=!0}constructor(D){this.document=D,this.loaded=!1,D.fonts.push(this)}}class StyleElement extends Element$1{constructor(D,R,F){super(D,R,F),this.type="style",compressSpaces(Array.from(R.childNodes).map(U=>U.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(U=>{const W=U.trim();if(!W)return;const Y=W.split("{"),Q=Y[0].split(","),Z=Y[1].split(";");Q.forEach(q=>{const J=q.trim();if(!J)return;const K=D.styles[J]||{};if(Z.forEach(te=>{const ne=te.indexOf(":"),ie=te.substr(0,ne).trim(),re=te.substr(ne+1,te.length-ne).trim();ie&&re&&(K[ie]=new Property(D,ie,re))}),D.styles[J]=K,D.stylesSpecificity[J]=getSelectorSpecificity(J),J==="@font-face"){const te=K["font-family"].getString().replace(/"|'/g,"");K.src.getString().split(",").forEach(ie=>{if(ie.indexOf('format("svg")')>0){const re=parseExternalUrl(ie);re&&new SVGFontLoader(D).load(te,re)}})}})})}}StyleElement.parseExternalUrl=parseExternalUrl;class UseElement extends RenderedElement{setContext(D){super.setContext(D);const R=this.getAttribute("x"),F=this.getAttribute("y");R.hasValue()&&D.translate(R.getPixels("x"),0),F.hasValue()&&D.translate(0,F.getPixels("y"))}path(D){const{element:R}=this;R&&R.path(D)}renderChildren(D){const{document:R,element:F}=this;if(F){let G=F;if(F.type==="symbol"&&(G=new SVGElement(R),G.attributes.viewBox=new Property(R,"viewBox",F.getAttribute("viewBox").getString()),G.attributes.preserveAspectRatio=new Property(R,"preserveAspectRatio",F.getAttribute("preserveAspectRatio").getString()),G.attributes.overflow=new Property(R,"overflow",F.getAttribute("overflow").getString()),G.children=F.children,F.styles.opacity=new Property(R,"opacity",this.calculateOpacity())),G.type==="svg"){const U=this.getStyle("width",!1,!0),W=this.getStyle("height",!1,!0);U.hasValue()&&(G.attributes.width=new Property(R,"width",U.getString())),W.hasValue()&&(G.attributes.height=new Property(R,"height",W.getString()))}const j=G.parent;G.parent=this,G.render(D),G.parent=j}}getBoundingBox(D){const{element:R}=this;return R?R.getBoundingBox(D):null}elementTransform(){const{document:D,element:R}=this;return R?Transform.fromElement(D,R):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...D){super(...D),this.type="use"}}function imGet(B,D,R,F,G,j){return B[R*F*4+D*4+j]}function imSet(B,D,R,F,G,j,U){B[R*F*4+D*4+j]=U}function m(B,D,R){return B[D]*R}function c(B,D,R,F){return D+Math.cos(B)*R+Math.sin(B)*F}class FeColorMatrixElement extends Element$1{apply(D,R,F,G,j){const{includeOpacity:U,matrix:W}=this,Y=D.getImageData(0,0,G,j);for(let Q=0;Q{K.addBoundingBox(te.getBoundingBox(D))}),G=Math.floor(K.x1),j=Math.floor(K.y1),U=Math.floor(K.width),W=Math.floor(K.height)}const Y=this.removeStyles(R,MaskElement.ignoreStyles),Q=F.createCanvas(G+U,j+W),Z=Q.getContext("2d");F.screen.setDefaults(Z),this.renderChildren(Z),new FeColorMatrixElement(F,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(Z,0,0,G+U,j+W);const q=F.createCanvas(G+U,j+W),J=q.getContext("2d");F.screen.setDefaults(J),R.render(J),J.globalCompositeOperation="destination-in",J.fillStyle=Z.createPattern(Q,"no-repeat"),J.fillRect(0,0,G+U,j+W),D.fillStyle=J.createPattern(q,"no-repeat"),D.fillRect(0,0,G+U,j+W),this.restoreStyles(R,Y)}render(D){}constructor(...D){super(...D),this.type="mask"}}MaskElement.ignoreStyles=["mask","transform","clip-path"];const noop=()=>{};class ClipPathElement extends Element$1{apply(D){const{document:R}=this,F=Reflect.getPrototypeOf(D),{beginPath:G,closePath:j}=D;F&&(F.beginPath=noop,F.closePath=noop),Reflect.apply(G,D,[]),this.children.forEach(U=>{if(!("path"in U))return;let W="elementTransform"in U?U.elementTransform():null;W||(W=Transform.fromElement(R,U)),W&&W.apply(D),U.path(D),F&&(F.closePath=j),W&&W.unapply(D)}),Reflect.apply(j,D,[]),D.clip(),F&&(F.beginPath=G,F.closePath=j)}render(D){}constructor(...D){super(...D),this.type="clipPath"}}class FilterElement extends Element$1{apply(D,R){const{document:F,children:G}=this,j="getBoundingBox"in R?R.getBoundingBox(D):null;if(!j)return;let U=0,W=0;G.forEach(re=>{const oe=re.extraFilterDistance||0;U=Math.max(U,oe),W=Math.max(W,oe)});const Y=Math.floor(j.width),Q=Math.floor(j.height),Z=Y+2*U,q=Q+2*W;if(Z<1||q<1)return;const J=Math.floor(j.x),K=Math.floor(j.y),te=this.removeStyles(R,FilterElement.ignoreStyles),ne=F.createCanvas(Z,q),ie=ne.getContext("2d");F.screen.setDefaults(ie),ie.translate(-J+U,-K+W),R.render(ie),G.forEach(re=>{typeof re.apply=="function"&&re.apply(ie,0,0,Z,q)}),D.drawImage(ne,0,0,Z,q,J-U,K-W,Z,q),this.restoreStyles(R,te)}render(D){}constructor(...D){super(...D),this.type="filter"}}FilterElement.ignoreStyles=["filter","transform","clip-path"];class FeDropShadowElement extends Element$1{apply(D,R,F,G,j){}constructor(D,R,F){super(D,R,F),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class FeMorphologyElement extends Element$1{apply(D,R,F,G,j){}constructor(...D){super(...D),this.type="feMorphology"}}class FeCompositeElement extends Element$1{apply(D,R,F,G,j){}constructor(...D){super(...D),this.type="feComposite"}}class FeGaussianBlurElement extends Element$1{apply(D,R,F,G,j){const{document:U,blurRadius:W}=this,Y=U.window?U.window.document.body:null,Q=D.canvas;Q.id=U.getUniqueId(),Y&&(Q.style.display="none",Y.appendChild(Q)),processCanvasRGBA(Q,R,F,G,j,W),Y&&Y.removeChild(Q)}constructor(D,R,F){super(D,R,F),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class TitleElement extends Element$1{constructor(...D){super(...D),this.type="title"}}class DescElement extends Element$1{constructor(...D){super(...D),this.type="desc"}}const elements={svg:SVGElement,rect:RectElement,circle:CircleElement,ellipse:EllipseElement,line:LineElement,polyline:PolylineElement,polygon:PolygonElement,path:PathElement,pattern:PatternElement,marker:MarkerElement,defs:DefsElement,linearGradient:LinearGradientElement,radialGradient:RadialGradientElement,stop:StopElement,animate:AnimateElement,animateColor:AnimateColorElement,animateTransform:AnimateTransformElement,font:FontElement,"font-face":FontFaceElement,"missing-glyph":MissingGlyphElement,glyph:GlyphElement,text:TextElement,tspan:TSpanElement,tref:TRefElement,a:AElement,textPath:TextPathElement,image:ImageElement,g:GElement,symbol:SymbolElement,style:StyleElement,use:UseElement,mask:MaskElement,clipPath:ClipPathElement,filter:FilterElement,feDropShadow:FeDropShadowElement,feMorphology:FeMorphologyElement,feComposite:FeCompositeElement,feColorMatrix:FeColorMatrixElement,feGaussianBlur:FeGaussianBlurElement,title:TitleElement,desc:DescElement};function createCanvas(B,D){const R=document.createElement("canvas");return R.width=B,R.height=D,R}async function createImage(B){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const R=document.createElement("img");return D&&(R.crossOrigin="Anonymous"),new Promise((F,G)=>{R.onload=()=>{F(R)},R.onerror=(j,U,W,Y,Q)=>{G(Q)},R.src=B})}const DEFAULT_EM_SIZE=12;class Document$1{bindCreateImage(D,R){return typeof R=="boolean"?(F,G)=>D(F,typeof G=="boolean"?G:R):D}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:D}=this;return D[D.length-1]||DEFAULT_EM_SIZE}set emSize(D){const{emSizeStack:R}=this;R.push(D)}popEmSize(){const{emSizeStack:D}=this;D.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(D=>D.loaded)}isFontsLoaded(){return this.fonts.every(D=>D.loaded)}createDocumentElement(D){const R=this.createElement(D.documentElement);return R.root=!0,R.addStylesFromStyleDefinition(),this.documentElement=R,R}createElement(D){const R=D.nodeName.replace(/^[^:]+:/,""),F=Document$1.elementTypes[R];return F?new F(this,D):new UnknownElement(this,D)}createTextNode(D){return new TextNode(this,D)}setViewBox(D){this.screen.setViewBox({document:this,...D})}constructor(D,{rootEmSize:R=DEFAULT_EM_SIZE,emSize:F=DEFAULT_EM_SIZE,createCanvas:G=Document$1.createCanvas,createImage:j=Document$1.createImage,anonymousCrossOrigin:U}={}){this.canvg=D,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=D.screen,this.rootEmSize=R,this.emSize=F,this.createCanvas=G,this.createImage=this.bindCreateImage(j,U),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}Document$1.createCanvas=createCanvas;Document$1.createImage=createImage;Document$1.elementTypes=elements;class Canvg{static async from(D,R){let F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j=await new Parser(F).parse(R);return new Canvg(D,j,F)}static fromString(D,R){let F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j=new Parser(F).parseFromString(R);return new Canvg(D,j,F)}fork(D,R){let F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Canvg.from(D,R,{...this.options,...F})}forkString(D,R){let F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Canvg.fromString(D,R,{...this.options,...F})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...D}),await this.ready(),this.stop()}start(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:R,screen:F,options:G}=this;F.start(R,{enableRedraw:!0,...G,...D})}stop(){this.screen.stop()}resize(D){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:D,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(D,R,F)}constructor(D,R,F={}){this.parser=new Parser(F),this.screen=new Screen(D,F),this.options=F;const G=new Document$1(this,F),j=G.createDocumentElement(R);this.document=G,this.documentElement=j}}globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;const bg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbwAAACNCAYAAADM4c9jAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABvKADAAQAAAABAAAAjQAAAADzprXxAABAAElEQVR4Ae2dd3Ndx3n/0UkUkiCIRoINJEWKtOXEtib515q0iTNOMsnIM7El9yLbif/IG7D1BpIZZyzZcpMcSeNYk+IUj1McyxlPEmtk/2JLIsUOkAAJgOgEQHT8Pt/l3aNT7z3nFtQ9M/eec7Y8++yzu0/bcqqr8lxra2vVo6OjLTU1Na08N6+srDTwXEeW6jzZdkrUWm1t7dLq6upSdXX1TFtb2yQVn+V5bacQwNXTUcBRwFFgK1EgVnBJ0E1PT++/d+9eD0y9YStVaCNxRSFY4Bo8duzYxEbi4cp2FHAUcBRwFIhSICLwXn311XoY9gmStviTY7nM1tXVLcDUlxCIO96KgR7VKAP1y8vLuyFHk59WvE+/8cYb1x955JFlf7h7dhRwFHAUcBTYOAoEBN7Nmzcbm5ubT8l1KZRw14lhDxE+/vDDDy9tHJqbu2QEXP2dO3cOgGW35KCwlbXX1dV1mfeFzY29w85RwFHAUWBnUMATeLLsTpw48aAVdvX19eP79u27AcNe2RmkKL2WCL66qampY0tLS62ClhN6FxwNS6etg+Ao4CjgKFAqBYzAg1FrccppgBk3Jgx6qL29fbBU4Dsxv2g5Pj5+GOu4U/VvaGiYQnG4shNp4ersKOAo4CiwmShQI2S0QIWbEXay7JywK76JUBbWWLE5gOCbEpTFxcV9CMB9xUN0OR0FHAUcBRwFykGBGlkkWo0pYJqzkxuzHIB3MgwJvY6Ojj5ouyo6sHLz8E6mh6u7o4CjgKPAZqBAjfbZ+bYeDLn5pvI0C3Rc5jckaKxujazkLE8pDoqjgKOAo4CjQFoKsI+8xiywUAatxkyb0aUrTIHJyUmPnigWHp0L53QpHAUcBRwFHAXKTYEa3G12ocqs23pQXvI+8MADC+zTm89BDexrLG9JDpqjgKOAo4CjQCEK1GjztBLBmN1+sULUKiIe+hq6YkkbOhcBwmVxFHAUcBRwFCgDBeTS1NmYVazOdBvLy0DQMAhLV/bkOYEXJo57dxRwFHAUWEcKaFuC3Yu3448LqwTdWalp6ept8q9EOQ6mo4CjgKOAo0B+Cph9ePmTuFhHAUcBRwFHAUeBrU8B487c7NX47ne/28jVxvL+FjZy7wLfWlyx1cw7VuMy1LL/NVyG2vO2gkGl8z8XCGN74b17HPM19/73v39xs9fR4eco4CjgKOAoUFkKbFqB96Mf/agV4dbNr0mCjZ8W1hhqSMjpx0HXVQg0hVUj4HRocy3vOvhaefYrja5//Md/nOeaRGhOvO9975szge5vU1Pgi1/8Yg0n1tR3d3evPfroo/rmoHUNb2q8HXJbgwIo0bUowu6c4K3RXGXDsppT/t8taNokvdFHimGdVf/nf/7nUbZKtPGLuFubmpqMoPPXPifwvKBC71iC85wocxsmOrEeTJRjxY5SZgd1W+3s7Px/HqIVfhAtn3322X3c132xDCtTV48ePToV93kkCbJf+7Vfq//d3/1dCTFzEk2YFE899dR+ziA9Du6mD2DNL+/Zs+cqDGomnNa9Owrko4D627lz53ZxfGIjCnAjTp8m+mcjeerpV7c//vGP38qX38VtLwpsGgvvhz/8Yc8///M/d8maC5NYgk4/e4WFmg1Pc0fY7SZd79/8zd90Pf/884OPPfbYdJp8Wy3NM888c4QB3bEReCPgq65evbqAwHrDr1R861vf2k37nh4cHKz/+te/XsVvgbaceOKJJ27508GQDlthJ/xpszo27uv4u4sbUZ+tVCZ0q37hhRf24NHQ+bh7oN0i+0GvxSkfaeulKYXZ2VlNJWyqi35Wox9XLfWs2b17dw31rkWw1dGvGgiXt6eeL5gYvPEWVdG3vDrQ53QYhBN4HkW2/8OGC7z//u//bhwbGzuNBhbBRS5JzvYMtEJY2ClNOCyQwffiT8dgaKLDP/Cd73znLs99222ej7rt8VV93R9hvLteeuklWZfe/CnMqYt3z+JUGlzR3ViiY4TbDfrC1UujF12ki/SP+zE7+1+uORh5MwKpGWbe/LWvfa2Ftve4Os+7Ll26dAgq3SiGUhKgKE9nGSMRRbQYeOXOA14GpO4SaLpL4bLh+cojXSNTJ3WlKAP54Lu4zUeBDWUiP/jBD9qGh4d748hihV0hgeYXYmE44bg4WHT6PaQ7++1vf/vKhz70odkwDPdePAWGhoYCTBJa741jRMzFBlybMG747Fogb/FYZM/51a9+tZ4+sRc8PMGRHUp5cyDvq2XF6Ec/ruO+C1o2YL0Yy0t0hWaamogruB3BOFSMUvfkk09W9/T0xAKNK2irhV24cEGK4cRWw9vhWxwFNkzg/cd//EcX/nTzlYY41OXClMDST4LKXnFCy8aF72nTwizEQM7gCrr+wQ9+cFt0fhikVq6GSbKu71pwYguE4Yo5y8UUvpbCjBi8q+MEYzhjJd5xc+/FLXaS8iNzyJUoLwtMoaSfFWy6p7nIUw3t9X3GgTTpd1IaFATNlWyLMb+T2q3Yum6YwPuN3/iNETrbsBD/3//9372ao0G4eRN11u9uKybXZloBpjx+ISmhqcvezQt/fnhiCsSfwCU08MlPftLgZdNtxTvMcBK8NTm/IRflz2t1pS0c5SbJxXrXptkMd1yDx+gLm07YlUobFKD7S5xLBbQN8sN3VvnNoeTOHjhw4M42qJKrQkoKbKpVmt/73ve66ISJ346LE3oSYhJcrDA1P6XxL3CxdFA6CVEEq/ndvn07IgCtQGSF6JVPf/rT92e6LYAi7xu1SlPo4qZtxloy5jECx7ilRB/7TJI9CKb2cNVYWDLGAgAJTC0yiVjh5NG856jyYQ0F3F2spqxCaKzSHtNYbp6JiSLRS/I25fFfwJmhjHt4Dw0c3Xk/4E+jZ8pcgWmP0UZeeTaPwoCzun///nHKLHolZ84KfShc9lZ+V1vxG6c/m/bKWhfyVrO46F1Z822G9PT9ZfrIIv1jYdeuXfPUZZ73uY985CMLCLx05vFmqIjDoWwU2FQCT7VipeaJubk5s4dOAshvqSleDNteEmwsf686ePCgDUp9F+wbN25Uvfnmm0YQKqPCdDEwVrq6ui68973vLflA7Y0UeKYyef6ee+65A0z0Hw8nQbAMfvSjHx1iLqsJQXI2HI9ScgcGmnoRhJjmN7/5zXeQr6IeBeCvsZ3hPLj7F8CE0U98//KXv9xC/jOJCbZGxBJ0mGXcTNOfJ2knz8ouFn36wT76gVY3V+RCCEkx06rSwIVQmiI8cV5dSg7XCvlXSSeFaBVlaeXIkSMrr7zyyhJbEgJzwwHg7mVHUqCiDCgrRWGMNQg84/qywkcw9CzBZ4WdniXo9Cv2EoyTJ0+an6y9n/70p57gY6DVDgwMnELjf9NvpRRb1k7Px766ZgRJxfsaDLCaPqT+U5TAwwpoIP+WaS6Y/SJ9VVs77rW2ts7Qp2fD86HlqEzO21EWj0ccPgjUdtouIvAIm/rEJz7hXI5xRHNhRVGg4kwoLVayAjgR5e24EwM4+YWdhJR+Dz30UKzbMm1Z4XSyEP/wD/+w6rXXXjM/lQkj2Y0LVKbjQDi9e89GAYTdun38lv7juTyzYckxPbW1DVgIkWzgP0Rf2NC5RlayrtH3V3E1y2pZcafPRJrJBTgKFKRAQLgUTF3BBGxROA2zems5pq8sWXZW2L3rXe+KuDl9SUt6lCCV1fhv//ZvVbhVteG580tf+tKdz3/+8yW7NktCbItnho770dbXpRYoTkW78HDvarNyBE8E4V36wLY8oCBSWRfgKLCNKbApBB6bP7s54iz2i+BW2KkNJJAk+Cp5qTxZexJ6uDqrOX9Tm3avV7LM7Qz7G9/4hk77iNuOUPZqa87nM5/5zORnP/vZomDLwotzaWLxe5vniwK8BTNpPlMu3nVCvTmB7o2aP1wPHFjwtIg7+N56lOXK2DgKbLjA00kHCLueOBJIuNkVl5pvs89xacsZpnJ/7/d+r+pf/uVfJPTaGHTDzGO4Q6eLIDLCLrIKVGAQTqNY0UNxIHHbnSU+sOkbOIswpYtx6RV2/vz5VRYpLDPnk5SkYDjuzAaEXiQdq/oWWQgTCd+uAdCxTot34oTQetYZa1tH463L8XgTExNUd+3/6Hduoct6NvI6l7XhAg+mdyKpznaRigRdMSsxBVdbEfyCM6msuPDf/u3frvqHf/iHKo4906Drj0uzmcMYwDWsjuzGVbwHGkR8dWwpqItz4cH4O9lGsF/54+rHarj9xDeH4ySUtJ3hwx/+8JjipMxwrFWsO5NFdYmuYqzCNWCFwVdVYkGGvxBoEbFoCFveaUyQsVb0PKifnlvpmXaufvnll9Xfox1vK1XE4ZqXArEMLW+OMka+8cYbDezZMqsyw2D9QqoYYac5OAkrznOsevHFF421Fi6j0Ltw4Jw9zeWJ+W85JoBlehLcD1IPuYu1qT/wi2PwOZrIb6yzRmOXogNTilIAlt6Bp086Hc/tudOWjzYxkhxM74awu7fZLGZW5NaGrUohTF13nDvTayj34CiwzSiwoRZef3//kSR6WvelhE4xAu8nP/mJ2WBu4dutB7/+679ug1LdZWV2dHTUPsundsigzdhb4vr+97+/i68S7N0gZOUGHkfYRaxA4YPyUNQm6ArXJWLdqbxyCzztfUTg72Ne0GyWh0ajfKJmQ1eAVpiuDryjwKahwIYKPE78SJyQ9rszi6GWBFz4igvzp1G8fnKD2p+2KOQu7RPaMgKPesQycFuZSt9h5FqsohNZAqeryD3IcU7G5VlpHLLAZw4ndoUmMLwOkAVeXFo+j2QsYMVBF5ME9/F+VgK/sZlWAp8+fXrtypUrcVXY1mGsJdg6mzC3dUtUrnKZBd6rr77a9PDDD5e8gENwLl68aNxdsuL8l//dCj5/fJpnWYgSWv7LWo3+MD3z7baqn//852Yrgj/OJ+z0tfVYa8Wf3j2/RQHoVceKyVEsPTF3rXQ1jczzwGbczE+fa8DyeqsCuSfqUTaXJnWP9CHCqpkTlXt402x90edyaLcrokmEIKEAcK9Gce2iHnnTovyskXYIhSeiQEB3udwDilGumHEWEcUeFUceLYYS3QpelDuGV8Gc2OLfp8nexir7TpqFzdgvC1bOJchEgUwC75/+6Z+a6Nxnf/azny3RgWTtTL373e++K609U6kkRqM2q/ck3KxgsYLOL5hsWFb4cl1qa4H/0h6+8CVBp+PFCl3Ud5fmebbDoLDtBdOQWy0yxybmBKPR1xZi40WrQjAsPZmrG4V2Yzptpbe3d6kcx7VZ2OW8a0sC9Y2AZGl+2QQe85sRWqvAYpW6CLJlDMidrpIXoixW+IE+NFxI2C2yveda0ue3EK5rwIgIPHkIOMg91v1Nnxql/HYUkh76YnRprQ9z0hzgJ8VrECUsInB9Sd3jNqdAJoEHLdpzwqmeTmaWDP/iF79YxVqbJk7m1BTWX6oORQc0J/n7hZ3/uVS6awO59tPJetP14IMPRhiLPUszbVm4PIRzrMaZFsYmSDfM0v0B4ZF0liZL0m99lLM0dfg0GvCDYZxpuzEYR5/Cc18xf1s4jf+dviJX0aammzad+3G2z9S/bALPwtzqdxS/Rs6IPUw/iP2+Yah+42wnuVFuRTHXp+6wEngChfUwFlrkwHE/HopHSLY+/fTTt5544ok7ufz+JO55B1Agk8BDIDVr9aNfI0UrrqHz6OioVgms//mf/5nDKjPWXz7XJ2kDZVthV06a2y8oJMHUUWL2SlO+rDzSb2rGbevj7tkoICsFiyKSiQVLTuDlqIIlVo8lfIipgnbuEVr5AxgrK9D0BsrVuD+83M9yvwKzj43yo+B0lF/iJ7HgU7UIviPUo530Nz73uc+5sVzuBtnk8AJCpxCu7NuSZZc3GfFNaH7yrR/6r//6ryU6/SRuj6nf/M3fDLg+YS6ptkRIwFbiElz/HJ/ftary0gjASuC1HWHC/Kr15ey0dZMrtVA/SwsrbTr6bOyiFf83/dLC2m7ptJ8Sb0gXY6KTtiw4bmm7KcZ3P8IulbenHPSS8AK3C1/5ylc6JJTBIVEiSyjyO4N3YgzLfhD37brhWY66OhjFUyCTwFMnyieAwkKD9PV0wg42I3cg/FZ/+MMfTiMAp/hm2tTQ0JA0s1g3kr86+crzp8v67Bd2yusXcAzWNXAH9eDgpn6pmXZWfDYiPYM9tv2pd3Qyq0gE2UR+6Jlnnunu6ekpiXaywNjf9+40aAh/NPnBj33sY3dSptc33yJ9kX6grxHs2JV7EnTXrl3rxGXYBT0LCjraaJl0A/bggTS0L2eaXFuNYMFNMFZ7UGLyujkVT55WXPe3Hn/8cefmLGdjbFJYsQwvCVc6SDVWnve5nnA6v9AIx1nXJ8yolZNLtOghkan64Ugw6V3CtJyXvwwLF5xWCe/n00CTX/jCF9bYtN5M+UeIN6vBqEMizhbGFrvHEhU6lE3jpb21gq8kYZeVpuBfS1PpSxepBB7tHEsHmPe6uDMZVzVaEJW1nmnSY6Hq696ZhDa4NDBf3cX8dzvtVwMdChaFxTSCFXhbx7sVTFzhBDmLrY96jM7MzBylL+R1czJP69ycFW6TzQK+cE+OwVRfDS9mM7gFJWHDIEoc4LLq/POEpZZny/XfwwJU7zAeb86BgavkcpO8+eyzz8qd08OcoFna7IezlZ/FCGBUkSpA/7IxLTHMSAHrEJCx3Ih1JxSx8FrSWpWlVAlL+zi/UkAk5sW6XsPKHmJz+63ERL6IF154YT8rqHtZuCQXhy8m/pE0d/kW300WpZRy8HLSvEVSeDwyoVBwMm5OrPdOxvYheE5iX8y5OU8A4pchMO51G1EgsQPE1VGuPoWH3YFxafOFWWFj7+G0Enh+C0yrKct9hctW3a5fvz4RLkfasVYsEn6NAVQZrhQudB3eZVFQt8ixbqID2n1JjGYd0C9rEXgcYgVeWQvZIGCyrmnTg2xu14KrghfWjs5XLWiRA3MRAXL1U5/61KUShV0VFtkc8PolPLnP6o7A7VN4QYQLJND4ZWvDMHV6naSFFtAUii9Qmove7BTIZOEhJFbQRGskkCT0/FZYlopaYRa3OdzCEXytstSl9NpeoC8mlOvy7/UTTAbZIlZddJlerkA+ORMRhuXCZSPgoMXrUOcIYxOzyUeHrLhSxjJMLFM/y1pGXHoYXeqN3NQ51qUZB3erhmHBqI4FadLS0jI+OTmZb2+b3N3DnORzp5z9BOGm/Xaxe+7KQfOcm/M61u4ono2j9I/AObES4AjvWwjHchTnYGxSCmRiRDAvdXbDHHQEV1jgyWqywixNfZU+KY8EnoSS4nWpPD1rf105LsHWT8JbFx2+sP+mHAVvAhiy7qDvoThUYP7B42niEmUIw5XUB3PpAm4mb0KGIiJJYe7LWAjRs+UiKe8HgJ8OUkiI3R7BLBRLVUGstRXcuBI8Xf6aSyAw/obwtoyVU9D5y1iPZ51bSlufl5uTdj9k+yX95SbviQrveuDmyqg8BTIJPDr8XVAyCzgkKDS3Zq2wLKhKcFnBKKEj4RZ3hefu5NpUvnJZehLYVuDFlb9dw8bGxrpxR93XJHyV1IAfHh4uq1sHzdocSOArZtM9wgQnWNnXrXmcTYdcGRCCqa+wUno+LSjGxQhj0gg8FJYFxuhtTkkZp3+kEpppy9modLl6DKP4TTAWDiHMV7Dstsw5uRtFt+1QbiaBhytAh/56mp+18iTAdFkhZl7y/PnTKa/f0vJnUzoJQ78lKaGnsLhjwvx50zxLWKsOumB2mWiRBv5mTMPg3oWlHntot9oX7b1sC1Y2Y/3jcBID5HoTrV+nBzXR7yKu3rh8WcMopwlFIzKXRnvMMHdWtpWxfrxk7XLSyR1Zbv7wfM+aq2aP2lX2z1brC/KiD1sNAlnkJWDu8zB0S3WeZSDzOr/kvDdy5dzOuTYNBqonD33mxf3tCApkYvJ0kHscR7WqeTxRRwLJzq1ZoWep5hdqNizurnTKq19cnrDAEwyFlePyW6cw+zoGL2N7e2ixSfSBuepUnMglpgBj1OKcghfnSzbh9jqshNAtuswzAYLoy6rBRtxHZV8kAmNfYs/YvWLdbbS73FnDCaiXJZiP8R6BXp1hYLTJMHPEm8rCYKGWwQe8wuiad+aAe8D7/iR7bIrNEwieQkYHd7fSP87vRKVu87TGxmKSSeAJVZjiJG4v76BXuQRldYXdjEkCLFxdmy6fa9MKPSsQlaccl99yFDyYsehREU27HPhWEgaWx1BO4y1YDExbrj/j/kOIFUyvBPo+H1bDSZhPI26yVHmyJBLMw4cPL2B5XJViliWvS5udAvSXRpSk7Bk3Nkf9iRMnxLtGNhYNV/pGUSDzQgIE22BY4Egg2UOa01QknL9QHmvR2Xz2XihfoXgJWXsJJsI8swJg82/lO9bNAqeSpLLuiq0nruPjOUFZLIiC+RC+u1hheKJgQpdgx1IAN21gdeaOJcQOrXhmBv+2t71t8e/+7u/uMtkb2MNlhZ5WURYSSNZSC9Pcb+UJhnV3Kp3/OZyvlHdbTg5+avdcKWVuprxy5e3du/dqzqUXQA3moM+2BMKKecmtCm0pJm/WPNRjt/acVeKDqhw43II7V8dRLXHwwthGfeqIpfUae4ekQCDkx1lOrxWG6UztrARNSI91tyX3pGKZlt+9kEAjF7z5KFAUN9NS8zihJvemLL1yrHy0QlF3/6/cJPRbeXfv3q3IYoVy41xmeP1JLkCssnkYaurFDnnwWldFAqFU9vL0GSSY5Wno0Q6zPzg4OPh2Frkcy1PnikQh7LSq8DS/FoRcLQpJx7OcBFSRwvIARRm6BQ6z/NbCv6Rs4XTlfk8q1x8O3yrPAgA/UPe8ZSiQ2cJTzTTXw8dgOf95qDtcUwknzelpfky/OMEYzmPf86WVENUiEysIbZ5y3VU2wm9dteRy4Z4FDkx7GoVF82/13IdYhZe4DUELQJ5//vlrnEfYu1NWsSbRkoVaWqQRUIgk/KDPxGOPPabvQVb80mHOV65c0RmhgQvcDjFHOrGeFmfOgo58ORlrvoEFLW8P00rC7fTp07/Mfc4ngH85XthW0oTF+0C+fkrfH0z6CG05cHAwNj8FirLwVK33ve99g2xmjT25QUJJe+gk+HQPC6l8gi0NycLw0uRJSmNh6c7B2Nte4MEcF/hsy+soI68h7AaT6GLDxcxZyv1LvnbwOgzjjZjfVZt2u95h4i0w8NjVrWwnWLc+w5FvWkYcWSki4cKB5+tubca1N8KuOyzslA6BN14pYYfSsRf4Z/IJO+JusPK0ovPUcfRwYZuLAkVZeLYKfDbkPFrb22dnZxOXTWpuTz+5DvUrVthJIPmFk56LhWXxD9+xIHeEfz/HNFPPweTmh2KVG4RBtV1UFKZnoXcYo+idekN0GB59YHc+JhdOX8w7Vlw17syjCXnnWOwzw8b1hOjyBuNZWcGSGYJukVNyaKM9+oL9Rn2aRzXNWXexWxWam5tTfbkiK8VwK7fBf46jiAWsbwtHliW7YK7ZbRY23N13JgVKEnhyedHJ38DSezvzX3lhySVp5/YkqPzCyj5bIWYFW7hJlM7GCVZ4W0E4fZp3C09pX3nllR25JSENnSqRBmY0zQkX14uF/fTTTx8nb95vnhUL2+bTEVQ8my0YNszesZbXfbEIC1SG2APZhoCLrDbUZ25we05VypKy9U6669SSBMEzVwlXInTQkXWHUQBiUSJuhZXXV1AUZmITuMAdR4G8QioNNaR10rFef/HFFx9CCEUWC1gh5oelML+g8cclPfuFndLIqihV4PnxwP+/LAGeVL4L33kU0EIV+oXOW4yr/Li+sh0XUckwWdusFu3HajkTLoe4Wub4jhBetBIRhpn2HVq1Miccq3yA13BaOGnS0R7VTz311GHSRjbx2/yUuYrw7eMw7CWt2u3u7jaNiMvV3PFMrb3nPe/RtwLdmLdE2wH3kgWeaESnWUGzfJ2Va2dZveWdopFVqOWjtwSeX+hpbrDUg6StxalyYSBFu9by4b3Z4mACjdKMy4UX7V2WPlQufMoFR0yVgwiOYz1EzAcxSbZyFJz/LBcuYTgStLg274CajkILX23MaY2t10IaFQ4u9Vjrx8KI5N7ndFYp88YJ0dmDZXUzXhOFnSDSfjUI4JPwpKrGxkbvdCbbnCgGVfqJjsxR38iOhcuxFSkQGczFVkJuFAbZa21tbaMSTP4rreAL5/PD8As7hcvC8wssf9q0z/78MLFt9XHXJBrAmLQfTtpxWX649SIrdZPK3krhz7LUH+ao46giF1Zf6lNpIpnLFICrTgI31gXPnNYxMfwyFZUXjBQDhM9x+lWs4oOwGWRsGasqL6AMkZS1P0PyvEmlNGj1a95ELnLbUKDsg+KP//iP+zs7O7UKMPPxToUEXpjqWgVayiUr0V47ReDZ+rp7MgW0wRzroCchxZzm0RLi1i1YUwlY67EDACbegBUUWdhSCeRwLXZBq71xsFF0K7Jlg7EamTqJKz9tGKtfy84H05bt0q0vBSrS0NoPxIA8j9/8AoJvJmydZa2i8tufP6++dJDWevTns89W4AkGe83WfT7G4uHuxVGAT94UlzFPLmn7WCwn4pJgWazRn/V9v7JaLHFlpQnTykNwSjp0ugt33Vtn56UBmDENh2F3QKskxWDp7NmzsQI5YzEuuaNA2ShQEYFnsWOv3hyC7yJLpX8Oo7jB4JhFcCWe3JEkvMhrQQbuSs/WiEBY2hfltZ8GgnHe9X82JC0Ml257UUDuuYsXL/ZSq6BPPldNLKdB+nNmz0WFqXQDvGPHFPgeU50qUb6EHa7dpO0a2nfXX6nVoliU2s7iLkeBzBRYF991TiPWPhxvLw6a9G5cCbvw8dcjfBiXa41sbeiSIJI157/s8V+KC18SWhKIWRew+N2hDM7E00bC5bn37UsBju06yr6+WPccfXiKxRcjbKPYVASQoobwGUwQPk25bRVlXSWZQtjdAq+KHeHFftkbrLbsYNxmUthRAPbI3bupGtAhs64UWBeBF1cjtD+tivRWRn7nO995uxVoVujpLmEWFoBheLLyJBT937cLpwm/W8sQRrb0J3/yJ+Mf+MAHwkm25XvOBfbW5GWJtQTeLuaStBR+3S8U/bJZL7kzKmM3TVPHRZaxbxpXZpjQuDZHEUJt4Bk5oJv+fYhl+ZPlOkwbN2l7gnA1aDFmJ/iG3v2vKocRLdN7zsrO7C6FRifA3Qm8MrXDVgSzYQLPT6x///d/39fX1xf4ErQVemmF2M9//vOqhx56qIpT7P2gY59l3dnTQThO7DZMYcfsxUHDXcBKKZv2Xel5otgGLHMgG9g7ERaxHYfwNbwQ1yrlnitHVei/a+yD60cBOEf7BpQAPCc1TCXI9Xi5lLLYo1qDF6UHgZG4HQBazY6MjPSVUo7L6yhQSQpkcglUChEGieZNIpeEXSHrzp9JQu+1117Lu5BFglTpdOG+WpB27IfhnncWBV544YX9BSzUG5U4JaTcVKYfz1OP2NWjctPi2vQ+2py1bH28l7NUz+QTdsCcY6vEZXd4Q1bquvTrSYENF3h8deFo3AktcmUmLVbJRyBZbz/5yU+8BSnhtD/96U89gcim6QFpx+E07j09BbAqNqwPYb0EJ3tzaMN4U7WpviunL0Ek1RYBMshcVNkUIpStgPWVVG6x4Tdv3hyCJt40gR8O7aRjxzJ7dCQob926dQ5YiSs+ZdkxVi/haoxdPOPHwz07CmwkBTIPgHIi+4Mf/KCNQRo5LULzcVqEImusmEsbymXFyTrkC+3GzSmYsv7sykxcPyNoxUlLuospdkvkgSHu46SVWEFRTAVQGJqBGcmKsCi4ko422ItL9MFI5hQBlFvLL3ZfQkdHR6qOw6b5Y+AZK4SwitQ/Yi2mOPSgQQ3CoYN8sXNECIUafrEbpumvBWkVV2Y4TNZV0rFj4FXHvLUOG+gL50t6p58cpl55T+WhDWcQdjqvsmLCDhx06s0BXLPaHxnbXkl18IfDT5rB1x9knu1xY5EIF7DtKLBhAu9f//Vfm7HGItq1FXbloLQEn4ScfhJ+etfFoJllocoAv3IUs6Vg5IRErKAopiJxwk5wECQF9zUiAOpgQGXtgzD2e2nn28Axyv3uE2EcYTfAlxBSkwSGrEOMtVQ/MQ+0j8RBgzUEdNm2OuQ7doz6HmCub0juzwgioQAUESlFeYUd9RmFRje4RzWeELxSXiXsoO0xxm0pYKrihB1hy8xpp1KQSircZd4UFEga8BVF7u///u9bEXYRzV4uTFlkWebtLKKFrEEbTwdfYuBfq/QgtXjtxDtCcL6/v39dPooapi/tPBgOS3qnDwyE4+gb05z7WMyKzESXX7gM/zsCb7zc1lG+Y8dQ+lIpGMAAtdV8gmwAOvWvxziSZeenWTmfqWNqK76c5TpYG0OBdRd4fE6omxNOToarq9WVEnbFXmEhaQWchad3NMQl9vppriH1t+Bs/q12p67JpkaFK8NG/j7/4oXz588vF2CeZcGIOo9l2f8Fw9b+S0/o0Udm+G7beipDSyhgqQV0WiJJgCK4b4TTI5ym2DKQ6sxYwWBMeftmLSxgLOAKvohVVNa9fRZ+3J12jZrGcQkzhkH7GfrASMZsLvkWpsC6CTwYYA3C7gzbAXrC9LLzbGEhFU6X7z2cNywAybvY2tp6MY07J185WyWOucp5hMy6CnYsuxUY4vXwqkYJP1yNY5WkHVbA0PDwcITJFypTjBvPwmvQ6gJfgC9l4UVWt9gcQumSNo4XwrGYePq5jh27RXtwW12EPn0w9yu857PaAkXhhbmtvDaQvKN8JeLCen8Wib5Tmi/TVsB3p6/e5Tuemejhy+4etygFqjnt5N3Cnc48xDaAsmubli5aIQYTPsVJ7s0STn6BpGctUpFL0y+4/M+Ck+89HOdPz7zKLAP32kZYduPj40cpv4MBtsqh2v/P0mM97tojR7v28ivbnF0c3hJ0tOEkmr9WNcYycCk8R44c6QaXVtJpfqikCya4JkbIR0/n0NRHKPf+BG1JUIvPLFqDxykg5K0b1soCgu6OLAtokVr4FI9ZaTlRUmunp6f30YfnN4rG+p4dc/sP0M8Ce3Wz1gweAIi1eeg+wgHgY1uB/lnr6NLnp8C6CTyLhjaZDwwM9LIloNYv9BQvt6Z/o3lYiBXzTie/9Ud/9EdDG9W5N1LgWZprAQKCoSLWPJv9V/iQpiy7Tc+8LT0qdYeZVr/00kv1Q0NDERccB6mLPityFVaq/O0MNx9t09Rb9H/00UeXXD9NQ63tm2bdBZ4l5fe+972uycnJQ1h8hhFL+EmgaZWmBF/Y2lO+LAIPTfoeJ2T0/87v/E6qOQuLV7nvm0HglbtODp6jgKOAo8BWpECqFVuVqNgf/MEfaNJ7+G//9m8PsnKsk8UkBhcJNW0el+CT0NMvzeUThnJtDQF/0mlzaSjn0jgKOAo4CuwMCmyYwLPk5YOxOmj2NhbfHqy9Hs62bOJXrT1zOu9Slp+EngSgfnEX1pzcRNO7du0a+63f+q2ynRMZV5YLcxRwFHAUcBTYmhSQwNPcAsZQzK7YdawTFtldintTRT7//PN7cUe2M8+nBS61HP9Ug/Az8yItLS2rCLYlhN88wvAecdO///u/P7NZrTkfXXf8HNc6didXlKOAo4CjQIQCdSzqWGZ1WT0r3vKuLovkrGDAY489pk3LG7JxudzVQmDXS5eAvrGrF8tdnoPnKOAo4CjgKBBPgRoYsdlng1uwpCW/8eBdKMu5DV1RLJzAc93BUcBRwFFgAylQg/VhVjGy7Lf51Vdf3TRW3gbSpGxFX758WR9HtXvgCp4tWbaCHSBHAUcBRwFHgQgFdIK798UANgYX/c2sCGQXUMXJLh492V/o0dmRxlHAUcBRwFFg/SlQAyOewe1mjw/qxtKrXX80tl+J0LGOX7dqhrtYpzts6Ekg24/CrkaOAo4CjgLZKCCX5horIgeVjcUrdayGPJoNhEsdpgCCThv6j0Nbs6meVaUD4TTu3VHAUcBRwFFgfSlgGDIHwk5QrJljYlVhG18z6FlfNLZPaRJ2nK5yGGFndsxzaO9UW1ub2xu4fZrY1cRRwFFgi1LACDxZeXy/7JpdsSlXHMd+9XJ37s0MDQu9ZCGfYF60U9lwFS+gTFzPAMIldRRwFHAUcBSoEAUCh9zevHmzke+BnYJRN6g87dHjNkT4+MMPP+yW1Sc0AoKuHhfmAaL1NQCjJEjYdXV1XeZ9ISGbC3YUcBRwFHAUWEcKBASeytXWhGPHjp3gMfCVYRj3LIsvFjjdZAkGv+NPDYEe1dqsD012Q47AmWe8T7/xxhvXH3nkkbJ/x2sd+4YrylHAUcBRYFtRICLwVDsYdjXfwNrP0V49MHVj7W2rWleoMrLquAZRGDQn6i5HAUcBRwFHgU1EgViBZ/GT4GMBSwurN1t5bparUys5ic+bz+bf5nd9gHRJJ6hg7M2wMEX77GZ53vHW7zZvd1c9RwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBR4H7FCj5u3Zf/epX65ubmxsFbnZ29t6nP/3ppc1O3Oeff37v0tJSDXjOf/SjH53fTPh+97vfrT1//vzaF7/4xdWNxku4DA0N1X3+859fWE9cvvGNb+zh+4ttKpNvDg4XaqNvfetbu/lWY5fS8z3C8Y9//ON39eyujafAl7/85Za6urpV+MLcemOjfrG4uLif6y5jam6jxxTjqWFiYuKA6NDQ0DAR7tff/va3m/no9l7Ff+pTnxqmL1eUB/jLO3369J1HHnlkWWXb60tf+tIuLjMO4/C16bLc9Y3VLN8MRb407d69u/HDH/7wWL5yvv/97+/i2637oN9EPhmkj7mWdLVwzc3NnRAQHq9x21Rf+6aTSRgvvv/9718RjrpmZmZ6YaSMw7pBXodM4Ab9SagwKPVx3T3z8/N7pqammru6uoSTcKv4pfJRVOq5Grg30Ll2oQw0gk8juDTQ4ddI8zr0W6w4MrkCoEcjbdOuVz6wO84tr1JCmnoGkkkP7vdIn0ngaRCqrFKuLIO4lHK2Ut6nnnpqP+Osl49GV3/ta18b/8QnPtG3XnRSvx4bGztFP9pFP646derUZWg3vZH0u3PnDnKj4VAOB/XTQL9eWFjQx7ZN/Msvv3yH+IoKPH95fX194tsBgcdHrXchQAw+3IVrAF/eM11qk2eeeeYB+sLEJz/5yeFCmb/5zW92wIeOwg+qyDsHDxLNYq/BwUHh2cZYPohi81qSclOywIstvcRADRQ66rFiwbS2tr5mBdz4+PhpCTdgXvvsZz+77sJYzJRGrkPLrKPh6vntol67Gfi7l5eXJVTqbT3p7OYR4dNJA99JK2SkyQomg6majllN/mo6Sg0duho6VlNOHbBr9aNc8yNebV9P+bUqlDRVKl+dS5fFhXs1aXoIum4ituEfFuWv0k73iV9k/dBEL5TLitFAR3AfKRKVkrI1NjYOfOhDHxopCQiZYWqyuA9bOPTN6fUSdhpztMcJCTuVj0J057HHHqu4sJPn6O7du8YisvX23xmXdeBmgmjfzqeffrrVHw+eu+24u3LlyhHi7yf2J8o9P/HEE/3rRc+Y4osKmpycPEn9msncTB9vwMIdyFeHGzdujB06dKiTNLunp6fFg67EFSz+B/8ydIfXDyUJO+XdlAJPjJuOYRhxXAULheG+MBo7QkMCxdSRgZyoHRSCFxfPgO4Fx3oG1TKdtxpCV9Nha+yduBre677+9a9L2FSBRxwYf9gSeWeAN4PQmnn00UdTu4YlRCnjpISWLiu0gGXe7V0vGnD60YlMnP8PfDXAlohbIM89WUuiG1ZfSZqdvww9QzsxQk/Qh+N5lwA3F4L5IOmN9WbDwnfS1Nv6gPcB0mtQJV1LaJcDSZHFhlNuLQMt83j6whe+sALuEcZGe0YbqFjkMuSTkpQheSSpxhyMTcJ6j42kX45Rn0W5qm1Y3H3Pnj0LaZW8uPw2DOX2MDzEuAah7Sr94y4CcJ+NL3RHOZ2xCnOhtP54CSz1P3+Y/1njzl7gtYe09jXu3pYv/sknn7xBprcAxkHYZGHUXwLuFGjV0yadGAINjJnr/GItWYXTn/rhnWfIu0/9J266gjhjhUL/xdu3b8syTrwCFCdjzV/91V/lY0QRQEheMX0Trmf5fSOJ8gQ89NBDK2HfMYx/jkEy4M+mCquTUKlJBs8MBNtLur2ETREXdmEZAspFKBikXYbJlZVp58qv426sIXAwQgT8DNrgpfknfxUkaORWXQL/BZ7niTf3uIGOtRDIm+8Ff/80nUGwJGTXgGsGgp7BY5XyVhFeq3omTsqEGfzgPk3Zo9wXEbKLwFkmTcUHkcqnHE+o5asb6fIySeUljR9EEy/6xV6iOxGBvgVtBunD1dCpFpodVEbupp+FgSSlIX1vT09PprEj2C+99NJr3O6b1bnCmBqYYZAHcMxF5b2JptTPKAc8j+bqmjdPOJJ6hMdSOEns+49+9KM6FM2D4C2NPJAG2h4AbqIgsIlzdS7o6rLp4+4ItnbaqNPGQYMaLCsz5WLDUtzPkyazgox1N0fZmo5IusQrDR0YhxMoF4G5ccKaoZ3t78PwwMBYJK6JNEaQJxWwmcPlAUGAvYlC9AB1kTXbevDgQRkO13jntlaNgeC1nepCn9D4Fm/TVMsRlNkxfx3pVzXwr/0KI808Y7CDNF4SpmRm8FjM2oD7kir3hsTdg0Z/ykZmvdOYR/TLku/SpUuSyNJWvAtTV0wpIKAw7wFdJ4F3F8KN0LHlgtpLn5n53Oc+FztIsHSsljfjAS/DgwY3LgdDO3CaRrCqoxvBQoeUUFklfJUGWGFeTGbXUiWFiToLZbyepmo5898IPPCb++AHP+i5ebMI2TRlJaWh3LvQKzDY/Wlp410aEArjeRZ63jdd/Yl8z3R4WdHGqlOnLwA7IFwE5jOf+Yxx4TEYGxhgVuCZfuYrxjwmpfnKV75yADwzC7wwfL1jXYjZZma4smKouxF40GSS9izoVogrP20YtK7GNdVCG7UzjvfLM5M2b1w6zRfHhacN0wIZ0h5Nmz4pHQpHrMWRlN6Gw4fEZxJ5TQ4/I/Do3+P0u0mbV3cYdRc3I/CYcxwKGwLwQAmDLSvwVEdZ8BJ6KAen6Deas2xFyB2nL/URrf4j70/gIs68M760HiMQT34vLfGiTYA+yAcpjvECz8u5DR40GGFCxm0gQvD8K7ZavBthBVM4SLg6WeBCWE0ywd4fCPS9oMlqvsyE0GhDdNyCWvF6CRMfmpv2EVoEFJwwohrYtIFRnLgPxrkx/Hnk6qAdTiuMNr2DclHyHJQffppnFMXhnIJl5hLA51ZYQ7dwSNsEnkYr7ejoKIq5WljrfYdZ1bLSUIxqD3RvZZwZj45lPNxnqPeQ3IKFcNNiKWj2AHkapMXjOg9o74Xy++MR9k3gojkiK3QHaINxf5q4Z/CsxjN1lLxGCVS7vfe9701UxuJg+MPAQ0pPrOKjBWF2ugEe1CCc/Xn9+a5du9ZIvDxC3kV+0ct7L/Qg+LTFWxIhlEE40A9NKPcmBLLhizYZtPC8MKTdnRPYNjpwl4LPuJ4LBCa8yF1MP7rC+oozwJUQa3vhhRfGMCJmuru7YxU94O+ijWTNGQPCgs7ll2K8SHyAXkrDWAsoy4EK0vj3RkZG+iywNPcmLpAwZiiFj7BiM1WlLey9e/cGLDkbXuqdwaiFL6axRShwizR8UjiDJuiLDCEDXK8jnDhxIraBbBbK0KIVo9WRb6EQ87b5Ct1lZaJV55urigXBgKmnfiYO3HYxKMxAj02cECgXas6qTEix84K1bJpBvICFaBctTKHxx44FNHmrpS6Ftfgw5exy63B43Dtt20ibmij6eyvLzlNNL2jOuBCz0hJ2tOWj1K/J1388NOAB07gOh9L2b+Zn6mBuJ8CzAWa1Bu+5KkboAczwYBf5AMsIO+D1U5/RQiA0NlF4jzEuzRhAOIyhvN4ulC9fPLRR29o+EEjqF1bQ8oilYyBR7oU6nA7H+/PH5QmHkf8Uinms8FVa2szLAi16rRJvA8HRPmra5lA43ou8/6A1B78MhSW+qq3hPZfhI5qf8y8qOq9Mahs/j4GHnuZdHshRxtqgBQyMd4Gb2v0GC3k8j4bGTZziEhB4MjfJGNCyKNhwRwqL1USRzKvIOCPw5C/92Mc+NmGR8d9xpbXSIZf8/lR/fPhZDJ2lsnJRmIvGNkKGQdUoWHRO84683a13m449gXdFTPDtAHc16j3KDdSJuEOqF/e4+b8qfMV5hbBPUyvIsJijoT1qjgk/6iA8ClqDti757izDFeM5lS9NoThoKSvDWBqF0vrjqdP/8f7WaPFHluH52LFjU7S9WbRz9uzZvAqFipPSceHChWt6Pn78uCdkGAz1ML7Ui3+Uv8TLU7/pc+qfHi5+uPS9Jvqecdf6w+Oeh4eHG+nrR+Li8oVRRrufYeVLC3wxkFhcbb7HH398DkGtMWODzNiiD02SfxJmM0eZ1Tdv3qxJWoRgM+asxFP0X2n3VYynfsZswXa2+e1dYxh32DHGeBuwRE/NX/fR5gUtO+H67LPPSthZF+OUVj4i8Cz4ou7ANW0LnbRYJmBdgKOIZwSQ4pTGXwjvZgW1wqiL15f8abbTs8YmfeGC+LWtF2tA9sLDDyLg1B9u2PAsd2A23Lp16xz9dR46XvHzgIDA8wOl09YwodgF0+ikEaUteVLVny7Ns2BR8DEGRh1IzLGA5EKhfDm34UmbTh1aF7i0A8fMU+idZ3VY02n1znWeCmuy0whLyr1NRw4IYbS6bgaGrL4Z5guH72dL/8+cnVk+TAfNyyTSQ9yZKSWQaJ/9MJmAC1KaGW24hqvpIHuXPP97EpXk/qEtjHvolVdeuav+1tvbe5B2Uv+9TYcvSWtPKjccrpW1DNQ1MTaUJsPMw2n0Tr9rpN56zNR/qKMm7z3mIAD+SwyTeGPVFUoLDtq6koijH66egbeGS6sfpbab+k0xzzWVU5CNNk6Sdrwq3SwjX4T+V/gFmLmFp7bxLU8XXGnsAYXUps1311w0vOQk+Y3iCz3XsECuMZ4D82JxMKCRFkccJ85YYtBCm8Cvq45x6dOGAVcC2OADzNtMiwz582Ic7Ld7llHUr4SVf+rTRXpj/bMR/EIh698PO98z7TxNu0VWLxK+D5wNLwXfG9Q/oByioDfS1ocEG9oOQePIWESp6iBvYN4sHy7hOL+wUxywKMbM7bUwdkcZu5nGiGCwz/qw2oIxuMpWtECd8gm8VZb37kWDqwOBLhhQ6n1hKtR/HT169ADENWVBuGl/XKFnygb3tXmZ07kBusRdmlM9xNEqSaMZ8uwNXhhlZw7uEsx0kkoXKiZrvGGuENSUnTVzOdJfwd/NxtDXC8FCg22CdpoUVgeYQEEYxS3wgPJB2zto17N07ON6h4YjdJaA8FF4+GIgxzKzcLp87/SnRuaCToFfAwO9GYu13zJJ4mrB4xQ4N9KWbX/xF3/x5p//+Z8n0po66TSPbpV37ty5OwieFRhPgwQPQYdgjmswtADzyYeb4oB3hAFnmI8/LYrUWyaOP4JnMUzmHxcpd5c8EaFo80rdtDDGjrtMgxn4/dA+0UMAvlq0ckoFMS5uwiw8F08YF9LKtf2OcHi+99yijCvhNKo38DSHpsVGu/wr7/xp5YlBCTmsNArnPjUwMHDTnybNM23bRv2Okf++Fnw/k1Z2t9CXPK9QEixwbaSvGyYNDPXlJWD2kDc2C+NEC5gSaWkzwS811swr8CPtRN29PnHkyJG3/IUWQIXu1HGB/h9RBKivaQcVS5q7pAl4tthXuIq722DFfOscfDQCA1oWLeziqqs+xhgaY/wdACeNv0tx6ZLCZCHSN4zXqr29PWIh2oEXmx/G2A8zPCfGwSDtIdH12IR5AhkE8pN3UQHjcgBmRNPIk12+Y20pkNVWCw6/SqfWIpGR5557rgcG3on1dl75abx3WzhoHavqeOQdhWglaW0Wpr3nVmiaXi1hYcPX+54TDnkHjTRKOqwRdtBiRvOzuAsboKFBl4G8Iu2aORBNBh/l14nmWSMmZIVPXL04aiwuOGvYCn3DWittMIAGaHv1xz/+8aosANrNMAfS3Mkn7OIKVZtz9WFtUe0aub97qOMK7vasfS9RuMWVqzA06TnoKEZiNP1wOhiHUZZy4ZkEXhjWZnpnXvcmLsIaaH1ANNfcGPj1CUcpN9qbR5xZRCYlljSDCO9hxWe56JfyFh2kjY2wA84M79zub2hOAwth5CWjn6jvWwXZC/c/MM7FQwoKPLb4NFk3MuPuBMLAD0aWsMdvmX8/GxMvl6bJExcfAMaL6g5vzMyTw3Aq+U4dm1D+YtcaiP/QB8bD5VOvQWjVCi32oETsR9AGPHTh9PadPDrR54jeaeORODe5X0Oy+by7JD5I2U7ZJuS9yJQPDIJ9CDujSVCRCesGSZm9qGRoCTf37dt3kQGWicGlKcy/UARf86ZkWNoLicZ6Su4TDWjacJZ5rqtJQiwnCAZUf9K3Hz58+BxtbSby09CkmDTqB1ioF8HNaI3cWy5fvnxG1oE6umDSb8YYEAVd6aTzBBNWo1FwgLHGJtTr1Mdo2ihHR3C5Gbgp8R1n0NwI/ygrLz4wPLM6kXLNqrJwWdTTjqElrIaAuyWcdiu9i94f+chH+m17QqcD9KGj9MNjKKrnbJsyJqWkvQmjtnwlUzXVh+mfsjKXUMYH6buXgG3oSNlr/BaTfgi2+5oemfWclM6GZ0KMxLS9x9jhdfIwBH70CY/fhuP0Tj08SRwXHw4DTw9eVlzXMf0+aC1lOvIDB+MuDeOicUH6W9BDW7xiFcdwHr2j4OokG1mpS7jcb8Wl8TSOuEiFHThwYAjtrEONwS+ziUmjdAkOd/nYb+u5mIvl27IypdWkcqfBUA3jKaasAnk8hrUewrsALoFouctwBXbB3LVgxwgB6K5l+jdpOyMIAhl8L2JACIQ58mrlnE5uOQWzmmIQD+VcWb7U5XmEfrLyrrEC8BDMqxsczZFrgs7zlBhoIbyVVgKP/HoMXGKOMF3NzZylPnLhiSFFXE2BTLkXGPMsNIkoTDmXpLwdsRdleP3ur//6r2WlBrwA1Nf0H3DKrCyRpxV3j2AmXX7msI+0RtFMSOwx14T4zMFqK+hzi3EqOoveZuGYBQRNx+AnN9XuNqyYu+Z4advX1b70zSr6qQGDJTGPADyfBJO+0E7cMcXDUK8W6tfAfSftlVqoMNYGWG0aUYhwZdbz02Zr0XyJPWiXEdoRGhDeDoyDwo/7BWB5Alph9iJdL/EtjNPYeJtuK9/x3N1hcdxYlr6SUyCl2NcxdiP0FT0KCjwVSEfRyd2H+O3ReXFpz6XLLWU2PnU6452wjzhLg7D6ywxemFteN55gYtZ20VETLRTizGCn07ejFcT6oHFjDIYnlXP4GoalzsaAiF1+7K8Xrg3P+qBcWV4F8/jzQ/Oljxc4/V/7Y1AmOmA0BjaMRpbaCvcbdIJxfn6Qic8qh7Y+D12OU7+9oiFw90HPOfAYZguJFirEdqREoAUigKv5Hx2pJo3b9EfK11c3zOkLBbKbaISdR2Mm+wOCXYOAfniV9qwGd08YpYFbTBqUi3so2tTHywAAHhpJREFUDpp41pyp+qAn8BSGq8+49ah3ZoEHXbQ/MRVaEjbqB5W4qEc1zKhehyFzbm09StZu+otOCWmmD4YRXKIPjdG2YzAhM0eEUNQc7THgzOMGHC6mT0nYZa0bOEiRM9nS8JGs8NXXwnk0NilLB2gbnsOUTh90iJ2PZpx5Y4t+vBi3aEW0h4cYXkh/iGp5YQQ2+B2hPYLXRYsevYu+orYP8Gf1Cfblvd0mgieYR8aLuZPeuHsZU52ESXExF3Q1Y5++10u4N/ZtPiVimqEf2WM8SeHOeR9K6F9Io1WIAd7hZI67CLxQivhXNDpj3ZFvpbe393Z8qnShMDXTyDqGq1AOytVp+4nuK4hjQICXmWSPg2c7aEycEXh0NmnavTHxgSC/5YHQb6HMgpPqfgDgKiZ90R+mZ61SYwDrdHD9DG0UTtialAsOXr0NU8isAeYG7WUpNjClw3RO1VMLEnrlLqQjThE2Eed7V/lZLhajNDJneBha7wVvLyt1FnPwOq8iECKx7g/FkddraxbzdEvgKNxeDBJtNRGMvfQfudVjGY5NX8od3NdgSLIitQJOCojnWqH8Vvql4biyILOWI0UAWiW2KbC1iMtYgLTRPcpITAtugLp/Ok0WPGThoiS+nbzVCLIqbbvlWQqW+VlY0EH9ZBQrfUo0seHKD2M7letXWk2tvnvdxlfyDuPbBX3MGEExWaavV6w4Kfsou1rR2moLoZ/eSmss2Dy6M9a7pdQBS18b0Kb/eoVD/wndN/OVU2Y8QS5cmU/Xlo0I2vSJgvJI/ZZ0EU1OPIMrAlMBlOWl9wrA/dEJo4x1l7BSTvmknel0hT0MaL2bi0l4CQ373EGcsZhgMFr2bFbLELl09erVHn+++7nv/5Nuls4X0AL88XomzS4qtAoBC2o1dAgJiftIhQGlfKczRbQ1mL3cNPeXYaWEU6lk0ENWrKfpqBzoMwHPu4U2YzTpuLL7+/uXmc+7qTgGUaKVoYEJ/AsMXK2I6+KnJcqiqQaw7pHJZsJSXblN84eA12Ez0IdWcZ+OQvdO0ThneXsLBWAWB23aAvcuv/AMp6UvizYVE3gqD/fVBLxVAm+XNHzrOqN9DuRkkI6am87KcBmfN/NZ+/RPb5Um428Q+B79wnRQXybsHeHwQu8af1giYrTGmwCttUPYHDZOfef1o69oVaMZP/RFDyTCrgVhdxI6GL5DXx2T2xqLx0tTyQfwMooh5S+CsyeEy1Em9dY5xC200R5+++nLnjUJ/CVZdsUIO+HGOG1mTBjByV3ufp2NO2gt5nLgv9EwWFm9ypjvrwQeLIjzlEtP4NFIxoWVtUCI72XhWR/utAsO/OE61NY/v+DF6QEmJyB5BR5pWuhEAeuODlwtUzinRXgwc8IzLzwvcYYHmNQKjXIhQxbtE6wB9zPKA32mwNnT+NPA4TDUqCpExpMnTw5evHixlQEA2OpRFuloVVJBZSBn9Y2kKRu4Ygpj+lm3KQxuP4P3dpr8cWkk7FicIgvBU8dgfNN4EG7oQ7MwU1nAsqIlzD2GTf+JpYPKAE8PFs+gaL76oKjIRVkB6y+SIBdAm9XFHYSOG6+euKRsJryzs3NS1rDaBsF3gMAZWTZYM0YZpE+M5WibF07WSPoWRd5XZllQVVaG7scFy+UWdJykH9xDYC0Uqou8ETDtHuqvwycMKNrzLu2kFcItKNF+8IFn5uRmCsEPZMjzQplGOafcguMkD5jYKOpwAnoYNx3lmDTgvYBgGmHeMtVcFHiN0zcMc37Pe97j9Xf6m+YFx6ChTqRZRDiI5qn6sRChrRpl0BikfH+UJ2vRhPDcRpqARwBjxvtcEeVpTthYlj4QBjZ5/UFFPefauOw8O4yMJ/BomGUqn6UjyNoRdzEDW4DtsxqDwRcgXrhg/zuNnDetrEqS7KXh/YxahwRXw1jO4a/1Oocfbrmfc50s0SqKK08CmYFuokRjtlRkyh8HU2Hy7wP7kr/zY0FL6z6WlCdLOFsTfuGfJ8lZKWLcN8IKRha4whs8J2AK7fzmUbQGP+rbI0QfukO7HuPXKiFhhTjKxv8llYMS8jbaxihUMNTIht+kfPnCweMgDCytVRkAJfrI9UtgK3D2Q8ebMA9jESkh/aAiAxshVwNTNLgwVkrnQgZS9E+KCaFG+aTtoglyIVIYaN+DjF1tVQiko710/qnnig5E+l5o21/yGvG2+JJ4j5Sj7+BFmLISQI9a4o20RQAsJ6XzgGV8YMM9ywxu6ustsnanVWd4oL5Q0o5V2+6fU0oCLUFpFQLwq7J5/Ho+/E7C7moSjLhw6Kx5RCmSiZf6O2kS44mT4qZf4CJf4H2zv3g1hBH3pUVWGhuNeZafLJhbdKaeXN7bIhwNskYjXcoNjLRgE9NRRg8EX9a8lE2E22iazqF5Ag0a78OKNn6r3TUArRsoLe4w1oBrDuai1YpBzpIWmC8dA2+F77Stwah9ofcfSxF2FhjCdLC3t1ef7RhXX7Hhubtn1TG4NcC8Ng+lM6+5fZGe94C+sp+Iobi06xnGmBgDF+0lqn3ggQf2IfC0kVbzXHeLHReqGxawmUOOqwvj0VsWjyWqtN57OD0CSEdahINLfs9Zc/ulsAAsEde0BYUXIeXLB321yjfWTQvtvKzQSfipn+S9JIDSXrnTgX5hxwfCqg3eFDtFlBZmXDrqUfL4joO72cJQdH6VdnrLfZgRQdpXUwYRxcATeGnh0Ql0GPJxANYghG6z32FBE9e6eJ5nocNtOt0htOMTMMyL/EodVbIk62loncTh9dqccLhi8WZwv9s+6y7LCiZzwh+W5hmBsQDsG2nS5mhxBvy0+XU4q8BSGbJixsbGDvHYxkKRK8X6+QULms+Bh9wf3gWO3sn8xEk5SRzF1F3zapp7naQNE9N5wIt8yLXjGJveAxByc3snbSACvCDD0L5IcLZZdG+SZVGsUPEBGsYdGVkUgDtPnyI65UsX+4irbwqmJ21/F3l6oOcuJcQKi2x1iAUQE0i53pxnTLTmub1g2jniwvIieSiHsJOShmLbSDvJ9SVhI0+M5wZTeZQzS7xcuHe7uroK9ilO3DFjQXnJMxq3UlFxm/Gyws6PG0LvHmNw0h9WzDMwAovTssAQHVEyb4bz6NtxhB1WOO10gX2rgbl/9sTusX0dGNeBEakH2yuOgFtgLUG4nGLeKa+WsVNMVpOHsRBgChZQZogIO608kua4hH996MUXXzR+awsQ19MQwqcNhJsgmIiZSnjY/DF3fQlcbqoxBEpMdHyQvnpOg5o5k/gU8aHULbXLEVerNEXRopnGkWDPND8nDFAS5JbV4bfVKA7qPOehXUHGoLzhK2fxBaw+5kiOKB0dehH6JVpLMC8dRm0sdVYyjodhV/pdp5uzsOkBcDCCQeXh+ss/WUYathu0WDee6kj+BgS/rIthwSj2gnEvsijAm+y2cKSgWBe1DYu7qw2h/TADT5+eMXXiefkDH/jAJCud47LEhjG3uUodA4woNiGBKkf9CDqYhSRJ6cLh9F1PkQzHxb1jxbXSNsfFlKB1JAk4LOOBGWfv7GiuT0bSxAUAt5tw4/qF/gvsxbrJuI9LGggDj2GEakQ5sYnE/NQOepcA4qdPOQnxrlzYCGGJ4566BMaU8qS9KPce/SiRL2jcab8dUxNL+cY9ylMzOHpjI235SgcO8tZEDA/4tAcGBWk1nAYFfA1lzaSBXrEwwF9TWh6cCjwM0z9TTwGAp4yxRM9GJoHHAO6AeNLAxIy0mXmV46sCdVSjsbKvD0LJ8ulAKCyzsiyxwQOZE14QrHf4JcQWDgYPTXwv5UtJfWQpFGSwFgbMpZq6GVrwvKL9RDYuy12uEODoYFa5gndzMo0GYdlccjAOzSto6bhWriZedCrNN8lFrRVgi3ELNv7sz/5MgzIycBKBpoxAiLTgrj7JgDb9EXrepRxpl3nbgwGqOSszrwDuxpIQYyOvNjyPcC9KcUiJdsFk1Gmsu7v7kK0X98yLVbBUpynoDRUmr0WcFaE49UcY2K/wqHmqKRTPiDtH6cpxyXpF8Z2HvoaxqP+L/rxrP6W+mJJ5oQm4d9H3jMIFrDUsYR0YkKqv5Vu5qvpqwQZ4marTt0fAb0zbbuBRRuAh0GbSHl9VDvpZGLKQ6eNnpUBBzzuEl2ocWNDb5k67LTNPnErhU6WhY94+k1rg5YTdUQGlQ97K10G0YZsz0K7TmCdIe5DOXIOWM6C8WS86fS0dw5SbNa9NDx7DEC1ijtt43RkU0gwik7L+NP5ntFEtujAaF/eiNs9aeAzAIRpKE/v6IONBGNs4jG3Rxhd714CCfnYxR16BR7n7SatVVzoP8W1xmjs4yoXszbEVi5fNl7OWtHpP8x1i2ivsy7sGA9KcrOZm67mDVrzgYh5wPwLPLFKQ2wwBM4FXQd8Z26X2Ib+YSMUv4ciS9IY4Nyq4yHoy44x6JFoRhZCUVYW1d4z7nF3R6s/D+GwBvlmUwZi7648r97PaAzz6aKe91G8G4XrP30Yofw3g00Xb7Dlz5sylQm7JHG+RN0i8xXz1IOHQh8xVkeJG3zKKKbAXcdutu/ciCWnGnLdKkv5btBWZBN+FRymQSuBJ+6JxTIeEGab6SKIEIkLkJgxULjV9pqWGgVHwiKswijATxlT+uYtwnkq/y7KQYFI5YmjaElBKmTALfZliAFjm7EsEgDTd66XAVF4GUTd4GjCUkcgEYV67aVdv4UdSubRlXu0pKV84XJYKTLsLV67c42ZiWswI184VucBy2rfJphM9eIgV/swf6TgyzfWs4hoep11WYJ6T1Hm/2oe+I4uqLDiH66B3GGkrSkArFnozglr0lULgXXLpU75HV/A5DI7T/CQEU1/qb7SPFlnoyyV7Kesc9RxAifMOR1c8tDQwsVwS2zp1oQUS5rRuo3mHpxoQhK3Qv1NKDHOsp8D/Er9IO6he7JFSH/VWw9KO13H55lVOC6DmRQs+itsJAowiwP1GHB5ehjwPUmq4yuoxYHx6rjfgp7Zi8qC5ZaPEg+jbbVjrAW8g/bpRB0inrRg8SocvJCbPK/ByiwiOkVtzItL+p/Gpp/5Ior5qgLCUW6qLwdgBc2iC2V3LYr2IYfEr6C6EWN6gEa6VvJib0IIAY1lQr5KsO4unFAToY1x5hLXhFh4pRcuFCe8R0xF86DeaY1C2uMAdTVw9JMCsbQLo6n16h7rmdQvbPIXuMORu4ErYmaTCj9V4g9YSIM7rsTDPWIGnLRgwCSNMYBzag2jy4LIaAq4GSD30lMvqdiF88sVrDOh7e+CkFYdNnCtrPvCpPOBtltWDh54DYBjA+kqDWWRCnDlqjAT1zCsf4Z5Jmckx6evUeQo85O2opW2PolC2MffZx3sVS+LNwgHiZ7N+XUL5y3nRb0cQyDrVRIcINPN5sOPQSC5KT2CIPsQfBl/jJRGNEE59CLvEubgsOFKejuAS77IrRXXE3lQWGP60OgSf/tSDEJ/Q9IXtb/40WZ9FG+pvFDbaLzJfnBXeVk2PTGhk64a+aC6lKCDweG9jfHtbegrVkT6VN0miwBPD5JgmnQFnGLsaGt99n7/T5oWci5Qrk87N2F/uUQPDMM7x3gcDTqXF0XH1CYkwESJFI1jXReCpcbBMjIsE4i6D2wh1ieBTTADnEt7EujunvDB6WXmXioEDjrXgKBetsUA5WWUwHxwYgQRZLDNgw7m3KoF5lbIIPBjbEPXTQp1lVkLeCAt2+oi3GALh6DFJWwfq10AazdVpQn5Z8GwcdZmD0Y3SbyQA5B6+C3PK685V3pxyp9NkDCj6ewdeiS7GgBQ271KZ/ot09xCyM1ibXn/O4XfcpmXRyVWUinZwlSBuQ2PVNxozM3b62jg4acP2ccrVtypb9GVnxtYC7wYx2qjgWPHjX6lnxsQAAkJfC5Bg20+byEoXL9gNrfSpIG9BGW01jzJ9FWFXFitHbYnAPUl5Zu+Z2gj3981S6ko9dJajrJCDQ0NDY8DKz1kLFEYfaWGs271x+mhxxAIuAGJbROsINsbyA7SRscLVdlbxVQXVN6D9QtrK0kZSIhLlWiRCBV6/fv0gndRYByoIALcQXLeLXThC5x9ShwemmLA2gJ4UUzrJaSH+yqWt1Ealg/g1CNYT1MEwFwapWbhTLnxgzPdgaJPAN9+CktKBiZ/JPSVmy0A6CQzDqKF1STTGfSZ3pxEs5dBqRSvBAc+LSSvToKt1QSl5QMjSBtUws146tknD6rJbYbzoZ7fos23AqdFRVpR1gTSxblENOITvAwi2Wmim8swl5sbPvpo7cJcJWyCdcUUhrG/KmvEnkhttdHS0F2Fk8CPtbW01YVzNUYYYXD35joLTbBJOfnjh55xychkadFBH82VneIVRSqDNCm0vaxI037KmwjDW413lc8kqPUN5srI0rbELwb8PfD3Ckm4UQV62cUQZTaz21dSAsRyh0eypU6eulMpngGMUf9GOPhXokwoLX9QxoqjZNLR9LUfcHbfvpDWrEKFVG/154fHHH9dh7YH89GXRU270QLiFsRXv0LROY4+6SpnQp4Cuh9uJcTQm+ZG2fihZshSN5yUujzfCNVA1V6djn6ywExIQ+iqDrCS3kAqWdsoczSUazWhG3NtVllZQ8ewNgDgkN0sYAugINDFuNBqnLAcox9TNozWCpicmPjFIc1/MjZ0lgXHjgOso86bSRou+6AtGC4VJF73gIq5wMXvwix28hHvMBfwD810w+oMMFIMT/UZfaTbMwl+GhAJ431AY7VQnBUD925/GPmvJP+X5BaxxMRGvL2iLdgNYmZcp85csk/8Fffiazcs+T/to7uBTw6rMk7K8FCD8UBJNe2ogy2WncA109queEuPTezEX43IOYRrQfFUPGOYZmP47tAhLcx+llFEMXjaPxrQ+jwQNtcrUXOBrjsLTC/hPQ4cL8IV+8C7ZupGiTr2PUsZZyjbCTvSnvS6Hmeh9bN76Zw7+rZfkJzPupfSkscYwEH7J72f8rvtBii7su9X2I4MjcXP04UmNXcJ6sX4fhA//Cv1cH5Bt52fGAnS6IniMB7Ni1w9zqz3TJ4yhpf6qH/hrvF4UHSpdF1OwiI2kNfuFQMCUSceZ4dcPEmVxMwgoTE5HU53HhJW7Z48qS8c/QgN3aCtD2LWlPGIOxPfqudgLYu4DfsA1FYYFUzMdOhxu38U86JBmnoSwJVwkhqHa+Dz3TEwt55KboiwdBNxMh99HWKy70ZYJTWXVdVIHs8xa4dBVR3YNMVBsssx3ytZXEszApB2C3D0ztPQZqLfR0MRc6COeUMQd1s1gMa5r8Flk3u+aP95fwp/+6Z+O0W9k+Ygm2hN6mvpIeQto5/TJFdINU+YqzOYeQinV+ZD+svQswQKT0lcAjLAjaAnaBeatZOmRZoR6dfJrRDnRgo7LaRioyiBdDed06pNNB8DV49KUadyq0EL7X3k12zsOkOUAru016HaX8T2F63UqbiWpYJd6qf6UpfneZuqm8zGbqb8OpwiA5n0ahWC4lAMW/ABFE+YID6A8a8rEjDX6hvrMbYTDUFL/gIarjBcDiv2vstgTXcwqg35nXLCUcT+TH4kUz9CiWvOA9MFD0MCzyJnG6FN2cNZ5w1K+5FnQHK13Ggx78O5Bs0kUrLFi2o/ykk7d8RRL+sZJxkFA8aB/epu/oVcP8d3hqkKPBnAPBye+i6dQP78FpsMyroTHZSKAEiNMb8RE1ykdhrFRAdp2eRBtIqI5l1iWyS7Nnoa9jPbXQYfTp2F0soeW48f6xBVPxtSTlnE4Ul47DCIuygujHO857oFO02HDaaD+sNaoDv3yyy/X/vjHP/Y2cBJWg5vCcw0DI2CtWHjhO53rtmVo4KX5wliBB5NpZBBotaPZuC444LYGw9Mcaarl1xrM586dq8a9KCZhhMuTTz5ZjRuohfbxLEz6RNm1L9GMyxNowl9uXMKl7Upoe2UyUHQmo2hh6sjtargNFOe/EPaDwBMjMcoDtHkQmpmVoP509PUB/zu0878WfJZ1gbvyARIay5q7+cgni0cCwlWAgD0A45ObWJ9EakEQ94JfRHATZr45hwtwN22sTceamzBbD0QbXWprfsOcTnKbdlS/G+DkC+2nbLdMReNHZUFL/Y5Aj2WY2xLPmmKQm3cJK3cR+Ape1DytlABTgO9Prl/6pLauiBnX6U455i4Bi8JFUTXCSRayrFsvN2EqZxRrS4co67nki3ZsgCG3g7P2BgsPAxMctBewHzrPw0TzlePhAX6dMHPtiYswCWDpuD4pD0Y4UFYqxY/+Wg8ttdhJbd2C0NoHLH3axuAEvgt4Ta5DDyNAc67xEW2jYKWq+oa+FK5tH9JgBAcW3XgQxXsGuKM8T8a1U1yFySs+H9Q8QgnBJ6Lwg6+Xiva0FqkXpgdgB96zvJB3EqVESmEiEGjXIyUhLVxg3e8ICRlMjbS5FS1wDC2w6sEHHxwoxEgSYKUOBieNhhHKnKYzHWfADamDxgEQMWj4obg4fxgdI5EoEFaM4a0R6M+Ye1bH0i8mygSxOOAKK+wOAacmzuKSkIB5vYM02gBs3GL4kwMwqUsqt6AsXQSlVuTp5IxhMb8czTz0xIBgMg8qgDQmHDpNk24QRp+qHGUSgwROL+UZGPqjDlVW+9U7eExS59QwlSfN9Zd/+Ze7odU56rcC3mpnnRLijTLezT46ub2po2lfpWPAX8VCKIiPaIYQuCahQn650/QtttOU95rgpMExTZrr168fJZ11I+uovcsIuwjzFCzhBLO+Bh5nxMiEF+NAngNTV30jkPrpa/OeR4I0RoCQVyB0LRE2Cq3usBLaE6oSesRJ0RmXQEAR0sKWvRJ45LXWT50EFDTwFugwBgXTXPSFqueee26IY98GbZjutIWEoD5J5fU3y7wV5r/AjSKXZyhb/VFu59ix7c+T5RnaHKNu2rcqYWCyUs4CKMqjkWpzvwQv49MecCDCtkHPCBp+2iiSLx9EFEnqr+MWT4CPrB31XwnPav8YssKD+EWex7T3FpwjBeYsOPWFO7RnzbFjx/ZK4AKvVeVDU50s1IKgX2VcTOBm7wdOsAGU0HepTOhUlGXqAxP7CM3Vj7y+GpvIFyg+gtKloxhnEXaDhXBXVtHSB6KkR4+5sAKzIOFKKikmc24gvBkT5QXRmVYg0m0vIOEBxpko8LCYrlGWZy3EgdCcB4SVJhd75ZjJQGwkgYoHB3Uqw/jAG3BvWY10DB1mqnm/JBCBcBb09L2HT4SoQ8TlkVBE8zELXCjrLgPglv3uWgBQgZeBgYFpCbi4i7INA6Vj3gT3uCQlhWn5PMxLgkHaI2PyPvPKAdXZpEaoQccJBkgX+NQy2K9Aj4KrLi1iahfocw2hcpg26ESrVj+PMBqbvpg7GvkAgkIf99WJIzo03RNCcfCkmcvSlMIiZoSF5s2ziia0q/IHmIgYBIxS82GaFyx4kokYOmnlpdGKVc2nNSGEmugn+jhyoxiV6El85FJZ4UCN1ZyCqhNwllVX/WgzfWUF429hgeX684y1+aTFSGGYxb7TB+QWNdMLwpW6DCP4zfmvWfop+F/np9W+ZnolCR/K0GC+x10LpCKCg/z66K9oIqUqAIYwKQpz9LtZrLIpaKMTadZYjBZIF/eS4zniW5OyGLmrzu2U0QBcbjWrghWXNxQ2xZi5EQoryyt4HQWQ5/1KA5RV48Y7g2elYHL60xDjJLW3EWXxOO1kpxUi8D2Bl5JwEQB0PHVyY4HpOZKgyAD2ui2iIWn5eirmZHFA8zNuQ077X2WAjqh4iBCrbftRA/dpOhBjx7h5/FGpnzUgYCrGP28z0cnFGOZp3LtoYza44D2NlY2L6CZunZGsKzn9hTOo9KmUK9Rb7hZZT7KGV1hpuMpKsgUNujiB64dRyvPevXv7aLPd0N9ocfRDuQPv+ecqYGJL7De7xF6lWoR6QcsujE+ub99EyGQ62zEMR++c0bqKVWwGIH3OMD8JFyyzy+985zuX0rSb4CgP+Fymny9Rv0Afp10HoIn2Uc63t7fPU6ZpB+XTlYZZ3k95/z9XfwmxgCDLMVEx0nq8LHUIkjr6bx2LOO7689tnlOIrxfIJC6Mcd23pAPd+cJ23Sh5hmUGrX5HpqjIyRqvlpYkDoi+HFKo3nwcaon/qlBid57oEbou4ohf9/TgOdtqwHK63wVOnMsnluR9rM2CFh2GR5g7tWsM90O7hdKW8U1/DN9PyaZWVZoxAbzPG4EmZvi6C0SHFZ57V5RHFpJR6uryOAo4CjgKOAo4CjgKOAo4CjgKOAo4CjgKbjQL/H0U4I+33KKiUAAAAAElFTkSuQmCC",bgImg=new Image;bgImg.src=bg;async function imgToCanvas(B){const D=document.createElement("img");D.src=B,D.setAttribute("crossOrigin","anonymous"),await new Promise(F=>D.onload=F);const R=document.createElement("canvas");return R.width=D.width,R.height=D.height,R.getContext("2d").drawImage(D,0,0),R}function addWatermark(B,D){const G=Math.max(B.width,B.height),j=Math.floor(G/600)*5,U=Math.floor(G/500)*5,W=B.getContext("2d");W.rotate(-30*Math.PI/180),console.log(W);for(let Y=0;Ynew Promise(F=>{this.canvas.toBlob(F)}),this.canvas}});const preset=index.offscreen();function blobToBase64(B){return new Promise((D,R)=>{const F=new FileReader;F.onloadend=()=>D(F.result),F.readAsDataURL(B)})}async function svgtopng(B,D,R){const F=new OffscreenCanvas(D,R),G=F.getContext("2d"),j=await Canvg.fromString(G,B,preset);j.resize(D*2,R*2,"xMidYMid meet"),await j.start();const U=await F.convertToBlob();return await blobToBase64(U)}const feedback="_feedback_1x8ma_1",title$1="_title_1x8ma_7",wrap$1="_wrap_1x8ma_14",sub="_sub_1x8ma_17",group="_group_1x8ma_23",text="_text_1x8ma_51",submit="_submit_1x8ma_72";var styles$5={feedback,title:title$1,wrap:wrap$1,sub,group,text,submit},bgSubmit="./assets/submit.a571df10.png",BackIcon="./assets/back.0e8784e6.svg",__glob_10_1="./assets/setting.39685e69.svg";const header="_header_1l0s0_1",left="_left_1l0s0_10";var styles$4={header,left};function getImageUrl(B){return new URL({"./icons/back.svg":BackIcon,"./icons/setting.svg":__glob_10_1}[`./icons/${B}.svg`],self.location).href}const settingPopup$1=ref(null),suggestPopup$1=ref(null);defineComponent({name:"ColexiuHeader",setup(){const[B]=useMenu();return()=>createVNode("div",{class:[styles$4.header,B.value?"animate__animated animate__fadeInDown":"animate__animated animate__fadeOutUp"]},[createVNode("div",{class:styles$4.left},[createVNode(Button,{icon:getImageUrl("back"),onClick:()=>postMessage({api:"back"})},null)]),createVNode(Button,{icon:getImageUrl("setting"),onClick:()=>{var D;console.log(settingPopup$1.value),(D=settingPopup$1.value)==null||D.onShow()},disabled:state.evaluatingStatus},null),createVNode(Popups,{ref:settingPopup$1,style:{borderRadius:"8px"}},{default:()=>[createVNode(Setting,null,null)]}),createVNode(Popups,{ref:suggestPopup$1,overlay:!1,style:{borderRadius:"8px"}},{default:()=>[createVNode(Feedback,null,null)]})])}});function _isSlot$1(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}var Feedback=defineComponent({name:"ColexiuFeedBack",setup(){const B=ref("\u8BC6\u522B\u4E0D\u51C6"),D=ref(""),R=ref(!1),F=[{name:"\u8BC6\u522B\u4E0D\u51C6"},{name:"\u65E0\u6CD5\u8BC4\u6D4B"},{name:"\u4E0D\u51FA\u8BC4\u6D4B\u7ED3\u679C"},{name:"\u66F2\u8C31\u4E0D\u4E00\u81F4"},{name:"\u6307\u6CD5\u9519\u8BEF"},{name:"\u5176\u4ED6"}],G=()=>{var j;try{if(!D.value)return Toast("\u8BF7\u5148\u586B\u5199\u610F\u89C1\u53CD\u9988");R.value=!0,request.post("/sysParamConfig/add",{data:{content:D.value+"#"+B.value,type:"SMART_PRACTICE"}}),(j=suggestPopup$1.value)==null||j.close(),Toast("\u610F\u89C1\u53CD\u9988\u5DF2\u63D0\u4EA4")}catch{}R.value=!1};return()=>{let j;return createVNode("div",{class:styles$5.feedback},[createVNode("div",{class:styles$5.title},[createTextVNode("\u610F\u89C1\u53CD\u9988")]),createVNode("div",{class:styles$5.wrap},[createVNode("div",{class:styles$5.sub},[createTextVNode("\u8BF7\u9009\u62E9\u95EE\u9898\u7C7B\u578B\u5907\u4EFD")]),createVNode(RadioGroup,{class:styles$5.group,modelValue:B.value,"onUpdate:modelValue":U=>B.value=U},{default:()=>[createVNode(Row,{gutter:4},_isSlot$1(j=F.map(U=>createVNode(Col,{span:8},{default:()=>[createVNode(Radio,{name:U.name},{default:()=>[U.name]})]})))?j:{default:()=>[j]})]}),createVNode(Field,{type:"textarea",class:styles$5.text,placeholder:"\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u60A8\u9047\u5230\u7684\u95EE\u9898\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u5C3D\u5FEB\u4E3A\u60A8\u89E3\u51B3\uFF01",maxlength:200,rows:"2",autosize:!0,"show-word-limit":!0,modelValue:D.value,"onUpdate:modelValue":U=>D.value=U},null),createVNode("div",{style:{display:"flex",justifyContent:"center"}},[createVNode(Button,{onClick:G,class:styles$5.submit},{default:()=>[createVNode("img",{style:{width:"100%"},src:bgSubmit,alt:"\u63D0\u4EA4"},null)]})])])])}}});const suggestPopup=ref(null),confirmShow$1=ref(!1),switchProps$2={"active-color":"#2dc7aa","inactive-color":"#CCCCCC",size:"20px"};var Seet=defineComponent({name:"ColexiuSettingSett",setup(){return()=>createVNode(Fragment,null,[createVNode("div",null,[createVNode(NoticeBar,{class:styles$7.noticebar,"left-icon":InfoIcon,text:"\u5168\u5C40\u8BBE\u7F6E\u4F1A\u66F4\u6539\u6240\u6709\u4E50\u8C31\u7EC3\u4E60\u53CA\u8BC4\u6D4B"},null),createVNode("div",{class:styles$7.groupBox,style:{height:"auto"}},[createVNode(Cell,{center:!0,border:!1,title:"\u62A4\u773C\u6A21\u5F0F"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.eyeProtection,"onUpdate:modelValue":B=>state$4.sett.eyeProtection=B},switchProps$2),null)]}),createVNode(Divider,null,null)]),createVNode("div",{class:styles$7.btnsbar},[createVNode(Button,{class:styles$7.btn,icon:iconTv,onClick:()=>show.value=!0},{default:()=>[createTextVNode("\u6295\u5C4F\u5E2E\u52A9")]}),createVNode(Button,{class:styles$7.btn,icon:iconYijian,onClick:()=>{var B;(B=suggestPopup.value)==null||B.onShow()}},{default:()=>[createTextVNode("\u610F\u89C1\u53CD\u9988")]})])]),createVNode(Popups,{ref:suggestPopup,overlay:!1,style:{borderRadius:"8px"}},{default:()=>[createVNode(Feedback,null,null)]}),createVNode(Dialog.Component,{teleport:"body",class:styles$f.confirm,style:{overflow:"initial"},show:confirmShow$1.value,"onUpdate:show":B=>confirmShow$1.value=B,message:"\u8BBE\u7F6E\u6210\u529F\uFF0C\u662F\u5426\u7ACB\u5373\u91CD\u65B0\u52A0\u8F7D\uFF1F"},{title:()=>createVNode("img",{class:styles$f.iconTitle,src:iconTitle},null),footer:()=>createVNode("div",{class:styles$f.footer},[createVNode("img",{src:iconCancel,onClick:()=>confirmShow$1.value=!1},null),createVNode("img",{src:iconConfirm,onClick:useReload},null)])})])}});ref(!1);const switchProps$1={"active-color":"#2dc7aa","inactive-color":"#CCCCCC",size:"20px"};var Practise=defineComponent({name:"ColexiuSettingPractise",setup(){return()=>createVNode("div",null,[createVNode("div",{class:styles$7.groupBox},[createVNode(Cell,{center:!0,border:!1,title:"\u5FAA\u73AF\u64AD\u653E"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.loop,"onUpdate:modelValue":B=>state$4.sett.loop=B},switchProps$1),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u663E\u793A\u6307\u6CD5"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.fingering,"onUpdate:modelValue":B=>state$4.sett.fingering=B},switchProps$1,{onChange:B=>{state$4.sett.fingering=B,event.emit("settingFingeringChange")}}),{default:()=>[createTextVNode("off")]})]})])])}});const switchProps={"active-color":"#2dc7aa","inactive-color":"#CCCCCC",size:"20px"};var Evaluat=defineComponent({name:"ColexiuSettingPractise",setup(){return()=>createVNode("div",null,[createVNode("div",{class:styles$7.groupBox},[createVNode(Cell,{center:!0,border:!1,title:"\u8BC4\u6D4B\u96BE\u5EA6"},{default:()=>[createVNode(RadioGroup,{iconSize:20,class:styles$7.radioGroup,modelValue:state$4.eva.difficulty,"onUpdate:modelValue":B=>state$4.eva.difficulty=B},{default:()=>[createVNode(Radio,{name:"BEGINNER"},{default:()=>[createTextVNode("\u5165\u95E8")]}),createVNode(Radio,{name:"ADVANCED"},{default:()=>[createTextVNode("\u8FDB\u9636")]}),createVNode(Radio,{name:"PERFORMER"},{default:()=>[createTextVNode("\u5927\u5E08")]})]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u6821\u97F3\u63D0\u9192"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.tuning,"onUpdate:modelValue":B=>state$4.sett.tuning=B},switchProps),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u6444\u50CF\u5934"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.camera,"onUpdate:modelValue":B=>state$4.sett.camera=B},switchProps),{default:()=>[createTextVNode("off")]})]}),state$4.sett.camera&&createVNode(Fragment,null,[createVNode(Divider,null,null),createVNode("div",{class:styles$7.sliderWrap},[createVNode("div",{class:"cell__title"},[createTextVNode("\u900F\u660E\u5EA6")]),createVNode(Slider,{min:0,max:100,modelValue:state$4.sett.opacity,"onUpdate:modelValue":B=>state$4.sett.opacity=B},{button:()=>createVNode("div",{class:styles$7.slider},[state$4.sett.opacity])})])]),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u4FDD\u5B58\u5230\u76F8\u518C"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.eva.save,"onUpdate:modelValue":B=>state$4.eva.save=B},switchProps),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u8BC4\u6D4B\u4F34\u594F"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.eva.mute,"onUpdate:modelValue":B=>state$4.eva.mute=B},switchProps),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u6807\u51C6\u97F3\u9AD8"},{default:()=>[createVNode("div",{style:{display:"flex"}},[createVNode(RadioGroup,{iconSize:20,class:styles$7.radioGroup,modelValue:state$4.sett.hertz,"onUpdate:modelValue":B=>state$4.sett.hertz=B},{default:()=>[createVNode(Radio,{name:440},{default:()=>[createTextVNode("440")]}),createVNode(Radio,{name:442},{default:()=>[createTextVNode("442")]})]})])]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u53CD\u5E94\u65F6\u95F4(\u6BEB\u79D2)"},{default:()=>[createVNode(Field,{modelValue:state$4.eva.reactionTimeMs,"onUpdate:modelValue":B=>state$4.eva.reactionTimeMs=B,inputAlign:"right",onBlur:()=>{state$4.eva.reactionTimeMs=Math.max(-300,Math.min(300,state$4.eva.reactionTimeMs))||0}},null)]})])])}}),Setting=defineComponent({name:"ColexiuSetting",props:{active:{type:String,default:"1"}},setup(B){return()=>createVNode("div",{class:styles$7.setting},[createVNode(Tabs,{active:B.active},{default:()=>[createVNode(Tab,{title:"\u5168\u5C40\u8BBE\u7F6E",name:"1"},{default:()=>[createVNode(Seet,null,null)]}),createVNode(Tab,{title:"\u7EC3\u4E60\u8BBE\u7F6E",name:"2"},{default:()=>[createVNode(Practise,null,null)]}),createVNode(Tab,{title:"\u8BC4\u6D4B\u8BBE\u7F6E",name:"3"},{default:()=>[createVNode(Evaluat,null,null)]})]})])}});const modelWraper="_modelWraper_iddf4_1",wrap="_wrap_iddf4_8";var styles$3={modelWraper,wrap},ModelWraper=defineComponent({name:"modelWraper",props:{show:{type:Boolean,default:!1},onChangeModelType:{type:Function,default:()=>{}}},setup(B,D){return()=>createVNode(Teleport,{to:"body"},{default:()=>[createVNode("div",{class:styles$3.modelWraper},[createVNode(Transition,{mode:"out-in","enter-active-class":"animate__animated animate__flipInX","leave-active-class":"animate__animated animate__fadeOut"},{default:()=>[B.show&&createVNode("div",{class:styles$3.wrap},[createVNode("img",{onClick:()=>B.onChangeModelType("practice"),src:model1},null),createVNode("img",{onClick:()=>B.onChangeModelType("follow"),src:model3},null),createVNode("img",{onClick:()=>B.onChangeModelType("evaluation"),src:model2},null)])]})])]})}});const follow="_follow_1izp1_4",title="_title_1izp1_12",endBtns="_endBtns_1izp1_16",button="_button_1izp1_21",hasText="_hasText_1izp1_29",bigIcon="_bigIcon_1izp1_52",start="_start_1izp1_59";var styles$2={follow,title,endBtns,button,hasText,bigIcon,start},iconFollwBtn="./assets/icon-follwBtn.40b797fe.svg";const togglePlayer=(B=!1)=>{let D=document.querySelector("#globalPlayer");D&&(D.style.display=B?"":"none")},data=reactive({list:[],index:0,start:!1});useToggle(!0);const noteFrequency=ref(0),audioFrequency=ref(0),followTime=ref(0),openToggleRecord=(B=!0)=>{if(postMessage({api:"cloudToggleFollow",content:{state:B?"start":"end"}}),B)followTime.value=Date.now();else{const D=Date.now()-followTime.value;followTime.value!==0&&D>0&&(followTime.value=0,updatePlayTime$1(D/1e3))}},initBehaviorId$1=""+new Date().valueOf();async function updatePlayTime$1(B){const D=useOriginSearch(),R=sessionStorage.getItem("behaviorId")||D.behaviorId||initBehaviorId$1,F=useClientType(),G=useOriginSearch().id,j=location.hash.split("?")[0].split("/").pop()||G||"";try{const U=await request.post("/musicPracticeRecord/save",{prefix:F==="teacher"?"/api-teacher":"/api-student",data:{musicSheetId:j,sysMusicScoreId:j,feature:"CLOUD_STUDY_TRAIN",playTime:B,deviceType:getPlatform(),behaviorId:R}})}catch{}}const onClear=()=>{state$2.times.forEach(B=>{const D=document.querySelector(`div[data-vf=vf${B.id}]`);D&&(D.classList.remove("follow-error"),D.classList.remove("follow-success"))})},handleStart=()=>{onClear(),data.start=!0,openToggleRecord(!0),data.index=0,data.list=[],state.osmd.cursor.reset(),getNoteIndex(),refreshView()},handleEnd=()=>{data.start=!1,openToggleRecord(!1),data.index=0,state.osmd.cursor.reset(),getNoteIndex()},next=()=>{state.osmd.product?state.osmd.cursor.setPosition(state$2.times[data.index].cursorBox):state.osmd.cursor.next(),refreshView()},getNoteIndex=()=>{const B=state$2.times[data.index];return B.frequency?(noteFrequency.value=B.frequency,state$2.fixedKey=B.realKey,{id:B.id,min:B.frequency-(B.frequency-B.noteElement.pitch.prevFrequency)*.1,max:B.frequency+(B.noteElement.pitch.nextFrequency-B.frequency)*.1}):(data.index=data.index+1,next(),getNoteIndex())};let checking=!1;const onFollowTime=B=>{var R;const D=(R=B==null?void 0:B.content)==null?void 0:R.frequency;audioFrequency.value=D,data.list.push(D),checked()},checked=()=>{if(checking)return;checking=!0;const B=getNoteIndex();for(let D=0;DB.min&&R{const R=document.querySelector(`div[data-vf=vf${B.id}]`);R&&(D?(R.classList.remove("follow-error"),R.classList.add("follow-success")):(R.classList.remove("follow-success"),R.classList.add("follow-error")))};var Follow=defineComponent({name:"follow",setup(B,{expose:D}){return onMounted(()=>{togglePlayer(),console.log("\u5F00\u59CB\u76D1\u542C"),listenerMessage("cloudFollowTime",onFollowTime)}),onUnmounted(()=>{removeListenerMessage("cloudFollowTime",onFollowTime),togglePlayer(!0),onClear()}),D({data,handleEnd}),()=>createVNode(Teleport,{to:"#colexiu-detail-music-sheet"},{default:()=>[createVNode("div",{class:styles$2.follow},[createVNode(Transition,{name:"start",duration:300},{default:()=>[!data.start&&createVNode(Button,{style:{backgroundImage:`url(${iconFollwBtn})`},class:[styles$2.button,styles$2.start,styles$2.followBtn],onClick:()=>handleStart()},{default:()=>[createTextVNode("\u5F00\u59CB")]})]})])]})}}),iconFollowEndBtn="./assets/icon-followEndBtn.7fe21406.svg";const confirmShow=ref(!1),search$3=useOriginSearch(),startButtonShow=ref(!0),evaluatingRef=ref({}),settingPopup=ref(null);ref(null);const followRef=ref(null),animate={mounted:B=>{B.addEventListener("click",D=>{D.target.classList.add("animate__animated","animate__tada")}),B.addEventListener("animationend",D=>{D.target.classList.remove("animate__animated","animate__tada")})}},beforeCheck=B=>{var U,W,Y,Q;const D=search$3.setting||{},R=(U=state$2.activeDetail)==null?void 0:U.paymentType,F=(W=state$2.activeDetail)==null?void 0:W.orderStatus,G=(Y=state$2.activeDetail)==null?void 0:Y.play,j=((Q=state$3.user)==null?void 0:Q.membershipDays)||0;if(useClientType()==="web"||G||D.feeType==="FREE")return B(!0);if((R==null?void 0:R.includes("VIP"))&&(R==null?void 0:R.includes("CHARGE"))&&!(j>0)&&F!=="PAID")return permissionPopup.active="memberAndDemand",permissionPopup.show=!0,B(!1);if(R==="VIP"&&!(j>0))return permissionPopup.active="member",permissionPopup.show=!0,B(!1);if(R==="CHARGE"&&F!=="PAID")return permissionPopup.active="demand",permissionPopup.show=!0,B(!1);B(!0)},back=()=>{postMessage({api:"back"})},startEvaluat=()=>{console.log("\u5F00\u59CB\u8BC4\u6D4B"),beforeCheck(B=>{B&&(setCurrentTime(0),state.evaluatingStatus=!0)})},modelType=ref("init"),modelWraperShow=ref(!0),onChangeModelType=B=>{var D;if(modelWraperShow.value=!1,B!==modelType.value){if(B==="evaluation")changeSpeed((D=state$2.activeDetail)==null?void 0:D.originalSpeed,!1),startEvaluat();else{const R=store_legacy.get("speeds")||{},F=useOriginSearch();R[F.id]&&changeSpeed(R[F.id])}nextTick(()=>{modelType.value=B})}};var Buttons=defineComponent({name:"Colexiu-Buttons",directives:{animate},props:{onSetMusicScoreType:{type:Function,default:B=>{}}},emits:["setMusicScoreType"],setup(B,{emit:D}){const R=useRoute$1(),[F]=useWiredHeadsetCheck(),G=ref(),[j]=useMenu(),U=ref(!1),W=()=>{R.query.modelType&&onChangeModelType(R.query.modelType)};onMounted(()=>{W()});const Y=ref(!1),Q=ref(""),Z=K=>{Q.value=K.text,confirmShow.value=!0},q=()=>{Q.value==="\u4E94\u7EBF\u8C31"?state$4.sett.type="staff":Q.value==="\u7B80\u8C31"?(state$4.sett.type="jianpu",state$4.sett.keySignature=!1):Q.value==="\u56FA\u5B9A\u8C03"&&(state$4.sett.type="jianpu",state$4.sett.keySignature=!0)},J=K=>{if(K==="staff")return state$4.sett.type===K;if(K==="shoudiao")return state$4.sett.type==="jianpu"&&!state$4.sett.keySignature;if(K==="guding")return state$4.sett.type==="jianpu"&&state$4.sett.keySignature};return()=>{var te,ne,ie,re,oe,le,fe,he,ge;const K=((te=state$2.activeDetail)!=null&&te.isAppPlay?((ne=state$2.activeDetail)==null?void 0:ne.midiUrl)==="":state.isFirstPlay||((ie=state.audiosInstance)==null?void 0:ie.length)==1)||state.evaluatingStatus||((re=state$2.activeDetail)==null?void 0:re.isAppPlay)&&state$2.midiPlayIniting;return createVNode("div",{class:[styles$9.container,j.value?"animate__animated animate__fadeInDown":"animate__animated animate__fadeOutUp"]},[createVNode("div",{class:styles$9.leftButton},[!((oe=R.query)!=null&&oe.modelType)&&createVNode(Button,{class:[styles$9.button,styles$9.backbtn],onClick:back},{default:()=>[createVNode(ButtonIcon,{name:"icon-back"},null)]}),createVNode("div",{class:styles$9.titleWrap},[createVNode("div",{class:styles$9.title},[(le=state$2.activeDetail)==null?void 0:le.musicSheetName]),search$3.albumName&&createVNode("div",{class:styles$9.album},[search$3.albumName])])]),createVNode("div",{class:styles$9.centerButton},[createVNode(Transition,{name:"finish"},{default:()=>{var ue,me;return[F.value&&!((ue=evaluatingRef.value)!=null&&ue.connentLoading)&&!startButtonShow.value&&createVNode(Button,{style:{backgroundImage:`url(${iconEvaluatingEnd})`},class:[styles$9.button,styles$9.finish],onClick:()=>{var be,ve;(ve=(be=evaluatingRef.value)==null?void 0:be.playerStop)==null||ve.call(be)}},{default:()=>[createTextVNode("\u7ED3\u675F\u8BC4\u6D4B")]}),((me=followRef==null?void 0:followRef.value)==null?void 0:me.data.start)&&createVNode(Button,{style:{backgroundImage:`url(${iconFollowEndBtn})`},class:[styles$9.button,styles$9.finish,styles$9.followEndBtn],onClick:()=>{var be,ve;(ve=(be=followRef.value)==null?void 0:be.handleEnd)==null||ve.call(be)}},{default:()=>[createTextVNode("\u7ED3\u675F\u6F14\u594F")]})]}})]),createVNode("div",{class:[styles$9.moreButton],style:{opacity:state$2.initRendered?1:0}},[!((fe=R.query)!=null&&fe.modelType)&&modelType.value!=="init"&&!state$2.frozenMode&&createVNode(Button,{class:[styles$9.button,styles$9.hasText],disabled:state.evaluatingStatus&&!startButtonShow.value||((he=followRef.value)==null?void 0:he.data.start),onClick:()=>{var ue,me,be;modelType.value==="practice"&&(resetPlayStatus(),setCurrentTime(0)),modelType.value==="evaluation"&&(state.evaluatingStatus=!1,(((ue=evaluatingRef.value)==null?void 0:ue.playStatus.value)==="play"||((me=evaluatingRef.value)==null?void 0:me.playStatus.value)==="connecting")&&((be=evaluatingRef.value)==null||be.cancelTheEvaluation())),modelType.value="init",modelWraperShow.value=!0}},{default:()=>[createVNode(ButtonIcon,{key:"modelType",name:"modelType"},null),createVNode("span",null,[createTextVNode("\u6A21\u5F0F")])]}),modelType.value==="evaluation"&&createVNode(Fragment,null,[createVNode(Popover,{show:U.value,"onUpdate:show":ue=>U.value=ue,overlay:!1,placement:"bottom-end",class:"cameraPopover","show-arrow":!1},{default:()=>[createVNode(CellGroup,{border:!1},{default:()=>[createVNode(Cell,{center:!0,title:"\u6444\u50CF\u5934"},{default:()=>[createVNode("div",{style:"display:flex;justify-content: flex-end;"},[createVNode(Switch,mergeProps({disabled:!startButtonShow.value,modelValue:state$4.sett.camera,"onUpdate:modelValue":ue=>state$4.sett.camera=ue},switchProps),{default:()=>[createTextVNode("off")]})])]}),state$4.sett.camera&&createVNode(Cell,{class:"cameraOpacity",center:!0,title:"\u900F\u660E\u5EA6"},{default:()=>[createVNode(Slider,{min:0,max:100,modelValue:state$4.sett.opacity,"onUpdate:modelValue":ue=>state$4.sett.opacity=ue},{button:()=>createVNode("div",{class:styles$9.slider},[state$4.sett.opacity])})]})]})],reference:()=>createVNode("div",null,[createVNode(Button,{class:[styles$9.button,styles$9.hasText]},{default:()=>[createVNode(ButtonIcon,{key:"camera",name:"camera"},null),createVNode("span",null,[createTextVNode("\u6444\u50CF\u5934")])]})])}),createVNode("div",{style:{display:"none"}},[state.evaluatingStatus?createVNode(Evaluating$1,{ref:evaluatingRef,key:"lianxi"},null):createVNode(Button,{class:[styles$9.button,styles$9.hasText],onClick:startEvaluat},{default:()=>[createVNode(ButtonIcon,{key:"evaluating",name:"evaluating"},null),createVNode("span",null,[createTextVNode("\u8BC4\u6D4B")])]})])]),modelType.value==="practice"&&createVNode(Fragment,null,[createVNode(Button,{class:[styles$9.button,styles$9.hasText],onClick:()=>changeMode(state.mode==="background"?"music":"background"),disabled:K},{default:()=>[createVNode(ButtonIcon,{key:"music",name:state.mode==="music"?"music":"accompaniment"},null),createVNode("span",null,[state.mode==="background"?"\u4F34\u594F":"\u539F\u58F0"])]}),createVNode(Button,{class:[styles$9.button,styles$9.hasText],onClick:sectionChange,disabled:state.evaluatingStatus},{default:()=>[createVNode(ButtonIcon,{key:"section",name:"section"+(state$2.section.length&&state$2.section.length<=2?state$2.section.length:"")},null),createVNode("span",null,[createTextVNode("\u9009\u6BB5")])]}),createVNode(Button,{class:[styles$9.button,styles$9.hasText],onClick:()=>{state$4.sett.fingering=!state$4.sett.fingering,event.emit("settingFingeringChange")}},{default:()=>[createVNode(ButtonIcon,{key:"music",name:state$4.sett.fingering?"fingeringOn":"fingeringOff"},null),createVNode("span",null,[createTextVNode("\u6307\u6CD5")])]})]),["practice","evaluation"].includes(modelType.value)&&createVNode(Popover,{trigger:"manual",overlay:!1,placement:"bottom",class:styles$9.popover,show:j.value&&state.speedShow&&!(state.evaluatingStatus||state.playState==="play"),"onUpdate:show":ue=>state.speedShow=ue},{default:()=>[createVNode(Speed,{ref:G,updateSpeed:ue=>state.speed=ue,changed:changeSpeed,mode:state.mode,changeMode,lib:{speed:state.speed},class:styles$9.speed},null)],reference:()=>createVNode(Button,{class:[styles$9.button,styles$9.hasText,styles$9.speedButton],disabled:state.evaluatingStatus||state.playState==="play",onClick:()=>{var ue;(ue=G.value)==null||ue.refUpdateSpeed(state.speed),state.speedShow=!state.speedShow}},{default:()=>[createVNode(ButtonIcon,{name:"speed"},null),createVNode("span",null,[createTextVNode("\u901F\u5EA6")]),createVNode("span",{class:styles$9.label},[state.speed])]})}),(ge=state$2.activeDetail)!=null&&ge.notation?createVNode(Popover,{class:styles$9.toggleMusicType,placement:"bottom-end",show:Y.value,"onUpdate:show":ue=>{var me;state.playState==="play"||state.evaluatingStatus&&!startButtonShow.value||((me=followRef.value)==null?void 0:me.data.start)||(Y.value=ue)}},{reference:()=>{var ue;return createVNode(Button,{disabled:state.playState==="play"||state.evaluatingStatus&&!startButtonShow.value||((ue=followRef.value)==null?void 0:ue.data.start),class:[styles$9.button,styles$9.hasText,styles$9.speedButton]},{default:()=>[createVNode(ButtonIcon,{name:"icon-zhuanpu"},null),createVNode("span",null,[J("staff")?"\u8F6C\u7B80\u8C31":"\u8F6C\u4E94\u7EBF\u8C31"])]})},default:()=>createVNode(Fragment,null,[createVNode("div",{role:"menuitem",class:"van-popover__action",onClick:()=>Z({text:"\u4E94\u7EBF\u8C31"})},[createVNode(ButtonIcon,{key:"type",name:J("staff")?"icon-staff-active":"icon-staff"},null),createVNode("div",{class:["action-text",J("staff")&&"action-active"]},[createTextVNode("\u4E94\u7EBF\u8C31")])]),createVNode("div",{role:"menuitem",class:"van-popover__action",onClick:()=>Z({text:"\u7B80\u8C31"})},[createVNode(ButtonIcon,{key:"type",name:J("shoudiao")?"shuodiao-active":"shuodiao"},null),createVNode("div",{class:["action-text",J("shoudiao")&&"action-active"]},[createTextVNode("\u9996\u8C03")])]),createVNode("div",{role:"menuitem",class:"van-popover__action",onClick:()=>Z({text:"\u56FA\u5B9A\u8C03"})},[createVNode(ButtonIcon,{key:"type",name:J("guding")?"guding-active":"guding"},null),createVNode("div",{class:["action-text",J("guding")&&"action-active"]},[createTextVNode("\u56FA\u5B9A\u8C03")])])])}):null,state$2.initRendered&&createVNode(Fragment,null,[createVNode(Button,{class:[styles$9.button,styles$9.hasText],onClick:()=>{var ue;(ue=settingPopup.value)==null||ue.onShow()},disabled:state.evaluatingStatus&&!startButtonShow.value},{default:()=>[createVNode(ButtonIcon,{name:"setting"},null),createVNode("span",null,[createTextVNode("\u8BBE\u7F6E")])]}),createVNode(Popups,{ref:settingPopup,style:{borderRadius:"8px"}},{default:()=>[createVNode(Setting,{active:modelType.value=="practice"?"2":modelType.value=="evaluation"?"3":"1"},null)]})]),modelType.value==="follow"&&createVNode(Fragment,null,[createVNode(Follow,{ref:followRef},null)])]),createVNode(Teleport,{to:"body"},{default:()=>{var ue;return[!((ue=R.query)!=null&&ue.modelType)&&modelType.value!=="evaluation"&&createVNode("div",{class:styles$9.btnMusicList,onClick:open$1},[createVNode(ButtonIcon,{name:"music-list1"},null)])]}}),state$2.initRendered&&!state$2.frozenMode&&createVNode(ModelWraper,{show:modelWraperShow.value,onChangeModelType},null),createVNode(FloatWraper,null,null),createVNode(Dialog.Component,{teleport:"body",class:styles$f.confirm,style:{overflow:"initial"},show:confirmShow.value,"onUpdate:show":ue=>confirmShow.value=ue,message:"\u8BBE\u7F6E\u6210\u529F\uFF0C\u662F\u5426\u7ACB\u5373\u91CD\u65B0\u52A0\u8F7D\uFF1F"},{title:()=>createVNode("img",{class:styles$f.iconTitle,src:iconTitle},null),footer:()=>createVNode("div",{class:styles$f.footer},[createVNode("img",{src:iconCancel,onClick:()=>confirmShow.value=!1},null),createVNode("img",{src:iconConfirm,onClick:()=>{q(),useReload()}},null)])})])}}});const scoreInfos={1:{img:Image1,tips:"\u4F60\u7684\u6F14\u594F\u4E0D\u592A\u597D\uFF0C\u97F3\u51C6\u548C\u5B8C\u6574\u6027\u8FD8\u9700\u52A0\u5F3A\uFF0C\u518D\u7EC3\u4E00\u7EC3\u5427\uFF5E",mome:"\u6562\u4E8E\u5C1D\u8BD5"},2:{img:Image2,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u719F\u7EC3\uFF0C\u97F3\u51C6\u548C\u5B8C\u6574\u6027\u8FD8\u9700\u52A0\u5F3A\uFF0C\u52A0\u7D27\u8BAD\u7EC3\u624D\u80FD\u6709\u597D\u6210\u7EE9\u54E6\uFF5E",mome:"\u8FD8\u8981\u52A0\u6CB9\u54E6\uFF5E"},3:{img:Image3,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u6D41\u7545\uFF0C\u97F3\u51C6\u548C\u8282\u594F\u8FD8\u9700\u52A0\u5F3A\uFF0C\u79D1\u5B66\u7684\u7EC3\u4E60\u624D\u80FD\u66F4\u5B8C\u7F8E\u54E6\uFF5E",mome:"\u7A81\u7834\u81EA\u6211"},4:{img:Image4,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u9519\uFF0C\u7EE7\u7EED\u52A0\u6CB9\u5427\uFF0C\u52A0\u5F3A\u97F3\u51C6\uFF0C\u79BB\u5B8C\u7F8E\u5C31\u5DEE\u4E00\u6B65\u5566\uFF5E",mome:"\u5D2D\u9732\u5934\u89D2"},5:{img:Image5,tips:"\u4F60\u7684\u6F14\u594F\u975E\u5E38\u4E0D\u9519\uFF0C\u97F3\u51C6\u7684\u628A\u63E1\u548C\u8282\u594F\u7A0D\u6709\u7455\u75B5\uFF0C\u5B8C\u6574\u6027\u628A\u63E1\u7684\u5F88\u597D~",mome:"\u4F60\u5F88\u68D2"}};ref(!1);const search$2=useOriginSearch();var Content=defineComponent({name:"ColexiuEvaluating",props:{data:{type:Object,default:()=>null}},emits:["restart","upload"],setup(B,{emit:D}){const R=ref(!1),F=ref(""),{data:G}=toRefs(B),j=location.origin.indexOf("localhost")>-1||location.origin.indexOf("192.168")>-1?"":"/accompany",U=()=>{var q,J,K,te,ne,ie,re,oe,le;const Z={id:(q=G.value)==null?void 0:q.recordId,musicId:search$2.id,name:((J=state$3.user)==null?void 0:J.username)||"",subjectName:(((K=state$3.user)==null?void 0:K.subjectName)||"").split(",")[0]||"",avatar:encodeURIComponent(((te=state$3.user)==null?void 0:te.avatar)||""),score:((ne=G.value)==null?void 0:ne.score)||0,examSongName:((ie=state$2.activeDetail)==null?void 0:ie.examSongName)||""};return state$2.isPercussion||(Z.intonation=(re=G.value)==null?void 0:re.intonation,Z.cadence=(oe=G.value)==null?void 0:oe.cadence,Z.integrity=(le=G.value)==null?void 0:le.integrity),`${location.origin}${j}/share-colexiu-evaluating/index.html?${queryString.stringify(Z)}`},W=Z=>{const q=Z.target;q&&(q.contentWindow.setPng=J=>{F.value=J})},Y=()=>{!F.value||postMessage({api:"shareAchievements",content:{title:"\u5206\u4EAB\u6211\u7684\u4E50\u5668\u7EC3\u4E60\u8FDB\u5EA6\uFF0C\u4E00\u8D77\u89C1\u8BC1\u6211\u7684\u6210\u957F\uFF01",desc:"\u6652\u4E00\u4E0B\u6211\u7684\u8BC4\u6D4B\u5206\u6570\uFF0C\u5FEB\u6765\u201C\u5C0F\u9177AI\u201D\u4E0A\u548C\u6211PK\u4E00\u4E0B\u5427\uFF01",image:F.value,video:"",type:"image",button:["copy"],url:U()}},Z=>{var q,J,K;(q=Z==null?void 0:Z.content)!=null&&q.status&&(R.value=!1),(J=Z==null?void 0:Z.content)!=null&&J.message&&Toast((K=Z==null?void 0:Z.content)==null?void 0:K.message)})},Q=()=>{var Z;postMessage({api:"openWebView",content:{url:location.origin+j+"/colexiu-report.html?source=evaluation&musicId="+search$2.id+"&id="+((Z=G.value)==null?void 0:Z.recordId)||"",orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}})};return()=>{var q,J;const Z=getLeveByScoreId((q=G.value)==null?void 0:q.score);return createVNode("div",null,[createVNode("div",{class:styles$f.box},[createVNode("div",{class:styles$f.wrap},[createVNode("div",{class:styles$f.top},[Z===5&&createVNode("img",{class:styles$f.iconLeft,src:iconBadge},null),createVNode("div",{class:styles$f.title},[createVNode("div",{style:{position:"relative",zIndex:1,"white-space":"nowrap"}},[createVNode("span",{class:styles$f.num},[(J=G.value)==null?void 0:J.score]),createVNode("span",{class:styles$f.txt},[createTextVNode("\u5206 "),createVNode("span",null,[scoreInfos[Z].mome])])]),createVNode("div",{class:styles$f.line},null)]),createVNode("img",{class:styles$f.iconTop,src:scoreInfos[Z].img},null)]),createVNode("div",{class:styles$f.evaluatWrap},[createVNode(Grid,null,{default:()=>[createVNode(GridItem,null,{icon:()=>createVNode("div",null,[createVNode("img",{class:styles$f.evaluatIcon,src:IntonationIcon},null),createVNode("span",{class:styles$f.evaluatTitle},[createTextVNode("\u97F3\u51C6")])]),text:()=>{var K;return createVNode("span",{class:styles$f.fraction},[(K=G.value)==null?void 0:K.intonation,createVNode("span",null,[createTextVNode("\u5206")])])}}),createVNode("div",{class:styles$f.line},null),createVNode(GridItem,null,{icon:()=>createVNode("div",null,[createVNode("img",{class:styles$f.evaluatIcon,src:CadenceIcon},null),createVNode("span",{class:styles$f.evaluatTitle},[createTextVNode("\u8282\u594F")])]),text:()=>{var K;return createVNode("span",{class:styles$f.fraction},[(K=G.value)==null?void 0:K.cadence,createVNode("span",null,[createTextVNode("\u5206")])])}}),createVNode("div",{class:styles$f.line},null),createVNode(GridItem,null,{icon:()=>createVNode("div",null,[createVNode("img",{class:styles$f.evaluatIcon,src:IntegrityIcon},null),createVNode("span",{class:styles$f.evaluatTitle},[createTextVNode("\u5B8C\u6574\u6027")])]),text:()=>{var K;return createVNode("span",{class:styles$f.fraction},[(K=G.value)==null?void 0:K.integrity,createVNode("span",null,[createTextVNode("\u5206")])])}})]})]),createVNode("div",{class:styles$f.tips},[scoreInfos[Z].tips]),createVNode("div",{class:styles$f.btns},[state$2.frozenMode?null:createVNode(Button,{onClick:()=>{state.evaluatingStatus=!1,onChangeModelType("practice")}},{default:()=>[createVNode("img",{class:styles$f.btnIcon,src:iconLianxi},null)]}),createVNode(Button,{style:{margin:"0 4px"},onClick:()=>D("restart")},{default:()=>[createVNode("img",{class:styles$f.btnIcon,src:TryIcon},null)]}),createVNode(Button,{onClick:Q},{default:()=>[createVNode("img",{class:styles$f.btnIcon,src:iconReport,alt:"\u67E5\u770B\u62A5\u544A"},null)]})])]),createVNode(Popup,{teleport:"body",show:R.value,style:{background:"transparent"}},{default:()=>[createVNode("div",{style:{textAlign:"right"}},[createVNode(Button,{class:styles$f.sbtn,onClick:Y,round:!0,type:"primary",color:"#2DC7AA"},{default:()=>[createTextVNode("\u5206\u4EAB")]}),createVNode(Button,{class:styles$f.sbtn,onClick:()=>R.value=!1,round:!0},{default:()=>[createTextVNode("\u5173\u95ED")]})]),createVNode("iframe",{style:{width:"50vw",border:"none",height:"70vh",marginTop:"1vh"},src:U(),onLoad:W},null)]}),createVNode(Button,{class:styles$f.button,icon:backIcon,onClick:()=>D("restart")},null),createVNode(Button,{class:styles$f.skepBtn,onClick:()=>D("upload")},{default:()=>[createTextVNode("\u4FDD\u5B58\u6F14\u594F")]}),createVNode(Button,{class:[styles$f.skepBtn,styles$f.sharBtn],onClick:()=>R.value=!0},{default:()=>[createTextVNode("\u5206\u4EAB")]})])])}}});const evaluatingShow=ref(!1),open=ref(!1);var Evaluating=defineComponent({name:"ColexiuEvaluating",props:{data:{type:Object,default:()=>null}},emits:["restart"],setup(B){const D=ref(!1),R=state$4.sett.camera&&state$4.eva.save;console.log(state$4.sett.camera,state$4.eva.save);const F=j=>{var U,W;postMessage({api:"proxyServiceMessage",content:{header:{commond:"videoUpload",status:200,type:"SOUND_COMPARE"},body:{filePath:(U=j==null?void 0:j.content)==null?void 0:U.filePath,recordId:(W=B.data)==null?void 0:W.recordId}}})},G=()=>{R?postMessage({api:"videoUpdate"},j=>{if(D.value=!1,j!=null&&j.content){if(j.content.type==="error"){Toast(j.content.message);return}F(j)}}):(D.value=!1,F(),Toast.success("\u4E0A\u4F20\u6210\u529F"))};return()=>createVNode("div",null,[createVNode(Popup,{position:"bottom",show:evaluatingShow.value,"onUpdate:show":j=>evaluatingShow.value=j,onOpen:()=>open.value=!0,onClosed:()=>open.value=!1,teleport:"body",style:{backgroundColor:"transparent"}},{default:()=>[open&&createVNode(Content,{data:B.data,onUpload:()=>D.value=!0,onRestart:()=>evaluatingShow.value=!1},null)]}),createVNode(Dialog.Component,{teleport:"body",class:styles$f.confirm,style:{overflow:"initial"},show:D.value,"onUpdate:show":j=>D.value=j,message:`\u8BC4\u6D4B${R?"\u97F3\u89C6\u9891":"\u97F3\u9891"}\u662F\u5426\u4FDD\u5B58\u6F14\u594F\uFF1F`},{title:()=>createVNode("img",{class:styles$f.iconTitle,src:iconTitle},null),footer:()=>createVNode("div",{class:styles$f.footer},[createVNode("img",{src:iconCancel,onClick:()=>D.value=!1},null),createVNode("img",{src:iconConfirm,onClick:G},null)])})])}});const soundNeedShow=()=>{if(state.evaluatingStatus&&!permissionPopup.show){let B=-1;const D=localStorage.getItem(storeKeys.lastCheckTime);try{const R=dayjs(parseFloat(D||"0"));R.isValid()&&(B=Math.abs(R.diff(dayjs(new Date().valueOf()),"day")))}catch{}(state$4.sett.tuning||B>0||!D)&&(soundEffectShow.value=!0)}},setWiredStatus=B=>{state.evaluatingStatus?(permissionPopup.active="earphone",permissionPopup.show=!(B!=null&&B.content.checkIsWired),soundNeedShow()):permissionPopup.show=!1},useWiredHeadsetCheck=()=>{const B=ref(!1);return watch(()=>state.evaluatingStatus,()=>{postMessage({api:"isWiredHeadsetOn"},setWiredStatus)}),watch(()=>permissionPopup.show,()=>{soundNeedShow()}),watch([()=>state.evaluatingStatus],()=>{Toast.clear(),state.evaluatingStatus||(state.evaluatingTips=!1,pause(),setCurrentTime(0)),state$4.sett.fingering&&event.emit("settingFingeringChange")}),watch([()=>state.evaluatingStatus,()=>permissionPopup.show,()=>soundEffectShow.value],([D,R,F])=>{B.value=D&&!R&&!F,state.evaluatingStatus||(state$2.evaluatings={},evaluatingShow.value=!1)}),onMounted(()=>{listenerMessage("listenerWiredStatus",setWiredStatus)}),onBeforeUnmount(()=>{removeListenerMessage("listenerWiredStatus",setWiredStatus)}),[B]},browserInfo$2=browser(),useFee=(B,D)=>{var Q,Z,q;console.log("maxtime",B,D);const R=((Q=state$2.activeDetail)==null?void 0:Q.orderStatus)||D,G=useOriginSearch().setting||{};if(((Z=state$2.activeDetail)==null?void 0:Z.play)||G.feeType==="FREE")return;const j=useClientType();if(!browserInfo$2.isApp&&j==="web"||(B==null?void 0:B.includes("VIP"))&&((q=state$3.user)==null?void 0:q.membershipDays)>0||(B==null?void 0:B.includes("CHARGE"))&&R==="PAID")return;const U=ref(-1),W=state$2.times[state$2.times.length-1];W&&(U.value=Math.max(10,W.time*state$2.freeRate));const Y=J=>{var te,ne,ie;const K=((te=state$2.activeDetail)==null?void 0:te.orderStatus)||D;j!="web"&&U.value>=0&&state.currentTimeNum>=U.value&&((B==null?void 0:B.includes("CHARGE"))&&B.includes("VIP")?K!=="PAID"&&!(((ne=state$3.user)==null?void 0:ne.membershipDays)>0)&&(permissionPopup.active="memberAndDemand",permissionPopup.show=!0,pause()):B==="CHARGE"?K!=="PAID"&&(permissionPopup.active="demand",permissionPopup.show=!0,pause()):B==="VIP"&&(((ie=state$3.user)==null?void 0:ie.membershipDays)>0||(permissionPopup.active="member",permissionPopup.show=!0,pause())))};state.audiosInstance.event.on("timeupdate",Y),listenerMessage("cloudTimeUpdae",Y),onBeforeUnmount(()=>{state.audiosInstance.event.off("timeupdate",Y),removeListenerMessage("cloudTimeUpdae",Y)})},search$1=useOriginSearch(),browserInfo$1=browser(),useClientType=()=>{let B=location.pathname.indexOf("/student/")===0||browserInfo$1.isStudent,D=location.pathname.indexOf("/teacher/")===0||browserInfo$1.isTeacher,R="student";return B&&(R="student"),D&&(R="teacher"),search$1.client&&(R=search$1.client),R},MemberDefaultData={membershipDays:1},useUpdateMember=()=>{request.get(`/music/sheet/detail/${search$1.id}`,{prefix:useClientType()==="teacher"?"/api-teacher":"/api-student"}).then(B=>{state$2.activeDetail&&(state$2.activeDetail.orderStatus=B.data.orderStatus,state$2.activeDetail.play=B.data.play)})},useUser=()=>{const B=usePageVisibility(),D=async()=>{try{const R=useClientType();if(R==="student"){const{data:F}=await request.get("/appLoginUser/getUserInfo");state$3.user=F}if(R==="teacher"){const{data:F}=await request.get("/appLoginUser/getUserInfo",{prefix:"/api-teacher"});state$3.user={...MemberDefaultData,...F}}R==="web"&&(state$3.user={...MemberDefaultData})}catch{}};D(),watch(B,async R=>{var F,G;permissionPopup.show=!1,R==="visible"&&((F=state$3.user)==null?void 0:F.membershipDays)===0&&D(),R==="visible"&&((G=state$2.activeDetail)==null?void 0:G.orderStatus)!=="PAID"&&useUpdateMember()})},typeById={2:{name:"flute",direction:"transverse"},4:{name:"clarinet",direction:"vertical",width:"1rem",paddingLeft:"0rem"},5:{name:"saxophone",direction:"vertical",width:"2rem"},6:{name:"saxophone",direction:"vertical",width:"2rem"},12:{name:"trumpet",direction:"transverse",height:"80px"},13:{name:"horn",direction:"vertical",width:"3.5rem"},14:{name:"trombone",direction:"transverse",height:"80px"},15:{name:"up-bass-horn",direction:"vertical",width:"3rem"},17:{name:"tuba",direction:"vertical",width:"3rem"},120:{name:"piccolo",direction:"vertical",width:"1rem"},136:{name:"hulusi-flute",direction:"vertical",width:"1.2rem"},135:{name:"pan-flute",direction:"vertical",width:"2.5rem"},134:{name:"ocarina",direction:"vertical",width:"2rem"},137:{name:"melodica",direction:"transverse"},130:{name:"ukulele",direction:"vertical",width:"2rem"},140:{name:"mouthorgan",direction:"transverse",height:"80px"},150:{name:"piano",direction:"transverse",height:"80px"}},relationships={flute17:{59:[27,26,25,15,24,22,17,20],60:[1,2,3,5,7,9,11,12,13,15],1060:[1,2,3,5,7,9,1011,12,13,15],61:[1,2,3,5,7,9,13,15],1061:[1,2,3,5,7,9,1013,15],62:[1,2,3,5,7,9,15],1062:[1,2,3,5,7,9,1010,15],63:[1,2,3,5,7,9,10,15],1063:[1,2,3,5,7,1009,10,15],64:[1,2,3,5,7,10,15],1064:[1,2,3,5,1007,10,15],65:[1,2,3,5,10,15],1065:[1,2,3,1005,9,10,15],66:[1,2,3,9,10,15],1066:[1,2,3,1009,10,15],67:[1,2,3,10,15],1067:[1,2,3,1004,10,15],68:[1,2,3,4,10,15],1068:[[1,2,1003,4,10,15],[1,2,1003,1004,10,15]],69:[1,2,10,15],1069:[1,1002,10,14],70:[[1,5,10,15],[1,10,14]],1070:[1,1005,10,15],71:[1,10,15],1071:[1,10,1015],72:[1,10],1072:[1001,10],73:[13],1073:[1006,13],74:[2,3,5,7,9,15],1074:[2,3,5,7,9,1013,15],75:[2,3,5,7,9,10,15],1075:[2,3,5,7,9,10,15],76:[1,2,3,5,7,10,15],1076:[1,2,3,5,1007,10,15],77:[1,2,3,5,10,15],1077:[1,2,3,1005,9,10,15],78:[1,2,3,9,10,15],1078:[1,2,3,1009,10,15],79:[1,2,3,10,15],1079:[1,2,3,4,10,15],80:[1,2,3,4,10,15],1080:[1,2,1003,4,10,15],81:[1,2,10,15],1081:[1,1002,10,15],82:[[1,5,10],[1,10,14]],1082:[1,1005,10,15],83:[1,10,15],1083:[1,10,1015],84:[1,10],1084:[1001,10],85:[10],1085:[1006,10],86:[2,3,10,15],1086:[2,3,1008,10,15],87:[1,2,3,4,5,7,8,10,15],1087:[1,2,1003,4,5,7,8,10,15],88:[1,2,5,7,10,15],1088:[1,1002,5,7,10,15],89:[1,3,5,10,15],1089:[1,3,1005,9,10,15],90:[1,3,9,10,15],1090:[1,3,9,10,1015],91:[1,2,3,10],1091:[1,2,3,1006,10],92:[2,3,4,10],1092:[2,3,4,1006,10],93:[2,5,10,15],1093:[1002,5,10,15],94:[5,6,15],1094:[1,3,1005,1006,8,15],95:[1,3,8,15],1095:[1,3,8,10,1015],96:[1,2,3,4,5,11],1096:[1001,2,3,4,5,11]},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]},upBassHorn:{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:[1,5,3],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:{72:[11,2,33,4,5,6,7,8],73:[11,2,33,4,5,6,7,88],74:[11,2,33,4,5,6,7],75:[11,2,33,4,5,6,77],76:[11,2,33,4,5,6],77:[11,2,33,4,5,7,8],78:[11,2,33,4,6,7],79:[11,2,33,4],80:[11,2,33,5,6,77],81:[11,2,33],82:[[11,2,4,5],[11,3,4,5]],83:[[11,2],[11,33,4]],84:[11,33],85:[[2,33],[11]],86:[33],87:[33,4,5,6,7],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]},smallDrum:{0:["active","active-left","active-right"],64:["left","right"]},hulusi:{59:[7,6,5,4,3,2,1],60:[7,6,5,4,3,2],61:[7,6,5,4,3],62:[7,6,5,4],63:[7,6,5],64:[7,6],65:[[7,5,4,3,2,1],[7,5,4,3,2],[7,66]],66:[7]},pan:{54:[21],56:[20],58:[19],60:[18],62:[17],64:[16],66:[15],68:[14],70:[13],72:[12],74:[11],76:[10],78:[9],80:[8],82:[7],84:[6],86:[5],88:[4],90:[3],92:[2],94:[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,8,9,10,11,12],60:[1,2,4,5,6,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,8,10,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,2,6,9,11,12],71:[1,6,9,11,12],72:[6,11,12],73:[2,6,12],74:[6,12],75:[2,6],76:[6],77:[]},melodica:{56:[1],57:[2],58:[3],59:[4],60:[5],61:[6],62:[7],63:[8],64:[9],65:[10],66:[11],67:[12],68:[13],69:[14],70:[15],71:[16],72:[17],73:[18],74:[19],75:[20],76:[21],77:[22],78:[23],79:[24],80:[25],81:[26],82:[27],83:[28],84:[29],85:[30],86:[31],87:[32]},ukulele:{60:[3,300],61:[3,301],62:[3,302],63:[3,303],64:[2,200],65:[2,201],66:[2,202],67:[2,203],68:[2,204],69:[1,100],70:[1,101],71:[1,102],72:[1,103],73:[1,104],74:[1,105],75:[1,106],76:[1,107],77:[1,108],78:[1,109],79:[1,110],80:[1,111],81:[1,112],82:[1,113],83:[1,114],84:[1,115],85:[1,116],86:[1,117]},mouthorgan:{53:[101],54:[1],55:[102],56:[2],57:[103],58:[3],59:[104],60:[105],61:[4],62:[106],63:[5],64:[107],65:[108],66:[6],67:[109],68:[7],69:[110],70:[8],71:[111],72:[112],73:[9],74:[113],75:[10],76:[114],77:[115],78:[11],79:[116],80:[12],81:[117],82:[13],83:[118],84:[119],85:[14],86:[120],87:[15],88:[121],89:[122]},piano:{21:[101],22:[1],23:[102],24:[103],25:[2],26:[104],27:[3],28:[105],29:[106],30:[4],31:[107],32:[5],33:[108],34:[6],35:[109],36:[110],37:[7],38:[111],39:[8],40:[112],41:[113],42:[9],43:[114],44:[10],45:[115],46:[11],47:[116],48:[117],49:[12],50:[118],51:[13],52:[119],53:[120],54:[14],55:[121],56:[15],57:[122],58:[16],59:[123],60:[124],61:[17],62:[125],63:[18],64:[126],65:[127],66:[19],67:[128],68:[20],69:[129],70:[21],71:[130],72:[131],73:[22],74:[132],75:[23],76:[133],77:[134],78:[24],79:[135],80:[25],81:[136],82:[26],83:[137],84:[138],85:[27],86:[139],87:[28],88:[140],89:[141],90:[29],91:[142],92:[30],93:[143],94:[31],95:[144],96:[145],97:[32],98:[146],99:[33],100:[147],101:[148],102:[34],103:[149],104:[35],105:[150],106:[36],107:[151],108:[152]}};var getTypes=async B=>{switch(B){case"flute":return{json:(await __vitePreload(()=>import("./index.9827614a.js"),[])).default,relationship:relationships.flute,height:"60px",styles:{}};case"clarinet":return{json:(await __vitePreload(()=>import("./index.81bcab95.js"),[])).default,relationship:relationships.clarinet,styles:{marginLeft:".4rem",marginRight:".7rem"}};case"trumpet":return{json:(await __vitePreload(()=>import("./index.562e6907.js"),[])).default,relationship:relationships.trumpet};case"horn":return{json:(await __vitePreload(()=>import("./index.677031cc.js"),[])).default,relationship:relationships.horn,height:"212px",width:"252px"};case"tuba":return{json:(await __vitePreload(()=>import("./index.5c50a9f0.js"),[])).default,relationship:relationships.tuba};case"piccolo":return{json:(await __vitePreload(()=>import("./index.f292a388.js"),[])).default,relationship:relationships.piccolo};case"up-bass-horn":return{json:(await __vitePreload(()=>import("./index.50d887bb.js"),[])).default,relationship:relationships.upBassHorn};case"trombone":return{json:(await __vitePreload(()=>import("./index.65d4cb1f.js"),[])).default,relationship:relationships.trombone};case"saxophone":return{json:(await __vitePreload(()=>import("./index.66139d6f.js"),[])).default,relationship:relationships.saxophone,styles:{marginLeft:".2rem",marginRight:".3rem"}};case"small-drum":return{json:(await __vitePreload(()=>import("./index.c980c934.js"),[])).default,relationship:relationships.smallDrum,width:"180px"};case"hulusi-flute":return{json:(await __vitePreload(()=>import("./index.1c832d4b.js"),[])).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"pan-flute":return{json:(await __vitePreload(()=>import("./index.065f17dc.js"),[])).default,relationship:relationships.pan,width:"240px",styles:{marginTop:"auto",marginLeft:".6rem",marginRight:".7rem"}};case"ocarina":return{json:(await __vitePreload(()=>import("./index.b1ee2f73.js"),[])).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"melodica":return{json:(await __vitePreload(()=>import("./index.150cabd9.js"),[])).default,relationship:relationships.melodica,height:"80px",styles:{marginTop:"auto"}};case"ukulele":return{json:(await __vitePreload(()=>import("./index.db14ec83.js"),[])).default,relationship:relationships.ukulele};case"mouthorgan":return{json:(await __vitePreload(()=>import("./index.3b668adc.js"),[])).default,relationship:relationships.mouthorgan};case"piano":return{json:(await __vitePreload(()=>import("./index.b7f1e2a7.js"),[])).default,relationship:relationships.piano};default:return null}};const container="_container_ajal8_1",changeIndex="_changeIndex_ajal8_6",activeopacity="_activeopacity_ajal8_1",leftrotates="_leftrotates_ajal8_1",rightrotates="_rightrotates_ajal8_1";var styles$1={container,changeIndex,activeopacity,leftrotates,rightrotates};const getImageSize=B=>new Promise((D,R)=>{const F=new Image;F.src=B,F.onload=()=>{D(F)},F.onerror=G=>D(F)}),formatFixedKey=(B,D)=>B==="piccolo"&&state$2.times[0]?ref(D+(1-state$2.times[0].octaveOffset)*12):ref(D),formatRelationship=(B,D)=>{let R=B[D]||B[0]||[];return typeof R[0]=="number"||typeof R[0]=="string"?[R]:typeof R[0]=="object"?R:[[]]},useFingeringSrc=(B,D,R)=>{const F=ref("");return B&&D==="trombone"&&!B.relationship[R]?(F.value=B.json.full2,F):(F.value=B.json.full,F)};var FingeringComponent=defineComponent({name:"fingering",props:{type:{type:String,default:""},fixedKey:{type:Number,default:0},fingeringInfo:{type:Object},loaded:{type:Function,default:()=>{}},viewInfo:{type:Object}},setup(B,{expose:D}){const R=toRefs(B),F=ref(null),G=ref(null),j=ref(0),U=ref(0);return D({container:F,containerWidth:j}),()=>{var q,J,K,te,ne,ie,re,oe,le,fe,he,ge,ue,me,be;if(!((q=R.viewInfo.value)!=null&&q.activeType))return null;const W=formatFixedKey((J=B.fingeringInfo)==null?void 0:J.name,R.fixedKey.value).value,Y=formatRelationship((te=(K=R.viewInfo.value)==null?void 0:K.activeType)==null?void 0:te.relationship,W||0),Q=()=>{let ve=U.value===Y.length-1?0:U.value+1;U.value=ve},Z=Y[U.value]||[];return createVNode("div",{ref:F,class:classnames((ne=B.fingeringInfo)==null?void 0:ne.name,styles$1.container),style:{width:((ie=B.fingeringInfo)==null?void 0:ie.direction)==="vertical"?(re=B.fingeringInfo)==null?void 0:re.width:"",height:((oe=B.fingeringInfo)==null?void 0:oe.direction)==="transverse"?((le=B.fingeringInfo)==null?void 0:le.height)||"":"100%",display:"flex",paddingLeft:((fe=B.fingeringInfo)==null?void 0:fe.direction)==="vertical"?(he=B.fingeringInfo)==null?void 0:he.paddingLeft:"",paddingRight:((ge=B.fingeringInfo)==null?void 0:ge.direction)==="vertical"?(ue=B.fingeringInfo)==null?void 0:ue.paddingRight:""}},[Z.includes(0)?createVNode("span",{style:{position:"absolute",top:".5vh",right:".5vw",color:"rgb(1, 193, 181)",fontWeight:"bold"}},[createTextVNode("\u8F6C\u8C03")]):null,createVNode("img",{ref:G,src:(me=R.viewInfo.value)==null?void 0:me.fullsrc,style:{width:"auto",maxWidth:"100%",maxHeight:((be=B.fingeringInfo)==null?void 0:be.name)=="ukulele"?"110%":"100%"}},null),Z.map((ve,pe)=>{var xe,ce,we,Be,Ae,Te,Ne,Pe;const ye=typeof ve=="string"?ve.replace("active-",""):String(ve);return createVNode("img",{"data-index":ye,style:{position:"absolute",top:((xe=G.value)==null?void 0:xe.offsetTop)+"px",left:((ce=G.value)==null?void 0:ce.offsetLeft)+"px",zIndex:pe,height:((we=G.value)==null?void 0:we.height)+"px",width:((Be=G.value)==null?void 0:Be.width)+"px",maxWidth:"100%",maxHeight:((Ae=B.fingeringInfo)==null?void 0:Ae.name)=="ukulele"?"110%":"100%"},src:(Pe=(Ne=(Te=R.viewInfo.value)==null?void 0:Te.activeType)==null?void 0:Ne.json)==null?void 0:Pe[ye]},null)}),Y.length>1?createVNode("div",{role:"button",onClick:Q,class:["substituteFinger",styles$1.changeIndex]},[createTextVNode("\u66FF\u6307")]):null])}}});const formatdata={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};var formatId=B=>formatdata[B]||-1;const fingeringWidth=ref(0),fingeringStatus=ref("hidden"),fingeringViewInfo=async B=>{const D=B;if(D){const R=await getTypes(D.name);if(R){const F=formatFixedKey(D.name,state$2.fixedKey),G=useFingeringSrc(R,D.name,F.value),{width:j,height:U}=await getImageSize(G.value),W=document.getElementById("colexiu-detail-music-sheet").clientHeight||0,Y=state.evaluatingStatus?0:j,Q=W/U;return fingeringWidth.value=W?Q*Y:Y,j&&(fingeringStatus.value="show"),reactive({width:j,height:U,scale:Q,usedFixedKey:F.value,fullsrc:G.value,activeType:R,detail:D})}}else fingeringStatus.value="hidden"},useFingering=async(B="")=>{const D=ref({}),R=ref({}),F=await fingeringViewInfo(typeById[formatId(B)]);return D.value=(F==null?void 0:F.activeType)||{},R.value=(F==null?void 0:F.detail)||{},[fingeringStatus,fingeringWidth,D,R]},ee=new EventEmitter;let playStartTime$1=0;class MultipleAudio{constructor(D){this.audios={},this.audioList=[],this.length=0,this.status="init",this.speed=90,this.muted=!1,this.audio=null,this.event=ee,this.currentTime=0,this.duration=0,this.timer=null,this.accelerateRefreshPlayer=()=>{if(this.timer)return;const R=this.currentTime;let F=new Date().getTime();this.timer=setInterval(()=>{this.currentTime=(new Date().getTime()-F)/1e3+R,this.event.emit("timeupdate",this)},10)},this.clearAccelerateRefreshPlayer=()=>{clearInterval(this.timer),this.timer=null},this.setVolume=(R,F)=>{let G=setInterval(()=>{Object.values(this.audios).map(j=>{R?(j.volume-=.01,j.volume<=.01&&(j.volume=0,clearInterval(G),F&&F())):(j.volume+=.01,j.volume>=1&&(j.volume=1,clearInterval(G),F&&F())),console.log(j.volume)})},16.7)},this.setSongs(D)}async setSongs(D){this.audioList=D.filter(G=>!!G).map(G=>G),this.audio=null,this.event.removeAllListeners(),this.audios={};const R=D.filter(G=>!!G).map(async G=>({url:G})),F=await Promise.all(R);for(const G of F){const j=new Audio(G.url);j.load(),this.audios[G.url]=j,this.audio||(this.audio=j)}this.length=R.length,this.audio&&(this.audio.addEventListener("loadedmetadata",G=>{this.setDuration()}),this.audio.addEventListener("timeupdate",G=>{var U;this.currentTime=((U=this.audio)==null?void 0:U.currentTime)||0,this.event.emit("timeupdate",G);let j=!1;this.currentTime===this.duration&&!j&&(j=!0)})),D.length&&(this.status=this.getStatus()),this.event.on("allWaiting",()=>{this.hasWaitng()&&this.event.emit("waiting")}),this.event.on("allPlaying",()=>{this.hasWaitng()||this.event.emit("playing")}),this.syncEvent()}setDuration(D){var F;const R=Object.values(D||this.audios||{});if(R.length){const G=[];for(const U of R){const W=U.duration;W>0&&G.push(W)}const j=Math.floor(Math.max(...G)-Math.min(...G));j>=1&&console.log("\u8BE5\u6559\u7A0B\u539F\u97F3\u4E0E\u4F34\u594F\u65F6\u957F\u8D85\u8FC7"+j+"\u79D2\uFF0C\u8BF7\u4FEE\u6539\u540E\u4F7F\u7528"),this.duration=Math.min(...G),this.duration>0&&((F=this.event)==null||F.emit("loadedmetadata",null,this.duration))}}destroyed(){this.pause(),this.event.removeAllListeners(),this.audio=null,this.audios={}}hasWaitng(){let D=!1;for(const R of Object.values(this.audios))if(R.dataset.status==="waiting"){D=!0;break}return D}syncEvent(){let D=!1;const R=W=>{var Y;D=!1,console.log("\u5F00\u59CB\u89E6\u53D1play\u4E8B\u4EF6",new Date().getTime()),this.event.emit("play",W),((Y=W.target)==null?void 0:Y.src)===this.audioList[0]&&(playStartTime$1=new Date().getTime())},F=async W=>{var Y;if(await this.pause(),this.event.emit("pause",W),((Y=W.target)==null?void 0:Y.src)===this.audioList[0]){const Q=new Date().getTime()-playStartTime$1;this.event.emit("updatePlayTime",Q/1e3)}},G=W=>{this.status==="play"&&(W.target.dataset.status="waiting"),this.event.emit("allWaiting")},j=W=>{W.target.dataset.status="",this.event.emit("allPlaying")},U=async W=>{D||(D=!0,await this.pause());for(const Y in this.audios)Object.prototype.hasOwnProperty.call(this.audios,Y)&&this.event.emit("ended",{target:this.audios[Y]})};for(const W of Object.values(this.audios))W.addEventListener("loadedmetadata",()=>this.setDuration(this.audios)),W.addEventListener("play",R),W.addEventListener("pause",F),W.addEventListener("waiting",G),W.addEventListener("playing",j),W.addEventListener("ended",U)}getStatus(){var D;return this.audio?(D=this.audio)!=null&&D.paused?"pause":"play":"init"}play(D){return this.getStatus()!=="play"?new Promise(R=>{setTimeout(()=>{new Date().getTime(),Object.values(this.audios).map(async(F,G)=>{console.log("play duration",F.duration),await F.play()}),R(this.audios)},D||100)}):(this.status=this.getStatus(),Promise.resolve())}pause(){return this.status=this.getStatus(),Promise.all(Object.values(this.audios).map(async D=>await D.pause())).then(D=>(this.status=this.getStatus(),D))}setMute(D,R){R?this.audios[R]&&(this.audios[R].muted=D):(this.muted=D,Object.values(this.audios).map(F=>F.muted=D))}setSpeed(D,R){R?this.audios[R]&&(this.audios[R].playbackRate=D):(this.speed=D,Object.values(this.audios).map(F=>(F.playbackRate=D,F)))}setCurrentTime(D){this.currentTime=D,Object.values(this.audios).map(R=>R.currentTime=D)}toggleMute(D){D?this.audios[D]&&(this.audios[D].muted=!this.audios[D].muted):(Object.values(this.audios).map(R=>R.muted=!this.muted),this.muted=!this.muted)}async togglePlay(D){if(this.getStatus()==="pause")return await this.play(D);if(this.getStatus()==="play")return this.setMute(!0),await this.pause()}}const search=useOriginSearch(),skpList=["Ukulele"],useXml=async(B,D)=>{let R=ref("");try{const F=await request$1$1(B),G=getCustomInfo(F);if(skpList.includes(G.code))R.value=F;else{R.value=formatXML(G.parsedXML,{title:D.musicSheetName});const j=Number(search["part-index"])||0;R.value=onlyVisible(R.value,j)}}catch{}return R},useMp3s=async B=>{var Y;const R=useOriginSearch()["part-index"]||0,F=(Y=B.background)==null?void 0:Y[R];state.songs={background:encodeURI(B.audioFileUrl||B.metronomeUrl||B.url||""),music:encodeURI((F==null?void 0:F.audioFileUrl)||(F==null?void 0:F.metronomeUrl)||"")},console.log("backgroundUrl",state.songs.background),console.log("musicUrl",state.songs.music),state$2.isAppPlay=B.audioType==="MIDI";let G={skipTick:!1,repeatedBeats:!0,scoreSize:"middle"},j={};state$2.activeDetail={...B,examSongId:B.id,originalSpeed:90,isAppPlay:B.audioType==="MIDI",extConfigJson:{...G}},state$4.sett.hertz=B.aiDefaultFrequency&&parseInt(""+B.aiDefaultFrequency||"440")||440;try{j=JSON.parse((B==null?void 0:B.extConfigJson)||"")}catch{}state$2.activeDetail.extConfigJson={...state$2.activeDetail.extConfigJson,...j};const U=state$2.activeDetail.extConfigJson.scoreSize,W=store_legacy.get("zooms")||{};U&&!W[""+B.id]&&(store_legacy.set("zooms",{...W,[""+B.id]:U}),state$4.sett.scoreSize=U),state$2.needTick=B.audioType==="MP3"&&B.mp3Type==="MP3"||B.audioType==="MIDI",state$2.skipTick=state$2.activeDetail.extConfigJson.skipTick,state$2.repeatedBeats=state$2.activeDetail.extConfigJson.repeatedBeats,state.songs.music||changeMode("background"),state.audiosInstance||(state.audiosInstance=new MultipleAudio(Object.values(state.songs)))},useSpecialShapedScreen=()=>{const B=ref(0);return postMessage({api:"isSpecialShapedScreen"},D=>{const R=D==null?void 0:D.content.notchHeight;state$2.notchHeight=(browser().ios?R*2:R)||((D==null?void 0:D.content.isSpecialShapedScreen)&&browser().ios?100:0),B.value=state$2.notchHeight,state$2.isSpecialShapedScreen=D==null?void 0:D.content.isSpecialShapedScreen}),[B]},useDetail=B=>{const D=useClientType(),R=ref("loading"),F=ref({});return R.value="loading",request.get(`/musicSheet/detail/${B}`,{prefix:D==="teacher"?"/api-teacher":"/api-student"}).then(G=>{useMp3s(G.data),F.value={...G.data},F.value.notation==0&&(state$4.sett.type="staff"),state$2.subjectId=(G.data.musicSubject||"").split(",")[0]||0,window.DYSubjectId=formatId(G.data.code),R.value="success"}).catch(()=>R.value="error"),[R,F]},useSuspendPlay=()=>{listenerMessage("suspendPlay",()=>{state$2.activeTick>-1&&stopTick(),console.log(state.playState),state.playState==="play"&&(resetPlayStatus(),state.evaluatingStatus&&evaluatStopPlay(!1))})},event=new EventEmitter,browserInfo=browser(),initBehaviorId=""+new Date().valueOf(),getLinkId=()=>{const B=useOriginSearch().id;return location.hash.split("?")[0].split("/").pop()||B||""},getFixTime=B=>{const D=getDuration(state.osmd);let R=D.numerator||0,F=D.denominator||4;return state$2.repeatedBeats&&(R=R===2?4:R),!state$2.needTick&&!state$2.skipTick?F*60/B/F*R:0};let prevIndex=0;const state=reactive({songs:{},playState:"init",sectionHint:new SectionHint,audiosInstance:null,mode:"music",isFirstPlay:!0,metro:null,metroing:!1,duration:"0:00",durationNum:0,currentTime:"0:00",currentTimeNum:0,loading:!1,speed:90,browser:browser(),speedShow:!1,progressShow:!1,touched:!1,osmd:null,tickPlayer:null,evaluatingStatus:!1,evaluatingTips:!1,clickTime:0,evaluatingFixTime:0,cameraStatus:!1,captureStatus:!1,ticking:!1,partIndex:0,activeIndex:0}),syncStepIndex=B=>{var D;state.osmd.hidden!==!1&&state.osmd.cursor.show(),prevIndex=B,setStepIndex(state.osmd,B),refreshIndex((D=state$2.times[B])==null?void 0:D.time)};watchEffect(()=>{state$2.maskStatus=state.playState==="play"});const syncPlayState=async()=>{if(state$2.activeDetail.isAppPlay){const B=await promisefiyPostMessage({api:"cloudGetMediaStatus"}),D=B==null?void 0:B.content.status;state.playState=D}else state.playState=state.audiosInstance.getStatus()},setCurrentTime=B=>{console.log("setCurrentTime",B);const D=B;state$2.fixedKey=0,state.currentTimeNum=D,state.currentTime=formatTime(D),state$2.activeDetail.isAppPlay?promisefiyPostMessage({api:"cloudSetCurrentTime",content:{currentTime:B*1e3,songID:state$2.activeDetail.examSongId}}):state.audiosInstance.setCurrentTime(D),refreshView(),syncPlayState();const R=getIndex(state$2.times,state.currentTimeNum);syncStepIndex(R)},getActiveMidiId=()=>{var B,D,R,F,G,j,U;return(U=(j=(G=(F=(R=(D=(B=state.osmd)==null?void 0:B.sheet)==null?void 0:D.instruments)==null?void 0:R[0])==null?void 0:F.subInstruments)==null?void 0:G[0])==null?void 0:j.midiInstrumentID)!=null?U:0},changeMode=async B=>{var R,F;const D=B==="background"?"music":"background";if(console.log(!state.songs[B],B,D),state$2.activeDetail.isAppPlay){const G=new Map;for(const j of state$2.partListNames)G.set(j,60);for(const j of getVoicePartInfo().partListNames)G.set(j,D==="background"?100:0);promisefiyPostMessage({api:"cloudVolume",content:{activeMidiId:getActiveMidiId(),activeMidiVolume:D==="background"?100:0,parts:Array.from(G.keys()).map(j=>({name:j,volume:G.get(j)}))}})}state.mode=B,(R=state.audiosInstance)==null||R.setMute(!0,state.songs[D]),(F=state.audiosInstance)==null||F.setMute(!1,state.songs[B])},changeAllMode=()=>{var B,D;if((B=state$2.activeDetail)!=null&&B.isAppPlay){const R=new Map;for(const F of state$2.partListNames)R.set(F,1);promisefiyPostMessage({api:"cloudVolume",content:{activeMidiId:getActiveMidiId(),activeMidiVolume:100,parts:Array.from(R.keys()).map(F=>({name:F,volume:R.get(F)}))}})}else state.mode="background",(D=state.audiosInstance)==null||D.setMute(!0)},changeSpeed=(B,D=!0)=>{var F;const R=store_legacy.get("speeds")||{};D&&(R[getLinkId()]=B,store_legacy.set("speeds",R)),state.speed=B,(F=state.audiosInstance)==null||F.setSpeed(B/state$2.baseSpeed),promisefiyPostMessage({api:"cloudChangeSpeed",content:{speed:B,originalSpeed:state$2.activeDetail.originalSpeed,songID:state$2.activeDetail.examSongId}}),state.playState==="play"&&syncStepIndex(getIndex(state$2.times,state.currentTimeNum))},resetCursor=()=>{state.osmd&&(state.osmd.product?state.osmd.cursor.setPosition({...state$2.times[0].cursorBox}):state.osmd.cursor.reset(),state.osmd.cursor.hide(),state$2.fixedKey=0)},refreshIndexBase=B=>{if(B<0)return;const{osmd:D}=state;D&&state$2.times[B]&&(state$2.sectionStatus||state.sectionHint.show(),state$2.times[B]&&state$2.times[B].noteElement&&state.sectionHint.showForElement(state$2.times[B]),D.product||D.cursor.hidden!==!1&&(D.cursor.reset(),D.cursor.show(),state$2.fixedKey=0),prevIndex!==B&&(setStepIndex(state.osmd,state$2.times[B].i,prevIndex),prevIndex=B),state$2.fixedKey=state$2.times[B].realKey,state$2.activeNote=state$2.times[B])},refreshIndex=B=>{const{osmd:D}=state;if(D&&(B||state.audiosInstance.audio)){const R=B||state.audiosInstance.audio.currentTime,F=getIndex(state$2.times,R);state.activeIndex=F,removeRepateBackground(F);const G=state$2.times[state$2.times.length-1],j=(G==null?void 0:G.sourceEndTime)||(G==null?void 0:G.endtime);R>j?(state.osmd.cursor.hide(),state.sectionHint.destroy()):state$2.times[F]&&refreshIndexBase(F)}},removeRepateBackground=B=>{var D,R;if(state.evaluatingStatus&&B){const F=state$2.times[B],G=state$2.times[B+1]||F,j=(R=(D=G==null?void 0:G.noteElement)==null?void 0:D.sourceMeasure)==null?void 0:R.measureListIndex;G&&state$2.evaluatings[j]&&B>0&&(state$2.evaluatings={...state$2.evaluatings,[j]:void 0})}},refreshPlayer=async B=>{var R,F;const{osmd:D}=state;if(D&&(B||state.audiosInstance.audio)){const G=B||state.audiosInstance.audio.currentTime,j=0;if(G+1{if(state$2.sectionStatus&&state$2.section.length===2){G>=state$2.section[0].time&&(state$2.sectionFlash=!1);const Y=state$2.times[state$2.section[1].i+1],Q=Y?Y.halfTone===0?state$2.section[1].endtime:Y.time:state.durationNum;return G+(browserInfo.xiaomi?.2:.08)>=Q}return!1})()){state.audiosInstance.setMute(!0),state.osmd.cursor.hide(),(R=state$2.activeDetail)!=null&&R.isAppPlay?pause():await state.audiosInstance.pause(),setSectionModeCurrentTime(),clearAccelerateRefreshPlayer(),setTimeout(()=>setPlayState(),1e3),state.loading=!1;return}((F=state$2.activeDetail)==null?void 0:F.isAppPlay)&&state.durationNum+3{try{prevIndex=0,state.osmd.cursor.reset(),state.osmd.cursor.hide(),state$2.fixedKey=0,state$2.sectionFlash=!1,state.sectionHint&&state.sectionHint.destroy(),B||(state$2.activeDetail.isAppPlay?(await promisefiyPostMessage({api:"cloudSuspend",content:{songID:state$2.activeDetail.examSongId}}),endCapture()):(console.log("resetPlayStatus\u8C03\u7528\u6682\u505C"),state.audiosInstance.pause())),syncPlayState()}catch(D){console.log("resetPlayStatus\u9519\u8BEF",D)}},play=async()=>{state.isFirstPlay&&(resetPlayStatus(),state$2.fixedKey=0),state$2.activeDetail.isAppPlay?(await syncPlayState(),promisefiyPostMessage({api:"cloudSuspend",content:{songID:state$2.activeDetail.examSongId}}),startCapture()):(state.playState=state.audiosInstance.getStatus(),clearAccelerateRefreshPlayer(),accelerateRefreshPlayer(),startCapture())},setDelayTime=async B=>new Promise(D=>{setTimeout(()=>{D(B)},B)}),pause=async()=>{state$2.sectionStatus&&state.osmd.cursor.hide(),state$2.activeDetail.isAppPlay?(await syncPlayState(),await promisefiyPostMessage({api:"cloudSuspend"}),await setDelayTime(200),endCapture()):(state.playState=state.audiosInstance.getStatus(),clearAccelerateRefreshPlayer(),state.audiosInstance.pause(),setTimeout(()=>{endCapture()},200))},waiting=()=>{state.loading=!0},playing=()=>{state.loading=!1},ended=lodash.exports.debounce(async B=>{resetPlayStatus(),state$2.fixedKey=0,state.evaluatingStatus||(refreshPlayer(0),state$4.sett.loop&&await setPlayState()),setCurrentTime(0),event.emit("ended",B)},300,{leading:!0,trailing:!1});let timer=null;const accelerateRefreshPlayer=()=>{timer||!state.audiosInstance||(timer=setInterval(()=>{requestAnimationFrame(()=>{refreshPlayer(),state.audiosInstance.getStatus()==="play"&&refreshIndex()})},16.7))},clearAccelerateRefreshPlayer=()=>{clearInterval(timer),timer=null},sectionChange=()=>{state$2.sectionStatus=!state$2.sectionStatus,clearAccelerateRefreshPlayer(),resetPlayStatus(),state$2.sectionStatus||(setCurrentTime(0),state$2.fixedKey=0),state$2.sectionStatus&&state$2.section.length!=2&&resetCursor()},getFirsrNoteByMeasureListIndex=(B,D=!0)=>{var R,F,G;for(const j of state$2.times)if(((F=(R=j==null?void 0:j.noteElement)==null?void 0:R.sourceMeasure)==null?void 0:F.measureListIndex)===B){let U=null;for(const W of j.measures)getSlursNote(W)&&(U=getSlursNote(W));if(U&&((G=U.sourceMeasure)==null?void 0:G.measureListIndex)!==B){for(const W of state$2.times)if(W.noteElement.NoteToGraphicalNoteObjectId===U.NoteToGraphicalNoteObjectId)return W}return j}return null},setSectionModeCurrentTime=()=>{var B,D;if(console.log(state$2.needTick,"setSectionModeCurrentTime"),state$2.needTick)setCurrentTime(state$2.section[0].sourceStartTime||state$2.section[0].time);else{const R=(D=(B=state$2.section[0].noteElement)==null?void 0:B.sourceMeasure)==null?void 0:D.measureListIndex;R>0?(setCurrentTime(getFirsrNoteByMeasureListIndex(R-1).time),state$2.sectionFlash=!0):setCurrentTime(0)}},setPlayerView=()=>{console.log(state$2.sectionStatus,"detailState.sectionStatus"),console.log(state$2.needTick),state$2.sectionStatus&&(syncStepIndex(getIndex(state$2.times,state.currentTimeNum)),state$2.section.length===2?setSectionModeCurrentTime():(state$2.section=[],state$2.sectionBoundingBoxs=[],state$2.sectionStatus=!1,Toast.clear()))},cloudToggleState=async()=>{const B=await promisefiyPostMessage({api:"cloudGetMediaStatus"}),D=B==null?void 0:B.content.status;if(D==="init")return;D==="suspend"?(await promisefiyPostMessage({api:"cloudPlay",content:{songID:state$2.activeDetail.examSongId,startTime:state.currentTimeNum*1e3,originalSpeed:state$2.activeDetail.originalSpeed,speed:state.speed,hertz:440}}),startCapture()):(await promisefiyPostMessage({api:"cloudSuspend"}),endCapture());const R=await promisefiyPostMessage({api:"cloudGetMediaStatus"});state.playState=R==null?void 0:R.content.status,console.log(R,"cloudGetMediaStatused")},toggleState=async B=>{state$2.activeDetail.isAppPlay?await cloudToggleState():(console.log(state$2.activeDetail),console.log("delay",B),state.isFirstPlay=!1,setPlayerView(),await state.audiosInstance.togglePlay(B),state.evaluatingStatus||changeMode(state.mode),state.playState=state.audiosInstance.getStatus())},setActiveKey=B=>{state$2.activeTick=B},setTickStop=()=>{console.log("\u8282\u62CD\u5668\u7ED3\u675F",new Date().getTime()-state.clickTime),state$2.activeTick=-1,state$2.activeTickRepeat=1,toggleState(getTickTime(state.speed/state$2.baseSpeed))};let timeliner=-1;const clearIntervalTimeline=()=>{clearInterval(timeliner)},onTickDestroy=()=>{event.emit("tickDestroy")},setTick=(B,D)=>{var F,G,j,U,W,Y,Q;console.log("ticking");const R=()=>{B(),event.emit("tickEnd")};if(state$2.needTick){let{numerator:Z,denominator:q}=getDuration(state.osmd);if(state.osmd.numerator&&state.osmd.denominator&&(Z=state.osmd.numerator,q=state.osmd.denominator),state$2.activeDetail.isAppPlay)state.ticking=!0,postMessage({api:"cloudMetronome",content:{repeat:Z===2?2:1,denominator:q,numerator:Z}},J=>{state.ticking=!1,(J==null?void 0:J.content.status)==="finish"?R():(J==null?void 0:J.content.status)==="cancel"&&event.emit("tickDestroy")});else{const J=Z===2?2:1;state$2.activeTickRepeat=J,console.log("ticking"),state.tickPlayer=new Player(Z,(D||state.speed)/90),(F=state.tickPlayer)==null||F.start(Z,(D||state.speed)/90,J),(G=state.tickPlayer)==null||G.event.off("tick",setActiveKey),(j=state.tickPlayer)==null||j.event.off("stop",R),(U=state.tickPlayer)==null||U.event.off("destroy",onTickDestroy),(W=state.tickPlayer)==null||W.event.on("tick",setActiveKey),(Y=state.tickPlayer)==null||Y.event.on("stop",R),(Q=state.tickPlayer)==null||Q.event.on("destroy",onTickDestroy)}}else R()},setPlayState=async()=>{if(!(state$2.activeTick>-1||state.ticking)){if(await syncPlayState(),console.table({playState:state.playState,currentTime:state.currentTimeNum}),state.playState!=="pause"&&state.playState!=="suspend"){await toggleState();return}console.log("\u8BBE\u7F6E\u64AD\u653E"),setPlayerView(),setTick(setTickStop)}},stopTick=()=>{state.tickPlayer&&state.tickPlayer.destroy(),event.emit("stopTick"),state$2.activeTickRepeat=1,state$2.activeTick=-1},windowResize=()=>{const B=getIndex(state$2.times,state.currentTimeNum);setTimeout(()=>{var D,R;(R=state.sectionHint)==null||R.showForElement((D=state$2.times[B])==null?void 0:D.noteElement)},200)},loadedmetadata=()=>{state.duration=formatTime(state.audiosInstance.duration),state.durationNum=state.audiosInstance.duration};let prevDiff=0,viewing=!1;const refreshView=()=>{var F;let B,D;(F=state==null?void 0:state.osmd)!=null&&F.product&&(B=state.osmd.cursor.img,D=document.querySelector("#colexiu-detail-music-sheet"));const R=Math.max(parseFloat((B||state.osmd.cursor.cursorElement).style.top),0);Math.abs(prevDiff-R)>10&&!viewing&&(viewing=!0,setTimeout(()=>{viewing=!1,(D||(state$3.clintNmae==="colexiu"?state.osmd.container.parentElement.parentElement:state.osmd.container.parentElement)).scrollTo({top:R,left:0,behavior:"smooth"}),prevDiff=R},100))},updatePlayTime=async B=>{if(!state.evaluatingStatus){const D=useOriginSearch(),R=sessionStorage.getItem("behaviorId")||D.behaviorId||initBehaviorId,F=useClientType();try{const G=await request.post("/musicPracticeRecord/save",{prefix:F==="teacher"?"/api-teacher":"/api-student",data:{musicSheetId:getLinkId(),sysMusicScoreId:getLinkId(),feature:"CLOUD_STUDY_TRAIN",playTime:B,deviceType:getPlatform(),behaviorId:R}});event.emit("updatePlayTimeSuccess",G.data)}catch{}}},setAudioInit=()=>{state.audiosInstance.event.on("loadedmetadata",loadedmetadata),state.audiosInstance.event.on("waiting",waiting),state.audiosInstance.event.on("playing",playing),state.audiosInstance.event.on("play",play,!1),state.audiosInstance.event.on("pause",pause,!1),state.audiosInstance.event.on("ended",ended,!1),state.audiosInstance.event.on("updatePlayTime",updatePlayTime,!1),listenerMessage("cloudplayed",async()=>{await syncPlayState(),state.currentTimeNum=0,state.currentTime="00:00",state.audiosInstance.event.emit("ended",new Event("ended"))}),listenerMessage("cloudTimeUpdae",B=>{const D=(B==null?void 0:B.content.currentTime)/1e3;state.playState==="play"&&(state.currentTimeNum=D,state.currentTime=formatTime(D),refreshPlayer(D),refreshIndex(D)),refreshView()}),state.audiosInstance.event.on("timeupdate",()=>{state.currentTimeNum=state.audiosInstance.currentTime,state.currentTime=formatTime(state.audiosInstance.currentTime),requestAnimationFrame(()=>{state.audiosInstance.getStatus()==="play"&&refreshPlayer(),refreshView()})}),window.addEventListener("resize",windowResize)},setStepView=(B,D)=>{prevIndex=Math.max(B.i,0),syncStepIndex(B.i),D&&refreshPlayer(D),refreshView()},noteClick=B=>{if(state.isFirstPlay){Toast("\u5F00\u59CB\u64AD\u653E\u540E\u624D\u80FD\u8C03\u6574\u8FDB\u5EA6");return}let D=getNoteBySlursStart(getActtiveNoteByTimes(B));if(D){const R=D.sourceStartTime||D.time;setCurrentTime(R),setStepView(D.i,R),state$2.fixedKey=D.realKey,state$2.activeNote=D}};let playStartTime=0;const startCapture=async()=>{var B;(B=state$2.activeDetail)!=null&&B.isAppPlay&&(playStartTime=new Date().getTime(),console.log("startCapture",playStartTime)),state$4.sett.camera&&browserInfo.isApp&&!state.captureStatus&&state.evaluatingStatus&&state$4.eva.save&&(state.captureStatus=!0,postMessage({api:"startCapture"},()=>{postMessage({api:"setCaptureMode",content:{mode:"evaluating"}})}))},endCapture=async()=>{var B,D;if((B=state$2.activeDetail)!=null&&B.isAppPlay){const R=new Date().getTime()-playStartTime;playStartTime!==0&&R>0&&((D=state.audiosInstance)==null||D.event.emit("updatePlayTime",R/1e3),playStartTime=0)}browserInfo.isApp&&state.evaluatingStatus&&state$4.sett.camera&&state.captureStatus&&(postMessage({api:"endCapture"},()=>{state.captureStatus=!1}),evaluatPlayerStop())},setCaptureMode=async()=>{browserInfo.isApp&&state$4.sett.camera&&postMessage({api:"setCaptureMode",content:{mode:state.evaluatingStatus?"evaluating":"practice"}})},section="_section_fxysl_1",measure="_measure_fxysl_1",dontTransition="_dontTransition_fxysl_5",after="_after_fxysl_5",img="_img_fxysl_22",font="_font_fxysl_30",bad="_bad_fxysl_35",good="_good_fxysl_43",great="_great_fxysl_51",perfect="_perfect_fxysl_58",noteWrap="_noteWrap_fxysl_80",noteBase="_noteBase_fxysl_86",noteRight="_noteRight_fxysl_89",noteError="_noteError_fxysl_92",flash="_flash_fxysl_124",restFlag="_restFlag_fxysl_127",restFlagActive="_restFlagActive_fxysl_141",flicker="_flicker_fxysl_1";var styles={section,measure,dontTransition,after,img,font,bad,good,great,perfect,noteWrap,noteBase,noteRight,noteError,flash,restFlag,restFlagActive,flicker};const restPromptData=reactive({list:[]}),restPromptMain=B=>{calculateMergeRest(B)};function calculateMergeRest(B){var j,U,W,Y,Q,Z,q,J,K;const D=[],R=document.querySelector("#osmdSvgPage1"),F=((j=R.getAttribute("viewBox"))==null?void 0:j.split(" "))||[];let G=Number(R.getAttribute("width"))/Number(F[2]);G=isNaN(G)?1:G;for(let te=0;tefe.measureNumberXML===ie)&&oe&&re>1){const fe=getStaveBox((K=(J=ne==null?void 0:ne.stave)==null?void 0:J.attrs)==null?void 0:K.id,G);D.push({measureNumberXML:ie,allRests:oe,multipleRestMeasures:re,staveBox:fe})}}restPromptData.list=D}function getStaveBox(B,D){var F;if(!B)return{};const R=document.querySelector("#"+B);if(R){const G=(F=R==null?void 0:R.nextElementSibling)==null?void 0:F.getBBox();return{left:G.x*D+"px",top:G.y*D+"px",width:G.width*D+"px",height:G.height*D+"px"}}return{}}function _isSlot(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}const sectionRef=ref(null),noteInfoItems=reactive({duration:!1,numerator:!1,denominator:!1,i:!1,time:!1,speed:!1});window.setNoteInfoItems=B=>{for(const D in B)Object.prototype.hasOwnProperty.call(B,D)&&(noteInfoItems[D]=B[D])};const uniqueByPosition=B=>{const D={};for(const R of B)R&&R.start_x&&(D[`${R.x}-${R.y}`]=R);return D};watchEffect(()=>{state$2.sectionStatus?state$2.section.length?state$2.section.length===1&&(Toast.clear(),Toast({duration:0,message:"\u8BF7\u9009\u62E9\u7ED3\u675F\u8282\u70B9",position:"top"})):(state$2.befireSection=null,Toast.clear(),Toast({duration:0,message:"\u8BF7\u9009\u62E9\u5F00\u59CB\u8282\u70B9",position:"top"})):(state$2.section=[],state$2.sectionBoundingBoxs=[],Toast.clear())});var Section=defineComponent({name:"section-box",props:{type:{type:String,default:"evaluating"},top:{type:Number,default:0},left:{type:Number,default:0}},data(){return{sectionTop:0,sectionLeft:0}},methods:{getBoundingBoxByNote(B,D){var G,j,U,W,Y,Q,Z,q,J,K,te;const R=(U=(j=(G=B.sourceMeasure)==null?void 0:G.verticalMeasureList)==null?void 0:j[0])==null?void 0:U.boundingBox;if(!R)return null;const F={...R.absolutePosition,...R.size,...D};return F.x=F.x*10,F.y=F.y*10,F.width=F.width*10,F.height=F.height*10,(Z=(Q=(Y=(W=B==null?void 0:B.sourceMeasure)==null?void 0:W.verticalMeasureList)==null?void 0:Y[0])==null?void 0:Q.stave)!=null&&Z.height&&(F.height=(te=(K=(J=(q=B.sourceMeasure)==null?void 0:q.verticalMeasureList)==null?void 0:J[0])==null?void 0:K.stave)==null?void 0:te.height),F},setSettionBackground(){var j,U,W,Y,Q;state$2.sectionBoundingBoxs=[];const[B,D]=state$2.section.sort((Z,q)=>Z.i-q.i),R=Math.abs(D.i-B.i)+1;D.noteLength;const F=[],G=[];for(let Z=0;Z(Z.height=Math.max(...G),Z))},setSection(B){const D=getActtiveNoteByTimes(B);if(console.log("\u{1F680} ~ activeNote",D),D&&state$2.section.length<2){const R=state$2.section.length;if(R===0){const F=getNoteBySlursStart(D,!0);state$2.section.push(state$2.times[F.i-F.si])}if(R===1){const F=getNoteBySlursStart(D,!0,"end");state$2.section.push(state$2.times[F.i-F.si+F.noteLength-1])}}state$2.section.length===2&&(Toast.clear(),this.setSettionBackground())},sectionClick(B){if(state$2.sectionStatus)this.setSection(B);else{if(state$2.mode!=="contact"||state.evaluatingStatus)return;event$1.emit("section-click",B)}},filterTimes(B){const D=[];return B.filter(R=>{const F=D.includes(R.id);return D.push(R.id),!F})}},mounted(){var B,D;Toast.clear(),state$2.section=[],this.sectionTop=(B=sectionRef.value)==null?void 0:B.getBoundingClientRect().top,this.sectionLeft=(D=sectionRef.value)==null?void 0:D.getBoundingClientRect().left},beforeUnmount(){Toast.clear(),state$2.sectionStatus=!1,state$2.section=[]},render(){var U,W,Y;let B;const D=state$4.sett.eyeProtection?"var(--eye-section-border-color)":"var(--section-border-color)",R=Q=>state$4.sett.eyeProtection?Q.before?"var(--section-background-color)":"var(--eye-section-background-color)":Q.before?"var(--eye-section-background-color)":"var(--section-background-color)",F=((Y=(W=(U=state$2.times[state.activeIndex])==null?void 0:U.noteElement)==null?void 0:W.sourceMeasure)==null?void 0:Y.MeasureNumberXML)||-2,G=restPromptData.list.find(Q=>{const Z=F-Q.measureNumberXML;return Q.allRests&&Z>=0&&Z{var ie,re,oe,le;if(!Q.svgElelent)return null;let Z;try{Z=Q.svgElelent.bbox||((re=(ie=Q.svgElelent).getBoundingBox)==null?void 0:re.call(ie)),!Z&&((le=(oe=Q.svgElelent)==null?void 0:oe.attrs)==null?void 0:le.el)&&(Z=Q.svgElelent.attrs.el.getBBox(),Z.w=Z.width<15?15:Z.width,Z.h=Z.height<11?11:Z.height)}catch(fe){console.log(fe)}if(!Z)return null;state$4.sett.type==="jianpu"&&Q.svgElelent&&Q.svgElelent.top_y&&Q.svgElelent.note_height&&(Z.y=Q.svgElelent.top_y-Q.svgElelent.note_height);let{x:q,y:J,h:K,w:te}=Z,ne=null;return Q.si===0&&(ne=this.getBoundingBoxByNote(Q.noteElement)),createVNode(Fragment,null,[Q.si===0&&ne&&createVNode("div",{"data-id":Q.id,style:{position:"absolute",top:formatZoom(ne.y)+"px",left:formatZoom(ne.x)+"px",height:formatZoom(ne.height)+"px",width:formatZoom(ne.width)+"px"},onClick:state$2.sectionStatus?this.sectionClick:void 0},null),createVNode("div",{"data-id":Q.id,"data-vf":"vf"+Q.id,class:styles.noteWrap,style:{position:"absolute",top:formatZoom(J)+"px",left:formatZoom(q)+"px",height:formatZoom(K)+"px",width:formatZoom(te)+"px",background:Object.values(noteInfoItems).find(fe=>fe===!0)?"rgba(255, 255, 255, 0.8)":""},onClick:this.sectionClick},[noteInfoItems.duration&&createVNode(Fragment,null,[parseInt(Q.duration*100+"")/100,createVNode("br",null,null)]),noteInfoItems.time&&createVNode(Fragment,null,[Q.time.toFixed(2),createVNode("br",null,null)]),noteInfoItems.numerator&&createVNode(Fragment,null,[Q.noteElement.sourceMeasure.activeTimeSignature.numerator,createVNode("br",null,null),createVNode("br",null,null)]),noteInfoItems.denominator&&createVNode(Fragment,null,[Q.noteElement.sourceMeasure.activeTimeSignature.denominator,createVNode("br",null,null),createVNode("br",null,null)]),noteInfoItems.i&&createVNode(Fragment,null,[Q.i,createVNode("br",null,null),createVNode("br",null,null)]),noteInfoItems.speed&&createVNode(Fragment,null,[Q.speed.toFixed(0),createVNode("br",null,null),createVNode("br",null,null)]),createVNode("div",{class:[styles.noteBase,styles.noteRight]},[createVNode(Icon,{name:"success",size:"16",color:"var(--primary-color)"},null)]),createVNode("div",{class:[styles.noteBase,styles.noteError]},[createVNode(Icon,{name:"cross",size:"16",color:"red"},null)])])])}),state$2.section.map((Q,Z)=>{var K;const q=getBoundingBoxByverticalNote(Q);let J;try{const te=Q.svgElelent.bbox||((K=Q.svgElelent)==null?void 0:K.getBoundingBox());J=formatZoom((te==null?void 0:te.x)||(Z===0?q.start_x:q.end_x))}catch(te){console.log(te)}return J?Z===0&&q?createVNode("div",{style:{position:"absolute",top:formatZoom(q.y)-5+"px",left:formatZoom(q.x)+"px",height:formatZoom(q.height)+"px",border:`5px solid ${D}`,borderColor:`${D} transparent ${D} ${D}`,borderRight:"none",width:"5px"}},null):Z===1&&q?(q.width=formatZoom(J-q.x+15),createVNode("div",{style:{position:"absolute",top:formatZoom(q.y-5)+"px",left:formatZoom(q.end_x-3)-5+"px",height:formatZoom(q.height)+"px",border:`5px solid ${D}`,borderColor:`${D} ${D} ${D} transparent`,borderLeft:"none",width:"5px"}},null)):null:null}),state$2.sectionBoundingBoxs.map(Q=>{var Z;return createVNode("div",{class:{[styles.flash]:Q.before&&state$2.sectionFlash&&state.playState==="play"},style:{position:"absolute",top:formatZoom(Q.y)+"px",left:formatZoom(Q.x)+"px",height:formatZoom((Z=getBoundingBoxByverticalNote(state$2.section[0]))==null?void 0:Z.height)+"px",width:formatZoom(Q.width)+"px",backgroundColor:R(Q)}},null)}),createVNode(TransitionGroup,{name:"list",duration:800},_isSlot(B=Object.values(uniqueByPosition(Object.values(state$2.evaluatings))).map(Q=>Q?createVNode("div",{key:Q.y+Q.x+Q.text,class:classnames(styles[Q.text],styles.measure,{[styles.dontTransition]:Q.dontTransition}),style:{position:"absolute",top:formatZoom(Q.y)+this.top+"px",left:formatZoom(Q.x)+this.left+"px",height:formatZoom(Q.height)+"px",width:formatZoom(Q.width)+"px"}},[this.type==="evaluating"?createVNode("span",{class:styles.after},[createVNode("span",{class:styles.img},null),createVNode("span",{class:styles.font},[Q.score])]):null]):createVNode("span",null,null)))?B:{default:()=>[B]}),G&&createVNode("div",{class:["dotWrap",styles.restMeasure],style:G.staveBox},[createVNode("div",{class:"dot"},[j])])])}});class Cursor{constructor(D){this.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAABCAYAAAASC7TOAAAAAXNSR0IArs4c6QAAABdJREFUGFdj3Pp5c0Ptm2oGdNAs0soAAHslBd3n2kNUAAAAAElFTkSuQmCC",this.x=D.x,this.y=D.y,this.width=D.w,this.height=D.h,this.img=document.createElement("img"),this.img.src=this.src,this.img.style.position="absolute",this.img.style.zIndex="-1",this.setValue()}reset(){var R,F;const D=(F=(R=state$2.times)==null?void 0:R[0])==null?void 0:F.cursorBox;D&&this.setPosition(D)}show(){this.img.style.display=""}hide(){this.img.style.display="none"}setPosition({x:D,y:R,w:F,h:G}){this.x=D,this.y=R,this.width=F,this.height=G,this.setValue()}setValue(){this.img.style.left=this.x+"px",this.img.style.top=this.y+"px",this.img.style.width=this.width+"px",this.img.style.height=this.height+"px",this.show()}}const rendered=ref(!1);var MusicSheet=defineComponent({name:"music-score",props:{isSoundEffect:{type:Boolean,default:!1},score:{type:String,default:""},showPartNames:{type:Boolean,default:!1},opotions:{type:Object,default:()=>{}},EngravingRules:{type:Object,default:()=>{}},showSection:{type:Boolean,default:!0}},emits:["rerender","startRender","renderError","loaddingEnd"],setup(B,{emit:D,expose:R}){const F=async oe=>{var fe;event$1.off("section-click",noteClick),D("startRender");const le=await request$1$1.get(oe);if(Q.value){let he=document.createElement("div");he.innerHTML=le,(fe=Q.value)==null||fe.appendChild(he.firstElementChild);let ge=document.querySelector("#osmdSvgPage1");const ue=document.getElementById("svgContainer");let me=ge==null?void 0:ge.getAttribute("width"),be=ge==null?void 0:ge.getAttribute("height");if(me=isNaN(Number(me))?0:Number(me),be=isNaN(Number(be))?0:Number(be),me&&be){let ve=be/me,pe=(ue==null?void 0:ue.offsetWidth)||document.body.clientWidth;state$2.zoom=pe/me,ge==null||ge.setAttribute("width",pe),ge==null||ge.setAttribute("height",pe*ve+"")}D("loaddingEnd")}},G=async oe=>{var fe,he,ge,ue,me,be,ve,pe,ye,xe,ce,we,Be,Ae,Te,Ne,Pe;const le=await request$1$1.get(oe);if(state$4.sett.scoreSize=((fe=le==null?void 0:le.osmd)==null?void 0:fe.scoreSize)||"middle",le&&Array.isArray(le.times)){for(let Me=0;Me{event$1.off("section-click",noteClick),D("startRender"),Z.value=useOsmd(Q,{...U.value,drawPartNames:W.value},j.value).value,Z.value&&(useEngravingRules(Z.value,j.value),state.isFirstPlay=!1,event$1.on("section-click",noteClick))},J=async oe=>{await F(oe.svg),G(oe.json)};onMounted(async()=>{var le,fe,he,ge,ue,me;if(rendered.value)return;if(state$4.sett.type==="staff"&&!((le=state$2==null?void 0:state$2.activeDetail)!=null&&le.musicSvg)||state$4.sett.type==="jianpu"&&state$4.sett.keySignature&&!((fe=state$2==null?void 0:state$2.activeDetail)!=null&&fe.musicFirstSvg)||state$4.sett.type==="jianpu"&&!state$4.sett.keySignature&&!((he=state$2==null?void 0:state$2.activeDetail)!=null&&he.musicJianSvg)){q();return}let oe=null;try{state$4.sett.type==="staff"&&((ge=state$2.activeDetail)==null?void 0:ge.musicSvg)?oe=JSON.parse(state$2.activeDetail.musicSvg):state$4.sett.keySignature&&((ue=state$2.activeDetail)==null?void 0:ue.musicFirstSvg)?oe=JSON.parse(state$2.activeDetail.musicFirstSvg):(me=state$2.activeDetail)!=null&&me.musicJianSvg&&(oe=JSON.parse(state$2.activeDetail.musicJianSvg))}catch(be){console.error(be),state$2.renderType="native"}oe&&!B.isSoundEffect?J(oe):q()}),onUnmounted(()=>{event$1.off("section-click",noteClick)}),watch([Y,Z],async()=>{if(Z&&Z.value&&Y.value)try{D("startRender"),await useOsmdLoader(Z.value,Y.value),D("rerender",Z.value),event$1.emit("loaded"),ne()}catch(oe){console.error(oe),D("renderError")}},{immediate:!0});const K=async({score:oe}={})=>{const le=oe||Y.value;Toast("\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E..."),setTimeout(async()=>{if(Z&&Z.value&&le){await Z.value.clear(),q();try{state$2.section=[],state$2.sectionStatus=!1,await useOsmdLoader(Z.value,le),D("rerender",Z.value),event$1.emit("loaded"),ne()}catch(fe){console.error(fe),D("renderError")}}},100)},te=async()=>{var oe;await((oe=Z.value)==null?void 0:oe.render())},ne=()=>{var fe,he;const oe=Array.from(Q.value.querySelectorAll(".staffline")),le=4;for(let ge=0,ue=oe.length;ge .vf-voices")),ce=Array.from(me.querySelectorAll(".vf-measure > .vf-beams")),we=Array.from(me.querySelectorAll(".vf-ties")),Be=Array.from(me.querySelectorAll(".vf-line")),Ae=Array.from(me.querySelectorAll(".vf-measure > .vf-stave text"));Array.from(me.querySelectorAll(".vf-measure > .vf-stave rect[fill=none]"));const Te=Array.from(me.querySelectorAll(".vf-measure .vf-staveSection")),Ne=["To Coda","D.S. al Coda","Coda"];Ae.filter(ke=>Ne.includes(ke.textContent||"")).forEach(ke=>{ce.forEach(Ge=>{var Ye;const We=re(ke,Ge),Ve=ke==null?void 0:ke.previousSibling;if(We.isCollision){const et=Number(ke.getAttribute("y"))-(We.b1-We.t2)-le+"";ke.setAttribute("y",et),Ve&&Ve.getAttribute("stroke-width")==="0.3"&&Ve.getAttribute("stroke")==="none"&&(((Ye=Ve.getAttribute("d"))==null?void 0:Ye.length)||0)>3e3&&(Ve.style.transform=`translateY(${-(We.b1-We.t2+le)}px)`)}}),xe.forEach(Ge=>{var Ye;const We=re(ke,Ge),Ve=ke==null?void 0:ke.previousSibling;if(We.isCollision){const et=Number(ke.getAttribute("y"))-(We.b1-We.t2)-le+"";ke.setAttribute("y",et),Ve&&Ve.getAttribute("stroke-width")==="0.3"&&Ve.getAttribute("stroke")==="none"&&(((Ye=Ve.getAttribute("d"))==null?void 0:Ye.length)||0)>3e3&&(Ve.style.transform=`translateY(${-(We.b1-We.t2+le)}px)`)}})}),Te.forEach(ke=>{let Ge=0;[...ye,...we,...xe].forEach(We=>{const Ve=re(ke,We);Ve.isCollision&&(Ge=Math.min(Ge,Ve.t2-Ve.b1-le))}),ke.style.transform=`translateY(${Ge}px)`});let Pe=Array.from(me.querySelectorAll(".vf-text > text")).filter(ke=>ke.getBBox().y text")).filter(ke=>ke.getBBox().y{const Ge=ke.getBBox();Ge.y1&&Se.forEach(ke=>{ke.setAttribute("y",Me+"")}),Pe.forEach(ke=>{[...ye,...pe,...Be].forEach(Ge=>{let We=re(ke,Ge);if(We.isCollision&&We.b1{Pe.forEach(Ge=>{if(ke.parentNode!==Ge.parentNode&&!["marcato","legato"].includes(ke.textContent))if(["marcato","legato"].includes(Ge.textContent)){if(re(ke,Ge,30,30).isCollision){const Ve=ke.getBBox();Ge.setAttribute("x",Ve.x+Ve.width+5+""),Ge.setAttribute("y",Ve.y+Ve.height-5+"")}}else{const We=re(ke,Ge);if(We.isCollision){const Ve=Number(ke.getAttribute("y")),Ye=We.b2-We.t2<24?24:We.b2-We.t2;Ge.setAttribute("y",Ve-Ye-.5+"")}}})});const Le=Array.from(me.querySelectorAll(".vf-text > text")).filter(ke=>ke.getBBox().y>ve),ze=Array.from(me.querySelectorAll(".vf-line")).filter(ke=>ke.getBBox().y>ve);for(let ke=0;ke{[...pe].forEach(Ge=>{let We=re(ke,Ge);We.isCollision&&ke.setAttribute("y",We.b2+Math.abs(We.t1-Number(ke.getAttribute("y")))+"")})}),ze.forEach(ke=>{var We;const Ge=[];if((We=ke.nextElementSibling)!=null&&We.classList.contains("vf-line")&&Le.forEach(Ve=>{let Ye=re(ke,Ve,20,20);Ye.isCollision&&Ge.push({text:Ve,result:Ye})}),Ge.length===1){const Ve=Ge[0].result,Ye=Ge[0].text;Ve.x2+Ve.w2Ve.x1+Ve.w1?Math.abs(Ve.y2-Ve.y1)>10&&Ye.setAttribute("y",Ve.y1+Ve.h2/2+""):Math.abs(Ve.x2-Ve.x1)10&&Ye.setAttribute("y",Ve.y1+Ve.h2/2+"")):(Ye.setAttribute("x",Ve.x1+Ve.w1+5+""),Math.abs(Ve.y2-Ve.y1)>10&&Ye.setAttribute("y",Ve.y1+Ve.h2/2+""))}else if(Ge.length===2){const Ve=Ge[0].result,Ye=Ge[0].text,et=Ge[1].result,ot=Ge[1].text;Ye.setAttribute("x",Ve.x1-Ve.w2-5+""),Math.abs(Ve.y2-Ve.y1)>10&&Ye.setAttribute("y",Ve.y1+Ve.h2/2+""),ot.setAttribute("x",et.x1+et.w1+5+""),Math.abs(et.y2-et.y1)>10&&ot.setAttribute("y",et.y1+et.h2/2+"")}}),Le.forEach(ke=>{Le.forEach(Ge=>{if(ke.parentNode!==Ge.parentNode&&!["marcato","legato","cresc.","Cantabile"].includes(ke.textContent))if(["marcato","legato","cresc.","Cantabile"].includes(Ge.textContent)){if(re(ke,Ge,30,30).isCollision){const Ve=ke.getBBox();Ge.setAttribute("x",Ve.x+Ve.width+5+""),Ge.setAttribute("y",Ve.y+Ve.height-5+"")}}else{const We=re(ke,Ge);We.isCollision&&Ge.setAttribute("y",We.y1+We.h1+We.h2+"")}})})}setTimeout(()=>ie())},ie=()=>{if(!Q.value)return;const oe=Q.value.querySelector("svg");if(!oe)return;const le=oe.getBBox();let fe=Array.from(Q.value.querySelectorAll(".vf-stavetempo")).reduce((be,ve)=>{var pe;return be.find(ye=>ye.outerHTML===ve.outerHTML)?(pe=ve==null?void 0:ve.parentNode)==null||pe.removeChild(ve):be.push(ve),be},[]);const he=Array.from(Q.value.querySelectorAll(".staffline")),ge=Array.from(Q.value.querySelectorAll(".staffline > .vf-measure")),ue=Array.from(Q.value.querySelectorAll(".staffline > .vf-text")),me=Array.from(Q.value.querySelectorAll(".staffline > .vf-curve"));fe.forEach(be=>{let ve=0;[...ge,...ue,...me].forEach(xe=>{const ce=re(be,xe);ce.isCollision&&(ce.b1ce.l2||ce.l10&&([...he,...fe].forEach(xe=>{if(be!=xe){const ce=re(be,xe,Math.abs(ye),Math.abs(ve));ce.isCollision&&(ve=ce.t2-ce.b1)}}),be.style.transform=`translate(-${ye/.7}px,${ve}px)`)}),le.y<0&&oe.setAttribute("height",Number(oe.getAttribute("height"))-le.y+10+"")},re=(oe,le,fe=0,he=0)=>{const ge=oe.getBBox(),ue=le.getBBox();let me=ge.y-he,be=ge.x-fe,ve=ge.x+ge.width+fe,pe=ge.y+ge.height+he,ye=ue.y,xe=ue.x,ce=ue.x+ue.width,we=ue.y+ue.height;return pece||me>we||vecreateVNode("div",{id:"svgContainer",class:styles$h.container,style:{position:"relative"}},[createVNode("div",{ref:Q},null),B.showSection&&createVNode(Section,{style:{position:"absolute",width:"100%",height:"100%",zIndex:1,top:0,left:0}},null)])}});export{ButtonIcon as $,PageFormat as A,Button as B,Canvg as C,Dialog as D,Empty as E,startRun as F,Grid as G,inBrowser$1 as H,isDef$1 as I,Icon as J,useXml as K,svgtopng as L,MusicSheet as M,NoticeBar as N,OpenSheetMusicDisplay as O,Popup as P,changeMode as Q,getDuration as R,Section as S,Toast as T,useClientType as U,useWiredHeadsetCheck as V,setPlayState as W,styles$9 as X,evaluatingRef as Y,startButtonShow as Z,iconEvaluatingStart as _,GridItem as a,Switch as a$,setCurrentTime as a0,ended as a1,permissionPopup as a2,refreshIndex as a3,iconColse as a4,typeById as a5,FingeringComponent as a6,formatId as a7,getTypes as a8,formatFixedKey as a9,Loading as aA,unknownProp as aB,useWindowSize as aC,useExpose as aD,pick as aE,Swipe as aF,callInterceptor as aG,extend$1 as aH,mountComponent as aI,usePopupState as aJ,Field as aK,Tabs as aL,Tab as aM,getTvIconUrl as aN,getEnvHostname as aO,score as aP,Popover as aQ,Player as aR,changeAllMode as aS,resetPlayStatus as aT,getFixTime as aU,setCaptureMode as aV,clearIntervalTimeline as aW,getNoteByMeasuresSlursStart as aX,listenerMessage as aY,removeListenerMessage as aZ,getLeveByScore as a_,useFingeringSrc as aa,getImageSize as ab,CellGroup as ac,Cell as ad,useDetail as ae,event as af,useUser as ag,useSuspendPlay as ah,Buttons as ai,modelType as aj,SoundEffect as ak,HelperPopup as al,MusicList as am,useFee as an,changeSpeed as ao,setAudioInit as ap,restPromptMain as aq,useFingering as ar,stopTick as as,cancelRaf as at,raf$2 as au,isObject as av,useTouch as aw,SwipeItem as ax,preventDefault as ay,clamp as az,useSpecialShapedScreen as b,noteClick as b0,Icons as b1,sectionChange as b2,Speed as b3,EventEmitter as b4,setPrefix as b5,List$1 as b6,useReload as b7,relationships as b8,getVoicePartInfo as b9,MultipleAudio as ba,idIsInClassIds as bb,appoggianceFormate as bc,useParent as bd,useChildren as be,unitToPx as bf,BORDER_UNSET_TOP_BOTTOM as bg,useScrollParent as bh,useClickAway as bi,useEventListener as bj,useRect as bk,getZIndexStyle as bl,fieldProps as bm,lodash as bn,Sticky as bo,Vex as bp,state as c,getParentNote as d,request$1$1 as e,getCustomInfo as f,getAllNodes as g,formatXML as h,getBoundingBoxByverticalNote as i,getLeveByScoreMeasure as j,classnames as k,Empty$1 as l,createNamespace as m,getSizeStyle as n,onlyVisible as o,postMessage as p,addUnit as q,request as r,state$2 as s,truthProp as t,useOriginSearch as u,event$1 as v,withInstall as w,styles$h as x,BackIcon as y,index as z};