@ovnonvo/abc-editor 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1164 +1,1148 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode('@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-blue-600:oklch(54.6% .245 262.881);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-950:oklch(12.9% .042 264.695);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1)}}@layer utilities{.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.h-full{height:100%}.h-screen{height:100vh}.w-full{width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.bg-blue-600{background-color:var(--color-blue-600)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-950{background-color:var(--color-slate-950)}.p-3{padding:calc(var(--spacing)*3)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-all{word-break:break-all}.text-slate-200{color:var(--color-slate-200)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-50{opacity:.5}.opacity-75{opacity:.75}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.select-none{-webkit-user-select:none;user-select:none}.\\[foo\\:bar\\]{foo:bar}@media(hover:hover){.hover\\:bg-slate-700:hover{background-color:var(--color-slate-700)}}}*{box-sizing:border-box}body{margin:0;padding:0}:root{--abc-ink:#1a1a1a;--abc-key:#06c;--abc-value:#996300;--abc-lyrics-key:#c06;--abc-lyrics-value:#b30059;--abc-note:#000;--abc-octave-high:#00994d;--abc-octave-low:#60c;--abc-rest:#666;--abc-rest-muted:#999;--abc-accidental:#b35900;--abc-duration-long:#cc5200;--abc-duration-short:#09c;--abc-duration-fraction:#c90;--abc-broken:#00b359;--abc-bar:#0080cc;--abc-bar-double:#06c;--abc-chord:#c09;--abc-slur-0:#cc004d;--abc-slur-1:#cc8000;--abc-slur-2:#0080cc;--abc-slur-3:#00b359;--abc-slur-4:#70c;--abc-tuplet:#00b359;--abc-tie:#c06;--abc-tie-dotted:#cc0080;--abc-ornament:#56c;--abc-chord-symbol:#00997a;--abc-annotation:#c80;--abc-decoration:#86c;--abc-grace:#66b300;--abc-volta:#c60;--abc-inline-bracket:#666;--abc-inline-key:#06c;--abc-inline-value:#960;--abc-comment:#999}[data-theme=dark]{--abc-ink:#e8f1ff;--abc-key:#7ad7ff;--abc-value:#ffd48a;--abc-lyrics-key:#ff7ba1;--abc-lyrics-value:#ffc8d8;--abc-note:#f8fbff;--abc-octave-high:#73f8c4;--abc-octave-low:#c7b3ff;--abc-rest:#8ca3b8;--abc-rest-muted:#596779;--abc-accidental:#f2c079;--abc-duration-long:#ffa25f;--abc-duration-short:#6edff6;--abc-duration-fraction:#ffe38f;--abc-broken:#7be495;--abc-bar:#79cfff;--abc-bar-double:#4aafff;--abc-chord:#ff8ccf;--abc-slur-0:#ff92b2;--abc-slur-1:#ffd77a;--abc-slur-2:#7ed4ff;--abc-slur-3:#92f3c6;--abc-slur-4:#c6a9ff;--abc-tuplet:#82f0a2;--abc-tie:#f07fb3;--abc-tie-dotted:#ff9ecf;--abc-ornament:#9fb0ff;--abc-chord-symbol:#63f5d3;--abc-annotation:#ffd88a;--abc-decoration:#d1a6ff;--abc-grace:#a4f28f;--abc-volta:#f9a15a;--abc-inline-bracket:#8ca7c0;--abc-inline-key:#7ad7ff;--abc-inline-value:#ffdcb2;--abc-comment:#7b8797}.abc-preview svg text{fill:#000!important}.abc-preview[data-theme=dark] svg text{fill:#fff!important}textarea::placeholder{color:#999;opacity:1}[data-theme=dark] textarea::placeholder{color:#64748b}.abc-meta-key{color:var(--abc-key);font-weight:600}.abc-meta-value{color:var(--abc-value)}.abc-lyrics-key{color:var(--abc-lyrics-key);font-weight:600}.abc-lyrics-value{color:var(--abc-lyrics-value)}.abc-note{color:var(--abc-note)}.abc-octave-high{color:var(--abc-octave-high);font-weight:600}.abc-octave-low{color:var(--abc-octave-low);font-weight:600}.abc-rest{color:var(--abc-rest)}.abc-rest-invisible{color:var(--abc-rest-muted);opacity:.5}.abc-accidental{color:var(--abc-accidental)}.abc-duration{font-weight:600}.abc-duration-long{color:var(--abc-duration-long)}.abc-duration-short{color:var(--abc-duration-short)}.abc-duration-fraction{color:var(--abc-duration-fraction)}.abc-broken-rhythm{color:var(--abc-broken);font-weight:700}.abc-bar{color:var(--abc-bar);font-weight:600}.abc-bar-double{color:var(--abc-bar-double);font-weight:900}.abc-chord{color:var(--abc-chord)}.abc-slur{font-weight:700}.abc-slur-level-0{color:var(--abc-slur-0)}.abc-slur-level-1{color:var(--abc-slur-1)}.abc-slur-level-2{color:var(--abc-slur-2)}.abc-slur-level-3{color:var(--abc-slur-3)}.abc-slur-level-4{color:var(--abc-slur-4)}.abc-tuplet{color:var(--abc-tuplet);font-weight:700}.abc-tie{color:var(--abc-tie);font-weight:600}.abc-tie-dotted{color:var(--abc-tie-dotted)}.abc-ornament{color:var(--abc-ornament);font-weight:700}.abc-chord-symbol{color:var(--abc-chord-symbol);font-weight:700}.abc-annotation{color:var(--abc-annotation);font-style:italic;font-weight:600}.abc-decoration{color:var(--abc-decoration);font-weight:700}.abc-grace-note{color:var(--abc-grace);font-weight:600}.abc-volta-bracket{color:var(--abc-volta);font-weight:700}.abc-inline-field-bracket{color:var(--abc-inline-bracket)}.abc-inline-field-key{color:var(--abc-inline-key);font-weight:600}.abc-inline-field-value{color:var(--abc-inline-value)}.abc-comment{color:var(--abc-comment);font-style:italic}.abc-text{color:var(--abc-ink)}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}')),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { jsx as h, jsxs as x } from "react/jsx-runtime";
3
- import { useState as R, useCallback as I, useEffect as P, useRef as w, useMemo as V } from "react";
4
- const G = (e) => e.split(`
5
- `).map((t, r) => r + 1).join(`
6
- `), S = /^([ABCDFGHIKLMmNOPQRrSsTUVWwXZ]:)(.*)$/, E = /[A-Ga-g]/, z = /[\^_=]/, Q = /[',]/, q = /\|[:|\]]?|:?\|/, X = /[\\[\]]/, Y = /[()]/, J = /^\(\d+$/, O = /^(\/+|\d+(\/\d+)?|\/?\d+(\/\d+)?)$/, D = /[zZx]/, M = /^\.?-$/, Z = /[.~HLMOPSTuv]/, ee = /^"[^"]*"$/, W = /^"[\^_<>@][^"]*"$/, te = /^![^!]+!$/, ne = /^\{[^}]+\}$/, re = /^\[\d+$/, se = /^\[([ABCDFGHIKLMmNOPQRrSsTUVWwXZ]):([^\]]*)\]$/, le = /^[<>]+$/, oe = /^%.*$/, p = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"), ae = (e, n) => {
7
- const t = e[n];
8
- if (t !== "|" && t !== ":")
9
- return null;
10
- let r = t, s = n + 1;
11
- for (; s < e.length && (e[s] === "|" || e[s] === ":" || e[s] === "]"); )
12
- r += e[s], s++;
13
- return q.test(r) ? {
14
- html: `<span class="${r === "||" ? "abc-bar-double" : "abc-bar"}">${p(r)}</span>`,
15
- nextIndex: s
16
- } : null;
17
- }, ie = (e, n) => {
18
- const t = e[n];
19
- return z.test(t) ? {
20
- html: `<span class="abc-accidental">${p(t)}</span>`,
21
- nextIndex: n + 1
22
- } : null;
23
- }, ce = (e, n, t) => {
24
- const r = e[n];
25
- if (!Y.test(r))
26
- return null;
27
- if (r === "(") {
28
- if (n + 1 < e.length && /\d/.test(e[n + 1])) {
29
- let s = r, o = n + 1;
30
- for (; o < e.length && /\d/.test(e[o]); )
31
- s += e[o], o++;
32
- if (J.test(s))
33
- return {
34
- html: `<span class="abc-tuplet">${p(s)}</span>`,
35
- nextIndex: o,
36
- slurLevelDelta: 0
37
- };
1
+ import { jsx as a, jsxs as p, Fragment as M } from "react/jsx-runtime";
2
+ import { useState as _, useCallback as y, useEffect as k, useRef as N, useMemo as O } from "react";
3
+ import D, { tokenize as W, parse as F, analyze as K, format_default as H } from "chamber-abc";
4
+ let ne, ge, ie, Ce, le, me, Q, Te, fe, ce, z, he, ve, re, oe, pe, de, se, G, ue, ae, be, ye, X, V, J, $, Z;
5
+ let __tla = (async () => {
6
+ (function() {
7
+ "use strict";
8
+ try {
9
+ if (typeof document < "u") {
10
+ var a2 = document.createElement("style");
11
+ a2.appendChild(document.createTextNode('@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-blue-600:oklch(54.6% .245 262.881);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-950:oklch(12.9% .042 264.695);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1)}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.block{display:block}.flex{display:flex}.inline{display:inline}.table{display:table}.h-full{height:100%}.h-screen{height:100vh}.w-full{width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.bg-blue-600{background-color:var(--color-blue-600)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-950{background-color:var(--color-slate-950)}.p-3{padding:calc(var(--spacing)*3)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-all{word-break:break-all}.text-slate-200{color:var(--color-slate-200)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.hover\\:bg-slate-700:hover{background-color:var(--color-slate-700)}}}*{box-sizing:border-box}body{margin:0;padding:0}:root{--abc-ink:#1a1a1a;--abc-key:#06c;--abc-value:#996300;--abc-lyrics-key:#c06;--abc-lyrics-value:#b30059;--abc-note:#000;--abc-octave-high:#00994d;--abc-octave-low:#60c;--abc-rest:#666;--abc-rest-muted:#999;--abc-accidental:#b35900;--abc-duration-long:#cc5200;--abc-duration-short:#09c;--abc-duration-fraction:#c90;--abc-broken:#00b359;--abc-bar:#0080cc;--abc-bar-double:#06c;--abc-chord:#c09;--abc-slur-0:#cc004d;--abc-slur-1:#cc8000;--abc-slur-2:#0080cc;--abc-slur-3:#00b359;--abc-slur-4:#70c;--abc-tuplet:#00b359;--abc-tie:#c06;--abc-tie-dotted:#cc0080;--abc-ornament:#56c;--abc-chord-symbol:#00997a;--abc-annotation:#c80;--abc-decoration:#86c;--abc-grace:#66b300;--abc-volta:#c60;--abc-inline-bracket:#666;--abc-inline-key:#06c;--abc-inline-value:#960;--abc-comment:#999}[data-theme=dark]{--abc-ink:#e8f1ff;--abc-key:#7ad7ff;--abc-value:#ffd48a;--abc-lyrics-key:#ff7ba1;--abc-lyrics-value:#ffc8d8;--abc-note:#f8fbff;--abc-octave-high:#73f8c4;--abc-octave-low:#c7b3ff;--abc-rest:#8ca3b8;--abc-rest-muted:#596779;--abc-accidental:#f2c079;--abc-duration-long:#ffa25f;--abc-duration-short:#6edff6;--abc-duration-fraction:#ffe38f;--abc-broken:#7be495;--abc-bar:#79cfff;--abc-bar-double:#4aafff;--abc-chord:#ff8ccf;--abc-slur-0:#ff92b2;--abc-slur-1:#ffd77a;--abc-slur-2:#7ed4ff;--abc-slur-3:#92f3c6;--abc-slur-4:#c6a9ff;--abc-tuplet:#82f0a2;--abc-tie:#f07fb3;--abc-tie-dotted:#ff9ecf;--abc-ornament:#9fb0ff;--abc-chord-symbol:#63f5d3;--abc-annotation:#ffd88a;--abc-decoration:#d1a6ff;--abc-grace:#a4f28f;--abc-volta:#f9a15a;--abc-inline-bracket:#8ca7c0;--abc-inline-key:#7ad7ff;--abc-inline-value:#ffdcb2;--abc-comment:#7b8797}.abc-preview svg text{fill:#000!important}.abc-preview[data-theme=dark] svg text{fill:#fff!important}textarea::placeholder{color:#999;opacity:1}[data-theme=dark] textarea::placeholder{color:#64748b}.abc-meta-key{color:var(--abc-key);font-weight:600}.abc-meta-value{color:var(--abc-value)}.abc-lyrics-key{color:var(--abc-lyrics-key);font-weight:600}.abc-lyrics-value{color:var(--abc-lyrics-value)}.abc-note{color:var(--abc-note)}.abc-octave-high{color:var(--abc-octave-high);font-weight:600}.abc-octave-low{color:var(--abc-octave-low);font-weight:600}.abc-rest{color:var(--abc-rest)}.abc-rest-invisible{color:var(--abc-rest-muted);opacity:.5}.abc-accidental{color:var(--abc-accidental)}.abc-duration{font-weight:600}.abc-duration-long{color:var(--abc-duration-long)}.abc-duration-short{color:var(--abc-duration-short)}.abc-duration-fraction{color:var(--abc-duration-fraction)}.abc-broken-rhythm{color:var(--abc-broken);font-weight:700}.abc-bar{color:var(--abc-bar);font-weight:600}.abc-bar-double{color:var(--abc-bar-double);font-weight:900}.abc-chord{color:var(--abc-chord)}.abc-slur{font-weight:700}.abc-slur-level-0{color:var(--abc-slur-0)}.abc-slur-level-1{color:var(--abc-slur-1)}.abc-slur-level-2{color:var(--abc-slur-2)}.abc-slur-level-3{color:var(--abc-slur-3)}.abc-slur-level-4{color:var(--abc-slur-4)}.abc-tuplet{color:var(--abc-tuplet);font-weight:700}.abc-tie{color:var(--abc-tie);font-weight:600}.abc-tie-dotted{color:var(--abc-tie-dotted)}.abc-ornament{color:var(--abc-ornament);font-weight:700}.abc-chord-symbol{color:var(--abc-chord-symbol);font-weight:700}.abc-annotation{color:var(--abc-annotation);font-style:italic;font-weight:600}.abc-decoration{color:var(--abc-decoration);font-weight:700}.abc-grace-note{color:var(--abc-grace);font-weight:600}.abc-volta-bracket{color:var(--abc-volta);font-weight:700}.abc-inline-field-bracket{color:var(--abc-inline-bracket)}.abc-inline-field-key{color:var(--abc-inline-key);font-weight:600}.abc-inline-field-value{color:var(--abc-inline-value)}.abc-comment{color:var(--abc-comment);font-style:italic}.abc-text{color:var(--abc-ink)}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}')), document.head.appendChild(a2);
12
+ }
13
+ } catch (t) {
14
+ console.error("vite-plugin-css-injected-by-js", t);
38
15
  }
39
- return {
40
- html: `<span class="abc-slur abc-slur-level-${t % 5}">${p(r)}</span>`,
41
- nextIndex: n + 1,
42
- slurLevelDelta: 1
43
- };
44
- } else if (r === ")")
45
- return {
46
- html: `<span class="abc-slur abc-slur-level-${Math.max(0, t - 1) % 5}">${p(r)}</span>`,
47
- nextIndex: n + 1,
48
- slurLevelDelta: -1
49
- };
50
- return null;
51
- }, ue = (e, n) => {
52
- const t = e[n];
53
- if (!E.test(t))
54
- return null;
55
- let r = `<span class="abc-note">${p(t)}</span>`, s = n + 1, o = "";
56
- for (; s < e.length && Q.test(e[s]); )
57
- o += e[s], s++;
58
- if (o) {
59
- const u = o[0] === "'" ? "abc-octave-high" : "abc-octave-low";
60
- r += `<span class="${u}">${p(o)}</span>`;
61
- }
62
- let l = "";
63
- const c = s;
64
- if (s < e.length && (e[s] === "/" || /\d/.test(e[s]))) {
65
- for (e[s] === "/" && (l += e[s], s++); s < e.length && /\d/.test(e[s]); )
66
- l += e[s], s++;
67
- if (s < e.length && e[s] === "/")
68
- for (l += e[s], s++; s < e.length && /\d/.test(e[s]); )
69
- l += e[s], s++;
70
- if (l && O.test(l)) {
71
- let u = "abc-duration";
72
- l.startsWith("/") ? u += " abc-duration-short" : l.includes("/") ? u += " abc-duration-fraction" : u += " abc-duration-long", r += `<span class="${u}">${p(l)}</span>`;
73
- } else
74
- s = c;
75
- }
76
- return {
77
- html: r,
78
- nextIndex: s
79
- };
80
- }, de = (e, n) => {
81
- const t = e[n];
82
- return X.test(t) ? {
83
- html: `<span class="abc-chord">${p(t)}</span>`,
84
- nextIndex: n + 1
85
- } : null;
86
- }, pe = (e, n) => {
87
- const t = e[n];
88
- if (!D.test(t))
89
- return null;
90
- let s = `<span class="${t === "x" ? "abc-rest-invisible" : "abc-rest"}">${p(t)}</span>`, o = n + 1, l = "";
91
- const c = o;
92
- if (o < e.length && (e[o] === "/" || /\d/.test(e[o]))) {
93
- for (e[o] === "/" && (l += e[o], o++); o < e.length && /\d/.test(e[o]); )
94
- l += e[o], o++;
95
- if (o < e.length && e[o] === "/")
96
- for (l += e[o], o++; o < e.length && /\d/.test(e[o]); )
97
- l += e[o], o++;
98
- if (l && O.test(l)) {
99
- let u = "abc-duration";
100
- l.startsWith("/") ? u += " abc-duration-short" : l.includes("/") ? u += " abc-duration-fraction" : u += " abc-duration-long", s += `<span class="${u}">${p(l)}</span>`;
101
- } else
102
- o = c;
103
- }
104
- return {
105
- html: s,
106
- nextIndex: o
107
- };
108
- }, he = (e, n) => {
109
- const t = e[n];
110
- return t === "." && n + 1 < e.length && e[n + 1] === "-" && M.test(".-") ? {
111
- html: `<span class="abc-tie abc-tie-dotted">${p(".-")}</span>`,
112
- nextIndex: n + 2
113
- } : t === "-" && M.test(t) ? {
114
- html: `<span class="abc-tie">${p(t)}</span>`,
115
- nextIndex: n + 1
116
- } : null;
117
- }, fe = (e, n) => {
118
- const t = e[n];
119
- return !Z.test(t) || t === "." && n + 1 < e.length && e[n + 1] === "-" ? null : {
120
- html: `<span class="abc-ornament">${p(t)}</span>`,
121
- nextIndex: n + 1
16
+ })();
17
+ $ = (r) => r.split(`
18
+ `).map((i, e) => e + 1).join(`
19
+ `);
20
+ await D();
21
+ let U, B, j, Y, L, S;
22
+ U = {
23
+ FieldLabel: "abc-meta-key",
24
+ Colon: "abc-meta-key",
25
+ Note: "abc-note",
26
+ Rest: "abc-rest",
27
+ OctaveUp: "abc-octave-high",
28
+ OctaveDown: "abc-octave-low",
29
+ NoteLength: "abc-duration",
30
+ Sharp: "abc-accidental",
31
+ Natural: "abc-accidental",
32
+ Flat: "abc-accidental",
33
+ Bar: "abc-bar",
34
+ DoubleBar: "abc-bar-double",
35
+ RepeatStart: "abc-bar",
36
+ RepeatEnd: "abc-bar",
37
+ ThinThickBar: "abc-bar-double",
38
+ ThickThinBar: "abc-bar-double",
39
+ LeftBracket: "abc-chord",
40
+ RightBracket: "abc-chord",
41
+ LeftParen: "abc-slur",
42
+ RightParen: "abc-slur",
43
+ LeftBrace: "abc-grace-note",
44
+ RightBrace: "abc-grace-note",
45
+ Tie: "abc-tie",
46
+ BrokenRhythm: "abc-broken-rhythm",
47
+ Tuplet: "abc-tuplet",
48
+ Decoration: "abc-decoration",
49
+ Text: "abc-meta-value",
50
+ Number: "abc-duration",
51
+ Slash: "abc-duration",
52
+ Whitespace: "",
53
+ Newline: "",
54
+ Comment: "abc-comment",
55
+ LineContinuation: "abc-text",
56
+ Eof: "",
57
+ Error: "abc-error"
122
58
  };
123
- }, ge = (e, n) => {
124
- if (e[n] !== '"')
125
- return null;
126
- let r = n + 1;
127
- for (; r < e.length && e[r] !== '"'; )
128
- r++;
129
- if (r >= e.length)
130
- return null;
131
- const s = e.substring(n, r + 1);
132
- return W.test(s) ? {
133
- html: `<span class="abc-annotation">${p(s)}</span>`,
134
- nextIndex: r + 1
135
- } : null;
136
- }, me = (e, n) => {
137
- if (e[n] !== '"')
138
- return null;
139
- let r = n + 1;
140
- for (; r < e.length && e[r] !== '"'; )
141
- r++;
142
- if (r >= e.length)
143
- return null;
144
- const s = e.substring(n, r + 1);
145
- return W.test(s) || !ee.test(s) ? null : {
146
- html: `<span class="abc-chord-symbol">${p(s)}</span>`,
147
- nextIndex: r + 1
59
+ B = (r) => r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
60
+ V = (r) => {
61
+ const n = W(r);
62
+ if (!n || !Array.isArray(n)) return B(r);
63
+ let i = "", e = 0;
64
+ for (const l of n) {
65
+ const d = l.range.start, m = l.range.end;
66
+ d > e && (i += B(r.slice(e, d)));
67
+ const g = r.slice(d, m), C = U[l.kind];
68
+ C ? i += `<span class="${C}">${B(g)}</span>` : i += B(g), e = m;
69
+ }
70
+ return e < r.length && (i += B(r.slice(e))), i;
148
71
  };
149
- }, be = (e, n) => {
150
- if (e[n] !== "!")
151
- return null;
152
- let r = n + 1;
153
- for (; r < e.length && e[r] !== "!"; )
154
- r++;
155
- if (r >= e.length)
156
- return null;
157
- const s = e.substring(n, r + 1);
158
- return te.test(s) ? {
159
- html: `<span class="abc-decoration">${p(s)}</span>`,
160
- nextIndex: r + 1
161
- } : null;
162
- }, ve = (e, n) => {
163
- if (e[n] !== "{")
164
- return null;
165
- let r = n + 1;
166
- for (; r < e.length && e[r] !== "}"; )
167
- r++;
168
- if (r >= e.length)
169
- return null;
170
- const s = e.substring(n, r + 1);
171
- return ne.test(s) ? {
172
- html: `<span class="abc-grace-note">${p(s)}</span>`,
173
- nextIndex: r + 1
174
- } : null;
175
- }, xe = (e, n) => {
176
- if (e[n] !== "[")
177
- return null;
178
- let r = n + 1;
179
- for (; r < e.length && e[r] !== "]"; )
180
- r++;
181
- if (r >= e.length)
182
- return null;
183
- const o = e.substring(n, r + 1).match(se);
184
- if (!o)
185
- return null;
186
- const [, l, c] = o;
187
- return {
188
- html: `<span class="abc-inline-field-bracket">[</span><span class="abc-inline-field-key">${p(l)}:</span><span class="abc-inline-field-value">${p(c)}</span><span class="abc-inline-field-bracket">]</span>`,
189
- nextIndex: r + 1
72
+ z = /^([ABCDFGHIKLMmNOPQRrSsTUVWwXZ]:)(.*)$/;
73
+ re = /[A-Ga-g]/;
74
+ ne = /[\^_=]/;
75
+ oe = /[',]/;
76
+ ie = /\|[:|\]]?|:?\|/;
77
+ le = /[\\[\]]/;
78
+ se = /[()]/;
79
+ ae = /^\(\d+$/;
80
+ ce = /^(\/+|\d+(\/\d+)?|\/?\d+(\/\d+)?)$/;
81
+ de = /[zZx]/;
82
+ ue = /^\.?-$/;
83
+ pe = /[.~HLMOPSTuv]/;
84
+ me = /^"[^"]*"$/;
85
+ ge = /^"[\^_<>@][^"]*"$/;
86
+ fe = /^![^!]+!$/;
87
+ he = /^\{[^}]+\}$/;
88
+ be = /^\[\d+$/;
89
+ ve = /^\[([ABCDFGHIKLMmNOPQRrSsTUVWwXZ]):([^\]]*)\]$/;
90
+ Ce = /^[<>]+$/;
91
+ Te = /^%.*$/;
92
+ G = {
93
+ "X:": [
94
+ {
95
+ value: "1",
96
+ description: "Reference number 1"
97
+ },
98
+ {
99
+ value: "2",
100
+ description: "Reference number 2"
101
+ }
102
+ ],
103
+ "T:": [
104
+ {
105
+ value: "\u30BF\u30A4\u30C8\u30EB",
106
+ description: "Japanese title template"
107
+ },
108
+ {
109
+ value: "Untitled",
110
+ description: "Default title"
111
+ }
112
+ ],
113
+ "M:": [
114
+ {
115
+ value: "4/4",
116
+ description: "Common time"
117
+ },
118
+ {
119
+ value: "3/4",
120
+ description: "Waltz time"
121
+ },
122
+ {
123
+ value: "2/4",
124
+ description: "March time"
125
+ },
126
+ {
127
+ value: "6/8",
128
+ description: "Compound duple"
129
+ },
130
+ {
131
+ value: "9/8",
132
+ description: "Compound triple"
133
+ },
134
+ {
135
+ value: "12/8",
136
+ description: "Compound quadruple"
137
+ },
138
+ {
139
+ value: "5/4",
140
+ description: "Quintuple meter"
141
+ },
142
+ {
143
+ value: "7/8",
144
+ description: "Septuple meter"
145
+ },
146
+ {
147
+ value: "C",
148
+ description: "Common time (4/4)"
149
+ },
150
+ {
151
+ value: "C|",
152
+ description: "Cut time (2/2)"
153
+ }
154
+ ],
155
+ "L:": [
156
+ {
157
+ value: "1/4",
158
+ description: "Quarter note"
159
+ },
160
+ {
161
+ value: "1/8",
162
+ description: "Eighth note"
163
+ },
164
+ {
165
+ value: "1/16",
166
+ description: "Sixteenth note"
167
+ }
168
+ ],
169
+ "Q:": [
170
+ {
171
+ value: "1/4=120",
172
+ description: "Quarter note = 120 BPM"
173
+ },
174
+ {
175
+ value: "1/4=100",
176
+ description: "Quarter note = 100 BPM"
177
+ },
178
+ {
179
+ value: "1/4=80",
180
+ description: "Quarter note = 80 BPM"
181
+ },
182
+ {
183
+ value: "1/8=180",
184
+ description: "Eighth note = 180 BPM"
185
+ }
186
+ ],
187
+ "K:": [
188
+ {
189
+ value: "C"
190
+ },
191
+ {
192
+ value: "G"
193
+ },
194
+ {
195
+ value: "D"
196
+ },
197
+ {
198
+ value: "A"
199
+ },
200
+ {
201
+ value: "E"
202
+ },
203
+ {
204
+ value: "B"
205
+ },
206
+ {
207
+ value: "F#"
208
+ },
209
+ {
210
+ value: "C#"
211
+ },
212
+ {
213
+ value: "F"
214
+ },
215
+ {
216
+ value: "Bb"
217
+ },
218
+ {
219
+ value: "Eb"
220
+ },
221
+ {
222
+ value: "Ab"
223
+ },
224
+ {
225
+ value: "Db"
226
+ },
227
+ {
228
+ value: "Gb"
229
+ },
230
+ {
231
+ value: "Cb"
232
+ },
233
+ {
234
+ value: "Am"
235
+ },
236
+ {
237
+ value: "Em"
238
+ },
239
+ {
240
+ value: "Bm"
241
+ },
242
+ {
243
+ value: "F#m"
244
+ },
245
+ {
246
+ value: "C#m"
247
+ },
248
+ {
249
+ value: "G#m"
250
+ },
251
+ {
252
+ value: "D#m"
253
+ },
254
+ {
255
+ value: "Dm"
256
+ },
257
+ {
258
+ value: "Gm"
259
+ },
260
+ {
261
+ value: "Cm"
262
+ },
263
+ {
264
+ value: "Fm"
265
+ },
266
+ {
267
+ value: "Bbm"
268
+ },
269
+ {
270
+ value: "Ebm"
271
+ },
272
+ {
273
+ value: "Abm"
274
+ }
275
+ ],
276
+ "C:": [
277
+ {
278
+ value: "Traditional",
279
+ description: "Traditional composer"
280
+ },
281
+ {
282
+ value: "Unknown",
283
+ description: "Unknown composer"
284
+ }
285
+ ],
286
+ "R:": [
287
+ {
288
+ value: "reel",
289
+ description: "Reel rhythm"
290
+ },
291
+ {
292
+ value: "jig",
293
+ description: "Jig rhythm"
294
+ },
295
+ {
296
+ value: "hornpipe",
297
+ description: "Hornpipe rhythm"
298
+ },
299
+ {
300
+ value: "waltz",
301
+ description: "Waltz rhythm"
302
+ },
303
+ {
304
+ value: "march",
305
+ description: "March rhythm"
306
+ }
307
+ ],
308
+ "A:": [
309
+ {
310
+ value: "Ireland",
311
+ description: "Area: Ireland"
312
+ },
313
+ {
314
+ value: "Scotland",
315
+ description: "Area: Scotland"
316
+ },
317
+ {
318
+ value: "England",
319
+ description: "Area: England"
320
+ },
321
+ {
322
+ value: "USA",
323
+ description: "Area: USA"
324
+ },
325
+ {
326
+ value: "Japan",
327
+ description: "Area: Japan"
328
+ }
329
+ ],
330
+ "B:": [
331
+ {
332
+ value: "The Session",
333
+ description: "Book: The Session"
334
+ },
335
+ {
336
+ value: "O'Neill's Music of Ireland",
337
+ description: "Book: O'Neill's Music of Ireland"
338
+ }
339
+ ],
340
+ "D:": [
341
+ {
342
+ value: "Album Name (Year)",
343
+ description: "Discography template"
344
+ }
345
+ ],
346
+ "F:": [
347
+ {
348
+ value: "https://thesession.org/",
349
+ description: "File URL template"
350
+ }
351
+ ],
352
+ "G:": [
353
+ {
354
+ value: "Group name",
355
+ description: "Group template"
356
+ }
357
+ ],
358
+ "H:": [
359
+ {
360
+ value: "History note",
361
+ description: "History template"
362
+ }
363
+ ],
364
+ "I:": [
365
+ {
366
+ value: "abc-charset utf-8",
367
+ description: "Character set: UTF-8"
368
+ }
369
+ ],
370
+ "m:": [
371
+ {
372
+ value: "~g2 = {a}g{f}g",
373
+ description: "Macro definition template"
374
+ }
375
+ ],
376
+ "N:": [
377
+ {
378
+ value: "Note text",
379
+ description: "Notes template"
380
+ }
381
+ ],
382
+ "O:": [
383
+ {
384
+ value: "Traditional",
385
+ description: "Origin: Traditional"
386
+ },
387
+ {
388
+ value: "Ireland",
389
+ description: "Origin: Ireland"
390
+ },
391
+ {
392
+ value: "Scotland",
393
+ description: "Origin: Scotland"
394
+ }
395
+ ],
396
+ "P:": [
397
+ {
398
+ value: "AABB",
399
+ description: "Parts: AABB"
400
+ },
401
+ {
402
+ value: "ABCD",
403
+ description: "Parts: ABCD"
404
+ },
405
+ {
406
+ value: "A",
407
+ description: "Part: A"
408
+ },
409
+ {
410
+ value: "B",
411
+ description: "Part: B"
412
+ }
413
+ ],
414
+ "r:": [
415
+ {
416
+ value: "Remark text",
417
+ description: "Remark template"
418
+ }
419
+ ],
420
+ "S:": [
421
+ {
422
+ value: "Session tune",
423
+ description: "Source: Session"
424
+ },
425
+ {
426
+ value: "Traditional",
427
+ description: "Source: Traditional"
428
+ }
429
+ ],
430
+ "s:": [
431
+ {
432
+ value: "Symbol line",
433
+ description: "Symbol line template"
434
+ }
435
+ ],
436
+ "U:": [
437
+ {
438
+ value: "u = !trill!",
439
+ description: "User defined: trill"
440
+ }
441
+ ],
442
+ "V:": [
443
+ {
444
+ value: "1",
445
+ description: "Voice 1"
446
+ },
447
+ {
448
+ value: "2",
449
+ description: "Voice 2"
450
+ },
451
+ {
452
+ value: "T",
453
+ description: "Tenor voice"
454
+ },
455
+ {
456
+ value: "B",
457
+ description: "Bass voice"
458
+ }
459
+ ],
460
+ "W:": [
461
+ {
462
+ value: "Lyrics line",
463
+ description: "Words (multi-line)"
464
+ }
465
+ ],
466
+ "w:": [
467
+ {
468
+ value: "Lyrics for this line",
469
+ description: "Words (aligned)"
470
+ }
471
+ ],
472
+ "Z:": [
473
+ {
474
+ value: "Your Name",
475
+ description: "Transcriber name"
476
+ },
477
+ {
478
+ value: "ABC transcription",
479
+ description: "Transcription note"
480
+ }
481
+ ]
190
482
  };
191
- }, ye = (e, n) => {
192
- if (e[n] !== "[" || n + 1 >= e.length || !/\d/.test(e[n + 1]))
193
- return null;
194
- let r = n + 1;
195
- for (; r < e.length && /\d/.test(e[r]); )
196
- r++;
197
- const s = e.substring(n, r);
198
- return re.test(s) ? {
199
- html: `<span class="abc-volta-bracket">${p(s)}</span>`,
200
- nextIndex: r
201
- } : null;
202
- }, Be = (e, n) => {
203
- const t = e[n];
204
- if (t !== ">" && t !== "<")
205
- return null;
206
- let r = n + 1;
207
- for (; r < e.length && e[r] === t; )
208
- r++;
209
- const s = e.substring(n, r);
210
- return le.test(s) ? {
211
- html: `<span class="abc-broken-rhythm">${p(s)}</span>`,
212
- nextIndex: r
213
- } : null;
214
- }, Te = (e) => {
215
- let n = "", t = 0, r = 0;
216
- for (; t < e.length; ) {
217
- const s = ae(e, t);
218
- if (s) {
219
- n += s.html, t = s.nextIndex;
220
- continue;
221
- }
222
- const o = be(e, t);
223
- if (o) {
224
- n += o.html, t = o.nextIndex;
225
- continue;
226
- }
227
- const l = ve(e, t);
228
- if (l) {
229
- n += l.html, t = l.nextIndex;
230
- continue;
231
- }
232
- const c = ie(e, t);
233
- if (c) {
234
- n += c.html, t = c.nextIndex;
235
- continue;
236
- }
237
- const u = fe(e, t);
238
- if (u) {
239
- n += u.html, t = u.nextIndex;
240
- continue;
241
- }
242
- const f = ge(e, t);
243
- if (f) {
244
- n += f.html, t = f.nextIndex;
245
- continue;
246
- }
247
- const i = me(e, t);
248
- if (i) {
249
- n += i.html, t = i.nextIndex;
250
- continue;
251
- }
252
- const a = ce(e, t, r);
253
- if (a) {
254
- n += a.html, t = a.nextIndex, a.slurLevelDelta && (r += a.slurLevelDelta);
255
- continue;
256
- }
257
- const d = pe(e, t);
258
- if (d) {
259
- n += d.html, t = d.nextIndex;
260
- continue;
261
- }
262
- const m = ue(e, t);
263
- if (m) {
264
- n += m.html, t = m.nextIndex;
265
- continue;
266
- }
267
- const y = Be(e, t);
268
- if (y) {
269
- n += y.html, t = y.nextIndex;
270
- continue;
271
- }
272
- const b = xe(e, t);
273
- if (b) {
274
- n += b.html, t = b.nextIndex;
275
- continue;
276
- }
277
- const v = ye(e, t);
278
- if (v) {
279
- n += v.html, t = v.nextIndex;
280
- continue;
281
- }
282
- const B = de(e, t);
283
- if (B) {
284
- n += B.html, t = B.nextIndex;
285
- continue;
286
- }
287
- const T = he(e, t);
288
- if (T) {
289
- n += T.html, t = T.nextIndex;
290
- continue;
291
- }
292
- n += `<span class="abc-text">${p(e[t])}</span>`, t++;
293
- }
294
- return n;
295
- }, $ = (e) => e.split(`
296
- `).map((t) => {
297
- if (oe.test(t))
298
- return `<span class="abc-comment">${p(t)}</span>`;
299
- const r = t.match(S);
300
- if (r) {
301
- const [, s, o] = r;
302
- return s === "w:" || s === "W:" ? `<span class="abc-lyrics-key">${p(s)}</span><span class="abc-lyrics-value">${p(o)}</span>` : `<span class="abc-meta-key">${p(s)}</span><span class="abc-meta-value">${p(o)}</span>`;
303
- }
304
- return Te(t);
305
- }).join(`
306
- `), Ae = {
307
- "X:": [
308
- { value: "1", description: "Reference number 1" },
309
- { value: "2", description: "Reference number 2" }
310
- ],
311
- "T:": [
312
- { value: "タイトル", description: "Japanese title template" },
313
- { value: "Untitled", description: "Default title" }
314
- ],
315
- "M:": [
316
- { value: "4/4", description: "Common time" },
317
- { value: "3/4", description: "Waltz time" },
318
- { value: "2/4", description: "March time" },
319
- { value: "6/8", description: "Compound duple" },
320
- { value: "9/8", description: "Compound triple" },
321
- { value: "12/8", description: "Compound quadruple" },
322
- { value: "5/4", description: "Quintuple meter" },
323
- { value: "7/8", description: "Septuple meter" },
324
- { value: "C", description: "Common time (4/4)" },
325
- { value: "C|", description: "Cut time (2/2)" }
326
- ],
327
- "L:": [
328
- { value: "1/4", description: "Quarter note" },
329
- { value: "1/8", description: "Eighth note" },
330
- { value: "1/16", description: "Sixteenth note" }
331
- ],
332
- "Q:": [
333
- { value: "1/4=120", description: "Quarter note = 120 BPM" },
334
- { value: "1/4=100", description: "Quarter note = 100 BPM" },
335
- { value: "1/4=80", description: "Quarter note = 80 BPM" },
336
- { value: "1/8=180", description: "Eighth note = 180 BPM" }
337
- ],
338
- "K:": [
339
- { value: "C" },
340
- { value: "G" },
341
- { value: "D" },
342
- { value: "A" },
343
- { value: "E" },
344
- { value: "B" },
345
- { value: "F#" },
346
- { value: "C#" },
347
- { value: "F" },
348
- { value: "Bb" },
349
- { value: "Eb" },
350
- { value: "Ab" },
351
- { value: "Db" },
352
- { value: "Gb" },
353
- { value: "Cb" },
354
- { value: "Am" },
355
- { value: "Em" },
356
- { value: "Bm" },
357
- { value: "F#m" },
358
- { value: "C#m" },
359
- { value: "G#m" },
360
- { value: "D#m" },
361
- { value: "Dm" },
362
- { value: "Gm" },
363
- { value: "Cm" },
364
- { value: "Fm" },
365
- { value: "Bbm" },
366
- { value: "Ebm" },
367
- { value: "Abm" }
368
- ],
369
- "C:": [
370
- { value: "Traditional", description: "Traditional composer" },
371
- { value: "Unknown", description: "Unknown composer" }
372
- ],
373
- "R:": [
374
- { value: "reel", description: "Reel rhythm" },
375
- { value: "jig", description: "Jig rhythm" },
376
- { value: "hornpipe", description: "Hornpipe rhythm" },
377
- { value: "waltz", description: "Waltz rhythm" },
378
- { value: "march", description: "March rhythm" }
379
- ],
380
- "A:": [
381
- { value: "Ireland", description: "Area: Ireland" },
382
- { value: "Scotland", description: "Area: Scotland" },
383
- { value: "England", description: "Area: England" },
384
- { value: "USA", description: "Area: USA" },
385
- { value: "Japan", description: "Area: Japan" }
386
- ],
387
- "B:": [
388
- { value: "The Session", description: "Book: The Session" },
389
- { value: "O'Neill's Music of Ireland", description: "Book: O'Neill's Music of Ireland" }
390
- ],
391
- "D:": [
392
- { value: "Album Name (Year)", description: "Discography template" }
393
- ],
394
- "F:": [
395
- { value: "https://thesession.org/", description: "File URL template" }
396
- ],
397
- "G:": [
398
- { value: "Group name", description: "Group template" }
399
- ],
400
- "H:": [
401
- { value: "History note", description: "History template" }
402
- ],
403
- "I:": [
404
- { value: "abc-charset utf-8", description: "Character set: UTF-8" }
405
- ],
406
- "m:": [
407
- { value: "~g2 = {a}g{f}g", description: "Macro definition template" }
408
- ],
409
- "N:": [
410
- { value: "Note text", description: "Notes template" }
411
- ],
412
- "O:": [
413
- { value: "Traditional", description: "Origin: Traditional" },
414
- { value: "Ireland", description: "Origin: Ireland" },
415
- { value: "Scotland", description: "Origin: Scotland" }
416
- ],
417
- "P:": [
418
- { value: "AABB", description: "Parts: AABB" },
419
- { value: "ABCD", description: "Parts: ABCD" },
420
- { value: "A", description: "Part: A" },
421
- { value: "B", description: "Part: B" }
422
- ],
423
- "r:": [
424
- { value: "Remark text", description: "Remark template" }
425
- ],
426
- "S:": [
427
- { value: "Session tune", description: "Source: Session" },
428
- { value: "Traditional", description: "Source: Traditional" }
429
- ],
430
- "s:": [
431
- { value: "Symbol line", description: "Symbol line template" }
432
- ],
433
- "U:": [
434
- { value: "u = !trill!", description: "User defined: trill" }
435
- ],
436
- "V:": [
437
- { value: "1", description: "Voice 1" },
438
- { value: "2", description: "Voice 2" },
439
- { value: "T", description: "Tenor voice" },
440
- { value: "B", description: "Bass voice" }
441
- ],
442
- "W:": [
443
- { value: "Lyrics line", description: "Words (multi-line)" }
444
- ],
445
- "w:": [
446
- { value: "Lyrics for this line", description: "Words (aligned)" }
447
- ],
448
- "Z:": [
449
- { value: "Your Name", description: "Transcriber name" },
450
- { value: "ABC transcription", description: "Transcription note" }
451
- ]
452
- }, Ie = (e) => Ae[e] || [], Ne = [
453
- {
454
- value: "/header",
455
- description: "Insert basic ABC header template",
456
- template: `X:1
483
+ j = (r) => G[r] || [];
484
+ Q = [
485
+ {
486
+ value: "/header",
487
+ description: "Insert basic ABC header template",
488
+ template: `X:1
457
489
  T:Untitled
458
490
  M:4/4
459
491
  L:1/4
460
492
  K:C
461
493
  `
462
- }
463
- ], Ce = (e) => e.startsWith("/") ? Ne.filter(
464
- (n) => n.value.toLowerCase().startsWith(e.toLowerCase())
465
- ) : [], we = ({
466
- value: e,
467
- textareaRef: n,
468
- onChange: t
469
- }) => {
470
- const [r, s] = R({
471
- isOpen: !1,
472
- suggestions: [],
473
- selectedIndex: 0,
474
- position: { top: 0, left: 0 },
475
- fieldKey: null,
476
- inputValue: "",
477
- isCommand: !1
478
- }), o = I(() => {
479
- if (!n.current)
480
- return null;
481
- const i = n.current.selectionStart, a = e.substring(0, i).split(`
482
- `), d = a[a.length - 1];
483
- if (d.startsWith("/"))
484
- return {
494
+ }
495
+ ];
496
+ Y = (r) => r.startsWith("/") ? Q.filter((n) => n.value.toLowerCase().startsWith(r.toLowerCase())) : [];
497
+ J = ({ value: r, textareaRef: n, onChange: i }) => {
498
+ const [e, l] = _({
499
+ isOpen: false,
500
+ suggestions: [],
501
+ selectedIndex: 0,
502
+ position: {
503
+ top: 0,
504
+ left: 0
505
+ },
506
+ fieldKey: null,
507
+ inputValue: "",
508
+ isCommand: false
509
+ }), d = y(() => {
510
+ if (!n.current) return null;
511
+ const o = n.current.selectionStart, t = r.substring(0, o).split(`
512
+ `), c = t[t.length - 1];
513
+ if (c.startsWith("/")) return {
485
514
  fieldKey: null,
486
- inputValue: d,
487
- line: d,
488
- lineStartPos: i - d.length,
489
- isCommand: !0
515
+ inputValue: c,
516
+ line: c,
517
+ lineStartPos: o - c.length,
518
+ isCommand: true
490
519
  };
491
- const m = d.match(S);
492
- if (m) {
493
- const [, y, b] = m;
520
+ const f = c.match(z);
521
+ if (f) {
522
+ const [, b, v] = f;
523
+ return {
524
+ fieldKey: b,
525
+ inputValue: v,
526
+ line: c,
527
+ lineStartPos: o - c.length,
528
+ isCommand: false
529
+ };
530
+ }
531
+ return null;
532
+ }, [
533
+ r,
534
+ n
535
+ ]), m = y(() => {
536
+ if (!n.current) return {
537
+ top: 0,
538
+ left: 0
539
+ };
540
+ const o = n.current, t = o.selectionStart, f = r.substring(0, t).split(`
541
+ `).length - 1, b = parseFloat(getComputedStyle(o).lineHeight) || 24;
494
542
  return {
495
- fieldKey: y,
496
- inputValue: b,
497
- line: d,
498
- lineStartPos: i - d.length,
499
- isCommand: !1
543
+ top: (parseFloat(getComputedStyle(o).paddingTop) || 16) + (f + 1) * b - o.scrollTop,
544
+ left: 60
500
545
  };
501
- }
502
- return null;
503
- }, [e, n]), l = I(() => {
504
- if (!n.current)
505
- return { top: 0, left: 0 };
506
- const i = n.current, a = i.selectionStart, m = e.substring(0, a).split(`
507
- `).length - 1, y = parseFloat(getComputedStyle(i).lineHeight) || 24;
508
- return { top: (parseFloat(getComputedStyle(i).paddingTop) || 16) + (m + 1) * y - i.scrollTop, left: 60 };
509
- }, [e, n]);
510
- P(() => {
511
- const i = o();
512
- if (!i) {
513
- s((d) => ({ ...d, isOpen: !1 }));
514
- return;
515
- }
516
- let a = [];
517
- if (i.isCommand ? a = Ce(i.inputValue) : i.fieldKey && (a = Ie(i.fieldKey).filter(
518
- (m) => m.value.toLowerCase().startsWith(i.inputValue.toLowerCase())
519
- )), a.length > 0) {
520
- const d = l();
521
- s({
522
- isOpen: !0,
523
- suggestions: a,
524
- selectedIndex: 0,
525
- position: d,
526
- fieldKey: i.fieldKey,
527
- inputValue: i.inputValue,
528
- isCommand: i.isCommand
529
- });
530
- } else
531
- s((d) => ({ ...d, isOpen: !1 }));
532
- }, [e, o, l]);
533
- const c = I(
534
- (i) => {
535
- if (!n.current)
546
+ }, [
547
+ r,
548
+ n
549
+ ]);
550
+ k(() => {
551
+ const o = d();
552
+ if (!o) {
553
+ l((c) => ({
554
+ ...c,
555
+ isOpen: false
556
+ }));
536
557
  return;
537
- const a = n.current.selectionStart, d = e.substring(0, a).split(`
538
- `), m = d[d.length - 1];
539
- let y, b;
540
- if (r.isCommand && i.template) {
541
- const v = e.substring(0, a - m.length), B = e.substring(a);
542
- y = v + i.template + B, b = v.length + i.template.length;
543
- } else if (r.fieldKey) {
544
- const v = r.fieldKey + i.value, B = e.substring(0, a - m.length), T = e.substring(a);
545
- y = B + v + T, b = B.length + v.length;
546
- } else
547
- return;
548
- t(y), setTimeout(() => {
549
- n.current && (n.current.selectionStart = b, n.current.selectionEnd = b, n.current.focus());
550
- }, 0), s((v) => ({ ...v, isOpen: !1 }));
551
- },
552
- [n, r.fieldKey, r.isCommand, e, t]
553
- ), u = I(
554
- (i) => {
555
- if (r.isOpen)
556
- switch (i.key) {
557
- case "ArrowDown":
558
- i.preventDefault(), s((a) => ({
559
- ...a,
560
- selectedIndex: Math.min(a.selectedIndex + 1, a.suggestions.length - 1)
561
- }));
562
- break;
563
- case "ArrowUp":
564
- i.preventDefault(), s((a) => ({
565
- ...a,
566
- selectedIndex: Math.max(a.selectedIndex - 1, 0)
567
- }));
568
- break;
569
- case "Enter":
570
- r.suggestions.length > 0 && (i.preventDefault(), c(r.suggestions[r.selectedIndex]));
571
- break;
572
- case "Escape":
573
- i.preventDefault(), s((a) => ({ ...a, isOpen: !1 }));
574
- break;
575
- }
576
- },
577
- [r.isOpen, r.suggestions, r.selectedIndex, c]
578
- ), f = I((i) => {
579
- s((a) => ({ ...a, selectedIndex: i }));
580
- }, []);
581
- return {
582
- isOpen: r.isOpen,
583
- suggestions: r.suggestions,
584
- selectedIndex: r.selectedIndex,
585
- position: r.position,
586
- handleKeyDown: u,
587
- selectSuggestion: c,
588
- handleMouseEnter: f
558
+ }
559
+ let t = [];
560
+ if (o.isCommand ? t = Y(o.inputValue) : o.fieldKey && (t = j(o.fieldKey).filter((f) => f.value.toLowerCase().startsWith(o.inputValue.toLowerCase()))), t.length > 0) {
561
+ const c = m();
562
+ l({
563
+ isOpen: true,
564
+ suggestions: t,
565
+ selectedIndex: 0,
566
+ position: c,
567
+ fieldKey: o.fieldKey,
568
+ inputValue: o.inputValue,
569
+ isCommand: o.isCommand
570
+ });
571
+ } else l((c) => ({
572
+ ...c,
573
+ isOpen: false
574
+ }));
575
+ }, [
576
+ r,
577
+ d,
578
+ m
579
+ ]);
580
+ const g = y((o) => {
581
+ if (!n.current) return;
582
+ const t = n.current.selectionStart, c = r.substring(0, t).split(`
583
+ `), f = c[c.length - 1];
584
+ let b, v;
585
+ if (e.isCommand && o.template) {
586
+ const h = r.substring(0, t - f.length), T = r.substring(t);
587
+ b = h + o.template + T, v = h.length + o.template.length;
588
+ } else if (e.fieldKey) {
589
+ const h = e.fieldKey + o.value, T = r.substring(0, t - f.length), w = r.substring(t);
590
+ b = T + h + w, v = T.length + h.length;
591
+ } else return;
592
+ i(b), setTimeout(() => {
593
+ n.current && (n.current.selectionStart = v, n.current.selectionEnd = v, n.current.focus());
594
+ }, 0), l((h) => ({
595
+ ...h,
596
+ isOpen: false
597
+ }));
598
+ }, [
599
+ n,
600
+ e.fieldKey,
601
+ e.isCommand,
602
+ r,
603
+ i
604
+ ]), C = y((o) => {
605
+ if (e.isOpen) switch (o.key) {
606
+ case "ArrowDown":
607
+ o.preventDefault(), l((t) => ({
608
+ ...t,
609
+ selectedIndex: Math.min(t.selectedIndex + 1, t.suggestions.length - 1)
610
+ }));
611
+ break;
612
+ case "ArrowUp":
613
+ o.preventDefault(), l((t) => ({
614
+ ...t,
615
+ selectedIndex: Math.max(t.selectedIndex - 1, 0)
616
+ }));
617
+ break;
618
+ case "Enter":
619
+ e.suggestions.length > 0 && (o.preventDefault(), g(e.suggestions[e.selectedIndex]));
620
+ break;
621
+ case "Escape":
622
+ o.preventDefault(), l((t) => ({
623
+ ...t,
624
+ isOpen: false
625
+ }));
626
+ break;
627
+ }
628
+ }, [
629
+ e.isOpen,
630
+ e.suggestions,
631
+ e.selectedIndex,
632
+ g
633
+ ]), A = y((o) => {
634
+ l((t) => ({
635
+ ...t,
636
+ selectedIndex: o
637
+ }));
638
+ }, []);
639
+ return {
640
+ isOpen: e.isOpen,
641
+ suggestions: e.suggestions,
642
+ selectedIndex: e.selectedIndex,
643
+ position: e.position,
644
+ handleKeyDown: C,
645
+ selectSuggestion: g,
646
+ handleMouseEnter: A
647
+ };
589
648
  };
590
- }, Se = ({
591
- suggestions: e,
592
- selectedIndex: n,
593
- position: t,
594
- onSelect: r,
595
- onMouseEnter: s
596
- }) => {
597
- const o = w(null);
598
- return P(() => {
599
- o.current?.scrollIntoView({
600
- block: "nearest",
601
- behavior: "smooth"
602
- });
603
- }, [n]), e.length === 0 ? null : /* @__PURE__ */ h(
604
- "div",
605
- {
649
+ X = ({ suggestions: r, selectedIndex: n, position: i, onSelect: e, onMouseEnter: l }) => {
650
+ const d = N(null);
651
+ return k(() => {
652
+ var _a;
653
+ (_a = d.current) == null ? void 0 : _a.scrollIntoView({
654
+ block: "nearest",
655
+ behavior: "smooth"
656
+ });
657
+ }, [
658
+ n
659
+ ]), r.length === 0 ? null : a("div", {
606
660
  className: "absolute z-50 bg-slate-800 rounded-md shadow-xl overflow-hidden",
607
661
  style: {
608
- top: `${t.top}px`,
609
- left: `${t.left}px`,
662
+ top: `${i.top}px`,
663
+ left: `${i.left}px`,
610
664
  minWidth: "200px",
611
665
  maxWidth: "400px",
612
666
  maxHeight: "300px",
613
667
  overflowY: "auto"
614
668
  },
615
- children: e.map((l, c) => /* @__PURE__ */ x(
616
- "div",
617
- {
618
- ref: c === n ? o : null,
619
- className: `px-3 py-2 cursor-pointer ${c === n ? "bg-blue-600 text-white" : "text-slate-200 hover:bg-slate-700"}`,
620
- onClick: () => r(l),
621
- onMouseEnter: () => s(c),
622
- children: [
623
- /* @__PURE__ */ h("div", { className: "font-mono text-sm", children: l.value }),
624
- l.description && /* @__PURE__ */ h("div", { className: "text-xs opacity-75 mt-1", children: l.description })
625
- ]
626
- },
627
- `${l.value}-${c}`
628
- ))
629
- }
630
- );
631
- }, ke = (e) => {
632
- const n = e.trim();
633
- if (n === "C")
634
- return { beatsPerMeasure: 4, beatUnit: 4 };
635
- if (n === "C|")
636
- return { beatsPerMeasure: 2, beatUnit: 2 };
637
- const t = n.match(/^(\d+)\/(\d+)$/);
638
- return t ? {
639
- beatsPerMeasure: parseInt(t[1], 10),
640
- beatUnit: parseInt(t[2], 10)
641
- } : { beatsPerMeasure: 4, beatUnit: 4 };
642
- }, Le = (e) => {
643
- const t = e.trim().match(/^(\d+)\/(\d+)$/);
644
- return t ? parseInt(t[1], 10) / parseInt(t[2], 10) : 1 / 8;
645
- }, Ee = (e) => {
646
- const n = e.split(`
647
- `);
648
- let t = { beatsPerMeasure: 4, beatUnit: 4 }, r = 1 / 8;
649
- for (const s of n) {
650
- const o = s.match(S);
651
- if (o) {
652
- const [, l, c] = o;
653
- l === "M:" ? t = ke(c) : l === "L:" && (r = Le(c));
654
- }
655
- }
656
- return { meter: t, unitNoteLength: r };
657
- }, _ = (e) => {
658
- if (!e)
659
- return 1;
660
- if (/^\/+$/.test(e))
661
- return 1 / Math.pow(2, e.length);
662
- if (e.startsWith("/"))
663
- return 1 / parseInt(e.substring(1), 10);
664
- if (e.includes("/")) {
665
- const [n, t] = e.split("/");
666
- return parseInt(n, 10) / parseInt(t, 10);
667
- }
668
- return parseInt(e, 10);
669
- }, Me = (e, n) => {
670
- if (e[n] !== "(") return null;
671
- let t = n + 1;
672
- if (t >= e.length || !/\d/.test(e[t])) return null;
673
- let r = "";
674
- for (; t < e.length && /\d/.test(e[t]); )
675
- r += e[t], t++;
676
- const s = parseInt(r, 10);
677
- let o;
678
- s === 2 || s === 4 || s === 8 ? o = 3 : o = 2;
679
- let l = s;
680
- if (t < e.length && e[t] === ":") {
681
- t++;
682
- let c = "";
683
- for (; t < e.length && /\d/.test(e[t]); )
684
- c += e[t], t++;
685
- if (c && (o = parseInt(c, 10)), t < e.length && e[t] === ":") {
686
- t++;
687
- let u = "";
688
- for (; t < e.length && /\d/.test(e[t]); )
689
- u += e[t], t++;
690
- u && (l = parseInt(u, 10));
691
- }
692
- }
693
- return {
694
- info: { p: s, q: o, remaining: l },
695
- nextIndex: t
669
+ children: r.map((m, g) => p("div", {
670
+ ref: g === n ? d : null,
671
+ className: `px-3 py-2 cursor-pointer ${g === n ? "bg-blue-600 text-white" : "text-slate-200 hover:bg-slate-700"}`,
672
+ onClick: () => e(m),
673
+ onMouseEnter: () => l(g),
674
+ children: [
675
+ a("div", {
676
+ className: "font-mono text-sm",
677
+ children: m.value
678
+ }),
679
+ m.description && a("div", {
680
+ className: "text-xs opacity-75 mt-1",
681
+ children: m.description
682
+ })
683
+ ]
684
+ }, `${m.value}-${g}`))
685
+ });
696
686
  };
697
- }, $e = (e, n) => {
698
- let t = 0, r = 0, s = null;
699
- for (; r < e.length; ) {
700
- const o = e[r];
701
- if (o === "\\") {
702
- r++;
703
- continue;
704
- }
705
- if (o === "(") {
706
- const l = Me(e, r);
707
- if (l) {
708
- s = l.info, r = l.nextIndex;
709
- continue;
710
- }
711
- r++;
712
- continue;
687
+ L = (r, n) => {
688
+ let i = 0, e = 0, l = 0;
689
+ for (const d of r) {
690
+ if (l >= n) break;
691
+ d === `
692
+ ` ? (i++, e = 0) : e++, l++;
713
693
  }
714
- if (E.test(o) || D.test(o)) {
715
- let l = r + 1;
716
- for (; l < e.length && (e[l] === "'" || e[l] === ","); )
717
- l++;
718
- let c = "";
719
- if (l < e.length && (e[l] === "/" || /\d/.test(e[l]))) {
720
- const d = l;
721
- for (; l < e.length && e[l] === "/"; )
722
- l++;
723
- for (; l < e.length && /\d/.test(e[l]); )
724
- l++;
725
- if (l < e.length && e[l] === "/")
726
- for (l++; l < e.length && /\d/.test(e[l]); )
727
- l++;
728
- c = e.substring(d, l);
729
- }
730
- const u = _(c);
731
- let f = n.unitNoteLength * u;
732
- s && (f = f * s.q / s.p, s.remaining--, s.remaining <= 0 && (s = null));
733
- const i = 1 / n.meter.beatUnit, a = f / i;
734
- t += a, r = l;
735
- } else if (o === "[") {
736
- let l = r + 1;
737
- for (; l < e.length && e[l] !== "]"; ) {
738
- const c = e[l];
739
- if (E.test(c)) {
740
- let u = l + 1;
741
- for (; u < e.length && (e[u] === "'" || e[u] === ","); )
742
- u++;
743
- l = u;
744
- } else
745
- l++;
746
- }
747
- if (l < e.length && e[l] === "]") {
748
- l++;
749
- let c = "";
750
- if (l < e.length && (e[l] === "/" || /\d/.test(e[l]))) {
751
- const d = l;
752
- for (; l < e.length && e[l] === "/"; )
753
- l++;
754
- for (; l < e.length && /\d/.test(e[l]); )
755
- l++;
756
- if (l < e.length && e[l] === "/")
757
- for (l++; l < e.length && /\d/.test(e[l]); )
758
- l++;
759
- c = e.substring(d, l);
760
- }
761
- const u = _(c);
762
- let f = n.unitNoteLength * u;
763
- s && (f = f * s.q / s.p, s.remaining--, s.remaining <= 0 && (s = null));
764
- const i = 1 / n.meter.beatUnit, a = f / i;
765
- t += a;
694
+ return {
695
+ line: i,
696
+ col: e
697
+ };
698
+ };
699
+ Z = (r) => {
700
+ const n = [];
701
+ try {
702
+ const i = F(r);
703
+ if (i && i.diagnostics) for (const e of i.diagnostics) {
704
+ const l = L(r, e.range.start);
705
+ n.push({
706
+ line: l.line,
707
+ column: l.col,
708
+ startCol: e.range.start,
709
+ endCol: e.range.end,
710
+ severity: e.severity.toLowerCase(),
711
+ code: e.code,
712
+ message: e.message
713
+ });
766
714
  }
767
- r = l;
768
- } else
769
- r++;
770
- }
771
- return t;
772
- }, _e = (e) => {
773
- const n = [], t = e.split(`
774
- `), r = Ee(e);
775
- return t.forEach((s, o) => {
776
- if (!(s.trim().startsWith("%") || S.test(s)) && s.includes("|")) {
777
- let l = 0;
778
- const c = s.split("|");
779
- let u = 0;
780
- c.forEach((f, i) => {
781
- if (i === c.length - 1 && f.trim() === "")
782
- return;
783
- const a = f.trim();
784
- if (a.startsWith(":") || a.startsWith("[") || a === "") {
785
- l += f.length + 1;
786
- return;
787
- }
788
- const d = $e(a, r), m = r.meter.beatsPerMeasure;
789
- if (Math.abs(d - m) > 0.01) {
790
- const b = s.indexOf(a, l), v = b + a.length;
715
+ if (i && i.tune) {
716
+ const e = K(i.tune);
717
+ if (e && e.diagnostics) for (const l of e.diagnostics) {
718
+ const d = L(r, l.range.start);
791
719
  n.push({
792
- line: o,
793
- measureIndex: u,
794
- startCol: b,
795
- endCol: v,
796
- expected: m,
797
- actual: d,
798
- message: `Expected ${m} beats, got ${d.toFixed(2)}`
720
+ line: d.line,
721
+ column: d.col,
722
+ startCol: l.range.start,
723
+ endCol: l.range.end,
724
+ severity: l.severity.toLowerCase(),
725
+ code: l.code,
726
+ message: l.message
799
727
  });
800
728
  }
801
- u++, l += f.length + 1;
802
- });
803
- }
804
- }), n;
805
- }, C = {
806
- margin: 0,
807
- padding: "16px",
808
- border: "none",
809
- outline: "none",
810
- fontSize: "14px",
811
- fontFamily: 'SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
812
- fontWeight: 400,
813
- fontStyle: "normal",
814
- fontVariant: "normal",
815
- fontStretch: "normal",
816
- lineHeight: "24px",
817
- letterSpacing: "normal",
818
- wordSpacing: "normal",
819
- textAlign: "left",
820
- textIndent: 0,
821
- textTransform: "none",
822
- whiteSpace: "pre-wrap",
823
- wordBreak: "break-all",
824
- wordWrap: "break-word",
825
- overflowWrap: "break-word",
826
- tabSize: 4,
827
- boxSizing: "border-box",
828
- WebkitFontSmoothing: "antialiased",
829
- MozOsxFontSmoothing: "grayscale"
830
- }, Oe = ({ value: e, onChange: n, theme: t = "light" }) => {
831
- const r = w(null), s = w(null), o = w(null), [l, c] = R(null), u = G(e), f = $(e), i = V(() => _e(e), [e]), a = t === "dark" ? {
832
- editorBg: "#262626",
833
- lineNumBg: "#0f0f0f",
834
- lineNumBorder: "#2d2d2d",
835
- caretColor: "#fff",
836
- errorBg: "#1a1a1a",
837
- errorBorder: "#2d2d2d",
838
- errorHeader: "#ffffff",
839
- errorBadgeBg: "#dc2626",
840
- errorBadgeText: "#ffffff",
841
- errorIcon: "#f59e0b",
842
- errorLocation: "#22d3ee",
843
- errorMessage: "#e5e7eb",
844
- errorHighlight: "rgba(245, 158, 11, 0.2)",
845
- errorHoverBg: "rgba(51, 65, 85, 0.4)",
846
- errorItemBorder: "rgba(255, 255, 255, 0.05)"
847
- } : {
848
- editorBg: "#ffffff",
849
- lineNumBg: "#ffffff",
850
- lineNumBorder: "#e5e7eb",
851
- caretColor: "#000",
852
- errorBg: "#ffffff",
853
- errorBorder: "#e5e7eb",
854
- errorHeader: "#1f2937",
855
- errorBadgeBg: "#dc2626",
856
- errorBadgeText: "#ffffff",
857
- errorIcon: "#dc2626",
858
- errorLocation: "#0891b2",
859
- errorMessage: "#1f2937",
860
- errorHighlight: "#fde047",
861
- errorHoverBg: "rgba(254, 202, 202, 0.4)",
862
- errorItemBorder: "rgba(220, 38, 38, 0.1)"
863
- }, {
864
- isOpen: d,
865
- suggestions: m,
866
- selectedIndex: y,
867
- position: b,
868
- handleKeyDown: v,
869
- selectSuggestion: B,
870
- handleMouseEnter: T
871
- } = we({ value: e, textareaRef: r, onChange: n }), H = () => {
872
- r.current && s.current && o.current && (s.current.scrollTop = r.current.scrollTop, o.current.scrollTop = r.current.scrollTop);
873
- }, U = (g) => {
874
- if (r.current) {
875
- const A = e.split(`
876
- `), N = A.slice(0, g.line).join(`
877
- `).length + (g.line > 0 ? 1 : 0);
878
- r.current.focus(), r.current.setSelectionRange(N, N), r.current.scrollTop = r.current.scrollHeight * (g.line / A.length);
729
+ }
730
+ } catch (i) {
731
+ console.warn("validateAbc error:", i);
879
732
  }
733
+ return n.sort((i, e) => i.startCol - e.startCol), n;
880
734
  };
881
- return /* @__PURE__ */ x("div", { className: "w-full h-full flex flex-col rounded-lg overflow-hidden shadow-lg", "data-theme": t, style: { backgroundColor: a.editorBg }, children: [
882
- /* @__PURE__ */ x("div", { className: "flex-1 flex overflow-hidden", children: [
883
- /* @__PURE__ */ h(
884
- "div",
885
- {
886
- ref: s,
887
- className: "overflow-hidden select-none",
888
- style: {
889
- ...C,
890
- backgroundColor: a.lineNumBg,
891
- minWidth: "3rem",
892
- padding: "16px 8px 16px 8px",
893
- color: "#6b7280",
894
- borderRightColor: a.lineNumBorder,
895
- borderRightStyle: "solid",
896
- borderRightWidth: "1px"
897
- },
898
- children: u.split(`
899
- `).map((g, A) => /* @__PURE__ */ h("div", { style: { textAlign: "center" }, children: g }, A))
900
- }
901
- ),
902
- /* @__PURE__ */ x("div", { className: "flex-1 relative", children: [
903
- /* @__PURE__ */ h(
904
- "div",
905
- {
906
- ref: o,
907
- className: "absolute inset-0 overflow-hidden pointer-events-none",
908
- style: {
909
- ...C,
910
- backgroundColor: a.editorBg,
911
- opacity: l ? 0.3 : 1,
912
- transition: "opacity 0.2s"
913
- },
914
- dangerouslySetInnerHTML: { __html: f }
915
- }
916
- ),
917
- l && (() => {
918
- const g = e.split(`
919
- `), N = (g[l.line] || "").substring(l.startCol, l.endCol), F = $(N);
920
- return /* @__PURE__ */ h(
921
- "div",
922
- {
923
- className: "absolute inset-0 overflow-hidden pointer-events-none",
735
+ S = {
736
+ margin: 0,
737
+ padding: "16px",
738
+ border: "none",
739
+ outline: "none",
740
+ fontSize: "14px",
741
+ fontFamily: 'SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
742
+ fontWeight: 400,
743
+ fontStyle: "normal",
744
+ fontVariant: "normal",
745
+ fontStretch: "normal",
746
+ lineHeight: "24px",
747
+ letterSpacing: "normal",
748
+ wordSpacing: "normal",
749
+ textAlign: "left",
750
+ textIndent: 0,
751
+ textTransform: "none",
752
+ whiteSpace: "pre-wrap",
753
+ wordBreak: "break-all",
754
+ wordWrap: "break-word",
755
+ overflowWrap: "break-word",
756
+ tabSize: 4,
757
+ boxSizing: "border-box",
758
+ WebkitFontSmoothing: "antialiased",
759
+ MozOsxFontSmoothing: "grayscale"
760
+ };
761
+ ye = ({ value: r, onChange: n, theme: i = "light" }) => {
762
+ const e = N(null), l = N(null), d = N(null), m = $(r), g = V(r), C = O(() => Z(r), [
763
+ r
764
+ ]), [A, o] = _(null), t = i === "dark" ? {
765
+ editorBg: "#262626",
766
+ lineNumBg: "#0f0f0f",
767
+ lineNumBorder: "#2d2d2d",
768
+ caretColor: "#fff",
769
+ errorBg: "#1a1a1a",
770
+ errorBorder: "#2d2d2d",
771
+ errorHeader: "#ffffff",
772
+ errorBadgeBg: "#dc2626",
773
+ errorBadgeText: "#ffffff",
774
+ errorIcon: "#f59e0b",
775
+ errorLocation: "#22d3ee",
776
+ errorMessage: "#e5e7eb",
777
+ warningIcon: "#fbbf24",
778
+ infoIcon: "#60a5fa"
779
+ } : {
780
+ editorBg: "#ffffff",
781
+ lineNumBg: "#ffffff",
782
+ lineNumBorder: "#e5e7eb",
783
+ caretColor: "#000",
784
+ errorBg: "#ffffff",
785
+ errorBorder: "#e5e7eb",
786
+ errorHeader: "#1f2937",
787
+ errorBadgeBg: "#dc2626",
788
+ errorBadgeText: "#ffffff",
789
+ errorIcon: "#dc2626",
790
+ errorLocation: "#0891b2",
791
+ errorMessage: "#1f2937",
792
+ warningIcon: "#d97706",
793
+ infoIcon: "#2563eb"
794
+ }, { isOpen: c, suggestions: f, selectedIndex: b, position: v, handleKeyDown: h, selectSuggestion: T, handleMouseEnter: w } = J({
795
+ value: r,
796
+ textareaRef: e,
797
+ onChange: n
798
+ }), R = () => {
799
+ e.current && l.current && d.current && (l.current.scrollTop = e.current.scrollTop, d.current.scrollTop = e.current.scrollTop);
800
+ }, I = (s) => {
801
+ if (e.current) {
802
+ const u = r.split(`
803
+ `), x = u.slice(0, s).join(`
804
+ `).length + (s > 0 ? 1 : 0);
805
+ e.current.focus(), e.current.setSelectionRange(x, x), e.current.scrollTop = e.current.scrollHeight * (s / u.length);
806
+ }
807
+ }, E = y(() => {
808
+ try {
809
+ const s = H(r);
810
+ s !== r && n(s);
811
+ } catch (s) {
812
+ console.warn("Format error:", s);
813
+ }
814
+ }, [
815
+ r,
816
+ n
817
+ ]);
818
+ k(() => {
819
+ const s = (u) => {
820
+ (u.metaKey || u.ctrlKey) && u.key === "s" && (u.preventDefault(), E());
821
+ };
822
+ return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
823
+ }, [
824
+ E
825
+ ]);
826
+ const P = (s) => {
827
+ switch (s) {
828
+ case "error":
829
+ return t.errorIcon;
830
+ case "warning":
831
+ return t.warningIcon;
832
+ case "info":
833
+ return t.infoIcon;
834
+ default:
835
+ return t.errorIcon;
836
+ }
837
+ };
838
+ return p("div", {
839
+ className: "w-full h-full flex flex-col rounded-lg overflow-hidden shadow-lg",
840
+ "data-theme": i,
841
+ style: {
842
+ backgroundColor: t.editorBg
843
+ },
844
+ children: [
845
+ p("div", {
846
+ className: "flex-1 flex overflow-hidden",
847
+ children: [
848
+ a("div", {
849
+ ref: l,
850
+ className: "overflow-hidden select-none",
924
851
  style: {
925
- ...C,
926
- backgroundColor: "transparent"
852
+ ...S,
853
+ backgroundColor: t.lineNumBg,
854
+ minWidth: "3rem",
855
+ padding: "16px 8px 16px 8px",
856
+ color: "#6b7280",
857
+ borderRightColor: t.lineNumBorder,
858
+ borderRightStyle: "solid",
859
+ borderRightWidth: "1px"
927
860
  },
928
- children: g.map((k, L) => {
929
- if (L === l.line) {
930
- const j = k.substring(0, l.startCol), K = k.substring(l.endCol);
931
- return /* @__PURE__ */ x("div", { children: [
932
- /* @__PURE__ */ h("span", { style: { visibility: "hidden" }, children: j }),
933
- /* @__PURE__ */ h(
934
- "span",
935
- {
936
- style: {
937
- backgroundColor: a.errorHighlight,
938
- borderRadius: "2px",
939
- padding: "1px 2px"
940
- },
941
- dangerouslySetInnerHTML: { __html: F }
942
- }
943
- ),
944
- /* @__PURE__ */ h("span", { style: { visibility: "hidden" }, children: K })
945
- ] }, L);
946
- }
947
- return /* @__PURE__ */ h("div", { style: { visibility: "hidden" }, children: k || "​" }, L);
948
- })
949
- }
950
- );
951
- })(),
952
- /* @__PURE__ */ h(
953
- "textarea",
954
- {
955
- ref: r,
956
- className: "absolute inset-0 w-full h-full resize-none",
957
- style: {
958
- ...C,
959
- backgroundColor: "transparent",
960
- color: "transparent",
961
- caretColor: a.caretColor,
962
- // ブラウザ固有のスタイルをリセット
963
- WebkitAppearance: "none",
964
- appearance: "none"
965
- },
966
- value: e,
967
- onChange: (g) => n(g.target.value),
968
- onScroll: H,
969
- onKeyDown: v,
970
- spellCheck: !1,
971
- autoCapitalize: "off",
972
- autoComplete: "off",
973
- autoCorrect: "off",
974
- placeholder: "Type /header to insert template..."
975
- }
976
- ),
977
- d && /* @__PURE__ */ h(
978
- Se,
979
- {
980
- suggestions: m,
981
- selectedIndex: y,
982
- position: b,
983
- onSelect: B,
984
- onMouseEnter: T
985
- }
986
- )
987
- ] })
988
- ] }),
989
- i.length > 0 && /* @__PURE__ */ x("div", { className: "flex", children: [
990
- /* @__PURE__ */ h(
991
- "div",
992
- {
993
- style: {
994
- backgroundColor: a.lineNumBg,
995
- minWidth: "3rem",
996
- borderRightColor: a.lineNumBorder,
997
- borderRightStyle: "solid",
998
- borderRightWidth: "1px"
999
- }
1000
- }
1001
- ),
1002
- /* @__PURE__ */ x(
1003
- "div",
1004
- {
1005
- className: "flex-1 px-4 py-3 text-xs font-mono overflow-auto border-t",
1006
- style: {
1007
- backgroundColor: a.errorBg,
1008
- borderColor: a.errorBorder,
1009
- maxHeight: "12rem",
1010
- scrollbarWidth: "thin",
1011
- scrollbarColor: `${a.errorIcon} transparent`
1012
- },
1013
- children: [
1014
- /* @__PURE__ */ x("div", { className: "flex items-center gap-2 mb-3", children: [
1015
- /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
1016
- /* @__PURE__ */ x(
1017
- "svg",
1018
- {
1019
- width: "14",
1020
- height: "14",
1021
- viewBox: "0 0 24 24",
1022
- fill: "none",
1023
- stroke: "currentColor",
1024
- strokeWidth: "2",
1025
- strokeLinecap: "round",
1026
- strokeLinejoin: "round",
1027
- style: { color: a.errorIcon },
1028
- children: [
1029
- /* @__PURE__ */ h("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
1030
- /* @__PURE__ */ h("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
1031
- /* @__PURE__ */ h("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
1032
- ]
861
+ children: m.split(`
862
+ `).map((s, u) => a("div", {
863
+ style: {
864
+ textAlign: "center"
865
+ },
866
+ children: s
867
+ }, u))
868
+ }),
869
+ p("div", {
870
+ className: "flex-1 relative",
871
+ children: [
872
+ a("div", {
873
+ ref: d,
874
+ className: "absolute inset-0 overflow-hidden pointer-events-none",
875
+ style: {
876
+ ...S,
877
+ backgroundColor: t.editorBg
878
+ },
879
+ dangerouslySetInnerHTML: {
880
+ __html: g
1033
881
  }
1034
- ),
1035
- /* @__PURE__ */ h("span", { className: "text-[11px] font-semibold uppercase tracking-wide", style: { color: a.errorHeader }, children: "Validation Issues" })
1036
- ] }),
1037
- /* @__PURE__ */ h(
1038
- "div",
1039
- {
1040
- className: "px-2 py-0.5 rounded-full text-[10px] font-bold",
882
+ }),
883
+ a("textarea", {
884
+ ref: e,
885
+ className: "absolute inset-0 w-full h-full resize-none",
1041
886
  style: {
1042
- backgroundColor: a.errorBadgeBg,
1043
- color: a.errorBadgeText
887
+ ...S,
888
+ backgroundColor: "transparent",
889
+ color: "transparent",
890
+ caretColor: t.caretColor,
891
+ WebkitAppearance: "none",
892
+ appearance: "none"
1044
893
  },
1045
- children: i.length
1046
- }
1047
- )
1048
- ] }),
1049
- /* @__PURE__ */ h("div", { className: "space-y-1", children: i.map((g, A) => /* @__PURE__ */ x(
1050
- "div",
1051
- {
1052
- className: "flex items-start gap-3 px-3 py-2 rounded-md border cursor-pointer",
1053
- style: {
1054
- backgroundColor: l === g ? a.errorHoverBg : "transparent",
1055
- borderColor: l === g ? a.errorIcon : a.errorItemBorder,
1056
- transition: "all 0.15s ease-in-out",
1057
- transform: l === g ? "translateX(2px)" : "translateX(0)"
1058
- },
1059
- onMouseEnter: () => c(g),
1060
- onMouseLeave: () => c(null),
1061
- onClick: () => U(g),
1062
- children: [
1063
- /* @__PURE__ */ x(
1064
- "svg",
1065
- {
1066
- width: "16",
1067
- height: "16",
1068
- viewBox: "0 0 24 24",
1069
- fill: "none",
1070
- stroke: "currentColor",
1071
- strokeWidth: "2",
1072
- strokeLinecap: "round",
1073
- strokeLinejoin: "round",
1074
- className: "shrink-0 mt-0.5",
1075
- style: { color: a.errorIcon },
894
+ value: r,
895
+ onChange: (s) => n(s.target.value),
896
+ onScroll: R,
897
+ onKeyDown: h,
898
+ spellCheck: false,
899
+ autoCapitalize: "off",
900
+ autoComplete: "off",
901
+ autoCorrect: "off",
902
+ placeholder: "Type /header to insert template..."
903
+ }),
904
+ c && a(X, {
905
+ suggestions: f,
906
+ selectedIndex: b,
907
+ position: v,
908
+ onSelect: T,
909
+ onMouseEnter: w
910
+ })
911
+ ]
912
+ })
913
+ ]
914
+ }),
915
+ C.length > 0 && p("div", {
916
+ className: "flex",
917
+ children: [
918
+ a("div", {
919
+ style: {
920
+ backgroundColor: t.lineNumBg,
921
+ minWidth: "3rem",
922
+ borderRightColor: t.lineNumBorder,
923
+ borderRightStyle: "solid",
924
+ borderRightWidth: "1px"
925
+ }
926
+ }),
927
+ p("div", {
928
+ className: "flex-1 px-4 py-3 text-xs font-mono overflow-auto border-t",
929
+ style: {
930
+ backgroundColor: t.errorBg,
931
+ borderColor: t.errorBorder,
932
+ maxHeight: "12rem",
933
+ scrollbarWidth: "thin",
934
+ scrollbarColor: `${t.errorIcon} transparent`
935
+ },
936
+ children: [
937
+ p("div", {
938
+ className: "flex items-center gap-2 mb-3",
939
+ children: [
940
+ p("div", {
941
+ className: "flex items-center gap-2",
1076
942
  children: [
1077
- /* @__PURE__ */ h("circle", { cx: "12", cy: "12", r: "10" }),
1078
- /* @__PURE__ */ h("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
1079
- /* @__PURE__ */ h("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
943
+ p("svg", {
944
+ width: "14",
945
+ height: "14",
946
+ viewBox: "0 0 24 24",
947
+ fill: "none",
948
+ stroke: "currentColor",
949
+ strokeWidth: "2",
950
+ strokeLinecap: "round",
951
+ strokeLinejoin: "round",
952
+ style: {
953
+ color: t.errorIcon
954
+ },
955
+ children: [
956
+ a("path", {
957
+ d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
958
+ }),
959
+ a("line", {
960
+ x1: "12",
961
+ y1: "9",
962
+ x2: "12",
963
+ y2: "13"
964
+ }),
965
+ a("line", {
966
+ x1: "12",
967
+ y1: "17",
968
+ x2: "12.01",
969
+ y2: "17"
970
+ })
971
+ ]
972
+ }),
973
+ a("span", {
974
+ className: "text-[11px] font-semibold uppercase tracking-wide",
975
+ style: {
976
+ color: t.errorHeader
977
+ },
978
+ children: "Diagnostics"
979
+ })
1080
980
  ]
1081
- }
1082
- ),
1083
- /* @__PURE__ */ x("div", { className: "flex-1 flex flex-col gap-1", children: [
1084
- /* @__PURE__ */ h("div", { className: "flex items-baseline gap-2 flex-wrap", children: /* @__PURE__ */ x(
1085
- "span",
1086
- {
1087
- className: "font-semibold text-[11px] px-1.5 py-0.5 rounded",
981
+ }),
982
+ a("div", {
983
+ className: "px-2 py-0.5 rounded-full text-[10px] font-bold",
984
+ style: {
985
+ backgroundColor: t.errorBadgeBg,
986
+ color: t.errorBadgeText
987
+ },
988
+ children: C.length
989
+ })
990
+ ]
991
+ }),
992
+ a("div", {
993
+ className: "space-y-1",
994
+ children: C.map((s, u) => p("div", {
995
+ className: "flex items-start gap-3 px-3 py-2 rounded-md border cursor-pointer hover:bg-opacity-50",
996
+ style: {
997
+ borderColor: "transparent",
998
+ transition: "all 0.15s ease-in-out"
999
+ },
1000
+ onClick: () => I(s.line),
1001
+ children: [
1002
+ p("svg", {
1003
+ width: "16",
1004
+ height: "16",
1005
+ viewBox: "0 0 24 24",
1006
+ fill: "none",
1007
+ stroke: "currentColor",
1008
+ strokeWidth: "2",
1009
+ strokeLinecap: "round",
1010
+ strokeLinejoin: "round",
1011
+ className: "shrink-0 mt-0.5",
1088
1012
  style: {
1089
- color: a.errorLocation,
1090
- backgroundColor: t === "dark" ? "rgba(34, 211, 238, 0.1)" : "rgba(8, 145, 178, 0.1)"
1013
+ color: P(s.severity)
1091
1014
  },
1092
1015
  children: [
1093
- "Line ",
1094
- g.line + 1,
1095
- ", Measure ",
1096
- g.measureIndex + 1
1016
+ a("circle", {
1017
+ cx: "12",
1018
+ cy: "12",
1019
+ r: "10"
1020
+ }),
1021
+ a("line", {
1022
+ x1: "12",
1023
+ y1: "8",
1024
+ x2: "12",
1025
+ y2: "12"
1026
+ }),
1027
+ a("line", {
1028
+ x1: "12",
1029
+ y1: "16",
1030
+ x2: "12.01",
1031
+ y2: "16"
1032
+ })
1097
1033
  ]
1098
- }
1099
- ) }),
1100
- /* @__PURE__ */ h("span", { className: "text-[11px] leading-relaxed", style: { color: a.errorMessage }, children: g.message })
1101
- ] }),
1102
- /* @__PURE__ */ x(
1103
- "svg",
1104
- {
1105
- width: "14",
1106
- height: "14",
1107
- viewBox: "0 0 24 24",
1108
- fill: "none",
1109
- stroke: "currentColor",
1110
- strokeWidth: "2",
1111
- strokeLinecap: "round",
1112
- strokeLinejoin: "round",
1113
- className: "shrink-0 mt-1 opacity-50",
1114
- style: {
1115
- color: a.errorIcon,
1116
- opacity: l === g ? 1 : 0.3,
1117
- transition: "opacity 0.15s ease-in-out"
1118
- },
1119
- children: [
1120
- /* @__PURE__ */ h("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1121
- /* @__PURE__ */ h("polyline", { points: "12 5 19 12 12 19" })
1122
- ]
1123
- }
1124
- )
1125
- ]
1126
- },
1127
- A
1128
- )) })
1034
+ }),
1035
+ p("div", {
1036
+ className: "flex-1 flex flex-col gap-1",
1037
+ children: [
1038
+ p("div", {
1039
+ className: "flex items-baseline gap-2 flex-wrap",
1040
+ children: [
1041
+ p("span", {
1042
+ className: "font-semibold text-[11px] px-1.5 py-0.5 rounded",
1043
+ style: {
1044
+ color: t.errorLocation,
1045
+ backgroundColor: i === "dark" ? "rgba(34, 211, 238, 0.1)" : "rgba(8, 145, 178, 0.1)"
1046
+ },
1047
+ children: [
1048
+ "Line ",
1049
+ s.line + 1,
1050
+ ":",
1051
+ s.column + 1
1052
+ ]
1053
+ }),
1054
+ a("span", {
1055
+ className: "text-[10px] px-1.5 py-0.5 rounded opacity-70",
1056
+ style: {
1057
+ backgroundColor: i === "dark" ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)"
1058
+ },
1059
+ children: s.code
1060
+ })
1061
+ ]
1062
+ }),
1063
+ a("span", {
1064
+ className: "text-[11px] leading-relaxed",
1065
+ style: {
1066
+ color: t.errorMessage
1067
+ },
1068
+ children: s.message
1069
+ })
1070
+ ]
1071
+ }),
1072
+ a("svg", {
1073
+ width: "14",
1074
+ height: "14",
1075
+ viewBox: "0 0 24 24",
1076
+ fill: "none",
1077
+ stroke: "currentColor",
1078
+ strokeWidth: "2",
1079
+ strokeLinecap: "round",
1080
+ strokeLinejoin: "round",
1081
+ className: "shrink-0 mt-1 cursor-pointer transition-opacity",
1082
+ style: {
1083
+ color: A === u ? "#22c55e" : t.errorMessage,
1084
+ opacity: A === u ? 1 : 0.3
1085
+ },
1086
+ onClick: (x) => {
1087
+ x.stopPropagation(), navigator.clipboard.writeText(s.message), o(u), setTimeout(() => o(null), 2e3);
1088
+ },
1089
+ children: A === u ? a("polyline", {
1090
+ points: "20 6 9 17 4 12"
1091
+ }) : p(M, {
1092
+ children: [
1093
+ a("rect", {
1094
+ x: "9",
1095
+ y: "9",
1096
+ width: "13",
1097
+ height: "13",
1098
+ rx: "2",
1099
+ ry: "2"
1100
+ }),
1101
+ a("path", {
1102
+ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
1103
+ })
1104
+ ]
1105
+ })
1106
+ })
1107
+ ]
1108
+ }, u))
1109
+ })
1110
+ ]
1111
+ })
1129
1112
  ]
1130
- }
1131
- )
1132
- ] })
1133
- ] });
1134
- };
1113
+ })
1114
+ ]
1115
+ });
1116
+ };
1117
+ })();
1135
1118
  export {
1136
- z as ABC_ACCIDENTAL_PATTERN,
1137
- W as ABC_ANNOTATION_PATTERN,
1138
- q as ABC_BAR_PATTERN,
1139
- le as ABC_BROKEN_RHYTHM_PATTERN,
1140
- X as ABC_CHORD_BRACKET_PATTERN,
1141
- ee as ABC_CHORD_SYMBOL_PATTERN,
1142
- Ne as ABC_COMMANDS,
1143
- oe as ABC_COMMENT_PATTERN,
1144
- te as ABC_DECORATION_PATTERN,
1145
- O as ABC_DURATION_PATTERN,
1146
- S as ABC_FIELD_PATTERN,
1147
- ne as ABC_GRACE_NOTE_PATTERN,
1148
- se as ABC_INLINE_FIELD_PATTERN,
1149
- E as ABC_NOTE_PATTERN,
1150
- Q as ABC_OCTAVE_PATTERN,
1151
- Z as ABC_ORNAMENT_PATTERN,
1152
- D as ABC_REST_PATTERN,
1153
- Y as ABC_SLUR_PATTERN,
1154
- Ae as ABC_SUGGESTIONS,
1155
- M as ABC_TIE_PATTERN,
1156
- J as ABC_TUPLET_PATTERN,
1157
- re as ABC_VOLTA_BRACKET_PATTERN,
1158
- Oe as AbcEditor,
1159
- Se as SuggestionList,
1160
- $ as highlightAbc,
1161
- we as useAbcAutoComplete,
1162
- G as useLineNumbers,
1163
- _e as validateAbc
1119
+ ne as ABC_ACCIDENTAL_PATTERN,
1120
+ ge as ABC_ANNOTATION_PATTERN,
1121
+ ie as ABC_BAR_PATTERN,
1122
+ Ce as ABC_BROKEN_RHYTHM_PATTERN,
1123
+ le as ABC_CHORD_BRACKET_PATTERN,
1124
+ me as ABC_CHORD_SYMBOL_PATTERN,
1125
+ Q as ABC_COMMANDS,
1126
+ Te as ABC_COMMENT_PATTERN,
1127
+ fe as ABC_DECORATION_PATTERN,
1128
+ ce as ABC_DURATION_PATTERN,
1129
+ z as ABC_FIELD_PATTERN,
1130
+ he as ABC_GRACE_NOTE_PATTERN,
1131
+ ve as ABC_INLINE_FIELD_PATTERN,
1132
+ re as ABC_NOTE_PATTERN,
1133
+ oe as ABC_OCTAVE_PATTERN,
1134
+ pe as ABC_ORNAMENT_PATTERN,
1135
+ de as ABC_REST_PATTERN,
1136
+ se as ABC_SLUR_PATTERN,
1137
+ G as ABC_SUGGESTIONS,
1138
+ ue as ABC_TIE_PATTERN,
1139
+ ae as ABC_TUPLET_PATTERN,
1140
+ be as ABC_VOLTA_BRACKET_PATTERN,
1141
+ ye as AbcEditor,
1142
+ X as SuggestionList,
1143
+ __tla,
1144
+ V as highlightAbc,
1145
+ J as useAbcAutoComplete,
1146
+ $ as useLineNumbers,
1147
+ Z as validateAbc
1164
1148
  };