@dsebastien/music-notation 0.10.0 → 0.11.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.
- package/README.md +7 -4
- package/dist/blocks/properties.d.ts +16 -5
- package/dist/blocks/renderers.d.ts +11 -2
- package/dist/chord/generate.d.ts +13 -4
- package/dist/cli.js +3 -3
- package/dist/fretboard/exercise.d.ts +80 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +5562 -3845
- package/dist/index.js.map +29 -21
- package/dist/music-notation.css +88 -0
- package/dist/music-notation.publish.min.js +117 -22
- package/dist/music-notation.tab.min.js +95 -7
- package/dist/picking/pattern.d.ts +59 -0
- package/dist/picking/play.d.ts +87 -0
- package/dist/picking/render.d.ts +17 -0
- package/dist/picking/voicing.d.ts +19 -0
- package/dist/playback/picking-bar.d.ts +10 -0
- package/dist/playback/progression-bar.d.ts +8 -0
- package/dist/playback/progression.d.ts +111 -0
- package/dist/playback/strum-bar.d.ts +26 -1
- package/dist/publish/index.js +5929 -4335
- package/dist/publish/index.js.map +28 -20
- package/dist/strum/play.d.ts +18 -0
- package/dist/tab/index.d.ts +5 -0
- package/dist/tab/index.js +15 -4
- package/dist/tab/index.js.map +4 -4
- package/dist/voicings/index.js +96 -7
- package/dist/voicings/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Music Notation
|
|
2
2
|
|
|
3
|
-
Chord diagrams, piano keyboards, fretboards, ChordPro charts, strumming patterns, progressions and the circle of fifths, rendered as SVG and HTML from small text blocks. No framework, no build step for pages that load the browser bundle. Made for [Obsidian](https://obsidian.md) (the [Music Practice](https://github.com/dsebastien/obsidian-music-practice) plugin and Obsidian Publish), usable on any web page.
|
|
3
|
+
Chord diagrams, piano keyboards, fretboards, ChordPro charts, strumming and fingerpicking patterns, progressions and the circle of fifths, rendered as SVG and HTML from small text blocks. No framework, no build step for pages that load the browser bundle. Made for [Obsidian](https://obsidian.md) (the [Music Practice](https://github.com/dsebastien/obsidian-music-practice) plugin and Obsidian Publish), usable on any web page.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -89,7 +89,7 @@ scales-for: G D Em C
|
|
|
89
89
|
```
|
|
90
90
|
````
|
|
91
91
|
|
|
92
|
-
Strumming patterns written the way you find them on the web, a capo, arpeggios, piano voicings, and chord diagrams above a chart:
|
|
92
|
+
Strumming patterns written the way you find them on the web, a capo, arpeggios, scale and arpeggio runs as tab exercises, piano voicings, and chord diagrams above a chart:
|
|
93
93
|
|
|
94
94
|
````markdown
|
|
95
95
|
```strum
|
|
@@ -160,9 +160,11 @@ if (!result.ok) console.warn(result.error)
|
|
|
160
160
|
- `@dsebastien/music-notation/voicings` adds about 1,800 guitar voicings, found by chord symbol (`chord` blocks with only a symbol). It's a separate entry point because the data weighs about 230 KB.
|
|
161
161
|
- **Hear the diagrams**: the `play` option adds a playback bar to each diagram, shown on hover. Guitar chords strum, piano chords strike as a block, scales run from their tonic up and back, and a click plays a note. While it plays, each note lights up on the drawing when you hear it.
|
|
162
162
|
- **Strumming patterns**: `strum` blocks draw a pattern (`D DU UDU`, `D - D U - U D U`) on a beat grid with counts, accents, muted and ghost strums and chord changes; with playback on, they play over their chords, with loop, tempo and a count-in. `playStrum(pattern, { bpm, chord, tuning })` plays one from code.
|
|
163
|
+
- **Practice in time**: `progression` blocks and ChordPro charts get a bar that plays their chords in time, one chord a bar, with a metronome click, a count-in and a loop. Each chord is strummed on the beats, once a bar, as an arpeggio or to a strumming pattern, and the chord playing lights up. `playProgression(chords, { bpm, strum, pattern, click, countIn, loop })` does it from code, with your own player.
|
|
164
|
+
- **Fingerpicking patterns**: `picking` blocks draw a pattern in PIMA letters (p, p' for the alternate bass, i, m, a) or string numbers as a small tab, over a chord or a progression, and play it in time. Travis, alternate bass and 1-2-3-4 come by name. `playPicking(pattern, { chord, chords, bpm })` plays one from code.
|
|
163
165
|
- **Tabs and scores**: `@dsebastien/music-notation/tab` draws `tab` and `score` blocks (alphaTex, or Guitar Pro and MusicXML files) with [alphaTab](https://alphatab.net), and adds a player. It also converts score files, text tabs and chord sheets, and exports Guitar Pro 7 and MIDI.
|
|
164
166
|
- `generateVoicings(symbol, options)` finds every playable voicing of a chord on any tuning, easiest first, with fingers and shape names; `fingerVoicing(frets)` fingers any voicing.
|
|
165
|
-
- The renderers (`renderGuitarDiagram`, `renderKeyboard`, `renderFretboard`, `renderChart`, `renderStrum`, `renderCircle`), the parsers and the theory helpers (`parseChord`, `transposeChord`, `chordNoteSet`, `scaleNoteSet`…) are exported too.
|
|
167
|
+
- The renderers (`renderGuitarDiagram`, `renderKeyboard`, `renderFretboard`, `renderChart`, `renderStrum`, `renderPicking`, `renderCircle`), the parsers and the theory helpers (`parseChord`, `transposeChord`, `chordNoteSet`, `scaleNoteSet`…) are exported too.
|
|
166
168
|
- Styles: `injectStyles(document)`, or ship `@dsebastien/music-notation/music-notation.css`. Colors follow Obsidian's theme variables, with fallbacks for any page.
|
|
167
169
|
|
|
168
170
|
## Check your notes
|
|
@@ -181,7 +183,7 @@ Add this to your site's `publish.js`. It loads the bundle only on pages that hav
|
|
|
181
183
|
|
|
182
184
|
```js
|
|
183
185
|
;(() => {
|
|
184
|
-
const VERSION = '0.
|
|
186
|
+
const VERSION = '0.11.0'
|
|
185
187
|
const CDN = `https://cdn.jsdelivr.net/npm/@dsebastien/music-notation@${VERSION}/dist`
|
|
186
188
|
const selector = (languages) => languages.map((l) => `pre > code.language-${l}`).join(', ')
|
|
187
189
|
const BLOCKS = selector([
|
|
@@ -190,6 +192,7 @@ Add this to your site's `publish.js`. It loads the bundle only on pages that hav
|
|
|
190
192
|
'keyboard',
|
|
191
193
|
'fretboard',
|
|
192
194
|
'strum',
|
|
195
|
+
'picking',
|
|
193
196
|
'progression',
|
|
194
197
|
'circle'
|
|
195
198
|
])
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Blocks from a note's properties: an empty ```chord block in a chord note, or ```fretboard /
|
|
3
|
-
* ```keyboard in a scale note, draws what the note's frontmatter says, so the body repeats nothing.
|
|
4
|
-
* Used by Music Practice in Obsidian and by the Publish bundle with the page's properties.
|
|
5
|
-
*/
|
|
6
1
|
/** Property names, as Music Practice and the Obsidian Starter Kit write them by default. */
|
|
7
2
|
export interface PropertyNames {
|
|
8
3
|
chordSymbol: string;
|
|
@@ -18,10 +13,26 @@ export interface PropertyNames {
|
|
|
18
13
|
shape: string;
|
|
19
14
|
fingeringRight: string;
|
|
20
15
|
tags: string;
|
|
16
|
+
/** Strumming patterns: the pattern ("D DU UDU", or one bar per list item). */
|
|
17
|
+
strumPattern: string;
|
|
18
|
+
/** Strumming patterns: the time signature ("3/4", "6/8"). */
|
|
19
|
+
timeSignature: string;
|
|
20
|
+
/** Strumming patterns: the feel ("straight", "swing", "60%"). */
|
|
21
|
+
strumFeel: string;
|
|
22
|
+
/** The current BPM: a strumming pattern's tempo (20 to 240). */
|
|
23
|
+
bpmCurrent: string;
|
|
24
|
+
/** Picking patterns (#51): a named pattern ("travis") or the pattern ("p i m a", a bar a line). */
|
|
25
|
+
pickingPattern: string;
|
|
21
26
|
}
|
|
22
27
|
export declare const DEFAULT_PROPERTY_NAMES: PropertyNames;
|
|
23
28
|
export type Instrument = 'guitar' | 'piano';
|
|
24
29
|
type Properties = Record<string, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* The kind of a music note, from its type tag as Music Practice reads it: the last segment of
|
|
32
|
+
* `type/music/<subject>/<kind>` (or `type/music/<kind>`), lowercased: `arpeggio`, `chord`,
|
|
33
|
+
* `strum`. Null without such a tag.
|
|
34
|
+
*/
|
|
35
|
+
export declare function kindOf(properties: Properties, names: PropertyNames): string | null;
|
|
25
36
|
/** Piano when a tag has a `piano` segment (`type/music/piano/chord`), else guitar. */
|
|
26
37
|
export declare function instrumentOf(properties: Properties, names: PropertyNames): Instrument;
|
|
27
38
|
/**
|
|
@@ -4,6 +4,7 @@ import { type LayoutDefaults } from '../render/layout.js';
|
|
|
4
4
|
import { type BlockSource } from './block-source.js';
|
|
5
5
|
import type { Instrument, PropertyNames } from './properties.js';
|
|
6
6
|
import { renderStrumBlock } from '../strum/render.js';
|
|
7
|
+
import { renderPickingBlock } from '../picking/render.js';
|
|
7
8
|
export interface RenderOptions extends LayoutDefaults {
|
|
8
9
|
/** Finds guitar voicings for chord blocks that only give a symbol (see `/voicings`). */
|
|
9
10
|
voicings?: VoicingLookup;
|
|
@@ -12,20 +13,27 @@ export interface RenderOptions extends LayoutDefaults {
|
|
|
12
13
|
/**
|
|
13
14
|
* The note's properties (or a function of the block's element returning them, read at each
|
|
14
15
|
* render, so a page can tell embeds from the note itself): an empty
|
|
15
|
-
* `chord`, `fretboard` or `
|
|
16
|
+
* `chord`, `fretboard`, `keyboard`, `strum` or `picking` block draws from them (see `blockFromProperties`).
|
|
16
17
|
*/
|
|
17
18
|
properties?: Record<string, unknown> | ((el: Element) => Record<string, unknown> | null | undefined) | null;
|
|
18
19
|
/** Property names, when they differ from the defaults. */
|
|
19
20
|
propertyNames?: Partial<PropertyNames>;
|
|
20
21
|
/** The note's instrument; from its tags when absent. */
|
|
21
22
|
instrument?: Instrument;
|
|
22
|
-
/** A playback bar on
|
|
23
|
+
/** A playback bar on diagrams, strum and picking patterns, progressions and charts (true for the defaults). */
|
|
23
24
|
play?: boolean | PlayOptions;
|
|
24
25
|
/**
|
|
25
26
|
* The chords used row of `chords` blocks, when a chart has no `{diagrams}`: `'top'`,
|
|
26
27
|
* `'bottom'` or `'off'` (the default). Guitar or piano diagrams follow `instrument`.
|
|
27
28
|
*/
|
|
28
29
|
chartDiagrams?: 'top' | 'bottom' | 'off';
|
|
30
|
+
/**
|
|
31
|
+
* Draws the tab of a fretboard's `exercise:` (#47): its alphaTex, as a `tab` block holds it, in
|
|
32
|
+
* `holder` (for example with `renderTab` from `/tab`); returns what frees it, called when the
|
|
33
|
+
* block is destroyed. Without it, the alphaTex shows under the diagram in a
|
|
34
|
+
* `pre > code.language-tab`, which the tab bundle draws on web pages.
|
|
35
|
+
*/
|
|
36
|
+
tab?: (source: string, holder: HTMLElement) => (() => void) | void;
|
|
29
37
|
}
|
|
30
38
|
export type Renderer = (doc: Document, source: string, options: RenderOptions) => Element;
|
|
31
39
|
/** Renders one diagram from a parsed block (the parts of a row share settings, see renderBlock). */
|
|
@@ -45,6 +53,7 @@ export declare const RENDERERS: {
|
|
|
45
53
|
keyboard: Renderer;
|
|
46
54
|
fretboard: Renderer;
|
|
47
55
|
strum: typeof renderStrumBlock;
|
|
56
|
+
picking: typeof renderPickingBlock;
|
|
48
57
|
progression: (doc: Document, source: string, options: RenderOptions) => Element;
|
|
49
58
|
circle: Renderer;
|
|
50
59
|
};
|
package/dist/chord/generate.d.ts
CHANGED
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { type FrettedVoicing } from './guitar.js';
|
|
8
8
|
import { type NoteSetMember } from '../theory/note-set.js';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type CagedLetter = 'C' | 'A' | 'G' | 'E' | 'D';
|
|
10
|
+
/**
|
|
11
|
+
* Shape names, as guitar teachers use them: one name per CAGED shape, barre or not. A voicing none
|
|
12
|
+
* of the first names fit gets one of the others (#72): a CAGED shape's strings ("E shape (strings
|
|
13
|
+
* 1-4)", F xx3211), drop 2 and drop 3 four-note voicings, the Hendrix chord, open strings ringing
|
|
14
|
+
* up the neck, else the strings it sounds ("Strings 3-6").
|
|
15
|
+
*/
|
|
16
|
+
export type VoicingShape = 'Open' | `${CagedLetter} shape` | 'Power chord' | 'Triad' | 'Shell' | `${CagedLetter} shape (strings ${string})` | `Drop ${2 | 3} (strings ${string})` | 'Hendrix chord' | 'Open bass' | 'Open strings' | `Strings ${string}`;
|
|
11
17
|
export interface GeneratedVoicing extends FrettedVoicing {
|
|
12
18
|
fingers: (string | null)[];
|
|
13
19
|
baseFret: number;
|
|
@@ -93,11 +99,13 @@ export declare function voicingShape(frets: readonly (number | null)[], symbol:
|
|
|
93
99
|
* One voicing per shape: leaves out a voicing that is another one of the list with its highest
|
|
94
100
|
* strings muted (A x0222x and 57765x, copies of x02220 and 577655), then draws the rest up the neck (lowest
|
|
95
101
|
* fretted note; ties keep the list's order, the easiest first). `count` voicings are kept, the
|
|
96
|
-
* easiest ones, before they are put in neck order (#72).
|
|
102
|
+
* easiest ones, before they are put in neck order (#72). In standard tuning (`tuning`, the
|
|
103
|
+
* default) a known jazz grip is kept and the longer voicing left out: C7#9 shows the Hendrix grip
|
|
104
|
+
* x3234x, not x32340.
|
|
97
105
|
*/
|
|
98
106
|
export declare function distinctShapes<T extends {
|
|
99
107
|
frets: readonly (number | null)[];
|
|
100
|
-
}>(voicings: readonly T[], count?: number): T[];
|
|
108
|
+
}>(voicings: readonly T[], count?: number, tuning?: readonly number[]): T[];
|
|
101
109
|
/** Whether standard-tuning frets are one of the known jazz grips, at any fret (#72). */
|
|
102
110
|
export declare function isJazzGrip(frets: readonly (number | null)[]): boolean;
|
|
103
111
|
/**
|
|
@@ -105,3 +113,4 @@ export declare function isJazzGrip(frets: readonly (number | null)[]): boolean;
|
|
|
105
113
|
* fits the options. See VoicingOptions for the filters.
|
|
106
114
|
*/
|
|
107
115
|
export declare function generateVoicings(symbol: string, options?: VoicingOptions): GeneratedVoicing[];
|
|
116
|
+
export {};
|
package/dist/cli.js
CHANGED
|
@@ -50,10 +50,10 @@ import{createRequire}from"node:module";var __create=Object.create;var{getPrototy
|
|
|
50
50
|
)`,enabled:":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])","read-only":"[readonly]:is(textarea, input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i]))","read-write":":not([readonly]):is(textarea, input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i]))",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"};function compile(parsed){let a=parsed[0],b=parsed[1]-1;if(b<0&&a<=0)return falseFunc;if(a===-1)return(index)=>index<=b;if(a===0)return(index)=>index===b;if(a===1)return b<0?trueFunc:(index)=>index>=b;let absA=Math.abs(a),bModulo=(b%absA+absA)%absA;return a>1?(index)=>index>=b&&index%absA===bModulo:(index)=>index<=b&&index%absA===bModulo}var whitespace=new Set([9,10,12,13,32]);function parse2(formula){switch(formula=formula.trim().toLowerCase(),formula){case"even":return[2,0];case"odd":return[2,1]}let index=0,a=0,sign=readSign(),number=readNumber();if(index<formula.length&&formula.charAt(index)==="n")if(index++,a=sign*(number??1),skipWhitespace(),index<formula.length)sign=readSign(),skipWhitespace(),number=readNumber();else sign=number=0;if(number===null||index<formula.length)throw Error(`n-th rule couldn't be parsed ('${formula}')`);return[a,sign*number];function readSign(){switch(formula.charAt(index)){case"-":return index++,-1;case"+":{index++;break}}return 1}function readNumber(){let start=index,value=0;while(index<formula.length&&formula.charCodeAt(index)>=48&&formula.charCodeAt(index)<=57)value=value*10+(formula.charCodeAt(index)-48),index++;return index===start?null:value}function skipWhitespace(){while(index<formula.length&&whitespace.has(formula.charCodeAt(index)))index++}}function nthCheck(formula){return compile(parse2(formula))}function cacheParentResults(next,{adapter,cacheResults},matches){if(cacheResults===!1||typeof WeakMap>"u")return(element)=>next(element)&&matches(element);let resultCache=new WeakMap;function addResultToCache(element){let result=matches(element);return resultCache.set(element,result),result}return function(element){if(!next(element))return!1;if(resultCache.has(element))return resultCache.get(element)??!1;let node=element;do{let parent=getElementParent(node,adapter);if(parent===null)return addResultToCache(element);node=parent}while(!resultCache.has(node));return resultCache.get(node)?addResultToCache(element):!1}}function copyOptions(options){let{context:_,rootFunc:__,...copied}=options;return copied}function extendedFilter(tag,range){if(range[0]!=="*"&&range[0]!==tag[0])return!1;let tagIndex=1;for(let rangeIndex=1;rangeIndex<range.length;rangeIndex++){if(range[rangeIndex]==="*")continue;while(tagIndex<tag.length&&tag[tagIndex]!==range[rangeIndex])if(tag[tagIndex++].length<=1)return!1;if(tagIndex>=tag.length)return!1;tagIndex++}return!0}var nthOfRegex=/^(.+?)\s+of\s+(.+)$/is;function compileNth(reverse,ofType){return function(next,rule,options,context2,compileToken){let{adapter,equals}=options,ofMatch=ofType?null:rule.match(nthOfRegex),nthCheck2=nthCheck(ofMatch?ofMatch[1].trim():rule);if(nthCheck2===falseFunc)return falseFunc;let ofSelector=ofMatch&&compileToken?compileToken(parse(ofMatch[2].trim()),copyOptions(options),context2):void 0;if(ofSelector===falseFunc)return falseFunc;if(nthCheck2===trueFunc&&!ofSelector)return(element)=>getElementParent(element,adapter)!==null&&next(element);let shouldCount=ofSelector?(_element,sibling)=>ofSelector(sibling):ofType?(element,sibling)=>adapter.getName(sibling)===adapter.getName(element):trueFunc;if(reverse)return function(element){if(ofSelector&&!ofSelector(element))return!1;let siblings=adapter.getSiblings(element),pos=0;for(let index=siblings.length-1;index>=0;index--){let sibling=siblings[index];if(equals(element,sibling))break;if(adapter.isTag(sibling)&&shouldCount(element,sibling))pos++}return nthCheck2(pos)&&next(element)};return function(element){if(ofSelector&&!ofSelector(element))return!1;let siblings=adapter.getSiblings(element),pos=0;for(let sibling of siblings){if(equals(element,sibling))break;if(adapter.isTag(sibling)&&shouldCount(element,sibling))pos++}return nthCheck2(pos)&&next(element)}}}var filters={contains(next,text,options){let{getText}=options.adapter;return cacheParentResults(next,options,(element)=>getText(element).includes(text))},icontains(next,text,options){let itext=text.toLowerCase(),{getText}=options.adapter;return cacheParentResults(next,options,(element)=>getText(element).toLowerCase().includes(itext))},"nth-child":compileNth(!1,!1),"nth-last-child":compileNth(!0,!1),"nth-of-type":compileNth(!1,!0),"nth-last-of-type":compileNth(!0,!0),root(next,_rule,{adapter}){return(element)=>getElementParent(element,adapter)===null&&next(element)},scope(next,rule,options,context2){let{equals}=options;if(!context2||context2.length===0)return filters.root(next,rule,options);if(context2.length===1)return(element)=>equals(context2[0],element)&&next(element);return(element)=>context2.includes(element)&&next(element)},lang(next,code,{adapter}){let ranges=code.split(",").map((r)=>r.trim()).filter((r)=>r.length>0).map((r)=>r.replace(/^['"]|['"]$/g,"").toLowerCase().split("-"));return function(element){let node=element;while(node!=null){let value=adapter.getAttributeValue(node,"xml:lang")??adapter.getAttributeValue(node,"lang");if(value!=null){if(!value)return ranges.some((r)=>r[0]==="")&&next(element);let tag=value.toLowerCase().split("-");return ranges.some((r)=>extendedFilter(tag,r))&&next(element)}let parent=adapter.getParent(node);node=parent!=null&&adapter.isTag(parent)?parent:null}return ranges.some((r)=>r[0]==="")&&next(element)}},hover:dynamicStatePseudo("isHovered"),visited:dynamicStatePseudo("isVisited"),active:dynamicStatePseudo("isActive")};function dynamicStatePseudo(name){return function(next,_rule,{adapter}){let filterFunction=adapter[name];if(typeof filterFunction!=="function")return falseFunc;return function(element){return filterFunction(element)&&next(element)}}}var isDocumentWhiteSpace=/^[ \t\r\n]*$/,pseudos={empty(element,{adapter}){let children=adapter.getChildren(element);return children.every((element)=>!adapter.isTag(element))&&children.every((element)=>isDocumentWhiteSpace.test(adapter.getText(element)))},"first-child"(element,{adapter,equals}){if(adapter.prevElementSibling)return adapter.prevElementSibling(element)==null;let firstChild=adapter.getSiblings(element).find((sibling)=>adapter.isTag(sibling));return firstChild!=null&&equals(element,firstChild)},"last-child"(element,{adapter,equals}){let siblings=adapter.getSiblings(element);for(let index=siblings.length-1;index>=0;index--){if(equals(element,siblings[index]))return!0;if(adapter.isTag(siblings[index]))break}return!1},"first-of-type"(element,{adapter,equals}){let siblings=adapter.getSiblings(element),elementName=adapter.getName(element);for(let currentSibling of siblings){if(equals(element,currentSibling))return!0;if(adapter.isTag(currentSibling)&&adapter.getName(currentSibling)===elementName)break}return!1},"last-of-type"(element,{adapter,equals}){let siblings=adapter.getSiblings(element),elementName=adapter.getName(element);for(let index=siblings.length-1;index>=0;index--){let currentSibling=siblings[index];if(equals(element,currentSibling))return!0;if(adapter.isTag(currentSibling)&&adapter.getName(currentSibling)===elementName)break}return!1},"only-of-type"(element,{adapter,equals}){let elementName=adapter.getName(element);return adapter.getSiblings(element).every((sibling)=>equals(element,sibling)||!adapter.isTag(sibling)||adapter.getName(sibling)!==elementName)},"only-child"(element,{adapter,equals}){return adapter.getSiblings(element).every((sibling)=>equals(element,sibling)||!adapter.isTag(sibling))}};function verifyPseudoArguments(pseudoClassCondition,name,subselect,argumentIndex){if(subselect===null){if(pseudoClassCondition.length>argumentIndex)throw Error(`Pseudo-class :${name} requires an argument`)}else if(pseudoClassCondition.length===argumentIndex)throw Error(`Pseudo-class :${name} doesn't have any arguments`)}function isTraversal2(token){return token.type==="_flexibleDescendant"||isTraversal(token)}function sortRules(array){let ratings=array.map(getQuality);for(let index=1;index<array.length;index++){let procNew=ratings[index];if(procNew<0)continue;for(let currentIndex=index;currentIndex>0&&procNew<ratings[currentIndex-1];currentIndex--){let token=array[currentIndex];array[currentIndex]=array[currentIndex-1],array[currentIndex-1]=token,ratings[currentIndex]=ratings[currentIndex-1],ratings[currentIndex-1]=procNew}}}function getAttributeQuality(token){switch(token.action){case AttributeAction.Exists:return 10;case AttributeAction.Equals:return token.name==="id"?9:8;case AttributeAction.Not:return 7;case AttributeAction.Start:return 6;case AttributeAction.End:return 6;case AttributeAction.Any:return 5;case AttributeAction.Hyphen:return 4;case AttributeAction.Element:return 3}}function getQuality(token){switch(token.type){case SelectorType.Universal:return 50;case SelectorType.Tag:return 30;case SelectorType.Attribute:return Math.floor(getAttributeQuality(token)/(token.ignoreCase?2:1));case SelectorType.Pseudo:return token.data?token.name==="has"||token.name==="contains"||token.name==="icontains"?0:Array.isArray(token.data)?Math.max(0,Math.min(...token.data.map((d)=>Math.min(...d.map(getQuality))))):2:3;default:return-1}}function includesScopePseudo(t){return t.type===SelectorType.Pseudo&&(t.name==="scope"||Array.isArray(t.data)&&t.data.some((data)=>data.some(includesScopePseudo)))}var PLACEHOLDER_ELEMENT={};function hasDependsOnCurrentElement(selector){return selector.some((sel)=>sel.length>0&&(isTraversal2(sel[0])||sel.some(includesScopePseudo)))}var is=(next,token,options,context2,compileToken)=>{let compiledToken=compileToken(token,copyOptions(options),context2);return compiledToken===trueFunc?next:compiledToken===falseFunc?falseFunc:(element)=>compiledToken(element)&&next(element)},subselects={is,matches:is,where:is,not(next,token,options,context2,compileToken){let compiledToken=compileToken(token,copyOptions(options),context2);return compiledToken===falseFunc?next:compiledToken===trueFunc?falseFunc:(element)=>!compiledToken(element)&&next(element)},has(next,subselect,options,_context,compileToken){let{adapter}=options,copiedOptions=copyOptions(options);copiedOptions.relativeSelector=!0;let context2=subselect.some((s)=>s.some(isTraversal2))?[PLACEHOLDER_ELEMENT]:void 0,skipCache=hasDependsOnCurrentElement(subselect),compiled=compileToken(subselect,copiedOptions,context2);if(compiled===falseFunc)return falseFunc;if(context2&&compiled!==trueFunc)return skipCache?(element)=>{if(!next(element))return!1;context2[0]=element;let childs=adapter.getChildren(element);return findOne3(compiled,compiled.shouldTestNextSiblings?[...childs,...getNextSiblings(element,adapter)]:childs,options)!==null}:cacheParentResults(next,options,(element)=>(context2[0]=element,findOne3(compiled,adapter.getChildren(element),options)!==null));let hasOne=(element)=>findOne3(compiled,adapter.getChildren(element),options)!==null;return skipCache?(element)=>next(element)&&hasOne(element):cacheParentResults(next,options,hasOne)}};function compilePseudoSelector(next,selector,options,context2,compileToken){let{name,data}=selector;if(Array.isArray(data)){if(!(name in subselects))throw Error(`Unknown pseudo-class :${name}(${data})`);return subselects[name](next,data,options,context2,compileToken)}let userPseudo=options.pseudos?.[name],stringPseudo=typeof userPseudo==="string"?userPseudo:aliases[name];if(typeof stringPseudo==="string"){if(data!=null)throw Error(`Pseudo ${name} doesn't have any arguments`);let alias=parse(stringPseudo);return subselects.is(next,alias,options,context2,compileToken)}if(typeof userPseudo==="function")return verifyPseudoArguments(userPseudo,name,data,1),(element)=>userPseudo(element,data)&&next(element);if(name in filters)return filters[name](next,data,options,context2,compileToken);if(name in pseudos){let pseudo=pseudos[name];return verifyPseudoArguments(pseudo,name,data,2),(element)=>pseudo(element,options,data)&&next(element)}throw Error(`Unknown pseudo-class :${name}`)}function compileGeneralSelector(next,selector,options,context2,compileToken,hasExpensiveSubselector){let{adapter,equals,cacheResults}=options;switch(selector.type){case SelectorType.PseudoElement:throw Error("Pseudo-elements are not supported by css-select");case SelectorType.ColumnCombinator:throw Error("Column combinators are not yet supported by css-select");case SelectorType.Attribute:{if(selector.namespace!=null)throw Error("Namespaced attributes are not yet supported by css-select");if(!options.xmlMode||options.lowerCaseAttributeNames)selector.name=selector.name.toLowerCase();return attributeRules[selector.action](next,selector,options)}case SelectorType.Pseudo:return compilePseudoSelector(next,selector,options,context2,compileToken);case SelectorType.Tag:{if(selector.namespace!=null)throw Error("Namespaced tag names are not yet supported by css-select");let{name}=selector;if(!options.xmlMode||options.lowerCaseTags)name=name.toLowerCase();return function(element){return adapter.getName(element)===name&&next(element)}}case SelectorType.Descendant:{if(!hasExpensiveSubselector||cacheResults===!1||typeof WeakMap>"u")return function(element){let current=element;while(current=getElementParent(current,adapter))if(next(current))return!0;return!1};let resultCache=new WeakMap;return function(element){let current=element,result;while(current=getElementParent(current,adapter)){let cached=resultCache.get(current);if(cached===void 0){if(result??={matches:!1},result.matches=next(current),resultCache.set(current,result),result.matches)return!0}else{if(result)result.matches=cached.matches;return cached.matches}}return!1}}case"_flexibleDescendant":return function(element){let current=element;do{if(next(current))return!0;current=getElementParent(current,adapter)}while(current);return!1};case SelectorType.Parent:return function(element){return adapter.getChildren(element).some((element)=>adapter.isTag(element)&&next(element))};case SelectorType.Child:return function(element){let parent=getElementParent(element,adapter);return parent!==null&&next(parent)};case SelectorType.Sibling:return function(element){let siblings=adapter.getSiblings(element);for(let currentSibling of siblings){if(equals(element,currentSibling))break;if(adapter.isTag(currentSibling)&&next(currentSibling))return!0}return!1};case SelectorType.Adjacent:{if(adapter.prevElementSibling)return function(element){let previous=adapter.prevElementSibling(element);return previous!=null&&next(previous)};return function(element){let siblings=adapter.getSiblings(element),lastElement;for(let currentSibling of siblings){if(equals(element,currentSibling))break;if(adapter.isTag(currentSibling))lastElement=currentSibling}return!!lastElement&&next(lastElement)}}case SelectorType.Universal:{if(selector.namespace!=null&&selector.namespace!=="*")throw Error("Namespaced universal selectors are not yet supported by css-select");return next}}}var DESCENDANT_TOKEN={type:SelectorType.Descendant},FLEXIBLE_DESCENDANT_TOKEN={type:"_flexibleDescendant"},SCOPE_TOKEN={type:SelectorType.Pseudo,name:"scope",data:null};function absolutize(token,{adapter},context2){let hasContext=!!context2?.every((element)=>element===PLACEHOLDER_ELEMENT||adapter.isTag(element)&&getElementParent(element,adapter)!==null);for(let t of token){if(t.length>0&&isTraversal2(t[0])&&t[0].type!==SelectorType.Descendant);else if(hasContext&&!t.some(includesScopePseudo))t.unshift(DESCENDANT_TOKEN);else continue;t.unshift(SCOPE_TOKEN)}}function compileToken(token,options,compilationContext){for(let rules of token)sortRules(rules);let{context:context2=compilationContext,rootFunc:rootFunction=trueFunc}=options,isArrayContext=Array.isArray(context2),finalContext=context2&&(Array.isArray(context2)?context2:[context2]);if(options.relativeSelector!==!1)absolutize(token,options,finalContext);else if(token.some((t)=>t.length>0&&isTraversal2(t[0])))throw Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let shouldTestNextSiblings=!1,query=falseFunc;combineLoop:for(let rules of token){if(rules.length>=2){let[first,second]=rules;if(first.type!==SelectorType.Pseudo||first.name!=="scope");else if(isArrayContext&&second.type===SelectorType.Descendant)rules[1]=FLEXIBLE_DESCENDANT_TOKEN;else if(second.type===SelectorType.Adjacent||second.type===SelectorType.Sibling)shouldTestNextSiblings=!0}let next=rootFunction,hasExpensiveSubselector=!1;for(let rule of rules){if(next=compileGeneralSelector(next,rule,options,finalContext,compileToken,hasExpensiveSubselector),getQuality(rule)===0)hasExpensiveSubselector=!0;if(next===falseFunc)continue combineLoop}if(next===rootFunction)return rootFunction;query=query===falseFunc?next:or(query,next)}return query.shouldTestNextSiblings=shouldTestNextSiblings,query}function or(a,b){return(element)=>a(element)||b(element)}var defaultEquals=(a,b)=>a===b,defaultOptions={adapter:{...exports_dist2,isTag:isTag4},equals:defaultEquals};function convertOptionFormats(options){let finalOptions=options??defaultOptions;return finalOptions.adapter??=defaultOptions.adapter,finalOptions.equals??=finalOptions.adapter?.equals??defaultEquals,finalOptions}function compile2(selector,options,context2){let convertedOptions=convertOptionFormats(options),next=_compileUnsafe(selector,convertedOptions,context2);return next===falseFunc?falseFunc:(element)=>convertedOptions.adapter.isTag(element)&&next(element)}function _compileUnsafe(selector,options,context2){return compileToken(typeof selector==="string"?parse(selector):selector,convertOptionFormats(options),context2)}function getSelectorFunction(searchFunction){return function(query,elements,options){let convertedOptions=convertOptionFormats(options);if(typeof query!=="function")query=_compileUnsafe(query,convertedOptions,elements);let filteredElements=prepareContext(elements,convertedOptions.adapter,query.shouldTestNextSiblings);return searchFunction(query,filteredElements,convertedOptions)}}function prepareContext(elements,adapter,shouldTestNextSiblings=!1){if(shouldTestNextSiblings)elements=appendNextSiblings(elements,adapter);return Array.isArray(elements)?adapter.removeSubsets(elements):adapter.getChildren(elements)}function appendNextSiblings(element,adapter){let elements=Array.isArray(element)?[...element]:[element],elementsLength=elements.length;for(let index=0;index<elementsLength;index++){let nextSiblings=getNextSiblings(elements[index],adapter);elements.push(...nextSiblings)}return elements}var selectAll=getSelectorFunction((query,elements,options)=>query===falseFunc||!elements||elements.length===0?[]:findAll3(query,elements,options)),selectOne=getSelectorFunction((query,elements,options)=>query===falseFunc||!elements||elements.length===0?null:findOne3(query,elements,options));function is2(element,query,options){return(typeof query==="function"?query:compile2(query,options))(element)}var{isArray}=Array,isTag5=({nodeType})=>nodeType===ELEMENT_NODE,existsOne3=(test,elements)=>elements.some((element)=>isTag5(element)&&(test(element)||existsOne3(test,getChildren3(element)))),getAttributeValue3=(element,name)=>name==="class"?element.getAttributeNode("class")?.value??null:element.getAttribute(name),getChildren3=({childNodes})=>childNodes,getName3=(element)=>{let{localName}=element;return ignoreCase(element)?localName.toLowerCase():localName},getParent3=({parentNode})=>parentNode,getSiblings3=(element)=>{let{parentNode}=element;return parentNode?getChildren3(parentNode):element},getText3=(node)=>{if(isArray(node))return node.map(getText3).join("");if(isTag5(node))return getText3(getChildren3(node));if(node.nodeType===TEXT_NODE)return node.data;return""},hasAttrib3=(element,name)=>element.hasAttribute(name),removeSubsets3=(nodes)=>{let{length}=nodes;while(length--){let node=nodes[length];if(length&&-1<nodes.lastIndexOf(node,length-1)){nodes.splice(length,1);continue}for(let{parentNode}=node;parentNode;parentNode=parentNode.parentNode)if(nodes.includes(parentNode)){nodes.splice(length,1);break}}return nodes},findAll4=(test,nodes)=>{let matches=[];for(let node of nodes)if(isTag5(node)){if(test(node))matches.push(node);matches.push(...findAll4(test,getChildren3(node)))}return matches},findOne4=(test,nodes)=>{for(let node of nodes)if(test(node)||(node=findOne4(test,getChildren3(node))))return node;return null},adapter={isTag:isTag5,existsOne:existsOne3,getAttributeValue:getAttributeValue3,getChildren:getChildren3,getName:getName3,getParent:getParent3,getSiblings:getSiblings3,getText:getText3,hasAttrib:hasAttrib3,removeSubsets:removeSubsets3,findAll:findAll4,findOne:findOne4},prepareMatch=(element,selectors)=>compile2(selectors,{context:selectors.includes(":scope")?element:void 0,xmlMode:!ignoreCase(element),adapter}),matches=(element,selectors)=>is2(element,selectors,{strict:!0,context:selectors.includes(":scope")?element:void 0,xmlMode:!ignoreCase(element),adapter});class Text6 extends CharacterData{constructor(ownerDocument,data=""){super(ownerDocument,"#text",TEXT_NODE,data)}get wholeText(){let text=[],{previousSibling,nextSibling}=this;while(previousSibling){if(previousSibling.nodeType===TEXT_NODE)text.unshift(previousSibling[VALUE]);else break;previousSibling=previousSibling.previousSibling}text.push(this[VALUE]);while(nextSibling){if(nextSibling.nodeType===TEXT_NODE)text.push(nextSibling[VALUE]);else break;nextSibling=nextSibling.nextSibling}return text.join("")}cloneNode(){let{ownerDocument,[VALUE]:data}=this;return new Text6(ownerDocument,data)}toString(){return escape2(this[VALUE])}}var isNode=(node)=>node instanceof Node2,insert=(parentNode,child,nodes)=>{let{ownerDocument}=parentNode;for(let node of nodes)parentNode.insertBefore(isNode(node)?node:new Text6(ownerDocument,node),child)};class ParentNode extends Node2{constructor(ownerDocument,localName,nodeType){super(ownerDocument,localName,nodeType);this[PRIVATE]=null,this[NEXT]=this[END]={[NEXT]:null,[PREV]:this,[START]:this,nodeType:NODE_END,ownerDocument:this.ownerDocument,parentNode:null}}get childNodes(){let childNodes=new NodeList,{firstChild}=this;while(firstChild)childNodes.push(firstChild),firstChild=nextSibling(firstChild);return childNodes}get children(){let children=new NodeList,{firstElementChild}=this;while(firstElementChild)children.push(firstElementChild),firstElementChild=nextElementSibling2(firstElementChild);return children}get firstChild(){let{[NEXT]:next,[END]:end}=this;while(next.nodeType===ATTRIBUTE_NODE)next=next[NEXT];return next===end?null:next}get firstElementChild(){let{firstChild}=this;while(firstChild){if(firstChild.nodeType===ELEMENT_NODE)return firstChild;firstChild=nextSibling(firstChild)}return null}get lastChild(){let prev=this[END][PREV];switch(prev.nodeType){case NODE_END:return prev[START];case ATTRIBUTE_NODE:return null}return prev===this?null:prev}get lastElementChild(){let{lastChild}=this;while(lastChild){if(lastChild.nodeType===ELEMENT_NODE)return lastChild;lastChild=previousSibling(lastChild)}return null}get childElementCount(){return this.children.length}prepend(...nodes){insert(this,this.firstChild,nodes)}append(...nodes){insert(this,this[END],nodes)}replaceChildren(...nodes){let{[NEXT]:next,[END]:end}=this;while(next!==end&&next.nodeType===ATTRIBUTE_NODE)next=next[NEXT];while(next!==end){let after=getEnd(next)[NEXT];next.remove(),next=after}if(nodes.length)insert(this,end,nodes)}getElementsByClassName(className){let elements=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&next.hasAttribute("class")&&next.classList.has(className))elements.push(next);next=next[NEXT]}return elements}getElementsByTagName(tagName){let elements=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&(next.localName===tagName||localCase(next)===tagName))elements.push(next);next=next[NEXT]}return elements}querySelector(selectors){let matches=prepareMatch(this,selectors),{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&matches(next))return next;next=next.nodeType===ELEMENT_NODE&&next.localName==="template"?next[END]:next[NEXT]}return null}querySelectorAll(selectors){let matches=prepareMatch(this,selectors),elements=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&matches(next))elements.push(next);next=next.nodeType===ELEMENT_NODE&&next.localName==="template"?next[END]:next[NEXT]}return elements}appendChild(node){return this.insertBefore(node,this[END])}contains(node){let parentNode=node;while(parentNode&&parentNode!==this)parentNode=parentNode.parentNode;return parentNode===this}insertBefore(node,before=null){if(node===before)return node;if(node===this)throw Error("unable to append a node to itself");let next=before||this[END];switch(node.nodeType){case ELEMENT_NODE:node.remove(),node.parentNode=this,knownBoundaries(next[PREV],node,next),moCallback(node,null),connectedCallback(node);break;case DOCUMENT_FRAGMENT_NODE:{let{[PRIVATE]:parentNode,firstChild,lastChild}=node;if(firstChild){if(knownSegment(next[PREV],firstChild,lastChild,next),knownAdjacent(node,node[END]),parentNode)parentNode.replaceChildren();do if(firstChild.parentNode=this,moCallback(firstChild,null),firstChild.nodeType===ELEMENT_NODE)connectedCallback(firstChild);while(firstChild!==lastChild&&(firstChild=nextSibling(firstChild)))}break}case TEXT_NODE:case COMMENT_NODE:case CDATA_SECTION_NODE:node.remove();default:node.parentNode=this,knownSiblings(next[PREV],node,next),moCallback(node,null);break}return node}normalize(){let{[NEXT]:next,[END]:end}=this;while(next!==end){let{[NEXT]:$next,[PREV]:$prev,nodeType}=next;if(nodeType===TEXT_NODE){if(!next[VALUE])next.remove();else if($prev&&$prev.nodeType===TEXT_NODE)$prev.textContent+=next.textContent,next.remove()}next=$next}}removeChild(node){if(node.parentNode!==this)throw Error("node is not a child");return node.remove(),node}replaceChild(node,replaced){let next=getEnd(replaced)[NEXT];return replaced.remove(),this.insertBefore(node,next),replaced}}class NonElementParentNode extends ParentNode{getElementById(id){let{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&next.id===id)return next;next=next[NEXT]}return null}cloneNode(deep){let{ownerDocument,constructor}=this,nonEPN=new constructor(ownerDocument);if(deep){let{[END]:end}=nonEPN;for(let node of this.childNodes)nonEPN.insertBefore(node.cloneNode(deep),end)}return nonEPN}toString(){let{childNodes,localName}=this;return`<${localName}>${childNodes.join("")}</${localName}>`}toJSON(){let json=[];return nonElementAsJSON(this,json),json}}class DocumentFragment extends NonElementParentNode{constructor(ownerDocument){super(ownerDocument,"#document-fragment",DOCUMENT_FRAGMENT_NODE)}}class DocumentType extends Node2{constructor(ownerDocument,name,publicId="",systemId=""){super(ownerDocument,"#document-type",DOCUMENT_TYPE_NODE);this.name=name,this.publicId=publicId,this.systemId=systemId}cloneNode(){let{ownerDocument,name,publicId,systemId}=this;return new DocumentType(ownerDocument,name,publicId,systemId)}toString(){let{name,publicId,systemId}=this,hasPublic=0<publicId.length,str=[name];if(hasPublic)str.push("PUBLIC",`"${publicId}"`);if(systemId.length){if(!hasPublic)str.push("SYSTEM");str.push(`"${systemId}"`)}return`<!DOCTYPE ${str.join(" ")}>`}toJSON(){let json=[];return documentTypeAsJSON(this,json),json}}var getInnerHtml=(node)=>node.childNodes.join(""),setInnerHtml=(node,html)=>{let{ownerDocument}=node,{constructor}=ownerDocument,document=new constructor;document[CUSTOM_ELEMENTS]=ownerDocument[CUSTOM_ELEMENTS];let{childNodes}=parseFromString(document,ignoreCase(node),html);node.replaceChildren(...childNodes.map(setOwnerDocument,ownerDocument))};function setOwnerDocument(node){switch(node.ownerDocument=this,node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:node.childNodes.forEach(setOwnerDocument,this);break}return node}var esm_default2=(camel)=>camel.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z0-9]+)([A-Z]))/g,"$2$5-$3$6").toLowerCase();var refs=new WeakMap,key=(name)=>`data-${esm_default2(name)}`,prop=(name)=>name.slice(5).replace(/-([a-z])/g,(_,$1)=>$1.toUpperCase()),handler={get(dataset,name){if(name in dataset)return refs.get(dataset).getAttribute(key(name))},set(dataset,name,value){return dataset[name]=value,refs.get(dataset).setAttribute(key(name),value),!0},deleteProperty(dataset,name){if(name in dataset)refs.get(dataset).removeAttribute(key(name));return delete dataset[name]}};class DOMStringMap{constructor(ref){for(let{name,value}of ref.attributes)if(/^data-/.test(name))this[prop(name)]=value;return refs.set(this,ref),new Proxy(this,handler)}}setPrototypeOf(DOMStringMap.prototype,null);var{add}=Set.prototype,addTokens=(self,tokens)=>{for(let token of tokens)if(token)add.call(self,token)},update=({[OWNER_ELEMENT]:ownerElement,value})=>{let attribute=ownerElement.getAttributeNode("class");if(attribute)attribute.value=value;else setAttribute(ownerElement,new Attr(ownerElement.ownerDocument,"class",value))};class DOMTokenList extends Set{constructor(ownerElement){super();this[OWNER_ELEMENT]=ownerElement;let attribute=ownerElement.getAttributeNode("class");if(attribute)addTokens(this,attribute.value.split(/\s+/))}get length(){return this.size}get value(){return[...this].join(" ")}add(...tokens){addTokens(this,tokens),update(this)}contains(token){return this.has(token)}remove(...tokens){for(let token of tokens)this.delete(token);update(this)}toggle(token,force){if(this.has(token)){if(force)return!0;this.delete(token),update(this)}else if(force||arguments.length===1)return super.add(token),update(this),!0;return!1}replace(token,newToken){if(this.has(token))return this.delete(token),super.add(newToken),update(this),!0;return!1}supports(){return!0}}var refs2=new WeakMap,getKeys=(style)=>[...style.keys()].filter((key)=>key!==PRIVATE),updateKeys=(style)=>{let attr=refs2.get(style).getAttributeNode("style");if(!attr||attr[CHANGED]||style.get(PRIVATE)!==attr){if(style.clear(),attr){style.set(PRIVATE,attr);for(let rule of attr[VALUE].split(/\s*;\s*/)){let[key,...rest]=rule.split(":");if(rest.length>0){key=key.trim();let value=rest.join(":").trim();if(key&&value)style.set(key,value)}}}}return attr},handler2={get(style,name){if(name in prototype)return style[name];if(updateKeys(style),name==="length")return getKeys(style).length;if(/^\d+$/.test(name))return getKeys(style)[name];return style.get(esm_default2(name))??""},set(style,name,value){if(name==="cssText")style[name]=value;else{let attr=updateKeys(style);if(value==null)style.delete(esm_default2(name));else style.set(esm_default2(name),value);if(!attr){let element=refs2.get(style);attr=element.ownerDocument.createAttribute("style"),element.setAttributeNode(attr),style.set(PRIVATE,attr)}attr[CHANGED]=!1,attr[VALUE]=style.toString()}return!0}};class CSSStyleDeclaration extends Map{constructor(element){super();return refs2.set(this,element),new Proxy(this,handler2)}get cssText(){return this.toString()}set cssText(value){refs2.get(this).setAttribute("style",value)}getPropertyValue(name){let self=this[PRIVATE];return handler2.get(self,name)}setProperty(name,value){let self=this[PRIVATE];handler2.set(self,name,value)}removeProperty(name){let self=this[PRIVATE];handler2.set(self,name,null)}[Symbol.iterator](){let self=this[PRIVATE];updateKeys(self);let keys=getKeys(self),{length}=keys,i=0;return{next(){let done=i===length;return{done,value:done?null:keys[i++]}}}}get[PRIVATE](){return this}toString(){let self=this[PRIVATE];updateKeys(self);let cssText=[];return self.forEach(push,cssText),cssText.join(";")}}var{prototype}=CSSStyleDeclaration;function push(value,key){if(key!==PRIVATE)this.push(`${key}:${value}`)}function getCurrentTarget(ev){return ev.currentTarget}class GlobalEvent{static get BUBBLING_PHASE(){return 3}static get AT_TARGET(){return 2}static get CAPTURING_PHASE(){return 1}static get NONE(){return 0}constructor(type,eventInitDict={}){this.type=type,this.bubbles=!!eventInitDict.bubbles,this.cancelBubble=!1,this._stopImmediatePropagationFlag=!1,this.cancelable=!!eventInitDict.cancelable,this.eventPhase=this.NONE,this.timeStamp=Date.now(),this.defaultPrevented=!1,this.originalTarget=null,this.returnValue=null,this.srcElement=null,this.target=null,this._path=[]}get BUBBLING_PHASE(){return 3}get AT_TARGET(){return 2}get CAPTURING_PHASE(){return 1}get NONE(){return 0}preventDefault(){this.defaultPrevented=!0}composedPath(){return this._path.map(getCurrentTarget)}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this.stopPropagation(),this._stopImmediatePropagationFlag=!0}}class NamedNodeMap extends Array{constructor(ownerElement){super();this.ownerElement=ownerElement}getNamedItem(name){return this.ownerElement.getAttributeNode(name)}setNamedItem(attr){this.ownerElement.setAttributeNode(attr),this.unshift(attr)}removeNamedItem(name){let item=this.getNamedItem(name);this.ownerElement.removeAttribute(name),this.splice(this.indexOf(item),1)}item(index){return index<this.length?this[index]:null}getNamedItemNS(_,name){return this.getNamedItem(name)}setNamedItemNS(_,attr){return this.setNamedItem(attr)}removeNamedItemNS(_,name){return this.removeNamedItem(name)}}class ShadowRoot extends NonElementParentNode{constructor(host){super(host.ownerDocument,"#shadow-root",DOCUMENT_FRAGMENT_NODE);this.host=host}get innerHTML(){return getInnerHtml(this)}set innerHTML(html){setInnerHtml(this,html)}}var attributesHandler={get(target,key){return key in target?target[key]:target.find(({name})=>name===key)}},create2=(ownerDocument,element,localName)=>{if("ownerSVGElement"in element){let svg=ownerDocument.createElementNS(SVG_NAMESPACE,localName);return svg.ownerSVGElement=element.ownerSVGElement,svg}return ownerDocument.createElement(localName)},isVoid=({localName,ownerDocument})=>ownerDocument[MIME].voidElements.test(localName);class Element2 extends ParentNode{constructor(ownerDocument,localName){super(ownerDocument,localName,ELEMENT_NODE);this[CLASS_LIST]=null,this[DATASET]=null,this[STYLE]=null}get isConnected(){return isConnected(this)}get parentElement(){return parentElement(this)}get previousSibling(){return previousSibling(this)}get nextSibling(){return nextSibling(this)}get namespaceURI(){return"http://www.w3.org/1999/xhtml"}get previousElementSibling(){return previousElementSibling(this)}get nextElementSibling(){return nextElementSibling2(this)}before(...nodes){before(this,nodes)}after(...nodes){after(this,nodes)}replaceWith(...nodes){replaceWith(this,nodes)}remove(){remove(this[PREV],this,this[END][NEXT])}get id(){return stringAttribute.get(this,"id")}set id(value){stringAttribute.set(this,"id",value)}get className(){return this.classList.value}set className(value){let{classList}=this;classList.clear(),classList.add(...$String(value).split(/\s+/))}get nodeName(){return localCase(this)}get tagName(){return localCase(this)}get classList(){return this[CLASS_LIST]||(this[CLASS_LIST]=new DOMTokenList(this))}get dataset(){return this[DATASET]||(this[DATASET]=new DOMStringMap(this))}getBoundingClientRect(){return{x:0,y:0,bottom:0,height:0,left:0,right:0,top:0,width:0}}get nonce(){return stringAttribute.get(this,"nonce")}set nonce(value){stringAttribute.set(this,"nonce",value)}get style(){return this[STYLE]||(this[STYLE]=new CSSStyleDeclaration(this))}get tabIndex(){return numericAttribute.get(this,"tabindex")||-1}set tabIndex(value){numericAttribute.set(this,"tabindex",value)}get slot(){return stringAttribute.get(this,"slot")}set slot(value){stringAttribute.set(this,"slot",value)}get innerText(){let text=[],{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===TEXT_NODE)text.push(next.textContent.replace(/\s+/g," "));else if(text.length&&next[NEXT]!=end&&BLOCK_ELEMENTS.has(next.tagName))text.push(`
|
|
51
51
|
`);next=next[NEXT]}return text.join("")}get textContent(){let text=[],{[NEXT]:next,[END]:end}=this;while(next!==end){let nodeType=next.nodeType;if(nodeType===TEXT_NODE||nodeType===CDATA_SECTION_NODE)text.push(next.textContent);next=next[NEXT]}return text.join("")}set textContent(text){if(this.replaceChildren(),text!=null&&text!=="")this.appendChild(new Text6(this.ownerDocument,text))}get innerHTML(){return getInnerHtml(this)}set innerHTML(html){setInnerHtml(this,html)}get outerHTML(){return this.toString()}set outerHTML(html){let template=this.ownerDocument.createElement("");template.innerHTML=html,this.replaceWith(...template.childNodes)}get attributes(){let attributes=new NamedNodeMap(this),next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE)attributes.push(next),next=next[NEXT];return new Proxy(attributes,attributesHandler)}focus(){this.dispatchEvent(new GlobalEvent("focus"))}getAttribute(name){if(name==="class")return this.className;let attribute=this.getAttributeNode(name);return attribute&&(ignoreCase(this)?attribute.value:escape2(attribute.value))}getAttributeNode(name){let next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE){if(next.name===name)return next;next=next[NEXT]}return null}getAttributeNames(){let attributes=new NodeList,next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE)attributes.push(next.name),next=next[NEXT];return attributes}hasAttribute(name){return!!this.getAttributeNode(name)}hasAttributes(){return this[NEXT].nodeType===ATTRIBUTE_NODE}removeAttribute(name){if(name==="class"&&this[CLASS_LIST])this[CLASS_LIST].clear();let next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE){if(next.name===name){removeAttribute(this,next);return}next=next[NEXT]}}removeAttributeNode(attribute){let next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE){if(next===attribute){removeAttribute(this,next);return}next=next[NEXT]}}setAttribute(name,value){if(name==="class")this.className=value;else{let attribute=this.getAttributeNode(name);if(attribute)attribute.value=value;else setAttribute(this,new Attr(this.ownerDocument,name,value))}}setAttributeNode(attribute){let{name}=attribute,previously=this.getAttributeNode(name);if(previously!==attribute){if(previously)this.removeAttributeNode(previously);let{ownerElement}=attribute;if(ownerElement)ownerElement.removeAttributeNode(attribute);setAttribute(this,attribute)}return previously}toggleAttribute(name,force){if(this.hasAttribute(name)){if(!force)return this.removeAttribute(name),!1;return!0}else if(force||arguments.length===1)return this.setAttribute(name,""),!0;return!1}get shadowRoot(){if(shadowRoots.has(this)){let{mode,shadowRoot}=shadowRoots.get(this);if(mode==="open")return shadowRoot}return null}attachShadow(init){if(shadowRoots.has(this))throw Error("operation not supported");let shadowRoot=new ShadowRoot(this);return shadowRoots.set(this,{mode:init.mode,shadowRoot}),shadowRoot}matches(selectors){return matches(this,selectors)}closest(selectors){let parentElement=this,matches=prepareMatch(parentElement,selectors);while(parentElement&&!matches(parentElement))parentElement=parentElement.parentElement;return parentElement}insertAdjacentElement(position,element){let{parentElement}=this;switch(position){case"beforebegin":if(parentElement){parentElement.insertBefore(element,this);break}return null;case"afterbegin":this.insertBefore(element,this.firstChild);break;case"beforeend":this.insertBefore(element,null);break;case"afterend":if(parentElement){parentElement.insertBefore(element,this.nextSibling);break}return null}return element}insertAdjacentHTML(position,html){this.insertAdjacentElement(position,htmlToFragment(this.ownerDocument,html))}insertAdjacentText(position,text){let node=this.ownerDocument.createTextNode(text);this.insertAdjacentElement(position,node)}cloneNode(deep=!1){let{ownerDocument,localName}=this,addNext=(next)=>{next.parentNode=parentNode,knownAdjacent($next,next),$next=next},clone=create2(ownerDocument,this,localName),parentNode=clone,$next=clone,{[NEXT]:next,[END]:prev}=this;while(next!==prev&&(deep||next.nodeType===ATTRIBUTE_NODE)){switch(next.nodeType){case NODE_END:knownAdjacent($next,parentNode[END]),$next=parentNode[END],parentNode=parentNode.parentNode;break;case ELEMENT_NODE:{let node=create2(ownerDocument,next,next.localName);addNext(node),parentNode=node;break}case ATTRIBUTE_NODE:{let attr=next.cloneNode(deep);attr.ownerElement=parentNode,addNext(attr);break}case TEXT_NODE:case COMMENT_NODE:case CDATA_SECTION_NODE:addNext(next.cloneNode(deep));break}next=next[NEXT]}return knownAdjacent($next,clone[END]),clone}toString(){let out=[],{[END]:end}=this,next={[NEXT]:this},isOpened=!1;do switch(next=next[NEXT],next.nodeType){case ATTRIBUTE_NODE:{let attr=" "+next;switch(attr){case" id":case" class":case" style":break;default:out.push(attr)}break}case NODE_END:{let start=next[START];if(isOpened){if("ownerSVGElement"in start)out.push(" />");else if(isVoid(start))out.push(ignoreCase(start)?">":" />");else out.push(`></${start.localName}>`);isOpened=!1}else out.push(`</${start.localName}>`);break}case ELEMENT_NODE:if(isOpened)out.push(">");if(next.toString!==this.toString)out.push(next.toString()),next=next[END],isOpened=!1;else out.push(`<${next.localName}`),isOpened=!0;break;case TEXT_NODE:case COMMENT_NODE:case CDATA_SECTION_NODE:out.push((isOpened?">":"")+next),isOpened=!1;break}while(next!==end);return out.join("")}toJSON(){let json=[];return elementAsJSON(this,json),json}getAttributeNS(_,name){return this.getAttribute(name)}getElementsByTagNameNS(_,name){return this.getElementsByTagName(name)}hasAttributeNS(_,name){return this.hasAttribute(name)}removeAttributeNS(_,name){this.removeAttribute(name)}setAttributeNS(_,name,value){this.setAttribute(name,value)}setAttributeNodeNS(attr){return this.setAttributeNode(attr)}}var classNames=new WeakMap,handler3={get(target,name){return target[name]},set(target,name,value){return target[name]=value,!0}};class SVGElement extends Element2{constructor(ownerDocument,localName,ownerSVGElement=null){super(ownerDocument,localName);this.ownerSVGElement=ownerSVGElement}get className(){if(!classNames.has(this))classNames.set(this,new Proxy({baseVal:"",animVal:""},handler3));return classNames.get(this)}set className(value){let{classList}=this;classList.clear(),classList.add(...$String(value).split(/\s+/))}get namespaceURI(){return"http://www.w3.org/2000/svg"}getAttribute(name){return name==="class"?[...this.classList].join(" "):super.getAttribute(name)}setAttribute(name,value){if(name==="class")this.className=value;else if(name==="style"){let{className}=this;className.baseVal=className.animVal=value}super.setAttribute(name,value)}}var illegalConstructor=()=>{throw TypeError("Illegal constructor")};function Attr2(){illegalConstructor()}setPrototypeOf(Attr2,Attr);Attr2.prototype=Attr.prototype;function CDATASection2(){illegalConstructor()}setPrototypeOf(CDATASection2,CDATASection);CDATASection2.prototype=CDATASection.prototype;function CharacterData2(){illegalConstructor()}setPrototypeOf(CharacterData2,CharacterData);CharacterData2.prototype=CharacterData.prototype;function Comment7(){illegalConstructor()}setPrototypeOf(Comment7,Comment3);Comment7.prototype=Comment3.prototype;function DocumentFragment2(){illegalConstructor()}setPrototypeOf(DocumentFragment2,DocumentFragment);DocumentFragment2.prototype=DocumentFragment.prototype;function DocumentType2(){illegalConstructor()}setPrototypeOf(DocumentType2,DocumentType);DocumentType2.prototype=DocumentType.prototype;function Element3(){illegalConstructor()}setPrototypeOf(Element3,Element2);Element3.prototype=Element2.prototype;function Node3(){illegalConstructor()}setPrototypeOf(Node3,Node2);Node3.prototype=Node2.prototype;function ShadowRoot2(){illegalConstructor()}setPrototypeOf(ShadowRoot2,ShadowRoot);ShadowRoot2.prototype=ShadowRoot.prototype;function Text7(){illegalConstructor()}setPrototypeOf(Text7,Text6);Text7.prototype=Text6.prototype;function SVGElement2(){illegalConstructor()}setPrototypeOf(SVGElement2,SVGElement);SVGElement2.prototype=SVGElement.prototype;var Facades={Attr:Attr2,CDATASection:CDATASection2,CharacterData:CharacterData2,Comment:Comment7,DocumentFragment:DocumentFragment2,DocumentType:DocumentType2,Element:Element3,Node:Node3,ShadowRoot:ShadowRoot2,Text:Text7,SVGElement:SVGElement2};var Level0=new WeakMap,level0={get(element,name){return Level0.has(element)&&Level0.get(element)[name]||null},set(element,name,value){if(!Level0.has(element))Level0.set(element,{});let handlers=Level0.get(element),type=name.slice(2);if(handlers[name])element.removeEventListener(type,handlers[name],!1);if(handlers[name]=value)element.addEventListener(type,value,!1)}};class HTMLElement extends Element2{static get observedAttributes(){return[]}constructor(ownerDocument=null,localName=""){super(ownerDocument,localName);let ownerLess=!ownerDocument,options;if(ownerLess){let{constructor:Class}=this;if(!Classes.has(Class))throw Error("unable to initialize this Custom Element");({ownerDocument,localName,options}=Classes.get(Class))}if(ownerDocument[UPGRADE]){let{element,values}=ownerDocument[UPGRADE];ownerDocument[UPGRADE]=null;for(let[key,value]of values)element[key]=value;return element}if(ownerLess){if(this.ownerDocument=this[END].ownerDocument=ownerDocument,this.localName=localName,customElements.set(this,{connected:!1}),options.is)this.setAttribute("is",options.is)}}blur(){this.dispatchEvent(new GlobalEvent("blur"))}click(){let clickEvent=new GlobalEvent("click",{bubbles:!0,cancelable:!0});clickEvent.button=0,this.dispatchEvent(clickEvent)}get accessKeyLabel(){let{accessKey}=this;return accessKey&&`Alt+Shift+${accessKey}`}get isContentEditable(){return this.hasAttribute("contenteditable")}get contentEditable(){return booleanAttribute.get(this,"contenteditable")}set contentEditable(value){booleanAttribute.set(this,"contenteditable",value)}get draggable(){return booleanAttribute.get(this,"draggable")}set draggable(value){booleanAttribute.set(this,"draggable",value)}get hidden(){return booleanAttribute.get(this,"hidden")}set hidden(value){booleanAttribute.set(this,"hidden",value)}get spellcheck(){return booleanAttribute.get(this,"spellcheck")}set spellcheck(value){booleanAttribute.set(this,"spellcheck",value)}get accessKey(){return stringAttribute.get(this,"accesskey")}set accessKey(value){stringAttribute.set(this,"accesskey",value)}get dir(){return stringAttribute.get(this,"dir")}set dir(value){stringAttribute.set(this,"dir",value)}get lang(){return stringAttribute.get(this,"lang")}set lang(value){stringAttribute.set(this,"lang",value)}get title(){return stringAttribute.get(this,"title")}set title(value){stringAttribute.set(this,"title",value)}get onabort(){return level0.get(this,"onabort")}set onabort(value){level0.set(this,"onabort",value)}get onblur(){return level0.get(this,"onblur")}set onblur(value){level0.set(this,"onblur",value)}get oncancel(){return level0.get(this,"oncancel")}set oncancel(value){level0.set(this,"oncancel",value)}get oncanplay(){return level0.get(this,"oncanplay")}set oncanplay(value){level0.set(this,"oncanplay",value)}get oncanplaythrough(){return level0.get(this,"oncanplaythrough")}set oncanplaythrough(value){level0.set(this,"oncanplaythrough",value)}get onchange(){return level0.get(this,"onchange")}set onchange(value){level0.set(this,"onchange",value)}get onclick(){return level0.get(this,"onclick")}set onclick(value){level0.set(this,"onclick",value)}get onclose(){return level0.get(this,"onclose")}set onclose(value){level0.set(this,"onclose",value)}get oncontextmenu(){return level0.get(this,"oncontextmenu")}set oncontextmenu(value){level0.set(this,"oncontextmenu",value)}get oncuechange(){return level0.get(this,"oncuechange")}set oncuechange(value){level0.set(this,"oncuechange",value)}get ondblclick(){return level0.get(this,"ondblclick")}set ondblclick(value){level0.set(this,"ondblclick",value)}get ondrag(){return level0.get(this,"ondrag")}set ondrag(value){level0.set(this,"ondrag",value)}get ondragend(){return level0.get(this,"ondragend")}set ondragend(value){level0.set(this,"ondragend",value)}get ondragenter(){return level0.get(this,"ondragenter")}set ondragenter(value){level0.set(this,"ondragenter",value)}get ondragleave(){return level0.get(this,"ondragleave")}set ondragleave(value){level0.set(this,"ondragleave",value)}get ondragover(){return level0.get(this,"ondragover")}set ondragover(value){level0.set(this,"ondragover",value)}get ondragstart(){return level0.get(this,"ondragstart")}set ondragstart(value){level0.set(this,"ondragstart",value)}get ondrop(){return level0.get(this,"ondrop")}set ondrop(value){level0.set(this,"ondrop",value)}get ondurationchange(){return level0.get(this,"ondurationchange")}set ondurationchange(value){level0.set(this,"ondurationchange",value)}get onemptied(){return level0.get(this,"onemptied")}set onemptied(value){level0.set(this,"onemptied",value)}get onended(){return level0.get(this,"onended")}set onended(value){level0.set(this,"onended",value)}get onerror(){return level0.get(this,"onerror")}set onerror(value){level0.set(this,"onerror",value)}get onfocus(){return level0.get(this,"onfocus")}set onfocus(value){level0.set(this,"onfocus",value)}get oninput(){return level0.get(this,"oninput")}set oninput(value){level0.set(this,"oninput",value)}get oninvalid(){return level0.get(this,"oninvalid")}set oninvalid(value){level0.set(this,"oninvalid",value)}get onkeydown(){return level0.get(this,"onkeydown")}set onkeydown(value){level0.set(this,"onkeydown",value)}get onkeypress(){return level0.get(this,"onkeypress")}set onkeypress(value){level0.set(this,"onkeypress",value)}get onkeyup(){return level0.get(this,"onkeyup")}set onkeyup(value){level0.set(this,"onkeyup",value)}get onload(){return level0.get(this,"onload")}set onload(value){level0.set(this,"onload",value)}get onloadeddata(){return level0.get(this,"onloadeddata")}set onloadeddata(value){level0.set(this,"onloadeddata",value)}get onloadedmetadata(){return level0.get(this,"onloadedmetadata")}set onloadedmetadata(value){level0.set(this,"onloadedmetadata",value)}get onloadstart(){return level0.get(this,"onloadstart")}set onloadstart(value){level0.set(this,"onloadstart",value)}get onmousedown(){return level0.get(this,"onmousedown")}set onmousedown(value){level0.set(this,"onmousedown",value)}get onmouseenter(){return level0.get(this,"onmouseenter")}set onmouseenter(value){level0.set(this,"onmouseenter",value)}get onmouseleave(){return level0.get(this,"onmouseleave")}set onmouseleave(value){level0.set(this,"onmouseleave",value)}get onmousemove(){return level0.get(this,"onmousemove")}set onmousemove(value){level0.set(this,"onmousemove",value)}get onmouseout(){return level0.get(this,"onmouseout")}set onmouseout(value){level0.set(this,"onmouseout",value)}get onmouseover(){return level0.get(this,"onmouseover")}set onmouseover(value){level0.set(this,"onmouseover",value)}get onmouseup(){return level0.get(this,"onmouseup")}set onmouseup(value){level0.set(this,"onmouseup",value)}get onmousewheel(){return level0.get(this,"onmousewheel")}set onmousewheel(value){level0.set(this,"onmousewheel",value)}get onpause(){return level0.get(this,"onpause")}set onpause(value){level0.set(this,"onpause",value)}get onplay(){return level0.get(this,"onplay")}set onplay(value){level0.set(this,"onplay",value)}get onplaying(){return level0.get(this,"onplaying")}set onplaying(value){level0.set(this,"onplaying",value)}get onprogress(){return level0.get(this,"onprogress")}set onprogress(value){level0.set(this,"onprogress",value)}get onratechange(){return level0.get(this,"onratechange")}set onratechange(value){level0.set(this,"onratechange",value)}get onreset(){return level0.get(this,"onreset")}set onreset(value){level0.set(this,"onreset",value)}get onresize(){return level0.get(this,"onresize")}set onresize(value){level0.set(this,"onresize",value)}get onscroll(){return level0.get(this,"onscroll")}set onscroll(value){level0.set(this,"onscroll",value)}get onseeked(){return level0.get(this,"onseeked")}set onseeked(value){level0.set(this,"onseeked",value)}get onseeking(){return level0.get(this,"onseeking")}set onseeking(value){level0.set(this,"onseeking",value)}get onselect(){return level0.get(this,"onselect")}set onselect(value){level0.set(this,"onselect",value)}get onshow(){return level0.get(this,"onshow")}set onshow(value){level0.set(this,"onshow",value)}get onstalled(){return level0.get(this,"onstalled")}set onstalled(value){level0.set(this,"onstalled",value)}get onsubmit(){return level0.get(this,"onsubmit")}set onsubmit(value){level0.set(this,"onsubmit",value)}get onsuspend(){return level0.get(this,"onsuspend")}set onsuspend(value){level0.set(this,"onsuspend",value)}get ontimeupdate(){return level0.get(this,"ontimeupdate")}set ontimeupdate(value){level0.set(this,"ontimeupdate",value)}get ontoggle(){return level0.get(this,"ontoggle")}set ontoggle(value){level0.set(this,"ontoggle",value)}get onvolumechange(){return level0.get(this,"onvolumechange")}set onvolumechange(value){level0.set(this,"onvolumechange",value)}get onwaiting(){return level0.get(this,"onwaiting")}set onwaiting(value){level0.set(this,"onwaiting",value)}get onauxclick(){return level0.get(this,"onauxclick")}set onauxclick(value){level0.set(this,"onauxclick",value)}get ongotpointercapture(){return level0.get(this,"ongotpointercapture")}set ongotpointercapture(value){level0.set(this,"ongotpointercapture",value)}get onlostpointercapture(){return level0.get(this,"onlostpointercapture")}set onlostpointercapture(value){level0.set(this,"onlostpointercapture",value)}get onpointercancel(){return level0.get(this,"onpointercancel")}set onpointercancel(value){level0.set(this,"onpointercancel",value)}get onpointerdown(){return level0.get(this,"onpointerdown")}set onpointerdown(value){level0.set(this,"onpointerdown",value)}get onpointerenter(){return level0.get(this,"onpointerenter")}set onpointerenter(value){level0.set(this,"onpointerenter",value)}get onpointerleave(){return level0.get(this,"onpointerleave")}set onpointerleave(value){level0.set(this,"onpointerleave",value)}get onpointermove(){return level0.get(this,"onpointermove")}set onpointermove(value){level0.set(this,"onpointermove",value)}get onpointerout(){return level0.get(this,"onpointerout")}set onpointerout(value){level0.set(this,"onpointerout",value)}get onpointerover(){return level0.get(this,"onpointerover")}set onpointerover(value){level0.set(this,"onpointerover",value)}get onpointerup(){return level0.get(this,"onpointerup")}set onpointerup(value){level0.set(this,"onpointerup",value)}}var tagName="template";class HTMLTemplateElement extends HTMLElement{constructor(ownerDocument){super(ownerDocument,tagName);let content=this.ownerDocument.createDocumentFragment();(this[CONTENT]=content)[PRIVATE]=this}get content(){if(this.hasChildNodes()&&!this[CONTENT].hasChildNodes())for(let node of this.childNodes)this[CONTENT].appendChild(node.cloneNode(!0));return this[CONTENT]}}registerHTMLClass(tagName,HTMLTemplateElement);class HTMLHtmlElement extends HTMLElement{constructor(ownerDocument,localName="html"){super(ownerDocument,localName)}}var{toString}=HTMLElement.prototype;class TextElement extends HTMLElement{get innerHTML(){return this.textContent}set innerHTML(html){this.textContent=html}toString(){return toString.call(this.cloneNode()).replace("><",()=>`>${this.textContent}<`)}}var tagName2="script";class HTMLScriptElement extends TextElement{constructor(ownerDocument,localName=tagName2){super(ownerDocument,localName)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get defer(){return booleanAttribute.get(this,"defer")}set defer(value){booleanAttribute.set(this,"defer",value)}get crossOrigin(){return stringAttribute.get(this,"crossorigin")}set crossOrigin(value){stringAttribute.set(this,"crossorigin",value)}get nomodule(){return booleanAttribute.get(this,"nomodule")}set nomodule(value){booleanAttribute.set(this,"nomodule",value)}get referrerPolicy(){return stringAttribute.get(this,"referrerpolicy")}set referrerPolicy(value){stringAttribute.set(this,"referrerpolicy",value)}get nonce(){return stringAttribute.get(this,"nonce")}set nonce(value){stringAttribute.set(this,"nonce",value)}get async(){return booleanAttribute.get(this,"async")}set async(value){booleanAttribute.set(this,"async",value)}get text(){return this.textContent}set text(content){this.textContent=content}}registerHTMLClass(tagName2,HTMLScriptElement);class HTMLFrameElement extends HTMLElement{constructor(ownerDocument,localName="frame"){super(ownerDocument,localName)}}var tagName3="iframe";class HTMLIFrameElement extends HTMLElement{constructor(ownerDocument,localName=tagName3){super(ownerDocument,localName)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get srcdoc(){return stringAttribute.get(this,"srcdoc")}set srcdoc(value){stringAttribute.set(this,"srcdoc",value)}get name(){return stringAttribute.get(this,"name")}set name(value){stringAttribute.set(this,"name",value)}get allow(){return stringAttribute.get(this,"allow")}set allow(value){stringAttribute.set(this,"allow",value)}get allowFullscreen(){return booleanAttribute.get(this,"allowfullscreen")}set allowFullscreen(value){booleanAttribute.set(this,"allowfullscreen",value)}get referrerPolicy(){return stringAttribute.get(this,"referrerpolicy")}set referrerPolicy(value){stringAttribute.set(this,"referrerpolicy",value)}get loading(){return stringAttribute.get(this,"loading")}set loading(value){stringAttribute.set(this,"loading",value)}}registerHTMLClass(tagName3,HTMLIFrameElement);class HTMLObjectElement extends HTMLElement{constructor(ownerDocument,localName="object"){super(ownerDocument,localName)}}class HTMLHeadElement extends HTMLElement{constructor(ownerDocument,localName="head"){super(ownerDocument,localName)}}class HTMLBodyElement extends HTMLElement{constructor(ownerDocument,localName="body"){super(ownerDocument,localName)}}var $setup=require_CSSOM().setup;require_errorUtils();require_regexPatterns();var $CSSStyleDeclaration=require_CSSStyleDeclaration().CSSStyleDeclaration;require_cssstyleTryCatchBlock();var $CSSRule=require_CSSRule().CSSRule,$CSSRuleList=require_CSSRuleList().CSSRuleList,$CSSNestedDeclarations=require_CSSNestedDeclarations().CSSNestedDeclarations,$CSSGroupingRule=require_CSSGroupingRule().CSSGroupingRule,$CSSCounterStyleRule=require_CSSCounterStyleRule().CSSCounterStyleRule,$CSSPropertyRule=require_CSSPropertyRule().CSSPropertyRule,$CSSConditionRule=require_CSSConditionRule().CSSConditionRule,$CSSStyleRule=require_CSSStyleRule().CSSStyleRule,$MediaList=require_MediaList().MediaList,$CSSMediaRule=require_CSSMediaRule().CSSMediaRule,$CSSContainerRule=require_CSSContainerRule().CSSContainerRule,$CSSSupportsRule=require_CSSSupportsRule().CSSSupportsRule,$CSSImportRule=require_CSSImportRule().CSSImportRule,$CSSNamespaceRule=require_CSSNamespaceRule().CSSNamespaceRule,$CSSFontFaceRule=require_CSSFontFaceRule().CSSFontFaceRule,$CSSHostRule=require_CSSHostRule().CSSHostRule,$CSSStartingStyleRule=require_CSSStartingStyleRule().CSSStartingStyleRule,$StyleSheet=require_StyleSheet().StyleSheet,$CSSStyleSheet=require_CSSStyleSheet().CSSStyleSheet,$CSSKeyframesRule=require_CSSKeyframesRule().CSSKeyframesRule,$CSSKeyframeRule=require_CSSKeyframeRule().CSSKeyframeRule,$MatcherList=require_MatcherList().MatcherList,$CSSDocumentRule=require_CSSDocumentRule().CSSDocumentRule,$CSSValue=require_CSSValue().CSSValue,$CSSValueExpression=require_CSSValueExpression().CSSValueExpression,$CSSScopeRule=require_CSSScopeRule().CSSScopeRule,$CSSLayerBlockRule=require_CSSLayerBlockRule().CSSLayerBlockRule,$CSSLayerStatementRule=require_CSSLayerStatementRule().CSSLayerStatementRule,$CSSPageRule=require_CSSPageRule().CSSPageRule,$parse=require_parse().parse,$clone=require_clone().clone;var tagName4="style";class HTMLStyleElement extends TextElement{constructor(ownerDocument,localName=tagName4){super(ownerDocument,localName);this[SHEET]=null}get sheet(){let sheet=this[SHEET];if(sheet!==null)return sheet;return this[SHEET]=$parse(this.textContent)}get innerHTML(){return super.innerHTML||""}set innerHTML(value){super.textContent=value,this[SHEET]=null}get innerText(){return super.innerText||""}set innerText(value){super.textContent=value,this[SHEET]=null}get textContent(){return super.textContent||""}set textContent(value){super.textContent=value,this[SHEET]=null}}registerHTMLClass(tagName4,HTMLStyleElement);class HTMLTimeElement extends HTMLElement{constructor(ownerDocument,localName="time"){super(ownerDocument,localName)}get dateTime(){return stringAttribute.get(this,"datetime")}set dateTime(value){stringAttribute.set(this,"datetime",value)}}registerHTMLClass("time",HTMLTimeElement);class HTMLFieldSetElement extends HTMLElement{constructor(ownerDocument,localName="fieldset"){super(ownerDocument,localName)}}class HTMLEmbedElement extends HTMLElement{constructor(ownerDocument,localName="embed"){super(ownerDocument,localName)}}class HTMLHRElement extends HTMLElement{constructor(ownerDocument,localName="hr"){super(ownerDocument,localName)}}class HTMLProgressElement extends HTMLElement{constructor(ownerDocument,localName="progress"){super(ownerDocument,localName)}}class HTMLParagraphElement extends HTMLElement{constructor(ownerDocument,localName="p"){super(ownerDocument,localName)}}class HTMLTableElement extends HTMLElement{constructor(ownerDocument,localName="table"){super(ownerDocument,localName)}}class HTMLFrameSetElement extends HTMLElement{constructor(ownerDocument,localName="frameset"){super(ownerDocument,localName)}}class HTMLLIElement extends HTMLElement{constructor(ownerDocument,localName="li"){super(ownerDocument,localName)}}class HTMLBaseElement extends HTMLElement{constructor(ownerDocument,localName="base"){super(ownerDocument,localName)}}class HTMLDataListElement extends HTMLElement{constructor(ownerDocument,localName="datalist"){super(ownerDocument,localName)}}var tagName5="input";class HTMLInputElement extends HTMLElement{constructor(ownerDocument,localName=tagName5){super(ownerDocument,localName)}get autofocus(){return booleanAttribute.get(this,"autofocus")||-1}set autofocus(value){booleanAttribute.set(this,"autofocus",value)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(value){this.setAttribute("placeholder",value)}get type(){return this.getAttribute("type")}set type(value){this.setAttribute("type",value)}get value(){return stringAttribute.get(this,"value")}set value(value){stringAttribute.set(this,"value",value)}}registerHTMLClass(tagName5,HTMLInputElement);class HTMLParamElement extends HTMLElement{constructor(ownerDocument,localName="param"){super(ownerDocument,localName)}}class HTMLMediaElement extends HTMLElement{constructor(ownerDocument,localName="media"){super(ownerDocument,localName)}}class HTMLAudioElement extends HTMLElement{constructor(ownerDocument,localName="audio"){super(ownerDocument,localName)}}var tagName6="h1";class HTMLHeadingElement extends HTMLElement{constructor(ownerDocument,localName=tagName6){super(ownerDocument,localName)}}registerHTMLClass([tagName6,"h2","h3","h4","h5","h6"],HTMLHeadingElement);class HTMLDirectoryElement extends HTMLElement{constructor(ownerDocument,localName="dir"){super(ownerDocument,localName)}}class HTMLQuoteElement extends HTMLElement{constructor(ownerDocument,localName="quote"){super(ownerDocument,localName)}}var import_canvas=__toESM(require_canvas(),1);var{createCanvas}=import_canvas.default,tagName7="canvas";class HTMLCanvasElement extends HTMLElement{constructor(ownerDocument,localName=tagName7){super(ownerDocument,localName);this[IMAGE]=createCanvas(300,150)}get width(){return this[IMAGE].width}set width(value){numericAttribute.set(this,"width",value),this[IMAGE].width=value}get height(){return this[IMAGE].height}set height(value){numericAttribute.set(this,"height",value),this[IMAGE].height=value}getContext(type){return this[IMAGE].getContext(type)}toDataURL(...args){return this[IMAGE].toDataURL(...args)}}registerHTMLClass(tagName7,HTMLCanvasElement);class HTMLLegendElement extends HTMLElement{constructor(ownerDocument,localName="legend"){super(ownerDocument,localName)}}var tagName8="option";class HTMLOptionElement extends HTMLElement{constructor(ownerDocument,localName=tagName8){super(ownerDocument,localName)}get value(){return stringAttribute.get(this,"value")}set value(value){stringAttribute.set(this,"value",value)}get selected(){return booleanAttribute.get(this,"selected")}set selected(value){let option=this.parentElement?.querySelector("option[selected]");if(option&&option!==this)option.selected=!1;booleanAttribute.set(this,"selected",value)}}registerHTMLClass(tagName8,HTMLOptionElement);class HTMLSpanElement extends HTMLElement{constructor(ownerDocument,localName="span"){super(ownerDocument,localName)}}class HTMLMeterElement extends HTMLElement{constructor(ownerDocument,localName="meter"){super(ownerDocument,localName)}}class HTMLVideoElement extends HTMLElement{constructor(ownerDocument,localName="video"){super(ownerDocument,localName)}}class HTMLTableCellElement extends HTMLElement{constructor(ownerDocument,localName="td"){super(ownerDocument,localName)}}var tagName9="title";class HTMLTitleElement extends TextElement{constructor(ownerDocument,localName=tagName9){super(ownerDocument,localName)}}registerHTMLClass(tagName9,HTMLTitleElement);class HTMLOutputElement extends HTMLElement{constructor(ownerDocument,localName="output"){super(ownerDocument,localName)}}class HTMLTableRowElement extends HTMLElement{constructor(ownerDocument,localName="tr"){super(ownerDocument,localName)}}class HTMLDataElement extends HTMLElement{constructor(ownerDocument,localName="data"){super(ownerDocument,localName)}}class HTMLMenuElement extends HTMLElement{constructor(ownerDocument,localName="menu"){super(ownerDocument,localName)}}var tagName10="select";class HTMLSelectElement extends HTMLElement{constructor(ownerDocument,localName=tagName10){super(ownerDocument,localName)}get options(){let children=new NodeList,{firstElementChild}=this;while(firstElementChild){if(firstElementChild.tagName==="OPTGROUP")children.push(...firstElementChild.children);else children.push(firstElementChild);firstElementChild=firstElementChild.nextElementSibling}return children}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get value(){return this.querySelector("option[selected]")?.value}}registerHTMLClass(tagName10,HTMLSelectElement);class HTMLBRElement extends HTMLElement{constructor(ownerDocument,localName="br"){super(ownerDocument,localName)}}var tagName11="button";class HTMLButtonElement extends HTMLElement{constructor(ownerDocument,localName=tagName11){super(ownerDocument,localName)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get type(){return this.getAttribute("type")}set type(value){this.setAttribute("type",value)}}registerHTMLClass(tagName11,HTMLButtonElement);class HTMLMapElement extends HTMLElement{constructor(ownerDocument,localName="map"){super(ownerDocument,localName)}}class HTMLOptGroupElement extends HTMLElement{constructor(ownerDocument,localName="optgroup"){super(ownerDocument,localName)}}class HTMLDListElement extends HTMLElement{constructor(ownerDocument,localName="dl"){super(ownerDocument,localName)}}var tagName12="textarea";class HTMLTextAreaElement extends TextElement{constructor(ownerDocument,localName=tagName12){super(ownerDocument,localName)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(value){this.setAttribute("placeholder",value)}get type(){return this.getAttribute("type")}set type(value){this.setAttribute("type",value)}get value(){return this.textContent}set value(content){this.textContent=content}}registerHTMLClass(tagName12,HTMLTextAreaElement);class HTMLFontElement extends HTMLElement{constructor(ownerDocument,localName="font"){super(ownerDocument,localName)}}class HTMLDivElement extends HTMLElement{constructor(ownerDocument,localName="div"){super(ownerDocument,localName)}}var tagName13="link";class HTMLLinkElement extends HTMLElement{constructor(ownerDocument,localName=tagName13){super(ownerDocument,localName)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get href(){return stringAttribute.get(this,"href").trim()}set href(value){stringAttribute.set(this,"href",value)}get hreflang(){return stringAttribute.get(this,"hreflang")}set hreflang(value){stringAttribute.set(this,"hreflang",value)}get media(){return stringAttribute.get(this,"media")}set media(value){stringAttribute.set(this,"media",value)}get rel(){return stringAttribute.get(this,"rel")}set rel(value){stringAttribute.set(this,"rel",value)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}}registerHTMLClass(tagName13,HTMLLinkElement);var tagName14="slot";class HTMLSlotElement extends HTMLElement{constructor(ownerDocument,localName=tagName14){super(ownerDocument,localName)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}assign(){}assignedNodes(options){let isNamedSlot=!!this.name,hostChildNodes=this.getRootNode().host?.childNodes??[],slottables;if(isNamedSlot)slottables=[...hostChildNodes].filter((node)=>node.slot===this.name);else slottables=[...hostChildNodes].filter((node)=>!node.slot);if(options?.flatten){let result=[];for(let slottable of slottables)if(slottable.localName==="slot")result.push(...slottable.assignedNodes({flatten:!0}));else result.push(slottable);slottables=result}return slottables.length?slottables:[...this.childNodes]}assignedElements(options){let slottables=this.assignedNodes(options).filter((n)=>n.nodeType===1);return slottables.length?slottables:[...this.children]}}registerHTMLClass(tagName14,HTMLSlotElement);class HTMLFormElement extends HTMLElement{constructor(ownerDocument,localName="form"){super(ownerDocument,localName)}}var tagName15="img";class HTMLImageElement extends HTMLElement{constructor(ownerDocument,localName=tagName15){super(ownerDocument,localName)}get alt(){return stringAttribute.get(this,"alt")}set alt(value){stringAttribute.set(this,"alt",value)}get sizes(){return stringAttribute.get(this,"sizes")}set sizes(value){stringAttribute.set(this,"sizes",value)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get srcset(){return stringAttribute.get(this,"srcset")}set srcset(value){stringAttribute.set(this,"srcset",value)}get title(){return stringAttribute.get(this,"title")}set title(value){stringAttribute.set(this,"title",value)}get width(){return numericAttribute.get(this,"width")}set width(value){numericAttribute.set(this,"width",value)}get height(){return numericAttribute.get(this,"height")}set height(value){numericAttribute.set(this,"height",value)}}registerHTMLClass(tagName15,HTMLImageElement);class HTMLPreElement extends HTMLElement{constructor(ownerDocument,localName="pre"){super(ownerDocument,localName)}}class HTMLUListElement extends HTMLElement{constructor(ownerDocument,localName="ul"){super(ownerDocument,localName)}}var tagName16="meta";class HTMLMetaElement extends HTMLElement{constructor(ownerDocument,localName=tagName16){super(ownerDocument,localName)}get name(){return stringAttribute.get(this,"name")}set name(value){stringAttribute.set(this,"name",value)}get httpEquiv(){return stringAttribute.get(this,"http-equiv")}set httpEquiv(value){stringAttribute.set(this,"http-equiv",value)}get content(){return stringAttribute.get(this,"content")}set content(value){stringAttribute.set(this,"content",value)}get charset(){return stringAttribute.get(this,"charset")}set charset(value){stringAttribute.set(this,"charset",value)}get media(){return stringAttribute.get(this,"media")}set media(value){stringAttribute.set(this,"media",value)}}registerHTMLClass(tagName16,HTMLMetaElement);class HTMLPictureElement extends HTMLElement{constructor(ownerDocument,localName="picture"){super(ownerDocument,localName)}}class HTMLAreaElement extends HTMLElement{constructor(ownerDocument,localName="area"){super(ownerDocument,localName)}}class HTMLOListElement extends HTMLElement{constructor(ownerDocument,localName="ol"){super(ownerDocument,localName)}}class HTMLTableCaptionElement extends HTMLElement{constructor(ownerDocument,localName="caption"){super(ownerDocument,localName)}}var tagName17="a";class HTMLAnchorElement extends HTMLElement{constructor(ownerDocument,localName=tagName17){super(ownerDocument,localName)}get href(){return encodeURI(decodeURI(stringAttribute.get(this,"href"))).trim()}set href(value){stringAttribute.set(this,"href",decodeURI(value))}get download(){return encodeURI(decodeURI(stringAttribute.get(this,"download")))}set download(value){stringAttribute.set(this,"download",decodeURI(value))}get target(){return stringAttribute.get(this,"target")}set target(value){stringAttribute.set(this,"target",value)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}get rel(){return stringAttribute.get(this,"rel")}set rel(value){stringAttribute.set(this,"rel",value)}}registerHTMLClass(tagName17,HTMLAnchorElement);class HTMLLabelElement extends HTMLElement{constructor(ownerDocument,localName="label"){super(ownerDocument,localName)}}class HTMLUnknownElement extends HTMLElement{constructor(ownerDocument,localName="unknown"){super(ownerDocument,localName)}}class HTMLModElement extends HTMLElement{constructor(ownerDocument,localName="mod"){super(ownerDocument,localName)}}class HTMLDetailsElement extends HTMLElement{constructor(ownerDocument,localName="details"){super(ownerDocument,localName)}}var tagName18="source";class HTMLSourceElement extends HTMLElement{constructor(ownerDocument,localName=tagName18){super(ownerDocument,localName)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get srcset(){return stringAttribute.get(this,"srcset")}set srcset(value){stringAttribute.set(this,"srcset",value)}get sizes(){return stringAttribute.get(this,"sizes")}set sizes(value){stringAttribute.set(this,"sizes",value)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}}registerHTMLClass(tagName18,HTMLSourceElement);class HTMLTrackElement extends HTMLElement{constructor(ownerDocument,localName="track"){super(ownerDocument,localName)}}class HTMLMarqueeElement extends HTMLElement{constructor(ownerDocument,localName="marquee"){super(ownerDocument,localName)}}var HTMLClasses={HTMLElement,HTMLTemplateElement,HTMLHtmlElement,HTMLScriptElement,HTMLFrameElement,HTMLIFrameElement,HTMLObjectElement,HTMLHeadElement,HTMLBodyElement,HTMLStyleElement,HTMLTimeElement,HTMLFieldSetElement,HTMLEmbedElement,HTMLHRElement,HTMLProgressElement,HTMLParagraphElement,HTMLTableElement,HTMLFrameSetElement,HTMLLIElement,HTMLBaseElement,HTMLDataListElement,HTMLInputElement,HTMLParamElement,HTMLMediaElement,HTMLAudioElement,HTMLHeadingElement,HTMLDirectoryElement,HTMLQuoteElement,HTMLCanvasElement,HTMLLegendElement,HTMLOptionElement,HTMLSpanElement,HTMLMeterElement,HTMLVideoElement,HTMLTableCellElement,HTMLTitleElement,HTMLOutputElement,HTMLTableRowElement,HTMLDataElement,HTMLMenuElement,HTMLSelectElement,HTMLBRElement,HTMLButtonElement,HTMLMapElement,HTMLOptGroupElement,HTMLDListElement,HTMLTextAreaElement,HTMLFontElement,HTMLDivElement,HTMLLinkElement,HTMLSlotElement,HTMLFormElement,HTMLImageElement,HTMLPreElement,HTMLUListElement,HTMLMetaElement,HTMLPictureElement,HTMLAreaElement,HTMLOListElement,HTMLTableCaptionElement,HTMLAnchorElement,HTMLLabelElement,HTMLUnknownElement,HTMLModElement,HTMLDetailsElement,HTMLSourceElement,HTMLTrackElement,HTMLMarqueeElement};var voidElements3={test:()=>!0},Mime={"text/html":{docType:"<!DOCTYPE html>",ignoreCase:!0,voidElements:/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i},"image/svg+xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3},"text/xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3},"application/xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3},"application/xhtml+xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3}};class CustomEvent extends GlobalEvent{constructor(type,eventInitDict={}){super(type,eventInitDict);this.detail=eventInitDict.detail}}class InputEvent extends GlobalEvent{constructor(type,inputEventInit={}){super(type,inputEventInit);this.inputType=inputEventInit.inputType,this.data=inputEventInit.data,this.dataTransfer=inputEventInit.dataTransfer,this.isComposing=inputEventInit.isComposing||!1,this.ranges=inputEventInit.ranges}}var ImageClass=(ownerDocument)=>class extends HTMLImageElement{constructor(width,height){super(ownerDocument);switch(arguments.length){case 1:this.height=width,this.width=width;break;case 2:this.height=height,this.width=width;break}}};var deleteContents=({[START]:start,[END]:end},fragment=null)=>{setAdjacent(start[PREV],end[NEXT]);do{let after=getEnd(start),next=after===end?after:after[NEXT];if(fragment)fragment.insertBefore(start,fragment[END]);else start.remove();start=next}while(start!==end)};class Range{constructor(){this[START]=null,this[END]=null,this.commonAncestorContainer=null}insertNode(newNode){this[END].parentNode.insertBefore(newNode,this[START])}selectNode(node){this[START]=node,this[END]=getEnd(node)}selectNodeContents(node){this.selectNode(node),this.commonAncestorContainer=node}surroundContents(parentNode){parentNode.replaceChildren(this.extractContents())}setStartBefore(node){this[START]=node}setStartAfter(node){this[START]=node.nextSibling}setEndBefore(node){this[END]=getEnd(node.previousSibling)}setEndAfter(node){this[END]=getEnd(node)}cloneContents(){let{[START]:start,[END]:end}=this,fragment=start.ownerDocument.createDocumentFragment();while(start!==end)if(fragment.insertBefore(start.cloneNode(!0),fragment[END]),start=getEnd(start),start!==end)start=start[NEXT];return fragment}deleteContents(){deleteContents(this)}extractContents(){let fragment=this[START].ownerDocument.createDocumentFragment();return deleteContents(this,fragment),fragment}createContextualFragment(html){let{commonAncestorContainer:doc}=this,isSVG="ownerSVGElement"in doc,document=isSVG?doc.ownerDocument:doc,content=htmlToFragment(document,html);if(isSVG){let childNodes=[...content.childNodes];content=document.createDocumentFragment(),Object.setPrototypeOf(content,SVGElement.prototype),content.ownerSVGElement=document;for(let child of childNodes)Object.setPrototypeOf(child,SVGElement.prototype),child.ownerSVGElement=document,content.appendChild(child)}else this.selectNode(content);return content}cloneRange(){let range=new Range;return range[START]=this[START],range[END]=this[END],range}}var isOK=({nodeType},mask)=>{switch(nodeType){case ELEMENT_NODE:return mask&SHOW_ELEMENT;case TEXT_NODE:return mask&SHOW_TEXT;case COMMENT_NODE:return mask&SHOW_COMMENT;case CDATA_SECTION_NODE:return mask&SHOW_CDATA_SECTION}return 0};class TreeWalker{constructor(root,whatToShow=SHOW_ALL){this.root=root,this.currentNode=root,this.whatToShow=whatToShow;let{[NEXT]:next,[END]:end}=root;if(root.nodeType===DOCUMENT_NODE){let{documentElement}=root;next=documentElement,end=documentElement[END]}let nodes=[];while(next&&next!==end){if(isOK(next,whatToShow))nodes.push(next);next=next[NEXT]}this[PRIVATE]={i:0,nodes}}nextNode(){let $=this[PRIVATE];return this.currentNode=$.i<$.nodes.length?$.nodes[$.i++]:null,this.currentNode}}var query=(method,ownerDocument,selectors)=>{let{[NEXT]:next,[END]:end}=ownerDocument;return method.call({ownerDocument,[NEXT]:next,[END]:end},selectors)},globalExports=assign({},Facades,HTMLClasses,{CustomEvent,Event:GlobalEvent,EventTarget:DOMEventTarget,InputEvent,NamedNodeMap,NodeList}),window2=new WeakMap;class Document2 extends NonElementParentNode{constructor(type){super(null,"#document",DOCUMENT_NODE);this[CUSTOM_ELEMENTS]={active:!1,registry:null},this[MUTATION_OBSERVER]={active:!1,class:null},this[MIME]=Mime[type],this[DOCTYPE]=null,this[DOM_PARSER]=null,this[GLOBALS]=null,this[IMAGE]=null,this[UPGRADE]=null}get defaultView(){if(!window2.has(this))window2.set(this,new Proxy(globalThis,{set:(target,name,value)=>{switch(name){case"addEventListener":case"removeEventListener":case"dispatchEvent":this[EVENT_TARGET][name]=value;break;default:target[name]=value;break}return!0},get:(globalThis2,name)=>{switch(name){case"addEventListener":case"removeEventListener":case"dispatchEvent":if(!this[EVENT_TARGET]){let et=this[EVENT_TARGET]=new DOMEventTarget;et.dispatchEvent=et.dispatchEvent.bind(et),et.addEventListener=et.addEventListener.bind(et),et.removeEventListener=et.removeEventListener.bind(et)}return this[EVENT_TARGET][name];case"document":return this;case"navigator":return{userAgent:"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"};case"window":return window2.get(this);case"customElements":if(!this[CUSTOM_ELEMENTS].registry)this[CUSTOM_ELEMENTS]=new CustomElementRegistry(this);return this[CUSTOM_ELEMENTS];case"performance":return globalThis2.performance;case"DOMParser":return this[DOM_PARSER];case"Image":if(!this[IMAGE])this[IMAGE]=ImageClass(this);return this[IMAGE];case"MutationObserver":if(!this[MUTATION_OBSERVER].class)this[MUTATION_OBSERVER]=new MutationObserverClass(this);return this[MUTATION_OBSERVER].class}return this[GLOBALS]&&this[GLOBALS][name]||globalExports[name]||globalThis2[name]}}));return window2.get(this)}get doctype(){let docType=this[DOCTYPE];if(docType)return docType;let{firstChild}=this;if(firstChild&&firstChild.nodeType===DOCUMENT_TYPE_NODE)return this[DOCTYPE]=firstChild;return null}set doctype(value){if(/^([a-z:]+)(\s+system|\s+public(\s+"([^"]+)")?)?(\s+"([^"]+)")?/i.test(value)){let{$1:name,$4:publicId,$6:systemId}=RegExp;this[DOCTYPE]=new DocumentType(this,name,publicId,systemId),knownSiblings(this,this[DOCTYPE],this[NEXT])}}get documentElement(){return this.firstElementChild}get isConnected(){return!0}_getParent(){return this[EVENT_TARGET]}createAttribute(name){return new Attr(this,name)}createCDATASection(data){return new CDATASection(this,data)}createComment(textContent){return new Comment3(this,textContent)}createDocumentFragment(){return new DocumentFragment(this)}createDocumentType(name,publicId,systemId){return new DocumentType(this,name,publicId,systemId)}createElement(localName){return new Element2(this,localName)}createRange(){let range=new Range;return range.commonAncestorContainer=this,range}createTextNode(textContent){return new Text6(this,textContent)}createTreeWalker(root,whatToShow=-1){return new TreeWalker(root,whatToShow)}createNodeIterator(root,whatToShow=-1){return this.createTreeWalker(root,whatToShow)}createEvent(name){let event=create(name==="Event"?new GlobalEvent(""):new CustomEvent(""));return event.initEvent=event.initCustomEvent=(type,canBubble=!1,cancelable=!1,detail)=>{event.bubbles=!!canBubble,defineProperties(event,{type:{value:type},canBubble:{value:canBubble},cancelable:{value:cancelable},detail:{value:detail}})},event}cloneNode(deep=!1){let{constructor,[CUSTOM_ELEMENTS]:customElements,[DOCTYPE]:doctype}=this,document=new constructor;if(document[CUSTOM_ELEMENTS]=customElements,deep){let end=document[END],{childNodes}=this;for(let{length}=childNodes,i=0;i<length;i++)document.insertBefore(childNodes[i].cloneNode(!0),end);if(doctype)document[DOCTYPE]=childNodes[0]}return document}importNode(externalNode){let deep=1<arguments.length&&!!arguments[1],node=externalNode.cloneNode(deep),{[CUSTOM_ELEMENTS]:customElements}=this,{active}=customElements,upgrade=(element)=>{let{ownerDocument,nodeType}=element;if(element.ownerDocument=this,active&&ownerDocument!==this&&nodeType===ELEMENT_NODE)customElements.upgrade(element)};if(upgrade(node),deep)switch(node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:{let{[NEXT]:next,[END]:end}=node;while(next!==end){if(next.nodeType===ELEMENT_NODE)upgrade(next);next=next[NEXT]}break}}return node}toString(){return this.childNodes.join("")}querySelector(selectors){return query(super.querySelector,this,selectors)}querySelectorAll(selectors){return query(super.querySelectorAll,this,selectors)}getElementsByTagNameNS(_,name){return this.getElementsByTagName(name)}createAttributeNS(_,name){return this.createAttribute(name)}createElementNS(nsp,localName,options){return nsp===SVG_NAMESPACE?new SVGElement(this,localName,null):this.createElement(localName,options)}}setPrototypeOf(globalExports.Document=function(){illegalConstructor()},Document2).prototype=Document2.prototype;var createHTMLElement=(ownerDocument,builtin,localName,options)=>{if(!builtin&&htmlClasses.has(localName))return new(htmlClasses.get(localName))(ownerDocument,localName);let{[CUSTOM_ELEMENTS]:{active,registry}}=ownerDocument;if(active){let ce=builtin?options.is:localName;if(registry.has(ce)){let{Class}=registry.get(ce),element=new Class(ownerDocument,localName);return customElements.set(element,{connected:!1}),element}}return new HTMLElement(ownerDocument,localName)};class HTMLDocument extends Document2{constructor(){super("text/html")}get all(){let nodeList=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){switch(next.nodeType){case ELEMENT_NODE:nodeList.push(next);break}next=next[NEXT]}return nodeList}get head(){let{documentElement}=this,{firstElementChild}=documentElement;if(!firstElementChild||firstElementChild.tagName!=="HEAD")firstElementChild=this.createElement("head"),documentElement.prepend(firstElementChild);return firstElementChild}get body(){let{head}=this,{nextElementSibling}=head;if(!nextElementSibling||nextElementSibling.tagName!=="BODY")nextElementSibling=this.createElement("body"),head.after(nextElementSibling);return nextElementSibling}get title(){let{head}=this;return head.getElementsByTagName("title").at(0)?.textContent||""}set title(textContent){let{head}=this,title=head.getElementsByTagName("title").at(0);if(title)title.textContent=textContent;else head.insertBefore(this.createElement("title"),head.firstChild).textContent=textContent}createElement(localName,options){let builtin=!!(options&&options.is),element=createHTMLElement(this,builtin,localName,options);if(builtin)element.setAttribute("is",options.is);return element}}class SVGDocument extends Document2{constructor(){super("image/svg+xml")}toString(){return this[MIME].docType+super.toString()}}class XMLDocument extends Document2{constructor(){super("text/xml")}toString(){return this[MIME].docType+super.toString()}}class DOMParser{parseFromString(markupLanguage,mimeType,globals=null){let isHTML=!1,document;if(mimeType==="text/html")isHTML=!0,document=new HTMLDocument;else if(mimeType==="image/svg+xml")document=new SVGDocument;else document=new XMLDocument;if(document[DOM_PARSER]=DOMParser,globals)document[GLOBALS]=globals;if(isHTML&&markupLanguage==="...")markupLanguage="<!doctype html><html><head></head><body></body></html>";return markupLanguage?parseFromString(document,isHTML,markupLanguage):document}}var{parse:parse3}=JSON;var parseHTML=(html,globals=null)=>new DOMParser().parseFromString(html,"text/html",globals).defaultView;function Document3(){illegalConstructor()}setPrototypeOf(Document3,Document2).prototype=Document2.prototype;import{readdir,readFile,stat}from"node:fs/promises";import{join,relative,resolve}from"node:path";import{isNotationLanguage,renderBlock}from"./index.js";import{parseTabSource}from"./tab/index.js";import{lookupGuitarVoicing}from"./voicings/index.js";var QUOTE2=/^[ \t]{0,3}>[ \t]?/,OPENING=/^(`{3,}|~{3,})(.*)$/,LIST_MARKER=/^(?:[-*+]|\d{1,9}[.)])[ \t]+/;function unquote(line,depth){let rest=line;for(let i=0;i<depth;i++){let m=QUOTE2.exec(rest);if(!m)return null;rest=rest.slice(m[0].length)}return rest}var dedent=(line,indent)=>{let i=0;while(i<indent&&(line[i]===" "||line[i]==="\t"))i++;return line.slice(i)},columns=(lead)=>[...lead].reduce((n,c)=>n+(c==="\t"?4-n%4:1),0);function opensComment(line){if((line.split("%%").length-1)%2===1)return!0;let html=line.lastIndexOf("<!--");return html>=0&&!line.includes("-->",html+4)}var commentEnd=(line)=>(line.split("%%").length-1)%2===1?"%%":"-->";function parseMarkdown(text){let lines=text.replace(/^\uFEFF/,"").split(/\r\n|\r|\n/),i=0,frontMatter=null;if(lines[0]?.trimEnd()==="---"){let end=lines.findIndex((l,n)=>n>0&&/^(?:---|\.\.\.)\s*$/.test(l));if(end>0)frontMatter=lines.slice(1,end).join(`
|
|
52
52
|
`),i=end+1}let blocks=[],comment=null,inList=!1;for(;i<lines.length;i++){let line=lines[i];if(comment){let end=line.indexOf(comment);if(end<0)continue;if(comment=null,opensComment(line.slice(end+2)))comment=commentEnd(line.slice(end+2));continue}let rest=line,depth=0;for(let m=QUOTE2.exec(rest);m;m=QUOTE2.exec(rest))rest=rest.slice(m[0].length),depth++;let spaces=/^[ \t]*/.exec(rest)[0].length,marker=LIST_MARKER.exec(rest.slice(spaces))?.[0].length??0,indent=spaces+marker;if(marker)inList=!0;else if(rest.trim()&&columns(rest.slice(0,spaces))===0)inList=!1;let open=OPENING.exec(rest.slice(indent));if(!open){if(opensComment(rest))comment=commentEnd(rest);continue}if(!marker&&!inList&&columns(rest.slice(0,spaces))>3)continue;let fence=open[1],info=open[2];if(fence[0]==="`"&&info.includes("`"))continue;let body=[],start=i;for(i++;i<lines.length;i++){let inner=unquote(lines[i],depth);if(inner===null){i--;break}let close=/^[ \t]*(`{3,}|~{3,})[ \t]*$/.exec(inner);if(close&&close[1][0]===fence[0]&&close[1].length>=fence.length)break;body.push(dedent(inner,indent))}blocks.push({language:info.trim().split(/\s+/)[0]??"",line:start+1,source:body.join(`
|
|
53
|
-
`)})}return{frontMatter,blocks}}import{chordNoteSet,midiOf,nameOf,noteOf}from"./index.js";var classes=(el)=>(el.getAttribute("class")??"").split(/\s+/),has=(el,cls)=>classes(el).includes(cls),text=(el)=>el?.textContent?.trim()||null,int=(value)=>value===null?null:Number(value),marksOf=(el)=>classes(el).flatMap((c)=>c==="mn-char"?["characteristic"]:c==="mn-diff"?["different"]:c==="mn-tone"?["chord tone"]:c==="mn-passing"?["passing"]:[]);function spelled(name,midi){let octave=Math.floor(midi/12)-1;for(let o of[octave,octave-1,octave+1])if(midiOf(`${name}${o}`)===midi)return`${name}${o}`;return noteOf(midi)}var labelAfter=(el,cls)=>{let next=el.nextElementSibling;return next&&has(next,cls)?text(next):null};function capoOf(svg){let capo=int(svg.getAttribute("data-mn-capo"));if(!capo)return{};return{capo,fretsFrom:svg.getAttribute("data-mn-frets-from")==="nut"?"nut":"capo"}}function guitarChord(svg){let chord=svg.getAttribute("data-mn-chord"),sounds=svg.getAttribute("data-mn-sounds"),set=sounds?chordNoteSet(sounds):chord?chordNoteSet(chord):null,strings=[...svg.querySelectorAll("[data-mn-string]")].map((el)=>{let fret=int(el.getAttribute("data-mn-fret")),midi=int(el.getAttribute("data-midi")),name=midi===null?null:set?.members.find((m)=>m.chroma===midi%12)?.name??nameOf(midi,set?.preferFlats);return{string:Number(el.getAttribute("data-mn-string")),fret,note:name!==null&&midi!==null?spelled(name,midi):null,label:fret?labelAfter(el,"mn-dot-text"):null,root:has(el,"mn-root"),mark:has(el,"mn-anchor")?"anchor":has(el,"mn-guide")?"guide":null}}),base=parseInt(text(svg.querySelector(".mn-base-fret"))??"1",10),rows=svg.querySelectorAll("line.mn-fret, line.mn-nut").length-1,frets=strings.map((s)=>s.fret===null?"x":String(s.fret)),barres=[...svg.querySelectorAll(".mn-barre")].map((el)=>({finger:el.getAttribute("data-mn-finger")??"",fret:Number(el.getAttribute("data-mn-fret")),from:Number(el.getAttribute("data-mn-from")),to:Number(el.getAttribute("data-mn-to"))}));return{type:"guitar-chord",title:text(svg.querySelector(".mn-title")),chord,frets:frets.join(frets.some((f)=>f.length>1)?"-":""),fretRange:[base,base+rows-1],strings,...capoOf(svg),...sounds?{sounds}:{},...barres.length?{barres}:{}}}function fretboard(svg){let range=(svg.getAttribute("data-mn-frets")??"0-0").split("-").map(Number),tuning=[...svg.querySelectorAll(".mn-string-name")].map((el)=>text(el)??"?"),dots=[...svg.querySelectorAll("circle[data-mn-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-midi"))),label:labelAfter(el,"mn-dot-text"),root:has(el,"mn-root"),marks:marksOf(el)})).sort((a,b)=>b.string-a.string||a.fret-b.fret),ghosts=[...svg.querySelectorAll("circle[data-mn-ghost-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-ghost-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-mn-pitch")))})).sort((a,b)=>b.string-a.string||a.fret-b.fret);return{type:"fretboard",title:text(svg.querySelector(".mn-title")),notes:svg.getAttribute("data-mn-set"),fretRange:[range[0]??0,range[1]??0],tuning:tuning.reverse(),dots,ghosts,...capoOf(svg)}}function keyboard(svg){let all=[...svg.querySelectorAll("rect[data-midi]")],midis=all.map((el)=>Number(el.getAttribute("data-midi"))),fingers=new Map([...svg.querySelectorAll(".mn-key-finger")].map((el)=>[Number(el.getAttribute("data-mn-key")),text(el)])),keys=all.filter((el)=>has(el,"mn-on")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return{midi,note:spelled(el.getAttribute("data-mn-note")??"",midi),label:labelAfter(el,"mn-key-label"),finger:fingers.get(midi)??null,root:has(el,"mn-root"),marks:marksOf(el),...has(el,"mn-hand-left")?{hand:"left"}:has(el,"mn-hand-right")?{hand:"right"}:{}}}).sort((a,b)=>a.midi-b.midi).map(({midi:_,...key})=>key);return{type:"keyboard",title:text(svg.querySelector(".mn-title")),chord:svg.getAttribute("data-mn-chord"),notes:svg.getAttribute("data-mn-set"),keyRange:[noteOf(Math.min(...midis)),noteOf(Math.max(...midis))],keys,ghosts:all.filter((el)=>has(el,"mn-ghost")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return spelled(el.getAttribute("data-mn-note")??"",midi)})}}function chart(el){let chords=[];for(let c of el.querySelectorAll(".mn-chord")){let name=text(c);if(name&&!chords.includes(name))chords.push(name)}return{type:"chart",title:text(el.querySelector(".mn-chart-title")),chords,sections:[...el.querySelectorAll(".mn-section-label")].map((s)=>text(s)??"")}}function strum(svg){let tempo=svg.getAttribute("data-mn-tempo"),swing=svg.getAttribute("data-mn-swing");return{type:"strum",title:text(svg.querySelector(".mn-title")),pattern:svg.getAttribute("data-mn-strum")??"",time:svg.getAttribute("data-mn-time")??"",subdivision:svg.getAttribute("data-mn-subdivision")??"",tempo:tempo===null?null:Number(tempo),...swing===null?{}:{swing:Number(swing)},chords:[...svg.querySelectorAll("[data-mn-beat][data-mn-chord]")].map((el)=>({beat:Number(el.getAttribute("data-mn-beat")),chord:el.getAttribute("data-mn-chord")??""}))}}function describeBlock(el){return[...el.querySelectorAll("svg.mn-svg, .mn-chart, .mn-cell.mn-error")].map((d)=>{if(has(d,"mn-error"))return{type:"error",message:(text(d.querySelector(".mn-error-message"))??"").replace(/^[a-z]+, /,"")};if(has(d,"mn-chart"))return chart(d);if(has(d,"mn-circle"))return{type:"circle",key:d.getAttribute("data-mn-set"),chords:[...d.querySelectorAll(".mn-circle-chip")].map((c)=>`${text(c.querySelector("title"))?.replace(": "," ")??""}`)};if(has(d,"mn-fretboard"))return fretboard(d);if(has(d,"mn-keyboard"))return keyboard(d);if(has(d,"mn-strum"))return strum(d);return guitarChord(d)})}var quoted=(s)=>s?`"${s}"`:null,listed=(parts)=>parts.filter(Boolean).join(", "),extra=(label,root,more=[])=>[label!==null?`"${label}"`:null,root?"root":null,...more].filter(Boolean).join(" "),capoText=(capo,from)=>`capo ${capo}${from==="nut"?", frets from the nut":""}`;function formatDiagram(d,n){let head=`${n}. `,pad=" ".repeat(head.length);switch(d.type){case"error":return[`${head}error: ${d.message}`];case"circle":return[`${head}${listed(["circle of fifths",d.key,`chords ${d.chords.join(", ")}`])}`];case"strum":return[`${head}${listed(["strumming pattern",quoted(d.title),d.time,d.subdivision,d.swing!==void 0&&(Math.abs(d.swing-0.6666666666666666)<0.001?"swing":`swing ${Math.round(d.swing*100)}%`),d.tempo!==null&&`tempo ${d.tempo}`])}`,`${pad}${d.pattern}`];case"chart":return[`${head}${listed(["chart",quoted(d.title),d.sections.length>0&&`sections ${d.sections.join(", ")}`,`chords ${d.chords.join(" ")||"none"}`])}`];case"guitar-chord":{let strings=d.strings.map((s)=>`${s.string} ${s.fret===null?"x":[s.fret,s.note,extra(s.label,s.root,s.mark?[s.mark]:[])].filter((p)=>p!==null&&p!=="").join(" ")}`);return[`${head}${listed(["chord diagram",quoted(d.title),d.chord&&`chord ${d.chord}`,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),d.sounds!==void 0&&`sounds ${d.sounds}`,`frets ${d.fretRange[0]}-${d.fretRange[1]}`,d.frets,...(d.barres??[]).map((b)=>`barre ${b.finger} at fret ${b.fret}, strings ${b.from} to ${b.to}`)])}`,`${pad}strings: ${strings.join(" | ")}`]}case"fretboard":{let lines=[`${head}${listed(["fretboard",quoted(d.title),d.notes,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),`frets ${d.fretRange[0]}-${d.fretRange[1]}`,`tuning ${d.tuning.join(" ")}`])}`],count=d.tuning.length;for(let string=count;string>=1;string--){let dots=d.dots.filter((dot)=>dot.string===string);if(!dots.length)continue;let name=d.tuning[count-string]??"?";lines.push(`${pad}string ${string} (${name}): ${dots.map((dot)=>[dot.fret,dot.note,extra(dot.label,dot.root,dot.marks)].filter((p)=>p!=="").join(" ")).join(", ")}`)}if(d.ghosts.length)lines.push(`${pad}ghosts (compared scale): ${d.ghosts.map((g)=>`string ${g.string} fret ${g.fret} ${g.note}`).join(", ")}`);return lines}case"keyboard":return[`${head}${listed(["keyboard",quoted(d.title),d.chord&&`chord ${d.chord}`,d.notes,`keys ${d.keyRange[0]}-${d.keyRange[1]}`])}`,`${pad}keys: ${d.keys.map((k)=>[k.note,extra(k.label,k.root,[...k.finger?[`finger ${k.finger}`]:[],...k.hand?[`${k.hand} hand`]:[],...k.marks])].filter(Boolean).join(" ")).join(", ")||"none"}`,...d.ghosts.length?[`${pad}ghosts (compared scale): ${d.ghosts.join(", ")}`]:[]]}}var DIAGRAM_LANGUAGES=["chord","keyboard","fretboard"],oneLine=(s)=>s.split(/[\r\n]+/).map((line)=>line.trim()).filter(Boolean).join(" ");function checkNote(file,text,doc){let note=parseMarkdown(text),reports=[];for(let block of note.blocks){let{language,line,source}=block,report=(status,message,diagrams=[])=>reports.push({file,line,language,status,message,diagrams}),isTab=language==="tab"||language==="score";if((isTab||isNotationLanguage(language))&&!source.trim()){if(note.frontMatter!==null&&DIAGRAM_LANGUAGES.includes(language))report("skipped","empty block: draws from the note's properties, not checked");else report("empty","empty block: draws nothing");continue}if(isTab){try{parseTabSource(language,source),report("skipped","alphaTex is not checked (it needs alphaTab)")}catch(e){report("error",oneLine(e instanceof Error?e.message:String(e)))}continue}if(!isNotationLanguage(language))continue;let host=doc.createElement("div"),result=renderBlock(language,source,host,{voicings:lookupGuitarVoicing}),diagrams=describeBlock(result.el);if(result.ok)report("ok",null,diagrams);else report("error",oneLine(result.error??"error"),diagrams);result.destroy()}return reports}function summarize(files,reports){let count=(status)=>reports.filter((r)=>r.status===status).length;return{files,blocks:reports.length,ok:count("ok"),errors:count("error"),skipped:count("skipped"),empty:count("empty")}}var formatError=(r)=>`${r.file}:${r.line}: ${r.language}: ${r.message}`;function formatReport(r){let where=`${r.file}:${r.line}: ${r.language}`;return r.status==="ok"?`${where}: ok`:`${where}: ${r.status}: ${r.message??""}`}function formatDescription(r){return[formatReport(r),...r.diagrams.flatMap((d,i)=>formatDiagram(d,i+1)).map((l)=>` ${l}`)]}var GLOB=/[*?[{]/;function globToRegExp(pattern){let out="";for(let i=0;i<pattern.length;i++){let c=pattern[i];if(c==="*"&&pattern[i+1]==="*"){let slash=pattern[i+2]==="/";out+=slash?"(?:.*/)?":".*",i+=slash?2:1}else if(c==="*")out+="[^/]*";else if(c==="?")out+="[^/]";else if(c==="{"){let end=pattern.indexOf("}",i);if(end<0)out+="\\{";else out+=`(?:${pattern.slice(i+1,end).split(",").map((p)=>p.replace(/[.+^$()|\\]/g,"\\$&").replace(/\*/g,"[^/]*")).join("|")})`,i=end}else if(c==="["){let end=pattern.indexOf("]",i+1);if(end<0)out+="\\[";else out+=`[${pattern.slice(i+1,end).replace(/^!/,"^").replace(/\\/g,"\\\\")}]`,i=end}else out+=c.replace(/[.+^$()|\\\]}]/g,"\\$&")}return new RegExp(`^${out}$`)}async function walk(dir){let entries=await readdir(dir,{withFileTypes:!0}),files=[];for(let entry of entries.sort((a,b)=>a.name.localeCompare(b.name))){let path=join(dir,entry.name);if(entry.isDirectory()){if(!entry.name.startsWith(".")&&entry.name!=="node_modules")files.push(...await walk(path))}else if(entry.isFile())files.push(path)}return files}var isMarkdown=(path)=>/\.(md|markdown)$/i.test(path);async function expand(arg,cwd){let pattern=arg.replace(/\\/g,"/"),path=resolve(cwd,arg),info=await stat(path).catch(()=>null);if(info)return info.isDirectory()?(await walk(path)).filter(isMarkdown):[path];if(!GLOB.test(pattern))throw Error(`${arg}: no such file or folder`);let segments=pattern.split("/"),first=segments.findIndex((s)=>GLOB.test(s)),base=resolve(cwd,segments.slice(0,first).join("/")||"."),matcher=globToRegExp(segments.slice(first).join("/"));if(!(await stat(base).catch(()=>null))?.isDirectory())return[];return(await walk(base)).filter((f)=>matcher.test(relative(base,f).replace(/\\/g,"/")))}var USAGE=`Usage: music-notation check [options] <files, folders or globs...>
|
|
53
|
+
`)})}return{frontMatter,blocks}}import{chordNoteSet,midiOf,nameOf,noteOf}from"./index.js";var classes=(el)=>(el.getAttribute("class")??"").split(/\s+/),has=(el,cls)=>classes(el).includes(cls),text=(el)=>el?.textContent?.trim()||null,int=(value)=>value===null?null:Number(value),marksOf=(el)=>classes(el).flatMap((c)=>c==="mn-char"?["characteristic"]:c==="mn-diff"?["different"]:c==="mn-tone"?["chord tone"]:c==="mn-passing"?["passing"]:[]);function spelled(name,midi){let octave=Math.floor(midi/12)-1;for(let o of[octave,octave-1,octave+1])if(midiOf(`${name}${o}`)===midi)return`${name}${o}`;return noteOf(midi)}var labelAfter=(el,cls)=>{let next=el.nextElementSibling;return next&&has(next,cls)?text(next):null};function capoOf(svg){let capo=int(svg.getAttribute("data-mn-capo"));if(!capo)return{};return{capo,fretsFrom:svg.getAttribute("data-mn-frets-from")==="nut"?"nut":"capo"}}function guitarChord(svg){let chord=svg.getAttribute("data-mn-chord"),sounds=svg.getAttribute("data-mn-sounds"),set=sounds?chordNoteSet(sounds):chord?chordNoteSet(chord):null,strings=[...svg.querySelectorAll("[data-mn-string]")].map((el)=>{let fret=int(el.getAttribute("data-mn-fret")),midi=int(el.getAttribute("data-midi")),name=midi===null?null:set?.members.find((m)=>m.chroma===midi%12)?.name??nameOf(midi,set?.preferFlats);return{string:Number(el.getAttribute("data-mn-string")),fret,note:name!==null&&midi!==null?spelled(name,midi):null,label:fret?labelAfter(el,"mn-dot-text"):null,root:has(el,"mn-root"),mark:has(el,"mn-anchor")?"anchor":has(el,"mn-guide")?"guide":null}}),base=parseInt(text(svg.querySelector(".mn-base-fret"))??"1",10),rows=svg.querySelectorAll("line.mn-fret, line.mn-nut").length-1,frets=strings.map((s)=>s.fret===null?"x":String(s.fret)),barres=[...svg.querySelectorAll(".mn-barre")].map((el)=>({finger:el.getAttribute("data-mn-finger")??"",fret:Number(el.getAttribute("data-mn-fret")),from:Number(el.getAttribute("data-mn-from")),to:Number(el.getAttribute("data-mn-to"))}));return{type:"guitar-chord",title:text(svg.querySelector(".mn-title")),chord,frets:frets.join(frets.some((f)=>f.length>1)?"-":""),fretRange:[base,base+rows-1],strings,...capoOf(svg),...sounds?{sounds}:{},...barres.length?{barres}:{}}}function fretboard(svg){let range=(svg.getAttribute("data-mn-frets")??"0-0").split("-").map(Number),tuning=[...svg.querySelectorAll(".mn-string-name")].map((el)=>text(el)??"?"),dots=[...svg.querySelectorAll("circle[data-mn-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-midi"))),label:labelAfter(el,"mn-dot-text"),root:has(el,"mn-root"),marks:marksOf(el)})).sort((a,b)=>b.string-a.string||a.fret-b.fret),ghosts=[...svg.querySelectorAll("circle[data-mn-ghost-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-ghost-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-mn-pitch")))})).sort((a,b)=>b.string-a.string||a.fret-b.fret);return{type:"fretboard",title:text(svg.querySelector(".mn-title")),notes:svg.getAttribute("data-mn-set"),fretRange:[range[0]??0,range[1]??0],tuning:tuning.reverse(),dots,ghosts,...capoOf(svg)}}function keyboard(svg){let all=[...svg.querySelectorAll("rect[data-midi]")],midis=all.map((el)=>Number(el.getAttribute("data-midi"))),fingers=new Map([...svg.querySelectorAll(".mn-key-finger")].map((el)=>[Number(el.getAttribute("data-mn-key")),text(el)])),keys=all.filter((el)=>has(el,"mn-on")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return{midi,note:spelled(el.getAttribute("data-mn-note")??"",midi),label:labelAfter(el,"mn-key-label"),finger:fingers.get(midi)??null,root:has(el,"mn-root"),marks:marksOf(el),...has(el,"mn-hand-left")?{hand:"left"}:has(el,"mn-hand-right")?{hand:"right"}:{}}}).sort((a,b)=>a.midi-b.midi).map(({midi:_,...key})=>key);return{type:"keyboard",title:text(svg.querySelector(".mn-title")),chord:svg.getAttribute("data-mn-chord"),notes:svg.getAttribute("data-mn-set"),keyRange:[noteOf(Math.min(...midis)),noteOf(Math.max(...midis))],keys,ghosts:all.filter((el)=>has(el,"mn-ghost")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return spelled(el.getAttribute("data-mn-note")??"",midi)})}}function chart(el){let chords=[];for(let c of el.querySelectorAll(".mn-chord")){let name=text(c);if(name&&!chords.includes(name))chords.push(name)}return{type:"chart",title:text(el.querySelector(".mn-chart-title")),chords,sections:[...el.querySelectorAll(".mn-section-label")].map((s)=>text(s)??"")}}function strum(svg){let tempo=svg.getAttribute("data-mn-tempo"),swing=svg.getAttribute("data-mn-swing");return{type:"strum",title:text(svg.querySelector(".mn-title")),pattern:svg.getAttribute("data-mn-strum")??"",time:svg.getAttribute("data-mn-time")??"",subdivision:svg.getAttribute("data-mn-subdivision")??"",tempo:tempo===null?null:Number(tempo),...swing===null?{}:{swing:Number(swing)},chords:[...svg.querySelectorAll("[data-mn-beat][data-mn-chord]")].map((el)=>({beat:Number(el.getAttribute("data-mn-beat")),chord:el.getAttribute("data-mn-chord")??""}))}}function picking(svg){let tempo=svg.getAttribute("data-mn-tempo"),swing=svg.getAttribute("data-mn-swing"),slots=[...svg.querySelectorAll("[data-mn-beat]")],count=Number(svg.getAttribute("data-mn-strings"))||6;return{type:"picking",title:text(svg.querySelector(".mn-title")),pattern:svg.getAttribute("data-mn-picking")??"",time:svg.getAttribute("data-mn-time")??"",subdivision:svg.getAttribute("data-mn-subdivision")??"",tempo:tempo===null?null:Number(tempo),...swing===null?{}:{swing:Number(swing)},chords:slots.filter((el)=>el.hasAttribute("data-mn-chord")).map((el)=>({bar:Number(el.getAttribute("data-mn-bar")),chord:el.getAttribute("data-mn-chord")??""})),notes:slots.map((el)=>{let notes=(el.getAttribute("data-mn-notes")??"").split(" ").filter(Boolean);return notes.length?notes.map((n)=>{let[string,fret]=n.split(":");return`${count-Number(string)}:${fret}`}).join("+"):"-"})}}function describeBlock(el){return[...el.querySelectorAll("svg.mn-svg, .mn-chart, .mn-cell.mn-error, .mn-exercise, .mn-exercise-tab")].map((d)=>{if(has(d,"mn-exercise")||has(d,"mn-exercise-tab"))return{type:"exercise",direction:d.getAttribute("data-mn-exercise")??"",rhythm:d.getAttribute("data-mn-rhythm")??"",tempo:Number(d.getAttribute("data-mn-tempo")),notes:(d.getAttribute("data-mn-notes")??"").split(" ").filter(Boolean)};if(has(d,"mn-error"))return{type:"error",message:(text(d.querySelector(".mn-error-message"))??"").replace(/^[a-z]+, /,"")};if(has(d,"mn-chart"))return chart(d);if(has(d,"mn-circle"))return{type:"circle",key:d.getAttribute("data-mn-set"),chords:[...d.querySelectorAll(".mn-circle-chip")].map((c)=>`${text(c.querySelector("title"))?.replace(": "," ")??""}`)};if(has(d,"mn-fretboard"))return fretboard(d);if(has(d,"mn-keyboard"))return keyboard(d);if(has(d,"mn-strum"))return strum(d);if(has(d,"mn-picking"))return picking(d);return guitarChord(d)})}var quoted=(s)=>s?`"${s}"`:null,listed=(parts)=>parts.filter(Boolean).join(", "),extra=(label,root,more=[])=>[label!==null?`"${label}"`:null,root?"root":null,...more].filter(Boolean).join(" "),capoText=(capo,from)=>`capo ${capo}${from==="nut"?", frets from the nut":""}`;function formatDiagram(d,n){let head=`${n}. `,pad=" ".repeat(head.length);switch(d.type){case"error":return[`${head}error: ${d.message}`];case"exercise":return[`${head}${listed(["exercise",d.direction,d.rhythm,`tempo ${d.tempo}`,`${d.notes.length} notes`])}`,`${pad}${d.notes.join(" ")}`];case"circle":return[`${head}${listed(["circle of fifths",d.key,`chords ${d.chords.join(", ")}`])}`];case"strum":return[`${head}${listed(["strumming pattern",quoted(d.title),d.time,d.subdivision,d.swing!==void 0&&(Math.abs(d.swing-0.6666666666666666)<0.001?"swing":`swing ${Math.round(d.swing*100)}%`),d.tempo!==null&&`tempo ${d.tempo}`])}`,`${pad}${d.pattern}`];case"picking":return[`${head}${listed(["picking pattern",quoted(d.title),d.time,d.subdivision,d.swing!==void 0&&`swing ${Math.round(d.swing*100)}%`,d.tempo!==null&&`tempo ${d.tempo}`,d.chords.length>0&&`chords ${d.chords.map((c)=>`${c.chord} (bar ${c.bar+1})`).join(" ")}`])}`,`${pad}${d.pattern}`,`${pad}notes (string:fret) ${d.notes.join(" ")}`];case"chart":return[`${head}${listed(["chart",quoted(d.title),d.sections.length>0&&`sections ${d.sections.join(", ")}`,`chords ${d.chords.join(" ")||"none"}`])}`];case"guitar-chord":{let strings=d.strings.map((s)=>`${s.string} ${s.fret===null?"x":[s.fret,s.note,extra(s.label,s.root,s.mark?[s.mark]:[])].filter((p)=>p!==null&&p!=="").join(" ")}`);return[`${head}${listed(["chord diagram",quoted(d.title),d.chord&&`chord ${d.chord}`,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),d.sounds!==void 0&&`sounds ${d.sounds}`,`frets ${d.fretRange[0]}-${d.fretRange[1]}`,d.frets,...(d.barres??[]).map((b)=>`barre ${b.finger} at fret ${b.fret}, strings ${b.from} to ${b.to}`)])}`,`${pad}strings: ${strings.join(" | ")}`]}case"fretboard":{let lines=[`${head}${listed(["fretboard",quoted(d.title),d.notes,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),`frets ${d.fretRange[0]}-${d.fretRange[1]}`,`tuning ${d.tuning.join(" ")}`])}`],count=d.tuning.length;for(let string=count;string>=1;string--){let dots=d.dots.filter((dot)=>dot.string===string);if(!dots.length)continue;let name=d.tuning[count-string]??"?";lines.push(`${pad}string ${string} (${name}): ${dots.map((dot)=>[dot.fret,dot.note,extra(dot.label,dot.root,dot.marks)].filter((p)=>p!=="").join(" ")).join(", ")}`)}if(d.ghosts.length)lines.push(`${pad}ghosts (compared scale): ${d.ghosts.map((g)=>`string ${g.string} fret ${g.fret} ${g.note}`).join(", ")}`);return lines}case"keyboard":return[`${head}${listed(["keyboard",quoted(d.title),d.chord&&`chord ${d.chord}`,d.notes,`keys ${d.keyRange[0]}-${d.keyRange[1]}`])}`,`${pad}keys: ${d.keys.map((k)=>[k.note,extra(k.label,k.root,[...k.finger?[`finger ${k.finger}`]:[],...k.hand?[`${k.hand} hand`]:[],...k.marks])].filter(Boolean).join(" ")).join(", ")||"none"}`,...d.ghosts.length?[`${pad}ghosts (compared scale): ${d.ghosts.join(", ")}`]:[]]}}var DIAGRAM_LANGUAGES=["chord","keyboard","fretboard"],oneLine=(s)=>s.split(/[\r\n]+/).map((line)=>line.trim()).filter(Boolean).join(" ");function checkNote(file,text,doc){let note=parseMarkdown(text),reports=[];for(let block of note.blocks){let{language,line,source}=block,report=(status,message,diagrams=[])=>reports.push({file,line,language,status,message,diagrams}),isTab=language==="tab"||language==="score";if((isTab||isNotationLanguage(language))&&!source.trim()){if(note.frontMatter!==null&&DIAGRAM_LANGUAGES.includes(language))report("skipped","empty block: draws from the note's properties, not checked");else report("empty","empty block: draws nothing");continue}if(isTab){try{parseTabSource(language,source),report("skipped","alphaTex is not checked (it needs alphaTab)")}catch(e){report("error",oneLine(e instanceof Error?e.message:String(e)))}continue}if(!isNotationLanguage(language))continue;let host=doc.createElement("div"),result=renderBlock(language,source,host,{voicings:lookupGuitarVoicing}),diagrams=describeBlock(result.el);if(result.ok)report("ok",null,diagrams);else report("error",oneLine(result.error??"error"),diagrams);result.destroy()}return reports}function summarize(files,reports){let count=(status)=>reports.filter((r)=>r.status===status).length;return{files,blocks:reports.length,ok:count("ok"),errors:count("error"),skipped:count("skipped"),empty:count("empty")}}var formatError=(r)=>`${r.file}:${r.line}: ${r.language}: ${r.message}`;function formatReport(r){let where=`${r.file}:${r.line}: ${r.language}`;return r.status==="ok"?`${where}: ok`:`${where}: ${r.status}: ${r.message??""}`}function formatDescription(r){return[formatReport(r),...r.diagrams.flatMap((d,i)=>formatDiagram(d,i+1)).map((l)=>` ${l}`)]}var GLOB=/[*?[{]/;function globToRegExp(pattern){let out="";for(let i=0;i<pattern.length;i++){let c=pattern[i];if(c==="*"&&pattern[i+1]==="*"){let slash=pattern[i+2]==="/";out+=slash?"(?:.*/)?":".*",i+=slash?2:1}else if(c==="*")out+="[^/]*";else if(c==="?")out+="[^/]";else if(c==="{"){let end=pattern.indexOf("}",i);if(end<0)out+="\\{";else out+=`(?:${pattern.slice(i+1,end).split(",").map((p)=>p.replace(/[.+^$()|\\]/g,"\\$&").replace(/\*/g,"[^/]*")).join("|")})`,i=end}else if(c==="["){let end=pattern.indexOf("]",i+1);if(end<0)out+="\\[";else out+=`[${pattern.slice(i+1,end).replace(/^!/,"^").replace(/\\/g,"\\\\")}]`,i=end}else out+=c.replace(/[.+^$()|\\\]}]/g,"\\$&")}return new RegExp(`^${out}$`)}async function walk(dir){let entries=await readdir(dir,{withFileTypes:!0}),files=[];for(let entry of entries.sort((a,b)=>a.name.localeCompare(b.name))){let path=join(dir,entry.name);if(entry.isDirectory()){if(!entry.name.startsWith(".")&&entry.name!=="node_modules")files.push(...await walk(path))}else if(entry.isFile())files.push(path)}return files}var isMarkdown=(path)=>/\.(md|markdown)$/i.test(path);async function expand(arg,cwd){let pattern=arg.replace(/\\/g,"/"),path=resolve(cwd,arg),info=await stat(path).catch(()=>null);if(info)return info.isDirectory()?(await walk(path)).filter(isMarkdown):[path];if(!GLOB.test(pattern))throw Error(`${arg}: no such file or folder`);let segments=pattern.split("/"),first=segments.findIndex((s)=>GLOB.test(s)),base=resolve(cwd,segments.slice(0,first).join("/")||"."),matcher=globToRegExp(segments.slice(first).join("/"));if(!(await stat(base).catch(()=>null))?.isDirectory())return[];return(await walk(base)).filter((f)=>matcher.test(relative(base,f).replace(/\\/g,"/")))}var USAGE=`Usage: music-notation check [options] <files, folders or globs...>
|
|
54
54
|
|
|
55
|
-
Renders every chord, chords, keyboard, fretboard
|
|
56
|
-
and reports each mistake as file:line: language: message.
|
|
55
|
+
Renders every chord, chords, keyboard, fretboard, strum, picking, progression and circle block
|
|
56
|
+
of Markdown files and reports each mistake as file:line: language: message.
|
|
57
57
|
|
|
58
58
|
Options:
|
|
59
59
|
--describe also print what each block draws (titles, chords, notes, frets, keys)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scale positions and arpeggios as tab exercises (#47): the notes of one position, in playing
|
|
3
|
+
* order, as alphaTex for a `tab` block, so the run plays in time with alphaTab's count-in,
|
|
4
|
+
* metronome and speed control.
|
|
5
|
+
*
|
|
6
|
+
* - The notes are the position's dots (`scalePosition`), each pitch once, string by string.
|
|
7
|
+
* - `up` plays them from the lowest to the highest, `down` from the highest to the lowest.
|
|
8
|
+
* - `both` (up and down) plays them in the order a diagram plays a scale (#61): from the lowest
|
|
9
|
+
* root up to the highest note, down to the lowest note, back up to that root; the top and the
|
|
10
|
+
* bottom note once each. With the root lowest, that is up and back down.
|
|
11
|
+
* - Rhythms in 4/4 (the metronome clicks quarters): 8ths (8 notes a bar), triplets (3 eighths a
|
|
12
|
+
* beat, 12 a bar, as tuplets), 16ths (16 a bar). The last bar ends with rests.
|
|
13
|
+
*/
|
|
14
|
+
import { type NoteSet } from '../theory/note-set.js';
|
|
15
|
+
import { type Cell, type Numbering, type PositionSystem } from './positions.js';
|
|
16
|
+
export type ExerciseDirection = 'up' | 'down' | 'both';
|
|
17
|
+
export type ExerciseRhythm = '8ths' | 'triplets' | '16ths';
|
|
18
|
+
/** A scale (`A minor pentatonic`), a chord's arpeggio (`Am7`), or a note set of either. */
|
|
19
|
+
export type ExerciseNotes = {
|
|
20
|
+
scale: string;
|
|
21
|
+
} | {
|
|
22
|
+
arpeggio: string;
|
|
23
|
+
} | NoteSet;
|
|
24
|
+
export interface ExerciseOptions {
|
|
25
|
+
/** Position 1 to 5 (CAGED, boxes) or 1 to 7 (3NPS); 1 by default. */
|
|
26
|
+
position?: number;
|
|
27
|
+
/** `E`, `D`, `C`, `A`, `G` (a CAGED shape) or `3nps`, as the fretboard block's `shape:`. */
|
|
28
|
+
shape?: string;
|
|
29
|
+
/** Up and down by default. */
|
|
30
|
+
direction?: ExerciseDirection;
|
|
31
|
+
/** 8ths by default. */
|
|
32
|
+
rhythm?: ExerciseRhythm;
|
|
33
|
+
/** Open strings (MIDI, lowest first) or a tuning name (`drop d`); standard by default. */
|
|
34
|
+
tuning?: number[] | string;
|
|
35
|
+
/** Quarters a minute, 20 to 240 (rounded); 60 by default. */
|
|
36
|
+
tempo?: number;
|
|
37
|
+
/** The lowest octave of the position inside these frets (else the lowest one). */
|
|
38
|
+
frets?: [number, number];
|
|
39
|
+
/** `minor` numbers a major pentatonic's positions from its relative minor. */
|
|
40
|
+
numbering?: Numbering;
|
|
41
|
+
/** A title over the tab. */
|
|
42
|
+
title?: string;
|
|
43
|
+
}
|
|
44
|
+
/** The tempo of an exercise without one: slow enough to learn the run. */
|
|
45
|
+
export declare const DEFAULT_EXERCISE_TEMPO = 60;
|
|
46
|
+
/** Reads `exercise:`: up, down, or up-down (also `both`, `up and down`). */
|
|
47
|
+
export declare function parseDirection(text: string): ExerciseDirection;
|
|
48
|
+
/** Reads `rhythm:`: 8ths, triplets or 16ths. */
|
|
49
|
+
export declare function parseRhythm(text: string): ExerciseRhythm;
|
|
50
|
+
/**
|
|
51
|
+
* The cells of a run in playing order: each pitch once (on the lowest string that has it), then
|
|
52
|
+
* up, down, or up and down from the lowest root (`root`, a pitch class; null: from the lowest note).
|
|
53
|
+
*/
|
|
54
|
+
export declare function exerciseRun(cells: Cell[], tuning: number[], root: number | null, direction: ExerciseDirection): Cell[];
|
|
55
|
+
/**
|
|
56
|
+
* alphaTex for a run of cells: the tempo, the tuning when it isn't standard, 4/4, then the notes
|
|
57
|
+
* (`fret.string`, strings counted from the highest) bar by bar, the last bar filled with rests.
|
|
58
|
+
*/
|
|
59
|
+
export declare function exerciseTex(run: Cell[], tuning: number[], options?: {
|
|
60
|
+
rhythm?: ExerciseRhythm;
|
|
61
|
+
tempo?: number;
|
|
62
|
+
title?: string;
|
|
63
|
+
}): string;
|
|
64
|
+
/**
|
|
65
|
+
* Where a scale's or arpeggio's position is: a numbered position of a 5-note scale is a box, of
|
|
66
|
+
* a 7-note scale and of an arpeggio a CAGED shape; `shape:` picks CAGED shapes or 3NPS. Throws when
|
|
67
|
+
* the set has no positions (a list) or the position doesn't exist.
|
|
68
|
+
*/
|
|
69
|
+
export declare function exercisePosition(set: NoteSet, tuning: number[], at: {
|
|
70
|
+
system: PositionSystem;
|
|
71
|
+
n: number;
|
|
72
|
+
}, options?: {
|
|
73
|
+
frets?: [number, number];
|
|
74
|
+
numbering?: Numbering;
|
|
75
|
+
}): Cell[];
|
|
76
|
+
/**
|
|
77
|
+
* A scale position or an arpeggio as a tab exercise: alphaTex for a `tab` block (see the module
|
|
78
|
+
* comment for the order and the rhythms). Pure; throws a message saying what to write instead.
|
|
79
|
+
*/
|
|
80
|
+
export declare function exerciseTab(notes: ExerciseNotes, options?: ExerciseOptions): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,15 +29,21 @@ export { parseChordName, readChord, suggestChords } from './theory/chord-name.js
|
|
|
29
29
|
export { detectChordFromFrets, detectChordFromPitches, type DetectedChord } from './theory/detect.js';
|
|
30
30
|
export { scaleName, modesOf, scaleTypes, characteristicIntervals, isScaleWithoutRoot } from './theory/scales.js';
|
|
31
31
|
export { scalePosition, neckPositions, isArpeggio, positionCount, CAGED_SHAPES, MAX_FRET, type Cell, type Numbering, type PositionOptions, type PositionSystem } from './fretboard/positions.js';
|
|
32
|
+
export { exerciseTab, exerciseRun, exerciseTex, exercisePosition, parseDirection, parseRhythm, DEFAULT_EXERCISE_TEMPO, type ExerciseDirection, type ExerciseRhythm, type ExerciseNotes, type ExerciseOptions } from './fretboard/exercise.js';
|
|
32
33
|
export { blockFromProperties, instrumentOf, DEFAULT_PROPERTY_NAMES, type PropertyNames, type Instrument } from './blocks/properties.js';
|
|
33
34
|
export { textTabToAlphaTex } from './convert/text-tab.js';
|
|
34
35
|
export { chordSheetToChordPro } from './convert/chord-sheet.js';
|
|
35
36
|
export { parseStrum, formatStrum, countOf, parseTime, parseSubdivision, parseSwing, isCompound, MAX_STRUM_BARS, type StrumPattern, type StrumSlot, type Stroke, type Subdivision } from './strum/pattern.js';
|
|
36
37
|
export { renderStrum, type StrumOptions } from './strum/render.js';
|
|
37
38
|
export { strumVoicing, DEFAULT_STRUM_CHORD } from './strum/voicing.js';
|
|
38
|
-
export { playStrum, strumEvents, scoreOf, STRUM_VELOCITY, STRUM_STRESS, strumVelocity, tempoOf, type PlayStrumOptions, type StrumEventOptions, type StrumScore } from './strum/play.js';
|
|
39
|
+
export { playStrum, runPasses, strumEvents, scoreOf, STRUM_VELOCITY, STRUM_STRESS, strumVelocity, tempoOf, type Pass, type PassMaker, type PlayStrumOptions, type StrumEventOptions, type StrumFollower, type StrumSettings, type StrumTiming, type StrumScore } from './strum/play.js';
|
|
40
|
+
export { playProgression, progressionEvents, progressionPitches, runProgression, followTimes, PROGRESSION_STRUMS, MAX_PROGRESSION_BARS, type PlayProgressionOptions, type ProgressionBar, type ProgressionChanges, type ProgressionChordInput, type ProgressionEventOptions, type ProgressionHandle, type ProgressionSettings, type ProgressionStrum } from './playback/progression.js';
|
|
39
41
|
export { findScales, findKey, inKey, scalesForChord, chordsInScale, bluesTonic, BLUES_SCALES, type ScaleMatch, type FindScalesOptions, type KeyCandidate, type FoundKey, type ScaleChord } from './theory/find.js';
|
|
40
42
|
export { readKey, keyNotes, keySignature, keyChords, parentMajor, signatureText, keyProblem, MAX_SIGNATURE, MODES, type Mode, type MusicalKey, type KeySignature, type KeyChord } from './theory/keys.js';
|
|
41
43
|
export { progressionChords, progressionChord, readNumeral, numeralOf, harmonicFunction, isBluesIn, withTonicizations, type NumeralOptions, type ProgressionChord, type HarmonicFunction } from './theory/numerals.js';
|
|
42
44
|
export { voiceLead, voiceLeadVoicings, voiceMotion, type VoiceLeadOptions, type LedVoicing } from './keyboard/voice-leading.js';
|
|
43
45
|
export { renderCircle, type CircleOptions } from './circle/circle.js';
|
|
46
|
+
export { parsePicking, formatPicking, namedPicking, pluckText, PICKING_PATTERNS, MAX_PICKING_BARS, type PickingPattern, type PickingSlot, type Pluck } from './picking/pattern.js';
|
|
47
|
+
export { pickingFrets, pluckNote, type PickedNote } from './picking/voicing.js';
|
|
48
|
+
export { playPicking, pickingEvents, pickingScore, PICKING_VELOCITY, type PickingEventOptions, type PickingScore, type PickingScoreOptions, type PlayPickingOptions } from './picking/play.js';
|
|
49
|
+
export { renderPicking, type PickingOptions } from './picking/render.js';
|