diff --git a/articles/demo.md b/articles/demo.md index 3e394ef..0ee4409 100644 --- a/articles/demo.md +++ b/articles/demo.md @@ -12,12 +12,24 @@ function func(a, b) { } ``` +[mermaid API](https://mermaid.js.org/config/setup/modules/mermaidAPI.html) + +
+ graph TD + A[Client] --> B[Load Balancer] + B --> C[Server01] + B --> D[Server02] ++
+flowchart LR + A --> B ++ [What's In A Class?] [1]
} */
+ let marker;
+ return start
+
+ /**
+ * Before a sequence.
+ *
+ * ```markdown
+ * > | **
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ marker = code;
+ effects.enter('attentionSequence');
+ return inside(code)
+ }
+
+ /**
+ * In a sequence.
+ *
+ * ```markdown
+ * > | **
+ * ^^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === marker) {
+ effects.consume(code);
+ return inside
+ }
+ const token = effects.exit('attentionSequence');
+
+ // To do: next major: move this to resolver, just like `markdown-rs`.
+ const after = classifyCharacter(code);
+
+ // Always populated by defaults.
+
+ const open =
+ !after || (after === 2 && before) || attentionMarkers.includes(code);
+ const close =
+ !before || (before === 2 && after) || attentionMarkers.includes(previous);
+ token._open = Boolean(marker === 42 ? open : open && (before || !close));
+ token._close = Boolean(marker === 42 ? close : close && (after || !open));
+ return ok(code)
+ }
+}
+
+/**
+ * Move a point a bit.
+ *
+ * Note: `move` only works inside lines! It’s not possible to move past other
+ * chunks (replacement characters, tabs, or line endings).
+ *
+ * @param {Point} point
+ * @param {number} offset
+ * @returns {void}
+ */
+function movePoint(point, offset) {
+ point.column += offset;
+ point.offset += offset;
+ point._bufferIndex += offset;
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const autolink = {
+ name: 'autolink',
+ tokenize: tokenizeAutolink
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeAutolink(effects, ok, nok) {
+ let size = 0;
+ return start
+
+ /**
+ * Start of an autolink.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('autolink');
+ effects.enter('autolinkMarker');
+ effects.consume(code);
+ effects.exit('autolinkMarker');
+ effects.enter('autolinkProtocol');
+ return open
+ }
+
+ /**
+ * After `<`, at protocol or atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return schemeOrEmailAtext
+ }
+ return emailAtext(code)
+ }
+
+ /**
+ * At second byte of protocol or atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function schemeOrEmailAtext(code) {
+ // ASCII alphanumeric and `+`, `-`, and `.`.
+ if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
+ // Count the previous alphabetical from `open` too.
+ size = 1;
+ return schemeInsideOrEmailAtext(code)
+ }
+ return emailAtext(code)
+ }
+
+ /**
+ * In ambiguous protocol or atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function schemeInsideOrEmailAtext(code) {
+ if (code === 58) {
+ effects.consume(code);
+ size = 0;
+ return urlInside
+ }
+
+ // ASCII alphanumeric and `+`, `-`, and `.`.
+ if (
+ (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) &&
+ size++ < 32
+ ) {
+ effects.consume(code);
+ return schemeInsideOrEmailAtext
+ }
+ size = 0;
+ return emailAtext(code)
+ }
+
+ /**
+ * After protocol, in URL.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function urlInside(code) {
+ if (code === 62) {
+ effects.exit('autolinkProtocol');
+ effects.enter('autolinkMarker');
+ effects.consume(code);
+ effects.exit('autolinkMarker');
+ effects.exit('autolink');
+ return ok
+ }
+
+ // ASCII control, space, or `<`.
+ if (code === null || code === 32 || code === 60 || asciiControl(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return urlInside
+ }
+
+ /**
+ * In email atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailAtext(code) {
+ if (code === 64) {
+ effects.consume(code);
+ return emailAtSignOrDot
+ }
+ if (asciiAtext(code)) {
+ effects.consume(code);
+ return emailAtext
+ }
+ return nok(code)
+ }
+
+ /**
+ * In label, after at-sign or dot.
+ *
+ * ```markdown
+ * > | ab
+ * ^ ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailAtSignOrDot(code) {
+ return asciiAlphanumeric(code) ? emailLabel(code) : nok(code)
+ }
+
+ /**
+ * In label, where `.` and `>` are allowed.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailLabel(code) {
+ if (code === 46) {
+ effects.consume(code);
+ size = 0;
+ return emailAtSignOrDot
+ }
+ if (code === 62) {
+ // Exit, then change the token type.
+ effects.exit('autolinkProtocol').type = 'autolinkEmail';
+ effects.enter('autolinkMarker');
+ effects.consume(code);
+ effects.exit('autolinkMarker');
+ effects.exit('autolink');
+ return ok
+ }
+ return emailValue(code)
+ }
+
+ /**
+ * In label, where `.` and `>` are *not* allowed.
+ *
+ * Though, this is also used in `emailLabel` to parse other values.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailValue(code) {
+ // ASCII alphanumeric or `-`.
+ if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
+ const next = code === 45 ? emailValue : emailLabel;
+ effects.consume(code);
+ return next
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const blankLine = {
+ tokenize: tokenizeBlankLine,
+ partial: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlankLine(effects, ok, nok) {
+ return start
+
+ /**
+ * Start of blank line.
+ *
+ * > 👉 **Note**: `␠` represents a space character.
+ *
+ * ```markdown
+ * > | ␠␠␊
+ * ^
+ * > | ␊
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ return markdownSpace(code)
+ ? factorySpace(effects, after, 'linePrefix')(code)
+ : after(code)
+ }
+
+ /**
+ * At eof/eol, after optional whitespace.
+ *
+ * > 👉 **Note**: `␠` represents a space character.
+ *
+ * ```markdown
+ * > | ␠␠␊
+ * ^
+ * > | ␊
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Exiter} Exiter
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const blockQuote = {
+ name: 'blockQuote',
+ tokenize: tokenizeBlockQuoteStart,
+ continuation: {
+ tokenize: tokenizeBlockQuoteContinuation
+ },
+ exit
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlockQuoteStart(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of block quote.
+ *
+ * ```markdown
+ * > | > a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === 62) {
+ const state = self.containerState;
+ if (!state.open) {
+ effects.enter('blockQuote', {
+ _container: true
+ });
+ state.open = true;
+ }
+ effects.enter('blockQuotePrefix');
+ effects.enter('blockQuoteMarker');
+ effects.consume(code);
+ effects.exit('blockQuoteMarker');
+ return after
+ }
+ return nok(code)
+ }
+
+ /**
+ * After `>`, before optional whitespace.
+ *
+ * ```markdown
+ * > | > a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ if (markdownSpace(code)) {
+ effects.enter('blockQuotePrefixWhitespace');
+ effects.consume(code);
+ effects.exit('blockQuotePrefixWhitespace');
+ effects.exit('blockQuotePrefix');
+ return ok
+ }
+ effects.exit('blockQuotePrefix');
+ return ok(code)
+ }
+}
+
+/**
+ * Start of block quote continuation.
+ *
+ * ```markdown
+ * | > a
+ * > | > b
+ * ^
+ * ```
+ *
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlockQuoteContinuation(effects, ok, nok) {
+ const self = this;
+ return contStart
+
+ /**
+ * Start of block quote continuation.
+ *
+ * Also used to parse the first block quote opening.
+ *
+ * ```markdown
+ * | > a
+ * > | > b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function contStart(code) {
+ if (markdownSpace(code)) {
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ contBefore,
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ }
+ return contBefore(code)
+ }
+
+ /**
+ * At `>`, after optional whitespace.
+ *
+ * Also used to parse the first block quote opening.
+ *
+ * ```markdown
+ * | > a
+ * > | > b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function contBefore(code) {
+ return effects.attempt(blockQuote, ok, nok)(code)
+ }
+}
+
+/** @type {Exiter} */
+function exit(effects) {
+ effects.exit('blockQuote');
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const characterEscape = {
+ name: 'characterEscape',
+ tokenize: tokenizeCharacterEscape
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCharacterEscape(effects, ok, nok) {
+ return start
+
+ /**
+ * Start of character escape.
+ *
+ * ```markdown
+ * > | a\*b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('characterEscape');
+ effects.enter('escapeMarker');
+ effects.consume(code);
+ effects.exit('escapeMarker');
+ return inside
+ }
+
+ /**
+ * After `\`, at punctuation.
+ *
+ * ```markdown
+ * > | a\*b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ // ASCII punctuation.
+ if (asciiPunctuation(code)) {
+ effects.enter('characterEscapeValue');
+ effects.consume(code);
+ effects.exit('characterEscapeValue');
+ effects.exit('characterEscape');
+ return ok
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * Map of named character references.
+ *
+ * @type {Record}
+ */
+const characterEntities = {
+ AElig: 'Æ',
+ AMP: '&',
+ Aacute: 'Á',
+ Abreve: 'Ă',
+ Acirc: 'Â',
+ Acy: 'А',
+ Afr: '𝔄',
+ Agrave: 'À',
+ Alpha: 'Α',
+ Amacr: 'Ā',
+ And: '⩓',
+ Aogon: 'Ą',
+ Aopf: '𝔸',
+ ApplyFunction: '',
+ Aring: 'Å',
+ Ascr: '𝒜',
+ Assign: '≔',
+ Atilde: 'Ã',
+ Auml: 'Ä',
+ Backslash: '∖',
+ Barv: '⫧',
+ Barwed: '⌆',
+ Bcy: 'Б',
+ Because: '∵',
+ Bernoullis: 'ℬ',
+ Beta: 'Β',
+ Bfr: '𝔅',
+ Bopf: '𝔹',
+ Breve: '˘',
+ Bscr: 'ℬ',
+ Bumpeq: '≎',
+ CHcy: 'Ч',
+ COPY: '©',
+ Cacute: 'Ć',
+ Cap: '⋒',
+ CapitalDifferentialD: 'ⅅ',
+ Cayleys: 'ℭ',
+ Ccaron: 'Č',
+ Ccedil: 'Ç',
+ Ccirc: 'Ĉ',
+ Cconint: '∰',
+ Cdot: 'Ċ',
+ Cedilla: '¸',
+ CenterDot: '·',
+ Cfr: 'ℭ',
+ Chi: 'Χ',
+ CircleDot: '⊙',
+ CircleMinus: '⊖',
+ CirclePlus: '⊕',
+ CircleTimes: '⊗',
+ ClockwiseContourIntegral: '∲',
+ CloseCurlyDoubleQuote: '”',
+ CloseCurlyQuote: '’',
+ Colon: '∷',
+ Colone: '⩴',
+ Congruent: '≡',
+ Conint: '∯',
+ ContourIntegral: '∮',
+ Copf: 'ℂ',
+ Coproduct: '∐',
+ CounterClockwiseContourIntegral: '∳',
+ Cross: '⨯',
+ Cscr: '𝒞',
+ Cup: '⋓',
+ CupCap: '≍',
+ DD: 'ⅅ',
+ DDotrahd: '⤑',
+ DJcy: 'Ђ',
+ DScy: 'Ѕ',
+ DZcy: 'Џ',
+ Dagger: '‡',
+ Darr: '↡',
+ Dashv: '⫤',
+ Dcaron: 'Ď',
+ Dcy: 'Д',
+ Del: '∇',
+ Delta: 'Δ',
+ Dfr: '𝔇',
+ DiacriticalAcute: '´',
+ DiacriticalDot: '˙',
+ DiacriticalDoubleAcute: '˝',
+ DiacriticalGrave: '`',
+ DiacriticalTilde: '˜',
+ Diamond: '⋄',
+ DifferentialD: 'ⅆ',
+ Dopf: '𝔻',
+ Dot: '¨',
+ DotDot: '⃜',
+ DotEqual: '≐',
+ DoubleContourIntegral: '∯',
+ DoubleDot: '¨',
+ DoubleDownArrow: '⇓',
+ DoubleLeftArrow: '⇐',
+ DoubleLeftRightArrow: '⇔',
+ DoubleLeftTee: '⫤',
+ DoubleLongLeftArrow: '⟸',
+ DoubleLongLeftRightArrow: '⟺',
+ DoubleLongRightArrow: '⟹',
+ DoubleRightArrow: '⇒',
+ DoubleRightTee: '⊨',
+ DoubleUpArrow: '⇑',
+ DoubleUpDownArrow: '⇕',
+ DoubleVerticalBar: '∥',
+ DownArrow: '↓',
+ DownArrowBar: '⤓',
+ DownArrowUpArrow: '⇵',
+ DownBreve: '̑',
+ DownLeftRightVector: '⥐',
+ DownLeftTeeVector: '⥞',
+ DownLeftVector: '↽',
+ DownLeftVectorBar: '⥖',
+ DownRightTeeVector: '⥟',
+ DownRightVector: '⇁',
+ DownRightVectorBar: '⥗',
+ DownTee: '⊤',
+ DownTeeArrow: '↧',
+ Downarrow: '⇓',
+ Dscr: '𝒟',
+ Dstrok: 'Đ',
+ ENG: 'Ŋ',
+ ETH: 'Ð',
+ Eacute: 'É',
+ Ecaron: 'Ě',
+ Ecirc: 'Ê',
+ Ecy: 'Э',
+ Edot: 'Ė',
+ Efr: '𝔈',
+ Egrave: 'È',
+ Element: '∈',
+ Emacr: 'Ē',
+ EmptySmallSquare: '◻',
+ EmptyVerySmallSquare: '▫',
+ Eogon: 'Ę',
+ Eopf: '𝔼',
+ Epsilon: 'Ε',
+ Equal: '⩵',
+ EqualTilde: '≂',
+ Equilibrium: '⇌',
+ Escr: 'ℰ',
+ Esim: '⩳',
+ Eta: 'Η',
+ Euml: 'Ë',
+ Exists: '∃',
+ ExponentialE: 'ⅇ',
+ Fcy: 'Ф',
+ Ffr: '𝔉',
+ FilledSmallSquare: '◼',
+ FilledVerySmallSquare: '▪',
+ Fopf: '𝔽',
+ ForAll: '∀',
+ Fouriertrf: 'ℱ',
+ Fscr: 'ℱ',
+ GJcy: 'Ѓ',
+ GT: '>',
+ Gamma: 'Γ',
+ Gammad: 'Ϝ',
+ Gbreve: 'Ğ',
+ Gcedil: 'Ģ',
+ Gcirc: 'Ĝ',
+ Gcy: 'Г',
+ Gdot: 'Ġ',
+ Gfr: '𝔊',
+ Gg: '⋙',
+ Gopf: '𝔾',
+ GreaterEqual: '≥',
+ GreaterEqualLess: '⋛',
+ GreaterFullEqual: '≧',
+ GreaterGreater: '⪢',
+ GreaterLess: '≷',
+ GreaterSlantEqual: '⩾',
+ GreaterTilde: '≳',
+ Gscr: '𝒢',
+ Gt: '≫',
+ HARDcy: 'Ъ',
+ Hacek: 'ˇ',
+ Hat: '^',
+ Hcirc: 'Ĥ',
+ Hfr: 'ℌ',
+ HilbertSpace: 'ℋ',
+ Hopf: 'ℍ',
+ HorizontalLine: '─',
+ Hscr: 'ℋ',
+ Hstrok: 'Ħ',
+ HumpDownHump: '≎',
+ HumpEqual: '≏',
+ IEcy: 'Е',
+ IJlig: 'IJ',
+ IOcy: 'Ё',
+ Iacute: 'Í',
+ Icirc: 'Î',
+ Icy: 'И',
+ Idot: 'İ',
+ Ifr: 'ℑ',
+ Igrave: 'Ì',
+ Im: 'ℑ',
+ Imacr: 'Ī',
+ ImaginaryI: 'ⅈ',
+ Implies: '⇒',
+ Int: '∬',
+ Integral: '∫',
+ Intersection: '⋂',
+ InvisibleComma: '',
+ InvisibleTimes: '',
+ Iogon: 'Į',
+ Iopf: '𝕀',
+ Iota: 'Ι',
+ Iscr: 'ℐ',
+ Itilde: 'Ĩ',
+ Iukcy: 'І',
+ Iuml: 'Ï',
+ Jcirc: 'Ĵ',
+ Jcy: 'Й',
+ Jfr: '𝔍',
+ Jopf: '𝕁',
+ Jscr: '𝒥',
+ Jsercy: 'Ј',
+ Jukcy: 'Є',
+ KHcy: 'Х',
+ KJcy: 'Ќ',
+ Kappa: 'Κ',
+ Kcedil: 'Ķ',
+ Kcy: 'К',
+ Kfr: '𝔎',
+ Kopf: '𝕂',
+ Kscr: '𝒦',
+ LJcy: 'Љ',
+ LT: '<',
+ Lacute: 'Ĺ',
+ Lambda: 'Λ',
+ Lang: '⟪',
+ Laplacetrf: 'ℒ',
+ Larr: '↞',
+ Lcaron: 'Ľ',
+ Lcedil: 'Ļ',
+ Lcy: 'Л',
+ LeftAngleBracket: '⟨',
+ LeftArrow: '←',
+ LeftArrowBar: '⇤',
+ LeftArrowRightArrow: '⇆',
+ LeftCeiling: '⌈',
+ LeftDoubleBracket: '⟦',
+ LeftDownTeeVector: '⥡',
+ LeftDownVector: '⇃',
+ LeftDownVectorBar: '⥙',
+ LeftFloor: '⌊',
+ LeftRightArrow: '↔',
+ LeftRightVector: '⥎',
+ LeftTee: '⊣',
+ LeftTeeArrow: '↤',
+ LeftTeeVector: '⥚',
+ LeftTriangle: '⊲',
+ LeftTriangleBar: '⧏',
+ LeftTriangleEqual: '⊴',
+ LeftUpDownVector: '⥑',
+ LeftUpTeeVector: '⥠',
+ LeftUpVector: '↿',
+ LeftUpVectorBar: '⥘',
+ LeftVector: '↼',
+ LeftVectorBar: '⥒',
+ Leftarrow: '⇐',
+ Leftrightarrow: '⇔',
+ LessEqualGreater: '⋚',
+ LessFullEqual: '≦',
+ LessGreater: '≶',
+ LessLess: '⪡',
+ LessSlantEqual: '⩽',
+ LessTilde: '≲',
+ Lfr: '𝔏',
+ Ll: '⋘',
+ Lleftarrow: '⇚',
+ Lmidot: 'Ŀ',
+ LongLeftArrow: '⟵',
+ LongLeftRightArrow: '⟷',
+ LongRightArrow: '⟶',
+ Longleftarrow: '⟸',
+ Longleftrightarrow: '⟺',
+ Longrightarrow: '⟹',
+ Lopf: '𝕃',
+ LowerLeftArrow: '↙',
+ LowerRightArrow: '↘',
+ Lscr: 'ℒ',
+ Lsh: '↰',
+ Lstrok: 'Ł',
+ Lt: '≪',
+ Map: '⤅',
+ Mcy: 'М',
+ MediumSpace: ' ',
+ Mellintrf: 'ℳ',
+ Mfr: '𝔐',
+ MinusPlus: '∓',
+ Mopf: '𝕄',
+ Mscr: 'ℳ',
+ Mu: 'Μ',
+ NJcy: 'Њ',
+ Nacute: 'Ń',
+ Ncaron: 'Ň',
+ Ncedil: 'Ņ',
+ Ncy: 'Н',
+ NegativeMediumSpace: '',
+ NegativeThickSpace: '',
+ NegativeThinSpace: '',
+ NegativeVeryThinSpace: '',
+ NestedGreaterGreater: '≫',
+ NestedLessLess: '≪',
+ NewLine: '\n',
+ Nfr: '𝔑',
+ NoBreak: '',
+ NonBreakingSpace: ' ',
+ Nopf: 'ℕ',
+ Not: '⫬',
+ NotCongruent: '≢',
+ NotCupCap: '≭',
+ NotDoubleVerticalBar: '∦',
+ NotElement: '∉',
+ NotEqual: '≠',
+ NotEqualTilde: '≂̸',
+ NotExists: '∄',
+ NotGreater: '≯',
+ NotGreaterEqual: '≱',
+ NotGreaterFullEqual: '≧̸',
+ NotGreaterGreater: '≫̸',
+ NotGreaterLess: '≹',
+ NotGreaterSlantEqual: '⩾̸',
+ NotGreaterTilde: '≵',
+ NotHumpDownHump: '≎̸',
+ NotHumpEqual: '≏̸',
+ NotLeftTriangle: '⋪',
+ NotLeftTriangleBar: '⧏̸',
+ NotLeftTriangleEqual: '⋬',
+ NotLess: '≮',
+ NotLessEqual: '≰',
+ NotLessGreater: '≸',
+ NotLessLess: '≪̸',
+ NotLessSlantEqual: '⩽̸',
+ NotLessTilde: '≴',
+ NotNestedGreaterGreater: '⪢̸',
+ NotNestedLessLess: '⪡̸',
+ NotPrecedes: '⊀',
+ NotPrecedesEqual: '⪯̸',
+ NotPrecedesSlantEqual: '⋠',
+ NotReverseElement: '∌',
+ NotRightTriangle: '⋫',
+ NotRightTriangleBar: '⧐̸',
+ NotRightTriangleEqual: '⋭',
+ NotSquareSubset: '⊏̸',
+ NotSquareSubsetEqual: '⋢',
+ NotSquareSuperset: '⊐̸',
+ NotSquareSupersetEqual: '⋣',
+ NotSubset: '⊂⃒',
+ NotSubsetEqual: '⊈',
+ NotSucceeds: '⊁',
+ NotSucceedsEqual: '⪰̸',
+ NotSucceedsSlantEqual: '⋡',
+ NotSucceedsTilde: '≿̸',
+ NotSuperset: '⊃⃒',
+ NotSupersetEqual: '⊉',
+ NotTilde: '≁',
+ NotTildeEqual: '≄',
+ NotTildeFullEqual: '≇',
+ NotTildeTilde: '≉',
+ NotVerticalBar: '∤',
+ Nscr: '𝒩',
+ Ntilde: 'Ñ',
+ Nu: 'Ν',
+ OElig: 'Œ',
+ Oacute: 'Ó',
+ Ocirc: 'Ô',
+ Ocy: 'О',
+ Odblac: 'Ő',
+ Ofr: '𝔒',
+ Ograve: 'Ò',
+ Omacr: 'Ō',
+ Omega: 'Ω',
+ Omicron: 'Ο',
+ Oopf: '𝕆',
+ OpenCurlyDoubleQuote: '“',
+ OpenCurlyQuote: '‘',
+ Or: '⩔',
+ Oscr: '𝒪',
+ Oslash: 'Ø',
+ Otilde: 'Õ',
+ Otimes: '⨷',
+ Ouml: 'Ö',
+ OverBar: '‾',
+ OverBrace: '⏞',
+ OverBracket: '⎴',
+ OverParenthesis: '⏜',
+ PartialD: '∂',
+ Pcy: 'П',
+ Pfr: '𝔓',
+ Phi: 'Φ',
+ Pi: 'Π',
+ PlusMinus: '±',
+ Poincareplane: 'ℌ',
+ Popf: 'ℙ',
+ Pr: '⪻',
+ Precedes: '≺',
+ PrecedesEqual: '⪯',
+ PrecedesSlantEqual: '≼',
+ PrecedesTilde: '≾',
+ Prime: '″',
+ Product: '∏',
+ Proportion: '∷',
+ Proportional: '∝',
+ Pscr: '𝒫',
+ Psi: 'Ψ',
+ QUOT: '"',
+ Qfr: '𝔔',
+ Qopf: 'ℚ',
+ Qscr: '𝒬',
+ RBarr: '⤐',
+ REG: '®',
+ Racute: 'Ŕ',
+ Rang: '⟫',
+ Rarr: '↠',
+ Rarrtl: '⤖',
+ Rcaron: 'Ř',
+ Rcedil: 'Ŗ',
+ Rcy: 'Р',
+ Re: 'ℜ',
+ ReverseElement: '∋',
+ ReverseEquilibrium: '⇋',
+ ReverseUpEquilibrium: '⥯',
+ Rfr: 'ℜ',
+ Rho: 'Ρ',
+ RightAngleBracket: '⟩',
+ RightArrow: '→',
+ RightArrowBar: '⇥',
+ RightArrowLeftArrow: '⇄',
+ RightCeiling: '⌉',
+ RightDoubleBracket: '⟧',
+ RightDownTeeVector: '⥝',
+ RightDownVector: '⇂',
+ RightDownVectorBar: '⥕',
+ RightFloor: '⌋',
+ RightTee: '⊢',
+ RightTeeArrow: '↦',
+ RightTeeVector: '⥛',
+ RightTriangle: '⊳',
+ RightTriangleBar: '⧐',
+ RightTriangleEqual: '⊵',
+ RightUpDownVector: '⥏',
+ RightUpTeeVector: '⥜',
+ RightUpVector: '↾',
+ RightUpVectorBar: '⥔',
+ RightVector: '⇀',
+ RightVectorBar: '⥓',
+ Rightarrow: '⇒',
+ Ropf: 'ℝ',
+ RoundImplies: '⥰',
+ Rrightarrow: '⇛',
+ Rscr: 'ℛ',
+ Rsh: '↱',
+ RuleDelayed: '⧴',
+ SHCHcy: 'Щ',
+ SHcy: 'Ш',
+ SOFTcy: 'Ь',
+ Sacute: 'Ś',
+ Sc: '⪼',
+ Scaron: 'Š',
+ Scedil: 'Ş',
+ Scirc: 'Ŝ',
+ Scy: 'С',
+ Sfr: '𝔖',
+ ShortDownArrow: '↓',
+ ShortLeftArrow: '←',
+ ShortRightArrow: '→',
+ ShortUpArrow: '↑',
+ Sigma: 'Σ',
+ SmallCircle: '∘',
+ Sopf: '𝕊',
+ Sqrt: '√',
+ Square: '□',
+ SquareIntersection: '⊓',
+ SquareSubset: '⊏',
+ SquareSubsetEqual: '⊑',
+ SquareSuperset: '⊐',
+ SquareSupersetEqual: '⊒',
+ SquareUnion: '⊔',
+ Sscr: '𝒮',
+ Star: '⋆',
+ Sub: '⋐',
+ Subset: '⋐',
+ SubsetEqual: '⊆',
+ Succeeds: '≻',
+ SucceedsEqual: '⪰',
+ SucceedsSlantEqual: '≽',
+ SucceedsTilde: '≿',
+ SuchThat: '∋',
+ Sum: '∑',
+ Sup: '⋑',
+ Superset: '⊃',
+ SupersetEqual: '⊇',
+ Supset: '⋑',
+ THORN: 'Þ',
+ TRADE: '™',
+ TSHcy: 'Ћ',
+ TScy: 'Ц',
+ Tab: '\t',
+ Tau: 'Τ',
+ Tcaron: 'Ť',
+ Tcedil: 'Ţ',
+ Tcy: 'Т',
+ Tfr: '𝔗',
+ Therefore: '∴',
+ Theta: 'Θ',
+ ThickSpace: ' ',
+ ThinSpace: ' ',
+ Tilde: '∼',
+ TildeEqual: '≃',
+ TildeFullEqual: '≅',
+ TildeTilde: '≈',
+ Topf: '𝕋',
+ TripleDot: '⃛',
+ Tscr: '𝒯',
+ Tstrok: 'Ŧ',
+ Uacute: 'Ú',
+ Uarr: '↟',
+ Uarrocir: '⥉',
+ Ubrcy: 'Ў',
+ Ubreve: 'Ŭ',
+ Ucirc: 'Û',
+ Ucy: 'У',
+ Udblac: 'Ű',
+ Ufr: '𝔘',
+ Ugrave: 'Ù',
+ Umacr: 'Ū',
+ UnderBar: '_',
+ UnderBrace: '⏟',
+ UnderBracket: '⎵',
+ UnderParenthesis: '⏝',
+ Union: '⋃',
+ UnionPlus: '⊎',
+ Uogon: 'Ų',
+ Uopf: '𝕌',
+ UpArrow: '↑',
+ UpArrowBar: '⤒',
+ UpArrowDownArrow: '⇅',
+ UpDownArrow: '↕',
+ UpEquilibrium: '⥮',
+ UpTee: '⊥',
+ UpTeeArrow: '↥',
+ Uparrow: '⇑',
+ Updownarrow: '⇕',
+ UpperLeftArrow: '↖',
+ UpperRightArrow: '↗',
+ Upsi: 'ϒ',
+ Upsilon: 'Υ',
+ Uring: 'Ů',
+ Uscr: '𝒰',
+ Utilde: 'Ũ',
+ Uuml: 'Ü',
+ VDash: '⊫',
+ Vbar: '⫫',
+ Vcy: 'В',
+ Vdash: '⊩',
+ Vdashl: '⫦',
+ Vee: '⋁',
+ Verbar: '‖',
+ Vert: '‖',
+ VerticalBar: '∣',
+ VerticalLine: '|',
+ VerticalSeparator: '❘',
+ VerticalTilde: '≀',
+ VeryThinSpace: ' ',
+ Vfr: '𝔙',
+ Vopf: '𝕍',
+ Vscr: '𝒱',
+ Vvdash: '⊪',
+ Wcirc: 'Ŵ',
+ Wedge: '⋀',
+ Wfr: '𝔚',
+ Wopf: '𝕎',
+ Wscr: '𝒲',
+ Xfr: '𝔛',
+ Xi: 'Ξ',
+ Xopf: '𝕏',
+ Xscr: '𝒳',
+ YAcy: 'Я',
+ YIcy: 'Ї',
+ YUcy: 'Ю',
+ Yacute: 'Ý',
+ Ycirc: 'Ŷ',
+ Ycy: 'Ы',
+ Yfr: '𝔜',
+ Yopf: '𝕐',
+ Yscr: '𝒴',
+ Yuml: 'Ÿ',
+ ZHcy: 'Ж',
+ Zacute: 'Ź',
+ Zcaron: 'Ž',
+ Zcy: 'З',
+ Zdot: 'Ż',
+ ZeroWidthSpace: '',
+ Zeta: 'Ζ',
+ Zfr: 'ℨ',
+ Zopf: 'ℤ',
+ Zscr: '𝒵',
+ aacute: 'á',
+ abreve: 'ă',
+ ac: '∾',
+ acE: '∾̳',
+ acd: '∿',
+ acirc: 'â',
+ acute: '´',
+ acy: 'а',
+ aelig: 'æ',
+ af: '',
+ afr: '𝔞',
+ agrave: 'à',
+ alefsym: 'ℵ',
+ aleph: 'ℵ',
+ alpha: 'α',
+ amacr: 'ā',
+ amalg: '⨿',
+ amp: '&',
+ and: '∧',
+ andand: '⩕',
+ andd: '⩜',
+ andslope: '⩘',
+ andv: '⩚',
+ ang: '∠',
+ ange: '⦤',
+ angle: '∠',
+ angmsd: '∡',
+ angmsdaa: '⦨',
+ angmsdab: '⦩',
+ angmsdac: '⦪',
+ angmsdad: '⦫',
+ angmsdae: '⦬',
+ angmsdaf: '⦭',
+ angmsdag: '⦮',
+ angmsdah: '⦯',
+ angrt: '∟',
+ angrtvb: '⊾',
+ angrtvbd: '⦝',
+ angsph: '∢',
+ angst: 'Å',
+ angzarr: '⍼',
+ aogon: 'ą',
+ aopf: '𝕒',
+ ap: '≈',
+ apE: '⩰',
+ apacir: '⩯',
+ ape: '≊',
+ apid: '≋',
+ apos: "'",
+ approx: '≈',
+ approxeq: '≊',
+ aring: 'å',
+ ascr: '𝒶',
+ ast: '*',
+ asymp: '≈',
+ asympeq: '≍',
+ atilde: 'ã',
+ auml: 'ä',
+ awconint: '∳',
+ awint: '⨑',
+ bNot: '⫭',
+ backcong: '≌',
+ backepsilon: '϶',
+ backprime: '‵',
+ backsim: '∽',
+ backsimeq: '⋍',
+ barvee: '⊽',
+ barwed: '⌅',
+ barwedge: '⌅',
+ bbrk: '⎵',
+ bbrktbrk: '⎶',
+ bcong: '≌',
+ bcy: 'б',
+ bdquo: '„',
+ becaus: '∵',
+ because: '∵',
+ bemptyv: '⦰',
+ bepsi: '϶',
+ bernou: 'ℬ',
+ beta: 'β',
+ beth: 'ℶ',
+ between: '≬',
+ bfr: '𝔟',
+ bigcap: '⋂',
+ bigcirc: '◯',
+ bigcup: '⋃',
+ bigodot: '⨀',
+ bigoplus: '⨁',
+ bigotimes: '⨂',
+ bigsqcup: '⨆',
+ bigstar: '★',
+ bigtriangledown: '▽',
+ bigtriangleup: '△',
+ biguplus: '⨄',
+ bigvee: '⋁',
+ bigwedge: '⋀',
+ bkarow: '⤍',
+ blacklozenge: '⧫',
+ blacksquare: '▪',
+ blacktriangle: '▴',
+ blacktriangledown: '▾',
+ blacktriangleleft: '◂',
+ blacktriangleright: '▸',
+ blank: '␣',
+ blk12: '▒',
+ blk14: '░',
+ blk34: '▓',
+ block: '█',
+ bne: '=⃥',
+ bnequiv: '≡⃥',
+ bnot: '⌐',
+ bopf: '𝕓',
+ bot: '⊥',
+ bottom: '⊥',
+ bowtie: '⋈',
+ boxDL: '╗',
+ boxDR: '╔',
+ boxDl: '╖',
+ boxDr: '╓',
+ boxH: '═',
+ boxHD: '╦',
+ boxHU: '╩',
+ boxHd: '╤',
+ boxHu: '╧',
+ boxUL: '╝',
+ boxUR: '╚',
+ boxUl: '╜',
+ boxUr: '╙',
+ boxV: '║',
+ boxVH: '╬',
+ boxVL: '╣',
+ boxVR: '╠',
+ boxVh: '╫',
+ boxVl: '╢',
+ boxVr: '╟',
+ boxbox: '⧉',
+ boxdL: '╕',
+ boxdR: '╒',
+ boxdl: '┐',
+ boxdr: '┌',
+ boxh: '─',
+ boxhD: '╥',
+ boxhU: '╨',
+ boxhd: '┬',
+ boxhu: '┴',
+ boxminus: '⊟',
+ boxplus: '⊞',
+ boxtimes: '⊠',
+ boxuL: '╛',
+ boxuR: '╘',
+ boxul: '┘',
+ boxur: '└',
+ boxv: '│',
+ boxvH: '╪',
+ boxvL: '╡',
+ boxvR: '╞',
+ boxvh: '┼',
+ boxvl: '┤',
+ boxvr: '├',
+ bprime: '‵',
+ breve: '˘',
+ brvbar: '¦',
+ bscr: '𝒷',
+ bsemi: '⁏',
+ bsim: '∽',
+ bsime: '⋍',
+ bsol: '\\',
+ bsolb: '⧅',
+ bsolhsub: '⟈',
+ bull: '•',
+ bullet: '•',
+ bump: '≎',
+ bumpE: '⪮',
+ bumpe: '≏',
+ bumpeq: '≏',
+ cacute: 'ć',
+ cap: '∩',
+ capand: '⩄',
+ capbrcup: '⩉',
+ capcap: '⩋',
+ capcup: '⩇',
+ capdot: '⩀',
+ caps: '∩︀',
+ caret: '⁁',
+ caron: 'ˇ',
+ ccaps: '⩍',
+ ccaron: 'č',
+ ccedil: 'ç',
+ ccirc: 'ĉ',
+ ccups: '⩌',
+ ccupssm: '⩐',
+ cdot: 'ċ',
+ cedil: '¸',
+ cemptyv: '⦲',
+ cent: '¢',
+ centerdot: '·',
+ cfr: '𝔠',
+ chcy: 'ч',
+ check: '✓',
+ checkmark: '✓',
+ chi: 'χ',
+ cir: '○',
+ cirE: '⧃',
+ circ: 'ˆ',
+ circeq: '≗',
+ circlearrowleft: '↺',
+ circlearrowright: '↻',
+ circledR: '®',
+ circledS: 'Ⓢ',
+ circledast: '⊛',
+ circledcirc: '⊚',
+ circleddash: '⊝',
+ cire: '≗',
+ cirfnint: '⨐',
+ cirmid: '⫯',
+ cirscir: '⧂',
+ clubs: '♣',
+ clubsuit: '♣',
+ colon: ':',
+ colone: '≔',
+ coloneq: '≔',
+ comma: ',',
+ commat: '@',
+ comp: '∁',
+ compfn: '∘',
+ complement: '∁',
+ complexes: 'ℂ',
+ cong: '≅',
+ congdot: '⩭',
+ conint: '∮',
+ copf: '𝕔',
+ coprod: '∐',
+ copy: '©',
+ copysr: '℗',
+ crarr: '↵',
+ cross: '✗',
+ cscr: '𝒸',
+ csub: '⫏',
+ csube: '⫑',
+ csup: '⫐',
+ csupe: '⫒',
+ ctdot: '⋯',
+ cudarrl: '⤸',
+ cudarrr: '⤵',
+ cuepr: '⋞',
+ cuesc: '⋟',
+ cularr: '↶',
+ cularrp: '⤽',
+ cup: '∪',
+ cupbrcap: '⩈',
+ cupcap: '⩆',
+ cupcup: '⩊',
+ cupdot: '⊍',
+ cupor: '⩅',
+ cups: '∪︀',
+ curarr: '↷',
+ curarrm: '⤼',
+ curlyeqprec: '⋞',
+ curlyeqsucc: '⋟',
+ curlyvee: '⋎',
+ curlywedge: '⋏',
+ curren: '¤',
+ curvearrowleft: '↶',
+ curvearrowright: '↷',
+ cuvee: '⋎',
+ cuwed: '⋏',
+ cwconint: '∲',
+ cwint: '∱',
+ cylcty: '⌭',
+ dArr: '⇓',
+ dHar: '⥥',
+ dagger: '†',
+ daleth: 'ℸ',
+ darr: '↓',
+ dash: '‐',
+ dashv: '⊣',
+ dbkarow: '⤏',
+ dblac: '˝',
+ dcaron: 'ď',
+ dcy: 'д',
+ dd: 'ⅆ',
+ ddagger: '‡',
+ ddarr: '⇊',
+ ddotseq: '⩷',
+ deg: '°',
+ delta: 'δ',
+ demptyv: '⦱',
+ dfisht: '⥿',
+ dfr: '𝔡',
+ dharl: '⇃',
+ dharr: '⇂',
+ diam: '⋄',
+ diamond: '⋄',
+ diamondsuit: '♦',
+ diams: '♦',
+ die: '¨',
+ digamma: 'ϝ',
+ disin: '⋲',
+ div: '÷',
+ divide: '÷',
+ divideontimes: '⋇',
+ divonx: '⋇',
+ djcy: 'ђ',
+ dlcorn: '⌞',
+ dlcrop: '⌍',
+ dollar: '$',
+ dopf: '𝕕',
+ dot: '˙',
+ doteq: '≐',
+ doteqdot: '≑',
+ dotminus: '∸',
+ dotplus: '∔',
+ dotsquare: '⊡',
+ doublebarwedge: '⌆',
+ downarrow: '↓',
+ downdownarrows: '⇊',
+ downharpoonleft: '⇃',
+ downharpoonright: '⇂',
+ drbkarow: '⤐',
+ drcorn: '⌟',
+ drcrop: '⌌',
+ dscr: '𝒹',
+ dscy: 'ѕ',
+ dsol: '⧶',
+ dstrok: 'đ',
+ dtdot: '⋱',
+ dtri: '▿',
+ dtrif: '▾',
+ duarr: '⇵',
+ duhar: '⥯',
+ dwangle: '⦦',
+ dzcy: 'џ',
+ dzigrarr: '⟿',
+ eDDot: '⩷',
+ eDot: '≑',
+ eacute: 'é',
+ easter: '⩮',
+ ecaron: 'ě',
+ ecir: '≖',
+ ecirc: 'ê',
+ ecolon: '≕',
+ ecy: 'э',
+ edot: 'ė',
+ ee: 'ⅇ',
+ efDot: '≒',
+ efr: '𝔢',
+ eg: '⪚',
+ egrave: 'è',
+ egs: '⪖',
+ egsdot: '⪘',
+ el: '⪙',
+ elinters: '⏧',
+ ell: 'ℓ',
+ els: '⪕',
+ elsdot: '⪗',
+ emacr: 'ē',
+ empty: '∅',
+ emptyset: '∅',
+ emptyv: '∅',
+ emsp13: ' ',
+ emsp14: ' ',
+ emsp: ' ',
+ eng: 'ŋ',
+ ensp: ' ',
+ eogon: 'ę',
+ eopf: '𝕖',
+ epar: '⋕',
+ eparsl: '⧣',
+ eplus: '⩱',
+ epsi: 'ε',
+ epsilon: 'ε',
+ epsiv: 'ϵ',
+ eqcirc: '≖',
+ eqcolon: '≕',
+ eqsim: '≂',
+ eqslantgtr: '⪖',
+ eqslantless: '⪕',
+ equals: '=',
+ equest: '≟',
+ equiv: '≡',
+ equivDD: '⩸',
+ eqvparsl: '⧥',
+ erDot: '≓',
+ erarr: '⥱',
+ escr: 'ℯ',
+ esdot: '≐',
+ esim: '≂',
+ eta: 'η',
+ eth: 'ð',
+ euml: 'ë',
+ euro: '€',
+ excl: '!',
+ exist: '∃',
+ expectation: 'ℰ',
+ exponentiale: 'ⅇ',
+ fallingdotseq: '≒',
+ fcy: 'ф',
+ female: '♀',
+ ffilig: 'ffi',
+ fflig: 'ff',
+ ffllig: 'ffl',
+ ffr: '𝔣',
+ filig: 'fi',
+ fjlig: 'fj',
+ flat: '♭',
+ fllig: 'fl',
+ fltns: '▱',
+ fnof: 'ƒ',
+ fopf: '𝕗',
+ forall: '∀',
+ fork: '⋔',
+ forkv: '⫙',
+ fpartint: '⨍',
+ frac12: '½',
+ frac13: '⅓',
+ frac14: '¼',
+ frac15: '⅕',
+ frac16: '⅙',
+ frac18: '⅛',
+ frac23: '⅔',
+ frac25: '⅖',
+ frac34: '¾',
+ frac35: '⅗',
+ frac38: '⅜',
+ frac45: '⅘',
+ frac56: '⅚',
+ frac58: '⅝',
+ frac78: '⅞',
+ frasl: '⁄',
+ frown: '⌢',
+ fscr: '𝒻',
+ gE: '≧',
+ gEl: '⪌',
+ gacute: 'ǵ',
+ gamma: 'γ',
+ gammad: 'ϝ',
+ gap: '⪆',
+ gbreve: 'ğ',
+ gcirc: 'ĝ',
+ gcy: 'г',
+ gdot: 'ġ',
+ ge: '≥',
+ gel: '⋛',
+ geq: '≥',
+ geqq: '≧',
+ geqslant: '⩾',
+ ges: '⩾',
+ gescc: '⪩',
+ gesdot: '⪀',
+ gesdoto: '⪂',
+ gesdotol: '⪄',
+ gesl: '⋛︀',
+ gesles: '⪔',
+ gfr: '𝔤',
+ gg: '≫',
+ ggg: '⋙',
+ gimel: 'ℷ',
+ gjcy: 'ѓ',
+ gl: '≷',
+ glE: '⪒',
+ gla: '⪥',
+ glj: '⪤',
+ gnE: '≩',
+ gnap: '⪊',
+ gnapprox: '⪊',
+ gne: '⪈',
+ gneq: '⪈',
+ gneqq: '≩',
+ gnsim: '⋧',
+ gopf: '𝕘',
+ grave: '`',
+ gscr: 'ℊ',
+ gsim: '≳',
+ gsime: '⪎',
+ gsiml: '⪐',
+ gt: '>',
+ gtcc: '⪧',
+ gtcir: '⩺',
+ gtdot: '⋗',
+ gtlPar: '⦕',
+ gtquest: '⩼',
+ gtrapprox: '⪆',
+ gtrarr: '⥸',
+ gtrdot: '⋗',
+ gtreqless: '⋛',
+ gtreqqless: '⪌',
+ gtrless: '≷',
+ gtrsim: '≳',
+ gvertneqq: '≩︀',
+ gvnE: '≩︀',
+ hArr: '⇔',
+ hairsp: ' ',
+ half: '½',
+ hamilt: 'ℋ',
+ hardcy: 'ъ',
+ harr: '↔',
+ harrcir: '⥈',
+ harrw: '↭',
+ hbar: 'ℏ',
+ hcirc: 'ĥ',
+ hearts: '♥',
+ heartsuit: '♥',
+ hellip: '…',
+ hercon: '⊹',
+ hfr: '𝔥',
+ hksearow: '⤥',
+ hkswarow: '⤦',
+ hoarr: '⇿',
+ homtht: '∻',
+ hookleftarrow: '↩',
+ hookrightarrow: '↪',
+ hopf: '𝕙',
+ horbar: '―',
+ hscr: '𝒽',
+ hslash: 'ℏ',
+ hstrok: 'ħ',
+ hybull: '⁃',
+ hyphen: '‐',
+ iacute: 'í',
+ ic: '',
+ icirc: 'î',
+ icy: 'и',
+ iecy: 'е',
+ iexcl: '¡',
+ iff: '⇔',
+ ifr: '𝔦',
+ igrave: 'ì',
+ ii: 'ⅈ',
+ iiiint: '⨌',
+ iiint: '∭',
+ iinfin: '⧜',
+ iiota: '℩',
+ ijlig: 'ij',
+ imacr: 'ī',
+ image: 'ℑ',
+ imagline: 'ℐ',
+ imagpart: 'ℑ',
+ imath: 'ı',
+ imof: '⊷',
+ imped: 'Ƶ',
+ in: '∈',
+ incare: '℅',
+ infin: '∞',
+ infintie: '⧝',
+ inodot: 'ı',
+ int: '∫',
+ intcal: '⊺',
+ integers: 'ℤ',
+ intercal: '⊺',
+ intlarhk: '⨗',
+ intprod: '⨼',
+ iocy: 'ё',
+ iogon: 'į',
+ iopf: '𝕚',
+ iota: 'ι',
+ iprod: '⨼',
+ iquest: '¿',
+ iscr: '𝒾',
+ isin: '∈',
+ isinE: '⋹',
+ isindot: '⋵',
+ isins: '⋴',
+ isinsv: '⋳',
+ isinv: '∈',
+ it: '',
+ itilde: 'ĩ',
+ iukcy: 'і',
+ iuml: 'ï',
+ jcirc: 'ĵ',
+ jcy: 'й',
+ jfr: '𝔧',
+ jmath: 'ȷ',
+ jopf: '𝕛',
+ jscr: '𝒿',
+ jsercy: 'ј',
+ jukcy: 'є',
+ kappa: 'κ',
+ kappav: 'ϰ',
+ kcedil: 'ķ',
+ kcy: 'к',
+ kfr: '𝔨',
+ kgreen: 'ĸ',
+ khcy: 'х',
+ kjcy: 'ќ',
+ kopf: '𝕜',
+ kscr: '𝓀',
+ lAarr: '⇚',
+ lArr: '⇐',
+ lAtail: '⤛',
+ lBarr: '⤎',
+ lE: '≦',
+ lEg: '⪋',
+ lHar: '⥢',
+ lacute: 'ĺ',
+ laemptyv: '⦴',
+ lagran: 'ℒ',
+ lambda: 'λ',
+ lang: '⟨',
+ langd: '⦑',
+ langle: '⟨',
+ lap: '⪅',
+ laquo: '«',
+ larr: '←',
+ larrb: '⇤',
+ larrbfs: '⤟',
+ larrfs: '⤝',
+ larrhk: '↩',
+ larrlp: '↫',
+ larrpl: '⤹',
+ larrsim: '⥳',
+ larrtl: '↢',
+ lat: '⪫',
+ latail: '⤙',
+ late: '⪭',
+ lates: '⪭︀',
+ lbarr: '⤌',
+ lbbrk: '❲',
+ lbrace: '{',
+ lbrack: '[',
+ lbrke: '⦋',
+ lbrksld: '⦏',
+ lbrkslu: '⦍',
+ lcaron: 'ľ',
+ lcedil: 'ļ',
+ lceil: '⌈',
+ lcub: '{',
+ lcy: 'л',
+ ldca: '⤶',
+ ldquo: '“',
+ ldquor: '„',
+ ldrdhar: '⥧',
+ ldrushar: '⥋',
+ ldsh: '↲',
+ le: '≤',
+ leftarrow: '←',
+ leftarrowtail: '↢',
+ leftharpoondown: '↽',
+ leftharpoonup: '↼',
+ leftleftarrows: '⇇',
+ leftrightarrow: '↔',
+ leftrightarrows: '⇆',
+ leftrightharpoons: '⇋',
+ leftrightsquigarrow: '↭',
+ leftthreetimes: '⋋',
+ leg: '⋚',
+ leq: '≤',
+ leqq: '≦',
+ leqslant: '⩽',
+ les: '⩽',
+ lescc: '⪨',
+ lesdot: '⩿',
+ lesdoto: '⪁',
+ lesdotor: '⪃',
+ lesg: '⋚︀',
+ lesges: '⪓',
+ lessapprox: '⪅',
+ lessdot: '⋖',
+ lesseqgtr: '⋚',
+ lesseqqgtr: '⪋',
+ lessgtr: '≶',
+ lesssim: '≲',
+ lfisht: '⥼',
+ lfloor: '⌊',
+ lfr: '𝔩',
+ lg: '≶',
+ lgE: '⪑',
+ lhard: '↽',
+ lharu: '↼',
+ lharul: '⥪',
+ lhblk: '▄',
+ ljcy: 'љ',
+ ll: '≪',
+ llarr: '⇇',
+ llcorner: '⌞',
+ llhard: '⥫',
+ lltri: '◺',
+ lmidot: 'ŀ',
+ lmoust: '⎰',
+ lmoustache: '⎰',
+ lnE: '≨',
+ lnap: '⪉',
+ lnapprox: '⪉',
+ lne: '⪇',
+ lneq: '⪇',
+ lneqq: '≨',
+ lnsim: '⋦',
+ loang: '⟬',
+ loarr: '⇽',
+ lobrk: '⟦',
+ longleftarrow: '⟵',
+ longleftrightarrow: '⟷',
+ longmapsto: '⟼',
+ longrightarrow: '⟶',
+ looparrowleft: '↫',
+ looparrowright: '↬',
+ lopar: '⦅',
+ lopf: '𝕝',
+ loplus: '⨭',
+ lotimes: '⨴',
+ lowast: '∗',
+ lowbar: '_',
+ loz: '◊',
+ lozenge: '◊',
+ lozf: '⧫',
+ lpar: '(',
+ lparlt: '⦓',
+ lrarr: '⇆',
+ lrcorner: '⌟',
+ lrhar: '⇋',
+ lrhard: '⥭',
+ lrm: '',
+ lrtri: '⊿',
+ lsaquo: '‹',
+ lscr: '𝓁',
+ lsh: '↰',
+ lsim: '≲',
+ lsime: '⪍',
+ lsimg: '⪏',
+ lsqb: '[',
+ lsquo: '‘',
+ lsquor: '‚',
+ lstrok: 'ł',
+ lt: '<',
+ ltcc: '⪦',
+ ltcir: '⩹',
+ ltdot: '⋖',
+ lthree: '⋋',
+ ltimes: '⋉',
+ ltlarr: '⥶',
+ ltquest: '⩻',
+ ltrPar: '⦖',
+ ltri: '◃',
+ ltrie: '⊴',
+ ltrif: '◂',
+ lurdshar: '⥊',
+ luruhar: '⥦',
+ lvertneqq: '≨︀',
+ lvnE: '≨︀',
+ mDDot: '∺',
+ macr: '¯',
+ male: '♂',
+ malt: '✠',
+ maltese: '✠',
+ map: '↦',
+ mapsto: '↦',
+ mapstodown: '↧',
+ mapstoleft: '↤',
+ mapstoup: '↥',
+ marker: '▮',
+ mcomma: '⨩',
+ mcy: 'м',
+ mdash: '—',
+ measuredangle: '∡',
+ mfr: '𝔪',
+ mho: '℧',
+ micro: 'µ',
+ mid: '∣',
+ midast: '*',
+ midcir: '⫰',
+ middot: '·',
+ minus: '−',
+ minusb: '⊟',
+ minusd: '∸',
+ minusdu: '⨪',
+ mlcp: '⫛',
+ mldr: '…',
+ mnplus: '∓',
+ models: '⊧',
+ mopf: '𝕞',
+ mp: '∓',
+ mscr: '𝓂',
+ mstpos: '∾',
+ mu: 'μ',
+ multimap: '⊸',
+ mumap: '⊸',
+ nGg: '⋙̸',
+ nGt: '≫⃒',
+ nGtv: '≫̸',
+ nLeftarrow: '⇍',
+ nLeftrightarrow: '⇎',
+ nLl: '⋘̸',
+ nLt: '≪⃒',
+ nLtv: '≪̸',
+ nRightarrow: '⇏',
+ nVDash: '⊯',
+ nVdash: '⊮',
+ nabla: '∇',
+ nacute: 'ń',
+ nang: '∠⃒',
+ nap: '≉',
+ napE: '⩰̸',
+ napid: '≋̸',
+ napos: 'ʼn',
+ napprox: '≉',
+ natur: '♮',
+ natural: '♮',
+ naturals: 'ℕ',
+ nbsp: ' ',
+ nbump: '≎̸',
+ nbumpe: '≏̸',
+ ncap: '⩃',
+ ncaron: 'ň',
+ ncedil: 'ņ',
+ ncong: '≇',
+ ncongdot: '⩭̸',
+ ncup: '⩂',
+ ncy: 'н',
+ ndash: '–',
+ ne: '≠',
+ neArr: '⇗',
+ nearhk: '⤤',
+ nearr: '↗',
+ nearrow: '↗',
+ nedot: '≐̸',
+ nequiv: '≢',
+ nesear: '⤨',
+ nesim: '≂̸',
+ nexist: '∄',
+ nexists: '∄',
+ nfr: '𝔫',
+ ngE: '≧̸',
+ nge: '≱',
+ ngeq: '≱',
+ ngeqq: '≧̸',
+ ngeqslant: '⩾̸',
+ nges: '⩾̸',
+ ngsim: '≵',
+ ngt: '≯',
+ ngtr: '≯',
+ nhArr: '⇎',
+ nharr: '↮',
+ nhpar: '⫲',
+ ni: '∋',
+ nis: '⋼',
+ nisd: '⋺',
+ niv: '∋',
+ njcy: 'њ',
+ nlArr: '⇍',
+ nlE: '≦̸',
+ nlarr: '↚',
+ nldr: '‥',
+ nle: '≰',
+ nleftarrow: '↚',
+ nleftrightarrow: '↮',
+ nleq: '≰',
+ nleqq: '≦̸',
+ nleqslant: '⩽̸',
+ nles: '⩽̸',
+ nless: '≮',
+ nlsim: '≴',
+ nlt: '≮',
+ nltri: '⋪',
+ nltrie: '⋬',
+ nmid: '∤',
+ nopf: '𝕟',
+ not: '¬',
+ notin: '∉',
+ notinE: '⋹̸',
+ notindot: '⋵̸',
+ notinva: '∉',
+ notinvb: '⋷',
+ notinvc: '⋶',
+ notni: '∌',
+ notniva: '∌',
+ notnivb: '⋾',
+ notnivc: '⋽',
+ npar: '∦',
+ nparallel: '∦',
+ nparsl: '⫽⃥',
+ npart: '∂̸',
+ npolint: '⨔',
+ npr: '⊀',
+ nprcue: '⋠',
+ npre: '⪯̸',
+ nprec: '⊀',
+ npreceq: '⪯̸',
+ nrArr: '⇏',
+ nrarr: '↛',
+ nrarrc: '⤳̸',
+ nrarrw: '↝̸',
+ nrightarrow: '↛',
+ nrtri: '⋫',
+ nrtrie: '⋭',
+ nsc: '⊁',
+ nsccue: '⋡',
+ nsce: '⪰̸',
+ nscr: '𝓃',
+ nshortmid: '∤',
+ nshortparallel: '∦',
+ nsim: '≁',
+ nsime: '≄',
+ nsimeq: '≄',
+ nsmid: '∤',
+ nspar: '∦',
+ nsqsube: '⋢',
+ nsqsupe: '⋣',
+ nsub: '⊄',
+ nsubE: '⫅̸',
+ nsube: '⊈',
+ nsubset: '⊂⃒',
+ nsubseteq: '⊈',
+ nsubseteqq: '⫅̸',
+ nsucc: '⊁',
+ nsucceq: '⪰̸',
+ nsup: '⊅',
+ nsupE: '⫆̸',
+ nsupe: '⊉',
+ nsupset: '⊃⃒',
+ nsupseteq: '⊉',
+ nsupseteqq: '⫆̸',
+ ntgl: '≹',
+ ntilde: 'ñ',
+ ntlg: '≸',
+ ntriangleleft: '⋪',
+ ntrianglelefteq: '⋬',
+ ntriangleright: '⋫',
+ ntrianglerighteq: '⋭',
+ nu: 'ν',
+ num: '#',
+ numero: '№',
+ numsp: ' ',
+ nvDash: '⊭',
+ nvHarr: '⤄',
+ nvap: '≍⃒',
+ nvdash: '⊬',
+ nvge: '≥⃒',
+ nvgt: '>⃒',
+ nvinfin: '⧞',
+ nvlArr: '⤂',
+ nvle: '≤⃒',
+ nvlt: '<⃒',
+ nvltrie: '⊴⃒',
+ nvrArr: '⤃',
+ nvrtrie: '⊵⃒',
+ nvsim: '∼⃒',
+ nwArr: '⇖',
+ nwarhk: '⤣',
+ nwarr: '↖',
+ nwarrow: '↖',
+ nwnear: '⤧',
+ oS: 'Ⓢ',
+ oacute: 'ó',
+ oast: '⊛',
+ ocir: '⊚',
+ ocirc: 'ô',
+ ocy: 'о',
+ odash: '⊝',
+ odblac: 'ő',
+ odiv: '⨸',
+ odot: '⊙',
+ odsold: '⦼',
+ oelig: 'œ',
+ ofcir: '⦿',
+ ofr: '𝔬',
+ ogon: '˛',
+ ograve: 'ò',
+ ogt: '⧁',
+ ohbar: '⦵',
+ ohm: 'Ω',
+ oint: '∮',
+ olarr: '↺',
+ olcir: '⦾',
+ olcross: '⦻',
+ oline: '‾',
+ olt: '⧀',
+ omacr: 'ō',
+ omega: 'ω',
+ omicron: 'ο',
+ omid: '⦶',
+ ominus: '⊖',
+ oopf: '𝕠',
+ opar: '⦷',
+ operp: '⦹',
+ oplus: '⊕',
+ or: '∨',
+ orarr: '↻',
+ ord: '⩝',
+ order: 'ℴ',
+ orderof: 'ℴ',
+ ordf: 'ª',
+ ordm: 'º',
+ origof: '⊶',
+ oror: '⩖',
+ orslope: '⩗',
+ orv: '⩛',
+ oscr: 'ℴ',
+ oslash: 'ø',
+ osol: '⊘',
+ otilde: 'õ',
+ otimes: '⊗',
+ otimesas: '⨶',
+ ouml: 'ö',
+ ovbar: '⌽',
+ par: '∥',
+ para: '¶',
+ parallel: '∥',
+ parsim: '⫳',
+ parsl: '⫽',
+ part: '∂',
+ pcy: 'п',
+ percnt: '%',
+ period: '.',
+ permil: '‰',
+ perp: '⊥',
+ pertenk: '‱',
+ pfr: '𝔭',
+ phi: 'φ',
+ phiv: 'ϕ',
+ phmmat: 'ℳ',
+ phone: '☎',
+ pi: 'π',
+ pitchfork: '⋔',
+ piv: 'ϖ',
+ planck: 'ℏ',
+ planckh: 'ℎ',
+ plankv: 'ℏ',
+ plus: '+',
+ plusacir: '⨣',
+ plusb: '⊞',
+ pluscir: '⨢',
+ plusdo: '∔',
+ plusdu: '⨥',
+ pluse: '⩲',
+ plusmn: '±',
+ plussim: '⨦',
+ plustwo: '⨧',
+ pm: '±',
+ pointint: '⨕',
+ popf: '𝕡',
+ pound: '£',
+ pr: '≺',
+ prE: '⪳',
+ prap: '⪷',
+ prcue: '≼',
+ pre: '⪯',
+ prec: '≺',
+ precapprox: '⪷',
+ preccurlyeq: '≼',
+ preceq: '⪯',
+ precnapprox: '⪹',
+ precneqq: '⪵',
+ precnsim: '⋨',
+ precsim: '≾',
+ prime: '′',
+ primes: 'ℙ',
+ prnE: '⪵',
+ prnap: '⪹',
+ prnsim: '⋨',
+ prod: '∏',
+ profalar: '⌮',
+ profline: '⌒',
+ profsurf: '⌓',
+ prop: '∝',
+ propto: '∝',
+ prsim: '≾',
+ prurel: '⊰',
+ pscr: '𝓅',
+ psi: 'ψ',
+ puncsp: ' ',
+ qfr: '𝔮',
+ qint: '⨌',
+ qopf: '𝕢',
+ qprime: '⁗',
+ qscr: '𝓆',
+ quaternions: 'ℍ',
+ quatint: '⨖',
+ quest: '?',
+ questeq: '≟',
+ quot: '"',
+ rAarr: '⇛',
+ rArr: '⇒',
+ rAtail: '⤜',
+ rBarr: '⤏',
+ rHar: '⥤',
+ race: '∽̱',
+ racute: 'ŕ',
+ radic: '√',
+ raemptyv: '⦳',
+ rang: '⟩',
+ rangd: '⦒',
+ range: '⦥',
+ rangle: '⟩',
+ raquo: '»',
+ rarr: '→',
+ rarrap: '⥵',
+ rarrb: '⇥',
+ rarrbfs: '⤠',
+ rarrc: '⤳',
+ rarrfs: '⤞',
+ rarrhk: '↪',
+ rarrlp: '↬',
+ rarrpl: '⥅',
+ rarrsim: '⥴',
+ rarrtl: '↣',
+ rarrw: '↝',
+ ratail: '⤚',
+ ratio: '∶',
+ rationals: 'ℚ',
+ rbarr: '⤍',
+ rbbrk: '❳',
+ rbrace: '}',
+ rbrack: ']',
+ rbrke: '⦌',
+ rbrksld: '⦎',
+ rbrkslu: '⦐',
+ rcaron: 'ř',
+ rcedil: 'ŗ',
+ rceil: '⌉',
+ rcub: '}',
+ rcy: 'р',
+ rdca: '⤷',
+ rdldhar: '⥩',
+ rdquo: '”',
+ rdquor: '”',
+ rdsh: '↳',
+ real: 'ℜ',
+ realine: 'ℛ',
+ realpart: 'ℜ',
+ reals: 'ℝ',
+ rect: '▭',
+ reg: '®',
+ rfisht: '⥽',
+ rfloor: '⌋',
+ rfr: '𝔯',
+ rhard: '⇁',
+ rharu: '⇀',
+ rharul: '⥬',
+ rho: 'ρ',
+ rhov: 'ϱ',
+ rightarrow: '→',
+ rightarrowtail: '↣',
+ rightharpoondown: '⇁',
+ rightharpoonup: '⇀',
+ rightleftarrows: '⇄',
+ rightleftharpoons: '⇌',
+ rightrightarrows: '⇉',
+ rightsquigarrow: '↝',
+ rightthreetimes: '⋌',
+ ring: '˚',
+ risingdotseq: '≓',
+ rlarr: '⇄',
+ rlhar: '⇌',
+ rlm: '',
+ rmoust: '⎱',
+ rmoustache: '⎱',
+ rnmid: '⫮',
+ roang: '⟭',
+ roarr: '⇾',
+ robrk: '⟧',
+ ropar: '⦆',
+ ropf: '𝕣',
+ roplus: '⨮',
+ rotimes: '⨵',
+ rpar: ')',
+ rpargt: '⦔',
+ rppolint: '⨒',
+ rrarr: '⇉',
+ rsaquo: '›',
+ rscr: '𝓇',
+ rsh: '↱',
+ rsqb: ']',
+ rsquo: '’',
+ rsquor: '’',
+ rthree: '⋌',
+ rtimes: '⋊',
+ rtri: '▹',
+ rtrie: '⊵',
+ rtrif: '▸',
+ rtriltri: '⧎',
+ ruluhar: '⥨',
+ rx: '℞',
+ sacute: 'ś',
+ sbquo: '‚',
+ sc: '≻',
+ scE: '⪴',
+ scap: '⪸',
+ scaron: 'š',
+ sccue: '≽',
+ sce: '⪰',
+ scedil: 'ş',
+ scirc: 'ŝ',
+ scnE: '⪶',
+ scnap: '⪺',
+ scnsim: '⋩',
+ scpolint: '⨓',
+ scsim: '≿',
+ scy: 'с',
+ sdot: '⋅',
+ sdotb: '⊡',
+ sdote: '⩦',
+ seArr: '⇘',
+ searhk: '⤥',
+ searr: '↘',
+ searrow: '↘',
+ sect: '§',
+ semi: ';',
+ seswar: '⤩',
+ setminus: '∖',
+ setmn: '∖',
+ sext: '✶',
+ sfr: '𝔰',
+ sfrown: '⌢',
+ sharp: '♯',
+ shchcy: 'щ',
+ shcy: 'ш',
+ shortmid: '∣',
+ shortparallel: '∥',
+ shy: '',
+ sigma: 'σ',
+ sigmaf: 'ς',
+ sigmav: 'ς',
+ sim: '∼',
+ simdot: '⩪',
+ sime: '≃',
+ simeq: '≃',
+ simg: '⪞',
+ simgE: '⪠',
+ siml: '⪝',
+ simlE: '⪟',
+ simne: '≆',
+ simplus: '⨤',
+ simrarr: '⥲',
+ slarr: '←',
+ smallsetminus: '∖',
+ smashp: '⨳',
+ smeparsl: '⧤',
+ smid: '∣',
+ smile: '⌣',
+ smt: '⪪',
+ smte: '⪬',
+ smtes: '⪬︀',
+ softcy: 'ь',
+ sol: '/',
+ solb: '⧄',
+ solbar: '⌿',
+ sopf: '𝕤',
+ spades: '♠',
+ spadesuit: '♠',
+ spar: '∥',
+ sqcap: '⊓',
+ sqcaps: '⊓︀',
+ sqcup: '⊔',
+ sqcups: '⊔︀',
+ sqsub: '⊏',
+ sqsube: '⊑',
+ sqsubset: '⊏',
+ sqsubseteq: '⊑',
+ sqsup: '⊐',
+ sqsupe: '⊒',
+ sqsupset: '⊐',
+ sqsupseteq: '⊒',
+ squ: '□',
+ square: '□',
+ squarf: '▪',
+ squf: '▪',
+ srarr: '→',
+ sscr: '𝓈',
+ ssetmn: '∖',
+ ssmile: '⌣',
+ sstarf: '⋆',
+ star: '☆',
+ starf: '★',
+ straightepsilon: 'ϵ',
+ straightphi: 'ϕ',
+ strns: '¯',
+ sub: '⊂',
+ subE: '⫅',
+ subdot: '⪽',
+ sube: '⊆',
+ subedot: '⫃',
+ submult: '⫁',
+ subnE: '⫋',
+ subne: '⊊',
+ subplus: '⪿',
+ subrarr: '⥹',
+ subset: '⊂',
+ subseteq: '⊆',
+ subseteqq: '⫅',
+ subsetneq: '⊊',
+ subsetneqq: '⫋',
+ subsim: '⫇',
+ subsub: '⫕',
+ subsup: '⫓',
+ succ: '≻',
+ succapprox: '⪸',
+ succcurlyeq: '≽',
+ succeq: '⪰',
+ succnapprox: '⪺',
+ succneqq: '⪶',
+ succnsim: '⋩',
+ succsim: '≿',
+ sum: '∑',
+ sung: '♪',
+ sup1: '¹',
+ sup2: '²',
+ sup3: '³',
+ sup: '⊃',
+ supE: '⫆',
+ supdot: '⪾',
+ supdsub: '⫘',
+ supe: '⊇',
+ supedot: '⫄',
+ suphsol: '⟉',
+ suphsub: '⫗',
+ suplarr: '⥻',
+ supmult: '⫂',
+ supnE: '⫌',
+ supne: '⊋',
+ supplus: '⫀',
+ supset: '⊃',
+ supseteq: '⊇',
+ supseteqq: '⫆',
+ supsetneq: '⊋',
+ supsetneqq: '⫌',
+ supsim: '⫈',
+ supsub: '⫔',
+ supsup: '⫖',
+ swArr: '⇙',
+ swarhk: '⤦',
+ swarr: '↙',
+ swarrow: '↙',
+ swnwar: '⤪',
+ szlig: 'ß',
+ target: '⌖',
+ tau: 'τ',
+ tbrk: '⎴',
+ tcaron: 'ť',
+ tcedil: 'ţ',
+ tcy: 'т',
+ tdot: '⃛',
+ telrec: '⌕',
+ tfr: '𝔱',
+ there4: '∴',
+ therefore: '∴',
+ theta: 'θ',
+ thetasym: 'ϑ',
+ thetav: 'ϑ',
+ thickapprox: '≈',
+ thicksim: '∼',
+ thinsp: ' ',
+ thkap: '≈',
+ thksim: '∼',
+ thorn: 'þ',
+ tilde: '˜',
+ times: '×',
+ timesb: '⊠',
+ timesbar: '⨱',
+ timesd: '⨰',
+ tint: '∭',
+ toea: '⤨',
+ top: '⊤',
+ topbot: '⌶',
+ topcir: '⫱',
+ topf: '𝕥',
+ topfork: '⫚',
+ tosa: '⤩',
+ tprime: '‴',
+ trade: '™',
+ triangle: '▵',
+ triangledown: '▿',
+ triangleleft: '◃',
+ trianglelefteq: '⊴',
+ triangleq: '≜',
+ triangleright: '▹',
+ trianglerighteq: '⊵',
+ tridot: '◬',
+ trie: '≜',
+ triminus: '⨺',
+ triplus: '⨹',
+ trisb: '⧍',
+ tritime: '⨻',
+ trpezium: '⏢',
+ tscr: '𝓉',
+ tscy: 'ц',
+ tshcy: 'ћ',
+ tstrok: 'ŧ',
+ twixt: '≬',
+ twoheadleftarrow: '↞',
+ twoheadrightarrow: '↠',
+ uArr: '⇑',
+ uHar: '⥣',
+ uacute: 'ú',
+ uarr: '↑',
+ ubrcy: 'ў',
+ ubreve: 'ŭ',
+ ucirc: 'û',
+ ucy: 'у',
+ udarr: '⇅',
+ udblac: 'ű',
+ udhar: '⥮',
+ ufisht: '⥾',
+ ufr: '𝔲',
+ ugrave: 'ù',
+ uharl: '↿',
+ uharr: '↾',
+ uhblk: '▀',
+ ulcorn: '⌜',
+ ulcorner: '⌜',
+ ulcrop: '⌏',
+ ultri: '◸',
+ umacr: 'ū',
+ uml: '¨',
+ uogon: 'ų',
+ uopf: '𝕦',
+ uparrow: '↑',
+ updownarrow: '↕',
+ upharpoonleft: '↿',
+ upharpoonright: '↾',
+ uplus: '⊎',
+ upsi: 'υ',
+ upsih: 'ϒ',
+ upsilon: 'υ',
+ upuparrows: '⇈',
+ urcorn: '⌝',
+ urcorner: '⌝',
+ urcrop: '⌎',
+ uring: 'ů',
+ urtri: '◹',
+ uscr: '𝓊',
+ utdot: '⋰',
+ utilde: 'ũ',
+ utri: '▵',
+ utrif: '▴',
+ uuarr: '⇈',
+ uuml: 'ü',
+ uwangle: '⦧',
+ vArr: '⇕',
+ vBar: '⫨',
+ vBarv: '⫩',
+ vDash: '⊨',
+ vangrt: '⦜',
+ varepsilon: 'ϵ',
+ varkappa: 'ϰ',
+ varnothing: '∅',
+ varphi: 'ϕ',
+ varpi: 'ϖ',
+ varpropto: '∝',
+ varr: '↕',
+ varrho: 'ϱ',
+ varsigma: 'ς',
+ varsubsetneq: '⊊︀',
+ varsubsetneqq: '⫋︀',
+ varsupsetneq: '⊋︀',
+ varsupsetneqq: '⫌︀',
+ vartheta: 'ϑ',
+ vartriangleleft: '⊲',
+ vartriangleright: '⊳',
+ vcy: 'в',
+ vdash: '⊢',
+ vee: '∨',
+ veebar: '⊻',
+ veeeq: '≚',
+ vellip: '⋮',
+ verbar: '|',
+ vert: '|',
+ vfr: '𝔳',
+ vltri: '⊲',
+ vnsub: '⊂⃒',
+ vnsup: '⊃⃒',
+ vopf: '𝕧',
+ vprop: '∝',
+ vrtri: '⊳',
+ vscr: '𝓋',
+ vsubnE: '⫋︀',
+ vsubne: '⊊︀',
+ vsupnE: '⫌︀',
+ vsupne: '⊋︀',
+ vzigzag: '⦚',
+ wcirc: 'ŵ',
+ wedbar: '⩟',
+ wedge: '∧',
+ wedgeq: '≙',
+ weierp: '℘',
+ wfr: '𝔴',
+ wopf: '𝕨',
+ wp: '℘',
+ wr: '≀',
+ wreath: '≀',
+ wscr: '𝓌',
+ xcap: '⋂',
+ xcirc: '◯',
+ xcup: '⋃',
+ xdtri: '▽',
+ xfr: '𝔵',
+ xhArr: '⟺',
+ xharr: '⟷',
+ xi: 'ξ',
+ xlArr: '⟸',
+ xlarr: '⟵',
+ xmap: '⟼',
+ xnis: '⋻',
+ xodot: '⨀',
+ xopf: '𝕩',
+ xoplus: '⨁',
+ xotime: '⨂',
+ xrArr: '⟹',
+ xrarr: '⟶',
+ xscr: '𝓍',
+ xsqcup: '⨆',
+ xuplus: '⨄',
+ xutri: '△',
+ xvee: '⋁',
+ xwedge: '⋀',
+ yacute: 'ý',
+ yacy: 'я',
+ ycirc: 'ŷ',
+ ycy: 'ы',
+ yen: '¥',
+ yfr: '𝔶',
+ yicy: 'ї',
+ yopf: '𝕪',
+ yscr: '𝓎',
+ yucy: 'ю',
+ yuml: 'ÿ',
+ zacute: 'ź',
+ zcaron: 'ž',
+ zcy: 'з',
+ zdot: 'ż',
+ zeetrf: 'ℨ',
+ zeta: 'ζ',
+ zfr: '𝔷',
+ zhcy: 'ж',
+ zigrarr: '⇝',
+ zopf: '𝕫',
+ zscr: '𝓏',
+ zwj: '',
+ zwnj: ''
+};
+
+const own$1 = {}.hasOwnProperty;
+
+/**
+ * Decode a single character reference (without the `&` or `;`).
+ * You probably only need this when you’re building parsers yourself that follow
+ * different rules compared to HTML.
+ * This is optimized to be tiny in browsers.
+ *
+ * @param {string} value
+ * `notin` (named), `#123` (deci), `#x123` (hexa).
+ * @returns {string|false}
+ * Decoded reference.
+ */
+function decodeNamedCharacterReference(value) {
+ return own$1.call(characterEntities, value) ? characterEntities[value] : false
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const characterReference = {
+ name: 'characterReference',
+ tokenize: tokenizeCharacterReference
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCharacterReference(effects, ok, nok) {
+ const self = this;
+ let size = 0;
+ /** @type {number} */
+ let max;
+ /** @type {(code: Code) => boolean} */
+ let test;
+ return start
+
+ /**
+ * Start of character reference.
+ *
+ * ```markdown
+ * > | a&b
+ * ^
+ * > | a{b
+ * ^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('characterReference');
+ effects.enter('characterReferenceMarker');
+ effects.consume(code);
+ effects.exit('characterReferenceMarker');
+ return open
+ }
+
+ /**
+ * After `&`, at `#` for numeric references or alphanumeric for named
+ * references.
+ *
+ * ```markdown
+ * > | a&b
+ * ^
+ * > | a{b
+ * ^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 35) {
+ effects.enter('characterReferenceMarkerNumeric');
+ effects.consume(code);
+ effects.exit('characterReferenceMarkerNumeric');
+ return numeric
+ }
+ effects.enter('characterReferenceValue');
+ max = 31;
+ test = asciiAlphanumeric;
+ return value(code)
+ }
+
+ /**
+ * After `#`, at `x` for hexadecimals or digit for decimals.
+ *
+ * ```markdown
+ * > | a{b
+ * ^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function numeric(code) {
+ if (code === 88 || code === 120) {
+ effects.enter('characterReferenceMarkerHexadecimal');
+ effects.consume(code);
+ effects.exit('characterReferenceMarkerHexadecimal');
+ effects.enter('characterReferenceValue');
+ max = 6;
+ test = asciiHexDigit;
+ return value
+ }
+ effects.enter('characterReferenceValue');
+ max = 7;
+ test = asciiDigit;
+ return value(code)
+ }
+
+ /**
+ * After markers (``, ``, or `&`), in value, before `;`.
+ *
+ * The character reference kind defines what and how many characters are
+ * allowed.
+ *
+ * ```markdown
+ * > | a&b
+ * ^^^
+ * > | a{b
+ * ^^^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function value(code) {
+ if (code === 59 && size) {
+ const token = effects.exit('characterReferenceValue');
+ if (
+ test === asciiAlphanumeric &&
+ !decodeNamedCharacterReference(self.sliceSerialize(token))
+ ) {
+ return nok(code)
+ }
+
+ // To do: `markdown-rs` uses a different name:
+ // `CharacterReferenceMarkerSemi`.
+ effects.enter('characterReferenceMarker');
+ effects.consume(code);
+ effects.exit('characterReferenceMarker');
+ effects.exit('characterReference');
+ return ok
+ }
+ if (test(code) && size++ < max) {
+ effects.consume(code);
+ return value
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const nonLazyContinuation = {
+ tokenize: tokenizeNonLazyContinuation,
+ partial: true
+};
+
+/** @type {Construct} */
+const codeFenced = {
+ name: 'codeFenced',
+ tokenize: tokenizeCodeFenced,
+ concrete: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCodeFenced(effects, ok, nok) {
+ const self = this;
+ /** @type {Construct} */
+ const closeStart = {
+ tokenize: tokenizeCloseStart,
+ partial: true
+ };
+ let initialPrefix = 0;
+ let sizeOpen = 0;
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Start of code.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: parse whitespace like `markdown-rs`.
+ return beforeSequenceOpen(code)
+ }
+
+ /**
+ * In opening fence, after prefix, at sequence.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeSequenceOpen(code) {
+ const tail = self.events[self.events.length - 1];
+ initialPrefix =
+ tail && tail[1].type === 'linePrefix'
+ ? tail[2].sliceSerialize(tail[1], true).length
+ : 0;
+ marker = code;
+ effects.enter('codeFenced');
+ effects.enter('codeFencedFence');
+ effects.enter('codeFencedFenceSequence');
+ return sequenceOpen(code)
+ }
+
+ /**
+ * In opening fence sequence.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceOpen(code) {
+ if (code === marker) {
+ sizeOpen++;
+ effects.consume(code);
+ return sequenceOpen
+ }
+ if (sizeOpen < 3) {
+ return nok(code)
+ }
+ effects.exit('codeFencedFenceSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, infoBefore, 'whitespace')(code)
+ : infoBefore(code)
+ }
+
+ /**
+ * In opening fence, after the sequence (and optional whitespace), before info.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function infoBefore(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFencedFence');
+ return self.interrupt
+ ? ok(code)
+ : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
+ }
+ effects.enter('codeFencedFenceInfo');
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return info(code)
+ }
+
+ /**
+ * In info.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function info(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('chunkString');
+ effects.exit('codeFencedFenceInfo');
+ return infoBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.exit('chunkString');
+ effects.exit('codeFencedFenceInfo');
+ return factorySpace(effects, metaBefore, 'whitespace')(code)
+ }
+ if (code === 96 && code === marker) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return info
+ }
+
+ /**
+ * In opening fence, after info and whitespace, before meta.
+ *
+ * ```markdown
+ * > | ~~~js eval
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function metaBefore(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return infoBefore(code)
+ }
+ effects.enter('codeFencedFenceMeta');
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return meta(code)
+ }
+
+ /**
+ * In meta.
+ *
+ * ```markdown
+ * > | ~~~js eval
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function meta(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('chunkString');
+ effects.exit('codeFencedFenceMeta');
+ return infoBefore(code)
+ }
+ if (code === 96 && code === marker) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return meta
+ }
+
+ /**
+ * At eol/eof in code, before a non-lazy closing fence or content.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function atNonLazyBreak(code) {
+ return effects.attempt(closeStart, after, contentBefore)(code)
+ }
+
+ /**
+ * Before code content, not a closing fence, at eol.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function contentBefore(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return contentStart
+ }
+
+ /**
+ * Before code content, not a closing fence.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function contentStart(code) {
+ return initialPrefix > 0 && markdownSpace(code)
+ ? factorySpace(
+ effects,
+ beforeContentChunk,
+ 'linePrefix',
+ initialPrefix + 1
+ )(code)
+ : beforeContentChunk(code)
+ }
+
+ /**
+ * Before code content, after optional prefix.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeContentChunk(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
+ }
+ effects.enter('codeFlowValue');
+ return contentChunk(code)
+ }
+
+ /**
+ * In code content.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^^^^^^^^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function contentChunk(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFlowValue');
+ return beforeContentChunk(code)
+ }
+ effects.consume(code);
+ return contentChunk
+ }
+
+ /**
+ * After code.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ effects.exit('codeFenced');
+ return ok(code)
+ }
+
+ /**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+ function tokenizeCloseStart(effects, ok, nok) {
+ let size = 0;
+ return startBefore
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function startBefore(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return start
+ }
+
+ /**
+ * Before closing fence, at optional whitespace.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // Always populated by defaults.
+
+ // To do: `enter` here or in next state?
+ effects.enter('codeFencedFence');
+ return markdownSpace(code)
+ ? factorySpace(
+ effects,
+ beforeSequenceClose,
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ : beforeSequenceClose(code)
+ }
+
+ /**
+ * In closing fence, after optional whitespace, at sequence.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeSequenceClose(code) {
+ if (code === marker) {
+ effects.enter('codeFencedFenceSequence');
+ return sequenceClose(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In closing fence sequence.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceClose(code) {
+ if (code === marker) {
+ size++;
+ effects.consume(code);
+ return sequenceClose
+ }
+ if (size >= sizeOpen) {
+ effects.exit('codeFencedFenceSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, sequenceCloseAfter, 'whitespace')(code)
+ : sequenceCloseAfter(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * After closing fence sequence, after optional whitespace.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceCloseAfter(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFencedFence');
+ return ok(code)
+ }
+ return nok(code)
+ }
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeNonLazyContinuation(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return lineStart
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function lineStart(code) {
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const codeIndented = {
+ name: 'codeIndented',
+ tokenize: tokenizeCodeIndented
+};
+
+/** @type {Construct} */
+const furtherStart = {
+ tokenize: tokenizeFurtherStart,
+ partial: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCodeIndented(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of code (indented).
+ *
+ * > **Parsing note**: it is not needed to check if this first line is a
+ * > filled line (that it has a non-whitespace character), because blank lines
+ * > are parsed already, so we never run into that.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: manually check if interrupting like `markdown-rs`.
+
+ effects.enter('codeIndented');
+ // To do: use an improved `space_or_tab` function like `markdown-rs`,
+ // so that we can drop the next state.
+ return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)
+ }
+
+ /**
+ * At start, after 1 or 4 spaces.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return tail &&
+ tail[1].type === 'linePrefix' &&
+ tail[2].sliceSerialize(tail[1], true).length >= 4
+ ? atBreak(code)
+ : nok(code)
+ }
+
+ /**
+ * At a break.
+ *
+ * ```markdown
+ * > | aaa
+ * ^ ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === null) {
+ return after(code)
+ }
+ if (markdownLineEnding(code)) {
+ return effects.attempt(furtherStart, atBreak, after)(code)
+ }
+ effects.enter('codeFlowValue');
+ return inside(code)
+ }
+
+ /**
+ * In code content.
+ *
+ * ```markdown
+ * > | aaa
+ * ^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFlowValue');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ return inside
+ }
+
+ /** @type {State} */
+ function after(code) {
+ effects.exit('codeIndented');
+ // To do: allow interrupting like `markdown-rs`.
+ // Feel free to interrupt.
+ // tokenizer.interrupt = false
+ return ok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeFurtherStart(effects, ok, nok) {
+ const self = this;
+ return furtherStart
+
+ /**
+ * At eol, trying to parse another indent.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * | bbb
+ * ```
+ *
+ * @type {State}
+ */
+ function furtherStart(code) {
+ // To do: improve `lazy` / `pierce` handling.
+ // If this is a lazy line, it can’t be code.
+ if (self.parser.lazy[self.now().line]) {
+ return nok(code)
+ }
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return furtherStart
+ }
+
+ // To do: the code here in `micromark-js` is a bit different from
+ // `markdown-rs` because there it can attempt spaces.
+ // We can’t yet.
+ //
+ // To do: use an improved `space_or_tab` function like `markdown-rs`,
+ // so that we can drop the next state.
+ return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)
+ }
+
+ /**
+ * At start, after 1 or 4 spaces.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return tail &&
+ tail[1].type === 'linePrefix' &&
+ tail[2].sliceSerialize(tail[1], true).length >= 4
+ ? ok(code)
+ : markdownLineEnding(code)
+ ? furtherStart(code)
+ : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Previous} Previous
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const codeText = {
+ name: 'codeText',
+ tokenize: tokenizeCodeText,
+ resolve: resolveCodeText,
+ previous
+};
+
+// To do: next major: don’t resolve, like `markdown-rs`.
+/** @type {Resolver} */
+function resolveCodeText(events) {
+ let tailExitIndex = events.length - 4;
+ let headEnterIndex = 3;
+ /** @type {number} */
+ let index;
+ /** @type {number | undefined} */
+ let enter;
+
+ // If we start and end with an EOL or a space.
+ if (
+ (events[headEnterIndex][1].type === 'lineEnding' ||
+ events[headEnterIndex][1].type === 'space') &&
+ (events[tailExitIndex][1].type === 'lineEnding' ||
+ events[tailExitIndex][1].type === 'space')
+ ) {
+ index = headEnterIndex;
+
+ // And we have data.
+ while (++index < tailExitIndex) {
+ if (events[index][1].type === 'codeTextData') {
+ // Then we have padding.
+ events[headEnterIndex][1].type = 'codeTextPadding';
+ events[tailExitIndex][1].type = 'codeTextPadding';
+ headEnterIndex += 2;
+ tailExitIndex -= 2;
+ break
+ }
+ }
+ }
+
+ // Merge adjacent spaces and data.
+ index = headEnterIndex - 1;
+ tailExitIndex++;
+ while (++index <= tailExitIndex) {
+ if (enter === undefined) {
+ if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') {
+ enter = index;
+ }
+ } else if (
+ index === tailExitIndex ||
+ events[index][1].type === 'lineEnding'
+ ) {
+ events[enter][1].type = 'codeTextData';
+ if (index !== enter + 2) {
+ events[enter][1].end = events[index - 1][1].end;
+ events.splice(enter + 2, index - enter - 2);
+ tailExitIndex -= index - enter - 2;
+ index = enter + 2;
+ }
+ enter = undefined;
+ }
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Previous}
+ */
+function previous(code) {
+ // If there is a previous code, there will always be a tail.
+ return (
+ code !== 96 ||
+ this.events[this.events.length - 1][1].type === 'characterEscape'
+ )
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCodeText(effects, ok, nok) {
+ let sizeOpen = 0;
+ /** @type {number} */
+ let size;
+ /** @type {Token} */
+ let token;
+ return start
+
+ /**
+ * Start of code (text).
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * > | \`a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('codeText');
+ effects.enter('codeTextSequence');
+ return sequenceOpen(code)
+ }
+
+ /**
+ * In opening sequence.
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceOpen(code) {
+ if (code === 96) {
+ effects.consume(code);
+ sizeOpen++;
+ return sequenceOpen
+ }
+ effects.exit('codeTextSequence');
+ return between(code)
+ }
+
+ /**
+ * Between something and something else.
+ *
+ * ```markdown
+ * > | `a`
+ * ^^
+ * ```
+ *
+ * @type {State}
+ */
+ function between(code) {
+ // EOF.
+ if (code === null) {
+ return nok(code)
+ }
+
+ // To do: next major: don’t do spaces in resolve, but when compiling,
+ // like `markdown-rs`.
+ // Tabs don’t work, and virtual spaces don’t make sense.
+ if (code === 32) {
+ effects.enter('space');
+ effects.consume(code);
+ effects.exit('space');
+ return between
+ }
+
+ // Closing fence? Could also be data.
+ if (code === 96) {
+ token = effects.enter('codeTextSequence');
+ size = 0;
+ return sequenceClose(code)
+ }
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return between
+ }
+
+ // Data.
+ effects.enter('codeTextData');
+ return data(code)
+ }
+
+ /**
+ * In data.
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function data(code) {
+ if (
+ code === null ||
+ code === 32 ||
+ code === 96 ||
+ markdownLineEnding(code)
+ ) {
+ effects.exit('codeTextData');
+ return between(code)
+ }
+ effects.consume(code);
+ return data
+ }
+
+ /**
+ * In closing sequence.
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceClose(code) {
+ // More.
+ if (code === 96) {
+ effects.consume(code);
+ size++;
+ return sequenceClose
+ }
+
+ // Done!
+ if (size === sizeOpen) {
+ effects.exit('codeTextSequence');
+ effects.exit('codeText');
+ return ok(code)
+ }
+
+ // More or less accents: mark as data.
+ token.type = 'codeTextData';
+ return data(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Chunk} Chunk
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').Token} Token
+ */
+
+/**
+ * Tokenize subcontent.
+ *
+ * @param {Array} events
+ * List of events.
+ * @returns {boolean}
+ * Whether subtokens were found.
+ */
+function subtokenize(events) {
+ /** @type {Record} */
+ const jumps = {};
+ let index = -1;
+ /** @type {Event} */
+ let event;
+ /** @type {number | undefined} */
+ let lineIndex;
+ /** @type {number} */
+ let otherIndex;
+ /** @type {Event} */
+ let otherEvent;
+ /** @type {Array} */
+ let parameters;
+ /** @type {Array} */
+ let subevents;
+ /** @type {boolean | undefined} */
+ let more;
+ while (++index < events.length) {
+ while (index in jumps) {
+ index = jumps[index];
+ }
+ event = events[index];
+
+ // Add a hook for the GFM tasklist extension, which needs to know if text
+ // is in the first content of a list item.
+ if (
+ index &&
+ event[1].type === 'chunkFlow' &&
+ events[index - 1][1].type === 'listItemPrefix'
+ ) {
+ subevents = event[1]._tokenizer.events;
+ otherIndex = 0;
+ if (
+ otherIndex < subevents.length &&
+ subevents[otherIndex][1].type === 'lineEndingBlank'
+ ) {
+ otherIndex += 2;
+ }
+ if (
+ otherIndex < subevents.length &&
+ subevents[otherIndex][1].type === 'content'
+ ) {
+ while (++otherIndex < subevents.length) {
+ if (subevents[otherIndex][1].type === 'content') {
+ break
+ }
+ if (subevents[otherIndex][1].type === 'chunkText') {
+ subevents[otherIndex][1]._isInFirstContentOfListItem = true;
+ otherIndex++;
+ }
+ }
+ }
+ }
+
+ // Enter.
+ if (event[0] === 'enter') {
+ if (event[1].contentType) {
+ Object.assign(jumps, subcontent(events, index));
+ index = jumps[index];
+ more = true;
+ }
+ }
+ // Exit.
+ else if (event[1]._container) {
+ otherIndex = index;
+ lineIndex = undefined;
+ while (otherIndex--) {
+ otherEvent = events[otherIndex];
+ if (
+ otherEvent[1].type === 'lineEnding' ||
+ otherEvent[1].type === 'lineEndingBlank'
+ ) {
+ if (otherEvent[0] === 'enter') {
+ if (lineIndex) {
+ events[lineIndex][1].type = 'lineEndingBlank';
+ }
+ otherEvent[1].type = 'lineEnding';
+ lineIndex = otherIndex;
+ }
+ } else {
+ break
+ }
+ }
+ if (lineIndex) {
+ // Fix position.
+ event[1].end = Object.assign({}, events[lineIndex][1].start);
+
+ // Switch container exit w/ line endings.
+ parameters = events.slice(lineIndex, index);
+ parameters.unshift(event);
+ splice(events, lineIndex, index - lineIndex + 1, parameters);
+ }
+ }
+ }
+ return !more
+}
+
+/**
+ * Tokenize embedded tokens.
+ *
+ * @param {Array} events
+ * @param {number} eventIndex
+ * @returns {Record}
+ */
+function subcontent(events, eventIndex) {
+ const token = events[eventIndex][1];
+ const context = events[eventIndex][2];
+ let startPosition = eventIndex - 1;
+ /** @type {Array} */
+ const startPositions = [];
+ const tokenizer =
+ token._tokenizer || context.parser[token.contentType](token.start);
+ const childEvents = tokenizer.events;
+ /** @type {Array<[number, number]>} */
+ const jumps = [];
+ /** @type {Record} */
+ const gaps = {};
+ /** @type {Array} */
+ let stream;
+ /** @type {Token | undefined} */
+ let previous;
+ let index = -1;
+ /** @type {Token | undefined} */
+ let current = token;
+ let adjust = 0;
+ let start = 0;
+ const breaks = [start];
+
+ // Loop forward through the linked tokens to pass them in order to the
+ // subtokenizer.
+ while (current) {
+ // Find the position of the event for this token.
+ while (events[++startPosition][1] !== current) {
+ // Empty.
+ }
+ startPositions.push(startPosition);
+ if (!current._tokenizer) {
+ stream = context.sliceStream(current);
+ if (!current.next) {
+ stream.push(null);
+ }
+ if (previous) {
+ tokenizer.defineSkip(current.start);
+ }
+ if (current._isInFirstContentOfListItem) {
+ tokenizer._gfmTasklistFirstContentOfListItem = true;
+ }
+ tokenizer.write(stream);
+ if (current._isInFirstContentOfListItem) {
+ tokenizer._gfmTasklistFirstContentOfListItem = undefined;
+ }
+ }
+
+ // Unravel the next token.
+ previous = current;
+ current = current.next;
+ }
+
+ // Now, loop back through all events (and linked tokens), to figure out which
+ // parts belong where.
+ current = token;
+ while (++index < childEvents.length) {
+ if (
+ // Find a void token that includes a break.
+ childEvents[index][0] === 'exit' &&
+ childEvents[index - 1][0] === 'enter' &&
+ childEvents[index][1].type === childEvents[index - 1][1].type &&
+ childEvents[index][1].start.line !== childEvents[index][1].end.line
+ ) {
+ start = index + 1;
+ breaks.push(start);
+ // Help GC.
+ current._tokenizer = undefined;
+ current.previous = undefined;
+ current = current.next;
+ }
+ }
+
+ // Help GC.
+ tokenizer.events = [];
+
+ // If there’s one more token (which is the cases for lines that end in an
+ // EOF), that’s perfect: the last point we found starts it.
+ // If there isn’t then make sure any remaining content is added to it.
+ if (current) {
+ // Help GC.
+ current._tokenizer = undefined;
+ current.previous = undefined;
+ } else {
+ breaks.pop();
+ }
+
+ // Now splice the events from the subtokenizer into the current events,
+ // moving back to front so that splice indices aren’t affected.
+ index = breaks.length;
+ while (index--) {
+ const slice = childEvents.slice(breaks[index], breaks[index + 1]);
+ const start = startPositions.pop();
+ jumps.unshift([start, start + slice.length - 1]);
+ splice(events, start, 2, slice);
+ }
+ index = -1;
+ while (++index < jumps.length) {
+ gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
+ adjust += jumps[index][1] - jumps[index][0] - 1;
+ }
+ return gaps
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/**
+ * No name because it must not be turned off.
+ * @type {Construct}
+ */
+const content = {
+ tokenize: tokenizeContent,
+ resolve: resolveContent
+};
+
+/** @type {Construct} */
+const continuationConstruct = {
+ tokenize: tokenizeContinuation,
+ partial: true
+};
+
+/**
+ * Content is transparent: it’s parsed right now. That way, definitions are also
+ * parsed right now: before text in paragraphs (specifically, media) are parsed.
+ *
+ * @type {Resolver}
+ */
+function resolveContent(events) {
+ subtokenize(events);
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeContent(effects, ok) {
+ /** @type {Token | undefined} */
+ let previous;
+ return chunkStart
+
+ /**
+ * Before a content chunk.
+ *
+ * ```markdown
+ * > | abc
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function chunkStart(code) {
+ effects.enter('content');
+ previous = effects.enter('chunkContent', {
+ contentType: 'content'
+ });
+ return chunkInside(code)
+ }
+
+ /**
+ * In a content chunk.
+ *
+ * ```markdown
+ * > | abc
+ * ^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function chunkInside(code) {
+ if (code === null) {
+ return contentEnd(code)
+ }
+
+ // To do: in `markdown-rs`, each line is parsed on its own, and everything
+ // is stitched together resolving.
+ if (markdownLineEnding(code)) {
+ return effects.check(
+ continuationConstruct,
+ contentContinue,
+ contentEnd
+ )(code)
+ }
+
+ // Data.
+ effects.consume(code);
+ return chunkInside
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function contentEnd(code) {
+ effects.exit('chunkContent');
+ effects.exit('content');
+ return ok(code)
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function contentContinue(code) {
+ effects.consume(code);
+ effects.exit('chunkContent');
+ previous.next = effects.enter('chunkContent', {
+ contentType: 'content',
+ previous
+ });
+ previous = previous.next;
+ return chunkInside
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeContinuation(effects, ok, nok) {
+ const self = this;
+ return startLookahead
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function startLookahead(code) {
+ effects.exit('chunkContent');
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, prefixed, 'linePrefix')
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function prefixed(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return nok(code)
+ }
+
+ // Always populated by defaults.
+
+ const tail = self.events[self.events.length - 1];
+ if (
+ !self.parser.constructs.disable.null.includes('codeIndented') &&
+ tail &&
+ tail[1].type === 'linePrefix' &&
+ tail[2].sliceSerialize(tail[1], true).length >= 4
+ ) {
+ return ok(code)
+ }
+ return effects.interrupt(self.parser.constructs.flow, nok, ok)(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+/**
+ * Parse destinations.
+ *
+ * ###### Examples
+ *
+ * ```markdown
+ *
+ * b>
+ *
+ *
+ * a
+ * a\)b
+ * a(b)c
+ * a(b)
+ * ```
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {State} nok
+ * State switched to when unsuccessful.
+ * @param {TokenType} type
+ * Type for whole (`` or `b`).
+ * @param {TokenType} literalType
+ * Type when enclosed (``).
+ * @param {TokenType} literalMarkerType
+ * Type for enclosing (`<` and `>`).
+ * @param {TokenType} rawType
+ * Type when not enclosed (`b`).
+ * @param {TokenType} stringType
+ * Type for the value (`a` or `b`).
+ * @param {number | undefined} [max=Infinity]
+ * Depth of nested parens (inclusive).
+ * @returns {State}
+ * Start state.
+ */ // eslint-disable-next-line max-params
+function factoryDestination(
+ effects,
+ ok,
+ nok,
+ type,
+ literalType,
+ literalMarkerType,
+ rawType,
+ stringType,
+ max
+) {
+ const limit = max || Number.POSITIVE_INFINITY;
+ let balance = 0;
+ return start
+
+ /**
+ * Start of destination.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > | aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === 60) {
+ effects.enter(type);
+ effects.enter(literalType);
+ effects.enter(literalMarkerType);
+ effects.consume(code);
+ effects.exit(literalMarkerType);
+ return enclosedBefore
+ }
+
+ // ASCII control, space, closing paren.
+ if (code === null || code === 32 || code === 41 || asciiControl(code)) {
+ return nok(code)
+ }
+ effects.enter(type);
+ effects.enter(rawType);
+ effects.enter(stringType);
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return raw(code)
+ }
+
+ /**
+ * After `<`, at an enclosed destination.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function enclosedBefore(code) {
+ if (code === 62) {
+ effects.enter(literalMarkerType);
+ effects.consume(code);
+ effects.exit(literalMarkerType);
+ effects.exit(literalType);
+ effects.exit(type);
+ return ok
+ }
+ effects.enter(stringType);
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return enclosed(code)
+ }
+
+ /**
+ * In enclosed destination.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function enclosed(code) {
+ if (code === 62) {
+ effects.exit('chunkString');
+ effects.exit(stringType);
+ return enclosedBefore(code)
+ }
+ if (code === null || code === 60 || markdownLineEnding(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return code === 92 ? enclosedEscape : enclosed
+ }
+
+ /**
+ * After `\`, at a special character.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function enclosedEscape(code) {
+ if (code === 60 || code === 62 || code === 92) {
+ effects.consume(code);
+ return enclosed
+ }
+ return enclosed(code)
+ }
+
+ /**
+ * In raw destination.
+ *
+ * ```markdown
+ * > | aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function raw(code) {
+ if (
+ !balance &&
+ (code === null || code === 41 || markdownLineEndingOrSpace(code))
+ ) {
+ effects.exit('chunkString');
+ effects.exit(stringType);
+ effects.exit(rawType);
+ effects.exit(type);
+ return ok(code)
+ }
+ if (balance < limit && code === 40) {
+ effects.consume(code);
+ balance++;
+ return raw
+ }
+ if (code === 41) {
+ effects.consume(code);
+ balance--;
+ return raw
+ }
+
+ // ASCII control (but *not* `\0`) and space and `(`.
+ // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it
+ // doesn’t.
+ if (code === null || code === 32 || code === 40 || asciiControl(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return code === 92 ? rawEscape : raw
+ }
+
+ /**
+ * After `\`, at special character.
+ *
+ * ```markdown
+ * > | a\*a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function rawEscape(code) {
+ if (code === 40 || code === 41 || code === 92) {
+ effects.consume(code);
+ return raw
+ }
+ return raw(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+/**
+ * Parse labels.
+ *
+ * > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
+ *
+ * ###### Examples
+ *
+ * ```markdown
+ * [a]
+ * [a
+ * b]
+ * [a\]b]
+ * ```
+ *
+ * @this {TokenizeContext}
+ * Tokenize context.
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {State} nok
+ * State switched to when unsuccessful.
+ * @param {TokenType} type
+ * Type of the whole label (`[a]`).
+ * @param {TokenType} markerType
+ * Type for the markers (`[` and `]`).
+ * @param {TokenType} stringType
+ * Type for the identifier (`a`).
+ * @returns {State}
+ * Start state.
+ */ // eslint-disable-next-line max-params
+function factoryLabel(effects, ok, nok, type, markerType, stringType) {
+ const self = this;
+ let size = 0;
+ /** @type {boolean} */
+ let seen;
+ return start
+
+ /**
+ * Start of label.
+ *
+ * ```markdown
+ * > | [a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter(type);
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ effects.enter(stringType);
+ return atBreak
+ }
+
+ /**
+ * In label, at something, before something else.
+ *
+ * ```markdown
+ * > | [a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (
+ size > 999 ||
+ code === null ||
+ code === 91 ||
+ (code === 93 && !seen) ||
+ // To do: remove in the future once we’ve switched from
+ // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
+ // which doesn’t need this.
+ // Hidden footnotes hook.
+ /* c8 ignore next 3 */
+ (code === 94 &&
+ !size &&
+ '_hiddenFootnoteSupport' in self.parser.constructs)
+ ) {
+ return nok(code)
+ }
+ if (code === 93) {
+ effects.exit(stringType);
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ effects.exit(type);
+ return ok
+ }
+
+ // To do: indent? Link chunks and EOLs together?
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return atBreak
+ }
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return labelInside(code)
+ }
+
+ /**
+ * In label, in text.
+ *
+ * ```markdown
+ * > | [a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelInside(code) {
+ if (
+ code === null ||
+ code === 91 ||
+ code === 93 ||
+ markdownLineEnding(code) ||
+ size++ > 999
+ ) {
+ effects.exit('chunkString');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ if (!seen) seen = !markdownSpace(code);
+ return code === 92 ? labelEscape : labelInside
+ }
+
+ /**
+ * After `\`, at a special character.
+ *
+ * ```markdown
+ * > | [a\*a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelEscape(code) {
+ if (code === 91 || code === 92 || code === 93) {
+ effects.consume(code);
+ size++;
+ return labelInside
+ }
+ return labelInside(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+/**
+ * Parse titles.
+ *
+ * ###### Examples
+ *
+ * ```markdown
+ * "a"
+ * 'b'
+ * (c)
+ * "a
+ * b"
+ * 'a
+ * b'
+ * (a\)b)
+ * ```
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {State} nok
+ * State switched to when unsuccessful.
+ * @param {TokenType} type
+ * Type of the whole title (`"a"`, `'b'`, `(c)`).
+ * @param {TokenType} markerType
+ * Type for the markers (`"`, `'`, `(`, and `)`).
+ * @param {TokenType} stringType
+ * Type for the value (`a`).
+ * @returns {State}
+ * Start state.
+ */ // eslint-disable-next-line max-params
+function factoryTitle(effects, ok, nok, type, markerType, stringType) {
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Start of title.
+ *
+ * ```markdown
+ * > | "a"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === 34 || code === 39 || code === 40) {
+ effects.enter(type);
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ marker = code === 40 ? 41 : code;
+ return begin
+ }
+ return nok(code)
+ }
+
+ /**
+ * After opening marker.
+ *
+ * This is also used at the closing marker.
+ *
+ * ```markdown
+ * > | "a"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function begin(code) {
+ if (code === marker) {
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ effects.exit(type);
+ return ok
+ }
+ effects.enter(stringType);
+ return atBreak(code)
+ }
+
+ /**
+ * At something, before something else.
+ *
+ * ```markdown
+ * > | "a"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === marker) {
+ effects.exit(stringType);
+ return begin(marker)
+ }
+ if (code === null) {
+ return nok(code)
+ }
+
+ // Note: blank lines can’t exist in content.
+ if (markdownLineEnding(code)) {
+ // To do: use `space_or_tab_eol_with_options`, connect.
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, atBreak, 'linePrefix')
+ }
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return inside(code)
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === marker || code === null || markdownLineEnding(code)) {
+ effects.exit('chunkString');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ return code === 92 ? escape : inside
+ }
+
+ /**
+ * After `\`, at a special character.
+ *
+ * ```markdown
+ * > | "a\*b"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function escape(code) {
+ if (code === marker || code === 92) {
+ effects.consume(code);
+ return inside
+ }
+ return inside(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ */
+
+/**
+ * Parse spaces and tabs.
+ *
+ * There is no `nok` parameter:
+ *
+ * * line endings or spaces in markdown are often optional, in which case this
+ * factory can be used and `ok` will be switched to whether spaces were found
+ * or not
+ * * one line ending or space can be detected with
+ * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @returns
+ * Start state.
+ */
+function factoryWhitespace(effects, ok) {
+ /** @type {boolean} */
+ let seen;
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ seen = true;
+ return start
+ }
+ if (markdownSpace(code)) {
+ return factorySpace(
+ effects,
+ start,
+ seen ? 'linePrefix' : 'lineSuffix'
+ )(code)
+ }
+ return ok(code)
+ }
+}
+
+/**
+ * Normalize an identifier (as found in references, definitions).
+ *
+ * Collapses markdown whitespace, trim, and then lower- and uppercase.
+ *
+ * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their
+ * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different
+ * uppercase character (U+0398 (`Θ`)).
+ * So, to get a canonical form, we perform both lower- and uppercase.
+ *
+ * Using uppercase last makes sure keys will never interact with default
+ * prototypal values (such as `constructor`): nothing in the prototype of
+ * `Object` is uppercase.
+ *
+ * @param {string} value
+ * Identifier to normalize.
+ * @returns {string}
+ * Normalized identifier.
+ */
+function normalizeIdentifier(value) {
+ return (
+ value
+ // Collapse markdown whitespace.
+ .replace(/[\t\n\r ]+/g, ' ')
+ // Trim.
+ .replace(/^ | $/g, '')
+ // Some characters are considered “uppercase”, but if their lowercase
+ // counterpart is uppercased will result in a different uppercase
+ // character.
+ // Hence, to get that form, we perform both lower- and uppercase.
+ // Upper case makes sure keys will not interact with default prototypal
+ // methods: no method is uppercase.
+ .toLowerCase()
+ .toUpperCase()
+ )
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const definition = {
+ name: 'definition',
+ tokenize: tokenizeDefinition
+};
+
+/** @type {Construct} */
+const titleBefore = {
+ tokenize: tokenizeTitleBefore,
+ partial: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeDefinition(effects, ok, nok) {
+ const self = this;
+ /** @type {string} */
+ let identifier;
+ return start
+
+ /**
+ * At start of a definition.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // Do not interrupt paragraphs (but do follow definitions).
+ // To do: do `interrupt` the way `markdown-rs` does.
+ // To do: parse whitespace the way `markdown-rs` does.
+ effects.enter('definition');
+ return before(code)
+ }
+
+ /**
+ * After optional whitespace, at `[`.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ // To do: parse whitespace the way `markdown-rs` does.
+
+ return factoryLabel.call(
+ self,
+ effects,
+ labelAfter,
+ // Note: we don’t need to reset the way `markdown-rs` does.
+ nok,
+ 'definitionLabel',
+ 'definitionLabelMarker',
+ 'definitionLabelString'
+ )(code)
+ }
+
+ /**
+ * After label.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelAfter(code) {
+ identifier = normalizeIdentifier(
+ self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
+ );
+ if (code === 58) {
+ effects.enter('definitionMarker');
+ effects.consume(code);
+ effects.exit('definitionMarker');
+ return markerAfter
+ }
+ return nok(code)
+ }
+
+ /**
+ * After marker.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function markerAfter(code) {
+ // Note: whitespace is optional.
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, destinationBefore)(code)
+ : destinationBefore(code)
+ }
+
+ /**
+ * Before destination.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function destinationBefore(code) {
+ return factoryDestination(
+ effects,
+ destinationAfter,
+ // Note: we don’t need to reset the way `markdown-rs` does.
+ nok,
+ 'definitionDestination',
+ 'definitionDestinationLiteral',
+ 'definitionDestinationLiteralMarker',
+ 'definitionDestinationRaw',
+ 'definitionDestinationString'
+ )(code)
+ }
+
+ /**
+ * After destination.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function destinationAfter(code) {
+ return effects.attempt(titleBefore, after, after)(code)
+ }
+
+ /**
+ * After definition.
+ *
+ * ```markdown
+ * > | [a]: b
+ * ^
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ return markdownSpace(code)
+ ? factorySpace(effects, afterWhitespace, 'whitespace')(code)
+ : afterWhitespace(code)
+ }
+
+ /**
+ * After definition, after optional whitespace.
+ *
+ * ```markdown
+ * > | [a]: b
+ * ^
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function afterWhitespace(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('definition');
+
+ // Note: we don’t care about uniqueness.
+ // It’s likely that that doesn’t happen very frequently.
+ // It is more likely that it wastes precious time.
+ self.parser.defined.push(identifier);
+
+ // To do: `markdown-rs` interrupt.
+ // // You’d be interrupting.
+ // tokenizer.interrupt = true
+ return ok(code)
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeTitleBefore(effects, ok, nok) {
+ return titleBefore
+
+ /**
+ * After destination, at whitespace.
+ *
+ * ```markdown
+ * > | [a]: b
+ * ^
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function titleBefore(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, beforeMarker)(code)
+ : nok(code)
+ }
+
+ /**
+ * At title.
+ *
+ * ```markdown
+ * | [a]: b
+ * > | "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeMarker(code) {
+ return factoryTitle(
+ effects,
+ titleAfter,
+ nok,
+ 'definitionTitle',
+ 'definitionTitleMarker',
+ 'definitionTitleString'
+ )(code)
+ }
+
+ /**
+ * After title.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function titleAfter(code) {
+ return markdownSpace(code)
+ ? factorySpace(effects, titleAfterOptionalWhitespace, 'whitespace')(code)
+ : titleAfterOptionalWhitespace(code)
+ }
+
+ /**
+ * After title, after optional whitespace.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function titleAfterOptionalWhitespace(code) {
+ return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const hardBreakEscape = {
+ name: 'hardBreakEscape',
+ tokenize: tokenizeHardBreakEscape
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHardBreakEscape(effects, ok, nok) {
+ return start
+
+ /**
+ * Start of a hard break (escape).
+ *
+ * ```markdown
+ * > | a\
+ * ^
+ * | b
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('hardBreakEscape');
+ effects.consume(code);
+ return after
+ }
+
+ /**
+ * After `\`, at eol.
+ *
+ * ```markdown
+ * > | a\
+ * ^
+ * | b
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ if (markdownLineEnding(code)) {
+ effects.exit('hardBreakEscape');
+ return ok(code)
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const headingAtx = {
+ name: 'headingAtx',
+ tokenize: tokenizeHeadingAtx,
+ resolve: resolveHeadingAtx
+};
+
+/** @type {Resolver} */
+function resolveHeadingAtx(events, context) {
+ let contentEnd = events.length - 2;
+ let contentStart = 3;
+ /** @type {Token} */
+ let content;
+ /** @type {Token} */
+ let text;
+
+ // Prefix whitespace, part of the opening.
+ if (events[contentStart][1].type === 'whitespace') {
+ contentStart += 2;
+ }
+
+ // Suffix whitespace, part of the closing.
+ if (
+ contentEnd - 2 > contentStart &&
+ events[contentEnd][1].type === 'whitespace'
+ ) {
+ contentEnd -= 2;
+ }
+ if (
+ events[contentEnd][1].type === 'atxHeadingSequence' &&
+ (contentStart === contentEnd - 1 ||
+ (contentEnd - 4 > contentStart &&
+ events[contentEnd - 2][1].type === 'whitespace'))
+ ) {
+ contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
+ }
+ if (contentEnd > contentStart) {
+ content = {
+ type: 'atxHeadingText',
+ start: events[contentStart][1].start,
+ end: events[contentEnd][1].end
+ };
+ text = {
+ type: 'chunkText',
+ start: events[contentStart][1].start,
+ end: events[contentEnd][1].end,
+ contentType: 'text'
+ };
+ splice(events, contentStart, contentEnd - contentStart + 1, [
+ ['enter', content, context],
+ ['enter', text, context],
+ ['exit', text, context],
+ ['exit', content, context]
+ ]);
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHeadingAtx(effects, ok, nok) {
+ let size = 0;
+ return start
+
+ /**
+ * Start of a heading (atx).
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: parse indent like `markdown-rs`.
+ effects.enter('atxHeading');
+ return before(code)
+ }
+
+ /**
+ * After optional whitespace, at `#`.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ effects.enter('atxHeadingSequence');
+ return sequenceOpen(code)
+ }
+
+ /**
+ * In opening sequence.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceOpen(code) {
+ if (code === 35 && size++ < 6) {
+ effects.consume(code);
+ return sequenceOpen
+ }
+
+ // Always at least one `#`.
+ if (code === null || markdownLineEndingOrSpace(code)) {
+ effects.exit('atxHeadingSequence');
+ return atBreak(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * After something, before something else.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === 35) {
+ effects.enter('atxHeadingSequence');
+ return sequenceFurther(code)
+ }
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('atxHeading');
+ // To do: interrupt like `markdown-rs`.
+ // // Feel free to interrupt.
+ // tokenizer.interrupt = false
+ return ok(code)
+ }
+ if (markdownSpace(code)) {
+ return factorySpace(effects, atBreak, 'whitespace')(code)
+ }
+
+ // To do: generate `data` tokens, add the `text` token later.
+ // Needs edit map, see: `markdown.rs`.
+ effects.enter('atxHeadingText');
+ return data(code)
+ }
+
+ /**
+ * In further sequence (after whitespace).
+ *
+ * Could be normal “visible” hashes in the heading or a final sequence.
+ *
+ * ```markdown
+ * > | ## aa ##
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceFurther(code) {
+ if (code === 35) {
+ effects.consume(code);
+ return sequenceFurther
+ }
+ effects.exit('atxHeadingSequence');
+ return atBreak(code)
+ }
+
+ /**
+ * In text.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function data(code) {
+ if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {
+ effects.exit('atxHeadingText');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ return data
+ }
+}
+
+/**
+ * List of lowercase HTML “block” tag names.
+ *
+ * The list, when parsing HTML (flow), results in more relaxed rules (condition
+ * 6).
+ * Because they are known blocks, the HTML-like syntax doesn’t have to be
+ * strictly parsed.
+ * For tag names not in this list, a more strict algorithm (condition 7) is used
+ * to detect whether the HTML-like syntax is seen as HTML (flow) or not.
+ *
+ * This is copied from:
+ * .
+ *
+ * > 👉 **Note**: `search` was added in `CommonMark@0.31`.
+ */
+const htmlBlockNames = [
+ 'address',
+ 'article',
+ 'aside',
+ 'base',
+ 'basefont',
+ 'blockquote',
+ 'body',
+ 'caption',
+ 'center',
+ 'col',
+ 'colgroup',
+ 'dd',
+ 'details',
+ 'dialog',
+ 'dir',
+ 'div',
+ 'dl',
+ 'dt',
+ 'fieldset',
+ 'figcaption',
+ 'figure',
+ 'footer',
+ 'form',
+ 'frame',
+ 'frameset',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'head',
+ 'header',
+ 'hr',
+ 'html',
+ 'iframe',
+ 'legend',
+ 'li',
+ 'link',
+ 'main',
+ 'menu',
+ 'menuitem',
+ 'nav',
+ 'noframes',
+ 'ol',
+ 'optgroup',
+ 'option',
+ 'p',
+ 'param',
+ 'search',
+ 'section',
+ 'summary',
+ 'table',
+ 'tbody',
+ 'td',
+ 'tfoot',
+ 'th',
+ 'thead',
+ 'title',
+ 'tr',
+ 'track',
+ 'ul'
+];
+
+/**
+ * List of lowercase HTML “raw” tag names.
+ *
+ * The list, when parsing HTML (flow), results in HTML that can include lines
+ * without exiting, until a closing tag also in this list is found (condition
+ * 1).
+ *
+ * This module is copied from:
+ * .
+ *
+ * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.
+ */
+const htmlRawNames = ['pre', 'script', 'style', 'textarea'];
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const htmlFlow = {
+ name: 'htmlFlow',
+ tokenize: tokenizeHtmlFlow,
+ resolveTo: resolveToHtmlFlow,
+ concrete: true
+};
+
+/** @type {Construct} */
+const blankLineBefore = {
+ tokenize: tokenizeBlankLineBefore,
+ partial: true
+};
+const nonLazyContinuationStart = {
+ tokenize: tokenizeNonLazyContinuationStart,
+ partial: true
+};
+
+/** @type {Resolver} */
+function resolveToHtmlFlow(events) {
+ let index = events.length;
+ while (index--) {
+ if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') {
+ break
+ }
+ }
+ if (index > 1 && events[index - 2][1].type === 'linePrefix') {
+ // Add the prefix start to the HTML token.
+ events[index][1].start = events[index - 2][1].start;
+ // Add the prefix start to the HTML line token.
+ events[index + 1][1].start = events[index - 2][1].start;
+ // Remove the line prefix.
+ events.splice(index - 2, 2);
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHtmlFlow(effects, ok, nok) {
+ const self = this;
+ /** @type {number} */
+ let marker;
+ /** @type {boolean} */
+ let closingTag;
+ /** @type {string} */
+ let buffer;
+ /** @type {number} */
+ let index;
+ /** @type {Code} */
+ let markerB;
+ return start
+
+ /**
+ * Start of HTML (flow).
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: parse indent like `markdown-rs`.
+ return before(code)
+ }
+
+ /**
+ * At `<`, after optional whitespace.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ effects.enter('htmlFlow');
+ effects.enter('htmlFlowData');
+ effects.consume(code);
+ return open
+ }
+
+ /**
+ * After `<`, at tag name or other stuff.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 33) {
+ effects.consume(code);
+ return declarationOpen
+ }
+ if (code === 47) {
+ effects.consume(code);
+ closingTag = true;
+ return tagCloseStart
+ }
+ if (code === 63) {
+ effects.consume(code);
+ marker = 3;
+ // To do:
+ // tokenizer.concrete = true
+ // To do: use `markdown-rs` style interrupt.
+ // While we’re in an instruction instead of a declaration, we’re on a `?`
+ // right now, so we do need to search for `>`, similar to declarations.
+ return self.interrupt ? ok : continuationDeclarationInside
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ // @ts-expect-error: not null.
+ buffer = String.fromCharCode(code);
+ return tagName
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` |
+ * ^
+ * > |
+ * ^
+ * > | &<]]>
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declarationOpen(code) {
+ if (code === 45) {
+ effects.consume(code);
+ marker = 2;
+ return commentOpenInside
+ }
+ if (code === 91) {
+ effects.consume(code);
+ marker = 5;
+ index = 0;
+ return cdataOpenInside
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ marker = 4;
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuationDeclarationInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentOpenInside(code) {
+ if (code === 45) {
+ effects.consume(code);
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuationDeclarationInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` | &<]]>
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataOpenInside(code) {
+ const value = 'CDATA[';
+ if (code === value.charCodeAt(index++)) {
+ effects.consume(code);
+ if (index === value.length) {
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuation
+ }
+ return cdataOpenInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ``, in closing tag, at tag name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseStart(code) {
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ // @ts-expect-error: not null.
+ buffer = String.fromCharCode(code);
+ return tagName
+ }
+ return nok(code)
+ }
+
+ /**
+ * In tag name.
+ *
+ * ```markdown
+ * > |
+ * ^^
+ * > |
+ * ^^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagName(code) {
+ if (
+ code === null ||
+ code === 47 ||
+ code === 62 ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ const slash = code === 47;
+ const name = buffer.toLowerCase();
+ if (!slash && !closingTag && htmlRawNames.includes(name)) {
+ marker = 1;
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok(code) : continuation(code)
+ }
+ if (htmlBlockNames.includes(buffer.toLowerCase())) {
+ marker = 6;
+ if (slash) {
+ effects.consume(code);
+ return basicSelfClosing
+ }
+
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok(code) : continuation(code)
+ }
+ marker = 7;
+ // Do not support complete HTML when interrupting.
+ return self.interrupt && !self.parser.lazy[self.now().line]
+ ? nok(code)
+ : closingTag
+ ? completeClosingTagAfter(code)
+ : completeAttributeNameBefore(code)
+ }
+
+ // ASCII alphanumerical and `-`.
+ if (code === 45 || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ buffer += String.fromCharCode(code);
+ return tagName
+ }
+ return nok(code)
+ }
+
+ /**
+ * After closing slash of a basic tag name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function basicSelfClosing(code) {
+ if (code === 62) {
+ effects.consume(code);
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuation
+ }
+ return nok(code)
+ }
+
+ /**
+ * After closing slash of a complete tag name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeClosingTagAfter(code) {
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeClosingTagAfter
+ }
+ return completeEnd(code)
+ }
+
+ /**
+ * At an attribute name.
+ *
+ * At first, this state is used after a complete tag name, after whitespace,
+ * where it expects optional attributes or the end of the tag.
+ * It is also reused after attributes, when expecting more optional
+ * attributes.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeNameBefore(code) {
+ if (code === 47) {
+ effects.consume(code);
+ return completeEnd
+ }
+
+ // ASCII alphanumerical and `:` and `_`.
+ if (code === 58 || code === 95 || asciiAlpha(code)) {
+ effects.consume(code);
+ return completeAttributeName
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAttributeNameBefore
+ }
+ return completeEnd(code)
+ }
+
+ /**
+ * In attribute name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeName(code) {
+ // ASCII alphanumerical and `-`, `.`, `:`, and `_`.
+ if (
+ code === 45 ||
+ code === 46 ||
+ code === 58 ||
+ code === 95 ||
+ asciiAlphanumeric(code)
+ ) {
+ effects.consume(code);
+ return completeAttributeName
+ }
+ return completeAttributeNameAfter(code)
+ }
+
+ /**
+ * After attribute name, at an optional initializer, the end of the tag, or
+ * whitespace.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeNameAfter(code) {
+ if (code === 61) {
+ effects.consume(code);
+ return completeAttributeValueBefore
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAttributeNameAfter
+ }
+ return completeAttributeNameBefore(code)
+ }
+
+ /**
+ * Before unquoted, double quoted, or single quoted attribute value, allowing
+ * whitespace.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueBefore(code) {
+ if (
+ code === null ||
+ code === 60 ||
+ code === 61 ||
+ code === 62 ||
+ code === 96
+ ) {
+ return nok(code)
+ }
+ if (code === 34 || code === 39) {
+ effects.consume(code);
+ markerB = code;
+ return completeAttributeValueQuoted
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAttributeValueBefore
+ }
+ return completeAttributeValueUnquoted(code)
+ }
+
+ /**
+ * In double or single quoted attribute value.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueQuoted(code) {
+ if (code === markerB) {
+ effects.consume(code);
+ markerB = null;
+ return completeAttributeValueQuotedAfter
+ }
+ if (code === null || markdownLineEnding(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return completeAttributeValueQuoted
+ }
+
+ /**
+ * In unquoted attribute value.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueUnquoted(code) {
+ if (
+ code === null ||
+ code === 34 ||
+ code === 39 ||
+ code === 47 ||
+ code === 60 ||
+ code === 61 ||
+ code === 62 ||
+ code === 96 ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ return completeAttributeNameAfter(code)
+ }
+ effects.consume(code);
+ return completeAttributeValueUnquoted
+ }
+
+ /**
+ * After double or single quoted attribute value, before whitespace or the
+ * end of the tag.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueQuotedAfter(code) {
+ if (code === 47 || code === 62 || markdownSpace(code)) {
+ return completeAttributeNameBefore(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In certain circumstances of a complete tag where only an `>` is allowed.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeEnd(code) {
+ if (code === 62) {
+ effects.consume(code);
+ return completeAfter
+ }
+ return nok(code)
+ }
+
+ /**
+ * After `>` in a complete tag.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAfter(code) {
+ if (code === null || markdownLineEnding(code)) {
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return continuation(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAfter
+ }
+ return nok(code)
+ }
+
+ /**
+ * In continuation of any HTML kind.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuation(code) {
+ if (code === 45 && marker === 2) {
+ effects.consume(code);
+ return continuationCommentInside
+ }
+ if (code === 60 && marker === 1) {
+ effects.consume(code);
+ return continuationRawTagOpen
+ }
+ if (code === 62 && marker === 4) {
+ effects.consume(code);
+ return continuationClose
+ }
+ if (code === 63 && marker === 3) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ if (code === 93 && marker === 5) {
+ effects.consume(code);
+ return continuationCdataInside
+ }
+ if (markdownLineEnding(code) && (marker === 6 || marker === 7)) {
+ effects.exit('htmlFlowData');
+ return effects.check(
+ blankLineBefore,
+ continuationAfter,
+ continuationStart
+ )(code)
+ }
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('htmlFlowData');
+ return continuationStart(code)
+ }
+ effects.consume(code);
+ return continuation
+ }
+
+ /**
+ * In continuation, at eol.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * | asd
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationStart(code) {
+ return effects.check(
+ nonLazyContinuationStart,
+ continuationStartNonLazy,
+ continuationAfter
+ )(code)
+ }
+
+ /**
+ * In continuation, at eol, before non-lazy content.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * | asd
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationStartNonLazy(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return continuationBefore
+ }
+
+ /**
+ * In continuation, before non-lazy content.
+ *
+ * ```markdown
+ * |
+ * > | asd
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationBefore(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return continuationStart(code)
+ }
+ effects.enter('htmlFlowData');
+ return continuation(code)
+ }
+
+ /**
+ * In comment continuation, after one `-`, expecting another.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationCommentInside(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In raw continuation, after `<`, at `/`.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationRawTagOpen(code) {
+ if (code === 47) {
+ effects.consume(code);
+ buffer = '';
+ return continuationRawEndTag
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In raw continuation, after ``, in a raw tag name.
+ *
+ * ```markdown
+ * > |
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationRawEndTag(code) {
+ if (code === 62) {
+ const name = buffer.toLowerCase();
+ if (htmlRawNames.includes(name)) {
+ effects.consume(code);
+ return continuationClose
+ }
+ return continuation(code)
+ }
+ if (asciiAlpha(code) && buffer.length < 8) {
+ effects.consume(code);
+ // @ts-expect-error: not null.
+ buffer += String.fromCharCode(code);
+ return continuationRawEndTag
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In cdata continuation, after `]`, expecting `]>`.
+ *
+ * ```markdown
+ * > | &<]]>
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationCdataInside(code) {
+ if (code === 93) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In declaration or instruction continuation, at `>`.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > | >
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * > | &<]]>
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationDeclarationInside(code) {
+ if (code === 62) {
+ effects.consume(code);
+ return continuationClose
+ }
+
+ // More dashes.
+ if (code === 45 && marker === 2) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In closed continuation: everything we get until the eol/eof is part of it.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationClose(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('htmlFlowData');
+ return continuationAfter(code)
+ }
+ effects.consume(code);
+ return continuationClose
+ }
+
+ /**
+ * Done.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationAfter(code) {
+ effects.exit('htmlFlow');
+ // // Feel free to interrupt.
+ // tokenizer.interrupt = false
+ // // No longer concrete.
+ // tokenizer.concrete = false
+ return ok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeNonLazyContinuationStart(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * At eol, before continuation.
+ *
+ * ```markdown
+ * > | * ```js
+ * ^
+ * | b
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return after
+ }
+ return nok(code)
+ }
+
+ /**
+ * A continuation.
+ *
+ * ```markdown
+ * | * ```js
+ * > | b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlankLineBefore(effects, ok, nok) {
+ return start
+
+ /**
+ * Before eol, expecting blank line.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * |
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return effects.attempt(blankLine, ok, nok)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const htmlText = {
+ name: 'htmlText',
+ tokenize: tokenizeHtmlText
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHtmlText(effects, ok, nok) {
+ const self = this;
+ /** @type {NonNullable | undefined} */
+ let marker;
+ /** @type {number} */
+ let index;
+ /** @type {State} */
+ let returnState;
+ return start
+
+ /**
+ * Start of HTML (text).
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('htmlText');
+ effects.enter('htmlTextData');
+ effects.consume(code);
+ return open
+ }
+
+ /**
+ * After `<`, at tag name or other stuff.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * > | a c
+ * ^
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 33) {
+ effects.consume(code);
+ return declarationOpen
+ }
+ if (code === 47) {
+ effects.consume(code);
+ return tagCloseStart
+ }
+ if (code === 63) {
+ effects.consume(code);
+ return instruction
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return tagOpen
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * > | a c
+ * ^
+ * > | a &<]]> c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declarationOpen(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return commentOpenInside
+ }
+ if (code === 91) {
+ effects.consume(code);
+ index = 0;
+ return cdataOpenInside
+ }
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return declaration
+ }
+ return nok(code)
+ }
+
+ /**
+ * In a comment, after ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentOpenInside(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return commentEnd
+ }
+ return nok(code)
+ }
+
+ /**
+ * In comment.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function comment(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ if (code === 45) {
+ effects.consume(code);
+ return commentClose
+ }
+ if (markdownLineEnding(code)) {
+ returnState = comment;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return comment
+ }
+
+ /**
+ * In comment, after `-`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentClose(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return commentEnd
+ }
+ return comment(code)
+ }
+
+ /**
+ * In comment, after `--`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentEnd(code) {
+ return code === 62
+ ? end(code)
+ : code === 45
+ ? commentClose(code)
+ : comment(code)
+ }
+
+ /**
+ * After ` | a &<]]> b
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataOpenInside(code) {
+ const value = 'CDATA[';
+ if (code === value.charCodeAt(index++)) {
+ effects.consume(code);
+ return index === value.length ? cdata : cdataOpenInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * In CDATA.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdata(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ if (code === 93) {
+ effects.consume(code);
+ return cdataClose
+ }
+ if (markdownLineEnding(code)) {
+ returnState = cdata;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return cdata
+ }
+
+ /**
+ * In CDATA, after `]`, at another `]`.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataClose(code) {
+ if (code === 93) {
+ effects.consume(code);
+ return cdataEnd
+ }
+ return cdata(code)
+ }
+
+ /**
+ * In CDATA, after `]]`, at `>`.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataEnd(code) {
+ if (code === 62) {
+ return end(code)
+ }
+ if (code === 93) {
+ effects.consume(code);
+ return cdataEnd
+ }
+ return cdata(code)
+ }
+
+ /**
+ * In declaration.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declaration(code) {
+ if (code === null || code === 62) {
+ return end(code)
+ }
+ if (markdownLineEnding(code)) {
+ returnState = declaration;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return declaration
+ }
+
+ /**
+ * In instruction.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function instruction(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ if (code === 63) {
+ effects.consume(code);
+ return instructionClose
+ }
+ if (markdownLineEnding(code)) {
+ returnState = instruction;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return instruction
+ }
+
+ /**
+ * In instruction, after `?`, at `>`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function instructionClose(code) {
+ return code === 62 ? end(code) : instruction(code)
+ }
+
+ /**
+ * After ``, in closing tag, at tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseStart(code) {
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return tagClose
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagClose(code) {
+ // ASCII alphanumerical and `-`.
+ if (code === 45 || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ return tagClose
+ }
+ return tagCloseBetween(code)
+ }
+
+ /**
+ * In closing tag, after tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseBetween(code) {
+ if (markdownLineEnding(code)) {
+ returnState = tagCloseBetween;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagCloseBetween
+ }
+ return end(code)
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpen(code) {
+ // ASCII alphanumerical and `-`.
+ if (code === 45 || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ return tagOpen
+ }
+ if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
+ return tagOpenBetween(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In opening tag, after tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenBetween(code) {
+ if (code === 47) {
+ effects.consume(code);
+ return end
+ }
+
+ // ASCII alphabetical and `:` and `_`.
+ if (code === 58 || code === 95 || asciiAlpha(code)) {
+ effects.consume(code);
+ return tagOpenAttributeName
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenBetween;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenBetween
+ }
+ return end(code)
+ }
+
+ /**
+ * In attribute name.
+ *
+ * ```markdown
+ * > | a d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeName(code) {
+ // ASCII alphabetical and `-`, `.`, `:`, and `_`.
+ if (
+ code === 45 ||
+ code === 46 ||
+ code === 58 ||
+ code === 95 ||
+ asciiAlphanumeric(code)
+ ) {
+ effects.consume(code);
+ return tagOpenAttributeName
+ }
+ return tagOpenAttributeNameAfter(code)
+ }
+
+ /**
+ * After attribute name, before initializer, the end of the tag, or
+ * whitespace.
+ *
+ * ```markdown
+ * > | a d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeNameAfter(code) {
+ if (code === 61) {
+ effects.consume(code);
+ return tagOpenAttributeValueBefore
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeNameAfter;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenAttributeNameAfter
+ }
+ return tagOpenBetween(code)
+ }
+
+ /**
+ * Before unquoted, double quoted, or single quoted attribute value, allowing
+ * whitespace.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueBefore(code) {
+ if (
+ code === null ||
+ code === 60 ||
+ code === 61 ||
+ code === 62 ||
+ code === 96
+ ) {
+ return nok(code)
+ }
+ if (code === 34 || code === 39) {
+ effects.consume(code);
+ marker = code;
+ return tagOpenAttributeValueQuoted
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeValueBefore;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenAttributeValueBefore
+ }
+ effects.consume(code);
+ return tagOpenAttributeValueUnquoted
+ }
+
+ /**
+ * In double or single quoted attribute value.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueQuoted(code) {
+ if (code === marker) {
+ effects.consume(code);
+ marker = undefined;
+ return tagOpenAttributeValueQuotedAfter
+ }
+ if (code === null) {
+ return nok(code)
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeValueQuoted;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return tagOpenAttributeValueQuoted
+ }
+
+ /**
+ * In unquoted attribute value.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueUnquoted(code) {
+ if (
+ code === null ||
+ code === 34 ||
+ code === 39 ||
+ code === 60 ||
+ code === 61 ||
+ code === 96
+ ) {
+ return nok(code)
+ }
+ if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
+ return tagOpenBetween(code)
+ }
+ effects.consume(code);
+ return tagOpenAttributeValueUnquoted
+ }
+
+ /**
+ * After double or single quoted attribute value, before whitespace or the end
+ * of the tag.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueQuotedAfter(code) {
+ if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
+ return tagOpenBetween(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In certain circumstances of a tag where only an `>` is allowed.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function end(code) {
+ if (code === 62) {
+ effects.consume(code);
+ effects.exit('htmlTextData');
+ effects.exit('htmlText');
+ return ok
+ }
+ return nok(code)
+ }
+
+ /**
+ * At eol.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * > | a
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingBefore(code) {
+ effects.exit('htmlTextData');
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return lineEndingAfter
+ }
+
+ /**
+ * After eol, at optional whitespace.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * | a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingAfter(code) {
+ // Always populated by defaults.
+
+ return markdownSpace(code)
+ ? factorySpace(
+ effects,
+ lineEndingAfterPrefix,
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ : lineEndingAfterPrefix(code)
+ }
+
+ /**
+ * After eol, after optional whitespace.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * | a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingAfterPrefix(code) {
+ effects.enter('htmlTextData');
+ return returnState(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const labelEnd = {
+ name: 'labelEnd',
+ tokenize: tokenizeLabelEnd,
+ resolveTo: resolveToLabelEnd,
+ resolveAll: resolveAllLabelEnd
+};
+
+/** @type {Construct} */
+const resourceConstruct = {
+ tokenize: tokenizeResource
+};
+/** @type {Construct} */
+const referenceFullConstruct = {
+ tokenize: tokenizeReferenceFull
+};
+/** @type {Construct} */
+const referenceCollapsedConstruct = {
+ tokenize: tokenizeReferenceCollapsed
+};
+
+/** @type {Resolver} */
+function resolveAllLabelEnd(events) {
+ let index = -1;
+ while (++index < events.length) {
+ const token = events[index][1];
+ if (
+ token.type === 'labelImage' ||
+ token.type === 'labelLink' ||
+ token.type === 'labelEnd'
+ ) {
+ // Remove the marker.
+ events.splice(index + 1, token.type === 'labelImage' ? 4 : 2);
+ token.type = 'data';
+ index++;
+ }
+ }
+ return events
+}
+
+/** @type {Resolver} */
+function resolveToLabelEnd(events, context) {
+ let index = events.length;
+ let offset = 0;
+ /** @type {Token} */
+ let token;
+ /** @type {number | undefined} */
+ let open;
+ /** @type {number | undefined} */
+ let close;
+ /** @type {Array} */
+ let media;
+
+ // Find an opening.
+ while (index--) {
+ token = events[index][1];
+ if (open) {
+ // If we see another link, or inactive link label, we’ve been here before.
+ if (
+ token.type === 'link' ||
+ (token.type === 'labelLink' && token._inactive)
+ ) {
+ break
+ }
+
+ // Mark other link openings as inactive, as we can’t have links in
+ // links.
+ if (events[index][0] === 'enter' && token.type === 'labelLink') {
+ token._inactive = true;
+ }
+ } else if (close) {
+ if (
+ events[index][0] === 'enter' &&
+ (token.type === 'labelImage' || token.type === 'labelLink') &&
+ !token._balanced
+ ) {
+ open = index;
+ if (token.type !== 'labelLink') {
+ offset = 2;
+ break
+ }
+ }
+ } else if (token.type === 'labelEnd') {
+ close = index;
+ }
+ }
+ const group = {
+ type: events[open][1].type === 'labelLink' ? 'link' : 'image',
+ start: Object.assign({}, events[open][1].start),
+ end: Object.assign({}, events[events.length - 1][1].end)
+ };
+ const label = {
+ type: 'label',
+ start: Object.assign({}, events[open][1].start),
+ end: Object.assign({}, events[close][1].end)
+ };
+ const text = {
+ type: 'labelText',
+ start: Object.assign({}, events[open + offset + 2][1].end),
+ end: Object.assign({}, events[close - 2][1].start)
+ };
+ media = [
+ ['enter', group, context],
+ ['enter', label, context]
+ ];
+
+ // Opening marker.
+ media = push(media, events.slice(open + 1, open + offset + 3));
+
+ // Text open.
+ media = push(media, [['enter', text, context]]);
+
+ // Always populated by defaults.
+
+ // Between.
+ media = push(
+ media,
+ resolveAll(
+ context.parser.constructs.insideSpan.null,
+ events.slice(open + offset + 4, close - 3),
+ context
+ )
+ );
+
+ // Text close, marker close, label close.
+ media = push(media, [
+ ['exit', text, context],
+ events[close - 2],
+ events[close - 1],
+ ['exit', label, context]
+ ]);
+
+ // Reference, resource, or so.
+ media = push(media, events.slice(close + 1));
+
+ // Media close.
+ media = push(media, [['exit', group, context]]);
+ splice(events, open, events.length, media);
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLabelEnd(effects, ok, nok) {
+ const self = this;
+ let index = self.events.length;
+ /** @type {Token} */
+ let labelStart;
+ /** @type {boolean} */
+ let defined;
+
+ // Find an opening.
+ while (index--) {
+ if (
+ (self.events[index][1].type === 'labelImage' ||
+ self.events[index][1].type === 'labelLink') &&
+ !self.events[index][1]._balanced
+ ) {
+ labelStart = self.events[index][1];
+ break
+ }
+ }
+ return start
+
+ /**
+ * Start of label end.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * > | [a][b] c
+ * ^
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // If there is not an okay opening.
+ if (!labelStart) {
+ return nok(code)
+ }
+
+ // If the corresponding label (link) start is marked as inactive,
+ // it means we’d be wrapping a link, like this:
+ //
+ // ```markdown
+ // > | a [b [c](d) e](f) g.
+ // ^
+ // ```
+ //
+ // We can’t have that, so it’s just balanced brackets.
+ if (labelStart._inactive) {
+ return labelEndNok(code)
+ }
+ defined = self.parser.defined.includes(
+ normalizeIdentifier(
+ self.sliceSerialize({
+ start: labelStart.end,
+ end: self.now()
+ })
+ )
+ );
+ effects.enter('labelEnd');
+ effects.enter('labelMarker');
+ effects.consume(code);
+ effects.exit('labelMarker');
+ effects.exit('labelEnd');
+ return after
+ }
+
+ /**
+ * After `]`.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * > | [a][b] c
+ * ^
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ // Note: `markdown-rs` also parses GFM footnotes here, which for us is in
+ // an extension.
+
+ // Resource (`[asd](fgh)`)?
+ if (code === 40) {
+ return effects.attempt(
+ resourceConstruct,
+ labelEndOk,
+ defined ? labelEndOk : labelEndNok
+ )(code)
+ }
+
+ // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?
+ if (code === 91) {
+ return effects.attempt(
+ referenceFullConstruct,
+ labelEndOk,
+ defined ? referenceNotFull : labelEndNok
+ )(code)
+ }
+
+ // Shortcut (`[asd]`) reference?
+ return defined ? labelEndOk(code) : labelEndNok(code)
+ }
+
+ /**
+ * After `]`, at `[`, but not at a full reference.
+ *
+ * > 👉 **Note**: we only get here if the label is defined.
+ *
+ * ```markdown
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceNotFull(code) {
+ return effects.attempt(
+ referenceCollapsedConstruct,
+ labelEndOk,
+ labelEndNok
+ )(code)
+ }
+
+ /**
+ * Done, we found something.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * > | [a][b] c
+ * ^
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelEndOk(code) {
+ // Note: `markdown-rs` does a bunch of stuff here.
+ return ok(code)
+ }
+
+ /**
+ * Done, it’s nothing.
+ *
+ * There was an okay opening, but we didn’t match anything.
+ *
+ * ```markdown
+ * > | [a](b c
+ * ^
+ * > | [a][b c
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelEndNok(code) {
+ labelStart._balanced = true;
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeResource(effects, ok, nok) {
+ return resourceStart
+
+ /**
+ * At a resource.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceStart(code) {
+ effects.enter('resource');
+ effects.enter('resourceMarker');
+ effects.consume(code);
+ effects.exit('resourceMarker');
+ return resourceBefore
+ }
+
+ /**
+ * In resource, after `(`, at optional whitespace.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceBefore(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, resourceOpen)(code)
+ : resourceOpen(code)
+ }
+
+ /**
+ * In resource, after optional whitespace, at `)` or a destination.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceOpen(code) {
+ if (code === 41) {
+ return resourceEnd(code)
+ }
+ return factoryDestination(
+ effects,
+ resourceDestinationAfter,
+ resourceDestinationMissing,
+ 'resourceDestination',
+ 'resourceDestinationLiteral',
+ 'resourceDestinationLiteralMarker',
+ 'resourceDestinationRaw',
+ 'resourceDestinationString',
+ 32
+ )(code)
+ }
+
+ /**
+ * In resource, after destination, at optional whitespace.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceDestinationAfter(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, resourceBetween)(code)
+ : resourceEnd(code)
+ }
+
+ /**
+ * At invalid destination.
+ *
+ * ```markdown
+ * > | [a](<<) b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceDestinationMissing(code) {
+ return nok(code)
+ }
+
+ /**
+ * In resource, after destination and whitespace, at `(` or title.
+ *
+ * ```markdown
+ * > | [a](b ) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceBetween(code) {
+ if (code === 34 || code === 39 || code === 40) {
+ return factoryTitle(
+ effects,
+ resourceTitleAfter,
+ nok,
+ 'resourceTitle',
+ 'resourceTitleMarker',
+ 'resourceTitleString'
+ )(code)
+ }
+ return resourceEnd(code)
+ }
+
+ /**
+ * In resource, after title, at optional whitespace.
+ *
+ * ```markdown
+ * > | [a](b "c") d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceTitleAfter(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, resourceEnd)(code)
+ : resourceEnd(code)
+ }
+
+ /**
+ * In resource, at `)`.
+ *
+ * ```markdown
+ * > | [a](b) d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceEnd(code) {
+ if (code === 41) {
+ effects.enter('resourceMarker');
+ effects.consume(code);
+ effects.exit('resourceMarker');
+ effects.exit('resource');
+ return ok
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeReferenceFull(effects, ok, nok) {
+ const self = this;
+ return referenceFull
+
+ /**
+ * In a reference (full), at the `[`.
+ *
+ * ```markdown
+ * > | [a][b] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceFull(code) {
+ return factoryLabel.call(
+ self,
+ effects,
+ referenceFullAfter,
+ referenceFullMissing,
+ 'reference',
+ 'referenceMarker',
+ 'referenceString'
+ )(code)
+ }
+
+ /**
+ * In a reference (full), after `]`.
+ *
+ * ```markdown
+ * > | [a][b] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceFullAfter(code) {
+ return self.parser.defined.includes(
+ normalizeIdentifier(
+ self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
+ )
+ )
+ ? ok(code)
+ : nok(code)
+ }
+
+ /**
+ * In reference (full) that was missing.
+ *
+ * ```markdown
+ * > | [a][b d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceFullMissing(code) {
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeReferenceCollapsed(effects, ok, nok) {
+ return referenceCollapsedStart
+
+ /**
+ * In reference (collapsed), at `[`.
+ *
+ * > 👉 **Note**: we only get here if the label is defined.
+ *
+ * ```markdown
+ * > | [a][] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceCollapsedStart(code) {
+ // We only attempt a collapsed label if there’s a `[`.
+
+ effects.enter('reference');
+ effects.enter('referenceMarker');
+ effects.consume(code);
+ effects.exit('referenceMarker');
+ return referenceCollapsedOpen
+ }
+
+ /**
+ * In reference (collapsed), at `]`.
+ *
+ * > 👉 **Note**: we only get here if the label is defined.
+ *
+ * ```markdown
+ * > | [a][] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceCollapsedOpen(code) {
+ if (code === 93) {
+ effects.enter('referenceMarker');
+ effects.consume(code);
+ effects.exit('referenceMarker');
+ effects.exit('reference');
+ return ok
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const labelStartImage = {
+ name: 'labelStartImage',
+ tokenize: tokenizeLabelStartImage,
+ resolveAll: labelEnd.resolveAll
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLabelStartImage(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of label (image) start.
+ *
+ * ```markdown
+ * > | a ![b] c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('labelImage');
+ effects.enter('labelImageMarker');
+ effects.consume(code);
+ effects.exit('labelImageMarker');
+ return open
+ }
+
+ /**
+ * After `!`, at `[`.
+ *
+ * ```markdown
+ * > | a ![b] c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 91) {
+ effects.enter('labelMarker');
+ effects.consume(code);
+ effects.exit('labelMarker');
+ effects.exit('labelImage');
+ return after
+ }
+ return nok(code)
+ }
+
+ /**
+ * After `![`.
+ *
+ * ```markdown
+ * > | a ![b] c
+ * ^
+ * ```
+ *
+ * This is needed in because, when GFM footnotes are enabled, images never
+ * form when started with a `^`.
+ * Instead, links form:
+ *
+ * ```markdown
+ * ![^a](b)
+ *
+ * ![^a][b]
+ *
+ * [b]: c
+ * ```
+ *
+ * ```html
+ * !^a
+ * !^a
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ // To do: use a new field to do this, this is still needed for
+ // `micromark-extension-gfm-footnote`, but the `label-start-link`
+ // behavior isn’t.
+ // Hidden footnotes hook.
+ /* c8 ignore next 3 */
+ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
+ ? nok(code)
+ : ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const labelStartLink = {
+ name: 'labelStartLink',
+ tokenize: tokenizeLabelStartLink,
+ resolveAll: labelEnd.resolveAll
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLabelStartLink(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of label (link) start.
+ *
+ * ```markdown
+ * > | a [b] c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('labelLink');
+ effects.enter('labelMarker');
+ effects.consume(code);
+ effects.exit('labelMarker');
+ effects.exit('labelLink');
+ return after
+ }
+
+ /** @type {State} */
+ function after(code) {
+ // To do: this isn’t needed in `micromark-extension-gfm-footnote`,
+ // remove.
+ // Hidden footnotes hook.
+ /* c8 ignore next 3 */
+ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
+ ? nok(code)
+ : ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const lineEnding = {
+ name: 'lineEnding',
+ tokenize: tokenizeLineEnding
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLineEnding(effects, ok) {
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, ok, 'linePrefix')
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const thematicBreak = {
+ name: 'thematicBreak',
+ tokenize: tokenizeThematicBreak
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeThematicBreak(effects, ok, nok) {
+ let size = 0;
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Start of thematic break.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('thematicBreak');
+ // To do: parse indent like `markdown-rs`.
+ return before(code)
+ }
+
+ /**
+ * After optional whitespace, at marker.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ marker = code;
+ return atBreak(code)
+ }
+
+ /**
+ * After something, before something else.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === marker) {
+ effects.enter('thematicBreakSequence');
+ return sequence(code)
+ }
+ if (size >= 3 && (code === null || markdownLineEnding(code))) {
+ effects.exit('thematicBreak');
+ return ok(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In sequence.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequence(code) {
+ if (code === marker) {
+ effects.consume(code);
+ size++;
+ return sequence
+ }
+ effects.exit('thematicBreakSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, atBreak, 'whitespace')(code)
+ : atBreak(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').ContainerState} ContainerState
+ * @typedef {import('micromark-util-types').Exiter} Exiter
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const list = {
+ name: 'list',
+ tokenize: tokenizeListStart,
+ continuation: {
+ tokenize: tokenizeListContinuation
+ },
+ exit: tokenizeListEnd
+};
+
+/** @type {Construct} */
+const listItemPrefixWhitespaceConstruct = {
+ tokenize: tokenizeListItemPrefixWhitespace,
+ partial: true
+};
+
+/** @type {Construct} */
+const indentConstruct = {
+ tokenize: tokenizeIndent,
+ partial: true
+};
+
+// To do: `markdown-rs` parses list items on their own and later stitches them
+// together.
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeListStart(effects, ok, nok) {
+ const self = this;
+ const tail = self.events[self.events.length - 1];
+ let initialSize =
+ tail && tail[1].type === 'linePrefix'
+ ? tail[2].sliceSerialize(tail[1], true).length
+ : 0;
+ let size = 0;
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ const kind =
+ self.containerState.type ||
+ (code === 42 || code === 43 || code === 45
+ ? 'listUnordered'
+ : 'listOrdered');
+ if (
+ kind === 'listUnordered'
+ ? !self.containerState.marker || code === self.containerState.marker
+ : asciiDigit(code)
+ ) {
+ if (!self.containerState.type) {
+ self.containerState.type = kind;
+ effects.enter(kind, {
+ _container: true
+ });
+ }
+ if (kind === 'listUnordered') {
+ effects.enter('listItemPrefix');
+ return code === 42 || code === 45
+ ? effects.check(thematicBreak, nok, atMarker)(code)
+ : atMarker(code)
+ }
+ if (!self.interrupt || code === 49) {
+ effects.enter('listItemPrefix');
+ effects.enter('listItemValue');
+ return inside(code)
+ }
+ }
+ return nok(code)
+ }
+
+ /** @type {State} */
+ function inside(code) {
+ if (asciiDigit(code) && ++size < 10) {
+ effects.consume(code);
+ return inside
+ }
+ if (
+ (!self.interrupt || size < 2) &&
+ (self.containerState.marker
+ ? code === self.containerState.marker
+ : code === 41 || code === 46)
+ ) {
+ effects.exit('listItemValue');
+ return atMarker(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * @type {State}
+ **/
+ function atMarker(code) {
+ effects.enter('listItemMarker');
+ effects.consume(code);
+ effects.exit('listItemMarker');
+ self.containerState.marker = self.containerState.marker || code;
+ return effects.check(
+ blankLine,
+ // Can’t be empty when interrupting.
+ self.interrupt ? nok : onBlank,
+ effects.attempt(
+ listItemPrefixWhitespaceConstruct,
+ endOfPrefix,
+ otherPrefix
+ )
+ )
+ }
+
+ /** @type {State} */
+ function onBlank(code) {
+ self.containerState.initialBlankLine = true;
+ initialSize++;
+ return endOfPrefix(code)
+ }
+
+ /** @type {State} */
+ function otherPrefix(code) {
+ if (markdownSpace(code)) {
+ effects.enter('listItemPrefixWhitespace');
+ effects.consume(code);
+ effects.exit('listItemPrefixWhitespace');
+ return endOfPrefix
+ }
+ return nok(code)
+ }
+
+ /** @type {State} */
+ function endOfPrefix(code) {
+ self.containerState.size =
+ initialSize +
+ self.sliceSerialize(effects.exit('listItemPrefix'), true).length;
+ return ok(code)
+ }
+}
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeListContinuation(effects, ok, nok) {
+ const self = this;
+ self.containerState._closeFlow = undefined;
+ return effects.check(blankLine, onBlank, notBlank)
+
+ /** @type {State} */
+ function onBlank(code) {
+ self.containerState.furtherBlankLines =
+ self.containerState.furtherBlankLines ||
+ self.containerState.initialBlankLine;
+
+ // We have a blank line.
+ // Still, try to consume at most the items size.
+ return factorySpace(
+ effects,
+ ok,
+ 'listItemIndent',
+ self.containerState.size + 1
+ )(code)
+ }
+
+ /** @type {State} */
+ function notBlank(code) {
+ if (self.containerState.furtherBlankLines || !markdownSpace(code)) {
+ self.containerState.furtherBlankLines = undefined;
+ self.containerState.initialBlankLine = undefined;
+ return notInCurrentItem(code)
+ }
+ self.containerState.furtherBlankLines = undefined;
+ self.containerState.initialBlankLine = undefined;
+ return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)
+ }
+
+ /** @type {State} */
+ function notInCurrentItem(code) {
+ // While we do continue, we signal that the flow should be closed.
+ self.containerState._closeFlow = true;
+ // As we’re closing flow, we’re no longer interrupting.
+ self.interrupt = undefined;
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ effects.attempt(list, ok, nok),
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ }
+}
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeIndent(effects, ok, nok) {
+ const self = this;
+ return factorySpace(
+ effects,
+ afterPrefix,
+ 'listItemIndent',
+ self.containerState.size + 1
+ )
+
+ /** @type {State} */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return tail &&
+ tail[1].type === 'listItemIndent' &&
+ tail[2].sliceSerialize(tail[1], true).length === self.containerState.size
+ ? ok(code)
+ : nok(code)
+ }
+}
+
+/**
+ * @type {Exiter}
+ * @this {TokenizeContext}
+ */
+function tokenizeListEnd(effects) {
+ effects.exit(this.containerState.type);
+}
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
+ const self = this;
+
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ afterPrefix,
+ 'listItemPrefixWhitespace',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4 + 1
+ )
+
+ /** @type {State} */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return !markdownSpace(code) &&
+ tail &&
+ tail[1].type === 'listItemPrefixWhitespace'
+ ? ok(code)
+ : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const setextUnderline = {
+ name: 'setextUnderline',
+ tokenize: tokenizeSetextUnderline,
+ resolveTo: resolveToSetextUnderline
+};
+
+/** @type {Resolver} */
+function resolveToSetextUnderline(events, context) {
+ // To do: resolve like `markdown-rs`.
+ let index = events.length;
+ /** @type {number | undefined} */
+ let content;
+ /** @type {number | undefined} */
+ let text;
+ /** @type {number | undefined} */
+ let definition;
+
+ // Find the opening of the content.
+ // It’ll always exist: we don’t tokenize if it isn’t there.
+ while (index--) {
+ if (events[index][0] === 'enter') {
+ if (events[index][1].type === 'content') {
+ content = index;
+ break
+ }
+ if (events[index][1].type === 'paragraph') {
+ text = index;
+ }
+ }
+ // Exit
+ else {
+ if (events[index][1].type === 'content') {
+ // Remove the content end (if needed we’ll add it later)
+ events.splice(index, 1);
+ }
+ if (!definition && events[index][1].type === 'definition') {
+ definition = index;
+ }
+ }
+ }
+ const heading = {
+ type: 'setextHeading',
+ start: Object.assign({}, events[text][1].start),
+ end: Object.assign({}, events[events.length - 1][1].end)
+ };
+
+ // Change the paragraph to setext heading text.
+ events[text][1].type = 'setextHeadingText';
+
+ // If we have definitions in the content, we’ll keep on having content,
+ // but we need move it.
+ if (definition) {
+ events.splice(text, 0, ['enter', heading, context]);
+ events.splice(definition + 1, 0, ['exit', events[content][1], context]);
+ events[content][1].end = Object.assign({}, events[definition][1].end);
+ } else {
+ events[content][1] = heading;
+ }
+
+ // Add the heading exit at the end.
+ events.push(['exit', heading, context]);
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeSetextUnderline(effects, ok, nok) {
+ const self = this;
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * At start of heading (setext) underline.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ let index = self.events.length;
+ /** @type {boolean | undefined} */
+ let paragraph;
+ // Find an opening.
+ while (index--) {
+ // Skip enter/exit of line ending, line prefix, and content.
+ // We can now either have a definition or a paragraph.
+ if (
+ self.events[index][1].type !== 'lineEnding' &&
+ self.events[index][1].type !== 'linePrefix' &&
+ self.events[index][1].type !== 'content'
+ ) {
+ paragraph = self.events[index][1].type === 'paragraph';
+ break
+ }
+ }
+
+ // To do: handle lazy/pierce like `markdown-rs`.
+ // To do: parse indent like `markdown-rs`.
+ if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {
+ effects.enter('setextHeadingLine');
+ marker = code;
+ return before(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * After optional whitespace, at `-` or `=`.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ effects.enter('setextHeadingLineSequence');
+ return inside(code)
+ }
+
+ /**
+ * In sequence.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === marker) {
+ effects.consume(code);
+ return inside
+ }
+ effects.exit('setextHeadingLineSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, after, 'lineSuffix')(code)
+ : after(code)
+ }
+
+ /**
+ * After sequence, after optional whitespace.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('setextHeadingLine');
+ return ok(code)
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').Initializer} Initializer
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+/** @type {InitialConstruct} */
+const flow$1 = {
+ tokenize: initializeFlow
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Initializer}
+ */
+function initializeFlow(effects) {
+ const self = this;
+ const initial = effects.attempt(
+ // Try to parse a blank line.
+ blankLine,
+ atBlankEnding,
+ // Try to parse initial flow (essentially, only code).
+ effects.attempt(
+ this.parser.constructs.flowInitial,
+ afterConstruct,
+ factorySpace(
+ effects,
+ effects.attempt(
+ this.parser.constructs.flow,
+ afterConstruct,
+ effects.attempt(content, afterConstruct)
+ ),
+ 'linePrefix'
+ )
+ )
+ );
+ return initial
+
+ /** @type {State} */
+ function atBlankEnding(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('lineEndingBlank');
+ effects.consume(code);
+ effects.exit('lineEndingBlank');
+ self.currentConstruct = undefined;
+ return initial
+ }
+
+ /** @type {State} */
+ function afterConstruct(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ self.currentConstruct = undefined;
+ return initial
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').Initializer} Initializer
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+const resolver = {
+ resolveAll: createResolver()
+};
+const string$1 = initializeFactory('string');
+const text$1 = initializeFactory('text');
+
+/**
+ * @param {'string' | 'text'} field
+ * @returns {InitialConstruct}
+ */
+function initializeFactory(field) {
+ return {
+ tokenize: initializeText,
+ resolveAll: createResolver(
+ field === 'text' ? resolveAllLineSuffixes : undefined
+ )
+ }
+
+ /**
+ * @this {TokenizeContext}
+ * @type {Initializer}
+ */
+ function initializeText(effects) {
+ const self = this;
+ const constructs = this.parser.constructs[field];
+ const text = effects.attempt(constructs, start, notText);
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ return atBreak(code) ? text(code) : notText(code)
+ }
+
+ /** @type {State} */
+ function notText(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('data');
+ effects.consume(code);
+ return data
+ }
+
+ /** @type {State} */
+ function data(code) {
+ if (atBreak(code)) {
+ effects.exit('data');
+ return text(code)
+ }
+
+ // Data.
+ effects.consume(code);
+ return data
+ }
+
+ /**
+ * @param {Code} code
+ * @returns {boolean}
+ */
+ function atBreak(code) {
+ if (code === null) {
+ return true
+ }
+ const list = constructs[code];
+ let index = -1;
+ if (list) {
+ // Always populated by defaults.
+
+ while (++index < list.length) {
+ const item = list[index];
+ if (!item.previous || item.previous.call(self, self.previous)) {
+ return true
+ }
+ }
+ }
+ return false
+ }
+ }
+}
+
+/**
+ * @param {Resolver | undefined} [extraResolver]
+ * @returns {Resolver}
+ */
+function createResolver(extraResolver) {
+ return resolveAllText
+
+ /** @type {Resolver} */
+ function resolveAllText(events, context) {
+ let index = -1;
+ /** @type {number | undefined} */
+ let enter;
+
+ // A rather boring computation (to merge adjacent `data` events) which
+ // improves mm performance by 29%.
+ while (++index <= events.length) {
+ if (enter === undefined) {
+ if (events[index] && events[index][1].type === 'data') {
+ enter = index;
+ index++;
+ }
+ } else if (!events[index] || events[index][1].type !== 'data') {
+ // Don’t do anything if there is one data token.
+ if (index !== enter + 2) {
+ events[enter][1].end = events[index - 1][1].end;
+ events.splice(enter + 2, index - enter - 2);
+ index = enter + 2;
+ }
+ enter = undefined;
+ }
+ }
+ return extraResolver ? extraResolver(events, context) : events
+ }
+}
+
+/**
+ * A rather ugly set of instructions which again looks at chunks in the input
+ * stream.
+ * The reason to do this here is that it is *much* faster to parse in reverse.
+ * And that we can’t hook into `null` to split the line suffix before an EOF.
+ * To do: figure out if we can make this into a clean utility, or even in core.
+ * As it will be useful for GFMs literal autolink extension (and maybe even
+ * tables?)
+ *
+ * @type {Resolver}
+ */
+function resolveAllLineSuffixes(events, context) {
+ let eventIndex = 0; // Skip first.
+
+ while (++eventIndex <= events.length) {
+ if (
+ (eventIndex === events.length ||
+ events[eventIndex][1].type === 'lineEnding') &&
+ events[eventIndex - 1][1].type === 'data'
+ ) {
+ const data = events[eventIndex - 1][1];
+ const chunks = context.sliceStream(data);
+ let index = chunks.length;
+ let bufferIndex = -1;
+ let size = 0;
+ /** @type {boolean | undefined} */
+ let tabs;
+ while (index--) {
+ const chunk = chunks[index];
+ if (typeof chunk === 'string') {
+ bufferIndex = chunk.length;
+ while (chunk.charCodeAt(bufferIndex - 1) === 32) {
+ size++;
+ bufferIndex--;
+ }
+ if (bufferIndex) break
+ bufferIndex = -1;
+ }
+ // Number
+ else if (chunk === -2) {
+ tabs = true;
+ size++;
+ } else if (chunk === -1) ; else {
+ // Replacement character, exit.
+ index++;
+ break
+ }
+ }
+ if (size) {
+ const token = {
+ type:
+ eventIndex === events.length || tabs || size < 2
+ ? 'lineSuffix'
+ : 'hardBreakTrailing',
+ start: {
+ line: data.end.line,
+ column: data.end.column - size,
+ offset: data.end.offset - size,
+ _index: data.start._index + index,
+ _bufferIndex: index
+ ? bufferIndex
+ : data.start._bufferIndex + bufferIndex
+ },
+ end: Object.assign({}, data.end)
+ };
+ data.end = Object.assign({}, token.start);
+ if (data.start.offset === data.end.offset) {
+ Object.assign(data, token);
+ } else {
+ events.splice(
+ eventIndex,
+ 0,
+ ['enter', token, context],
+ ['exit', token, context]
+ );
+ eventIndex += 2;
+ }
+ }
+ eventIndex++;
+ }
+ }
+ return events
+}
+
+/**
+ * @typedef {import('micromark-util-types').Chunk} Chunk
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').ParseContext} ParseContext
+ * @typedef {import('micromark-util-types').Point} Point
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+/**
+ * Create a tokenizer.
+ * Tokenizers deal with one type of data (e.g., containers, flow, text).
+ * The parser is the object dealing with it all.
+ * `initialize` works like other constructs, except that only its `tokenize`
+ * function is used, in which case it doesn’t receive an `ok` or `nok`.
+ * `from` can be given to set the point before the first character, although
+ * when further lines are indented, they must be set with `defineSkip`.
+ *
+ * @param {ParseContext} parser
+ * @param {InitialConstruct} initialize
+ * @param {Omit | undefined} [from]
+ * @returns {TokenizeContext}
+ */
+function createTokenizer(parser, initialize, from) {
+ /** @type {Point} */
+ let point = Object.assign(
+ from
+ ? Object.assign({}, from)
+ : {
+ line: 1,
+ column: 1,
+ offset: 0
+ },
+ {
+ _index: 0,
+ _bufferIndex: -1
+ }
+ );
+ /** @type {Record} */
+ const columnStart = {};
+ /** @type {Array} */
+ const resolveAllConstructs = [];
+ /** @type {Array} */
+ let chunks = [];
+ /** @type {Array} */
+ let stack = [];
+
+ /**
+ * Tools used for tokenizing.
+ *
+ * @type {Effects}
+ */
+ const effects = {
+ consume,
+ enter,
+ exit,
+ attempt: constructFactory(onsuccessfulconstruct),
+ check: constructFactory(onsuccessfulcheck),
+ interrupt: constructFactory(onsuccessfulcheck, {
+ interrupt: true
+ })
+ };
+
+ /**
+ * State and tools for resolving and serializing.
+ *
+ * @type {TokenizeContext}
+ */
+ const context = {
+ previous: null,
+ code: null,
+ containerState: {},
+ events: [],
+ parser,
+ sliceStream,
+ sliceSerialize,
+ now,
+ defineSkip,
+ write
+ };
+
+ /**
+ * The state function.
+ *
+ * @type {State | void}
+ */
+ let state = initialize.tokenize.call(context, effects);
+ if (initialize.resolveAll) {
+ resolveAllConstructs.push(initialize);
+ }
+ return context
+
+ /** @type {TokenizeContext['write']} */
+ function write(slice) {
+ chunks = push(chunks, slice);
+ main();
+
+ // Exit if we’re not done, resolve might change stuff.
+ if (chunks[chunks.length - 1] !== null) {
+ return []
+ }
+ addResult(initialize, 0);
+
+ // Otherwise, resolve, and exit.
+ context.events = resolveAll(resolveAllConstructs, context.events, context);
+ return context.events
+ }
+
+ //
+ // Tools.
+ //
+
+ /** @type {TokenizeContext['sliceSerialize']} */
+ function sliceSerialize(token, expandTabs) {
+ return serializeChunks(sliceStream(token), expandTabs)
+ }
+
+ /** @type {TokenizeContext['sliceStream']} */
+ function sliceStream(token) {
+ return sliceChunks(chunks, token)
+ }
+
+ /** @type {TokenizeContext['now']} */
+ function now() {
+ // This is a hot path, so we clone manually instead of `Object.assign({}, point)`
+ const {line, column, offset, _index, _bufferIndex} = point;
+ return {
+ line,
+ column,
+ offset,
+ _index,
+ _bufferIndex
+ }
+ }
+
+ /** @type {TokenizeContext['defineSkip']} */
+ function defineSkip(value) {
+ columnStart[value.line] = value.column;
+ accountForPotentialSkip();
+ }
+
+ //
+ // State management.
+ //
+
+ /**
+ * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by
+ * `consume`).
+ * Here is where we walk through the chunks, which either include strings of
+ * several characters, or numerical character codes.
+ * The reason to do this in a loop instead of a call is so the stack can
+ * drain.
+ *
+ * @returns {void}
+ */
+ function main() {
+ /** @type {number} */
+ let chunkIndex;
+ while (point._index < chunks.length) {
+ const chunk = chunks[point._index];
+
+ // If we’re in a buffer chunk, loop through it.
+ if (typeof chunk === 'string') {
+ chunkIndex = point._index;
+ if (point._bufferIndex < 0) {
+ point._bufferIndex = 0;
+ }
+ while (
+ point._index === chunkIndex &&
+ point._bufferIndex < chunk.length
+ ) {
+ go(chunk.charCodeAt(point._bufferIndex));
+ }
+ } else {
+ go(chunk);
+ }
+ }
+ }
+
+ /**
+ * Deal with one code.
+ *
+ * @param {Code} code
+ * @returns {void}
+ */
+ function go(code) {
+ state = state(code);
+ }
+
+ /** @type {Effects['consume']} */
+ function consume(code) {
+ if (markdownLineEnding(code)) {
+ point.line++;
+ point.column = 1;
+ point.offset += code === -3 ? 2 : 1;
+ accountForPotentialSkip();
+ } else if (code !== -1) {
+ point.column++;
+ point.offset++;
+ }
+
+ // Not in a string chunk.
+ if (point._bufferIndex < 0) {
+ point._index++;
+ } else {
+ point._bufferIndex++;
+
+ // At end of string chunk.
+ // @ts-expect-error Points w/ non-negative `_bufferIndex` reference
+ // strings.
+ if (point._bufferIndex === chunks[point._index].length) {
+ point._bufferIndex = -1;
+ point._index++;
+ }
+ }
+
+ // Expose the previous character.
+ context.previous = code;
+ }
+
+ /** @type {Effects['enter']} */
+ function enter(type, fields) {
+ /** @type {Token} */
+ // @ts-expect-error Patch instead of assign required fields to help GC.
+ const token = fields || {};
+ token.type = type;
+ token.start = now();
+ context.events.push(['enter', token, context]);
+ stack.push(token);
+ return token
+ }
+
+ /** @type {Effects['exit']} */
+ function exit(type) {
+ const token = stack.pop();
+ token.end = now();
+ context.events.push(['exit', token, context]);
+ return token
+ }
+
+ /**
+ * Use results.
+ *
+ * @type {ReturnHandle}
+ */
+ function onsuccessfulconstruct(construct, info) {
+ addResult(construct, info.from);
+ }
+
+ /**
+ * Discard results.
+ *
+ * @type {ReturnHandle}
+ */
+ function onsuccessfulcheck(_, info) {
+ info.restore();
+ }
+
+ /**
+ * Factory to attempt/check/interrupt.
+ *
+ * @param {ReturnHandle} onreturn
+ * @param {{interrupt?: boolean | undefined} | undefined} [fields]
+ */
+ function constructFactory(onreturn, fields) {
+ return hook
+
+ /**
+ * Handle either an object mapping codes to constructs, a list of
+ * constructs, or a single construct.
+ *
+ * @param {Array | Construct | ConstructRecord} constructs
+ * @param {State} returnState
+ * @param {State | undefined} [bogusState]
+ * @returns {State}
+ */
+ function hook(constructs, returnState, bogusState) {
+ /** @type {Array} */
+ let listOfConstructs;
+ /** @type {number} */
+ let constructIndex;
+ /** @type {Construct} */
+ let currentConstruct;
+ /** @type {Info} */
+ let info;
+ return Array.isArray(constructs) /* c8 ignore next 1 */
+ ? handleListOfConstructs(constructs)
+ : 'tokenize' in constructs
+ ? // @ts-expect-error Looks like a construct.
+ handleListOfConstructs([constructs])
+ : handleMapOfConstructs(constructs)
+
+ /**
+ * Handle a list of construct.
+ *
+ * @param {ConstructRecord} map
+ * @returns {State}
+ */
+ function handleMapOfConstructs(map) {
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ const def = code !== null && map[code];
+ const all = code !== null && map.null;
+ const list = [
+ // To do: add more extension tests.
+ /* c8 ignore next 2 */
+ ...(Array.isArray(def) ? def : def ? [def] : []),
+ ...(Array.isArray(all) ? all : all ? [all] : [])
+ ];
+ return handleListOfConstructs(list)(code)
+ }
+ }
+
+ /**
+ * Handle a list of construct.
+ *
+ * @param {Array} list
+ * @returns {State}
+ */
+ function handleListOfConstructs(list) {
+ listOfConstructs = list;
+ constructIndex = 0;
+ if (list.length === 0) {
+ return bogusState
+ }
+ return handleConstruct(list[constructIndex])
+ }
+
+ /**
+ * Handle a single construct.
+ *
+ * @param {Construct} construct
+ * @returns {State}
+ */
+ function handleConstruct(construct) {
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ // To do: not needed to store if there is no bogus state, probably?
+ // Currently doesn’t work because `inspect` in document does a check
+ // w/o a bogus, which doesn’t make sense. But it does seem to help perf
+ // by not storing.
+ info = store();
+ currentConstruct = construct;
+ if (!construct.partial) {
+ context.currentConstruct = construct;
+ }
+
+ // Always populated by defaults.
+
+ if (
+ construct.name &&
+ context.parser.constructs.disable.null.includes(construct.name)
+ ) {
+ return nok()
+ }
+ return construct.tokenize.call(
+ // If we do have fields, create an object w/ `context` as its
+ // prototype.
+ // This allows a “live binding”, which is needed for `interrupt`.
+ fields ? Object.assign(Object.create(context), fields) : context,
+ effects,
+ ok,
+ nok
+ )(code)
+ }
+ }
+
+ /** @type {State} */
+ function ok(code) {
+ onreturn(currentConstruct, info);
+ return returnState
+ }
+
+ /** @type {State} */
+ function nok(code) {
+ info.restore();
+ if (++constructIndex < listOfConstructs.length) {
+ return handleConstruct(listOfConstructs[constructIndex])
+ }
+ return bogusState
+ }
+ }
+ }
+
+ /**
+ * @param {Construct} construct
+ * @param {number} from
+ * @returns {void}
+ */
+ function addResult(construct, from) {
+ if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
+ resolveAllConstructs.push(construct);
+ }
+ if (construct.resolve) {
+ splice(
+ context.events,
+ from,
+ context.events.length - from,
+ construct.resolve(context.events.slice(from), context)
+ );
+ }
+ if (construct.resolveTo) {
+ context.events = construct.resolveTo(context.events, context);
+ }
+ }
+
+ /**
+ * Store state.
+ *
+ * @returns {Info}
+ */
+ function store() {
+ const startPoint = now();
+ const startPrevious = context.previous;
+ const startCurrentConstruct = context.currentConstruct;
+ const startEventsIndex = context.events.length;
+ const startStack = Array.from(stack);
+ return {
+ restore,
+ from: startEventsIndex
+ }
+
+ /**
+ * Restore state.
+ *
+ * @returns {void}
+ */
+ function restore() {
+ point = startPoint;
+ context.previous = startPrevious;
+ context.currentConstruct = startCurrentConstruct;
+ context.events.length = startEventsIndex;
+ stack = startStack;
+ accountForPotentialSkip();
+ }
+ }
+
+ /**
+ * Move the current point a bit forward in the line when it’s on a column
+ * skip.
+ *
+ * @returns {void}
+ */
+ function accountForPotentialSkip() {
+ if (point.line in columnStart && point.column < 2) {
+ point.column = columnStart[point.line];
+ point.offset += columnStart[point.line] - 1;
+ }
+ }
+}
+
+/**
+ * Get the chunks from a slice of chunks in the range of a token.
+ *
+ * @param {Array} chunks
+ * @param {Pick} token
+ * @returns {Array}
+ */
+function sliceChunks(chunks, token) {
+ const startIndex = token.start._index;
+ const startBufferIndex = token.start._bufferIndex;
+ const endIndex = token.end._index;
+ const endBufferIndex = token.end._bufferIndex;
+ /** @type {Array} */
+ let view;
+ if (startIndex === endIndex) {
+ // @ts-expect-error `_bufferIndex` is used on string chunks.
+ view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
+ } else {
+ view = chunks.slice(startIndex, endIndex);
+ if (startBufferIndex > -1) {
+ const head = view[0];
+ if (typeof head === 'string') {
+ view[0] = head.slice(startBufferIndex);
+ } else {
+ view.shift();
+ }
+ }
+ if (endBufferIndex > 0) {
+ // @ts-expect-error `_bufferIndex` is used on string chunks.
+ view.push(chunks[endIndex].slice(0, endBufferIndex));
+ }
+ }
+ return view
+}
+
+/**
+ * Get the string value of a slice of chunks.
+ *
+ * @param {Array} chunks
+ * @param {boolean | undefined} [expandTabs=false]
+ * @returns {string}
+ */
+function serializeChunks(chunks, expandTabs) {
+ let index = -1;
+ /** @type {Array} */
+ const result = [];
+ /** @type {boolean | undefined} */
+ let atTab;
+ while (++index < chunks.length) {
+ const chunk = chunks[index];
+ /** @type {string} */
+ let value;
+ if (typeof chunk === 'string') {
+ value = chunk;
+ } else
+ switch (chunk) {
+ case -5: {
+ value = '\r';
+ break
+ }
+ case -4: {
+ value = '\n';
+ break
+ }
+ case -3: {
+ value = '\r' + '\n';
+ break
+ }
+ case -2: {
+ value = expandTabs ? ' ' : '\t';
+ break
+ }
+ case -1: {
+ if (!expandTabs && atTab) continue
+ value = ' ';
+ break
+ }
+ default: {
+ // Currently only replacement character.
+ value = String.fromCharCode(chunk);
+ }
+ }
+ atTab = chunk === -2;
+ result.push(value);
+ }
+ return result.join('')
+}
+
+/**
+ * @typedef {import('micromark-util-types').Extension} Extension
+ */
+
+
+/** @satisfies {Extension['document']} */
+const document = {
+ [42]: list,
+ [43]: list,
+ [45]: list,
+ [48]: list,
+ [49]: list,
+ [50]: list,
+ [51]: list,
+ [52]: list,
+ [53]: list,
+ [54]: list,
+ [55]: list,
+ [56]: list,
+ [57]: list,
+ [62]: blockQuote
+};
+
+/** @satisfies {Extension['contentInitial']} */
+const contentInitial = {
+ [91]: definition
+};
+
+/** @satisfies {Extension['flowInitial']} */
+const flowInitial = {
+ [-2]: codeIndented,
+ [-1]: codeIndented,
+ [32]: codeIndented
+};
+
+/** @satisfies {Extension['flow']} */
+const flow = {
+ [35]: headingAtx,
+ [42]: thematicBreak,
+ [45]: [setextUnderline, thematicBreak],
+ [60]: htmlFlow,
+ [61]: setextUnderline,
+ [95]: thematicBreak,
+ [96]: codeFenced,
+ [126]: codeFenced
+};
+
+/** @satisfies {Extension['string']} */
+const string = {
+ [38]: characterReference,
+ [92]: characterEscape
+};
+
+/** @satisfies {Extension['text']} */
+const text = {
+ [-5]: lineEnding,
+ [-4]: lineEnding,
+ [-3]: lineEnding,
+ [33]: labelStartImage,
+ [38]: characterReference,
+ [42]: attention,
+ [60]: [autolink, htmlText],
+ [91]: labelStartLink,
+ [92]: [hardBreakEscape, characterEscape],
+ [93]: labelEnd,
+ [95]: attention,
+ [96]: codeText
+};
+
+/** @satisfies {Extension['insideSpan']} */
+const insideSpan = {
+ null: [attention, resolver]
+};
+
+/** @satisfies {Extension['attentionMarkers']} */
+const attentionMarkers = {
+ null: [42, 95]
+};
+
+/** @satisfies {Extension['disable']} */
+const disable = {
+ null: []
+};
+
+var defaultConstructs = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ attentionMarkers: attentionMarkers,
+ contentInitial: contentInitial,
+ disable: disable,
+ document: document,
+ flow: flow,
+ flowInitial: flowInitial,
+ insideSpan: insideSpan,
+ string: string,
+ text: text
+});
+
+/**
+ * @typedef {import('micromark-util-types').Create} Create
+ * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').ParseContext} ParseContext
+ * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
+ */
+
+
+/**
+ * @param {ParseOptions | null | undefined} [options]
+ * @returns {ParseContext}
+ */
+function parse(options) {
+ const settings = options || {};
+ const constructs =
+ /** @type {FullNormalizedExtension} */
+ combineExtensions([defaultConstructs, ...(settings.extensions || [])]);
+
+ /** @type {ParseContext} */
+ const parser = {
+ defined: [],
+ lazy: {},
+ constructs,
+ content: create(content$1),
+ document: create(document$1),
+ flow: create(flow$1),
+ string: create(string$1),
+ text: create(text$1)
+ };
+ return parser
+
+ /**
+ * @param {InitialConstruct} initial
+ */
+ function create(initial) {
+ return creator
+ /** @type {Create} */
+ function creator(from) {
+ return createTokenizer(parser, initial, from)
+ }
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Chunk} Chunk
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Encoding} Encoding
+ * @typedef {import('micromark-util-types').Value} Value
+ */
+
+/**
+ * @callback Preprocessor
+ * @param {Value} value
+ * @param {Encoding | null | undefined} [encoding]
+ * @param {boolean | null | undefined} [end=false]
+ * @returns {Array}
+ */
+
+const search = /[\0\t\n\r]/g;
+
+/**
+ * @returns {Preprocessor}
+ */
+function preprocess() {
+ let column = 1;
+ let buffer = '';
+ /** @type {boolean | undefined} */
+ let start = true;
+ /** @type {boolean | undefined} */
+ let atCarriageReturn;
+ return preprocessor
+
+ /** @type {Preprocessor} */
+ function preprocessor(value, encoding, end) {
+ /** @type {Array} */
+ const chunks = [];
+ /** @type {RegExpMatchArray | null} */
+ let match;
+ /** @type {number} */
+ let next;
+ /** @type {number} */
+ let startPosition;
+ /** @type {number} */
+ let endPosition;
+ /** @type {Code} */
+ let code;
+
+ // @ts-expect-error `Buffer` does allow an encoding.
+ value = buffer + value.toString(encoding);
+ startPosition = 0;
+ buffer = '';
+ if (start) {
+ // To do: `markdown-rs` actually parses BOMs (byte order mark).
+ if (value.charCodeAt(0) === 65279) {
+ startPosition++;
+ }
+ start = undefined;
+ }
+ while (startPosition < value.length) {
+ search.lastIndex = startPosition;
+ match = search.exec(value);
+ endPosition =
+ match && match.index !== undefined ? match.index : value.length;
+ code = value.charCodeAt(endPosition);
+ if (!match) {
+ buffer = value.slice(startPosition);
+ break
+ }
+ if (code === 10 && startPosition === endPosition && atCarriageReturn) {
+ chunks.push(-3);
+ atCarriageReturn = undefined;
+ } else {
+ if (atCarriageReturn) {
+ chunks.push(-5);
+ atCarriageReturn = undefined;
+ }
+ if (startPosition < endPosition) {
+ chunks.push(value.slice(startPosition, endPosition));
+ column += endPosition - startPosition;
+ }
+ switch (code) {
+ case 0: {
+ chunks.push(65533);
+ column++;
+ break
+ }
+ case 9: {
+ next = Math.ceil(column / 4) * 4;
+ chunks.push(-2);
+ while (column++ < next) chunks.push(-1);
+ break
+ }
+ case 10: {
+ chunks.push(-4);
+ column = 1;
+ break
+ }
+ default: {
+ atCarriageReturn = true;
+ column = 1;
+ }
+ }
+ }
+ startPosition = endPosition + 1;
+ }
+ if (end) {
+ if (atCarriageReturn) chunks.push(-5);
+ if (buffer) chunks.push(buffer);
+ chunks.push(null);
+ }
+ return chunks
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Event} Event
+ */
+
+
+/**
+ * @param {Array} events
+ * @returns {Array}
+ */
+function postprocess(events) {
+ while (!subtokenize(events)) {
+ // Empty
+ }
+ return events
+}
+
+/**
+ * Turn the number (in string form as either hexa- or plain decimal) coming from
+ * a numeric character reference into a character.
+ *
+ * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes
+ * non-characters and control characters safe.
+ *
+ * @param {string} value
+ * Value to decode.
+ * @param {number} base
+ * Numeric base.
+ * @returns {string}
+ * Character.
+ */
+function decodeNumericCharacterReference(value, base) {
+ const code = Number.parseInt(value, base);
+ if (
+ // C0 except for HT, LF, FF, CR, space.
+ code < 9 ||
+ code === 11 ||
+ (code > 13 && code < 32) ||
+ // Control character (DEL) of C0, and C1 controls.
+ (code > 126 && code < 160) ||
+ // Lone high surrogates and low surrogates.
+ (code > 55295 && code < 57344) ||
+ // Noncharacters.
+ (code > 64975 && code < 65008) /* eslint-disable no-bitwise */ ||
+ (code & 65535) === 65535 ||
+ (code & 65535) === 65534 /* eslint-enable no-bitwise */ ||
+ // Out of range
+ code > 1114111
+ ) {
+ return '\uFFFD'
+ }
+ return String.fromCharCode(code)
+}
+
+const characterEscapeOrReference =
+ /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
+
+/**
+ * Decode markdown strings (which occur in places such as fenced code info
+ * strings, destinations, labels, and titles).
+ *
+ * The “string” content type allows character escapes and -references.
+ * This decodes those.
+ *
+ * @param {string} value
+ * Value to decode.
+ * @returns {string}
+ * Decoded value.
+ */
+function decodeString(value) {
+ return value.replace(characterEscapeOrReference, decode)
+}
+
+/**
+ * @param {string} $0
+ * @param {string} $1
+ * @param {string} $2
+ * @returns {string}
+ */
+function decode($0, $1, $2) {
+ if ($1) {
+ // Escape.
+ return $1
+ }
+
+ // Reference.
+ const head = $2.charCodeAt(0);
+ if (head === 35) {
+ const head = $2.charCodeAt(1);
+ const hex = head === 120 || head === 88;
+ return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)
+ }
+ return decodeNamedCharacterReference($2) || $0
+}
+
+/**
+ * @typedef {import('unist').Node} Node
+ * @typedef {import('unist').Point} Point
+ * @typedef {import('unist').Position} Position
+ */
+
+/**
+ * @typedef NodeLike
+ * @property {string} type
+ * @property {PositionLike | null | undefined} [position]
+ *
+ * @typedef PositionLike
+ * @property {PointLike | null | undefined} [start]
+ * @property {PointLike | null | undefined} [end]
+ *
+ * @typedef PointLike
+ * @property {number | null | undefined} [line]
+ * @property {number | null | undefined} [column]
+ * @property {number | null | undefined} [offset]
+ */
+
+/**
+ * Serialize the positional info of a point, position (start and end points),
+ * or node.
+ *
+ * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]
+ * Node, position, or point.
+ * @returns {string}
+ * Pretty printed positional info of a node (`string`).
+ *
+ * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
+ * or a point `l:c` (when given `point`), where `l` stands for line, `c` for
+ * column, `s` for `start`, and `e` for end.
+ * An empty string (`''`) is returned if the given value is neither `node`,
+ * `position`, nor `point`.
+ */
+function stringifyPosition(value) {
+ // Nothing.
+ if (!value || typeof value !== 'object') {
+ return ''
+ }
+
+ // Node.
+ if ('position' in value || 'type' in value) {
+ return position(value.position)
+ }
+
+ // Position.
+ if ('start' in value || 'end' in value) {
+ return position(value)
+ }
+
+ // Point.
+ if ('line' in value || 'column' in value) {
+ return point$1(value)
+ }
+
+ // ?
+ return ''
+}
+
+/**
+ * @param {Point | PointLike | null | undefined} point
+ * @returns {string}
+ */
+function point$1(point) {
+ return index(point && point.line) + ':' + index(point && point.column)
+}
+
+/**
+ * @param {Position | PositionLike | null | undefined} pos
+ * @returns {string}
+ */
+function position(pos) {
+ return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
+}
+
+/**
+ * @param {number | null | undefined} value
+ * @returns {number}
+ */
+function index(value) {
+ return value && typeof value === 'number' ? value : 1
+}
+
+/**
+ * @typedef {import('micromark-util-types').Encoding} Encoding
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Value} Value
+ *
+ * @typedef {import('unist').Parent} UnistParent
+ * @typedef {import('unist').Point} Point
+ *
+ * @typedef {import('mdast').PhrasingContent} PhrasingContent
+ * @typedef {import('mdast').StaticPhrasingContent} StaticPhrasingContent
+ * @typedef {import('mdast').Content} Content
+ * @typedef {import('mdast').Break} Break
+ * @typedef {import('mdast').Blockquote} Blockquote
+ * @typedef {import('mdast').Code} Code
+ * @typedef {import('mdast').Definition} Definition
+ * @typedef {import('mdast').Emphasis} Emphasis
+ * @typedef {import('mdast').Heading} Heading
+ * @typedef {import('mdast').HTML} HTML
+ * @typedef {import('mdast').Image} Image
+ * @typedef {import('mdast').ImageReference} ImageReference
+ * @typedef {import('mdast').InlineCode} InlineCode
+ * @typedef {import('mdast').Link} Link
+ * @typedef {import('mdast').LinkReference} LinkReference
+ * @typedef {import('mdast').List} List
+ * @typedef {import('mdast').ListItem} ListItem
+ * @typedef {import('mdast').Paragraph} Paragraph
+ * @typedef {import('mdast').Root} Root
+ * @typedef {import('mdast').Strong} Strong
+ * @typedef {import('mdast').Text} Text
+ * @typedef {import('mdast').ThematicBreak} ThematicBreak
+ * @typedef {import('mdast').ReferenceType} ReferenceType
+ * @typedef {import('../index.js').CompileData} CompileData
+ */
+
+const own = {}.hasOwnProperty;
+
+/**
+ * @param value
+ * Markdown to parse.
+ * @param encoding
+ * Character encoding for when `value` is `Buffer`.
+ * @param options
+ * Configuration.
+ * @returns
+ * mdast tree.
+ */
+const fromMarkdown =
+ /**
+ * @type {(
+ * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &
+ * ((value: Value, options?: Options | null | undefined) => Root)
+ * )}
+ */
+
+ /**
+ * @param {Value} value
+ * @param {Encoding | Options | null | undefined} [encoding]
+ * @param {Options | null | undefined} [options]
+ * @returns {Root}
+ */
+ function (value, encoding, options) {
+ if (typeof encoding !== 'string') {
+ options = encoding;
+ encoding = undefined;
+ }
+ return compiler(options)(
+ postprocess(
+ parse(options).document().write(preprocess()(value, encoding, true))
+ )
+ )
+ };
+
+/**
+ * Note this compiler only understand complete buffering, not streaming.
+ *
+ * @param {Options | null | undefined} [options]
+ */
+function compiler(options) {
+ /** @type {Config} */
+ const config = {
+ transforms: [],
+ canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],
+ enter: {
+ autolink: opener(link),
+ autolinkProtocol: onenterdata,
+ autolinkEmail: onenterdata,
+ atxHeading: opener(heading),
+ blockQuote: opener(blockQuote),
+ characterEscape: onenterdata,
+ characterReference: onenterdata,
+ codeFenced: opener(codeFlow),
+ codeFencedFenceInfo: buffer,
+ codeFencedFenceMeta: buffer,
+ codeIndented: opener(codeFlow, buffer),
+ codeText: opener(codeText, buffer),
+ codeTextData: onenterdata,
+ data: onenterdata,
+ codeFlowValue: onenterdata,
+ definition: opener(definition),
+ definitionDestinationString: buffer,
+ definitionLabelString: buffer,
+ definitionTitleString: buffer,
+ emphasis: opener(emphasis),
+ hardBreakEscape: opener(hardBreak),
+ hardBreakTrailing: opener(hardBreak),
+ htmlFlow: opener(html, buffer),
+ htmlFlowData: onenterdata,
+ htmlText: opener(html, buffer),
+ htmlTextData: onenterdata,
+ image: opener(image),
+ label: buffer,
+ link: opener(link),
+ listItem: opener(listItem),
+ listItemValue: onenterlistitemvalue,
+ listOrdered: opener(list, onenterlistordered),
+ listUnordered: opener(list),
+ paragraph: opener(paragraph),
+ reference: onenterreference,
+ referenceString: buffer,
+ resourceDestinationString: buffer,
+ resourceTitleString: buffer,
+ setextHeading: opener(heading),
+ strong: opener(strong),
+ thematicBreak: opener(thematicBreak)
+ },
+ exit: {
+ atxHeading: closer(),
+ atxHeadingSequence: onexitatxheadingsequence,
+ autolink: closer(),
+ autolinkEmail: onexitautolinkemail,
+ autolinkProtocol: onexitautolinkprotocol,
+ blockQuote: closer(),
+ characterEscapeValue: onexitdata,
+ characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
+ characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
+ characterReferenceValue: onexitcharacterreferencevalue,
+ codeFenced: closer(onexitcodefenced),
+ codeFencedFence: onexitcodefencedfence,
+ codeFencedFenceInfo: onexitcodefencedfenceinfo,
+ codeFencedFenceMeta: onexitcodefencedfencemeta,
+ codeFlowValue: onexitdata,
+ codeIndented: closer(onexitcodeindented),
+ codeText: closer(onexitcodetext),
+ codeTextData: onexitdata,
+ data: onexitdata,
+ definition: closer(),
+ definitionDestinationString: onexitdefinitiondestinationstring,
+ definitionLabelString: onexitdefinitionlabelstring,
+ definitionTitleString: onexitdefinitiontitlestring,
+ emphasis: closer(),
+ hardBreakEscape: closer(onexithardbreak),
+ hardBreakTrailing: closer(onexithardbreak),
+ htmlFlow: closer(onexithtmlflow),
+ htmlFlowData: onexitdata,
+ htmlText: closer(onexithtmltext),
+ htmlTextData: onexitdata,
+ image: closer(onexitimage),
+ label: onexitlabel,
+ labelText: onexitlabeltext,
+ lineEnding: onexitlineending,
+ link: closer(onexitlink),
+ listItem: closer(),
+ listOrdered: closer(),
+ listUnordered: closer(),
+ paragraph: closer(),
+ referenceString: onexitreferencestring,
+ resourceDestinationString: onexitresourcedestinationstring,
+ resourceTitleString: onexitresourcetitlestring,
+ resource: onexitresource,
+ setextHeading: closer(onexitsetextheading),
+ setextHeadingLineSequence: onexitsetextheadinglinesequence,
+ setextHeadingText: onexitsetextheadingtext,
+ strong: closer(),
+ thematicBreak: closer()
+ }
+ };
+ configure(config, (options || {}).mdastExtensions || []);
+
+ /** @type {CompileData} */
+ const data = {};
+ return compile
+
+ /**
+ * Turn micromark events into an mdast tree.
+ *
+ * @param {Array} events
+ * Events.
+ * @returns {Root}
+ * mdast tree.
+ */
+ function compile(events) {
+ /** @type {Root} */
+ let tree = {
+ type: 'root',
+ children: []
+ };
+ /** @type {Omit} */
+ const context = {
+ stack: [tree],
+ tokenStack: [],
+ config,
+ enter,
+ exit,
+ buffer,
+ resume,
+ setData,
+ getData
+ };
+ /** @type {Array} */
+ const listStack = [];
+ let index = -1;
+ while (++index < events.length) {
+ // We preprocess lists to add `listItem` tokens, and to infer whether
+ // items the list itself are spread out.
+ if (
+ events[index][1].type === 'listOrdered' ||
+ events[index][1].type === 'listUnordered'
+ ) {
+ if (events[index][0] === 'enter') {
+ listStack.push(index);
+ } else {
+ const tail = listStack.pop();
+ index = prepareList(events, tail, index);
+ }
+ }
+ }
+ index = -1;
+ while (++index < events.length) {
+ const handler = config[events[index][0]];
+ if (own.call(handler, events[index][1].type)) {
+ handler[events[index][1].type].call(
+ Object.assign(
+ {
+ sliceSerialize: events[index][2].sliceSerialize
+ },
+ context
+ ),
+ events[index][1]
+ );
+ }
+ }
+
+ // Handle tokens still being open.
+ if (context.tokenStack.length > 0) {
+ const tail = context.tokenStack[context.tokenStack.length - 1];
+ const handler = tail[1] || defaultOnError;
+ handler.call(context, undefined, tail[0]);
+ }
+
+ // Figure out `root` position.
+ tree.position = {
+ start: point(
+ events.length > 0
+ ? events[0][1].start
+ : {
+ line: 1,
+ column: 1,
+ offset: 0
+ }
+ ),
+ end: point(
+ events.length > 0
+ ? events[events.length - 2][1].end
+ : {
+ line: 1,
+ column: 1,
+ offset: 0
+ }
+ )
+ };
+
+ // Call transforms.
+ index = -1;
+ while (++index < config.transforms.length) {
+ tree = config.transforms[index](tree) || tree;
+ }
+ return tree
+ }
+
+ /**
+ * @param {Array} events
+ * @param {number} start
+ * @param {number} length
+ * @returns {number}
+ */
+ function prepareList(events, start, length) {
+ let index = start - 1;
+ let containerBalance = -1;
+ let listSpread = false;
+ /** @type {Token | undefined} */
+ let listItem;
+ /** @type {number | undefined} */
+ let lineIndex;
+ /** @type {number | undefined} */
+ let firstBlankLineIndex;
+ /** @type {boolean | undefined} */
+ let atMarker;
+ while (++index <= length) {
+ const event = events[index];
+ if (
+ event[1].type === 'listUnordered' ||
+ event[1].type === 'listOrdered' ||
+ event[1].type === 'blockQuote'
+ ) {
+ if (event[0] === 'enter') {
+ containerBalance++;
+ } else {
+ containerBalance--;
+ }
+ atMarker = undefined;
+ } else if (event[1].type === 'lineEndingBlank') {
+ if (event[0] === 'enter') {
+ if (
+ listItem &&
+ !atMarker &&
+ !containerBalance &&
+ !firstBlankLineIndex
+ ) {
+ firstBlankLineIndex = index;
+ }
+ atMarker = undefined;
+ }
+ } else if (
+ event[1].type === 'linePrefix' ||
+ event[1].type === 'listItemValue' ||
+ event[1].type === 'listItemMarker' ||
+ event[1].type === 'listItemPrefix' ||
+ event[1].type === 'listItemPrefixWhitespace'
+ ) ; else {
+ atMarker = undefined;
+ }
+ if (
+ (!containerBalance &&
+ event[0] === 'enter' &&
+ event[1].type === 'listItemPrefix') ||
+ (containerBalance === -1 &&
+ event[0] === 'exit' &&
+ (event[1].type === 'listUnordered' ||
+ event[1].type === 'listOrdered'))
+ ) {
+ if (listItem) {
+ let tailIndex = index;
+ lineIndex = undefined;
+ while (tailIndex--) {
+ const tailEvent = events[tailIndex];
+ if (
+ tailEvent[1].type === 'lineEnding' ||
+ tailEvent[1].type === 'lineEndingBlank'
+ ) {
+ if (tailEvent[0] === 'exit') continue
+ if (lineIndex) {
+ events[lineIndex][1].type = 'lineEndingBlank';
+ listSpread = true;
+ }
+ tailEvent[1].type = 'lineEnding';
+ lineIndex = tailIndex;
+ } else if (
+ tailEvent[1].type === 'linePrefix' ||
+ tailEvent[1].type === 'blockQuotePrefix' ||
+ tailEvent[1].type === 'blockQuotePrefixWhitespace' ||
+ tailEvent[1].type === 'blockQuoteMarker' ||
+ tailEvent[1].type === 'listItemIndent'
+ ) ; else {
+ break
+ }
+ }
+ if (
+ firstBlankLineIndex &&
+ (!lineIndex || firstBlankLineIndex < lineIndex)
+ ) {
+ listItem._spread = true;
+ }
+
+ // Fix position.
+ listItem.end = Object.assign(
+ {},
+ lineIndex ? events[lineIndex][1].start : event[1].end
+ );
+ events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);
+ index++;
+ length++;
+ }
+
+ // Create a new list item.
+ if (event[1].type === 'listItemPrefix') {
+ listItem = {
+ type: 'listItem',
+ _spread: false,
+ start: Object.assign({}, event[1].start),
+ // @ts-expect-error: we’ll add `end` in a second.
+ end: undefined
+ };
+ // @ts-expect-error: `listItem` is most definitely defined, TS...
+ events.splice(index, 0, ['enter', listItem, event[2]]);
+ index++;
+ length++;
+ firstBlankLineIndex = undefined;
+ atMarker = true;
+ }
+ }
+ }
+ events[start][1]._spread = listSpread;
+ return length
+ }
+
+ /**
+ * Set data.
+ *
+ * @template {keyof CompileData} Key
+ * Field type.
+ * @param {Key} key
+ * Key of field.
+ * @param {CompileData[Key]} [value]
+ * New value.
+ * @returns {void}
+ * Nothing.
+ */
+ function setData(key, value) {
+ data[key] = value;
+ }
+
+ /**
+ * Get data.
+ *
+ * @template {keyof CompileData} Key
+ * Field type.
+ * @param {Key} key
+ * Key of field.
+ * @returns {CompileData[Key]}
+ * Value.
+ */
+ function getData(key) {
+ return data[key]
+ }
+
+ /**
+ * Create an opener handle.
+ *
+ * @param {(token: Token) => Node} create
+ * Create a node.
+ * @param {Handle} [and]
+ * Optional function to also run.
+ * @returns {Handle}
+ * Handle.
+ */
+ function opener(create, and) {
+ return open
+
+ /**
+ * @this {CompileContext}
+ * @param {Token} token
+ * @returns {void}
+ */
+ function open(token) {
+ enter.call(this, create(token), token);
+ if (and) and.call(this, token);
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @returns {void}
+ */
+ function buffer() {
+ this.stack.push({
+ type: 'fragment',
+ children: []
+ });
+ }
+
+ /**
+ * @template {Node} Kind
+ * Node type.
+ * @this {CompileContext}
+ * Context.
+ * @param {Kind} node
+ * Node to enter.
+ * @param {Token} token
+ * Corresponding token.
+ * @param {OnEnterError | undefined} [errorHandler]
+ * Handle the case where this token is open, but it is closed by something else.
+ * @returns {Kind}
+ * The given node.
+ */
+ function enter(node, token, errorHandler) {
+ const parent = this.stack[this.stack.length - 1];
+ // @ts-expect-error: Assume `Node` can exist as a child of `parent`.
+ parent.children.push(node);
+ this.stack.push(node);
+ this.tokenStack.push([token, errorHandler]);
+ // @ts-expect-error: `end` will be patched later.
+ node.position = {
+ start: point(token.start)
+ };
+ return node
+ }
+
+ /**
+ * Create a closer handle.
+ *
+ * @param {Handle} [and]
+ * Optional function to also run.
+ * @returns {Handle}
+ * Handle.
+ */
+ function closer(and) {
+ return close
+
+ /**
+ * @this {CompileContext}
+ * @param {Token} token
+ * @returns {void}
+ */
+ function close(token) {
+ if (and) and.call(this, token);
+ exit.call(this, token);
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * Context.
+ * @param {Token} token
+ * Corresponding token.
+ * @param {OnExitError | undefined} [onExitError]
+ * Handle the case where another token is open.
+ * @returns {Node}
+ * The closed node.
+ */
+ function exit(token, onExitError) {
+ const node = this.stack.pop();
+ const open = this.tokenStack.pop();
+ if (!open) {
+ throw new Error(
+ 'Cannot close `' +
+ token.type +
+ '` (' +
+ stringifyPosition({
+ start: token.start,
+ end: token.end
+ }) +
+ '): it’s not open'
+ )
+ } else if (open[0].type !== token.type) {
+ if (onExitError) {
+ onExitError.call(this, token, open[0]);
+ } else {
+ const handler = open[1] || defaultOnError;
+ handler.call(this, token, open[0]);
+ }
+ }
+ node.position.end = point(token.end);
+ return node
+ }
+
+ /**
+ * @this {CompileContext}
+ * @returns {string}
+ */
+ function resume() {
+ return toString(this.stack.pop())
+ }
+
+ //
+ // Handlers.
+ //
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onenterlistordered() {
+ setData('expectingFirstListItemValue', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onenterlistitemvalue(token) {
+ if (getData('expectingFirstListItemValue')) {
+ const ancestor = this.stack[this.stack.length - 2];
+ ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);
+ setData('expectingFirstListItemValue');
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefencedfenceinfo() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.lang = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefencedfencemeta() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.meta = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefencedfence() {
+ // Exit if this is the closing fence.
+ if (getData('flowCodeInside')) return
+ this.buffer();
+ setData('flowCodeInside', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefenced() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, '');
+ setData('flowCodeInside');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodeindented() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data.replace(/(\r?\n|\r)$/g, '');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitdefinitionlabelstring(token) {
+ const label = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.label = label;
+ node.identifier = normalizeIdentifier(
+ this.sliceSerialize(token)
+ ).toLowerCase();
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitdefinitiontitlestring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.title = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitdefinitiondestinationstring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.url = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitatxheadingsequence(token) {
+ const node = this.stack[this.stack.length - 1];
+ if (!node.depth) {
+ const depth = this.sliceSerialize(token).length;
+ node.depth = depth;
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitsetextheadingtext() {
+ setData('setextHeadingSlurpLineEnding', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitsetextheadinglinesequence(token) {
+ const node = this.stack[this.stack.length - 1];
+ node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitsetextheading() {
+ setData('setextHeadingSlurpLineEnding');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onenterdata(token) {
+ const node = this.stack[this.stack.length - 1];
+ let tail = node.children[node.children.length - 1];
+ if (!tail || tail.type !== 'text') {
+ // Add a new text node.
+ tail = text();
+ // @ts-expect-error: we’ll add `end` later.
+ tail.position = {
+ start: point(token.start)
+ };
+ // @ts-expect-error: Assume `parent` accepts `text`.
+ node.children.push(tail);
+ }
+ this.stack.push(tail);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitdata(token) {
+ const tail = this.stack.pop();
+ tail.value += this.sliceSerialize(token);
+ tail.position.end = point(token.end);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlineending(token) {
+ const context = this.stack[this.stack.length - 1];
+ // If we’re at a hard break, include the line ending in there.
+ if (getData('atHardBreak')) {
+ const tail = context.children[context.children.length - 1];
+ tail.position.end = point(token.end);
+ setData('atHardBreak');
+ return
+ }
+ if (
+ !getData('setextHeadingSlurpLineEnding') &&
+ config.canContainEols.includes(context.type)
+ ) {
+ onenterdata.call(this, token);
+ onexitdata.call(this, token);
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexithardbreak() {
+ setData('atHardBreak', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexithtmlflow() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexithtmltext() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitcodetext() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlink() {
+ const node = this.stack[this.stack.length - 1];
+ // Note: there are also `identifier` and `label` fields on this link node!
+ // These are used / cleaned here.
+ // To do: clean.
+ if (getData('inReference')) {
+ /** @type {ReferenceType} */
+ const referenceType = getData('referenceType') || 'shortcut';
+ node.type += 'Reference';
+ // @ts-expect-error: mutate.
+ node.referenceType = referenceType;
+ // @ts-expect-error: mutate.
+ delete node.url;
+ delete node.title;
+ } else {
+ // @ts-expect-error: mutate.
+ delete node.identifier;
+ // @ts-expect-error: mutate.
+ delete node.label;
+ }
+ setData('referenceType');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitimage() {
+ const node = this.stack[this.stack.length - 1];
+ // Note: there are also `identifier` and `label` fields on this link node!
+ // These are used / cleaned here.
+ // To do: clean.
+ if (getData('inReference')) {
+ /** @type {ReferenceType} */
+ const referenceType = getData('referenceType') || 'shortcut';
+ node.type += 'Reference';
+ // @ts-expect-error: mutate.
+ node.referenceType = referenceType;
+ // @ts-expect-error: mutate.
+ delete node.url;
+ delete node.title;
+ } else {
+ // @ts-expect-error: mutate.
+ delete node.identifier;
+ // @ts-expect-error: mutate.
+ delete node.label;
+ }
+ setData('referenceType');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlabeltext(token) {
+ const string = this.sliceSerialize(token);
+ const ancestor = this.stack[this.stack.length - 2];
+ // @ts-expect-error: stash this on the node, as it might become a reference
+ // later.
+ ancestor.label = decodeString(string);
+ // @ts-expect-error: same as above.
+ ancestor.identifier = normalizeIdentifier(string).toLowerCase();
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlabel() {
+ const fragment = this.stack[this.stack.length - 1];
+ const value = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ // Assume a reference.
+ setData('inReference', true);
+ if (node.type === 'link') {
+ /** @type {Array} */
+ // @ts-expect-error: Assume static phrasing content.
+ const children = fragment.children;
+ node.children = children;
+ } else {
+ node.alt = value;
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitresourcedestinationstring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.url = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitresourcetitlestring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.title = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitresource() {
+ setData('inReference');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onenterreference() {
+ setData('referenceType', 'collapsed');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitreferencestring(token) {
+ const label = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ // @ts-expect-error: stash this on the node, as it might become a reference
+ // later.
+ node.label = label;
+ // @ts-expect-error: same as above.
+ node.identifier = normalizeIdentifier(
+ this.sliceSerialize(token)
+ ).toLowerCase();
+ setData('referenceType', 'full');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitcharacterreferencemarker(token) {
+ setData('characterReferenceType', token.type);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcharacterreferencevalue(token) {
+ const data = this.sliceSerialize(token);
+ const type = getData('characterReferenceType');
+ /** @type {string} */
+ let value;
+ if (type) {
+ value = decodeNumericCharacterReference(
+ data,
+ type === 'characterReferenceMarkerNumeric' ? 10 : 16
+ );
+ setData('characterReferenceType');
+ } else {
+ const result = decodeNamedCharacterReference(data);
+ value = result;
+ }
+ const tail = this.stack.pop();
+ tail.value += value;
+ tail.position.end = point(token.end);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitautolinkprotocol(token) {
+ onexitdata.call(this, token);
+ const node = this.stack[this.stack.length - 1];
+ node.url = this.sliceSerialize(token);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitautolinkemail(token) {
+ onexitdata.call(this, token);
+ const node = this.stack[this.stack.length - 1];
+ node.url = 'mailto:' + this.sliceSerialize(token);
+ }
+
+ //
+ // Creaters.
+ //
+
+ /** @returns {Blockquote} */
+ function blockQuote() {
+ return {
+ type: 'blockquote',
+ children: []
+ }
+ }
+
+ /** @returns {Code} */
+ function codeFlow() {
+ return {
+ type: 'code',
+ lang: null,
+ meta: null,
+ value: ''
+ }
+ }
+
+ /** @returns {InlineCode} */
+ function codeText() {
+ return {
+ type: 'inlineCode',
+ value: ''
+ }
+ }
+
+ /** @returns {Definition} */
+ function definition() {
+ return {
+ type: 'definition',
+ identifier: '',
+ label: null,
+ title: null,
+ url: ''
+ }
+ }
+
+ /** @returns {Emphasis} */
+ function emphasis() {
+ return {
+ type: 'emphasis',
+ children: []
+ }
+ }
+
+ /** @returns {Heading} */
+ function heading() {
+ // @ts-expect-error `depth` will be set later.
+ return {
+ type: 'heading',
+ depth: undefined,
+ children: []
+ }
+ }
+
+ /** @returns {Break} */
+ function hardBreak() {
+ return {
+ type: 'break'
+ }
+ }
+
+ /** @returns {HTML} */
+ function html() {
+ return {
+ type: 'html',
+ value: ''
+ }
+ }
+
+ /** @returns {Image} */
+ function image() {
+ return {
+ type: 'image',
+ title: null,
+ url: '',
+ alt: null
+ }
+ }
+
+ /** @returns {Link} */
+ function link() {
+ return {
+ type: 'link',
+ title: null,
+ url: '',
+ children: []
+ }
+ }
+
+ /**
+ * @param {Token} token
+ * @returns {List}
+ */
+ function list(token) {
+ return {
+ type: 'list',
+ ordered: token.type === 'listOrdered',
+ start: null,
+ spread: token._spread,
+ children: []
+ }
+ }
+
+ /**
+ * @param {Token} token
+ * @returns {ListItem}
+ */
+ function listItem(token) {
+ return {
+ type: 'listItem',
+ spread: token._spread,
+ checked: null,
+ children: []
+ }
+ }
+
+ /** @returns {Paragraph} */
+ function paragraph() {
+ return {
+ type: 'paragraph',
+ children: []
+ }
+ }
+
+ /** @returns {Strong} */
+ function strong() {
+ return {
+ type: 'strong',
+ children: []
+ }
+ }
+
+ /** @returns {Text} */
+ function text() {
+ return {
+ type: 'text',
+ value: ''
+ }
+ }
+
+ /** @returns {ThematicBreak} */
+ function thematicBreak() {
+ return {
+ type: 'thematicBreak'
+ }
+ }
+}
+
+/**
+ * Copy a point-like value.
+ *
+ * @param {Point} d
+ * Point-like value.
+ * @returns {Point}
+ * unist point.
+ */
+function point(d) {
+ return {
+ line: d.line,
+ column: d.column,
+ offset: d.offset
+ }
+}
+
+/**
+ * @param {Config} combined
+ * @param {Array>} extensions
+ * @returns {void}
+ */
+function configure(combined, extensions) {
+ let index = -1;
+ while (++index < extensions.length) {
+ const value = extensions[index];
+ if (Array.isArray(value)) {
+ configure(combined, value);
+ } else {
+ extension(combined, value);
+ }
+ }
+}
+
+/**
+ * @param {Config} combined
+ * @param {Extension} extension
+ * @returns {void}
+ */
+function extension(combined, extension) {
+ /** @type {keyof Extension} */
+ let key;
+ for (key in extension) {
+ if (own.call(extension, key)) {
+ if (key === 'canContainEols') {
+ const right = extension[key];
+ if (right) {
+ combined[key].push(...right);
+ }
+ } else if (key === 'transforms') {
+ const right = extension[key];
+ if (right) {
+ combined[key].push(...right);
+ }
+ } else if (key === 'enter' || key === 'exit') {
+ const right = extension[key];
+ if (right) {
+ Object.assign(combined[key], right);
+ }
+ }
+ }
+ }
+}
+
+/** @type {OnEnterError} */
+function defaultOnError(left, right) {
+ if (left) {
+ throw new Error(
+ 'Cannot close `' +
+ left.type +
+ '` (' +
+ stringifyPosition({
+ start: left.start,
+ end: left.end
+ }) +
+ '): a different token (`' +
+ right.type +
+ '`, ' +
+ stringifyPosition({
+ start: right.start,
+ end: right.end
+ }) +
+ ') is open'
+ )
+ } else {
+ throw new Error(
+ 'Cannot close document, a token (`' +
+ right.type +
+ '`, ' +
+ stringifyPosition({
+ start: right.start,
+ end: right.end
+ }) +
+ ') is still open'
+ )
+ }
+}
+
+function preprocessMarkdown(markdown) {
+ const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n");
+ const withoutExtraSpaces = dedent(withoutMultipleNewlines);
+ return withoutExtraSpaces;
+}
+function markdownToLines(markdown) {
+ const preprocessedMarkdown = preprocessMarkdown(markdown);
+ const { children } = fromMarkdown(preprocessedMarkdown);
+ const lines = [[]];
+ let currentLine = 0;
+ function processNode(node, parentType = "normal") {
+ if (node.type === "text") {
+ const textLines = node.value.split("\n");
+ textLines.forEach((textLine, index) => {
+ if (index !== 0) {
+ currentLine++;
+ lines.push([]);
+ }
+ textLine.split(" ").forEach((word) => {
+ if (word) {
+ lines[currentLine].push({ content: word, type: parentType });
+ }
+ });
+ });
+ } else if (node.type === "strong" || node.type === "emphasis") {
+ node.children.forEach((contentNode) => {
+ processNode(contentNode, node.type);
+ });
+ }
+ }
+ children.forEach((treeNode) => {
+ if (treeNode.type === "paragraph") {
+ treeNode.children.forEach((contentNode) => {
+ processNode(contentNode);
+ });
+ }
+ });
+ return lines;
+}
+function markdownToHTML(markdown) {
+ const { children } = fromMarkdown(markdown);
+ function output(node) {
+ if (node.type === "text") {
+ return node.value.replace(/\n/g, "
");
+ } else if (node.type === "strong") {
+ return `${node.children.map(output).join("")}`;
+ } else if (node.type === "emphasis") {
+ return `${node.children.map(output).join("")}`;
+ } else if (node.type === "paragraph") {
+ return `${node.children.map(output).join("")}
`;
+ }
+ return `Unsupported markdown: ${node.type}`;
+ }
+ return children.map(output).join("");
+}
+function splitTextToChars(text) {
+ if (Intl.Segmenter) {
+ return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);
+ }
+ return [...text];
+}
+function splitWordToFitWidth(checkFit, word) {
+ const characters = splitTextToChars(word.content);
+ return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);
+}
+function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) {
+ if (remainingChars.length === 0) {
+ return [
+ { content: usedChars.join(""), type },
+ { content: "", type }
+ ];
+ }
+ const [nextChar, ...rest] = remainingChars;
+ const newWord = [...usedChars, nextChar];
+ if (checkFit([{ content: newWord.join(""), type }])) {
+ return splitWordToFitWidthRecursion(checkFit, newWord, rest, type);
+ }
+ if (usedChars.length === 0 && nextChar) {
+ usedChars.push(nextChar);
+ remainingChars.shift();
+ }
+ return [
+ { content: usedChars.join(""), type },
+ { content: remainingChars.join(""), type }
+ ];
+}
+function splitLineToFitWidth(line, checkFit) {
+ if (line.some(({ content }) => content.includes("\n"))) {
+ throw new Error("splitLineToFitWidth does not support newlines in the line");
+ }
+ return splitLineToFitWidthRecursion(line, checkFit);
+}
+function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
+ if (words.length === 0) {
+ if (newLine.length > 0) {
+ lines.push(newLine);
+ }
+ return lines.length > 0 ? lines : [];
+ }
+ let joiner = "";
+ if (words[0].content === " ") {
+ joiner = " ";
+ words.shift();
+ }
+ const nextWord = words.shift() ?? { content: " ", type: "normal" };
+ const lineWithNextWord = [...newLine];
+ if (joiner !== "") {
+ lineWithNextWord.push({ content: joiner, type: "normal" });
+ }
+ lineWithNextWord.push(nextWord);
+ if (checkFit(lineWithNextWord)) {
+ return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);
+ }
+ if (newLine.length > 0) {
+ lines.push(newLine);
+ words.unshift(nextWord);
+ } else if (nextWord.content) {
+ const [line, rest] = splitWordToFitWidth(checkFit, nextWord);
+ lines.push([line]);
+ if (rest.content) {
+ words.unshift(rest);
+ }
+ }
+ return splitLineToFitWidthRecursion(words, checkFit, lines);
+}
+function applyStyle(dom, styleFn) {
+ if (styleFn) {
+ dom.attr("style", styleFn);
+ }
+}
+function addHtmlSpan(element, node, width, classes, addBackground = false) {
+ const fo = element.append("foreignObject");
+ const div = fo.append("xhtml:div");
+ const label = node.label;
+ const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
+ div.html(
+ `
+ " + label + ""
+ );
+ applyStyle(div, node.labelStyle);
+ div.style("display", "table-cell");
+ div.style("white-space", "nowrap");
+ div.style("max-width", width + "px");
+ div.attr("xmlns", "http://www.w3.org/1999/xhtml");
+ if (addBackground) {
+ div.attr("class", "labelBkg");
+ }
+ let bbox = div.node().getBoundingClientRect();
+ if (bbox.width === width) {
+ div.style("display", "table");
+ div.style("white-space", "break-spaces");
+ div.style("width", width + "px");
+ bbox = div.node().getBoundingClientRect();
+ }
+ fo.style("width", bbox.width);
+ fo.style("height", bbox.height);
+ return fo.node();
+}
+function createTspan(textElement, lineIndex, lineHeight) {
+ return textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
+}
+function computeWidthOfText(parentNode, lineHeight, line) {
+ const testElement = parentNode.append("text");
+ const testSpan = createTspan(testElement, 1, lineHeight);
+ updateTextContentAndStyles(testSpan, line);
+ const textLength = testSpan.node().getComputedTextLength();
+ testElement.remove();
+ return textLength;
+}
+function computeDimensionOfText(parentNode, lineHeight, text) {
+ var _a;
+ const testElement = parentNode.append("text");
+ const testSpan = createTspan(testElement, 1, lineHeight);
+ updateTextContentAndStyles(testSpan, [{ content: text, type: "normal" }]);
+ const textDimension = (_a = testSpan.node()) == null ? void 0 : _a.getBoundingClientRect();
+ if (textDimension) {
+ testElement.remove();
+ }
+ return textDimension;
+}
+function createFormattedText(width, g, structuredText, addBackground = false) {
+ const lineHeight = 1.1;
+ const labelGroup = g.append("g");
+ const bkg = labelGroup.insert("rect").attr("class", "background");
+ const textElement = labelGroup.append("text").attr("y", "-10.1");
+ let lineIndex = 0;
+ for (const line of structuredText) {
+ const checkWidth = (line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width;
+ const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);
+ for (const preparedLine of linesUnderWidth) {
+ const tspan = createTspan(textElement, lineIndex, lineHeight);
+ updateTextContentAndStyles(tspan, preparedLine);
+ lineIndex++;
+ }
+ }
+ if (addBackground) {
+ const bbox = textElement.node().getBBox();
+ const padding = 2;
+ bkg.attr("x", -padding).attr("y", -padding).attr("width", bbox.width + 2 * padding).attr("height", bbox.height + 2 * padding);
+ return labelGroup.node();
+ } else {
+ return textElement.node();
+ }
+}
+function updateTextContentAndStyles(tspan, wrappedLine) {
+ tspan.text("");
+ wrappedLine.forEach((word, index) => {
+ const innerTspan = tspan.append("tspan").attr("font-style", word.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
+ if (index === 0) {
+ innerTspan.text(word.content);
+ } else {
+ innerTspan.text(" " + word.content);
+ }
+ });
+}
+const createText = (el, text = "", {
+ style = "",
+ isTitle = false,
+ classes = "",
+ useHtmlLabels = true,
+ isNode = true,
+ width = 200,
+ addSvgBackground = false
+} = {}) => {
+ log$1.info("createText", text, style, isTitle, classes, useHtmlLabels, isNode, addSvgBackground);
+ if (useHtmlLabels) {
+ const htmlText = markdownToHTML(text);
+ const node = {
+ isNode,
+ label: decodeEntities(htmlText).replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell: disable-line
+ (s) => ``
+ ),
+ labelStyle: style.replace("fill:", "color:")
+ };
+ const vertexNode = addHtmlSpan(el, node, width, classes, addSvgBackground);
+ return vertexNode;
+ } else {
+ const structuredText = markdownToLines(text);
+ const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground);
+ return svgLabel;
+ }
+};
+
+export { createText as a, computeDimensionOfText as c };
diff --git a/libs/marked/createText-ca0c5216-DF05SDfj.js b/libs/marked/createText-ca0c5216-DF05SDfj.js
new file mode 100644
index 0000000..2b480bb
--- /dev/null
+++ b/libs/marked/createText-ca0c5216-DF05SDfj.js
@@ -0,0 +1,12431 @@
+import { l as log$1, b6 as decodeEntities, b7 as dedent } from './index-CN3YjQ0n.js';
+
+/**
+ * @typedef {import('mdast').Root|import('mdast').Content} Node
+ *
+ * @typedef Options
+ * Configuration (optional).
+ * @property {boolean | null | undefined} [includeImageAlt=true]
+ * Whether to use `alt` for `image`s.
+ * @property {boolean | null | undefined} [includeHtml=true]
+ * Whether to use `value` of HTML.
+ */
+
+/** @type {Options} */
+const emptyOptions = {};
+
+/**
+ * Get the text content of a node or list of nodes.
+ *
+ * Prefers the node’s plain-text fields, otherwise serializes its children,
+ * and if the given value is an array, serialize the nodes in it.
+ *
+ * @param {unknown} value
+ * Thing to serialize, typically `Node`.
+ * @param {Options | null | undefined} [options]
+ * Configuration (optional).
+ * @returns {string}
+ * Serialized `value`.
+ */
+function toString(value, options) {
+ const settings = emptyOptions;
+ const includeImageAlt =
+ typeof settings.includeImageAlt === 'boolean'
+ ? settings.includeImageAlt
+ : true;
+ const includeHtml =
+ typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true;
+
+ return one(value, includeImageAlt, includeHtml)
+}
+
+/**
+ * One node or several nodes.
+ *
+ * @param {unknown} value
+ * Thing to serialize.
+ * @param {boolean} includeImageAlt
+ * Include image `alt`s.
+ * @param {boolean} includeHtml
+ * Include HTML.
+ * @returns {string}
+ * Serialized node.
+ */
+function one(value, includeImageAlt, includeHtml) {
+ if (node(value)) {
+ if ('value' in value) {
+ return value.type === 'html' && !includeHtml ? '' : value.value
+ }
+
+ if (includeImageAlt && 'alt' in value && value.alt) {
+ return value.alt
+ }
+
+ if ('children' in value) {
+ return all(value.children, includeImageAlt, includeHtml)
+ }
+ }
+
+ if (Array.isArray(value)) {
+ return all(value, includeImageAlt, includeHtml)
+ }
+
+ return ''
+}
+
+/**
+ * Serialize a list of nodes.
+ *
+ * @param {Array} values
+ * Thing to serialize.
+ * @param {boolean} includeImageAlt
+ * Include image `alt`s.
+ * @param {boolean} includeHtml
+ * Include HTML.
+ * @returns {string}
+ * Serialized nodes.
+ */
+function all(values, includeImageAlt, includeHtml) {
+ /** @type {Array} */
+ const result = [];
+ let index = -1;
+
+ while (++index < values.length) {
+ result[index] = one(values[index], includeImageAlt, includeHtml);
+ }
+
+ return result.join('')
+}
+
+/**
+ * Check if `value` looks like a node.
+ *
+ * @param {unknown} value
+ * Thing.
+ * @returns {value is Node}
+ * Whether `value` is a node.
+ */
+function node(value) {
+ return Boolean(value && typeof value === 'object')
+}
+
+/**
+ * Like `Array#splice`, but smarter for giant arrays.
+ *
+ * `Array#splice` takes all items to be inserted as individual argument which
+ * causes a stack overflow in V8 when trying to insert 100k items for instance.
+ *
+ * Otherwise, this does not return the removed items, and takes `items` as an
+ * array instead of rest parameters.
+ *
+ * @template {unknown} T
+ * Item type.
+ * @param {Array} list
+ * List to operate on.
+ * @param {number} start
+ * Index to remove/insert at (can be negative).
+ * @param {number} remove
+ * Number of items to remove.
+ * @param {Array} items
+ * Items to inject into `list`.
+ * @returns {void}
+ * Nothing.
+ */
+function splice(list, start, remove, items) {
+ const end = list.length;
+ let chunkStart = 0;
+ /** @type {Array} */
+ let parameters;
+
+ // Make start between zero and `end` (included).
+ if (start < 0) {
+ start = -start > end ? 0 : end + start;
+ } else {
+ start = start > end ? end : start;
+ }
+ remove = remove > 0 ? remove : 0;
+
+ // No need to chunk the items if there’s only a couple (10k) items.
+ if (items.length < 10000) {
+ parameters = Array.from(items);
+ parameters.unshift(start, remove);
+ // @ts-expect-error Hush, it’s fine.
+ list.splice(...parameters);
+ } else {
+ // Delete `remove` items starting from `start`
+ if (remove) list.splice(start, remove);
+
+ // Insert the items in chunks to not cause stack overflows.
+ while (chunkStart < items.length) {
+ parameters = items.slice(chunkStart, chunkStart + 10000);
+ parameters.unshift(start, 0);
+ // @ts-expect-error Hush, it’s fine.
+ list.splice(...parameters);
+ chunkStart += 10000;
+ start += 10000;
+ }
+ }
+}
+
+/**
+ * Append `items` (an array) at the end of `list` (another array).
+ * When `list` was empty, returns `items` instead.
+ *
+ * This prevents a potentially expensive operation when `list` is empty,
+ * and adds items in batches to prevent V8 from hanging.
+ *
+ * @template {unknown} T
+ * Item type.
+ * @param {Array} list
+ * List to operate on.
+ * @param {Array} items
+ * Items to add to `list`.
+ * @returns {Array}
+ * Either `list` or `items`.
+ */
+function push(list, items) {
+ if (list.length > 0) {
+ splice(list, list.length, 0, items);
+ return list
+ }
+ return items
+}
+
+/**
+ * @typedef {import('micromark-util-types').Extension} Extension
+ * @typedef {import('micromark-util-types').Handles} Handles
+ * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
+ * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension
+ */
+
+
+const hasOwnProperty = {}.hasOwnProperty;
+
+/**
+ * Combine multiple syntax extensions into one.
+ *
+ * @param {Array} extensions
+ * List of syntax extensions.
+ * @returns {NormalizedExtension}
+ * A single combined extension.
+ */
+function combineExtensions(extensions) {
+ /** @type {NormalizedExtension} */
+ const all = {};
+ let index = -1;
+
+ while (++index < extensions.length) {
+ syntaxExtension(all, extensions[index]);
+ }
+
+ return all
+}
+
+/**
+ * Merge `extension` into `all`.
+ *
+ * @param {NormalizedExtension} all
+ * Extension to merge into.
+ * @param {Extension} extension
+ * Extension to merge.
+ * @returns {void}
+ */
+function syntaxExtension(all, extension) {
+ /** @type {keyof Extension} */
+ let hook;
+
+ for (hook in extension) {
+ const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined;
+ /** @type {Record} */
+ const left = maybe || (all[hook] = {});
+ /** @type {Record | undefined} */
+ const right = extension[hook];
+ /** @type {string} */
+ let code;
+
+ if (right) {
+ for (code in right) {
+ if (!hasOwnProperty.call(left, code)) left[code] = [];
+ const value = right[code];
+ constructs(
+ // @ts-expect-error Looks like a list.
+ left[code],
+ Array.isArray(value) ? value : value ? [value] : []
+ );
+ }
+ }
+ }
+}
+
+/**
+ * Merge `list` into `existing` (both lists of constructs).
+ * Mutates `existing`.
+ *
+ * @param {Array} existing
+ * @param {Array} list
+ * @returns {void}
+ */
+function constructs(existing, list) {
+ let index = -1;
+ /** @type {Array} */
+ const before = [];
+
+ while (++index < list.length) {
+(list[index].add === 'after' ? existing : before).push(list[index]);
+ }
+
+ splice(existing, 0, 0, before);
+}
+
+// This module is generated by `script/`.
+//
+// CommonMark handles attention (emphasis, strong) markers based on what comes
+// before or after them.
+// One such difference is if those characters are Unicode punctuation.
+// This script is generated from the Unicode data.
+
+/**
+ * Regular expression that matches a unicode punctuation character.
+ */
+const unicodePunctuationRegex =
+ /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ */
+
+
+/**
+ * Check whether the character code represents an ASCII alpha (`a` through `z`,
+ * case insensitive).
+ *
+ * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
+ *
+ * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
+ * to U+005A (`Z`).
+ *
+ * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
+ * to U+007A (`z`).
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const asciiAlpha = regexCheck(/[A-Za-z]/);
+
+/**
+ * Check whether the character code represents an ASCII alphanumeric (`a`
+ * through `z`, case insensitive, or `0` through `9`).
+ *
+ * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
+ * (see `asciiAlpha`).
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
+
+/**
+ * Check whether the character code represents an ASCII atext.
+ *
+ * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in
+ * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),
+ * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F
+ * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E
+ * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE
+ * (`{`) to U+007E TILDE (`~`).
+ *
+ * See:
+ * **\[RFC5322]**:
+ * [Internet Message Format](https://tools.ietf.org/html/rfc5322).
+ * P. Resnick.
+ * IETF.
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
+
+/**
+ * Check whether a character code is an ASCII control character.
+ *
+ * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
+ * to U+001F (US), or U+007F (DEL).
+ *
+ * @param {Code} code
+ * Code.
+ * @returns {boolean}
+ * Whether it matches.
+ */
+function asciiControl(code) {
+ return (
+ // Special whitespace codes (which have negative values), C0 and Control
+ // character DEL
+ code !== null && (code < 32 || code === 127)
+ )
+}
+
+/**
+ * Check whether the character code represents an ASCII digit (`0` through `9`).
+ *
+ * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
+ * U+0039 (`9`).
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const asciiDigit = regexCheck(/\d/);
+
+/**
+ * Check whether the character code represents an ASCII hex digit (`a` through
+ * `f`, case insensitive, or `0` through `9`).
+ *
+ * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex
+ * digit, or an ASCII lower hex digit.
+ *
+ * An **ASCII upper hex digit** is a character in the inclusive range U+0041
+ * (`A`) to U+0046 (`F`).
+ *
+ * An **ASCII lower hex digit** is a character in the inclusive range U+0061
+ * (`a`) to U+0066 (`f`).
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
+
+/**
+ * Check whether the character code represents ASCII punctuation.
+ *
+ * An **ASCII punctuation** is a character in the inclusive ranges U+0021
+ * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT
+ * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT
+ * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
+
+/**
+ * Check whether a character code is a markdown line ending.
+ *
+ * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
+ * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
+ *
+ * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
+ * RETURN (CR) are replaced by these virtual characters depending on whether
+ * they occurred together.
+ *
+ * @param {Code} code
+ * Code.
+ * @returns {boolean}
+ * Whether it matches.
+ */
+function markdownLineEnding(code) {
+ return code !== null && code < -2
+}
+
+/**
+ * Check whether a character code is a markdown line ending (see
+ * `markdownLineEnding`) or markdown space (see `markdownSpace`).
+ *
+ * @param {Code} code
+ * Code.
+ * @returns {boolean}
+ * Whether it matches.
+ */
+function markdownLineEndingOrSpace(code) {
+ return code !== null && (code < 0 || code === 32)
+}
+
+/**
+ * Check whether a character code is a markdown space.
+ *
+ * A **markdown space** is the concrete character U+0020 SPACE (SP) and the
+ * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
+ *
+ * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
+ * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
+ * SPACE (VS) characters, depending on the column at which the tab occurred.
+ *
+ * @param {Code} code
+ * Code.
+ * @returns {boolean}
+ * Whether it matches.
+ */
+function markdownSpace(code) {
+ return code === -2 || code === -1 || code === 32
+}
+
+// Size note: removing ASCII from the regex and using `asciiPunctuation` here
+// In fact adds to the bundle size.
+/**
+ * Check whether the character code represents Unicode punctuation.
+ *
+ * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
+ * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
+ * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
+ * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
+ * punctuation (see `asciiPunctuation`).
+ *
+ * See:
+ * **\[UNICODE]**:
+ * [The Unicode Standard](https://www.unicode.org/versions/).
+ * Unicode Consortium.
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const unicodePunctuation = regexCheck(unicodePunctuationRegex);
+
+/**
+ * Check whether the character code represents Unicode whitespace.
+ *
+ * Note that this does handle micromark specific markdown whitespace characters.
+ * See `markdownLineEndingOrSpace` to check that.
+ *
+ * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
+ * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
+ * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
+ *
+ * See:
+ * **\[UNICODE]**:
+ * [The Unicode Standard](https://www.unicode.org/versions/).
+ * Unicode Consortium.
+ *
+ * @param code
+ * Code.
+ * @returns
+ * Whether it matches.
+ */
+const unicodeWhitespace = regexCheck(/\s/);
+
+/**
+ * Create a code check from a regex.
+ *
+ * @param {RegExp} regex
+ * @returns {(code: Code) => boolean}
+ */
+function regexCheck(regex) {
+ return check
+
+ /**
+ * Check whether a code matches the bound regex.
+ *
+ * @param {Code} code
+ * Character code.
+ * @returns {boolean}
+ * Whether the character code matches the bound regex.
+ */
+ function check(code) {
+ return code !== null && regex.test(String.fromCharCode(code))
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+
+// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.
+
+/**
+ * Parse spaces and tabs.
+ *
+ * There is no `nok` parameter:
+ *
+ * * spaces in markdown are often optional, in which case this factory can be
+ * used and `ok` will be switched to whether spaces were found or not
+ * * one line ending or space can be detected with `markdownSpace(code)` right
+ * before using `factorySpace`
+ *
+ * ###### Examples
+ *
+ * Where `␉` represents a tab (plus how much it expands) and `␠` represents a
+ * single space.
+ *
+ * ```markdown
+ * ␉
+ * ␠␠␠␠
+ * ␉␠
+ * ```
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {TokenType} type
+ * Type (`' \t'`).
+ * @param {number | undefined} [max=Infinity]
+ * Max (exclusive).
+ * @returns
+ * Start state.
+ */
+function factorySpace(effects, ok, type, max) {
+ const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
+ let size = 0;
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ if (markdownSpace(code)) {
+ effects.enter(type);
+ return prefix(code)
+ }
+ return ok(code)
+ }
+
+ /** @type {State} */
+ function prefix(code) {
+ if (markdownSpace(code) && size++ < limit) {
+ effects.consume(code);
+ return prefix
+ }
+ effects.exit(type);
+ return ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').Initializer} Initializer
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+/** @type {InitialConstruct} */
+const content$1 = {
+ tokenize: initializeContent
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Initializer}
+ */
+function initializeContent(effects) {
+ const contentStart = effects.attempt(
+ this.parser.constructs.contentInitial,
+ afterContentStartConstruct,
+ paragraphInitial
+ );
+ /** @type {Token} */
+ let previous;
+ return contentStart
+
+ /** @type {State} */
+ function afterContentStartConstruct(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, contentStart, 'linePrefix')
+ }
+
+ /** @type {State} */
+ function paragraphInitial(code) {
+ effects.enter('paragraph');
+ return lineStart(code)
+ }
+
+ /** @type {State} */
+ function lineStart(code) {
+ const token = effects.enter('chunkText', {
+ contentType: 'text',
+ previous
+ });
+ if (previous) {
+ previous.next = token;
+ }
+ previous = token;
+ return data(code)
+ }
+
+ /** @type {State} */
+ function data(code) {
+ if (code === null) {
+ effects.exit('chunkText');
+ effects.exit('paragraph');
+ effects.consume(code);
+ return
+ }
+ if (markdownLineEnding(code)) {
+ effects.consume(code);
+ effects.exit('chunkText');
+ return lineStart
+ }
+
+ // Data.
+ effects.consume(code);
+ return data
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').ContainerState} ContainerState
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').Initializer} Initializer
+ * @typedef {import('micromark-util-types').Point} Point
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {InitialConstruct} */
+const document$1 = {
+ tokenize: initializeDocument
+};
+
+/** @type {Construct} */
+const containerConstruct = {
+ tokenize: tokenizeContainer
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Initializer}
+ */
+function initializeDocument(effects) {
+ const self = this;
+ /** @type {Array} */
+ const stack = [];
+ let continued = 0;
+ /** @type {TokenizeContext | undefined} */
+ let childFlow;
+ /** @type {Token | undefined} */
+ let childToken;
+ /** @type {number} */
+ let lineStartOffset;
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ // First we iterate through the open blocks, starting with the root
+ // document, and descending through last children down to the last open
+ // block.
+ // Each block imposes a condition that the line must satisfy if the block is
+ // to remain open.
+ // For example, a block quote requires a `>` character.
+ // A paragraph requires a non-blank line.
+ // In this phase we may match all or just some of the open blocks.
+ // But we cannot close unmatched blocks yet, because we may have a lazy
+ // continuation line.
+ if (continued < stack.length) {
+ const item = stack[continued];
+ self.containerState = item[1];
+ return effects.attempt(
+ item[0].continuation,
+ documentContinue,
+ checkNewContainers
+ )(code)
+ }
+
+ // Done.
+ return checkNewContainers(code)
+ }
+
+ /** @type {State} */
+ function documentContinue(code) {
+ continued++;
+
+ // Note: this field is called `_closeFlow` but it also closes containers.
+ // Perhaps a good idea to rename it but it’s already used in the wild by
+ // extensions.
+ if (self.containerState._closeFlow) {
+ self.containerState._closeFlow = undefined;
+ if (childFlow) {
+ closeFlow();
+ }
+
+ // Note: this algorithm for moving events around is similar to the
+ // algorithm when dealing with lazy lines in `writeToChild`.
+ const indexBeforeExits = self.events.length;
+ let indexBeforeFlow = indexBeforeExits;
+ /** @type {Point | undefined} */
+ let point;
+
+ // Find the flow chunk.
+ while (indexBeforeFlow--) {
+ if (
+ self.events[indexBeforeFlow][0] === 'exit' &&
+ self.events[indexBeforeFlow][1].type === 'chunkFlow'
+ ) {
+ point = self.events[indexBeforeFlow][1].end;
+ break
+ }
+ }
+ exitContainers(continued);
+
+ // Fix positions.
+ let index = indexBeforeExits;
+ while (index < self.events.length) {
+ self.events[index][1].end = Object.assign({}, point);
+ index++;
+ }
+
+ // Inject the exits earlier (they’re still also at the end).
+ splice(
+ self.events,
+ indexBeforeFlow + 1,
+ 0,
+ self.events.slice(indexBeforeExits)
+ );
+
+ // Discard the duplicate exits.
+ self.events.length = index;
+ return checkNewContainers(code)
+ }
+ return start(code)
+ }
+
+ /** @type {State} */
+ function checkNewContainers(code) {
+ // Next, after consuming the continuation markers for existing blocks, we
+ // look for new block starts (e.g. `>` for a block quote).
+ // If we encounter a new block start, we close any blocks unmatched in
+ // step 1 before creating the new block as a child of the last matched
+ // block.
+ if (continued === stack.length) {
+ // No need to `check` whether there’s a container, of `exitContainers`
+ // would be moot.
+ // We can instead immediately `attempt` to parse one.
+ if (!childFlow) {
+ return documentContinued(code)
+ }
+
+ // If we have concrete content, such as block HTML or fenced code,
+ // we can’t have containers “pierce” into them, so we can immediately
+ // start.
+ if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
+ return flowStart(code)
+ }
+
+ // If we do have flow, it could still be a blank line,
+ // but we’d be interrupting it w/ a new container if there’s a current
+ // construct.
+ // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer
+ // needed in micromark-extension-gfm-table@1.0.6).
+ self.interrupt = Boolean(
+ childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack
+ );
+ }
+
+ // Check if there is a new container.
+ self.containerState = {};
+ return effects.check(
+ containerConstruct,
+ thereIsANewContainer,
+ thereIsNoNewContainer
+ )(code)
+ }
+
+ /** @type {State} */
+ function thereIsANewContainer(code) {
+ if (childFlow) closeFlow();
+ exitContainers(continued);
+ return documentContinued(code)
+ }
+
+ /** @type {State} */
+ function thereIsNoNewContainer(code) {
+ self.parser.lazy[self.now().line] = continued !== stack.length;
+ lineStartOffset = self.now().offset;
+ return flowStart(code)
+ }
+
+ /** @type {State} */
+ function documentContinued(code) {
+ // Try new containers.
+ self.containerState = {};
+ return effects.attempt(
+ containerConstruct,
+ containerContinue,
+ flowStart
+ )(code)
+ }
+
+ /** @type {State} */
+ function containerContinue(code) {
+ continued++;
+ stack.push([self.currentConstruct, self.containerState]);
+ // Try another.
+ return documentContinued(code)
+ }
+
+ /** @type {State} */
+ function flowStart(code) {
+ if (code === null) {
+ if (childFlow) closeFlow();
+ exitContainers(0);
+ effects.consume(code);
+ return
+ }
+ childFlow = childFlow || self.parser.flow(self.now());
+ effects.enter('chunkFlow', {
+ contentType: 'flow',
+ previous: childToken,
+ _tokenizer: childFlow
+ });
+ return flowContinue(code)
+ }
+
+ /** @type {State} */
+ function flowContinue(code) {
+ if (code === null) {
+ writeToChild(effects.exit('chunkFlow'), true);
+ exitContainers(0);
+ effects.consume(code);
+ return
+ }
+ if (markdownLineEnding(code)) {
+ effects.consume(code);
+ writeToChild(effects.exit('chunkFlow'));
+ // Get ready for the next line.
+ continued = 0;
+ self.interrupt = undefined;
+ return start
+ }
+ effects.consume(code);
+ return flowContinue
+ }
+
+ /**
+ * @param {Token} token
+ * @param {boolean | undefined} [eof]
+ * @returns {void}
+ */
+ function writeToChild(token, eof) {
+ const stream = self.sliceStream(token);
+ if (eof) stream.push(null);
+ token.previous = childToken;
+ if (childToken) childToken.next = token;
+ childToken = token;
+ childFlow.defineSkip(token.start);
+ childFlow.write(stream);
+
+ // Alright, so we just added a lazy line:
+ //
+ // ```markdown
+ // > a
+ // b.
+ //
+ // Or:
+ //
+ // > ~~~c
+ // d
+ //
+ // Or:
+ //
+ // > | e |
+ // f
+ // ```
+ //
+ // The construct in the second example (fenced code) does not accept lazy
+ // lines, so it marked itself as done at the end of its first line, and
+ // then the content construct parses `d`.
+ // Most constructs in markdown match on the first line: if the first line
+ // forms a construct, a non-lazy line can’t “unmake” it.
+ //
+ // The construct in the third example is potentially a GFM table, and
+ // those are *weird*.
+ // It *could* be a table, from the first line, if the following line
+ // matches a condition.
+ // In this case, that second line is lazy, which “unmakes” the first line
+ // and turns the whole into one content block.
+ //
+ // We’ve now parsed the non-lazy and the lazy line, and can figure out
+ // whether the lazy line started a new flow block.
+ // If it did, we exit the current containers between the two flow blocks.
+ if (self.parser.lazy[token.start.line]) {
+ let index = childFlow.events.length;
+ while (index--) {
+ if (
+ // The token starts before the line ending…
+ childFlow.events[index][1].start.offset < lineStartOffset &&
+ // …and either is not ended yet…
+ (!childFlow.events[index][1].end ||
+ // …or ends after it.
+ childFlow.events[index][1].end.offset > lineStartOffset)
+ ) {
+ // Exit: there’s still something open, which means it’s a lazy line
+ // part of something.
+ return
+ }
+ }
+
+ // Note: this algorithm for moving events around is similar to the
+ // algorithm when closing flow in `documentContinue`.
+ const indexBeforeExits = self.events.length;
+ let indexBeforeFlow = indexBeforeExits;
+ /** @type {boolean | undefined} */
+ let seen;
+ /** @type {Point | undefined} */
+ let point;
+
+ // Find the previous chunk (the one before the lazy line).
+ while (indexBeforeFlow--) {
+ if (
+ self.events[indexBeforeFlow][0] === 'exit' &&
+ self.events[indexBeforeFlow][1].type === 'chunkFlow'
+ ) {
+ if (seen) {
+ point = self.events[indexBeforeFlow][1].end;
+ break
+ }
+ seen = true;
+ }
+ }
+ exitContainers(continued);
+
+ // Fix positions.
+ index = indexBeforeExits;
+ while (index < self.events.length) {
+ self.events[index][1].end = Object.assign({}, point);
+ index++;
+ }
+
+ // Inject the exits earlier (they’re still also at the end).
+ splice(
+ self.events,
+ indexBeforeFlow + 1,
+ 0,
+ self.events.slice(indexBeforeExits)
+ );
+
+ // Discard the duplicate exits.
+ self.events.length = index;
+ }
+ }
+
+ /**
+ * @param {number} size
+ * @returns {void}
+ */
+ function exitContainers(size) {
+ let index = stack.length;
+
+ // Exit open containers.
+ while (index-- > size) {
+ const entry = stack[index];
+ self.containerState = entry[1];
+ entry[0].exit.call(self, effects);
+ }
+ stack.length = size;
+ }
+ function closeFlow() {
+ childFlow.write([null]);
+ childToken = undefined;
+ childFlow = undefined;
+ self.containerState._closeFlow = undefined;
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeContainer(effects, ok, nok) {
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ effects.attempt(this.parser.constructs.document, ok, nok),
+ 'linePrefix',
+ this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4
+ )
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ */
+
+/**
+ * Classify whether a code represents whitespace, punctuation, or something
+ * else.
+ *
+ * Used for attention (emphasis, strong), whose sequences can open or close
+ * based on the class of surrounding characters.
+ *
+ * > 👉 **Note**: eof (`null`) is seen as whitespace.
+ *
+ * @param {Code} code
+ * Code.
+ * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
+ * Group.
+ */
+function classifyCharacter(code) {
+ if (
+ code === null ||
+ markdownLineEndingOrSpace(code) ||
+ unicodeWhitespace(code)
+ ) {
+ return 1
+ }
+ if (unicodePunctuation(code)) {
+ return 2
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+/**
+ * Call all `resolveAll`s.
+ *
+ * @param {Array<{resolveAll?: Resolver | undefined}>} constructs
+ * List of constructs, optionally with `resolveAll`s.
+ * @param {Array} events
+ * List of events.
+ * @param {TokenizeContext} context
+ * Context used by `tokenize`.
+ * @returns {Array}
+ * Changed events.
+ */
+function resolveAll(constructs, events, context) {
+ /** @type {Array} */
+ const called = [];
+ let index = -1;
+
+ while (++index < constructs.length) {
+ const resolve = constructs[index].resolveAll;
+
+ if (resolve && !called.includes(resolve)) {
+ events = resolve(events, context);
+ called.push(resolve);
+ }
+ }
+
+ return events
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').Point} Point
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const attention = {
+ name: 'attention',
+ tokenize: tokenizeAttention,
+ resolveAll: resolveAllAttention
+};
+
+/**
+ * Take all events and resolve attention to emphasis or strong.
+ *
+ * @type {Resolver}
+ */
+function resolveAllAttention(events, context) {
+ let index = -1;
+ /** @type {number} */
+ let open;
+ /** @type {Token} */
+ let group;
+ /** @type {Token} */
+ let text;
+ /** @type {Token} */
+ let openingSequence;
+ /** @type {Token} */
+ let closingSequence;
+ /** @type {number} */
+ let use;
+ /** @type {Array} */
+ let nextEvents;
+ /** @type {number} */
+ let offset;
+
+ // Walk through all events.
+ //
+ // Note: performance of this is fine on an mb of normal markdown, but it’s
+ // a bottleneck for malicious stuff.
+ while (++index < events.length) {
+ // Find a token that can close.
+ if (
+ events[index][0] === 'enter' &&
+ events[index][1].type === 'attentionSequence' &&
+ events[index][1]._close
+ ) {
+ open = index;
+
+ // Now walk back to find an opener.
+ while (open--) {
+ // Find a token that can open the closer.
+ if (
+ events[open][0] === 'exit' &&
+ events[open][1].type === 'attentionSequence' &&
+ events[open][1]._open &&
+ // If the markers are the same:
+ context.sliceSerialize(events[open][1]).charCodeAt(0) ===
+ context.sliceSerialize(events[index][1]).charCodeAt(0)
+ ) {
+ // If the opening can close or the closing can open,
+ // and the close size *is not* a multiple of three,
+ // but the sum of the opening and closing size *is* multiple of three,
+ // then don’t match.
+ if (
+ (events[open][1]._close || events[index][1]._open) &&
+ (events[index][1].end.offset - events[index][1].start.offset) % 3 &&
+ !(
+ (events[open][1].end.offset -
+ events[open][1].start.offset +
+ events[index][1].end.offset -
+ events[index][1].start.offset) %
+ 3
+ )
+ ) {
+ continue
+ }
+
+ // Number of markers to use from the sequence.
+ use =
+ events[open][1].end.offset - events[open][1].start.offset > 1 &&
+ events[index][1].end.offset - events[index][1].start.offset > 1
+ ? 2
+ : 1;
+ const start = Object.assign({}, events[open][1].end);
+ const end = Object.assign({}, events[index][1].start);
+ movePoint(start, -use);
+ movePoint(end, use);
+ openingSequence = {
+ type: use > 1 ? 'strongSequence' : 'emphasisSequence',
+ start,
+ end: Object.assign({}, events[open][1].end)
+ };
+ closingSequence = {
+ type: use > 1 ? 'strongSequence' : 'emphasisSequence',
+ start: Object.assign({}, events[index][1].start),
+ end
+ };
+ text = {
+ type: use > 1 ? 'strongText' : 'emphasisText',
+ start: Object.assign({}, events[open][1].end),
+ end: Object.assign({}, events[index][1].start)
+ };
+ group = {
+ type: use > 1 ? 'strong' : 'emphasis',
+ start: Object.assign({}, openingSequence.start),
+ end: Object.assign({}, closingSequence.end)
+ };
+ events[open][1].end = Object.assign({}, openingSequence.start);
+ events[index][1].start = Object.assign({}, closingSequence.end);
+ nextEvents = [];
+
+ // If there are more markers in the opening, add them before.
+ if (events[open][1].end.offset - events[open][1].start.offset) {
+ nextEvents = push(nextEvents, [
+ ['enter', events[open][1], context],
+ ['exit', events[open][1], context]
+ ]);
+ }
+
+ // Opening.
+ nextEvents = push(nextEvents, [
+ ['enter', group, context],
+ ['enter', openingSequence, context],
+ ['exit', openingSequence, context],
+ ['enter', text, context]
+ ]);
+
+ // Always populated by defaults.
+
+ // Between.
+ nextEvents = push(
+ nextEvents,
+ resolveAll(
+ context.parser.constructs.insideSpan.null,
+ events.slice(open + 1, index),
+ context
+ )
+ );
+
+ // Closing.
+ nextEvents = push(nextEvents, [
+ ['exit', text, context],
+ ['enter', closingSequence, context],
+ ['exit', closingSequence, context],
+ ['exit', group, context]
+ ]);
+
+ // If there are more markers in the closing, add them after.
+ if (events[index][1].end.offset - events[index][1].start.offset) {
+ offset = 2;
+ nextEvents = push(nextEvents, [
+ ['enter', events[index][1], context],
+ ['exit', events[index][1], context]
+ ]);
+ } else {
+ offset = 0;
+ }
+ splice(events, open - 1, index - open + 3, nextEvents);
+ index = open + nextEvents.length - offset - 2;
+ break
+ }
+ }
+ }
+ }
+
+ // Remove remaining sequences.
+ index = -1;
+ while (++index < events.length) {
+ if (events[index][1].type === 'attentionSequence') {
+ events[index][1].type = 'data';
+ }
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeAttention(effects, ok) {
+ const attentionMarkers = this.parser.constructs.attentionMarkers.null;
+ const previous = this.previous;
+ const before = classifyCharacter(previous);
+
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Before a sequence.
+ *
+ * ```markdown
+ * > | **
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ marker = code;
+ effects.enter('attentionSequence');
+ return inside(code)
+ }
+
+ /**
+ * In a sequence.
+ *
+ * ```markdown
+ * > | **
+ * ^^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === marker) {
+ effects.consume(code);
+ return inside
+ }
+ const token = effects.exit('attentionSequence');
+
+ // To do: next major: move this to resolver, just like `markdown-rs`.
+ const after = classifyCharacter(code);
+
+ // Always populated by defaults.
+
+ const open =
+ !after || (after === 2 && before) || attentionMarkers.includes(code);
+ const close =
+ !before || (before === 2 && after) || attentionMarkers.includes(previous);
+ token._open = Boolean(marker === 42 ? open : open && (before || !close));
+ token._close = Boolean(marker === 42 ? close : close && (after || !open));
+ return ok(code)
+ }
+}
+
+/**
+ * Move a point a bit.
+ *
+ * Note: `move` only works inside lines! It’s not possible to move past other
+ * chunks (replacement characters, tabs, or line endings).
+ *
+ * @param {Point} point
+ * @param {number} offset
+ * @returns {void}
+ */
+function movePoint(point, offset) {
+ point.column += offset;
+ point.offset += offset;
+ point._bufferIndex += offset;
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const autolink = {
+ name: 'autolink',
+ tokenize: tokenizeAutolink
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeAutolink(effects, ok, nok) {
+ let size = 0;
+ return start
+
+ /**
+ * Start of an autolink.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('autolink');
+ effects.enter('autolinkMarker');
+ effects.consume(code);
+ effects.exit('autolinkMarker');
+ effects.enter('autolinkProtocol');
+ return open
+ }
+
+ /**
+ * After `<`, at protocol or atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return schemeOrEmailAtext
+ }
+ return emailAtext(code)
+ }
+
+ /**
+ * At second byte of protocol or atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function schemeOrEmailAtext(code) {
+ // ASCII alphanumeric and `+`, `-`, and `.`.
+ if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
+ // Count the previous alphabetical from `open` too.
+ size = 1;
+ return schemeInsideOrEmailAtext(code)
+ }
+ return emailAtext(code)
+ }
+
+ /**
+ * In ambiguous protocol or atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function schemeInsideOrEmailAtext(code) {
+ if (code === 58) {
+ effects.consume(code);
+ size = 0;
+ return urlInside
+ }
+
+ // ASCII alphanumeric and `+`, `-`, and `.`.
+ if (
+ (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) &&
+ size++ < 32
+ ) {
+ effects.consume(code);
+ return schemeInsideOrEmailAtext
+ }
+ size = 0;
+ return emailAtext(code)
+ }
+
+ /**
+ * After protocol, in URL.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function urlInside(code) {
+ if (code === 62) {
+ effects.exit('autolinkProtocol');
+ effects.enter('autolinkMarker');
+ effects.consume(code);
+ effects.exit('autolinkMarker');
+ effects.exit('autolink');
+ return ok
+ }
+
+ // ASCII control, space, or `<`.
+ if (code === null || code === 32 || code === 60 || asciiControl(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return urlInside
+ }
+
+ /**
+ * In email atext.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailAtext(code) {
+ if (code === 64) {
+ effects.consume(code);
+ return emailAtSignOrDot
+ }
+ if (asciiAtext(code)) {
+ effects.consume(code);
+ return emailAtext
+ }
+ return nok(code)
+ }
+
+ /**
+ * In label, after at-sign or dot.
+ *
+ * ```markdown
+ * > | ab
+ * ^ ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailAtSignOrDot(code) {
+ return asciiAlphanumeric(code) ? emailLabel(code) : nok(code)
+ }
+
+ /**
+ * In label, where `.` and `>` are allowed.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailLabel(code) {
+ if (code === 46) {
+ effects.consume(code);
+ size = 0;
+ return emailAtSignOrDot
+ }
+ if (code === 62) {
+ // Exit, then change the token type.
+ effects.exit('autolinkProtocol').type = 'autolinkEmail';
+ effects.enter('autolinkMarker');
+ effects.consume(code);
+ effects.exit('autolinkMarker');
+ effects.exit('autolink');
+ return ok
+ }
+ return emailValue(code)
+ }
+
+ /**
+ * In label, where `.` and `>` are *not* allowed.
+ *
+ * Though, this is also used in `emailLabel` to parse other values.
+ *
+ * ```markdown
+ * > | ab
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function emailValue(code) {
+ // ASCII alphanumeric or `-`.
+ if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
+ const next = code === 45 ? emailValue : emailLabel;
+ effects.consume(code);
+ return next
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const blankLine = {
+ tokenize: tokenizeBlankLine,
+ partial: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlankLine(effects, ok, nok) {
+ return start
+
+ /**
+ * Start of blank line.
+ *
+ * > 👉 **Note**: `␠` represents a space character.
+ *
+ * ```markdown
+ * > | ␠␠␊
+ * ^
+ * > | ␊
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ return markdownSpace(code)
+ ? factorySpace(effects, after, 'linePrefix')(code)
+ : after(code)
+ }
+
+ /**
+ * At eof/eol, after optional whitespace.
+ *
+ * > 👉 **Note**: `␠` represents a space character.
+ *
+ * ```markdown
+ * > | ␠␠␊
+ * ^
+ * > | ␊
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Exiter} Exiter
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const blockQuote = {
+ name: 'blockQuote',
+ tokenize: tokenizeBlockQuoteStart,
+ continuation: {
+ tokenize: tokenizeBlockQuoteContinuation
+ },
+ exit
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlockQuoteStart(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of block quote.
+ *
+ * ```markdown
+ * > | > a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === 62) {
+ const state = self.containerState;
+ if (!state.open) {
+ effects.enter('blockQuote', {
+ _container: true
+ });
+ state.open = true;
+ }
+ effects.enter('blockQuotePrefix');
+ effects.enter('blockQuoteMarker');
+ effects.consume(code);
+ effects.exit('blockQuoteMarker');
+ return after
+ }
+ return nok(code)
+ }
+
+ /**
+ * After `>`, before optional whitespace.
+ *
+ * ```markdown
+ * > | > a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ if (markdownSpace(code)) {
+ effects.enter('blockQuotePrefixWhitespace');
+ effects.consume(code);
+ effects.exit('blockQuotePrefixWhitespace');
+ effects.exit('blockQuotePrefix');
+ return ok
+ }
+ effects.exit('blockQuotePrefix');
+ return ok(code)
+ }
+}
+
+/**
+ * Start of block quote continuation.
+ *
+ * ```markdown
+ * | > a
+ * > | > b
+ * ^
+ * ```
+ *
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlockQuoteContinuation(effects, ok, nok) {
+ const self = this;
+ return contStart
+
+ /**
+ * Start of block quote continuation.
+ *
+ * Also used to parse the first block quote opening.
+ *
+ * ```markdown
+ * | > a
+ * > | > b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function contStart(code) {
+ if (markdownSpace(code)) {
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ contBefore,
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ }
+ return contBefore(code)
+ }
+
+ /**
+ * At `>`, after optional whitespace.
+ *
+ * Also used to parse the first block quote opening.
+ *
+ * ```markdown
+ * | > a
+ * > | > b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function contBefore(code) {
+ return effects.attempt(blockQuote, ok, nok)(code)
+ }
+}
+
+/** @type {Exiter} */
+function exit(effects) {
+ effects.exit('blockQuote');
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const characterEscape = {
+ name: 'characterEscape',
+ tokenize: tokenizeCharacterEscape
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCharacterEscape(effects, ok, nok) {
+ return start
+
+ /**
+ * Start of character escape.
+ *
+ * ```markdown
+ * > | a\*b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('characterEscape');
+ effects.enter('escapeMarker');
+ effects.consume(code);
+ effects.exit('escapeMarker');
+ return inside
+ }
+
+ /**
+ * After `\`, at punctuation.
+ *
+ * ```markdown
+ * > | a\*b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ // ASCII punctuation.
+ if (asciiPunctuation(code)) {
+ effects.enter('characterEscapeValue');
+ effects.consume(code);
+ effects.exit('characterEscapeValue');
+ effects.exit('characterEscape');
+ return ok
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * Map of named character references.
+ *
+ * @type {Record}
+ */
+const characterEntities = {
+ AElig: 'Æ',
+ AMP: '&',
+ Aacute: 'Á',
+ Abreve: 'Ă',
+ Acirc: 'Â',
+ Acy: 'А',
+ Afr: '𝔄',
+ Agrave: 'À',
+ Alpha: 'Α',
+ Amacr: 'Ā',
+ And: '⩓',
+ Aogon: 'Ą',
+ Aopf: '𝔸',
+ ApplyFunction: '',
+ Aring: 'Å',
+ Ascr: '𝒜',
+ Assign: '≔',
+ Atilde: 'Ã',
+ Auml: 'Ä',
+ Backslash: '∖',
+ Barv: '⫧',
+ Barwed: '⌆',
+ Bcy: 'Б',
+ Because: '∵',
+ Bernoullis: 'ℬ',
+ Beta: 'Β',
+ Bfr: '𝔅',
+ Bopf: '𝔹',
+ Breve: '˘',
+ Bscr: 'ℬ',
+ Bumpeq: '≎',
+ CHcy: 'Ч',
+ COPY: '©',
+ Cacute: 'Ć',
+ Cap: '⋒',
+ CapitalDifferentialD: 'ⅅ',
+ Cayleys: 'ℭ',
+ Ccaron: 'Č',
+ Ccedil: 'Ç',
+ Ccirc: 'Ĉ',
+ Cconint: '∰',
+ Cdot: 'Ċ',
+ Cedilla: '¸',
+ CenterDot: '·',
+ Cfr: 'ℭ',
+ Chi: 'Χ',
+ CircleDot: '⊙',
+ CircleMinus: '⊖',
+ CirclePlus: '⊕',
+ CircleTimes: '⊗',
+ ClockwiseContourIntegral: '∲',
+ CloseCurlyDoubleQuote: '”',
+ CloseCurlyQuote: '’',
+ Colon: '∷',
+ Colone: '⩴',
+ Congruent: '≡',
+ Conint: '∯',
+ ContourIntegral: '∮',
+ Copf: 'ℂ',
+ Coproduct: '∐',
+ CounterClockwiseContourIntegral: '∳',
+ Cross: '⨯',
+ Cscr: '𝒞',
+ Cup: '⋓',
+ CupCap: '≍',
+ DD: 'ⅅ',
+ DDotrahd: '⤑',
+ DJcy: 'Ђ',
+ DScy: 'Ѕ',
+ DZcy: 'Џ',
+ Dagger: '‡',
+ Darr: '↡',
+ Dashv: '⫤',
+ Dcaron: 'Ď',
+ Dcy: 'Д',
+ Del: '∇',
+ Delta: 'Δ',
+ Dfr: '𝔇',
+ DiacriticalAcute: '´',
+ DiacriticalDot: '˙',
+ DiacriticalDoubleAcute: '˝',
+ DiacriticalGrave: '`',
+ DiacriticalTilde: '˜',
+ Diamond: '⋄',
+ DifferentialD: 'ⅆ',
+ Dopf: '𝔻',
+ Dot: '¨',
+ DotDot: '⃜',
+ DotEqual: '≐',
+ DoubleContourIntegral: '∯',
+ DoubleDot: '¨',
+ DoubleDownArrow: '⇓',
+ DoubleLeftArrow: '⇐',
+ DoubleLeftRightArrow: '⇔',
+ DoubleLeftTee: '⫤',
+ DoubleLongLeftArrow: '⟸',
+ DoubleLongLeftRightArrow: '⟺',
+ DoubleLongRightArrow: '⟹',
+ DoubleRightArrow: '⇒',
+ DoubleRightTee: '⊨',
+ DoubleUpArrow: '⇑',
+ DoubleUpDownArrow: '⇕',
+ DoubleVerticalBar: '∥',
+ DownArrow: '↓',
+ DownArrowBar: '⤓',
+ DownArrowUpArrow: '⇵',
+ DownBreve: '̑',
+ DownLeftRightVector: '⥐',
+ DownLeftTeeVector: '⥞',
+ DownLeftVector: '↽',
+ DownLeftVectorBar: '⥖',
+ DownRightTeeVector: '⥟',
+ DownRightVector: '⇁',
+ DownRightVectorBar: '⥗',
+ DownTee: '⊤',
+ DownTeeArrow: '↧',
+ Downarrow: '⇓',
+ Dscr: '𝒟',
+ Dstrok: 'Đ',
+ ENG: 'Ŋ',
+ ETH: 'Ð',
+ Eacute: 'É',
+ Ecaron: 'Ě',
+ Ecirc: 'Ê',
+ Ecy: 'Э',
+ Edot: 'Ė',
+ Efr: '𝔈',
+ Egrave: 'È',
+ Element: '∈',
+ Emacr: 'Ē',
+ EmptySmallSquare: '◻',
+ EmptyVerySmallSquare: '▫',
+ Eogon: 'Ę',
+ Eopf: '𝔼',
+ Epsilon: 'Ε',
+ Equal: '⩵',
+ EqualTilde: '≂',
+ Equilibrium: '⇌',
+ Escr: 'ℰ',
+ Esim: '⩳',
+ Eta: 'Η',
+ Euml: 'Ë',
+ Exists: '∃',
+ ExponentialE: 'ⅇ',
+ Fcy: 'Ф',
+ Ffr: '𝔉',
+ FilledSmallSquare: '◼',
+ FilledVerySmallSquare: '▪',
+ Fopf: '𝔽',
+ ForAll: '∀',
+ Fouriertrf: 'ℱ',
+ Fscr: 'ℱ',
+ GJcy: 'Ѓ',
+ GT: '>',
+ Gamma: 'Γ',
+ Gammad: 'Ϝ',
+ Gbreve: 'Ğ',
+ Gcedil: 'Ģ',
+ Gcirc: 'Ĝ',
+ Gcy: 'Г',
+ Gdot: 'Ġ',
+ Gfr: '𝔊',
+ Gg: '⋙',
+ Gopf: '𝔾',
+ GreaterEqual: '≥',
+ GreaterEqualLess: '⋛',
+ GreaterFullEqual: '≧',
+ GreaterGreater: '⪢',
+ GreaterLess: '≷',
+ GreaterSlantEqual: '⩾',
+ GreaterTilde: '≳',
+ Gscr: '𝒢',
+ Gt: '≫',
+ HARDcy: 'Ъ',
+ Hacek: 'ˇ',
+ Hat: '^',
+ Hcirc: 'Ĥ',
+ Hfr: 'ℌ',
+ HilbertSpace: 'ℋ',
+ Hopf: 'ℍ',
+ HorizontalLine: '─',
+ Hscr: 'ℋ',
+ Hstrok: 'Ħ',
+ HumpDownHump: '≎',
+ HumpEqual: '≏',
+ IEcy: 'Е',
+ IJlig: 'IJ',
+ IOcy: 'Ё',
+ Iacute: 'Í',
+ Icirc: 'Î',
+ Icy: 'И',
+ Idot: 'İ',
+ Ifr: 'ℑ',
+ Igrave: 'Ì',
+ Im: 'ℑ',
+ Imacr: 'Ī',
+ ImaginaryI: 'ⅈ',
+ Implies: '⇒',
+ Int: '∬',
+ Integral: '∫',
+ Intersection: '⋂',
+ InvisibleComma: '',
+ InvisibleTimes: '',
+ Iogon: 'Į',
+ Iopf: '𝕀',
+ Iota: 'Ι',
+ Iscr: 'ℐ',
+ Itilde: 'Ĩ',
+ Iukcy: 'І',
+ Iuml: 'Ï',
+ Jcirc: 'Ĵ',
+ Jcy: 'Й',
+ Jfr: '𝔍',
+ Jopf: '𝕁',
+ Jscr: '𝒥',
+ Jsercy: 'Ј',
+ Jukcy: 'Є',
+ KHcy: 'Х',
+ KJcy: 'Ќ',
+ Kappa: 'Κ',
+ Kcedil: 'Ķ',
+ Kcy: 'К',
+ Kfr: '𝔎',
+ Kopf: '𝕂',
+ Kscr: '𝒦',
+ LJcy: 'Љ',
+ LT: '<',
+ Lacute: 'Ĺ',
+ Lambda: 'Λ',
+ Lang: '⟪',
+ Laplacetrf: 'ℒ',
+ Larr: '↞',
+ Lcaron: 'Ľ',
+ Lcedil: 'Ļ',
+ Lcy: 'Л',
+ LeftAngleBracket: '⟨',
+ LeftArrow: '←',
+ LeftArrowBar: '⇤',
+ LeftArrowRightArrow: '⇆',
+ LeftCeiling: '⌈',
+ LeftDoubleBracket: '⟦',
+ LeftDownTeeVector: '⥡',
+ LeftDownVector: '⇃',
+ LeftDownVectorBar: '⥙',
+ LeftFloor: '⌊',
+ LeftRightArrow: '↔',
+ LeftRightVector: '⥎',
+ LeftTee: '⊣',
+ LeftTeeArrow: '↤',
+ LeftTeeVector: '⥚',
+ LeftTriangle: '⊲',
+ LeftTriangleBar: '⧏',
+ LeftTriangleEqual: '⊴',
+ LeftUpDownVector: '⥑',
+ LeftUpTeeVector: '⥠',
+ LeftUpVector: '↿',
+ LeftUpVectorBar: '⥘',
+ LeftVector: '↼',
+ LeftVectorBar: '⥒',
+ Leftarrow: '⇐',
+ Leftrightarrow: '⇔',
+ LessEqualGreater: '⋚',
+ LessFullEqual: '≦',
+ LessGreater: '≶',
+ LessLess: '⪡',
+ LessSlantEqual: '⩽',
+ LessTilde: '≲',
+ Lfr: '𝔏',
+ Ll: '⋘',
+ Lleftarrow: '⇚',
+ Lmidot: 'Ŀ',
+ LongLeftArrow: '⟵',
+ LongLeftRightArrow: '⟷',
+ LongRightArrow: '⟶',
+ Longleftarrow: '⟸',
+ Longleftrightarrow: '⟺',
+ Longrightarrow: '⟹',
+ Lopf: '𝕃',
+ LowerLeftArrow: '↙',
+ LowerRightArrow: '↘',
+ Lscr: 'ℒ',
+ Lsh: '↰',
+ Lstrok: 'Ł',
+ Lt: '≪',
+ Map: '⤅',
+ Mcy: 'М',
+ MediumSpace: ' ',
+ Mellintrf: 'ℳ',
+ Mfr: '𝔐',
+ MinusPlus: '∓',
+ Mopf: '𝕄',
+ Mscr: 'ℳ',
+ Mu: 'Μ',
+ NJcy: 'Њ',
+ Nacute: 'Ń',
+ Ncaron: 'Ň',
+ Ncedil: 'Ņ',
+ Ncy: 'Н',
+ NegativeMediumSpace: '',
+ NegativeThickSpace: '',
+ NegativeThinSpace: '',
+ NegativeVeryThinSpace: '',
+ NestedGreaterGreater: '≫',
+ NestedLessLess: '≪',
+ NewLine: '\n',
+ Nfr: '𝔑',
+ NoBreak: '',
+ NonBreakingSpace: ' ',
+ Nopf: 'ℕ',
+ Not: '⫬',
+ NotCongruent: '≢',
+ NotCupCap: '≭',
+ NotDoubleVerticalBar: '∦',
+ NotElement: '∉',
+ NotEqual: '≠',
+ NotEqualTilde: '≂̸',
+ NotExists: '∄',
+ NotGreater: '≯',
+ NotGreaterEqual: '≱',
+ NotGreaterFullEqual: '≧̸',
+ NotGreaterGreater: '≫̸',
+ NotGreaterLess: '≹',
+ NotGreaterSlantEqual: '⩾̸',
+ NotGreaterTilde: '≵',
+ NotHumpDownHump: '≎̸',
+ NotHumpEqual: '≏̸',
+ NotLeftTriangle: '⋪',
+ NotLeftTriangleBar: '⧏̸',
+ NotLeftTriangleEqual: '⋬',
+ NotLess: '≮',
+ NotLessEqual: '≰',
+ NotLessGreater: '≸',
+ NotLessLess: '≪̸',
+ NotLessSlantEqual: '⩽̸',
+ NotLessTilde: '≴',
+ NotNestedGreaterGreater: '⪢̸',
+ NotNestedLessLess: '⪡̸',
+ NotPrecedes: '⊀',
+ NotPrecedesEqual: '⪯̸',
+ NotPrecedesSlantEqual: '⋠',
+ NotReverseElement: '∌',
+ NotRightTriangle: '⋫',
+ NotRightTriangleBar: '⧐̸',
+ NotRightTriangleEqual: '⋭',
+ NotSquareSubset: '⊏̸',
+ NotSquareSubsetEqual: '⋢',
+ NotSquareSuperset: '⊐̸',
+ NotSquareSupersetEqual: '⋣',
+ NotSubset: '⊂⃒',
+ NotSubsetEqual: '⊈',
+ NotSucceeds: '⊁',
+ NotSucceedsEqual: '⪰̸',
+ NotSucceedsSlantEqual: '⋡',
+ NotSucceedsTilde: '≿̸',
+ NotSuperset: '⊃⃒',
+ NotSupersetEqual: '⊉',
+ NotTilde: '≁',
+ NotTildeEqual: '≄',
+ NotTildeFullEqual: '≇',
+ NotTildeTilde: '≉',
+ NotVerticalBar: '∤',
+ Nscr: '𝒩',
+ Ntilde: 'Ñ',
+ Nu: 'Ν',
+ OElig: 'Œ',
+ Oacute: 'Ó',
+ Ocirc: 'Ô',
+ Ocy: 'О',
+ Odblac: 'Ő',
+ Ofr: '𝔒',
+ Ograve: 'Ò',
+ Omacr: 'Ō',
+ Omega: 'Ω',
+ Omicron: 'Ο',
+ Oopf: '𝕆',
+ OpenCurlyDoubleQuote: '“',
+ OpenCurlyQuote: '‘',
+ Or: '⩔',
+ Oscr: '𝒪',
+ Oslash: 'Ø',
+ Otilde: 'Õ',
+ Otimes: '⨷',
+ Ouml: 'Ö',
+ OverBar: '‾',
+ OverBrace: '⏞',
+ OverBracket: '⎴',
+ OverParenthesis: '⏜',
+ PartialD: '∂',
+ Pcy: 'П',
+ Pfr: '𝔓',
+ Phi: 'Φ',
+ Pi: 'Π',
+ PlusMinus: '±',
+ Poincareplane: 'ℌ',
+ Popf: 'ℙ',
+ Pr: '⪻',
+ Precedes: '≺',
+ PrecedesEqual: '⪯',
+ PrecedesSlantEqual: '≼',
+ PrecedesTilde: '≾',
+ Prime: '″',
+ Product: '∏',
+ Proportion: '∷',
+ Proportional: '∝',
+ Pscr: '𝒫',
+ Psi: 'Ψ',
+ QUOT: '"',
+ Qfr: '𝔔',
+ Qopf: 'ℚ',
+ Qscr: '𝒬',
+ RBarr: '⤐',
+ REG: '®',
+ Racute: 'Ŕ',
+ Rang: '⟫',
+ Rarr: '↠',
+ Rarrtl: '⤖',
+ Rcaron: 'Ř',
+ Rcedil: 'Ŗ',
+ Rcy: 'Р',
+ Re: 'ℜ',
+ ReverseElement: '∋',
+ ReverseEquilibrium: '⇋',
+ ReverseUpEquilibrium: '⥯',
+ Rfr: 'ℜ',
+ Rho: 'Ρ',
+ RightAngleBracket: '⟩',
+ RightArrow: '→',
+ RightArrowBar: '⇥',
+ RightArrowLeftArrow: '⇄',
+ RightCeiling: '⌉',
+ RightDoubleBracket: '⟧',
+ RightDownTeeVector: '⥝',
+ RightDownVector: '⇂',
+ RightDownVectorBar: '⥕',
+ RightFloor: '⌋',
+ RightTee: '⊢',
+ RightTeeArrow: '↦',
+ RightTeeVector: '⥛',
+ RightTriangle: '⊳',
+ RightTriangleBar: '⧐',
+ RightTriangleEqual: '⊵',
+ RightUpDownVector: '⥏',
+ RightUpTeeVector: '⥜',
+ RightUpVector: '↾',
+ RightUpVectorBar: '⥔',
+ RightVector: '⇀',
+ RightVectorBar: '⥓',
+ Rightarrow: '⇒',
+ Ropf: 'ℝ',
+ RoundImplies: '⥰',
+ Rrightarrow: '⇛',
+ Rscr: 'ℛ',
+ Rsh: '↱',
+ RuleDelayed: '⧴',
+ SHCHcy: 'Щ',
+ SHcy: 'Ш',
+ SOFTcy: 'Ь',
+ Sacute: 'Ś',
+ Sc: '⪼',
+ Scaron: 'Š',
+ Scedil: 'Ş',
+ Scirc: 'Ŝ',
+ Scy: 'С',
+ Sfr: '𝔖',
+ ShortDownArrow: '↓',
+ ShortLeftArrow: '←',
+ ShortRightArrow: '→',
+ ShortUpArrow: '↑',
+ Sigma: 'Σ',
+ SmallCircle: '∘',
+ Sopf: '𝕊',
+ Sqrt: '√',
+ Square: '□',
+ SquareIntersection: '⊓',
+ SquareSubset: '⊏',
+ SquareSubsetEqual: '⊑',
+ SquareSuperset: '⊐',
+ SquareSupersetEqual: '⊒',
+ SquareUnion: '⊔',
+ Sscr: '𝒮',
+ Star: '⋆',
+ Sub: '⋐',
+ Subset: '⋐',
+ SubsetEqual: '⊆',
+ Succeeds: '≻',
+ SucceedsEqual: '⪰',
+ SucceedsSlantEqual: '≽',
+ SucceedsTilde: '≿',
+ SuchThat: '∋',
+ Sum: '∑',
+ Sup: '⋑',
+ Superset: '⊃',
+ SupersetEqual: '⊇',
+ Supset: '⋑',
+ THORN: 'Þ',
+ TRADE: '™',
+ TSHcy: 'Ћ',
+ TScy: 'Ц',
+ Tab: '\t',
+ Tau: 'Τ',
+ Tcaron: 'Ť',
+ Tcedil: 'Ţ',
+ Tcy: 'Т',
+ Tfr: '𝔗',
+ Therefore: '∴',
+ Theta: 'Θ',
+ ThickSpace: ' ',
+ ThinSpace: ' ',
+ Tilde: '∼',
+ TildeEqual: '≃',
+ TildeFullEqual: '≅',
+ TildeTilde: '≈',
+ Topf: '𝕋',
+ TripleDot: '⃛',
+ Tscr: '𝒯',
+ Tstrok: 'Ŧ',
+ Uacute: 'Ú',
+ Uarr: '↟',
+ Uarrocir: '⥉',
+ Ubrcy: 'Ў',
+ Ubreve: 'Ŭ',
+ Ucirc: 'Û',
+ Ucy: 'У',
+ Udblac: 'Ű',
+ Ufr: '𝔘',
+ Ugrave: 'Ù',
+ Umacr: 'Ū',
+ UnderBar: '_',
+ UnderBrace: '⏟',
+ UnderBracket: '⎵',
+ UnderParenthesis: '⏝',
+ Union: '⋃',
+ UnionPlus: '⊎',
+ Uogon: 'Ų',
+ Uopf: '𝕌',
+ UpArrow: '↑',
+ UpArrowBar: '⤒',
+ UpArrowDownArrow: '⇅',
+ UpDownArrow: '↕',
+ UpEquilibrium: '⥮',
+ UpTee: '⊥',
+ UpTeeArrow: '↥',
+ Uparrow: '⇑',
+ Updownarrow: '⇕',
+ UpperLeftArrow: '↖',
+ UpperRightArrow: '↗',
+ Upsi: 'ϒ',
+ Upsilon: 'Υ',
+ Uring: 'Ů',
+ Uscr: '𝒰',
+ Utilde: 'Ũ',
+ Uuml: 'Ü',
+ VDash: '⊫',
+ Vbar: '⫫',
+ Vcy: 'В',
+ Vdash: '⊩',
+ Vdashl: '⫦',
+ Vee: '⋁',
+ Verbar: '‖',
+ Vert: '‖',
+ VerticalBar: '∣',
+ VerticalLine: '|',
+ VerticalSeparator: '❘',
+ VerticalTilde: '≀',
+ VeryThinSpace: ' ',
+ Vfr: '𝔙',
+ Vopf: '𝕍',
+ Vscr: '𝒱',
+ Vvdash: '⊪',
+ Wcirc: 'Ŵ',
+ Wedge: '⋀',
+ Wfr: '𝔚',
+ Wopf: '𝕎',
+ Wscr: '𝒲',
+ Xfr: '𝔛',
+ Xi: 'Ξ',
+ Xopf: '𝕏',
+ Xscr: '𝒳',
+ YAcy: 'Я',
+ YIcy: 'Ї',
+ YUcy: 'Ю',
+ Yacute: 'Ý',
+ Ycirc: 'Ŷ',
+ Ycy: 'Ы',
+ Yfr: '𝔜',
+ Yopf: '𝕐',
+ Yscr: '𝒴',
+ Yuml: 'Ÿ',
+ ZHcy: 'Ж',
+ Zacute: 'Ź',
+ Zcaron: 'Ž',
+ Zcy: 'З',
+ Zdot: 'Ż',
+ ZeroWidthSpace: '',
+ Zeta: 'Ζ',
+ Zfr: 'ℨ',
+ Zopf: 'ℤ',
+ Zscr: '𝒵',
+ aacute: 'á',
+ abreve: 'ă',
+ ac: '∾',
+ acE: '∾̳',
+ acd: '∿',
+ acirc: 'â',
+ acute: '´',
+ acy: 'а',
+ aelig: 'æ',
+ af: '',
+ afr: '𝔞',
+ agrave: 'à',
+ alefsym: 'ℵ',
+ aleph: 'ℵ',
+ alpha: 'α',
+ amacr: 'ā',
+ amalg: '⨿',
+ amp: '&',
+ and: '∧',
+ andand: '⩕',
+ andd: '⩜',
+ andslope: '⩘',
+ andv: '⩚',
+ ang: '∠',
+ ange: '⦤',
+ angle: '∠',
+ angmsd: '∡',
+ angmsdaa: '⦨',
+ angmsdab: '⦩',
+ angmsdac: '⦪',
+ angmsdad: '⦫',
+ angmsdae: '⦬',
+ angmsdaf: '⦭',
+ angmsdag: '⦮',
+ angmsdah: '⦯',
+ angrt: '∟',
+ angrtvb: '⊾',
+ angrtvbd: '⦝',
+ angsph: '∢',
+ angst: 'Å',
+ angzarr: '⍼',
+ aogon: 'ą',
+ aopf: '𝕒',
+ ap: '≈',
+ apE: '⩰',
+ apacir: '⩯',
+ ape: '≊',
+ apid: '≋',
+ apos: "'",
+ approx: '≈',
+ approxeq: '≊',
+ aring: 'å',
+ ascr: '𝒶',
+ ast: '*',
+ asymp: '≈',
+ asympeq: '≍',
+ atilde: 'ã',
+ auml: 'ä',
+ awconint: '∳',
+ awint: '⨑',
+ bNot: '⫭',
+ backcong: '≌',
+ backepsilon: '϶',
+ backprime: '‵',
+ backsim: '∽',
+ backsimeq: '⋍',
+ barvee: '⊽',
+ barwed: '⌅',
+ barwedge: '⌅',
+ bbrk: '⎵',
+ bbrktbrk: '⎶',
+ bcong: '≌',
+ bcy: 'б',
+ bdquo: '„',
+ becaus: '∵',
+ because: '∵',
+ bemptyv: '⦰',
+ bepsi: '϶',
+ bernou: 'ℬ',
+ beta: 'β',
+ beth: 'ℶ',
+ between: '≬',
+ bfr: '𝔟',
+ bigcap: '⋂',
+ bigcirc: '◯',
+ bigcup: '⋃',
+ bigodot: '⨀',
+ bigoplus: '⨁',
+ bigotimes: '⨂',
+ bigsqcup: '⨆',
+ bigstar: '★',
+ bigtriangledown: '▽',
+ bigtriangleup: '△',
+ biguplus: '⨄',
+ bigvee: '⋁',
+ bigwedge: '⋀',
+ bkarow: '⤍',
+ blacklozenge: '⧫',
+ blacksquare: '▪',
+ blacktriangle: '▴',
+ blacktriangledown: '▾',
+ blacktriangleleft: '◂',
+ blacktriangleright: '▸',
+ blank: '␣',
+ blk12: '▒',
+ blk14: '░',
+ blk34: '▓',
+ block: '█',
+ bne: '=⃥',
+ bnequiv: '≡⃥',
+ bnot: '⌐',
+ bopf: '𝕓',
+ bot: '⊥',
+ bottom: '⊥',
+ bowtie: '⋈',
+ boxDL: '╗',
+ boxDR: '╔',
+ boxDl: '╖',
+ boxDr: '╓',
+ boxH: '═',
+ boxHD: '╦',
+ boxHU: '╩',
+ boxHd: '╤',
+ boxHu: '╧',
+ boxUL: '╝',
+ boxUR: '╚',
+ boxUl: '╜',
+ boxUr: '╙',
+ boxV: '║',
+ boxVH: '╬',
+ boxVL: '╣',
+ boxVR: '╠',
+ boxVh: '╫',
+ boxVl: '╢',
+ boxVr: '╟',
+ boxbox: '⧉',
+ boxdL: '╕',
+ boxdR: '╒',
+ boxdl: '┐',
+ boxdr: '┌',
+ boxh: '─',
+ boxhD: '╥',
+ boxhU: '╨',
+ boxhd: '┬',
+ boxhu: '┴',
+ boxminus: '⊟',
+ boxplus: '⊞',
+ boxtimes: '⊠',
+ boxuL: '╛',
+ boxuR: '╘',
+ boxul: '┘',
+ boxur: '└',
+ boxv: '│',
+ boxvH: '╪',
+ boxvL: '╡',
+ boxvR: '╞',
+ boxvh: '┼',
+ boxvl: '┤',
+ boxvr: '├',
+ bprime: '‵',
+ breve: '˘',
+ brvbar: '¦',
+ bscr: '𝒷',
+ bsemi: '⁏',
+ bsim: '∽',
+ bsime: '⋍',
+ bsol: '\\',
+ bsolb: '⧅',
+ bsolhsub: '⟈',
+ bull: '•',
+ bullet: '•',
+ bump: '≎',
+ bumpE: '⪮',
+ bumpe: '≏',
+ bumpeq: '≏',
+ cacute: 'ć',
+ cap: '∩',
+ capand: '⩄',
+ capbrcup: '⩉',
+ capcap: '⩋',
+ capcup: '⩇',
+ capdot: '⩀',
+ caps: '∩︀',
+ caret: '⁁',
+ caron: 'ˇ',
+ ccaps: '⩍',
+ ccaron: 'č',
+ ccedil: 'ç',
+ ccirc: 'ĉ',
+ ccups: '⩌',
+ ccupssm: '⩐',
+ cdot: 'ċ',
+ cedil: '¸',
+ cemptyv: '⦲',
+ cent: '¢',
+ centerdot: '·',
+ cfr: '𝔠',
+ chcy: 'ч',
+ check: '✓',
+ checkmark: '✓',
+ chi: 'χ',
+ cir: '○',
+ cirE: '⧃',
+ circ: 'ˆ',
+ circeq: '≗',
+ circlearrowleft: '↺',
+ circlearrowright: '↻',
+ circledR: '®',
+ circledS: 'Ⓢ',
+ circledast: '⊛',
+ circledcirc: '⊚',
+ circleddash: '⊝',
+ cire: '≗',
+ cirfnint: '⨐',
+ cirmid: '⫯',
+ cirscir: '⧂',
+ clubs: '♣',
+ clubsuit: '♣',
+ colon: ':',
+ colone: '≔',
+ coloneq: '≔',
+ comma: ',',
+ commat: '@',
+ comp: '∁',
+ compfn: '∘',
+ complement: '∁',
+ complexes: 'ℂ',
+ cong: '≅',
+ congdot: '⩭',
+ conint: '∮',
+ copf: '𝕔',
+ coprod: '∐',
+ copy: '©',
+ copysr: '℗',
+ crarr: '↵',
+ cross: '✗',
+ cscr: '𝒸',
+ csub: '⫏',
+ csube: '⫑',
+ csup: '⫐',
+ csupe: '⫒',
+ ctdot: '⋯',
+ cudarrl: '⤸',
+ cudarrr: '⤵',
+ cuepr: '⋞',
+ cuesc: '⋟',
+ cularr: '↶',
+ cularrp: '⤽',
+ cup: '∪',
+ cupbrcap: '⩈',
+ cupcap: '⩆',
+ cupcup: '⩊',
+ cupdot: '⊍',
+ cupor: '⩅',
+ cups: '∪︀',
+ curarr: '↷',
+ curarrm: '⤼',
+ curlyeqprec: '⋞',
+ curlyeqsucc: '⋟',
+ curlyvee: '⋎',
+ curlywedge: '⋏',
+ curren: '¤',
+ curvearrowleft: '↶',
+ curvearrowright: '↷',
+ cuvee: '⋎',
+ cuwed: '⋏',
+ cwconint: '∲',
+ cwint: '∱',
+ cylcty: '⌭',
+ dArr: '⇓',
+ dHar: '⥥',
+ dagger: '†',
+ daleth: 'ℸ',
+ darr: '↓',
+ dash: '‐',
+ dashv: '⊣',
+ dbkarow: '⤏',
+ dblac: '˝',
+ dcaron: 'ď',
+ dcy: 'д',
+ dd: 'ⅆ',
+ ddagger: '‡',
+ ddarr: '⇊',
+ ddotseq: '⩷',
+ deg: '°',
+ delta: 'δ',
+ demptyv: '⦱',
+ dfisht: '⥿',
+ dfr: '𝔡',
+ dharl: '⇃',
+ dharr: '⇂',
+ diam: '⋄',
+ diamond: '⋄',
+ diamondsuit: '♦',
+ diams: '♦',
+ die: '¨',
+ digamma: 'ϝ',
+ disin: '⋲',
+ div: '÷',
+ divide: '÷',
+ divideontimes: '⋇',
+ divonx: '⋇',
+ djcy: 'ђ',
+ dlcorn: '⌞',
+ dlcrop: '⌍',
+ dollar: '$',
+ dopf: '𝕕',
+ dot: '˙',
+ doteq: '≐',
+ doteqdot: '≑',
+ dotminus: '∸',
+ dotplus: '∔',
+ dotsquare: '⊡',
+ doublebarwedge: '⌆',
+ downarrow: '↓',
+ downdownarrows: '⇊',
+ downharpoonleft: '⇃',
+ downharpoonright: '⇂',
+ drbkarow: '⤐',
+ drcorn: '⌟',
+ drcrop: '⌌',
+ dscr: '𝒹',
+ dscy: 'ѕ',
+ dsol: '⧶',
+ dstrok: 'đ',
+ dtdot: '⋱',
+ dtri: '▿',
+ dtrif: '▾',
+ duarr: '⇵',
+ duhar: '⥯',
+ dwangle: '⦦',
+ dzcy: 'џ',
+ dzigrarr: '⟿',
+ eDDot: '⩷',
+ eDot: '≑',
+ eacute: 'é',
+ easter: '⩮',
+ ecaron: 'ě',
+ ecir: '≖',
+ ecirc: 'ê',
+ ecolon: '≕',
+ ecy: 'э',
+ edot: 'ė',
+ ee: 'ⅇ',
+ efDot: '≒',
+ efr: '𝔢',
+ eg: '⪚',
+ egrave: 'è',
+ egs: '⪖',
+ egsdot: '⪘',
+ el: '⪙',
+ elinters: '⏧',
+ ell: 'ℓ',
+ els: '⪕',
+ elsdot: '⪗',
+ emacr: 'ē',
+ empty: '∅',
+ emptyset: '∅',
+ emptyv: '∅',
+ emsp13: ' ',
+ emsp14: ' ',
+ emsp: ' ',
+ eng: 'ŋ',
+ ensp: ' ',
+ eogon: 'ę',
+ eopf: '𝕖',
+ epar: '⋕',
+ eparsl: '⧣',
+ eplus: '⩱',
+ epsi: 'ε',
+ epsilon: 'ε',
+ epsiv: 'ϵ',
+ eqcirc: '≖',
+ eqcolon: '≕',
+ eqsim: '≂',
+ eqslantgtr: '⪖',
+ eqslantless: '⪕',
+ equals: '=',
+ equest: '≟',
+ equiv: '≡',
+ equivDD: '⩸',
+ eqvparsl: '⧥',
+ erDot: '≓',
+ erarr: '⥱',
+ escr: 'ℯ',
+ esdot: '≐',
+ esim: '≂',
+ eta: 'η',
+ eth: 'ð',
+ euml: 'ë',
+ euro: '€',
+ excl: '!',
+ exist: '∃',
+ expectation: 'ℰ',
+ exponentiale: 'ⅇ',
+ fallingdotseq: '≒',
+ fcy: 'ф',
+ female: '♀',
+ ffilig: 'ffi',
+ fflig: 'ff',
+ ffllig: 'ffl',
+ ffr: '𝔣',
+ filig: 'fi',
+ fjlig: 'fj',
+ flat: '♭',
+ fllig: 'fl',
+ fltns: '▱',
+ fnof: 'ƒ',
+ fopf: '𝕗',
+ forall: '∀',
+ fork: '⋔',
+ forkv: '⫙',
+ fpartint: '⨍',
+ frac12: '½',
+ frac13: '⅓',
+ frac14: '¼',
+ frac15: '⅕',
+ frac16: '⅙',
+ frac18: '⅛',
+ frac23: '⅔',
+ frac25: '⅖',
+ frac34: '¾',
+ frac35: '⅗',
+ frac38: '⅜',
+ frac45: '⅘',
+ frac56: '⅚',
+ frac58: '⅝',
+ frac78: '⅞',
+ frasl: '⁄',
+ frown: '⌢',
+ fscr: '𝒻',
+ gE: '≧',
+ gEl: '⪌',
+ gacute: 'ǵ',
+ gamma: 'γ',
+ gammad: 'ϝ',
+ gap: '⪆',
+ gbreve: 'ğ',
+ gcirc: 'ĝ',
+ gcy: 'г',
+ gdot: 'ġ',
+ ge: '≥',
+ gel: '⋛',
+ geq: '≥',
+ geqq: '≧',
+ geqslant: '⩾',
+ ges: '⩾',
+ gescc: '⪩',
+ gesdot: '⪀',
+ gesdoto: '⪂',
+ gesdotol: '⪄',
+ gesl: '⋛︀',
+ gesles: '⪔',
+ gfr: '𝔤',
+ gg: '≫',
+ ggg: '⋙',
+ gimel: 'ℷ',
+ gjcy: 'ѓ',
+ gl: '≷',
+ glE: '⪒',
+ gla: '⪥',
+ glj: '⪤',
+ gnE: '≩',
+ gnap: '⪊',
+ gnapprox: '⪊',
+ gne: '⪈',
+ gneq: '⪈',
+ gneqq: '≩',
+ gnsim: '⋧',
+ gopf: '𝕘',
+ grave: '`',
+ gscr: 'ℊ',
+ gsim: '≳',
+ gsime: '⪎',
+ gsiml: '⪐',
+ gt: '>',
+ gtcc: '⪧',
+ gtcir: '⩺',
+ gtdot: '⋗',
+ gtlPar: '⦕',
+ gtquest: '⩼',
+ gtrapprox: '⪆',
+ gtrarr: '⥸',
+ gtrdot: '⋗',
+ gtreqless: '⋛',
+ gtreqqless: '⪌',
+ gtrless: '≷',
+ gtrsim: '≳',
+ gvertneqq: '≩︀',
+ gvnE: '≩︀',
+ hArr: '⇔',
+ hairsp: ' ',
+ half: '½',
+ hamilt: 'ℋ',
+ hardcy: 'ъ',
+ harr: '↔',
+ harrcir: '⥈',
+ harrw: '↭',
+ hbar: 'ℏ',
+ hcirc: 'ĥ',
+ hearts: '♥',
+ heartsuit: '♥',
+ hellip: '…',
+ hercon: '⊹',
+ hfr: '𝔥',
+ hksearow: '⤥',
+ hkswarow: '⤦',
+ hoarr: '⇿',
+ homtht: '∻',
+ hookleftarrow: '↩',
+ hookrightarrow: '↪',
+ hopf: '𝕙',
+ horbar: '―',
+ hscr: '𝒽',
+ hslash: 'ℏ',
+ hstrok: 'ħ',
+ hybull: '⁃',
+ hyphen: '‐',
+ iacute: 'í',
+ ic: '',
+ icirc: 'î',
+ icy: 'и',
+ iecy: 'е',
+ iexcl: '¡',
+ iff: '⇔',
+ ifr: '𝔦',
+ igrave: 'ì',
+ ii: 'ⅈ',
+ iiiint: '⨌',
+ iiint: '∭',
+ iinfin: '⧜',
+ iiota: '℩',
+ ijlig: 'ij',
+ imacr: 'ī',
+ image: 'ℑ',
+ imagline: 'ℐ',
+ imagpart: 'ℑ',
+ imath: 'ı',
+ imof: '⊷',
+ imped: 'Ƶ',
+ in: '∈',
+ incare: '℅',
+ infin: '∞',
+ infintie: '⧝',
+ inodot: 'ı',
+ int: '∫',
+ intcal: '⊺',
+ integers: 'ℤ',
+ intercal: '⊺',
+ intlarhk: '⨗',
+ intprod: '⨼',
+ iocy: 'ё',
+ iogon: 'į',
+ iopf: '𝕚',
+ iota: 'ι',
+ iprod: '⨼',
+ iquest: '¿',
+ iscr: '𝒾',
+ isin: '∈',
+ isinE: '⋹',
+ isindot: '⋵',
+ isins: '⋴',
+ isinsv: '⋳',
+ isinv: '∈',
+ it: '',
+ itilde: 'ĩ',
+ iukcy: 'і',
+ iuml: 'ï',
+ jcirc: 'ĵ',
+ jcy: 'й',
+ jfr: '𝔧',
+ jmath: 'ȷ',
+ jopf: '𝕛',
+ jscr: '𝒿',
+ jsercy: 'ј',
+ jukcy: 'є',
+ kappa: 'κ',
+ kappav: 'ϰ',
+ kcedil: 'ķ',
+ kcy: 'к',
+ kfr: '𝔨',
+ kgreen: 'ĸ',
+ khcy: 'х',
+ kjcy: 'ќ',
+ kopf: '𝕜',
+ kscr: '𝓀',
+ lAarr: '⇚',
+ lArr: '⇐',
+ lAtail: '⤛',
+ lBarr: '⤎',
+ lE: '≦',
+ lEg: '⪋',
+ lHar: '⥢',
+ lacute: 'ĺ',
+ laemptyv: '⦴',
+ lagran: 'ℒ',
+ lambda: 'λ',
+ lang: '⟨',
+ langd: '⦑',
+ langle: '⟨',
+ lap: '⪅',
+ laquo: '«',
+ larr: '←',
+ larrb: '⇤',
+ larrbfs: '⤟',
+ larrfs: '⤝',
+ larrhk: '↩',
+ larrlp: '↫',
+ larrpl: '⤹',
+ larrsim: '⥳',
+ larrtl: '↢',
+ lat: '⪫',
+ latail: '⤙',
+ late: '⪭',
+ lates: '⪭︀',
+ lbarr: '⤌',
+ lbbrk: '❲',
+ lbrace: '{',
+ lbrack: '[',
+ lbrke: '⦋',
+ lbrksld: '⦏',
+ lbrkslu: '⦍',
+ lcaron: 'ľ',
+ lcedil: 'ļ',
+ lceil: '⌈',
+ lcub: '{',
+ lcy: 'л',
+ ldca: '⤶',
+ ldquo: '“',
+ ldquor: '„',
+ ldrdhar: '⥧',
+ ldrushar: '⥋',
+ ldsh: '↲',
+ le: '≤',
+ leftarrow: '←',
+ leftarrowtail: '↢',
+ leftharpoondown: '↽',
+ leftharpoonup: '↼',
+ leftleftarrows: '⇇',
+ leftrightarrow: '↔',
+ leftrightarrows: '⇆',
+ leftrightharpoons: '⇋',
+ leftrightsquigarrow: '↭',
+ leftthreetimes: '⋋',
+ leg: '⋚',
+ leq: '≤',
+ leqq: '≦',
+ leqslant: '⩽',
+ les: '⩽',
+ lescc: '⪨',
+ lesdot: '⩿',
+ lesdoto: '⪁',
+ lesdotor: '⪃',
+ lesg: '⋚︀',
+ lesges: '⪓',
+ lessapprox: '⪅',
+ lessdot: '⋖',
+ lesseqgtr: '⋚',
+ lesseqqgtr: '⪋',
+ lessgtr: '≶',
+ lesssim: '≲',
+ lfisht: '⥼',
+ lfloor: '⌊',
+ lfr: '𝔩',
+ lg: '≶',
+ lgE: '⪑',
+ lhard: '↽',
+ lharu: '↼',
+ lharul: '⥪',
+ lhblk: '▄',
+ ljcy: 'љ',
+ ll: '≪',
+ llarr: '⇇',
+ llcorner: '⌞',
+ llhard: '⥫',
+ lltri: '◺',
+ lmidot: 'ŀ',
+ lmoust: '⎰',
+ lmoustache: '⎰',
+ lnE: '≨',
+ lnap: '⪉',
+ lnapprox: '⪉',
+ lne: '⪇',
+ lneq: '⪇',
+ lneqq: '≨',
+ lnsim: '⋦',
+ loang: '⟬',
+ loarr: '⇽',
+ lobrk: '⟦',
+ longleftarrow: '⟵',
+ longleftrightarrow: '⟷',
+ longmapsto: '⟼',
+ longrightarrow: '⟶',
+ looparrowleft: '↫',
+ looparrowright: '↬',
+ lopar: '⦅',
+ lopf: '𝕝',
+ loplus: '⨭',
+ lotimes: '⨴',
+ lowast: '∗',
+ lowbar: '_',
+ loz: '◊',
+ lozenge: '◊',
+ lozf: '⧫',
+ lpar: '(',
+ lparlt: '⦓',
+ lrarr: '⇆',
+ lrcorner: '⌟',
+ lrhar: '⇋',
+ lrhard: '⥭',
+ lrm: '',
+ lrtri: '⊿',
+ lsaquo: '‹',
+ lscr: '𝓁',
+ lsh: '↰',
+ lsim: '≲',
+ lsime: '⪍',
+ lsimg: '⪏',
+ lsqb: '[',
+ lsquo: '‘',
+ lsquor: '‚',
+ lstrok: 'ł',
+ lt: '<',
+ ltcc: '⪦',
+ ltcir: '⩹',
+ ltdot: '⋖',
+ lthree: '⋋',
+ ltimes: '⋉',
+ ltlarr: '⥶',
+ ltquest: '⩻',
+ ltrPar: '⦖',
+ ltri: '◃',
+ ltrie: '⊴',
+ ltrif: '◂',
+ lurdshar: '⥊',
+ luruhar: '⥦',
+ lvertneqq: '≨︀',
+ lvnE: '≨︀',
+ mDDot: '∺',
+ macr: '¯',
+ male: '♂',
+ malt: '✠',
+ maltese: '✠',
+ map: '↦',
+ mapsto: '↦',
+ mapstodown: '↧',
+ mapstoleft: '↤',
+ mapstoup: '↥',
+ marker: '▮',
+ mcomma: '⨩',
+ mcy: 'м',
+ mdash: '—',
+ measuredangle: '∡',
+ mfr: '𝔪',
+ mho: '℧',
+ micro: 'µ',
+ mid: '∣',
+ midast: '*',
+ midcir: '⫰',
+ middot: '·',
+ minus: '−',
+ minusb: '⊟',
+ minusd: '∸',
+ minusdu: '⨪',
+ mlcp: '⫛',
+ mldr: '…',
+ mnplus: '∓',
+ models: '⊧',
+ mopf: '𝕞',
+ mp: '∓',
+ mscr: '𝓂',
+ mstpos: '∾',
+ mu: 'μ',
+ multimap: '⊸',
+ mumap: '⊸',
+ nGg: '⋙̸',
+ nGt: '≫⃒',
+ nGtv: '≫̸',
+ nLeftarrow: '⇍',
+ nLeftrightarrow: '⇎',
+ nLl: '⋘̸',
+ nLt: '≪⃒',
+ nLtv: '≪̸',
+ nRightarrow: '⇏',
+ nVDash: '⊯',
+ nVdash: '⊮',
+ nabla: '∇',
+ nacute: 'ń',
+ nang: '∠⃒',
+ nap: '≉',
+ napE: '⩰̸',
+ napid: '≋̸',
+ napos: 'ʼn',
+ napprox: '≉',
+ natur: '♮',
+ natural: '♮',
+ naturals: 'ℕ',
+ nbsp: ' ',
+ nbump: '≎̸',
+ nbumpe: '≏̸',
+ ncap: '⩃',
+ ncaron: 'ň',
+ ncedil: 'ņ',
+ ncong: '≇',
+ ncongdot: '⩭̸',
+ ncup: '⩂',
+ ncy: 'н',
+ ndash: '–',
+ ne: '≠',
+ neArr: '⇗',
+ nearhk: '⤤',
+ nearr: '↗',
+ nearrow: '↗',
+ nedot: '≐̸',
+ nequiv: '≢',
+ nesear: '⤨',
+ nesim: '≂̸',
+ nexist: '∄',
+ nexists: '∄',
+ nfr: '𝔫',
+ ngE: '≧̸',
+ nge: '≱',
+ ngeq: '≱',
+ ngeqq: '≧̸',
+ ngeqslant: '⩾̸',
+ nges: '⩾̸',
+ ngsim: '≵',
+ ngt: '≯',
+ ngtr: '≯',
+ nhArr: '⇎',
+ nharr: '↮',
+ nhpar: '⫲',
+ ni: '∋',
+ nis: '⋼',
+ nisd: '⋺',
+ niv: '∋',
+ njcy: 'њ',
+ nlArr: '⇍',
+ nlE: '≦̸',
+ nlarr: '↚',
+ nldr: '‥',
+ nle: '≰',
+ nleftarrow: '↚',
+ nleftrightarrow: '↮',
+ nleq: '≰',
+ nleqq: '≦̸',
+ nleqslant: '⩽̸',
+ nles: '⩽̸',
+ nless: '≮',
+ nlsim: '≴',
+ nlt: '≮',
+ nltri: '⋪',
+ nltrie: '⋬',
+ nmid: '∤',
+ nopf: '𝕟',
+ not: '¬',
+ notin: '∉',
+ notinE: '⋹̸',
+ notindot: '⋵̸',
+ notinva: '∉',
+ notinvb: '⋷',
+ notinvc: '⋶',
+ notni: '∌',
+ notniva: '∌',
+ notnivb: '⋾',
+ notnivc: '⋽',
+ npar: '∦',
+ nparallel: '∦',
+ nparsl: '⫽⃥',
+ npart: '∂̸',
+ npolint: '⨔',
+ npr: '⊀',
+ nprcue: '⋠',
+ npre: '⪯̸',
+ nprec: '⊀',
+ npreceq: '⪯̸',
+ nrArr: '⇏',
+ nrarr: '↛',
+ nrarrc: '⤳̸',
+ nrarrw: '↝̸',
+ nrightarrow: '↛',
+ nrtri: '⋫',
+ nrtrie: '⋭',
+ nsc: '⊁',
+ nsccue: '⋡',
+ nsce: '⪰̸',
+ nscr: '𝓃',
+ nshortmid: '∤',
+ nshortparallel: '∦',
+ nsim: '≁',
+ nsime: '≄',
+ nsimeq: '≄',
+ nsmid: '∤',
+ nspar: '∦',
+ nsqsube: '⋢',
+ nsqsupe: '⋣',
+ nsub: '⊄',
+ nsubE: '⫅̸',
+ nsube: '⊈',
+ nsubset: '⊂⃒',
+ nsubseteq: '⊈',
+ nsubseteqq: '⫅̸',
+ nsucc: '⊁',
+ nsucceq: '⪰̸',
+ nsup: '⊅',
+ nsupE: '⫆̸',
+ nsupe: '⊉',
+ nsupset: '⊃⃒',
+ nsupseteq: '⊉',
+ nsupseteqq: '⫆̸',
+ ntgl: '≹',
+ ntilde: 'ñ',
+ ntlg: '≸',
+ ntriangleleft: '⋪',
+ ntrianglelefteq: '⋬',
+ ntriangleright: '⋫',
+ ntrianglerighteq: '⋭',
+ nu: 'ν',
+ num: '#',
+ numero: '№',
+ numsp: ' ',
+ nvDash: '⊭',
+ nvHarr: '⤄',
+ nvap: '≍⃒',
+ nvdash: '⊬',
+ nvge: '≥⃒',
+ nvgt: '>⃒',
+ nvinfin: '⧞',
+ nvlArr: '⤂',
+ nvle: '≤⃒',
+ nvlt: '<⃒',
+ nvltrie: '⊴⃒',
+ nvrArr: '⤃',
+ nvrtrie: '⊵⃒',
+ nvsim: '∼⃒',
+ nwArr: '⇖',
+ nwarhk: '⤣',
+ nwarr: '↖',
+ nwarrow: '↖',
+ nwnear: '⤧',
+ oS: 'Ⓢ',
+ oacute: 'ó',
+ oast: '⊛',
+ ocir: '⊚',
+ ocirc: 'ô',
+ ocy: 'о',
+ odash: '⊝',
+ odblac: 'ő',
+ odiv: '⨸',
+ odot: '⊙',
+ odsold: '⦼',
+ oelig: 'œ',
+ ofcir: '⦿',
+ ofr: '𝔬',
+ ogon: '˛',
+ ograve: 'ò',
+ ogt: '⧁',
+ ohbar: '⦵',
+ ohm: 'Ω',
+ oint: '∮',
+ olarr: '↺',
+ olcir: '⦾',
+ olcross: '⦻',
+ oline: '‾',
+ olt: '⧀',
+ omacr: 'ō',
+ omega: 'ω',
+ omicron: 'ο',
+ omid: '⦶',
+ ominus: '⊖',
+ oopf: '𝕠',
+ opar: '⦷',
+ operp: '⦹',
+ oplus: '⊕',
+ or: '∨',
+ orarr: '↻',
+ ord: '⩝',
+ order: 'ℴ',
+ orderof: 'ℴ',
+ ordf: 'ª',
+ ordm: 'º',
+ origof: '⊶',
+ oror: '⩖',
+ orslope: '⩗',
+ orv: '⩛',
+ oscr: 'ℴ',
+ oslash: 'ø',
+ osol: '⊘',
+ otilde: 'õ',
+ otimes: '⊗',
+ otimesas: '⨶',
+ ouml: 'ö',
+ ovbar: '⌽',
+ par: '∥',
+ para: '¶',
+ parallel: '∥',
+ parsim: '⫳',
+ parsl: '⫽',
+ part: '∂',
+ pcy: 'п',
+ percnt: '%',
+ period: '.',
+ permil: '‰',
+ perp: '⊥',
+ pertenk: '‱',
+ pfr: '𝔭',
+ phi: 'φ',
+ phiv: 'ϕ',
+ phmmat: 'ℳ',
+ phone: '☎',
+ pi: 'π',
+ pitchfork: '⋔',
+ piv: 'ϖ',
+ planck: 'ℏ',
+ planckh: 'ℎ',
+ plankv: 'ℏ',
+ plus: '+',
+ plusacir: '⨣',
+ plusb: '⊞',
+ pluscir: '⨢',
+ plusdo: '∔',
+ plusdu: '⨥',
+ pluse: '⩲',
+ plusmn: '±',
+ plussim: '⨦',
+ plustwo: '⨧',
+ pm: '±',
+ pointint: '⨕',
+ popf: '𝕡',
+ pound: '£',
+ pr: '≺',
+ prE: '⪳',
+ prap: '⪷',
+ prcue: '≼',
+ pre: '⪯',
+ prec: '≺',
+ precapprox: '⪷',
+ preccurlyeq: '≼',
+ preceq: '⪯',
+ precnapprox: '⪹',
+ precneqq: '⪵',
+ precnsim: '⋨',
+ precsim: '≾',
+ prime: '′',
+ primes: 'ℙ',
+ prnE: '⪵',
+ prnap: '⪹',
+ prnsim: '⋨',
+ prod: '∏',
+ profalar: '⌮',
+ profline: '⌒',
+ profsurf: '⌓',
+ prop: '∝',
+ propto: '∝',
+ prsim: '≾',
+ prurel: '⊰',
+ pscr: '𝓅',
+ psi: 'ψ',
+ puncsp: ' ',
+ qfr: '𝔮',
+ qint: '⨌',
+ qopf: '𝕢',
+ qprime: '⁗',
+ qscr: '𝓆',
+ quaternions: 'ℍ',
+ quatint: '⨖',
+ quest: '?',
+ questeq: '≟',
+ quot: '"',
+ rAarr: '⇛',
+ rArr: '⇒',
+ rAtail: '⤜',
+ rBarr: '⤏',
+ rHar: '⥤',
+ race: '∽̱',
+ racute: 'ŕ',
+ radic: '√',
+ raemptyv: '⦳',
+ rang: '⟩',
+ rangd: '⦒',
+ range: '⦥',
+ rangle: '⟩',
+ raquo: '»',
+ rarr: '→',
+ rarrap: '⥵',
+ rarrb: '⇥',
+ rarrbfs: '⤠',
+ rarrc: '⤳',
+ rarrfs: '⤞',
+ rarrhk: '↪',
+ rarrlp: '↬',
+ rarrpl: '⥅',
+ rarrsim: '⥴',
+ rarrtl: '↣',
+ rarrw: '↝',
+ ratail: '⤚',
+ ratio: '∶',
+ rationals: 'ℚ',
+ rbarr: '⤍',
+ rbbrk: '❳',
+ rbrace: '}',
+ rbrack: ']',
+ rbrke: '⦌',
+ rbrksld: '⦎',
+ rbrkslu: '⦐',
+ rcaron: 'ř',
+ rcedil: 'ŗ',
+ rceil: '⌉',
+ rcub: '}',
+ rcy: 'р',
+ rdca: '⤷',
+ rdldhar: '⥩',
+ rdquo: '”',
+ rdquor: '”',
+ rdsh: '↳',
+ real: 'ℜ',
+ realine: 'ℛ',
+ realpart: 'ℜ',
+ reals: 'ℝ',
+ rect: '▭',
+ reg: '®',
+ rfisht: '⥽',
+ rfloor: '⌋',
+ rfr: '𝔯',
+ rhard: '⇁',
+ rharu: '⇀',
+ rharul: '⥬',
+ rho: 'ρ',
+ rhov: 'ϱ',
+ rightarrow: '→',
+ rightarrowtail: '↣',
+ rightharpoondown: '⇁',
+ rightharpoonup: '⇀',
+ rightleftarrows: '⇄',
+ rightleftharpoons: '⇌',
+ rightrightarrows: '⇉',
+ rightsquigarrow: '↝',
+ rightthreetimes: '⋌',
+ ring: '˚',
+ risingdotseq: '≓',
+ rlarr: '⇄',
+ rlhar: '⇌',
+ rlm: '',
+ rmoust: '⎱',
+ rmoustache: '⎱',
+ rnmid: '⫮',
+ roang: '⟭',
+ roarr: '⇾',
+ robrk: '⟧',
+ ropar: '⦆',
+ ropf: '𝕣',
+ roplus: '⨮',
+ rotimes: '⨵',
+ rpar: ')',
+ rpargt: '⦔',
+ rppolint: '⨒',
+ rrarr: '⇉',
+ rsaquo: '›',
+ rscr: '𝓇',
+ rsh: '↱',
+ rsqb: ']',
+ rsquo: '’',
+ rsquor: '’',
+ rthree: '⋌',
+ rtimes: '⋊',
+ rtri: '▹',
+ rtrie: '⊵',
+ rtrif: '▸',
+ rtriltri: '⧎',
+ ruluhar: '⥨',
+ rx: '℞',
+ sacute: 'ś',
+ sbquo: '‚',
+ sc: '≻',
+ scE: '⪴',
+ scap: '⪸',
+ scaron: 'š',
+ sccue: '≽',
+ sce: '⪰',
+ scedil: 'ş',
+ scirc: 'ŝ',
+ scnE: '⪶',
+ scnap: '⪺',
+ scnsim: '⋩',
+ scpolint: '⨓',
+ scsim: '≿',
+ scy: 'с',
+ sdot: '⋅',
+ sdotb: '⊡',
+ sdote: '⩦',
+ seArr: '⇘',
+ searhk: '⤥',
+ searr: '↘',
+ searrow: '↘',
+ sect: '§',
+ semi: ';',
+ seswar: '⤩',
+ setminus: '∖',
+ setmn: '∖',
+ sext: '✶',
+ sfr: '𝔰',
+ sfrown: '⌢',
+ sharp: '♯',
+ shchcy: 'щ',
+ shcy: 'ш',
+ shortmid: '∣',
+ shortparallel: '∥',
+ shy: '',
+ sigma: 'σ',
+ sigmaf: 'ς',
+ sigmav: 'ς',
+ sim: '∼',
+ simdot: '⩪',
+ sime: '≃',
+ simeq: '≃',
+ simg: '⪞',
+ simgE: '⪠',
+ siml: '⪝',
+ simlE: '⪟',
+ simne: '≆',
+ simplus: '⨤',
+ simrarr: '⥲',
+ slarr: '←',
+ smallsetminus: '∖',
+ smashp: '⨳',
+ smeparsl: '⧤',
+ smid: '∣',
+ smile: '⌣',
+ smt: '⪪',
+ smte: '⪬',
+ smtes: '⪬︀',
+ softcy: 'ь',
+ sol: '/',
+ solb: '⧄',
+ solbar: '⌿',
+ sopf: '𝕤',
+ spades: '♠',
+ spadesuit: '♠',
+ spar: '∥',
+ sqcap: '⊓',
+ sqcaps: '⊓︀',
+ sqcup: '⊔',
+ sqcups: '⊔︀',
+ sqsub: '⊏',
+ sqsube: '⊑',
+ sqsubset: '⊏',
+ sqsubseteq: '⊑',
+ sqsup: '⊐',
+ sqsupe: '⊒',
+ sqsupset: '⊐',
+ sqsupseteq: '⊒',
+ squ: '□',
+ square: '□',
+ squarf: '▪',
+ squf: '▪',
+ srarr: '→',
+ sscr: '𝓈',
+ ssetmn: '∖',
+ ssmile: '⌣',
+ sstarf: '⋆',
+ star: '☆',
+ starf: '★',
+ straightepsilon: 'ϵ',
+ straightphi: 'ϕ',
+ strns: '¯',
+ sub: '⊂',
+ subE: '⫅',
+ subdot: '⪽',
+ sube: '⊆',
+ subedot: '⫃',
+ submult: '⫁',
+ subnE: '⫋',
+ subne: '⊊',
+ subplus: '⪿',
+ subrarr: '⥹',
+ subset: '⊂',
+ subseteq: '⊆',
+ subseteqq: '⫅',
+ subsetneq: '⊊',
+ subsetneqq: '⫋',
+ subsim: '⫇',
+ subsub: '⫕',
+ subsup: '⫓',
+ succ: '≻',
+ succapprox: '⪸',
+ succcurlyeq: '≽',
+ succeq: '⪰',
+ succnapprox: '⪺',
+ succneqq: '⪶',
+ succnsim: '⋩',
+ succsim: '≿',
+ sum: '∑',
+ sung: '♪',
+ sup1: '¹',
+ sup2: '²',
+ sup3: '³',
+ sup: '⊃',
+ supE: '⫆',
+ supdot: '⪾',
+ supdsub: '⫘',
+ supe: '⊇',
+ supedot: '⫄',
+ suphsol: '⟉',
+ suphsub: '⫗',
+ suplarr: '⥻',
+ supmult: '⫂',
+ supnE: '⫌',
+ supne: '⊋',
+ supplus: '⫀',
+ supset: '⊃',
+ supseteq: '⊇',
+ supseteqq: '⫆',
+ supsetneq: '⊋',
+ supsetneqq: '⫌',
+ supsim: '⫈',
+ supsub: '⫔',
+ supsup: '⫖',
+ swArr: '⇙',
+ swarhk: '⤦',
+ swarr: '↙',
+ swarrow: '↙',
+ swnwar: '⤪',
+ szlig: 'ß',
+ target: '⌖',
+ tau: 'τ',
+ tbrk: '⎴',
+ tcaron: 'ť',
+ tcedil: 'ţ',
+ tcy: 'т',
+ tdot: '⃛',
+ telrec: '⌕',
+ tfr: '𝔱',
+ there4: '∴',
+ therefore: '∴',
+ theta: 'θ',
+ thetasym: 'ϑ',
+ thetav: 'ϑ',
+ thickapprox: '≈',
+ thicksim: '∼',
+ thinsp: ' ',
+ thkap: '≈',
+ thksim: '∼',
+ thorn: 'þ',
+ tilde: '˜',
+ times: '×',
+ timesb: '⊠',
+ timesbar: '⨱',
+ timesd: '⨰',
+ tint: '∭',
+ toea: '⤨',
+ top: '⊤',
+ topbot: '⌶',
+ topcir: '⫱',
+ topf: '𝕥',
+ topfork: '⫚',
+ tosa: '⤩',
+ tprime: '‴',
+ trade: '™',
+ triangle: '▵',
+ triangledown: '▿',
+ triangleleft: '◃',
+ trianglelefteq: '⊴',
+ triangleq: '≜',
+ triangleright: '▹',
+ trianglerighteq: '⊵',
+ tridot: '◬',
+ trie: '≜',
+ triminus: '⨺',
+ triplus: '⨹',
+ trisb: '⧍',
+ tritime: '⨻',
+ trpezium: '⏢',
+ tscr: '𝓉',
+ tscy: 'ц',
+ tshcy: 'ћ',
+ tstrok: 'ŧ',
+ twixt: '≬',
+ twoheadleftarrow: '↞',
+ twoheadrightarrow: '↠',
+ uArr: '⇑',
+ uHar: '⥣',
+ uacute: 'ú',
+ uarr: '↑',
+ ubrcy: 'ў',
+ ubreve: 'ŭ',
+ ucirc: 'û',
+ ucy: 'у',
+ udarr: '⇅',
+ udblac: 'ű',
+ udhar: '⥮',
+ ufisht: '⥾',
+ ufr: '𝔲',
+ ugrave: 'ù',
+ uharl: '↿',
+ uharr: '↾',
+ uhblk: '▀',
+ ulcorn: '⌜',
+ ulcorner: '⌜',
+ ulcrop: '⌏',
+ ultri: '◸',
+ umacr: 'ū',
+ uml: '¨',
+ uogon: 'ų',
+ uopf: '𝕦',
+ uparrow: '↑',
+ updownarrow: '↕',
+ upharpoonleft: '↿',
+ upharpoonright: '↾',
+ uplus: '⊎',
+ upsi: 'υ',
+ upsih: 'ϒ',
+ upsilon: 'υ',
+ upuparrows: '⇈',
+ urcorn: '⌝',
+ urcorner: '⌝',
+ urcrop: '⌎',
+ uring: 'ů',
+ urtri: '◹',
+ uscr: '𝓊',
+ utdot: '⋰',
+ utilde: 'ũ',
+ utri: '▵',
+ utrif: '▴',
+ uuarr: '⇈',
+ uuml: 'ü',
+ uwangle: '⦧',
+ vArr: '⇕',
+ vBar: '⫨',
+ vBarv: '⫩',
+ vDash: '⊨',
+ vangrt: '⦜',
+ varepsilon: 'ϵ',
+ varkappa: 'ϰ',
+ varnothing: '∅',
+ varphi: 'ϕ',
+ varpi: 'ϖ',
+ varpropto: '∝',
+ varr: '↕',
+ varrho: 'ϱ',
+ varsigma: 'ς',
+ varsubsetneq: '⊊︀',
+ varsubsetneqq: '⫋︀',
+ varsupsetneq: '⊋︀',
+ varsupsetneqq: '⫌︀',
+ vartheta: 'ϑ',
+ vartriangleleft: '⊲',
+ vartriangleright: '⊳',
+ vcy: 'в',
+ vdash: '⊢',
+ vee: '∨',
+ veebar: '⊻',
+ veeeq: '≚',
+ vellip: '⋮',
+ verbar: '|',
+ vert: '|',
+ vfr: '𝔳',
+ vltri: '⊲',
+ vnsub: '⊂⃒',
+ vnsup: '⊃⃒',
+ vopf: '𝕧',
+ vprop: '∝',
+ vrtri: '⊳',
+ vscr: '𝓋',
+ vsubnE: '⫋︀',
+ vsubne: '⊊︀',
+ vsupnE: '⫌︀',
+ vsupne: '⊋︀',
+ vzigzag: '⦚',
+ wcirc: 'ŵ',
+ wedbar: '⩟',
+ wedge: '∧',
+ wedgeq: '≙',
+ weierp: '℘',
+ wfr: '𝔴',
+ wopf: '𝕨',
+ wp: '℘',
+ wr: '≀',
+ wreath: '≀',
+ wscr: '𝓌',
+ xcap: '⋂',
+ xcirc: '◯',
+ xcup: '⋃',
+ xdtri: '▽',
+ xfr: '𝔵',
+ xhArr: '⟺',
+ xharr: '⟷',
+ xi: 'ξ',
+ xlArr: '⟸',
+ xlarr: '⟵',
+ xmap: '⟼',
+ xnis: '⋻',
+ xodot: '⨀',
+ xopf: '𝕩',
+ xoplus: '⨁',
+ xotime: '⨂',
+ xrArr: '⟹',
+ xrarr: '⟶',
+ xscr: '𝓍',
+ xsqcup: '⨆',
+ xuplus: '⨄',
+ xutri: '△',
+ xvee: '⋁',
+ xwedge: '⋀',
+ yacute: 'ý',
+ yacy: 'я',
+ ycirc: 'ŷ',
+ ycy: 'ы',
+ yen: '¥',
+ yfr: '𝔶',
+ yicy: 'ї',
+ yopf: '𝕪',
+ yscr: '𝓎',
+ yucy: 'ю',
+ yuml: 'ÿ',
+ zacute: 'ź',
+ zcaron: 'ž',
+ zcy: 'з',
+ zdot: 'ż',
+ zeetrf: 'ℨ',
+ zeta: 'ζ',
+ zfr: '𝔷',
+ zhcy: 'ж',
+ zigrarr: '⇝',
+ zopf: '𝕫',
+ zscr: '𝓏',
+ zwj: '',
+ zwnj: ''
+};
+
+const own$1 = {}.hasOwnProperty;
+
+/**
+ * Decode a single character reference (without the `&` or `;`).
+ * You probably only need this when you’re building parsers yourself that follow
+ * different rules compared to HTML.
+ * This is optimized to be tiny in browsers.
+ *
+ * @param {string} value
+ * `notin` (named), `#123` (deci), `#x123` (hexa).
+ * @returns {string|false}
+ * Decoded reference.
+ */
+function decodeNamedCharacterReference(value) {
+ return own$1.call(characterEntities, value) ? characterEntities[value] : false
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const characterReference = {
+ name: 'characterReference',
+ tokenize: tokenizeCharacterReference
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCharacterReference(effects, ok, nok) {
+ const self = this;
+ let size = 0;
+ /** @type {number} */
+ let max;
+ /** @type {(code: Code) => boolean} */
+ let test;
+ return start
+
+ /**
+ * Start of character reference.
+ *
+ * ```markdown
+ * > | a&b
+ * ^
+ * > | a{b
+ * ^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('characterReference');
+ effects.enter('characterReferenceMarker');
+ effects.consume(code);
+ effects.exit('characterReferenceMarker');
+ return open
+ }
+
+ /**
+ * After `&`, at `#` for numeric references or alphanumeric for named
+ * references.
+ *
+ * ```markdown
+ * > | a&b
+ * ^
+ * > | a{b
+ * ^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 35) {
+ effects.enter('characterReferenceMarkerNumeric');
+ effects.consume(code);
+ effects.exit('characterReferenceMarkerNumeric');
+ return numeric
+ }
+ effects.enter('characterReferenceValue');
+ max = 31;
+ test = asciiAlphanumeric;
+ return value(code)
+ }
+
+ /**
+ * After `#`, at `x` for hexadecimals or digit for decimals.
+ *
+ * ```markdown
+ * > | a{b
+ * ^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function numeric(code) {
+ if (code === 88 || code === 120) {
+ effects.enter('characterReferenceMarkerHexadecimal');
+ effects.consume(code);
+ effects.exit('characterReferenceMarkerHexadecimal');
+ effects.enter('characterReferenceValue');
+ max = 6;
+ test = asciiHexDigit;
+ return value
+ }
+ effects.enter('characterReferenceValue');
+ max = 7;
+ test = asciiDigit;
+ return value(code)
+ }
+
+ /**
+ * After markers (``, ``, or `&`), in value, before `;`.
+ *
+ * The character reference kind defines what and how many characters are
+ * allowed.
+ *
+ * ```markdown
+ * > | a&b
+ * ^^^
+ * > | a{b
+ * ^^^
+ * > | a b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function value(code) {
+ if (code === 59 && size) {
+ const token = effects.exit('characterReferenceValue');
+ if (
+ test === asciiAlphanumeric &&
+ !decodeNamedCharacterReference(self.sliceSerialize(token))
+ ) {
+ return nok(code)
+ }
+
+ // To do: `markdown-rs` uses a different name:
+ // `CharacterReferenceMarkerSemi`.
+ effects.enter('characterReferenceMarker');
+ effects.consume(code);
+ effects.exit('characterReferenceMarker');
+ effects.exit('characterReference');
+ return ok
+ }
+ if (test(code) && size++ < max) {
+ effects.consume(code);
+ return value
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const nonLazyContinuation = {
+ tokenize: tokenizeNonLazyContinuation,
+ partial: true
+};
+
+/** @type {Construct} */
+const codeFenced = {
+ name: 'codeFenced',
+ tokenize: tokenizeCodeFenced,
+ concrete: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCodeFenced(effects, ok, nok) {
+ const self = this;
+ /** @type {Construct} */
+ const closeStart = {
+ tokenize: tokenizeCloseStart,
+ partial: true
+ };
+ let initialPrefix = 0;
+ let sizeOpen = 0;
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Start of code.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: parse whitespace like `markdown-rs`.
+ return beforeSequenceOpen(code)
+ }
+
+ /**
+ * In opening fence, after prefix, at sequence.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeSequenceOpen(code) {
+ const tail = self.events[self.events.length - 1];
+ initialPrefix =
+ tail && tail[1].type === 'linePrefix'
+ ? tail[2].sliceSerialize(tail[1], true).length
+ : 0;
+ marker = code;
+ effects.enter('codeFenced');
+ effects.enter('codeFencedFence');
+ effects.enter('codeFencedFenceSequence');
+ return sequenceOpen(code)
+ }
+
+ /**
+ * In opening fence sequence.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceOpen(code) {
+ if (code === marker) {
+ sizeOpen++;
+ effects.consume(code);
+ return sequenceOpen
+ }
+ if (sizeOpen < 3) {
+ return nok(code)
+ }
+ effects.exit('codeFencedFenceSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, infoBefore, 'whitespace')(code)
+ : infoBefore(code)
+ }
+
+ /**
+ * In opening fence, after the sequence (and optional whitespace), before info.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function infoBefore(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFencedFence');
+ return self.interrupt
+ ? ok(code)
+ : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
+ }
+ effects.enter('codeFencedFenceInfo');
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return info(code)
+ }
+
+ /**
+ * In info.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function info(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('chunkString');
+ effects.exit('codeFencedFenceInfo');
+ return infoBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.exit('chunkString');
+ effects.exit('codeFencedFenceInfo');
+ return factorySpace(effects, metaBefore, 'whitespace')(code)
+ }
+ if (code === 96 && code === marker) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return info
+ }
+
+ /**
+ * In opening fence, after info and whitespace, before meta.
+ *
+ * ```markdown
+ * > | ~~~js eval
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function metaBefore(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return infoBefore(code)
+ }
+ effects.enter('codeFencedFenceMeta');
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return meta(code)
+ }
+
+ /**
+ * In meta.
+ *
+ * ```markdown
+ * > | ~~~js eval
+ * ^
+ * | alert(1)
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function meta(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('chunkString');
+ effects.exit('codeFencedFenceMeta');
+ return infoBefore(code)
+ }
+ if (code === 96 && code === marker) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return meta
+ }
+
+ /**
+ * At eol/eof in code, before a non-lazy closing fence or content.
+ *
+ * ```markdown
+ * > | ~~~js
+ * ^
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function atNonLazyBreak(code) {
+ return effects.attempt(closeStart, after, contentBefore)(code)
+ }
+
+ /**
+ * Before code content, not a closing fence, at eol.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function contentBefore(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return contentStart
+ }
+
+ /**
+ * Before code content, not a closing fence.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function contentStart(code) {
+ return initialPrefix > 0 && markdownSpace(code)
+ ? factorySpace(
+ effects,
+ beforeContentChunk,
+ 'linePrefix',
+ initialPrefix + 1
+ )(code)
+ : beforeContentChunk(code)
+ }
+
+ /**
+ * Before code content, after optional prefix.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeContentChunk(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)
+ }
+ effects.enter('codeFlowValue');
+ return contentChunk(code)
+ }
+
+ /**
+ * In code content.
+ *
+ * ```markdown
+ * | ~~~js
+ * > | alert(1)
+ * ^^^^^^^^
+ * | ~~~
+ * ```
+ *
+ * @type {State}
+ */
+ function contentChunk(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFlowValue');
+ return beforeContentChunk(code)
+ }
+ effects.consume(code);
+ return contentChunk
+ }
+
+ /**
+ * After code.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ effects.exit('codeFenced');
+ return ok(code)
+ }
+
+ /**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+ function tokenizeCloseStart(effects, ok, nok) {
+ let size = 0;
+ return startBefore
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function startBefore(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return start
+ }
+
+ /**
+ * Before closing fence, at optional whitespace.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // Always populated by defaults.
+
+ // To do: `enter` here or in next state?
+ effects.enter('codeFencedFence');
+ return markdownSpace(code)
+ ? factorySpace(
+ effects,
+ beforeSequenceClose,
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ : beforeSequenceClose(code)
+ }
+
+ /**
+ * In closing fence, after optional whitespace, at sequence.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeSequenceClose(code) {
+ if (code === marker) {
+ effects.enter('codeFencedFenceSequence');
+ return sequenceClose(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In closing fence sequence.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceClose(code) {
+ if (code === marker) {
+ size++;
+ effects.consume(code);
+ return sequenceClose
+ }
+ if (size >= sizeOpen) {
+ effects.exit('codeFencedFenceSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, sequenceCloseAfter, 'whitespace')(code)
+ : sequenceCloseAfter(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * After closing fence sequence, after optional whitespace.
+ *
+ * ```markdown
+ * | ~~~js
+ * | alert(1)
+ * > | ~~~
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceCloseAfter(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFencedFence');
+ return ok(code)
+ }
+ return nok(code)
+ }
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeNonLazyContinuation(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return lineStart
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function lineStart(code) {
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const codeIndented = {
+ name: 'codeIndented',
+ tokenize: tokenizeCodeIndented
+};
+
+/** @type {Construct} */
+const furtherStart = {
+ tokenize: tokenizeFurtherStart,
+ partial: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCodeIndented(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of code (indented).
+ *
+ * > **Parsing note**: it is not needed to check if this first line is a
+ * > filled line (that it has a non-whitespace character), because blank lines
+ * > are parsed already, so we never run into that.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: manually check if interrupting like `markdown-rs`.
+
+ effects.enter('codeIndented');
+ // To do: use an improved `space_or_tab` function like `markdown-rs`,
+ // so that we can drop the next state.
+ return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)
+ }
+
+ /**
+ * At start, after 1 or 4 spaces.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return tail &&
+ tail[1].type === 'linePrefix' &&
+ tail[2].sliceSerialize(tail[1], true).length >= 4
+ ? atBreak(code)
+ : nok(code)
+ }
+
+ /**
+ * At a break.
+ *
+ * ```markdown
+ * > | aaa
+ * ^ ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === null) {
+ return after(code)
+ }
+ if (markdownLineEnding(code)) {
+ return effects.attempt(furtherStart, atBreak, after)(code)
+ }
+ effects.enter('codeFlowValue');
+ return inside(code)
+ }
+
+ /**
+ * In code content.
+ *
+ * ```markdown
+ * > | aaa
+ * ^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('codeFlowValue');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ return inside
+ }
+
+ /** @type {State} */
+ function after(code) {
+ effects.exit('codeIndented');
+ // To do: allow interrupting like `markdown-rs`.
+ // Feel free to interrupt.
+ // tokenizer.interrupt = false
+ return ok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeFurtherStart(effects, ok, nok) {
+ const self = this;
+ return furtherStart
+
+ /**
+ * At eol, trying to parse another indent.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * | bbb
+ * ```
+ *
+ * @type {State}
+ */
+ function furtherStart(code) {
+ // To do: improve `lazy` / `pierce` handling.
+ // If this is a lazy line, it can’t be code.
+ if (self.parser.lazy[self.now().line]) {
+ return nok(code)
+ }
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return furtherStart
+ }
+
+ // To do: the code here in `micromark-js` is a bit different from
+ // `markdown-rs` because there it can attempt spaces.
+ // We can’t yet.
+ //
+ // To do: use an improved `space_or_tab` function like `markdown-rs`,
+ // so that we can drop the next state.
+ return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)
+ }
+
+ /**
+ * At start, after 1 or 4 spaces.
+ *
+ * ```markdown
+ * > | aaa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return tail &&
+ tail[1].type === 'linePrefix' &&
+ tail[2].sliceSerialize(tail[1], true).length >= 4
+ ? ok(code)
+ : markdownLineEnding(code)
+ ? furtherStart(code)
+ : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Previous} Previous
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const codeText = {
+ name: 'codeText',
+ tokenize: tokenizeCodeText,
+ resolve: resolveCodeText,
+ previous
+};
+
+// To do: next major: don’t resolve, like `markdown-rs`.
+/** @type {Resolver} */
+function resolveCodeText(events) {
+ let tailExitIndex = events.length - 4;
+ let headEnterIndex = 3;
+ /** @type {number} */
+ let index;
+ /** @type {number | undefined} */
+ let enter;
+
+ // If we start and end with an EOL or a space.
+ if (
+ (events[headEnterIndex][1].type === 'lineEnding' ||
+ events[headEnterIndex][1].type === 'space') &&
+ (events[tailExitIndex][1].type === 'lineEnding' ||
+ events[tailExitIndex][1].type === 'space')
+ ) {
+ index = headEnterIndex;
+
+ // And we have data.
+ while (++index < tailExitIndex) {
+ if (events[index][1].type === 'codeTextData') {
+ // Then we have padding.
+ events[headEnterIndex][1].type = 'codeTextPadding';
+ events[tailExitIndex][1].type = 'codeTextPadding';
+ headEnterIndex += 2;
+ tailExitIndex -= 2;
+ break
+ }
+ }
+ }
+
+ // Merge adjacent spaces and data.
+ index = headEnterIndex - 1;
+ tailExitIndex++;
+ while (++index <= tailExitIndex) {
+ if (enter === undefined) {
+ if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') {
+ enter = index;
+ }
+ } else if (
+ index === tailExitIndex ||
+ events[index][1].type === 'lineEnding'
+ ) {
+ events[enter][1].type = 'codeTextData';
+ if (index !== enter + 2) {
+ events[enter][1].end = events[index - 1][1].end;
+ events.splice(enter + 2, index - enter - 2);
+ tailExitIndex -= index - enter - 2;
+ index = enter + 2;
+ }
+ enter = undefined;
+ }
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Previous}
+ */
+function previous(code) {
+ // If there is a previous code, there will always be a tail.
+ return (
+ code !== 96 ||
+ this.events[this.events.length - 1][1].type === 'characterEscape'
+ )
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeCodeText(effects, ok, nok) {
+ let sizeOpen = 0;
+ /** @type {number} */
+ let size;
+ /** @type {Token} */
+ let token;
+ return start
+
+ /**
+ * Start of code (text).
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * > | \`a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('codeText');
+ effects.enter('codeTextSequence');
+ return sequenceOpen(code)
+ }
+
+ /**
+ * In opening sequence.
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceOpen(code) {
+ if (code === 96) {
+ effects.consume(code);
+ sizeOpen++;
+ return sequenceOpen
+ }
+ effects.exit('codeTextSequence');
+ return between(code)
+ }
+
+ /**
+ * Between something and something else.
+ *
+ * ```markdown
+ * > | `a`
+ * ^^
+ * ```
+ *
+ * @type {State}
+ */
+ function between(code) {
+ // EOF.
+ if (code === null) {
+ return nok(code)
+ }
+
+ // To do: next major: don’t do spaces in resolve, but when compiling,
+ // like `markdown-rs`.
+ // Tabs don’t work, and virtual spaces don’t make sense.
+ if (code === 32) {
+ effects.enter('space');
+ effects.consume(code);
+ effects.exit('space');
+ return between
+ }
+
+ // Closing fence? Could also be data.
+ if (code === 96) {
+ token = effects.enter('codeTextSequence');
+ size = 0;
+ return sequenceClose(code)
+ }
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return between
+ }
+
+ // Data.
+ effects.enter('codeTextData');
+ return data(code)
+ }
+
+ /**
+ * In data.
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function data(code) {
+ if (
+ code === null ||
+ code === 32 ||
+ code === 96 ||
+ markdownLineEnding(code)
+ ) {
+ effects.exit('codeTextData');
+ return between(code)
+ }
+ effects.consume(code);
+ return data
+ }
+
+ /**
+ * In closing sequence.
+ *
+ * ```markdown
+ * > | `a`
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceClose(code) {
+ // More.
+ if (code === 96) {
+ effects.consume(code);
+ size++;
+ return sequenceClose
+ }
+
+ // Done!
+ if (size === sizeOpen) {
+ effects.exit('codeTextSequence');
+ effects.exit('codeText');
+ return ok(code)
+ }
+
+ // More or less accents: mark as data.
+ token.type = 'codeTextData';
+ return data(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Chunk} Chunk
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').Token} Token
+ */
+
+/**
+ * Tokenize subcontent.
+ *
+ * @param {Array} events
+ * List of events.
+ * @returns {boolean}
+ * Whether subtokens were found.
+ */
+function subtokenize(events) {
+ /** @type {Record} */
+ const jumps = {};
+ let index = -1;
+ /** @type {Event} */
+ let event;
+ /** @type {number | undefined} */
+ let lineIndex;
+ /** @type {number} */
+ let otherIndex;
+ /** @type {Event} */
+ let otherEvent;
+ /** @type {Array} */
+ let parameters;
+ /** @type {Array} */
+ let subevents;
+ /** @type {boolean | undefined} */
+ let more;
+ while (++index < events.length) {
+ while (index in jumps) {
+ index = jumps[index];
+ }
+ event = events[index];
+
+ // Add a hook for the GFM tasklist extension, which needs to know if text
+ // is in the first content of a list item.
+ if (
+ index &&
+ event[1].type === 'chunkFlow' &&
+ events[index - 1][1].type === 'listItemPrefix'
+ ) {
+ subevents = event[1]._tokenizer.events;
+ otherIndex = 0;
+ if (
+ otherIndex < subevents.length &&
+ subevents[otherIndex][1].type === 'lineEndingBlank'
+ ) {
+ otherIndex += 2;
+ }
+ if (
+ otherIndex < subevents.length &&
+ subevents[otherIndex][1].type === 'content'
+ ) {
+ while (++otherIndex < subevents.length) {
+ if (subevents[otherIndex][1].type === 'content') {
+ break
+ }
+ if (subevents[otherIndex][1].type === 'chunkText') {
+ subevents[otherIndex][1]._isInFirstContentOfListItem = true;
+ otherIndex++;
+ }
+ }
+ }
+ }
+
+ // Enter.
+ if (event[0] === 'enter') {
+ if (event[1].contentType) {
+ Object.assign(jumps, subcontent(events, index));
+ index = jumps[index];
+ more = true;
+ }
+ }
+ // Exit.
+ else if (event[1]._container) {
+ otherIndex = index;
+ lineIndex = undefined;
+ while (otherIndex--) {
+ otherEvent = events[otherIndex];
+ if (
+ otherEvent[1].type === 'lineEnding' ||
+ otherEvent[1].type === 'lineEndingBlank'
+ ) {
+ if (otherEvent[0] === 'enter') {
+ if (lineIndex) {
+ events[lineIndex][1].type = 'lineEndingBlank';
+ }
+ otherEvent[1].type = 'lineEnding';
+ lineIndex = otherIndex;
+ }
+ } else {
+ break
+ }
+ }
+ if (lineIndex) {
+ // Fix position.
+ event[1].end = Object.assign({}, events[lineIndex][1].start);
+
+ // Switch container exit w/ line endings.
+ parameters = events.slice(lineIndex, index);
+ parameters.unshift(event);
+ splice(events, lineIndex, index - lineIndex + 1, parameters);
+ }
+ }
+ }
+ return !more
+}
+
+/**
+ * Tokenize embedded tokens.
+ *
+ * @param {Array} events
+ * @param {number} eventIndex
+ * @returns {Record}
+ */
+function subcontent(events, eventIndex) {
+ const token = events[eventIndex][1];
+ const context = events[eventIndex][2];
+ let startPosition = eventIndex - 1;
+ /** @type {Array} */
+ const startPositions = [];
+ const tokenizer =
+ token._tokenizer || context.parser[token.contentType](token.start);
+ const childEvents = tokenizer.events;
+ /** @type {Array<[number, number]>} */
+ const jumps = [];
+ /** @type {Record} */
+ const gaps = {};
+ /** @type {Array} */
+ let stream;
+ /** @type {Token | undefined} */
+ let previous;
+ let index = -1;
+ /** @type {Token | undefined} */
+ let current = token;
+ let adjust = 0;
+ let start = 0;
+ const breaks = [start];
+
+ // Loop forward through the linked tokens to pass them in order to the
+ // subtokenizer.
+ while (current) {
+ // Find the position of the event for this token.
+ while (events[++startPosition][1] !== current) {
+ // Empty.
+ }
+ startPositions.push(startPosition);
+ if (!current._tokenizer) {
+ stream = context.sliceStream(current);
+ if (!current.next) {
+ stream.push(null);
+ }
+ if (previous) {
+ tokenizer.defineSkip(current.start);
+ }
+ if (current._isInFirstContentOfListItem) {
+ tokenizer._gfmTasklistFirstContentOfListItem = true;
+ }
+ tokenizer.write(stream);
+ if (current._isInFirstContentOfListItem) {
+ tokenizer._gfmTasklistFirstContentOfListItem = undefined;
+ }
+ }
+
+ // Unravel the next token.
+ previous = current;
+ current = current.next;
+ }
+
+ // Now, loop back through all events (and linked tokens), to figure out which
+ // parts belong where.
+ current = token;
+ while (++index < childEvents.length) {
+ if (
+ // Find a void token that includes a break.
+ childEvents[index][0] === 'exit' &&
+ childEvents[index - 1][0] === 'enter' &&
+ childEvents[index][1].type === childEvents[index - 1][1].type &&
+ childEvents[index][1].start.line !== childEvents[index][1].end.line
+ ) {
+ start = index + 1;
+ breaks.push(start);
+ // Help GC.
+ current._tokenizer = undefined;
+ current.previous = undefined;
+ current = current.next;
+ }
+ }
+
+ // Help GC.
+ tokenizer.events = [];
+
+ // If there’s one more token (which is the cases for lines that end in an
+ // EOF), that’s perfect: the last point we found starts it.
+ // If there isn’t then make sure any remaining content is added to it.
+ if (current) {
+ // Help GC.
+ current._tokenizer = undefined;
+ current.previous = undefined;
+ } else {
+ breaks.pop();
+ }
+
+ // Now splice the events from the subtokenizer into the current events,
+ // moving back to front so that splice indices aren’t affected.
+ index = breaks.length;
+ while (index--) {
+ const slice = childEvents.slice(breaks[index], breaks[index + 1]);
+ const start = startPositions.pop();
+ jumps.unshift([start, start + slice.length - 1]);
+ splice(events, start, 2, slice);
+ }
+ index = -1;
+ while (++index < jumps.length) {
+ gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
+ adjust += jumps[index][1] - jumps[index][0] - 1;
+ }
+ return gaps
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/**
+ * No name because it must not be turned off.
+ * @type {Construct}
+ */
+const content = {
+ tokenize: tokenizeContent,
+ resolve: resolveContent
+};
+
+/** @type {Construct} */
+const continuationConstruct = {
+ tokenize: tokenizeContinuation,
+ partial: true
+};
+
+/**
+ * Content is transparent: it’s parsed right now. That way, definitions are also
+ * parsed right now: before text in paragraphs (specifically, media) are parsed.
+ *
+ * @type {Resolver}
+ */
+function resolveContent(events) {
+ subtokenize(events);
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeContent(effects, ok) {
+ /** @type {Token | undefined} */
+ let previous;
+ return chunkStart
+
+ /**
+ * Before a content chunk.
+ *
+ * ```markdown
+ * > | abc
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function chunkStart(code) {
+ effects.enter('content');
+ previous = effects.enter('chunkContent', {
+ contentType: 'content'
+ });
+ return chunkInside(code)
+ }
+
+ /**
+ * In a content chunk.
+ *
+ * ```markdown
+ * > | abc
+ * ^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function chunkInside(code) {
+ if (code === null) {
+ return contentEnd(code)
+ }
+
+ // To do: in `markdown-rs`, each line is parsed on its own, and everything
+ // is stitched together resolving.
+ if (markdownLineEnding(code)) {
+ return effects.check(
+ continuationConstruct,
+ contentContinue,
+ contentEnd
+ )(code)
+ }
+
+ // Data.
+ effects.consume(code);
+ return chunkInside
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function contentEnd(code) {
+ effects.exit('chunkContent');
+ effects.exit('content');
+ return ok(code)
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function contentContinue(code) {
+ effects.consume(code);
+ effects.exit('chunkContent');
+ previous.next = effects.enter('chunkContent', {
+ contentType: 'content',
+ previous
+ });
+ previous = previous.next;
+ return chunkInside
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeContinuation(effects, ok, nok) {
+ const self = this;
+ return startLookahead
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function startLookahead(code) {
+ effects.exit('chunkContent');
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, prefixed, 'linePrefix')
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function prefixed(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return nok(code)
+ }
+
+ // Always populated by defaults.
+
+ const tail = self.events[self.events.length - 1];
+ if (
+ !self.parser.constructs.disable.null.includes('codeIndented') &&
+ tail &&
+ tail[1].type === 'linePrefix' &&
+ tail[2].sliceSerialize(tail[1], true).length >= 4
+ ) {
+ return ok(code)
+ }
+ return effects.interrupt(self.parser.constructs.flow, nok, ok)(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+/**
+ * Parse destinations.
+ *
+ * ###### Examples
+ *
+ * ```markdown
+ *
+ * b>
+ *
+ *
+ * a
+ * a\)b
+ * a(b)c
+ * a(b)
+ * ```
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {State} nok
+ * State switched to when unsuccessful.
+ * @param {TokenType} type
+ * Type for whole (`` or `b`).
+ * @param {TokenType} literalType
+ * Type when enclosed (``).
+ * @param {TokenType} literalMarkerType
+ * Type for enclosing (`<` and `>`).
+ * @param {TokenType} rawType
+ * Type when not enclosed (`b`).
+ * @param {TokenType} stringType
+ * Type for the value (`a` or `b`).
+ * @param {number | undefined} [max=Infinity]
+ * Depth of nested parens (inclusive).
+ * @returns {State}
+ * Start state.
+ */ // eslint-disable-next-line max-params
+function factoryDestination(
+ effects,
+ ok,
+ nok,
+ type,
+ literalType,
+ literalMarkerType,
+ rawType,
+ stringType,
+ max
+) {
+ const limit = max || Number.POSITIVE_INFINITY;
+ let balance = 0;
+ return start
+
+ /**
+ * Start of destination.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > | aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === 60) {
+ effects.enter(type);
+ effects.enter(literalType);
+ effects.enter(literalMarkerType);
+ effects.consume(code);
+ effects.exit(literalMarkerType);
+ return enclosedBefore
+ }
+
+ // ASCII control, space, closing paren.
+ if (code === null || code === 32 || code === 41 || asciiControl(code)) {
+ return nok(code)
+ }
+ effects.enter(type);
+ effects.enter(rawType);
+ effects.enter(stringType);
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return raw(code)
+ }
+
+ /**
+ * After `<`, at an enclosed destination.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function enclosedBefore(code) {
+ if (code === 62) {
+ effects.enter(literalMarkerType);
+ effects.consume(code);
+ effects.exit(literalMarkerType);
+ effects.exit(literalType);
+ effects.exit(type);
+ return ok
+ }
+ effects.enter(stringType);
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return enclosed(code)
+ }
+
+ /**
+ * In enclosed destination.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function enclosed(code) {
+ if (code === 62) {
+ effects.exit('chunkString');
+ effects.exit(stringType);
+ return enclosedBefore(code)
+ }
+ if (code === null || code === 60 || markdownLineEnding(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return code === 92 ? enclosedEscape : enclosed
+ }
+
+ /**
+ * After `\`, at a special character.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function enclosedEscape(code) {
+ if (code === 60 || code === 62 || code === 92) {
+ effects.consume(code);
+ return enclosed
+ }
+ return enclosed(code)
+ }
+
+ /**
+ * In raw destination.
+ *
+ * ```markdown
+ * > | aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function raw(code) {
+ if (
+ !balance &&
+ (code === null || code === 41 || markdownLineEndingOrSpace(code))
+ ) {
+ effects.exit('chunkString');
+ effects.exit(stringType);
+ effects.exit(rawType);
+ effects.exit(type);
+ return ok(code)
+ }
+ if (balance < limit && code === 40) {
+ effects.consume(code);
+ balance++;
+ return raw
+ }
+ if (code === 41) {
+ effects.consume(code);
+ balance--;
+ return raw
+ }
+
+ // ASCII control (but *not* `\0`) and space and `(`.
+ // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it
+ // doesn’t.
+ if (code === null || code === 32 || code === 40 || asciiControl(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return code === 92 ? rawEscape : raw
+ }
+
+ /**
+ * After `\`, at special character.
+ *
+ * ```markdown
+ * > | a\*a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function rawEscape(code) {
+ if (code === 40 || code === 41 || code === 92) {
+ effects.consume(code);
+ return raw
+ }
+ return raw(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+/**
+ * Parse labels.
+ *
+ * > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
+ *
+ * ###### Examples
+ *
+ * ```markdown
+ * [a]
+ * [a
+ * b]
+ * [a\]b]
+ * ```
+ *
+ * @this {TokenizeContext}
+ * Tokenize context.
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {State} nok
+ * State switched to when unsuccessful.
+ * @param {TokenType} type
+ * Type of the whole label (`[a]`).
+ * @param {TokenType} markerType
+ * Type for the markers (`[` and `]`).
+ * @param {TokenType} stringType
+ * Type for the identifier (`a`).
+ * @returns {State}
+ * Start state.
+ */ // eslint-disable-next-line max-params
+function factoryLabel(effects, ok, nok, type, markerType, stringType) {
+ const self = this;
+ let size = 0;
+ /** @type {boolean} */
+ let seen;
+ return start
+
+ /**
+ * Start of label.
+ *
+ * ```markdown
+ * > | [a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter(type);
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ effects.enter(stringType);
+ return atBreak
+ }
+
+ /**
+ * In label, at something, before something else.
+ *
+ * ```markdown
+ * > | [a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (
+ size > 999 ||
+ code === null ||
+ code === 91 ||
+ (code === 93 && !seen) ||
+ // To do: remove in the future once we’ve switched from
+ // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
+ // which doesn’t need this.
+ // Hidden footnotes hook.
+ /* c8 ignore next 3 */
+ (code === 94 &&
+ !size &&
+ '_hiddenFootnoteSupport' in self.parser.constructs)
+ ) {
+ return nok(code)
+ }
+ if (code === 93) {
+ effects.exit(stringType);
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ effects.exit(type);
+ return ok
+ }
+
+ // To do: indent? Link chunks and EOLs together?
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return atBreak
+ }
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return labelInside(code)
+ }
+
+ /**
+ * In label, in text.
+ *
+ * ```markdown
+ * > | [a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelInside(code) {
+ if (
+ code === null ||
+ code === 91 ||
+ code === 93 ||
+ markdownLineEnding(code) ||
+ size++ > 999
+ ) {
+ effects.exit('chunkString');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ if (!seen) seen = !markdownSpace(code);
+ return code === 92 ? labelEscape : labelInside
+ }
+
+ /**
+ * After `\`, at a special character.
+ *
+ * ```markdown
+ * > | [a\*a]
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelEscape(code) {
+ if (code === 91 || code === 92 || code === 93) {
+ effects.consume(code);
+ size++;
+ return labelInside
+ }
+ return labelInside(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ */
+
+/**
+ * Parse titles.
+ *
+ * ###### Examples
+ *
+ * ```markdown
+ * "a"
+ * 'b'
+ * (c)
+ * "a
+ * b"
+ * 'a
+ * b'
+ * (a\)b)
+ * ```
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @param {State} nok
+ * State switched to when unsuccessful.
+ * @param {TokenType} type
+ * Type of the whole title (`"a"`, `'b'`, `(c)`).
+ * @param {TokenType} markerType
+ * Type for the markers (`"`, `'`, `(`, and `)`).
+ * @param {TokenType} stringType
+ * Type for the value (`a`).
+ * @returns {State}
+ * Start state.
+ */ // eslint-disable-next-line max-params
+function factoryTitle(effects, ok, nok, type, markerType, stringType) {
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Start of title.
+ *
+ * ```markdown
+ * > | "a"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (code === 34 || code === 39 || code === 40) {
+ effects.enter(type);
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ marker = code === 40 ? 41 : code;
+ return begin
+ }
+ return nok(code)
+ }
+
+ /**
+ * After opening marker.
+ *
+ * This is also used at the closing marker.
+ *
+ * ```markdown
+ * > | "a"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function begin(code) {
+ if (code === marker) {
+ effects.enter(markerType);
+ effects.consume(code);
+ effects.exit(markerType);
+ effects.exit(type);
+ return ok
+ }
+ effects.enter(stringType);
+ return atBreak(code)
+ }
+
+ /**
+ * At something, before something else.
+ *
+ * ```markdown
+ * > | "a"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === marker) {
+ effects.exit(stringType);
+ return begin(marker)
+ }
+ if (code === null) {
+ return nok(code)
+ }
+
+ // Note: blank lines can’t exist in content.
+ if (markdownLineEnding(code)) {
+ // To do: use `space_or_tab_eol_with_options`, connect.
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, atBreak, 'linePrefix')
+ }
+ effects.enter('chunkString', {
+ contentType: 'string'
+ });
+ return inside(code)
+ }
+
+ /**
+ *
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === marker || code === null || markdownLineEnding(code)) {
+ effects.exit('chunkString');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ return code === 92 ? escape : inside
+ }
+
+ /**
+ * After `\`, at a special character.
+ *
+ * ```markdown
+ * > | "a\*b"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function escape(code) {
+ if (code === marker || code === 92) {
+ effects.consume(code);
+ return inside
+ }
+ return inside(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').State} State
+ */
+
+/**
+ * Parse spaces and tabs.
+ *
+ * There is no `nok` parameter:
+ *
+ * * line endings or spaces in markdown are often optional, in which case this
+ * factory can be used and `ok` will be switched to whether spaces were found
+ * or not
+ * * one line ending or space can be detected with
+ * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
+ *
+ * @param {Effects} effects
+ * Context.
+ * @param {State} ok
+ * State switched to when successful.
+ * @returns
+ * Start state.
+ */
+function factoryWhitespace(effects, ok) {
+ /** @type {boolean} */
+ let seen;
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ seen = true;
+ return start
+ }
+ if (markdownSpace(code)) {
+ return factorySpace(
+ effects,
+ start,
+ seen ? 'linePrefix' : 'lineSuffix'
+ )(code)
+ }
+ return ok(code)
+ }
+}
+
+/**
+ * Normalize an identifier (as found in references, definitions).
+ *
+ * Collapses markdown whitespace, trim, and then lower- and uppercase.
+ *
+ * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their
+ * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different
+ * uppercase character (U+0398 (`Θ`)).
+ * So, to get a canonical form, we perform both lower- and uppercase.
+ *
+ * Using uppercase last makes sure keys will never interact with default
+ * prototypal values (such as `constructor`): nothing in the prototype of
+ * `Object` is uppercase.
+ *
+ * @param {string} value
+ * Identifier to normalize.
+ * @returns {string}
+ * Normalized identifier.
+ */
+function normalizeIdentifier(value) {
+ return (
+ value
+ // Collapse markdown whitespace.
+ .replace(/[\t\n\r ]+/g, ' ')
+ // Trim.
+ .replace(/^ | $/g, '')
+ // Some characters are considered “uppercase”, but if their lowercase
+ // counterpart is uppercased will result in a different uppercase
+ // character.
+ // Hence, to get that form, we perform both lower- and uppercase.
+ // Upper case makes sure keys will not interact with default prototypal
+ // methods: no method is uppercase.
+ .toLowerCase()
+ .toUpperCase()
+ )
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const definition = {
+ name: 'definition',
+ tokenize: tokenizeDefinition
+};
+
+/** @type {Construct} */
+const titleBefore = {
+ tokenize: tokenizeTitleBefore,
+ partial: true
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeDefinition(effects, ok, nok) {
+ const self = this;
+ /** @type {string} */
+ let identifier;
+ return start
+
+ /**
+ * At start of a definition.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // Do not interrupt paragraphs (but do follow definitions).
+ // To do: do `interrupt` the way `markdown-rs` does.
+ // To do: parse whitespace the way `markdown-rs` does.
+ effects.enter('definition');
+ return before(code)
+ }
+
+ /**
+ * After optional whitespace, at `[`.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ // To do: parse whitespace the way `markdown-rs` does.
+
+ return factoryLabel.call(
+ self,
+ effects,
+ labelAfter,
+ // Note: we don’t need to reset the way `markdown-rs` does.
+ nok,
+ 'definitionLabel',
+ 'definitionLabelMarker',
+ 'definitionLabelString'
+ )(code)
+ }
+
+ /**
+ * After label.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelAfter(code) {
+ identifier = normalizeIdentifier(
+ self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
+ );
+ if (code === 58) {
+ effects.enter('definitionMarker');
+ effects.consume(code);
+ effects.exit('definitionMarker');
+ return markerAfter
+ }
+ return nok(code)
+ }
+
+ /**
+ * After marker.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function markerAfter(code) {
+ // Note: whitespace is optional.
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, destinationBefore)(code)
+ : destinationBefore(code)
+ }
+
+ /**
+ * Before destination.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function destinationBefore(code) {
+ return factoryDestination(
+ effects,
+ destinationAfter,
+ // Note: we don’t need to reset the way `markdown-rs` does.
+ nok,
+ 'definitionDestination',
+ 'definitionDestinationLiteral',
+ 'definitionDestinationLiteralMarker',
+ 'definitionDestinationRaw',
+ 'definitionDestinationString'
+ )(code)
+ }
+
+ /**
+ * After destination.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function destinationAfter(code) {
+ return effects.attempt(titleBefore, after, after)(code)
+ }
+
+ /**
+ * After definition.
+ *
+ * ```markdown
+ * > | [a]: b
+ * ^
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ return markdownSpace(code)
+ ? factorySpace(effects, afterWhitespace, 'whitespace')(code)
+ : afterWhitespace(code)
+ }
+
+ /**
+ * After definition, after optional whitespace.
+ *
+ * ```markdown
+ * > | [a]: b
+ * ^
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function afterWhitespace(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('definition');
+
+ // Note: we don’t care about uniqueness.
+ // It’s likely that that doesn’t happen very frequently.
+ // It is more likely that it wastes precious time.
+ self.parser.defined.push(identifier);
+
+ // To do: `markdown-rs` interrupt.
+ // // You’d be interrupting.
+ // tokenizer.interrupt = true
+ return ok(code)
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeTitleBefore(effects, ok, nok) {
+ return titleBefore
+
+ /**
+ * After destination, at whitespace.
+ *
+ * ```markdown
+ * > | [a]: b
+ * ^
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function titleBefore(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, beforeMarker)(code)
+ : nok(code)
+ }
+
+ /**
+ * At title.
+ *
+ * ```markdown
+ * | [a]: b
+ * > | "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function beforeMarker(code) {
+ return factoryTitle(
+ effects,
+ titleAfter,
+ nok,
+ 'definitionTitle',
+ 'definitionTitleMarker',
+ 'definitionTitleString'
+ )(code)
+ }
+
+ /**
+ * After title.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function titleAfter(code) {
+ return markdownSpace(code)
+ ? factorySpace(effects, titleAfterOptionalWhitespace, 'whitespace')(code)
+ : titleAfterOptionalWhitespace(code)
+ }
+
+ /**
+ * After title, after optional whitespace.
+ *
+ * ```markdown
+ * > | [a]: b "c"
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function titleAfterOptionalWhitespace(code) {
+ return code === null || markdownLineEnding(code) ? ok(code) : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const hardBreakEscape = {
+ name: 'hardBreakEscape',
+ tokenize: tokenizeHardBreakEscape
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHardBreakEscape(effects, ok, nok) {
+ return start
+
+ /**
+ * Start of a hard break (escape).
+ *
+ * ```markdown
+ * > | a\
+ * ^
+ * | b
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('hardBreakEscape');
+ effects.consume(code);
+ return after
+ }
+
+ /**
+ * After `\`, at eol.
+ *
+ * ```markdown
+ * > | a\
+ * ^
+ * | b
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ if (markdownLineEnding(code)) {
+ effects.exit('hardBreakEscape');
+ return ok(code)
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const headingAtx = {
+ name: 'headingAtx',
+ tokenize: tokenizeHeadingAtx,
+ resolve: resolveHeadingAtx
+};
+
+/** @type {Resolver} */
+function resolveHeadingAtx(events, context) {
+ let contentEnd = events.length - 2;
+ let contentStart = 3;
+ /** @type {Token} */
+ let content;
+ /** @type {Token} */
+ let text;
+
+ // Prefix whitespace, part of the opening.
+ if (events[contentStart][1].type === 'whitespace') {
+ contentStart += 2;
+ }
+
+ // Suffix whitespace, part of the closing.
+ if (
+ contentEnd - 2 > contentStart &&
+ events[contentEnd][1].type === 'whitespace'
+ ) {
+ contentEnd -= 2;
+ }
+ if (
+ events[contentEnd][1].type === 'atxHeadingSequence' &&
+ (contentStart === contentEnd - 1 ||
+ (contentEnd - 4 > contentStart &&
+ events[contentEnd - 2][1].type === 'whitespace'))
+ ) {
+ contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
+ }
+ if (contentEnd > contentStart) {
+ content = {
+ type: 'atxHeadingText',
+ start: events[contentStart][1].start,
+ end: events[contentEnd][1].end
+ };
+ text = {
+ type: 'chunkText',
+ start: events[contentStart][1].start,
+ end: events[contentEnd][1].end,
+ contentType: 'text'
+ };
+ splice(events, contentStart, contentEnd - contentStart + 1, [
+ ['enter', content, context],
+ ['enter', text, context],
+ ['exit', text, context],
+ ['exit', content, context]
+ ]);
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHeadingAtx(effects, ok, nok) {
+ let size = 0;
+ return start
+
+ /**
+ * Start of a heading (atx).
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: parse indent like `markdown-rs`.
+ effects.enter('atxHeading');
+ return before(code)
+ }
+
+ /**
+ * After optional whitespace, at `#`.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ effects.enter('atxHeadingSequence');
+ return sequenceOpen(code)
+ }
+
+ /**
+ * In opening sequence.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceOpen(code) {
+ if (code === 35 && size++ < 6) {
+ effects.consume(code);
+ return sequenceOpen
+ }
+
+ // Always at least one `#`.
+ if (code === null || markdownLineEndingOrSpace(code)) {
+ effects.exit('atxHeadingSequence');
+ return atBreak(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * After something, before something else.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === 35) {
+ effects.enter('atxHeadingSequence');
+ return sequenceFurther(code)
+ }
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('atxHeading');
+ // To do: interrupt like `markdown-rs`.
+ // // Feel free to interrupt.
+ // tokenizer.interrupt = false
+ return ok(code)
+ }
+ if (markdownSpace(code)) {
+ return factorySpace(effects, atBreak, 'whitespace')(code)
+ }
+
+ // To do: generate `data` tokens, add the `text` token later.
+ // Needs edit map, see: `markdown.rs`.
+ effects.enter('atxHeadingText');
+ return data(code)
+ }
+
+ /**
+ * In further sequence (after whitespace).
+ *
+ * Could be normal “visible” hashes in the heading or a final sequence.
+ *
+ * ```markdown
+ * > | ## aa ##
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequenceFurther(code) {
+ if (code === 35) {
+ effects.consume(code);
+ return sequenceFurther
+ }
+ effects.exit('atxHeadingSequence');
+ return atBreak(code)
+ }
+
+ /**
+ * In text.
+ *
+ * ```markdown
+ * > | ## aa
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function data(code) {
+ if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {
+ effects.exit('atxHeadingText');
+ return atBreak(code)
+ }
+ effects.consume(code);
+ return data
+ }
+}
+
+/**
+ * List of lowercase HTML “block” tag names.
+ *
+ * The list, when parsing HTML (flow), results in more relaxed rules (condition
+ * 6).
+ * Because they are known blocks, the HTML-like syntax doesn’t have to be
+ * strictly parsed.
+ * For tag names not in this list, a more strict algorithm (condition 7) is used
+ * to detect whether the HTML-like syntax is seen as HTML (flow) or not.
+ *
+ * This is copied from:
+ * .
+ *
+ * > 👉 **Note**: `search` was added in `CommonMark@0.31`.
+ */
+const htmlBlockNames = [
+ 'address',
+ 'article',
+ 'aside',
+ 'base',
+ 'basefont',
+ 'blockquote',
+ 'body',
+ 'caption',
+ 'center',
+ 'col',
+ 'colgroup',
+ 'dd',
+ 'details',
+ 'dialog',
+ 'dir',
+ 'div',
+ 'dl',
+ 'dt',
+ 'fieldset',
+ 'figcaption',
+ 'figure',
+ 'footer',
+ 'form',
+ 'frame',
+ 'frameset',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'head',
+ 'header',
+ 'hr',
+ 'html',
+ 'iframe',
+ 'legend',
+ 'li',
+ 'link',
+ 'main',
+ 'menu',
+ 'menuitem',
+ 'nav',
+ 'noframes',
+ 'ol',
+ 'optgroup',
+ 'option',
+ 'p',
+ 'param',
+ 'search',
+ 'section',
+ 'summary',
+ 'table',
+ 'tbody',
+ 'td',
+ 'tfoot',
+ 'th',
+ 'thead',
+ 'title',
+ 'tr',
+ 'track',
+ 'ul'
+];
+
+/**
+ * List of lowercase HTML “raw” tag names.
+ *
+ * The list, when parsing HTML (flow), results in HTML that can include lines
+ * without exiting, until a closing tag also in this list is found (condition
+ * 1).
+ *
+ * This module is copied from:
+ * .
+ *
+ * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.
+ */
+const htmlRawNames = ['pre', 'script', 'style', 'textarea'];
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const htmlFlow = {
+ name: 'htmlFlow',
+ tokenize: tokenizeHtmlFlow,
+ resolveTo: resolveToHtmlFlow,
+ concrete: true
+};
+
+/** @type {Construct} */
+const blankLineBefore = {
+ tokenize: tokenizeBlankLineBefore,
+ partial: true
+};
+const nonLazyContinuationStart = {
+ tokenize: tokenizeNonLazyContinuationStart,
+ partial: true
+};
+
+/** @type {Resolver} */
+function resolveToHtmlFlow(events) {
+ let index = events.length;
+ while (index--) {
+ if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') {
+ break
+ }
+ }
+ if (index > 1 && events[index - 2][1].type === 'linePrefix') {
+ // Add the prefix start to the HTML token.
+ events[index][1].start = events[index - 2][1].start;
+ // Add the prefix start to the HTML line token.
+ events[index + 1][1].start = events[index - 2][1].start;
+ // Remove the line prefix.
+ events.splice(index - 2, 2);
+ }
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHtmlFlow(effects, ok, nok) {
+ const self = this;
+ /** @type {number} */
+ let marker;
+ /** @type {boolean} */
+ let closingTag;
+ /** @type {string} */
+ let buffer;
+ /** @type {number} */
+ let index;
+ /** @type {Code} */
+ let markerB;
+ return start
+
+ /**
+ * Start of HTML (flow).
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // To do: parse indent like `markdown-rs`.
+ return before(code)
+ }
+
+ /**
+ * At `<`, after optional whitespace.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ effects.enter('htmlFlow');
+ effects.enter('htmlFlowData');
+ effects.consume(code);
+ return open
+ }
+
+ /**
+ * After `<`, at tag name or other stuff.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 33) {
+ effects.consume(code);
+ return declarationOpen
+ }
+ if (code === 47) {
+ effects.consume(code);
+ closingTag = true;
+ return tagCloseStart
+ }
+ if (code === 63) {
+ effects.consume(code);
+ marker = 3;
+ // To do:
+ // tokenizer.concrete = true
+ // To do: use `markdown-rs` style interrupt.
+ // While we’re in an instruction instead of a declaration, we’re on a `?`
+ // right now, so we do need to search for `>`, similar to declarations.
+ return self.interrupt ? ok : continuationDeclarationInside
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ // @ts-expect-error: not null.
+ buffer = String.fromCharCode(code);
+ return tagName
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` |
+ * ^
+ * > |
+ * ^
+ * > | &<]]>
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declarationOpen(code) {
+ if (code === 45) {
+ effects.consume(code);
+ marker = 2;
+ return commentOpenInside
+ }
+ if (code === 91) {
+ effects.consume(code);
+ marker = 5;
+ index = 0;
+ return cdataOpenInside
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ marker = 4;
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuationDeclarationInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentOpenInside(code) {
+ if (code === 45) {
+ effects.consume(code);
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuationDeclarationInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` | &<]]>
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataOpenInside(code) {
+ const value = 'CDATA[';
+ if (code === value.charCodeAt(index++)) {
+ effects.consume(code);
+ if (index === value.length) {
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuation
+ }
+ return cdataOpenInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ``, in closing tag, at tag name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseStart(code) {
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ // @ts-expect-error: not null.
+ buffer = String.fromCharCode(code);
+ return tagName
+ }
+ return nok(code)
+ }
+
+ /**
+ * In tag name.
+ *
+ * ```markdown
+ * > |
+ * ^^
+ * > |
+ * ^^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagName(code) {
+ if (
+ code === null ||
+ code === 47 ||
+ code === 62 ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ const slash = code === 47;
+ const name = buffer.toLowerCase();
+ if (!slash && !closingTag && htmlRawNames.includes(name)) {
+ marker = 1;
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok(code) : continuation(code)
+ }
+ if (htmlBlockNames.includes(buffer.toLowerCase())) {
+ marker = 6;
+ if (slash) {
+ effects.consume(code);
+ return basicSelfClosing
+ }
+
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok(code) : continuation(code)
+ }
+ marker = 7;
+ // Do not support complete HTML when interrupting.
+ return self.interrupt && !self.parser.lazy[self.now().line]
+ ? nok(code)
+ : closingTag
+ ? completeClosingTagAfter(code)
+ : completeAttributeNameBefore(code)
+ }
+
+ // ASCII alphanumerical and `-`.
+ if (code === 45 || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ buffer += String.fromCharCode(code);
+ return tagName
+ }
+ return nok(code)
+ }
+
+ /**
+ * After closing slash of a basic tag name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function basicSelfClosing(code) {
+ if (code === 62) {
+ effects.consume(code);
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return self.interrupt ? ok : continuation
+ }
+ return nok(code)
+ }
+
+ /**
+ * After closing slash of a complete tag name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeClosingTagAfter(code) {
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeClosingTagAfter
+ }
+ return completeEnd(code)
+ }
+
+ /**
+ * At an attribute name.
+ *
+ * At first, this state is used after a complete tag name, after whitespace,
+ * where it expects optional attributes or the end of the tag.
+ * It is also reused after attributes, when expecting more optional
+ * attributes.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeNameBefore(code) {
+ if (code === 47) {
+ effects.consume(code);
+ return completeEnd
+ }
+
+ // ASCII alphanumerical and `:` and `_`.
+ if (code === 58 || code === 95 || asciiAlpha(code)) {
+ effects.consume(code);
+ return completeAttributeName
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAttributeNameBefore
+ }
+ return completeEnd(code)
+ }
+
+ /**
+ * In attribute name.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeName(code) {
+ // ASCII alphanumerical and `-`, `.`, `:`, and `_`.
+ if (
+ code === 45 ||
+ code === 46 ||
+ code === 58 ||
+ code === 95 ||
+ asciiAlphanumeric(code)
+ ) {
+ effects.consume(code);
+ return completeAttributeName
+ }
+ return completeAttributeNameAfter(code)
+ }
+
+ /**
+ * After attribute name, at an optional initializer, the end of the tag, or
+ * whitespace.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeNameAfter(code) {
+ if (code === 61) {
+ effects.consume(code);
+ return completeAttributeValueBefore
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAttributeNameAfter
+ }
+ return completeAttributeNameBefore(code)
+ }
+
+ /**
+ * Before unquoted, double quoted, or single quoted attribute value, allowing
+ * whitespace.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueBefore(code) {
+ if (
+ code === null ||
+ code === 60 ||
+ code === 61 ||
+ code === 62 ||
+ code === 96
+ ) {
+ return nok(code)
+ }
+ if (code === 34 || code === 39) {
+ effects.consume(code);
+ markerB = code;
+ return completeAttributeValueQuoted
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAttributeValueBefore
+ }
+ return completeAttributeValueUnquoted(code)
+ }
+
+ /**
+ * In double or single quoted attribute value.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueQuoted(code) {
+ if (code === markerB) {
+ effects.consume(code);
+ markerB = null;
+ return completeAttributeValueQuotedAfter
+ }
+ if (code === null || markdownLineEnding(code)) {
+ return nok(code)
+ }
+ effects.consume(code);
+ return completeAttributeValueQuoted
+ }
+
+ /**
+ * In unquoted attribute value.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueUnquoted(code) {
+ if (
+ code === null ||
+ code === 34 ||
+ code === 39 ||
+ code === 47 ||
+ code === 60 ||
+ code === 61 ||
+ code === 62 ||
+ code === 96 ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ return completeAttributeNameAfter(code)
+ }
+ effects.consume(code);
+ return completeAttributeValueUnquoted
+ }
+
+ /**
+ * After double or single quoted attribute value, before whitespace or the
+ * end of the tag.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAttributeValueQuotedAfter(code) {
+ if (code === 47 || code === 62 || markdownSpace(code)) {
+ return completeAttributeNameBefore(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In certain circumstances of a complete tag where only an `>` is allowed.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeEnd(code) {
+ if (code === 62) {
+ effects.consume(code);
+ return completeAfter
+ }
+ return nok(code)
+ }
+
+ /**
+ * After `>` in a complete tag.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function completeAfter(code) {
+ if (code === null || markdownLineEnding(code)) {
+ // // Do not form containers.
+ // tokenizer.concrete = true
+ return continuation(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return completeAfter
+ }
+ return nok(code)
+ }
+
+ /**
+ * In continuation of any HTML kind.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuation(code) {
+ if (code === 45 && marker === 2) {
+ effects.consume(code);
+ return continuationCommentInside
+ }
+ if (code === 60 && marker === 1) {
+ effects.consume(code);
+ return continuationRawTagOpen
+ }
+ if (code === 62 && marker === 4) {
+ effects.consume(code);
+ return continuationClose
+ }
+ if (code === 63 && marker === 3) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ if (code === 93 && marker === 5) {
+ effects.consume(code);
+ return continuationCdataInside
+ }
+ if (markdownLineEnding(code) && (marker === 6 || marker === 7)) {
+ effects.exit('htmlFlowData');
+ return effects.check(
+ blankLineBefore,
+ continuationAfter,
+ continuationStart
+ )(code)
+ }
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('htmlFlowData');
+ return continuationStart(code)
+ }
+ effects.consume(code);
+ return continuation
+ }
+
+ /**
+ * In continuation, at eol.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * | asd
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationStart(code) {
+ return effects.check(
+ nonLazyContinuationStart,
+ continuationStartNonLazy,
+ continuationAfter
+ )(code)
+ }
+
+ /**
+ * In continuation, at eol, before non-lazy content.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * | asd
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationStartNonLazy(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return continuationBefore
+ }
+
+ /**
+ * In continuation, before non-lazy content.
+ *
+ * ```markdown
+ * |
+ * > | asd
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationBefore(code) {
+ if (code === null || markdownLineEnding(code)) {
+ return continuationStart(code)
+ }
+ effects.enter('htmlFlowData');
+ return continuation(code)
+ }
+
+ /**
+ * In comment continuation, after one `-`, expecting another.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationCommentInside(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In raw continuation, after `<`, at `/`.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationRawTagOpen(code) {
+ if (code === 47) {
+ effects.consume(code);
+ buffer = '';
+ return continuationRawEndTag
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In raw continuation, after ``, in a raw tag name.
+ *
+ * ```markdown
+ * > |
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationRawEndTag(code) {
+ if (code === 62) {
+ const name = buffer.toLowerCase();
+ if (htmlRawNames.includes(name)) {
+ effects.consume(code);
+ return continuationClose
+ }
+ return continuation(code)
+ }
+ if (asciiAlpha(code) && buffer.length < 8) {
+ effects.consume(code);
+ // @ts-expect-error: not null.
+ buffer += String.fromCharCode(code);
+ return continuationRawEndTag
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In cdata continuation, after `]`, expecting `]>`.
+ *
+ * ```markdown
+ * > | &<]]>
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationCdataInside(code) {
+ if (code === 93) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In declaration or instruction continuation, at `>`.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * > | >
+ * ^
+ * > |
+ * ^
+ * > |
+ * ^
+ * > | &<]]>
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationDeclarationInside(code) {
+ if (code === 62) {
+ effects.consume(code);
+ return continuationClose
+ }
+
+ // More dashes.
+ if (code === 45 && marker === 2) {
+ effects.consume(code);
+ return continuationDeclarationInside
+ }
+ return continuation(code)
+ }
+
+ /**
+ * In closed continuation: everything we get until the eol/eof is part of it.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationClose(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('htmlFlowData');
+ return continuationAfter(code)
+ }
+ effects.consume(code);
+ return continuationClose
+ }
+
+ /**
+ * Done.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function continuationAfter(code) {
+ effects.exit('htmlFlow');
+ // // Feel free to interrupt.
+ // tokenizer.interrupt = false
+ // // No longer concrete.
+ // tokenizer.concrete = false
+ return ok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeNonLazyContinuationStart(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * At eol, before continuation.
+ *
+ * ```markdown
+ * > | * ```js
+ * ^
+ * | b
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ if (markdownLineEnding(code)) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return after
+ }
+ return nok(code)
+ }
+
+ /**
+ * A continuation.
+ *
+ * ```markdown
+ * | * ```js
+ * > | b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeBlankLineBefore(effects, ok, nok) {
+ return start
+
+ /**
+ * Before eol, expecting blank line.
+ *
+ * ```markdown
+ * > |
+ * ^
+ * |
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return effects.attempt(blankLine, ok, nok)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const htmlText = {
+ name: 'htmlText',
+ tokenize: tokenizeHtmlText
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeHtmlText(effects, ok, nok) {
+ const self = this;
+ /** @type {NonNullable | undefined} */
+ let marker;
+ /** @type {number} */
+ let index;
+ /** @type {State} */
+ let returnState;
+ return start
+
+ /**
+ * Start of HTML (text).
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('htmlText');
+ effects.enter('htmlTextData');
+ effects.consume(code);
+ return open
+ }
+
+ /**
+ * After `<`, at tag name or other stuff.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * > | a c
+ * ^
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 33) {
+ effects.consume(code);
+ return declarationOpen
+ }
+ if (code === 47) {
+ effects.consume(code);
+ return tagCloseStart
+ }
+ if (code === 63) {
+ effects.consume(code);
+ return instruction
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return tagOpen
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * > | a c
+ * ^
+ * > | a &<]]> c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declarationOpen(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return commentOpenInside
+ }
+ if (code === 91) {
+ effects.consume(code);
+ index = 0;
+ return cdataOpenInside
+ }
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return declaration
+ }
+ return nok(code)
+ }
+
+ /**
+ * In a comment, after ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentOpenInside(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return commentEnd
+ }
+ return nok(code)
+ }
+
+ /**
+ * In comment.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function comment(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ if (code === 45) {
+ effects.consume(code);
+ return commentClose
+ }
+ if (markdownLineEnding(code)) {
+ returnState = comment;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return comment
+ }
+
+ /**
+ * In comment, after `-`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentClose(code) {
+ if (code === 45) {
+ effects.consume(code);
+ return commentEnd
+ }
+ return comment(code)
+ }
+
+ /**
+ * In comment, after `--`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentEnd(code) {
+ return code === 62
+ ? end(code)
+ : code === 45
+ ? commentClose(code)
+ : comment(code)
+ }
+
+ /**
+ * After ` | a &<]]> b
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataOpenInside(code) {
+ const value = 'CDATA[';
+ if (code === value.charCodeAt(index++)) {
+ effects.consume(code);
+ return index === value.length ? cdata : cdataOpenInside
+ }
+ return nok(code)
+ }
+
+ /**
+ * In CDATA.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdata(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ if (code === 93) {
+ effects.consume(code);
+ return cdataClose
+ }
+ if (markdownLineEnding(code)) {
+ returnState = cdata;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return cdata
+ }
+
+ /**
+ * In CDATA, after `]`, at another `]`.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataClose(code) {
+ if (code === 93) {
+ effects.consume(code);
+ return cdataEnd
+ }
+ return cdata(code)
+ }
+
+ /**
+ * In CDATA, after `]]`, at `>`.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataEnd(code) {
+ if (code === 62) {
+ return end(code)
+ }
+ if (code === 93) {
+ effects.consume(code);
+ return cdataEnd
+ }
+ return cdata(code)
+ }
+
+ /**
+ * In declaration.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declaration(code) {
+ if (code === null || code === 62) {
+ return end(code)
+ }
+ if (markdownLineEnding(code)) {
+ returnState = declaration;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return declaration
+ }
+
+ /**
+ * In instruction.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function instruction(code) {
+ if (code === null) {
+ return nok(code)
+ }
+ if (code === 63) {
+ effects.consume(code);
+ return instructionClose
+ }
+ if (markdownLineEnding(code)) {
+ returnState = instruction;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return instruction
+ }
+
+ /**
+ * In instruction, after `?`, at `>`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function instructionClose(code) {
+ return code === 62 ? end(code) : instruction(code)
+ }
+
+ /**
+ * After ``, in closing tag, at tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseStart(code) {
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return tagClose
+ }
+ return nok(code)
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagClose(code) {
+ // ASCII alphanumerical and `-`.
+ if (code === 45 || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ return tagClose
+ }
+ return tagCloseBetween(code)
+ }
+
+ /**
+ * In closing tag, after tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseBetween(code) {
+ if (markdownLineEnding(code)) {
+ returnState = tagCloseBetween;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagCloseBetween
+ }
+ return end(code)
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpen(code) {
+ // ASCII alphanumerical and `-`.
+ if (code === 45 || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ return tagOpen
+ }
+ if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
+ return tagOpenBetween(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In opening tag, after tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenBetween(code) {
+ if (code === 47) {
+ effects.consume(code);
+ return end
+ }
+
+ // ASCII alphabetical and `:` and `_`.
+ if (code === 58 || code === 95 || asciiAlpha(code)) {
+ effects.consume(code);
+ return tagOpenAttributeName
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenBetween;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenBetween
+ }
+ return end(code)
+ }
+
+ /**
+ * In attribute name.
+ *
+ * ```markdown
+ * > | a d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeName(code) {
+ // ASCII alphabetical and `-`, `.`, `:`, and `_`.
+ if (
+ code === 45 ||
+ code === 46 ||
+ code === 58 ||
+ code === 95 ||
+ asciiAlphanumeric(code)
+ ) {
+ effects.consume(code);
+ return tagOpenAttributeName
+ }
+ return tagOpenAttributeNameAfter(code)
+ }
+
+ /**
+ * After attribute name, before initializer, the end of the tag, or
+ * whitespace.
+ *
+ * ```markdown
+ * > | a d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeNameAfter(code) {
+ if (code === 61) {
+ effects.consume(code);
+ return tagOpenAttributeValueBefore
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeNameAfter;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenAttributeNameAfter
+ }
+ return tagOpenBetween(code)
+ }
+
+ /**
+ * Before unquoted, double quoted, or single quoted attribute value, allowing
+ * whitespace.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueBefore(code) {
+ if (
+ code === null ||
+ code === 60 ||
+ code === 61 ||
+ code === 62 ||
+ code === 96
+ ) {
+ return nok(code)
+ }
+ if (code === 34 || code === 39) {
+ effects.consume(code);
+ marker = code;
+ return tagOpenAttributeValueQuoted
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeValueBefore;
+ return lineEndingBefore(code)
+ }
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenAttributeValueBefore
+ }
+ effects.consume(code);
+ return tagOpenAttributeValueUnquoted
+ }
+
+ /**
+ * In double or single quoted attribute value.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueQuoted(code) {
+ if (code === marker) {
+ effects.consume(code);
+ marker = undefined;
+ return tagOpenAttributeValueQuotedAfter
+ }
+ if (code === null) {
+ return nok(code)
+ }
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeValueQuoted;
+ return lineEndingBefore(code)
+ }
+ effects.consume(code);
+ return tagOpenAttributeValueQuoted
+ }
+
+ /**
+ * In unquoted attribute value.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueUnquoted(code) {
+ if (
+ code === null ||
+ code === 34 ||
+ code === 39 ||
+ code === 60 ||
+ code === 61 ||
+ code === 96
+ ) {
+ return nok(code)
+ }
+ if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
+ return tagOpenBetween(code)
+ }
+ effects.consume(code);
+ return tagOpenAttributeValueUnquoted
+ }
+
+ /**
+ * After double or single quoted attribute value, before whitespace or the end
+ * of the tag.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueQuotedAfter(code) {
+ if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
+ return tagOpenBetween(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In certain circumstances of a tag where only an `>` is allowed.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function end(code) {
+ if (code === 62) {
+ effects.consume(code);
+ effects.exit('htmlTextData');
+ effects.exit('htmlText');
+ return ok
+ }
+ return nok(code)
+ }
+
+ /**
+ * At eol.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * > | a
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingBefore(code) {
+ effects.exit('htmlTextData');
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return lineEndingAfter
+ }
+
+ /**
+ * After eol, at optional whitespace.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * | a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingAfter(code) {
+ // Always populated by defaults.
+
+ return markdownSpace(code)
+ ? factorySpace(
+ effects,
+ lineEndingAfterPrefix,
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ : lineEndingAfterPrefix(code)
+ }
+
+ /**
+ * After eol, after optional whitespace.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * | a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingAfterPrefix(code) {
+ effects.enter('htmlTextData');
+ return returnState(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const labelEnd = {
+ name: 'labelEnd',
+ tokenize: tokenizeLabelEnd,
+ resolveTo: resolveToLabelEnd,
+ resolveAll: resolveAllLabelEnd
+};
+
+/** @type {Construct} */
+const resourceConstruct = {
+ tokenize: tokenizeResource
+};
+/** @type {Construct} */
+const referenceFullConstruct = {
+ tokenize: tokenizeReferenceFull
+};
+/** @type {Construct} */
+const referenceCollapsedConstruct = {
+ tokenize: tokenizeReferenceCollapsed
+};
+
+/** @type {Resolver} */
+function resolveAllLabelEnd(events) {
+ let index = -1;
+ while (++index < events.length) {
+ const token = events[index][1];
+ if (
+ token.type === 'labelImage' ||
+ token.type === 'labelLink' ||
+ token.type === 'labelEnd'
+ ) {
+ // Remove the marker.
+ events.splice(index + 1, token.type === 'labelImage' ? 4 : 2);
+ token.type = 'data';
+ index++;
+ }
+ }
+ return events
+}
+
+/** @type {Resolver} */
+function resolveToLabelEnd(events, context) {
+ let index = events.length;
+ let offset = 0;
+ /** @type {Token} */
+ let token;
+ /** @type {number | undefined} */
+ let open;
+ /** @type {number | undefined} */
+ let close;
+ /** @type {Array} */
+ let media;
+
+ // Find an opening.
+ while (index--) {
+ token = events[index][1];
+ if (open) {
+ // If we see another link, or inactive link label, we’ve been here before.
+ if (
+ token.type === 'link' ||
+ (token.type === 'labelLink' && token._inactive)
+ ) {
+ break
+ }
+
+ // Mark other link openings as inactive, as we can’t have links in
+ // links.
+ if (events[index][0] === 'enter' && token.type === 'labelLink') {
+ token._inactive = true;
+ }
+ } else if (close) {
+ if (
+ events[index][0] === 'enter' &&
+ (token.type === 'labelImage' || token.type === 'labelLink') &&
+ !token._balanced
+ ) {
+ open = index;
+ if (token.type !== 'labelLink') {
+ offset = 2;
+ break
+ }
+ }
+ } else if (token.type === 'labelEnd') {
+ close = index;
+ }
+ }
+ const group = {
+ type: events[open][1].type === 'labelLink' ? 'link' : 'image',
+ start: Object.assign({}, events[open][1].start),
+ end: Object.assign({}, events[events.length - 1][1].end)
+ };
+ const label = {
+ type: 'label',
+ start: Object.assign({}, events[open][1].start),
+ end: Object.assign({}, events[close][1].end)
+ };
+ const text = {
+ type: 'labelText',
+ start: Object.assign({}, events[open + offset + 2][1].end),
+ end: Object.assign({}, events[close - 2][1].start)
+ };
+ media = [
+ ['enter', group, context],
+ ['enter', label, context]
+ ];
+
+ // Opening marker.
+ media = push(media, events.slice(open + 1, open + offset + 3));
+
+ // Text open.
+ media = push(media, [['enter', text, context]]);
+
+ // Always populated by defaults.
+
+ // Between.
+ media = push(
+ media,
+ resolveAll(
+ context.parser.constructs.insideSpan.null,
+ events.slice(open + offset + 4, close - 3),
+ context
+ )
+ );
+
+ // Text close, marker close, label close.
+ media = push(media, [
+ ['exit', text, context],
+ events[close - 2],
+ events[close - 1],
+ ['exit', label, context]
+ ]);
+
+ // Reference, resource, or so.
+ media = push(media, events.slice(close + 1));
+
+ // Media close.
+ media = push(media, [['exit', group, context]]);
+ splice(events, open, events.length, media);
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLabelEnd(effects, ok, nok) {
+ const self = this;
+ let index = self.events.length;
+ /** @type {Token} */
+ let labelStart;
+ /** @type {boolean} */
+ let defined;
+
+ // Find an opening.
+ while (index--) {
+ if (
+ (self.events[index][1].type === 'labelImage' ||
+ self.events[index][1].type === 'labelLink') &&
+ !self.events[index][1]._balanced
+ ) {
+ labelStart = self.events[index][1];
+ break
+ }
+ }
+ return start
+
+ /**
+ * Start of label end.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * > | [a][b] c
+ * ^
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ // If there is not an okay opening.
+ if (!labelStart) {
+ return nok(code)
+ }
+
+ // If the corresponding label (link) start is marked as inactive,
+ // it means we’d be wrapping a link, like this:
+ //
+ // ```markdown
+ // > | a [b [c](d) e](f) g.
+ // ^
+ // ```
+ //
+ // We can’t have that, so it’s just balanced brackets.
+ if (labelStart._inactive) {
+ return labelEndNok(code)
+ }
+ defined = self.parser.defined.includes(
+ normalizeIdentifier(
+ self.sliceSerialize({
+ start: labelStart.end,
+ end: self.now()
+ })
+ )
+ );
+ effects.enter('labelEnd');
+ effects.enter('labelMarker');
+ effects.consume(code);
+ effects.exit('labelMarker');
+ effects.exit('labelEnd');
+ return after
+ }
+
+ /**
+ * After `]`.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * > | [a][b] c
+ * ^
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ // Note: `markdown-rs` also parses GFM footnotes here, which for us is in
+ // an extension.
+
+ // Resource (`[asd](fgh)`)?
+ if (code === 40) {
+ return effects.attempt(
+ resourceConstruct,
+ labelEndOk,
+ defined ? labelEndOk : labelEndNok
+ )(code)
+ }
+
+ // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?
+ if (code === 91) {
+ return effects.attempt(
+ referenceFullConstruct,
+ labelEndOk,
+ defined ? referenceNotFull : labelEndNok
+ )(code)
+ }
+
+ // Shortcut (`[asd]`) reference?
+ return defined ? labelEndOk(code) : labelEndNok(code)
+ }
+
+ /**
+ * After `]`, at `[`, but not at a full reference.
+ *
+ * > 👉 **Note**: we only get here if the label is defined.
+ *
+ * ```markdown
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceNotFull(code) {
+ return effects.attempt(
+ referenceCollapsedConstruct,
+ labelEndOk,
+ labelEndNok
+ )(code)
+ }
+
+ /**
+ * Done, we found something.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * > | [a][b] c
+ * ^
+ * > | [a][] b
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelEndOk(code) {
+ // Note: `markdown-rs` does a bunch of stuff here.
+ return ok(code)
+ }
+
+ /**
+ * Done, it’s nothing.
+ *
+ * There was an okay opening, but we didn’t match anything.
+ *
+ * ```markdown
+ * > | [a](b c
+ * ^
+ * > | [a][b c
+ * ^
+ * > | [a] b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function labelEndNok(code) {
+ labelStart._balanced = true;
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeResource(effects, ok, nok) {
+ return resourceStart
+
+ /**
+ * At a resource.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceStart(code) {
+ effects.enter('resource');
+ effects.enter('resourceMarker');
+ effects.consume(code);
+ effects.exit('resourceMarker');
+ return resourceBefore
+ }
+
+ /**
+ * In resource, after `(`, at optional whitespace.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceBefore(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, resourceOpen)(code)
+ : resourceOpen(code)
+ }
+
+ /**
+ * In resource, after optional whitespace, at `)` or a destination.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceOpen(code) {
+ if (code === 41) {
+ return resourceEnd(code)
+ }
+ return factoryDestination(
+ effects,
+ resourceDestinationAfter,
+ resourceDestinationMissing,
+ 'resourceDestination',
+ 'resourceDestinationLiteral',
+ 'resourceDestinationLiteralMarker',
+ 'resourceDestinationRaw',
+ 'resourceDestinationString',
+ 32
+ )(code)
+ }
+
+ /**
+ * In resource, after destination, at optional whitespace.
+ *
+ * ```markdown
+ * > | [a](b) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceDestinationAfter(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, resourceBetween)(code)
+ : resourceEnd(code)
+ }
+
+ /**
+ * At invalid destination.
+ *
+ * ```markdown
+ * > | [a](<<) b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceDestinationMissing(code) {
+ return nok(code)
+ }
+
+ /**
+ * In resource, after destination and whitespace, at `(` or title.
+ *
+ * ```markdown
+ * > | [a](b ) c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceBetween(code) {
+ if (code === 34 || code === 39 || code === 40) {
+ return factoryTitle(
+ effects,
+ resourceTitleAfter,
+ nok,
+ 'resourceTitle',
+ 'resourceTitleMarker',
+ 'resourceTitleString'
+ )(code)
+ }
+ return resourceEnd(code)
+ }
+
+ /**
+ * In resource, after title, at optional whitespace.
+ *
+ * ```markdown
+ * > | [a](b "c") d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceTitleAfter(code) {
+ return markdownLineEndingOrSpace(code)
+ ? factoryWhitespace(effects, resourceEnd)(code)
+ : resourceEnd(code)
+ }
+
+ /**
+ * In resource, at `)`.
+ *
+ * ```markdown
+ * > | [a](b) d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function resourceEnd(code) {
+ if (code === 41) {
+ effects.enter('resourceMarker');
+ effects.consume(code);
+ effects.exit('resourceMarker');
+ effects.exit('resource');
+ return ok
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeReferenceFull(effects, ok, nok) {
+ const self = this;
+ return referenceFull
+
+ /**
+ * In a reference (full), at the `[`.
+ *
+ * ```markdown
+ * > | [a][b] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceFull(code) {
+ return factoryLabel.call(
+ self,
+ effects,
+ referenceFullAfter,
+ referenceFullMissing,
+ 'reference',
+ 'referenceMarker',
+ 'referenceString'
+ )(code)
+ }
+
+ /**
+ * In a reference (full), after `]`.
+ *
+ * ```markdown
+ * > | [a][b] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceFullAfter(code) {
+ return self.parser.defined.includes(
+ normalizeIdentifier(
+ self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
+ )
+ )
+ ? ok(code)
+ : nok(code)
+ }
+
+ /**
+ * In reference (full) that was missing.
+ *
+ * ```markdown
+ * > | [a][b d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceFullMissing(code) {
+ return nok(code)
+ }
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeReferenceCollapsed(effects, ok, nok) {
+ return referenceCollapsedStart
+
+ /**
+ * In reference (collapsed), at `[`.
+ *
+ * > 👉 **Note**: we only get here if the label is defined.
+ *
+ * ```markdown
+ * > | [a][] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceCollapsedStart(code) {
+ // We only attempt a collapsed label if there’s a `[`.
+
+ effects.enter('reference');
+ effects.enter('referenceMarker');
+ effects.consume(code);
+ effects.exit('referenceMarker');
+ return referenceCollapsedOpen
+ }
+
+ /**
+ * In reference (collapsed), at `]`.
+ *
+ * > 👉 **Note**: we only get here if the label is defined.
+ *
+ * ```markdown
+ * > | [a][] d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function referenceCollapsedOpen(code) {
+ if (code === 93) {
+ effects.enter('referenceMarker');
+ effects.consume(code);
+ effects.exit('referenceMarker');
+ effects.exit('reference');
+ return ok
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const labelStartImage = {
+ name: 'labelStartImage',
+ tokenize: tokenizeLabelStartImage,
+ resolveAll: labelEnd.resolveAll
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLabelStartImage(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of label (image) start.
+ *
+ * ```markdown
+ * > | a ![b] c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('labelImage');
+ effects.enter('labelImageMarker');
+ effects.consume(code);
+ effects.exit('labelImageMarker');
+ return open
+ }
+
+ /**
+ * After `!`, at `[`.
+ *
+ * ```markdown
+ * > | a ![b] c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === 91) {
+ effects.enter('labelMarker');
+ effects.consume(code);
+ effects.exit('labelMarker');
+ effects.exit('labelImage');
+ return after
+ }
+ return nok(code)
+ }
+
+ /**
+ * After `![`.
+ *
+ * ```markdown
+ * > | a ![b] c
+ * ^
+ * ```
+ *
+ * This is needed in because, when GFM footnotes are enabled, images never
+ * form when started with a `^`.
+ * Instead, links form:
+ *
+ * ```markdown
+ * ![^a](b)
+ *
+ * ![^a][b]
+ *
+ * [b]: c
+ * ```
+ *
+ * ```html
+ * !^a
+ * !^a
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ // To do: use a new field to do this, this is still needed for
+ // `micromark-extension-gfm-footnote`, but the `label-start-link`
+ // behavior isn’t.
+ // Hidden footnotes hook.
+ /* c8 ignore next 3 */
+ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
+ ? nok(code)
+ : ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const labelStartLink = {
+ name: 'labelStartLink',
+ tokenize: tokenizeLabelStartLink,
+ resolveAll: labelEnd.resolveAll
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLabelStartLink(effects, ok, nok) {
+ const self = this;
+ return start
+
+ /**
+ * Start of label (link) start.
+ *
+ * ```markdown
+ * > | a [b] c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('labelLink');
+ effects.enter('labelMarker');
+ effects.consume(code);
+ effects.exit('labelMarker');
+ effects.exit('labelLink');
+ return after
+ }
+
+ /** @type {State} */
+ function after(code) {
+ // To do: this isn’t needed in `micromark-extension-gfm-footnote`,
+ // remove.
+ // Hidden footnotes hook.
+ /* c8 ignore next 3 */
+ return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs
+ ? nok(code)
+ : ok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const lineEnding = {
+ name: 'lineEnding',
+ tokenize: tokenizeLineEnding
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeLineEnding(effects, ok) {
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ return factorySpace(effects, ok, 'linePrefix')
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const thematicBreak = {
+ name: 'thematicBreak',
+ tokenize: tokenizeThematicBreak
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeThematicBreak(effects, ok, nok) {
+ let size = 0;
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * Start of thematic break.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ effects.enter('thematicBreak');
+ // To do: parse indent like `markdown-rs`.
+ return before(code)
+ }
+
+ /**
+ * After optional whitespace, at marker.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ marker = code;
+ return atBreak(code)
+ }
+
+ /**
+ * After something, before something else.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function atBreak(code) {
+ if (code === marker) {
+ effects.enter('thematicBreakSequence');
+ return sequence(code)
+ }
+ if (size >= 3 && (code === null || markdownLineEnding(code))) {
+ effects.exit('thematicBreak');
+ return ok(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * In sequence.
+ *
+ * ```markdown
+ * > | ***
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function sequence(code) {
+ if (code === marker) {
+ effects.consume(code);
+ size++;
+ return sequence
+ }
+ effects.exit('thematicBreakSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, atBreak, 'whitespace')(code)
+ : atBreak(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').ContainerState} ContainerState
+ * @typedef {import('micromark-util-types').Exiter} Exiter
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+
+/** @type {Construct} */
+const list = {
+ name: 'list',
+ tokenize: tokenizeListStart,
+ continuation: {
+ tokenize: tokenizeListContinuation
+ },
+ exit: tokenizeListEnd
+};
+
+/** @type {Construct} */
+const listItemPrefixWhitespaceConstruct = {
+ tokenize: tokenizeListItemPrefixWhitespace,
+ partial: true
+};
+
+/** @type {Construct} */
+const indentConstruct = {
+ tokenize: tokenizeIndent,
+ partial: true
+};
+
+// To do: `markdown-rs` parses list items on their own and later stitches them
+// together.
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeListStart(effects, ok, nok) {
+ const self = this;
+ const tail = self.events[self.events.length - 1];
+ let initialSize =
+ tail && tail[1].type === 'linePrefix'
+ ? tail[2].sliceSerialize(tail[1], true).length
+ : 0;
+ let size = 0;
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ const kind =
+ self.containerState.type ||
+ (code === 42 || code === 43 || code === 45
+ ? 'listUnordered'
+ : 'listOrdered');
+ if (
+ kind === 'listUnordered'
+ ? !self.containerState.marker || code === self.containerState.marker
+ : asciiDigit(code)
+ ) {
+ if (!self.containerState.type) {
+ self.containerState.type = kind;
+ effects.enter(kind, {
+ _container: true
+ });
+ }
+ if (kind === 'listUnordered') {
+ effects.enter('listItemPrefix');
+ return code === 42 || code === 45
+ ? effects.check(thematicBreak, nok, atMarker)(code)
+ : atMarker(code)
+ }
+ if (!self.interrupt || code === 49) {
+ effects.enter('listItemPrefix');
+ effects.enter('listItemValue');
+ return inside(code)
+ }
+ }
+ return nok(code)
+ }
+
+ /** @type {State} */
+ function inside(code) {
+ if (asciiDigit(code) && ++size < 10) {
+ effects.consume(code);
+ return inside
+ }
+ if (
+ (!self.interrupt || size < 2) &&
+ (self.containerState.marker
+ ? code === self.containerState.marker
+ : code === 41 || code === 46)
+ ) {
+ effects.exit('listItemValue');
+ return atMarker(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * @type {State}
+ **/
+ function atMarker(code) {
+ effects.enter('listItemMarker');
+ effects.consume(code);
+ effects.exit('listItemMarker');
+ self.containerState.marker = self.containerState.marker || code;
+ return effects.check(
+ blankLine,
+ // Can’t be empty when interrupting.
+ self.interrupt ? nok : onBlank,
+ effects.attempt(
+ listItemPrefixWhitespaceConstruct,
+ endOfPrefix,
+ otherPrefix
+ )
+ )
+ }
+
+ /** @type {State} */
+ function onBlank(code) {
+ self.containerState.initialBlankLine = true;
+ initialSize++;
+ return endOfPrefix(code)
+ }
+
+ /** @type {State} */
+ function otherPrefix(code) {
+ if (markdownSpace(code)) {
+ effects.enter('listItemPrefixWhitespace');
+ effects.consume(code);
+ effects.exit('listItemPrefixWhitespace');
+ return endOfPrefix
+ }
+ return nok(code)
+ }
+
+ /** @type {State} */
+ function endOfPrefix(code) {
+ self.containerState.size =
+ initialSize +
+ self.sliceSerialize(effects.exit('listItemPrefix'), true).length;
+ return ok(code)
+ }
+}
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeListContinuation(effects, ok, nok) {
+ const self = this;
+ self.containerState._closeFlow = undefined;
+ return effects.check(blankLine, onBlank, notBlank)
+
+ /** @type {State} */
+ function onBlank(code) {
+ self.containerState.furtherBlankLines =
+ self.containerState.furtherBlankLines ||
+ self.containerState.initialBlankLine;
+
+ // We have a blank line.
+ // Still, try to consume at most the items size.
+ return factorySpace(
+ effects,
+ ok,
+ 'listItemIndent',
+ self.containerState.size + 1
+ )(code)
+ }
+
+ /** @type {State} */
+ function notBlank(code) {
+ if (self.containerState.furtherBlankLines || !markdownSpace(code)) {
+ self.containerState.furtherBlankLines = undefined;
+ self.containerState.initialBlankLine = undefined;
+ return notInCurrentItem(code)
+ }
+ self.containerState.furtherBlankLines = undefined;
+ self.containerState.initialBlankLine = undefined;
+ return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)
+ }
+
+ /** @type {State} */
+ function notInCurrentItem(code) {
+ // While we do continue, we signal that the flow should be closed.
+ self.containerState._closeFlow = true;
+ // As we’re closing flow, we’re no longer interrupting.
+ self.interrupt = undefined;
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ effects.attempt(list, ok, nok),
+ 'linePrefix',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4
+ )(code)
+ }
+}
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeIndent(effects, ok, nok) {
+ const self = this;
+ return factorySpace(
+ effects,
+ afterPrefix,
+ 'listItemIndent',
+ self.containerState.size + 1
+ )
+
+ /** @type {State} */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return tail &&
+ tail[1].type === 'listItemIndent' &&
+ tail[2].sliceSerialize(tail[1], true).length === self.containerState.size
+ ? ok(code)
+ : nok(code)
+ }
+}
+
+/**
+ * @type {Exiter}
+ * @this {TokenizeContext}
+ */
+function tokenizeListEnd(effects) {
+ effects.exit(this.containerState.type);
+}
+
+/**
+ * @type {Tokenizer}
+ * @this {TokenizeContext}
+ */
+function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
+ const self = this;
+
+ // Always populated by defaults.
+
+ return factorySpace(
+ effects,
+ afterPrefix,
+ 'listItemPrefixWhitespace',
+ self.parser.constructs.disable.null.includes('codeIndented')
+ ? undefined
+ : 4 + 1
+ )
+
+ /** @type {State} */
+ function afterPrefix(code) {
+ const tail = self.events[self.events.length - 1];
+ return !markdownSpace(code) &&
+ tail &&
+ tail[1].type === 'listItemPrefixWhitespace'
+ ? ok(code)
+ : nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
+ */
+
+/** @type {Construct} */
+const setextUnderline = {
+ name: 'setextUnderline',
+ tokenize: tokenizeSetextUnderline,
+ resolveTo: resolveToSetextUnderline
+};
+
+/** @type {Resolver} */
+function resolveToSetextUnderline(events, context) {
+ // To do: resolve like `markdown-rs`.
+ let index = events.length;
+ /** @type {number | undefined} */
+ let content;
+ /** @type {number | undefined} */
+ let text;
+ /** @type {number | undefined} */
+ let definition;
+
+ // Find the opening of the content.
+ // It’ll always exist: we don’t tokenize if it isn’t there.
+ while (index--) {
+ if (events[index][0] === 'enter') {
+ if (events[index][1].type === 'content') {
+ content = index;
+ break
+ }
+ if (events[index][1].type === 'paragraph') {
+ text = index;
+ }
+ }
+ // Exit
+ else {
+ if (events[index][1].type === 'content') {
+ // Remove the content end (if needed we’ll add it later)
+ events.splice(index, 1);
+ }
+ if (!definition && events[index][1].type === 'definition') {
+ definition = index;
+ }
+ }
+ }
+ const heading = {
+ type: 'setextHeading',
+ start: Object.assign({}, events[text][1].start),
+ end: Object.assign({}, events[events.length - 1][1].end)
+ };
+
+ // Change the paragraph to setext heading text.
+ events[text][1].type = 'setextHeadingText';
+
+ // If we have definitions in the content, we’ll keep on having content,
+ // but we need move it.
+ if (definition) {
+ events.splice(text, 0, ['enter', heading, context]);
+ events.splice(definition + 1, 0, ['exit', events[content][1], context]);
+ events[content][1].end = Object.assign({}, events[definition][1].end);
+ } else {
+ events[content][1] = heading;
+ }
+
+ // Add the heading exit at the end.
+ events.push(['exit', heading, context]);
+ return events
+}
+
+/**
+ * @this {TokenizeContext}
+ * @type {Tokenizer}
+ */
+function tokenizeSetextUnderline(effects, ok, nok) {
+ const self = this;
+ /** @type {NonNullable} */
+ let marker;
+ return start
+
+ /**
+ * At start of heading (setext) underline.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ let index = self.events.length;
+ /** @type {boolean | undefined} */
+ let paragraph;
+ // Find an opening.
+ while (index--) {
+ // Skip enter/exit of line ending, line prefix, and content.
+ // We can now either have a definition or a paragraph.
+ if (
+ self.events[index][1].type !== 'lineEnding' &&
+ self.events[index][1].type !== 'linePrefix' &&
+ self.events[index][1].type !== 'content'
+ ) {
+ paragraph = self.events[index][1].type === 'paragraph';
+ break
+ }
+ }
+
+ // To do: handle lazy/pierce like `markdown-rs`.
+ // To do: parse indent like `markdown-rs`.
+ if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {
+ effects.enter('setextHeadingLine');
+ marker = code;
+ return before(code)
+ }
+ return nok(code)
+ }
+
+ /**
+ * After optional whitespace, at `-` or `=`.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function before(code) {
+ effects.enter('setextHeadingLineSequence');
+ return inside(code)
+ }
+
+ /**
+ * In sequence.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function inside(code) {
+ if (code === marker) {
+ effects.consume(code);
+ return inside
+ }
+ effects.exit('setextHeadingLineSequence');
+ return markdownSpace(code)
+ ? factorySpace(effects, after, 'lineSuffix')(code)
+ : after(code)
+ }
+
+ /**
+ * After sequence, after optional whitespace.
+ *
+ * ```markdown
+ * | aa
+ * > | ==
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function after(code) {
+ if (code === null || markdownLineEnding(code)) {
+ effects.exit('setextHeadingLine');
+ return ok(code)
+ }
+ return nok(code)
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').Initializer} Initializer
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+/** @type {InitialConstruct} */
+const flow$1 = {
+ tokenize: initializeFlow
+};
+
+/**
+ * @this {TokenizeContext}
+ * @type {Initializer}
+ */
+function initializeFlow(effects) {
+ const self = this;
+ const initial = effects.attempt(
+ // Try to parse a blank line.
+ blankLine,
+ atBlankEnding,
+ // Try to parse initial flow (essentially, only code).
+ effects.attempt(
+ this.parser.constructs.flowInitial,
+ afterConstruct,
+ factorySpace(
+ effects,
+ effects.attempt(
+ this.parser.constructs.flow,
+ afterConstruct,
+ effects.attempt(content, afterConstruct)
+ ),
+ 'linePrefix'
+ )
+ )
+ );
+ return initial
+
+ /** @type {State} */
+ function atBlankEnding(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('lineEndingBlank');
+ effects.consume(code);
+ effects.exit('lineEndingBlank');
+ self.currentConstruct = undefined;
+ return initial
+ }
+
+ /** @type {State} */
+ function afterConstruct(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('lineEnding');
+ effects.consume(code);
+ effects.exit('lineEnding');
+ self.currentConstruct = undefined;
+ return initial
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').Initializer} Initializer
+ * @typedef {import('micromark-util-types').Resolver} Resolver
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+const resolver = {
+ resolveAll: createResolver()
+};
+const string$1 = initializeFactory('string');
+const text$1 = initializeFactory('text');
+
+/**
+ * @param {'string' | 'text'} field
+ * @returns {InitialConstruct}
+ */
+function initializeFactory(field) {
+ return {
+ tokenize: initializeText,
+ resolveAll: createResolver(
+ field === 'text' ? resolveAllLineSuffixes : undefined
+ )
+ }
+
+ /**
+ * @this {TokenizeContext}
+ * @type {Initializer}
+ */
+ function initializeText(effects) {
+ const self = this;
+ const constructs = this.parser.constructs[field];
+ const text = effects.attempt(constructs, start, notText);
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ return atBreak(code) ? text(code) : notText(code)
+ }
+
+ /** @type {State} */
+ function notText(code) {
+ if (code === null) {
+ effects.consume(code);
+ return
+ }
+ effects.enter('data');
+ effects.consume(code);
+ return data
+ }
+
+ /** @type {State} */
+ function data(code) {
+ if (atBreak(code)) {
+ effects.exit('data');
+ return text(code)
+ }
+
+ // Data.
+ effects.consume(code);
+ return data
+ }
+
+ /**
+ * @param {Code} code
+ * @returns {boolean}
+ */
+ function atBreak(code) {
+ if (code === null) {
+ return true
+ }
+ const list = constructs[code];
+ let index = -1;
+ if (list) {
+ // Always populated by defaults.
+
+ while (++index < list.length) {
+ const item = list[index];
+ if (!item.previous || item.previous.call(self, self.previous)) {
+ return true
+ }
+ }
+ }
+ return false
+ }
+ }
+}
+
+/**
+ * @param {Resolver | undefined} [extraResolver]
+ * @returns {Resolver}
+ */
+function createResolver(extraResolver) {
+ return resolveAllText
+
+ /** @type {Resolver} */
+ function resolveAllText(events, context) {
+ let index = -1;
+ /** @type {number | undefined} */
+ let enter;
+
+ // A rather boring computation (to merge adjacent `data` events) which
+ // improves mm performance by 29%.
+ while (++index <= events.length) {
+ if (enter === undefined) {
+ if (events[index] && events[index][1].type === 'data') {
+ enter = index;
+ index++;
+ }
+ } else if (!events[index] || events[index][1].type !== 'data') {
+ // Don’t do anything if there is one data token.
+ if (index !== enter + 2) {
+ events[enter][1].end = events[index - 1][1].end;
+ events.splice(enter + 2, index - enter - 2);
+ index = enter + 2;
+ }
+ enter = undefined;
+ }
+ }
+ return extraResolver ? extraResolver(events, context) : events
+ }
+}
+
+/**
+ * A rather ugly set of instructions which again looks at chunks in the input
+ * stream.
+ * The reason to do this here is that it is *much* faster to parse in reverse.
+ * And that we can’t hook into `null` to split the line suffix before an EOF.
+ * To do: figure out if we can make this into a clean utility, or even in core.
+ * As it will be useful for GFMs literal autolink extension (and maybe even
+ * tables?)
+ *
+ * @type {Resolver}
+ */
+function resolveAllLineSuffixes(events, context) {
+ let eventIndex = 0; // Skip first.
+
+ while (++eventIndex <= events.length) {
+ if (
+ (eventIndex === events.length ||
+ events[eventIndex][1].type === 'lineEnding') &&
+ events[eventIndex - 1][1].type === 'data'
+ ) {
+ const data = events[eventIndex - 1][1];
+ const chunks = context.sliceStream(data);
+ let index = chunks.length;
+ let bufferIndex = -1;
+ let size = 0;
+ /** @type {boolean | undefined} */
+ let tabs;
+ while (index--) {
+ const chunk = chunks[index];
+ if (typeof chunk === 'string') {
+ bufferIndex = chunk.length;
+ while (chunk.charCodeAt(bufferIndex - 1) === 32) {
+ size++;
+ bufferIndex--;
+ }
+ if (bufferIndex) break
+ bufferIndex = -1;
+ }
+ // Number
+ else if (chunk === -2) {
+ tabs = true;
+ size++;
+ } else if (chunk === -1) ; else {
+ // Replacement character, exit.
+ index++;
+ break
+ }
+ }
+ if (size) {
+ const token = {
+ type:
+ eventIndex === events.length || tabs || size < 2
+ ? 'lineSuffix'
+ : 'hardBreakTrailing',
+ start: {
+ line: data.end.line,
+ column: data.end.column - size,
+ offset: data.end.offset - size,
+ _index: data.start._index + index,
+ _bufferIndex: index
+ ? bufferIndex
+ : data.start._bufferIndex + bufferIndex
+ },
+ end: Object.assign({}, data.end)
+ };
+ data.end = Object.assign({}, token.start);
+ if (data.start.offset === data.end.offset) {
+ Object.assign(data, token);
+ } else {
+ events.splice(
+ eventIndex,
+ 0,
+ ['enter', token, context],
+ ['exit', token, context]
+ );
+ eventIndex += 2;
+ }
+ }
+ eventIndex++;
+ }
+ }
+ return events
+}
+
+/**
+ * @typedef {import('micromark-util-types').Chunk} Chunk
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Construct} Construct
+ * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
+ * @typedef {import('micromark-util-types').Effects} Effects
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').ParseContext} ParseContext
+ * @typedef {import('micromark-util-types').Point} Point
+ * @typedef {import('micromark-util-types').State} State
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenType} TokenType
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ */
+
+/**
+ * Create a tokenizer.
+ * Tokenizers deal with one type of data (e.g., containers, flow, text).
+ * The parser is the object dealing with it all.
+ * `initialize` works like other constructs, except that only its `tokenize`
+ * function is used, in which case it doesn’t receive an `ok` or `nok`.
+ * `from` can be given to set the point before the first character, although
+ * when further lines are indented, they must be set with `defineSkip`.
+ *
+ * @param {ParseContext} parser
+ * @param {InitialConstruct} initialize
+ * @param {Omit | undefined} [from]
+ * @returns {TokenizeContext}
+ */
+function createTokenizer(parser, initialize, from) {
+ /** @type {Point} */
+ let point = Object.assign(
+ from
+ ? Object.assign({}, from)
+ : {
+ line: 1,
+ column: 1,
+ offset: 0
+ },
+ {
+ _index: 0,
+ _bufferIndex: -1
+ }
+ );
+ /** @type {Record} */
+ const columnStart = {};
+ /** @type {Array} */
+ const resolveAllConstructs = [];
+ /** @type {Array} */
+ let chunks = [];
+ /** @type {Array} */
+ let stack = [];
+
+ /**
+ * Tools used for tokenizing.
+ *
+ * @type {Effects}
+ */
+ const effects = {
+ consume,
+ enter,
+ exit,
+ attempt: constructFactory(onsuccessfulconstruct),
+ check: constructFactory(onsuccessfulcheck),
+ interrupt: constructFactory(onsuccessfulcheck, {
+ interrupt: true
+ })
+ };
+
+ /**
+ * State and tools for resolving and serializing.
+ *
+ * @type {TokenizeContext}
+ */
+ const context = {
+ previous: null,
+ code: null,
+ containerState: {},
+ events: [],
+ parser,
+ sliceStream,
+ sliceSerialize,
+ now,
+ defineSkip,
+ write
+ };
+
+ /**
+ * The state function.
+ *
+ * @type {State | void}
+ */
+ let state = initialize.tokenize.call(context, effects);
+ if (initialize.resolveAll) {
+ resolveAllConstructs.push(initialize);
+ }
+ return context
+
+ /** @type {TokenizeContext['write']} */
+ function write(slice) {
+ chunks = push(chunks, slice);
+ main();
+
+ // Exit if we’re not done, resolve might change stuff.
+ if (chunks[chunks.length - 1] !== null) {
+ return []
+ }
+ addResult(initialize, 0);
+
+ // Otherwise, resolve, and exit.
+ context.events = resolveAll(resolveAllConstructs, context.events, context);
+ return context.events
+ }
+
+ //
+ // Tools.
+ //
+
+ /** @type {TokenizeContext['sliceSerialize']} */
+ function sliceSerialize(token, expandTabs) {
+ return serializeChunks(sliceStream(token), expandTabs)
+ }
+
+ /** @type {TokenizeContext['sliceStream']} */
+ function sliceStream(token) {
+ return sliceChunks(chunks, token)
+ }
+
+ /** @type {TokenizeContext['now']} */
+ function now() {
+ // This is a hot path, so we clone manually instead of `Object.assign({}, point)`
+ const {line, column, offset, _index, _bufferIndex} = point;
+ return {
+ line,
+ column,
+ offset,
+ _index,
+ _bufferIndex
+ }
+ }
+
+ /** @type {TokenizeContext['defineSkip']} */
+ function defineSkip(value) {
+ columnStart[value.line] = value.column;
+ accountForPotentialSkip();
+ }
+
+ //
+ // State management.
+ //
+
+ /**
+ * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by
+ * `consume`).
+ * Here is where we walk through the chunks, which either include strings of
+ * several characters, or numerical character codes.
+ * The reason to do this in a loop instead of a call is so the stack can
+ * drain.
+ *
+ * @returns {void}
+ */
+ function main() {
+ /** @type {number} */
+ let chunkIndex;
+ while (point._index < chunks.length) {
+ const chunk = chunks[point._index];
+
+ // If we’re in a buffer chunk, loop through it.
+ if (typeof chunk === 'string') {
+ chunkIndex = point._index;
+ if (point._bufferIndex < 0) {
+ point._bufferIndex = 0;
+ }
+ while (
+ point._index === chunkIndex &&
+ point._bufferIndex < chunk.length
+ ) {
+ go(chunk.charCodeAt(point._bufferIndex));
+ }
+ } else {
+ go(chunk);
+ }
+ }
+ }
+
+ /**
+ * Deal with one code.
+ *
+ * @param {Code} code
+ * @returns {void}
+ */
+ function go(code) {
+ state = state(code);
+ }
+
+ /** @type {Effects['consume']} */
+ function consume(code) {
+ if (markdownLineEnding(code)) {
+ point.line++;
+ point.column = 1;
+ point.offset += code === -3 ? 2 : 1;
+ accountForPotentialSkip();
+ } else if (code !== -1) {
+ point.column++;
+ point.offset++;
+ }
+
+ // Not in a string chunk.
+ if (point._bufferIndex < 0) {
+ point._index++;
+ } else {
+ point._bufferIndex++;
+
+ // At end of string chunk.
+ // @ts-expect-error Points w/ non-negative `_bufferIndex` reference
+ // strings.
+ if (point._bufferIndex === chunks[point._index].length) {
+ point._bufferIndex = -1;
+ point._index++;
+ }
+ }
+
+ // Expose the previous character.
+ context.previous = code;
+ }
+
+ /** @type {Effects['enter']} */
+ function enter(type, fields) {
+ /** @type {Token} */
+ // @ts-expect-error Patch instead of assign required fields to help GC.
+ const token = fields || {};
+ token.type = type;
+ token.start = now();
+ context.events.push(['enter', token, context]);
+ stack.push(token);
+ return token
+ }
+
+ /** @type {Effects['exit']} */
+ function exit(type) {
+ const token = stack.pop();
+ token.end = now();
+ context.events.push(['exit', token, context]);
+ return token
+ }
+
+ /**
+ * Use results.
+ *
+ * @type {ReturnHandle}
+ */
+ function onsuccessfulconstruct(construct, info) {
+ addResult(construct, info.from);
+ }
+
+ /**
+ * Discard results.
+ *
+ * @type {ReturnHandle}
+ */
+ function onsuccessfulcheck(_, info) {
+ info.restore();
+ }
+
+ /**
+ * Factory to attempt/check/interrupt.
+ *
+ * @param {ReturnHandle} onreturn
+ * @param {{interrupt?: boolean | undefined} | undefined} [fields]
+ */
+ function constructFactory(onreturn, fields) {
+ return hook
+
+ /**
+ * Handle either an object mapping codes to constructs, a list of
+ * constructs, or a single construct.
+ *
+ * @param {Array | Construct | ConstructRecord} constructs
+ * @param {State} returnState
+ * @param {State | undefined} [bogusState]
+ * @returns {State}
+ */
+ function hook(constructs, returnState, bogusState) {
+ /** @type {Array} */
+ let listOfConstructs;
+ /** @type {number} */
+ let constructIndex;
+ /** @type {Construct} */
+ let currentConstruct;
+ /** @type {Info} */
+ let info;
+ return Array.isArray(constructs) /* c8 ignore next 1 */
+ ? handleListOfConstructs(constructs)
+ : 'tokenize' in constructs
+ ? // @ts-expect-error Looks like a construct.
+ handleListOfConstructs([constructs])
+ : handleMapOfConstructs(constructs)
+
+ /**
+ * Handle a list of construct.
+ *
+ * @param {ConstructRecord} map
+ * @returns {State}
+ */
+ function handleMapOfConstructs(map) {
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ const def = code !== null && map[code];
+ const all = code !== null && map.null;
+ const list = [
+ // To do: add more extension tests.
+ /* c8 ignore next 2 */
+ ...(Array.isArray(def) ? def : def ? [def] : []),
+ ...(Array.isArray(all) ? all : all ? [all] : [])
+ ];
+ return handleListOfConstructs(list)(code)
+ }
+ }
+
+ /**
+ * Handle a list of construct.
+ *
+ * @param {Array} list
+ * @returns {State}
+ */
+ function handleListOfConstructs(list) {
+ listOfConstructs = list;
+ constructIndex = 0;
+ if (list.length === 0) {
+ return bogusState
+ }
+ return handleConstruct(list[constructIndex])
+ }
+
+ /**
+ * Handle a single construct.
+ *
+ * @param {Construct} construct
+ * @returns {State}
+ */
+ function handleConstruct(construct) {
+ return start
+
+ /** @type {State} */
+ function start(code) {
+ // To do: not needed to store if there is no bogus state, probably?
+ // Currently doesn’t work because `inspect` in document does a check
+ // w/o a bogus, which doesn’t make sense. But it does seem to help perf
+ // by not storing.
+ info = store();
+ currentConstruct = construct;
+ if (!construct.partial) {
+ context.currentConstruct = construct;
+ }
+
+ // Always populated by defaults.
+
+ if (
+ construct.name &&
+ context.parser.constructs.disable.null.includes(construct.name)
+ ) {
+ return nok()
+ }
+ return construct.tokenize.call(
+ // If we do have fields, create an object w/ `context` as its
+ // prototype.
+ // This allows a “live binding”, which is needed for `interrupt`.
+ fields ? Object.assign(Object.create(context), fields) : context,
+ effects,
+ ok,
+ nok
+ )(code)
+ }
+ }
+
+ /** @type {State} */
+ function ok(code) {
+ onreturn(currentConstruct, info);
+ return returnState
+ }
+
+ /** @type {State} */
+ function nok(code) {
+ info.restore();
+ if (++constructIndex < listOfConstructs.length) {
+ return handleConstruct(listOfConstructs[constructIndex])
+ }
+ return bogusState
+ }
+ }
+ }
+
+ /**
+ * @param {Construct} construct
+ * @param {number} from
+ * @returns {void}
+ */
+ function addResult(construct, from) {
+ if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
+ resolveAllConstructs.push(construct);
+ }
+ if (construct.resolve) {
+ splice(
+ context.events,
+ from,
+ context.events.length - from,
+ construct.resolve(context.events.slice(from), context)
+ );
+ }
+ if (construct.resolveTo) {
+ context.events = construct.resolveTo(context.events, context);
+ }
+ }
+
+ /**
+ * Store state.
+ *
+ * @returns {Info}
+ */
+ function store() {
+ const startPoint = now();
+ const startPrevious = context.previous;
+ const startCurrentConstruct = context.currentConstruct;
+ const startEventsIndex = context.events.length;
+ const startStack = Array.from(stack);
+ return {
+ restore,
+ from: startEventsIndex
+ }
+
+ /**
+ * Restore state.
+ *
+ * @returns {void}
+ */
+ function restore() {
+ point = startPoint;
+ context.previous = startPrevious;
+ context.currentConstruct = startCurrentConstruct;
+ context.events.length = startEventsIndex;
+ stack = startStack;
+ accountForPotentialSkip();
+ }
+ }
+
+ /**
+ * Move the current point a bit forward in the line when it’s on a column
+ * skip.
+ *
+ * @returns {void}
+ */
+ function accountForPotentialSkip() {
+ if (point.line in columnStart && point.column < 2) {
+ point.column = columnStart[point.line];
+ point.offset += columnStart[point.line] - 1;
+ }
+ }
+}
+
+/**
+ * Get the chunks from a slice of chunks in the range of a token.
+ *
+ * @param {Array} chunks
+ * @param {Pick} token
+ * @returns {Array}
+ */
+function sliceChunks(chunks, token) {
+ const startIndex = token.start._index;
+ const startBufferIndex = token.start._bufferIndex;
+ const endIndex = token.end._index;
+ const endBufferIndex = token.end._bufferIndex;
+ /** @type {Array} */
+ let view;
+ if (startIndex === endIndex) {
+ // @ts-expect-error `_bufferIndex` is used on string chunks.
+ view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
+ } else {
+ view = chunks.slice(startIndex, endIndex);
+ if (startBufferIndex > -1) {
+ const head = view[0];
+ if (typeof head === 'string') {
+ view[0] = head.slice(startBufferIndex);
+ } else {
+ view.shift();
+ }
+ }
+ if (endBufferIndex > 0) {
+ // @ts-expect-error `_bufferIndex` is used on string chunks.
+ view.push(chunks[endIndex].slice(0, endBufferIndex));
+ }
+ }
+ return view
+}
+
+/**
+ * Get the string value of a slice of chunks.
+ *
+ * @param {Array} chunks
+ * @param {boolean | undefined} [expandTabs=false]
+ * @returns {string}
+ */
+function serializeChunks(chunks, expandTabs) {
+ let index = -1;
+ /** @type {Array} */
+ const result = [];
+ /** @type {boolean | undefined} */
+ let atTab;
+ while (++index < chunks.length) {
+ const chunk = chunks[index];
+ /** @type {string} */
+ let value;
+ if (typeof chunk === 'string') {
+ value = chunk;
+ } else
+ switch (chunk) {
+ case -5: {
+ value = '\r';
+ break
+ }
+ case -4: {
+ value = '\n';
+ break
+ }
+ case -3: {
+ value = '\r' + '\n';
+ break
+ }
+ case -2: {
+ value = expandTabs ? ' ' : '\t';
+ break
+ }
+ case -1: {
+ if (!expandTabs && atTab) continue
+ value = ' ';
+ break
+ }
+ default: {
+ // Currently only replacement character.
+ value = String.fromCharCode(chunk);
+ }
+ }
+ atTab = chunk === -2;
+ result.push(value);
+ }
+ return result.join('')
+}
+
+/**
+ * @typedef {import('micromark-util-types').Extension} Extension
+ */
+
+
+/** @satisfies {Extension['document']} */
+const document = {
+ [42]: list,
+ [43]: list,
+ [45]: list,
+ [48]: list,
+ [49]: list,
+ [50]: list,
+ [51]: list,
+ [52]: list,
+ [53]: list,
+ [54]: list,
+ [55]: list,
+ [56]: list,
+ [57]: list,
+ [62]: blockQuote
+};
+
+/** @satisfies {Extension['contentInitial']} */
+const contentInitial = {
+ [91]: definition
+};
+
+/** @satisfies {Extension['flowInitial']} */
+const flowInitial = {
+ [-2]: codeIndented,
+ [-1]: codeIndented,
+ [32]: codeIndented
+};
+
+/** @satisfies {Extension['flow']} */
+const flow = {
+ [35]: headingAtx,
+ [42]: thematicBreak,
+ [45]: [setextUnderline, thematicBreak],
+ [60]: htmlFlow,
+ [61]: setextUnderline,
+ [95]: thematicBreak,
+ [96]: codeFenced,
+ [126]: codeFenced
+};
+
+/** @satisfies {Extension['string']} */
+const string = {
+ [38]: characterReference,
+ [92]: characterEscape
+};
+
+/** @satisfies {Extension['text']} */
+const text = {
+ [-5]: lineEnding,
+ [-4]: lineEnding,
+ [-3]: lineEnding,
+ [33]: labelStartImage,
+ [38]: characterReference,
+ [42]: attention,
+ [60]: [autolink, htmlText],
+ [91]: labelStartLink,
+ [92]: [hardBreakEscape, characterEscape],
+ [93]: labelEnd,
+ [95]: attention,
+ [96]: codeText
+};
+
+/** @satisfies {Extension['insideSpan']} */
+const insideSpan = {
+ null: [attention, resolver]
+};
+
+/** @satisfies {Extension['attentionMarkers']} */
+const attentionMarkers = {
+ null: [42, 95]
+};
+
+/** @satisfies {Extension['disable']} */
+const disable = {
+ null: []
+};
+
+var defaultConstructs = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ attentionMarkers: attentionMarkers,
+ contentInitial: contentInitial,
+ disable: disable,
+ document: document,
+ flow: flow,
+ flowInitial: flowInitial,
+ insideSpan: insideSpan,
+ string: string,
+ text: text
+});
+
+/**
+ * @typedef {import('micromark-util-types').Create} Create
+ * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension
+ * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
+ * @typedef {import('micromark-util-types').ParseContext} ParseContext
+ * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
+ */
+
+
+/**
+ * @param {ParseOptions | null | undefined} [options]
+ * @returns {ParseContext}
+ */
+function parse(options) {
+ const settings = options || {};
+ const constructs =
+ /** @type {FullNormalizedExtension} */
+ combineExtensions([defaultConstructs, ...(settings.extensions || [])]);
+
+ /** @type {ParseContext} */
+ const parser = {
+ defined: [],
+ lazy: {},
+ constructs,
+ content: create(content$1),
+ document: create(document$1),
+ flow: create(flow$1),
+ string: create(string$1),
+ text: create(text$1)
+ };
+ return parser
+
+ /**
+ * @param {InitialConstruct} initial
+ */
+ function create(initial) {
+ return creator
+ /** @type {Create} */
+ function creator(from) {
+ return createTokenizer(parser, initial, from)
+ }
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Chunk} Chunk
+ * @typedef {import('micromark-util-types').Code} Code
+ * @typedef {import('micromark-util-types').Encoding} Encoding
+ * @typedef {import('micromark-util-types').Value} Value
+ */
+
+/**
+ * @callback Preprocessor
+ * @param {Value} value
+ * @param {Encoding | null | undefined} [encoding]
+ * @param {boolean | null | undefined} [end=false]
+ * @returns {Array}
+ */
+
+const search = /[\0\t\n\r]/g;
+
+/**
+ * @returns {Preprocessor}
+ */
+function preprocess() {
+ let column = 1;
+ let buffer = '';
+ /** @type {boolean | undefined} */
+ let start = true;
+ /** @type {boolean | undefined} */
+ let atCarriageReturn;
+ return preprocessor
+
+ /** @type {Preprocessor} */
+ function preprocessor(value, encoding, end) {
+ /** @type {Array} */
+ const chunks = [];
+ /** @type {RegExpMatchArray | null} */
+ let match;
+ /** @type {number} */
+ let next;
+ /** @type {number} */
+ let startPosition;
+ /** @type {number} */
+ let endPosition;
+ /** @type {Code} */
+ let code;
+
+ // @ts-expect-error `Buffer` does allow an encoding.
+ value = buffer + value.toString(encoding);
+ startPosition = 0;
+ buffer = '';
+ if (start) {
+ // To do: `markdown-rs` actually parses BOMs (byte order mark).
+ if (value.charCodeAt(0) === 65279) {
+ startPosition++;
+ }
+ start = undefined;
+ }
+ while (startPosition < value.length) {
+ search.lastIndex = startPosition;
+ match = search.exec(value);
+ endPosition =
+ match && match.index !== undefined ? match.index : value.length;
+ code = value.charCodeAt(endPosition);
+ if (!match) {
+ buffer = value.slice(startPosition);
+ break
+ }
+ if (code === 10 && startPosition === endPosition && atCarriageReturn) {
+ chunks.push(-3);
+ atCarriageReturn = undefined;
+ } else {
+ if (atCarriageReturn) {
+ chunks.push(-5);
+ atCarriageReturn = undefined;
+ }
+ if (startPosition < endPosition) {
+ chunks.push(value.slice(startPosition, endPosition));
+ column += endPosition - startPosition;
+ }
+ switch (code) {
+ case 0: {
+ chunks.push(65533);
+ column++;
+ break
+ }
+ case 9: {
+ next = Math.ceil(column / 4) * 4;
+ chunks.push(-2);
+ while (column++ < next) chunks.push(-1);
+ break
+ }
+ case 10: {
+ chunks.push(-4);
+ column = 1;
+ break
+ }
+ default: {
+ atCarriageReturn = true;
+ column = 1;
+ }
+ }
+ }
+ startPosition = endPosition + 1;
+ }
+ if (end) {
+ if (atCarriageReturn) chunks.push(-5);
+ if (buffer) chunks.push(buffer);
+ chunks.push(null);
+ }
+ return chunks
+ }
+}
+
+/**
+ * @typedef {import('micromark-util-types').Event} Event
+ */
+
+
+/**
+ * @param {Array} events
+ * @returns {Array}
+ */
+function postprocess(events) {
+ while (!subtokenize(events)) {
+ // Empty
+ }
+ return events
+}
+
+/**
+ * Turn the number (in string form as either hexa- or plain decimal) coming from
+ * a numeric character reference into a character.
+ *
+ * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes
+ * non-characters and control characters safe.
+ *
+ * @param {string} value
+ * Value to decode.
+ * @param {number} base
+ * Numeric base.
+ * @returns {string}
+ * Character.
+ */
+function decodeNumericCharacterReference(value, base) {
+ const code = Number.parseInt(value, base);
+ if (
+ // C0 except for HT, LF, FF, CR, space.
+ code < 9 ||
+ code === 11 ||
+ (code > 13 && code < 32) ||
+ // Control character (DEL) of C0, and C1 controls.
+ (code > 126 && code < 160) ||
+ // Lone high surrogates and low surrogates.
+ (code > 55295 && code < 57344) ||
+ // Noncharacters.
+ (code > 64975 && code < 65008) /* eslint-disable no-bitwise */ ||
+ (code & 65535) === 65535 ||
+ (code & 65535) === 65534 /* eslint-enable no-bitwise */ ||
+ // Out of range
+ code > 1114111
+ ) {
+ return '\uFFFD'
+ }
+ return String.fromCharCode(code)
+}
+
+const characterEscapeOrReference =
+ /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
+
+/**
+ * Decode markdown strings (which occur in places such as fenced code info
+ * strings, destinations, labels, and titles).
+ *
+ * The “string” content type allows character escapes and -references.
+ * This decodes those.
+ *
+ * @param {string} value
+ * Value to decode.
+ * @returns {string}
+ * Decoded value.
+ */
+function decodeString(value) {
+ return value.replace(characterEscapeOrReference, decode)
+}
+
+/**
+ * @param {string} $0
+ * @param {string} $1
+ * @param {string} $2
+ * @returns {string}
+ */
+function decode($0, $1, $2) {
+ if ($1) {
+ // Escape.
+ return $1
+ }
+
+ // Reference.
+ const head = $2.charCodeAt(0);
+ if (head === 35) {
+ const head = $2.charCodeAt(1);
+ const hex = head === 120 || head === 88;
+ return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)
+ }
+ return decodeNamedCharacterReference($2) || $0
+}
+
+/**
+ * @typedef {import('unist').Node} Node
+ * @typedef {import('unist').Point} Point
+ * @typedef {import('unist').Position} Position
+ */
+
+/**
+ * @typedef NodeLike
+ * @property {string} type
+ * @property {PositionLike | null | undefined} [position]
+ *
+ * @typedef PositionLike
+ * @property {PointLike | null | undefined} [start]
+ * @property {PointLike | null | undefined} [end]
+ *
+ * @typedef PointLike
+ * @property {number | null | undefined} [line]
+ * @property {number | null | undefined} [column]
+ * @property {number | null | undefined} [offset]
+ */
+
+/**
+ * Serialize the positional info of a point, position (start and end points),
+ * or node.
+ *
+ * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]
+ * Node, position, or point.
+ * @returns {string}
+ * Pretty printed positional info of a node (`string`).
+ *
+ * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
+ * or a point `l:c` (when given `point`), where `l` stands for line, `c` for
+ * column, `s` for `start`, and `e` for end.
+ * An empty string (`''`) is returned if the given value is neither `node`,
+ * `position`, nor `point`.
+ */
+function stringifyPosition(value) {
+ // Nothing.
+ if (!value || typeof value !== 'object') {
+ return ''
+ }
+
+ // Node.
+ if ('position' in value || 'type' in value) {
+ return position(value.position)
+ }
+
+ // Position.
+ if ('start' in value || 'end' in value) {
+ return position(value)
+ }
+
+ // Point.
+ if ('line' in value || 'column' in value) {
+ return point$1(value)
+ }
+
+ // ?
+ return ''
+}
+
+/**
+ * @param {Point | PointLike | null | undefined} point
+ * @returns {string}
+ */
+function point$1(point) {
+ return index(point && point.line) + ':' + index(point && point.column)
+}
+
+/**
+ * @param {Position | PositionLike | null | undefined} pos
+ * @returns {string}
+ */
+function position(pos) {
+ return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
+}
+
+/**
+ * @param {number | null | undefined} value
+ * @returns {number}
+ */
+function index(value) {
+ return value && typeof value === 'number' ? value : 1
+}
+
+/**
+ * @typedef {import('micromark-util-types').Encoding} Encoding
+ * @typedef {import('micromark-util-types').Event} Event
+ * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
+ * @typedef {import('micromark-util-types').Token} Token
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
+ * @typedef {import('micromark-util-types').Value} Value
+ *
+ * @typedef {import('unist').Parent} UnistParent
+ * @typedef {import('unist').Point} Point
+ *
+ * @typedef {import('mdast').PhrasingContent} PhrasingContent
+ * @typedef {import('mdast').StaticPhrasingContent} StaticPhrasingContent
+ * @typedef {import('mdast').Content} Content
+ * @typedef {import('mdast').Break} Break
+ * @typedef {import('mdast').Blockquote} Blockquote
+ * @typedef {import('mdast').Code} Code
+ * @typedef {import('mdast').Definition} Definition
+ * @typedef {import('mdast').Emphasis} Emphasis
+ * @typedef {import('mdast').Heading} Heading
+ * @typedef {import('mdast').HTML} HTML
+ * @typedef {import('mdast').Image} Image
+ * @typedef {import('mdast').ImageReference} ImageReference
+ * @typedef {import('mdast').InlineCode} InlineCode
+ * @typedef {import('mdast').Link} Link
+ * @typedef {import('mdast').LinkReference} LinkReference
+ * @typedef {import('mdast').List} List
+ * @typedef {import('mdast').ListItem} ListItem
+ * @typedef {import('mdast').Paragraph} Paragraph
+ * @typedef {import('mdast').Root} Root
+ * @typedef {import('mdast').Strong} Strong
+ * @typedef {import('mdast').Text} Text
+ * @typedef {import('mdast').ThematicBreak} ThematicBreak
+ * @typedef {import('mdast').ReferenceType} ReferenceType
+ * @typedef {import('../index.js').CompileData} CompileData
+ */
+
+const own = {}.hasOwnProperty;
+
+/**
+ * @param value
+ * Markdown to parse.
+ * @param encoding
+ * Character encoding for when `value` is `Buffer`.
+ * @param options
+ * Configuration.
+ * @returns
+ * mdast tree.
+ */
+const fromMarkdown =
+ /**
+ * @type {(
+ * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &
+ * ((value: Value, options?: Options | null | undefined) => Root)
+ * )}
+ */
+
+ /**
+ * @param {Value} value
+ * @param {Encoding | Options | null | undefined} [encoding]
+ * @param {Options | null | undefined} [options]
+ * @returns {Root}
+ */
+ function (value, encoding, options) {
+ if (typeof encoding !== 'string') {
+ options = encoding;
+ encoding = undefined;
+ }
+ return compiler(options)(
+ postprocess(
+ parse(options).document().write(preprocess()(value, encoding, true))
+ )
+ )
+ };
+
+/**
+ * Note this compiler only understand complete buffering, not streaming.
+ *
+ * @param {Options | null | undefined} [options]
+ */
+function compiler(options) {
+ /** @type {Config} */
+ const config = {
+ transforms: [],
+ canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],
+ enter: {
+ autolink: opener(link),
+ autolinkProtocol: onenterdata,
+ autolinkEmail: onenterdata,
+ atxHeading: opener(heading),
+ blockQuote: opener(blockQuote),
+ characterEscape: onenterdata,
+ characterReference: onenterdata,
+ codeFenced: opener(codeFlow),
+ codeFencedFenceInfo: buffer,
+ codeFencedFenceMeta: buffer,
+ codeIndented: opener(codeFlow, buffer),
+ codeText: opener(codeText, buffer),
+ codeTextData: onenterdata,
+ data: onenterdata,
+ codeFlowValue: onenterdata,
+ definition: opener(definition),
+ definitionDestinationString: buffer,
+ definitionLabelString: buffer,
+ definitionTitleString: buffer,
+ emphasis: opener(emphasis),
+ hardBreakEscape: opener(hardBreak),
+ hardBreakTrailing: opener(hardBreak),
+ htmlFlow: opener(html, buffer),
+ htmlFlowData: onenterdata,
+ htmlText: opener(html, buffer),
+ htmlTextData: onenterdata,
+ image: opener(image),
+ label: buffer,
+ link: opener(link),
+ listItem: opener(listItem),
+ listItemValue: onenterlistitemvalue,
+ listOrdered: opener(list, onenterlistordered),
+ listUnordered: opener(list),
+ paragraph: opener(paragraph),
+ reference: onenterreference,
+ referenceString: buffer,
+ resourceDestinationString: buffer,
+ resourceTitleString: buffer,
+ setextHeading: opener(heading),
+ strong: opener(strong),
+ thematicBreak: opener(thematicBreak)
+ },
+ exit: {
+ atxHeading: closer(),
+ atxHeadingSequence: onexitatxheadingsequence,
+ autolink: closer(),
+ autolinkEmail: onexitautolinkemail,
+ autolinkProtocol: onexitautolinkprotocol,
+ blockQuote: closer(),
+ characterEscapeValue: onexitdata,
+ characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
+ characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
+ characterReferenceValue: onexitcharacterreferencevalue,
+ codeFenced: closer(onexitcodefenced),
+ codeFencedFence: onexitcodefencedfence,
+ codeFencedFenceInfo: onexitcodefencedfenceinfo,
+ codeFencedFenceMeta: onexitcodefencedfencemeta,
+ codeFlowValue: onexitdata,
+ codeIndented: closer(onexitcodeindented),
+ codeText: closer(onexitcodetext),
+ codeTextData: onexitdata,
+ data: onexitdata,
+ definition: closer(),
+ definitionDestinationString: onexitdefinitiondestinationstring,
+ definitionLabelString: onexitdefinitionlabelstring,
+ definitionTitleString: onexitdefinitiontitlestring,
+ emphasis: closer(),
+ hardBreakEscape: closer(onexithardbreak),
+ hardBreakTrailing: closer(onexithardbreak),
+ htmlFlow: closer(onexithtmlflow),
+ htmlFlowData: onexitdata,
+ htmlText: closer(onexithtmltext),
+ htmlTextData: onexitdata,
+ image: closer(onexitimage),
+ label: onexitlabel,
+ labelText: onexitlabeltext,
+ lineEnding: onexitlineending,
+ link: closer(onexitlink),
+ listItem: closer(),
+ listOrdered: closer(),
+ listUnordered: closer(),
+ paragraph: closer(),
+ referenceString: onexitreferencestring,
+ resourceDestinationString: onexitresourcedestinationstring,
+ resourceTitleString: onexitresourcetitlestring,
+ resource: onexitresource,
+ setextHeading: closer(onexitsetextheading),
+ setextHeadingLineSequence: onexitsetextheadinglinesequence,
+ setextHeadingText: onexitsetextheadingtext,
+ strong: closer(),
+ thematicBreak: closer()
+ }
+ };
+ configure(config, (options || {}).mdastExtensions || []);
+
+ /** @type {CompileData} */
+ const data = {};
+ return compile
+
+ /**
+ * Turn micromark events into an mdast tree.
+ *
+ * @param {Array} events
+ * Events.
+ * @returns {Root}
+ * mdast tree.
+ */
+ function compile(events) {
+ /** @type {Root} */
+ let tree = {
+ type: 'root',
+ children: []
+ };
+ /** @type {Omit} */
+ const context = {
+ stack: [tree],
+ tokenStack: [],
+ config,
+ enter,
+ exit,
+ buffer,
+ resume,
+ setData,
+ getData
+ };
+ /** @type {Array} */
+ const listStack = [];
+ let index = -1;
+ while (++index < events.length) {
+ // We preprocess lists to add `listItem` tokens, and to infer whether
+ // items the list itself are spread out.
+ if (
+ events[index][1].type === 'listOrdered' ||
+ events[index][1].type === 'listUnordered'
+ ) {
+ if (events[index][0] === 'enter') {
+ listStack.push(index);
+ } else {
+ const tail = listStack.pop();
+ index = prepareList(events, tail, index);
+ }
+ }
+ }
+ index = -1;
+ while (++index < events.length) {
+ const handler = config[events[index][0]];
+ if (own.call(handler, events[index][1].type)) {
+ handler[events[index][1].type].call(
+ Object.assign(
+ {
+ sliceSerialize: events[index][2].sliceSerialize
+ },
+ context
+ ),
+ events[index][1]
+ );
+ }
+ }
+
+ // Handle tokens still being open.
+ if (context.tokenStack.length > 0) {
+ const tail = context.tokenStack[context.tokenStack.length - 1];
+ const handler = tail[1] || defaultOnError;
+ handler.call(context, undefined, tail[0]);
+ }
+
+ // Figure out `root` position.
+ tree.position = {
+ start: point(
+ events.length > 0
+ ? events[0][1].start
+ : {
+ line: 1,
+ column: 1,
+ offset: 0
+ }
+ ),
+ end: point(
+ events.length > 0
+ ? events[events.length - 2][1].end
+ : {
+ line: 1,
+ column: 1,
+ offset: 0
+ }
+ )
+ };
+
+ // Call transforms.
+ index = -1;
+ while (++index < config.transforms.length) {
+ tree = config.transforms[index](tree) || tree;
+ }
+ return tree
+ }
+
+ /**
+ * @param {Array} events
+ * @param {number} start
+ * @param {number} length
+ * @returns {number}
+ */
+ function prepareList(events, start, length) {
+ let index = start - 1;
+ let containerBalance = -1;
+ let listSpread = false;
+ /** @type {Token | undefined} */
+ let listItem;
+ /** @type {number | undefined} */
+ let lineIndex;
+ /** @type {number | undefined} */
+ let firstBlankLineIndex;
+ /** @type {boolean | undefined} */
+ let atMarker;
+ while (++index <= length) {
+ const event = events[index];
+ if (
+ event[1].type === 'listUnordered' ||
+ event[1].type === 'listOrdered' ||
+ event[1].type === 'blockQuote'
+ ) {
+ if (event[0] === 'enter') {
+ containerBalance++;
+ } else {
+ containerBalance--;
+ }
+ atMarker = undefined;
+ } else if (event[1].type === 'lineEndingBlank') {
+ if (event[0] === 'enter') {
+ if (
+ listItem &&
+ !atMarker &&
+ !containerBalance &&
+ !firstBlankLineIndex
+ ) {
+ firstBlankLineIndex = index;
+ }
+ atMarker = undefined;
+ }
+ } else if (
+ event[1].type === 'linePrefix' ||
+ event[1].type === 'listItemValue' ||
+ event[1].type === 'listItemMarker' ||
+ event[1].type === 'listItemPrefix' ||
+ event[1].type === 'listItemPrefixWhitespace'
+ ) ; else {
+ atMarker = undefined;
+ }
+ if (
+ (!containerBalance &&
+ event[0] === 'enter' &&
+ event[1].type === 'listItemPrefix') ||
+ (containerBalance === -1 &&
+ event[0] === 'exit' &&
+ (event[1].type === 'listUnordered' ||
+ event[1].type === 'listOrdered'))
+ ) {
+ if (listItem) {
+ let tailIndex = index;
+ lineIndex = undefined;
+ while (tailIndex--) {
+ const tailEvent = events[tailIndex];
+ if (
+ tailEvent[1].type === 'lineEnding' ||
+ tailEvent[1].type === 'lineEndingBlank'
+ ) {
+ if (tailEvent[0] === 'exit') continue
+ if (lineIndex) {
+ events[lineIndex][1].type = 'lineEndingBlank';
+ listSpread = true;
+ }
+ tailEvent[1].type = 'lineEnding';
+ lineIndex = tailIndex;
+ } else if (
+ tailEvent[1].type === 'linePrefix' ||
+ tailEvent[1].type === 'blockQuotePrefix' ||
+ tailEvent[1].type === 'blockQuotePrefixWhitespace' ||
+ tailEvent[1].type === 'blockQuoteMarker' ||
+ tailEvent[1].type === 'listItemIndent'
+ ) ; else {
+ break
+ }
+ }
+ if (
+ firstBlankLineIndex &&
+ (!lineIndex || firstBlankLineIndex < lineIndex)
+ ) {
+ listItem._spread = true;
+ }
+
+ // Fix position.
+ listItem.end = Object.assign(
+ {},
+ lineIndex ? events[lineIndex][1].start : event[1].end
+ );
+ events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);
+ index++;
+ length++;
+ }
+
+ // Create a new list item.
+ if (event[1].type === 'listItemPrefix') {
+ listItem = {
+ type: 'listItem',
+ _spread: false,
+ start: Object.assign({}, event[1].start),
+ // @ts-expect-error: we’ll add `end` in a second.
+ end: undefined
+ };
+ // @ts-expect-error: `listItem` is most definitely defined, TS...
+ events.splice(index, 0, ['enter', listItem, event[2]]);
+ index++;
+ length++;
+ firstBlankLineIndex = undefined;
+ atMarker = true;
+ }
+ }
+ }
+ events[start][1]._spread = listSpread;
+ return length
+ }
+
+ /**
+ * Set data.
+ *
+ * @template {keyof CompileData} Key
+ * Field type.
+ * @param {Key} key
+ * Key of field.
+ * @param {CompileData[Key]} [value]
+ * New value.
+ * @returns {void}
+ * Nothing.
+ */
+ function setData(key, value) {
+ data[key] = value;
+ }
+
+ /**
+ * Get data.
+ *
+ * @template {keyof CompileData} Key
+ * Field type.
+ * @param {Key} key
+ * Key of field.
+ * @returns {CompileData[Key]}
+ * Value.
+ */
+ function getData(key) {
+ return data[key]
+ }
+
+ /**
+ * Create an opener handle.
+ *
+ * @param {(token: Token) => Node} create
+ * Create a node.
+ * @param {Handle} [and]
+ * Optional function to also run.
+ * @returns {Handle}
+ * Handle.
+ */
+ function opener(create, and) {
+ return open
+
+ /**
+ * @this {CompileContext}
+ * @param {Token} token
+ * @returns {void}
+ */
+ function open(token) {
+ enter.call(this, create(token), token);
+ if (and) and.call(this, token);
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @returns {void}
+ */
+ function buffer() {
+ this.stack.push({
+ type: 'fragment',
+ children: []
+ });
+ }
+
+ /**
+ * @template {Node} Kind
+ * Node type.
+ * @this {CompileContext}
+ * Context.
+ * @param {Kind} node
+ * Node to enter.
+ * @param {Token} token
+ * Corresponding token.
+ * @param {OnEnterError | undefined} [errorHandler]
+ * Handle the case where this token is open, but it is closed by something else.
+ * @returns {Kind}
+ * The given node.
+ */
+ function enter(node, token, errorHandler) {
+ const parent = this.stack[this.stack.length - 1];
+ // @ts-expect-error: Assume `Node` can exist as a child of `parent`.
+ parent.children.push(node);
+ this.stack.push(node);
+ this.tokenStack.push([token, errorHandler]);
+ // @ts-expect-error: `end` will be patched later.
+ node.position = {
+ start: point(token.start)
+ };
+ return node
+ }
+
+ /**
+ * Create a closer handle.
+ *
+ * @param {Handle} [and]
+ * Optional function to also run.
+ * @returns {Handle}
+ * Handle.
+ */
+ function closer(and) {
+ return close
+
+ /**
+ * @this {CompileContext}
+ * @param {Token} token
+ * @returns {void}
+ */
+ function close(token) {
+ if (and) and.call(this, token);
+ exit.call(this, token);
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * Context.
+ * @param {Token} token
+ * Corresponding token.
+ * @param {OnExitError | undefined} [onExitError]
+ * Handle the case where another token is open.
+ * @returns {Node}
+ * The closed node.
+ */
+ function exit(token, onExitError) {
+ const node = this.stack.pop();
+ const open = this.tokenStack.pop();
+ if (!open) {
+ throw new Error(
+ 'Cannot close `' +
+ token.type +
+ '` (' +
+ stringifyPosition({
+ start: token.start,
+ end: token.end
+ }) +
+ '): it’s not open'
+ )
+ } else if (open[0].type !== token.type) {
+ if (onExitError) {
+ onExitError.call(this, token, open[0]);
+ } else {
+ const handler = open[1] || defaultOnError;
+ handler.call(this, token, open[0]);
+ }
+ }
+ node.position.end = point(token.end);
+ return node
+ }
+
+ /**
+ * @this {CompileContext}
+ * @returns {string}
+ */
+ function resume() {
+ return toString(this.stack.pop())
+ }
+
+ //
+ // Handlers.
+ //
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onenterlistordered() {
+ setData('expectingFirstListItemValue', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onenterlistitemvalue(token) {
+ if (getData('expectingFirstListItemValue')) {
+ const ancestor = this.stack[this.stack.length - 2];
+ ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);
+ setData('expectingFirstListItemValue');
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefencedfenceinfo() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.lang = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefencedfencemeta() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.meta = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefencedfence() {
+ // Exit if this is the closing fence.
+ if (getData('flowCodeInside')) return
+ this.buffer();
+ setData('flowCodeInside', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodefenced() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, '');
+ setData('flowCodeInside');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcodeindented() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data.replace(/(\r?\n|\r)$/g, '');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitdefinitionlabelstring(token) {
+ const label = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.label = label;
+ node.identifier = normalizeIdentifier(
+ this.sliceSerialize(token)
+ ).toLowerCase();
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitdefinitiontitlestring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.title = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitdefinitiondestinationstring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.url = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitatxheadingsequence(token) {
+ const node = this.stack[this.stack.length - 1];
+ if (!node.depth) {
+ const depth = this.sliceSerialize(token).length;
+ node.depth = depth;
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitsetextheadingtext() {
+ setData('setextHeadingSlurpLineEnding', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitsetextheadinglinesequence(token) {
+ const node = this.stack[this.stack.length - 1];
+ node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitsetextheading() {
+ setData('setextHeadingSlurpLineEnding');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onenterdata(token) {
+ const node = this.stack[this.stack.length - 1];
+ let tail = node.children[node.children.length - 1];
+ if (!tail || tail.type !== 'text') {
+ // Add a new text node.
+ tail = text();
+ // @ts-expect-error: we’ll add `end` later.
+ tail.position = {
+ start: point(token.start)
+ };
+ // @ts-expect-error: Assume `parent` accepts `text`.
+ node.children.push(tail);
+ }
+ this.stack.push(tail);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitdata(token) {
+ const tail = this.stack.pop();
+ tail.value += this.sliceSerialize(token);
+ tail.position.end = point(token.end);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlineending(token) {
+ const context = this.stack[this.stack.length - 1];
+ // If we’re at a hard break, include the line ending in there.
+ if (getData('atHardBreak')) {
+ const tail = context.children[context.children.length - 1];
+ tail.position.end = point(token.end);
+ setData('atHardBreak');
+ return
+ }
+ if (
+ !getData('setextHeadingSlurpLineEnding') &&
+ config.canContainEols.includes(context.type)
+ ) {
+ onenterdata.call(this, token);
+ onexitdata.call(this, token);
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexithardbreak() {
+ setData('atHardBreak', true);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexithtmlflow() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexithtmltext() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitcodetext() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.value = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlink() {
+ const node = this.stack[this.stack.length - 1];
+ // Note: there are also `identifier` and `label` fields on this link node!
+ // These are used / cleaned here.
+ // To do: clean.
+ if (getData('inReference')) {
+ /** @type {ReferenceType} */
+ const referenceType = getData('referenceType') || 'shortcut';
+ node.type += 'Reference';
+ // @ts-expect-error: mutate.
+ node.referenceType = referenceType;
+ // @ts-expect-error: mutate.
+ delete node.url;
+ delete node.title;
+ } else {
+ // @ts-expect-error: mutate.
+ delete node.identifier;
+ // @ts-expect-error: mutate.
+ delete node.label;
+ }
+ setData('referenceType');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitimage() {
+ const node = this.stack[this.stack.length - 1];
+ // Note: there are also `identifier` and `label` fields on this link node!
+ // These are used / cleaned here.
+ // To do: clean.
+ if (getData('inReference')) {
+ /** @type {ReferenceType} */
+ const referenceType = getData('referenceType') || 'shortcut';
+ node.type += 'Reference';
+ // @ts-expect-error: mutate.
+ node.referenceType = referenceType;
+ // @ts-expect-error: mutate.
+ delete node.url;
+ delete node.title;
+ } else {
+ // @ts-expect-error: mutate.
+ delete node.identifier;
+ // @ts-expect-error: mutate.
+ delete node.label;
+ }
+ setData('referenceType');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlabeltext(token) {
+ const string = this.sliceSerialize(token);
+ const ancestor = this.stack[this.stack.length - 2];
+ // @ts-expect-error: stash this on the node, as it might become a reference
+ // later.
+ ancestor.label = decodeString(string);
+ // @ts-expect-error: same as above.
+ ancestor.identifier = normalizeIdentifier(string).toLowerCase();
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitlabel() {
+ const fragment = this.stack[this.stack.length - 1];
+ const value = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ // Assume a reference.
+ setData('inReference', true);
+ if (node.type === 'link') {
+ /** @type {Array} */
+ // @ts-expect-error: Assume static phrasing content.
+ const children = fragment.children;
+ node.children = children;
+ } else {
+ node.alt = value;
+ }
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitresourcedestinationstring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.url = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitresourcetitlestring() {
+ const data = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ node.title = data;
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitresource() {
+ setData('inReference');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onenterreference() {
+ setData('referenceType', 'collapsed');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitreferencestring(token) {
+ const label = this.resume();
+ const node = this.stack[this.stack.length - 1];
+ // @ts-expect-error: stash this on the node, as it might become a reference
+ // later.
+ node.label = label;
+ // @ts-expect-error: same as above.
+ node.identifier = normalizeIdentifier(
+ this.sliceSerialize(token)
+ ).toLowerCase();
+ setData('referenceType', 'full');
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+
+ function onexitcharacterreferencemarker(token) {
+ setData('characterReferenceType', token.type);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitcharacterreferencevalue(token) {
+ const data = this.sliceSerialize(token);
+ const type = getData('characterReferenceType');
+ /** @type {string} */
+ let value;
+ if (type) {
+ value = decodeNumericCharacterReference(
+ data,
+ type === 'characterReferenceMarkerNumeric' ? 10 : 16
+ );
+ setData('characterReferenceType');
+ } else {
+ const result = decodeNamedCharacterReference(data);
+ value = result;
+ }
+ const tail = this.stack.pop();
+ tail.value += value;
+ tail.position.end = point(token.end);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitautolinkprotocol(token) {
+ onexitdata.call(this, token);
+ const node = this.stack[this.stack.length - 1];
+ node.url = this.sliceSerialize(token);
+ }
+
+ /**
+ * @this {CompileContext}
+ * @type {Handle}
+ */
+ function onexitautolinkemail(token) {
+ onexitdata.call(this, token);
+ const node = this.stack[this.stack.length - 1];
+ node.url = 'mailto:' + this.sliceSerialize(token);
+ }
+
+ //
+ // Creaters.
+ //
+
+ /** @returns {Blockquote} */
+ function blockQuote() {
+ return {
+ type: 'blockquote',
+ children: []
+ }
+ }
+
+ /** @returns {Code} */
+ function codeFlow() {
+ return {
+ type: 'code',
+ lang: null,
+ meta: null,
+ value: ''
+ }
+ }
+
+ /** @returns {InlineCode} */
+ function codeText() {
+ return {
+ type: 'inlineCode',
+ value: ''
+ }
+ }
+
+ /** @returns {Definition} */
+ function definition() {
+ return {
+ type: 'definition',
+ identifier: '',
+ label: null,
+ title: null,
+ url: ''
+ }
+ }
+
+ /** @returns {Emphasis} */
+ function emphasis() {
+ return {
+ type: 'emphasis',
+ children: []
+ }
+ }
+
+ /** @returns {Heading} */
+ function heading() {
+ // @ts-expect-error `depth` will be set later.
+ return {
+ type: 'heading',
+ depth: undefined,
+ children: []
+ }
+ }
+
+ /** @returns {Break} */
+ function hardBreak() {
+ return {
+ type: 'break'
+ }
+ }
+
+ /** @returns {HTML} */
+ function html() {
+ return {
+ type: 'html',
+ value: ''
+ }
+ }
+
+ /** @returns {Image} */
+ function image() {
+ return {
+ type: 'image',
+ title: null,
+ url: '',
+ alt: null
+ }
+ }
+
+ /** @returns {Link} */
+ function link() {
+ return {
+ type: 'link',
+ title: null,
+ url: '',
+ children: []
+ }
+ }
+
+ /**
+ * @param {Token} token
+ * @returns {List}
+ */
+ function list(token) {
+ return {
+ type: 'list',
+ ordered: token.type === 'listOrdered',
+ start: null,
+ spread: token._spread,
+ children: []
+ }
+ }
+
+ /**
+ * @param {Token} token
+ * @returns {ListItem}
+ */
+ function listItem(token) {
+ return {
+ type: 'listItem',
+ spread: token._spread,
+ checked: null,
+ children: []
+ }
+ }
+
+ /** @returns {Paragraph} */
+ function paragraph() {
+ return {
+ type: 'paragraph',
+ children: []
+ }
+ }
+
+ /** @returns {Strong} */
+ function strong() {
+ return {
+ type: 'strong',
+ children: []
+ }
+ }
+
+ /** @returns {Text} */
+ function text() {
+ return {
+ type: 'text',
+ value: ''
+ }
+ }
+
+ /** @returns {ThematicBreak} */
+ function thematicBreak() {
+ return {
+ type: 'thematicBreak'
+ }
+ }
+}
+
+/**
+ * Copy a point-like value.
+ *
+ * @param {Point} d
+ * Point-like value.
+ * @returns {Point}
+ * unist point.
+ */
+function point(d) {
+ return {
+ line: d.line,
+ column: d.column,
+ offset: d.offset
+ }
+}
+
+/**
+ * @param {Config} combined
+ * @param {Array>} extensions
+ * @returns {void}
+ */
+function configure(combined, extensions) {
+ let index = -1;
+ while (++index < extensions.length) {
+ const value = extensions[index];
+ if (Array.isArray(value)) {
+ configure(combined, value);
+ } else {
+ extension(combined, value);
+ }
+ }
+}
+
+/**
+ * @param {Config} combined
+ * @param {Extension} extension
+ * @returns {void}
+ */
+function extension(combined, extension) {
+ /** @type {keyof Extension} */
+ let key;
+ for (key in extension) {
+ if (own.call(extension, key)) {
+ if (key === 'canContainEols') {
+ const right = extension[key];
+ if (right) {
+ combined[key].push(...right);
+ }
+ } else if (key === 'transforms') {
+ const right = extension[key];
+ if (right) {
+ combined[key].push(...right);
+ }
+ } else if (key === 'enter' || key === 'exit') {
+ const right = extension[key];
+ if (right) {
+ Object.assign(combined[key], right);
+ }
+ }
+ }
+ }
+}
+
+/** @type {OnEnterError} */
+function defaultOnError(left, right) {
+ if (left) {
+ throw new Error(
+ 'Cannot close `' +
+ left.type +
+ '` (' +
+ stringifyPosition({
+ start: left.start,
+ end: left.end
+ }) +
+ '): a different token (`' +
+ right.type +
+ '`, ' +
+ stringifyPosition({
+ start: right.start,
+ end: right.end
+ }) +
+ ') is open'
+ )
+ } else {
+ throw new Error(
+ 'Cannot close document, a token (`' +
+ right.type +
+ '`, ' +
+ stringifyPosition({
+ start: right.start,
+ end: right.end
+ }) +
+ ') is still open'
+ )
+ }
+}
+
+function preprocessMarkdown(markdown) {
+ const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n");
+ const withoutExtraSpaces = dedent(withoutMultipleNewlines);
+ return withoutExtraSpaces;
+}
+function markdownToLines(markdown) {
+ const preprocessedMarkdown = preprocessMarkdown(markdown);
+ const { children } = fromMarkdown(preprocessedMarkdown);
+ const lines = [[]];
+ let currentLine = 0;
+ function processNode(node, parentType = "normal") {
+ if (node.type === "text") {
+ const textLines = node.value.split("\n");
+ textLines.forEach((textLine, index) => {
+ if (index !== 0) {
+ currentLine++;
+ lines.push([]);
+ }
+ textLine.split(" ").forEach((word) => {
+ if (word) {
+ lines[currentLine].push({ content: word, type: parentType });
+ }
+ });
+ });
+ } else if (node.type === "strong" || node.type === "emphasis") {
+ node.children.forEach((contentNode) => {
+ processNode(contentNode, node.type);
+ });
+ }
+ }
+ children.forEach((treeNode) => {
+ if (treeNode.type === "paragraph") {
+ treeNode.children.forEach((contentNode) => {
+ processNode(contentNode);
+ });
+ }
+ });
+ return lines;
+}
+function markdownToHTML(markdown) {
+ const { children } = fromMarkdown(markdown);
+ function output(node) {
+ if (node.type === "text") {
+ return node.value.replace(/\n/g, "
");
+ } else if (node.type === "strong") {
+ return `${node.children.map(output).join("")}`;
+ } else if (node.type === "emphasis") {
+ return `${node.children.map(output).join("")}`;
+ } else if (node.type === "paragraph") {
+ return `${node.children.map(output).join("")}
`;
+ }
+ return `Unsupported markdown: ${node.type}`;
+ }
+ return children.map(output).join("");
+}
+function splitTextToChars(text) {
+ if (Intl.Segmenter) {
+ return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);
+ }
+ return [...text];
+}
+function splitWordToFitWidth(checkFit, word) {
+ const characters = splitTextToChars(word.content);
+ return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);
+}
+function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) {
+ if (remainingChars.length === 0) {
+ return [
+ { content: usedChars.join(""), type },
+ { content: "", type }
+ ];
+ }
+ const [nextChar, ...rest] = remainingChars;
+ const newWord = [...usedChars, nextChar];
+ if (checkFit([{ content: newWord.join(""), type }])) {
+ return splitWordToFitWidthRecursion(checkFit, newWord, rest, type);
+ }
+ if (usedChars.length === 0 && nextChar) {
+ usedChars.push(nextChar);
+ remainingChars.shift();
+ }
+ return [
+ { content: usedChars.join(""), type },
+ { content: remainingChars.join(""), type }
+ ];
+}
+function splitLineToFitWidth(line, checkFit) {
+ if (line.some(({ content }) => content.includes("\n"))) {
+ throw new Error("splitLineToFitWidth does not support newlines in the line");
+ }
+ return splitLineToFitWidthRecursion(line, checkFit);
+}
+function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
+ if (words.length === 0) {
+ if (newLine.length > 0) {
+ lines.push(newLine);
+ }
+ return lines.length > 0 ? lines : [];
+ }
+ let joiner = "";
+ if (words[0].content === " ") {
+ joiner = " ";
+ words.shift();
+ }
+ const nextWord = words.shift() ?? { content: " ", type: "normal" };
+ const lineWithNextWord = [...newLine];
+ if (joiner !== "") {
+ lineWithNextWord.push({ content: joiner, type: "normal" });
+ }
+ lineWithNextWord.push(nextWord);
+ if (checkFit(lineWithNextWord)) {
+ return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);
+ }
+ if (newLine.length > 0) {
+ lines.push(newLine);
+ words.unshift(nextWord);
+ } else if (nextWord.content) {
+ const [line, rest] = splitWordToFitWidth(checkFit, nextWord);
+ lines.push([line]);
+ if (rest.content) {
+ words.unshift(rest);
+ }
+ }
+ return splitLineToFitWidthRecursion(words, checkFit, lines);
+}
+function applyStyle(dom, styleFn) {
+ if (styleFn) {
+ dom.attr("style", styleFn);
+ }
+}
+function addHtmlSpan(element, node, width, classes, addBackground = false) {
+ const fo = element.append("foreignObject");
+ const div = fo.append("xhtml:div");
+ const label = node.label;
+ const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
+ div.html(
+ `
+ " + label + ""
+ );
+ applyStyle(div, node.labelStyle);
+ div.style("display", "table-cell");
+ div.style("white-space", "nowrap");
+ div.style("max-width", width + "px");
+ div.attr("xmlns", "http://www.w3.org/1999/xhtml");
+ if (addBackground) {
+ div.attr("class", "labelBkg");
+ }
+ let bbox = div.node().getBoundingClientRect();
+ if (bbox.width === width) {
+ div.style("display", "table");
+ div.style("white-space", "break-spaces");
+ div.style("width", width + "px");
+ bbox = div.node().getBoundingClientRect();
+ }
+ fo.style("width", bbox.width);
+ fo.style("height", bbox.height);
+ return fo.node();
+}
+function createTspan(textElement, lineIndex, lineHeight) {
+ return textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
+}
+function computeWidthOfText(parentNode, lineHeight, line) {
+ const testElement = parentNode.append("text");
+ const testSpan = createTspan(testElement, 1, lineHeight);
+ updateTextContentAndStyles(testSpan, line);
+ const textLength = testSpan.node().getComputedTextLength();
+ testElement.remove();
+ return textLength;
+}
+function computeDimensionOfText(parentNode, lineHeight, text) {
+ var _a;
+ const testElement = parentNode.append("text");
+ const testSpan = createTspan(testElement, 1, lineHeight);
+ updateTextContentAndStyles(testSpan, [{ content: text, type: "normal" }]);
+ const textDimension = (_a = testSpan.node()) == null ? void 0 : _a.getBoundingClientRect();
+ if (textDimension) {
+ testElement.remove();
+ }
+ return textDimension;
+}
+function createFormattedText(width, g, structuredText, addBackground = false) {
+ const lineHeight = 1.1;
+ const labelGroup = g.append("g");
+ const bkg = labelGroup.insert("rect").attr("class", "background");
+ const textElement = labelGroup.append("text").attr("y", "-10.1");
+ let lineIndex = 0;
+ for (const line of structuredText) {
+ const checkWidth = (line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width;
+ const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);
+ for (const preparedLine of linesUnderWidth) {
+ const tspan = createTspan(textElement, lineIndex, lineHeight);
+ updateTextContentAndStyles(tspan, preparedLine);
+ lineIndex++;
+ }
+ }
+ if (addBackground) {
+ const bbox = textElement.node().getBBox();
+ const padding = 2;
+ bkg.attr("x", -padding).attr("y", -padding).attr("width", bbox.width + 2 * padding).attr("height", bbox.height + 2 * padding);
+ return labelGroup.node();
+ } else {
+ return textElement.node();
+ }
+}
+function updateTextContentAndStyles(tspan, wrappedLine) {
+ tspan.text("");
+ wrappedLine.forEach((word, index) => {
+ const innerTspan = tspan.append("tspan").attr("font-style", word.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
+ if (index === 0) {
+ innerTspan.text(word.content);
+ } else {
+ innerTspan.text(" " + word.content);
+ }
+ });
+}
+const createText = (el, text = "", {
+ style = "",
+ isTitle = false,
+ classes = "",
+ useHtmlLabels = true,
+ isNode = true,
+ width = 200,
+ addSvgBackground = false
+} = {}) => {
+ log$1.info("createText", text, style, isTitle, classes, useHtmlLabels, isNode, addSvgBackground);
+ if (useHtmlLabels) {
+ const htmlText = markdownToHTML(text);
+ const node = {
+ isNode,
+ label: decodeEntities(htmlText).replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell: disable-line
+ (s) => ``
+ ),
+ labelStyle: style.replace("fill:", "color:")
+ };
+ const vertexNode = addHtmlSpan(el, node, width, classes, addSvgBackground);
+ return vertexNode;
+ } else {
+ const structuredText = markdownToLines(text);
+ const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground);
+ return svgLabel;
+ }
+};
+
+export { createText as a, computeDimensionOfText as c };
diff --git a/libs/marked/edges-066a5561-Bqw9g7uz.js b/libs/marked/edges-066a5561-Bqw9g7uz.js
new file mode 100644
index 0000000..3d25270
--- /dev/null
+++ b/libs/marked/edges-066a5561-Bqw9g7uz.js
@@ -0,0 +1,1825 @@
+import { p as evaluate, c as getConfig, d as sanitizeText$2, b6 as decodeEntities, h as select, l as log$1, A as utils, F as curveBasis } from './index-Bd_FDXSq.js';
+import { a as createText } from './createText-ca0c5216-B9KlDTE8.js';
+import { l as line } from './line-DUwhS6kk.js';
+
+const insertMarkers = (elem, markerArray, type, id) => {
+ markerArray.forEach((markerName) => {
+ markers[markerName](elem, type, id);
+ });
+};
+const extension = (elem, type, id) => {
+ log$1.trace("Making markers for ", id);
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionStart").attr("class", "marker extension " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionEnd").attr("class", "marker extension " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
+};
+const composition = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionStart").attr("class", "marker composition " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionEnd").attr("class", "marker composition " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+};
+const aggregation = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationStart").attr("class", "marker aggregation " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationEnd").attr("class", "marker aggregation " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+};
+const dependency = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyStart").attr("class", "marker dependency " + type).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyEnd").attr("class", "marker dependency " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
+};
+const lollipop = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopStart").attr("class", "marker lollipop " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopEnd").attr("class", "marker lollipop " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+};
+const point = (elem, type, id) => {
+ elem.append("marker").attr("id", id + "_" + type + "-pointEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+ elem.append("marker").attr("id", id + "_" + type + "-pointStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+};
+const circle$1 = (elem, type, id) => {
+ elem.append("marker").attr("id", id + "_" + type + "-circleEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+ elem.append("marker").attr("id", id + "_" + type + "-circleStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+};
+const cross = (elem, type, id) => {
+ elem.append("marker").attr("id", id + "_" + type + "-crossEnd").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+ elem.append("marker").attr("id", id + "_" + type + "-crossStart").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+};
+const barb = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
+};
+const markers = {
+ extension,
+ composition,
+ aggregation,
+ dependency,
+ lollipop,
+ point,
+ circle: circle$1,
+ cross,
+ barb
+};
+const insertMarkers$1 = insertMarkers;
+function applyStyle(dom, styleFn) {
+ if (styleFn) {
+ dom.attr("style", styleFn);
+ }
+}
+function addHtmlLabel(node) {
+ const fo = select(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"));
+ const div = fo.append("xhtml:div");
+ const label = node.label;
+ const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
+ div.html(
+ '" + label + ""
+ );
+ applyStyle(div, node.labelStyle);
+ div.style("display", "inline-block");
+ div.style("white-space", "nowrap");
+ div.attr("xmlns", "http://www.w3.org/1999/xhtml");
+ return fo.node();
+}
+const createLabel = (_vertexText, style, isTitle, isNode) => {
+ let vertexText = _vertexText || "";
+ if (typeof vertexText === "object") {
+ vertexText = vertexText[0];
+ }
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ vertexText = vertexText.replace(/\\n|\n/g, "
");
+ log$1.debug("vertexText" + vertexText);
+ const node = {
+ isNode,
+ label: decodeEntities(vertexText).replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell: disable-line
+ (s) => ``
+ ),
+ labelStyle: style.replace("fill:", "color:")
+ };
+ let vertexNode = addHtmlLabel(node);
+ return vertexNode;
+ } else {
+ const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
+ svgLabel.setAttribute("style", style.replace("color:", "fill:"));
+ let rows = [];
+ if (typeof vertexText === "string") {
+ rows = vertexText.split(/\\n|\n|
/gi);
+ } else if (Array.isArray(vertexText)) {
+ rows = vertexText;
+ } else {
+ rows = [];
+ }
+ for (const row of rows) {
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
+ tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+ tspan.setAttribute("dy", "1em");
+ tspan.setAttribute("x", "0");
+ if (isTitle) {
+ tspan.setAttribute("class", "title-row");
+ } else {
+ tspan.setAttribute("class", "row");
+ }
+ tspan.textContent = row.trim();
+ svgLabel.appendChild(tspan);
+ }
+ return svgLabel;
+ }
+};
+const createLabel$1 = createLabel;
+const labelHelper = async (parent, node, _classes, isNode) => {
+ let classes;
+ const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig().flowchart.htmlLabels);
+ if (!_classes) {
+ classes = "node default";
+ } else {
+ classes = _classes;
+ }
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+ const label = shapeSvg.insert("g").attr("class", "label").attr("style", node.labelStyle);
+ let labelText;
+ if (node.labelText === void 0) {
+ labelText = "";
+ } else {
+ labelText = typeof node.labelText === "string" ? node.labelText : node.labelText[0];
+ }
+ const textNode = label.node();
+ let text;
+ if (node.labelType === "markdown") {
+ text = createText(label, sanitizeText$2(decodeEntities(labelText), getConfig()), {
+ useHtmlLabels,
+ width: node.width || getConfig().flowchart.wrappingWidth,
+ classes: "markdown-node-label"
+ });
+ } else {
+ text = textNode.appendChild(
+ createLabel$1(
+ sanitizeText$2(decodeEntities(labelText), getConfig()),
+ node.labelStyle,
+ false,
+ isNode
+ )
+ );
+ }
+ let bbox = text.getBBox();
+ const halfPadding = node.padding / 2;
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = text.children[0];
+ const dv = select(text);
+ const images = div.getElementsByTagName("img");
+ if (images) {
+ const noImgText = labelText.replace(/]*>/g, "").trim() === "";
+ await Promise.all(
+ [...images].map(
+ (img) => new Promise((res) => {
+ function setupImage() {
+ img.style.display = "flex";
+ img.style.flexDirection = "column";
+ if (noImgText) {
+ const bodyFontSize = getConfig().fontSize ? getConfig().fontSize : window.getComputedStyle(document.body).fontSize;
+ const enlargingFactor = 5;
+ const width = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
+ img.style.minWidth = width;
+ img.style.maxWidth = width;
+ } else {
+ img.style.width = "100%";
+ }
+ res(img);
+ }
+ setTimeout(() => {
+ if (img.complete) {
+ setupImage();
+ }
+ });
+ img.addEventListener("error", setupImage);
+ img.addEventListener("load", setupImage);
+ })
+ )
+ );
+ }
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ if (useHtmlLabels) {
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+ } else {
+ label.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
+ }
+ if (node.centerLabel) {
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+ }
+ label.insert("rect", ":first-child");
+ return { shapeSvg, bbox, halfPadding, label };
+};
+const updateNodeBounds = (node, element) => {
+ const bbox = element.node().getBBox();
+ node.width = bbox.width;
+ node.height = bbox.height;
+};
+function insertPolygonShape(parent, w, h, points) {
+ return parent.insert("polygon", ":first-child").attr(
+ "points",
+ points.map(function(d) {
+ return d.x + "," + d.y;
+ }).join(" ")
+ ).attr("class", "label-container").attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
+}
+function intersectNode(node, point2) {
+ return node.intersect(point2);
+}
+function intersectEllipse(node, rx, ry, point2) {
+ var cx = node.x;
+ var cy = node.y;
+ var px = cx - point2.x;
+ var py = cy - point2.y;
+ var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+ var dx = Math.abs(rx * ry * px / det);
+ if (point2.x < cx) {
+ dx = -dx;
+ }
+ var dy = Math.abs(rx * ry * py / det);
+ if (point2.y < cy) {
+ dy = -dy;
+ }
+ return { x: cx + dx, y: cy + dy };
+}
+function intersectCircle(node, rx, point2) {
+ return intersectEllipse(node, rx, rx, point2);
+}
+function intersectLine(p1, p2, q1, q2) {
+ var a1, a2, b1, b2, c1, c2;
+ var r1, r2, r3, r4;
+ var denom, offset, num;
+ var x, y;
+ a1 = p2.y - p1.y;
+ b1 = p1.x - p2.x;
+ c1 = p2.x * p1.y - p1.x * p2.y;
+ r3 = a1 * q1.x + b1 * q1.y + c1;
+ r4 = a1 * q2.x + b1 * q2.y + c1;
+ if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
+ return;
+ }
+ a2 = q2.y - q1.y;
+ b2 = q1.x - q2.x;
+ c2 = q2.x * q1.y - q1.x * q2.y;
+ r1 = a2 * p1.x + b2 * p1.y + c2;
+ r2 = a2 * p2.x + b2 * p2.y + c2;
+ if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
+ return;
+ }
+ denom = a1 * b2 - a2 * b1;
+ if (denom === 0) {
+ return;
+ }
+ offset = Math.abs(denom / 2);
+ num = b1 * c2 - b2 * c1;
+ x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+ num = a2 * c1 - a1 * c2;
+ y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+ return { x, y };
+}
+function sameSign(r1, r2) {
+ return r1 * r2 > 0;
+}
+function intersectPolygon(node, polyPoints, point2) {
+ var x1 = node.x;
+ var y1 = node.y;
+ var intersections = [];
+ var minX = Number.POSITIVE_INFINITY;
+ var minY = Number.POSITIVE_INFINITY;
+ if (typeof polyPoints.forEach === "function") {
+ polyPoints.forEach(function(entry) {
+ minX = Math.min(minX, entry.x);
+ minY = Math.min(minY, entry.y);
+ });
+ } else {
+ minX = Math.min(minX, polyPoints.x);
+ minY = Math.min(minY, polyPoints.y);
+ }
+ var left = x1 - node.width / 2 - minX;
+ var top = y1 - node.height / 2 - minY;
+ for (var i = 0; i < polyPoints.length; i++) {
+ var p1 = polyPoints[i];
+ var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+ var intersect2 = intersectLine(
+ node,
+ point2,
+ { x: left + p1.x, y: top + p1.y },
+ { x: left + p2.x, y: top + p2.y }
+ );
+ if (intersect2) {
+ intersections.push(intersect2);
+ }
+ }
+ if (!intersections.length) {
+ return node;
+ }
+ if (intersections.length > 1) {
+ intersections.sort(function(p, q) {
+ var pdx = p.x - point2.x;
+ var pdy = p.y - point2.y;
+ var distp = Math.sqrt(pdx * pdx + pdy * pdy);
+ var qdx = q.x - point2.x;
+ var qdy = q.y - point2.y;
+ var distq = Math.sqrt(qdx * qdx + qdy * qdy);
+ return distp < distq ? -1 : distp === distq ? 0 : 1;
+ });
+ }
+ return intersections[0];
+}
+const intersectRect = (node, point2) => {
+ var x = node.x;
+ var y = node.y;
+ var dx = point2.x - x;
+ var dy = point2.y - y;
+ var w = node.width / 2;
+ var h = node.height / 2;
+ var sx, sy;
+ if (Math.abs(dy) * w > Math.abs(dx) * h) {
+ if (dy < 0) {
+ h = -h;
+ }
+ sx = dy === 0 ? 0 : h * dx / dy;
+ sy = h;
+ } else {
+ if (dx < 0) {
+ w = -w;
+ }
+ sx = w;
+ sy = dx === 0 ? 0 : w * dy / dx;
+ }
+ return { x: x + sx, y: y + sy };
+};
+const intersectRect$1 = intersectRect;
+const intersect = {
+ node: intersectNode,
+ circle: intersectCircle,
+ ellipse: intersectEllipse,
+ polygon: intersectPolygon,
+ rect: intersectRect$1
+};
+const note = async (parent, node) => {
+ const useHtmlLabels = node.useHtmlLabels || getConfig().flowchart.htmlLabels;
+ if (!useHtmlLabels) {
+ node.centerLabel = true;
+ }
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ "node " + node.classes,
+ true
+ );
+ log$1.info("Classes = ", node.classes);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const note$1 = note;
+const expandAndDeduplicateDirections = (directions) => {
+ const uniqueDirections = /* @__PURE__ */ new Set();
+ for (const direction of directions) {
+ switch (direction) {
+ case "x":
+ uniqueDirections.add("right");
+ uniqueDirections.add("left");
+ break;
+ case "y":
+ uniqueDirections.add("up");
+ uniqueDirections.add("down");
+ break;
+ default:
+ uniqueDirections.add(direction);
+ break;
+ }
+ }
+ return uniqueDirections;
+};
+const getArrowPoints = (duplicatedDirections, bbox, node) => {
+ const directions = expandAndDeduplicateDirections(duplicatedDirections);
+ const f = 2;
+ const height = bbox.height + 2 * node.padding;
+ const midpoint = height / f;
+ const width = bbox.width + 2 * midpoint + node.padding;
+ const padding = node.padding / 2;
+ if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) {
+ return [
+ // Bottom
+ { x: 0, y: 0 },
+ { x: midpoint, y: 0 },
+ { x: width / 2, y: 2 * padding },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: 0 },
+ // Right
+ { x: width, y: -height / 3 },
+ { x: width + 2 * padding, y: -height / 2 },
+ { x: width, y: -2 * height / 3 },
+ { x: width, y: -height },
+ // Top
+ { x: width - midpoint, y: -height },
+ { x: width / 2, y: -height - 2 * padding },
+ { x: midpoint, y: -height },
+ // Left
+ { x: 0, y: -height },
+ { x: 0, y: -2 * height / 3 },
+ { x: -2 * padding, y: -height / 2 },
+ { x: 0, y: -height / 3 }
+ ];
+ }
+ if (directions.has("right") && directions.has("left") && directions.has("up")) {
+ return [
+ { x: midpoint, y: 0 },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: -height / 2 },
+ { x: width - midpoint, y: -height },
+ { x: midpoint, y: -height },
+ { x: 0, y: -height / 2 }
+ ];
+ }
+ if (directions.has("right") && directions.has("left") && directions.has("down")) {
+ return [
+ { x: 0, y: 0 },
+ { x: midpoint, y: -height },
+ { x: width - midpoint, y: -height },
+ { x: width, y: 0 }
+ ];
+ }
+ if (directions.has("right") && directions.has("up") && directions.has("down")) {
+ return [
+ { x: 0, y: 0 },
+ { x: width, y: -midpoint },
+ { x: width, y: -height + midpoint },
+ { x: 0, y: -height }
+ ];
+ }
+ if (directions.has("left") && directions.has("up") && directions.has("down")) {
+ return [
+ { x: width, y: 0 },
+ { x: 0, y: -midpoint },
+ { x: 0, y: -height + midpoint },
+ { x: width, y: -height }
+ ];
+ }
+ if (directions.has("right") && directions.has("left")) {
+ return [
+ { x: midpoint, y: 0 },
+ { x: midpoint, y: -padding },
+ { x: width - midpoint, y: -padding },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: -height / 2 },
+ { x: width - midpoint, y: -height },
+ { x: width - midpoint, y: -height + padding },
+ { x: midpoint, y: -height + padding },
+ { x: midpoint, y: -height },
+ { x: 0, y: -height / 2 }
+ ];
+ }
+ if (directions.has("up") && directions.has("down")) {
+ return [
+ // Bottom center
+ { x: width / 2, y: 0 },
+ // Left pont of bottom arrow
+ { x: 0, y: -padding },
+ { x: midpoint, y: -padding },
+ // Left top over vertical section
+ { x: midpoint, y: -height + padding },
+ { x: 0, y: -height + padding },
+ // Top of arrow
+ { x: width / 2, y: -height },
+ { x: width, y: -height + padding },
+ // Top of right vertical bar
+ { x: width - midpoint, y: -height + padding },
+ { x: width - midpoint, y: -padding },
+ { x: width, y: -padding }
+ ];
+ }
+ if (directions.has("right") && directions.has("up")) {
+ return [
+ { x: 0, y: 0 },
+ { x: width, y: -midpoint },
+ { x: 0, y: -height }
+ ];
+ }
+ if (directions.has("right") && directions.has("down")) {
+ return [
+ { x: 0, y: 0 },
+ { x: width, y: 0 },
+ { x: 0, y: -height }
+ ];
+ }
+ if (directions.has("left") && directions.has("up")) {
+ return [
+ { x: width, y: 0 },
+ { x: 0, y: -midpoint },
+ { x: width, y: -height }
+ ];
+ }
+ if (directions.has("left") && directions.has("down")) {
+ return [
+ { x: width, y: 0 },
+ { x: 0, y: 0 },
+ { x: width, y: -height }
+ ];
+ }
+ if (directions.has("right")) {
+ return [
+ { x: midpoint, y: -padding },
+ { x: midpoint, y: -padding },
+ { x: width - midpoint, y: -padding },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: -height / 2 },
+ { x: width - midpoint, y: -height },
+ { x: width - midpoint, y: -height + padding },
+ // top left corner of arrow
+ { x: midpoint, y: -height + padding },
+ { x: midpoint, y: -height + padding }
+ ];
+ }
+ if (directions.has("left")) {
+ return [
+ { x: midpoint, y: 0 },
+ { x: midpoint, y: -padding },
+ // Two points, the right corners
+ { x: width - midpoint, y: -padding },
+ { x: width - midpoint, y: -height + padding },
+ { x: midpoint, y: -height + padding },
+ { x: midpoint, y: -height },
+ { x: 0, y: -height / 2 }
+ ];
+ }
+ if (directions.has("up")) {
+ return [
+ // Bottom center
+ { x: midpoint, y: -padding },
+ // Left top over vertical section
+ { x: midpoint, y: -height + padding },
+ { x: 0, y: -height + padding },
+ // Top of arrow
+ { x: width / 2, y: -height },
+ { x: width, y: -height + padding },
+ // Top of right vertical bar
+ { x: width - midpoint, y: -height + padding },
+ { x: width - midpoint, y: -padding }
+ ];
+ }
+ if (directions.has("down")) {
+ return [
+ // Bottom center
+ { x: width / 2, y: 0 },
+ // Left pont of bottom arrow
+ { x: 0, y: -padding },
+ { x: midpoint, y: -padding },
+ // Left top over vertical section
+ { x: midpoint, y: -height + padding },
+ { x: width - midpoint, y: -height + padding },
+ { x: width - midpoint, y: -padding },
+ { x: width, y: -padding }
+ ];
+ }
+ return [{ x: 0, y: 0 }];
+};
+const formatClass = (str) => {
+ if (str) {
+ return " " + str;
+ }
+ return "";
+};
+const getClassesFromNode = (node, otherClasses) => {
+ return `${"node default"}${formatClass(node.classes)} ${formatClass(
+ node.class
+ )}`;
+};
+const question = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const s = w + h;
+ const points = [
+ { x: s / 2, y: 0 },
+ { x: s, y: -s / 2 },
+ { x: s / 2, y: -s },
+ { x: 0, y: -s / 2 }
+ ];
+ log$1.info("Question main (Circle)");
+ const questionElem = insertPolygonShape(shapeSvg, s, s, points);
+ questionElem.attr("style", node.style);
+ updateNodeBounds(node, questionElem);
+ node.intersect = function(point2) {
+ log$1.warn("Intersect called");
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const choice = (parent, node) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ const s = 28;
+ const points = [
+ { x: 0, y: s / 2 },
+ { x: s / 2, y: 0 },
+ { x: 0, y: -s / 2 },
+ { x: -s / 2, y: 0 }
+ ];
+ const choice2 = shapeSvg.insert("polygon", ":first-child").attr(
+ "points",
+ points.map(function(d) {
+ return d.x + "," + d.y;
+ }).join(" ")
+ );
+ choice2.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28);
+ node.width = 28;
+ node.height = 28;
+ node.intersect = function(point2) {
+ return intersect.circle(node, 14, point2);
+ };
+ return shapeSvg;
+};
+const hexagon = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const f = 4;
+ const h = bbox.height + node.padding;
+ const m = h / f;
+ const w = bbox.width + 2 * m + node.padding;
+ const points = [
+ { x: m, y: 0 },
+ { x: w - m, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w - m, y: -h },
+ { x: m, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const hex = insertPolygonShape(shapeSvg, w, h, points);
+ hex.attr("style", node.style);
+ updateNodeBounds(node, hex);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const block_arrow = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(parent, node, void 0, true);
+ const f = 2;
+ const h = bbox.height + 2 * node.padding;
+ const m = h / f;
+ const w = bbox.width + 2 * m + node.padding;
+ const points = getArrowPoints(node.directions, bbox, node);
+ const blockArrow = insertPolygonShape(shapeSvg, w, h, points);
+ blockArrow.attr("style", node.style);
+ updateNodeBounds(node, blockArrow);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const rect_left_inv_arrow = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: -h / 2, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: -h / 2, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ node.width = w + h;
+ node.height = h;
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const lean_right = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(parent, node, getClassesFromNode(node), true);
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const lean_left = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: 2 * h / 6, y: 0 },
+ { x: w + h / 6, y: 0 },
+ { x: w - 2 * h / 6, y: -h },
+ { x: -h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const trapezoid = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: 0 },
+ { x: w - h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const inv_trapezoid = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: -2 * h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const rect_right_inv_arrow = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w + h / 2, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w + h / 2, y: -h },
+ { x: 0, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const cylinder = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const rx = w / 2;
+ const ry = rx / (2.5 + w / 50);
+ const h = bbox.height + ry + node.padding;
+ const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
+ const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node.style).attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ const pos = intersect.rect(node, point2);
+ const x = pos.x - node.x;
+ if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
+ let y = ry * ry * (1 - x * x / (rx * rx));
+ if (y != 0) {
+ y = Math.sqrt(y);
+ }
+ y = ry - y;
+ if (point2.y - node.y > 0) {
+ y = -y;
+ }
+ pos.y += y;
+ }
+ return pos;
+ };
+ return shapeSvg;
+};
+const rect = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ "node " + node.classes + " " + node.class,
+ true
+ );
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
+ const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
+ const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
+ const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
+ rect2.attr("class", "basic label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+ if (node.props) {
+ const propKeys = new Set(Object.keys(node.props));
+ if (node.props.borders) {
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+ propKeys.delete("borders");
+ }
+ propKeys.forEach((propKey) => {
+ log$1.warn(`Unknown node property ${propKey}`);
+ });
+ }
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const composite = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ "node " + node.classes,
+ true
+ );
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
+ const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
+ const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
+ const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
+ rect2.attr("class", "basic cluster composite label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+ if (node.props) {
+ const propKeys = new Set(Object.keys(node.props));
+ if (node.props.borders) {
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+ propKeys.delete("borders");
+ }
+ propKeys.forEach((propKey) => {
+ log$1.warn(`Unknown node property ${propKey}`);
+ });
+ }
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const labelRect = async (parent, node) => {
+ const { shapeSvg } = await labelHelper(parent, node, "label", true);
+ log$1.trace("Classes = ", node.class);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const totalWidth = 0;
+ const totalHeight = 0;
+ rect2.attr("width", totalWidth).attr("height", totalHeight);
+ shapeSvg.attr("class", "label edgeLabel");
+ if (node.props) {
+ const propKeys = new Set(Object.keys(node.props));
+ if (node.props.borders) {
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+ propKeys.delete("borders");
+ }
+ propKeys.forEach((propKey) => {
+ log$1.warn(`Unknown node property ${propKey}`);
+ });
+ }
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+function applyNodePropertyBorders(rect2, borders, totalWidth, totalHeight) {
+ const strokeDashArray = [];
+ const addBorder = (length) => {
+ strokeDashArray.push(length, 0);
+ };
+ const skipBorder = (length) => {
+ strokeDashArray.push(0, length);
+ };
+ if (borders.includes("t")) {
+ log$1.debug("add top border");
+ addBorder(totalWidth);
+ } else {
+ skipBorder(totalWidth);
+ }
+ if (borders.includes("r")) {
+ log$1.debug("add right border");
+ addBorder(totalHeight);
+ } else {
+ skipBorder(totalHeight);
+ }
+ if (borders.includes("b")) {
+ log$1.debug("add bottom border");
+ addBorder(totalWidth);
+ } else {
+ skipBorder(totalWidth);
+ }
+ if (borders.includes("l")) {
+ log$1.debug("add left border");
+ addBorder(totalHeight);
+ } else {
+ skipBorder(totalHeight);
+ }
+ rect2.attr("stroke-dasharray", strokeDashArray.join(" "));
+}
+const rectWithTitle = (parent, node) => {
+ let classes;
+ if (!node.classes) {
+ classes = "node default";
+ } else {
+ classes = "node " + node.classes;
+ }
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const innerLine = shapeSvg.insert("line");
+ const label = shapeSvg.insert("g").attr("class", "label");
+ const text2 = node.labelText.flat ? node.labelText.flat() : node.labelText;
+ let title = "";
+ if (typeof text2 === "object") {
+ title = text2[0];
+ } else {
+ title = text2;
+ }
+ log$1.info("Label text abc79", title, text2, typeof text2 === "object");
+ const text = label.node().appendChild(createLabel$1(title, node.labelStyle, true, true));
+ let bbox = { width: 0, height: 0 };
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = text.children[0];
+ const dv = select(text);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ log$1.info("Text 2", text2);
+ const textRows = text2.slice(1, text2.length);
+ let titleBox = text.getBBox();
+ const descr = label.node().appendChild(
+ createLabel$1(textRows.join ? textRows.join("
") : textRows, node.labelStyle, true, true)
+ );
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = descr.children[0];
+ const dv = select(descr);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ const halfPadding = node.padding / 2;
+ select(descr).attr(
+ "transform",
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
+ (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
+ );
+ select(text).attr(
+ "transform",
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
+ (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
+ );
+ bbox = label.node().getBBox();
+ label.attr(
+ "transform",
+ "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
+ );
+ rect2.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const stadium = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const h = bbox.height + node.padding;
+ const w = bbox.width + h / 4 + node.padding;
+ const rect2 = shapeSvg.insert("rect", ":first-child").attr("style", node.style).attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const circle = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const circle2 = shapeSvg.insert("circle", ":first-child");
+ circle2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ log$1.info("Circle main");
+ updateNodeBounds(node, circle2);
+ node.intersect = function(point2) {
+ log$1.info("Circle intersect", node, bbox.width / 2 + halfPadding, point2);
+ return intersect.circle(node, bbox.width / 2 + halfPadding, point2);
+ };
+ return shapeSvg;
+};
+const doublecircle = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const gap = 5;
+ const circleGroup = shapeSvg.insert("g", ":first-child");
+ const outerCircle = circleGroup.insert("circle");
+ const innerCircle = circleGroup.insert("circle");
+ circleGroup.attr("class", node.class);
+ outerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node.padding + gap * 2).attr("height", bbox.height + node.padding + gap * 2);
+ innerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ log$1.info("DoubleCircle main");
+ updateNodeBounds(node, outerCircle);
+ node.intersect = function(point2) {
+ log$1.info("DoubleCircle intersect", node, bbox.width / 2 + halfPadding + gap, point2);
+ return intersect.circle(node, bbox.width / 2 + halfPadding + gap, point2);
+ };
+ return shapeSvg;
+};
+const subroutine = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: 0, y: -h },
+ { x: 0, y: 0 },
+ { x: -8, y: 0 },
+ { x: w + 8, y: 0 },
+ { x: w + 8, y: -h },
+ { x: -8, y: -h },
+ { x: -8, y: 0 }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const start = (parent, node) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ const circle2 = shapeSvg.insert("circle", ":first-child");
+ circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+ updateNodeBounds(node, circle2);
+ node.intersect = function(point2) {
+ return intersect.circle(node, 7, point2);
+ };
+ return shapeSvg;
+};
+const forkJoin = (parent, node, dir) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ let width = 70;
+ let height = 10;
+ if (dir === "LR") {
+ width = 10;
+ height = 70;
+ }
+ const shape = shapeSvg.append("rect").attr("x", -1 * width / 2).attr("y", -1 * height / 2).attr("width", width).attr("height", height).attr("class", "fork-join");
+ updateNodeBounds(node, shape);
+ node.height = node.height + node.padding / 2;
+ node.width = node.width + node.padding / 2;
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const end = (parent, node) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ const innerCircle = shapeSvg.insert("circle", ":first-child");
+ const circle2 = shapeSvg.insert("circle", ":first-child");
+ circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+ innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
+ updateNodeBounds(node, circle2);
+ node.intersect = function(point2) {
+ return intersect.circle(node, 7, point2);
+ };
+ return shapeSvg;
+};
+const class_box = (parent, node) => {
+ const halfPadding = node.padding / 2;
+ const rowPadding = 4;
+ const lineHeight = 8;
+ let classes;
+ if (!node.classes) {
+ classes = "node default";
+ } else {
+ classes = "node " + node.classes;
+ }
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const topLine = shapeSvg.insert("line");
+ const bottomLine = shapeSvg.insert("line");
+ let maxWidth = 0;
+ let maxHeight = rowPadding;
+ const labelContainer = shapeSvg.insert("g").attr("class", "label");
+ let verticalPos = 0;
+ const hasInterface = node.classData.annotations && node.classData.annotations[0];
+ const interfaceLabelText = node.classData.annotations[0] ? "«" + node.classData.annotations[0] + "»" : "";
+ const interfaceLabel = labelContainer.node().appendChild(createLabel$1(interfaceLabelText, node.labelStyle, true, true));
+ let interfaceBBox = interfaceLabel.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = interfaceLabel.children[0];
+ const dv = select(interfaceLabel);
+ interfaceBBox = div.getBoundingClientRect();
+ dv.attr("width", interfaceBBox.width);
+ dv.attr("height", interfaceBBox.height);
+ }
+ if (node.classData.annotations[0]) {
+ maxHeight += interfaceBBox.height + rowPadding;
+ maxWidth += interfaceBBox.width;
+ }
+ let classTitleString = node.classData.label;
+ if (node.classData.type !== void 0 && node.classData.type !== "") {
+ if (getConfig().flowchart.htmlLabels) {
+ classTitleString += "<" + node.classData.type + ">";
+ } else {
+ classTitleString += "<" + node.classData.type + ">";
+ }
+ }
+ const classTitleLabel = labelContainer.node().appendChild(createLabel$1(classTitleString, node.labelStyle, true, true));
+ select(classTitleLabel).attr("class", "classTitle");
+ let classTitleBBox = classTitleLabel.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = classTitleLabel.children[0];
+ const dv = select(classTitleLabel);
+ classTitleBBox = div.getBoundingClientRect();
+ dv.attr("width", classTitleBBox.width);
+ dv.attr("height", classTitleBBox.height);
+ }
+ maxHeight += classTitleBBox.height + rowPadding;
+ if (classTitleBBox.width > maxWidth) {
+ maxWidth = classTitleBBox.width;
+ }
+ const classAttributes = [];
+ node.classData.members.forEach((member) => {
+ const parsedInfo = member.getDisplayDetails();
+ let parsedText = parsedInfo.displayText;
+ if (getConfig().flowchart.htmlLabels) {
+ parsedText = parsedText.replace(//g, ">");
+ }
+ const lbl = labelContainer.node().appendChild(
+ createLabel$1(
+ parsedText,
+ parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
+ true,
+ true
+ )
+ );
+ let bbox = lbl.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = lbl.children[0];
+ const dv = select(lbl);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ if (bbox.width > maxWidth) {
+ maxWidth = bbox.width;
+ }
+ maxHeight += bbox.height + rowPadding;
+ classAttributes.push(lbl);
+ });
+ maxHeight += lineHeight;
+ const classMethods = [];
+ node.classData.methods.forEach((member) => {
+ const parsedInfo = member.getDisplayDetails();
+ let displayText = parsedInfo.displayText;
+ if (getConfig().flowchart.htmlLabels) {
+ displayText = displayText.replace(//g, ">");
+ }
+ const lbl = labelContainer.node().appendChild(
+ createLabel$1(
+ displayText,
+ parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
+ true,
+ true
+ )
+ );
+ let bbox = lbl.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = lbl.children[0];
+ const dv = select(lbl);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ if (bbox.width > maxWidth) {
+ maxWidth = bbox.width;
+ }
+ maxHeight += bbox.height + rowPadding;
+ classMethods.push(lbl);
+ });
+ maxHeight += lineHeight;
+ if (hasInterface) {
+ let diffX2 = (maxWidth - interfaceBBox.width) / 2;
+ select(interfaceLabel).attr(
+ "transform",
+ "translate( " + (-1 * maxWidth / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")"
+ );
+ verticalPos = interfaceBBox.height + rowPadding;
+ }
+ let diffX = (maxWidth - classTitleBBox.width) / 2;
+ select(classTitleLabel).attr(
+ "transform",
+ "translate( " + (-1 * maxWidth / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
+ );
+ verticalPos += classTitleBBox.height + rowPadding;
+ topLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
+ verticalPos += lineHeight;
+ classAttributes.forEach((lbl) => {
+ select(lbl).attr(
+ "transform",
+ "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")"
+ );
+ const memberBBox = lbl == null ? void 0 : lbl.getBBox();
+ verticalPos += ((memberBBox == null ? void 0 : memberBBox.height) ?? 0) + rowPadding;
+ });
+ verticalPos += lineHeight;
+ bottomLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
+ verticalPos += lineHeight;
+ classMethods.forEach((lbl) => {
+ select(lbl).attr(
+ "transform",
+ "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
+ );
+ const memberBBox = lbl == null ? void 0 : lbl.getBBox();
+ verticalPos += ((memberBBox == null ? void 0 : memberBBox.height) ?? 0) + rowPadding;
+ });
+ rect2.attr("style", node.style).attr("class", "outer title-state").attr("x", -maxWidth / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth + node.padding).attr("height", maxHeight + node.padding);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const shapes = {
+ rhombus: question,
+ composite,
+ question,
+ rect,
+ labelRect,
+ rectWithTitle,
+ choice,
+ circle,
+ doublecircle,
+ stadium,
+ hexagon,
+ block_arrow,
+ rect_left_inv_arrow,
+ lean_right,
+ lean_left,
+ trapezoid,
+ inv_trapezoid,
+ rect_right_inv_arrow,
+ cylinder,
+ start,
+ end,
+ note: note$1,
+ subroutine,
+ fork: forkJoin,
+ join: forkJoin,
+ class_box
+};
+let nodeElems = {};
+const insertNode = async (elem, node, dir) => {
+ let newEl;
+ let el;
+ if (node.link) {
+ let target;
+ if (getConfig().securityLevel === "sandbox") {
+ target = "_top";
+ } else if (node.linkTarget) {
+ target = node.linkTarget || "_blank";
+ }
+ newEl = elem.insert("svg:a").attr("xlink:href", node.link).attr("target", target);
+ el = await shapes[node.shape](newEl, node, dir);
+ } else {
+ el = await shapes[node.shape](elem, node, dir);
+ newEl = el;
+ }
+ if (node.tooltip) {
+ el.attr("title", node.tooltip);
+ }
+ if (node.class) {
+ el.attr("class", "node default " + node.class);
+ }
+ newEl.attr("data-node", "true");
+ newEl.attr("data-id", node.id);
+ nodeElems[node.id] = newEl;
+ if (node.haveCallback) {
+ nodeElems[node.id].attr("class", nodeElems[node.id].attr("class") + " clickable");
+ }
+ return newEl;
+};
+const setNodeElem = (elem, node) => {
+ nodeElems[node.id] = elem;
+};
+const clear$1 = () => {
+ nodeElems = {};
+};
+const positionNode = (node) => {
+ const el = nodeElems[node.id];
+ log$1.trace(
+ "Transforming node",
+ node.diff,
+ node,
+ "translate(" + (node.x - node.width / 2 - 5) + ", " + node.width / 2 + ")"
+ );
+ const padding = 8;
+ const diff = node.diff || 0;
+ if (node.clusterNode) {
+ el.attr(
+ "transform",
+ "translate(" + (node.x + diff - node.width / 2) + ", " + (node.y - node.height / 2 - padding) + ")"
+ );
+ } else {
+ el.attr("transform", "translate(" + node.x + ", " + node.y + ")");
+ }
+ return diff;
+};
+const getSubGraphTitleMargins = ({
+ flowchart
+}) => {
+ var _a, _b;
+ const subGraphTitleTopMargin = ((_a = flowchart == null ? void 0 : flowchart.subGraphTitleMargin) == null ? void 0 : _a.top) ?? 0;
+ const subGraphTitleBottomMargin = ((_b = flowchart == null ? void 0 : flowchart.subGraphTitleMargin) == null ? void 0 : _b.bottom) ?? 0;
+ const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
+ return {
+ subGraphTitleTopMargin,
+ subGraphTitleBottomMargin,
+ subGraphTitleTotalMargin
+ };
+};
+const markerOffsets = {
+ aggregation: 18,
+ extension: 18,
+ composition: 18,
+ dependency: 6,
+ lollipop: 13.5,
+ arrow_point: 5.3
+};
+function calculateDeltaAndAngle(point1, point2) {
+ if (point1 === void 0 || point2 === void 0) {
+ return { angle: 0, deltaX: 0, deltaY: 0 };
+ }
+ point1 = pointTransformer(point1);
+ point2 = pointTransformer(point2);
+ const [x1, y1] = [point1.x, point1.y];
+ const [x2, y2] = [point2.x, point2.y];
+ const deltaX = x2 - x1;
+ const deltaY = y2 - y1;
+ return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY };
+}
+const pointTransformer = (data) => {
+ if (Array.isArray(data)) {
+ return { x: data[0], y: data[1] };
+ }
+ return data;
+};
+const getLineFunctionsWithOffset = (edge) => {
+ return {
+ x: function(d, i, data) {
+ let offset = 0;
+ if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
+ const { angle, deltaX } = calculateDeltaAndAngle(data[0], data[1]);
+ offset = markerOffsets[edge.arrowTypeStart] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
+ } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
+ const { angle, deltaX } = calculateDeltaAndAngle(
+ data[data.length - 1],
+ data[data.length - 2]
+ );
+ offset = markerOffsets[edge.arrowTypeEnd] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
+ }
+ return pointTransformer(d).x + offset;
+ },
+ y: function(d, i, data) {
+ let offset = 0;
+ if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
+ const { angle, deltaY } = calculateDeltaAndAngle(data[0], data[1]);
+ offset = markerOffsets[edge.arrowTypeStart] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
+ } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
+ const { angle, deltaY } = calculateDeltaAndAngle(
+ data[data.length - 1],
+ data[data.length - 2]
+ );
+ offset = markerOffsets[edge.arrowTypeEnd] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
+ }
+ return pointTransformer(d).y + offset;
+ }
+ };
+};
+const addEdgeMarkers = (svgPath, edge, url, id, diagramType) => {
+ if (edge.arrowTypeStart) {
+ addEdgeMarker(svgPath, "start", edge.arrowTypeStart, url, id, diagramType);
+ }
+ if (edge.arrowTypeEnd) {
+ addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id, diagramType);
+ }
+};
+const arrowTypesMap = {
+ arrow_cross: "cross",
+ arrow_point: "point",
+ arrow_barb: "barb",
+ arrow_circle: "circle",
+ aggregation: "aggregation",
+ extension: "extension",
+ composition: "composition",
+ dependency: "dependency",
+ lollipop: "lollipop"
+};
+const addEdgeMarker = (svgPath, position, arrowType, url, id, diagramType) => {
+ const endMarkerType = arrowTypesMap[arrowType];
+ if (!endMarkerType) {
+ log$1.warn(`Unknown arrow type: ${arrowType}`);
+ return;
+ }
+ const suffix = position === "start" ? "Start" : "End";
+ svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);
+};
+let edgeLabels = {};
+let terminalLabels = {};
+const clear = () => {
+ edgeLabels = {};
+ terminalLabels = {};
+};
+const insertEdgeLabel = (elem, edge) => {
+ const useHtmlLabels = evaluate(getConfig().flowchart.htmlLabels);
+ const labelElement = edge.labelType === "markdown" ? createText(elem, edge.label, {
+ style: edge.labelStyle,
+ useHtmlLabels,
+ addSvgBackground: true
+ }) : createLabel$1(edge.label, edge.labelStyle);
+ const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
+ const label = edgeLabel.insert("g").attr("class", "label");
+ label.node().appendChild(labelElement);
+ let bbox = labelElement.getBBox();
+ if (useHtmlLabels) {
+ const div = labelElement.children[0];
+ const dv = select(labelElement);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+ edgeLabels[edge.id] = edgeLabel;
+ edge.width = bbox.width;
+ edge.height = bbox.height;
+ let fo;
+ if (edge.startLabelLeft) {
+ const startLabelElement = createLabel$1(edge.startLabelLeft, edge.labelStyle);
+ const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = startEdgeLabelLeft.insert("g").attr("class", "inner");
+ fo = inner.node().appendChild(startLabelElement);
+ const slBox = startLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
+ setTerminalWidth(fo, edge.startLabelLeft);
+ }
+ if (edge.startLabelRight) {
+ const startLabelElement = createLabel$1(edge.startLabelRight, edge.labelStyle);
+ const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = startEdgeLabelRight.insert("g").attr("class", "inner");
+ fo = startEdgeLabelRight.node().appendChild(startLabelElement);
+ inner.node().appendChild(startLabelElement);
+ const slBox = startLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].startRight = startEdgeLabelRight;
+ setTerminalWidth(fo, edge.startLabelRight);
+ }
+ if (edge.endLabelLeft) {
+ const endLabelElement = createLabel$1(edge.endLabelLeft, edge.labelStyle);
+ const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = endEdgeLabelLeft.insert("g").attr("class", "inner");
+ fo = inner.node().appendChild(endLabelElement);
+ const slBox = endLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ endEdgeLabelLeft.node().appendChild(endLabelElement);
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
+ setTerminalWidth(fo, edge.endLabelLeft);
+ }
+ if (edge.endLabelRight) {
+ const endLabelElement = createLabel$1(edge.endLabelRight, edge.labelStyle);
+ const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = endEdgeLabelRight.insert("g").attr("class", "inner");
+ fo = inner.node().appendChild(endLabelElement);
+ const slBox = endLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ endEdgeLabelRight.node().appendChild(endLabelElement);
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].endRight = endEdgeLabelRight;
+ setTerminalWidth(fo, edge.endLabelRight);
+ }
+ return labelElement;
+};
+function setTerminalWidth(fo, value) {
+ if (getConfig().flowchart.htmlLabels && fo) {
+ fo.style.width = value.length * 9 + "px";
+ fo.style.height = "12px";
+ }
+}
+const positionEdgeLabel = (edge, paths) => {
+ log$1.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels[edge.id], paths);
+ let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
+ const siteConfig = getConfig();
+ const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
+ if (edge.label) {
+ const el = edgeLabels[edge.id];
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcLabelPosition(path);
+ log$1.debug(
+ "Moving label " + edge.label + " from (",
+ x,
+ ",",
+ y,
+ ") to (",
+ pos.x,
+ ",",
+ pos.y,
+ ") abc88"
+ );
+ if (paths.updatedPath) {
+ x = pos.x;
+ y = pos.y;
+ }
+ }
+ el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
+ }
+ if (edge.startLabelLeft) {
+ const el = terminalLabels[edge.id].startLeft;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+ if (edge.startLabelRight) {
+ const el = terminalLabels[edge.id].startRight;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(
+ edge.arrowTypeStart ? 10 : 0,
+ "start_right",
+ path
+ );
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+ if (edge.endLabelLeft) {
+ const el = terminalLabels[edge.id].endLeft;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+ if (edge.endLabelRight) {
+ const el = terminalLabels[edge.id].endRight;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+};
+const outsideNode = (node, point2) => {
+ const x = node.x;
+ const y = node.y;
+ const dx = Math.abs(point2.x - x);
+ const dy = Math.abs(point2.y - y);
+ const w = node.width / 2;
+ const h = node.height / 2;
+ if (dx >= w || dy >= h) {
+ return true;
+ }
+ return false;
+};
+const intersection = (node, outsidePoint, insidePoint) => {
+ log$1.debug(`intersection calc abc89:
+ outsidePoint: ${JSON.stringify(outsidePoint)}
+ insidePoint : ${JSON.stringify(insidePoint)}
+ node : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
+ const x = node.x;
+ const y = node.y;
+ const dx = Math.abs(x - insidePoint.x);
+ const w = node.width / 2;
+ let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
+ const h = node.height / 2;
+ const Q = Math.abs(outsidePoint.y - insidePoint.y);
+ const R = Math.abs(outsidePoint.x - insidePoint.x);
+ if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
+ let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
+ r = R * q / Q;
+ const res = {
+ x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
+ y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
+ };
+ if (r === 0) {
+ res.x = outsidePoint.x;
+ res.y = outsidePoint.y;
+ }
+ if (R === 0) {
+ res.x = outsidePoint.x;
+ }
+ if (Q === 0) {
+ res.y = outsidePoint.y;
+ }
+ log$1.debug(`abc89 topp/bott calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
+ return res;
+ } else {
+ if (insidePoint.x < outsidePoint.x) {
+ r = outsidePoint.x - w - x;
+ } else {
+ r = x - w - outsidePoint.x;
+ }
+ let q = Q * r / R;
+ let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
+ let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
+ log$1.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });
+ if (r === 0) {
+ _x = outsidePoint.x;
+ _y = outsidePoint.y;
+ }
+ if (R === 0) {
+ _x = outsidePoint.x;
+ }
+ if (Q === 0) {
+ _y = outsidePoint.y;
+ }
+ return { x: _x, y: _y };
+ }
+};
+const cutPathAtIntersect = (_points, boundaryNode) => {
+ log$1.debug("abc88 cutPathAtIntersect", _points, boundaryNode);
+ let points = [];
+ let lastPointOutside = _points[0];
+ let isInside = false;
+ _points.forEach((point2) => {
+ if (!outsideNode(boundaryNode, point2) && !isInside) {
+ const inter = intersection(boundaryNode, lastPointOutside, point2);
+ let pointPresent = false;
+ points.forEach((p) => {
+ pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
+ });
+ if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
+ points.push(inter);
+ }
+ isInside = true;
+ } else {
+ lastPointOutside = point2;
+ if (!isInside) {
+ points.push(point2);
+ }
+ }
+ });
+ return points;
+};
+const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph, id) {
+ let points = edge.points;
+ log$1.debug("abc88 InsertEdge: edge=", edge, "e=", e);
+ let pointsHasChanged = false;
+ const tail = graph.node(e.v);
+ var head = graph.node(e.w);
+ if ((head == null ? void 0 : head.intersect) && (tail == null ? void 0 : tail.intersect)) {
+ points = points.slice(1, edge.points.length - 1);
+ points.unshift(tail.intersect(points[0]));
+ points.push(head.intersect(points[points.length - 1]));
+ }
+ if (edge.toCluster) {
+ log$1.debug("to cluster abc88", clusterDb[edge.toCluster]);
+ points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node);
+ pointsHasChanged = true;
+ }
+ if (edge.fromCluster) {
+ log$1.debug("from cluster abc88", clusterDb[edge.fromCluster]);
+ points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse();
+ pointsHasChanged = true;
+ }
+ const lineData = points.filter((p) => !Number.isNaN(p.y));
+ let curve = curveBasis;
+ if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) {
+ curve = edge.curve;
+ }
+ const { x, y } = getLineFunctionsWithOffset(edge);
+ const lineFunction = line().x(x).y(y).curve(curve);
+ let strokeClasses;
+ switch (edge.thickness) {
+ case "normal":
+ strokeClasses = "edge-thickness-normal";
+ break;
+ case "thick":
+ strokeClasses = "edge-thickness-thick";
+ break;
+ case "invisible":
+ strokeClasses = "edge-thickness-thick";
+ break;
+ default:
+ strokeClasses = "";
+ }
+ switch (edge.pattern) {
+ case "solid":
+ strokeClasses += " edge-pattern-solid";
+ break;
+ case "dotted":
+ strokeClasses += " edge-pattern-dotted";
+ break;
+ case "dashed":
+ strokeClasses += " edge-pattern-dashed";
+ break;
+ }
+ const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style);
+ let url = "";
+ if (getConfig().flowchart.arrowMarkerAbsolute || getConfig().state.arrowMarkerAbsolute) {
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+ url = url.replace(/\(/g, "\\(");
+ url = url.replace(/\)/g, "\\)");
+ }
+ addEdgeMarkers(svgPath, edge, url, id, diagramType);
+ let paths = {};
+ if (pointsHasChanged) {
+ paths.updatedPath = points;
+ }
+ paths.originalPath = edge.points;
+ return paths;
+};
+
+export { insertNode as a, insertEdgeLabel as b, insertEdge as c, positionEdgeLabel as d, clear$1 as e, clear as f, getSubGraphTitleMargins as g, createLabel$1 as h, insertMarkers$1 as i, intersectRect$1 as j, getLineFunctionsWithOffset as k, labelHelper as l, addEdgeMarkers as m, positionNode as p, setNodeElem as s, updateNodeBounds as u };
diff --git a/libs/marked/edges-066a5561-a6s42o55.js b/libs/marked/edges-066a5561-a6s42o55.js
new file mode 100644
index 0000000..732012c
--- /dev/null
+++ b/libs/marked/edges-066a5561-a6s42o55.js
@@ -0,0 +1,1825 @@
+import { p as evaluate, c as getConfig, d as sanitizeText$2, b6 as decodeEntities, h as select, l as log$1, A as utils, F as curveBasis } from './index-CN3YjQ0n.js';
+import { a as createText } from './createText-ca0c5216-DF05SDfj.js';
+import { l as line } from './line-D1aCvau7.js';
+
+const insertMarkers = (elem, markerArray, type, id) => {
+ markerArray.forEach((markerName) => {
+ markers[markerName](elem, type, id);
+ });
+};
+const extension = (elem, type, id) => {
+ log$1.trace("Making markers for ", id);
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionStart").attr("class", "marker extension " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionEnd").attr("class", "marker extension " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
+};
+const composition = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionStart").attr("class", "marker composition " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionEnd").attr("class", "marker composition " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+};
+const aggregation = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationStart").attr("class", "marker aggregation " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationEnd").attr("class", "marker aggregation " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+};
+const dependency = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyStart").attr("class", "marker dependency " + type).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyEnd").attr("class", "marker dependency " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
+};
+const lollipop = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopStart").attr("class", "marker lollipop " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopEnd").attr("class", "marker lollipop " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
+};
+const point = (elem, type, id) => {
+ elem.append("marker").attr("id", id + "_" + type + "-pointEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+ elem.append("marker").attr("id", id + "_" + type + "-pointStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+};
+const circle$1 = (elem, type, id) => {
+ elem.append("marker").attr("id", id + "_" + type + "-circleEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+ elem.append("marker").attr("id", id + "_" + type + "-circleStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+};
+const cross = (elem, type, id) => {
+ elem.append("marker").attr("id", id + "_" + type + "-crossEnd").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+ elem.append("marker").attr("id", id + "_" + type + "-crossStart").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
+};
+const barb = (elem, type, id) => {
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
+};
+const markers = {
+ extension,
+ composition,
+ aggregation,
+ dependency,
+ lollipop,
+ point,
+ circle: circle$1,
+ cross,
+ barb
+};
+const insertMarkers$1 = insertMarkers;
+function applyStyle(dom, styleFn) {
+ if (styleFn) {
+ dom.attr("style", styleFn);
+ }
+}
+function addHtmlLabel(node) {
+ const fo = select(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"));
+ const div = fo.append("xhtml:div");
+ const label = node.label;
+ const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
+ div.html(
+ '" + label + ""
+ );
+ applyStyle(div, node.labelStyle);
+ div.style("display", "inline-block");
+ div.style("white-space", "nowrap");
+ div.attr("xmlns", "http://www.w3.org/1999/xhtml");
+ return fo.node();
+}
+const createLabel = (_vertexText, style, isTitle, isNode) => {
+ let vertexText = _vertexText || "";
+ if (typeof vertexText === "object") {
+ vertexText = vertexText[0];
+ }
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ vertexText = vertexText.replace(/\\n|\n/g, "
");
+ log$1.debug("vertexText" + vertexText);
+ const node = {
+ isNode,
+ label: decodeEntities(vertexText).replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell: disable-line
+ (s) => ``
+ ),
+ labelStyle: style.replace("fill:", "color:")
+ };
+ let vertexNode = addHtmlLabel(node);
+ return vertexNode;
+ } else {
+ const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
+ svgLabel.setAttribute("style", style.replace("color:", "fill:"));
+ let rows = [];
+ if (typeof vertexText === "string") {
+ rows = vertexText.split(/\\n|\n|
/gi);
+ } else if (Array.isArray(vertexText)) {
+ rows = vertexText;
+ } else {
+ rows = [];
+ }
+ for (const row of rows) {
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
+ tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+ tspan.setAttribute("dy", "1em");
+ tspan.setAttribute("x", "0");
+ if (isTitle) {
+ tspan.setAttribute("class", "title-row");
+ } else {
+ tspan.setAttribute("class", "row");
+ }
+ tspan.textContent = row.trim();
+ svgLabel.appendChild(tspan);
+ }
+ return svgLabel;
+ }
+};
+const createLabel$1 = createLabel;
+const labelHelper = async (parent, node, _classes, isNode) => {
+ let classes;
+ const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig().flowchart.htmlLabels);
+ if (!_classes) {
+ classes = "node default";
+ } else {
+ classes = _classes;
+ }
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+ const label = shapeSvg.insert("g").attr("class", "label").attr("style", node.labelStyle);
+ let labelText;
+ if (node.labelText === void 0) {
+ labelText = "";
+ } else {
+ labelText = typeof node.labelText === "string" ? node.labelText : node.labelText[0];
+ }
+ const textNode = label.node();
+ let text;
+ if (node.labelType === "markdown") {
+ text = createText(label, sanitizeText$2(decodeEntities(labelText), getConfig()), {
+ useHtmlLabels,
+ width: node.width || getConfig().flowchart.wrappingWidth,
+ classes: "markdown-node-label"
+ });
+ } else {
+ text = textNode.appendChild(
+ createLabel$1(
+ sanitizeText$2(decodeEntities(labelText), getConfig()),
+ node.labelStyle,
+ false,
+ isNode
+ )
+ );
+ }
+ let bbox = text.getBBox();
+ const halfPadding = node.padding / 2;
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = text.children[0];
+ const dv = select(text);
+ const images = div.getElementsByTagName("img");
+ if (images) {
+ const noImgText = labelText.replace(/]*>/g, "").trim() === "";
+ await Promise.all(
+ [...images].map(
+ (img) => new Promise((res) => {
+ function setupImage() {
+ img.style.display = "flex";
+ img.style.flexDirection = "column";
+ if (noImgText) {
+ const bodyFontSize = getConfig().fontSize ? getConfig().fontSize : window.getComputedStyle(document.body).fontSize;
+ const enlargingFactor = 5;
+ const width = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
+ img.style.minWidth = width;
+ img.style.maxWidth = width;
+ } else {
+ img.style.width = "100%";
+ }
+ res(img);
+ }
+ setTimeout(() => {
+ if (img.complete) {
+ setupImage();
+ }
+ });
+ img.addEventListener("error", setupImage);
+ img.addEventListener("load", setupImage);
+ })
+ )
+ );
+ }
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ if (useHtmlLabels) {
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+ } else {
+ label.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
+ }
+ if (node.centerLabel) {
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+ }
+ label.insert("rect", ":first-child");
+ return { shapeSvg, bbox, halfPadding, label };
+};
+const updateNodeBounds = (node, element) => {
+ const bbox = element.node().getBBox();
+ node.width = bbox.width;
+ node.height = bbox.height;
+};
+function insertPolygonShape(parent, w, h, points) {
+ return parent.insert("polygon", ":first-child").attr(
+ "points",
+ points.map(function(d) {
+ return d.x + "," + d.y;
+ }).join(" ")
+ ).attr("class", "label-container").attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
+}
+function intersectNode(node, point2) {
+ return node.intersect(point2);
+}
+function intersectEllipse(node, rx, ry, point2) {
+ var cx = node.x;
+ var cy = node.y;
+ var px = cx - point2.x;
+ var py = cy - point2.y;
+ var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+ var dx = Math.abs(rx * ry * px / det);
+ if (point2.x < cx) {
+ dx = -dx;
+ }
+ var dy = Math.abs(rx * ry * py / det);
+ if (point2.y < cy) {
+ dy = -dy;
+ }
+ return { x: cx + dx, y: cy + dy };
+}
+function intersectCircle(node, rx, point2) {
+ return intersectEllipse(node, rx, rx, point2);
+}
+function intersectLine(p1, p2, q1, q2) {
+ var a1, a2, b1, b2, c1, c2;
+ var r1, r2, r3, r4;
+ var denom, offset, num;
+ var x, y;
+ a1 = p2.y - p1.y;
+ b1 = p1.x - p2.x;
+ c1 = p2.x * p1.y - p1.x * p2.y;
+ r3 = a1 * q1.x + b1 * q1.y + c1;
+ r4 = a1 * q2.x + b1 * q2.y + c1;
+ if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
+ return;
+ }
+ a2 = q2.y - q1.y;
+ b2 = q1.x - q2.x;
+ c2 = q2.x * q1.y - q1.x * q2.y;
+ r1 = a2 * p1.x + b2 * p1.y + c2;
+ r2 = a2 * p2.x + b2 * p2.y + c2;
+ if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
+ return;
+ }
+ denom = a1 * b2 - a2 * b1;
+ if (denom === 0) {
+ return;
+ }
+ offset = Math.abs(denom / 2);
+ num = b1 * c2 - b2 * c1;
+ x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+ num = a2 * c1 - a1 * c2;
+ y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+ return { x, y };
+}
+function sameSign(r1, r2) {
+ return r1 * r2 > 0;
+}
+function intersectPolygon(node, polyPoints, point2) {
+ var x1 = node.x;
+ var y1 = node.y;
+ var intersections = [];
+ var minX = Number.POSITIVE_INFINITY;
+ var minY = Number.POSITIVE_INFINITY;
+ if (typeof polyPoints.forEach === "function") {
+ polyPoints.forEach(function(entry) {
+ minX = Math.min(minX, entry.x);
+ minY = Math.min(minY, entry.y);
+ });
+ } else {
+ minX = Math.min(minX, polyPoints.x);
+ minY = Math.min(minY, polyPoints.y);
+ }
+ var left = x1 - node.width / 2 - minX;
+ var top = y1 - node.height / 2 - minY;
+ for (var i = 0; i < polyPoints.length; i++) {
+ var p1 = polyPoints[i];
+ var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+ var intersect2 = intersectLine(
+ node,
+ point2,
+ { x: left + p1.x, y: top + p1.y },
+ { x: left + p2.x, y: top + p2.y }
+ );
+ if (intersect2) {
+ intersections.push(intersect2);
+ }
+ }
+ if (!intersections.length) {
+ return node;
+ }
+ if (intersections.length > 1) {
+ intersections.sort(function(p, q) {
+ var pdx = p.x - point2.x;
+ var pdy = p.y - point2.y;
+ var distp = Math.sqrt(pdx * pdx + pdy * pdy);
+ var qdx = q.x - point2.x;
+ var qdy = q.y - point2.y;
+ var distq = Math.sqrt(qdx * qdx + qdy * qdy);
+ return distp < distq ? -1 : distp === distq ? 0 : 1;
+ });
+ }
+ return intersections[0];
+}
+const intersectRect = (node, point2) => {
+ var x = node.x;
+ var y = node.y;
+ var dx = point2.x - x;
+ var dy = point2.y - y;
+ var w = node.width / 2;
+ var h = node.height / 2;
+ var sx, sy;
+ if (Math.abs(dy) * w > Math.abs(dx) * h) {
+ if (dy < 0) {
+ h = -h;
+ }
+ sx = dy === 0 ? 0 : h * dx / dy;
+ sy = h;
+ } else {
+ if (dx < 0) {
+ w = -w;
+ }
+ sx = w;
+ sy = dx === 0 ? 0 : w * dy / dx;
+ }
+ return { x: x + sx, y: y + sy };
+};
+const intersectRect$1 = intersectRect;
+const intersect = {
+ node: intersectNode,
+ circle: intersectCircle,
+ ellipse: intersectEllipse,
+ polygon: intersectPolygon,
+ rect: intersectRect$1
+};
+const note = async (parent, node) => {
+ const useHtmlLabels = node.useHtmlLabels || getConfig().flowchart.htmlLabels;
+ if (!useHtmlLabels) {
+ node.centerLabel = true;
+ }
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ "node " + node.classes,
+ true
+ );
+ log$1.info("Classes = ", node.classes);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const note$1 = note;
+const expandAndDeduplicateDirections = (directions) => {
+ const uniqueDirections = /* @__PURE__ */ new Set();
+ for (const direction of directions) {
+ switch (direction) {
+ case "x":
+ uniqueDirections.add("right");
+ uniqueDirections.add("left");
+ break;
+ case "y":
+ uniqueDirections.add("up");
+ uniqueDirections.add("down");
+ break;
+ default:
+ uniqueDirections.add(direction);
+ break;
+ }
+ }
+ return uniqueDirections;
+};
+const getArrowPoints = (duplicatedDirections, bbox, node) => {
+ const directions = expandAndDeduplicateDirections(duplicatedDirections);
+ const f = 2;
+ const height = bbox.height + 2 * node.padding;
+ const midpoint = height / f;
+ const width = bbox.width + 2 * midpoint + node.padding;
+ const padding = node.padding / 2;
+ if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) {
+ return [
+ // Bottom
+ { x: 0, y: 0 },
+ { x: midpoint, y: 0 },
+ { x: width / 2, y: 2 * padding },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: 0 },
+ // Right
+ { x: width, y: -height / 3 },
+ { x: width + 2 * padding, y: -height / 2 },
+ { x: width, y: -2 * height / 3 },
+ { x: width, y: -height },
+ // Top
+ { x: width - midpoint, y: -height },
+ { x: width / 2, y: -height - 2 * padding },
+ { x: midpoint, y: -height },
+ // Left
+ { x: 0, y: -height },
+ { x: 0, y: -2 * height / 3 },
+ { x: -2 * padding, y: -height / 2 },
+ { x: 0, y: -height / 3 }
+ ];
+ }
+ if (directions.has("right") && directions.has("left") && directions.has("up")) {
+ return [
+ { x: midpoint, y: 0 },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: -height / 2 },
+ { x: width - midpoint, y: -height },
+ { x: midpoint, y: -height },
+ { x: 0, y: -height / 2 }
+ ];
+ }
+ if (directions.has("right") && directions.has("left") && directions.has("down")) {
+ return [
+ { x: 0, y: 0 },
+ { x: midpoint, y: -height },
+ { x: width - midpoint, y: -height },
+ { x: width, y: 0 }
+ ];
+ }
+ if (directions.has("right") && directions.has("up") && directions.has("down")) {
+ return [
+ { x: 0, y: 0 },
+ { x: width, y: -midpoint },
+ { x: width, y: -height + midpoint },
+ { x: 0, y: -height }
+ ];
+ }
+ if (directions.has("left") && directions.has("up") && directions.has("down")) {
+ return [
+ { x: width, y: 0 },
+ { x: 0, y: -midpoint },
+ { x: 0, y: -height + midpoint },
+ { x: width, y: -height }
+ ];
+ }
+ if (directions.has("right") && directions.has("left")) {
+ return [
+ { x: midpoint, y: 0 },
+ { x: midpoint, y: -padding },
+ { x: width - midpoint, y: -padding },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: -height / 2 },
+ { x: width - midpoint, y: -height },
+ { x: width - midpoint, y: -height + padding },
+ { x: midpoint, y: -height + padding },
+ { x: midpoint, y: -height },
+ { x: 0, y: -height / 2 }
+ ];
+ }
+ if (directions.has("up") && directions.has("down")) {
+ return [
+ // Bottom center
+ { x: width / 2, y: 0 },
+ // Left pont of bottom arrow
+ { x: 0, y: -padding },
+ { x: midpoint, y: -padding },
+ // Left top over vertical section
+ { x: midpoint, y: -height + padding },
+ { x: 0, y: -height + padding },
+ // Top of arrow
+ { x: width / 2, y: -height },
+ { x: width, y: -height + padding },
+ // Top of right vertical bar
+ { x: width - midpoint, y: -height + padding },
+ { x: width - midpoint, y: -padding },
+ { x: width, y: -padding }
+ ];
+ }
+ if (directions.has("right") && directions.has("up")) {
+ return [
+ { x: 0, y: 0 },
+ { x: width, y: -midpoint },
+ { x: 0, y: -height }
+ ];
+ }
+ if (directions.has("right") && directions.has("down")) {
+ return [
+ { x: 0, y: 0 },
+ { x: width, y: 0 },
+ { x: 0, y: -height }
+ ];
+ }
+ if (directions.has("left") && directions.has("up")) {
+ return [
+ { x: width, y: 0 },
+ { x: 0, y: -midpoint },
+ { x: width, y: -height }
+ ];
+ }
+ if (directions.has("left") && directions.has("down")) {
+ return [
+ { x: width, y: 0 },
+ { x: 0, y: 0 },
+ { x: width, y: -height }
+ ];
+ }
+ if (directions.has("right")) {
+ return [
+ { x: midpoint, y: -padding },
+ { x: midpoint, y: -padding },
+ { x: width - midpoint, y: -padding },
+ { x: width - midpoint, y: 0 },
+ { x: width, y: -height / 2 },
+ { x: width - midpoint, y: -height },
+ { x: width - midpoint, y: -height + padding },
+ // top left corner of arrow
+ { x: midpoint, y: -height + padding },
+ { x: midpoint, y: -height + padding }
+ ];
+ }
+ if (directions.has("left")) {
+ return [
+ { x: midpoint, y: 0 },
+ { x: midpoint, y: -padding },
+ // Two points, the right corners
+ { x: width - midpoint, y: -padding },
+ { x: width - midpoint, y: -height + padding },
+ { x: midpoint, y: -height + padding },
+ { x: midpoint, y: -height },
+ { x: 0, y: -height / 2 }
+ ];
+ }
+ if (directions.has("up")) {
+ return [
+ // Bottom center
+ { x: midpoint, y: -padding },
+ // Left top over vertical section
+ { x: midpoint, y: -height + padding },
+ { x: 0, y: -height + padding },
+ // Top of arrow
+ { x: width / 2, y: -height },
+ { x: width, y: -height + padding },
+ // Top of right vertical bar
+ { x: width - midpoint, y: -height + padding },
+ { x: width - midpoint, y: -padding }
+ ];
+ }
+ if (directions.has("down")) {
+ return [
+ // Bottom center
+ { x: width / 2, y: 0 },
+ // Left pont of bottom arrow
+ { x: 0, y: -padding },
+ { x: midpoint, y: -padding },
+ // Left top over vertical section
+ { x: midpoint, y: -height + padding },
+ { x: width - midpoint, y: -height + padding },
+ { x: width - midpoint, y: -padding },
+ { x: width, y: -padding }
+ ];
+ }
+ return [{ x: 0, y: 0 }];
+};
+const formatClass = (str) => {
+ if (str) {
+ return " " + str;
+ }
+ return "";
+};
+const getClassesFromNode = (node, otherClasses) => {
+ return `${"node default"}${formatClass(node.classes)} ${formatClass(
+ node.class
+ )}`;
+};
+const question = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const s = w + h;
+ const points = [
+ { x: s / 2, y: 0 },
+ { x: s, y: -s / 2 },
+ { x: s / 2, y: -s },
+ { x: 0, y: -s / 2 }
+ ];
+ log$1.info("Question main (Circle)");
+ const questionElem = insertPolygonShape(shapeSvg, s, s, points);
+ questionElem.attr("style", node.style);
+ updateNodeBounds(node, questionElem);
+ node.intersect = function(point2) {
+ log$1.warn("Intersect called");
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const choice = (parent, node) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ const s = 28;
+ const points = [
+ { x: 0, y: s / 2 },
+ { x: s / 2, y: 0 },
+ { x: 0, y: -s / 2 },
+ { x: -s / 2, y: 0 }
+ ];
+ const choice2 = shapeSvg.insert("polygon", ":first-child").attr(
+ "points",
+ points.map(function(d) {
+ return d.x + "," + d.y;
+ }).join(" ")
+ );
+ choice2.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28);
+ node.width = 28;
+ node.height = 28;
+ node.intersect = function(point2) {
+ return intersect.circle(node, 14, point2);
+ };
+ return shapeSvg;
+};
+const hexagon = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const f = 4;
+ const h = bbox.height + node.padding;
+ const m = h / f;
+ const w = bbox.width + 2 * m + node.padding;
+ const points = [
+ { x: m, y: 0 },
+ { x: w - m, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w - m, y: -h },
+ { x: m, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const hex = insertPolygonShape(shapeSvg, w, h, points);
+ hex.attr("style", node.style);
+ updateNodeBounds(node, hex);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const block_arrow = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(parent, node, void 0, true);
+ const f = 2;
+ const h = bbox.height + 2 * node.padding;
+ const m = h / f;
+ const w = bbox.width + 2 * m + node.padding;
+ const points = getArrowPoints(node.directions, bbox, node);
+ const blockArrow = insertPolygonShape(shapeSvg, w, h, points);
+ blockArrow.attr("style", node.style);
+ updateNodeBounds(node, blockArrow);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const rect_left_inv_arrow = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: -h / 2, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: -h / 2, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ node.width = w + h;
+ node.height = h;
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const lean_right = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(parent, node, getClassesFromNode(node), true);
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const lean_left = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: 2 * h / 6, y: 0 },
+ { x: w + h / 6, y: 0 },
+ { x: w - 2 * h / 6, y: -h },
+ { x: -h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const trapezoid = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: 0 },
+ { x: w - h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const inv_trapezoid = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: -2 * h / 6, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const rect_right_inv_arrow = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w + h / 2, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w + h / 2, y: -h },
+ { x: 0, y: -h }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const cylinder = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const rx = w / 2;
+ const ry = rx / (2.5 + w / 50);
+ const h = bbox.height + ry + node.padding;
+ const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
+ const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node.style).attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ const pos = intersect.rect(node, point2);
+ const x = pos.x - node.x;
+ if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
+ let y = ry * ry * (1 - x * x / (rx * rx));
+ if (y != 0) {
+ y = Math.sqrt(y);
+ }
+ y = ry - y;
+ if (point2.y - node.y > 0) {
+ y = -y;
+ }
+ pos.y += y;
+ }
+ return pos;
+ };
+ return shapeSvg;
+};
+const rect = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ "node " + node.classes + " " + node.class,
+ true
+ );
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
+ const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
+ const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
+ const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
+ rect2.attr("class", "basic label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+ if (node.props) {
+ const propKeys = new Set(Object.keys(node.props));
+ if (node.props.borders) {
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+ propKeys.delete("borders");
+ }
+ propKeys.forEach((propKey) => {
+ log$1.warn(`Unknown node property ${propKey}`);
+ });
+ }
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const composite = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ "node " + node.classes,
+ true
+ );
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
+ const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
+ const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
+ const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
+ rect2.attr("class", "basic cluster composite label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
+ if (node.props) {
+ const propKeys = new Set(Object.keys(node.props));
+ if (node.props.borders) {
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+ propKeys.delete("borders");
+ }
+ propKeys.forEach((propKey) => {
+ log$1.warn(`Unknown node property ${propKey}`);
+ });
+ }
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const labelRect = async (parent, node) => {
+ const { shapeSvg } = await labelHelper(parent, node, "label", true);
+ log$1.trace("Classes = ", node.class);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const totalWidth = 0;
+ const totalHeight = 0;
+ rect2.attr("width", totalWidth).attr("height", totalHeight);
+ shapeSvg.attr("class", "label edgeLabel");
+ if (node.props) {
+ const propKeys = new Set(Object.keys(node.props));
+ if (node.props.borders) {
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
+ propKeys.delete("borders");
+ }
+ propKeys.forEach((propKey) => {
+ log$1.warn(`Unknown node property ${propKey}`);
+ });
+ }
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+function applyNodePropertyBorders(rect2, borders, totalWidth, totalHeight) {
+ const strokeDashArray = [];
+ const addBorder = (length) => {
+ strokeDashArray.push(length, 0);
+ };
+ const skipBorder = (length) => {
+ strokeDashArray.push(0, length);
+ };
+ if (borders.includes("t")) {
+ log$1.debug("add top border");
+ addBorder(totalWidth);
+ } else {
+ skipBorder(totalWidth);
+ }
+ if (borders.includes("r")) {
+ log$1.debug("add right border");
+ addBorder(totalHeight);
+ } else {
+ skipBorder(totalHeight);
+ }
+ if (borders.includes("b")) {
+ log$1.debug("add bottom border");
+ addBorder(totalWidth);
+ } else {
+ skipBorder(totalWidth);
+ }
+ if (borders.includes("l")) {
+ log$1.debug("add left border");
+ addBorder(totalHeight);
+ } else {
+ skipBorder(totalHeight);
+ }
+ rect2.attr("stroke-dasharray", strokeDashArray.join(" "));
+}
+const rectWithTitle = (parent, node) => {
+ let classes;
+ if (!node.classes) {
+ classes = "node default";
+ } else {
+ classes = "node " + node.classes;
+ }
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const innerLine = shapeSvg.insert("line");
+ const label = shapeSvg.insert("g").attr("class", "label");
+ const text2 = node.labelText.flat ? node.labelText.flat() : node.labelText;
+ let title = "";
+ if (typeof text2 === "object") {
+ title = text2[0];
+ } else {
+ title = text2;
+ }
+ log$1.info("Label text abc79", title, text2, typeof text2 === "object");
+ const text = label.node().appendChild(createLabel$1(title, node.labelStyle, true, true));
+ let bbox = { width: 0, height: 0 };
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = text.children[0];
+ const dv = select(text);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ log$1.info("Text 2", text2);
+ const textRows = text2.slice(1, text2.length);
+ let titleBox = text.getBBox();
+ const descr = label.node().appendChild(
+ createLabel$1(textRows.join ? textRows.join("
") : textRows, node.labelStyle, true, true)
+ );
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = descr.children[0];
+ const dv = select(descr);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ const halfPadding = node.padding / 2;
+ select(descr).attr(
+ "transform",
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
+ (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
+ );
+ select(text).attr(
+ "transform",
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
+ (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
+ );
+ bbox = label.node().getBBox();
+ label.attr(
+ "transform",
+ "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
+ );
+ rect2.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const stadium = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const h = bbox.height + node.padding;
+ const w = bbox.width + h / 4 + node.padding;
+ const rect2 = shapeSvg.insert("rect", ":first-child").attr("style", node.style).attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const circle = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const circle2 = shapeSvg.insert("circle", ":first-child");
+ circle2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ log$1.info("Circle main");
+ updateNodeBounds(node, circle2);
+ node.intersect = function(point2) {
+ log$1.info("Circle intersect", node, bbox.width / 2 + halfPadding, point2);
+ return intersect.circle(node, bbox.width / 2 + halfPadding, point2);
+ };
+ return shapeSvg;
+};
+const doublecircle = async (parent, node) => {
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const gap = 5;
+ const circleGroup = shapeSvg.insert("g", ":first-child");
+ const outerCircle = circleGroup.insert("circle");
+ const innerCircle = circleGroup.insert("circle");
+ circleGroup.attr("class", node.class);
+ outerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node.padding + gap * 2).attr("height", bbox.height + node.padding + gap * 2);
+ innerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
+ log$1.info("DoubleCircle main");
+ updateNodeBounds(node, outerCircle);
+ node.intersect = function(point2) {
+ log$1.info("DoubleCircle intersect", node, bbox.width / 2 + halfPadding + gap, point2);
+ return intersect.circle(node, bbox.width / 2 + halfPadding + gap, point2);
+ };
+ return shapeSvg;
+};
+const subroutine = async (parent, node) => {
+ const { shapeSvg, bbox } = await labelHelper(
+ parent,
+ node,
+ getClassesFromNode(node),
+ true
+ );
+ const w = bbox.width + node.padding;
+ const h = bbox.height + node.padding;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: 0, y: -h },
+ { x: 0, y: 0 },
+ { x: -8, y: 0 },
+ { x: w + 8, y: 0 },
+ { x: w + 8, y: -h },
+ { x: -8, y: -h },
+ { x: -8, y: 0 }
+ ];
+ const el = insertPolygonShape(shapeSvg, w, h, points);
+ el.attr("style", node.style);
+ updateNodeBounds(node, el);
+ node.intersect = function(point2) {
+ return intersect.polygon(node, points, point2);
+ };
+ return shapeSvg;
+};
+const start = (parent, node) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ const circle2 = shapeSvg.insert("circle", ":first-child");
+ circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+ updateNodeBounds(node, circle2);
+ node.intersect = function(point2) {
+ return intersect.circle(node, 7, point2);
+ };
+ return shapeSvg;
+};
+const forkJoin = (parent, node, dir) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ let width = 70;
+ let height = 10;
+ if (dir === "LR") {
+ width = 10;
+ height = 70;
+ }
+ const shape = shapeSvg.append("rect").attr("x", -1 * width / 2).attr("y", -1 * height / 2).attr("width", width).attr("height", height).attr("class", "fork-join");
+ updateNodeBounds(node, shape);
+ node.height = node.height + node.padding / 2;
+ node.width = node.width + node.padding / 2;
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const end = (parent, node) => {
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
+ const innerCircle = shapeSvg.insert("circle", ":first-child");
+ const circle2 = shapeSvg.insert("circle", ":first-child");
+ circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
+ innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
+ updateNodeBounds(node, circle2);
+ node.intersect = function(point2) {
+ return intersect.circle(node, 7, point2);
+ };
+ return shapeSvg;
+};
+const class_box = (parent, node) => {
+ const halfPadding = node.padding / 2;
+ const rowPadding = 4;
+ const lineHeight = 8;
+ let classes;
+ if (!node.classes) {
+ classes = "node default";
+ } else {
+ classes = "node " + node.classes;
+ }
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
+ const rect2 = shapeSvg.insert("rect", ":first-child");
+ const topLine = shapeSvg.insert("line");
+ const bottomLine = shapeSvg.insert("line");
+ let maxWidth = 0;
+ let maxHeight = rowPadding;
+ const labelContainer = shapeSvg.insert("g").attr("class", "label");
+ let verticalPos = 0;
+ const hasInterface = node.classData.annotations && node.classData.annotations[0];
+ const interfaceLabelText = node.classData.annotations[0] ? "«" + node.classData.annotations[0] + "»" : "";
+ const interfaceLabel = labelContainer.node().appendChild(createLabel$1(interfaceLabelText, node.labelStyle, true, true));
+ let interfaceBBox = interfaceLabel.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = interfaceLabel.children[0];
+ const dv = select(interfaceLabel);
+ interfaceBBox = div.getBoundingClientRect();
+ dv.attr("width", interfaceBBox.width);
+ dv.attr("height", interfaceBBox.height);
+ }
+ if (node.classData.annotations[0]) {
+ maxHeight += interfaceBBox.height + rowPadding;
+ maxWidth += interfaceBBox.width;
+ }
+ let classTitleString = node.classData.label;
+ if (node.classData.type !== void 0 && node.classData.type !== "") {
+ if (getConfig().flowchart.htmlLabels) {
+ classTitleString += "<" + node.classData.type + ">";
+ } else {
+ classTitleString += "<" + node.classData.type + ">";
+ }
+ }
+ const classTitleLabel = labelContainer.node().appendChild(createLabel$1(classTitleString, node.labelStyle, true, true));
+ select(classTitleLabel).attr("class", "classTitle");
+ let classTitleBBox = classTitleLabel.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = classTitleLabel.children[0];
+ const dv = select(classTitleLabel);
+ classTitleBBox = div.getBoundingClientRect();
+ dv.attr("width", classTitleBBox.width);
+ dv.attr("height", classTitleBBox.height);
+ }
+ maxHeight += classTitleBBox.height + rowPadding;
+ if (classTitleBBox.width > maxWidth) {
+ maxWidth = classTitleBBox.width;
+ }
+ const classAttributes = [];
+ node.classData.members.forEach((member) => {
+ const parsedInfo = member.getDisplayDetails();
+ let parsedText = parsedInfo.displayText;
+ if (getConfig().flowchart.htmlLabels) {
+ parsedText = parsedText.replace(//g, ">");
+ }
+ const lbl = labelContainer.node().appendChild(
+ createLabel$1(
+ parsedText,
+ parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
+ true,
+ true
+ )
+ );
+ let bbox = lbl.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = lbl.children[0];
+ const dv = select(lbl);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ if (bbox.width > maxWidth) {
+ maxWidth = bbox.width;
+ }
+ maxHeight += bbox.height + rowPadding;
+ classAttributes.push(lbl);
+ });
+ maxHeight += lineHeight;
+ const classMethods = [];
+ node.classData.methods.forEach((member) => {
+ const parsedInfo = member.getDisplayDetails();
+ let displayText = parsedInfo.displayText;
+ if (getConfig().flowchart.htmlLabels) {
+ displayText = displayText.replace(//g, ">");
+ }
+ const lbl = labelContainer.node().appendChild(
+ createLabel$1(
+ displayText,
+ parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
+ true,
+ true
+ )
+ );
+ let bbox = lbl.getBBox();
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const div = lbl.children[0];
+ const dv = select(lbl);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ if (bbox.width > maxWidth) {
+ maxWidth = bbox.width;
+ }
+ maxHeight += bbox.height + rowPadding;
+ classMethods.push(lbl);
+ });
+ maxHeight += lineHeight;
+ if (hasInterface) {
+ let diffX2 = (maxWidth - interfaceBBox.width) / 2;
+ select(interfaceLabel).attr(
+ "transform",
+ "translate( " + (-1 * maxWidth / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")"
+ );
+ verticalPos = interfaceBBox.height + rowPadding;
+ }
+ let diffX = (maxWidth - classTitleBBox.width) / 2;
+ select(classTitleLabel).attr(
+ "transform",
+ "translate( " + (-1 * maxWidth / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
+ );
+ verticalPos += classTitleBBox.height + rowPadding;
+ topLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
+ verticalPos += lineHeight;
+ classAttributes.forEach((lbl) => {
+ select(lbl).attr(
+ "transform",
+ "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")"
+ );
+ const memberBBox = lbl == null ? void 0 : lbl.getBBox();
+ verticalPos += ((memberBBox == null ? void 0 : memberBBox.height) ?? 0) + rowPadding;
+ });
+ verticalPos += lineHeight;
+ bottomLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
+ verticalPos += lineHeight;
+ classMethods.forEach((lbl) => {
+ select(lbl).attr(
+ "transform",
+ "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
+ );
+ const memberBBox = lbl == null ? void 0 : lbl.getBBox();
+ verticalPos += ((memberBBox == null ? void 0 : memberBBox.height) ?? 0) + rowPadding;
+ });
+ rect2.attr("style", node.style).attr("class", "outer title-state").attr("x", -maxWidth / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth + node.padding).attr("height", maxHeight + node.padding);
+ updateNodeBounds(node, rect2);
+ node.intersect = function(point2) {
+ return intersect.rect(node, point2);
+ };
+ return shapeSvg;
+};
+const shapes = {
+ rhombus: question,
+ composite,
+ question,
+ rect,
+ labelRect,
+ rectWithTitle,
+ choice,
+ circle,
+ doublecircle,
+ stadium,
+ hexagon,
+ block_arrow,
+ rect_left_inv_arrow,
+ lean_right,
+ lean_left,
+ trapezoid,
+ inv_trapezoid,
+ rect_right_inv_arrow,
+ cylinder,
+ start,
+ end,
+ note: note$1,
+ subroutine,
+ fork: forkJoin,
+ join: forkJoin,
+ class_box
+};
+let nodeElems = {};
+const insertNode = async (elem, node, dir) => {
+ let newEl;
+ let el;
+ if (node.link) {
+ let target;
+ if (getConfig().securityLevel === "sandbox") {
+ target = "_top";
+ } else if (node.linkTarget) {
+ target = node.linkTarget || "_blank";
+ }
+ newEl = elem.insert("svg:a").attr("xlink:href", node.link).attr("target", target);
+ el = await shapes[node.shape](newEl, node, dir);
+ } else {
+ el = await shapes[node.shape](elem, node, dir);
+ newEl = el;
+ }
+ if (node.tooltip) {
+ el.attr("title", node.tooltip);
+ }
+ if (node.class) {
+ el.attr("class", "node default " + node.class);
+ }
+ newEl.attr("data-node", "true");
+ newEl.attr("data-id", node.id);
+ nodeElems[node.id] = newEl;
+ if (node.haveCallback) {
+ nodeElems[node.id].attr("class", nodeElems[node.id].attr("class") + " clickable");
+ }
+ return newEl;
+};
+const setNodeElem = (elem, node) => {
+ nodeElems[node.id] = elem;
+};
+const clear$1 = () => {
+ nodeElems = {};
+};
+const positionNode = (node) => {
+ const el = nodeElems[node.id];
+ log$1.trace(
+ "Transforming node",
+ node.diff,
+ node,
+ "translate(" + (node.x - node.width / 2 - 5) + ", " + node.width / 2 + ")"
+ );
+ const padding = 8;
+ const diff = node.diff || 0;
+ if (node.clusterNode) {
+ el.attr(
+ "transform",
+ "translate(" + (node.x + diff - node.width / 2) + ", " + (node.y - node.height / 2 - padding) + ")"
+ );
+ } else {
+ el.attr("transform", "translate(" + node.x + ", " + node.y + ")");
+ }
+ return diff;
+};
+const getSubGraphTitleMargins = ({
+ flowchart
+}) => {
+ var _a, _b;
+ const subGraphTitleTopMargin = ((_a = flowchart == null ? void 0 : flowchart.subGraphTitleMargin) == null ? void 0 : _a.top) ?? 0;
+ const subGraphTitleBottomMargin = ((_b = flowchart == null ? void 0 : flowchart.subGraphTitleMargin) == null ? void 0 : _b.bottom) ?? 0;
+ const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
+ return {
+ subGraphTitleTopMargin,
+ subGraphTitleBottomMargin,
+ subGraphTitleTotalMargin
+ };
+};
+const markerOffsets = {
+ aggregation: 18,
+ extension: 18,
+ composition: 18,
+ dependency: 6,
+ lollipop: 13.5,
+ arrow_point: 5.3
+};
+function calculateDeltaAndAngle(point1, point2) {
+ if (point1 === void 0 || point2 === void 0) {
+ return { angle: 0, deltaX: 0, deltaY: 0 };
+ }
+ point1 = pointTransformer(point1);
+ point2 = pointTransformer(point2);
+ const [x1, y1] = [point1.x, point1.y];
+ const [x2, y2] = [point2.x, point2.y];
+ const deltaX = x2 - x1;
+ const deltaY = y2 - y1;
+ return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY };
+}
+const pointTransformer = (data) => {
+ if (Array.isArray(data)) {
+ return { x: data[0], y: data[1] };
+ }
+ return data;
+};
+const getLineFunctionsWithOffset = (edge) => {
+ return {
+ x: function(d, i, data) {
+ let offset = 0;
+ if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
+ const { angle, deltaX } = calculateDeltaAndAngle(data[0], data[1]);
+ offset = markerOffsets[edge.arrowTypeStart] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
+ } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
+ const { angle, deltaX } = calculateDeltaAndAngle(
+ data[data.length - 1],
+ data[data.length - 2]
+ );
+ offset = markerOffsets[edge.arrowTypeEnd] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
+ }
+ return pointTransformer(d).x + offset;
+ },
+ y: function(d, i, data) {
+ let offset = 0;
+ if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
+ const { angle, deltaY } = calculateDeltaAndAngle(data[0], data[1]);
+ offset = markerOffsets[edge.arrowTypeStart] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
+ } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
+ const { angle, deltaY } = calculateDeltaAndAngle(
+ data[data.length - 1],
+ data[data.length - 2]
+ );
+ offset = markerOffsets[edge.arrowTypeEnd] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
+ }
+ return pointTransformer(d).y + offset;
+ }
+ };
+};
+const addEdgeMarkers = (svgPath, edge, url, id, diagramType) => {
+ if (edge.arrowTypeStart) {
+ addEdgeMarker(svgPath, "start", edge.arrowTypeStart, url, id, diagramType);
+ }
+ if (edge.arrowTypeEnd) {
+ addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id, diagramType);
+ }
+};
+const arrowTypesMap = {
+ arrow_cross: "cross",
+ arrow_point: "point",
+ arrow_barb: "barb",
+ arrow_circle: "circle",
+ aggregation: "aggregation",
+ extension: "extension",
+ composition: "composition",
+ dependency: "dependency",
+ lollipop: "lollipop"
+};
+const addEdgeMarker = (svgPath, position, arrowType, url, id, diagramType) => {
+ const endMarkerType = arrowTypesMap[arrowType];
+ if (!endMarkerType) {
+ log$1.warn(`Unknown arrow type: ${arrowType}`);
+ return;
+ }
+ const suffix = position === "start" ? "Start" : "End";
+ svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);
+};
+let edgeLabels = {};
+let terminalLabels = {};
+const clear = () => {
+ edgeLabels = {};
+ terminalLabels = {};
+};
+const insertEdgeLabel = (elem, edge) => {
+ const useHtmlLabels = evaluate(getConfig().flowchart.htmlLabels);
+ const labelElement = edge.labelType === "markdown" ? createText(elem, edge.label, {
+ style: edge.labelStyle,
+ useHtmlLabels,
+ addSvgBackground: true
+ }) : createLabel$1(edge.label, edge.labelStyle);
+ const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
+ const label = edgeLabel.insert("g").attr("class", "label");
+ label.node().appendChild(labelElement);
+ let bbox = labelElement.getBBox();
+ if (useHtmlLabels) {
+ const div = labelElement.children[0];
+ const dv = select(labelElement);
+ bbox = div.getBoundingClientRect();
+ dv.attr("width", bbox.width);
+ dv.attr("height", bbox.height);
+ }
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
+ edgeLabels[edge.id] = edgeLabel;
+ edge.width = bbox.width;
+ edge.height = bbox.height;
+ let fo;
+ if (edge.startLabelLeft) {
+ const startLabelElement = createLabel$1(edge.startLabelLeft, edge.labelStyle);
+ const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = startEdgeLabelLeft.insert("g").attr("class", "inner");
+ fo = inner.node().appendChild(startLabelElement);
+ const slBox = startLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
+ setTerminalWidth(fo, edge.startLabelLeft);
+ }
+ if (edge.startLabelRight) {
+ const startLabelElement = createLabel$1(edge.startLabelRight, edge.labelStyle);
+ const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = startEdgeLabelRight.insert("g").attr("class", "inner");
+ fo = startEdgeLabelRight.node().appendChild(startLabelElement);
+ inner.node().appendChild(startLabelElement);
+ const slBox = startLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].startRight = startEdgeLabelRight;
+ setTerminalWidth(fo, edge.startLabelRight);
+ }
+ if (edge.endLabelLeft) {
+ const endLabelElement = createLabel$1(edge.endLabelLeft, edge.labelStyle);
+ const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = endEdgeLabelLeft.insert("g").attr("class", "inner");
+ fo = inner.node().appendChild(endLabelElement);
+ const slBox = endLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ endEdgeLabelLeft.node().appendChild(endLabelElement);
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
+ setTerminalWidth(fo, edge.endLabelLeft);
+ }
+ if (edge.endLabelRight) {
+ const endLabelElement = createLabel$1(edge.endLabelRight, edge.labelStyle);
+ const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
+ const inner = endEdgeLabelRight.insert("g").attr("class", "inner");
+ fo = inner.node().appendChild(endLabelElement);
+ const slBox = endLabelElement.getBBox();
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
+ endEdgeLabelRight.node().appendChild(endLabelElement);
+ if (!terminalLabels[edge.id]) {
+ terminalLabels[edge.id] = {};
+ }
+ terminalLabels[edge.id].endRight = endEdgeLabelRight;
+ setTerminalWidth(fo, edge.endLabelRight);
+ }
+ return labelElement;
+};
+function setTerminalWidth(fo, value) {
+ if (getConfig().flowchart.htmlLabels && fo) {
+ fo.style.width = value.length * 9 + "px";
+ fo.style.height = "12px";
+ }
+}
+const positionEdgeLabel = (edge, paths) => {
+ log$1.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels[edge.id], paths);
+ let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
+ const siteConfig = getConfig();
+ const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
+ if (edge.label) {
+ const el = edgeLabels[edge.id];
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcLabelPosition(path);
+ log$1.debug(
+ "Moving label " + edge.label + " from (",
+ x,
+ ",",
+ y,
+ ") to (",
+ pos.x,
+ ",",
+ pos.y,
+ ") abc88"
+ );
+ if (paths.updatedPath) {
+ x = pos.x;
+ y = pos.y;
+ }
+ }
+ el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
+ }
+ if (edge.startLabelLeft) {
+ const el = terminalLabels[edge.id].startLeft;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+ if (edge.startLabelRight) {
+ const el = terminalLabels[edge.id].startRight;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(
+ edge.arrowTypeStart ? 10 : 0,
+ "start_right",
+ path
+ );
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+ if (edge.endLabelLeft) {
+ const el = terminalLabels[edge.id].endLeft;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+ if (edge.endLabelRight) {
+ const el = terminalLabels[edge.id].endRight;
+ let x = edge.x;
+ let y = edge.y;
+ if (path) {
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
+ x = pos.x;
+ y = pos.y;
+ }
+ el.attr("transform", `translate(${x}, ${y})`);
+ }
+};
+const outsideNode = (node, point2) => {
+ const x = node.x;
+ const y = node.y;
+ const dx = Math.abs(point2.x - x);
+ const dy = Math.abs(point2.y - y);
+ const w = node.width / 2;
+ const h = node.height / 2;
+ if (dx >= w || dy >= h) {
+ return true;
+ }
+ return false;
+};
+const intersection = (node, outsidePoint, insidePoint) => {
+ log$1.debug(`intersection calc abc89:
+ outsidePoint: ${JSON.stringify(outsidePoint)}
+ insidePoint : ${JSON.stringify(insidePoint)}
+ node : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
+ const x = node.x;
+ const y = node.y;
+ const dx = Math.abs(x - insidePoint.x);
+ const w = node.width / 2;
+ let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
+ const h = node.height / 2;
+ const Q = Math.abs(outsidePoint.y - insidePoint.y);
+ const R = Math.abs(outsidePoint.x - insidePoint.x);
+ if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
+ let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
+ r = R * q / Q;
+ const res = {
+ x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
+ y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
+ };
+ if (r === 0) {
+ res.x = outsidePoint.x;
+ res.y = outsidePoint.y;
+ }
+ if (R === 0) {
+ res.x = outsidePoint.x;
+ }
+ if (Q === 0) {
+ res.y = outsidePoint.y;
+ }
+ log$1.debug(`abc89 topp/bott calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
+ return res;
+ } else {
+ if (insidePoint.x < outsidePoint.x) {
+ r = outsidePoint.x - w - x;
+ } else {
+ r = x - w - outsidePoint.x;
+ }
+ let q = Q * r / R;
+ let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
+ let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
+ log$1.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });
+ if (r === 0) {
+ _x = outsidePoint.x;
+ _y = outsidePoint.y;
+ }
+ if (R === 0) {
+ _x = outsidePoint.x;
+ }
+ if (Q === 0) {
+ _y = outsidePoint.y;
+ }
+ return { x: _x, y: _y };
+ }
+};
+const cutPathAtIntersect = (_points, boundaryNode) => {
+ log$1.debug("abc88 cutPathAtIntersect", _points, boundaryNode);
+ let points = [];
+ let lastPointOutside = _points[0];
+ let isInside = false;
+ _points.forEach((point2) => {
+ if (!outsideNode(boundaryNode, point2) && !isInside) {
+ const inter = intersection(boundaryNode, lastPointOutside, point2);
+ let pointPresent = false;
+ points.forEach((p) => {
+ pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
+ });
+ if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
+ points.push(inter);
+ }
+ isInside = true;
+ } else {
+ lastPointOutside = point2;
+ if (!isInside) {
+ points.push(point2);
+ }
+ }
+ });
+ return points;
+};
+const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph, id) {
+ let points = edge.points;
+ log$1.debug("abc88 InsertEdge: edge=", edge, "e=", e);
+ let pointsHasChanged = false;
+ const tail = graph.node(e.v);
+ var head = graph.node(e.w);
+ if ((head == null ? void 0 : head.intersect) && (tail == null ? void 0 : tail.intersect)) {
+ points = points.slice(1, edge.points.length - 1);
+ points.unshift(tail.intersect(points[0]));
+ points.push(head.intersect(points[points.length - 1]));
+ }
+ if (edge.toCluster) {
+ log$1.debug("to cluster abc88", clusterDb[edge.toCluster]);
+ points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node);
+ pointsHasChanged = true;
+ }
+ if (edge.fromCluster) {
+ log$1.debug("from cluster abc88", clusterDb[edge.fromCluster]);
+ points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse();
+ pointsHasChanged = true;
+ }
+ const lineData = points.filter((p) => !Number.isNaN(p.y));
+ let curve = curveBasis;
+ if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) {
+ curve = edge.curve;
+ }
+ const { x, y } = getLineFunctionsWithOffset(edge);
+ const lineFunction = line().x(x).y(y).curve(curve);
+ let strokeClasses;
+ switch (edge.thickness) {
+ case "normal":
+ strokeClasses = "edge-thickness-normal";
+ break;
+ case "thick":
+ strokeClasses = "edge-thickness-thick";
+ break;
+ case "invisible":
+ strokeClasses = "edge-thickness-thick";
+ break;
+ default:
+ strokeClasses = "";
+ }
+ switch (edge.pattern) {
+ case "solid":
+ strokeClasses += " edge-pattern-solid";
+ break;
+ case "dotted":
+ strokeClasses += " edge-pattern-dotted";
+ break;
+ case "dashed":
+ strokeClasses += " edge-pattern-dashed";
+ break;
+ }
+ const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style);
+ let url = "";
+ if (getConfig().flowchart.arrowMarkerAbsolute || getConfig().state.arrowMarkerAbsolute) {
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+ url = url.replace(/\(/g, "\\(");
+ url = url.replace(/\)/g, "\\)");
+ }
+ addEdgeMarkers(svgPath, edge, url, id, diagramType);
+ let paths = {};
+ if (pointsHasChanged) {
+ paths.updatedPath = points;
+ }
+ paths.originalPath = edge.points;
+ return paths;
+};
+
+export { insertNode as a, insertEdgeLabel as b, insertEdge as c, positionEdgeLabel as d, clear$1 as e, clear as f, getSubGraphTitleMargins as g, createLabel$1 as h, insertMarkers$1 as i, intersectRect$1 as j, getLineFunctionsWithOffset as k, labelHelper as l, addEdgeMarkers as m, positionNode as p, setNodeElem as s, updateNodeBounds as u };
diff --git a/libs/marked/erDiagram-09d1c15f-CNysBsxR.js b/libs/marked/erDiagram-09d1c15f-CNysBsxR.js
new file mode 100644
index 0000000..d6d55b3
--- /dev/null
+++ b/libs/marked/erDiagram-09d1c15f-CNysBsxR.js
@@ -0,0 +1,1384 @@
+import { c as getConfig, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, C as setDiagramTitle, D as getDiagramTitle, l as log$1, E as clear$1, h as select, A as utils, i as configureSvgSize, F as curveBasis, G as parseGenericTypes } from './index-Bd_FDXSq.js';
+import { G as Graph } from './graph-KZW2Npeo.js';
+import { l as layout } from './layout-BnytXFfq.js';
+import { l as line } from './line-DUwhS6kk.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+
+var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
+
+function validate(uuid) {
+ return typeof uuid === 'string' && REGEX.test(uuid);
+}
+
+/**
+ * Convert array of 16 byte values to UUID string format of the form:
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ */
+
+const byteToHex = [];
+
+for (let i = 0; i < 256; ++i) {
+ byteToHex.push((i + 0x100).toString(16).slice(1));
+}
+
+function unsafeStringify(arr, offset = 0) {
+ // Note: Be careful editing this code! It's been tuned for performance
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
+}
+
+function parse(uuid) {
+ if (!validate(uuid)) {
+ throw TypeError('Invalid UUID');
+ }
+
+ let v;
+ const arr = new Uint8Array(16); // Parse ########-....-....-....-............
+
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
+ arr[1] = v >>> 16 & 0xff;
+ arr[2] = v >>> 8 & 0xff;
+ arr[3] = v & 0xff; // Parse ........-####-....-....-............
+
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
+ arr[5] = v & 0xff; // Parse ........-....-####-....-............
+
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
+ arr[7] = v & 0xff; // Parse ........-....-....-####-............
+
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
+ arr[9] = v & 0xff; // Parse ........-....-....-....-############
+ // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
+
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
+ arr[11] = v / 0x100000000 & 0xff;
+ arr[12] = v >>> 24 & 0xff;
+ arr[13] = v >>> 16 & 0xff;
+ arr[14] = v >>> 8 & 0xff;
+ arr[15] = v & 0xff;
+ return arr;
+}
+
+function stringToBytes(str) {
+ str = unescape(encodeURIComponent(str)); // UTF8 escape
+
+ const bytes = [];
+
+ for (let i = 0; i < str.length; ++i) {
+ bytes.push(str.charCodeAt(i));
+ }
+
+ return bytes;
+}
+
+const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
+const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
+function v35(name, version, hashfunc) {
+ function generateUUID(value, namespace, buf, offset) {
+ var _namespace;
+
+ if (typeof value === 'string') {
+ value = stringToBytes(value);
+ }
+
+ if (typeof namespace === 'string') {
+ namespace = parse(namespace);
+ }
+
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
+ } // Compute hash of namespace and value, Per 4.3
+ // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
+ // hashfunc([...namespace, ... value])`
+
+
+ let bytes = new Uint8Array(16 + value.length);
+ bytes.set(namespace);
+ bytes.set(value, namespace.length);
+ bytes = hashfunc(bytes);
+ bytes[6] = bytes[6] & 0x0f | version;
+ bytes[8] = bytes[8] & 0x3f | 0x80;
+
+ if (buf) {
+ offset = offset || 0;
+
+ for (let i = 0; i < 16; ++i) {
+ buf[offset + i] = bytes[i];
+ }
+
+ return buf;
+ }
+
+ return unsafeStringify(bytes);
+ } // Function#name is not settable on some platforms (#270)
+
+
+ try {
+ generateUUID.name = name; // eslint-disable-next-line no-empty
+ } catch (err) {} // For CommonJS default export support
+
+
+ generateUUID.DNS = DNS;
+ generateUUID.URL = URL;
+ return generateUUID;
+}
+
+// Adapted from Chris Veness' SHA1 code at
+// http://www.movable-type.co.uk/scripts/sha1.html
+function f(s, x, y, z) {
+ switch (s) {
+ case 0:
+ return x & y ^ ~x & z;
+
+ case 1:
+ return x ^ y ^ z;
+
+ case 2:
+ return x & y ^ x & z ^ y & z;
+
+ case 3:
+ return x ^ y ^ z;
+ }
+}
+
+function ROTL(x, n) {
+ return x << n | x >>> 32 - n;
+}
+
+function sha1(bytes) {
+ const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
+ const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
+
+ if (typeof bytes === 'string') {
+ const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
+
+ bytes = [];
+
+ for (let i = 0; i < msg.length; ++i) {
+ bytes.push(msg.charCodeAt(i));
+ }
+ } else if (!Array.isArray(bytes)) {
+ // Convert Array-like to Array
+ bytes = Array.prototype.slice.call(bytes);
+ }
+
+ bytes.push(0x80);
+ const l = bytes.length / 4 + 2;
+ const N = Math.ceil(l / 16);
+ const M = new Array(N);
+
+ for (let i = 0; i < N; ++i) {
+ const arr = new Uint32Array(16);
+
+ for (let j = 0; j < 16; ++j) {
+ arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
+ }
+
+ M[i] = arr;
+ }
+
+ M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
+ M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
+
+ for (let i = 0; i < N; ++i) {
+ const W = new Uint32Array(80);
+
+ for (let t = 0; t < 16; ++t) {
+ W[t] = M[i][t];
+ }
+
+ for (let t = 16; t < 80; ++t) {
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
+ }
+
+ let a = H[0];
+ let b = H[1];
+ let c = H[2];
+ let d = H[3];
+ let e = H[4];
+
+ for (let t = 0; t < 80; ++t) {
+ const s = Math.floor(t / 20);
+ const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
+ e = d;
+ d = c;
+ c = ROTL(b, 30) >>> 0;
+ b = a;
+ a = T;
+ }
+
+ H[0] = H[0] + a >>> 0;
+ H[1] = H[1] + b >>> 0;
+ H[2] = H[2] + c >>> 0;
+ H[3] = H[3] + d >>> 0;
+ H[4] = H[4] + e >>> 0;
+ }
+
+ return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
+}
+
+const v5 = v35('v5', 0x50, sha1);
+
+var parser = function() {
+ var o = function(k, v, o2, l) {
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
+ ;
+ return o2;
+ }, $V0 = [6, 8, 10, 20, 22, 24, 26, 27, 28], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 14], $V6 = [1, 15], $V7 = [1, 21], $V8 = [1, 22], $V9 = [1, 23], $Va = [1, 24], $Vb = [1, 25], $Vc = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], $Vd = [1, 34], $Ve = [27, 28, 46, 47], $Vf = [41, 42, 43, 44, 45], $Vg = [17, 34], $Vh = [1, 54], $Vi = [1, 53], $Vj = [17, 34, 36, 38];
+ var parser2 = {
+ trace: function trace() {
+ },
+ yy: {},
+ symbols_: { "error": 2, "start": 3, "ER_DIAGRAM": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "entityName": 11, "relSpec": 12, ":": 13, "role": 14, "BLOCK_START": 15, "attributes": 16, "BLOCK_STOP": 17, "SQS": 18, "SQE": 19, "title": 20, "title_value": 21, "acc_title": 22, "acc_title_value": 23, "acc_descr": 24, "acc_descr_value": 25, "acc_descr_multiline_value": 26, "ALPHANUM": 27, "ENTITY_NAME": 28, "attribute": 29, "attributeType": 30, "attributeName": 31, "attributeKeyTypeList": 32, "attributeComment": 33, "ATTRIBUTE_WORD": 34, "attributeKeyType": 35, "COMMA": 36, "ATTRIBUTE_KEY": 37, "COMMENT": 38, "cardinality": 39, "relType": 40, "ZERO_OR_ONE": 41, "ZERO_OR_MORE": 42, "ONE_OR_MORE": 43, "ONLY_ONE": 44, "MD_PARENT": 45, "NON_IDENTIFYING": 46, "IDENTIFYING": 47, "WORD": 48, "$accept": 0, "$end": 1 },
+ terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
+ productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+ var $0 = $$.length - 1;
+ switch (yystate) {
+ case 1:
+ break;
+ case 2:
+ this.$ = [];
+ break;
+ case 3:
+ $$[$0 - 1].push($$[$0]);
+ this.$ = $$[$0 - 1];
+ break;
+ case 4:
+ case 5:
+ this.$ = $$[$0];
+ break;
+ case 6:
+ case 7:
+ this.$ = [];
+ break;
+ case 8:
+ yy.addEntity($$[$0 - 4]);
+ yy.addEntity($$[$0 - 2]);
+ yy.addRelationship($$[$0 - 4], $$[$0], $$[$0 - 2], $$[$0 - 3]);
+ break;
+ case 9:
+ yy.addEntity($$[$0 - 3]);
+ yy.addAttributes($$[$0 - 3], $$[$0 - 1]);
+ break;
+ case 10:
+ yy.addEntity($$[$0 - 2]);
+ break;
+ case 11:
+ yy.addEntity($$[$0]);
+ break;
+ case 12:
+ yy.addEntity($$[$0 - 6], $$[$0 - 4]);
+ yy.addAttributes($$[$0 - 6], $$[$0 - 1]);
+ break;
+ case 13:
+ yy.addEntity($$[$0 - 5], $$[$0 - 3]);
+ break;
+ case 14:
+ yy.addEntity($$[$0 - 3], $$[$0 - 1]);
+ break;
+ case 15:
+ case 16:
+ this.$ = $$[$0].trim();
+ yy.setAccTitle(this.$);
+ break;
+ case 17:
+ case 18:
+ this.$ = $$[$0].trim();
+ yy.setAccDescription(this.$);
+ break;
+ case 19:
+ case 43:
+ this.$ = $$[$0];
+ break;
+ case 20:
+ case 41:
+ case 42:
+ this.$ = $$[$0].replace(/"/g, "");
+ break;
+ case 21:
+ case 29:
+ this.$ = [$$[$0]];
+ break;
+ case 22:
+ $$[$0].push($$[$0 - 1]);
+ this.$ = $$[$0];
+ break;
+ case 23:
+ this.$ = { attributeType: $$[$0 - 1], attributeName: $$[$0] };
+ break;
+ case 24:
+ this.$ = { attributeType: $$[$0 - 2], attributeName: $$[$0 - 1], attributeKeyTypeList: $$[$0] };
+ break;
+ case 25:
+ this.$ = { attributeType: $$[$0 - 2], attributeName: $$[$0 - 1], attributeComment: $$[$0] };
+ break;
+ case 26:
+ this.$ = { attributeType: $$[$0 - 3], attributeName: $$[$0 - 2], attributeKeyTypeList: $$[$0 - 1], attributeComment: $$[$0] };
+ break;
+ case 27:
+ case 28:
+ case 31:
+ this.$ = $$[$0];
+ break;
+ case 30:
+ $$[$0 - 2].push($$[$0]);
+ this.$ = $$[$0 - 2];
+ break;
+ case 32:
+ this.$ = $$[$0].replace(/"/g, "");
+ break;
+ case 33:
+ this.$ = { cardA: $$[$0], relType: $$[$0 - 1], cardB: $$[$0 - 2] };
+ break;
+ case 34:
+ this.$ = yy.Cardinality.ZERO_OR_ONE;
+ break;
+ case 35:
+ this.$ = yy.Cardinality.ZERO_OR_MORE;
+ break;
+ case 36:
+ this.$ = yy.Cardinality.ONE_OR_MORE;
+ break;
+ case 37:
+ this.$ = yy.Cardinality.ONLY_ONE;
+ break;
+ case 38:
+ this.$ = yy.Cardinality.MD_PARENT;
+ break;
+ case 39:
+ this.$ = yy.Identification.NON_IDENTIFYING;
+ break;
+ case 40:
+ this.$ = yy.Identification.IDENTIFYING;
+ break;
+ }
+ },
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 16, 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, o($V0, [2, 18]), o($Vc, [2, 19]), o($Vc, [2, 20]), o($V0, [2, 4]), { 11: 29, 27: $V5, 28: $V6 }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: $Vd }, { 11: 35, 27: $V5, 28: $V6 }, { 40: 36, 46: [1, 37], 47: [1, 38] }, o($Ve, [2, 34]), o($Ve, [2, 35]), o($Ve, [2, 36]), o($Ve, [2, 37]), o($Ve, [2, 38]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, o($V0, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: $Vd }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }, o($Vf, [2, 39]), o($Vf, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, o($V0, [2, 9]), { 17: [2, 22] }, o($Vg, [2, 23], { 32: 50, 33: 51, 35: 52, 37: $Vh, 38: $Vi }), o([17, 34, 37, 38], [2, 28]), o($V0, [2, 14], { 15: [1, 55] }), o([27, 28], [2, 33]), o($V0, [2, 8]), o($V0, [2, 41]), o($V0, [2, 42]), o($V0, [2, 43]), o($Vg, [2, 24], { 33: 56, 36: [1, 57], 38: $Vi }), o($Vg, [2, 25]), o($Vj, [2, 29]), o($Vg, [2, 32]), o($Vj, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: $Vd }, o($Vg, [2, 26]), { 35: 60, 37: $Vh }, { 17: [1, 61] }, o($V0, [2, 13]), o($Vj, [2, 30]), o($V0, [2, 12])],
+ defaultActions: { 34: [2, 27], 41: [2, 22] },
+ parseError: function parseError(str, hash) {
+ if (hash.recoverable) {
+ this.trace(str);
+ } else {
+ var error = new Error(str);
+ error.hash = hash;
+ throw error;
+ }
+ },
+ parse: function parse(input) {
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+ var args = lstack.slice.call(arguments, 1);
+ var lexer2 = Object.create(this.lexer);
+ var sharedState = { yy: {} };
+ for (var k in this.yy) {
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
+ sharedState.yy[k] = this.yy[k];
+ }
+ }
+ lexer2.setInput(input, sharedState.yy);
+ sharedState.yy.lexer = lexer2;
+ sharedState.yy.parser = this;
+ if (typeof lexer2.yylloc == "undefined") {
+ lexer2.yylloc = {};
+ }
+ var yyloc = lexer2.yylloc;
+ lstack.push(yyloc);
+ var ranges = lexer2.options && lexer2.options.ranges;
+ if (typeof sharedState.yy.parseError === "function") {
+ this.parseError = sharedState.yy.parseError;
+ } else {
+ this.parseError = Object.getPrototypeOf(this).parseError;
+ }
+ function lex() {
+ var token;
+ token = tstack.pop() || lexer2.lex() || EOF;
+ if (typeof token !== "number") {
+ if (token instanceof Array) {
+ tstack = token;
+ token = tstack.pop();
+ }
+ token = self.symbols_[token] || token;
+ }
+ return token;
+ }
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+ while (true) {
+ state = stack[stack.length - 1];
+ if (this.defaultActions[state]) {
+ action = this.defaultActions[state];
+ } else {
+ if (symbol === null || typeof symbol == "undefined") {
+ symbol = lex();
+ }
+ action = table[state] && table[state][symbol];
+ }
+ if (typeof action === "undefined" || !action.length || !action[0]) {
+ var errStr = "";
+ expected = [];
+ for (p in table[state]) {
+ if (this.terminals_[p] && p > TERROR) {
+ expected.push("'" + this.terminals_[p] + "'");
+ }
+ }
+ if (lexer2.showPosition) {
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
+ } else {
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
+ }
+ this.parseError(errStr, {
+ text: lexer2.match,
+ token: this.terminals_[symbol] || symbol,
+ line: lexer2.yylineno,
+ loc: yyloc,
+ expected
+ });
+ }
+ if (action[0] instanceof Array && action.length > 1) {
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
+ }
+ switch (action[0]) {
+ case 1:
+ stack.push(symbol);
+ vstack.push(lexer2.yytext);
+ lstack.push(lexer2.yylloc);
+ stack.push(action[1]);
+ symbol = null;
+ {
+ yyleng = lexer2.yyleng;
+ yytext = lexer2.yytext;
+ yylineno = lexer2.yylineno;
+ yyloc = lexer2.yylloc;
+ }
+ break;
+ case 2:
+ len = this.productions_[action[1]][1];
+ yyval.$ = vstack[vstack.length - len];
+ yyval._$ = {
+ first_line: lstack[lstack.length - (len || 1)].first_line,
+ last_line: lstack[lstack.length - 1].last_line,
+ first_column: lstack[lstack.length - (len || 1)].first_column,
+ last_column: lstack[lstack.length - 1].last_column
+ };
+ if (ranges) {
+ yyval._$.range = [
+ lstack[lstack.length - (len || 1)].range[0],
+ lstack[lstack.length - 1].range[1]
+ ];
+ }
+ r = this.performAction.apply(yyval, [
+ yytext,
+ yyleng,
+ yylineno,
+ sharedState.yy,
+ action[1],
+ vstack,
+ lstack
+ ].concat(args));
+ if (typeof r !== "undefined") {
+ return r;
+ }
+ if (len) {
+ stack = stack.slice(0, -1 * len * 2);
+ vstack = vstack.slice(0, -1 * len);
+ lstack = lstack.slice(0, -1 * len);
+ }
+ stack.push(this.productions_[action[1]][0]);
+ vstack.push(yyval.$);
+ lstack.push(yyval._$);
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
+ stack.push(newState);
+ break;
+ case 3:
+ return true;
+ }
+ }
+ return true;
+ }
+ };
+ var lexer = function() {
+ var lexer2 = {
+ EOF: 1,
+ parseError: function parseError(str, hash) {
+ if (this.yy.parser) {
+ this.yy.parser.parseError(str, hash);
+ } else {
+ throw new Error(str);
+ }
+ },
+ // resets the lexer, sets new input
+ setInput: function(input, yy) {
+ this.yy = yy || this.yy || {};
+ this._input = input;
+ this._more = this._backtrack = this.done = false;
+ this.yylineno = this.yyleng = 0;
+ this.yytext = this.matched = this.match = "";
+ this.conditionStack = ["INITIAL"];
+ this.yylloc = {
+ first_line: 1,
+ first_column: 0,
+ last_line: 1,
+ last_column: 0
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [0, 0];
+ }
+ this.offset = 0;
+ return this;
+ },
+ // consumes and returns one char from the input
+ input: function() {
+ var ch = this._input[0];
+ this.yytext += ch;
+ this.yyleng++;
+ this.offset++;
+ this.match += ch;
+ this.matched += ch;
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno++;
+ this.yylloc.last_line++;
+ } else {
+ this.yylloc.last_column++;
+ }
+ if (this.options.ranges) {
+ this.yylloc.range[1]++;
+ }
+ this._input = this._input.slice(1);
+ return ch;
+ },
+ // unshifts one char (or a string) into the input
+ unput: function(ch) {
+ var len = ch.length;
+ var lines = ch.split(/(?:\r\n?|\n)/g);
+ this._input = ch + this._input;
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
+ this.offset -= len;
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
+ this.match = this.match.substr(0, this.match.length - 1);
+ this.matched = this.matched.substr(0, this.matched.length - 1);
+ if (lines.length - 1) {
+ this.yylineno -= lines.length - 1;
+ }
+ var r = this.yylloc.range;
+ this.yylloc = {
+ first_line: this.yylloc.first_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.first_column,
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
+ }
+ this.yyleng = this.yytext.length;
+ return this;
+ },
+ // When called from action, caches matched text and appends it on next action
+ more: function() {
+ this._more = true;
+ return this;
+ },
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
+ reject: function() {
+ if (this.options.backtrack_lexer) {
+ this._backtrack = true;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ return this;
+ },
+ // retain first n characters of the match
+ less: function(n) {
+ this.unput(this.match.slice(n));
+ },
+ // displays already matched input, i.e. for error messages
+ pastInput: function() {
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
+ },
+ // displays upcoming input, i.e. for error messages
+ upcomingInput: function() {
+ var next = this.match;
+ if (next.length < 20) {
+ next += this._input.substr(0, 20 - next.length);
+ }
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
+ },
+ // displays the character position where the lexing error occurred, i.e. for error messages
+ showPosition: function() {
+ var pre = this.pastInput();
+ var c = new Array(pre.length + 1).join("-");
+ return pre + this.upcomingInput() + "\n" + c + "^";
+ },
+ // test the lexed token: return FALSE when not a match, otherwise return token
+ test_match: function(match, indexed_rule) {
+ var token, lines, backup;
+ if (this.options.backtrack_lexer) {
+ backup = {
+ yylineno: this.yylineno,
+ yylloc: {
+ first_line: this.yylloc.first_line,
+ last_line: this.last_line,
+ first_column: this.yylloc.first_column,
+ last_column: this.yylloc.last_column
+ },
+ yytext: this.yytext,
+ match: this.match,
+ matches: this.matches,
+ matched: this.matched,
+ yyleng: this.yyleng,
+ offset: this.offset,
+ _more: this._more,
+ _input: this._input,
+ yy: this.yy,
+ conditionStack: this.conditionStack.slice(0),
+ done: this.done
+ };
+ if (this.options.ranges) {
+ backup.yylloc.range = this.yylloc.range.slice(0);
+ }
+ }
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno += lines.length;
+ }
+ this.yylloc = {
+ first_line: this.yylloc.last_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.last_column,
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
+ };
+ this.yytext += match[0];
+ this.match += match[0];
+ this.matches = match;
+ this.yyleng = this.yytext.length;
+ if (this.options.ranges) {
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
+ }
+ this._more = false;
+ this._backtrack = false;
+ this._input = this._input.slice(match[0].length);
+ this.matched += match[0];
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
+ if (this.done && this._input) {
+ this.done = false;
+ }
+ if (token) {
+ return token;
+ } else if (this._backtrack) {
+ for (var k in backup) {
+ this[k] = backup[k];
+ }
+ return false;
+ }
+ return false;
+ },
+ // return next match in input
+ next: function() {
+ if (this.done) {
+ return this.EOF;
+ }
+ if (!this._input) {
+ this.done = true;
+ }
+ var token, match, tempMatch, index;
+ if (!this._more) {
+ this.yytext = "";
+ this.match = "";
+ }
+ var rules = this._currentRules();
+ for (var i = 0; i < rules.length; i++) {
+ tempMatch = this._input.match(this.rules[rules[i]]);
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
+ match = tempMatch;
+ index = i;
+ if (this.options.backtrack_lexer) {
+ token = this.test_match(tempMatch, rules[i]);
+ if (token !== false) {
+ return token;
+ } else if (this._backtrack) {
+ match = false;
+ continue;
+ } else {
+ return false;
+ }
+ } else if (!this.options.flex) {
+ break;
+ }
+ }
+ }
+ if (match) {
+ token = this.test_match(match, rules[index]);
+ if (token !== false) {
+ return token;
+ }
+ return false;
+ }
+ if (this._input === "") {
+ return this.EOF;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ },
+ // return next match that has a token
+ lex: function lex() {
+ var r = this.next();
+ if (r) {
+ return r;
+ } else {
+ return this.lex();
+ }
+ },
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
+ begin: function begin(condition) {
+ this.conditionStack.push(condition);
+ },
+ // pop the previously active lexer condition state off the condition stack
+ popState: function popState() {
+ var n = this.conditionStack.length - 1;
+ if (n > 0) {
+ return this.conditionStack.pop();
+ } else {
+ return this.conditionStack[0];
+ }
+ },
+ // produce the lexer rule set which is active for the currently active lexer condition state
+ _currentRules: function _currentRules() {
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
+ } else {
+ return this.conditions["INITIAL"].rules;
+ }
+ },
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
+ topState: function topState(n) {
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
+ if (n >= 0) {
+ return this.conditionStack[n];
+ } else {
+ return "INITIAL";
+ }
+ },
+ // alias for begin(condition)
+ pushState: function pushState(condition) {
+ this.begin(condition);
+ },
+ // return the number of states currently on the stack
+ stateStackSize: function stateStackSize() {
+ return this.conditionStack.length;
+ },
+ options: { "case-insensitive": true },
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+ switch ($avoiding_name_collisions) {
+ case 0:
+ this.begin("acc_title");
+ return 22;
+ case 1:
+ this.popState();
+ return "acc_title_value";
+ case 2:
+ this.begin("acc_descr");
+ return 24;
+ case 3:
+ this.popState();
+ return "acc_descr_value";
+ case 4:
+ this.begin("acc_descr_multiline");
+ break;
+ case 5:
+ this.popState();
+ break;
+ case 6:
+ return "acc_descr_multiline_value";
+ case 7:
+ return 10;
+ case 8:
+ break;
+ case 9:
+ return 8;
+ case 10:
+ return 28;
+ case 11:
+ return 48;
+ case 12:
+ return 4;
+ case 13:
+ this.begin("block");
+ return 15;
+ case 14:
+ return 36;
+ case 15:
+ break;
+ case 16:
+ return 37;
+ case 17:
+ return 34;
+ case 18:
+ return 34;
+ case 19:
+ return 38;
+ case 20:
+ break;
+ case 21:
+ this.popState();
+ return 17;
+ case 22:
+ return yy_.yytext[0];
+ case 23:
+ return 18;
+ case 24:
+ return 19;
+ case 25:
+ return 41;
+ case 26:
+ return 43;
+ case 27:
+ return 43;
+ case 28:
+ return 43;
+ case 29:
+ return 41;
+ case 30:
+ return 41;
+ case 31:
+ return 42;
+ case 32:
+ return 42;
+ case 33:
+ return 42;
+ case 34:
+ return 42;
+ case 35:
+ return 42;
+ case 36:
+ return 43;
+ case 37:
+ return 42;
+ case 38:
+ return 43;
+ case 39:
+ return 44;
+ case 40:
+ return 44;
+ case 41:
+ return 44;
+ case 42:
+ return 44;
+ case 43:
+ return 41;
+ case 44:
+ return 42;
+ case 45:
+ return 43;
+ case 46:
+ return 45;
+ case 47:
+ return 46;
+ case 48:
+ return 47;
+ case 49:
+ return 47;
+ case 50:
+ return 46;
+ case 51:
+ return 46;
+ case 52:
+ return 46;
+ case 53:
+ return 27;
+ case 54:
+ return yy_.yytext[0];
+ case 55:
+ return 6;
+ }
+ },
+ rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
+ conditions: { "acc_descr_multiline": { "rules": [5, 6], "inclusive": false }, "acc_descr": { "rules": [3], "inclusive": false }, "acc_title": { "rules": [1], "inclusive": false }, "block": { "rules": [14, 15, 16, 17, 18, 19, 20, 21, 22], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], "inclusive": true } }
+ };
+ return lexer2;
+ }();
+ parser2.lexer = lexer;
+ function Parser() {
+ this.yy = {};
+ }
+ Parser.prototype = parser2;
+ parser2.Parser = Parser;
+ return new Parser();
+}();
+parser.parser = parser;
+const erParser = parser;
+let entities = {};
+let relationships = [];
+const Cardinality = {
+ ZERO_OR_ONE: "ZERO_OR_ONE",
+ ZERO_OR_MORE: "ZERO_OR_MORE",
+ ONE_OR_MORE: "ONE_OR_MORE",
+ ONLY_ONE: "ONLY_ONE",
+ MD_PARENT: "MD_PARENT"
+};
+const Identification = {
+ NON_IDENTIFYING: "NON_IDENTIFYING",
+ IDENTIFYING: "IDENTIFYING"
+};
+const addEntity = function(name, alias = void 0) {
+ if (entities[name] === void 0) {
+ entities[name] = { attributes: [], alias };
+ log$1.info("Added new entity :", name);
+ } else if (entities[name] && !entities[name].alias && alias) {
+ entities[name].alias = alias;
+ log$1.info(`Add alias '${alias}' to entity '${name}'`);
+ }
+ return entities[name];
+};
+const getEntities = () => entities;
+const addAttributes = function(entityName, attribs) {
+ let entity = addEntity(entityName);
+ let i;
+ for (i = attribs.length - 1; i >= 0; i--) {
+ entity.attributes.push(attribs[i]);
+ log$1.debug("Added attribute ", attribs[i].attributeName);
+ }
+};
+const addRelationship = function(entA, rolA, entB, rSpec) {
+ let rel = {
+ entityA: entA,
+ roleA: rolA,
+ entityB: entB,
+ relSpec: rSpec
+ };
+ relationships.push(rel);
+ log$1.debug("Added new relationship :", rel);
+};
+const getRelationships = () => relationships;
+const clear = function() {
+ entities = {};
+ relationships = [];
+ clear$1();
+};
+const erDb = {
+ Cardinality,
+ Identification,
+ getConfig: () => getConfig().er,
+ addEntity,
+ addAttributes,
+ getEntities,
+ addRelationship,
+ getRelationships,
+ clear,
+ setAccTitle,
+ getAccTitle,
+ setAccDescription,
+ getAccDescription,
+ setDiagramTitle,
+ getDiagramTitle
+};
+const ERMarkers = {
+ ONLY_ONE_START: "ONLY_ONE_START",
+ ONLY_ONE_END: "ONLY_ONE_END",
+ ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
+ ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
+ ONE_OR_MORE_START: "ONE_OR_MORE_START",
+ ONE_OR_MORE_END: "ONE_OR_MORE_END",
+ ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
+ ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
+ MD_PARENT_END: "MD_PARENT_END",
+ MD_PARENT_START: "MD_PARENT_START"
+};
+const insertMarkers = function(elem, conf2) {
+ let marker;
+ elem.append("defs").append("marker").attr("id", ERMarkers.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", ERMarkers.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M9,0 L9,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,0 L21,18");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
+ return;
+};
+const erMarkers = {
+ ERMarkers,
+ insertMarkers
+};
+const BAD_ID_CHARS_REGEXP = /[^\dA-Za-z](\W)*/g;
+let conf = {};
+let entityNameIds = /* @__PURE__ */ new Map();
+const setConf = function(cnf) {
+ const keys = Object.keys(cnf);
+ for (const key of keys) {
+ conf[key] = cnf[key];
+ }
+};
+const drawAttributes = (groupNode, entityTextNode, attributes) => {
+ const heightPadding = conf.entityPadding / 3;
+ const widthPadding = conf.entityPadding / 3;
+ const attrFontSize = conf.fontSize * 0.85;
+ const labelBBox = entityTextNode.node().getBBox();
+ const attributeNodes = [];
+ let hasKeyType = false;
+ let hasComment = false;
+ let maxTypeWidth = 0;
+ let maxNameWidth = 0;
+ let maxKeyWidth = 0;
+ let maxCommentWidth = 0;
+ let cumulativeHeight = labelBBox.height + heightPadding * 2;
+ let attrNum = 1;
+ attributes.forEach((item) => {
+ if (item.attributeKeyTypeList !== void 0 && item.attributeKeyTypeList.length > 0) {
+ hasKeyType = true;
+ }
+ if (item.attributeComment !== void 0) {
+ hasComment = true;
+ }
+ });
+ attributes.forEach((item) => {
+ const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`;
+ let nodeHeight = 0;
+ const attributeType = parseGenericTypes(item.attributeType);
+ const typeNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(attributeType);
+ const nameNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(item.attributeName);
+ const attributeNode = {};
+ attributeNode.tn = typeNode;
+ attributeNode.nn = nameNode;
+ const typeBBox = typeNode.node().getBBox();
+ const nameBBox = nameNode.node().getBBox();
+ maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);
+ maxNameWidth = Math.max(maxNameWidth, nameBBox.width);
+ nodeHeight = Math.max(typeBBox.height, nameBBox.height);
+ if (hasKeyType) {
+ const keyTypeNodeText = item.attributeKeyTypeList !== void 0 ? item.attributeKeyTypeList.join(",") : "";
+ const keyTypeNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(keyTypeNodeText);
+ attributeNode.kn = keyTypeNode;
+ const keyTypeBBox = keyTypeNode.node().getBBox();
+ maxKeyWidth = Math.max(maxKeyWidth, keyTypeBBox.width);
+ nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);
+ }
+ if (hasComment) {
+ const commentNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(item.attributeComment || "");
+ attributeNode.cn = commentNode;
+ const commentNodeBBox = commentNode.node().getBBox();
+ maxCommentWidth = Math.max(maxCommentWidth, commentNodeBBox.width);
+ nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);
+ }
+ attributeNode.height = nodeHeight;
+ attributeNodes.push(attributeNode);
+ cumulativeHeight += nodeHeight + heightPadding * 2;
+ attrNum += 1;
+ });
+ let widthPaddingFactor = 4;
+ if (hasKeyType) {
+ widthPaddingFactor += 2;
+ }
+ if (hasComment) {
+ widthPaddingFactor += 2;
+ }
+ const maxWidth = maxTypeWidth + maxNameWidth + maxKeyWidth + maxCommentWidth;
+ const bBox = {
+ width: Math.max(
+ conf.minEntityWidth,
+ Math.max(
+ labelBBox.width + conf.entityPadding * 2,
+ maxWidth + widthPadding * widthPaddingFactor
+ )
+ ),
+ height: attributes.length > 0 ? cumulativeHeight : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2)
+ };
+ if (attributes.length > 0) {
+ const spareColumnWidth = Math.max(
+ 0,
+ (bBox.width - maxWidth - widthPadding * widthPaddingFactor) / (widthPaddingFactor / 2)
+ );
+ entityTextNode.attr(
+ "transform",
+ "translate(" + bBox.width / 2 + "," + (heightPadding + labelBBox.height / 2) + ")"
+ );
+ let heightOffset = labelBBox.height + heightPadding * 2;
+ let attribStyle = "attributeBoxOdd";
+ attributeNodes.forEach((attributeNode) => {
+ const alignY = heightOffset + heightPadding + attributeNode.height / 2;
+ attributeNode.tn.attr("transform", "translate(" + widthPadding + "," + alignY + ")");
+ const typeRect = groupNode.insert("rect", "#" + attributeNode.tn.node().id).classed(`er ${attribStyle}`, true).attr("x", 0).attr("y", heightOffset).attr("width", maxTypeWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ const nameXOffset = parseFloat(typeRect.attr("x")) + parseFloat(typeRect.attr("width"));
+ attributeNode.nn.attr(
+ "transform",
+ "translate(" + (nameXOffset + widthPadding) + "," + alignY + ")"
+ );
+ const nameRect = groupNode.insert("rect", "#" + attributeNode.nn.node().id).classed(`er ${attribStyle}`, true).attr("x", nameXOffset).attr("y", heightOffset).attr("width", maxNameWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ let keyTypeAndCommentXOffset = parseFloat(nameRect.attr("x")) + parseFloat(nameRect.attr("width"));
+ if (hasKeyType) {
+ attributeNode.kn.attr(
+ "transform",
+ "translate(" + (keyTypeAndCommentXOffset + widthPadding) + "," + alignY + ")"
+ );
+ const keyTypeRect = groupNode.insert("rect", "#" + attributeNode.kn.node().id).classed(`er ${attribStyle}`, true).attr("x", keyTypeAndCommentXOffset).attr("y", heightOffset).attr("width", maxKeyWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ keyTypeAndCommentXOffset = parseFloat(keyTypeRect.attr("x")) + parseFloat(keyTypeRect.attr("width"));
+ }
+ if (hasComment) {
+ attributeNode.cn.attr(
+ "transform",
+ "translate(" + (keyTypeAndCommentXOffset + widthPadding) + "," + alignY + ")"
+ );
+ groupNode.insert("rect", "#" + attributeNode.cn.node().id).classed(`er ${attribStyle}`, "true").attr("x", keyTypeAndCommentXOffset).attr("y", heightOffset).attr("width", maxCommentWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ }
+ heightOffset += attributeNode.height + heightPadding * 2;
+ attribStyle = attribStyle === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
+ });
+ } else {
+ bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight);
+ entityTextNode.attr("transform", "translate(" + bBox.width / 2 + "," + bBox.height / 2 + ")");
+ }
+ return bBox;
+};
+const drawEntities = function(svgNode, entities2, graph) {
+ const keys = Object.keys(entities2);
+ let firstOne;
+ keys.forEach(function(entityName) {
+ const entityId = generateId(entityName, "entity");
+ entityNameIds.set(entityName, entityId);
+ const groupNode = svgNode.append("g").attr("id", entityId);
+ firstOne = firstOne === void 0 ? entityId : firstOne;
+ const textId = "text-" + entityId;
+ const textNode = groupNode.append("text").classed("er entityLabel", true).attr("id", textId).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(entities2[entityName].alias ?? entityName);
+ const { width: entityWidth, height: entityHeight } = drawAttributes(
+ groupNode,
+ textNode,
+ entities2[entityName].attributes
+ );
+ const rectNode = groupNode.insert("rect", "#" + textId).classed("er entityBox", true).attr("x", 0).attr("y", 0).attr("width", entityWidth).attr("height", entityHeight);
+ const rectBBox = rectNode.node().getBBox();
+ graph.setNode(entityId, {
+ width: rectBBox.width,
+ height: rectBBox.height,
+ shape: "rect",
+ id: entityId
+ });
+ });
+ return firstOne;
+};
+const adjustEntities = function(svgNode, graph) {
+ graph.nodes().forEach(function(v) {
+ if (v !== void 0 && graph.node(v) !== void 0) {
+ svgNode.select("#" + v).attr(
+ "transform",
+ "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y - graph.node(v).height / 2) + " )"
+ );
+ }
+ });
+};
+const getEdgeName = function(rel) {
+ return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, "");
+};
+const addRelationships = function(relationships2, g) {
+ relationships2.forEach(function(r) {
+ g.setEdge(
+ entityNameIds.get(r.entityA),
+ entityNameIds.get(r.entityB),
+ { relationship: r },
+ getEdgeName(r)
+ );
+ });
+ return relationships2;
+};
+let relCnt = 0;
+const drawRelationshipFromLayout = function(svg, rel, g, insert, diagObj) {
+ relCnt++;
+ const edge = g.edge(
+ entityNameIds.get(rel.entityA),
+ entityNameIds.get(rel.entityB),
+ getEdgeName(rel)
+ );
+ const lineFunction = line().x(function(d) {
+ return d.x;
+ }).y(function(d) {
+ return d.y;
+ }).curve(curveBasis);
+ const svgPath = svg.insert("path", "#" + insert).classed("er relationshipLine", true).attr("d", lineFunction(edge.points)).style("stroke", conf.stroke).style("fill", "none");
+ if (rel.relSpec.relType === diagObj.db.Identification.NON_IDENTIFYING) {
+ svgPath.attr("stroke-dasharray", "8,8");
+ }
+ let url = "";
+ if (conf.arrowMarkerAbsolute) {
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+ url = url.replace(/\(/g, "\\(");
+ url = url.replace(/\)/g, "\\)");
+ }
+ switch (rel.relSpec.cardA) {
+ case diagObj.db.Cardinality.ZERO_OR_ONE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_END + ")");
+ break;
+ case diagObj.db.Cardinality.ZERO_OR_MORE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_END + ")");
+ break;
+ case diagObj.db.Cardinality.ONE_OR_MORE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_END + ")");
+ break;
+ case diagObj.db.Cardinality.ONLY_ONE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_END + ")");
+ break;
+ case diagObj.db.Cardinality.MD_PARENT:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_END + ")");
+ break;
+ }
+ switch (rel.relSpec.cardB) {
+ case diagObj.db.Cardinality.ZERO_OR_ONE:
+ svgPath.attr(
+ "marker-start",
+ "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_START + ")"
+ );
+ break;
+ case diagObj.db.Cardinality.ZERO_OR_MORE:
+ svgPath.attr(
+ "marker-start",
+ "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_START + ")"
+ );
+ break;
+ case diagObj.db.Cardinality.ONE_OR_MORE:
+ svgPath.attr(
+ "marker-start",
+ "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_START + ")"
+ );
+ break;
+ case diagObj.db.Cardinality.ONLY_ONE:
+ svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_START + ")");
+ break;
+ case diagObj.db.Cardinality.MD_PARENT:
+ svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_START + ")");
+ break;
+ }
+ const len = svgPath.node().getTotalLength();
+ const labelPoint = svgPath.node().getPointAtLength(len * 0.5);
+ const labelId = "rel" + relCnt;
+ const labelNode = svg.append("text").classed("er relationshipLabel", true).attr("id", labelId).attr("x", labelPoint.x).attr("y", labelPoint.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(rel.roleA);
+ const labelBBox = labelNode.node().getBBox();
+ svg.insert("rect", "#" + labelId).classed("er relationshipLabelBox", true).attr("x", labelPoint.x - labelBBox.width / 2).attr("y", labelPoint.y - labelBBox.height / 2).attr("width", labelBBox.width).attr("height", labelBBox.height);
+};
+const draw = function(text, id, _version, diagObj) {
+ conf = getConfig().er;
+ log$1.info("Drawing ER diagram");
+ const securityLevel = getConfig().securityLevel;
+ let sandboxElement;
+ if (securityLevel === "sandbox") {
+ sandboxElement = select("#i" + id);
+ }
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
+ const svg = root.select(`[id='${id}']`);
+ erMarkers.insertMarkers(svg, conf);
+ let g;
+ g = new Graph({
+ multigraph: true,
+ directed: true,
+ compound: false
+ }).setGraph({
+ rankdir: conf.layoutDirection,
+ marginx: 20,
+ marginy: 20,
+ nodesep: 100,
+ edgesep: 100,
+ ranksep: 100
+ }).setDefaultEdgeLabel(function() {
+ return {};
+ });
+ const firstEntity = drawEntities(svg, diagObj.db.getEntities(), g);
+ const relationships2 = addRelationships(diagObj.db.getRelationships(), g);
+ layout(g);
+ adjustEntities(svg, g);
+ relationships2.forEach(function(rel) {
+ drawRelationshipFromLayout(svg, rel, g, firstEntity, diagObj);
+ });
+ const padding = conf.diagramPadding;
+ utils.insertTitle(svg, "entityTitleText", conf.titleTopMargin, diagObj.db.getDiagramTitle());
+ const svgBounds = svg.node().getBBox();
+ const width = svgBounds.width + padding * 2;
+ const height = svgBounds.height + padding * 2;
+ configureSvgSize(svg, height, width, conf.useMaxWidth);
+ svg.attr("viewBox", `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`);
+};
+const MERMAID_ERDIAGRAM_UUID = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
+function generateId(str = "", prefix = "") {
+ const simplifiedStr = str.replace(BAD_ID_CHARS_REGEXP, "");
+ return `${strWithHyphen(prefix)}${strWithHyphen(simplifiedStr)}${v5(
+ str,
+ MERMAID_ERDIAGRAM_UUID
+ )}`;
+}
+function strWithHyphen(str = "") {
+ return str.length > 0 ? `${str}-` : "";
+}
+const erRenderer = {
+ setConf,
+ draw
+};
+const getStyles = (options) => `
+ .entityBox {
+ fill: ${options.mainBkg};
+ stroke: ${options.nodeBorder};
+ }
+
+ .attributeBoxOdd {
+ fill: ${options.attributeBackgroundColorOdd};
+ stroke: ${options.nodeBorder};
+ }
+
+ .attributeBoxEven {
+ fill: ${options.attributeBackgroundColorEven};
+ stroke: ${options.nodeBorder};
+ }
+
+ .relationshipLabelBox {
+ fill: ${options.tertiaryColor};
+ opacity: 0.7;
+ background-color: ${options.tertiaryColor};
+ rect {
+ opacity: 0.5;
+ }
+ }
+
+ .relationshipLine {
+ stroke: ${options.lineColor};
+ }
+
+ .entityTitleText {
+ text-anchor: middle;
+ font-size: 18px;
+ fill: ${options.textColor};
+ }
+ #MD_PARENT_START {
+ fill: #f5f5f5 !important;
+ stroke: ${options.lineColor} !important;
+ stroke-width: 1;
+ }
+ #MD_PARENT_END {
+ fill: #f5f5f5 !important;
+ stroke: ${options.lineColor} !important;
+ stroke-width: 1;
+ }
+
+`;
+const erStyles = getStyles;
+const diagram = {
+ parser: erParser,
+ db: erDb,
+ renderer: erRenderer,
+ styles: erStyles
+};
+
+export { diagram };
diff --git a/libs/marked/erDiagram-09d1c15f-DYT5JEfx.js b/libs/marked/erDiagram-09d1c15f-DYT5JEfx.js
new file mode 100644
index 0000000..3908541
--- /dev/null
+++ b/libs/marked/erDiagram-09d1c15f-DYT5JEfx.js
@@ -0,0 +1,1384 @@
+import { c as getConfig, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, C as setDiagramTitle, D as getDiagramTitle, l as log$1, E as clear$1, h as select, A as utils, i as configureSvgSize, F as curveBasis, G as parseGenericTypes } from './index-CN3YjQ0n.js';
+import { G as Graph } from './graph-DadsyNmk.js';
+import { l as layout } from './layout-BOZlZI7g.js';
+import { l as line } from './line-D1aCvau7.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+
+var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
+
+function validate(uuid) {
+ return typeof uuid === 'string' && REGEX.test(uuid);
+}
+
+/**
+ * Convert array of 16 byte values to UUID string format of the form:
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ */
+
+const byteToHex = [];
+
+for (let i = 0; i < 256; ++i) {
+ byteToHex.push((i + 0x100).toString(16).slice(1));
+}
+
+function unsafeStringify(arr, offset = 0) {
+ // Note: Be careful editing this code! It's been tuned for performance
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
+}
+
+function parse(uuid) {
+ if (!validate(uuid)) {
+ throw TypeError('Invalid UUID');
+ }
+
+ let v;
+ const arr = new Uint8Array(16); // Parse ########-....-....-....-............
+
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
+ arr[1] = v >>> 16 & 0xff;
+ arr[2] = v >>> 8 & 0xff;
+ arr[3] = v & 0xff; // Parse ........-####-....-....-............
+
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
+ arr[5] = v & 0xff; // Parse ........-....-####-....-............
+
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
+ arr[7] = v & 0xff; // Parse ........-....-....-####-............
+
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
+ arr[9] = v & 0xff; // Parse ........-....-....-....-############
+ // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
+
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
+ arr[11] = v / 0x100000000 & 0xff;
+ arr[12] = v >>> 24 & 0xff;
+ arr[13] = v >>> 16 & 0xff;
+ arr[14] = v >>> 8 & 0xff;
+ arr[15] = v & 0xff;
+ return arr;
+}
+
+function stringToBytes(str) {
+ str = unescape(encodeURIComponent(str)); // UTF8 escape
+
+ const bytes = [];
+
+ for (let i = 0; i < str.length; ++i) {
+ bytes.push(str.charCodeAt(i));
+ }
+
+ return bytes;
+}
+
+const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
+const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
+function v35(name, version, hashfunc) {
+ function generateUUID(value, namespace, buf, offset) {
+ var _namespace;
+
+ if (typeof value === 'string') {
+ value = stringToBytes(value);
+ }
+
+ if (typeof namespace === 'string') {
+ namespace = parse(namespace);
+ }
+
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
+ } // Compute hash of namespace and value, Per 4.3
+ // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
+ // hashfunc([...namespace, ... value])`
+
+
+ let bytes = new Uint8Array(16 + value.length);
+ bytes.set(namespace);
+ bytes.set(value, namespace.length);
+ bytes = hashfunc(bytes);
+ bytes[6] = bytes[6] & 0x0f | version;
+ bytes[8] = bytes[8] & 0x3f | 0x80;
+
+ if (buf) {
+ offset = offset || 0;
+
+ for (let i = 0; i < 16; ++i) {
+ buf[offset + i] = bytes[i];
+ }
+
+ return buf;
+ }
+
+ return unsafeStringify(bytes);
+ } // Function#name is not settable on some platforms (#270)
+
+
+ try {
+ generateUUID.name = name; // eslint-disable-next-line no-empty
+ } catch (err) {} // For CommonJS default export support
+
+
+ generateUUID.DNS = DNS;
+ generateUUID.URL = URL;
+ return generateUUID;
+}
+
+// Adapted from Chris Veness' SHA1 code at
+// http://www.movable-type.co.uk/scripts/sha1.html
+function f(s, x, y, z) {
+ switch (s) {
+ case 0:
+ return x & y ^ ~x & z;
+
+ case 1:
+ return x ^ y ^ z;
+
+ case 2:
+ return x & y ^ x & z ^ y & z;
+
+ case 3:
+ return x ^ y ^ z;
+ }
+}
+
+function ROTL(x, n) {
+ return x << n | x >>> 32 - n;
+}
+
+function sha1(bytes) {
+ const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
+ const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
+
+ if (typeof bytes === 'string') {
+ const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
+
+ bytes = [];
+
+ for (let i = 0; i < msg.length; ++i) {
+ bytes.push(msg.charCodeAt(i));
+ }
+ } else if (!Array.isArray(bytes)) {
+ // Convert Array-like to Array
+ bytes = Array.prototype.slice.call(bytes);
+ }
+
+ bytes.push(0x80);
+ const l = bytes.length / 4 + 2;
+ const N = Math.ceil(l / 16);
+ const M = new Array(N);
+
+ for (let i = 0; i < N; ++i) {
+ const arr = new Uint32Array(16);
+
+ for (let j = 0; j < 16; ++j) {
+ arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
+ }
+
+ M[i] = arr;
+ }
+
+ M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
+ M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
+
+ for (let i = 0; i < N; ++i) {
+ const W = new Uint32Array(80);
+
+ for (let t = 0; t < 16; ++t) {
+ W[t] = M[i][t];
+ }
+
+ for (let t = 16; t < 80; ++t) {
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
+ }
+
+ let a = H[0];
+ let b = H[1];
+ let c = H[2];
+ let d = H[3];
+ let e = H[4];
+
+ for (let t = 0; t < 80; ++t) {
+ const s = Math.floor(t / 20);
+ const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
+ e = d;
+ d = c;
+ c = ROTL(b, 30) >>> 0;
+ b = a;
+ a = T;
+ }
+
+ H[0] = H[0] + a >>> 0;
+ H[1] = H[1] + b >>> 0;
+ H[2] = H[2] + c >>> 0;
+ H[3] = H[3] + d >>> 0;
+ H[4] = H[4] + e >>> 0;
+ }
+
+ return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
+}
+
+const v5 = v35('v5', 0x50, sha1);
+
+var parser = function() {
+ var o = function(k, v, o2, l) {
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
+ ;
+ return o2;
+ }, $V0 = [6, 8, 10, 20, 22, 24, 26, 27, 28], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 14], $V6 = [1, 15], $V7 = [1, 21], $V8 = [1, 22], $V9 = [1, 23], $Va = [1, 24], $Vb = [1, 25], $Vc = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], $Vd = [1, 34], $Ve = [27, 28, 46, 47], $Vf = [41, 42, 43, 44, 45], $Vg = [17, 34], $Vh = [1, 54], $Vi = [1, 53], $Vj = [17, 34, 36, 38];
+ var parser2 = {
+ trace: function trace() {
+ },
+ yy: {},
+ symbols_: { "error": 2, "start": 3, "ER_DIAGRAM": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "entityName": 11, "relSpec": 12, ":": 13, "role": 14, "BLOCK_START": 15, "attributes": 16, "BLOCK_STOP": 17, "SQS": 18, "SQE": 19, "title": 20, "title_value": 21, "acc_title": 22, "acc_title_value": 23, "acc_descr": 24, "acc_descr_value": 25, "acc_descr_multiline_value": 26, "ALPHANUM": 27, "ENTITY_NAME": 28, "attribute": 29, "attributeType": 30, "attributeName": 31, "attributeKeyTypeList": 32, "attributeComment": 33, "ATTRIBUTE_WORD": 34, "attributeKeyType": 35, "COMMA": 36, "ATTRIBUTE_KEY": 37, "COMMENT": 38, "cardinality": 39, "relType": 40, "ZERO_OR_ONE": 41, "ZERO_OR_MORE": 42, "ONE_OR_MORE": 43, "ONLY_ONE": 44, "MD_PARENT": 45, "NON_IDENTIFYING": 46, "IDENTIFYING": 47, "WORD": 48, "$accept": 0, "$end": 1 },
+ terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
+ productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+ var $0 = $$.length - 1;
+ switch (yystate) {
+ case 1:
+ break;
+ case 2:
+ this.$ = [];
+ break;
+ case 3:
+ $$[$0 - 1].push($$[$0]);
+ this.$ = $$[$0 - 1];
+ break;
+ case 4:
+ case 5:
+ this.$ = $$[$0];
+ break;
+ case 6:
+ case 7:
+ this.$ = [];
+ break;
+ case 8:
+ yy.addEntity($$[$0 - 4]);
+ yy.addEntity($$[$0 - 2]);
+ yy.addRelationship($$[$0 - 4], $$[$0], $$[$0 - 2], $$[$0 - 3]);
+ break;
+ case 9:
+ yy.addEntity($$[$0 - 3]);
+ yy.addAttributes($$[$0 - 3], $$[$0 - 1]);
+ break;
+ case 10:
+ yy.addEntity($$[$0 - 2]);
+ break;
+ case 11:
+ yy.addEntity($$[$0]);
+ break;
+ case 12:
+ yy.addEntity($$[$0 - 6], $$[$0 - 4]);
+ yy.addAttributes($$[$0 - 6], $$[$0 - 1]);
+ break;
+ case 13:
+ yy.addEntity($$[$0 - 5], $$[$0 - 3]);
+ break;
+ case 14:
+ yy.addEntity($$[$0 - 3], $$[$0 - 1]);
+ break;
+ case 15:
+ case 16:
+ this.$ = $$[$0].trim();
+ yy.setAccTitle(this.$);
+ break;
+ case 17:
+ case 18:
+ this.$ = $$[$0].trim();
+ yy.setAccDescription(this.$);
+ break;
+ case 19:
+ case 43:
+ this.$ = $$[$0];
+ break;
+ case 20:
+ case 41:
+ case 42:
+ this.$ = $$[$0].replace(/"/g, "");
+ break;
+ case 21:
+ case 29:
+ this.$ = [$$[$0]];
+ break;
+ case 22:
+ $$[$0].push($$[$0 - 1]);
+ this.$ = $$[$0];
+ break;
+ case 23:
+ this.$ = { attributeType: $$[$0 - 1], attributeName: $$[$0] };
+ break;
+ case 24:
+ this.$ = { attributeType: $$[$0 - 2], attributeName: $$[$0 - 1], attributeKeyTypeList: $$[$0] };
+ break;
+ case 25:
+ this.$ = { attributeType: $$[$0 - 2], attributeName: $$[$0 - 1], attributeComment: $$[$0] };
+ break;
+ case 26:
+ this.$ = { attributeType: $$[$0 - 3], attributeName: $$[$0 - 2], attributeKeyTypeList: $$[$0 - 1], attributeComment: $$[$0] };
+ break;
+ case 27:
+ case 28:
+ case 31:
+ this.$ = $$[$0];
+ break;
+ case 30:
+ $$[$0 - 2].push($$[$0]);
+ this.$ = $$[$0 - 2];
+ break;
+ case 32:
+ this.$ = $$[$0].replace(/"/g, "");
+ break;
+ case 33:
+ this.$ = { cardA: $$[$0], relType: $$[$0 - 1], cardB: $$[$0 - 2] };
+ break;
+ case 34:
+ this.$ = yy.Cardinality.ZERO_OR_ONE;
+ break;
+ case 35:
+ this.$ = yy.Cardinality.ZERO_OR_MORE;
+ break;
+ case 36:
+ this.$ = yy.Cardinality.ONE_OR_MORE;
+ break;
+ case 37:
+ this.$ = yy.Cardinality.ONLY_ONE;
+ break;
+ case 38:
+ this.$ = yy.Cardinality.MD_PARENT;
+ break;
+ case 39:
+ this.$ = yy.Identification.NON_IDENTIFYING;
+ break;
+ case 40:
+ this.$ = yy.Identification.IDENTIFYING;
+ break;
+ }
+ },
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 16, 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, o($V0, [2, 18]), o($Vc, [2, 19]), o($Vc, [2, 20]), o($V0, [2, 4]), { 11: 29, 27: $V5, 28: $V6 }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: $Vd }, { 11: 35, 27: $V5, 28: $V6 }, { 40: 36, 46: [1, 37], 47: [1, 38] }, o($Ve, [2, 34]), o($Ve, [2, 35]), o($Ve, [2, 36]), o($Ve, [2, 37]), o($Ve, [2, 38]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, o($V0, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: $Vd }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }, o($Vf, [2, 39]), o($Vf, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, o($V0, [2, 9]), { 17: [2, 22] }, o($Vg, [2, 23], { 32: 50, 33: 51, 35: 52, 37: $Vh, 38: $Vi }), o([17, 34, 37, 38], [2, 28]), o($V0, [2, 14], { 15: [1, 55] }), o([27, 28], [2, 33]), o($V0, [2, 8]), o($V0, [2, 41]), o($V0, [2, 42]), o($V0, [2, 43]), o($Vg, [2, 24], { 33: 56, 36: [1, 57], 38: $Vi }), o($Vg, [2, 25]), o($Vj, [2, 29]), o($Vg, [2, 32]), o($Vj, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: $Vd }, o($Vg, [2, 26]), { 35: 60, 37: $Vh }, { 17: [1, 61] }, o($V0, [2, 13]), o($Vj, [2, 30]), o($V0, [2, 12])],
+ defaultActions: { 34: [2, 27], 41: [2, 22] },
+ parseError: function parseError(str, hash) {
+ if (hash.recoverable) {
+ this.trace(str);
+ } else {
+ var error = new Error(str);
+ error.hash = hash;
+ throw error;
+ }
+ },
+ parse: function parse(input) {
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+ var args = lstack.slice.call(arguments, 1);
+ var lexer2 = Object.create(this.lexer);
+ var sharedState = { yy: {} };
+ for (var k in this.yy) {
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
+ sharedState.yy[k] = this.yy[k];
+ }
+ }
+ lexer2.setInput(input, sharedState.yy);
+ sharedState.yy.lexer = lexer2;
+ sharedState.yy.parser = this;
+ if (typeof lexer2.yylloc == "undefined") {
+ lexer2.yylloc = {};
+ }
+ var yyloc = lexer2.yylloc;
+ lstack.push(yyloc);
+ var ranges = lexer2.options && lexer2.options.ranges;
+ if (typeof sharedState.yy.parseError === "function") {
+ this.parseError = sharedState.yy.parseError;
+ } else {
+ this.parseError = Object.getPrototypeOf(this).parseError;
+ }
+ function lex() {
+ var token;
+ token = tstack.pop() || lexer2.lex() || EOF;
+ if (typeof token !== "number") {
+ if (token instanceof Array) {
+ tstack = token;
+ token = tstack.pop();
+ }
+ token = self.symbols_[token] || token;
+ }
+ return token;
+ }
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+ while (true) {
+ state = stack[stack.length - 1];
+ if (this.defaultActions[state]) {
+ action = this.defaultActions[state];
+ } else {
+ if (symbol === null || typeof symbol == "undefined") {
+ symbol = lex();
+ }
+ action = table[state] && table[state][symbol];
+ }
+ if (typeof action === "undefined" || !action.length || !action[0]) {
+ var errStr = "";
+ expected = [];
+ for (p in table[state]) {
+ if (this.terminals_[p] && p > TERROR) {
+ expected.push("'" + this.terminals_[p] + "'");
+ }
+ }
+ if (lexer2.showPosition) {
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
+ } else {
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
+ }
+ this.parseError(errStr, {
+ text: lexer2.match,
+ token: this.terminals_[symbol] || symbol,
+ line: lexer2.yylineno,
+ loc: yyloc,
+ expected
+ });
+ }
+ if (action[0] instanceof Array && action.length > 1) {
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
+ }
+ switch (action[0]) {
+ case 1:
+ stack.push(symbol);
+ vstack.push(lexer2.yytext);
+ lstack.push(lexer2.yylloc);
+ stack.push(action[1]);
+ symbol = null;
+ {
+ yyleng = lexer2.yyleng;
+ yytext = lexer2.yytext;
+ yylineno = lexer2.yylineno;
+ yyloc = lexer2.yylloc;
+ }
+ break;
+ case 2:
+ len = this.productions_[action[1]][1];
+ yyval.$ = vstack[vstack.length - len];
+ yyval._$ = {
+ first_line: lstack[lstack.length - (len || 1)].first_line,
+ last_line: lstack[lstack.length - 1].last_line,
+ first_column: lstack[lstack.length - (len || 1)].first_column,
+ last_column: lstack[lstack.length - 1].last_column
+ };
+ if (ranges) {
+ yyval._$.range = [
+ lstack[lstack.length - (len || 1)].range[0],
+ lstack[lstack.length - 1].range[1]
+ ];
+ }
+ r = this.performAction.apply(yyval, [
+ yytext,
+ yyleng,
+ yylineno,
+ sharedState.yy,
+ action[1],
+ vstack,
+ lstack
+ ].concat(args));
+ if (typeof r !== "undefined") {
+ return r;
+ }
+ if (len) {
+ stack = stack.slice(0, -1 * len * 2);
+ vstack = vstack.slice(0, -1 * len);
+ lstack = lstack.slice(0, -1 * len);
+ }
+ stack.push(this.productions_[action[1]][0]);
+ vstack.push(yyval.$);
+ lstack.push(yyval._$);
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
+ stack.push(newState);
+ break;
+ case 3:
+ return true;
+ }
+ }
+ return true;
+ }
+ };
+ var lexer = function() {
+ var lexer2 = {
+ EOF: 1,
+ parseError: function parseError(str, hash) {
+ if (this.yy.parser) {
+ this.yy.parser.parseError(str, hash);
+ } else {
+ throw new Error(str);
+ }
+ },
+ // resets the lexer, sets new input
+ setInput: function(input, yy) {
+ this.yy = yy || this.yy || {};
+ this._input = input;
+ this._more = this._backtrack = this.done = false;
+ this.yylineno = this.yyleng = 0;
+ this.yytext = this.matched = this.match = "";
+ this.conditionStack = ["INITIAL"];
+ this.yylloc = {
+ first_line: 1,
+ first_column: 0,
+ last_line: 1,
+ last_column: 0
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [0, 0];
+ }
+ this.offset = 0;
+ return this;
+ },
+ // consumes and returns one char from the input
+ input: function() {
+ var ch = this._input[0];
+ this.yytext += ch;
+ this.yyleng++;
+ this.offset++;
+ this.match += ch;
+ this.matched += ch;
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno++;
+ this.yylloc.last_line++;
+ } else {
+ this.yylloc.last_column++;
+ }
+ if (this.options.ranges) {
+ this.yylloc.range[1]++;
+ }
+ this._input = this._input.slice(1);
+ return ch;
+ },
+ // unshifts one char (or a string) into the input
+ unput: function(ch) {
+ var len = ch.length;
+ var lines = ch.split(/(?:\r\n?|\n)/g);
+ this._input = ch + this._input;
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
+ this.offset -= len;
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
+ this.match = this.match.substr(0, this.match.length - 1);
+ this.matched = this.matched.substr(0, this.matched.length - 1);
+ if (lines.length - 1) {
+ this.yylineno -= lines.length - 1;
+ }
+ var r = this.yylloc.range;
+ this.yylloc = {
+ first_line: this.yylloc.first_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.first_column,
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
+ }
+ this.yyleng = this.yytext.length;
+ return this;
+ },
+ // When called from action, caches matched text and appends it on next action
+ more: function() {
+ this._more = true;
+ return this;
+ },
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
+ reject: function() {
+ if (this.options.backtrack_lexer) {
+ this._backtrack = true;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ return this;
+ },
+ // retain first n characters of the match
+ less: function(n) {
+ this.unput(this.match.slice(n));
+ },
+ // displays already matched input, i.e. for error messages
+ pastInput: function() {
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
+ },
+ // displays upcoming input, i.e. for error messages
+ upcomingInput: function() {
+ var next = this.match;
+ if (next.length < 20) {
+ next += this._input.substr(0, 20 - next.length);
+ }
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
+ },
+ // displays the character position where the lexing error occurred, i.e. for error messages
+ showPosition: function() {
+ var pre = this.pastInput();
+ var c = new Array(pre.length + 1).join("-");
+ return pre + this.upcomingInput() + "\n" + c + "^";
+ },
+ // test the lexed token: return FALSE when not a match, otherwise return token
+ test_match: function(match, indexed_rule) {
+ var token, lines, backup;
+ if (this.options.backtrack_lexer) {
+ backup = {
+ yylineno: this.yylineno,
+ yylloc: {
+ first_line: this.yylloc.first_line,
+ last_line: this.last_line,
+ first_column: this.yylloc.first_column,
+ last_column: this.yylloc.last_column
+ },
+ yytext: this.yytext,
+ match: this.match,
+ matches: this.matches,
+ matched: this.matched,
+ yyleng: this.yyleng,
+ offset: this.offset,
+ _more: this._more,
+ _input: this._input,
+ yy: this.yy,
+ conditionStack: this.conditionStack.slice(0),
+ done: this.done
+ };
+ if (this.options.ranges) {
+ backup.yylloc.range = this.yylloc.range.slice(0);
+ }
+ }
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno += lines.length;
+ }
+ this.yylloc = {
+ first_line: this.yylloc.last_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.last_column,
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
+ };
+ this.yytext += match[0];
+ this.match += match[0];
+ this.matches = match;
+ this.yyleng = this.yytext.length;
+ if (this.options.ranges) {
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
+ }
+ this._more = false;
+ this._backtrack = false;
+ this._input = this._input.slice(match[0].length);
+ this.matched += match[0];
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
+ if (this.done && this._input) {
+ this.done = false;
+ }
+ if (token) {
+ return token;
+ } else if (this._backtrack) {
+ for (var k in backup) {
+ this[k] = backup[k];
+ }
+ return false;
+ }
+ return false;
+ },
+ // return next match in input
+ next: function() {
+ if (this.done) {
+ return this.EOF;
+ }
+ if (!this._input) {
+ this.done = true;
+ }
+ var token, match, tempMatch, index;
+ if (!this._more) {
+ this.yytext = "";
+ this.match = "";
+ }
+ var rules = this._currentRules();
+ for (var i = 0; i < rules.length; i++) {
+ tempMatch = this._input.match(this.rules[rules[i]]);
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
+ match = tempMatch;
+ index = i;
+ if (this.options.backtrack_lexer) {
+ token = this.test_match(tempMatch, rules[i]);
+ if (token !== false) {
+ return token;
+ } else if (this._backtrack) {
+ match = false;
+ continue;
+ } else {
+ return false;
+ }
+ } else if (!this.options.flex) {
+ break;
+ }
+ }
+ }
+ if (match) {
+ token = this.test_match(match, rules[index]);
+ if (token !== false) {
+ return token;
+ }
+ return false;
+ }
+ if (this._input === "") {
+ return this.EOF;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ },
+ // return next match that has a token
+ lex: function lex() {
+ var r = this.next();
+ if (r) {
+ return r;
+ } else {
+ return this.lex();
+ }
+ },
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
+ begin: function begin(condition) {
+ this.conditionStack.push(condition);
+ },
+ // pop the previously active lexer condition state off the condition stack
+ popState: function popState() {
+ var n = this.conditionStack.length - 1;
+ if (n > 0) {
+ return this.conditionStack.pop();
+ } else {
+ return this.conditionStack[0];
+ }
+ },
+ // produce the lexer rule set which is active for the currently active lexer condition state
+ _currentRules: function _currentRules() {
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
+ } else {
+ return this.conditions["INITIAL"].rules;
+ }
+ },
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
+ topState: function topState(n) {
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
+ if (n >= 0) {
+ return this.conditionStack[n];
+ } else {
+ return "INITIAL";
+ }
+ },
+ // alias for begin(condition)
+ pushState: function pushState(condition) {
+ this.begin(condition);
+ },
+ // return the number of states currently on the stack
+ stateStackSize: function stateStackSize() {
+ return this.conditionStack.length;
+ },
+ options: { "case-insensitive": true },
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+ switch ($avoiding_name_collisions) {
+ case 0:
+ this.begin("acc_title");
+ return 22;
+ case 1:
+ this.popState();
+ return "acc_title_value";
+ case 2:
+ this.begin("acc_descr");
+ return 24;
+ case 3:
+ this.popState();
+ return "acc_descr_value";
+ case 4:
+ this.begin("acc_descr_multiline");
+ break;
+ case 5:
+ this.popState();
+ break;
+ case 6:
+ return "acc_descr_multiline_value";
+ case 7:
+ return 10;
+ case 8:
+ break;
+ case 9:
+ return 8;
+ case 10:
+ return 28;
+ case 11:
+ return 48;
+ case 12:
+ return 4;
+ case 13:
+ this.begin("block");
+ return 15;
+ case 14:
+ return 36;
+ case 15:
+ break;
+ case 16:
+ return 37;
+ case 17:
+ return 34;
+ case 18:
+ return 34;
+ case 19:
+ return 38;
+ case 20:
+ break;
+ case 21:
+ this.popState();
+ return 17;
+ case 22:
+ return yy_.yytext[0];
+ case 23:
+ return 18;
+ case 24:
+ return 19;
+ case 25:
+ return 41;
+ case 26:
+ return 43;
+ case 27:
+ return 43;
+ case 28:
+ return 43;
+ case 29:
+ return 41;
+ case 30:
+ return 41;
+ case 31:
+ return 42;
+ case 32:
+ return 42;
+ case 33:
+ return 42;
+ case 34:
+ return 42;
+ case 35:
+ return 42;
+ case 36:
+ return 43;
+ case 37:
+ return 42;
+ case 38:
+ return 43;
+ case 39:
+ return 44;
+ case 40:
+ return 44;
+ case 41:
+ return 44;
+ case 42:
+ return 44;
+ case 43:
+ return 41;
+ case 44:
+ return 42;
+ case 45:
+ return 43;
+ case 46:
+ return 45;
+ case 47:
+ return 46;
+ case 48:
+ return 47;
+ case 49:
+ return 47;
+ case 50:
+ return 46;
+ case 51:
+ return 46;
+ case 52:
+ return 46;
+ case 53:
+ return 27;
+ case 54:
+ return yy_.yytext[0];
+ case 55:
+ return 6;
+ }
+ },
+ rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
+ conditions: { "acc_descr_multiline": { "rules": [5, 6], "inclusive": false }, "acc_descr": { "rules": [3], "inclusive": false }, "acc_title": { "rules": [1], "inclusive": false }, "block": { "rules": [14, 15, 16, 17, 18, 19, 20, 21, 22], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], "inclusive": true } }
+ };
+ return lexer2;
+ }();
+ parser2.lexer = lexer;
+ function Parser() {
+ this.yy = {};
+ }
+ Parser.prototype = parser2;
+ parser2.Parser = Parser;
+ return new Parser();
+}();
+parser.parser = parser;
+const erParser = parser;
+let entities = {};
+let relationships = [];
+const Cardinality = {
+ ZERO_OR_ONE: "ZERO_OR_ONE",
+ ZERO_OR_MORE: "ZERO_OR_MORE",
+ ONE_OR_MORE: "ONE_OR_MORE",
+ ONLY_ONE: "ONLY_ONE",
+ MD_PARENT: "MD_PARENT"
+};
+const Identification = {
+ NON_IDENTIFYING: "NON_IDENTIFYING",
+ IDENTIFYING: "IDENTIFYING"
+};
+const addEntity = function(name, alias = void 0) {
+ if (entities[name] === void 0) {
+ entities[name] = { attributes: [], alias };
+ log$1.info("Added new entity :", name);
+ } else if (entities[name] && !entities[name].alias && alias) {
+ entities[name].alias = alias;
+ log$1.info(`Add alias '${alias}' to entity '${name}'`);
+ }
+ return entities[name];
+};
+const getEntities = () => entities;
+const addAttributes = function(entityName, attribs) {
+ let entity = addEntity(entityName);
+ let i;
+ for (i = attribs.length - 1; i >= 0; i--) {
+ entity.attributes.push(attribs[i]);
+ log$1.debug("Added attribute ", attribs[i].attributeName);
+ }
+};
+const addRelationship = function(entA, rolA, entB, rSpec) {
+ let rel = {
+ entityA: entA,
+ roleA: rolA,
+ entityB: entB,
+ relSpec: rSpec
+ };
+ relationships.push(rel);
+ log$1.debug("Added new relationship :", rel);
+};
+const getRelationships = () => relationships;
+const clear = function() {
+ entities = {};
+ relationships = [];
+ clear$1();
+};
+const erDb = {
+ Cardinality,
+ Identification,
+ getConfig: () => getConfig().er,
+ addEntity,
+ addAttributes,
+ getEntities,
+ addRelationship,
+ getRelationships,
+ clear,
+ setAccTitle,
+ getAccTitle,
+ setAccDescription,
+ getAccDescription,
+ setDiagramTitle,
+ getDiagramTitle
+};
+const ERMarkers = {
+ ONLY_ONE_START: "ONLY_ONE_START",
+ ONLY_ONE_END: "ONLY_ONE_END",
+ ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
+ ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
+ ONE_OR_MORE_START: "ONE_OR_MORE_START",
+ ONE_OR_MORE_END: "ONE_OR_MORE_END",
+ ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
+ ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
+ MD_PARENT_END: "MD_PARENT_END",
+ MD_PARENT_START: "MD_PARENT_START"
+};
+const insertMarkers = function(elem, conf2) {
+ let marker;
+ elem.append("defs").append("marker").attr("id", ERMarkers.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", ERMarkers.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M9,0 L9,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,0 L21,18");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27");
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18");
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6);
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
+ return;
+};
+const erMarkers = {
+ ERMarkers,
+ insertMarkers
+};
+const BAD_ID_CHARS_REGEXP = /[^\dA-Za-z](\W)*/g;
+let conf = {};
+let entityNameIds = /* @__PURE__ */ new Map();
+const setConf = function(cnf) {
+ const keys = Object.keys(cnf);
+ for (const key of keys) {
+ conf[key] = cnf[key];
+ }
+};
+const drawAttributes = (groupNode, entityTextNode, attributes) => {
+ const heightPadding = conf.entityPadding / 3;
+ const widthPadding = conf.entityPadding / 3;
+ const attrFontSize = conf.fontSize * 0.85;
+ const labelBBox = entityTextNode.node().getBBox();
+ const attributeNodes = [];
+ let hasKeyType = false;
+ let hasComment = false;
+ let maxTypeWidth = 0;
+ let maxNameWidth = 0;
+ let maxKeyWidth = 0;
+ let maxCommentWidth = 0;
+ let cumulativeHeight = labelBBox.height + heightPadding * 2;
+ let attrNum = 1;
+ attributes.forEach((item) => {
+ if (item.attributeKeyTypeList !== void 0 && item.attributeKeyTypeList.length > 0) {
+ hasKeyType = true;
+ }
+ if (item.attributeComment !== void 0) {
+ hasComment = true;
+ }
+ });
+ attributes.forEach((item) => {
+ const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`;
+ let nodeHeight = 0;
+ const attributeType = parseGenericTypes(item.attributeType);
+ const typeNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(attributeType);
+ const nameNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(item.attributeName);
+ const attributeNode = {};
+ attributeNode.tn = typeNode;
+ attributeNode.nn = nameNode;
+ const typeBBox = typeNode.node().getBBox();
+ const nameBBox = nameNode.node().getBBox();
+ maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);
+ maxNameWidth = Math.max(maxNameWidth, nameBBox.width);
+ nodeHeight = Math.max(typeBBox.height, nameBBox.height);
+ if (hasKeyType) {
+ const keyTypeNodeText = item.attributeKeyTypeList !== void 0 ? item.attributeKeyTypeList.join(",") : "";
+ const keyTypeNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(keyTypeNodeText);
+ attributeNode.kn = keyTypeNode;
+ const keyTypeBBox = keyTypeNode.node().getBBox();
+ maxKeyWidth = Math.max(maxKeyWidth, keyTypeBBox.width);
+ nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);
+ }
+ if (hasComment) {
+ const commentNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(item.attributeComment || "");
+ attributeNode.cn = commentNode;
+ const commentNodeBBox = commentNode.node().getBBox();
+ maxCommentWidth = Math.max(maxCommentWidth, commentNodeBBox.width);
+ nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);
+ }
+ attributeNode.height = nodeHeight;
+ attributeNodes.push(attributeNode);
+ cumulativeHeight += nodeHeight + heightPadding * 2;
+ attrNum += 1;
+ });
+ let widthPaddingFactor = 4;
+ if (hasKeyType) {
+ widthPaddingFactor += 2;
+ }
+ if (hasComment) {
+ widthPaddingFactor += 2;
+ }
+ const maxWidth = maxTypeWidth + maxNameWidth + maxKeyWidth + maxCommentWidth;
+ const bBox = {
+ width: Math.max(
+ conf.minEntityWidth,
+ Math.max(
+ labelBBox.width + conf.entityPadding * 2,
+ maxWidth + widthPadding * widthPaddingFactor
+ )
+ ),
+ height: attributes.length > 0 ? cumulativeHeight : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2)
+ };
+ if (attributes.length > 0) {
+ const spareColumnWidth = Math.max(
+ 0,
+ (bBox.width - maxWidth - widthPadding * widthPaddingFactor) / (widthPaddingFactor / 2)
+ );
+ entityTextNode.attr(
+ "transform",
+ "translate(" + bBox.width / 2 + "," + (heightPadding + labelBBox.height / 2) + ")"
+ );
+ let heightOffset = labelBBox.height + heightPadding * 2;
+ let attribStyle = "attributeBoxOdd";
+ attributeNodes.forEach((attributeNode) => {
+ const alignY = heightOffset + heightPadding + attributeNode.height / 2;
+ attributeNode.tn.attr("transform", "translate(" + widthPadding + "," + alignY + ")");
+ const typeRect = groupNode.insert("rect", "#" + attributeNode.tn.node().id).classed(`er ${attribStyle}`, true).attr("x", 0).attr("y", heightOffset).attr("width", maxTypeWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ const nameXOffset = parseFloat(typeRect.attr("x")) + parseFloat(typeRect.attr("width"));
+ attributeNode.nn.attr(
+ "transform",
+ "translate(" + (nameXOffset + widthPadding) + "," + alignY + ")"
+ );
+ const nameRect = groupNode.insert("rect", "#" + attributeNode.nn.node().id).classed(`er ${attribStyle}`, true).attr("x", nameXOffset).attr("y", heightOffset).attr("width", maxNameWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ let keyTypeAndCommentXOffset = parseFloat(nameRect.attr("x")) + parseFloat(nameRect.attr("width"));
+ if (hasKeyType) {
+ attributeNode.kn.attr(
+ "transform",
+ "translate(" + (keyTypeAndCommentXOffset + widthPadding) + "," + alignY + ")"
+ );
+ const keyTypeRect = groupNode.insert("rect", "#" + attributeNode.kn.node().id).classed(`er ${attribStyle}`, true).attr("x", keyTypeAndCommentXOffset).attr("y", heightOffset).attr("width", maxKeyWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ keyTypeAndCommentXOffset = parseFloat(keyTypeRect.attr("x")) + parseFloat(keyTypeRect.attr("width"));
+ }
+ if (hasComment) {
+ attributeNode.cn.attr(
+ "transform",
+ "translate(" + (keyTypeAndCommentXOffset + widthPadding) + "," + alignY + ")"
+ );
+ groupNode.insert("rect", "#" + attributeNode.cn.node().id).classed(`er ${attribStyle}`, "true").attr("x", keyTypeAndCommentXOffset).attr("y", heightOffset).attr("width", maxCommentWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
+ }
+ heightOffset += attributeNode.height + heightPadding * 2;
+ attribStyle = attribStyle === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
+ });
+ } else {
+ bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight);
+ entityTextNode.attr("transform", "translate(" + bBox.width / 2 + "," + bBox.height / 2 + ")");
+ }
+ return bBox;
+};
+const drawEntities = function(svgNode, entities2, graph) {
+ const keys = Object.keys(entities2);
+ let firstOne;
+ keys.forEach(function(entityName) {
+ const entityId = generateId(entityName, "entity");
+ entityNameIds.set(entityName, entityId);
+ const groupNode = svgNode.append("g").attr("id", entityId);
+ firstOne = firstOne === void 0 ? entityId : firstOne;
+ const textId = "text-" + entityId;
+ const textNode = groupNode.append("text").classed("er entityLabel", true).attr("id", textId).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(entities2[entityName].alias ?? entityName);
+ const { width: entityWidth, height: entityHeight } = drawAttributes(
+ groupNode,
+ textNode,
+ entities2[entityName].attributes
+ );
+ const rectNode = groupNode.insert("rect", "#" + textId).classed("er entityBox", true).attr("x", 0).attr("y", 0).attr("width", entityWidth).attr("height", entityHeight);
+ const rectBBox = rectNode.node().getBBox();
+ graph.setNode(entityId, {
+ width: rectBBox.width,
+ height: rectBBox.height,
+ shape: "rect",
+ id: entityId
+ });
+ });
+ return firstOne;
+};
+const adjustEntities = function(svgNode, graph) {
+ graph.nodes().forEach(function(v) {
+ if (v !== void 0 && graph.node(v) !== void 0) {
+ svgNode.select("#" + v).attr(
+ "transform",
+ "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y - graph.node(v).height / 2) + " )"
+ );
+ }
+ });
+};
+const getEdgeName = function(rel) {
+ return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, "");
+};
+const addRelationships = function(relationships2, g) {
+ relationships2.forEach(function(r) {
+ g.setEdge(
+ entityNameIds.get(r.entityA),
+ entityNameIds.get(r.entityB),
+ { relationship: r },
+ getEdgeName(r)
+ );
+ });
+ return relationships2;
+};
+let relCnt = 0;
+const drawRelationshipFromLayout = function(svg, rel, g, insert, diagObj) {
+ relCnt++;
+ const edge = g.edge(
+ entityNameIds.get(rel.entityA),
+ entityNameIds.get(rel.entityB),
+ getEdgeName(rel)
+ );
+ const lineFunction = line().x(function(d) {
+ return d.x;
+ }).y(function(d) {
+ return d.y;
+ }).curve(curveBasis);
+ const svgPath = svg.insert("path", "#" + insert).classed("er relationshipLine", true).attr("d", lineFunction(edge.points)).style("stroke", conf.stroke).style("fill", "none");
+ if (rel.relSpec.relType === diagObj.db.Identification.NON_IDENTIFYING) {
+ svgPath.attr("stroke-dasharray", "8,8");
+ }
+ let url = "";
+ if (conf.arrowMarkerAbsolute) {
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
+ url = url.replace(/\(/g, "\\(");
+ url = url.replace(/\)/g, "\\)");
+ }
+ switch (rel.relSpec.cardA) {
+ case diagObj.db.Cardinality.ZERO_OR_ONE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_END + ")");
+ break;
+ case diagObj.db.Cardinality.ZERO_OR_MORE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_END + ")");
+ break;
+ case diagObj.db.Cardinality.ONE_OR_MORE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_END + ")");
+ break;
+ case diagObj.db.Cardinality.ONLY_ONE:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_END + ")");
+ break;
+ case diagObj.db.Cardinality.MD_PARENT:
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_END + ")");
+ break;
+ }
+ switch (rel.relSpec.cardB) {
+ case diagObj.db.Cardinality.ZERO_OR_ONE:
+ svgPath.attr(
+ "marker-start",
+ "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_START + ")"
+ );
+ break;
+ case diagObj.db.Cardinality.ZERO_OR_MORE:
+ svgPath.attr(
+ "marker-start",
+ "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_START + ")"
+ );
+ break;
+ case diagObj.db.Cardinality.ONE_OR_MORE:
+ svgPath.attr(
+ "marker-start",
+ "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_START + ")"
+ );
+ break;
+ case diagObj.db.Cardinality.ONLY_ONE:
+ svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_START + ")");
+ break;
+ case diagObj.db.Cardinality.MD_PARENT:
+ svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_START + ")");
+ break;
+ }
+ const len = svgPath.node().getTotalLength();
+ const labelPoint = svgPath.node().getPointAtLength(len * 0.5);
+ const labelId = "rel" + relCnt;
+ const labelNode = svg.append("text").classed("er relationshipLabel", true).attr("id", labelId).attr("x", labelPoint.x).attr("y", labelPoint.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(rel.roleA);
+ const labelBBox = labelNode.node().getBBox();
+ svg.insert("rect", "#" + labelId).classed("er relationshipLabelBox", true).attr("x", labelPoint.x - labelBBox.width / 2).attr("y", labelPoint.y - labelBBox.height / 2).attr("width", labelBBox.width).attr("height", labelBBox.height);
+};
+const draw = function(text, id, _version, diagObj) {
+ conf = getConfig().er;
+ log$1.info("Drawing ER diagram");
+ const securityLevel = getConfig().securityLevel;
+ let sandboxElement;
+ if (securityLevel === "sandbox") {
+ sandboxElement = select("#i" + id);
+ }
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
+ const svg = root.select(`[id='${id}']`);
+ erMarkers.insertMarkers(svg, conf);
+ let g;
+ g = new Graph({
+ multigraph: true,
+ directed: true,
+ compound: false
+ }).setGraph({
+ rankdir: conf.layoutDirection,
+ marginx: 20,
+ marginy: 20,
+ nodesep: 100,
+ edgesep: 100,
+ ranksep: 100
+ }).setDefaultEdgeLabel(function() {
+ return {};
+ });
+ const firstEntity = drawEntities(svg, diagObj.db.getEntities(), g);
+ const relationships2 = addRelationships(diagObj.db.getRelationships(), g);
+ layout(g);
+ adjustEntities(svg, g);
+ relationships2.forEach(function(rel) {
+ drawRelationshipFromLayout(svg, rel, g, firstEntity, diagObj);
+ });
+ const padding = conf.diagramPadding;
+ utils.insertTitle(svg, "entityTitleText", conf.titleTopMargin, diagObj.db.getDiagramTitle());
+ const svgBounds = svg.node().getBBox();
+ const width = svgBounds.width + padding * 2;
+ const height = svgBounds.height + padding * 2;
+ configureSvgSize(svg, height, width, conf.useMaxWidth);
+ svg.attr("viewBox", `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`);
+};
+const MERMAID_ERDIAGRAM_UUID = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
+function generateId(str = "", prefix = "") {
+ const simplifiedStr = str.replace(BAD_ID_CHARS_REGEXP, "");
+ return `${strWithHyphen(prefix)}${strWithHyphen(simplifiedStr)}${v5(
+ str,
+ MERMAID_ERDIAGRAM_UUID
+ )}`;
+}
+function strWithHyphen(str = "") {
+ return str.length > 0 ? `${str}-` : "";
+}
+const erRenderer = {
+ setConf,
+ draw
+};
+const getStyles = (options) => `
+ .entityBox {
+ fill: ${options.mainBkg};
+ stroke: ${options.nodeBorder};
+ }
+
+ .attributeBoxOdd {
+ fill: ${options.attributeBackgroundColorOdd};
+ stroke: ${options.nodeBorder};
+ }
+
+ .attributeBoxEven {
+ fill: ${options.attributeBackgroundColorEven};
+ stroke: ${options.nodeBorder};
+ }
+
+ .relationshipLabelBox {
+ fill: ${options.tertiaryColor};
+ opacity: 0.7;
+ background-color: ${options.tertiaryColor};
+ rect {
+ opacity: 0.5;
+ }
+ }
+
+ .relationshipLine {
+ stroke: ${options.lineColor};
+ }
+
+ .entityTitleText {
+ text-anchor: middle;
+ font-size: 18px;
+ fill: ${options.textColor};
+ }
+ #MD_PARENT_START {
+ fill: #f5f5f5 !important;
+ stroke: ${options.lineColor} !important;
+ stroke-width: 1;
+ }
+ #MD_PARENT_END {
+ fill: #f5f5f5 !important;
+ stroke: ${options.lineColor} !important;
+ stroke-width: 1;
+ }
+
+`;
+const erStyles = getStyles;
+const diagram = {
+ parser: erParser,
+ db: erDb,
+ renderer: erRenderer,
+ styles: erStyles
+};
+
+export { diagram };
diff --git a/libs/marked/flowDb-c1833063-C_SlfbWJ.js b/libs/marked/flowDb-c1833063-C_SlfbWJ.js
new file mode 100644
index 0000000..172b73b
--- /dev/null
+++ b/libs/marked/flowDb-c1833063-C_SlfbWJ.js
@@ -0,0 +1,1711 @@
+import { c as getConfig, aq as defaultConfig, s as setAccTitle, g as getAccTitle, a as getAccDescription, b as setAccDescription, C as setDiagramTitle, D as getDiagramTitle, l as log$1, A as utils, E as clear$1, j as common$1, h as select } from './index-CN3YjQ0n.js';
+
+var parser = function() {
+ var o = function(k, v, o2, l) {
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
+ ;
+ return o2;
+ }, $V0 = [1, 4], $V1 = [1, 3], $V2 = [1, 5], $V3 = [1, 8, 9, 10, 11, 27, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], $V4 = [2, 2], $V5 = [1, 13], $V6 = [1, 14], $V7 = [1, 15], $V8 = [1, 16], $V9 = [1, 23], $Va = [1, 25], $Vb = [1, 26], $Vc = [1, 27], $Vd = [1, 49], $Ve = [1, 48], $Vf = [1, 29], $Vg = [1, 30], $Vh = [1, 31], $Vi = [1, 32], $Vj = [1, 33], $Vk = [1, 44], $Vl = [1, 46], $Vm = [1, 42], $Vn = [1, 47], $Vo = [1, 43], $Vp = [1, 50], $Vq = [1, 45], $Vr = [1, 51], $Vs = [1, 52], $Vt = [1, 34], $Vu = [1, 35], $Vv = [1, 36], $Vw = [1, 37], $Vx = [1, 57], $Vy = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], $Vz = [1, 61], $VA = [1, 60], $VB = [1, 62], $VC = [8, 9, 11, 73, 75], $VD = [1, 88], $VE = [1, 93], $VF = [1, 92], $VG = [1, 89], $VH = [1, 85], $VI = [1, 91], $VJ = [1, 87], $VK = [1, 94], $VL = [1, 90], $VM = [1, 95], $VN = [1, 86], $VO = [8, 9, 10, 11, 73, 75], $VP = [8, 9, 10, 11, 44, 73, 75], $VQ = [8, 9, 10, 11, 29, 42, 44, 46, 48, 50, 52, 54, 56, 58, 61, 63, 65, 66, 68, 73, 75, 86, 99, 102, 103, 106, 108, 111, 112, 113], $VR = [8, 9, 11, 42, 58, 73, 75, 86, 99, 102, 103, 106, 108, 111, 112, 113], $VS = [42, 58, 86, 99, 102, 103, 106, 108, 111, 112, 113], $VT = [1, 121], $VU = [1, 120], $VV = [1, 128], $VW = [1, 142], $VX = [1, 143], $VY = [1, 144], $VZ = [1, 145], $V_ = [1, 130], $V$ = [1, 132], $V01 = [1, 136], $V11 = [1, 137], $V21 = [1, 138], $V31 = [1, 139], $V41 = [1, 140], $V51 = [1, 141], $V61 = [1, 146], $V71 = [1, 147], $V81 = [1, 126], $V91 = [1, 127], $Va1 = [1, 134], $Vb1 = [1, 129], $Vc1 = [1, 133], $Vd1 = [1, 131], $Ve1 = [8, 9, 10, 11, 27, 32, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], $Vf1 = [1, 149], $Vg1 = [8, 9, 11], $Vh1 = [8, 9, 10, 11, 14, 42, 58, 86, 102, 103, 106, 108, 111, 112, 113], $Vi1 = [1, 169], $Vj1 = [1, 165], $Vk1 = [1, 166], $Vl1 = [1, 170], $Vm1 = [1, 167], $Vn1 = [1, 168], $Vo1 = [75, 113, 116], $Vp1 = [8, 9, 10, 11, 12, 14, 27, 29, 32, 42, 58, 73, 81, 82, 83, 84, 85, 86, 87, 102, 106, 108, 111, 112, 113], $Vq1 = [10, 103], $Vr1 = [31, 47, 49, 51, 53, 55, 60, 62, 64, 65, 67, 69, 113, 114, 115], $Vs1 = [1, 235], $Vt1 = [1, 233], $Vu1 = [1, 237], $Vv1 = [1, 231], $Vw1 = [1, 232], $Vx1 = [1, 234], $Vy1 = [1, 236], $Vz1 = [1, 238], $VA1 = [1, 255], $VB1 = [8, 9, 11, 103], $VC1 = [8, 9, 10, 11, 58, 81, 102, 103, 106, 107, 108, 109];
+ var parser2 = {
+ trace: function trace() {
+ },
+ yy: {},
+ symbols_: { "error": 2, "start": 3, "graphConfig": 4, "document": 5, "line": 6, "statement": 7, "SEMI": 8, "NEWLINE": 9, "SPACE": 10, "EOF": 11, "GRAPH": 12, "NODIR": 13, "DIR": 14, "FirstStmtSeparator": 15, "ending": 16, "endToken": 17, "spaceList": 18, "spaceListNewline": 19, "vertexStatement": 20, "separator": 21, "styleStatement": 22, "linkStyleStatement": 23, "classDefStatement": 24, "classStatement": 25, "clickStatement": 26, "subgraph": 27, "textNoTags": 28, "SQS": 29, "text": 30, "SQE": 31, "end": 32, "direction": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "link": 39, "node": 40, "styledVertex": 41, "AMP": 42, "vertex": 43, "STYLE_SEPARATOR": 44, "idString": 45, "DOUBLECIRCLESTART": 46, "DOUBLECIRCLEEND": 47, "PS": 48, "PE": 49, "(-": 50, "-)": 51, "STADIUMSTART": 52, "STADIUMEND": 53, "SUBROUTINESTART": 54, "SUBROUTINEEND": 55, "VERTEX_WITH_PROPS_START": 56, "NODE_STRING[field]": 57, "COLON": 58, "NODE_STRING[value]": 59, "PIPE": 60, "CYLINDERSTART": 61, "CYLINDEREND": 62, "DIAMOND_START": 63, "DIAMOND_STOP": 64, "TAGEND": 65, "TRAPSTART": 66, "TRAPEND": 67, "INVTRAPSTART": 68, "INVTRAPEND": 69, "linkStatement": 70, "arrowText": 71, "TESTSTR": 72, "START_LINK": 73, "edgeText": 74, "LINK": 75, "edgeTextToken": 76, "STR": 77, "MD_STR": 78, "textToken": 79, "keywords": 80, "STYLE": 81, "LINKSTYLE": 82, "CLASSDEF": 83, "CLASS": 84, "CLICK": 85, "DOWN": 86, "UP": 87, "textNoTagsToken": 88, "stylesOpt": 89, "idString[vertex]": 90, "idString[class]": 91, "CALLBACKNAME": 92, "CALLBACKARGS": 93, "HREF": 94, "LINK_TARGET": 95, "STR[link]": 96, "STR[tooltip]": 97, "alphaNum": 98, "DEFAULT": 99, "numList": 100, "INTERPOLATE": 101, "NUM": 102, "COMMA": 103, "style": 104, "styleComponent": 105, "NODE_STRING": 106, "UNIT": 107, "BRKT": 108, "PCT": 109, "idStringToken": 110, "MINUS": 111, "MULT": 112, "UNICODE_TEXT": 113, "TEXT": 114, "TAGSTART": 115, "EDGE_TEXT": 116, "alphaNumToken": 117, "direction_tb": 118, "direction_bt": 119, "direction_rl": 120, "direction_lr": 121, "$accept": 0, "$end": 1 },
+ terminals_: { 2: "error", 8: "SEMI", 9: "NEWLINE", 10: "SPACE", 11: "EOF", 12: "GRAPH", 13: "NODIR", 14: "DIR", 27: "subgraph", 29: "SQS", 31: "SQE", 32: "end", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 42: "AMP", 44: "STYLE_SEPARATOR", 46: "DOUBLECIRCLESTART", 47: "DOUBLECIRCLEEND", 48: "PS", 49: "PE", 50: "(-", 51: "-)", 52: "STADIUMSTART", 53: "STADIUMEND", 54: "SUBROUTINESTART", 55: "SUBROUTINEEND", 56: "VERTEX_WITH_PROPS_START", 57: "NODE_STRING[field]", 58: "COLON", 59: "NODE_STRING[value]", 60: "PIPE", 61: "CYLINDERSTART", 62: "CYLINDEREND", 63: "DIAMOND_START", 64: "DIAMOND_STOP", 65: "TAGEND", 66: "TRAPSTART", 67: "TRAPEND", 68: "INVTRAPSTART", 69: "INVTRAPEND", 72: "TESTSTR", 73: "START_LINK", 75: "LINK", 77: "STR", 78: "MD_STR", 81: "STYLE", 82: "LINKSTYLE", 83: "CLASSDEF", 84: "CLASS", 85: "CLICK", 86: "DOWN", 87: "UP", 90: "idString[vertex]", 91: "idString[class]", 92: "CALLBACKNAME", 93: "CALLBACKARGS", 94: "HREF", 95: "LINK_TARGET", 96: "STR[link]", 97: "STR[tooltip]", 99: "DEFAULT", 101: "INTERPOLATE", 102: "NUM", 103: "COMMA", 106: "NODE_STRING", 107: "UNIT", 108: "BRKT", 109: "PCT", 111: "MINUS", 112: "MULT", 113: "UNICODE_TEXT", 114: "TEXT", 115: "TAGSTART", 116: "EDGE_TEXT", 118: "direction_tb", 119: "direction_bt", 120: "direction_rl", 121: "direction_lr" },
+ productions_: [0, [3, 2], [5, 0], [5, 2], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [4, 2], [4, 2], [4, 2], [4, 3], [16, 2], [16, 1], [17, 1], [17, 1], [17, 1], [15, 1], [15, 1], [15, 2], [19, 2], [19, 2], [19, 1], [19, 1], [18, 2], [18, 1], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 9], [7, 6], [7, 4], [7, 1], [7, 2], [7, 2], [7, 1], [21, 1], [21, 1], [21, 1], [20, 3], [20, 4], [20, 2], [20, 1], [40, 1], [40, 5], [41, 1], [41, 3], [43, 4], [43, 4], [43, 6], [43, 4], [43, 4], [43, 4], [43, 8], [43, 4], [43, 4], [43, 4], [43, 6], [43, 4], [43, 4], [43, 4], [43, 4], [43, 4], [43, 1], [39, 2], [39, 3], [39, 3], [39, 1], [39, 3], [74, 1], [74, 2], [74, 1], [74, 1], [70, 1], [71, 3], [30, 1], [30, 2], [30, 1], [30, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [28, 1], [28, 2], [28, 1], [28, 1], [24, 5], [25, 5], [26, 2], [26, 4], [26, 3], [26, 5], [26, 3], [26, 5], [26, 5], [26, 7], [26, 2], [26, 4], [26, 2], [26, 4], [26, 4], [26, 6], [22, 5], [23, 5], [23, 5], [23, 9], [23, 9], [23, 7], [23, 7], [100, 1], [100, 3], [89, 1], [89, 3], [104, 1], [104, 2], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [79, 1], [79, 1], [79, 1], [79, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [76, 1], [76, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [45, 1], [45, 2], [98, 1], [98, 2], [33, 1], [33, 1], [33, 1], [33, 1]],
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+ var $0 = $$.length - 1;
+ switch (yystate) {
+ case 2:
+ this.$ = [];
+ break;
+ case 3:
+ if (!Array.isArray($$[$0]) || $$[$0].length > 0) {
+ $$[$0 - 1].push($$[$0]);
+ }
+ this.$ = $$[$0 - 1];
+ break;
+ case 4:
+ case 176:
+ this.$ = $$[$0];
+ break;
+ case 11:
+ yy.setDirection("TB");
+ this.$ = "TB";
+ break;
+ case 12:
+ yy.setDirection($$[$0 - 1]);
+ this.$ = $$[$0 - 1];
+ break;
+ case 27:
+ this.$ = $$[$0 - 1].nodes;
+ break;
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ this.$ = [];
+ break;
+ case 33:
+ this.$ = yy.addSubGraph($$[$0 - 6], $$[$0 - 1], $$[$0 - 4]);
+ break;
+ case 34:
+ this.$ = yy.addSubGraph($$[$0 - 3], $$[$0 - 1], $$[$0 - 3]);
+ break;
+ case 35:
+ this.$ = yy.addSubGraph(void 0, $$[$0 - 1], void 0);
+ break;
+ case 37:
+ this.$ = $$[$0].trim();
+ yy.setAccTitle(this.$);
+ break;
+ case 38:
+ case 39:
+ this.$ = $$[$0].trim();
+ yy.setAccDescription(this.$);
+ break;
+ case 43:
+ yy.addLink($$[$0 - 2].stmt, $$[$0], $$[$0 - 1]);
+ this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0 - 2].nodes) };
+ break;
+ case 44:
+ yy.addLink($$[$0 - 3].stmt, $$[$0 - 1], $$[$0 - 2]);
+ this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1].concat($$[$0 - 3].nodes) };
+ break;
+ case 45:
+ this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1] };
+ break;
+ case 46:
+ this.$ = { stmt: $$[$0], nodes: $$[$0] };
+ break;
+ case 47:
+ this.$ = [$$[$0]];
+ break;
+ case 48:
+ this.$ = $$[$0 - 4].concat($$[$0]);
+ break;
+ case 49:
+ this.$ = $$[$0];
+ break;
+ case 50:
+ this.$ = $$[$0 - 2];
+ yy.setClass($$[$0 - 2], $$[$0]);
+ break;
+ case 51:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "square");
+ break;
+ case 52:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "doublecircle");
+ break;
+ case 53:
+ this.$ = $$[$0 - 5];
+ yy.addVertex($$[$0 - 5], $$[$0 - 2], "circle");
+ break;
+ case 54:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "ellipse");
+ break;
+ case 55:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "stadium");
+ break;
+ case 56:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "subroutine");
+ break;
+ case 57:
+ this.$ = $$[$0 - 7];
+ yy.addVertex($$[$0 - 7], $$[$0 - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[$$[$0 - 5], $$[$0 - 3]]]));
+ break;
+ case 58:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "cylinder");
+ break;
+ case 59:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "round");
+ break;
+ case 60:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "diamond");
+ break;
+ case 61:
+ this.$ = $$[$0 - 5];
+ yy.addVertex($$[$0 - 5], $$[$0 - 2], "hexagon");
+ break;
+ case 62:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "odd");
+ break;
+ case 63:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "trapezoid");
+ break;
+ case 64:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "inv_trapezoid");
+ break;
+ case 65:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_right");
+ break;
+ case 66:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_left");
+ break;
+ case 67:
+ this.$ = $$[$0];
+ yy.addVertex($$[$0]);
+ break;
+ case 68:
+ $$[$0 - 1].text = $$[$0];
+ this.$ = $$[$0 - 1];
+ break;
+ case 69:
+ case 70:
+ $$[$0 - 2].text = $$[$0 - 1];
+ this.$ = $$[$0 - 2];
+ break;
+ case 71:
+ this.$ = $$[$0];
+ break;
+ case 72:
+ var inf = yy.destructLink($$[$0], $$[$0 - 2]);
+ this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "text": $$[$0 - 1] };
+ break;
+ case 73:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 74:
+ this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
+ break;
+ case 75:
+ this.$ = { text: $$[$0], type: "string" };
+ break;
+ case 76:
+ this.$ = { text: $$[$0], type: "markdown" };
+ break;
+ case 77:
+ var inf = yy.destructLink($$[$0]);
+ this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length };
+ break;
+ case 78:
+ this.$ = $$[$0 - 1];
+ break;
+ case 79:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 80:
+ this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
+ break;
+ case 81:
+ this.$ = { text: $$[$0], type: "string" };
+ break;
+ case 82:
+ case 97:
+ this.$ = { text: $$[$0], type: "markdown" };
+ break;
+ case 94:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 95:
+ this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
+ break;
+ case 96:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 98:
+ this.$ = $$[$0 - 4];
+ yy.addClass($$[$0 - 2], $$[$0]);
+ break;
+ case 99:
+ this.$ = $$[$0 - 4];
+ yy.setClass($$[$0 - 2], $$[$0]);
+ break;
+ case 100:
+ case 108:
+ this.$ = $$[$0 - 1];
+ yy.setClickEvent($$[$0 - 1], $$[$0]);
+ break;
+ case 101:
+ case 109:
+ this.$ = $$[$0 - 3];
+ yy.setClickEvent($$[$0 - 3], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 3], $$[$0]);
+ break;
+ case 102:
+ this.$ = $$[$0 - 2];
+ yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]);
+ break;
+ case 103:
+ this.$ = $$[$0 - 4];
+ yy.setClickEvent($$[$0 - 4], $$[$0 - 3], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 4], $$[$0]);
+ break;
+ case 104:
+ this.$ = $$[$0 - 2];
+ yy.setLink($$[$0 - 2], $$[$0]);
+ break;
+ case 105:
+ this.$ = $$[$0 - 4];
+ yy.setLink($$[$0 - 4], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 4], $$[$0]);
+ break;
+ case 106:
+ this.$ = $$[$0 - 4];
+ yy.setLink($$[$0 - 4], $$[$0 - 2], $$[$0]);
+ break;
+ case 107:
+ this.$ = $$[$0 - 6];
+ yy.setLink($$[$0 - 6], $$[$0 - 4], $$[$0]);
+ yy.setTooltip($$[$0 - 6], $$[$0 - 2]);
+ break;
+ case 110:
+ this.$ = $$[$0 - 1];
+ yy.setLink($$[$0 - 1], $$[$0]);
+ break;
+ case 111:
+ this.$ = $$[$0 - 3];
+ yy.setLink($$[$0 - 3], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 3], $$[$0]);
+ break;
+ case 112:
+ this.$ = $$[$0 - 3];
+ yy.setLink($$[$0 - 3], $$[$0 - 2], $$[$0]);
+ break;
+ case 113:
+ this.$ = $$[$0 - 5];
+ yy.setLink($$[$0 - 5], $$[$0 - 4], $$[$0]);
+ yy.setTooltip($$[$0 - 5], $$[$0 - 2]);
+ break;
+ case 114:
+ this.$ = $$[$0 - 4];
+ yy.addVertex($$[$0 - 2], void 0, void 0, $$[$0]);
+ break;
+ case 115:
+ this.$ = $$[$0 - 4];
+ yy.updateLink([$$[$0 - 2]], $$[$0]);
+ break;
+ case 116:
+ this.$ = $$[$0 - 4];
+ yy.updateLink($$[$0 - 2], $$[$0]);
+ break;
+ case 117:
+ this.$ = $$[$0 - 8];
+ yy.updateLinkInterpolate([$$[$0 - 6]], $$[$0 - 2]);
+ yy.updateLink([$$[$0 - 6]], $$[$0]);
+ break;
+ case 118:
+ this.$ = $$[$0 - 8];
+ yy.updateLinkInterpolate($$[$0 - 6], $$[$0 - 2]);
+ yy.updateLink($$[$0 - 6], $$[$0]);
+ break;
+ case 119:
+ this.$ = $$[$0 - 6];
+ yy.updateLinkInterpolate([$$[$0 - 4]], $$[$0]);
+ break;
+ case 120:
+ this.$ = $$[$0 - 6];
+ yy.updateLinkInterpolate($$[$0 - 4], $$[$0]);
+ break;
+ case 121:
+ case 123:
+ this.$ = [$$[$0]];
+ break;
+ case 122:
+ case 124:
+ $$[$0 - 2].push($$[$0]);
+ this.$ = $$[$0 - 2];
+ break;
+ case 126:
+ this.$ = $$[$0 - 1] + $$[$0];
+ break;
+ case 174:
+ this.$ = $$[$0];
+ break;
+ case 175:
+ this.$ = $$[$0 - 1] + "" + $$[$0];
+ break;
+ case 177:
+ this.$ = $$[$0 - 1] + "" + $$[$0];
+ break;
+ case 178:
+ this.$ = { stmt: "dir", value: "TB" };
+ break;
+ case 179:
+ this.$ = { stmt: "dir", value: "BT" };
+ break;
+ case 180:
+ this.$ = { stmt: "dir", value: "RL" };
+ break;
+ case 181:
+ this.$ = { stmt: "dir", value: "LR" };
+ break;
+ }
+ },
+ table: [{ 3: 1, 4: 2, 9: $V0, 10: $V1, 12: $V2 }, { 1: [3] }, o($V3, $V4, { 5: 6 }), { 4: 7, 9: $V0, 10: $V1, 12: $V2 }, { 4: 8, 9: $V0, 10: $V1, 12: $V2 }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, o($V3, [2, 9]), o($V3, [2, 10]), o($V3, [2, 11]), { 8: [1, 54], 9: [1, 55], 10: $Vx, 15: 53, 18: 56 }, o($Vy, [2, 3]), o($Vy, [2, 4]), o($Vy, [2, 5]), o($Vy, [2, 6]), o($Vy, [2, 7]), o($Vy, [2, 8]), { 8: $Vz, 9: $VA, 11: $VB, 21: 58, 39: 59, 70: 63, 73: [1, 64], 75: [1, 65] }, { 8: $Vz, 9: $VA, 11: $VB, 21: 66 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 67 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 68 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 69 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 70 }, { 8: $Vz, 9: $VA, 10: [1, 71], 11: $VB, 21: 72 }, o($Vy, [2, 36]), { 35: [1, 73] }, { 37: [1, 74] }, o($Vy, [2, 39]), o($VC, [2, 46], { 18: 75, 10: $Vx }), { 10: [1, 76] }, { 10: [1, 77] }, { 10: [1, 78] }, { 10: [1, 79] }, { 14: $VD, 42: $VE, 58: $VF, 77: [1, 83], 86: $VG, 92: [1, 80], 94: [1, 81], 98: 82, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN, 117: 84 }, o($Vy, [2, 178]), o($Vy, [2, 179]), o($Vy, [2, 180]), o($Vy, [2, 181]), o($VO, [2, 47]), o($VO, [2, 49], { 44: [1, 96] }), o($VP, [2, 67], { 110: 109, 29: [1, 97], 42: $Vd, 46: [1, 98], 48: [1, 99], 50: [1, 100], 52: [1, 101], 54: [1, 102], 56: [1, 103], 58: $Ve, 61: [1, 104], 63: [1, 105], 65: [1, 106], 66: [1, 107], 68: [1, 108], 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 111: $Vq, 112: $Vr, 113: $Vs }), o($VQ, [2, 174]), o($VQ, [2, 135]), o($VQ, [2, 136]), o($VQ, [2, 137]), o($VQ, [2, 138]), o($VQ, [2, 139]), o($VQ, [2, 140]), o($VQ, [2, 141]), o($VQ, [2, 142]), o($VQ, [2, 143]), o($VQ, [2, 144]), o($VQ, [2, 145]), o($V3, [2, 12]), o($V3, [2, 18]), o($V3, [2, 19]), { 9: [1, 110] }, o($VR, [2, 26], { 18: 111, 10: $Vx }), o($Vy, [2, 27]), { 40: 112, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, o($Vy, [2, 40]), o($Vy, [2, 41]), o($Vy, [2, 42]), o($VS, [2, 71], { 71: 113, 60: [1, 115], 72: [1, 114] }), { 74: 116, 76: 117, 77: [1, 118], 78: [1, 119], 113: $VT, 116: $VU }, o([42, 58, 60, 72, 86, 99, 102, 103, 106, 108, 111, 112, 113], [2, 77]), o($Vy, [2, 28]), o($Vy, [2, 29]), o($Vy, [2, 30]), o($Vy, [2, 31]), o($Vy, [2, 32]), { 10: $VV, 12: $VW, 14: $VX, 27: $VY, 28: 122, 32: $VZ, 42: $V_, 58: $V$, 73: $V01, 77: [1, 124], 78: [1, 125], 80: 135, 81: $V11, 82: $V21, 83: $V31, 84: $V41, 85: $V51, 86: $V61, 87: $V71, 88: 123, 102: $V81, 106: $V91, 108: $Va1, 111: $Vb1, 112: $Vc1, 113: $Vd1 }, o($Ve1, $V4, { 5: 148 }), o($Vy, [2, 37]), o($Vy, [2, 38]), o($VC, [2, 45], { 42: $Vf1 }), { 42: $Vd, 45: 150, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 99: [1, 151], 100: 152, 102: [1, 153] }, { 42: $Vd, 45: 154, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 42: $Vd, 45: 155, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, o($Vg1, [2, 100], { 10: [1, 156], 93: [1, 157] }), { 77: [1, 158] }, o($Vg1, [2, 108], { 117: 160, 10: [1, 159], 14: $VD, 42: $VE, 58: $VF, 86: $VG, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN }), o($Vg1, [2, 110], { 10: [1, 161] }), o($Vh1, [2, 176]), o($Vh1, [2, 163]), o($Vh1, [2, 164]), o($Vh1, [2, 165]), o($Vh1, [2, 166]), o($Vh1, [2, 167]), o($Vh1, [2, 168]), o($Vh1, [2, 169]), o($Vh1, [2, 170]), o($Vh1, [2, 171]), o($Vh1, [2, 172]), o($Vh1, [2, 173]), { 42: $Vd, 45: 162, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 30: 163, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 171, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 173, 48: [1, 172], 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 174, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 175, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 176, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 106: [1, 177] }, { 30: 178, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 179, 63: [1, 180], 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 181, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 182, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 183, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VQ, [2, 175]), o($V3, [2, 20]), o($VR, [2, 25]), o($VC, [2, 43], { 18: 184, 10: $Vx }), o($VS, [2, 68], { 10: [1, 185] }), { 10: [1, 186] }, { 30: 187, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 75: [1, 188], 76: 189, 113: $VT, 116: $VU }, o($Vo1, [2, 73]), o($Vo1, [2, 75]), o($Vo1, [2, 76]), o($Vo1, [2, 161]), o($Vo1, [2, 162]), { 8: $Vz, 9: $VA, 10: $VV, 11: $VB, 12: $VW, 14: $VX, 21: 191, 27: $VY, 29: [1, 190], 32: $VZ, 42: $V_, 58: $V$, 73: $V01, 80: 135, 81: $V11, 82: $V21, 83: $V31, 84: $V41, 85: $V51, 86: $V61, 87: $V71, 88: 192, 102: $V81, 106: $V91, 108: $Va1, 111: $Vb1, 112: $Vc1, 113: $Vd1 }, o($Vp1, [2, 94]), o($Vp1, [2, 96]), o($Vp1, [2, 97]), o($Vp1, [2, 150]), o($Vp1, [2, 151]), o($Vp1, [2, 152]), o($Vp1, [2, 153]), o($Vp1, [2, 154]), o($Vp1, [2, 155]), o($Vp1, [2, 156]), o($Vp1, [2, 157]), o($Vp1, [2, 158]), o($Vp1, [2, 159]), o($Vp1, [2, 160]), o($Vp1, [2, 83]), o($Vp1, [2, 84]), o($Vp1, [2, 85]), o($Vp1, [2, 86]), o($Vp1, [2, 87]), o($Vp1, [2, 88]), o($Vp1, [2, 89]), o($Vp1, [2, 90]), o($Vp1, [2, 91]), o($Vp1, [2, 92]), o($Vp1, [2, 93]), { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 193], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, { 10: $Vx, 18: 194 }, { 10: [1, 195], 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 109, 111: $Vq, 112: $Vr, 113: $Vs }, { 10: [1, 196] }, { 10: [1, 197], 103: [1, 198] }, o($Vq1, [2, 121]), { 10: [1, 199], 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 109, 111: $Vq, 112: $Vr, 113: $Vs }, { 10: [1, 200], 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 109, 111: $Vq, 112: $Vr, 113: $Vs }, { 77: [1, 201] }, o($Vg1, [2, 102], { 10: [1, 202] }), o($Vg1, [2, 104], { 10: [1, 203] }), { 77: [1, 204] }, o($Vh1, [2, 177]), { 77: [1, 205], 95: [1, 206] }, o($VO, [2, 50], { 110: 109, 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 111: $Vq, 112: $Vr, 113: $Vs }), { 31: [1, 207], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($Vr1, [2, 79]), o($Vr1, [2, 81]), o($Vr1, [2, 82]), o($Vr1, [2, 146]), o($Vr1, [2, 147]), o($Vr1, [2, 148]), o($Vr1, [2, 149]), { 47: [1, 209], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 210, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 49: [1, 211], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 51: [1, 212], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 53: [1, 213], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 55: [1, 214], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 58: [1, 215] }, { 62: [1, 216], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 64: [1, 217], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 218, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 31: [1, 219], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 65: $Vi1, 67: [1, 220], 69: [1, 221], 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 65: $Vi1, 67: [1, 223], 69: [1, 222], 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VC, [2, 44], { 42: $Vf1 }), o($VS, [2, 70]), o($VS, [2, 69]), { 60: [1, 224], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VS, [2, 72]), o($Vo1, [2, 74]), { 30: 225, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($Ve1, $V4, { 5: 226 }), o($Vp1, [2, 95]), o($Vy, [2, 35]), { 41: 227, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 228, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 239, 101: [1, 240], 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 241, 101: [1, 242], 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 102: [1, 243] }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 244, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 42: $Vd, 45: 245, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, o($Vg1, [2, 101]), { 77: [1, 246] }, { 77: [1, 247], 95: [1, 248] }, o($Vg1, [2, 109]), o($Vg1, [2, 111], { 10: [1, 249] }), o($Vg1, [2, 112]), o($VP, [2, 51]), o($Vr1, [2, 80]), o($VP, [2, 52]), { 49: [1, 250], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VP, [2, 59]), o($VP, [2, 54]), o($VP, [2, 55]), o($VP, [2, 56]), { 106: [1, 251] }, o($VP, [2, 58]), o($VP, [2, 60]), { 64: [1, 252], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VP, [2, 62]), o($VP, [2, 63]), o($VP, [2, 65]), o($VP, [2, 64]), o($VP, [2, 66]), o([10, 42, 58, 86, 99, 102, 103, 106, 108, 111, 112, 113], [2, 78]), { 31: [1, 253], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 254], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, o($VO, [2, 48]), o($Vg1, [2, 114], { 103: $VA1 }), o($VB1, [2, 123], { 105: 256, 10: $Vs1, 58: $Vt1, 81: $Vu1, 102: $Vv1, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }), o($VC1, [2, 125]), o($VC1, [2, 127]), o($VC1, [2, 128]), o($VC1, [2, 129]), o($VC1, [2, 130]), o($VC1, [2, 131]), o($VC1, [2, 132]), o($VC1, [2, 133]), o($VC1, [2, 134]), o($Vg1, [2, 115], { 103: $VA1 }), { 10: [1, 257] }, o($Vg1, [2, 116], { 103: $VA1 }), { 10: [1, 258] }, o($Vq1, [2, 122]), o($Vg1, [2, 98], { 103: $VA1 }), o($Vg1, [2, 99], { 110: 109, 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 111: $Vq, 112: $Vr, 113: $Vs }), o($Vg1, [2, 103]), o($Vg1, [2, 105], { 10: [1, 259] }), o($Vg1, [2, 106]), { 95: [1, 260] }, { 49: [1, 261] }, { 60: [1, 262] }, { 64: [1, 263] }, { 8: $Vz, 9: $VA, 11: $VB, 21: 264 }, o($Vy, [2, 34]), { 10: $Vs1, 58: $Vt1, 81: $Vu1, 102: $Vv1, 104: 265, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, o($VC1, [2, 126]), { 14: $VD, 42: $VE, 58: $VF, 86: $VG, 98: 266, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN, 117: 84 }, { 14: $VD, 42: $VE, 58: $VF, 86: $VG, 98: 267, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN, 117: 84 }, { 95: [1, 268] }, o($Vg1, [2, 113]), o($VP, [2, 53]), { 30: 269, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VP, [2, 61]), o($Ve1, $V4, { 5: 270 }), o($VB1, [2, 124], { 105: 256, 10: $Vs1, 58: $Vt1, 81: $Vu1, 102: $Vv1, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }), o($Vg1, [2, 119], { 117: 160, 10: [1, 271], 14: $VD, 42: $VE, 58: $VF, 86: $VG, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN }), o($Vg1, [2, 120], { 117: 160, 10: [1, 272], 14: $VD, 42: $VE, 58: $VF, 86: $VG, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN }), o($Vg1, [2, 107]), { 31: [1, 273], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 274], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 275, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 276, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, o($VP, [2, 57]), o($Vy, [2, 33]), o($Vg1, [2, 117], { 103: $VA1 }), o($Vg1, [2, 118], { 103: $VA1 })],
+ defaultActions: {},
+ parseError: function parseError(str, hash) {
+ if (hash.recoverable) {
+ this.trace(str);
+ } else {
+ var error = new Error(str);
+ error.hash = hash;
+ throw error;
+ }
+ },
+ parse: function parse(input) {
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+ var args = lstack.slice.call(arguments, 1);
+ var lexer2 = Object.create(this.lexer);
+ var sharedState = { yy: {} };
+ for (var k in this.yy) {
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
+ sharedState.yy[k] = this.yy[k];
+ }
+ }
+ lexer2.setInput(input, sharedState.yy);
+ sharedState.yy.lexer = lexer2;
+ sharedState.yy.parser = this;
+ if (typeof lexer2.yylloc == "undefined") {
+ lexer2.yylloc = {};
+ }
+ var yyloc = lexer2.yylloc;
+ lstack.push(yyloc);
+ var ranges = lexer2.options && lexer2.options.ranges;
+ if (typeof sharedState.yy.parseError === "function") {
+ this.parseError = sharedState.yy.parseError;
+ } else {
+ this.parseError = Object.getPrototypeOf(this).parseError;
+ }
+ function lex2() {
+ var token;
+ token = tstack.pop() || lexer2.lex() || EOF;
+ if (typeof token !== "number") {
+ if (token instanceof Array) {
+ tstack = token;
+ token = tstack.pop();
+ }
+ token = self.symbols_[token] || token;
+ }
+ return token;
+ }
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+ while (true) {
+ state = stack[stack.length - 1];
+ if (this.defaultActions[state]) {
+ action = this.defaultActions[state];
+ } else {
+ if (symbol === null || typeof symbol == "undefined") {
+ symbol = lex2();
+ }
+ action = table[state] && table[state][symbol];
+ }
+ if (typeof action === "undefined" || !action.length || !action[0]) {
+ var errStr = "";
+ expected = [];
+ for (p in table[state]) {
+ if (this.terminals_[p] && p > TERROR) {
+ expected.push("'" + this.terminals_[p] + "'");
+ }
+ }
+ if (lexer2.showPosition) {
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
+ } else {
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
+ }
+ this.parseError(errStr, {
+ text: lexer2.match,
+ token: this.terminals_[symbol] || symbol,
+ line: lexer2.yylineno,
+ loc: yyloc,
+ expected
+ });
+ }
+ if (action[0] instanceof Array && action.length > 1) {
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
+ }
+ switch (action[0]) {
+ case 1:
+ stack.push(symbol);
+ vstack.push(lexer2.yytext);
+ lstack.push(lexer2.yylloc);
+ stack.push(action[1]);
+ symbol = null;
+ {
+ yyleng = lexer2.yyleng;
+ yytext = lexer2.yytext;
+ yylineno = lexer2.yylineno;
+ yyloc = lexer2.yylloc;
+ }
+ break;
+ case 2:
+ len = this.productions_[action[1]][1];
+ yyval.$ = vstack[vstack.length - len];
+ yyval._$ = {
+ first_line: lstack[lstack.length - (len || 1)].first_line,
+ last_line: lstack[lstack.length - 1].last_line,
+ first_column: lstack[lstack.length - (len || 1)].first_column,
+ last_column: lstack[lstack.length - 1].last_column
+ };
+ if (ranges) {
+ yyval._$.range = [
+ lstack[lstack.length - (len || 1)].range[0],
+ lstack[lstack.length - 1].range[1]
+ ];
+ }
+ r = this.performAction.apply(yyval, [
+ yytext,
+ yyleng,
+ yylineno,
+ sharedState.yy,
+ action[1],
+ vstack,
+ lstack
+ ].concat(args));
+ if (typeof r !== "undefined") {
+ return r;
+ }
+ if (len) {
+ stack = stack.slice(0, -1 * len * 2);
+ vstack = vstack.slice(0, -1 * len);
+ lstack = lstack.slice(0, -1 * len);
+ }
+ stack.push(this.productions_[action[1]][0]);
+ vstack.push(yyval.$);
+ lstack.push(yyval._$);
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
+ stack.push(newState);
+ break;
+ case 3:
+ return true;
+ }
+ }
+ return true;
+ }
+ };
+ var lexer = function() {
+ var lexer2 = {
+ EOF: 1,
+ parseError: function parseError(str, hash) {
+ if (this.yy.parser) {
+ this.yy.parser.parseError(str, hash);
+ } else {
+ throw new Error(str);
+ }
+ },
+ // resets the lexer, sets new input
+ setInput: function(input, yy) {
+ this.yy = yy || this.yy || {};
+ this._input = input;
+ this._more = this._backtrack = this.done = false;
+ this.yylineno = this.yyleng = 0;
+ this.yytext = this.matched = this.match = "";
+ this.conditionStack = ["INITIAL"];
+ this.yylloc = {
+ first_line: 1,
+ first_column: 0,
+ last_line: 1,
+ last_column: 0
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [0, 0];
+ }
+ this.offset = 0;
+ return this;
+ },
+ // consumes and returns one char from the input
+ input: function() {
+ var ch = this._input[0];
+ this.yytext += ch;
+ this.yyleng++;
+ this.offset++;
+ this.match += ch;
+ this.matched += ch;
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno++;
+ this.yylloc.last_line++;
+ } else {
+ this.yylloc.last_column++;
+ }
+ if (this.options.ranges) {
+ this.yylloc.range[1]++;
+ }
+ this._input = this._input.slice(1);
+ return ch;
+ },
+ // unshifts one char (or a string) into the input
+ unput: function(ch) {
+ var len = ch.length;
+ var lines = ch.split(/(?:\r\n?|\n)/g);
+ this._input = ch + this._input;
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
+ this.offset -= len;
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
+ this.match = this.match.substr(0, this.match.length - 1);
+ this.matched = this.matched.substr(0, this.matched.length - 1);
+ if (lines.length - 1) {
+ this.yylineno -= lines.length - 1;
+ }
+ var r = this.yylloc.range;
+ this.yylloc = {
+ first_line: this.yylloc.first_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.first_column,
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
+ }
+ this.yyleng = this.yytext.length;
+ return this;
+ },
+ // When called from action, caches matched text and appends it on next action
+ more: function() {
+ this._more = true;
+ return this;
+ },
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
+ reject: function() {
+ if (this.options.backtrack_lexer) {
+ this._backtrack = true;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ return this;
+ },
+ // retain first n characters of the match
+ less: function(n) {
+ this.unput(this.match.slice(n));
+ },
+ // displays already matched input, i.e. for error messages
+ pastInput: function() {
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
+ },
+ // displays upcoming input, i.e. for error messages
+ upcomingInput: function() {
+ var next = this.match;
+ if (next.length < 20) {
+ next += this._input.substr(0, 20 - next.length);
+ }
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
+ },
+ // displays the character position where the lexing error occurred, i.e. for error messages
+ showPosition: function() {
+ var pre = this.pastInput();
+ var c = new Array(pre.length + 1).join("-");
+ return pre + this.upcomingInput() + "\n" + c + "^";
+ },
+ // test the lexed token: return FALSE when not a match, otherwise return token
+ test_match: function(match, indexed_rule) {
+ var token, lines, backup;
+ if (this.options.backtrack_lexer) {
+ backup = {
+ yylineno: this.yylineno,
+ yylloc: {
+ first_line: this.yylloc.first_line,
+ last_line: this.last_line,
+ first_column: this.yylloc.first_column,
+ last_column: this.yylloc.last_column
+ },
+ yytext: this.yytext,
+ match: this.match,
+ matches: this.matches,
+ matched: this.matched,
+ yyleng: this.yyleng,
+ offset: this.offset,
+ _more: this._more,
+ _input: this._input,
+ yy: this.yy,
+ conditionStack: this.conditionStack.slice(0),
+ done: this.done
+ };
+ if (this.options.ranges) {
+ backup.yylloc.range = this.yylloc.range.slice(0);
+ }
+ }
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno += lines.length;
+ }
+ this.yylloc = {
+ first_line: this.yylloc.last_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.last_column,
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
+ };
+ this.yytext += match[0];
+ this.match += match[0];
+ this.matches = match;
+ this.yyleng = this.yytext.length;
+ if (this.options.ranges) {
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
+ }
+ this._more = false;
+ this._backtrack = false;
+ this._input = this._input.slice(match[0].length);
+ this.matched += match[0];
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
+ if (this.done && this._input) {
+ this.done = false;
+ }
+ if (token) {
+ return token;
+ } else if (this._backtrack) {
+ for (var k in backup) {
+ this[k] = backup[k];
+ }
+ return false;
+ }
+ return false;
+ },
+ // return next match in input
+ next: function() {
+ if (this.done) {
+ return this.EOF;
+ }
+ if (!this._input) {
+ this.done = true;
+ }
+ var token, match, tempMatch, index;
+ if (!this._more) {
+ this.yytext = "";
+ this.match = "";
+ }
+ var rules = this._currentRules();
+ for (var i = 0; i < rules.length; i++) {
+ tempMatch = this._input.match(this.rules[rules[i]]);
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
+ match = tempMatch;
+ index = i;
+ if (this.options.backtrack_lexer) {
+ token = this.test_match(tempMatch, rules[i]);
+ if (token !== false) {
+ return token;
+ } else if (this._backtrack) {
+ match = false;
+ continue;
+ } else {
+ return false;
+ }
+ } else if (!this.options.flex) {
+ break;
+ }
+ }
+ }
+ if (match) {
+ token = this.test_match(match, rules[index]);
+ if (token !== false) {
+ return token;
+ }
+ return false;
+ }
+ if (this._input === "") {
+ return this.EOF;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ },
+ // return next match that has a token
+ lex: function lex2() {
+ var r = this.next();
+ if (r) {
+ return r;
+ } else {
+ return this.lex();
+ }
+ },
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
+ begin: function begin(condition) {
+ this.conditionStack.push(condition);
+ },
+ // pop the previously active lexer condition state off the condition stack
+ popState: function popState() {
+ var n = this.conditionStack.length - 1;
+ if (n > 0) {
+ return this.conditionStack.pop();
+ } else {
+ return this.conditionStack[0];
+ }
+ },
+ // produce the lexer rule set which is active for the currently active lexer condition state
+ _currentRules: function _currentRules() {
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
+ } else {
+ return this.conditions["INITIAL"].rules;
+ }
+ },
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
+ topState: function topState(n) {
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
+ if (n >= 0) {
+ return this.conditionStack[n];
+ } else {
+ return "INITIAL";
+ }
+ },
+ // alias for begin(condition)
+ pushState: function pushState(condition) {
+ this.begin(condition);
+ },
+ // return the number of states currently on the stack
+ stateStackSize: function stateStackSize() {
+ return this.conditionStack.length;
+ },
+ options: {},
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+ switch ($avoiding_name_collisions) {
+ case 0:
+ this.begin("acc_title");
+ return 34;
+ case 1:
+ this.popState();
+ return "acc_title_value";
+ case 2:
+ this.begin("acc_descr");
+ return 36;
+ case 3:
+ this.popState();
+ return "acc_descr_value";
+ case 4:
+ this.begin("acc_descr_multiline");
+ break;
+ case 5:
+ this.popState();
+ break;
+ case 6:
+ return "acc_descr_multiline_value";
+ case 7:
+ this.begin("callbackname");
+ break;
+ case 8:
+ this.popState();
+ break;
+ case 9:
+ this.popState();
+ this.begin("callbackargs");
+ break;
+ case 10:
+ return 92;
+ case 11:
+ this.popState();
+ break;
+ case 12:
+ return 93;
+ case 13:
+ return "MD_STR";
+ case 14:
+ this.popState();
+ break;
+ case 15:
+ this.begin("md_string");
+ break;
+ case 16:
+ return "STR";
+ case 17:
+ this.popState();
+ break;
+ case 18:
+ this.pushState("string");
+ break;
+ case 19:
+ return 81;
+ case 20:
+ return 99;
+ case 21:
+ return 82;
+ case 22:
+ return 101;
+ case 23:
+ return 83;
+ case 24:
+ return 84;
+ case 25:
+ return 94;
+ case 26:
+ this.begin("click");
+ break;
+ case 27:
+ this.popState();
+ break;
+ case 28:
+ return 85;
+ case 29:
+ if (yy.lex.firstGraph()) {
+ this.begin("dir");
+ }
+ return 12;
+ case 30:
+ if (yy.lex.firstGraph()) {
+ this.begin("dir");
+ }
+ return 12;
+ case 31:
+ if (yy.lex.firstGraph()) {
+ this.begin("dir");
+ }
+ return 12;
+ case 32:
+ return 27;
+ case 33:
+ return 32;
+ case 34:
+ return 95;
+ case 35:
+ return 95;
+ case 36:
+ return 95;
+ case 37:
+ return 95;
+ case 38:
+ this.popState();
+ return 13;
+ case 39:
+ this.popState();
+ return 14;
+ case 40:
+ this.popState();
+ return 14;
+ case 41:
+ this.popState();
+ return 14;
+ case 42:
+ this.popState();
+ return 14;
+ case 43:
+ this.popState();
+ return 14;
+ case 44:
+ this.popState();
+ return 14;
+ case 45:
+ this.popState();
+ return 14;
+ case 46:
+ this.popState();
+ return 14;
+ case 47:
+ this.popState();
+ return 14;
+ case 48:
+ this.popState();
+ return 14;
+ case 49:
+ return 118;
+ case 50:
+ return 119;
+ case 51:
+ return 120;
+ case 52:
+ return 121;
+ case 53:
+ return 102;
+ case 54:
+ return 108;
+ case 55:
+ return 44;
+ case 56:
+ return 58;
+ case 57:
+ return 42;
+ case 58:
+ return 8;
+ case 59:
+ return 103;
+ case 60:
+ return 112;
+ case 61:
+ this.popState();
+ return 75;
+ case 62:
+ this.pushState("edgeText");
+ return 73;
+ case 63:
+ return 116;
+ case 64:
+ this.popState();
+ return 75;
+ case 65:
+ this.pushState("thickEdgeText");
+ return 73;
+ case 66:
+ return 116;
+ case 67:
+ this.popState();
+ return 75;
+ case 68:
+ this.pushState("dottedEdgeText");
+ return 73;
+ case 69:
+ return 116;
+ case 70:
+ return 75;
+ case 71:
+ this.popState();
+ return 51;
+ case 72:
+ return "TEXT";
+ case 73:
+ this.pushState("ellipseText");
+ return 50;
+ case 74:
+ this.popState();
+ return 53;
+ case 75:
+ this.pushState("text");
+ return 52;
+ case 76:
+ this.popState();
+ return 55;
+ case 77:
+ this.pushState("text");
+ return 54;
+ case 78:
+ return 56;
+ case 79:
+ this.pushState("text");
+ return 65;
+ case 80:
+ this.popState();
+ return 62;
+ case 81:
+ this.pushState("text");
+ return 61;
+ case 82:
+ this.popState();
+ return 47;
+ case 83:
+ this.pushState("text");
+ return 46;
+ case 84:
+ this.popState();
+ return 67;
+ case 85:
+ this.popState();
+ return 69;
+ case 86:
+ return 114;
+ case 87:
+ this.pushState("trapText");
+ return 66;
+ case 88:
+ this.pushState("trapText");
+ return 68;
+ case 89:
+ return 115;
+ case 90:
+ return 65;
+ case 91:
+ return 87;
+ case 92:
+ return "SEP";
+ case 93:
+ return 86;
+ case 94:
+ return 112;
+ case 95:
+ return 108;
+ case 96:
+ return 42;
+ case 97:
+ return 106;
+ case 98:
+ return 111;
+ case 99:
+ return 113;
+ case 100:
+ this.popState();
+ return 60;
+ case 101:
+ this.pushState("text");
+ return 60;
+ case 102:
+ this.popState();
+ return 49;
+ case 103:
+ this.pushState("text");
+ return 48;
+ case 104:
+ this.popState();
+ return 31;
+ case 105:
+ this.pushState("text");
+ return 29;
+ case 106:
+ this.popState();
+ return 64;
+ case 107:
+ this.pushState("text");
+ return 63;
+ case 108:
+ return "TEXT";
+ case 109:
+ return "QUOTE";
+ case 110:
+ return 9;
+ case 111:
+ return 10;
+ case 112:
+ return 11;
+ }
+ },
+ rules: [/^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["][`])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:["])/, /^(?:style\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\b)/, /^(?:class\b)/, /^(?:href[\s])/, /^(?:click[\s]+)/, /^(?:[\s\n])/, /^(?:[^\s\n]*)/, /^(?:flowchart-elk\b)/, /^(?:graph\b)/, /^(?:flowchart\b)/, /^(?:subgraph\b)/, /^(?:end\b\s*)/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:(\r?\n)*\s*\n)/, /^(?:\s*LR\b)/, /^(?:\s*RL\b)/, /^(?:\s*TB\b)/, /^(?:\s*BT\b)/, /^(?:\s*TD\b)/, /^(?:\s*BR\b)/, /^(?:\s*<)/, /^(?:\s*>)/, /^(?:\s*\^)/, /^(?:\s*v\b)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:[0-9]+)/, /^(?:#)/, /^(?::::)/, /^(?::)/, /^(?:&)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:[^-]|-(?!-)+)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:[^=]|=(?!))/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:[^\.]|\.(?!))/, /^(?:\s*~~[\~]+\s*)/, /^(?:[-/\)][\)])/, /^(?:[^\(\)\[\]\{\}]|!\)+)/, /^(?:\(-)/, /^(?:\]\))/, /^(?:\(\[)/, /^(?:\]\])/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:>)/, /^(?:\)\])/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\(\(\()/, /^(?:[\\(?=\])][\]])/, /^(?:\/(?=\])\])/, /^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:<)/, /^(?:>)/, /^(?:\^)/, /^(?:\\\|)/, /^(?:v\b)/, /^(?:\*)/, /^(?:#)/, /^(?:&)/, /^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/, /^(?:-)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\|)/, /^(?:\|)/, /^(?:\))/, /^(?:\()/, /^(?:\])/, /^(?:\[)/, /^(?:(\}))/, /^(?:\{)/, /^(?:[^\[\]\(\)\{\}\|\"]+)/, /^(?:")/, /^(?:(\r?\n)+)/, /^(?:\s)/, /^(?:$)/],
+ conditions: { "callbackargs": { "rules": [11, 12, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "callbackname": { "rules": [8, 9, 10, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "href": { "rules": [15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "click": { "rules": [15, 18, 27, 28, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "dottedEdgeText": { "rules": [15, 18, 67, 69, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "thickEdgeText": { "rules": [15, 18, 64, 66, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "edgeText": { "rules": [15, 18, 61, 63, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "trapText": { "rules": [15, 18, 70, 73, 75, 77, 81, 83, 84, 85, 86, 87, 88, 101, 103, 105, 107], "inclusive": false }, "ellipseText": { "rules": [15, 18, 70, 71, 72, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "text": { "rules": [15, 18, 70, 73, 74, 75, 76, 77, 80, 81, 82, 83, 87, 88, 100, 101, 102, 103, 104, 105, 106, 107, 108], "inclusive": false }, "vertex": { "rules": [15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "dir": { "rules": [15, 18, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "acc_descr_multiline": { "rules": [5, 6, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "acc_descr": { "rules": [3, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "acc_title": { "rules": [1, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "md_string": { "rules": [13, 14, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "string": { "rules": [15, 16, 17, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 67, 68, 70, 73, 75, 77, 78, 79, 81, 83, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 103, 105, 107, 109, 110, 111, 112], "inclusive": true } }
+ };
+ return lexer2;
+ }();
+ parser2.lexer = lexer;
+ function Parser() {
+ this.yy = {};
+ }
+ Parser.prototype = parser2;
+ parser2.Parser = Parser;
+ return new Parser();
+}();
+parser.parser = parser;
+const parser$1 = parser;
+const MERMAID_DOM_ID_PREFIX = "flowchart-";
+let vertexCounter = 0;
+let config = getConfig();
+let vertices = {};
+let edges = [];
+let classes = {};
+let subGraphs = [];
+let subGraphLookup = {};
+let tooltips = {};
+let subCount = 0;
+let firstGraphFlag = true;
+let direction;
+let version;
+let funs = [];
+const sanitizeText = (txt) => common$1.sanitizeText(txt, config);
+const lookUpDomId = function(id) {
+ const vertexKeys = Object.keys(vertices);
+ for (const vertexKey of vertexKeys) {
+ if (vertices[vertexKey].id === id) {
+ return vertices[vertexKey].domId;
+ }
+ }
+ return id;
+};
+const addVertex = function(_id, textObj, type, style, classes2, dir, props = {}) {
+ let txt;
+ let id = _id;
+ if (id === void 0) {
+ return;
+ }
+ if (id.trim().length === 0) {
+ return;
+ }
+ if (vertices[id] === void 0) {
+ vertices[id] = {
+ id,
+ labelType: "text",
+ domId: MERMAID_DOM_ID_PREFIX + id + "-" + vertexCounter,
+ styles: [],
+ classes: []
+ };
+ }
+ vertexCounter++;
+ if (textObj !== void 0) {
+ config = getConfig();
+ txt = sanitizeText(textObj.text.trim());
+ vertices[id].labelType = textObj.type;
+ if (txt[0] === '"' && txt[txt.length - 1] === '"') {
+ txt = txt.substring(1, txt.length - 1);
+ }
+ vertices[id].text = txt;
+ } else {
+ if (vertices[id].text === void 0) {
+ vertices[id].text = _id;
+ }
+ }
+ if (type !== void 0) {
+ vertices[id].type = type;
+ }
+ if (style !== void 0 && style !== null) {
+ style.forEach(function(s) {
+ vertices[id].styles.push(s);
+ });
+ }
+ if (classes2 !== void 0 && classes2 !== null) {
+ classes2.forEach(function(s) {
+ vertices[id].classes.push(s);
+ });
+ }
+ if (dir !== void 0) {
+ vertices[id].dir = dir;
+ }
+ if (vertices[id].props === void 0) {
+ vertices[id].props = props;
+ } else if (props !== void 0) {
+ Object.assign(vertices[id].props, props);
+ }
+};
+const addSingleLink = function(_start, _end, type) {
+ let start = _start;
+ let end = _end;
+ const edge = { start, end, type: void 0, text: "", labelType: "text" };
+ log$1.info("abc78 Got edge...", edge);
+ const linkTextObj = type.text;
+ if (linkTextObj !== void 0) {
+ edge.text = sanitizeText(linkTextObj.text.trim());
+ if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
+ edge.text = edge.text.substring(1, edge.text.length - 1);
+ }
+ edge.labelType = linkTextObj.type;
+ }
+ if (type !== void 0) {
+ edge.type = type.type;
+ edge.stroke = type.stroke;
+ edge.length = type.length;
+ }
+ if ((edge == null ? void 0 : edge.length) > 10) {
+ edge.length = 10;
+ }
+ if (edges.length < (config.maxEdges ?? 500)) {
+ log$1.info("abc78 pushing edge...");
+ edges.push(edge);
+ } else {
+ throw new Error(
+ `Edge limit exceeded. ${edges.length} edges found, but the limit is ${config.maxEdges}.
+
+Initialize mermaid with maxEdges set to a higher number to allow more edges.
+You cannot set this config via configuration inside the diagram as it is a secure config.
+You have to call mermaid.initialize.`
+ );
+ }
+};
+const addLink = function(_start, _end, type) {
+ log$1.info("addLink (abc78)", _start, _end, type);
+ let i, j;
+ for (i = 0; i < _start.length; i++) {
+ for (j = 0; j < _end.length; j++) {
+ addSingleLink(_start[i], _end[j], type);
+ }
+ }
+};
+const updateLinkInterpolate = function(positions, interp) {
+ positions.forEach(function(pos) {
+ if (pos === "default") {
+ edges.defaultInterpolate = interp;
+ } else {
+ edges[pos].interpolate = interp;
+ }
+ });
+};
+const updateLink = function(positions, style) {
+ positions.forEach(function(pos) {
+ if (pos >= edges.length) {
+ throw new Error(
+ `The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)`
+ );
+ }
+ if (pos === "default") {
+ edges.defaultStyle = style;
+ } else {
+ if (utils.isSubstringInArray("fill", style) === -1) {
+ style.push("fill:none");
+ }
+ edges[pos].style = style;
+ }
+ });
+};
+const addClass = function(ids, style) {
+ ids.split(",").forEach(function(id) {
+ if (classes[id] === void 0) {
+ classes[id] = { id, styles: [], textStyles: [] };
+ }
+ if (style !== void 0 && style !== null) {
+ style.forEach(function(s) {
+ if (s.match("color")) {
+ const newStyle = s.replace("fill", "bgFill").replace("color", "fill");
+ classes[id].textStyles.push(newStyle);
+ }
+ classes[id].styles.push(s);
+ });
+ }
+ });
+};
+const setDirection = function(dir) {
+ direction = dir;
+ if (direction.match(/.*)) {
+ direction = "RL";
+ }
+ if (direction.match(/.*\^/)) {
+ direction = "BT";
+ }
+ if (direction.match(/.*>/)) {
+ direction = "LR";
+ }
+ if (direction.match(/.*v/)) {
+ direction = "TB";
+ }
+ if (direction === "TD") {
+ direction = "TB";
+ }
+};
+const setClass = function(ids, className) {
+ ids.split(",").forEach(function(_id) {
+ let id = _id;
+ if (vertices[id] !== void 0) {
+ vertices[id].classes.push(className);
+ }
+ if (subGraphLookup[id] !== void 0) {
+ subGraphLookup[id].classes.push(className);
+ }
+ });
+};
+const setTooltip = function(ids, tooltip) {
+ ids.split(",").forEach(function(id) {
+ if (tooltip !== void 0) {
+ tooltips[version === "gen-1" ? lookUpDomId(id) : id] = sanitizeText(tooltip);
+ }
+ });
+};
+const setClickFun = function(id, functionName, functionArgs) {
+ let domId = lookUpDomId(id);
+ if (getConfig().securityLevel !== "loose") {
+ return;
+ }
+ if (functionName === void 0) {
+ return;
+ }
+ let argList = [];
+ if (typeof functionArgs === "string") {
+ argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
+ for (let i = 0; i < argList.length; i++) {
+ let item = argList[i].trim();
+ if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
+ item = item.substr(1, item.length - 2);
+ }
+ argList[i] = item;
+ }
+ }
+ if (argList.length === 0) {
+ argList.push(id);
+ }
+ if (vertices[id] !== void 0) {
+ vertices[id].haveCallback = true;
+ funs.push(function() {
+ const elem = document.querySelector(`[id="${domId}"]`);
+ if (elem !== null) {
+ elem.addEventListener(
+ "click",
+ function() {
+ utils.runFunc(functionName, ...argList);
+ },
+ false
+ );
+ }
+ });
+ }
+};
+const setLink = function(ids, linkStr, target) {
+ ids.split(",").forEach(function(id) {
+ if (vertices[id] !== void 0) {
+ vertices[id].link = utils.formatUrl(linkStr, config);
+ vertices[id].linkTarget = target;
+ }
+ });
+ setClass(ids, "clickable");
+};
+const getTooltip = function(id) {
+ if (tooltips.hasOwnProperty(id)) {
+ return tooltips[id];
+ }
+ return void 0;
+};
+const setClickEvent = function(ids, functionName, functionArgs) {
+ ids.split(",").forEach(function(id) {
+ setClickFun(id, functionName, functionArgs);
+ });
+ setClass(ids, "clickable");
+};
+const bindFunctions = function(element) {
+ funs.forEach(function(fun) {
+ fun(element);
+ });
+};
+const getDirection = function() {
+ return direction.trim();
+};
+const getVertices = function() {
+ return vertices;
+};
+const getEdges = function() {
+ return edges;
+};
+const getClasses = function() {
+ return classes;
+};
+const setupToolTips = function(element) {
+ let tooltipElem = select(".mermaidTooltip");
+ if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
+ tooltipElem = select("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0);
+ }
+ const svg = select(element).select("svg");
+ const nodes = svg.selectAll("g.node");
+ nodes.on("mouseover", function() {
+ const el = select(this);
+ const title = el.attr("title");
+ if (title === null) {
+ return;
+ }
+ const rect = this.getBoundingClientRect();
+ tooltipElem.transition().duration(200).style("opacity", ".9");
+ tooltipElem.text(el.attr("title")).style("left", window.scrollX + rect.left + (rect.right - rect.left) / 2 + "px").style("top", window.scrollY + rect.bottom + "px");
+ tooltipElem.html(tooltipElem.html().replace(/<br\/>/g, "
"));
+ el.classed("hover", true);
+ }).on("mouseout", function() {
+ tooltipElem.transition().duration(500).style("opacity", 0);
+ const el = select(this);
+ el.classed("hover", false);
+ });
+};
+funs.push(setupToolTips);
+const clear = function(ver = "gen-1") {
+ vertices = {};
+ classes = {};
+ edges = [];
+ funs = [setupToolTips];
+ subGraphs = [];
+ subGraphLookup = {};
+ subCount = 0;
+ tooltips = {};
+ firstGraphFlag = true;
+ version = ver;
+ config = getConfig();
+ clear$1();
+};
+const setGen = (ver) => {
+ version = ver || "gen-2";
+};
+const defaultStyle = function() {
+ return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;";
+};
+const addSubGraph = function(_id, list, _title) {
+ let id = _id.text.trim();
+ let title = _title.text;
+ if (_id === _title && _title.text.match(/\s/)) {
+ id = void 0;
+ }
+ function uniq(a) {
+ const prims = { boolean: {}, number: {}, string: {} };
+ const objs = [];
+ let dir2;
+ const nodeList2 = a.filter(function(item) {
+ const type = typeof item;
+ if (item.stmt && item.stmt === "dir") {
+ dir2 = item.value;
+ return false;
+ }
+ if (item.trim() === "") {
+ return false;
+ }
+ if (type in prims) {
+ return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true;
+ } else {
+ return objs.includes(item) ? false : objs.push(item);
+ }
+ });
+ return { nodeList: nodeList2, dir: dir2 };
+ }
+ let nodeList = [];
+ const { nodeList: nl, dir } = uniq(nodeList.concat.apply(nodeList, list));
+ nodeList = nl;
+ if (version === "gen-1") {
+ for (let i = 0; i < nodeList.length; i++) {
+ nodeList[i] = lookUpDomId(nodeList[i]);
+ }
+ }
+ id = id || "subGraph" + subCount;
+ title = title || "";
+ title = sanitizeText(title);
+ subCount = subCount + 1;
+ const subGraph = {
+ id,
+ nodes: nodeList,
+ title: title.trim(),
+ classes: [],
+ dir,
+ labelType: _title.type
+ };
+ log$1.info("Adding", subGraph.id, subGraph.nodes, subGraph.dir);
+ subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
+ subGraphs.push(subGraph);
+ subGraphLookup[id] = subGraph;
+ return id;
+};
+const getPosForId = function(id) {
+ for (const [i, subGraph] of subGraphs.entries()) {
+ if (subGraph.id === id) {
+ return i;
+ }
+ }
+ return -1;
+};
+let secCount = -1;
+const posCrossRef = [];
+const indexNodes2 = function(id, pos) {
+ const nodes = subGraphs[pos].nodes;
+ secCount = secCount + 1;
+ if (secCount > 2e3) {
+ return;
+ }
+ posCrossRef[secCount] = pos;
+ if (subGraphs[pos].id === id) {
+ return {
+ result: true,
+ count: 0
+ };
+ }
+ let count = 0;
+ let posCount = 1;
+ while (count < nodes.length) {
+ const childPos = getPosForId(nodes[count]);
+ if (childPos >= 0) {
+ const res = indexNodes2(id, childPos);
+ if (res.result) {
+ return {
+ result: true,
+ count: posCount + res.count
+ };
+ } else {
+ posCount = posCount + res.count;
+ }
+ }
+ count = count + 1;
+ }
+ return {
+ result: false,
+ count: posCount
+ };
+};
+const getDepthFirstPos = function(pos) {
+ return posCrossRef[pos];
+};
+const indexNodes = function() {
+ secCount = -1;
+ if (subGraphs.length > 0) {
+ indexNodes2("none", subGraphs.length - 1);
+ }
+};
+const getSubGraphs = function() {
+ return subGraphs;
+};
+const firstGraph = () => {
+ if (firstGraphFlag) {
+ firstGraphFlag = false;
+ return true;
+ }
+ return false;
+};
+const destructStartLink = (_str) => {
+ let str = _str.trim();
+ let type = "arrow_open";
+ switch (str[0]) {
+ case "<":
+ type = "arrow_point";
+ str = str.slice(1);
+ break;
+ case "x":
+ type = "arrow_cross";
+ str = str.slice(1);
+ break;
+ case "o":
+ type = "arrow_circle";
+ str = str.slice(1);
+ break;
+ }
+ let stroke = "normal";
+ if (str.includes("=")) {
+ stroke = "thick";
+ }
+ if (str.includes(".")) {
+ stroke = "dotted";
+ }
+ return { type, stroke };
+};
+const countChar = (char, str) => {
+ const length = str.length;
+ let count = 0;
+ for (let i = 0; i < length; ++i) {
+ if (str[i] === char) {
+ ++count;
+ }
+ }
+ return count;
+};
+const destructEndLink = (_str) => {
+ const str = _str.trim();
+ let line = str.slice(0, -1);
+ let type = "arrow_open";
+ switch (str.slice(-1)) {
+ case "x":
+ type = "arrow_cross";
+ if (str[0] === "x") {
+ type = "double_" + type;
+ line = line.slice(1);
+ }
+ break;
+ case ">":
+ type = "arrow_point";
+ if (str[0] === "<") {
+ type = "double_" + type;
+ line = line.slice(1);
+ }
+ break;
+ case "o":
+ type = "arrow_circle";
+ if (str[0] === "o") {
+ type = "double_" + type;
+ line = line.slice(1);
+ }
+ break;
+ }
+ let stroke = "normal";
+ let length = line.length - 1;
+ if (line[0] === "=") {
+ stroke = "thick";
+ }
+ if (line[0] === "~") {
+ stroke = "invisible";
+ }
+ let dots = countChar(".", line);
+ if (dots) {
+ stroke = "dotted";
+ length = dots;
+ }
+ return { type, stroke, length };
+};
+const destructLink = (_str, _startStr) => {
+ const info = destructEndLink(_str);
+ let startInfo;
+ if (_startStr) {
+ startInfo = destructStartLink(_startStr);
+ if (startInfo.stroke !== info.stroke) {
+ return { type: "INVALID", stroke: "INVALID" };
+ }
+ if (startInfo.type === "arrow_open") {
+ startInfo.type = info.type;
+ } else {
+ if (startInfo.type !== info.type) {
+ return { type: "INVALID", stroke: "INVALID" };
+ }
+ startInfo.type = "double_" + startInfo.type;
+ }
+ if (startInfo.type === "double_arrow") {
+ startInfo.type = "double_arrow_point";
+ }
+ startInfo.length = info.length;
+ return startInfo;
+ }
+ return info;
+};
+const exists = (allSgs, _id) => {
+ let res = false;
+ allSgs.forEach((sg) => {
+ const pos = sg.nodes.indexOf(_id);
+ if (pos >= 0) {
+ res = true;
+ }
+ });
+ return res;
+};
+const makeUniq = (sg, allSubgraphs) => {
+ const res = [];
+ sg.nodes.forEach((_id, pos) => {
+ if (!exists(allSubgraphs, _id)) {
+ res.push(sg.nodes[pos]);
+ }
+ });
+ return { nodes: res };
+};
+const lex = {
+ firstGraph
+};
+const flowDb = {
+ defaultConfig: () => defaultConfig.flowchart,
+ setAccTitle,
+ getAccTitle,
+ getAccDescription,
+ setAccDescription,
+ addVertex,
+ lookUpDomId,
+ addLink,
+ updateLinkInterpolate,
+ updateLink,
+ addClass,
+ setDirection,
+ setClass,
+ setTooltip,
+ getTooltip,
+ setClickEvent,
+ setLink,
+ bindFunctions,
+ getDirection,
+ getVertices,
+ getEdges,
+ getClasses,
+ clear,
+ setGen,
+ defaultStyle,
+ addSubGraph,
+ getDepthFirstPos,
+ indexNodes,
+ getSubGraphs,
+ destructLink,
+ lex,
+ exists,
+ makeUniq,
+ setDiagramTitle,
+ getDiagramTitle
+};
+const db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
+ __proto__: null,
+ addClass,
+ addLink,
+ addSingleLink,
+ addSubGraph,
+ addVertex,
+ bindFunctions,
+ clear,
+ default: flowDb,
+ defaultStyle,
+ destructLink,
+ firstGraph,
+ getClasses,
+ getDepthFirstPos,
+ getDirection,
+ getEdges,
+ getSubGraphs,
+ getTooltip,
+ getVertices,
+ indexNodes,
+ lex,
+ lookUpDomId,
+ setClass,
+ setClickEvent,
+ setDirection,
+ setGen,
+ setLink,
+ updateLink,
+ updateLinkInterpolate
+}, Symbol.toStringTag, { value: "Module" }));
+
+export { db as d, flowDb as f, parser$1 as p };
diff --git a/libs/marked/flowDb-c1833063-Df5kDQr4.js b/libs/marked/flowDb-c1833063-Df5kDQr4.js
new file mode 100644
index 0000000..45aded0
--- /dev/null
+++ b/libs/marked/flowDb-c1833063-Df5kDQr4.js
@@ -0,0 +1,1711 @@
+import { c as getConfig, aq as defaultConfig, s as setAccTitle, g as getAccTitle, a as getAccDescription, b as setAccDescription, C as setDiagramTitle, D as getDiagramTitle, l as log$1, A as utils, E as clear$1, j as common$1, h as select } from './index-Bd_FDXSq.js';
+
+var parser = function() {
+ var o = function(k, v, o2, l) {
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
+ ;
+ return o2;
+ }, $V0 = [1, 4], $V1 = [1, 3], $V2 = [1, 5], $V3 = [1, 8, 9, 10, 11, 27, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], $V4 = [2, 2], $V5 = [1, 13], $V6 = [1, 14], $V7 = [1, 15], $V8 = [1, 16], $V9 = [1, 23], $Va = [1, 25], $Vb = [1, 26], $Vc = [1, 27], $Vd = [1, 49], $Ve = [1, 48], $Vf = [1, 29], $Vg = [1, 30], $Vh = [1, 31], $Vi = [1, 32], $Vj = [1, 33], $Vk = [1, 44], $Vl = [1, 46], $Vm = [1, 42], $Vn = [1, 47], $Vo = [1, 43], $Vp = [1, 50], $Vq = [1, 45], $Vr = [1, 51], $Vs = [1, 52], $Vt = [1, 34], $Vu = [1, 35], $Vv = [1, 36], $Vw = [1, 37], $Vx = [1, 57], $Vy = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], $Vz = [1, 61], $VA = [1, 60], $VB = [1, 62], $VC = [8, 9, 11, 73, 75], $VD = [1, 88], $VE = [1, 93], $VF = [1, 92], $VG = [1, 89], $VH = [1, 85], $VI = [1, 91], $VJ = [1, 87], $VK = [1, 94], $VL = [1, 90], $VM = [1, 95], $VN = [1, 86], $VO = [8, 9, 10, 11, 73, 75], $VP = [8, 9, 10, 11, 44, 73, 75], $VQ = [8, 9, 10, 11, 29, 42, 44, 46, 48, 50, 52, 54, 56, 58, 61, 63, 65, 66, 68, 73, 75, 86, 99, 102, 103, 106, 108, 111, 112, 113], $VR = [8, 9, 11, 42, 58, 73, 75, 86, 99, 102, 103, 106, 108, 111, 112, 113], $VS = [42, 58, 86, 99, 102, 103, 106, 108, 111, 112, 113], $VT = [1, 121], $VU = [1, 120], $VV = [1, 128], $VW = [1, 142], $VX = [1, 143], $VY = [1, 144], $VZ = [1, 145], $V_ = [1, 130], $V$ = [1, 132], $V01 = [1, 136], $V11 = [1, 137], $V21 = [1, 138], $V31 = [1, 139], $V41 = [1, 140], $V51 = [1, 141], $V61 = [1, 146], $V71 = [1, 147], $V81 = [1, 126], $V91 = [1, 127], $Va1 = [1, 134], $Vb1 = [1, 129], $Vc1 = [1, 133], $Vd1 = [1, 131], $Ve1 = [8, 9, 10, 11, 27, 32, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], $Vf1 = [1, 149], $Vg1 = [8, 9, 11], $Vh1 = [8, 9, 10, 11, 14, 42, 58, 86, 102, 103, 106, 108, 111, 112, 113], $Vi1 = [1, 169], $Vj1 = [1, 165], $Vk1 = [1, 166], $Vl1 = [1, 170], $Vm1 = [1, 167], $Vn1 = [1, 168], $Vo1 = [75, 113, 116], $Vp1 = [8, 9, 10, 11, 12, 14, 27, 29, 32, 42, 58, 73, 81, 82, 83, 84, 85, 86, 87, 102, 106, 108, 111, 112, 113], $Vq1 = [10, 103], $Vr1 = [31, 47, 49, 51, 53, 55, 60, 62, 64, 65, 67, 69, 113, 114, 115], $Vs1 = [1, 235], $Vt1 = [1, 233], $Vu1 = [1, 237], $Vv1 = [1, 231], $Vw1 = [1, 232], $Vx1 = [1, 234], $Vy1 = [1, 236], $Vz1 = [1, 238], $VA1 = [1, 255], $VB1 = [8, 9, 11, 103], $VC1 = [8, 9, 10, 11, 58, 81, 102, 103, 106, 107, 108, 109];
+ var parser2 = {
+ trace: function trace() {
+ },
+ yy: {},
+ symbols_: { "error": 2, "start": 3, "graphConfig": 4, "document": 5, "line": 6, "statement": 7, "SEMI": 8, "NEWLINE": 9, "SPACE": 10, "EOF": 11, "GRAPH": 12, "NODIR": 13, "DIR": 14, "FirstStmtSeparator": 15, "ending": 16, "endToken": 17, "spaceList": 18, "spaceListNewline": 19, "vertexStatement": 20, "separator": 21, "styleStatement": 22, "linkStyleStatement": 23, "classDefStatement": 24, "classStatement": 25, "clickStatement": 26, "subgraph": 27, "textNoTags": 28, "SQS": 29, "text": 30, "SQE": 31, "end": 32, "direction": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "link": 39, "node": 40, "styledVertex": 41, "AMP": 42, "vertex": 43, "STYLE_SEPARATOR": 44, "idString": 45, "DOUBLECIRCLESTART": 46, "DOUBLECIRCLEEND": 47, "PS": 48, "PE": 49, "(-": 50, "-)": 51, "STADIUMSTART": 52, "STADIUMEND": 53, "SUBROUTINESTART": 54, "SUBROUTINEEND": 55, "VERTEX_WITH_PROPS_START": 56, "NODE_STRING[field]": 57, "COLON": 58, "NODE_STRING[value]": 59, "PIPE": 60, "CYLINDERSTART": 61, "CYLINDEREND": 62, "DIAMOND_START": 63, "DIAMOND_STOP": 64, "TAGEND": 65, "TRAPSTART": 66, "TRAPEND": 67, "INVTRAPSTART": 68, "INVTRAPEND": 69, "linkStatement": 70, "arrowText": 71, "TESTSTR": 72, "START_LINK": 73, "edgeText": 74, "LINK": 75, "edgeTextToken": 76, "STR": 77, "MD_STR": 78, "textToken": 79, "keywords": 80, "STYLE": 81, "LINKSTYLE": 82, "CLASSDEF": 83, "CLASS": 84, "CLICK": 85, "DOWN": 86, "UP": 87, "textNoTagsToken": 88, "stylesOpt": 89, "idString[vertex]": 90, "idString[class]": 91, "CALLBACKNAME": 92, "CALLBACKARGS": 93, "HREF": 94, "LINK_TARGET": 95, "STR[link]": 96, "STR[tooltip]": 97, "alphaNum": 98, "DEFAULT": 99, "numList": 100, "INTERPOLATE": 101, "NUM": 102, "COMMA": 103, "style": 104, "styleComponent": 105, "NODE_STRING": 106, "UNIT": 107, "BRKT": 108, "PCT": 109, "idStringToken": 110, "MINUS": 111, "MULT": 112, "UNICODE_TEXT": 113, "TEXT": 114, "TAGSTART": 115, "EDGE_TEXT": 116, "alphaNumToken": 117, "direction_tb": 118, "direction_bt": 119, "direction_rl": 120, "direction_lr": 121, "$accept": 0, "$end": 1 },
+ terminals_: { 2: "error", 8: "SEMI", 9: "NEWLINE", 10: "SPACE", 11: "EOF", 12: "GRAPH", 13: "NODIR", 14: "DIR", 27: "subgraph", 29: "SQS", 31: "SQE", 32: "end", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 42: "AMP", 44: "STYLE_SEPARATOR", 46: "DOUBLECIRCLESTART", 47: "DOUBLECIRCLEEND", 48: "PS", 49: "PE", 50: "(-", 51: "-)", 52: "STADIUMSTART", 53: "STADIUMEND", 54: "SUBROUTINESTART", 55: "SUBROUTINEEND", 56: "VERTEX_WITH_PROPS_START", 57: "NODE_STRING[field]", 58: "COLON", 59: "NODE_STRING[value]", 60: "PIPE", 61: "CYLINDERSTART", 62: "CYLINDEREND", 63: "DIAMOND_START", 64: "DIAMOND_STOP", 65: "TAGEND", 66: "TRAPSTART", 67: "TRAPEND", 68: "INVTRAPSTART", 69: "INVTRAPEND", 72: "TESTSTR", 73: "START_LINK", 75: "LINK", 77: "STR", 78: "MD_STR", 81: "STYLE", 82: "LINKSTYLE", 83: "CLASSDEF", 84: "CLASS", 85: "CLICK", 86: "DOWN", 87: "UP", 90: "idString[vertex]", 91: "idString[class]", 92: "CALLBACKNAME", 93: "CALLBACKARGS", 94: "HREF", 95: "LINK_TARGET", 96: "STR[link]", 97: "STR[tooltip]", 99: "DEFAULT", 101: "INTERPOLATE", 102: "NUM", 103: "COMMA", 106: "NODE_STRING", 107: "UNIT", 108: "BRKT", 109: "PCT", 111: "MINUS", 112: "MULT", 113: "UNICODE_TEXT", 114: "TEXT", 115: "TAGSTART", 116: "EDGE_TEXT", 118: "direction_tb", 119: "direction_bt", 120: "direction_rl", 121: "direction_lr" },
+ productions_: [0, [3, 2], [5, 0], [5, 2], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [4, 2], [4, 2], [4, 2], [4, 3], [16, 2], [16, 1], [17, 1], [17, 1], [17, 1], [15, 1], [15, 1], [15, 2], [19, 2], [19, 2], [19, 1], [19, 1], [18, 2], [18, 1], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 9], [7, 6], [7, 4], [7, 1], [7, 2], [7, 2], [7, 1], [21, 1], [21, 1], [21, 1], [20, 3], [20, 4], [20, 2], [20, 1], [40, 1], [40, 5], [41, 1], [41, 3], [43, 4], [43, 4], [43, 6], [43, 4], [43, 4], [43, 4], [43, 8], [43, 4], [43, 4], [43, 4], [43, 6], [43, 4], [43, 4], [43, 4], [43, 4], [43, 4], [43, 1], [39, 2], [39, 3], [39, 3], [39, 1], [39, 3], [74, 1], [74, 2], [74, 1], [74, 1], [70, 1], [71, 3], [30, 1], [30, 2], [30, 1], [30, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [28, 1], [28, 2], [28, 1], [28, 1], [24, 5], [25, 5], [26, 2], [26, 4], [26, 3], [26, 5], [26, 3], [26, 5], [26, 5], [26, 7], [26, 2], [26, 4], [26, 2], [26, 4], [26, 4], [26, 6], [22, 5], [23, 5], [23, 5], [23, 9], [23, 9], [23, 7], [23, 7], [100, 1], [100, 3], [89, 1], [89, 3], [104, 1], [104, 2], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [79, 1], [79, 1], [79, 1], [79, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [76, 1], [76, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [45, 1], [45, 2], [98, 1], [98, 2], [33, 1], [33, 1], [33, 1], [33, 1]],
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
+ var $0 = $$.length - 1;
+ switch (yystate) {
+ case 2:
+ this.$ = [];
+ break;
+ case 3:
+ if (!Array.isArray($$[$0]) || $$[$0].length > 0) {
+ $$[$0 - 1].push($$[$0]);
+ }
+ this.$ = $$[$0 - 1];
+ break;
+ case 4:
+ case 176:
+ this.$ = $$[$0];
+ break;
+ case 11:
+ yy.setDirection("TB");
+ this.$ = "TB";
+ break;
+ case 12:
+ yy.setDirection($$[$0 - 1]);
+ this.$ = $$[$0 - 1];
+ break;
+ case 27:
+ this.$ = $$[$0 - 1].nodes;
+ break;
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ this.$ = [];
+ break;
+ case 33:
+ this.$ = yy.addSubGraph($$[$0 - 6], $$[$0 - 1], $$[$0 - 4]);
+ break;
+ case 34:
+ this.$ = yy.addSubGraph($$[$0 - 3], $$[$0 - 1], $$[$0 - 3]);
+ break;
+ case 35:
+ this.$ = yy.addSubGraph(void 0, $$[$0 - 1], void 0);
+ break;
+ case 37:
+ this.$ = $$[$0].trim();
+ yy.setAccTitle(this.$);
+ break;
+ case 38:
+ case 39:
+ this.$ = $$[$0].trim();
+ yy.setAccDescription(this.$);
+ break;
+ case 43:
+ yy.addLink($$[$0 - 2].stmt, $$[$0], $$[$0 - 1]);
+ this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0 - 2].nodes) };
+ break;
+ case 44:
+ yy.addLink($$[$0 - 3].stmt, $$[$0 - 1], $$[$0 - 2]);
+ this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1].concat($$[$0 - 3].nodes) };
+ break;
+ case 45:
+ this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1] };
+ break;
+ case 46:
+ this.$ = { stmt: $$[$0], nodes: $$[$0] };
+ break;
+ case 47:
+ this.$ = [$$[$0]];
+ break;
+ case 48:
+ this.$ = $$[$0 - 4].concat($$[$0]);
+ break;
+ case 49:
+ this.$ = $$[$0];
+ break;
+ case 50:
+ this.$ = $$[$0 - 2];
+ yy.setClass($$[$0 - 2], $$[$0]);
+ break;
+ case 51:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "square");
+ break;
+ case 52:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "doublecircle");
+ break;
+ case 53:
+ this.$ = $$[$0 - 5];
+ yy.addVertex($$[$0 - 5], $$[$0 - 2], "circle");
+ break;
+ case 54:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "ellipse");
+ break;
+ case 55:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "stadium");
+ break;
+ case 56:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "subroutine");
+ break;
+ case 57:
+ this.$ = $$[$0 - 7];
+ yy.addVertex($$[$0 - 7], $$[$0 - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[$$[$0 - 5], $$[$0 - 3]]]));
+ break;
+ case 58:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "cylinder");
+ break;
+ case 59:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "round");
+ break;
+ case 60:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "diamond");
+ break;
+ case 61:
+ this.$ = $$[$0 - 5];
+ yy.addVertex($$[$0 - 5], $$[$0 - 2], "hexagon");
+ break;
+ case 62:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "odd");
+ break;
+ case 63:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "trapezoid");
+ break;
+ case 64:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "inv_trapezoid");
+ break;
+ case 65:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_right");
+ break;
+ case 66:
+ this.$ = $$[$0 - 3];
+ yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_left");
+ break;
+ case 67:
+ this.$ = $$[$0];
+ yy.addVertex($$[$0]);
+ break;
+ case 68:
+ $$[$0 - 1].text = $$[$0];
+ this.$ = $$[$0 - 1];
+ break;
+ case 69:
+ case 70:
+ $$[$0 - 2].text = $$[$0 - 1];
+ this.$ = $$[$0 - 2];
+ break;
+ case 71:
+ this.$ = $$[$0];
+ break;
+ case 72:
+ var inf = yy.destructLink($$[$0], $$[$0 - 2]);
+ this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "text": $$[$0 - 1] };
+ break;
+ case 73:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 74:
+ this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
+ break;
+ case 75:
+ this.$ = { text: $$[$0], type: "string" };
+ break;
+ case 76:
+ this.$ = { text: $$[$0], type: "markdown" };
+ break;
+ case 77:
+ var inf = yy.destructLink($$[$0]);
+ this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length };
+ break;
+ case 78:
+ this.$ = $$[$0 - 1];
+ break;
+ case 79:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 80:
+ this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
+ break;
+ case 81:
+ this.$ = { text: $$[$0], type: "string" };
+ break;
+ case 82:
+ case 97:
+ this.$ = { text: $$[$0], type: "markdown" };
+ break;
+ case 94:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 95:
+ this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type };
+ break;
+ case 96:
+ this.$ = { text: $$[$0], type: "text" };
+ break;
+ case 98:
+ this.$ = $$[$0 - 4];
+ yy.addClass($$[$0 - 2], $$[$0]);
+ break;
+ case 99:
+ this.$ = $$[$0 - 4];
+ yy.setClass($$[$0 - 2], $$[$0]);
+ break;
+ case 100:
+ case 108:
+ this.$ = $$[$0 - 1];
+ yy.setClickEvent($$[$0 - 1], $$[$0]);
+ break;
+ case 101:
+ case 109:
+ this.$ = $$[$0 - 3];
+ yy.setClickEvent($$[$0 - 3], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 3], $$[$0]);
+ break;
+ case 102:
+ this.$ = $$[$0 - 2];
+ yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]);
+ break;
+ case 103:
+ this.$ = $$[$0 - 4];
+ yy.setClickEvent($$[$0 - 4], $$[$0 - 3], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 4], $$[$0]);
+ break;
+ case 104:
+ this.$ = $$[$0 - 2];
+ yy.setLink($$[$0 - 2], $$[$0]);
+ break;
+ case 105:
+ this.$ = $$[$0 - 4];
+ yy.setLink($$[$0 - 4], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 4], $$[$0]);
+ break;
+ case 106:
+ this.$ = $$[$0 - 4];
+ yy.setLink($$[$0 - 4], $$[$0 - 2], $$[$0]);
+ break;
+ case 107:
+ this.$ = $$[$0 - 6];
+ yy.setLink($$[$0 - 6], $$[$0 - 4], $$[$0]);
+ yy.setTooltip($$[$0 - 6], $$[$0 - 2]);
+ break;
+ case 110:
+ this.$ = $$[$0 - 1];
+ yy.setLink($$[$0 - 1], $$[$0]);
+ break;
+ case 111:
+ this.$ = $$[$0 - 3];
+ yy.setLink($$[$0 - 3], $$[$0 - 2]);
+ yy.setTooltip($$[$0 - 3], $$[$0]);
+ break;
+ case 112:
+ this.$ = $$[$0 - 3];
+ yy.setLink($$[$0 - 3], $$[$0 - 2], $$[$0]);
+ break;
+ case 113:
+ this.$ = $$[$0 - 5];
+ yy.setLink($$[$0 - 5], $$[$0 - 4], $$[$0]);
+ yy.setTooltip($$[$0 - 5], $$[$0 - 2]);
+ break;
+ case 114:
+ this.$ = $$[$0 - 4];
+ yy.addVertex($$[$0 - 2], void 0, void 0, $$[$0]);
+ break;
+ case 115:
+ this.$ = $$[$0 - 4];
+ yy.updateLink([$$[$0 - 2]], $$[$0]);
+ break;
+ case 116:
+ this.$ = $$[$0 - 4];
+ yy.updateLink($$[$0 - 2], $$[$0]);
+ break;
+ case 117:
+ this.$ = $$[$0 - 8];
+ yy.updateLinkInterpolate([$$[$0 - 6]], $$[$0 - 2]);
+ yy.updateLink([$$[$0 - 6]], $$[$0]);
+ break;
+ case 118:
+ this.$ = $$[$0 - 8];
+ yy.updateLinkInterpolate($$[$0 - 6], $$[$0 - 2]);
+ yy.updateLink($$[$0 - 6], $$[$0]);
+ break;
+ case 119:
+ this.$ = $$[$0 - 6];
+ yy.updateLinkInterpolate([$$[$0 - 4]], $$[$0]);
+ break;
+ case 120:
+ this.$ = $$[$0 - 6];
+ yy.updateLinkInterpolate($$[$0 - 4], $$[$0]);
+ break;
+ case 121:
+ case 123:
+ this.$ = [$$[$0]];
+ break;
+ case 122:
+ case 124:
+ $$[$0 - 2].push($$[$0]);
+ this.$ = $$[$0 - 2];
+ break;
+ case 126:
+ this.$ = $$[$0 - 1] + $$[$0];
+ break;
+ case 174:
+ this.$ = $$[$0];
+ break;
+ case 175:
+ this.$ = $$[$0 - 1] + "" + $$[$0];
+ break;
+ case 177:
+ this.$ = $$[$0 - 1] + "" + $$[$0];
+ break;
+ case 178:
+ this.$ = { stmt: "dir", value: "TB" };
+ break;
+ case 179:
+ this.$ = { stmt: "dir", value: "BT" };
+ break;
+ case 180:
+ this.$ = { stmt: "dir", value: "RL" };
+ break;
+ case 181:
+ this.$ = { stmt: "dir", value: "LR" };
+ break;
+ }
+ },
+ table: [{ 3: 1, 4: 2, 9: $V0, 10: $V1, 12: $V2 }, { 1: [3] }, o($V3, $V4, { 5: 6 }), { 4: 7, 9: $V0, 10: $V1, 12: $V2 }, { 4: 8, 9: $V0, 10: $V1, 12: $V2 }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, o($V3, [2, 9]), o($V3, [2, 10]), o($V3, [2, 11]), { 8: [1, 54], 9: [1, 55], 10: $Vx, 15: 53, 18: 56 }, o($Vy, [2, 3]), o($Vy, [2, 4]), o($Vy, [2, 5]), o($Vy, [2, 6]), o($Vy, [2, 7]), o($Vy, [2, 8]), { 8: $Vz, 9: $VA, 11: $VB, 21: 58, 39: 59, 70: 63, 73: [1, 64], 75: [1, 65] }, { 8: $Vz, 9: $VA, 11: $VB, 21: 66 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 67 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 68 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 69 }, { 8: $Vz, 9: $VA, 11: $VB, 21: 70 }, { 8: $Vz, 9: $VA, 10: [1, 71], 11: $VB, 21: 72 }, o($Vy, [2, 36]), { 35: [1, 73] }, { 37: [1, 74] }, o($Vy, [2, 39]), o($VC, [2, 46], { 18: 75, 10: $Vx }), { 10: [1, 76] }, { 10: [1, 77] }, { 10: [1, 78] }, { 10: [1, 79] }, { 14: $VD, 42: $VE, 58: $VF, 77: [1, 83], 86: $VG, 92: [1, 80], 94: [1, 81], 98: 82, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN, 117: 84 }, o($Vy, [2, 178]), o($Vy, [2, 179]), o($Vy, [2, 180]), o($Vy, [2, 181]), o($VO, [2, 47]), o($VO, [2, 49], { 44: [1, 96] }), o($VP, [2, 67], { 110: 109, 29: [1, 97], 42: $Vd, 46: [1, 98], 48: [1, 99], 50: [1, 100], 52: [1, 101], 54: [1, 102], 56: [1, 103], 58: $Ve, 61: [1, 104], 63: [1, 105], 65: [1, 106], 66: [1, 107], 68: [1, 108], 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 111: $Vq, 112: $Vr, 113: $Vs }), o($VQ, [2, 174]), o($VQ, [2, 135]), o($VQ, [2, 136]), o($VQ, [2, 137]), o($VQ, [2, 138]), o($VQ, [2, 139]), o($VQ, [2, 140]), o($VQ, [2, 141]), o($VQ, [2, 142]), o($VQ, [2, 143]), o($VQ, [2, 144]), o($VQ, [2, 145]), o($V3, [2, 12]), o($V3, [2, 18]), o($V3, [2, 19]), { 9: [1, 110] }, o($VR, [2, 26], { 18: 111, 10: $Vx }), o($Vy, [2, 27]), { 40: 112, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, o($Vy, [2, 40]), o($Vy, [2, 41]), o($Vy, [2, 42]), o($VS, [2, 71], { 71: 113, 60: [1, 115], 72: [1, 114] }), { 74: 116, 76: 117, 77: [1, 118], 78: [1, 119], 113: $VT, 116: $VU }, o([42, 58, 60, 72, 86, 99, 102, 103, 106, 108, 111, 112, 113], [2, 77]), o($Vy, [2, 28]), o($Vy, [2, 29]), o($Vy, [2, 30]), o($Vy, [2, 31]), o($Vy, [2, 32]), { 10: $VV, 12: $VW, 14: $VX, 27: $VY, 28: 122, 32: $VZ, 42: $V_, 58: $V$, 73: $V01, 77: [1, 124], 78: [1, 125], 80: 135, 81: $V11, 82: $V21, 83: $V31, 84: $V41, 85: $V51, 86: $V61, 87: $V71, 88: 123, 102: $V81, 106: $V91, 108: $Va1, 111: $Vb1, 112: $Vc1, 113: $Vd1 }, o($Ve1, $V4, { 5: 148 }), o($Vy, [2, 37]), o($Vy, [2, 38]), o($VC, [2, 45], { 42: $Vf1 }), { 42: $Vd, 45: 150, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 99: [1, 151], 100: 152, 102: [1, 153] }, { 42: $Vd, 45: 154, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 42: $Vd, 45: 155, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, o($Vg1, [2, 100], { 10: [1, 156], 93: [1, 157] }), { 77: [1, 158] }, o($Vg1, [2, 108], { 117: 160, 10: [1, 159], 14: $VD, 42: $VE, 58: $VF, 86: $VG, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN }), o($Vg1, [2, 110], { 10: [1, 161] }), o($Vh1, [2, 176]), o($Vh1, [2, 163]), o($Vh1, [2, 164]), o($Vh1, [2, 165]), o($Vh1, [2, 166]), o($Vh1, [2, 167]), o($Vh1, [2, 168]), o($Vh1, [2, 169]), o($Vh1, [2, 170]), o($Vh1, [2, 171]), o($Vh1, [2, 172]), o($Vh1, [2, 173]), { 42: $Vd, 45: 162, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 30: 163, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 171, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 173, 48: [1, 172], 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 174, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 175, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 176, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 106: [1, 177] }, { 30: 178, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 179, 63: [1, 180], 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 181, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 182, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 183, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VQ, [2, 175]), o($V3, [2, 20]), o($VR, [2, 25]), o($VC, [2, 43], { 18: 184, 10: $Vx }), o($VS, [2, 68], { 10: [1, 185] }), { 10: [1, 186] }, { 30: 187, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 75: [1, 188], 76: 189, 113: $VT, 116: $VU }, o($Vo1, [2, 73]), o($Vo1, [2, 75]), o($Vo1, [2, 76]), o($Vo1, [2, 161]), o($Vo1, [2, 162]), { 8: $Vz, 9: $VA, 10: $VV, 11: $VB, 12: $VW, 14: $VX, 21: 191, 27: $VY, 29: [1, 190], 32: $VZ, 42: $V_, 58: $V$, 73: $V01, 80: 135, 81: $V11, 82: $V21, 83: $V31, 84: $V41, 85: $V51, 86: $V61, 87: $V71, 88: 192, 102: $V81, 106: $V91, 108: $Va1, 111: $Vb1, 112: $Vc1, 113: $Vd1 }, o($Vp1, [2, 94]), o($Vp1, [2, 96]), o($Vp1, [2, 97]), o($Vp1, [2, 150]), o($Vp1, [2, 151]), o($Vp1, [2, 152]), o($Vp1, [2, 153]), o($Vp1, [2, 154]), o($Vp1, [2, 155]), o($Vp1, [2, 156]), o($Vp1, [2, 157]), o($Vp1, [2, 158]), o($Vp1, [2, 159]), o($Vp1, [2, 160]), o($Vp1, [2, 83]), o($Vp1, [2, 84]), o($Vp1, [2, 85]), o($Vp1, [2, 86]), o($Vp1, [2, 87]), o($Vp1, [2, 88]), o($Vp1, [2, 89]), o($Vp1, [2, 90]), o($Vp1, [2, 91]), o($Vp1, [2, 92]), o($Vp1, [2, 93]), { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 193], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, { 10: $Vx, 18: 194 }, { 10: [1, 195], 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 109, 111: $Vq, 112: $Vr, 113: $Vs }, { 10: [1, 196] }, { 10: [1, 197], 103: [1, 198] }, o($Vq1, [2, 121]), { 10: [1, 199], 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 109, 111: $Vq, 112: $Vr, 113: $Vs }, { 10: [1, 200], 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 109, 111: $Vq, 112: $Vr, 113: $Vs }, { 77: [1, 201] }, o($Vg1, [2, 102], { 10: [1, 202] }), o($Vg1, [2, 104], { 10: [1, 203] }), { 77: [1, 204] }, o($Vh1, [2, 177]), { 77: [1, 205], 95: [1, 206] }, o($VO, [2, 50], { 110: 109, 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 111: $Vq, 112: $Vr, 113: $Vs }), { 31: [1, 207], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($Vr1, [2, 79]), o($Vr1, [2, 81]), o($Vr1, [2, 82]), o($Vr1, [2, 146]), o($Vr1, [2, 147]), o($Vr1, [2, 148]), o($Vr1, [2, 149]), { 47: [1, 209], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 210, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 49: [1, 211], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 51: [1, 212], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 53: [1, 213], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 55: [1, 214], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 58: [1, 215] }, { 62: [1, 216], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 64: [1, 217], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 30: 218, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 31: [1, 219], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 65: $Vi1, 67: [1, 220], 69: [1, 221], 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 65: $Vi1, 67: [1, 223], 69: [1, 222], 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VC, [2, 44], { 42: $Vf1 }), o($VS, [2, 70]), o($VS, [2, 69]), { 60: [1, 224], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VS, [2, 72]), o($Vo1, [2, 74]), { 30: 225, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($Ve1, $V4, { 5: 226 }), o($Vp1, [2, 95]), o($Vy, [2, 35]), { 41: 227, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 228, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 239, 101: [1, 240], 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 241, 101: [1, 242], 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 102: [1, 243] }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 244, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 42: $Vd, 45: 245, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs }, o($Vg1, [2, 101]), { 77: [1, 246] }, { 77: [1, 247], 95: [1, 248] }, o($Vg1, [2, 109]), o($Vg1, [2, 111], { 10: [1, 249] }), o($Vg1, [2, 112]), o($VP, [2, 51]), o($Vr1, [2, 80]), o($VP, [2, 52]), { 49: [1, 250], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VP, [2, 59]), o($VP, [2, 54]), o($VP, [2, 55]), o($VP, [2, 56]), { 106: [1, 251] }, o($VP, [2, 58]), o($VP, [2, 60]), { 64: [1, 252], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VP, [2, 62]), o($VP, [2, 63]), o($VP, [2, 65]), o($VP, [2, 64]), o($VP, [2, 66]), o([10, 42, 58, 86, 99, 102, 103, 106, 108, 111, 112, 113], [2, 78]), { 31: [1, 253], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 254], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, o($VO, [2, 48]), o($Vg1, [2, 114], { 103: $VA1 }), o($VB1, [2, 123], { 105: 256, 10: $Vs1, 58: $Vt1, 81: $Vu1, 102: $Vv1, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }), o($VC1, [2, 125]), o($VC1, [2, 127]), o($VC1, [2, 128]), o($VC1, [2, 129]), o($VC1, [2, 130]), o($VC1, [2, 131]), o($VC1, [2, 132]), o($VC1, [2, 133]), o($VC1, [2, 134]), o($Vg1, [2, 115], { 103: $VA1 }), { 10: [1, 257] }, o($Vg1, [2, 116], { 103: $VA1 }), { 10: [1, 258] }, o($Vq1, [2, 122]), o($Vg1, [2, 98], { 103: $VA1 }), o($Vg1, [2, 99], { 110: 109, 42: $Vd, 58: $Ve, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 111: $Vq, 112: $Vr, 113: $Vs }), o($Vg1, [2, 103]), o($Vg1, [2, 105], { 10: [1, 259] }), o($Vg1, [2, 106]), { 95: [1, 260] }, { 49: [1, 261] }, { 60: [1, 262] }, { 64: [1, 263] }, { 8: $Vz, 9: $VA, 11: $VB, 21: 264 }, o($Vy, [2, 34]), { 10: $Vs1, 58: $Vt1, 81: $Vu1, 102: $Vv1, 104: 265, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, o($VC1, [2, 126]), { 14: $VD, 42: $VE, 58: $VF, 86: $VG, 98: 266, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN, 117: 84 }, { 14: $VD, 42: $VE, 58: $VF, 86: $VG, 98: 267, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN, 117: 84 }, { 95: [1, 268] }, o($Vg1, [2, 113]), o($VP, [2, 53]), { 30: 269, 65: $Vi1, 77: $Vj1, 78: $Vk1, 79: 164, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, o($VP, [2, 61]), o($Ve1, $V4, { 5: 270 }), o($VB1, [2, 124], { 105: 256, 10: $Vs1, 58: $Vt1, 81: $Vu1, 102: $Vv1, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }), o($Vg1, [2, 119], { 117: 160, 10: [1, 271], 14: $VD, 42: $VE, 58: $VF, 86: $VG, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN }), o($Vg1, [2, 120], { 117: 160, 10: [1, 272], 14: $VD, 42: $VE, 58: $VF, 86: $VG, 102: $VH, 103: $VI, 106: $VJ, 108: $VK, 111: $VL, 112: $VM, 113: $VN }), o($Vg1, [2, 107]), { 31: [1, 273], 65: $Vi1, 79: 208, 113: $Vl1, 114: $Vm1, 115: $Vn1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 274], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 40: 28, 41: 38, 42: $Vd, 43: 39, 45: 40, 58: $Ve, 81: $Vf, 82: $Vg, 83: $Vh, 84: $Vi, 85: $Vj, 86: $Vk, 99: $Vl, 102: $Vm, 103: $Vn, 106: $Vo, 108: $Vp, 110: 41, 111: $Vq, 112: $Vr, 113: $Vs, 118: $Vt, 119: $Vu, 120: $Vv, 121: $Vw }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 275, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, { 10: $Vs1, 58: $Vt1, 81: $Vu1, 89: 276, 102: $Vv1, 104: 229, 105: 230, 106: $Vw1, 107: $Vx1, 108: $Vy1, 109: $Vz1 }, o($VP, [2, 57]), o($Vy, [2, 33]), o($Vg1, [2, 117], { 103: $VA1 }), o($Vg1, [2, 118], { 103: $VA1 })],
+ defaultActions: {},
+ parseError: function parseError(str, hash) {
+ if (hash.recoverable) {
+ this.trace(str);
+ } else {
+ var error = new Error(str);
+ error.hash = hash;
+ throw error;
+ }
+ },
+ parse: function parse(input) {
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
+ var args = lstack.slice.call(arguments, 1);
+ var lexer2 = Object.create(this.lexer);
+ var sharedState = { yy: {} };
+ for (var k in this.yy) {
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
+ sharedState.yy[k] = this.yy[k];
+ }
+ }
+ lexer2.setInput(input, sharedState.yy);
+ sharedState.yy.lexer = lexer2;
+ sharedState.yy.parser = this;
+ if (typeof lexer2.yylloc == "undefined") {
+ lexer2.yylloc = {};
+ }
+ var yyloc = lexer2.yylloc;
+ lstack.push(yyloc);
+ var ranges = lexer2.options && lexer2.options.ranges;
+ if (typeof sharedState.yy.parseError === "function") {
+ this.parseError = sharedState.yy.parseError;
+ } else {
+ this.parseError = Object.getPrototypeOf(this).parseError;
+ }
+ function lex2() {
+ var token;
+ token = tstack.pop() || lexer2.lex() || EOF;
+ if (typeof token !== "number") {
+ if (token instanceof Array) {
+ tstack = token;
+ token = tstack.pop();
+ }
+ token = self.symbols_[token] || token;
+ }
+ return token;
+ }
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
+ while (true) {
+ state = stack[stack.length - 1];
+ if (this.defaultActions[state]) {
+ action = this.defaultActions[state];
+ } else {
+ if (symbol === null || typeof symbol == "undefined") {
+ symbol = lex2();
+ }
+ action = table[state] && table[state][symbol];
+ }
+ if (typeof action === "undefined" || !action.length || !action[0]) {
+ var errStr = "";
+ expected = [];
+ for (p in table[state]) {
+ if (this.terminals_[p] && p > TERROR) {
+ expected.push("'" + this.terminals_[p] + "'");
+ }
+ }
+ if (lexer2.showPosition) {
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
+ } else {
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
+ }
+ this.parseError(errStr, {
+ text: lexer2.match,
+ token: this.terminals_[symbol] || symbol,
+ line: lexer2.yylineno,
+ loc: yyloc,
+ expected
+ });
+ }
+ if (action[0] instanceof Array && action.length > 1) {
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
+ }
+ switch (action[0]) {
+ case 1:
+ stack.push(symbol);
+ vstack.push(lexer2.yytext);
+ lstack.push(lexer2.yylloc);
+ stack.push(action[1]);
+ symbol = null;
+ {
+ yyleng = lexer2.yyleng;
+ yytext = lexer2.yytext;
+ yylineno = lexer2.yylineno;
+ yyloc = lexer2.yylloc;
+ }
+ break;
+ case 2:
+ len = this.productions_[action[1]][1];
+ yyval.$ = vstack[vstack.length - len];
+ yyval._$ = {
+ first_line: lstack[lstack.length - (len || 1)].first_line,
+ last_line: lstack[lstack.length - 1].last_line,
+ first_column: lstack[lstack.length - (len || 1)].first_column,
+ last_column: lstack[lstack.length - 1].last_column
+ };
+ if (ranges) {
+ yyval._$.range = [
+ lstack[lstack.length - (len || 1)].range[0],
+ lstack[lstack.length - 1].range[1]
+ ];
+ }
+ r = this.performAction.apply(yyval, [
+ yytext,
+ yyleng,
+ yylineno,
+ sharedState.yy,
+ action[1],
+ vstack,
+ lstack
+ ].concat(args));
+ if (typeof r !== "undefined") {
+ return r;
+ }
+ if (len) {
+ stack = stack.slice(0, -1 * len * 2);
+ vstack = vstack.slice(0, -1 * len);
+ lstack = lstack.slice(0, -1 * len);
+ }
+ stack.push(this.productions_[action[1]][0]);
+ vstack.push(yyval.$);
+ lstack.push(yyval._$);
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
+ stack.push(newState);
+ break;
+ case 3:
+ return true;
+ }
+ }
+ return true;
+ }
+ };
+ var lexer = function() {
+ var lexer2 = {
+ EOF: 1,
+ parseError: function parseError(str, hash) {
+ if (this.yy.parser) {
+ this.yy.parser.parseError(str, hash);
+ } else {
+ throw new Error(str);
+ }
+ },
+ // resets the lexer, sets new input
+ setInput: function(input, yy) {
+ this.yy = yy || this.yy || {};
+ this._input = input;
+ this._more = this._backtrack = this.done = false;
+ this.yylineno = this.yyleng = 0;
+ this.yytext = this.matched = this.match = "";
+ this.conditionStack = ["INITIAL"];
+ this.yylloc = {
+ first_line: 1,
+ first_column: 0,
+ last_line: 1,
+ last_column: 0
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [0, 0];
+ }
+ this.offset = 0;
+ return this;
+ },
+ // consumes and returns one char from the input
+ input: function() {
+ var ch = this._input[0];
+ this.yytext += ch;
+ this.yyleng++;
+ this.offset++;
+ this.match += ch;
+ this.matched += ch;
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno++;
+ this.yylloc.last_line++;
+ } else {
+ this.yylloc.last_column++;
+ }
+ if (this.options.ranges) {
+ this.yylloc.range[1]++;
+ }
+ this._input = this._input.slice(1);
+ return ch;
+ },
+ // unshifts one char (or a string) into the input
+ unput: function(ch) {
+ var len = ch.length;
+ var lines = ch.split(/(?:\r\n?|\n)/g);
+ this._input = ch + this._input;
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
+ this.offset -= len;
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
+ this.match = this.match.substr(0, this.match.length - 1);
+ this.matched = this.matched.substr(0, this.matched.length - 1);
+ if (lines.length - 1) {
+ this.yylineno -= lines.length - 1;
+ }
+ var r = this.yylloc.range;
+ this.yylloc = {
+ first_line: this.yylloc.first_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.first_column,
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
+ };
+ if (this.options.ranges) {
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
+ }
+ this.yyleng = this.yytext.length;
+ return this;
+ },
+ // When called from action, caches matched text and appends it on next action
+ more: function() {
+ this._more = true;
+ return this;
+ },
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
+ reject: function() {
+ if (this.options.backtrack_lexer) {
+ this._backtrack = true;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ return this;
+ },
+ // retain first n characters of the match
+ less: function(n) {
+ this.unput(this.match.slice(n));
+ },
+ // displays already matched input, i.e. for error messages
+ pastInput: function() {
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
+ },
+ // displays upcoming input, i.e. for error messages
+ upcomingInput: function() {
+ var next = this.match;
+ if (next.length < 20) {
+ next += this._input.substr(0, 20 - next.length);
+ }
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
+ },
+ // displays the character position where the lexing error occurred, i.e. for error messages
+ showPosition: function() {
+ var pre = this.pastInput();
+ var c = new Array(pre.length + 1).join("-");
+ return pre + this.upcomingInput() + "\n" + c + "^";
+ },
+ // test the lexed token: return FALSE when not a match, otherwise return token
+ test_match: function(match, indexed_rule) {
+ var token, lines, backup;
+ if (this.options.backtrack_lexer) {
+ backup = {
+ yylineno: this.yylineno,
+ yylloc: {
+ first_line: this.yylloc.first_line,
+ last_line: this.last_line,
+ first_column: this.yylloc.first_column,
+ last_column: this.yylloc.last_column
+ },
+ yytext: this.yytext,
+ match: this.match,
+ matches: this.matches,
+ matched: this.matched,
+ yyleng: this.yyleng,
+ offset: this.offset,
+ _more: this._more,
+ _input: this._input,
+ yy: this.yy,
+ conditionStack: this.conditionStack.slice(0),
+ done: this.done
+ };
+ if (this.options.ranges) {
+ backup.yylloc.range = this.yylloc.range.slice(0);
+ }
+ }
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
+ if (lines) {
+ this.yylineno += lines.length;
+ }
+ this.yylloc = {
+ first_line: this.yylloc.last_line,
+ last_line: this.yylineno + 1,
+ first_column: this.yylloc.last_column,
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
+ };
+ this.yytext += match[0];
+ this.match += match[0];
+ this.matches = match;
+ this.yyleng = this.yytext.length;
+ if (this.options.ranges) {
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
+ }
+ this._more = false;
+ this._backtrack = false;
+ this._input = this._input.slice(match[0].length);
+ this.matched += match[0];
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
+ if (this.done && this._input) {
+ this.done = false;
+ }
+ if (token) {
+ return token;
+ } else if (this._backtrack) {
+ for (var k in backup) {
+ this[k] = backup[k];
+ }
+ return false;
+ }
+ return false;
+ },
+ // return next match in input
+ next: function() {
+ if (this.done) {
+ return this.EOF;
+ }
+ if (!this._input) {
+ this.done = true;
+ }
+ var token, match, tempMatch, index;
+ if (!this._more) {
+ this.yytext = "";
+ this.match = "";
+ }
+ var rules = this._currentRules();
+ for (var i = 0; i < rules.length; i++) {
+ tempMatch = this._input.match(this.rules[rules[i]]);
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
+ match = tempMatch;
+ index = i;
+ if (this.options.backtrack_lexer) {
+ token = this.test_match(tempMatch, rules[i]);
+ if (token !== false) {
+ return token;
+ } else if (this._backtrack) {
+ match = false;
+ continue;
+ } else {
+ return false;
+ }
+ } else if (!this.options.flex) {
+ break;
+ }
+ }
+ }
+ if (match) {
+ token = this.test_match(match, rules[index]);
+ if (token !== false) {
+ return token;
+ }
+ return false;
+ }
+ if (this._input === "") {
+ return this.EOF;
+ } else {
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
+ text: "",
+ token: null,
+ line: this.yylineno
+ });
+ }
+ },
+ // return next match that has a token
+ lex: function lex2() {
+ var r = this.next();
+ if (r) {
+ return r;
+ } else {
+ return this.lex();
+ }
+ },
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
+ begin: function begin(condition) {
+ this.conditionStack.push(condition);
+ },
+ // pop the previously active lexer condition state off the condition stack
+ popState: function popState() {
+ var n = this.conditionStack.length - 1;
+ if (n > 0) {
+ return this.conditionStack.pop();
+ } else {
+ return this.conditionStack[0];
+ }
+ },
+ // produce the lexer rule set which is active for the currently active lexer condition state
+ _currentRules: function _currentRules() {
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
+ } else {
+ return this.conditions["INITIAL"].rules;
+ }
+ },
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
+ topState: function topState(n) {
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
+ if (n >= 0) {
+ return this.conditionStack[n];
+ } else {
+ return "INITIAL";
+ }
+ },
+ // alias for begin(condition)
+ pushState: function pushState(condition) {
+ this.begin(condition);
+ },
+ // return the number of states currently on the stack
+ stateStackSize: function stateStackSize() {
+ return this.conditionStack.length;
+ },
+ options: {},
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
+ switch ($avoiding_name_collisions) {
+ case 0:
+ this.begin("acc_title");
+ return 34;
+ case 1:
+ this.popState();
+ return "acc_title_value";
+ case 2:
+ this.begin("acc_descr");
+ return 36;
+ case 3:
+ this.popState();
+ return "acc_descr_value";
+ case 4:
+ this.begin("acc_descr_multiline");
+ break;
+ case 5:
+ this.popState();
+ break;
+ case 6:
+ return "acc_descr_multiline_value";
+ case 7:
+ this.begin("callbackname");
+ break;
+ case 8:
+ this.popState();
+ break;
+ case 9:
+ this.popState();
+ this.begin("callbackargs");
+ break;
+ case 10:
+ return 92;
+ case 11:
+ this.popState();
+ break;
+ case 12:
+ return 93;
+ case 13:
+ return "MD_STR";
+ case 14:
+ this.popState();
+ break;
+ case 15:
+ this.begin("md_string");
+ break;
+ case 16:
+ return "STR";
+ case 17:
+ this.popState();
+ break;
+ case 18:
+ this.pushState("string");
+ break;
+ case 19:
+ return 81;
+ case 20:
+ return 99;
+ case 21:
+ return 82;
+ case 22:
+ return 101;
+ case 23:
+ return 83;
+ case 24:
+ return 84;
+ case 25:
+ return 94;
+ case 26:
+ this.begin("click");
+ break;
+ case 27:
+ this.popState();
+ break;
+ case 28:
+ return 85;
+ case 29:
+ if (yy.lex.firstGraph()) {
+ this.begin("dir");
+ }
+ return 12;
+ case 30:
+ if (yy.lex.firstGraph()) {
+ this.begin("dir");
+ }
+ return 12;
+ case 31:
+ if (yy.lex.firstGraph()) {
+ this.begin("dir");
+ }
+ return 12;
+ case 32:
+ return 27;
+ case 33:
+ return 32;
+ case 34:
+ return 95;
+ case 35:
+ return 95;
+ case 36:
+ return 95;
+ case 37:
+ return 95;
+ case 38:
+ this.popState();
+ return 13;
+ case 39:
+ this.popState();
+ return 14;
+ case 40:
+ this.popState();
+ return 14;
+ case 41:
+ this.popState();
+ return 14;
+ case 42:
+ this.popState();
+ return 14;
+ case 43:
+ this.popState();
+ return 14;
+ case 44:
+ this.popState();
+ return 14;
+ case 45:
+ this.popState();
+ return 14;
+ case 46:
+ this.popState();
+ return 14;
+ case 47:
+ this.popState();
+ return 14;
+ case 48:
+ this.popState();
+ return 14;
+ case 49:
+ return 118;
+ case 50:
+ return 119;
+ case 51:
+ return 120;
+ case 52:
+ return 121;
+ case 53:
+ return 102;
+ case 54:
+ return 108;
+ case 55:
+ return 44;
+ case 56:
+ return 58;
+ case 57:
+ return 42;
+ case 58:
+ return 8;
+ case 59:
+ return 103;
+ case 60:
+ return 112;
+ case 61:
+ this.popState();
+ return 75;
+ case 62:
+ this.pushState("edgeText");
+ return 73;
+ case 63:
+ return 116;
+ case 64:
+ this.popState();
+ return 75;
+ case 65:
+ this.pushState("thickEdgeText");
+ return 73;
+ case 66:
+ return 116;
+ case 67:
+ this.popState();
+ return 75;
+ case 68:
+ this.pushState("dottedEdgeText");
+ return 73;
+ case 69:
+ return 116;
+ case 70:
+ return 75;
+ case 71:
+ this.popState();
+ return 51;
+ case 72:
+ return "TEXT";
+ case 73:
+ this.pushState("ellipseText");
+ return 50;
+ case 74:
+ this.popState();
+ return 53;
+ case 75:
+ this.pushState("text");
+ return 52;
+ case 76:
+ this.popState();
+ return 55;
+ case 77:
+ this.pushState("text");
+ return 54;
+ case 78:
+ return 56;
+ case 79:
+ this.pushState("text");
+ return 65;
+ case 80:
+ this.popState();
+ return 62;
+ case 81:
+ this.pushState("text");
+ return 61;
+ case 82:
+ this.popState();
+ return 47;
+ case 83:
+ this.pushState("text");
+ return 46;
+ case 84:
+ this.popState();
+ return 67;
+ case 85:
+ this.popState();
+ return 69;
+ case 86:
+ return 114;
+ case 87:
+ this.pushState("trapText");
+ return 66;
+ case 88:
+ this.pushState("trapText");
+ return 68;
+ case 89:
+ return 115;
+ case 90:
+ return 65;
+ case 91:
+ return 87;
+ case 92:
+ return "SEP";
+ case 93:
+ return 86;
+ case 94:
+ return 112;
+ case 95:
+ return 108;
+ case 96:
+ return 42;
+ case 97:
+ return 106;
+ case 98:
+ return 111;
+ case 99:
+ return 113;
+ case 100:
+ this.popState();
+ return 60;
+ case 101:
+ this.pushState("text");
+ return 60;
+ case 102:
+ this.popState();
+ return 49;
+ case 103:
+ this.pushState("text");
+ return 48;
+ case 104:
+ this.popState();
+ return 31;
+ case 105:
+ this.pushState("text");
+ return 29;
+ case 106:
+ this.popState();
+ return 64;
+ case 107:
+ this.pushState("text");
+ return 63;
+ case 108:
+ return "TEXT";
+ case 109:
+ return "QUOTE";
+ case 110:
+ return 9;
+ case 111:
+ return 10;
+ case 112:
+ return 11;
+ }
+ },
+ rules: [/^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["][`])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:["])/, /^(?:style\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\b)/, /^(?:class\b)/, /^(?:href[\s])/, /^(?:click[\s]+)/, /^(?:[\s\n])/, /^(?:[^\s\n]*)/, /^(?:flowchart-elk\b)/, /^(?:graph\b)/, /^(?:flowchart\b)/, /^(?:subgraph\b)/, /^(?:end\b\s*)/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:(\r?\n)*\s*\n)/, /^(?:\s*LR\b)/, /^(?:\s*RL\b)/, /^(?:\s*TB\b)/, /^(?:\s*BT\b)/, /^(?:\s*TD\b)/, /^(?:\s*BR\b)/, /^(?:\s*<)/, /^(?:\s*>)/, /^(?:\s*\^)/, /^(?:\s*v\b)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:[0-9]+)/, /^(?:#)/, /^(?::::)/, /^(?::)/, /^(?:&)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:[^-]|-(?!-)+)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:[^=]|=(?!))/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:[^\.]|\.(?!))/, /^(?:\s*~~[\~]+\s*)/, /^(?:[-/\)][\)])/, /^(?:[^\(\)\[\]\{\}]|!\)+)/, /^(?:\(-)/, /^(?:\]\))/, /^(?:\(\[)/, /^(?:\]\])/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:>)/, /^(?:\)\])/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\(\(\()/, /^(?:[\\(?=\])][\]])/, /^(?:\/(?=\])\])/, /^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:<)/, /^(?:>)/, /^(?:\^)/, /^(?:\\\|)/, /^(?:v\b)/, /^(?:\*)/, /^(?:#)/, /^(?:&)/, /^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/, /^(?:-)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\|)/, /^(?:\|)/, /^(?:\))/, /^(?:\()/, /^(?:\])/, /^(?:\[)/, /^(?:(\}))/, /^(?:\{)/, /^(?:[^\[\]\(\)\{\}\|\"]+)/, /^(?:")/, /^(?:(\r?\n)+)/, /^(?:\s)/, /^(?:$)/],
+ conditions: { "callbackargs": { "rules": [11, 12, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "callbackname": { "rules": [8, 9, 10, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "href": { "rules": [15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "click": { "rules": [15, 18, 27, 28, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "dottedEdgeText": { "rules": [15, 18, 67, 69, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "thickEdgeText": { "rules": [15, 18, 64, 66, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "edgeText": { "rules": [15, 18, 61, 63, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "trapText": { "rules": [15, 18, 70, 73, 75, 77, 81, 83, 84, 85, 86, 87, 88, 101, 103, 105, 107], "inclusive": false }, "ellipseText": { "rules": [15, 18, 70, 71, 72, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "text": { "rules": [15, 18, 70, 73, 74, 75, 76, 77, 80, 81, 82, 83, 87, 88, 100, 101, 102, 103, 104, 105, 106, 107, 108], "inclusive": false }, "vertex": { "rules": [15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "dir": { "rules": [15, 18, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "acc_descr_multiline": { "rules": [5, 6, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "acc_descr": { "rules": [3, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "acc_title": { "rules": [1, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "md_string": { "rules": [13, 14, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "string": { "rules": [15, 16, 17, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 67, 68, 70, 73, 75, 77, 78, 79, 81, 83, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 103, 105, 107, 109, 110, 111, 112], "inclusive": true } }
+ };
+ return lexer2;
+ }();
+ parser2.lexer = lexer;
+ function Parser() {
+ this.yy = {};
+ }
+ Parser.prototype = parser2;
+ parser2.Parser = Parser;
+ return new Parser();
+}();
+parser.parser = parser;
+const parser$1 = parser;
+const MERMAID_DOM_ID_PREFIX = "flowchart-";
+let vertexCounter = 0;
+let config = getConfig();
+let vertices = {};
+let edges = [];
+let classes = {};
+let subGraphs = [];
+let subGraphLookup = {};
+let tooltips = {};
+let subCount = 0;
+let firstGraphFlag = true;
+let direction;
+let version;
+let funs = [];
+const sanitizeText = (txt) => common$1.sanitizeText(txt, config);
+const lookUpDomId = function(id) {
+ const vertexKeys = Object.keys(vertices);
+ for (const vertexKey of vertexKeys) {
+ if (vertices[vertexKey].id === id) {
+ return vertices[vertexKey].domId;
+ }
+ }
+ return id;
+};
+const addVertex = function(_id, textObj, type, style, classes2, dir, props = {}) {
+ let txt;
+ let id = _id;
+ if (id === void 0) {
+ return;
+ }
+ if (id.trim().length === 0) {
+ return;
+ }
+ if (vertices[id] === void 0) {
+ vertices[id] = {
+ id,
+ labelType: "text",
+ domId: MERMAID_DOM_ID_PREFIX + id + "-" + vertexCounter,
+ styles: [],
+ classes: []
+ };
+ }
+ vertexCounter++;
+ if (textObj !== void 0) {
+ config = getConfig();
+ txt = sanitizeText(textObj.text.trim());
+ vertices[id].labelType = textObj.type;
+ if (txt[0] === '"' && txt[txt.length - 1] === '"') {
+ txt = txt.substring(1, txt.length - 1);
+ }
+ vertices[id].text = txt;
+ } else {
+ if (vertices[id].text === void 0) {
+ vertices[id].text = _id;
+ }
+ }
+ if (type !== void 0) {
+ vertices[id].type = type;
+ }
+ if (style !== void 0 && style !== null) {
+ style.forEach(function(s) {
+ vertices[id].styles.push(s);
+ });
+ }
+ if (classes2 !== void 0 && classes2 !== null) {
+ classes2.forEach(function(s) {
+ vertices[id].classes.push(s);
+ });
+ }
+ if (dir !== void 0) {
+ vertices[id].dir = dir;
+ }
+ if (vertices[id].props === void 0) {
+ vertices[id].props = props;
+ } else if (props !== void 0) {
+ Object.assign(vertices[id].props, props);
+ }
+};
+const addSingleLink = function(_start, _end, type) {
+ let start = _start;
+ let end = _end;
+ const edge = { start, end, type: void 0, text: "", labelType: "text" };
+ log$1.info("abc78 Got edge...", edge);
+ const linkTextObj = type.text;
+ if (linkTextObj !== void 0) {
+ edge.text = sanitizeText(linkTextObj.text.trim());
+ if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
+ edge.text = edge.text.substring(1, edge.text.length - 1);
+ }
+ edge.labelType = linkTextObj.type;
+ }
+ if (type !== void 0) {
+ edge.type = type.type;
+ edge.stroke = type.stroke;
+ edge.length = type.length;
+ }
+ if ((edge == null ? void 0 : edge.length) > 10) {
+ edge.length = 10;
+ }
+ if (edges.length < (config.maxEdges ?? 500)) {
+ log$1.info("abc78 pushing edge...");
+ edges.push(edge);
+ } else {
+ throw new Error(
+ `Edge limit exceeded. ${edges.length} edges found, but the limit is ${config.maxEdges}.
+
+Initialize mermaid with maxEdges set to a higher number to allow more edges.
+You cannot set this config via configuration inside the diagram as it is a secure config.
+You have to call mermaid.initialize.`
+ );
+ }
+};
+const addLink = function(_start, _end, type) {
+ log$1.info("addLink (abc78)", _start, _end, type);
+ let i, j;
+ for (i = 0; i < _start.length; i++) {
+ for (j = 0; j < _end.length; j++) {
+ addSingleLink(_start[i], _end[j], type);
+ }
+ }
+};
+const updateLinkInterpolate = function(positions, interp) {
+ positions.forEach(function(pos) {
+ if (pos === "default") {
+ edges.defaultInterpolate = interp;
+ } else {
+ edges[pos].interpolate = interp;
+ }
+ });
+};
+const updateLink = function(positions, style) {
+ positions.forEach(function(pos) {
+ if (pos >= edges.length) {
+ throw new Error(
+ `The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)`
+ );
+ }
+ if (pos === "default") {
+ edges.defaultStyle = style;
+ } else {
+ if (utils.isSubstringInArray("fill", style) === -1) {
+ style.push("fill:none");
+ }
+ edges[pos].style = style;
+ }
+ });
+};
+const addClass = function(ids, style) {
+ ids.split(",").forEach(function(id) {
+ if (classes[id] === void 0) {
+ classes[id] = { id, styles: [], textStyles: [] };
+ }
+ if (style !== void 0 && style !== null) {
+ style.forEach(function(s) {
+ if (s.match("color")) {
+ const newStyle = s.replace("fill", "bgFill").replace("color", "fill");
+ classes[id].textStyles.push(newStyle);
+ }
+ classes[id].styles.push(s);
+ });
+ }
+ });
+};
+const setDirection = function(dir) {
+ direction = dir;
+ if (direction.match(/.*)) {
+ direction = "RL";
+ }
+ if (direction.match(/.*\^/)) {
+ direction = "BT";
+ }
+ if (direction.match(/.*>/)) {
+ direction = "LR";
+ }
+ if (direction.match(/.*v/)) {
+ direction = "TB";
+ }
+ if (direction === "TD") {
+ direction = "TB";
+ }
+};
+const setClass = function(ids, className) {
+ ids.split(",").forEach(function(_id) {
+ let id = _id;
+ if (vertices[id] !== void 0) {
+ vertices[id].classes.push(className);
+ }
+ if (subGraphLookup[id] !== void 0) {
+ subGraphLookup[id].classes.push(className);
+ }
+ });
+};
+const setTooltip = function(ids, tooltip) {
+ ids.split(",").forEach(function(id) {
+ if (tooltip !== void 0) {
+ tooltips[version === "gen-1" ? lookUpDomId(id) : id] = sanitizeText(tooltip);
+ }
+ });
+};
+const setClickFun = function(id, functionName, functionArgs) {
+ let domId = lookUpDomId(id);
+ if (getConfig().securityLevel !== "loose") {
+ return;
+ }
+ if (functionName === void 0) {
+ return;
+ }
+ let argList = [];
+ if (typeof functionArgs === "string") {
+ argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
+ for (let i = 0; i < argList.length; i++) {
+ let item = argList[i].trim();
+ if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
+ item = item.substr(1, item.length - 2);
+ }
+ argList[i] = item;
+ }
+ }
+ if (argList.length === 0) {
+ argList.push(id);
+ }
+ if (vertices[id] !== void 0) {
+ vertices[id].haveCallback = true;
+ funs.push(function() {
+ const elem = document.querySelector(`[id="${domId}"]`);
+ if (elem !== null) {
+ elem.addEventListener(
+ "click",
+ function() {
+ utils.runFunc(functionName, ...argList);
+ },
+ false
+ );
+ }
+ });
+ }
+};
+const setLink = function(ids, linkStr, target) {
+ ids.split(",").forEach(function(id) {
+ if (vertices[id] !== void 0) {
+ vertices[id].link = utils.formatUrl(linkStr, config);
+ vertices[id].linkTarget = target;
+ }
+ });
+ setClass(ids, "clickable");
+};
+const getTooltip = function(id) {
+ if (tooltips.hasOwnProperty(id)) {
+ return tooltips[id];
+ }
+ return void 0;
+};
+const setClickEvent = function(ids, functionName, functionArgs) {
+ ids.split(",").forEach(function(id) {
+ setClickFun(id, functionName, functionArgs);
+ });
+ setClass(ids, "clickable");
+};
+const bindFunctions = function(element) {
+ funs.forEach(function(fun) {
+ fun(element);
+ });
+};
+const getDirection = function() {
+ return direction.trim();
+};
+const getVertices = function() {
+ return vertices;
+};
+const getEdges = function() {
+ return edges;
+};
+const getClasses = function() {
+ return classes;
+};
+const setupToolTips = function(element) {
+ let tooltipElem = select(".mermaidTooltip");
+ if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
+ tooltipElem = select("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0);
+ }
+ const svg = select(element).select("svg");
+ const nodes = svg.selectAll("g.node");
+ nodes.on("mouseover", function() {
+ const el = select(this);
+ const title = el.attr("title");
+ if (title === null) {
+ return;
+ }
+ const rect = this.getBoundingClientRect();
+ tooltipElem.transition().duration(200).style("opacity", ".9");
+ tooltipElem.text(el.attr("title")).style("left", window.scrollX + rect.left + (rect.right - rect.left) / 2 + "px").style("top", window.scrollY + rect.bottom + "px");
+ tooltipElem.html(tooltipElem.html().replace(/<br\/>/g, "
"));
+ el.classed("hover", true);
+ }).on("mouseout", function() {
+ tooltipElem.transition().duration(500).style("opacity", 0);
+ const el = select(this);
+ el.classed("hover", false);
+ });
+};
+funs.push(setupToolTips);
+const clear = function(ver = "gen-1") {
+ vertices = {};
+ classes = {};
+ edges = [];
+ funs = [setupToolTips];
+ subGraphs = [];
+ subGraphLookup = {};
+ subCount = 0;
+ tooltips = {};
+ firstGraphFlag = true;
+ version = ver;
+ config = getConfig();
+ clear$1();
+};
+const setGen = (ver) => {
+ version = ver || "gen-2";
+};
+const defaultStyle = function() {
+ return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;";
+};
+const addSubGraph = function(_id, list, _title) {
+ let id = _id.text.trim();
+ let title = _title.text;
+ if (_id === _title && _title.text.match(/\s/)) {
+ id = void 0;
+ }
+ function uniq(a) {
+ const prims = { boolean: {}, number: {}, string: {} };
+ const objs = [];
+ let dir2;
+ const nodeList2 = a.filter(function(item) {
+ const type = typeof item;
+ if (item.stmt && item.stmt === "dir") {
+ dir2 = item.value;
+ return false;
+ }
+ if (item.trim() === "") {
+ return false;
+ }
+ if (type in prims) {
+ return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true;
+ } else {
+ return objs.includes(item) ? false : objs.push(item);
+ }
+ });
+ return { nodeList: nodeList2, dir: dir2 };
+ }
+ let nodeList = [];
+ const { nodeList: nl, dir } = uniq(nodeList.concat.apply(nodeList, list));
+ nodeList = nl;
+ if (version === "gen-1") {
+ for (let i = 0; i < nodeList.length; i++) {
+ nodeList[i] = lookUpDomId(nodeList[i]);
+ }
+ }
+ id = id || "subGraph" + subCount;
+ title = title || "";
+ title = sanitizeText(title);
+ subCount = subCount + 1;
+ const subGraph = {
+ id,
+ nodes: nodeList,
+ title: title.trim(),
+ classes: [],
+ dir,
+ labelType: _title.type
+ };
+ log$1.info("Adding", subGraph.id, subGraph.nodes, subGraph.dir);
+ subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
+ subGraphs.push(subGraph);
+ subGraphLookup[id] = subGraph;
+ return id;
+};
+const getPosForId = function(id) {
+ for (const [i, subGraph] of subGraphs.entries()) {
+ if (subGraph.id === id) {
+ return i;
+ }
+ }
+ return -1;
+};
+let secCount = -1;
+const posCrossRef = [];
+const indexNodes2 = function(id, pos) {
+ const nodes = subGraphs[pos].nodes;
+ secCount = secCount + 1;
+ if (secCount > 2e3) {
+ return;
+ }
+ posCrossRef[secCount] = pos;
+ if (subGraphs[pos].id === id) {
+ return {
+ result: true,
+ count: 0
+ };
+ }
+ let count = 0;
+ let posCount = 1;
+ while (count < nodes.length) {
+ const childPos = getPosForId(nodes[count]);
+ if (childPos >= 0) {
+ const res = indexNodes2(id, childPos);
+ if (res.result) {
+ return {
+ result: true,
+ count: posCount + res.count
+ };
+ } else {
+ posCount = posCount + res.count;
+ }
+ }
+ count = count + 1;
+ }
+ return {
+ result: false,
+ count: posCount
+ };
+};
+const getDepthFirstPos = function(pos) {
+ return posCrossRef[pos];
+};
+const indexNodes = function() {
+ secCount = -1;
+ if (subGraphs.length > 0) {
+ indexNodes2("none", subGraphs.length - 1);
+ }
+};
+const getSubGraphs = function() {
+ return subGraphs;
+};
+const firstGraph = () => {
+ if (firstGraphFlag) {
+ firstGraphFlag = false;
+ return true;
+ }
+ return false;
+};
+const destructStartLink = (_str) => {
+ let str = _str.trim();
+ let type = "arrow_open";
+ switch (str[0]) {
+ case "<":
+ type = "arrow_point";
+ str = str.slice(1);
+ break;
+ case "x":
+ type = "arrow_cross";
+ str = str.slice(1);
+ break;
+ case "o":
+ type = "arrow_circle";
+ str = str.slice(1);
+ break;
+ }
+ let stroke = "normal";
+ if (str.includes("=")) {
+ stroke = "thick";
+ }
+ if (str.includes(".")) {
+ stroke = "dotted";
+ }
+ return { type, stroke };
+};
+const countChar = (char, str) => {
+ const length = str.length;
+ let count = 0;
+ for (let i = 0; i < length; ++i) {
+ if (str[i] === char) {
+ ++count;
+ }
+ }
+ return count;
+};
+const destructEndLink = (_str) => {
+ const str = _str.trim();
+ let line = str.slice(0, -1);
+ let type = "arrow_open";
+ switch (str.slice(-1)) {
+ case "x":
+ type = "arrow_cross";
+ if (str[0] === "x") {
+ type = "double_" + type;
+ line = line.slice(1);
+ }
+ break;
+ case ">":
+ type = "arrow_point";
+ if (str[0] === "<") {
+ type = "double_" + type;
+ line = line.slice(1);
+ }
+ break;
+ case "o":
+ type = "arrow_circle";
+ if (str[0] === "o") {
+ type = "double_" + type;
+ line = line.slice(1);
+ }
+ break;
+ }
+ let stroke = "normal";
+ let length = line.length - 1;
+ if (line[0] === "=") {
+ stroke = "thick";
+ }
+ if (line[0] === "~") {
+ stroke = "invisible";
+ }
+ let dots = countChar(".", line);
+ if (dots) {
+ stroke = "dotted";
+ length = dots;
+ }
+ return { type, stroke, length };
+};
+const destructLink = (_str, _startStr) => {
+ const info = destructEndLink(_str);
+ let startInfo;
+ if (_startStr) {
+ startInfo = destructStartLink(_startStr);
+ if (startInfo.stroke !== info.stroke) {
+ return { type: "INVALID", stroke: "INVALID" };
+ }
+ if (startInfo.type === "arrow_open") {
+ startInfo.type = info.type;
+ } else {
+ if (startInfo.type !== info.type) {
+ return { type: "INVALID", stroke: "INVALID" };
+ }
+ startInfo.type = "double_" + startInfo.type;
+ }
+ if (startInfo.type === "double_arrow") {
+ startInfo.type = "double_arrow_point";
+ }
+ startInfo.length = info.length;
+ return startInfo;
+ }
+ return info;
+};
+const exists = (allSgs, _id) => {
+ let res = false;
+ allSgs.forEach((sg) => {
+ const pos = sg.nodes.indexOf(_id);
+ if (pos >= 0) {
+ res = true;
+ }
+ });
+ return res;
+};
+const makeUniq = (sg, allSubgraphs) => {
+ const res = [];
+ sg.nodes.forEach((_id, pos) => {
+ if (!exists(allSubgraphs, _id)) {
+ res.push(sg.nodes[pos]);
+ }
+ });
+ return { nodes: res };
+};
+const lex = {
+ firstGraph
+};
+const flowDb = {
+ defaultConfig: () => defaultConfig.flowchart,
+ setAccTitle,
+ getAccTitle,
+ getAccDescription,
+ setAccDescription,
+ addVertex,
+ lookUpDomId,
+ addLink,
+ updateLinkInterpolate,
+ updateLink,
+ addClass,
+ setDirection,
+ setClass,
+ setTooltip,
+ getTooltip,
+ setClickEvent,
+ setLink,
+ bindFunctions,
+ getDirection,
+ getVertices,
+ getEdges,
+ getClasses,
+ clear,
+ setGen,
+ defaultStyle,
+ addSubGraph,
+ getDepthFirstPos,
+ indexNodes,
+ getSubGraphs,
+ destructLink,
+ lex,
+ exists,
+ makeUniq,
+ setDiagramTitle,
+ getDiagramTitle
+};
+const db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
+ __proto__: null,
+ addClass,
+ addLink,
+ addSingleLink,
+ addSubGraph,
+ addVertex,
+ bindFunctions,
+ clear,
+ default: flowDb,
+ defaultStyle,
+ destructLink,
+ firstGraph,
+ getClasses,
+ getDepthFirstPos,
+ getDirection,
+ getEdges,
+ getSubGraphs,
+ getTooltip,
+ getVertices,
+ indexNodes,
+ lex,
+ lookUpDomId,
+ setClass,
+ setClickEvent,
+ setDirection,
+ setGen,
+ setLink,
+ updateLink,
+ updateLinkInterpolate
+}, Symbol.toStringTag, { value: "Module" }));
+
+export { db as d, flowDb as f, parser$1 as p };
diff --git a/libs/marked/flowDiagram-b222e15a-BK68zTn6.js b/libs/marked/flowDiagram-b222e15a-BK68zTn6.js
new file mode 100644
index 0000000..c032238
--- /dev/null
+++ b/libs/marked/flowDiagram-b222e15a-BK68zTn6.js
@@ -0,0 +1,1583 @@
+import { p as parser$1, f as flowDb } from './flowDb-c1833063-Df5kDQr4.js';
+import { h as has, f as forEach, G as Graph } from './graph-KZW2Npeo.js';
+import { h as select, n as curveLinear, o as getStylesFromArray, p as evaluate, c as getConfig, r as renderKatex, j as common$1, l as log$1, q as interpolateToCurve, t as setupGraphViewbox$1 } from './index-Bd_FDXSq.js';
+import { u as uniqueId, r as range, p as pick, l as layout, d as defaults } from './layout-BnytXFfq.js';
+import { a as applyStyle, b as addHtmlLabel, i as isSubgraph, c as applyTransition, e as edgeToId, d as applyClass, f as flowRendererV2, g as flowStyles, s as selectAll } from './styles-483fbfea-DDPjh658.js';
+import { l as line } from './line-DUwhS6kk.js';
+import './index-01f381cb-BCBEZMaa.js';
+import './clone-B-QllgkM.js';
+import './edges-066a5561-Bqw9g7uz.js';
+import './createText-ca0c5216-B9KlDTE8.js';
+import './channel-BxFDB0yY.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+
+function responseText(response) {
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
+ return response.text();
+}
+
+function text(input, init) {
+ return fetch(input, init).then(responseText);
+}
+
+function parser(type) {
+ return (input, init) => text(input, init)
+ .then(text => (new DOMParser).parseFromString(text, type));
+}
+
+var svg = parser("image/svg+xml");
+
+var arrows = {
+ normal,
+ vee,
+ undirected,
+};
+
+function setArrows(value) {
+ arrows = value;
+}
+
+function normal(parent, id, edge, type) {
+ var marker = parent
+ .append('marker')
+ .attr('id', id)
+ .attr('viewBox', '0 0 10 10')
+ .attr('refX', 9)
+ .attr('refY', 5)
+ .attr('markerUnits', 'strokeWidth')
+ .attr('markerWidth', 8)
+ .attr('markerHeight', 6)
+ .attr('orient', 'auto');
+
+ var path = marker
+ .append('path')
+ .attr('d', 'M 0 0 L 10 5 L 0 10 z')
+ .style('stroke-width', 1)
+ .style('stroke-dasharray', '1,0');
+ applyStyle(path, edge[type + 'Style']);
+ if (edge[type + 'Class']) {
+ path.attr('class', edge[type + 'Class']);
+ }
+}
+
+function vee(parent, id, edge, type) {
+ var marker = parent
+ .append('marker')
+ .attr('id', id)
+ .attr('viewBox', '0 0 10 10')
+ .attr('refX', 9)
+ .attr('refY', 5)
+ .attr('markerUnits', 'strokeWidth')
+ .attr('markerWidth', 8)
+ .attr('markerHeight', 6)
+ .attr('orient', 'auto');
+
+ var path = marker
+ .append('path')
+ .attr('d', 'M 0 0 L 10 5 L 0 10 L 4 5 z')
+ .style('stroke-width', 1)
+ .style('stroke-dasharray', '1,0');
+ applyStyle(path, edge[type + 'Style']);
+ if (edge[type + 'Class']) {
+ path.attr('class', edge[type + 'Class']);
+ }
+}
+
+function undirected(parent, id, edge, type) {
+ var marker = parent
+ .append('marker')
+ .attr('id', id)
+ .attr('viewBox', '0 0 10 10')
+ .attr('refX', 9)
+ .attr('refY', 5)
+ .attr('markerUnits', 'strokeWidth')
+ .attr('markerWidth', 8)
+ .attr('markerHeight', 6)
+ .attr('orient', 'auto');
+
+ var path = marker
+ .append('path')
+ .attr('d', 'M 0 5 L 10 5')
+ .style('stroke-width', 1)
+ .style('stroke-dasharray', '1,0');
+ applyStyle(path, edge[type + 'Style']);
+ if (edge[type + 'Class']) {
+ path.attr('class', edge[type + 'Class']);
+ }
+}
+
+function addSVGLabel(root, node) {
+ var domNode = root;
+
+ domNode.node().appendChild(node.label);
+
+ applyStyle(domNode, node.labelStyle);
+
+ return domNode;
+}
+
+/*
+ * Attaches a text label to the specified root. Handles escape sequences.
+ */
+function addTextLabel(root, node) {
+ var domNode = root.append('text');
+
+ var lines = processEscapeSequences(node.label).split('\n');
+ for (var i = 0; i < lines.length; i++) {
+ domNode
+ .append('tspan')
+ .attr('xml:space', 'preserve')
+ .attr('dy', '1em')
+ .attr('x', '1')
+ .text(lines[i]);
+ }
+
+ applyStyle(domNode, node.labelStyle);
+
+ return domNode;
+}
+
+function processEscapeSequences(text) {
+ var newText = '';
+ var escaped = false;
+ var ch;
+ for (var i = 0; i < text.length; ++i) {
+ ch = text[i];
+ if (escaped) {
+ switch (ch) {
+ case 'n':
+ newText += '\n';
+ break;
+ default:
+ newText += ch;
+ }
+ escaped = false;
+ } else if (ch === '\\') {
+ escaped = true;
+ } else {
+ newText += ch;
+ }
+ }
+ return newText;
+}
+
+function addLabel(root, node, location) {
+ var label = node.label;
+ var labelSvg = root.append('g');
+
+ // Allow the label to be a string, a function that returns a DOM element, or
+ // a DOM element itself.
+ if (node.labelType === 'svg') {
+ addSVGLabel(labelSvg, node);
+ } else if (typeof label !== 'string' || node.labelType === 'html') {
+ addHtmlLabel(labelSvg, node);
+ } else {
+ addTextLabel(labelSvg, node);
+ }
+
+ var labelBBox = labelSvg.node().getBBox();
+ var y;
+ switch (location) {
+ case 'top':
+ y = -node.height / 2;
+ break;
+ case 'bottom':
+ y = node.height / 2 - labelBBox.height;
+ break;
+ default:
+ y = -labelBBox.height / 2;
+ }
+ labelSvg.attr('transform', 'translate(' + -labelBBox.width / 2 + ',' + y + ')');
+
+ return labelSvg;
+}
+
+var createClusters = function (selection, g) {
+ var clusters = g.nodes().filter(function (v) {
+ return isSubgraph(g, v);
+ });
+ var svgClusters = selection.selectAll('g.cluster').data(clusters, function (v) {
+ return v;
+ });
+
+ applyTransition(svgClusters.exit(), g).style('opacity', 0).remove();
+
+ var enterSelection = svgClusters
+ .enter()
+ .append('g')
+ .attr('class', 'cluster')
+ .attr('id', function (v) {
+ var node = g.node(v);
+ return node.id;
+ })
+ .style('opacity', 0)
+ .each(function (v) {
+ var node = g.node(v);
+ var thisGroup = select(this);
+ select(this).append('rect');
+ var labelGroup = thisGroup.append('g').attr('class', 'label');
+ addLabel(labelGroup, node, node.clusterLabelPos);
+ });
+
+ svgClusters = svgClusters.merge(enterSelection);
+
+ svgClusters = applyTransition(svgClusters, g).style('opacity', 1);
+
+ svgClusters.selectAll('rect').each(function (c) {
+ var node = g.node(c);
+ var domCluster = select(this);
+ applyStyle(domCluster, node.style);
+ });
+
+ return svgClusters;
+};
+
+function setCreateClusters(value) {
+ createClusters = value;
+}
+
+let createEdgeLabels = function (selection, g) {
+ var svgEdgeLabels = selection
+ .selectAll('g.edgeLabel')
+ .data(g.edges(), function (e) {
+ return edgeToId(e);
+ })
+ .classed('update', true);
+
+ svgEdgeLabels.exit().remove();
+ svgEdgeLabels.enter().append('g').classed('edgeLabel', true).style('opacity', 0);
+
+ svgEdgeLabels = selection.selectAll('g.edgeLabel');
+
+ svgEdgeLabels.each(function (e) {
+ var root = select(this);
+ root.select('.label').remove();
+ var edge = g.edge(e);
+ var label = addLabel(root, g.edge(e), 0).classed('label', true);
+ var bbox = label.node().getBBox();
+
+ if (edge.labelId) {
+ label.attr('id', edge.labelId);
+ }
+ if (!has(edge, 'width')) {
+ edge.width = bbox.width;
+ }
+ if (!has(edge, 'height')) {
+ edge.height = bbox.height;
+ }
+ });
+
+ var exitSelection;
+
+ if (svgEdgeLabels.exit) {
+ exitSelection = svgEdgeLabels.exit();
+ } else {
+ exitSelection = svgEdgeLabels.selectAll(null); // empty selection
+ }
+
+ applyTransition(exitSelection, g).style('opacity', 0).remove();
+
+ return svgEdgeLabels;
+};
+
+function setCreateEdgeLabels(value) {
+ createEdgeLabels = value;
+}
+
+function intersectNode(node, point) {
+ return node.intersect(point);
+}
+
+var createEdgePaths = function (selection, g, arrows) {
+ var previousPaths = selection
+ .selectAll('g.edgePath')
+ .data(g.edges(), function (e) {
+ return edgeToId(e);
+ })
+ .classed('update', true);
+
+ var newPaths = enter(previousPaths, g);
+ exit(previousPaths, g);
+
+ var svgPaths = previousPaths.merge !== undefined ? previousPaths.merge(newPaths) : previousPaths;
+ applyTransition(svgPaths, g).style('opacity', 1);
+
+ // Save DOM element in the path group, and set ID and class
+ svgPaths.each(function (e) {
+ var domEdge = select(this);
+ var edge = g.edge(e);
+ edge.elem = this;
+
+ if (edge.id) {
+ domEdge.attr('id', edge.id);
+ }
+
+ applyClass(
+ domEdge,
+ edge['class'],
+ (domEdge.classed('update') ? 'update ' : '') + 'edgePath'
+ );
+ });
+
+ svgPaths.selectAll('path.path').each(function (e) {
+ var edge = g.edge(e);
+ edge.arrowheadId = uniqueId('arrowhead');
+
+ var domEdge = select(this)
+ .attr('marker-end', function () {
+ return 'url(' + makeFragmentRef(location.href, edge.arrowheadId) + ')';
+ })
+ .style('fill', 'none');
+
+ applyTransition(domEdge, g).attr('d', function (e) {
+ return calcPoints(g, e);
+ });
+
+ applyStyle(domEdge, edge.style);
+ });
+
+ svgPaths.selectAll('defs *').remove();
+ svgPaths.selectAll('defs').each(function (e) {
+ var edge = g.edge(e);
+ var arrowhead = arrows[edge.arrowhead];
+ arrowhead(select(this), edge.arrowheadId, edge, 'arrowhead');
+ });
+
+ return svgPaths;
+};
+
+function setCreateEdgePaths(value) {
+ createEdgePaths = value;
+}
+
+function makeFragmentRef(url, fragmentId) {
+ var baseUrl = url.split('#')[0];
+ return baseUrl + '#' + fragmentId;
+}
+
+function calcPoints(g, e) {
+ var edge = g.edge(e);
+ var tail = g.node(e.v);
+ var head = g.node(e.w);
+ var points = edge.points.slice(1, edge.points.length - 1);
+ points.unshift(intersectNode(tail, points[0]));
+ points.push(intersectNode(head, points[points.length - 1]));
+
+ return createLine(edge, points);
+}
+
+function createLine(edge, points) {
+ // @ts-expect-error
+ var line$1 = (line || svg.line)()
+ .x(function (d) {
+ return d.x;
+ })
+ .y(function (d) {
+ return d.y;
+ });
+
+ (line$1.curve || line$1.interpolate)(edge.curve);
+
+ return line$1(points);
+}
+
+function getCoords(elem) {
+ var bbox = elem.getBBox();
+ var matrix = elem.ownerSVGElement
+ .getScreenCTM()
+ .inverse()
+ .multiply(elem.getScreenCTM())
+ .translate(bbox.width / 2, bbox.height / 2);
+ return { x: matrix.e, y: matrix.f };
+}
+
+function enter(svgPaths, g) {
+ var svgPathsEnter = svgPaths.enter().append('g').attr('class', 'edgePath').style('opacity', 0);
+ svgPathsEnter
+ .append('path')
+ .attr('class', 'path')
+ .attr('d', function (e) {
+ var edge = g.edge(e);
+ var sourceElem = g.node(e.v).elem;
+ var points = range(edge.points.length).map(function () {
+ return getCoords(sourceElem);
+ });
+ return createLine(edge, points);
+ });
+ svgPathsEnter.append('defs');
+ return svgPathsEnter;
+}
+
+function exit(svgPaths, g) {
+ var svgPathExit = svgPaths.exit();
+ applyTransition(svgPathExit, g).style('opacity', 0).remove();
+}
+
+var createNodes = function (selection, g, shapes) {
+ var simpleNodes = g.nodes().filter(function (v) {
+ return !isSubgraph(g, v);
+ });
+ var svgNodes = selection
+ .selectAll('g.node')
+ .data(simpleNodes, function (v) {
+ return v;
+ })
+ .classed('update', true);
+
+ svgNodes.exit().remove();
+
+ svgNodes.enter().append('g').attr('class', 'node').style('opacity', 0);
+
+ svgNodes = selection.selectAll('g.node');
+
+ svgNodes.each(function (v) {
+ var node = g.node(v);
+ var thisGroup = select(this);
+ applyClass(
+ thisGroup,
+ node['class'],
+ (thisGroup.classed('update') ? 'update ' : '') + 'node'
+ );
+
+ thisGroup.select('g.label').remove();
+ var labelGroup = thisGroup.append('g').attr('class', 'label');
+ var labelDom = addLabel(labelGroup, node);
+ var shape = shapes[node.shape];
+ var bbox = pick(labelDom.node().getBBox(), 'width', 'height');
+
+ node.elem = this;
+
+ if (node.id) {
+ thisGroup.attr('id', node.id);
+ }
+ if (node.labelId) {
+ labelGroup.attr('id', node.labelId);
+ }
+
+ if (has(node, 'width')) {
+ bbox.width = node.width;
+ }
+ if (has(node, 'height')) {
+ bbox.height = node.height;
+ }
+
+ bbox.width += node.paddingLeft + node.paddingRight;
+ bbox.height += node.paddingTop + node.paddingBottom;
+ labelGroup.attr(
+ 'transform',
+ 'translate(' +
+ (node.paddingLeft - node.paddingRight) / 2 +
+ ',' +
+ (node.paddingTop - node.paddingBottom) / 2 +
+ ')'
+ );
+
+ var root = select(this);
+ root.select('.label-container').remove();
+ var shapeSvg = shape(root, bbox, node).classed('label-container', true);
+ applyStyle(shapeSvg, node.style);
+
+ var shapeBBox = shapeSvg.node().getBBox();
+ node.width = shapeBBox.width;
+ node.height = shapeBBox.height;
+ });
+
+ var exitSelection;
+
+ if (svgNodes.exit) {
+ exitSelection = svgNodes.exit();
+ } else {
+ exitSelection = svgNodes.selectAll(null); // empty selection
+ }
+
+ applyTransition(exitSelection, g).style('opacity', 0).remove();
+
+ return svgNodes;
+};
+
+function setCreateNodes(value) {
+ createNodes = value;
+}
+
+function positionClusters(selection, g) {
+ var created = selection.filter(function () {
+ return !select(this).classed('update');
+ });
+
+ function translate(v) {
+ var node = g.node(v);
+ return 'translate(' + node.x + ',' + node.y + ')';
+ }
+
+ created.attr('transform', translate);
+
+ applyTransition(selection, g).style('opacity', 1).attr('transform', translate);
+
+ applyTransition(created.selectAll('rect'), g)
+ .attr('width', function (v) {
+ return g.node(v).width;
+ })
+ .attr('height', function (v) {
+ return g.node(v).height;
+ })
+ .attr('x', function (v) {
+ var node = g.node(v);
+ return -node.width / 2;
+ })
+ .attr('y', function (v) {
+ var node = g.node(v);
+ return -node.height / 2;
+ });
+}
+
+function positionEdgeLabels(selection, g) {
+ var created = selection.filter(function () {
+ return !select(this).classed('update');
+ });
+
+ function translate(e) {
+ var edge = g.edge(e);
+ return has(edge, 'x') ? 'translate(' + edge.x + ',' + edge.y + ')' : '';
+ }
+
+ created.attr('transform', translate);
+
+ applyTransition(selection, g).style('opacity', 1).attr('transform', translate);
+}
+
+function positionNodes(selection, g) {
+ var created = selection.filter(function () {
+ return !select(this).classed('update');
+ });
+
+ function translate(v) {
+ var node = g.node(v);
+ return 'translate(' + node.x + ',' + node.y + ')';
+ }
+
+ created.attr('transform', translate);
+
+ applyTransition(selection, g).style('opacity', 1).attr('transform', translate);
+}
+
+function intersectEllipse(node, rx, ry, point) {
+ // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
+
+ var cx = node.x;
+ var cy = node.y;
+
+ var px = cx - point.x;
+ var py = cy - point.y;
+
+ var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+
+ var dx = Math.abs((rx * ry * px) / det);
+ if (point.x < cx) {
+ dx = -dx;
+ }
+ var dy = Math.abs((rx * ry * py) / det);
+ if (point.y < cy) {
+ dy = -dy;
+ }
+
+ return { x: cx + dx, y: cy + dy };
+}
+
+function intersectCircle(node, rx, point) {
+ return intersectEllipse(node, rx, rx, point);
+}
+
+/*
+ * Returns the point at which two lines, p and q, intersect or returns
+ * undefined if they do not intersect.
+ */
+function intersectLine(p1, p2, q1, q2) {
+ // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
+ // p7 and p473.
+
+ var a1, a2, b1, b2, c1, c2;
+ var r1, r2, r3, r4;
+ var denom, offset, num;
+ var x, y;
+
+ // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
+ // b1 y + c1 = 0.
+ a1 = p2.y - p1.y;
+ b1 = p1.x - p2.x;
+ c1 = p2.x * p1.y - p1.x * p2.y;
+
+ // Compute r3 and r4.
+ r3 = a1 * q1.x + b1 * q1.y + c1;
+ r4 = a1 * q2.x + b1 * q2.y + c1;
+
+ // Check signs of r3 and r4. If both point 3 and point 4 lie on
+ // same side of line 1, the line segments do not intersect.
+ if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
+ return /*DONT_INTERSECT*/;
+ }
+
+ // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
+ a2 = q2.y - q1.y;
+ b2 = q1.x - q2.x;
+ c2 = q2.x * q1.y - q1.x * q2.y;
+
+ // Compute r1 and r2
+ r1 = a2 * p1.x + b2 * p1.y + c2;
+ r2 = a2 * p2.x + b2 * p2.y + c2;
+
+ // Check signs of r1 and r2. If both point 1 and point 2 lie
+ // on same side of second line segment, the line segments do
+ // not intersect.
+ if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
+ return /*DONT_INTERSECT*/;
+ }
+
+ // Line segments intersect: compute intersection point.
+ denom = a1 * b2 - a2 * b1;
+ if (denom === 0) {
+ return /*COLLINEAR*/;
+ }
+
+ offset = Math.abs(denom / 2);
+
+ // The denom/2 is to get rounding instead of truncating. It
+ // is added or subtracted to the numerator, depending upon the
+ // sign of the numerator.
+ num = b1 * c2 - b2 * c1;
+ x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+
+ num = a2 * c1 - a1 * c2;
+ y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+
+ return { x: x, y: y };
+}
+
+function sameSign(r1, r2) {
+ return r1 * r2 > 0;
+}
+
+/*
+ * Returns the point ({x, y}) at which the point argument intersects with the
+ * node argument assuming that it has the shape specified by polygon.
+ */
+function intersectPolygon(node, polyPoints, point) {
+ var x1 = node.x;
+ var y1 = node.y;
+
+ var intersections = [];
+
+ var minX = Number.POSITIVE_INFINITY;
+ var minY = Number.POSITIVE_INFINITY;
+ polyPoints.forEach(function (entry) {
+ minX = Math.min(minX, entry.x);
+ minY = Math.min(minY, entry.y);
+ });
+
+ var left = x1 - node.width / 2 - minX;
+ var top = y1 - node.height / 2 - minY;
+
+ for (var i = 0; i < polyPoints.length; i++) {
+ var p1 = polyPoints[i];
+ var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+ var intersect = intersectLine(
+ node,
+ point,
+ { x: left + p1.x, y: top + p1.y },
+ { x: left + p2.x, y: top + p2.y }
+ );
+ if (intersect) {
+ intersections.push(intersect);
+ }
+ }
+
+ if (!intersections.length) {
+ console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
+ return node;
+ }
+
+ if (intersections.length > 1) {
+ // More intersections, find the one nearest to edge end point
+ intersections.sort(function (p, q) {
+ var pdx = p.x - point.x;
+ var pdy = p.y - point.y;
+ var distp = Math.sqrt(pdx * pdx + pdy * pdy);
+
+ var qdx = q.x - point.x;
+ var qdy = q.y - point.y;
+ var distq = Math.sqrt(qdx * qdx + qdy * qdy);
+
+ return distp < distq ? -1 : distp === distq ? 0 : 1;
+ });
+ }
+ return intersections[0];
+}
+
+function intersectRect(node, point) {
+ var x = node.x;
+ var y = node.y;
+
+ // Rectangle intersection algorithm from:
+ // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
+ var dx = point.x - x;
+ var dy = point.y - y;
+ var w = node.width / 2;
+ var h = node.height / 2;
+
+ var sx, sy;
+ if (Math.abs(dy) * w > Math.abs(dx) * h) {
+ // Intersection is top or bottom of rect.
+ if (dy < 0) {
+ h = -h;
+ }
+ sx = dy === 0 ? 0 : (h * dx) / dy;
+ sy = h;
+ } else {
+ // Intersection is left or right of rect.
+ if (dx < 0) {
+ w = -w;
+ }
+ sx = w;
+ sy = dx === 0 ? 0 : (w * dy) / dx;
+ }
+
+ return { x: x + sx, y: y + sy };
+}
+
+var shapes = {
+ rect,
+ ellipse,
+ circle,
+ diamond,
+};
+
+function setShapes(value) {
+ shapes = value;
+}
+
+function rect(parent, bbox, node) {
+ var shapeSvg = parent
+ .insert('rect', ':first-child')
+ .attr('rx', node.rx)
+ .attr('ry', node.ry)
+ .attr('x', -bbox.width / 2)
+ .attr('y', -bbox.height / 2)
+ .attr('width', bbox.width)
+ .attr('height', bbox.height);
+
+ node.intersect = function (point) {
+ return intersectRect(node, point);
+ };
+
+ return shapeSvg;
+}
+
+function ellipse(parent, bbox, node) {
+ var rx = bbox.width / 2;
+ var ry = bbox.height / 2;
+ var shapeSvg = parent
+ .insert('ellipse', ':first-child')
+ .attr('x', -bbox.width / 2)
+ .attr('y', -bbox.height / 2)
+ .attr('rx', rx)
+ .attr('ry', ry);
+
+ node.intersect = function (point) {
+ return intersectEllipse(node, rx, ry, point);
+ };
+
+ return shapeSvg;
+}
+
+function circle(parent, bbox, node) {
+ var r = Math.max(bbox.width, bbox.height) / 2;
+ var shapeSvg = parent
+ .insert('circle', ':first-child')
+ .attr('x', -bbox.width / 2)
+ .attr('y', -bbox.height / 2)
+ .attr('r', r);
+
+ node.intersect = function (point) {
+ return intersectCircle(node, r, point);
+ };
+
+ return shapeSvg;
+}
+
+// Circumscribe an ellipse for the bounding box with a diamond shape. I derived
+// the function to calculate the diamond shape from:
+// http://mathforum.org/kb/message.jspa?messageID=3750236
+function diamond(parent, bbox, node) {
+ var w = (bbox.width * Math.SQRT2) / 2;
+ var h = (bbox.height * Math.SQRT2) / 2;
+ var points = [
+ { x: 0, y: -h },
+ { x: -w, y: 0 },
+ { x: 0, y: h },
+ { x: w, y: 0 },
+ ];
+ var shapeSvg = parent.insert('polygon', ':first-child').attr(
+ 'points',
+ points
+ .map(function (p) {
+ return p.x + ',' + p.y;
+ })
+ .join(' ')
+ );
+
+ node.intersect = function (p) {
+ return intersectPolygon(node, points, p);
+ };
+
+ return shapeSvg;
+}
+
+// This design is based on http://bost.ocks.org/mike/chart/.
+function render() {
+ var fn = function (svg, g) {
+ preProcessGraph(g);
+
+ var outputGroup = createOrSelectGroup(svg, 'output');
+ var clustersGroup = createOrSelectGroup(outputGroup, 'clusters');
+ var edgePathsGroup = createOrSelectGroup(outputGroup, 'edgePaths');
+ var edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, 'edgeLabels'), g);
+ var nodes = createNodes(createOrSelectGroup(outputGroup, 'nodes'), g, shapes);
+
+ layout(g);
+
+ positionNodes(nodes, g);
+ positionEdgeLabels(edgeLabels, g);
+ createEdgePaths(edgePathsGroup, g, arrows);
+
+ var clusters = createClusters(clustersGroup, g);
+ positionClusters(clusters, g);
+
+ postProcessGraph(g);
+ };
+
+ fn.createNodes = function (value) {
+ if (!arguments.length) return createNodes;
+ setCreateNodes(value);
+ return fn;
+ };
+
+ fn.createClusters = function (value) {
+ if (!arguments.length) return createClusters;
+ setCreateClusters(value);
+ return fn;
+ };
+
+ fn.createEdgeLabels = function (value) {
+ if (!arguments.length) return createEdgeLabels;
+ setCreateEdgeLabels(value);
+ return fn;
+ };
+
+ fn.createEdgePaths = function (value) {
+ if (!arguments.length) return createEdgePaths;
+ setCreateEdgePaths(value);
+ return fn;
+ };
+
+ fn.shapes = function (value) {
+ if (!arguments.length) return shapes;
+ setShapes(value);
+ return fn;
+ };
+
+ fn.arrows = function (value) {
+ if (!arguments.length) return arrows;
+ setArrows(value);
+ return fn;
+ };
+
+ return fn;
+}
+
+var NODE_DEFAULT_ATTRS = {
+ paddingLeft: 10,
+ paddingRight: 10,
+ paddingTop: 10,
+ paddingBottom: 10,
+ rx: 0,
+ ry: 0,
+ shape: 'rect',
+};
+
+var EDGE_DEFAULT_ATTRS = {
+ arrowhead: 'normal',
+ curve: curveLinear,
+};
+
+function preProcessGraph(g) {
+ g.nodes().forEach(function (v) {
+ var node = g.node(v);
+ if (!has(node, 'label') && !g.children(v).length) {
+ node.label = v;
+ }
+
+ if (has(node, 'paddingX')) {
+ defaults(node, {
+ paddingLeft: node.paddingX,
+ paddingRight: node.paddingX,
+ });
+ }
+
+ if (has(node, 'paddingY')) {
+ defaults(node, {
+ paddingTop: node.paddingY,
+ paddingBottom: node.paddingY,
+ });
+ }
+
+ if (has(node, 'padding')) {
+ defaults(node, {
+ paddingLeft: node.padding,
+ paddingRight: node.padding,
+ paddingTop: node.padding,
+ paddingBottom: node.padding,
+ });
+ }
+
+ defaults(node, NODE_DEFAULT_ATTRS);
+
+ forEach(['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'], function (k) {
+ node[k] = Number(node[k]);
+ });
+
+ // Save dimensions for restore during post-processing
+ if (has(node, 'width')) {
+ node._prevWidth = node.width;
+ }
+ if (has(node, 'height')) {
+ node._prevHeight = node.height;
+ }
+ });
+
+ g.edges().forEach(function (e) {
+ var edge = g.edge(e);
+ if (!has(edge, 'label')) {
+ edge.label = '';
+ }
+ defaults(edge, EDGE_DEFAULT_ATTRS);
+ });
+}
+
+function postProcessGraph(g) {
+ forEach(g.nodes(), function (v) {
+ var node = g.node(v);
+
+ // Restore original dimensions
+ if (has(node, '_prevWidth')) {
+ node.width = node._prevWidth;
+ } else {
+ delete node.width;
+ }
+
+ if (has(node, '_prevHeight')) {
+ node.height = node._prevHeight;
+ } else {
+ delete node.height;
+ }
+
+ delete node._prevWidth;
+ delete node._prevHeight;
+ });
+}
+
+function createOrSelectGroup(root, name) {
+ var selection = root.select('g.' + name);
+ if (selection.empty()) {
+ selection = root.append('g').attr('class', name);
+ }
+ return selection;
+}
+
+function question(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const s = (w + h) * 0.9;
+ const points = [
+ { x: s / 2, y: 0 },
+ { x: s, y: -s / 2 },
+ { x: s / 2, y: -s },
+ { x: 0, y: -s / 2 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, s, s, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function hexagon(parent, bbox, node) {
+ const f = 4;
+ const h = bbox.height;
+ const m = h / f;
+ const w = bbox.width + 2 * m;
+ const points = [
+ { x: m, y: 0 },
+ { x: w - m, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w - m, y: -h },
+ { x: m, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function rect_left_inv_arrow(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: -h / 2, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: -h / 2, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function lean_right(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function lean_left(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: 2 * h / 6, y: 0 },
+ { x: w + h / 6, y: 0 },
+ { x: w - 2 * h / 6, y: -h },
+ { x: -h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function trapezoid(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: 0 },
+ { x: w - h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function inv_trapezoid(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: -2 * h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function rect_right_inv_arrow(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w + h / 2, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w + h / 2, y: -h },
+ { x: 0, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function stadium(parent, bbox, node) {
+ const h = bbox.height;
+ const w = bbox.width + h / 4;
+ const shapeSvg = parent.insert("rect", ":first-child").attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
+ node.intersect = function(point) {
+ return intersectRect(node, point);
+ };
+ return shapeSvg;
+}
+function subroutine(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: 0, y: -h },
+ { x: 0, y: 0 },
+ { x: -8, y: 0 },
+ { x: w + 8, y: 0 },
+ { x: w + 8, y: -h },
+ { x: -8, y: -h },
+ { x: -8, y: 0 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function cylinder(parent, bbox, node) {
+ const w = bbox.width;
+ const rx = w / 2;
+ const ry = rx / (2.5 + w / 50);
+ const h = bbox.height + ry;
+ const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
+ const shapeSvg = parent.attr("label-offset-y", ry).insert("path", ":first-child").attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
+ node.intersect = function(point) {
+ const pos = intersectRect(node, point);
+ const x = pos.x - node.x;
+ if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
+ let y = ry * ry * (1 - x * x / (rx * rx));
+ if (y != 0) {
+ y = Math.sqrt(y);
+ }
+ y = ry - y;
+ if (point.y - node.y > 0) {
+ y = -y;
+ }
+ pos.y += y;
+ }
+ return pos;
+ };
+ return shapeSvg;
+}
+function addToRender(render2) {
+ render2.shapes().question = question;
+ render2.shapes().hexagon = hexagon;
+ render2.shapes().stadium = stadium;
+ render2.shapes().subroutine = subroutine;
+ render2.shapes().cylinder = cylinder;
+ render2.shapes().rect_left_inv_arrow = rect_left_inv_arrow;
+ render2.shapes().lean_right = lean_right;
+ render2.shapes().lean_left = lean_left;
+ render2.shapes().trapezoid = trapezoid;
+ render2.shapes().inv_trapezoid = inv_trapezoid;
+ render2.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
+}
+function addToRenderV2(addShape) {
+ addShape({ question });
+ addShape({ hexagon });
+ addShape({ stadium });
+ addShape({ subroutine });
+ addShape({ cylinder });
+ addShape({ rect_left_inv_arrow });
+ addShape({ lean_right });
+ addShape({ lean_left });
+ addShape({ trapezoid });
+ addShape({ inv_trapezoid });
+ addShape({ rect_right_inv_arrow });
+}
+function insertPolygonShape(parent, w, h, points) {
+ return parent.insert("polygon", ":first-child").attr(
+ "points",
+ points.map(function(d) {
+ return d.x + "," + d.y;
+ }).join(" ")
+ ).attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
+}
+const flowChartShapes = {
+ addToRender,
+ addToRenderV2
+};
+const conf = {};
+const setConf = function(cnf) {
+ const keys = Object.keys(cnf);
+ for (const key of keys) {
+ conf[key] = cnf[key];
+ }
+};
+const addVertices = async function(vert, g, svgId, root, _doc, diagObj) {
+ const svg = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`);
+ const doc = !_doc ? document : _doc;
+ const keys = Object.keys(vert);
+ for (const id of keys) {
+ const vertex = vert[id];
+ let classStr = "default";
+ if (vertex.classes.length > 0) {
+ classStr = vertex.classes.join(" ");
+ }
+ const styles = getStylesFromArray(vertex.styles);
+ let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id;
+ let vertexNode;
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const node = {
+ label: await renderKatex(
+ vertexText.replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell:disable-line
+ (s) => ``
+ ),
+ getConfig()
+ )
+ };
+ vertexNode = addHtmlLabel(svg, node).node();
+ vertexNode.parentNode.removeChild(vertexNode);
+ } else {
+ const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
+ svgLabel.setAttribute("style", styles.labelStyle.replace("color:", "fill:"));
+ const rows = vertexText.split(common$1.lineBreakRegex);
+ for (const row of rows) {
+ const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
+ tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+ tspan.setAttribute("dy", "1em");
+ tspan.setAttribute("x", "1");
+ tspan.textContent = row;
+ svgLabel.appendChild(tspan);
+ }
+ vertexNode = svgLabel;
+ }
+ let radius = 0;
+ let _shape = "";
+ switch (vertex.type) {
+ case "round":
+ radius = 5;
+ _shape = "rect";
+ break;
+ case "square":
+ _shape = "rect";
+ break;
+ case "diamond":
+ _shape = "question";
+ break;
+ case "hexagon":
+ _shape = "hexagon";
+ break;
+ case "odd":
+ _shape = "rect_left_inv_arrow";
+ break;
+ case "lean_right":
+ _shape = "lean_right";
+ break;
+ case "lean_left":
+ _shape = "lean_left";
+ break;
+ case "trapezoid":
+ _shape = "trapezoid";
+ break;
+ case "inv_trapezoid":
+ _shape = "inv_trapezoid";
+ break;
+ case "odd_right":
+ _shape = "rect_left_inv_arrow";
+ break;
+ case "circle":
+ _shape = "circle";
+ break;
+ case "ellipse":
+ _shape = "ellipse";
+ break;
+ case "stadium":
+ _shape = "stadium";
+ break;
+ case "subroutine":
+ _shape = "subroutine";
+ break;
+ case "cylinder":
+ _shape = "cylinder";
+ break;
+ case "group":
+ _shape = "rect";
+ break;
+ default:
+ _shape = "rect";
+ }
+ log$1.warn("Adding node", vertex.id, vertex.domId);
+ g.setNode(diagObj.db.lookUpDomId(vertex.id), {
+ labelType: "svg",
+ labelStyle: styles.labelStyle,
+ shape: _shape,
+ label: vertexNode,
+ rx: radius,
+ ry: radius,
+ class: classStr,
+ style: styles.style,
+ id: diagObj.db.lookUpDomId(vertex.id)
+ });
+ }
+};
+const addEdges = async function(edges, g, diagObj) {
+ let cnt = 0;
+ let defaultStyle;
+ let defaultLabelStyle;
+ if (edges.defaultStyle !== void 0) {
+ const defaultStyles = getStylesFromArray(edges.defaultStyle);
+ defaultStyle = defaultStyles.style;
+ defaultLabelStyle = defaultStyles.labelStyle;
+ }
+ for (const edge of edges) {
+ cnt++;
+ const linkId = "L-" + edge.start + "-" + edge.end;
+ const linkNameStart = "LS-" + edge.start;
+ const linkNameEnd = "LE-" + edge.end;
+ const edgeData = {};
+ if (edge.type === "arrow_open") {
+ edgeData.arrowhead = "none";
+ } else {
+ edgeData.arrowhead = "normal";
+ }
+ let style = "";
+ let labelStyle = "";
+ if (edge.style !== void 0) {
+ const styles = getStylesFromArray(edge.style);
+ style = styles.style;
+ labelStyle = styles.labelStyle;
+ } else {
+ switch (edge.stroke) {
+ case "normal":
+ style = "fill:none";
+ if (defaultStyle !== void 0) {
+ style = defaultStyle;
+ }
+ if (defaultLabelStyle !== void 0) {
+ labelStyle = defaultLabelStyle;
+ }
+ break;
+ case "dotted":
+ style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
+ break;
+ case "thick":
+ style = " stroke-width: 3.5px;fill:none";
+ break;
+ }
+ }
+ edgeData.style = style;
+ edgeData.labelStyle = labelStyle;
+ if (edge.interpolate !== void 0) {
+ edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
+ } else if (edges.defaultInterpolate !== void 0) {
+ edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
+ } else {
+ edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
+ }
+ if (edge.text === void 0) {
+ if (edge.style !== void 0) {
+ edgeData.arrowheadStyle = "fill: #333";
+ }
+ } else {
+ edgeData.arrowheadStyle = "fill: #333";
+ edgeData.labelpos = "c";
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ edgeData.labelType = "html";
+ edgeData.label = `${await renderKatex(
+ edge.text.replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell:disable-line
+ (s) => ``
+ ),
+ getConfig()
+ )}`;
+ } else {
+ edgeData.labelType = "text";
+ edgeData.label = edge.text.replace(common$1.lineBreakRegex, "\n");
+ if (edge.style === void 0) {
+ edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
+ }
+ edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
+ }
+ }
+ edgeData.id = linkId;
+ edgeData.class = linkNameStart + " " + linkNameEnd;
+ edgeData.minlen = edge.length || 1;
+ g.setEdge(diagObj.db.lookUpDomId(edge.start), diagObj.db.lookUpDomId(edge.end), edgeData, cnt);
+ }
+};
+const getClasses = function(text, diagObj) {
+ log$1.info("Extracting classes");
+ return diagObj.db.getClasses();
+};
+const draw = async function(text, id, _version, diagObj) {
+ log$1.info("Drawing flowchart");
+ const { securityLevel, flowchart: conf2 } = getConfig();
+ let sandboxElement;
+ if (securityLevel === "sandbox") {
+ sandboxElement = select("#i" + id);
+ }
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
+ let dir = diagObj.db.getDirection();
+ if (dir === void 0) {
+ dir = "TD";
+ }
+ const nodeSpacing = conf2.nodeSpacing || 50;
+ const rankSpacing = conf2.rankSpacing || 50;
+ const g = new Graph({
+ multigraph: true,
+ compound: true
+ }).setGraph({
+ rankdir: dir,
+ nodesep: nodeSpacing,
+ ranksep: rankSpacing,
+ marginx: 8,
+ marginy: 8
+ }).setDefaultEdgeLabel(function() {
+ return {};
+ });
+ let subG;
+ const subGraphs = diagObj.db.getSubGraphs();
+ for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
+ subG = subGraphs[i2];
+ diagObj.db.addVertex(subG.id, subG.title, "group", void 0, subG.classes);
+ }
+ const vert = diagObj.db.getVertices();
+ log$1.warn("Get vertices", vert);
+ const edges = diagObj.db.getEdges();
+ let i = 0;
+ for (i = subGraphs.length - 1; i >= 0; i--) {
+ subG = subGraphs[i];
+ selectAll("cluster").append("text");
+ for (let j = 0; j < subG.nodes.length; j++) {
+ log$1.warn(
+ "Setting subgraph",
+ subG.nodes[j],
+ diagObj.db.lookUpDomId(subG.nodes[j]),
+ diagObj.db.lookUpDomId(subG.id)
+ );
+ g.setParent(diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));
+ }
+ }
+ await addVertices(vert, g, id, root, doc, diagObj);
+ await addEdges(edges, g, diagObj);
+ const render$1 = new render();
+ flowChartShapes.addToRender(render$1);
+ render$1.arrows().none = function normal(parent, id2, edge, type) {
+ const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
+ const path = marker.append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
+ applyStyle(path, edge[type + "Style"]);
+ };
+ render$1.arrows().normal = function normal(parent, id2) {
+ const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
+ marker.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+ };
+ const svg = root.select(`[id="${id}"]`);
+ const element = root.select("#" + id + " g");
+ render$1(element, g);
+ element.selectAll("g.node").attr("title", function() {
+ return diagObj.db.getTooltip(this.id);
+ });
+ diagObj.db.indexNodes("subGraph" + i);
+ for (i = 0; i < subGraphs.length; i++) {
+ subG = subGraphs[i];
+ if (subG.title !== "undefined") {
+ const clusterRects = doc.querySelectorAll(
+ "#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"] rect'
+ );
+ const clusterEl = doc.querySelectorAll(
+ "#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"]'
+ );
+ const xPos = clusterRects[0].x.baseVal.value;
+ const yPos = clusterRects[0].y.baseVal.value;
+ const _width = clusterRects[0].width.baseVal.value;
+ const cluster = select(clusterEl[0]);
+ const te = cluster.select(".label");
+ te.attr("transform", `translate(${xPos + _width / 2}, ${yPos + 14})`);
+ te.attr("id", id + "Text");
+ for (let j = 0; j < subG.classes.length; j++) {
+ clusterEl[0].classList.add(subG.classes[j]);
+ }
+ }
+ }
+ if (!conf2.htmlLabels) {
+ const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
+ for (const label of labels) {
+ const dim = label.getBBox();
+ const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
+ rect.setAttribute("rx", 0);
+ rect.setAttribute("ry", 0);
+ rect.setAttribute("width", dim.width);
+ rect.setAttribute("height", dim.height);
+ label.insertBefore(rect, label.firstChild);
+ }
+ }
+ setupGraphViewbox$1(g, svg, conf2.diagramPadding, conf2.useMaxWidth);
+ const keys = Object.keys(vert);
+ keys.forEach(function(key) {
+ const vertex = vert[key];
+ if (vertex.link) {
+ const node = root.select("#" + id + ' [id="' + diagObj.db.lookUpDomId(key) + '"]');
+ if (node) {
+ const link = doc.createElementNS("http://www.w3.org/2000/svg", "a");
+ link.setAttributeNS("http://www.w3.org/2000/svg", "class", vertex.classes.join(" "));
+ link.setAttributeNS("http://www.w3.org/2000/svg", "href", vertex.link);
+ link.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener");
+ if (securityLevel === "sandbox") {
+ link.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top");
+ } else if (vertex.linkTarget) {
+ link.setAttributeNS("http://www.w3.org/2000/svg", "target", vertex.linkTarget);
+ }
+ const linkNode = node.insert(function() {
+ return link;
+ }, ":first-child");
+ const shape = node.select(".label-container");
+ if (shape) {
+ linkNode.append(function() {
+ return shape.node();
+ });
+ }
+ const label = node.select(".label");
+ if (label) {
+ linkNode.append(function() {
+ return label.node();
+ });
+ }
+ }
+ }
+ });
+};
+const flowRenderer = {
+ setConf,
+ addVertices,
+ addEdges,
+ getClasses,
+ draw
+};
+const diagram = {
+ parser: parser$1,
+ db: flowDb,
+ renderer: flowRendererV2,
+ styles: flowStyles,
+ init: (cnf) => {
+ if (!cnf.flowchart) {
+ cnf.flowchart = {};
+ }
+ cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
+ flowRenderer.setConf(cnf.flowchart);
+ flowDb.clear();
+ flowDb.setGen("gen-1");
+ }
+};
+
+export { diagram };
diff --git a/libs/marked/flowDiagram-b222e15a-CZXxO4wD.js b/libs/marked/flowDiagram-b222e15a-CZXxO4wD.js
new file mode 100644
index 0000000..9e86ad8
--- /dev/null
+++ b/libs/marked/flowDiagram-b222e15a-CZXxO4wD.js
@@ -0,0 +1,1583 @@
+import { p as parser$1, f as flowDb } from './flowDb-c1833063-C_SlfbWJ.js';
+import { h as has, f as forEach, G as Graph } from './graph-DadsyNmk.js';
+import { h as select, n as curveLinear, o as getStylesFromArray, p as evaluate, c as getConfig, r as renderKatex, j as common$1, l as log$1, q as interpolateToCurve, t as setupGraphViewbox$1 } from './index-CN3YjQ0n.js';
+import { u as uniqueId, r as range, p as pick, l as layout, d as defaults } from './layout-BOZlZI7g.js';
+import { a as applyStyle, b as addHtmlLabel, i as isSubgraph, c as applyTransition, e as edgeToId, d as applyClass, f as flowRendererV2, g as flowStyles, s as selectAll } from './styles-483fbfea-Bj8pmBPH.js';
+import { l as line } from './line-D1aCvau7.js';
+import './index-01f381cb-CDFlKdjO.js';
+import './clone-B4k62NSz.js';
+import './edges-066a5561-a6s42o55.js';
+import './createText-ca0c5216-DF05SDfj.js';
+import './channel-DcrZctv4.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+
+function responseText(response) {
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
+ return response.text();
+}
+
+function text(input, init) {
+ return fetch(input, init).then(responseText);
+}
+
+function parser(type) {
+ return (input, init) => text(input, init)
+ .then(text => (new DOMParser).parseFromString(text, type));
+}
+
+var svg = parser("image/svg+xml");
+
+var arrows = {
+ normal,
+ vee,
+ undirected,
+};
+
+function setArrows(value) {
+ arrows = value;
+}
+
+function normal(parent, id, edge, type) {
+ var marker = parent
+ .append('marker')
+ .attr('id', id)
+ .attr('viewBox', '0 0 10 10')
+ .attr('refX', 9)
+ .attr('refY', 5)
+ .attr('markerUnits', 'strokeWidth')
+ .attr('markerWidth', 8)
+ .attr('markerHeight', 6)
+ .attr('orient', 'auto');
+
+ var path = marker
+ .append('path')
+ .attr('d', 'M 0 0 L 10 5 L 0 10 z')
+ .style('stroke-width', 1)
+ .style('stroke-dasharray', '1,0');
+ applyStyle(path, edge[type + 'Style']);
+ if (edge[type + 'Class']) {
+ path.attr('class', edge[type + 'Class']);
+ }
+}
+
+function vee(parent, id, edge, type) {
+ var marker = parent
+ .append('marker')
+ .attr('id', id)
+ .attr('viewBox', '0 0 10 10')
+ .attr('refX', 9)
+ .attr('refY', 5)
+ .attr('markerUnits', 'strokeWidth')
+ .attr('markerWidth', 8)
+ .attr('markerHeight', 6)
+ .attr('orient', 'auto');
+
+ var path = marker
+ .append('path')
+ .attr('d', 'M 0 0 L 10 5 L 0 10 L 4 5 z')
+ .style('stroke-width', 1)
+ .style('stroke-dasharray', '1,0');
+ applyStyle(path, edge[type + 'Style']);
+ if (edge[type + 'Class']) {
+ path.attr('class', edge[type + 'Class']);
+ }
+}
+
+function undirected(parent, id, edge, type) {
+ var marker = parent
+ .append('marker')
+ .attr('id', id)
+ .attr('viewBox', '0 0 10 10')
+ .attr('refX', 9)
+ .attr('refY', 5)
+ .attr('markerUnits', 'strokeWidth')
+ .attr('markerWidth', 8)
+ .attr('markerHeight', 6)
+ .attr('orient', 'auto');
+
+ var path = marker
+ .append('path')
+ .attr('d', 'M 0 5 L 10 5')
+ .style('stroke-width', 1)
+ .style('stroke-dasharray', '1,0');
+ applyStyle(path, edge[type + 'Style']);
+ if (edge[type + 'Class']) {
+ path.attr('class', edge[type + 'Class']);
+ }
+}
+
+function addSVGLabel(root, node) {
+ var domNode = root;
+
+ domNode.node().appendChild(node.label);
+
+ applyStyle(domNode, node.labelStyle);
+
+ return domNode;
+}
+
+/*
+ * Attaches a text label to the specified root. Handles escape sequences.
+ */
+function addTextLabel(root, node) {
+ var domNode = root.append('text');
+
+ var lines = processEscapeSequences(node.label).split('\n');
+ for (var i = 0; i < lines.length; i++) {
+ domNode
+ .append('tspan')
+ .attr('xml:space', 'preserve')
+ .attr('dy', '1em')
+ .attr('x', '1')
+ .text(lines[i]);
+ }
+
+ applyStyle(domNode, node.labelStyle);
+
+ return domNode;
+}
+
+function processEscapeSequences(text) {
+ var newText = '';
+ var escaped = false;
+ var ch;
+ for (var i = 0; i < text.length; ++i) {
+ ch = text[i];
+ if (escaped) {
+ switch (ch) {
+ case 'n':
+ newText += '\n';
+ break;
+ default:
+ newText += ch;
+ }
+ escaped = false;
+ } else if (ch === '\\') {
+ escaped = true;
+ } else {
+ newText += ch;
+ }
+ }
+ return newText;
+}
+
+function addLabel(root, node, location) {
+ var label = node.label;
+ var labelSvg = root.append('g');
+
+ // Allow the label to be a string, a function that returns a DOM element, or
+ // a DOM element itself.
+ if (node.labelType === 'svg') {
+ addSVGLabel(labelSvg, node);
+ } else if (typeof label !== 'string' || node.labelType === 'html') {
+ addHtmlLabel(labelSvg, node);
+ } else {
+ addTextLabel(labelSvg, node);
+ }
+
+ var labelBBox = labelSvg.node().getBBox();
+ var y;
+ switch (location) {
+ case 'top':
+ y = -node.height / 2;
+ break;
+ case 'bottom':
+ y = node.height / 2 - labelBBox.height;
+ break;
+ default:
+ y = -labelBBox.height / 2;
+ }
+ labelSvg.attr('transform', 'translate(' + -labelBBox.width / 2 + ',' + y + ')');
+
+ return labelSvg;
+}
+
+var createClusters = function (selection, g) {
+ var clusters = g.nodes().filter(function (v) {
+ return isSubgraph(g, v);
+ });
+ var svgClusters = selection.selectAll('g.cluster').data(clusters, function (v) {
+ return v;
+ });
+
+ applyTransition(svgClusters.exit(), g).style('opacity', 0).remove();
+
+ var enterSelection = svgClusters
+ .enter()
+ .append('g')
+ .attr('class', 'cluster')
+ .attr('id', function (v) {
+ var node = g.node(v);
+ return node.id;
+ })
+ .style('opacity', 0)
+ .each(function (v) {
+ var node = g.node(v);
+ var thisGroup = select(this);
+ select(this).append('rect');
+ var labelGroup = thisGroup.append('g').attr('class', 'label');
+ addLabel(labelGroup, node, node.clusterLabelPos);
+ });
+
+ svgClusters = svgClusters.merge(enterSelection);
+
+ svgClusters = applyTransition(svgClusters, g).style('opacity', 1);
+
+ svgClusters.selectAll('rect').each(function (c) {
+ var node = g.node(c);
+ var domCluster = select(this);
+ applyStyle(domCluster, node.style);
+ });
+
+ return svgClusters;
+};
+
+function setCreateClusters(value) {
+ createClusters = value;
+}
+
+let createEdgeLabels = function (selection, g) {
+ var svgEdgeLabels = selection
+ .selectAll('g.edgeLabel')
+ .data(g.edges(), function (e) {
+ return edgeToId(e);
+ })
+ .classed('update', true);
+
+ svgEdgeLabels.exit().remove();
+ svgEdgeLabels.enter().append('g').classed('edgeLabel', true).style('opacity', 0);
+
+ svgEdgeLabels = selection.selectAll('g.edgeLabel');
+
+ svgEdgeLabels.each(function (e) {
+ var root = select(this);
+ root.select('.label').remove();
+ var edge = g.edge(e);
+ var label = addLabel(root, g.edge(e), 0).classed('label', true);
+ var bbox = label.node().getBBox();
+
+ if (edge.labelId) {
+ label.attr('id', edge.labelId);
+ }
+ if (!has(edge, 'width')) {
+ edge.width = bbox.width;
+ }
+ if (!has(edge, 'height')) {
+ edge.height = bbox.height;
+ }
+ });
+
+ var exitSelection;
+
+ if (svgEdgeLabels.exit) {
+ exitSelection = svgEdgeLabels.exit();
+ } else {
+ exitSelection = svgEdgeLabels.selectAll(null); // empty selection
+ }
+
+ applyTransition(exitSelection, g).style('opacity', 0).remove();
+
+ return svgEdgeLabels;
+};
+
+function setCreateEdgeLabels(value) {
+ createEdgeLabels = value;
+}
+
+function intersectNode(node, point) {
+ return node.intersect(point);
+}
+
+var createEdgePaths = function (selection, g, arrows) {
+ var previousPaths = selection
+ .selectAll('g.edgePath')
+ .data(g.edges(), function (e) {
+ return edgeToId(e);
+ })
+ .classed('update', true);
+
+ var newPaths = enter(previousPaths, g);
+ exit(previousPaths, g);
+
+ var svgPaths = previousPaths.merge !== undefined ? previousPaths.merge(newPaths) : previousPaths;
+ applyTransition(svgPaths, g).style('opacity', 1);
+
+ // Save DOM element in the path group, and set ID and class
+ svgPaths.each(function (e) {
+ var domEdge = select(this);
+ var edge = g.edge(e);
+ edge.elem = this;
+
+ if (edge.id) {
+ domEdge.attr('id', edge.id);
+ }
+
+ applyClass(
+ domEdge,
+ edge['class'],
+ (domEdge.classed('update') ? 'update ' : '') + 'edgePath'
+ );
+ });
+
+ svgPaths.selectAll('path.path').each(function (e) {
+ var edge = g.edge(e);
+ edge.arrowheadId = uniqueId('arrowhead');
+
+ var domEdge = select(this)
+ .attr('marker-end', function () {
+ return 'url(' + makeFragmentRef(location.href, edge.arrowheadId) + ')';
+ })
+ .style('fill', 'none');
+
+ applyTransition(domEdge, g).attr('d', function (e) {
+ return calcPoints(g, e);
+ });
+
+ applyStyle(domEdge, edge.style);
+ });
+
+ svgPaths.selectAll('defs *').remove();
+ svgPaths.selectAll('defs').each(function (e) {
+ var edge = g.edge(e);
+ var arrowhead = arrows[edge.arrowhead];
+ arrowhead(select(this), edge.arrowheadId, edge, 'arrowhead');
+ });
+
+ return svgPaths;
+};
+
+function setCreateEdgePaths(value) {
+ createEdgePaths = value;
+}
+
+function makeFragmentRef(url, fragmentId) {
+ var baseUrl = url.split('#')[0];
+ return baseUrl + '#' + fragmentId;
+}
+
+function calcPoints(g, e) {
+ var edge = g.edge(e);
+ var tail = g.node(e.v);
+ var head = g.node(e.w);
+ var points = edge.points.slice(1, edge.points.length - 1);
+ points.unshift(intersectNode(tail, points[0]));
+ points.push(intersectNode(head, points[points.length - 1]));
+
+ return createLine(edge, points);
+}
+
+function createLine(edge, points) {
+ // @ts-expect-error
+ var line$1 = (line || svg.line)()
+ .x(function (d) {
+ return d.x;
+ })
+ .y(function (d) {
+ return d.y;
+ });
+
+ (line$1.curve || line$1.interpolate)(edge.curve);
+
+ return line$1(points);
+}
+
+function getCoords(elem) {
+ var bbox = elem.getBBox();
+ var matrix = elem.ownerSVGElement
+ .getScreenCTM()
+ .inverse()
+ .multiply(elem.getScreenCTM())
+ .translate(bbox.width / 2, bbox.height / 2);
+ return { x: matrix.e, y: matrix.f };
+}
+
+function enter(svgPaths, g) {
+ var svgPathsEnter = svgPaths.enter().append('g').attr('class', 'edgePath').style('opacity', 0);
+ svgPathsEnter
+ .append('path')
+ .attr('class', 'path')
+ .attr('d', function (e) {
+ var edge = g.edge(e);
+ var sourceElem = g.node(e.v).elem;
+ var points = range(edge.points.length).map(function () {
+ return getCoords(sourceElem);
+ });
+ return createLine(edge, points);
+ });
+ svgPathsEnter.append('defs');
+ return svgPathsEnter;
+}
+
+function exit(svgPaths, g) {
+ var svgPathExit = svgPaths.exit();
+ applyTransition(svgPathExit, g).style('opacity', 0).remove();
+}
+
+var createNodes = function (selection, g, shapes) {
+ var simpleNodes = g.nodes().filter(function (v) {
+ return !isSubgraph(g, v);
+ });
+ var svgNodes = selection
+ .selectAll('g.node')
+ .data(simpleNodes, function (v) {
+ return v;
+ })
+ .classed('update', true);
+
+ svgNodes.exit().remove();
+
+ svgNodes.enter().append('g').attr('class', 'node').style('opacity', 0);
+
+ svgNodes = selection.selectAll('g.node');
+
+ svgNodes.each(function (v) {
+ var node = g.node(v);
+ var thisGroup = select(this);
+ applyClass(
+ thisGroup,
+ node['class'],
+ (thisGroup.classed('update') ? 'update ' : '') + 'node'
+ );
+
+ thisGroup.select('g.label').remove();
+ var labelGroup = thisGroup.append('g').attr('class', 'label');
+ var labelDom = addLabel(labelGroup, node);
+ var shape = shapes[node.shape];
+ var bbox = pick(labelDom.node().getBBox(), 'width', 'height');
+
+ node.elem = this;
+
+ if (node.id) {
+ thisGroup.attr('id', node.id);
+ }
+ if (node.labelId) {
+ labelGroup.attr('id', node.labelId);
+ }
+
+ if (has(node, 'width')) {
+ bbox.width = node.width;
+ }
+ if (has(node, 'height')) {
+ bbox.height = node.height;
+ }
+
+ bbox.width += node.paddingLeft + node.paddingRight;
+ bbox.height += node.paddingTop + node.paddingBottom;
+ labelGroup.attr(
+ 'transform',
+ 'translate(' +
+ (node.paddingLeft - node.paddingRight) / 2 +
+ ',' +
+ (node.paddingTop - node.paddingBottom) / 2 +
+ ')'
+ );
+
+ var root = select(this);
+ root.select('.label-container').remove();
+ var shapeSvg = shape(root, bbox, node).classed('label-container', true);
+ applyStyle(shapeSvg, node.style);
+
+ var shapeBBox = shapeSvg.node().getBBox();
+ node.width = shapeBBox.width;
+ node.height = shapeBBox.height;
+ });
+
+ var exitSelection;
+
+ if (svgNodes.exit) {
+ exitSelection = svgNodes.exit();
+ } else {
+ exitSelection = svgNodes.selectAll(null); // empty selection
+ }
+
+ applyTransition(exitSelection, g).style('opacity', 0).remove();
+
+ return svgNodes;
+};
+
+function setCreateNodes(value) {
+ createNodes = value;
+}
+
+function positionClusters(selection, g) {
+ var created = selection.filter(function () {
+ return !select(this).classed('update');
+ });
+
+ function translate(v) {
+ var node = g.node(v);
+ return 'translate(' + node.x + ',' + node.y + ')';
+ }
+
+ created.attr('transform', translate);
+
+ applyTransition(selection, g).style('opacity', 1).attr('transform', translate);
+
+ applyTransition(created.selectAll('rect'), g)
+ .attr('width', function (v) {
+ return g.node(v).width;
+ })
+ .attr('height', function (v) {
+ return g.node(v).height;
+ })
+ .attr('x', function (v) {
+ var node = g.node(v);
+ return -node.width / 2;
+ })
+ .attr('y', function (v) {
+ var node = g.node(v);
+ return -node.height / 2;
+ });
+}
+
+function positionEdgeLabels(selection, g) {
+ var created = selection.filter(function () {
+ return !select(this).classed('update');
+ });
+
+ function translate(e) {
+ var edge = g.edge(e);
+ return has(edge, 'x') ? 'translate(' + edge.x + ',' + edge.y + ')' : '';
+ }
+
+ created.attr('transform', translate);
+
+ applyTransition(selection, g).style('opacity', 1).attr('transform', translate);
+}
+
+function positionNodes(selection, g) {
+ var created = selection.filter(function () {
+ return !select(this).classed('update');
+ });
+
+ function translate(v) {
+ var node = g.node(v);
+ return 'translate(' + node.x + ',' + node.y + ')';
+ }
+
+ created.attr('transform', translate);
+
+ applyTransition(selection, g).style('opacity', 1).attr('transform', translate);
+}
+
+function intersectEllipse(node, rx, ry, point) {
+ // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
+
+ var cx = node.x;
+ var cy = node.y;
+
+ var px = cx - point.x;
+ var py = cy - point.y;
+
+ var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
+
+ var dx = Math.abs((rx * ry * px) / det);
+ if (point.x < cx) {
+ dx = -dx;
+ }
+ var dy = Math.abs((rx * ry * py) / det);
+ if (point.y < cy) {
+ dy = -dy;
+ }
+
+ return { x: cx + dx, y: cy + dy };
+}
+
+function intersectCircle(node, rx, point) {
+ return intersectEllipse(node, rx, rx, point);
+}
+
+/*
+ * Returns the point at which two lines, p and q, intersect or returns
+ * undefined if they do not intersect.
+ */
+function intersectLine(p1, p2, q1, q2) {
+ // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
+ // p7 and p473.
+
+ var a1, a2, b1, b2, c1, c2;
+ var r1, r2, r3, r4;
+ var denom, offset, num;
+ var x, y;
+
+ // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
+ // b1 y + c1 = 0.
+ a1 = p2.y - p1.y;
+ b1 = p1.x - p2.x;
+ c1 = p2.x * p1.y - p1.x * p2.y;
+
+ // Compute r3 and r4.
+ r3 = a1 * q1.x + b1 * q1.y + c1;
+ r4 = a1 * q2.x + b1 * q2.y + c1;
+
+ // Check signs of r3 and r4. If both point 3 and point 4 lie on
+ // same side of line 1, the line segments do not intersect.
+ if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
+ return /*DONT_INTERSECT*/;
+ }
+
+ // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
+ a2 = q2.y - q1.y;
+ b2 = q1.x - q2.x;
+ c2 = q2.x * q1.y - q1.x * q2.y;
+
+ // Compute r1 and r2
+ r1 = a2 * p1.x + b2 * p1.y + c2;
+ r2 = a2 * p2.x + b2 * p2.y + c2;
+
+ // Check signs of r1 and r2. If both point 1 and point 2 lie
+ // on same side of second line segment, the line segments do
+ // not intersect.
+ if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
+ return /*DONT_INTERSECT*/;
+ }
+
+ // Line segments intersect: compute intersection point.
+ denom = a1 * b2 - a2 * b1;
+ if (denom === 0) {
+ return /*COLLINEAR*/;
+ }
+
+ offset = Math.abs(denom / 2);
+
+ // The denom/2 is to get rounding instead of truncating. It
+ // is added or subtracted to the numerator, depending upon the
+ // sign of the numerator.
+ num = b1 * c2 - b2 * c1;
+ x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+
+ num = a2 * c1 - a1 * c2;
+ y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
+
+ return { x: x, y: y };
+}
+
+function sameSign(r1, r2) {
+ return r1 * r2 > 0;
+}
+
+/*
+ * Returns the point ({x, y}) at which the point argument intersects with the
+ * node argument assuming that it has the shape specified by polygon.
+ */
+function intersectPolygon(node, polyPoints, point) {
+ var x1 = node.x;
+ var y1 = node.y;
+
+ var intersections = [];
+
+ var minX = Number.POSITIVE_INFINITY;
+ var minY = Number.POSITIVE_INFINITY;
+ polyPoints.forEach(function (entry) {
+ minX = Math.min(minX, entry.x);
+ minY = Math.min(minY, entry.y);
+ });
+
+ var left = x1 - node.width / 2 - minX;
+ var top = y1 - node.height / 2 - minY;
+
+ for (var i = 0; i < polyPoints.length; i++) {
+ var p1 = polyPoints[i];
+ var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
+ var intersect = intersectLine(
+ node,
+ point,
+ { x: left + p1.x, y: top + p1.y },
+ { x: left + p2.x, y: top + p2.y }
+ );
+ if (intersect) {
+ intersections.push(intersect);
+ }
+ }
+
+ if (!intersections.length) {
+ console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
+ return node;
+ }
+
+ if (intersections.length > 1) {
+ // More intersections, find the one nearest to edge end point
+ intersections.sort(function (p, q) {
+ var pdx = p.x - point.x;
+ var pdy = p.y - point.y;
+ var distp = Math.sqrt(pdx * pdx + pdy * pdy);
+
+ var qdx = q.x - point.x;
+ var qdy = q.y - point.y;
+ var distq = Math.sqrt(qdx * qdx + qdy * qdy);
+
+ return distp < distq ? -1 : distp === distq ? 0 : 1;
+ });
+ }
+ return intersections[0];
+}
+
+function intersectRect(node, point) {
+ var x = node.x;
+ var y = node.y;
+
+ // Rectangle intersection algorithm from:
+ // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
+ var dx = point.x - x;
+ var dy = point.y - y;
+ var w = node.width / 2;
+ var h = node.height / 2;
+
+ var sx, sy;
+ if (Math.abs(dy) * w > Math.abs(dx) * h) {
+ // Intersection is top or bottom of rect.
+ if (dy < 0) {
+ h = -h;
+ }
+ sx = dy === 0 ? 0 : (h * dx) / dy;
+ sy = h;
+ } else {
+ // Intersection is left or right of rect.
+ if (dx < 0) {
+ w = -w;
+ }
+ sx = w;
+ sy = dx === 0 ? 0 : (w * dy) / dx;
+ }
+
+ return { x: x + sx, y: y + sy };
+}
+
+var shapes = {
+ rect,
+ ellipse,
+ circle,
+ diamond,
+};
+
+function setShapes(value) {
+ shapes = value;
+}
+
+function rect(parent, bbox, node) {
+ var shapeSvg = parent
+ .insert('rect', ':first-child')
+ .attr('rx', node.rx)
+ .attr('ry', node.ry)
+ .attr('x', -bbox.width / 2)
+ .attr('y', -bbox.height / 2)
+ .attr('width', bbox.width)
+ .attr('height', bbox.height);
+
+ node.intersect = function (point) {
+ return intersectRect(node, point);
+ };
+
+ return shapeSvg;
+}
+
+function ellipse(parent, bbox, node) {
+ var rx = bbox.width / 2;
+ var ry = bbox.height / 2;
+ var shapeSvg = parent
+ .insert('ellipse', ':first-child')
+ .attr('x', -bbox.width / 2)
+ .attr('y', -bbox.height / 2)
+ .attr('rx', rx)
+ .attr('ry', ry);
+
+ node.intersect = function (point) {
+ return intersectEllipse(node, rx, ry, point);
+ };
+
+ return shapeSvg;
+}
+
+function circle(parent, bbox, node) {
+ var r = Math.max(bbox.width, bbox.height) / 2;
+ var shapeSvg = parent
+ .insert('circle', ':first-child')
+ .attr('x', -bbox.width / 2)
+ .attr('y', -bbox.height / 2)
+ .attr('r', r);
+
+ node.intersect = function (point) {
+ return intersectCircle(node, r, point);
+ };
+
+ return shapeSvg;
+}
+
+// Circumscribe an ellipse for the bounding box with a diamond shape. I derived
+// the function to calculate the diamond shape from:
+// http://mathforum.org/kb/message.jspa?messageID=3750236
+function diamond(parent, bbox, node) {
+ var w = (bbox.width * Math.SQRT2) / 2;
+ var h = (bbox.height * Math.SQRT2) / 2;
+ var points = [
+ { x: 0, y: -h },
+ { x: -w, y: 0 },
+ { x: 0, y: h },
+ { x: w, y: 0 },
+ ];
+ var shapeSvg = parent.insert('polygon', ':first-child').attr(
+ 'points',
+ points
+ .map(function (p) {
+ return p.x + ',' + p.y;
+ })
+ .join(' ')
+ );
+
+ node.intersect = function (p) {
+ return intersectPolygon(node, points, p);
+ };
+
+ return shapeSvg;
+}
+
+// This design is based on http://bost.ocks.org/mike/chart/.
+function render() {
+ var fn = function (svg, g) {
+ preProcessGraph(g);
+
+ var outputGroup = createOrSelectGroup(svg, 'output');
+ var clustersGroup = createOrSelectGroup(outputGroup, 'clusters');
+ var edgePathsGroup = createOrSelectGroup(outputGroup, 'edgePaths');
+ var edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, 'edgeLabels'), g);
+ var nodes = createNodes(createOrSelectGroup(outputGroup, 'nodes'), g, shapes);
+
+ layout(g);
+
+ positionNodes(nodes, g);
+ positionEdgeLabels(edgeLabels, g);
+ createEdgePaths(edgePathsGroup, g, arrows);
+
+ var clusters = createClusters(clustersGroup, g);
+ positionClusters(clusters, g);
+
+ postProcessGraph(g);
+ };
+
+ fn.createNodes = function (value) {
+ if (!arguments.length) return createNodes;
+ setCreateNodes(value);
+ return fn;
+ };
+
+ fn.createClusters = function (value) {
+ if (!arguments.length) return createClusters;
+ setCreateClusters(value);
+ return fn;
+ };
+
+ fn.createEdgeLabels = function (value) {
+ if (!arguments.length) return createEdgeLabels;
+ setCreateEdgeLabels(value);
+ return fn;
+ };
+
+ fn.createEdgePaths = function (value) {
+ if (!arguments.length) return createEdgePaths;
+ setCreateEdgePaths(value);
+ return fn;
+ };
+
+ fn.shapes = function (value) {
+ if (!arguments.length) return shapes;
+ setShapes(value);
+ return fn;
+ };
+
+ fn.arrows = function (value) {
+ if (!arguments.length) return arrows;
+ setArrows(value);
+ return fn;
+ };
+
+ return fn;
+}
+
+var NODE_DEFAULT_ATTRS = {
+ paddingLeft: 10,
+ paddingRight: 10,
+ paddingTop: 10,
+ paddingBottom: 10,
+ rx: 0,
+ ry: 0,
+ shape: 'rect',
+};
+
+var EDGE_DEFAULT_ATTRS = {
+ arrowhead: 'normal',
+ curve: curveLinear,
+};
+
+function preProcessGraph(g) {
+ g.nodes().forEach(function (v) {
+ var node = g.node(v);
+ if (!has(node, 'label') && !g.children(v).length) {
+ node.label = v;
+ }
+
+ if (has(node, 'paddingX')) {
+ defaults(node, {
+ paddingLeft: node.paddingX,
+ paddingRight: node.paddingX,
+ });
+ }
+
+ if (has(node, 'paddingY')) {
+ defaults(node, {
+ paddingTop: node.paddingY,
+ paddingBottom: node.paddingY,
+ });
+ }
+
+ if (has(node, 'padding')) {
+ defaults(node, {
+ paddingLeft: node.padding,
+ paddingRight: node.padding,
+ paddingTop: node.padding,
+ paddingBottom: node.padding,
+ });
+ }
+
+ defaults(node, NODE_DEFAULT_ATTRS);
+
+ forEach(['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'], function (k) {
+ node[k] = Number(node[k]);
+ });
+
+ // Save dimensions for restore during post-processing
+ if (has(node, 'width')) {
+ node._prevWidth = node.width;
+ }
+ if (has(node, 'height')) {
+ node._prevHeight = node.height;
+ }
+ });
+
+ g.edges().forEach(function (e) {
+ var edge = g.edge(e);
+ if (!has(edge, 'label')) {
+ edge.label = '';
+ }
+ defaults(edge, EDGE_DEFAULT_ATTRS);
+ });
+}
+
+function postProcessGraph(g) {
+ forEach(g.nodes(), function (v) {
+ var node = g.node(v);
+
+ // Restore original dimensions
+ if (has(node, '_prevWidth')) {
+ node.width = node._prevWidth;
+ } else {
+ delete node.width;
+ }
+
+ if (has(node, '_prevHeight')) {
+ node.height = node._prevHeight;
+ } else {
+ delete node.height;
+ }
+
+ delete node._prevWidth;
+ delete node._prevHeight;
+ });
+}
+
+function createOrSelectGroup(root, name) {
+ var selection = root.select('g.' + name);
+ if (selection.empty()) {
+ selection = root.append('g').attr('class', name);
+ }
+ return selection;
+}
+
+function question(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const s = (w + h) * 0.9;
+ const points = [
+ { x: s / 2, y: 0 },
+ { x: s, y: -s / 2 },
+ { x: s / 2, y: -s },
+ { x: 0, y: -s / 2 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, s, s, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function hexagon(parent, bbox, node) {
+ const f = 4;
+ const h = bbox.height;
+ const m = h / f;
+ const w = bbox.width + 2 * m;
+ const points = [
+ { x: m, y: 0 },
+ { x: w - m, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w - m, y: -h },
+ { x: m, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function rect_left_inv_arrow(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: -h / 2, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: -h / 2, y: -h },
+ { x: 0, y: -h / 2 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function lean_right(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function lean_left(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: 2 * h / 6, y: 0 },
+ { x: w + h / 6, y: 0 },
+ { x: w - 2 * h / 6, y: -h },
+ { x: -h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function trapezoid(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: -2 * h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: 0 },
+ { x: w - h / 6, y: -h },
+ { x: h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function inv_trapezoid(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: h / 6, y: 0 },
+ { x: w - h / 6, y: 0 },
+ { x: w + 2 * h / 6, y: -h },
+ { x: -2 * h / 6, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function rect_right_inv_arrow(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w + h / 2, y: 0 },
+ { x: w, y: -h / 2 },
+ { x: w + h / 2, y: -h },
+ { x: 0, y: -h }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function stadium(parent, bbox, node) {
+ const h = bbox.height;
+ const w = bbox.width + h / 4;
+ const shapeSvg = parent.insert("rect", ":first-child").attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
+ node.intersect = function(point) {
+ return intersectRect(node, point);
+ };
+ return shapeSvg;
+}
+function subroutine(parent, bbox, node) {
+ const w = bbox.width;
+ const h = bbox.height;
+ const points = [
+ { x: 0, y: 0 },
+ { x: w, y: 0 },
+ { x: w, y: -h },
+ { x: 0, y: -h },
+ { x: 0, y: 0 },
+ { x: -8, y: 0 },
+ { x: w + 8, y: 0 },
+ { x: w + 8, y: -h },
+ { x: -8, y: -h },
+ { x: -8, y: 0 }
+ ];
+ const shapeSvg = insertPolygonShape(parent, w, h, points);
+ node.intersect = function(point) {
+ return intersectPolygon(node, points, point);
+ };
+ return shapeSvg;
+}
+function cylinder(parent, bbox, node) {
+ const w = bbox.width;
+ const rx = w / 2;
+ const ry = rx / (2.5 + w / 50);
+ const h = bbox.height + ry;
+ const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
+ const shapeSvg = parent.attr("label-offset-y", ry).insert("path", ":first-child").attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
+ node.intersect = function(point) {
+ const pos = intersectRect(node, point);
+ const x = pos.x - node.x;
+ if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
+ let y = ry * ry * (1 - x * x / (rx * rx));
+ if (y != 0) {
+ y = Math.sqrt(y);
+ }
+ y = ry - y;
+ if (point.y - node.y > 0) {
+ y = -y;
+ }
+ pos.y += y;
+ }
+ return pos;
+ };
+ return shapeSvg;
+}
+function addToRender(render2) {
+ render2.shapes().question = question;
+ render2.shapes().hexagon = hexagon;
+ render2.shapes().stadium = stadium;
+ render2.shapes().subroutine = subroutine;
+ render2.shapes().cylinder = cylinder;
+ render2.shapes().rect_left_inv_arrow = rect_left_inv_arrow;
+ render2.shapes().lean_right = lean_right;
+ render2.shapes().lean_left = lean_left;
+ render2.shapes().trapezoid = trapezoid;
+ render2.shapes().inv_trapezoid = inv_trapezoid;
+ render2.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
+}
+function addToRenderV2(addShape) {
+ addShape({ question });
+ addShape({ hexagon });
+ addShape({ stadium });
+ addShape({ subroutine });
+ addShape({ cylinder });
+ addShape({ rect_left_inv_arrow });
+ addShape({ lean_right });
+ addShape({ lean_left });
+ addShape({ trapezoid });
+ addShape({ inv_trapezoid });
+ addShape({ rect_right_inv_arrow });
+}
+function insertPolygonShape(parent, w, h, points) {
+ return parent.insert("polygon", ":first-child").attr(
+ "points",
+ points.map(function(d) {
+ return d.x + "," + d.y;
+ }).join(" ")
+ ).attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
+}
+const flowChartShapes = {
+ addToRender,
+ addToRenderV2
+};
+const conf = {};
+const setConf = function(cnf) {
+ const keys = Object.keys(cnf);
+ for (const key of keys) {
+ conf[key] = cnf[key];
+ }
+};
+const addVertices = async function(vert, g, svgId, root, _doc, diagObj) {
+ const svg = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`);
+ const doc = !_doc ? document : _doc;
+ const keys = Object.keys(vert);
+ for (const id of keys) {
+ const vertex = vert[id];
+ let classStr = "default";
+ if (vertex.classes.length > 0) {
+ classStr = vertex.classes.join(" ");
+ }
+ const styles = getStylesFromArray(vertex.styles);
+ let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id;
+ let vertexNode;
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ const node = {
+ label: await renderKatex(
+ vertexText.replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell:disable-line
+ (s) => ``
+ ),
+ getConfig()
+ )
+ };
+ vertexNode = addHtmlLabel(svg, node).node();
+ vertexNode.parentNode.removeChild(vertexNode);
+ } else {
+ const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
+ svgLabel.setAttribute("style", styles.labelStyle.replace("color:", "fill:"));
+ const rows = vertexText.split(common$1.lineBreakRegex);
+ for (const row of rows) {
+ const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
+ tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
+ tspan.setAttribute("dy", "1em");
+ tspan.setAttribute("x", "1");
+ tspan.textContent = row;
+ svgLabel.appendChild(tspan);
+ }
+ vertexNode = svgLabel;
+ }
+ let radius = 0;
+ let _shape = "";
+ switch (vertex.type) {
+ case "round":
+ radius = 5;
+ _shape = "rect";
+ break;
+ case "square":
+ _shape = "rect";
+ break;
+ case "diamond":
+ _shape = "question";
+ break;
+ case "hexagon":
+ _shape = "hexagon";
+ break;
+ case "odd":
+ _shape = "rect_left_inv_arrow";
+ break;
+ case "lean_right":
+ _shape = "lean_right";
+ break;
+ case "lean_left":
+ _shape = "lean_left";
+ break;
+ case "trapezoid":
+ _shape = "trapezoid";
+ break;
+ case "inv_trapezoid":
+ _shape = "inv_trapezoid";
+ break;
+ case "odd_right":
+ _shape = "rect_left_inv_arrow";
+ break;
+ case "circle":
+ _shape = "circle";
+ break;
+ case "ellipse":
+ _shape = "ellipse";
+ break;
+ case "stadium":
+ _shape = "stadium";
+ break;
+ case "subroutine":
+ _shape = "subroutine";
+ break;
+ case "cylinder":
+ _shape = "cylinder";
+ break;
+ case "group":
+ _shape = "rect";
+ break;
+ default:
+ _shape = "rect";
+ }
+ log$1.warn("Adding node", vertex.id, vertex.domId);
+ g.setNode(diagObj.db.lookUpDomId(vertex.id), {
+ labelType: "svg",
+ labelStyle: styles.labelStyle,
+ shape: _shape,
+ label: vertexNode,
+ rx: radius,
+ ry: radius,
+ class: classStr,
+ style: styles.style,
+ id: diagObj.db.lookUpDomId(vertex.id)
+ });
+ }
+};
+const addEdges = async function(edges, g, diagObj) {
+ let cnt = 0;
+ let defaultStyle;
+ let defaultLabelStyle;
+ if (edges.defaultStyle !== void 0) {
+ const defaultStyles = getStylesFromArray(edges.defaultStyle);
+ defaultStyle = defaultStyles.style;
+ defaultLabelStyle = defaultStyles.labelStyle;
+ }
+ for (const edge of edges) {
+ cnt++;
+ const linkId = "L-" + edge.start + "-" + edge.end;
+ const linkNameStart = "LS-" + edge.start;
+ const linkNameEnd = "LE-" + edge.end;
+ const edgeData = {};
+ if (edge.type === "arrow_open") {
+ edgeData.arrowhead = "none";
+ } else {
+ edgeData.arrowhead = "normal";
+ }
+ let style = "";
+ let labelStyle = "";
+ if (edge.style !== void 0) {
+ const styles = getStylesFromArray(edge.style);
+ style = styles.style;
+ labelStyle = styles.labelStyle;
+ } else {
+ switch (edge.stroke) {
+ case "normal":
+ style = "fill:none";
+ if (defaultStyle !== void 0) {
+ style = defaultStyle;
+ }
+ if (defaultLabelStyle !== void 0) {
+ labelStyle = defaultLabelStyle;
+ }
+ break;
+ case "dotted":
+ style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
+ break;
+ case "thick":
+ style = " stroke-width: 3.5px;fill:none";
+ break;
+ }
+ }
+ edgeData.style = style;
+ edgeData.labelStyle = labelStyle;
+ if (edge.interpolate !== void 0) {
+ edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
+ } else if (edges.defaultInterpolate !== void 0) {
+ edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
+ } else {
+ edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
+ }
+ if (edge.text === void 0) {
+ if (edge.style !== void 0) {
+ edgeData.arrowheadStyle = "fill: #333";
+ }
+ } else {
+ edgeData.arrowheadStyle = "fill: #333";
+ edgeData.labelpos = "c";
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
+ edgeData.labelType = "html";
+ edgeData.label = `${await renderKatex(
+ edge.text.replace(
+ /fa[blrs]?:fa-[\w-]+/g,
+ // cspell:disable-line
+ (s) => ``
+ ),
+ getConfig()
+ )}`;
+ } else {
+ edgeData.labelType = "text";
+ edgeData.label = edge.text.replace(common$1.lineBreakRegex, "\n");
+ if (edge.style === void 0) {
+ edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
+ }
+ edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
+ }
+ }
+ edgeData.id = linkId;
+ edgeData.class = linkNameStart + " " + linkNameEnd;
+ edgeData.minlen = edge.length || 1;
+ g.setEdge(diagObj.db.lookUpDomId(edge.start), diagObj.db.lookUpDomId(edge.end), edgeData, cnt);
+ }
+};
+const getClasses = function(text, diagObj) {
+ log$1.info("Extracting classes");
+ return diagObj.db.getClasses();
+};
+const draw = async function(text, id, _version, diagObj) {
+ log$1.info("Drawing flowchart");
+ const { securityLevel, flowchart: conf2 } = getConfig();
+ let sandboxElement;
+ if (securityLevel === "sandbox") {
+ sandboxElement = select("#i" + id);
+ }
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
+ let dir = diagObj.db.getDirection();
+ if (dir === void 0) {
+ dir = "TD";
+ }
+ const nodeSpacing = conf2.nodeSpacing || 50;
+ const rankSpacing = conf2.rankSpacing || 50;
+ const g = new Graph({
+ multigraph: true,
+ compound: true
+ }).setGraph({
+ rankdir: dir,
+ nodesep: nodeSpacing,
+ ranksep: rankSpacing,
+ marginx: 8,
+ marginy: 8
+ }).setDefaultEdgeLabel(function() {
+ return {};
+ });
+ let subG;
+ const subGraphs = diagObj.db.getSubGraphs();
+ for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
+ subG = subGraphs[i2];
+ diagObj.db.addVertex(subG.id, subG.title, "group", void 0, subG.classes);
+ }
+ const vert = diagObj.db.getVertices();
+ log$1.warn("Get vertices", vert);
+ const edges = diagObj.db.getEdges();
+ let i = 0;
+ for (i = subGraphs.length - 1; i >= 0; i--) {
+ subG = subGraphs[i];
+ selectAll("cluster").append("text");
+ for (let j = 0; j < subG.nodes.length; j++) {
+ log$1.warn(
+ "Setting subgraph",
+ subG.nodes[j],
+ diagObj.db.lookUpDomId(subG.nodes[j]),
+ diagObj.db.lookUpDomId(subG.id)
+ );
+ g.setParent(diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));
+ }
+ }
+ await addVertices(vert, g, id, root, doc, diagObj);
+ await addEdges(edges, g, diagObj);
+ const render$1 = new render();
+ flowChartShapes.addToRender(render$1);
+ render$1.arrows().none = function normal(parent, id2, edge, type) {
+ const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
+ const path = marker.append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
+ applyStyle(path, edge[type + "Style"]);
+ };
+ render$1.arrows().normal = function normal(parent, id2) {
+ const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
+ marker.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
+ };
+ const svg = root.select(`[id="${id}"]`);
+ const element = root.select("#" + id + " g");
+ render$1(element, g);
+ element.selectAll("g.node").attr("title", function() {
+ return diagObj.db.getTooltip(this.id);
+ });
+ diagObj.db.indexNodes("subGraph" + i);
+ for (i = 0; i < subGraphs.length; i++) {
+ subG = subGraphs[i];
+ if (subG.title !== "undefined") {
+ const clusterRects = doc.querySelectorAll(
+ "#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"] rect'
+ );
+ const clusterEl = doc.querySelectorAll(
+ "#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"]'
+ );
+ const xPos = clusterRects[0].x.baseVal.value;
+ const yPos = clusterRects[0].y.baseVal.value;
+ const _width = clusterRects[0].width.baseVal.value;
+ const cluster = select(clusterEl[0]);
+ const te = cluster.select(".label");
+ te.attr("transform", `translate(${xPos + _width / 2}, ${yPos + 14})`);
+ te.attr("id", id + "Text");
+ for (let j = 0; j < subG.classes.length; j++) {
+ clusterEl[0].classList.add(subG.classes[j]);
+ }
+ }
+ }
+ if (!conf2.htmlLabels) {
+ const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
+ for (const label of labels) {
+ const dim = label.getBBox();
+ const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
+ rect.setAttribute("rx", 0);
+ rect.setAttribute("ry", 0);
+ rect.setAttribute("width", dim.width);
+ rect.setAttribute("height", dim.height);
+ label.insertBefore(rect, label.firstChild);
+ }
+ }
+ setupGraphViewbox$1(g, svg, conf2.diagramPadding, conf2.useMaxWidth);
+ const keys = Object.keys(vert);
+ keys.forEach(function(key) {
+ const vertex = vert[key];
+ if (vertex.link) {
+ const node = root.select("#" + id + ' [id="' + diagObj.db.lookUpDomId(key) + '"]');
+ if (node) {
+ const link = doc.createElementNS("http://www.w3.org/2000/svg", "a");
+ link.setAttributeNS("http://www.w3.org/2000/svg", "class", vertex.classes.join(" "));
+ link.setAttributeNS("http://www.w3.org/2000/svg", "href", vertex.link);
+ link.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener");
+ if (securityLevel === "sandbox") {
+ link.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top");
+ } else if (vertex.linkTarget) {
+ link.setAttributeNS("http://www.w3.org/2000/svg", "target", vertex.linkTarget);
+ }
+ const linkNode = node.insert(function() {
+ return link;
+ }, ":first-child");
+ const shape = node.select(".label-container");
+ if (shape) {
+ linkNode.append(function() {
+ return shape.node();
+ });
+ }
+ const label = node.select(".label");
+ if (label) {
+ linkNode.append(function() {
+ return label.node();
+ });
+ }
+ }
+ }
+ });
+};
+const flowRenderer = {
+ setConf,
+ addVertices,
+ addEdges,
+ getClasses,
+ draw
+};
+const diagram = {
+ parser: parser$1,
+ db: flowDb,
+ renderer: flowRendererV2,
+ styles: flowStyles,
+ init: (cnf) => {
+ if (!cnf.flowchart) {
+ cnf.flowchart = {};
+ }
+ cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
+ flowRenderer.setConf(cnf.flowchart);
+ flowDb.clear();
+ flowDb.setGen("gen-1");
+ }
+};
+
+export { diagram };
diff --git a/libs/marked/flowDiagram-v2-13329dc7-BhMMoQnO.js b/libs/marked/flowDiagram-v2-13329dc7-BhMMoQnO.js
new file mode 100644
index 0000000..dc6a1d4
--- /dev/null
+++ b/libs/marked/flowDiagram-v2-13329dc7-BhMMoQnO.js
@@ -0,0 +1,32 @@
+import { p as parser$1, f as flowDb } from './flowDb-c1833063-Df5kDQr4.js';
+import { f as flowRendererV2, g as flowStyles } from './styles-483fbfea-DDPjh658.js';
+import { u as setConfig } from './index-Bd_FDXSq.js';
+import './graph-KZW2Npeo.js';
+import './layout-BnytXFfq.js';
+import './index-01f381cb-BCBEZMaa.js';
+import './clone-B-QllgkM.js';
+import './edges-066a5561-Bqw9g7uz.js';
+import './createText-ca0c5216-B9KlDTE8.js';
+import './line-DUwhS6kk.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+import './channel-BxFDB0yY.js';
+
+const diagram = {
+ parser: parser$1,
+ db: flowDb,
+ renderer: flowRendererV2,
+ styles: flowStyles,
+ init: (cnf) => {
+ if (!cnf.flowchart) {
+ cnf.flowchart = {};
+ }
+ cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
+ setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
+ flowRendererV2.setConf(cnf.flowchart);
+ flowDb.clear();
+ flowDb.setGen("gen-2");
+ }
+};
+
+export { diagram };
diff --git a/libs/marked/flowDiagram-v2-13329dc7-BmGiwYxl.js b/libs/marked/flowDiagram-v2-13329dc7-BmGiwYxl.js
new file mode 100644
index 0000000..4de0c4d
--- /dev/null
+++ b/libs/marked/flowDiagram-v2-13329dc7-BmGiwYxl.js
@@ -0,0 +1,32 @@
+import { p as parser$1, f as flowDb } from './flowDb-c1833063-C_SlfbWJ.js';
+import { f as flowRendererV2, g as flowStyles } from './styles-483fbfea-Bj8pmBPH.js';
+import { u as setConfig } from './index-CN3YjQ0n.js';
+import './graph-DadsyNmk.js';
+import './layout-BOZlZI7g.js';
+import './index-01f381cb-CDFlKdjO.js';
+import './clone-B4k62NSz.js';
+import './edges-066a5561-a6s42o55.js';
+import './createText-ca0c5216-DF05SDfj.js';
+import './line-D1aCvau7.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+import './channel-DcrZctv4.js';
+
+const diagram = {
+ parser: parser$1,
+ db: flowDb,
+ renderer: flowRendererV2,
+ styles: flowStyles,
+ init: (cnf) => {
+ if (!cnf.flowchart) {
+ cnf.flowchart = {};
+ }
+ cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
+ setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
+ flowRendererV2.setConf(cnf.flowchart);
+ flowDb.clear();
+ flowDb.setGen("gen-2");
+ }
+};
+
+export { diagram };
diff --git a/libs/marked/flowchart-elk-definition-ae0efee6-BGp9zXvL.js b/libs/marked/flowchart-elk-definition-ae0efee6-BGp9zXvL.js
new file mode 100644
index 0000000..fb7feca
--- /dev/null
+++ b/libs/marked/flowchart-elk-definition-ae0efee6-BGp9zXvL.js
@@ -0,0 +1,7505 @@
+import { d as db, p as parser$1 } from './flowDb-c1833063-C_SlfbWJ.js';
+import { P as commonjsGlobal, Q as getDefaultExportFromCjs, l as log$1, h as select, _ as getConfig$1, t as setupGraphViewbox$1, o as getStylesFromArray, q as interpolateToCurve, n as curveLinear, j as common$1 } from './index-CN3YjQ0n.js';
+import { i as insertMarkers$1, a as insertNode, l as labelHelper, b as insertEdgeLabel, k as getLineFunctionsWithOffset, m as addEdgeMarkers } from './edges-066a5561-a6s42o55.js';
+import { l as line } from './line-D1aCvau7.js';
+import './createText-ca0c5216-DF05SDfj.js';
+import './array-DJxSMw-N.js';
+import './path-BZ3S9nBE.js';
+
+function commonjsRequire(path) {
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
+}
+
+var elk_bundled = {exports: {}};
+
+(function (module, exports) {
+ (function(f){{module.exports=f();}})(function(){return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof commonjsRequire&&commonjsRequire;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t);}return n[i].exports}for(var u="function"==typeof commonjsRequire&&commonjsRequire,i=0;i 0 && arguments[0] !== undefined ? arguments[0] : {},
+ _ref$defaultLayoutOpt = _ref.defaultLayoutOptions,
+ defaultLayoutOptions = _ref$defaultLayoutOpt === undefined ? {} : _ref$defaultLayoutOpt,
+ _ref$algorithms = _ref.algorithms,
+ algorithms = _ref$algorithms === undefined ? ['layered', 'stress', 'mrtree', 'radial', 'force', 'disco', 'sporeOverlap', 'sporeCompaction', 'rectpacking'] : _ref$algorithms,
+ workerFactory = _ref.workerFactory,
+ workerUrl = _ref.workerUrl;
+
+ _classCallCheck(this, ELK);
+
+ this.defaultLayoutOptions = defaultLayoutOptions;
+ this.initialized = false;
+
+ // check valid worker construction possible
+ if (typeof workerUrl === 'undefined' && typeof workerFactory === 'undefined') {
+ throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");
+ }
+ var factory = workerFactory;
+ if (typeof workerUrl !== 'undefined' && typeof workerFactory === 'undefined') {
+ // use default Web Worker
+ factory = function factory(url) {
+ return new Worker(url);
+ };
+ }
+
+ // create the worker
+ var worker = factory(workerUrl);
+ if (typeof worker.postMessage !== 'function') {
+ throw new TypeError("Created worker does not provide" + " the required 'postMessage' function.");
+ }
+
+ // wrap the worker to return promises
+ this.worker = new PromisedWorker(worker);
+
+ // initially register algorithms
+ this.worker.postMessage({
+ cmd: 'register',
+ algorithms: algorithms
+ }).then(function (r) {
+ return _this.initialized = true;
+ }).catch(console.err);
+ }
+
+ _createClass(ELK, [{
+ key: 'layout',
+ value: function layout(graph) {
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ _ref2$layoutOptions = _ref2.layoutOptions,
+ layoutOptions = _ref2$layoutOptions === undefined ? this.defaultLayoutOptions : _ref2$layoutOptions,
+ _ref2$logging = _ref2.logging,
+ logging = _ref2$logging === undefined ? false : _ref2$logging,
+ _ref2$measureExecutio = _ref2.measureExecutionTime,
+ measureExecutionTime = _ref2$measureExecutio === undefined ? false : _ref2$measureExecutio;
+
+ if (!graph) {
+ return Promise.reject(new Error("Missing mandatory parameter 'graph'."));
+ }
+ return this.worker.postMessage({
+ cmd: 'layout',
+ graph: graph,
+ layoutOptions: layoutOptions,
+ options: {
+ logging: logging,
+ measureExecutionTime: measureExecutionTime
+ }
+ });
+ }
+ }, {
+ key: 'knownLayoutAlgorithms',
+ value: function knownLayoutAlgorithms() {
+ return this.worker.postMessage({ cmd: 'algorithms' });
+ }
+ }, {
+ key: 'knownLayoutOptions',
+ value: function knownLayoutOptions() {
+ return this.worker.postMessage({ cmd: 'options' });
+ }
+ }, {
+ key: 'knownLayoutCategories',
+ value: function knownLayoutCategories() {
+ return this.worker.postMessage({ cmd: 'categories' });
+ }
+ }, {
+ key: 'terminateWorker',
+ value: function terminateWorker() {
+ if (this.worker) this.worker.terminate();
+ }
+ }]);
+
+ return ELK;
+ }();
+
+ exports.default = ELK;
+
+ var PromisedWorker = function () {
+ function PromisedWorker(worker) {
+ var _this2 = this;
+
+ _classCallCheck(this, PromisedWorker);
+
+ if (worker === undefined) {
+ throw new Error("Missing mandatory parameter 'worker'.");
+ }
+ this.resolvers = {};
+ this.worker = worker;
+ this.worker.onmessage = function (answer) {
+ // why is this necessary?
+ setTimeout(function () {
+ _this2.receive(_this2, answer);
+ }, 0);
+ };
+ }
+
+ _createClass(PromisedWorker, [{
+ key: 'postMessage',
+ value: function postMessage(msg) {
+ var id = this.id || 0;
+ this.id = id + 1;
+ msg.id = id;
+ var self = this;
+ return new Promise(function (resolve, reject) {
+ // prepare the resolver
+ self.resolvers[id] = function (err, res) {
+ if (err) {
+ self.convertGwtStyleError(err);
+ reject(err);
+ } else {
+ resolve(res);
+ }
+ };
+ // post the message
+ self.worker.postMessage(msg);
+ });
+ }
+ }, {
+ key: 'receive',
+ value: function receive(self, answer) {
+ var json = answer.data;
+ var resolver = self.resolvers[json.id];
+ if (resolver) {
+ delete self.resolvers[json.id];
+ if (json.error) {
+ resolver(json.error);
+ } else {
+ resolver(null, json.data);
+ }
+ }
+ }
+ }, {
+ key: 'terminate',
+ value: function terminate() {
+ if (this.worker) {
+ this.worker.terminate();
+ }
+ }
+ }, {
+ key: 'convertGwtStyleError',
+ value: function convertGwtStyleError(err) {
+ if (!err) {
+ return;
+ }
+ // Somewhat flatten the way GWT stores nested exception(s)
+ var javaException = err['__java$exception'];
+ if (javaException) {
+ // Note that the property name of the nested exception is different
+ // in the non-minified ('cause') and the minified (not deterministic) version.
+ // Hence, the version below only works for the non-minified version.
+ // However, as the minified stack trace is not of much use anyway, one
+ // should switch the used version for debugging in such a case.
+ if (javaException.cause && javaException.cause.backingJsObject) {
+ err.cause = javaException.cause.backingJsObject;
+ this.convertGwtStyleError(err.cause);
+ }
+ delete err['__java$exception'];
+ }
+ }
+ }]);
+
+ return PromisedWorker;
+ }();
+ },{}],2:[function(require,module,exports){
+ (function (global){(function (){
+
+ // -------------- FAKE ELEMENTS GWT ASSUMES EXIST --------------
+ var $wnd;
+ if (typeof window !== 'undefined')
+ $wnd = window;
+ else if (typeof global !== 'undefined')
+ $wnd = global; // nodejs
+ else if (typeof self !== 'undefined')
+ $wnd = self; // web worker
+
+ // -------------- WORKAROUND STRICT MODE, SEE #127 --------------
+ var o;
+
+ // -------------- GENERATED CODE --------------
+ function nb(){}
+ function xb(){}
+ function Fd(){}
+ function hh(){}
+ function lq(){}
+ function Nq(){}
+ function ir(){}
+ function Ws(){}
+ function Zw(){}
+ function jx(){}
+ function rx(){}
+ function sx(){}
+ function My(){}
+ function bA(){}
+ function mA(){}
+ function tA(){}
+ function aB(){}
+ function dB(){}
+ function jB(){}
+ function dC(){}
+ function keb(){}
+ function geb(){}
+ function oeb(){}
+ function iob(){}
+ function Job(){}
+ function Rob(){}
+ function apb(){}
+ function ipb(){}
+ function nrb(){}
+ function wrb(){}
+ function Brb(){}
+ function Prb(){}
+ function ltb(){}
+ function svb(){}
+ function xvb(){}
+ function zvb(){}
+ function $xb(){}
+ function Gzb(){}
+ function NAb(){}
+ function VAb(){}
+ function rBb(){}
+ function RBb(){}
+ function TBb(){}
+ function XBb(){}
+ function ZBb(){}
+ function _Bb(){}
+ function bCb(){}
+ function dCb(){}
+ function fCb(){}
+ function jCb(){}
+ function rCb(){}
+ function uCb(){}
+ function wCb(){}
+ function yCb(){}
+ function ACb(){}
+ function ECb(){}
+ function FEb(){}
+ function IEb(){}
+ function KEb(){}
+ function MEb(){}
+ function gFb(){}
+ function FFb(){}
+ function JFb(){}
+ function xGb(){}
+ function AGb(){}
+ function YGb(){}
+ function oHb(){}
+ function tHb(){}
+ function xHb(){}
+ function pIb(){}
+ function BJb(){}
+ function kLb(){}
+ function mLb(){}
+ function oLb(){}
+ function qLb(){}
+ function FLb(){}
+ function JLb(){}
+ function KMb(){}
+ function MMb(){}
+ function OMb(){}
+ function YMb(){}
+ function MNb(){}
+ function ONb(){}
+ function aOb(){}
+ function eOb(){}
+ function xOb(){}
+ function BOb(){}
+ function DOb(){}
+ function FOb(){}
+ function IOb(){}
+ function MOb(){}
+ function POb(){}
+ function UOb(){}
+ function ZOb(){}
+ function cPb(){}
+ function gPb(){}
+ function nPb(){}
+ function qPb(){}
+ function tPb(){}
+ function wPb(){}
+ function CPb(){}
+ function qQb(){}
+ function GQb(){}
+ function bRb(){}
+ function gRb(){}
+ function kRb(){}
+ function pRb(){}
+ function wRb(){}
+ function xSb(){}
+ function TSb(){}
+ function VSb(){}
+ function XSb(){}
+ function ZSb(){}
+ function _Sb(){}
+ function tTb(){}
+ function DTb(){}
+ function FTb(){}
+ function FXb(){}
+ function hXb(){}
+ function hWb(){}
+ function mWb(){}
+ function CVb(){}
+ function XXb(){}
+ function $Xb(){}
+ function bYb(){}
+ function lYb(){}
+ function FYb(){}
+ function XYb(){}
+ function aZb(){}
+ function SZb(){}
+ function ZZb(){}
+ function Z_b(){}
+ function j_b(){}
+ function j$b(){}
+ function b$b(){}
+ function f$b(){}
+ function n$b(){}
+ function K_b(){}
+ function V_b(){}
+ function b0b(){}
+ function l0b(){}
+ function X1b(){}
+ function _1b(){}
+ function x3b(){}
+ function r4b(){}
+ function w4b(){}
+ function A4b(){}
+ function E4b(){}
+ function I4b(){}
+ function M4b(){}
+ function o5b(){}
+ function q5b(){}
+ function w5b(){}
+ function A5b(){}
+ function E5b(){}
+ function h6b(){}
+ function j6b(){}
+ function l6b(){}
+ function q6b(){}
+ function v6b(){}
+ function y6b(){}
+ function G6b(){}
+ function K6b(){}
+ function N6b(){}
+ function P6b(){}
+ function R6b(){}
+ function b7b(){}
+ function f7b(){}
+ function j7b(){}
+ function n7b(){}
+ function C7b(){}
+ function H7b(){}
+ function J7b(){}
+ function L7b(){}
+ function N7b(){}
+ function P7b(){}
+ function a8b(){}
+ function c8b(){}
+ function e8b(){}
+ function g8b(){}
+ function i8b(){}
+ function m8b(){}
+ function Z8b(){}
+ function f9b(){}
+ function i9b(){}
+ function o9b(){}
+ function C9b(){}
+ function F9b(){}
+ function K9b(){}
+ function Q9b(){}
+ function aac(){}
+ function bac(){}
+ function eac(){}
+ function mac(){}
+ function pac(){}
+ function rac(){}
+ function tac(){}
+ function xac(){}
+ function Aac(){}
+ function Dac(){}
+ function Iac(){}
+ function Oac(){}
+ function Uac(){}
+ function Ucc(){}
+ function scc(){}
+ function ycc(){}
+ function Acc(){}
+ function Ccc(){}
+ function Ncc(){}
+ function Wcc(){}
+ function ydc(){}
+ function Adc(){}
+ function Gdc(){}
+ function Ldc(){}
+ function Zdc(){}
+ function fec(){}
+ function Dec(){}
+ function Gec(){}
+ function Kec(){}
+ function efc(){}
+ function jfc(){}
+ function nfc(){}
+ function Bfc(){}
+ function Ifc(){}
+ function Lfc(){}
+ function Rfc(){}
+ function Ufc(){}
+ function Zfc(){}
+ function cgc(){}
+ function egc(){}
+ function ggc(){}
+ function igc(){}
+ function kgc(){}
+ function Dgc(){}
+ function Hgc(){}
+ function Lgc(){}
+ function Ngc(){}
+ function Pgc(){}
+ function Vgc(){}
+ function Ygc(){}
+ function chc(){}
+ function ehc(){}
+ function ghc(){}
+ function ihc(){}
+ function mhc(){}
+ function rhc(){}
+ function uhc(){}
+ function whc(){}
+ function yhc(){}
+ function Ahc(){}
+ function Chc(){}
+ function Ghc(){}
+ function Nhc(){}
+ function Phc(){}
+ function Rhc(){}
+ function Thc(){}
+ function $hc(){}
+ function aic(){}
+ function cic(){}
+ function eic(){}
+ function jic(){}
+ function nic(){}
+ function pic(){}
+ function ric(){}
+ function vic(){}
+ function yic(){}
+ function Dic(){}
+ function Ric(){}
+ function Zic(){}
+ function bjc(){}
+ function djc(){}
+ function jjc(){}
+ function njc(){}
+ function rjc(){}
+ function tjc(){}
+ function zjc(){}
+ function Djc(){}
+ function Fjc(){}
+ function Ljc(){}
+ function Pjc(){}
+ function Rjc(){}
+ function fkc(){}
+ function Kkc(){}
+ function Mkc(){}
+ function Okc(){}
+ function Qkc(){}
+ function Skc(){}
+ function Ukc(){}
+ function Wkc(){}
+ function clc(){}
+ function elc(){}
+ function klc(){}
+ function mlc(){}
+ function olc(){}
+ function qlc(){}
+ function wlc(){}
+ function ylc(){}
+ function Alc(){}
+ function Jlc(){}
+ function Joc(){}
+ function poc(){}
+ function roc(){}
+ function toc(){}
+ function voc(){}
+ function Boc(){}
+ function Foc(){}
+ function Hoc(){}
+ function Loc(){}
+ function Noc(){}
+ function Poc(){}
+ function qnc(){}
+ function unc(){}
+ function upc(){}
+ function kpc(){}
+ function mpc(){}
+ function opc(){}
+ function qpc(){}
+ function ypc(){}
+ function Cpc(){}
+ function Mpc(){}
+ function Qpc(){}
+ function dqc(){}
+ function jqc(){}
+ function Aqc(){}
+ function Eqc(){}
+ function Gqc(){}
+ function Sqc(){}
+ function arc(){}
+ function lrc(){}
+ function zrc(){}
+ function Hrc(){}
+ function bsc(){}
+ function dsc(){}
+ function fsc(){}
+ function ksc(){}
+ function msc(){}
+ function Asc(){}
+ function Csc(){}
+ function Esc(){}
+ function Ksc(){}
+ function Nsc(){}
+ function Ssc(){}
+ function CCc(){}
+ function tGc(){}
+ function aHc(){}
+ function gHc(){}
+ function nIc(){}
+ function PJc(){}
+ function XKc(){}
+ function fLc(){}
+ function hLc(){}
+ function lLc(){}
+ function eNc(){}
+ function IOc(){}
+ function MOc(){}
+ function WOc(){}
+ function YOc(){}
+ function $Oc(){}
+ function cPc(){}
+ function iPc(){}
+ function mPc(){}
+ function oPc(){}
+ function qPc(){}
+ function sPc(){}
+ function wPc(){}
+ function APc(){}
+ function FPc(){}
+ function HPc(){}
+ function NPc(){}
+ function PPc(){}
+ function TPc(){}
+ function VPc(){}
+ function ZPc(){}
+ function _Pc(){}
+ function bQc(){}
+ function dQc(){}
+ function SQc(){}
+ function hRc(){}
+ function HRc(){}
+ function HSc(){}
+ function pSc(){}
+ function xSc(){}
+ function zSc(){}
+ function BSc(){}
+ function DSc(){}
+ function FSc(){}
+ function CTc(){}
+ function ITc(){}
+ function KTc(){}
+ function MTc(){}
+ function XTc(){}
+ function ZTc(){}
+ function jVc(){}
+ function lVc(){}
+ function zVc(){}
+ function IVc(){}
+ function KVc(){}
+ function KWc(){}
+ function uWc(){}
+ function xWc(){}
+ function AWc(){}
+ function QWc(){}
+ function UWc(){}
+ function qXc(){}
+ function KXc(){}
+ function OXc(){}
+ function SXc(){}
+ function $Xc(){}
+ function mYc(){}
+ function rYc(){}
+ function zYc(){}
+ function DYc(){}
+ function FYc(){}
+ function HYc(){}
+ function JYc(){}
+ function cZc(){}
+ function gZc(){}
+ function iZc(){}
+ function pZc(){}
+ function tZc(){}
+ function vZc(){}
+ function AZc(){}
+ function GZc(){}
+ function l_c(){}
+ function l1c(){}
+ function b1c(){}
+ function d1c(){}
+ function h1c(){}
+ function n1c(){}
+ function r1c(){}
+ function v1c(){}
+ function x1c(){}
+ function D1c(){}
+ function H1c(){}
+ function L1c(){}
+ function R1c(){}
+ function V1c(){}
+ function Z1c(){}
+ function Z0c(){}
+ function a0c(){}
+ function c0c(){}
+ function e0c(){}
+ function k0c(){}
+ function o0c(){}
+ function b2c(){}
+ function l2c(){}
+ function p2c(){}
+ function Y2c(){}
+ function _2c(){}
+ function A3c(){}
+ function F3c(){}
+ function I3c(){}
+ function K3c(){}
+ function M3c(){}
+ function Q3c(){}
+ function U3c(){}
+ function c5c(){}
+ function D5c(){}
+ function G5c(){}
+ function J5c(){}
+ function N5c(){}
+ function V5c(){}
+ function p6c(){}
+ function s6c(){}
+ function H6c(){}
+ function K6c(){}
+ function _7c(){}
+ function h8c(){}
+ function j8c(){}
+ function o8c(){}
+ function r8c(){}
+ function u8c(){}
+ function R8c(){}
+ function X8c(){}
+ function o9c(){}
+ function s9c(){}
+ function x9c(){}
+ function Qad(){}
+ function rcd(){}
+ function Xcd(){}
+ function vdd(){}
+ function Tdd(){}
+ function _dd(){}
+ function qed(){}
+ function sed(){}
+ function ved(){}
+ function Hed(){}
+ function Zed(){}
+ function bfd(){}
+ function ifd(){}
+ function Gfd(){}
+ function Ifd(){}
+ function Igd(){}
+ function agd(){}
+ function dgd(){}
+ function pgd(){}
+ function Hgd(){}
+ function Kgd(){}
+ function Mgd(){}
+ function Ogd(){}
+ function Qgd(){}
+ function Sgd(){}
+ function Ugd(){}
+ function Wgd(){}
+ function Ygd(){}
+ function $gd(){}
+ function ahd(){}
+ function chd(){}
+ function ehd(){}
+ function ghd(){}
+ function ihd(){}
+ function khd(){}
+ function mhd(){}
+ function ohd(){}
+ function qhd(){}
+ function shd(){}
+ function Shd(){}
+ function lkd(){}
+ function znd(){}
+ function Jpd(){}
+ function jrd(){}
+ function Mrd(){}
+ function Qrd(){}
+ function Urd(){}
+ function Yrd(){}
+ function Yud(){}
+ function eud(){}
+ function asd(){}
+ function Lsd(){}
+ function btd(){}
+ function dtd(){}
+ function jtd(){}
+ function otd(){}
+ function ztd(){}
+ function Xxd(){}
+ function $yd(){}
+ function rzd(){}
+ function Rzd(){}
+ function KAd(){}
+ function hCd(){}
+ function _Cd(){}
+ function _Sd(){}
+ function OSd(){}
+ function BDd(){}
+ function BId(){}
+ function JId(){}
+ function YHd(){}
+ function fLd(){}
+ function cPd(){}
+ function hQd(){}
+ function AQd(){}
+ function kUd(){}
+ function VUd(){}
+ function pVd(){}
+ function W$d(){}
+ function Z$d(){}
+ function a_d(){}
+ function i_d(){}
+ function v_d(){}
+ function y_d(){}
+ function f1d(){}
+ function L5d(){}
+ function v6d(){}
+ function b8d(){}
+ function e8d(){}
+ function h8d(){}
+ function k8d(){}
+ function n8d(){}
+ function q8d(){}
+ function t8d(){}
+ function w8d(){}
+ function z8d(){}
+ function X9d(){}
+ function _9d(){}
+ function Mae(){}
+ function cbe(){}
+ function ebe(){}
+ function hbe(){}
+ function kbe(){}
+ function nbe(){}
+ function qbe(){}
+ function tbe(){}
+ function wbe(){}
+ function zbe(){}
+ function Cbe(){}
+ function Fbe(){}
+ function Ibe(){}
+ function Lbe(){}
+ function Obe(){}
+ function Rbe(){}
+ function Ube(){}
+ function Xbe(){}
+ function $be(){}
+ function bce(){}
+ function ece(){}
+ function hce(){}
+ function kce(){}
+ function nce(){}
+ function qce(){}
+ function tce(){}
+ function wce(){}
+ function zce(){}
+ function Cce(){}
+ function Fce(){}
+ function Ice(){}
+ function Lce(){}
+ function Oce(){}
+ function Rce(){}
+ function Uce(){}
+ function Xce(){}
+ function $ce(){}
+ function bde(){}
+ function ede(){}
+ function hde(){}
+ function kde(){}
+ function nde(){}
+ function qde(){}
+ function tde(){}
+ function wde(){}
+ function Hie(){}
+ function rke(){}
+ function rne(){}
+ function Ene(){}
+ function Gne(){}
+ function Jne(){}
+ function Mne(){}
+ function Pne(){}
+ function Sne(){}
+ function Vne(){}
+ function Yne(){}
+ function _ne(){}
+ function yme(){}
+ function coe(){}
+ function foe(){}
+ function ioe(){}
+ function loe(){}
+ function ooe(){}
+ function roe(){}
+ function uoe(){}
+ function xoe(){}
+ function Aoe(){}
+ function Doe(){}
+ function Goe(){}
+ function Joe(){}
+ function Moe(){}
+ function Poe(){}
+ function Soe(){}
+ function Voe(){}
+ function Yoe(){}
+ function _oe(){}
+ function cpe(){}
+ function fpe(){}
+ function ipe(){}
+ function lpe(){}
+ function ope(){}
+ function rpe(){}
+ function upe(){}
+ function xpe(){}
+ function Ape(){}
+ function Dpe(){}
+ function Gpe(){}
+ function Jpe(){}
+ function Mpe(){}
+ function Ppe(){}
+ function Spe(){}
+ function Vpe(){}
+ function Ype(){}
+ function _pe(){}
+ function cqe(){}
+ function fqe(){}
+ function iqe(){}
+ function lqe(){}
+ function oqe(){}
+ function rqe(){}
+ function uqe(){}
+ function Tqe(){}
+ function sue(){}
+ function Cue(){}
+ function zl(){wb();}
+ function z7b(){s7b();}
+ function ZHb(){YHb();}
+ function fSb(){eSb();}
+ function vSb(){tSb();}
+ function PUb(){OUb();}
+ function AVb(){yVb();}
+ function RVb(){QVb();}
+ function fWb(){dWb();}
+ function N5b(){H5b();}
+ function $9b(){U9b();}
+ function Lcc(){Hcc();}
+ function pdc(){Zcc();}
+ function pec(){iec();}
+ function pGc(){nGc();}
+ function jGc(){gGc();}
+ function YGc(){SGc();}
+ function cGc(){_Fc();}
+ function NFc(){KFc();}
+ function xgc(){sgc();}
+ function xHc(){tHc();}
+ function pHc(){lHc();}
+ function IHc(){CHc();}
+ function XHc(){RHc();}
+ function boc(){Mnc();}
+ function yqc(){mqc();}
+ function Pzc(){Ozc();}
+ function ACc(){yCc();}
+ function aKc(){YJc();}
+ function FLc(){DLc();}
+ function DNc(){ANc();}
+ function TNc(){JNc();}
+ function iQc(){gQc();}
+ function WRc(){TRc();}
+ function C$c(){B$c();}
+ function J0c(){B0c();}
+ function x0c(){r0c();}
+ function j_c(){h_c();}
+ function N_c(){H_c();}
+ function V_c(){R_c();}
+ function E4c(){D4c();}
+ function a5c(){$4c();}
+ function v7c(){u7c();}
+ function Z7c(){X7c();}
+ function pcd(){ncd();}
+ function Lcd(){Kcd();}
+ function Vcd(){Tcd();}
+ function fUd(){TTd();}
+ function Bfd(){Afd();}
+ function jkd(){hkd();}
+ function vmd(){umd();}
+ function xnd(){vnd();}
+ function Hpd(){Fpd();}
+ function HYd(){lYd();}
+ function yAd(){qAd();}
+ function gke(){rue();}
+ function Yxb(a){uFb(a);}
+ function Yb(a){this.a=a;}
+ function cc(a){this.a=a;}
+ function df(a){this.a=a;}
+ function kf(a){this.a=a;}
+ function kj(a){this.a=a;}
+ function qj(a){this.a=a;}
+ function Lj(a){this.a=a;}
+ function jh(a){this.a=a;}
+ function th(a){this.a=a;}
+ function Bh(a){this.a=a;}
+ function Xh(a){this.a=a;}
+ function Xn(a){this.a=a;}
+ function Di(a){this.a=a;}
+ function Ki(a){this.a=a;}
+ function Ik(a){this.a=a;}
+ function Qk(a){this.a=a;}
+ function mp(a){this.a=a;}
+ function Lp(a){this.a=a;}
+ function iq(a){this.a=a;}
+ function Eq(a){this.a=a;}
+ function Vq(a){this.a=a;}
+ function Or(a){this.a=a;}
+ function $r(a){this.b=a;}
+ function Aj(a){this.c=a;}
+ function vu(a){this.a=a;}
+ function vw(a){this.a=a;}
+ function gw(a){this.a=a;}
+ function lw(a){this.a=a;}
+ function Iw(a){this.a=a;}
+ function Nw(a){this.a=a;}
+ function Sw(a){this.a=a;}
+ function ex(a){this.a=a;}
+ function fx(a){this.a=a;}
+ function lx(a){this.a=a;}
+ function my(a){this.a=a;}
+ function qy(a){this.a=a;}
+ function Oy(a){this.a=a;}
+ function NB(a){this.a=a;}
+ function XB(a){this.a=a;}
+ function hC(a){this.a=a;}
+ function vC(a){this.a=a;}
+ function MB(){this.a=[];}
+ function HEb(a,b){a.a=b;}
+ function E2b(a,b){a.a=b;}
+ function F2b(a,b){a.b=b;}
+ function PRb(a,b){a.b=b;}
+ function RRb(a,b){a.b=b;}
+ function QJb(a,b){a.j=b;}
+ function hQb(a,b){a.g=b;}
+ function iQb(a,b){a.i=b;}
+ function _Tb(a,b){a.c=b;}
+ function G2b(a,b){a.c=b;}
+ function H2b(a,b){a.d=b;}
+ function aUb(a,b){a.d=b;}
+ function h3b(a,b){a.k=b;}
+ function O3b(a,b){a.c=b;}
+ function Tmc(a,b){a.c=b;}
+ function Smc(a,b){a.a=b;}
+ function DJc(a,b){a.a=b;}
+ function EJc(a,b){a.f=b;}
+ function NSc(a,b){a.a=b;}
+ function OSc(a,b){a.b=b;}
+ function PSc(a,b){a.d=b;}
+ function QSc(a,b){a.i=b;}
+ function RSc(a,b){a.o=b;}
+ function SSc(a,b){a.r=b;}
+ function yUc(a,b){a.a=b;}
+ function zUc(a,b){a.b=b;}
+ function q3c(a,b){a.e=b;}
+ function r3c(a,b){a.f=b;}
+ function s3c(a,b){a.g=b;}
+ function Y9c(a,b){a.e=b;}
+ function Z9c(a,b){a.f=b;}
+ function kad(a,b){a.f=b;}
+ function Ntd(a,b){a.a=b;}
+ function Otd(a,b){a.b=b;}
+ function BWd(a,b){a.n=b;}
+ function $ee(a,b){a.a=b;}
+ function _ee(a,b){a.c=b;}
+ function ife(a,b){a.c=b;}
+ function Efe(a,b){a.c=b;}
+ function hfe(a,b){a.a=b;}
+ function Dfe(a,b){a.a=b;}
+ function jfe(a,b){a.d=b;}
+ function Ffe(a,b){a.d=b;}
+ function kfe(a,b){a.e=b;}
+ function Gfe(a,b){a.e=b;}
+ function lfe(a,b){a.g=b;}
+ function Hfe(a,b){a.f=b;}
+ function Ife(a,b){a.j=b;}
+ function wme(a,b){a.a=b;}
+ function Fme(a,b){a.a=b;}
+ function xme(a,b){a.b=b;}
+ function gmc(a){a.b=a.a;}
+ function Lg(a){a.c=a.d.d;}
+ function fgb(a){this.a=a;}
+ function zgb(a){this.a=a;}
+ function Xgb(a){this.a=a;}
+ function Xkb(a){this.a=a;}
+ function mkb(a){this.a=a;}
+ function reb(a){this.a=a;}
+ function Seb(a){this.a=a;}
+ function bfb(a){this.a=a;}
+ function Tfb(a){this.a=a;}
+ function blb(a){this.a=a;}
+ function glb(a){this.a=a;}
+ function llb(a){this.a=a;}
+ function Ulb(a){this.a=a;}
+ function _lb(a){this.a=a;}
+ function Plb(a){this.b=a;}
+ function Ppb(a){this.b=a;}
+ function xpb(a){this.b=a;}
+ function mpb(a){this.a=a;}
+ function Yqb(a){this.a=a;}
+ function uqb(a){this.c=a;}
+ function Anb(a){this.c=a;}
+ function zwb(a){this.c=a;}
+ function Dkb(a){this.d=a;}
+ function brb(a){this.a=a;}
+ function Frb(a){this.a=a;}
+ function hsb(a){this.a=a;}
+ function ctb(a){this.a=a;}
+ function cxb(a){this.a=a;}
+ function axb(a){this.a=a;}
+ function exb(a){this.a=a;}
+ function gxb(a){this.a=a;}
+ function wub(a){this.a=a;}
+ function zAb(a){this.a=a;}
+ function JAb(a){this.a=a;}
+ function LAb(a){this.a=a;}
+ function PAb(a){this.a=a;}
+ function VBb(a){this.a=a;}
+ function lCb(a){this.a=a;}
+ function nCb(a){this.a=a;}
+ function pCb(a){this.a=a;}
+ function CCb(a){this.a=a;}
+ function GCb(a){this.a=a;}
+ function bDb(a){this.a=a;}
+ function dDb(a){this.a=a;}
+ function fDb(a){this.a=a;}
+ function uDb(a){this.a=a;}
+ function $Db(a){this.a=a;}
+ function aEb(a){this.a=a;}
+ function eEb(a){this.a=a;}
+ function OEb(a){this.a=a;}
+ function SEb(a){this.a=a;}
+ function SFb(a){this.a=a;}
+ function HFb(a){this.a=a;}
+ function NFb(a){this.a=a;}
+ function WGb(a){this.a=a;}
+ function HJb(a){this.a=a;}
+ function PJb(a){this.a=a;}
+ function kNb(a){this.a=a;}
+ function tOb(a){this.a=a;}
+ function APb(a){this.a=a;}
+ function IQb(a){this.a=a;}
+ function bTb(a){this.a=a;}
+ function dTb(a){this.a=a;}
+ function wTb(a){this.a=a;}
+ function GWb(a){this.a=a;}
+ function UWb(a){this.a=a;}
+ function WWb(a){this.a=a;}
+ function fXb(a){this.a=a;}
+ function jXb(a){this.a=a;}
+ function M0b(a){this.a=a;}
+ function r1b(a){this.a=a;}
+ function D1b(a){this.e=a;}
+ function T3b(a){this.a=a;}
+ function W3b(a){this.a=a;}
+ function _3b(a){this.a=a;}
+ function c4b(a){this.a=a;}
+ function s5b(a){this.a=a;}
+ function u5b(a){this.a=a;}
+ function y5b(a){this.a=a;}
+ function C5b(a){this.a=a;}
+ function Q5b(a){this.a=a;}
+ function S5b(a){this.a=a;}
+ function U5b(a){this.a=a;}
+ function W5b(a){this.a=a;}
+ function l7b(a){this.a=a;}
+ function p7b(a){this.a=a;}
+ function k8b(a){this.a=a;}
+ function L8b(a){this.a=a;}
+ function Rac(a){this.a=a;}
+ function Xac(a){this.a=a;}
+ function $ac(a){this.a=a;}
+ function bbc(a){this.a=a;}
+ function Cdc(a){this.a=a;}
+ function Edc(a){this.a=a;}
+ function Ehc(a){this.a=a;}
+ function khc(a){this.a=a;}
+ function Ihc(a){this.a=a;}
+ function qfc(a){this.a=a;}
+ function tfc(a){this.a=a;}
+ function Wfc(a){this.a=a;}
+ function Fic(a){this.a=a;}
+ function Vic(a){this.a=a;}
+ function fjc(a){this.a=a;}
+ function pjc(a){this.a=a;}
+ function ckc(a){this.a=a;}
+ function hkc(a){this.a=a;}
+ function Ykc(a){this.a=a;}
+ function $kc(a){this.a=a;}
+ function alc(a){this.a=a;}
+ function glc(a){this.a=a;}
+ function ilc(a){this.a=a;}
+ function slc(a){this.a=a;}
+ function Clc(a){this.a=a;}
+ function xoc(a){this.a=a;}
+ function zoc(a){this.a=a;}
+ function spc(a){this.a=a;}
+ function Vqc(a){this.a=a;}
+ function Xqc(a){this.a=a;}
+ function Gsc(a){this.a=a;}
+ function Isc(a){this.a=a;}
+ function JGc(a){this.a=a;}
+ function NGc(a){this.a=a;}
+ function MHc(a){this.a=a;}
+ function JIc(a){this.a=a;}
+ function fJc(a){this.a=a;}
+ function BJc(a){this.a=a;}
+ function dJc(a){this.c=a;}
+ function Trc(a){this.b=a;}
+ function eKc(a){this.a=a;}
+ function IKc(a){this.a=a;}
+ function KKc(a){this.a=a;}
+ function MKc(a){this.a=a;}
+ function yLc(a){this.a=a;}
+ function HMc(a){this.a=a;}
+ function LMc(a){this.a=a;}
+ function PMc(a){this.a=a;}
+ function TMc(a){this.a=a;}
+ function XMc(a){this.a=a;}
+ function ZMc(a){this.a=a;}
+ function aNc(a){this.a=a;}
+ function jNc(a){this.a=a;}
+ function aPc(a){this.a=a;}
+ function gPc(a){this.a=a;}
+ function kPc(a){this.a=a;}
+ function yPc(a){this.a=a;}
+ function CPc(a){this.a=a;}
+ function JPc(a){this.a=a;}
+ function RPc(a){this.a=a;}
+ function XPc(a){this.a=a;}
+ function mRc(a){this.a=a;}
+ function xTc(a){this.a=a;}
+ function CWc(a){this.a=a;}
+ function EWc(a){this.a=a;}
+ function IWc(a){this.a=a;}
+ function OWc(a){this.a=a;}
+ function dXc(a){this.a=a;}
+ function gXc(a){this.a=a;}
+ function EXc(a){this.a=a;}
+ function WXc(a){this.a=a;}
+ function YXc(a){this.a=a;}
+ function aYc(a){this.a=a;}
+ function cYc(a){this.a=a;}
+ function eYc(a){this.a=a;}
+ function iYc(a){this.a=a;}
+ function i0c(a){this.a=a;}
+ function g0c(a){this.a=a;}
+ function P1c(a){this.a=a;}
+ function Sad(a){this.a=a;}
+ function Uad(a){this.a=a;}
+ function Wad(a){this.a=a;}
+ function Yad(a){this.a=a;}
+ function cbd(a){this.a=a;}
+ function ydd(a){this.a=a;}
+ function Kdd(a){this.a=a;}
+ function Mdd(a){this.a=a;}
+ function _ed(a){this.a=a;}
+ function dfd(a){this.a=a;}
+ function Kfd(a){this.a=a;}
+ function prd(a){this.a=a;}
+ function $rd(a){this.a=a;}
+ function csd(a){this.a=a;}
+ function Usd(a){this.a=a;}
+ function Vtd(a){this.a=a;}
+ function wud(a){this.a=a;}
+ function Rud(a){this.f=a;}
+ function LEd(a){this.a=a;}
+ function UEd(a){this.a=a;}
+ function VEd(a){this.a=a;}
+ function WEd(a){this.a=a;}
+ function XEd(a){this.a=a;}
+ function YEd(a){this.a=a;}
+ function ZEd(a){this.a=a;}
+ function $Ed(a){this.a=a;}
+ function _Ed(a){this.a=a;}
+ function aFd(a){this.a=a;}
+ function gFd(a){this.a=a;}
+ function iFd(a){this.a=a;}
+ function jFd(a){this.a=a;}
+ function kFd(a){this.a=a;}
+ function lFd(a){this.a=a;}
+ function nFd(a){this.a=a;}
+ function qFd(a){this.a=a;}
+ function wFd(a){this.a=a;}
+ function xFd(a){this.a=a;}
+ function zFd(a){this.a=a;}
+ function AFd(a){this.a=a;}
+ function BFd(a){this.a=a;}
+ function CFd(a){this.a=a;}
+ function DFd(a){this.a=a;}
+ function MFd(a){this.a=a;}
+ function OFd(a){this.a=a;}
+ function QFd(a){this.a=a;}
+ function SFd(a){this.a=a;}
+ function uGd(a){this.a=a;}
+ function QGd(a){this.a=a;}
+ function jGd(a){this.b=a;}
+ function YOd(a){this.a=a;}
+ function ePd(a){this.a=a;}
+ function kPd(a){this.a=a;}
+ function qPd(a){this.a=a;}
+ function IPd(a){this.a=a;}
+ function w$d(a){this.a=a;}
+ function e_d(a){this.a=a;}
+ function Q_d(a){this.b=a;}
+ function c1d(a){this.a=a;}
+ function c2d(a){this.a=a;}
+ function l5d(a){this.a=a;}
+ function I9d(a){this.a=a;}
+ function L6d(a){this.c=a;}
+ function t7d(a){this.e=a;}
+ function pae(a){this.a=a;}
+ function xae(a){this.a=a;}
+ function Zde(a){this.a=a;}
+ function Sde(a){this.d=a;}
+ function mee(a){this.a=a;}
+ function uje(a){this.a=a;}
+ function Bte(a){this.a=a;}
+ function Wse(a){this.e=a;}
+ function Xsd(){this.a=0;}
+ function Tsb(){akb(this);}
+ function bnb(){Pmb(this);}
+ function cHb(){bHb(this);}
+ function I2b(){}
+ function s2d(){this.c=d2d;}
+ function Prc(a,b){a.b+=b;}
+ function Uje(a,b){b.Wb(a);}
+ function UC(a){return a.a}
+ function nC(a){return a.a}
+ function BC(a){return a.a}
+ function TB(a){return a.a}
+ function _B(a){return a.a}
+ function Adb(a){return a.e}
+ function gC(){return null}
+ function MC(){return null}
+ function leb(){MId();OId();}
+ function qMb(a){a.b.Of(a.e);}
+ function A$b(a){a.b=new Ri;}
+ function A8b(a,b){a.b=b-a.b;}
+ function x8b(a,b){a.a=b-a.a;}
+ function ZEb(a,b){a.push(b);}
+ function bFb(a,b){a.sort(b);}
+ function Q5c(a,b){b.jd(a.a);}
+ function Voc(a,b){Q3b(b,a);}
+ function tp(a,b,c){a.Yd(c,b);}
+ function Ss(a,b){a.e=b;b.b=a;}
+ function im(a){_l();this.a=a;}
+ function xq(a){_l();this.a=a;}
+ function Gq(a){_l();this.a=a;}
+ function Xq(a){tm();this.a=a;}
+ function gA(a){fA();eA.le(a);}
+ function vA(){vA=geb;new Tsb;}
+ function xz(){mz.call(this);}
+ function Ceb(){mz.call(this);}
+ function ueb(){xz.call(this);}
+ function yeb(){xz.call(this);}
+ function Hfb(){xz.call(this);}
+ function _fb(){xz.call(this);}
+ function cgb(){xz.call(this);}
+ function Ngb(){xz.call(this);}
+ function jib(){xz.call(this);}
+ function Jrb(){xz.call(this);}
+ function Srb(){xz.call(this);}
+ function Dvb(){xz.call(this);}
+ function Ied(){xz.call(this);}
+ function R1d(){this.a=this;}
+ function k1d(){this.Bb|=256;}
+ function vWb(){this.b=new Et;}
+ function aFb(a,b){a.length=b;}
+ function dyb(a,b){Rmb(a.a,b);}
+ function jNb(a,b){LKb(a.c,b);}
+ function qRc(a,b){Ysb(a.b,b);}
+ function VOd(a,b){UNd(a.a,b);}
+ function WOd(a,b){VNd(a.a,b);}
+ function eZd(a,b){qvd(a.e,b);}
+ function Cke(a){bge(a.c,a.b);}
+ function uj(a,b){a.kc().Nb(b);}
+ function Ufb(a){this.a=Zfb(a);}
+ function _sb(){this.a=new Tsb;}
+ function $Ab(){this.a=new Tsb;}
+ function xAb(){this.a=new dzb;}
+ function gyb(){this.a=new bnb;}
+ function BIb(){this.a=new bnb;}
+ function GIb(){this.a=new bnb;}
+ function wIb(){this.a=new pIb;}
+ function gJb(){this.a=new DIb;}
+ function TTb(){this.a=new DTb;}
+ function jGb(){this.a=new fGb;}
+ function qGb(){this.a=new kGb;}
+ function q_b(){this.a=new bnb;}
+ function E_b(){this.a=new bnb;}
+ function EZb(){this.a=new bnb;}
+ function J$b(){this.a=new bnb;}
+ function YNb(){this.d=new bnb;}
+ function lXb(){this.a=new RWb;}
+ function y_b(){this.a=new _sb;}
+ function k5b(){this.a=new Tsb;}
+ function E0b(){this.b=new Tsb;}
+ function jHc(){this.b=new bnb;}
+ function ZNc(){this.e=new bnb;}
+ function ahc(){this.a=new boc;}
+ function UQc(){this.d=new bnb;}
+ function uRc(){tRc.call(this);}
+ function BRc(){tRc.call(this);}
+ function VOc(){bnb.call(this);}
+ function web(){ueb.call(this);}
+ function Fyb(){gyb.call(this);}
+ function fKb(){RJb.call(this);}
+ function N$b(){J$b.call(this);}
+ function P2b(){I2b.call(this);}
+ function T2b(){P2b.call(this);}
+ function z3b(){I2b.call(this);}
+ function C3b(){z3b.call(this);}
+ function cUc(){aUc.call(this);}
+ function hUc(){aUc.call(this);}
+ function mUc(){aUc.call(this);}
+ function Hdd(){Ddd.call(this);}
+ function ACd(){$yd.call(this);}
+ function PCd(){$yd.call(this);}
+ function Ejd(){Yub.call(this);}
+ function LQd(){wQd.call(this);}
+ function lRd(){wQd.call(this);}
+ function MSd(){Tsb.call(this);}
+ function VSd(){Tsb.call(this);}
+ function eTd(){Tsb.call(this);}
+ function mXd(){HWd.call(this);}
+ function i1d(){_sb.call(this);}
+ function A1d(){k1d.call(this);}
+ function q4d(){dWd.call(this);}
+ function O5d(){Tsb.call(this);}
+ function R5d(){dWd.call(this);}
+ function lae(){Tsb.call(this);}
+ function Cae(){Tsb.call(this);}
+ function ome(){kUd.call(this);}
+ function Hme(){ome.call(this);}
+ function Nme(){kUd.call(this);}
+ function Gre(){Tqe.call(this);}
+ function aUc(){this.a=new _sb;}
+ function nZc(){this.a=new Tsb;}
+ function DZc(){this.a=new bnb;}
+ function Ddd(){this.a=new Tsb;}
+ function Oqd(){this.a=new Yub;}
+ function Oed(){this.j=new bnb;}
+ function obd(){this.a=new nbd;}
+ function wQd(){this.a=new AQd;}
+ function R5c(){this.a=new V5c;}
+ function wb(){wb=geb;vb=new xb;}
+ function Wk(){Wk=geb;Vk=new Xk;}
+ function kl(){kl=geb;jl=new ll;}
+ function ll(){Qk.call(this,'');}
+ function Xk(){Qk.call(this,'');}
+ function Dd(a){yd.call(this,a);}
+ function Hd(a){yd.call(this,a);}
+ function xh(a){th.call(this,a);}
+ function $h(a){Wc.call(this,a);}
+ function Qi(a){Wc.call(this,a);}
+ function wi(a){$h.call(this,a);}
+ function Sp(a){$h.call(this,a);}
+ function Js(a){$h.call(this,a);}
+ function Jp(a){Xo.call(this,a);}
+ function Qp(a){Xo.call(this,a);}
+ function dq(a){ho.call(this,a);}
+ function Fv(a){uv.call(this,a);}
+ function aw(a){Tr.call(this,a);}
+ function cw(a){Tr.call(this,a);}
+ function _w(a){Tr.call(this,a);}
+ function Mx(a){Gn.call(this,a);}
+ function Nx(a){Mx.call(this,a);}
+ function yz(a){nz.call(this,a);}
+ function aC(a){yz.call(this,a);}
+ function uC(){vC.call(this,{});}
+ function cC(){cC=geb;bC=new dC;}
+ function zs(){zs=geb;ys=new As;}
+ function Az(){Az=geb;zz=new nb;}
+ function $z(){$z=geb;Zz=new bA;}
+ function $A(){$A=geb;ZA=new aB;}
+ function Ovb(a){Kvb();this.a=a;}
+ function FKc(a){jKc();this.a=a;}
+ function zud(a){nud();this.f=a;}
+ function Bud(a){nud();this.f=a;}
+ function Cde(a){KMd();this.a=a;}
+ function Lyb(a){a.b=null;a.c=0;}
+ function kz(a,b){a.e=b;hz(a,b);}
+ function NYb(a,b){a.a=b;PYb(a);}
+ function cLb(a,b,c){a.a[b.g]=c;}
+ function zsd(a,b,c){Hsd(c,a,b);}
+ function shc(a,b){Xmc(b.i,a.n);}
+ function HCc(a,b){ICc(a).Cd(b);}
+ function yw(a,b){a.a.ec().Mc(b);}
+ function ns(a,b){return a.g-b.g}
+ function AUb(a,b){return a*a/b}
+ function Heb(a){return uFb(a),a}
+ function Kfb(a){return uFb(a),a}
+ function Mfb(a){return uFb(a),a}
+ function JC(a){return new hC(a)}
+ function LC(a){return new OC(a)}
+ function shb(a){return uFb(a),a}
+ function Chb(a){return uFb(a),a}
+ function teb(a){yz.call(this,a);}
+ function veb(a){yz.call(this,a);}
+ function zeb(a){yz.call(this,a);}
+ function Aeb(a){nz.call(this,a);}
+ function Ifb(a){yz.call(this,a);}
+ function agb(a){yz.call(this,a);}
+ function dgb(a){yz.call(this,a);}
+ function Mgb(a){yz.call(this,a);}
+ function Ogb(a){yz.call(this,a);}
+ function kib(a){yz.call(this,a);}
+ function Jed(a){yz.call(this,a);}
+ function Ked(a){yz.call(this,a);}
+ function CDd(a){yz.call(this,a);}
+ function Mle(a){yz.call(this,a);}
+ function Lqe(a){yz.call(this,a);}
+ function mob(a){uFb(a);this.a=a;}
+ function yYb(a){sYb(a);return a}
+ function Nnb(a){Snb(a,a.length);}
+ function nmb(a){return a.b==a.c}
+ function Vyb(a){return !!a&&a.b}
+ function gLb(a){return !!a&&a.k}
+ function hLb(a){return !!a&&a.j}
+ function F_b(a,b,c){a.c.Ef(b,c);}
+ function Ts(a,b){a.be(b);b.ae(a);}
+ function Fy(a){_l();this.a=Qb(a);}
+ function Gb(){this.a=WD(Qb(pve));}
+ function jc(){throw Adb(new jib)}
+ function jn(){throw Adb(new jib)}
+ function Hh(){throw Adb(new jib)}
+ function Xi(){throw Adb(new jib)}
+ function Xj(){throw Adb(new jib)}
+ function Yj(){throw Adb(new jib)}
+ function Qz(){Qz=geb;!!(fA(),eA);}
+ function Qhb(){reb.call(this,'');}
+ function Rhb(){reb.call(this,'');}
+ function bib(){reb.call(this,'');}
+ function cib(){reb.call(this,'');}
+ function eib(a){veb.call(this,a);}
+ function xeb(a){veb.call(this,a);}
+ function Vgb(a){agb.call(this,a);}
+ function Lqb(a){xpb.call(this,a);}
+ function Sqb(a){Lqb.call(this,a);}
+ function irb(a){Upb.call(this,a);}
+ function pc(a){qc.call(this,a,0);}
+ function Ri(){Si.call(this,12,3);}
+ function WC(a,b){return xfb(a,b)}
+ function cFb(a,b){return dD(a,b)}
+ function Reb(a,b){return a.a-b.a}
+ function afb(a,b){return a.a-b.a}
+ function Wgb(a,b){return a.a-b.a}
+ function pC(b,a){return a in b.a}
+ function Vvb(a){return a.a?a.b:0}
+ function cwb(a){return a.a?a.b:0}
+ function Fxb(a,b,c){b.Cd(a.a[c]);}
+ function Kxb(a,b,c){b.Pe(a.a[c]);}
+ function uKb(a,b){a.b=new sjd(b);}
+ function QGb(a,b){a.b=b;return a}
+ function RGb(a,b){a.c=b;return a}
+ function SGb(a,b){a.f=b;return a}
+ function TGb(a,b){a.g=b;return a}
+ function yJb(a,b){a.a=b;return a}
+ function zJb(a,b){a.f=b;return a}
+ function AJb(a,b){a.k=b;return a}
+ function WNb(a,b){a.a=b;return a}
+ function XNb(a,b){a.e=b;return a}
+ function BYb(a,b){a.e=b;return a}
+ function CYb(a,b){a.f=b;return a}
+ function BRb(a,b){a.b=true;a.d=b;}
+ function WNc(a,b){return a.b-b.b}
+ function KSc(a,b){return a.g-b.g}
+ function pmc(a,b){return a?0:b-1}
+ function qKc(a,b){return a?0:b-1}
+ function pKc(a,b){return a?b-1:0}
+ function uVc(a,b){return a.s-b.s}
+ function Xed(a,b){return b.rg(a)}
+ function Xfd(a,b){a.b=b;return a}
+ function Wfd(a,b){a.a=b;return a}
+ function Yfd(a,b){a.c=b;return a}
+ function Zfd(a,b){a.d=b;return a}
+ function $fd(a,b){a.e=b;return a}
+ function _fd(a,b){a.f=b;return a}
+ function mgd(a,b){a.a=b;return a}
+ function ngd(a,b){a.b=b;return a}
+ function ogd(a,b){a.c=b;return a}
+ function Khd(a,b){a.c=b;return a}
+ function Jhd(a,b){a.b=b;return a}
+ function Lhd(a,b){a.d=b;return a}
+ function Mhd(a,b){a.e=b;return a}
+ function Nhd(a,b){a.f=b;return a}
+ function Ohd(a,b){a.g=b;return a}
+ function Phd(a,b){a.a=b;return a}
+ function Qhd(a,b){a.i=b;return a}
+ function Rhd(a,b){a.j=b;return a}
+ function coc(a,b){Mnc();P3b(b,a);}
+ function bbd(a,b,c){_ad(a.a,b,c);}
+ function Fjd(a){Zub.call(this,a);}
+ function TRb(a){SRb.call(this,a);}
+ function pLc(a){CIc.call(this,a);}
+ function ILc(a){CIc.call(this,a);}
+ function gLd(a){ZHd.call(this,a);}
+ function DPd(a){xPd.call(this,a);}
+ function FPd(a){xPd.call(this,a);}
+ function x2b(){y2b.call(this,'');}
+ function pjd(){this.a=0;this.b=0;}
+ function ATc(){this.b=0;this.a=0;}
+ function lXd(a,b){a.b=0;bWd(a,b);}
+ function Kqd(a,b){a.k=b;return a}
+ function Lqd(a,b){a.j=b;return a}
+ function vfe(a,b){a.c=b;a.b=true;}
+ function Etb(){Etb=geb;Dtb=Gtb();}
+ function bvd(){bvd=geb;avd=OAd();}
+ function dvd(){dvd=geb;cvd=aCd();}
+ function MId(){MId=geb;LId=ygd();}
+ function jTd(){jTd=geb;iTd=Qae();}
+ function Ole(){Ole=geb;Nle=vne();}
+ function Qle(){Qle=geb;Ple=Cne();}
+ function mfb(a){return a.e&&a.e()}
+ function FD(a){return a.l|a.m<<22}
+ function Oc(a,b){return a.c._b(b)}
+ function En(a,b){return Wv(a.b,b)}
+ function Vd(a){return !a?null:a.d}
+ function Vv(a){return !a?null:a.g}
+ function $v(a){return !a?null:a.i}
+ function nfb(a){lfb(a);return a.o}
+ function Khb(a,b){a.a+=b;return a}
+ function Lhb(a,b){a.a+=b;return a}
+ function Ohb(a,b){a.a+=b;return a}
+ function Uhb(a,b){a.a+=b;return a}
+ function _wb(a,b){while(a.Bd(b));}
+ function atb(a){this.a=new Usb(a);}
+ function $tb(){throw Adb(new jib)}
+ function qpb(){throw Adb(new jib)}
+ function rpb(){throw Adb(new jib)}
+ function spb(){throw Adb(new jib)}
+ function vpb(){throw Adb(new jib)}
+ function Opb(){throw Adb(new jib)}
+ function yAb(a){this.a=new ezb(a);}
+ function H2c(){this.a=new Wed(s0);}
+ function TVc(){this.b=new Wed(H$);}
+ function l6c(){this.a=new Wed(V0);}
+ function $ad(){this.b=new Wed(I1);}
+ function nbd(){this.b=new Wed(I1);}
+ function T2c(a){this.a=0;this.b=a;}
+ function Bib(a){tib();vib(this,a);}
+ function QDb(a){LCb(a);return a.a}
+ function dvb(a){return a.b!=a.d.c}
+ function AMc(a,b){return a.d[b.p]}
+ function ued(a,b){return ned(a,b)}
+ function $Eb(a,b,c){a.splice(b,c);}
+ function ixb(a,b){while(a.Re(b));}
+ function NKb(a){a.c?MKb(a):OKb(a);}
+ function mQd(){throw Adb(new jib)}
+ function nQd(){throw Adb(new jib)}
+ function oQd(){throw Adb(new jib)}
+ function pQd(){throw Adb(new jib)}
+ function qQd(){throw Adb(new jib)}
+ function rQd(){throw Adb(new jib)}
+ function sQd(){throw Adb(new jib)}
+ function tQd(){throw Adb(new jib)}
+ function uQd(){throw Adb(new jib)}
+ function vQd(){throw Adb(new jib)}
+ function zue(){throw Adb(new Dvb)}
+ function Aue(){throw Adb(new Dvb)}
+ function oue(a){this.a=new Dte(a);}
+ function Dte(a){Cte(this,a,sse());}
+ function cve(a){return !a||bve(a)}
+ function Cqe(a){return xqe[a]!=-1}
+ function Yz(){Nz!=0&&(Nz=0);Pz=-1;}
+ function beb(){_db==null&&(_db=[]);}
+ function eg(a,b){zf.call(this,a,b);}
+ function gg(a,b){eg.call(this,a,b);}
+ function Nj(a,b){this.a=a;this.b=b;}
+ function hk(a,b){this.a=a;this.b=b;}
+ function nk(a,b){this.a=a;this.b=b;}
+ function pk(a,b){this.a=a;this.b=b;}
+ function xk(a,b){this.a=a;this.b=b;}
+ function zk(a,b){this.a=a;this.b=b;}
+ function Kk(a,b){this.a=a;this.b=b;}
+ function ne(a,b){this.e=a;this.d=b;}
+ function Hf(a,b){this.b=a;this.c=b;}
+ function cp(a,b){this.b=a;this.a=b;}
+ function Cp(a,b){this.b=a;this.a=b;}
+ function qr(a,b){this.b=a;this.a=b;}
+ function Rr(a,b){this.b=a;this.a=b;}
+ function vr(a,b){this.a=a;this.b=b;}
+ function su(a,b){this.a=a;this.b=b;}
+ function Hu(a,b){this.a=a;this.f=b;}
+ function gp(a,b){this.g=a;this.i=b;}
+ function qs(a,b){this.f=a;this.g=b;}
+ function Gv(a,b){this.b=a;this.c=b;}
+ function Wc(a){Lb(a.dc());this.c=a;}
+ function Ex(a,b){this.a=a;this.b=b;}
+ function ey(a,b){this.a=a;this.b=b;}
+ function pv(a){this.a=RD(Qb(a),15);}
+ function uv(a){this.a=RD(Qb(a),15);}
+ function nw(a){this.a=RD(Qb(a),85);}
+ function rf(a){this.b=RD(Qb(a),85);}
+ function Tr(a){this.b=RD(Qb(a),51);}
+ function uB(){this.q=new $wnd.Date;}
+ function CC(a,b){this.a=a;this.b=b;}
+ function Bt(a,b){return Ujb(a.b,b)}
+ function tpb(a,b){return a.b.Hc(b)}
+ function upb(a,b){return a.b.Ic(b)}
+ function wpb(a,b){return a.b.Qc(b)}
+ function Pqb(a,b){return a.b.Hc(b)}
+ function pqb(a,b){return a.c.uc(b)}
+ function rqb(a,b){return pb(a.c,b)}
+ function Zsb(a,b){return a.a._b(b)}
+ function Xp(a,b){return a>b&&b0}
+ function Ldb(a,b){return Ddb(a,b)<0}
+ function Urb(a,b){return Bsb(a.a,b)}
+ function Beb(a,b){oz.call(this,a,b);}
+ function Qx(a){Px();ho.call(this,a);}
+ function Lnb(a,b){Pnb(a,a.length,b);}
+ function Mnb(a,b){Rnb(a,a.length,b);}
+ function Ktb(a,b){return a.a.get(b)}
+ function bub(a,b){return Ujb(a.e,b)}
+ function Zxb(a){return uFb(a),false}
+ function zw(a){this.a=RD(Qb(a),229);}
+ function $wb(a){Swb.call(this,a,21);}
+ function dAb(a,b){qs.call(this,a,b);}
+ function yBb(a,b){qs.call(this,a,b);}
+ function ssb(a,b){this.b=a;this.a=b;}
+ function xlb(a,b){this.d=a;this.e=b;}
+ function jEb(a,b){this.a=a;this.b=b;}
+ function pEb(a,b){this.a=a;this.b=b;}
+ function vEb(a,b){this.a=a;this.b=b;}
+ function BEb(a,b){this.a=a;this.b=b;}
+ function TFb(a,b){this.a=a;this.b=b;}
+ function QEb(a,b){this.b=a;this.a=b;}
+ function sHb(a,b){this.b=a;this.a=b;}
+ function EHb(a,b){qs.call(this,a,b);}
+ function MHb(a,b){qs.call(this,a,b);}
+ function jIb(a,b){qs.call(this,a,b);}
+ function $Jb(a,b){qs.call(this,a,b);}
+ function FKb(a,b){qs.call(this,a,b);}
+ function wLb(a,b){qs.call(this,a,b);}
+ function nOb(a,b){qs.call(this,a,b);}
+ function kPb(a,b){this.b=a;this.a=b;}
+ function JPb(a,b){qs.call(this,a,b);}
+ function fRb(a,b){this.b=a;this.a=b;}
+ function JRb(a,b){qs.call(this,a,b);}
+ function OTb(a,b){this.b=a;this.a=b;}
+ function UUb(a,b){qs.call(this,a,b);}
+ function BWb(a,b){qs.call(this,a,b);}
+ function tXb(a,b){qs.call(this,a,b);}
+ function XEb(a,b,c){a.splice(b,0,c);}
+ function pr(a,b,c){a.Mb(c)&&b.Cd(c);}
+ function lEb(a,b,c){b.Pe(a.a.Ye(c));}
+ function rEb(a,b,c){b.Dd(a.a.Ze(c));}
+ function xEb(a,b,c){b.Cd(a.a.Kb(c));}
+ function eYb(a,b){return Csb(a.c,b)}
+ function cGb(a,b){return Csb(a.e,b)}
+ function qZb(a,b){qs.call(this,a,b);}
+ function V$b(a,b){qs.call(this,a,b);}
+ function s3b(a,b){qs.call(this,a,b);}
+ function Q8b(a,b){qs.call(this,a,b);}
+ function icc(a,b){qs.call(this,a,b);}
+ function xec(a,b){qs.call(this,a,b);}
+ function gic(a,b){this.a=a;this.b=b;}
+ function Xic(a,b){this.a=a;this.b=b;}
+ function h4b(a,b){this.a=a;this.b=b;}
+ function vjc(a,b){this.a=a;this.b=b;}
+ function xjc(a,b){this.a=a;this.b=b;}
+ function Hjc(a,b){this.a=a;this.b=b;}
+ function hjc(a,b){this.b=a;this.a=b;}
+ function Jjc(a,b){this.b=a;this.a=b;}
+ function _Yb(a,b){this.b=a;this.a=b;}
+ function eZb(a,b){this.c=a;this.d=b;}
+ function Q1b(a,b){this.e=a;this.d=b;}
+ function Tjc(a,b){this.a=a;this.b=b;}
+ function ulc(a,b){this.a=a;this.b=b;}
+ function Elc(a,b){this.a=a;this.b=b;}
+ function fqc(a,b){this.b=a;this.a=b;}
+ function smc(a,b){this.b=b;this.c=a;}
+ function fnc(a,b){qs.call(this,a,b);}
+ function Cnc(a,b){qs.call(this,a,b);}
+ function koc(a,b){qs.call(this,a,b);}
+ function ktc(a,b){qs.call(this,a,b);}
+ function ctc(a,b){qs.call(this,a,b);}
+ function utc(a,b){qs.call(this,a,b);}
+ function Ftc(a,b){qs.call(this,a,b);}
+ function Rtc(a,b){qs.call(this,a,b);}
+ function _tc(a,b){qs.call(this,a,b);}
+ function iuc(a,b){qs.call(this,a,b);}
+ function vuc(a,b){qs.call(this,a,b);}
+ function Duc(a,b){qs.call(this,a,b);}
+ function Puc(a,b){qs.call(this,a,b);}
+ function _uc(a,b){qs.call(this,a,b);}
+ function pvc(a,b){qs.call(this,a,b);}
+ function yvc(a,b){qs.call(this,a,b);}
+ function Hvc(a,b){qs.call(this,a,b);}
+ function Pvc(a,b){qs.call(this,a,b);}
+ function dxc(a,b){qs.call(this,a,b);}
+ function bDc(a,b){qs.call(this,a,b);}
+ function nDc(a,b){qs.call(this,a,b);}
+ function yDc(a,b){qs.call(this,a,b);}
+ function LDc(a,b){qs.call(this,a,b);}
+ function bEc(a,b){qs.call(this,a,b);}
+ function lEc(a,b){qs.call(this,a,b);}
+ function tEc(a,b){qs.call(this,a,b);}
+ function CEc(a,b){qs.call(this,a,b);}
+ function LEc(a,b){qs.call(this,a,b);}
+ function UEc(a,b){qs.call(this,a,b);}
+ function mFc(a,b){qs.call(this,a,b);}
+ function vFc(a,b){qs.call(this,a,b);}
+ function EFc(a,b){qs.call(this,a,b);}
+ function SKc(a,b){qs.call(this,a,b);}
+ function cNc(a,b){this.b=a;this.a=b;}
+ function tNc(a,b){qs.call(this,a,b);}
+ function QOc(a,b){this.a=a;this.b=b;}
+ function ePc(a,b){this.a=a;this.b=b;}
+ function LPc(a,b){this.a=a;this.b=b;}
+ function xQc(a,b){qs.call(this,a,b);}
+ function FQc(a,b){qs.call(this,a,b);}
+ function MQc(a,b){this.a=a;this.b=b;}
+ function FMc(a,b){dMc();return b!=a}
+ function Uvb(a){sFb(a.a);return a.b}
+ function qYb(a){rYb(a,a.c);return a}
+ function Itb(){Etb();return new Dtb}
+ function _ec(){Rec();this.a=new e6b;}
+ function lSc(){dSc();this.a=new _sb;}
+ function aRc(){WQc();this.b=new _sb;}
+ function xRc(a,b){this.b=a;this.d=b;}
+ function nVc(a,b){this.a=a;this.b=b;}
+ function pVc(a,b){this.a=a;this.b=b;}
+ function GWc(a,b){this.a=a;this.b=b;}
+ function IXc(a,b){this.b=a;this.a=b;}
+ function gTc(a,b){qs.call(this,a,b);}
+ function eVc(a,b){qs.call(this,a,b);}
+ function $Vc(a,b){qs.call(this,a,b);}
+ function XYc(a,b){qs.call(this,a,b);}
+ function MZc(a,b){qs.call(this,a,b);}
+ function t_c(a,b){qs.call(this,a,b);}
+ function B_c(a,b){qs.call(this,a,b);}
+ function z2c(a,b){qs.call(this,a,b);}
+ function h3c(a,b){qs.call(this,a,b);}
+ function $3c(a,b){qs.call(this,a,b);}
+ function i4c(a,b){qs.call(this,a,b);}
+ function l5c(a,b){qs.call(this,a,b);}
+ function v5c(a,b){qs.call(this,a,b);}
+ function g6c(a,b){qs.call(this,a,b);}
+ function A6c(a,b){qs.call(this,a,b);}
+ function a7c(a,b){qs.call(this,a,b);}
+ function B8c(a,b){qs.call(this,a,b);}
+ function d9c(a,b){qs.call(this,a,b);}
+ function D9c(a,b){qs.call(this,a,b);}
+ function tad(a,b){qs.call(this,a,b);}
+ function hbd(a,b){qs.call(this,a,b);}
+ function Nbd(a,b){qs.call(this,a,b);}
+ function Ybd(a,b){qs.call(this,a,b);}
+ function ndd(a,b){qs.call(this,a,b);}
+ function z1c(a,b){this.b=a;this.a=b;}
+ function B1c(a,b){this.b=a;this.a=b;}
+ function d2c(a,b){this.b=a;this.a=b;}
+ function f2c(a,b){this.b=a;this.a=b;}
+ function m9c(a,b){this.a=a;this.b=b;}
+ function xed(a,b){this.a=a;this.b=b;}
+ function ffd(a,b){this.a=a;this.b=b;}
+ function rjd(a,b){this.a=a;this.b=b;}
+ function Sjd(a,b){qs.call(this,a,b);}
+ function Zhd(a,b){qs.call(this,a,b);}
+ function lid(a,b){qs.call(this,a,b);}
+ function vkd(a,b){qs.call(this,a,b);}
+ function Gmd(a,b){qs.call(this,a,b);}
+ function Pmd(a,b){qs.call(this,a,b);}
+ function Zmd(a,b){qs.call(this,a,b);}
+ function jnd(a,b){qs.call(this,a,b);}
+ function Gnd(a,b){qs.call(this,a,b);}
+ function Rnd(a,b){qs.call(this,a,b);}
+ function eod(a,b){qs.call(this,a,b);}
+ function qod(a,b){qs.call(this,a,b);}
+ function Eod(a,b){qs.call(this,a,b);}
+ function Qod(a,b){qs.call(this,a,b);}
+ function upd(a,b){qs.call(this,a,b);}
+ function Rpd(a,b){qs.call(this,a,b);}
+ function eqd(a,b){qs.call(this,a,b);}
+ function nqd(a,b){qs.call(this,a,b);}
+ function vqd(a,b){qs.call(this,a,b);}
+ function Hrd(a,b){qs.call(this,a,b);}
+ function esd(a,b){this.a=a;this.b=b;}
+ function gsd(a,b){this.a=a;this.b=b;}
+ function isd(a,b){this.a=a;this.b=b;}
+ function Osd(a,b){this.a=a;this.b=b;}
+ function Qsd(a,b){this.a=a;this.b=b;}
+ function Ssd(a,b){this.a=a;this.b=b;}
+ function Ptd(a,b){this.a=a;this.b=b;}
+ function JEd(a,b){this.a=a;this.b=b;}
+ function KEd(a,b){this.a=a;this.b=b;}
+ function MEd(a,b){this.a=a;this.b=b;}
+ function NEd(a,b){this.a=a;this.b=b;}
+ function QEd(a,b){this.a=a;this.b=b;}
+ function REd(a,b){this.a=a;this.b=b;}
+ function SEd(a,b){this.b=a;this.a=b;}
+ function TEd(a,b){this.b=a;this.a=b;}
+ function bFd(a,b){this.b=a;this.a=b;}
+ function dFd(a,b){this.b=a;this.a=b;}
+ function fFd(a,b){this.a=a;this.b=b;}
+ function hFd(a,b){this.a=a;this.b=b;}
+ function utd(a,b){qs.call(this,a,b);}
+ function sFd(a,b){this.a=a;this.b=b;}
+ function uFd(a,b){this.a=a;this.b=b;}
+ function bGd(a,b){qs.call(this,a,b);}
+ function uId(a,b){this.f=a;this.c=b;}
+ function Ofd(a,b){return Csb(a.g,b)}
+ function Tqc(a,b){return Csb(b.b,a)}
+ function HPd(a,b){return QNd(a.a,b)}
+ function Idd(a,b){return -a.b.af(b)}
+ function IId(a,b){!!a&&Zjb(CId,a,b);}
+ function yWd(a,b){a.i=null;zWd(a,b);}
+ function kEd(a,b,c){pDd(b,KDd(a,c));}
+ function lEd(a,b,c){pDd(b,KDd(a,c));}
+ function mFd(a,b){vEd(a.a,RD(b,58));}
+ function _Mc(a,b){GMc(a.a,RD(b,12));}
+ function KTd(a,b){this.a=a;this.b=b;}
+ function NTd(a,b){this.a=a;this.b=b;}
+ function B5d(a,b){this.a=a;this.b=b;}
+ function Z6d(a,b){this.a=a;this.b=b;}
+ function Ble(a,b){this.a=a;this.b=b;}
+ function afe(a,b){this.d=a;this.b=b;}
+ function wfe(a,b){this.e=a;this.a=b;}
+ function Eke(a,b){this.b=a;this.c=b;}
+ function zNd(a,b){this.i=a;this.g=b;}
+ function kZd(a,b){this.d=a;this.e=b;}
+ function ave(a,b){eve(new dMd(a),b);}
+ function Dke(a){return pge(a.c,a.b)}
+ function Wd(a){return !a?null:a.md()}
+ function dE(a){return a==null?null:a}
+ function bE(a){return typeof a===jve}
+ function $D(a){return typeof a===hve}
+ function _D(a){return typeof a===ive}
+ function Gdb(a,b){return Ddb(a,b)==0}
+ function Jdb(a,b){return Ddb(a,b)>=0}
+ function Pdb(a,b){return Ddb(a,b)!=0}
+ function ar(a,b){return zr(a.Kc(),b)}
+ function Qm(a,b){return a.Rd().Xb(b)}
+ function kg(a){ig(a);return a.d.gc()}
+ function fE(a){CFb(a==null);return a}
+ function Mhb(a,b){a.a+=''+b;return a}
+ function Nhb(a,b){a.a+=''+b;return a}
+ function Whb(a,b){a.a+=''+b;return a}
+ function Yhb(a,b){a.a+=''+b;return a}
+ function Zhb(a,b){a.a+=''+b;return a}
+ function Vhb(a,b){return a.a+=''+b,a}
+ function Pfb(a){return ''+(uFb(a),a)}
+ function Vsb(a){akb(this);Ld(this,a);}
+ function YFc(){RFc();UFc.call(this);}
+ function pxb(a,b){kxb.call(this,a,b);}
+ function txb(a,b){kxb.call(this,a,b);}
+ function xxb(a,b){kxb.call(this,a,b);}
+ function Oub(a,b){Pub(a,b,a.c.b,a.c);}
+ function Nub(a,b){Pub(a,b,a.a,a.a.a);}
+ function Iob(a){tFb(a,0);return null}
+ function Xvb(){this.b=0;this.a=false;}
+ function dwb(){this.b=0;this.a=false;}
+ function Et(){this.b=new Usb(Sv(12));}
+ function pMb(){pMb=geb;oMb=ss(nMb());}
+ function ncc(){ncc=geb;mcc=ss(lcc());}
+ function aZc(){aZc=geb;_Yc=ss($Yc());}
+ function WA(){WA=geb;vA();VA=new Tsb;}
+ function hjd(a){a.a=0;a.b=0;return a}
+ function qfd(a,b){a.a=b.g+1;return a}
+ function yNd(a,b){aMd.call(this,a,b);}
+ function lGd(a,b){kGd.call(this,a,b);}
+ function N$d(a,b){zNd.call(this,a,b);}
+ function Whe(a,b){Q2d.call(this,a,b);}
+ function She(a,b){Phe.call(this,a,b);}
+ function RRd(a,b){PRd();Zjb(ORd,a,b);}
+ function sB(a,b){a.q.setTime(Xdb(b));}
+ function Xz(a){$wnd.clearTimeout(a);}
+ function cr(a){return Qb(a),new Dl(a)}
+ function mb(a,b){return dE(a)===dE(b)}
+ function Mw(a,b){return a.a.a.a.cc(b)}
+ function qeb(a,b){return zhb(a.a,0,b)}
+ function SSb(a){return MSb(RD(a,74))}
+ function Nfb(a){return eE((uFb(a),a))}
+ function Ofb(a){return eE((uFb(a),a))}
+ function gD(a){return hD(a.l,a.m,a.h)}
+ function egb(a,b){return hgb(a.a,b.a)}
+ function ygb(a,b){return Agb(a.a,b.a)}
+ function Sfb(a,b){return Qfb(a.a,b.a)}
+ function qhb(a,b){return a.indexOf(b)}
+ function nOc(a,b){return a.j[b.p]==2}
+ function cz(a,b){return a==b?0:a?1:-1}
+ function AB(a){return a<10?'0'+a:''+a}
+ function Kdb(a){return typeof a===ive}
+ function oZb(a){return a==jZb||a==mZb}
+ function pZb(a){return a==jZb||a==kZb}
+ function ELb(a,b){return hgb(a.g,b.g)}
+ function Q4b(a){return Wmb(a.b.b,a,0)}
+ function Q2b(){J2b.call(this,0,0,0,0);}
+ function Iub(){ctb.call(this,new gub);}
+ function Znb(a,b){Wnb(a,0,a.length,b);}
+ function Eyb(a,b){Rmb(a.a,b);return b}
+ function Fkc(a,b){lkc();return b.a+=a}
+ function Hkc(a,b){lkc();return b.a+=a}
+ function Gkc(a,b){lkc();return b.c+=a}
+ function ied(a,b){Rmb(a.c,b);return a}
+ function Ped(a,b){ofd(a.a,b);return a}
+ function ttb(a){this.a=Itb();this.b=a;}
+ function Ntb(a){this.a=Itb();this.b=a;}
+ function sjd(a){this.a=a.a;this.b=a.b;}
+ function Dl(a){this.a=a;zl.call(this);}
+ function Gl(a){this.a=a;zl.call(this);}
+ function Tid(){Uid.call(this,0,0,0,0);}
+ function vfd(a){return ofd(new ufd,a)}
+ function Ksd(a){return iyd(RD(a,123))}
+ function Mvd(a){return a.vh()&&a.wh()}
+ function Dod(a){return a!=zod&&a!=Aod}
+ function Dmd(a){return a==ymd||a==zmd}
+ function Emd(a){return a==Bmd||a==xmd}
+ function xDc(a){return a==tDc||a==sDc}
+ function yrc(a,b){return hgb(a.g,b.g)}
+ function Yfe(a,b){return new Phe(b,a)}
+ function Zfe(a,b){return new Phe(b,a)}
+ function lr(a){return Dr(a.b.Kc(),a.a)}
+ function IXd(a,b){yXd(a,b);zXd(a,a.D);}
+ function Uxd(a,b,c){Vxd(a,b);Wxd(a,c);}
+ function zyd(a,b,c){Cyd(a,b);Ayd(a,c);}
+ function Byd(a,b,c){Dyd(a,b);Eyd(a,c);}
+ function Gzd(a,b,c){Hzd(a,b);Izd(a,c);}
+ function Nzd(a,b,c){Ozd(a,b);Pzd(a,c);}
+ function eh(a,b,c){bh.call(this,a,b,c);}
+ function zId(a){uId.call(this,a,true);}
+ function nAb(){dAb.call(this,'Tail',3);}
+ function iAb(){dAb.call(this,'Head',1);}
+ function ejb(a){Pib();fjb.call(this,a);}
+ function A3b(a){J2b.call(this,a,a,a,a);}
+ function Pmb(a){a.c=$C(jJ,rve,1,0,5,1);}
+ function yRb(a){a.b&&CRb(a);return a.a}
+ function zRb(a){a.b&&CRb(a);return a.c}
+ function mBb(a,b){if(dBb){return}a.b=b;}
+ function YCb(a,b){return a[a.length]=b}
+ function _Cb(a,b){return a[a.length]=b}
+ function l5b(a,b){return NGd(b,MCd(a))}
+ function m5b(a,b){return NGd(b,MCd(a))}
+ function DDd(a,b){return lp(Co(a.d),b)}
+ function EDd(a,b){return lp(Co(a.g),b)}
+ function FDd(a,b){return lp(Co(a.j),b)}
+ function mGd(a,b){kGd.call(this,a.b,b);}
+ function s0d(a,b){WGd(tYd(a.a),v0d(b));}
+ function B4d(a,b){WGd(o4d(a.a),E4d(b));}
+ function Asd(a,b,c){Byd(c,c.i+a,c.j+b);}
+ function eFc(a,b,c){bD(a.c[b.g],b.g,c);}
+ function zVd(a,b,c){RD(a.c,71).Gi(b,c);}
+ function LMd(a,b,c){bD(a,b,c);return c}
+ function DJb(a){Umb(a.Sf(),new HJb(a));}
+ function Gvb(a){return a!=null?tb(a):0}
+ function aOd(a){return a==null?0:tb(a)}
+ function iue(a){Vse();Wse.call(this,a);}
+ function Ug(a){this.a=a;Og.call(this,a);}
+ function Zy(){Zy=geb;$wnd.Math.log(2);}
+ function s7d(){s7d=geb;r7d=($Sd(),ZSd);}
+ function FRc(){FRc=geb;ERc=new Zrb(u3);}
+ function Hde(){Hde=geb;new Ide;new bnb;}
+ function Ide(){new Tsb;new Tsb;new Tsb;}
+ function yue(){throw Adb(new kib(bMe))}
+ function Nue(){throw Adb(new kib(bMe))}
+ function Bue(){throw Adb(new kib(cMe))}
+ function Que(){throw Adb(new kib(cMe))}
+ function Gp(a){this.a=a;rf.call(this,a);}
+ function Np(a){this.a=a;rf.call(this,a);}
+ function Sq(a,b){tm();this.a=a;this.b=b;}
+ function Jh(a,b){Qb(b);Ih(a).Jc(new jx);}
+ function _mb(a,b){Ynb(a.c,a.c.length,b);}
+ function xnb(a){return a.ab?1:0}
+ function Kgb(a,b){return Ddb(a,b)>0?a:b}
+ function hD(a,b,c){return {l:a,m:b,h:c}}
+ function Mvb(a,b){a.a!=null&&_Mc(b,a.a);}
+ function Lhc(a){Y0b(a,null);Z0b(a,null);}
+ function xkc(a,b,c){return Zjb(a.g,c,b)}
+ function bFc(a,b,c){return _Ec(b,c,a.c)}
+ function jOc(a,b,c){return Zjb(a.k,c,b)}
+ function pOc(a,b,c){qOc(a,b,c);return c}
+ function FOc(a,b){dOc();return b.n.b+=a}
+ function lUb(a){VTb.call(this);this.b=a;}
+ function y2b(a){v2b.call(this);this.a=a;}
+ function kAb(){dAb.call(this,'Range',2);}
+ function $Fb(a){this.b=a;this.a=new bnb;}
+ function WQb(a){this.b=new gRb;this.a=a;}
+ function Lub(a){a.a=new svb;a.c=new svb;}
+ function nrc(a){a.a=new Tsb;a.d=new Tsb;}
+ function $Sc(a){_Sc(a,null);aTc(a,null);}
+ function a2d(a,b){return xA(a.a,b,null)}
+ function Cdd(a,b){return Zjb(a.a,b.a,b)}
+ function ajd(a){return new rjd(a.a,a.b)}
+ function Pid(a){return new rjd(a.c,a.d)}
+ function Qid(a){return new rjd(a.c,a.d)}
+ function Ake(a,b){return Tfe(a.c,a.b,b)}
+ function ZD(a,b){return a!=null&&QD(a,b)}
+ function br(a,b){return Jr(a.Kc(),b)!=-1}
+ function Hr(a){return a.Ob()?a.Pb():null}
+ function _p(a){this.b=(yob(),new uqb(a));}
+ function zke(a){this.a=a;Tsb.call(this);}
+ function Uhe(){Q2d.call(this,null,null);}
+ function Yhe(){p3d.call(this,null,null);}
+ function As(){qs.call(this,'INSTANCE',0);}
+ function dXb(){_Wb();this.a=new Wed(UP);}
+ function Hhb(a){return Ihb(a,0,a.length)}
+ function Rv(a,b){return new ew(a.Kc(),b)}
+ function $sb(a,b){return a.a.Bc(b)!=null}
+ function hZd(a,b){sLd(a);a.Gc(RD(b,15));}
+ function ONd(a,b,c){a.c.bd(b,RD(c,136));}
+ function eOd(a,b,c){a.c.Ui(b,RD(c,136));}
+ function eub(a,b){if(a.c){rub(b);qub(b);}}
+ function oB(a,b){a.q.setHours(b);mB(a,b);}
+ function vTb(a,b){Zid(b,a.a.a.a,a.a.a.b);}
+ function tKb(a,b,c,d){bD(a.a[b.g],c.g,d);}
+ function oKb(a,b,c){return a.a[b.g][c.g]}
+ function AIc(a,b){return a.e[b.c.p][b.p]}
+ function TIc(a,b){return a.c[b.c.p][b.p]}
+ function pJc(a,b){return a.a[b.c.p][b.p]}
+ function mOc(a,b){return a.j[b.p]=AOc(b)}
+ function wAb(a,b){return a.a.Bc(b)!=null}
+ function wXc(a,b){return Kfb(UD(b.a))<=a}
+ function xXc(a,b){return Kfb(UD(b.a))>=a}
+ function vhd(a,b){return jhb(a.f,b.Pg())}
+ function cjd(a,b){return a.a*b.a+a.b*b.b}
+ function Wsd(a,b){return a.a0?b/(a*a):b*100}
+ function FUb(a,b){return a>0?b*b/a:b*b*100}
+ function $5b(a,b){return RD(cub(a.a,b),34)}
+ function doc(a,b){Mnc();return Rc(a,b.e,b)}
+ function NCc(a,b,c){GCc();return c.Mg(a,b)}
+ function L0c(a){B0c();return a.e.a+a.f.a/2}
+ function N0c(a,b,c){B0c();return c.e.a-a*b}
+ function V0c(a){B0c();return a.e.b+a.f.b/2}
+ function X0c(a,b,c){B0c();return c.e.b-a*b}
+ function _tb(a){a.d=new tub(a);a.e=new Tsb;}
+ function x3c(){this.a=new Tp;this.b=new Tp;}
+ function hmc(a){this.c=a;this.a=1;this.b=1;}
+ function C$b(a){z$b();A$b(this);this.Ff(a);}
+ function Efd(a,b,c){Afd();a.pf(b)&&c.Cd(a);}
+ function Red(a,b,c){return Rmb(b,Ted(a,c))}
+ function Zid(a,b,c){a.a+=b;a.b+=c;return a}
+ function jjd(a,b,c){a.a*=b;a.b*=c;return a}
+ function mjd(a,b){a.a=b.a;a.b=b.b;return a}
+ function fjd(a){a.a=-a.a;a.b=-a.b;return a}
+ function njd(a,b,c){a.a-=b;a.b-=c;return a}
+ function Gjd(a){Yub.call(this);zjd(this,a);}
+ function Dbd(){qs.call(this,'GROW_TREE',0);}
+ function WRb(){qs.call(this,'POLYOMINO',0);}
+ function SVd(a,b,c){DVd.call(this,a,b,c,2);}
+ function r0d(a,b,c){VGd(tYd(a.a),b,v0d(c));}
+ function e3d(a,b){N2d();Q2d.call(this,a,b);}
+ function D3d(a,b){j3d();p3d.call(this,a,b);}
+ function F3d(a,b){j3d();D3d.call(this,a,b);}
+ function H3d(a,b){j3d();p3d.call(this,a,b);}
+ function PNd(a,b){return a.c.Fc(RD(b,136))}
+ function A4d(a,b,c){VGd(o4d(a.a),b,E4d(c));}
+ function Ard(a){this.c=a;Dyd(a,0);Eyd(a,0);}
+ function Z8d(a,b){s7d();N8d.call(this,a,b);}
+ function _8d(a,b){s7d();Z8d.call(this,a,b);}
+ function b9d(a,b){s7d();Z8d.call(this,a,b);}
+ function n9d(a,b){s7d();N8d.call(this,a,b);}
+ function d9d(a,b){s7d();b9d.call(this,a,b);}
+ function p9d(a,b){s7d();n9d.call(this,a,b);}
+ function v9d(a,b){s7d();N8d.call(this,a,b);}
+ function lge(a,b,c){return b.zl(a.e,a.c,c)}
+ function nge(a,b,c){return b.Al(a.e,a.c,c)}
+ function Wee(a,b,c){return tfe(Pee(a,b),c)}
+ function Age(a,b){return Vvd(a.e,RD(b,54))}
+ function _me(a){return a==null?null:Bqe(a)}
+ function dne(a){return a==null?null:Iqe(a)}
+ function gne(a){return a==null?null:jeb(a)}
+ function hne(a){return a==null?null:jeb(a)}
+ function TD(a){CFb(a==null||$D(a));return a}
+ function UD(a){CFb(a==null||_D(a));return a}
+ function WD(a){CFb(a==null||bE(a));return a}
+ function lfb(a){if(a.o!=null){return}Bfb(a);}
+ function lFb(a){if(!a){throw Adb(new _fb)}}
+ function pFb(a){if(!a){throw Adb(new yeb)}}
+ function sFb(a){if(!a){throw Adb(new Dvb)}}
+ function yFb(a){if(!a){throw Adb(new cgb)}}
+ function zmb(a){if(!a){throw Adb(new Jrb)}}
+ function jQd(){jQd=geb;iQd=new LQd;new lRd;}
+ function u2c(){u2c=geb;t2c=new jGd('root');}
+ function d6d(){HWd.call(this);this.Bb|=txe;}
+ function Pg(a,b){this.d=a;Lg(this);this.b=b;}
+ function WCb(a,b){NCb.call(this,a);this.a=b;}
+ function oDb(a,b){NCb.call(this,a);this.a=b;}
+ function bh(a,b,c){lg.call(this,a,b,c,null);}
+ function fh(a,b,c){lg.call(this,a,b,c,null);}
+ function Mf(a,b){this.c=a;ne.call(this,a,b);}
+ function Uf(a,b){this.a=a;Mf.call(this,a,b);}
+ function wB(a){this.q=new $wnd.Date(Xdb(a));}
+ function OPb(a){if(a>8){return 0}return a+1}
+ function iBb(a,b){if(dBb){return}Rmb(a.a,b);}
+ function P5b(a,b){H5b();return n2b(b.d.i,a)}
+ function qdc(a,b){Zcc();return new xdc(b,a)}
+ function HAb(a,b,c){return a.Ne(b,c)<=0?c:b}
+ function IAb(a,b,c){return a.Ne(b,c)<=0?b:c}
+ function rgd(a,b){return RD(cub(a.b,b),143)}
+ function tgd(a,b){return RD(cub(a.c,b),233)}
+ function amc(a){return RD(Vmb(a.a,a.b),294)}
+ function Mid(a){return new rjd(a.c,a.d+a.a)}
+ function Jeb(a){return (uFb(a),a)?1231:1237}
+ function EPc(a){return dOc(),xDc(RD(a,203))}
+ function RMb(){RMb=geb;QMb=xsb((Qpd(),Ppd));}
+ function YQb(a,b){b.a?ZQb(a,b):wAb(a.a,b.b);}
+ function aJd(a,b,c){++a.j;a.tj();$Gd(a,b,c);}
+ function $Id(a,b,c){++a.j;a.qj(b,a.Zi(b,c));}
+ function B2d(a,b,c){var d;d=a.fd(b);d.Rb(c);}
+ function Bzd(a,b,c){c=xvd(a,b,6,c);return c}
+ function izd(a,b,c){c=xvd(a,b,3,c);return c}
+ function KCd(a,b,c){c=xvd(a,b,9,c);return c}
+ function SKb(a,b){Ivb(b,Pye);a.f=b;return a}
+ function bOd(a,b){return (b&lve)%a.d.length}
+ function Bke(a,b,c){return age(a.c,a.b,b,c)}
+ function ZLd(a,b){this.c=a;ZHd.call(this,b);}
+ function w0d(a,b){this.a=a;Q_d.call(this,b);}
+ function F4d(a,b){this.a=a;Q_d.call(this,b);}
+ function kGd(a,b){jGd.call(this,a);this.a=b;}
+ function U6d(a,b){L6d.call(this,a);this.a=b;}
+ function S9d(a,b){L6d.call(this,a);this.a=b;}
+ function jQb(a){gQb.call(this,0,0);this.f=a;}
+ function _hb(a,b,c){a.a+=Ihb(b,0,c);return a}
+ function _A(a){!a.a&&(a.a=new jB);return a.a}
+ function qlb(a,b){var c;c=a.e;a.e=b;return c}
+ function Clb(a,b){var c;c=b;return !!a.Fe(c)}
+ function Keb(a,b){Geb();return a==b?0:a?1:-1}
+ function Ikb(a,b){a.a.bd(a.b,b);++a.b;a.c=-1;}
+ function hg(a){a.b?hg(a.b):a.f.c.zc(a.e,a.d);}
+ function aub(a){akb(a.e);a.d.b=a.d;a.d.a=a.d;}
+ function VDb(a,b,c){xDb();HEb(a,b.Ve(a.a,c));}
+ function Xrb(a,b,c){return Wrb(a,RD(b,22),c)}
+ function WEb(a,b){return cFb(new Array(b),a)}
+ function Fgb(a){return Ydb(Udb(a,32))^Ydb(a)}
+ function XD(a){return String.fromCharCode(a)}
+ function Dz(a){return a==null?null:a.message}
+ function Rz(a,b,c){return a.apply(b,c);}
+ function Btb(a,b){var c;c=a[Jxe];c.call(a,b);}
+ function Ctb(a,b){var c;c=a[Jxe];c.call(a,b);}
+ function O5b(a,b){H5b();return !n2b(b.d.i,a)}
+ function R2b(a,b,c,d){J2b.call(this,a,b,c,d);}
+ function TJb(){RJb.call(this);this.a=new pjd;}
+ function v2b(){this.n=new pjd;this.o=new pjd;}
+ function kGb(){this.b=new pjd;this.c=new bnb;}
+ function cUb(){this.a=new bnb;this.b=new bnb;}
+ function kWb(){this.a=new DTb;this.b=new vWb;}
+ function e6b(){this.b=new gub;this.a=new gub;}
+ function jIc(){this.b=new _sb;this.a=new _sb;}
+ function vYc(){this.b=new Tsb;this.a=new Tsb;}
+ function fWc(){this.b=new TVc;this.a=new IVc;}
+ function Yhc(){this.a=new yqc;this.b=new Sqc;}
+ function lNc(){this.a=new bnb;this.d=new bnb;}
+ function RJb(){this.n=new z3b;this.i=new Tid;}
+ function hq(a){this.a=(dk(a,iwe),new cnb(a));}
+ function oq(a){this.a=(dk(a,iwe),new cnb(a));}
+ function tLd(a){return a<100?null:new gLd(a)}
+ function Lac(a,b){return a.n.a=(uFb(b),b)+10}
+ function Mac(a,b){return a.n.a=(uFb(b),b)+10}
+ function DYd(a,b){return b==a||PHd(sYd(b),a)}
+ function nae(a,b){return Zjb(a.a,b,'')==null}
+ function Hee(a,b){var c;c=b.qi(a.a);return c}
+ function $id(a,b){a.a+=b.a;a.b+=b.b;return a}
+ function ojd(a,b){a.a-=b.a;a.b-=b.b;return a}
+ function sfd(a){aFb(a.j.c,0);a.a=-1;return a}
+ function rCd(a,b,c){c=xvd(a,b,11,c);return c}
+ function SDd(a,b,c){c!=null&&Kzd(b,uEd(a,c));}
+ function TDd(a,b,c){c!=null&&Lzd(b,uEd(a,c));}
+ function G5d(a,b,c,d){C5d.call(this,a,b,c,d);}
+ function oie(a,b,c,d){C5d.call(this,a,b,c,d);}
+ function sie(a,b,c,d){oie.call(this,a,b,c,d);}
+ function Nie(a,b,c,d){Iie.call(this,a,b,c,d);}
+ function Pie(a,b,c,d){Iie.call(this,a,b,c,d);}
+ function Vie(a,b,c,d){Iie.call(this,a,b,c,d);}
+ function Tie(a,b,c,d){Pie.call(this,a,b,c,d);}
+ function $ie(a,b,c,d){Pie.call(this,a,b,c,d);}
+ function Yie(a,b,c,d){Vie.call(this,a,b,c,d);}
+ function bje(a,b,c,d){$ie.call(this,a,b,c,d);}
+ function Dje(a,b,c,d){wje.call(this,a,b,c,d);}
+ function aMd(a,b){veb.call(this,HJe+a+NIe+b);}
+ function Hje(a,b){return a.jk().wi().ri(a,b)}
+ function Ije(a,b){return a.jk().wi().ti(a,b)}
+ function Lfb(a,b){return uFb(a),dE(a)===dE(b)}
+ function lhb(a,b){return uFb(a),dE(a)===dE(b)}
+ function mEb(a,b){return a.b.Bd(new pEb(a,b))}
+ function sEb(a,b){return a.b.Bd(new vEb(a,b))}
+ function yEb(a,b){return a.b.Bd(new BEb(a,b))}
+ function Bk(a,b){return a.e=RD(a.d.Kb(b),159)}
+ function uhb(a,b,c){return a.lastIndexOf(b,c)}
+ function wWb(a,b,c){return Qfb(a[b.a],a[c.a])}
+ function TWb(a,b){return pQb(b,(yCc(),gAc),a)}
+ function Lpc(a,b){return hgb(b.a.d.p,a.a.d.p)}
+ function Kpc(a,b){return hgb(a.a.d.p,b.a.d.p)}
+ function zTc(a,b){return Qfb(a.c-a.s,b.c-b.s)}
+ function qWc(a,b){return Qfb(a.b.e.a,b.b.e.a)}
+ function sWc(a,b){return Qfb(a.c.e.a,b.c.e.a)}
+ function $2b(a){return !a.c?-1:Wmb(a.c.a,a,0)}
+ function Cod(a){return a==vod||a==xod||a==wod}
+ function CMd(a,b){this.c=a;nMd.call(this,a,b);}
+ function fq(a,b,c){this.a=a;qc.call(this,b,c);}
+ function YDb(a){this.c=a;xxb.call(this,Sve,0);}
+ function rk(a,b,c){this.c=b;this.b=c;this.a=a;}
+ function DMc(a){dMc();this.d=a;this.a=new wmb;}
+ function ho(a){_l();this.a=(yob(),new Lqb(a));}
+ function Xmc(a,b){Dmd(a.f)?Ymc(a,b):Zmc(a,b);}
+ function Lxb(a,b){Mxb.call(this,a,a.length,b);}
+ function nBb(a,b){if(dBb){return}!!b&&(a.d=b);}
+ function ZNd(a,b){return ZD(b,15)&&_Gd(a.c,b)}
+ function AVd(a,b,c){return RD(a.c,71).Wk(b,c)}
+ function BVd(a,b,c){return RD(a.c,71).Xk(b,c)}
+ function mge(a,b,c){return lge(a,RD(b,343),c)}
+ function oge(a,b,c){return nge(a,RD(b,343),c)}
+ function Ige(a,b,c){return Hge(a,RD(b,343),c)}
+ function Kge(a,b,c){return Jge(a,RD(b,343),c)}
+ function Fn(a,b){return b==null?null:Xv(a.b,b)}
+ function Qeb(a){return _D(a)?(uFb(a),a):a.ue()}
+ function Rfb(a){return !isNaN(a)&&!isFinite(a)}
+ function Zub(a){Lub(this);Xub(this);ye(this,a);}
+ function dnb(a){Pmb(this);YEb(this.c,0,a.Pc());}
+ function Fsb(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function Vtb(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function hvb(a,b,c){this.d=a;this.b=c;this.a=b;}
+ function aBb(a){this.a=a;gib();Hdb(Date.now());}
+ function wzb(a){Ckb(a.a);Yyb(a.c,a.b);a.b=null;}
+ function wvb(){wvb=geb;uvb=new xvb;vvb=new zvb;}
+ function KMd(){KMd=geb;JMd=$C(jJ,rve,1,0,5,1);}
+ function TTd(){TTd=geb;STd=$C(jJ,rve,1,0,5,1);}
+ function yUd(){yUd=geb;xUd=$C(jJ,rve,1,0,5,1);}
+ function _l(){_l=geb;new im((yob(),yob(),vob));}
+ function gAb(a){cAb();return ws((qAb(),pAb),a)}
+ function zBb(a){xBb();return ws((CBb(),BBb),a)}
+ function FHb(a){DHb();return ws((IHb(),HHb),a)}
+ function NHb(a){LHb();return ws((QHb(),PHb),a)}
+ function kIb(a){iIb();return ws((nIb(),mIb),a)}
+ function _Jb(a){ZJb();return ws((cKb(),bKb),a)}
+ function GKb(a){EKb();return ws((JKb(),IKb),a)}
+ function xLb(a){vLb();return ws((ALb(),zLb),a)}
+ function mMb(a){hMb();return ws((pMb(),oMb),a)}
+ function oOb(a){mOb();return ws((rOb(),qOb),a)}
+ function KPb(a){IPb();return ws((NPb(),MPb),a)}
+ function KRb(a){IRb();return ws((NRb(),MRb),a)}
+ function XRb(a){VRb();return ws(($Rb(),ZRb),a)}
+ function VUb(a){TUb();return ws((YUb(),XUb),a)}
+ function CWb(a){AWb();return ws((FWb(),EWb),a)}
+ function uXb(a){sXb();return ws((xXb(),wXb),a)}
+ function tZb(a){nZb();return ws((wZb(),vZb),a)}
+ function W$b(a){U$b();return ws((Z$b(),Y$b),a)}
+ function Mb(a,b){if(!a){throw Adb(new agb(b))}}
+ function Vb(a){if(!a){throw Adb(new dgb(tve))}}
+ function rFb(a,b){if(a!=b){throw Adb(new Jrb)}}
+ function KQb(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function lRb(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function h7b(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function J0b(a,b,c){this.b=a;this.a=b;this.c=c;}
+ function dNb(a,b,c){this.b=a;this.c=b;this.a=c;}
+ function oac(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function F1b(a,b,c){this.e=b;this.b=a;this.d=c;}
+ function Ecc(a,b,c){this.b=a;this.a=b;this.c=c;}
+ function UDb(a,b,c){xDb();a.a.Yd(b,c);return b}
+ function CJb(a){var b;b=new BJb;b.e=a;return b}
+ function _Nb(a){var b;b=new YNb;b.b=a;return b}
+ function U9b(){U9b=geb;S9b=new bac;T9b=new eac;}
+ function Rec(){Rec=geb;Qec=new efc;Pec=new jfc;}
+ function lkc(){lkc=geb;jkc=new Mkc;kkc=new Okc;}
+ function loc(a){joc();return ws((ooc(),noc),a)}
+ function kcc(a){hcc();return ws((ncc(),mcc),a)}
+ function yec(a){vec();return ws((Bec(),Aec),a)}
+ function gnc(a){enc();return ws((jnc(),inc),a)}
+ function Enc(a){Bnc();return ws((Hnc(),Gnc),a)}
+ function gpc(a){epc();return ws((jpc(),ipc),a)}
+ function dtc(a){btc();return ws((gtc(),ftc),a)}
+ function ltc(a){jtc();return ws((otc(),ntc),a)}
+ function xtc(a){stc();return ws((Atc(),ztc),a)}
+ function Gtc(a){Etc();return ws((Jtc(),Itc),a)}
+ function Utc(a){Ptc();return ws((Xtc(),Wtc),a)}
+ function auc(a){$tc();return ws((duc(),cuc),a)}
+ function avc(a){$uc();return ws((dvc(),cvc),a)}
+ function qvc(a){ovc();return ws((tvc(),svc),a)}
+ function zvc(a){xvc();return ws((Cvc(),Bvc),a)}
+ function Ivc(a){Gvc();return ws((Lvc(),Kvc),a)}
+ function Qvc(a){Ovc();return ws((Tvc(),Svc),a)}
+ function Quc(a){Ouc();return ws((Tuc(),Suc),a)}
+ function juc(a){huc();return ws((muc(),luc),a)}
+ function wuc(a){tuc();return ws((zuc(),yuc),a)}
+ function Euc(a){Cuc();return ws((Huc(),Guc),a)}
+ function exc(a){cxc();return ws((hxc(),gxc),a)}
+ function eDc(a){_Cc();return ws((hDc(),gDc),a)}
+ function oDc(a){lDc();return ws((rDc(),qDc),a)}
+ function ADc(a){wDc();return ws((DDc(),CDc),a)}
+ function ODc(a){JDc();return ws((RDc(),QDc),a)}
+ function cEc(a){aEc();return ws((fEc(),eEc),a)}
+ function mEc(a){kEc();return ws((pEc(),oEc),a)}
+ function uEc(a){sEc();return ws((xEc(),wEc),a)}
+ function DEc(a){BEc();return ws((GEc(),FEc),a)}
+ function MEc(a){KEc();return ws((PEc(),OEc),a)}
+ function VEc(a){TEc();return ws((YEc(),XEc),a)}
+ function nFc(a){lFc();return ws((qFc(),pFc),a)}
+ function wFc(a){uFc();return ws((zFc(),yFc),a)}
+ function FFc(a){DFc();return ws((IFc(),HFc),a)}
+ function TKc(a){RKc();return ws((WKc(),VKc),a)}
+ function uNc(a){sNc();return ws((xNc(),wNc),a)}
+ function yQc(a){wQc();return ws((BQc(),AQc),a)}
+ function GQc(a){EQc();return ws((JQc(),IQc),a)}
+ function hTc(a){fTc();return ws((kTc(),jTc),a)}
+ function fVc(a){dVc();return ws((iVc(),hVc),a)}
+ function bWc(a){YVc();return ws((eWc(),dWc),a)}
+ function ZYc(a){WYc();return ws((aZc(),_Yc),a)}
+ function NZc(a){LZc();return ws((QZc(),PZc),a)}
+ function u_c(a){s_c();return ws((x_c(),w_c),a)}
+ function C_c(a){A_c();return ws((F_c(),E_c),a)}
+ function C2c(a){x2c();return ws((F2c(),E2c),a)}
+ function j3c(a){g3c();return ws((m3c(),l3c),a)}
+ function j4c(a){g4c();return ws((m4c(),l4c),a)}
+ function _3c(a){Y3c();return ws((c4c(),b4c),a)}
+ function m5c(a){j5c();return ws((p5c(),o5c),a)}
+ function w5c(a){t5c();return ws((z5c(),y5c),a)}
+ function h6c(a){f6c();return ws((k6c(),j6c),a)}
+ function C6c(a){z6c();return ws((F6c(),E6c),a)}
+ function b7c(a){_6c();return ws((e7c(),d7c),a)}
+ function E8c(a){z8c();return ws((H8c(),G8c),a)}
+ function R8b(a){P8b();return ws((U8b(),T8b),a)}
+ function t3b(a){r3b();return ws((w3b(),v3b),a)}
+ function g9c(a){b9c();return ws((j9c(),i9c),a)}
+ function G9c(a){B9c();return ws((J9c(),I9c),a)}
+ function uad(a){sad();return ws((xad(),wad),a)}
+ function xbd(a){sbd();return ws((Abd(),zbd),a)}
+ function ibd(a){gbd();return ws((lbd(),kbd),a)}
+ function Gbd(a){Cbd();return ws((Jbd(),Ibd),a)}
+ function Obd(a){Mbd();return ws((Rbd(),Qbd),a)}
+ function Zbd(a){Xbd();return ws((acd(),_bd),a)}
+ function fdd(a){_cd();return ws((idd(),hdd),a)}
+ function qdd(a){ldd();return ws((tdd(),sdd),a)}
+ function $hd(a){Yhd();return ws((bid(),aid),a)}
+ function mid(a){kid();return ws((pid(),oid),a)}
+ function Tjd(a){Rjd();return ws((Wjd(),Vjd),a)}
+ function wkd(a){ukd();return ws((zkd(),ykd),a)}
+ function Hmd(a){Cmd();return ws((Kmd(),Jmd),a)}
+ function Qmd(a){Omd();return ws((Tmd(),Smd),a)}
+ function $md(a){Ymd();return ws((bnd(),and),a)}
+ function knd(a){ind();return ws((nnd(),mnd),a)}
+ function Hnd(a){Fnd();return ws((Knd(),Jnd),a)}
+ function Snd(a){Pnd();return ws((Vnd(),Und),a)}
+ function god(a){dod();return ws((jod(),iod),a)}
+ function rod(a){pod();return ws((uod(),tod),a)}
+ function Fod(a){Bod();return ws((Iod(),Hod),a)}
+ function Tod(a){Pod();return ws((Wod(),Vod),a)}
+ function wpd(a){qpd();return ws((zpd(),ypd),a)}
+ function Spd(a){Qpd();return ws((Vpd(),Upd),a)}
+ function fqd(a){dqd();return ws((iqd(),hqd),a)}
+ function oqd(a){mqd();return ws((rqd(),qqd),a)}
+ function zsc(a,b){return (uFb(a),a)+(uFb(b),b)}
+ function wqd(a){uqd();return ws((Eqd(),Dqd),a)}
+ function Ird(a){Grd();return ws((Lrd(),Krd),a)}
+ function vtd(a){ttd();return ws((ytd(),xtd),a)}
+ function dMc(){dMc=geb;bMc=(qpd(),ppd);cMc=Xod;}
+ function uqd(){uqd=geb;sqd=new zqd;tqd=new Bqd;}
+ function wJc(a){!a.e&&(a.e=new bnb);return a.e}
+ function BTc(a,b){this.c=a;this.a=b;this.b=b-a;}
+ function g8c(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function gud(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function Wdd(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function ced(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function pFd(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function ZPd(a,b,c){this.a=a;this.b=b;this.c=c;}
+ function g7d(a,b,c){this.e=a;this.a=b;this.c=c;}
+ function K7d(a,b,c){s7d();C7d.call(this,a,b,c);}
+ function f9d(a,b,c){s7d();O8d.call(this,a,b,c);}
+ function r9d(a,b,c){s7d();O8d.call(this,a,b,c);}
+ function x9d(a,b,c){s7d();O8d.call(this,a,b,c);}
+ function h9d(a,b,c){s7d();f9d.call(this,a,b,c);}
+ function j9d(a,b,c){s7d();f9d.call(this,a,b,c);}
+ function l9d(a,b,c){s7d();j9d.call(this,a,b,c);}
+ function t9d(a,b,c){s7d();r9d.call(this,a,b,c);}
+ function z9d(a,b,c){s7d();x9d.call(this,a,b,c);}
+ function S2b(a){J2b.call(this,a.d,a.c,a.a,a.b);}
+ function B3b(a){J2b.call(this,a.d,a.c,a.a,a.b);}
+ function Og(a){this.d=a;Lg(this);this.b=ed(a.d);}
+ function cGd(a){aGd();return ws((fGd(),eGd),a)}
+ function gk(a,b){Qb(a);Qb(b);return new hk(a,b)}
+ function dr(a,b){Qb(a);Qb(b);return new mr(a,b)}
+ function hr(a,b){Qb(a);Qb(b);return new sr(a,b)}
+ function Dr(a,b){Qb(a);Qb(b);return new Rr(a,b)}
+ function Uub(a){sFb(a.b!=0);return Wub(a,a.a.a)}
+ function Vub(a){sFb(a.b!=0);return Wub(a,a.c.b)}
+ function q$d(a){!a.c&&(a.c=new X9d);return a.c}
+ function cv(a){var b;b=new bnb;xr(b,a);return b}
+ function Vx(a){var b;b=new _sb;xr(b,a);return b}
+ function Yx(a){var b;b=new xAb;_q(b,a);return b}
+ function gv(a){var b;b=new Yub;_q(b,a);return b}
+ function RD(a,b){CFb(a==null||QD(a,b));return a}
+ function Mxb(a,b,c){Axb.call(this,b,c);this.a=a;}
+ function kB(a,b){this.c=a;this.b=b;this.a=false;}
+ function hCb(){this.a=';,;';this.b='';this.c='';}
+ function $Cb(a,b,c){this.b=a;pxb.call(this,b,c);}
+ function uub(a,b,c){this.c=a;xlb.call(this,b,c);}
+ function fZb(a,b,c){eZb.call(this,a,b);this.b=c;}
+ function YEb(a,b,c){VEb(c,0,a,b,c.length,false);}
+ function JYb(a,b,c,d,e){a.b=b;a.c=c;a.d=d;a.a=e;}
+ function D2b(a,b,c,d,e){a.d=b;a.c=c;a.a=d;a.b=e;}
+ function XDb(a,b){if(b){a.b=b;a.a=(LCb(b),b.a);}}
+ function mFb(a,b){if(!a){throw Adb(new agb(b))}}
+ function zFb(a,b){if(!a){throw Adb(new dgb(b))}}
+ function qFb(a,b){if(!a){throw Adb(new zeb(b))}}
+ function zqc(a,b){mqc();return hgb(a.d.p,b.d.p)}
+ function T0c(a,b){B0c();return Qfb(a.e.b,b.e.b)}
+ function U0c(a,b){B0c();return Qfb(a.e.a,b.e.a)}
+ function Xoc(a,b){return hgb(N3b(a.d),N3b(b.d))}
+ function Izb(a,b){return !!b&&Jzb(a,b.d)?b:null}
+ function $lc(a,b){return b==(qpd(),ppd)?a.c:a.d}
+ function Qdb(a){return Edb(yD(Kdb(a)?Wdb(a):a))}
+ function Nid(a){return new rjd(a.c+a.b,a.d+a.a)}
+ function GSd(a){return a!=null&&!mSd(a,aSd,bSd)}
+ function DSd(a,b){return (JSd(a)<<4|JSd(b))&Bwe}
+ function Rid(a,b,c,d,e){a.c=b;a.d=c;a.b=d;a.a=e;}
+ function y8b(a){var b,c;b=a.b;c=a.c;a.b=c;a.c=b;}
+ function B8b(a){var b,c;c=a.d;b=a.a;a.d=b;a.a=c;}
+ function u6d(a,b){var c;c=a.c;t6d(a,b);return c}
+ function Nqd(a,b){b<0?(a.g=-1):(a.g=b);return a}
+ function kjd(a,b){gjd(a);a.a*=b;a.b*=b;return a}
+ function hrc(a,b,c){grc.call(this,b,c);this.d=a;}
+ function PZd(a,b,c){kZd.call(this,a,b);this.c=c;}
+ function Kfe(a,b,c){kZd.call(this,a,b);this.c=c;}
+ function zUd(a){yUd();kUd.call(this);this.ci(a);}
+ function Yee(){ree();Zee.call(this,(YSd(),XSd));}
+ function Yse(a){Vse();return new Hte(0,a)}
+ function uke(){uke=geb;tke=(yob(),new mpb(eLe));}
+ function ux(){ux=geb;new wx((kl(),jl),(Wk(),Vk));}
+ function ugb(){ugb=geb;tgb=$C(bJ,Nve,17,256,0,1);}
+ function zUb(){this.b=Kfb(UD(iGd((yVb(),sVb))));}
+ function Pq(a){this.b=a;this.a=gn(this.b.a).Od();}
+ function mr(a,b){this.b=a;this.a=b;zl.call(this);}
+ function sr(a,b){this.a=a;this.b=b;zl.call(this);}
+ function s_d(a,b,c){this.a=a;N$d.call(this,b,c);}
+ function n_d(a,b,c){this.a=a;N$d.call(this,b,c);}
+ function sDd(a,b,c){var d;d=new OC(c);sC(a,b,d);}
+ function _Eb(a,b,c){var d;d=a[b];a[b]=c;return d}
+ function UEb(a){var b;b=a.slice();return dD(b,a)}
+ function SJb(a){var b;b=a.n;return a.a.b+b.d+b.a}
+ function PKb(a){var b;b=a.n;return a.e.b+b.d+b.a}
+ function QKb(a){var b;b=a.n;return a.e.a+b.b+b.c}
+ function rub(a){a.a.b=a.b;a.b.a=a.a;a.a=a.b=null;}
+ function Mub(a,b){Pub(a,b,a.c.b,a.c);return true}
+ function w2b(a){if(a.a){return a.a}return R0b(a)}
+ function NSb(a){HSb();return JGd(a)==vCd(LGd(a))}
+ function OSb(a){HSb();return LGd(a)==vCd(JGd(a))}
+ function l_b(a,b){return k_b(a,new eZb(b.a,b.b))}
+ function xn(a,b){return fn(),ck(a,b),new zy(a,b)}
+ function fmc(a,b){return a.c=b){throw Adb(new web)}}
+ function JDb(a,b){return MDb(a,(uFb(b),new JAb(b)))}
+ function KDb(a,b){return MDb(a,(uFb(b),new LAb(b)))}
+ function prc(a,b,c){return qrc(a,RD(b,12),RD(c,12))}
+ function q4b(a){return J3b(),RD(a,12).g.c.length!=0}
+ function v4b(a){return J3b(),RD(a,12).e.c.length!=0}
+ function sdc(a,b){Zcc();return Qfb(b.a.o.a,a.a.o.a)}
+ function d_d(a,b){(b.Bb&QHe)!=0&&!a.a.o&&(a.a.o=b);}
+ function T3c(a,b){b.Ug("General 'Rotator",1);S3c(a);}
+ function MCc(a,b,c){b.qf(c,Kfb(UD(Wjb(a.b,c)))*a.a);}
+ function yid(a,b,c){tid();return xid(a,b)&&xid(a,c)}
+ function Rod(a){Pod();return !a.Hc(Lod)&&!a.Hc(Nod)}
+ function Nrc(a){if(a.e){return Src(a.e)}return null}
+ function Zdb(a){if(Kdb(a)){return ''+a}return GD(a)}
+ function XNc(a){var b;b=a;while(b.f){b=b.f;}return b}
+ function HBb(a,b,c){bD(b,0,tCb(b[0],c[0]));return b}
+ function Gpc(a,b,c,d){var e;e=a.i;e.i=b;e.a=c;e.b=d;}
+ function C5d(a,b,c,d){XZd.call(this,a,b,c);this.b=d;}
+ function N3d(a,b,c,d,e){O3d.call(this,a,b,c,d,e,-1);}
+ function b4d(a,b,c,d,e){c4d.call(this,a,b,c,d,e,-1);}
+ function Iie(a,b,c,d){PZd.call(this,a,b,c);this.b=d;}
+ function Xde(a){uId.call(this,a,false);this.a=false;}
+ function Bqd(){vqd.call(this,'LOOKAHEAD_LAYOUT',1);}
+ function nNd(a){this.b=a;mMd.call(this,a);mNd(this);}
+ function vNd(a){this.b=a;BMd.call(this,a);uNd(this);}
+ function J5d(a,b,c){this.a=a;G5d.call(this,b,c,5,6);}
+ function wje(a,b,c,d){this.b=a;XZd.call(this,b,c,d);}
+ function Tj(a,b){this.b=a;Aj.call(this,a.b);this.a=b;}
+ function NLc(a){this.a=LLc(a.a);this.b=new dnb(a.b);}
+ function Fx(a,b){tm();Ex.call(this,a,Pm(new mob(b)));}
+ function _se(a,b){Vse();return new aue(a,b,0)}
+ function bte(a,b){Vse();return new aue(6,a,b)}
+ function Ztb(a,b){uFb(b);while(a.Ob()){b.Cd(a.Pb());}}
+ function Ujb(a,b){return bE(b)?Yjb(a,b):!!qtb(a.f,b)}
+ function O_d(a,b){return b.Vh()?Vvd(a.b,RD(b,54)):b}
+ function whb(a,b){return lhb(a.substr(0,b.length),b)}
+ function Fl(a){return new is(new Il(a.a.length,a.a))}
+ function Oid(a){return new rjd(a.c+a.b/2,a.d+a.a/2)}
+ function yD(a){return hD(~a.l&dxe,~a.m&dxe,~a.h&exe)}
+ function cE(a){return typeof a===gve||typeof a===kve}
+ function akb(a){a.f=new ttb(a);a.i=new Ntb(a);++a.g;}
+ function Klb(a){if(!a){throw Adb(new Dvb)}return a.d}
+ function smb(a){var b;b=omb(a);sFb(b!=null);return b}
+ function tmb(a){var b;b=pmb(a);sFb(b!=null);return b}
+ function tv(a,b){var c;c=a.a.gc();Sb(b,c);return c-b}
+ function Ysb(a,b){var c;c=a.a.zc(b,a);return c==null}
+ function rAb(a,b){return a.a.zc(b,(Geb(),Eeb))==null}
+ function _nb(a){return new SDb(null,$nb(a,a.length))}
+ function yPb(a,b,c){return zPb(a,RD(b,42),RD(c,176))}
+ function Wrb(a,b,c){zsb(a.a,b);return _Eb(a.b,b.g,c)}
+ function fyb(a,b,c){lyb(c,a.a.c.length);$mb(a.a,c,b);}
+ function Knb(a,b,c,d){nFb(b,c,a.length);Onb(a,b,c,d);}
+ function Onb(a,b,c,d){var e;for(e=b;e0?$wnd.Math.log(a/b):-100}
+ function Agb(a,b){return Ddb(a,b)<0?-1:Ddb(a,b)>0?1:0}
+ function Dge(a,b){hZd(a,ZD(b,160)?b:RD(b,2036).Rl());}
+ function vFb(a,b){if(a==null){throw Adb(new Ogb(b))}}
+ function $nb(a,b){return jxb(b,a.length),new Gxb(a,b)}
+ function hsc(a,b){if(!b){return false}return ye(a,b)}
+ function Gs(){zs();return cD(WC(RG,1),jwe,549,0,[ys])}
+ function Xib(a){return a.e==0?a:new cjb(-a.e,a.d,a.a)}
+ function $Nb(a,b){return Qfb(a.c.c+a.c.b,b.c.c+b.c.b)}
+ function cvb(a,b){Pub(a.d,b,a.b.b,a.b);++a.a;a.c=null;}
+ function JCb(a,b){!a.c?Rmb(a.b,b):JCb(a.c,b);return a}
+ function KB(a,b,c){var d;d=JB(a,b);LB(a,b,c);return d}
+ function Rnb(a,b,c){var d;for(d=0;d=a.g}
+ function bD(a,b,c){pFb(c==null||VC(a,c));return a[b]=c}
+ function yhb(a,b){BFb(b,a.length+1);return a.substr(b)}
+ function yxb(a,b){uFb(b);while(a.c=a){return new rDb}return iDb(a-1)}
+ function Y2b(a){if(!a.a&&!!a.c){return a.c.b}return a.a}
+ function Zx(a){if(ZD(a,616)){return a}return new sy(a)}
+ function LCb(a){if(!a.c){MCb(a);a.d=true;}else {LCb(a.c);}}
+ function ICb(a){if(!a.c){a.d=true;KCb(a);}else {a.c.$e();}}
+ function bHb(a){a.b=false;a.c=false;a.d=false;a.a=false;}
+ function uMc(a){var b,c;b=a.c.i.c;c=a.d.i.c;return b==c}
+ function _vd(a,b){var c;c=a.Ih(b);c>=0?a.ki(c):Tvd(a,b);}
+ function mtd(a,b){a.c<0||a.b.b0){a=a<<1|(a<0?1:0);}return a}
+ function BGc(a,b){var c;c=new R4b(a);ZEb(b.c,c);return c}
+ function FMb(a,b){a.u.Hc((Pod(),Lod))&&DMb(a,b);HMb(a,b);}
+ function Fvb(a,b){return dE(a)===dE(b)||a!=null&&pb(a,b)}
+ function Vrb(a,b){return Bsb(a.a,b)?a.b[RD(b,22).g]:null}
+ function YRb(){VRb();return cD(WC($O,1),jwe,489,0,[URb])}
+ function ybd(){sbd();return cD(WC(M1,1),jwe,490,0,[rbd])}
+ function Hbd(){Cbd();return cD(WC(N1,1),jwe,558,0,[Bbd])}
+ function gdd(){_cd();return cD(WC(V1,1),jwe,539,0,[$cd])}
+ function iyd(a){!a.n&&(a.n=new C5d(I4,a,1,7));return a.n}
+ function wCd(a){!a.c&&(a.c=new C5d(K4,a,9,9));return a.c}
+ function mzd(a){!a.c&&(a.c=new Yie(E4,a,5,8));return a.c}
+ function lzd(a){!a.b&&(a.b=new Yie(E4,a,4,7));return a.b}
+ function Sed(a){a.j.c.length=0;Ae(a.c);sfd(a.a);return a}
+ function Afe(a){a.e==fLe&&Gfe(a,Aee(a.g,a.b));return a.e}
+ function Bfe(a){a.f==fLe&&Hfe(a,Bee(a.g,a.b));return a.f}
+ function xBd(a,b,c,d){wBd(a,b,c,false);j1d(a,d);return a}
+ function oNd(a,b){this.b=a;nMd.call(this,a,b);mNd(this);}
+ function wNd(a,b){this.b=a;CMd.call(this,a,b);uNd(this);}
+ function Kmb(a){this.d=a;this.a=this.d.b;this.b=this.d.c;}
+ function oy(a,b){this.b=a;this.c=b;this.a=new Osb(this.b);}
+ function ihb(a,b){BFb(b,a.length);return a.charCodeAt(b)}
+ function NDd(a,b){CGd(a,Kfb(vDd(b,'x')),Kfb(vDd(b,'y')));}
+ function $Dd(a,b){CGd(a,Kfb(vDd(b,'x')),Kfb(vDd(b,'y')));}
+ function CDb(a,b){MCb(a);return new SDb(a,new hEb(b,a.a))}
+ function GDb(a,b){MCb(a);return new SDb(a,new zEb(b,a.a))}
+ function HDb(a,b){MCb(a);return new WCb(a,new nEb(b,a.a))}
+ function IDb(a,b){MCb(a);return new oDb(a,new tEb(b,a.a))}
+ function Ty(a,b){return new Ry(RD(Qb(a),50),RD(Qb(b),50))}
+ function nHb(a,b){return Qfb(a.d.c+a.d.b/2,b.d.c+b.d.b/2)}
+ function gTb(a,b,c){c.a?Eyd(a,b.b-a.f/2):Dyd(a,b.a-a.g/2);}
+ function WYb(a,b){return Qfb(a.g.c+a.g.b/2,b.g.c+b.g.b/2)}
+ function RZb(a,b){NZb();return Qfb((uFb(a),a),(uFb(b),b))}
+ function wSd(a){return a!=null&&tpb(eSd,a.toLowerCase())}
+ function Ae(a){var b;for(b=a.Kc();b.Ob();){b.Pb();b.Qb();}}
+ function Ih(a){var b;b=a.b;!b&&(a.b=b=new Xh(a));return b}
+ function R0b(a){var b;b=Z5b(a);if(b){return b}return null}
+ function BSb(a,b){var c,d;c=a/b;d=eE(c);c>d&&++d;return d}
+ function Ck(a,b,c){var d;d=RD(a.d.Kb(c),159);!!d&&d.Nb(b);}
+ function Vhc(a,b,c){tqc(a.a,c);Jpc(c);Kqc(a.b,c);bqc(b,c);}
+ function oNc(a,b,c,d){this.a=a;this.c=b;this.b=c;this.d=d;}
+ function ROc(a,b,c,d){this.c=a;this.b=b;this.a=c;this.d=d;}
+ function uPc(a,b,c,d){this.c=a;this.b=b;this.d=c;this.a=d;}
+ function Uid(a,b,c,d){this.c=a;this.d=b;this.b=c;this.a=d;}
+ function GTc(a,b,c,d){this.a=a;this.d=b;this.c=c;this.b=d;}
+ function t1b(a,b,c,d){this.a=a;this.e=b;this.d=c;this.c=d;}
+ function $td(a,b,c,d){this.a=a;this.c=b;this.d=c;this.b=d;}
+ function ehb(a,b,c){this.a=ywe;this.d=a;this.b=b;this.c=c;}
+ function fpc(a,b,c,d){qs.call(this,a,b);this.a=c;this.b=d;}
+ function Uwb(a,b){this.d=(uFb(a),a);this.a=16449;this.c=b;}
+ function CIc(a){this.a=new bnb;this.e=$C(kE,Nve,53,a,0,2);}
+ function ELc(a){a.Ug('No crossing minimization',1);a.Vg();}
+ function Evb(){yz.call(this,'There is no more element.');}
+ function OEd(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d;}
+ function PEd(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d;}
+ function h7d(a,b,c,d){this.e=a;this.a=b;this.c=c;this.d=d;}
+ function x7d(a,b,c,d){this.a=a;this.c=b;this.d=c;this.b=d;}
+ function C8d(a,b,c,d){s7d();M7d.call(this,b,c,d);this.a=a;}
+ function J8d(a,b,c,d){s7d();M7d.call(this,b,c,d);this.a=a;}
+ function lwd(a,b,c){var d,e;d=oSd(a);e=b.ti(c,d);return e}
+ function lBd(a){var b,c;c=(b=new s2d,b);l2d(c,a);return c}
+ function mBd(a){var b,c;c=(b=new s2d,b);p2d(c,a);return c}
+ function HDd(a,b){var c;c=Wjb(a.f,b);wEd(b,c);return null}
+ function uCd(a){!a.b&&(a.b=new C5d(G4,a,12,3));return a.b}
+ function VD(a){CFb(a==null||cE(a)&&!(a.Tm===keb));return a}
+ function gz(a){if(a.n){a.e!==rwe&&a.je();a.j=null;}return a}
+ function Ng(a){ig(a.d);if(a.d.d!=a.c){throw Adb(new Jrb)}}
+ function Bkb(a){sFb(a.b0&&wPd(this);}
+ function Vg(a,b){this.a=a;Pg.call(this,a,RD(a.d,15).fd(b));}
+ function lrd(a,b){return Qfb(urd(a)*trd(a),urd(b)*trd(b))}
+ function mrd(a,b){return Qfb(urd(a)*trd(a),urd(b)*trd(b))}
+ function n5b(a){return ozd(a)&&Heb(TD(Gxd(a,(yCc(),OAc))))}
+ function Sfc(a,b){return Rc(a,RD(mQb(b,(yCc(),tBc)),17),b)}
+ function lic(a,b){RD(mQb(a,(Ywc(),qwc)),15).Fc(b);return b}
+ function C2b(a,b){a.b=b.b;a.c=b.c;a.d=b.d;a.a=b.a;return a}
+ function cEb(a,b,c,d){this.b=a;this.c=d;xxb.call(this,b,c);}
+ function Ulc(a,b,c){a.i=0;a.e=0;if(b==c){return}Qlc(a,b,c);}
+ function Vlc(a,b,c){a.i=0;a.e=0;if(b==c){return}Rlc(a,b,c);}
+ function akc(a,b,c){Wjc();return _Gb(RD(Wjb(a.e,b),529),c)}
+ function nd(a){var b;return b=a.f,!b?(a.f=new ne(a,a.c)):b}
+ function nTc(a,b){return VTc(a.j,b.s,b.c)+VTc(b.e,a.s,a.c)}
+ function Rrc(a,b){if(!!a.e&&!a.e.a){Prc(a.e,b);Rrc(a.e,b);}}
+ function Qrc(a,b){if(!!a.d&&!a.d.a){Prc(a.d,b);Qrc(a.d,b);}}
+ function krd(a,b){return -Qfb(urd(a)*trd(a),urd(b)*trd(b))}
+ function gtd(a){return RD(a.ld(),149).Pg()+':'+jeb(a.md())}
+ function EBd(){BBd(this,new yAd);this.wb=(lTd(),kTd);jTd();}
+ function G7b(a){this.b=new bnb;Tmb(this.b,this.b);this.a=a;}
+ function WWc(a,b){new Yub;this.a=new Ejd;this.b=a;this.c=b;}
+ function urb(){urb=geb;rrb=new wrb;srb=new wrb;trb=new Brb;}
+ function yob(){yob=geb;vob=new Job;wob=new apb;xob=new ipb;}
+ function FGb(){FGb=geb;CGb=new AGb;EGb=new fHb;DGb=new YGb;}
+ function HSb(){HSb=geb;GSb=new bnb;FSb=new Tsb;ESb=new bnb;}
+ function Rb(a,b){if(a==null){throw Adb(new Ogb(b))}return a}
+ function tCd(a){!a.a&&(a.a=new C5d(J4,a,10,11));return a.a}
+ function uYd(a){!a.q&&(a.q=new C5d(s7,a,11,10));return a.q}
+ function xYd(a){!a.s&&(a.s=new C5d(y7,a,21,17));return a.s}
+ function er(a){Qb(a);return Er(new is(Mr(a.a.Kc(),new ir)))}
+ function hfd(a,b){rb(a);rb(b);return ns(RD(a,22),RD(b,22))}
+ function qDd(a,b,c){var d,e;d=Qeb(c);e=new hC(d);sC(a,b,e);}
+ function d4d(a,b,c,d,e,f){c4d.call(this,a,b,c,d,e,f?-2:-1);}
+ function sje(a,b,c,d){kZd.call(this,b,c);this.b=a;this.a=d;}
+ function Ry(a,b){wi.call(this,new ezb(a));this.a=a;this.b=b;}
+ function Gu(a){this.b=a;this.c=a;a.e=null;a.c=null;this.a=1;}
+ function Dkc(a){lkc();var b;b=RD(a.g,10);b.n.a=a.d.c+b.d.b;}
+ function fA(){fA=geb;var a,b;b=!lA();a=new tA;eA=b?new mA:a;}
+ function Hob(a){yob();return ZD(a,59)?new irb(a):new Upb(a)}
+ function Ux(a){return ZD(a,16)?new btb(RD(a,16)):Vx(a.Kc())}
+ function Vi(a){return new ij(a,a.e.Rd().gc()*a.c.Rd().gc())}
+ function fj(a){return new sj(a,a.e.Rd().gc()*a.c.Rd().gc())}
+ function Iz(a){return !!a&&!!a.hashCode?a.hashCode():kFb(a)}
+ function Yjb(a,b){return b==null?!!qtb(a.f,null):Jtb(a.i,b)}
+ function hYb(a,b){var c;c=$sb(a.a,b);c&&(b.d=null);return c}
+ function MGb(a,b,c){if(a.f){return a.f.ef(b,c)}return false}
+ function cFc(a,b,c,d){bD(a.c[b.g],c.g,d);bD(a.c[c.g],b.g,d);}
+ function fFc(a,b,c,d){bD(a.c[b.g],b.g,c);bD(a.b[b.g],b.g,d);}
+ function sXc(a,b,c){return Kfb(UD(c.a))<=a&&Kfb(UD(c.b))>=b}
+ function yJc(a,b){this.g=a;this.d=cD(WC(jR,1),WAe,10,0,[b]);}
+ function lHb(a){this.c=a;this.b=new yAb(RD(Qb(new oHb),50));}
+ function UYb(a){this.c=a;this.b=new yAb(RD(Qb(new XYb),50));}
+ function $Qb(a){this.b=a;this.a=new yAb(RD(Qb(new bRb),50));}
+ function tRc(){this.b=new _sb;this.d=new Yub;this.e=new Fyb;}
+ function VTb(){this.c=new pjd;this.d=new pjd;this.e=new pjd;}
+ function a1b(){this.a=new Ejd;this.b=(dk(3,iwe),new cnb(3));}
+ function i7d(a,b){this.e=a;this.a=jJ;this.b=pje(b);this.c=b;}
+ function Vid(a){this.c=a.c;this.d=a.d;this.b=a.b;this.a=a.a;}
+ function VLd(a,b,c,d,e,f){this.a=a;NKd.call(this,b,c,d,e,f);}
+ function aLd(a,b,c,d,e,f){this.a=a;NKd.call(this,b,c,d,e,f);}
+ function fge(a,b,c,d,e,f,g){return new lle(a.e,b,c,d,e,f,g)}
+ function xhb(a,b,c){return c>=0&&lhb(a.substr(c,b.length),b)}
+ function hGd(a,b){return ZD(b,149)&&lhb(a.b,RD(b,149).Pg())}
+ function Tde(a,b){return a.a?b.Gh().Kc():RD(b.Gh(),71).Ii()}
+ function Qqb(a,b){var c;c=a.b.Qc(b);Rqb(c,a.b.gc());return c}
+ function Ivb(a,b){if(a==null){throw Adb(new Ogb(b))}return a}
+ function zYd(a){if(!a.u){yYd(a);a.u=new w0d(a,a);}return a.u}
+ function Kx(a){this.a=(yob(),ZD(a,59)?new irb(a):new Upb(a));}
+ function Uwd(a){var b;b=RD(Ywd(a,16),29);return !b?a.ii():b}
+ function lz(a,b){var c;c=nfb(a.Rm);return b==null?c:c+': '+b}
+ function zhb(a,b,c){AFb(b,c,a.length);return a.substr(b,c-b)}
+ function VKb(a,b){RJb.call(this);KKb(this);this.a=a;this.c=b;}
+ function neb(a){!a?vve:lz(a,a.ie());}
+ function Wz(a){Qz();$wnd.setTimeout(function(){throw a},0);}
+ function GHb(){DHb();return cD(WC(uN,1),jwe,436,0,[CHb,BHb])}
+ function OHb(){LHb();return cD(WC(vN,1),jwe,435,0,[JHb,KHb])}
+ function WUb(){TUb();return cD(WC(BP,1),jwe,432,0,[RUb,SUb])}
+ function S8b(){P8b();return cD(WC(vS,1),jwe,517,0,[O8b,N8b])}
+ function Rvc(){Ovc();return cD(WC(lX,1),jwe,429,0,[Mvc,Nvc])}
+ function buc(){$tc();return cD(WC(cX,1),jwe,428,0,[Ytc,Ztc])}
+ function mtc(){jtc();return cD(WC($W,1),jwe,431,0,[htc,itc])}
+ function vEc(){sEc();return cD(WC(xX,1),jwe,430,0,[qEc,rEc])}
+ function vNc(){sNc();return cD(WC(MY,1),jwe,531,0,[rNc,qNc])}
+ function D2c(){x2c();return cD(WC(s0,1),jwe,501,0,[v2c,w2c])}
+ function zQc(){wQc();return cD(WC(FZ,1),jwe,523,0,[vQc,uQc])}
+ function HQc(){EQc();return cD(WC(GZ,1),jwe,522,0,[CQc,DQc])}
+ function iTc(){fTc();return cD(WC(b$,1),jwe,528,0,[eTc,dTc])}
+ function Fuc(){Cuc();return cD(WC(fX,1),jwe,488,0,[Buc,Auc])}
+ function F8c(){z8c();return cD(WC(l1,1),jwe,491,0,[x8c,y8c])}
+ function H9c(){B9c();return cD(WC(t1,1),jwe,492,0,[z9c,A9c])}
+ function D_c(){A_c();return cD(WC(K_,1),jwe,433,0,[z_c,y_c])}
+ function a4c(){Y3c();return cD(WC(H0,1),jwe,434,0,[W3c,X3c])}
+ function gVc(){dVc();return cD(WC(w$,1),jwe,465,0,[bVc,cVc])}
+ function Pbd(){Mbd();return cD(WC(O1,1),jwe,438,0,[Lbd,Kbd])}
+ function rdd(){ldd();return cD(WC(W1,1),jwe,437,0,[kdd,jdd])}
+ function xqd(){uqd();return cD(WC(M3,1),jwe,347,0,[sqd,tqd])}
+ function Jvd(a,b,c,d){return c>=0?a.Uh(b,c,d):a.Ch(null,c,d)}
+ function ltd(a){if(a.b.b==0){return a.a.sf()}return Uub(a.b)}
+ function vKd(a){if(a.p!=5)throw Adb(new cgb);return Ydb(a.f)}
+ function EKd(a){if(a.p!=5)throw Adb(new cgb);return Ydb(a.k)}
+ function P$d(a){dE(a.a)===dE((lYd(),kYd))&&Q$d(a);return a.a}
+ function iad(a,b){a.b=b;a.c>0&&a.b>0&&(a.g=Aad(a.c,a.b,a.a));}
+ function jad(a,b){a.c=b;a.c>0&&a.b>0&&(a.g=Aad(a.c,a.b,a.a));}
+ function BUc(a,b){yUc(this,new rjd(a.a,a.b));zUc(this,gv(b));}
+ function Tp(){Sp.call(this,new Usb(Sv(12)));Lb(true);this.a=2;}
+ function eue(a,b,c){Vse();Wse.call(this,a);this.b=b;this.a=c;}
+ function C7d(a,b,c){s7d();t7d.call(this,b);this.a=a;this.b=c;}
+ function qub(a){var b;b=a.c.d.b;a.b=b;a.a=a.c.d;b.a=a.c.d.b=a;}
+ function Tub(a){return a.b==0?null:(sFb(a.b!=0),Wub(a,a.a.a))}
+ function Xjb(a,b){return b==null?Wd(qtb(a.f,null)):Ktb(a.i,b)}
+ function bzb(a,b,c,d,e){return new Kzb(a,(cAb(),aAb),b,c,d,e)}
+ function Fnb(a,b){oFb(b);return Hnb(a,$C(kE,Pwe,28,b,15,1),b)}
+ function Tx(a,b){Rb(a,'set1');Rb(b,'set2');return new ey(a,b)}
+ function Kz(a,b){var c=Jz[a.charCodeAt(0)];return c==null?a:c}
+ function Xyb(a,b){var c,d;c=b;d=new Gzb;Zyb(a,c,d);return d.d}
+ function EMb(a,b,c,d){var e;e=new TJb;b.a[c.g]=e;Wrb(a.b,d,e);}
+ function SXb(a,b){var c;c=BXb(a.f,b);return $id(fjd(c),a.f.d)}
+ function RFb(a){var b;EJb(a.a);DJb(a.a);b=new PJb(a.a);LJb(b);}
+ function _Mb(a,b){$Mb(a,true);Umb(a.e.Rf(),new dNb(a,true,b));}
+ function PSb(a,b){HSb();return a==vCd(JGd(b))||a==vCd(LGd(b))}
+ function R0c(a,b){B0c();return RD(mQb(b,(h_c(),f_c)),17).a==a}
+ function eE(a){return Math.max(Math.min(a,lve),-2147483648)|0}
+ function sy(a){this.a=RD(Qb(a),277);this.b=(yob(),new jrb(a));}
+ function qbd(a,b,c){this.i=new bnb;this.b=a;this.g=b;this.a=c;}
+ function had(a,b,c){this.a=new bnb;this.e=a;this.f=b;this.c=c;}
+ function _9c(a,b,c){this.c=new bnb;this.e=a;this.f=b;this.b=c;}
+ function TKb(a){RJb.call(this);KKb(this);this.a=a;this.c=true;}
+ function ieb(a){function b(){}
+b.prototype=a||{};return new b}
+ function zfb(a){if(a.Ae()){return null}var b=a.n;return eeb[b]}
+ function kzd(a){if(a.Db>>16!=3)return null;return RD(a.Cb,27)}
+ function MCd(a){if(a.Db>>16!=9)return null;return RD(a.Cb,27)}
+ function Fzd(a){if(a.Db>>16!=6)return null;return RD(a.Cb,74)}
+ function dVc(){dVc=geb;bVc=new eVc(Nye,0);cVc=new eVc(Oye,1);}
+ function wQc(){wQc=geb;vQc=new xQc(Oye,0);uQc=new xQc(Nye,1);}
+ function EQc(){EQc=geb;CQc=new FQc(Zye,0);DQc=new FQc('UP',1);}
+ function Is(){Is=geb;Hs=ss((zs(),cD(WC(RG,1),jwe,549,0,[ys])));}
+ function Wx(a){var b;b=new atb(Sv(a.length));zob(b,a);return b}
+ function B2b(a,b){a.b+=b.b;a.c+=b.c;a.d+=b.d;a.a+=b.a;return a}
+ function qmb(a,b){if(kmb(a,b)){Jmb(a);return true}return false}
+ function qC(a,b){if(b==null){throw Adb(new Ngb)}return rC(a,b)}
+ function nB(a,b){var c;c=a.q.getHours();a.q.setDate(b);mB(a,c);}
+ function Xvd(a,b,c){var d;d=a.Ih(b);d>=0?a.bi(d,c):Svd(a,b,c);}
+ function Lvd(a,b){var c;c=a.Ih(b);return c>=0?a.Wh(c):Rvd(a,b)}
+ function zo(a,b){var c;Qb(b);for(c=a.a;c;c=c.c){b.Yd(c.g,c.i);}}
+ function pMc(a,b,c){var d;d=qMc(a,b,c);a.b=new _Lc(d.c.length);}
+ function HId(a,b,c){EId();!!a&&Zjb(DId,a,b);!!a&&Zjb(CId,a,c);}
+ function bfc(a,b){Rec();return Geb(),RD(b.a,17).a0}
+ function sId(a){var b;b=a.d;b=a.bj(a.f);WGd(a,b);return b.Ob()}
+ function bHd(a,b){var c;c=new Kub(b);Ve(c,a);return new dnb(c)}
+ function qKd(a){if(a.p!=0)throw Adb(new cgb);return Pdb(a.f,0)}
+ function zKd(a){if(a.p!=0)throw Adb(new cgb);return Pdb(a.k,0)}
+ function gBd(a){if(a.Db>>16!=7)return null;return RD(a.Cb,241)}
+ function xXd(a){if(a.Db>>16!=6)return null;return RD(a.Cb,241)}
+ function dCd(a){if(a.Db>>16!=7)return null;return RD(a.Cb,167)}
+ function vCd(a){if(a.Db>>16!=11)return null;return RD(a.Cb,27)}
+ function uWd(a){if(a.Db>>16!=17)return null;return RD(a.Cb,29)}
+ function kVd(a){if(a.Db>>16!=3)return null;return RD(a.Cb,155)}
+ function BDb(a){var b;MCb(a);b=new _sb;return CDb(a,new aEb(b))}
+ function xfb(a,b){var c=a.a=a.a||[];return c[b]||(c[b]=a.ve(b))}
+ function qB(a,b){var c;c=a.q.getHours();a.q.setMonth(b);mB(a,c);}
+ function oz(a,b){ez(this);this.f=b;this.g=a;gz(this);this.je();}
+ function TQb(a,b){this.a=a;this.c=ajd(this.a);this.b=new Vid(b);}
+ function aGb(a,b,c){this.a=b;this.c=a;this.b=(Qb(c),new dnb(c));}
+ function s$b(a,b,c){this.a=b;this.c=a;this.b=(Qb(c),new dnb(c));}
+ function _Kc(a){this.a=a;this.b=$C(qY,Nve,2043,a.e.length,0,2);}
+ function fGb(){this.a=new Iub;this.e=new _sb;this.g=0;this.i=0;}
+ function EId(){EId=geb;DId=new Tsb;CId=new Tsb;IId(zK,new JId);}
+ function KFc(){KFc=geb;JFc=nfd(new ufd,(sXb(),rXb),(hcc(),$bc));}
+ function RFc(){RFc=geb;QFc=nfd(new ufd,(sXb(),rXb),(hcc(),$bc));}
+ function gGc(){gGc=geb;fGc=nfd(new ufd,(sXb(),rXb),(hcc(),$bc));}
+ function ANc(){ANc=geb;zNc=pfd(new ufd,(sXb(),rXb),(hcc(),ybc));}
+ function dOc(){dOc=geb;cOc=pfd(new ufd,(sXb(),rXb),(hcc(),ybc));}
+ function gQc(){gQc=geb;fQc=pfd(new ufd,(sXb(),rXb),(hcc(),ybc));}
+ function WQc(){WQc=geb;VQc=pfd(new ufd,(sXb(),rXb),(hcc(),ybc));}
+ function dZd(a,b,c,d,e,f){return new P3d(a.e,b,a.Lj(),c,d,e,f)}
+ function $jb(a,b,c){return b==null?rtb(a.f,null,c):Ltb(a.i,b,c)}
+ function Y0b(a,b){!!a.c&&Ymb(a.c.g,a);a.c=b;!!a.c&&Rmb(a.c.g,a);}
+ function g3b(a,b){!!a.c&&Ymb(a.c.a,a);a.c=b;!!a.c&&Rmb(a.c.a,a);}
+ function P3b(a,b){!!a.i&&Ymb(a.i.j,a);a.i=b;!!a.i&&Rmb(a.i.j,a);}
+ function Z0b(a,b){!!a.d&&Ymb(a.d.e,a);a.d=b;!!a.d&&Rmb(a.d.e,a);}
+ function _Sc(a,b){!!a.a&&Ymb(a.a.k,a);a.a=b;!!a.a&&Rmb(a.a.k,a);}
+ function aTc(a,b){!!a.b&&Ymb(a.b.f,a);a.b=b;!!a.b&&Rmb(a.b.f,a);}
+ function Odd(a,b){Pdd(a,a.b,a.c);RD(a.b.b,68);!!b&&RD(b.b,68).b;}
+ function j2c(a,b){return Qfb(RD(a.c,65).c.e.b,RD(b.c,65).c.e.b)}
+ function k2c(a,b){return Qfb(RD(a.c,65).c.e.a,RD(b.c,65).c.e.a)}
+ function YXb(a){NXb();return Geb(),RD(a.a,86).d.e!=0?true:false}
+ function LXd(a,b){ZD(a.Cb,184)&&(RD(a.Cb,184).tb=null);PAd(a,b);}
+ function CWd(a,b){ZD(a.Cb,90)&&v$d(yYd(RD(a.Cb,90)),4);PAd(a,b);}
+ function _5d(a,b){a6d(a,b);ZD(a.Cb,90)&&v$d(yYd(RD(a.Cb,90)),2);}
+ function JFd(a,b){var c,d;c=b.c;d=c!=null;d&&oDd(a,new OC(b.c));}
+ function v0d(a){var b,c;c=(jTd(),b=new s2d,b);l2d(c,a);return c}
+ function E4d(a){var b,c;c=(jTd(),b=new s2d,b);l2d(c,a);return c}
+ function Fr(a){var b;while(true){b=a.Pb();if(!a.Ob()){return b}}}
+ function nq(a,b,c){Rmb(a.a,(fn(),ck(b,c),new gp(b,c)));return a}
+ function rge(a,b){return nke(),wWd(b)?new ole(b,a):new Eke(b,a)}
+ function ojb(a){Pib();return Ddb(a,0)>=0?jjb(a):Xib(jjb(Odb(a)))}
+ function Asb(a){var b;b=RD(UEb(a.b),9);return new Fsb(a.a,b,a.c)}
+ function Qw(a,b){var c;c=RD(Xv(nd(a.a),b),16);return !c?0:c.gc()}
+ function Zmb(a,b,c){var d;xFb(b,c,a.c.length);d=c-b;$Eb(a.c,b,d);}
+ function Rkb(a,b,c){xFb(b,c,a.gc());this.c=a;this.a=b;this.b=c-b;}
+ function fgd(a){this.c=new Yub;this.b=a.b;this.d=a.c;this.a=a.a;}
+ function qjd(a){this.a=$wnd.Math.cos(a);this.b=$wnd.Math.sin(a);}
+ function bTc(a,b,c,d){this.c=a;this.d=d;_Sc(this,b);aTc(this,c);}
+ function Si(a,b){Qi.call(this,new Usb(Sv(a)));dk(b,Mve);this.a=b;}
+ function Ryb(a,b,c){return new Kzb(a,(cAb(),_zb),null,false,b,c)}
+ function czb(a,b,c){return new Kzb(a,(cAb(),bAb),b,c,null,false)}
+ function ABb(){xBb();return cD(WC(QL,1),jwe,108,0,[uBb,vBb,wBb])}
+ function yLb(){vLb();return cD(WC(TN,1),jwe,472,0,[uLb,tLb,sLb])}
+ function HKb(){EKb();return cD(WC(MN,1),jwe,471,0,[CKb,BKb,DKb])}
+ function aKb(){ZJb();return cD(WC(JN,1),jwe,237,0,[WJb,XJb,YJb])}
+ function DWb(){AWb();return cD(WC(JP,1),jwe,391,0,[yWb,xWb,zWb])}
+ function moc(){joc();return cD(WC(UV,1),jwe,372,0,[ioc,hoc,goc])}
+ function ytc(){stc();return cD(WC(_W,1),jwe,322,0,[qtc,ptc,rtc])}
+ function Htc(){Etc();return cD(WC(aX,1),jwe,351,0,[Btc,Dtc,Ctc])}
+ function kuc(){huc();return cD(WC(dX,1),jwe,460,0,[fuc,euc,guc])}
+ function Avc(){xvc();return cD(WC(jX,1),jwe,299,0,[vvc,wvc,uvc])}
+ function Jvc(){Gvc();return cD(WC(kX,1),jwe,311,0,[Evc,Fvc,Dvc])}
+ function pDc(){lDc();return cD(WC(sX,1),jwe,390,0,[iDc,jDc,kDc])}
+ function EEc(){BEc();return cD(WC(yX,1),jwe,463,0,[AEc,yEc,zEc])}
+ function NEc(){KEc();return cD(WC(zX,1),jwe,387,0,[HEc,IEc,JEc])}
+ function WEc(){TEc();return cD(WC(AX,1),jwe,349,0,[SEc,QEc,REc])}
+ function oFc(){lFc();return cD(WC(CX,1),jwe,350,0,[iFc,jFc,kFc])}
+ function xFc(){uFc();return cD(WC(DX,1),jwe,352,0,[tFc,rFc,sFc])}
+ function GFc(){DFc();return cD(WC(EX,1),jwe,388,0,[BFc,CFc,AFc])}
+ function UKc(){RKc();return cD(WC(nY,1),jwe,464,0,[OKc,PKc,QKc])}
+ function K3b(a){return xjd(cD(WC(l3,1),Nve,8,0,[a.i.n,a.n,a.a]))}
+ function OZc(){LZc();return cD(WC(F_,1),jwe,392,0,[KZc,JZc,IZc])}
+ function H_c(){H_c=geb;G_c=nfd(new ufd,(YVc(),WVc),(WYc(),MYc));}
+ function A_c(){A_c=geb;z_c=new B_c('DFS',0);y_c=new B_c('BFS',1);}
+ function TQc(a,b,c){var d;d=new SQc;d.b=b;d.a=c;++b.b;Rmb(a.d,d);}
+ function NTb(a,b,c){var d;d=new sjd(c.d);$id(d,a);CGd(b,d.a,d.b);}
+ function Nwb(a,b){Mwb(a,Ydb(Cdb(Tdb(b,24),Pxe)),Ydb(Cdb(b,Pxe)));}
+ function wFb(a,b){if(a<0||a>b){throw Adb(new veb(cye+a+dye+b))}}
+ function tFb(a,b){if(a<0||a>=b){throw Adb(new veb(cye+a+dye+b))}}
+ function BFb(a,b){if(a<0||a>=b){throw Adb(new eib(cye+a+dye+b))}}
+ function Swb(a,b){this.b=(uFb(a),a);this.a=(b&qxe)==0?b|64|Ove:b;}
+ function ODb(a){var b;MCb(a);b=(urb(),urb(),srb);return PDb(a,b)}
+ function R9c(a,b,c){var d;d=S9c(a,b,false);return d.b<=b&&d.a<=c}
+ function h9c(){b9c();return cD(WC(o1,1),jwe,439,0,[$8c,a9c,_8c])}
+ function c7c(){_6c();return cD(WC(a1,1),jwe,394,0,[Z6c,$6c,Y6c])}
+ function i6c(){f6c();return cD(WC(V0,1),jwe,445,0,[c6c,d6c,e6c])}
+ function D6c(){z6c();return cD(WC(Z0,1),jwe,456,0,[w6c,y6c,x6c])}
+ function k4c(){g4c();return cD(WC(I0,1),jwe,393,0,[d4c,e4c,f4c])}
+ function x5c(){t5c();return cD(WC(N0,1),jwe,300,0,[r5c,s5c,q5c])}
+ function Ind(){Fnd();return cD(WC(y3,1),jwe,346,0,[Dnd,Cnd,End])}
+ function jbd(){gbd();return cD(WC(I1,1),jwe,444,0,[dbd,ebd,fbd])}
+ function Rmd(){Omd();return cD(WC(t3,1),jwe,278,0,[Lmd,Mmd,Nmd])}
+ function pqd(){mqd();return cD(WC(J3,1),jwe,280,0,[kqd,jqd,lqd])}
+ function bv(a){Qb(a);return ZD(a,16)?new dnb(RD(a,16)):cv(a.Kc())}
+ function Hz(a,b){return !!a&&!!a.equals?a.equals(b):dE(a)===dE(b)}
+ function Cdb(a,b){return Edb(tD(Kdb(a)?Wdb(a):a,Kdb(b)?Wdb(b):b))}
+ function Rdb(a,b){return Edb(zD(Kdb(a)?Wdb(a):a,Kdb(b)?Wdb(b):b))}
+ function $db(a,b){return Edb(HD(Kdb(a)?Wdb(a):a,Kdb(b)?Wdb(b):b))}
+ function xs(a,b){var c;c=(uFb(a),a).g;lFb(!!c);uFb(b);return c(b)}
+ function rv(a,b){var c,d;d=tv(a,b);c=a.a.fd(d);return new Gv(a,c)}
+ function CXd(a){if(a.Db>>16!=6)return null;return RD(yvd(a),241)}
+ function sKd(a){if(a.p!=2)throw Adb(new cgb);return Ydb(a.f)&Bwe}
+ function BKd(a){if(a.p!=2)throw Adb(new cgb);return Ydb(a.k)&Bwe}
+ function ynb(a){sFb(a.ad?1:0}
+ function Hmc(a,b){var c,d;c=Gmc(b);d=c;return RD(Wjb(a.c,d),17).a}
+ function CMc(a,b,c){var d;d=a.d[b.p];a.d[b.p]=a.d[c.p];a.d[c.p]=d;}
+ function Jqd(a,b,c){var d;if(a.n&&!!b&&!!c){d=new otd;Rmb(a.e,d);}}
+ function gYb(a,b){Ysb(a.a,b);if(b.d){throw Adb(new yz(jye))}b.d=a;}
+ function Had(a,b){this.a=new bnb;this.d=new bnb;this.f=a;this.c=b;}
+ function RWb(){this.c=new dXb;this.a=new I_b;this.b=new E0b;g0b();}
+ function med(){hed();this.b=new Tsb;this.a=new Tsb;this.c=new bnb;}
+ function KKd(a,b,c){this.d=a;this.j=b;this.e=c;this.o=-1;this.p=3;}
+ function LKd(a,b,c){this.d=a;this.k=b;this.f=c;this.o=-1;this.p=5;}
+ function S3d(a,b,c,d,e,f){R3d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function U3d(a,b,c,d,e,f){T3d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function W3d(a,b,c,d,e,f){V3d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function Y3d(a,b,c,d,e,f){X3d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function $3d(a,b,c,d,e,f){Z3d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function a4d(a,b,c,d,e,f){_3d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function f4d(a,b,c,d,e,f){e4d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function h4d(a,b,c,d,e,f){g4d.call(this,a,b,c,d,e);f&&(this.o=-2);}
+ function N7d(a,b,c,d){t7d.call(this,c);this.b=a;this.c=b;this.d=d;}
+ function mfe(a,b){this.f=a;this.a=(ree(),pee);this.c=pee;this.b=b;}
+ function Jfe(a,b){this.g=a;this.d=(ree(),qee);this.a=qee;this.b=b;}
+ function Gme(a,b){!a.c&&(a.c=new Uge(a,0));Fge(a.c,(nme(),fme),b);}
+ function Oge(a,b){return Pge(a,b,ZD(b,102)&&(RD(b,19).Bb&txe)!=0)}
+ function lB(a,b){return Agb(Hdb(a.q.getTime()),Hdb(b.q.getTime()))}
+ function gj(a){return fk(a.e.Rd().gc()*a.c.Rd().gc(),16,new qj(a))}
+ function CYd(a){return !!a.u&&tYd(a.u.a).i!=0&&!(!!a.n&&d$d(a.n))}
+ function p4d(a){return !!a.a&&o4d(a.a.a).i!=0&&!(!!a.b&&o5d(a.b))}
+ function Cxd(a,b){if(b==0){return !!a.o&&a.o.f!=0}return Kvd(a,b)}
+ function Cc(a,b,c){var d;d=RD(a.Zb().xc(b),16);return !!d&&d.Hc(c)}
+ function Gc(a,b,c){var d;d=RD(a.Zb().xc(b),16);return !!d&&d.Mc(c)}
+ function _yb(a,b){var c;c=1-b;a.a[c]=azb(a.a[c],c);return azb(a,b)}
+ function DFb(a,b){var c,d;d=Cdb(a,yxe);c=Sdb(b,32);return Rdb(c,d)}
+ function bGb(a,b,c){var d;d=(Qb(a),new dnb(a));_Fb(new aGb(d,b,c));}
+ function t$b(a,b,c){var d;d=(Qb(a),new dnb(a));r$b(new s$b(d,b,c));}
+ function vBd(a,b,c,d,e,f){wBd(a,b,c,f);EYd(a,d);FYd(a,e);return a}
+ function Xhb(a,b,c,d){a.a+=''+zhb(b==null?vve:jeb(b),c,d);return a}
+ function Jkb(a,b){this.a=a;Dkb.call(this,a);wFb(b,a.gc());this.b=b;}
+ function xmb(a){this.a=$C(jJ,rve,1,mgb($wnd.Math.max(8,a))<<1,5,1);}
+ function t2b(a){return RD(anb(a,$C(jR,WAe,10,a.c.length,0,1)),199)}
+ function s2b(a){return RD(anb(a,$C(WQ,VAe,18,a.c.length,0,1)),483)}
+ function Iyb(a){return !a.a?a.c:a.e.length==0?a.a.a:a.a.a+(''+a.e)}
+ function Rib(a){while(a.d>0&&a.a[--a.d]==0);a.a[a.d++]==0&&(a.e=0);}
+ function fvb(a){sFb(a.b.b!=a.d.a);a.c=a.b=a.b.b;--a.a;return a.c.c}
+ function sRc(a,b,c){a.a=b;a.c=c;a.b.a.$b();Xub(a.d);aFb(a.e.a.c,0);}
+ function Z5c(a,b){var c;a.e=new R5c;c=Q2c(b);_mb(c,a.c);$5c(a,c,0);}
+ function zgd(a,b,c,d){var e;e=new Hgd;e.a=b;e.b=c;e.c=d;Mub(a.a,e);}
+ function Agd(a,b,c,d){var e;e=new Hgd;e.a=b;e.b=c;e.c=d;Mub(a.b,e);}
+ function Tb(a,b,c){if(a<0||bc){throw Adb(new veb(Kb(a,b,c)))}}
+ function Pb(a,b){if(a<0||a>=b){throw Adb(new veb(Ib(a,b)))}return a}
+ function qz(b){if(!('stack' in b)){try{throw b}catch(a){}}return b}
+ function Zjc(a){Wjc();if(ZD(a.g,10)){return RD(a.g,10)}return null}
+ function nx(a){if(Ih(a).dc()){return false}Jh(a,new rx);return true}
+ function Xdb(a){var b;if(Kdb(a)){b=a;return b==-0.?0:b}return ED(a)}
+ function lkb(a,b){if(ZD(b,44)){return Jd(a.a,RD(b,44))}return false}
+ function gsb(a,b){if(ZD(b,44)){return Jd(a.a,RD(b,44))}return false}
+ function vub(a,b){if(ZD(b,44)){return Jd(a.a,RD(b,44))}return false}
+ function RCb(a){var b;LCb(a);b=new Prb;ixb(a.a,new fDb(b));return b}
+ function Vae(){var a,b,c;b=(c=(a=new s2d,a),c);Rmb(Rae,b);return b}
+ function mDb(a){var b;LCb(a);b=new ltb;ixb(a.a,new uDb(b));return b}
+ function jDb(a,b){if(a.a<=a.b){b.Dd(a.a++);return true}return false}
+ function xzb(a){yzb.call(this,a,(cAb(),$zb),null,false,null,false);}
+ function $Rb(){$Rb=geb;ZRb=ss((VRb(),cD(WC($O,1),jwe,489,0,[URb])));}
+ function CHc(){CHc=geb;BHc=yx(sgb(1),sgb(4));AHc=yx(sgb(1),sgb(2));}
+ function yXc(a,b){return new gud(b,njd(ajd(b.e),a,a),(Geb(),true))}
+ function fv(a){return new cnb((dk(a,lwe),dz(Bdb(Bdb(5,a),a/10|0))))}
+ function Wi(a){return fk(a.e.Rd().gc()*a.c.Rd().gc(),273,new kj(a))}
+ function u2b(a){return RD(anb(a,$C(xR,XAe,12,a.c.length,0,1)),2042)}
+ function COc(a){dOc();return !W0b(a)&&!(!W0b(a)&&a.c.i.c==a.d.i.c)}
+ function Y_c(a,b){R_c();return RD(mQb(b,(h_c(),W$c)),17).a>=a.gc()}
+ function q8b(a,b){w8b(b,a);y8b(a.d);y8b(RD(mQb(a,(yCc(),cBc)),214));}
+ function r8b(a,b){z8b(b,a);B8b(a.d);B8b(RD(mQb(a,(yCc(),cBc)),214));}
+ function $0b(a,b,c){!!a.d&&Ymb(a.d.e,a);a.d=b;!!a.d&&Qmb(a.d.e,c,a);}
+ function jPb(a,b,c){return c.f.c.length>0?yPb(a.a,b,c):yPb(a.b,b,c)}
+ function Uz(a,b,c){var d;d=Sz();try{return Rz(a,b,c)}finally{Vz(d);}}
+ function wDd(a,b){var c,d;c=qC(a,b);d=null;!!c&&(d=c.pe());return d}
+ function yDd(a,b){var c,d;c=qC(a,b);d=null;!!c&&(d=c.se());return d}
+ function xDd(a,b){var c,d;c=JB(a,b);d=null;!!c&&(d=c.se());return d}
+ function zDd(a,b){var c,d;c=qC(a,b);d=null;!!c&&(d=ADd(c));return d}
+ function rEd(a,b,c){var d;d=uDd(c);Do(a.g,d,b);Do(a.i,b,c);return b}
+ function UIc(a,b,c){this.d=new fJc(this);this.e=a;this.i=b;this.f=c;}
+ function Mk(a,b,c,d){this.e=null;this.c=a;this.d=b;this.a=c;this.b=d;}
+ function urc(a,b,c,d){nrc(this);this.c=a;this.e=b;this.f=c;this.b=d;}
+ function MKd(a,b,c,d){this.d=a;this.n=b;this.g=c;this.o=d;this.p=-1;}
+ function Vc(a,b,c,d){return ZD(c,59)?new Kg(a,b,c,d):new yg(a,b,c,d)}
+ function gr(a){if(ZD(a,16)){return RD(a,16).dc()}return !a.Kc().Ob()}
+ function Wo(a){if(a.e.g!=a.b){throw Adb(new Jrb)}return !!a.c&&a.d>0}
+ function evb(a){sFb(a.b!=a.d.c);a.c=a.b;a.b=a.b.a;++a.a;return a.c.c}
+ function imb(a,b){uFb(b);bD(a.a,a.c,b);a.c=a.c+1&a.a.length-1;mmb(a);}
+ function hmb(a,b){uFb(b);a.b=a.b-1&a.a.length-1;bD(a.a,a.b,b);mmb(a);}
+ function _je(a){var b;b=a.Gh();this.a=ZD(b,71)?RD(b,71).Ii():b.Kc();}
+ function px(a){return new Swb(Dob(RD(a.a.md(),16).gc(),a.a.ld()),16)}
+ function Abd(){Abd=geb;zbd=ss((sbd(),cD(WC(M1,1),jwe,490,0,[rbd])));}
+ function Jbd(){Jbd=geb;Ibd=ss((Cbd(),cD(WC(N1,1),jwe,558,0,[Bbd])));}
+ function idd(){idd=geb;hdd=ss((_cd(),cD(WC(V1,1),jwe,539,0,[$cd])));}
+ function X$b(){U$b();return cD(WC(CQ,1),jwe,389,0,[T$b,R$b,Q$b,S$b])}
+ function hAb(){cAb();return cD(WC(AL,1),jwe,304,0,[$zb,_zb,aAb,bAb])}
+ function LPb(){IPb();return cD(WC(DO,1),jwe,332,0,[FPb,EPb,GPb,HPb])}
+ function LRb(){IRb();return cD(WC(WO,1),jwe,406,0,[FRb,ERb,GRb,HRb])}
+ function pOb(){mOb();return cD(WC(hO,1),jwe,417,0,[lOb,iOb,jOb,kOb])}
+ function uZb(){nZb();return cD(WC(lQ,1),jwe,416,0,[jZb,mZb,kZb,lZb])}
+ function hnc(){enc();return cD(WC(LV,1),jwe,421,0,[anc,bnc,cnc,dnc])}
+ function zec(){vec();return cD(WC(qT,1),jwe,371,0,[uec,sec,tec,rec])}
+ function BDc(){wDc();return cD(WC(tX,1),jwe,203,0,[uDc,vDc,tDc,sDc])}
+ function nEc(){kEc();return cD(WC(wX,1),jwe,284,0,[hEc,gEc,iEc,jEc])}
+ function Unc(a){var b;return a.j==(qpd(),npd)&&(b=Vnc(a),Csb(b,Xod))}
+ function qhc(a,b){var c;c=b.a;Y0b(c,b.c.d);Z0b(c,b.d.d);Cjd(c.a,a.n);}
+ function _5b(a,b){var c;c=RD(cub(a.b,b),67);!c&&(c=new Yub);return c}
+ function $jc(a){Wjc();if(ZD(a.g,154)){return RD(a.g,154)}return null}
+ function gRc(a){a.a=null;a.e=null;aFb(a.b.c,0);aFb(a.f.c,0);a.c=null;}
+ function Ovc(){Ovc=geb;Mvc=new Pvc(Kye,0);Nvc=new Pvc('TOP_LEFT',1);}
+ function sNc(){sNc=geb;rNc=new tNc('UPPER',0);qNc=new tNc('LOWER',1);}
+ function nWc(a,b){return cjd(new rjd(b.e.a+b.f.a/2,b.e.b+b.f.b/2),a)}
+ function wqc(a,b){return RD(Lvb(JDb(RD(Qc(a.k,b),15).Oc(),lqc)),113)}
+ function xqc(a,b){return RD(Lvb(KDb(RD(Qc(a.k,b),15).Oc(),lqc)),113)}
+ function cWc(){YVc();return cD(WC(H$,1),jwe,405,0,[UVc,VVc,WVc,XVc])}
+ function v_c(){s_c();return cD(WC(J_,1),jwe,353,0,[r_c,p_c,q_c,o_c])}
+ function n5c(){j5c();return cD(WC(M0,1),jwe,354,0,[i5c,g5c,h5c,f5c])}
+ function Tpd(){Qpd();return cD(WC(H3,1),jwe,386,0,[Opd,Ppd,Npd,Mpd])}
+ function Tnd(){Pnd();return cD(WC(z3,1),jwe,291,0,[Ond,Lnd,Mnd,Nnd])}
+ function _md(){Ymd();return cD(WC(u3,1),jwe,223,0,[Xmd,Vmd,Umd,Wmd])}
+ function Jrd(){Grd();return cD(WC(R3,1),jwe,320,0,[Frd,Crd,Erd,Drd])}
+ function wtd(){ttd();return cD(WC(n4,1),jwe,415,0,[qtd,rtd,ptd,std])}
+ function GId(a){EId();return Ujb(DId,a)?RD(Wjb(DId,a),341).Qg():null}
+ function Avd(a,b,c){return b<0?Rvd(a,c):RD(c,69).wk().Bk(a,a.hi(),b)}
+ function sEd(a,b,c){var d;d=uDd(c);Do(a.j,d,b);Zjb(a.k,b,c);return b}
+ function qEd(a,b,c){var d;d=uDd(c);Do(a.d,d,b);Zjb(a.e,b,c);return b}
+ function DGd(a){var b,c;b=(bvd(),c=new rzd,c);!!a&&pzd(b,a);return b}
+ function WHd(a){var b;b=a.aj(a.i);a.i>0&&hib(a.g,0,b,0,a.i);return b}
+ function Led(a,b){var c;for(c=a.j.c.length;c>24}
+ function AKd(a){if(a.p!=1)throw Adb(new cgb);return Ydb(a.k)<<24>>24}
+ function GKd(a){if(a.p!=7)throw Adb(new cgb);return Ydb(a.k)<<16>>16}
+ function xKd(a){if(a.p!=7)throw Adb(new cgb);return Ydb(a.f)<<16>>16}
+ function Wib(a,b){if(b.e==0||a.e==0){return Oib}return Ljb(),Mjb(a,b)}
+ function Nd(a,b){return dE(b)===dE(a)?'(this Map)':b==null?vve:jeb(b)}
+ function MFb(a,b,c){return Jfb(UD(Wd(qtb(a.f,b))),UD(Wd(qtb(a.f,c))))}
+ function wkc(a,b,c){var d;d=RD(Wjb(a.g,c),60);Rmb(a.a.c,new Ptd(b,d));}
+ function Slc(a,b,c){a.i=0;a.e=0;if(b==c){return}Rlc(a,b,c);Qlc(a,b,c);}
+ function rTc(a,b,c,d,e){var f;f=mTc(e,c,d);Rmb(b,TSc(e,f));vTc(a,e,b);}
+ function Jrc(a,b,c,d,e){this.i=a;this.a=b;this.e=c;this.j=d;this.f=e;}
+ function iUb(a,b){VTb.call(this);this.a=a;this.b=b;Rmb(this.a.b,this);}
+ function rTb(a){this.b=new Tsb;this.c=new Tsb;this.d=new Tsb;this.a=a;}
+ function Dx(a,b){var c;c=new cib;a.Gd(c);c.a+='..';b.Hd(c);return c.a}
+ function Fsd(a,b){var c;c=b;while(c){Zid(a,c.i,c.j);c=vCd(c);}return a}
+ function pEd(a,b,c){var d;d=uDd(c);Zjb(a.b,d,b);Zjb(a.c,b,c);return b}
+ function Kr(a){var b;b=0;while(a.Ob()){a.Pb();b=Bdb(b,1);}return dz(b)}
+ function oke(a,b){nke();var c;c=RD(a,69).vk();K6d(c,b);return c.xl(b)}
+ function tC(d,a,b){if(b){var c=b.oe();d.a[a]=c(b);}else {delete d.a[a];}}
+ function tB(a,b){var c;c=a.q.getHours();a.q.setFullYear(b+Owe);mB(a,c);}
+ function KSd(a,b){return RD(b==null?Wd(qtb(a.f,null)):Ktb(a.i,b),288)}
+ function hOc(a,b){return a==(r3b(),p3b)&&b==p3b?4:a==p3b||b==p3b?8:32}
+ function cge(a,b,c){return dge(a,b,c,ZD(b,102)&&(RD(b,19).Bb&txe)!=0)}
+ function jge(a,b,c){return kge(a,b,c,ZD(b,102)&&(RD(b,19).Bb&txe)!=0)}
+ function Qge(a,b,c){return Rge(a,b,c,ZD(b,102)&&(RD(b,19).Bb&txe)!=0)}
+ function jmb(a){if(a.b==a.c){return}a.a=$C(jJ,rve,1,8,5,1);a.b=0;a.c=0;}
+ function Nsb(a){sFb(a.a=0&&a.a[c]===b[c];c--);return c<0}
+ function Xx(a){var b;if(a){return new Kub(a)}b=new Iub;_q(b,a);return b}
+ function nmc(a,b){var c,d;d=false;do{c=qmc(a,b);d=d|c;}while(c);return d}
+ function Vz(a){a&&aA(($z(),Zz));--Nz;if(a){if(Pz!=-1){Xz(Pz);Pz=-1;}}}
+ function Pwb(a){Hwb();Mwb(this,Ydb(Cdb(Tdb(a,24),Pxe)),Ydb(Cdb(a,Pxe)));}
+ function IHb(){IHb=geb;HHb=ss((DHb(),cD(WC(uN,1),jwe,436,0,[CHb,BHb])));}
+ function QHb(){QHb=geb;PHb=ss((LHb(),cD(WC(vN,1),jwe,435,0,[JHb,KHb])));}
+ function YUb(){YUb=geb;XUb=ss((TUb(),cD(WC(BP,1),jwe,432,0,[RUb,SUb])));}
+ function U8b(){U8b=geb;T8b=ss((P8b(),cD(WC(vS,1),jwe,517,0,[O8b,N8b])));}
+ function Tvc(){Tvc=geb;Svc=ss((Ovc(),cD(WC(lX,1),jwe,429,0,[Mvc,Nvc])));}
+ function duc(){duc=geb;cuc=ss(($tc(),cD(WC(cX,1),jwe,428,0,[Ytc,Ztc])));}
+ function Huc(){Huc=geb;Guc=ss((Cuc(),cD(WC(fX,1),jwe,488,0,[Buc,Auc])));}
+ function xEc(){xEc=geb;wEc=ss((sEc(),cD(WC(xX,1),jwe,430,0,[qEc,rEc])));}
+ function xNc(){xNc=geb;wNc=ss((sNc(),cD(WC(MY,1),jwe,531,0,[rNc,qNc])));}
+ function otc(){otc=geb;ntc=ss((jtc(),cD(WC($W,1),jwe,431,0,[htc,itc])));}
+ function F_c(){F_c=geb;E_c=ss((A_c(),cD(WC(K_,1),jwe,433,0,[z_c,y_c])));}
+ function F2c(){F2c=geb;E2c=ss((x2c(),cD(WC(s0,1),jwe,501,0,[v2c,w2c])));}
+ function BQc(){BQc=geb;AQc=ss((wQc(),cD(WC(FZ,1),jwe,523,0,[vQc,uQc])));}
+ function JQc(){JQc=geb;IQc=ss((EQc(),cD(WC(GZ,1),jwe,522,0,[CQc,DQc])));}
+ function kTc(){kTc=geb;jTc=ss((fTc(),cD(WC(b$,1),jwe,528,0,[eTc,dTc])));}
+ function iVc(){iVc=geb;hVc=ss((dVc(),cD(WC(w$,1),jwe,465,0,[bVc,cVc])));}
+ function c4c(){c4c=geb;b4c=ss((Y3c(),cD(WC(H0,1),jwe,434,0,[W3c,X3c])));}
+ function H8c(){H8c=geb;G8c=ss((z8c(),cD(WC(l1,1),jwe,491,0,[x8c,y8c])));}
+ function J9c(){J9c=geb;I9c=ss((B9c(),cD(WC(t1,1),jwe,492,0,[z9c,A9c])));}
+ function Rbd(){Rbd=geb;Qbd=ss((Mbd(),cD(WC(O1,1),jwe,438,0,[Lbd,Kbd])));}
+ function tdd(){tdd=geb;sdd=ss((ldd(),cD(WC(W1,1),jwe,437,0,[kdd,jdd])));}
+ function Eqd(){Eqd=geb;Dqd=ss((uqd(),cD(WC(M3,1),jwe,347,0,[sqd,tqd])));}
+ function Imd(){Cmd();return cD(WC(s3,1),jwe,88,0,[Amd,zmd,ymd,xmd,Bmd])}
+ function xpd(){qpd();return cD(WC(E3,1),NAe,64,0,[opd,Yod,Xod,npd,ppd])}
+ function LSd(a,b,c){return RD(b==null?rtb(a.f,null,c):Ltb(a.i,b,c),288)}
+ function L6b(a){return (a.k==(r3b(),p3b)||a.k==m3b)&&nQb(a,(Ywc(),cwc))}
+ function bUb(a){return !!a.c&&!!a.d?kUb(a.c)+'->'+kUb(a.d):'e_'+kFb(a)}
+ function xgb(a,b){var c,d;uFb(b);for(d=a.Kc();d.Ob();){c=d.Pb();b.Cd(c);}}
+ function jEd(a,b){var c;c=new uC;qDd(c,'x',b.a);qDd(c,'y',b.b);oDd(a,c);}
+ function mEd(a,b){var c;c=new uC;qDd(c,'x',b.a);qDd(c,'y',b.b);oDd(a,c);}
+ function Gsd(a,b){var c;c=b;while(c){Zid(a,-c.i,-c.j);c=vCd(c);}return a}
+ function ZLc(a,b){var c,d;c=b;d=0;while(c>0){d+=a.a[c];c-=c&-c;}return d}
+ function $mb(a,b,c){var d;d=(tFb(b,a.c.length),a.c[b]);a.c[b]=c;return d}
+ function uIc(a,b,c){a.a.c.length=0;yIc(a,b,c);a.a.c.length==0||rIc(a,b);}
+ function wo(a){a.i=0;Mnb(a.b,null);Mnb(a.c,null);a.a=null;a.e=null;++a.g;}
+ function gBb(){gBb=geb;dBb=true;bBb=false;cBb=false;fBb=false;eBb=false;}
+ function oBb(a){gBb();if(dBb){return}this.c=a;this.e=true;this.a=new bnb;}
+ function kDb(a,b){this.c=0;this.b=b;txb.call(this,a,17493);this.a=this.c;}
+ function S_b(a){P_b();A$b(this);this.a=new Yub;Q_b(this,a);Mub(this.a,a);}
+ function m_b(){Pmb(this);this.b=new rjd(oxe,oxe);this.a=new rjd(pxe,pxe);}
+ function z8c(){z8c=geb;x8c=new B8c(CBe,0);y8c=new B8c('TARGET_WIDTH',1);}
+ function yDb(a,b){return (MCb(a),QDb(new SDb(a,new hEb(b,a.a)))).Bd(wDb)}
+ function vXb(){sXb();return cD(WC(UP,1),jwe,367,0,[nXb,oXb,pXb,qXb,rXb])}
+ function Fnc(){Bnc();return cD(WC(TV,1),jwe,375,0,[xnc,znc,Anc,ync,wnc])}
+ function Vtc(){Ptc();return cD(WC(bX,1),jwe,348,0,[Ltc,Ktc,Ntc,Otc,Mtc])}
+ function PDc(){JDc();return cD(WC(uX,1),jwe,323,0,[IDc,FDc,GDc,EDc,HDc])}
+ function fxc(){cxc();return cD(WC(mX,1),jwe,171,0,[bxc,Zwc,$wc,_wc,axc])}
+ function k3c(){g3c();return cD(WC(x0,1),jwe,368,0,[e3c,b3c,f3c,c3c,d3c])}
+ function vad(){sad();return cD(WC(x1,1),jwe,373,0,[oad,nad,qad,pad,rad])}
+ function $bd(){Xbd();return cD(WC(P1,1),jwe,324,0,[Sbd,Tbd,Wbd,Ubd,Vbd])}
+ function _hd(){Yhd();return cD(WC(d3,1),jwe,170,0,[Whd,Vhd,Thd,Xhd,Uhd])}
+ function sod(){pod();return cD(WC(B3,1),jwe,256,0,[mod,ood,kod,lod,nod])}
+ function Tz(b){Qz();return function(){return Uz(b,this,arguments);}}
+ function W0b(a){if(!a.c||!a.d){return false}return !!a.c.i&&a.c.i==a.d.i}
+ function Nfd(a,b){if(ZD(b,143)){return lhb(a.c,RD(b,143).c)}return false}
+ function yYd(a){if(!a.t){a.t=new w$d(a);VGd(new Cde(a),0,a.t);}return a.t}
+ function jNd(a){this.b=a;dMd.call(this,a);this.a=RD(Ywd(this.b.a,4),129);}
+ function sNd(a){this.b=a;yMd.call(this,a);this.a=RD(Ywd(this.b.a,4),129);}
+ function Q3d(a,b,c,d,e){OKd.call(this,b,d,e);this.c=a;this.b=c;}
+ function V3d(a,b,c,d,e){KKd.call(this,b,d,e);this.c=a;this.a=c;}
+ function Z3d(a,b,c,d,e){LKd.call(this,b,d,e);this.c=a;this.a=c;}
+ function g4d(a,b,c,d,e){OKd.call(this,b,d,e);this.c=a;this.a=c;}
+ function ugd(a,b){var c;c=RD(cub(a.d,b),23);return c?c:RD(cub(a.e,b),23)}
+ function Blb(a,b){var c,d;c=b.ld();d=a.Fe(c);return !!d&&Fvb(d.e,b.md())}
+ function me(a,b){var c;c=b.ld();return new gp(c,a.e.pc(c,RD(b.md(),16)))}
+ function ptb(a,b){var c;c=a.a.get(b);return c==null?$C(jJ,rve,1,0,5,1):c}
+ function khb(a){var b;b=a.length;return lhb(sxe.substr(sxe.length-b,b),a)}
+ function hs(a){if(gs(a)){a.c=a.a;return a.a.Pb()}else {throw Adb(new Dvb)}}
+ function $ib(a,b){if(b==0||a.e==0){return a}return b>0?tjb(a,b):qjb(a,-b)}
+ function Zib(a,b){if(b==0||a.e==0){return a}return b>0?qjb(a,b):tjb(a,-b)}
+ function Deb(a){Beb.call(this,a==null?vve:jeb(a),ZD(a,82)?RD(a,82):null);}
+ function Y5d(a){var b;if(!a.c){b=a.r;ZD(b,90)&&(a.c=RD(b,29));}return a.c}
+ function s0b(a){var b;b=new a1b;kQb(b,a);pQb(b,(yCc(),RAc),null);return b}
+ function lec(a){var b,c;b=a.c.i;c=a.d.i;return b.k==(r3b(),m3b)&&c.k==m3b}
+ function fD(a){var b,c,d;b=a&dxe;c=a>>22&dxe;d=a<0?exe:0;return hD(b,c,d)}
+ function Ky(a){var b,c,d,e;for(c=a,d=0,e=c.length;d=0?a.Lh(d,c,true):Qvd(a,b,c)}
+ function AXc(a,b,c){return Qfb(cjd(jWc(a),ajd(b.b)),cjd(jWc(a),ajd(c.b)))}
+ function BXc(a,b,c){return Qfb(cjd(jWc(a),ajd(b.e)),cjd(jWc(a),ajd(c.e)))}
+ function Kad(a,b){return $wnd.Math.min(bjd(b.a,a.d.d.c),bjd(b.b,a.d.d.c))}
+ function LHd(a,b){a._i(a.i+1);MHd(a,a.i,a.Zi(a.i,b));a.Mi(a.i++,b);a.Ni();}
+ function OHd(a){var b,c;++a.j;b=a.g;c=a.i;a.g=null;a.i=0;a.Oi(c,b);a.Ni();}
+ function yke(a,b,c){var d;d=new zke(a.a);Ld(d,a.a.a);rtb(d.f,b,c);a.a.a=d;}
+ function mKb(a,b,c,d){var e;for(e=0;eb){throw Adb(new veb(Jb(a,b,'index')))}return a}
+ function Xmb(a,b){var c;c=(tFb(b,a.c.length),a.c[b]);$Eb(a.c,b,1);return c}
+ function jhb(a,b){var c,d;c=(uFb(a),a);d=(uFb(b),b);return c==d?0:cb.p){return -1}return 0}
+ function hXd(a){var b;if(!a.a){b=a.r;ZD(b,156)&&(a.a=RD(b,156));}return a.a}
+ function iOd(a,b,c){var d;++a.e;--a.f;d=RD(a.d[b].gd(c),136);return d.md()}
+ function fd(a){var b,c;b=a.ld();c=RD(a.md(),16);return gk(c.Nc(),new jh(b))}
+ function oae(a,b){if(Ujb(a.a,b)){_jb(a.a,b);return true}else {return false}}
+ function Ui(a,b,c){Pb(b,a.e.Rd().gc());Pb(c,a.c.Rd().gc());return a.a[b][c]}
+ function _Uc(a,b,c){this.a=a;this.b=b;this.c=c;Rmb(a.t,this);Rmb(b.i,this);}
+ function lg(a,b,c,d){this.f=a;this.e=b;this.d=c;this.b=d;this.c=!d?null:d.d;}
+ function YWc(){this.b=new Yub;this.a=new Yub;this.b=new Yub;this.a=new Yub;}
+ function ree(){ree=geb;var a,b;pee=(jTd(),b=new k1d,b);qee=(a=new mXd,a);}
+ function UCb(a){var b;MCb(a);b=new $Cb(a,a.a.e,a.a.d|4);return new WCb(a,b)}
+ function ADb(a){var b;LCb(a);b=0;while(a.a.Bd(new MEb)){b=Bdb(b,1);}return b}
+ function zxb(a,b){uFb(b);if(a.c=0,'Initial capacity must not be negative');}
+ function rid(){rid=geb;qid=new jGd('org.eclipse.elk.labels.labelManager');}
+ function iec(){iec=geb;hec=new kGd('separateLayerConnections',(vec(),uec));}
+ function fTc(){fTc=geb;eTc=new gTc('REGULAR',0);dTc=new gTc('CRITICAL',1);}
+ function Mbd(){Mbd=geb;Lbd=new Nbd('FIXED',0);Kbd=new Nbd('CENTER_NODE',1);}
+ function jtc(){jtc=geb;htc=new ktc('QUADRATIC',0);itc=new ktc('SCANLINE',1);}
+ function Atc(){Atc=geb;ztc=ss((stc(),cD(WC(_W,1),jwe,322,0,[qtc,ptc,rtc])));}
+ function Jtc(){Jtc=geb;Itc=ss((Etc(),cD(WC(aX,1),jwe,351,0,[Btc,Dtc,Ctc])));}
+ function ooc(){ooc=geb;noc=ss((joc(),cD(WC(UV,1),jwe,372,0,[ioc,hoc,goc])));}
+ function muc(){muc=geb;luc=ss((huc(),cD(WC(dX,1),jwe,460,0,[fuc,euc,guc])));}
+ function Cvc(){Cvc=geb;Bvc=ss((xvc(),cD(WC(jX,1),jwe,299,0,[vvc,wvc,uvc])));}
+ function Lvc(){Lvc=geb;Kvc=ss((Gvc(),cD(WC(kX,1),jwe,311,0,[Evc,Fvc,Dvc])));}
+ function rDc(){rDc=geb;qDc=ss((lDc(),cD(WC(sX,1),jwe,390,0,[iDc,jDc,kDc])));}
+ function PEc(){PEc=geb;OEc=ss((KEc(),cD(WC(zX,1),jwe,387,0,[HEc,IEc,JEc])));}
+ function YEc(){YEc=geb;XEc=ss((TEc(),cD(WC(AX,1),jwe,349,0,[SEc,QEc,REc])));}
+ function GEc(){GEc=geb;FEc=ss((BEc(),cD(WC(yX,1),jwe,463,0,[AEc,yEc,zEc])));}
+ function qFc(){qFc=geb;pFc=ss((lFc(),cD(WC(CX,1),jwe,350,0,[iFc,jFc,kFc])));}
+ function zFc(){zFc=geb;yFc=ss((uFc(),cD(WC(DX,1),jwe,352,0,[tFc,rFc,sFc])));}
+ function IFc(){IFc=geb;HFc=ss((DFc(),cD(WC(EX,1),jwe,388,0,[BFc,CFc,AFc])));}
+ function QZc(){QZc=geb;PZc=ss((LZc(),cD(WC(F_,1),jwe,392,0,[KZc,JZc,IZc])));}
+ function m4c(){m4c=geb;l4c=ss((g4c(),cD(WC(I0,1),jwe,393,0,[d4c,e4c,f4c])));}
+ function z5c(){z5c=geb;y5c=ss((t5c(),cD(WC(N0,1),jwe,300,0,[r5c,s5c,q5c])));}
+ function k6c(){k6c=geb;j6c=ss((f6c(),cD(WC(V0,1),jwe,445,0,[c6c,d6c,e6c])));}
+ function F6c(){F6c=geb;E6c=ss((z6c(),cD(WC(Z0,1),jwe,456,0,[w6c,y6c,x6c])));}
+ function e7c(){e7c=geb;d7c=ss((_6c(),cD(WC(a1,1),jwe,394,0,[Z6c,$6c,Y6c])));}
+ function j9c(){j9c=geb;i9c=ss((b9c(),cD(WC(o1,1),jwe,439,0,[$8c,a9c,_8c])));}
+ function WKc(){WKc=geb;VKc=ss((RKc(),cD(WC(nY,1),jwe,464,0,[OKc,PKc,QKc])));}
+ function JKb(){JKb=geb;IKb=ss((EKb(),cD(WC(MN,1),jwe,471,0,[CKb,BKb,DKb])));}
+ function cKb(){cKb=geb;bKb=ss((ZJb(),cD(WC(JN,1),jwe,237,0,[WJb,XJb,YJb])));}
+ function ALb(){ALb=geb;zLb=ss((vLb(),cD(WC(TN,1),jwe,472,0,[uLb,tLb,sLb])));}
+ function CBb(){CBb=geb;BBb=ss((xBb(),cD(WC(QL,1),jwe,108,0,[uBb,vBb,wBb])));}
+ function FWb(){FWb=geb;EWb=ss((AWb(),cD(WC(JP,1),jwe,391,0,[yWb,xWb,zWb])));}
+ function Knd(){Knd=geb;Jnd=ss((Fnd(),cD(WC(y3,1),jwe,346,0,[Dnd,Cnd,End])));}
+ function lbd(){lbd=geb;kbd=ss((gbd(),cD(WC(I1,1),jwe,444,0,[dbd,ebd,fbd])));}
+ function Tmd(){Tmd=geb;Smd=ss((Omd(),cD(WC(t3,1),jwe,278,0,[Lmd,Mmd,Nmd])));}
+ function rqd(){rqd=geb;qqd=ss((mqd(),cD(WC(J3,1),jwe,280,0,[kqd,jqd,lqd])));}
+ function Hxd(a,b){return !a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),QNd(a.o,b)}
+ function HMb(a,b){var c;if(a.C){c=RD(Vrb(a.b,b),127).n;c.d=a.C.d;c.a=a.C.a;}}
+ function F8b(a){var b,c,d,e;e=a.d;b=a.a;c=a.b;d=a.c;a.d=c;a.a=d;a.b=e;a.c=b;}
+ function cOd(a){!a.g&&(a.g=new hQd);!a.g.b&&(a.g.b=new ePd(a));return a.g.b}
+ function dOd(a){!a.g&&(a.g=new hQd);!a.g.c&&(a.g.c=new IPd(a));return a.g.c}
+ function lOd(a){!a.g&&(a.g=new hQd);!a.g.d&&(a.g.d=new kPd(a));return a.g.d}
+ function YNd(a){!a.g&&(a.g=new hQd);!a.g.a&&(a.g.a=new qPd(a));return a.g.a}
+ function B9d(a,b,c,d){!!c&&(d=c.Rh(b,BYd(c.Dh(),a.c.uk()),null,d));return d}
+ function C9d(a,b,c,d){!!c&&(d=c.Th(b,BYd(c.Dh(),a.c.uk()),null,d));return d}
+ function Cjb(a,b,c,d){var e;e=$C(kE,Pwe,28,b+1,15,1);Djb(e,a,b,c,d);return e}
+ function $C(a,b,c,d,e,f){var g;g=_C(e,d);e!=10&&cD(WC(a,f),b,c,e,g);return g}
+ function $fe(a,b,c){var d,e;e=new Phe(b,a);for(d=0;dc||b=0?a.Lh(c,true,true):Qvd(a,b,true)}
+ function gMc(a,b,c){var d;d=qMc(a,b,c);a.b=new _Lc(d.c.length);return iMc(a,d)}
+ function Pue(a){if(a.b<=0)throw Adb(new Dvb);--a.b;a.a-=a.c.c;return sgb(a.a)}
+ function PGd(a){var b;if(!a.a){throw Adb(new Evb)}b=a.a;a.a=vCd(a.a);return b}
+ function WDb(a){while(!a.a){if(!yEb(a.c,new $Db(a))){return false}}return true}
+ function Nr(a){var b;Qb(a);if(ZD(a,204)){b=RD(a,204);return b}return new Or(a)}
+ function Cfd(a){Afd();RD(a.of((umd(),Lld)),181).Fc((Pod(),Mod));a.qf(Kld,null);}
+ function Afd(){Afd=geb;xfd=new Gfd;zfd=new Ifd;yfd=yn((umd(),Kld),xfd,pld,zfd);}
+ function Y3c(){Y3c=geb;W3c=new $3c('LEAF_NUMBER',0);X3c=new $3c('NODE_SIZE',1);}
+ function YLc(a){a.a=$C(kE,Pwe,28,a.b+1,15,1);a.c=$C(kE,Pwe,28,a.b,15,1);a.d=0;}
+ function OZb(a,b){if(a.a.Ne(b.d,a.b)>0){Rmb(a.c,new fZb(b.c,b.d,a.d));a.b=b.d;}}
+ function NHd(a,b){if(a.g==null||b>=a.i)throw Adb(new yNd(b,a.i));return a.g[b]}
+ function P_d(a,b,c){gHd(a,c);if(c!=null&&!a.fk(c)){throw Adb(new yeb)}return c}
+ function dD(a,b){XC(b)!=10&&cD(rb(b),b.Sm,b.__elementTypeId$,XC(b),a);return a}
+ function Wnb(a,b,c,d){var e;d=(urb(),!d?rrb:d);e=a.slice(b,c);Xnb(e,a,b,c,-b,d);}
+ function zvd(a,b,c,d,e){return b<0?Qvd(a,c,d):RD(c,69).wk().yk(a,a.hi(),b,d,e)}
+ function J9b(a,b){return Qfb(Kfb(UD(mQb(a,(Ywc(),Jwc)))),Kfb(UD(mQb(b,Jwc))))}
+ function qAb(){qAb=geb;pAb=ss((cAb(),cD(WC(AL,1),jwe,304,0,[$zb,_zb,aAb,bAb])));}
+ function cAb(){cAb=geb;$zb=new dAb('All',0);_zb=new iAb;aAb=new kAb;bAb=new nAb;}
+ function EKb(){EKb=geb;CKb=new FKb(Nye,0);BKb=new FKb(Kye,1);DKb=new FKb(Oye,2);}
+ function Zme(){Zme=geb;qAd();Wme=oxe;Vme=pxe;Yme=new Tfb(oxe);Xme=new Tfb(pxe);}
+ function rOb(){rOb=geb;qOb=ss((mOb(),cD(WC(hO,1),jwe,417,0,[lOb,iOb,jOb,kOb])));}
+ function NRb(){NRb=geb;MRb=ss((IRb(),cD(WC(WO,1),jwe,406,0,[FRb,ERb,GRb,HRb])));}
+ function NPb(){NPb=geb;MPb=ss((IPb(),cD(WC(DO,1),jwe,332,0,[FPb,EPb,GPb,HPb])));}
+ function Z$b(){Z$b=geb;Y$b=ss((U$b(),cD(WC(CQ,1),jwe,389,0,[T$b,R$b,Q$b,S$b])));}
+ function wZb(){wZb=geb;vZb=ss((nZb(),cD(WC(lQ,1),jwe,416,0,[jZb,mZb,kZb,lZb])));}
+ function jnc(){jnc=geb;inc=ss((enc(),cD(WC(LV,1),jwe,421,0,[anc,bnc,cnc,dnc])));}
+ function Bec(){Bec=geb;Aec=ss((vec(),cD(WC(qT,1),jwe,371,0,[uec,sec,tec,rec])));}
+ function DDc(){DDc=geb;CDc=ss((wDc(),cD(WC(tX,1),jwe,203,0,[uDc,vDc,tDc,sDc])));}
+ function pEc(){pEc=geb;oEc=ss((kEc(),cD(WC(wX,1),jwe,284,0,[hEc,gEc,iEc,jEc])));}
+ function Cuc(){Cuc=geb;Buc=new Duc(LAe,0);Auc=new Duc('IMPROVE_STRAIGHTNESS',1);}
+ function _i(a,b){var c,d;d=b/a.c.Rd().gc()|0;c=b%a.c.Rd().gc();return Ui(a,d,c)}
+ function iZd(a){var b;if(a.nl()){for(b=a.i-1;b>=0;--b){QHd(a,b);}}return WHd(a)}
+ function Nyb(a){var b,c;if(!a.b){return null}c=a.b;while(b=c.a[0]){c=b;}return c}
+ function Oyb(a){var b,c;if(!a.b){return null}c=a.b;while(b=c.a[1]){c=b;}return c}
+ function Hae(a){if(ZD(a,180)){return ''+RD(a,180).a}return a==null?null:jeb(a)}
+ function Iae(a){if(ZD(a,180)){return ''+RD(a,180).a}return a==null?null:jeb(a)}
+ function eGb(a,b){if(b.a){throw Adb(new yz(jye))}Ysb(a.a,b);b.a=a;!a.j&&(a.j=b);}
+ function hEb(a,b){xxb.call(this,b.zd(),b.yd()&-16449);uFb(a);this.a=a;this.c=b;}
+ function zXc(a,b){return new gud(b,Zid(ajd(b.e),b.f.a+a,b.f.b+a),(Geb(),false))}
+ function EMc(a,b){dMc();return Rmb(a,new Ptd(b,sgb(b.e.c.length+b.g.c.length)))}
+ function GMc(a,b){dMc();return Rmb(a,new Ptd(b,sgb(b.e.c.length+b.g.c.length)))}
+ function p5c(){p5c=geb;o5c=ss((j5c(),cD(WC(M0,1),jwe,354,0,[i5c,g5c,h5c,f5c])));}
+ function x_c(){x_c=geb;w_c=ss((s_c(),cD(WC(J_,1),jwe,353,0,[r_c,p_c,q_c,o_c])));}
+ function eWc(){eWc=geb;dWc=ss((YVc(),cD(WC(H$,1),jwe,405,0,[UVc,VVc,WVc,XVc])));}
+ function bnd(){bnd=geb;and=ss((Ymd(),cD(WC(u3,1),jwe,223,0,[Xmd,Vmd,Umd,Wmd])));}
+ function Vnd(){Vnd=geb;Und=ss((Pnd(),cD(WC(z3,1),jwe,291,0,[Ond,Lnd,Mnd,Nnd])));}
+ function Vpd(){Vpd=geb;Upd=ss((Qpd(),cD(WC(H3,1),jwe,386,0,[Opd,Ppd,Npd,Mpd])));}
+ function Lrd(){Lrd=geb;Krd=ss((Grd(),cD(WC(R3,1),jwe,320,0,[Frd,Crd,Erd,Drd])));}
+ function ytd(){ytd=geb;xtd=ss((ttd(),cD(WC(n4,1),jwe,415,0,[qtd,rtd,ptd,std])));}
+ function b9c(){b9c=geb;$8c=new d9c(iFe,0);a9c=new d9c(mEe,1);_8c=new d9c(LAe,2);}
+ function sBb(a,b,c,d,e){uFb(a);uFb(b);uFb(c);uFb(d);uFb(e);return new DBb(a,b,d)}
+ function fub(a,b){var c;c=RD(_jb(a.e,b),400);if(c){rub(c);return c.e}return null}
+ function Ymb(a,b){var c;c=Wmb(a,b,0);if(c==-1){return false}Xmb(a,c);return true}
+ function LDb(a,b,c){var d;LCb(a);d=new IEb;d.a=b;a.a.Nb(new QEb(d,c));return d.a}
+ function VCb(a){var b;LCb(a);b=$C(iE,vxe,28,0,15,1);ixb(a.a,new dDb(b));return b}
+ function yc(a){var b;if(!xc(a)){throw Adb(new Dvb)}a.e=1;b=a.d;a.d=null;return b}
+ function Odb(a){var b;if(Kdb(a)){b=0-a;if(!isNaN(b)){return b}}return Edb(xD(a))}
+ function Wmb(a,b,c){for(;c=0?Dvd(a,c,true,true):Qvd(a,b,true)}
+ function Vwd(a){var b;b=SD(Ywd(a,32));if(b==null){Wwd(a);b=SD(Ywd(a,32));}return b}
+ function Yvd(a){var b;if(!a.Oh()){b=AYd(a.Dh())-a.ji();a.$h().Mk(b);}return a.zh()}
+ function zQb(a,b){yQb=new kRb;wQb=b;xQb=a;RD(xQb.b,68);BQb(xQb,yQb,null);AQb(xQb);}
+ function AWb(){AWb=geb;yWb=new BWb('XY',0);xWb=new BWb('X',1);zWb=new BWb('Y',2);}
+ function vLb(){vLb=geb;uLb=new wLb('TOP',0);tLb=new wLb(Kye,1);sLb=new wLb(Qye,2);}
+ function Gvc(){Gvc=geb;Evc=new Hvc(LAe,0);Fvc=new Hvc('TOP',1);Dvc=new Hvc(Qye,2);}
+ function sEc(){sEc=geb;qEc=new tEc('INPUT_ORDER',0);rEc=new tEc('PORT_DEGREE',1);}
+ function MD(){MD=geb;ID=hD(dxe,dxe,524287);JD=hD(0,0,fxe);KD=fD(1);fD(2);LD=fD(0);}
+ function wWd(a){var b;if(a.d!=a.r){b=WVd(a);a.e=!!b&&b.lk()==aKe;a.d=b;}return a.e}
+ function UHd(a,b,c){var d;d=a.g[b];MHd(a,b,a.Zi(b,c));a.Ri(b,c,d);a.Ni();return d}
+ function dHd(a,b){var c;c=a.dd(b);if(c>=0){a.gd(c);return true}else {return false}}
+ function xr(a,b){var c;Qb(a);Qb(b);c=false;while(b.Ob()){c=c|a.Fc(b.Pb());}return c}
+ function cub(a,b){var c;c=RD(Wjb(a.e,b),400);if(c){eub(a,c);return c.e}return null}
+ function iB(a){var b,c;b=a/60|0;c=a%60;if(c==0){return ''+b}return ''+b+':'+(''+c)}
+ function JB(d,a){var b=d.a[a];var c=(HC(),GC)[typeof b];return c?c(b):NC(typeof b)}
+ function EDb(a,b){var c,d;MCb(a);d=new zEb(b,a.a);c=new YDb(d);return new SDb(a,c)}
+ function mwb(a){var b;b=a.b.c.length==0?null:Vmb(a.b,0);b!=null&&owb(a,0);return b}
+ function ukc(a,b){var c,d,e;e=b.c.i;c=RD(Wjb(a.f,e),60);d=c.d.c-c.e.c;Bjd(b.a,d,0);}
+ function XLc(a,b){var c;++a.d;++a.c[b];c=b+1;while(c=0){++b[0];}}
+ function eEd(a,b){Dyd(a,b==null||Rfb((uFb(b),b))||isNaN((uFb(b),b))?0:(uFb(b),b));}
+ function fEd(a,b){Eyd(a,b==null||Rfb((uFb(b),b))||isNaN((uFb(b),b))?0:(uFb(b),b));}
+ function gEd(a,b){Cyd(a,b==null||Rfb((uFb(b),b))||isNaN((uFb(b),b))?0:(uFb(b),b));}
+ function hEd(a,b){Ayd(a,b==null||Rfb((uFb(b),b))||isNaN((uFb(b),b))?0:(uFb(b),b));}
+ function oWc(a,b,c){return cjd(new rjd(c.e.a+c.f.a/2,c.e.b+c.f.b/2),a)==(uFb(b),b)}
+ function qge(a,b){return ZD(b,102)&&(RD(b,19).Bb&txe)!=0?new She(b,a):new Phe(b,a)}
+ function sge(a,b){return ZD(b,102)&&(RD(b,19).Bb&txe)!=0?new She(b,a):new Phe(b,a)}
+ function XC(a){return a.__elementTypeCategory$==null?10:a.__elementTypeCategory$}
+ function Bhb(a,b){return b==(wvb(),wvb(),vvb)?a.toLocaleLowerCase():a.toLowerCase()}
+ function Mu(a){if(!a.e){throw Adb(new Dvb)}a.c=a.a=a.e;a.e=a.e.e;--a.d;return a.a.f}
+ function Lu(a){if(!a.c){throw Adb(new Dvb)}a.e=a.a=a.c;a.c=a.c.c;++a.d;return a.a.f}
+ function Lsb(a){var b;++a.a;for(b=a.c.a.length;a.aa.a[d]&&(d=c);}return d}
+ function Krc(a){var b;b=RD(mQb(a,(Ywc(),Wvc)),313);if(b){return b.a==a}return false}
+ function Lrc(a){var b;b=RD(mQb(a,(Ywc(),Wvc)),313);if(b){return b.i==a}return false}
+ function xXb(){xXb=geb;wXb=ss((sXb(),cD(WC(UP,1),jwe,367,0,[nXb,oXb,pXb,qXb,rXb])));}
+ function Hnc(){Hnc=geb;Gnc=ss((Bnc(),cD(WC(TV,1),jwe,375,0,[xnc,znc,Anc,ync,wnc])));}
+ function Xtc(){Xtc=geb;Wtc=ss((Ptc(),cD(WC(bX,1),jwe,348,0,[Ltc,Ktc,Ntc,Otc,Mtc])));}
+ function RDc(){RDc=geb;QDc=ss((JDc(),cD(WC(uX,1),jwe,323,0,[IDc,FDc,GDc,EDc,HDc])));}
+ function hxc(){hxc=geb;gxc=ss((cxc(),cD(WC(mX,1),jwe,171,0,[bxc,Zwc,$wc,_wc,axc])));}
+ function m3c(){m3c=geb;l3c=ss((g3c(),cD(WC(x0,1),jwe,368,0,[e3c,b3c,f3c,c3c,d3c])));}
+ function xad(){xad=geb;wad=ss((sad(),cD(WC(x1,1),jwe,373,0,[oad,nad,qad,pad,rad])));}
+ function acd(){acd=geb;_bd=ss((Xbd(),cD(WC(P1,1),jwe,324,0,[Sbd,Tbd,Wbd,Ubd,Vbd])));}
+ function Kmd(){Kmd=geb;Jmd=ss((Cmd(),cD(WC(s3,1),jwe,88,0,[Amd,zmd,ymd,xmd,Bmd])));}
+ function bid(){bid=geb;aid=ss((Yhd(),cD(WC(d3,1),jwe,170,0,[Whd,Vhd,Thd,Xhd,Uhd])));}
+ function uod(){uod=geb;tod=ss((pod(),cD(WC(B3,1),jwe,256,0,[mod,ood,kod,lod,nod])));}
+ function zpd(){zpd=geb;ypd=ss((qpd(),cD(WC(E3,1),NAe,64,0,[opd,Yod,Xod,npd,ppd])));}
+ function LHb(){LHb=geb;JHb=new MHb('BY_SIZE',0);KHb=new MHb('BY_SIZE_AND_SHAPE',1);}
+ function TUb(){TUb=geb;RUb=new UUb('EADES',0);SUb=new UUb('FRUCHTERMAN_REINGOLD',1);}
+ function $tc(){$tc=geb;Ytc=new _tc('READING_DIRECTION',0);Ztc=new _tc('ROTATION',1);}
+ function CZb(){CZb=geb;zZb=new ZZb;AZb=new b$b;xZb=new f$b;yZb=new j$b;BZb=new n$b;}
+ function dGb(a){this.b=new bnb;this.a=new bnb;this.c=new bnb;this.d=new bnb;this.e=a;}
+ function XZb(a){this.g=a;this.f=new bnb;this.a=$wnd.Math.min(this.g.c.c,this.g.d.c);}
+ function UKb(a,b,c){RJb.call(this);KKb(this);this.a=a;this.c=c;this.b=b.d;this.f=b.e;}
+ function d6b(a,b,c){var d,e;for(e=new Anb(c);e.a=0&&b0?b-1:b;return Kqd(Lqd(Mqd(Nqd(new Oqd,c),a.n),a.j),a.k)}
+ function nBd(a){var b,c;c=(b=new q4d,b);WGd((!a.q&&(a.q=new C5d(s7,a,11,10)),a.q),c);}
+ function ofb(a){return ((a.i&2)!=0?'interface ':(a.i&1)!=0?'':'class ')+(lfb(a),a.o)}
+ function dz(a){if(Ddb(a,lve)>0){return lve}if(Ddb(a,qwe)<0){return qwe}return Ydb(a)}
+ function Sv(a){if(a<3){dk(a,fwe);return a+1}if(a=-0.01&&a.a<=Tye&&(a.a=0);a.b>=-0.01&&a.b<=Tye&&(a.b=0);return a}
+ function Hid(a){tid();var b,c;c=KEe;for(b=0;bc&&(c=a[b]);}return c}
+ function Zvd(a,b){var c;c=wYd(a.Dh(),b);if(!c){throw Adb(new agb(KHe+b+NHe))}return c}
+ function NGd(a,b){var c;c=a;while(vCd(c)){c=vCd(c);if(c==b){return true}}return false}
+ function ix(a,b){var c,d,e;d=b.a.ld();c=RD(b.a.md(),16).gc();for(e=0;ea||a>b){throw Adb(new xeb('fromIndex: 0, toIndex: '+a+Qxe+b))}}
+ function ZHd(a){if(a<0){throw Adb(new agb('Illegal Capacity: '+a))}this.g=this.aj(a);}
+ function _y(a,b){Zy();bz(pwe);return $wnd.Math.abs(a-b)<=pwe||a==b||isNaN(a)&&isNaN(b)}
+ function xJc(a,b){var c,d,e,f;for(d=a.d,e=0,f=d.length;e0){a.a/=b;a.b/=b;}return a}
+ function BXd(a){var b;if(a.w){return a.w}else {b=CXd(a);!!b&&!b.Vh()&&(a.w=b);return b}}
+ function l2d(a,b){var c,d;d=a.a;c=m2d(a,b,null);d!=b&&!a.e&&(c=o2d(a,b,c));!!c&&c.oj();}
+ function rQc(a,b,c){var d,e;d=b;do{e=Kfb(a.p[d.p])+c;a.p[d.p]=e;d=a.a[d.p];}while(d!=b)}
+ function heb(a,b,c){var d=function(){return a.apply(d,arguments)};b.apply(d,c);return d}
+ function Gae(a){var b;if(a==null){return null}else {b=RD(a,195);return sAd(b,b.length)}}
+ function QHd(a,b){if(a.g==null||b>=a.i)throw Adb(new yNd(b,a.i));return a.Wi(b,a.g[b])}
+ function Dob(a,b){yob();var c,d;d=new bnb;for(c=0;c=14&&b<=16)));return a}
+ function ws(a,b){var c;uFb(b);c=a[':'+b];mFb(!!c,'Enum constant undefined: '+b);return c}
+ function tfb(a,b,c,d,e,f){var g;g=rfb(a,b);Ffb(c,g);g.i=e?8:0;g.f=d;g.e=e;g.g=f;return g}
+ function R3d(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=1;this.c=a;this.a=c;}
+ function T3d(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=2;this.c=a;this.a=c;}
+ function _3d(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=6;this.c=a;this.a=c;}
+ function e4d(a,b,c,d,e){this.d=b;this.k=d;this.f=e;this.o=-1;this.p=7;this.c=a;this.a=c;}
+ function X3d(a,b,c,d,e){this.d=b;this.j=d;this.e=e;this.o=-1;this.p=4;this.c=a;this.a=c;}
+ function iGb(a,b){var c,d,e,f;for(d=b,e=0,f=d.length;e=0)){throw Adb(new agb('tolerance ('+a+') must be >= 0'))}return a}
+ function hOd(a,b){var c;if(ZD(b,44)){return a.c.Mc(b)}else {c=QNd(a,b);jOd(a,b);return c}}
+ function yBd(a,b,c){YVd(a,b);PAd(a,c);$Vd(a,0);bWd(a,1);aWd(a,true);_Vd(a,true);return a}
+ function ZGd(a,b){var c;c=a.gc();if(b<0||b>c)throw Adb(new aMd(b,c));return new CMd(a,b)}
+ function Cad(a,b){a.b=$wnd.Math.max(a.b,b.d);a.e+=b.r+(a.a.c.length==0?0:a.c);Rmb(a.a,b);}
+ function Jmb(a){yFb(a.c>=0);if(rmb(a.d,a.c)<0){a.a=a.a-1&a.d.a.length-1;a.b=a.d.c;}a.c=-1;}
+ function Nc(a){var b,c;for(c=a.c.Cc().Kc();c.Ob();){b=RD(c.Pb(),16);b.$b();}a.c.$b();a.d=0;}
+ function Zi(a){var b,c,d,e;for(c=a.a,d=0,e=c.length;d=0}
+ function Iqd(a,b){if(a.r>0&&a.c0&&a.g!=0&&Iqd(a.i,b/a.r*a.i.d);}}
+ function $Cd(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,1,c,a.c));}
+ function P1d(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,4,c,a.c));}
+ function jyd(a,b){var c;c=a.k;a.k=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,2,c,a.k));}
+ function JXd(a,b){var c;c=a.D;a.D=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,2,c,a.D));}
+ function Kzd(a,b){var c;c=a.f;a.f=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,8,c,a.f));}
+ function Lzd(a,b){var c;c=a.i;a.i=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,7,c,a.i));}
+ function fCd(a,b){var c;c=a.a;a.a=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,8,c,a.a));}
+ function ZCd(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,0,c,a.b));}
+ function s6d(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,0,c,a.b));}
+ function t6d(a,b){var c;c=a.c;a.c=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,1,c,a.c));}
+ function nVd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,1,c,a.d));}
+ function Cte(a,b,c){var d;a.b=b;a.a=c;d=(a.a&512)==512?new Gre:new Tqe;a.c=Nqe(d,a.b,a.a);}
+ function Gge(a,b){return qke(a.e,b)?(nke(),wWd(b)?new ole(b,a):new Eke(b,a)):new Ble(b,a)}
+ function iDb(a){var b,c;if(0>a){return new rDb}b=a+1;c=new kDb(b,a);return new oDb(null,c)}
+ function Gob(a,b){yob();var c;c=new Usb(1);bE(a)?$jb(c,a,b):rtb(c.f,a,b);return new uqb(c)}
+ function pQc(a,b){var c,d;c=a.c;d=b.e[a.p];if(d>0){return RD(Vmb(c.a,d-1),10)}return null}
+ function TOb(a,b){var c,d;c=a.o+a.p;d=b.o+b.p;if(cb){b<<=1;return b>0?b:hwe}return b}
+ function xc(a){Ub(a.e!=3);switch(a.e){case 2:return false;case 0:return true;}return zc(a)}
+ function djd(a,b){var c;if(ZD(b,8)){c=RD(b,8);return a.a==c.a&&a.b==c.b}else {return false}}
+ function Ydd(a,b){var c;c=new kRb;RD(b.b,68);RD(b.b,68);RD(b.b,68);Umb(b.a,new ced(a,c,b));}
+ function gOd(a,b){var c,d;for(d=b.vc().Kc();d.Ob();){c=RD(d.Pb(),44);fOd(a,c.ld(),c.md());}}
+ function Jzd(a,b){var c;c=a.d;a.d=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,11,c,a.d));}
+ function zWd(a,b){var c;c=a.j;a.j=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,13,c,a.j));}
+ function b6d(a,b){var c;c=a.b;a.b=b;(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,21,c,a.b));}
+ function YAb(a,b){((gBb(),dBb)?null:b.c).length==0&&iBb(b,new rBb);$jb(a.a,dBb?null:b.c,b);}
+ function b9b(a,b){b.Ug('Hierarchical port constraint processing',1);c9b(a);e9b(a);b.Vg();}
+ function joc(){joc=geb;ioc=new koc('START',0);hoc=new koc('MIDDLE',1);goc=new koc('END',2);}
+ function x2c(){x2c=geb;v2c=new z2c('P1_NODE_PLACEMENT',0);w2c=new z2c('P2_EDGE_ROUTING',1);}
+ function JVb(){JVb=geb;HVb=new jGd(rAe);IVb=new jGd(sAe);GVb=new jGd(tAe);FVb=new jGd(uAe);}
+ function tkb(a){var b;rFb(a.f.g,a.d);sFb(a.b);a.c=a.a;b=RD(a.a.Pb(),44);a.b=skb(a);return b}
+ function P2d(a){var b;if(a.b==null){return j3d(),j3d(),i3d}b=a.ul()?a.tl():a.sl();return b}
+ function nwb(a,b){var c;c=b==null?-1:Wmb(a.b,b,0);if(c<0){return false}owb(a,c);return true}
+ function zsb(a,b){var c;uFb(b);c=b.g;if(!a.b[c]){bD(a.b,c,b);++a.c;return true}return false}
+ function azb(a,b){var c,d;c=1-b;d=a.a[c];a.a[c]=d.a[b];d.a[b]=a;a.b=true;d.b=false;return d}
+ function xRb(a,b){var c,d;for(d=b.Kc();d.Ob();){c=RD(d.Pb(),272);a.b=true;Ysb(a.e,c);c.b=a;}}
+ function kic(a,b){var c,d;c=RD(mQb(a,(yCc(),IBc)),8);d=RD(mQb(b,IBc),8);return Qfb(c.b,d.b)}
+ function SPb(a,b,c){var d,e,f;f=b>>5;e=b&31;d=Cdb(Udb(a.n[c][f],Ydb(Sdb(e,1))),3);return d}
+ function lmb(a,b,c){var d,e,f;f=a.a.length-1;for(e=a.b,d=0;d0?1:0}return (!a.c&&(a.c=ojb(Hdb(a.f))),a.c).e}
+ function GXd(a,b){if(b){if(a.B==null){a.B=a.D;a.D=null;}}else if(a.B!=null){a.D=a.B;a.B=null;}}
+ function rZb(a,b){nZb();return a==jZb&&b==mZb||a==mZb&&b==jZb||a==lZb&&b==kZb||a==kZb&&b==lZb}
+ function sZb(a,b){nZb();return a==jZb&&b==kZb||a==jZb&&b==lZb||a==mZb&&b==lZb||a==mZb&&b==kZb}
+ function zMb(a,b){return Zy(),bz(Tye),$wnd.Math.abs(0-b)<=Tye||0==b||isNaN(0)&&isNaN(b)?0:a/b}
+ function qsc(a,b){return Kfb(UD(Lvb(MDb(GDb(new SDb(null,new Swb(a.c.b,16)),new Isc(a)),b))))}
+ function tsc(a,b){return Kfb(UD(Lvb(MDb(GDb(new SDb(null,new Swb(a.c.b,16)),new Gsc(a)),b))))}
+ function rvc(){ovc();return cD(WC(iX,1),jwe,259,0,[fvc,hvc,ivc,jvc,kvc,lvc,nvc,evc,gvc,mvc])}
+ function dEc(){aEc();return cD(WC(vX,1),jwe,243,0,[$Dc,VDc,YDc,WDc,XDc,SDc,ZDc,_Dc,TDc,UDc])}
+ function z3c(a,b){var c;b.Ug('General Compactor',1);c=h4c(RD(Gxd(a,($4c(),I4c)),393));c.Cg(a);}
+ function T5c(a,b){var c,d;c=RD(Gxd(a,($4c(),P4c)),17);d=RD(Gxd(b,P4c),17);return hgb(c.a,d.a)}
+ function Bjd(a,b,c){var d,e;for(e=Sub(a,0);e.b!=e.d.c;){d=RD(evb(e),8);d.a+=b;d.b+=c;}return a}
+ function Go(a,b,c){var d;for(d=a.b[c&a.f];d;d=d.b){if(c==d.a&&Hb(b,d.g)){return d}}return null}
+ function Ho(a,b,c){var d;for(d=a.c[c&a.f];d;d=d.d){if(c==d.f&&Hb(b,d.i)){return d}}return null}
+ function sjb(a,b,c){var d,e,f;d=0;for(e=0;e>>31;}d!=0&&(a[c]=d);}
+ function yzb(a,b,c,d,e,f){var g;this.c=a;g=new bnb;Syb(a,g,b,a.b,c,d,e,f);this.a=new Jkb(g,0);}
+ function _5c(){this.c=new T2c(0);this.b=new T2c(FEe);this.d=new T2c(EEe);this.a=new T2c(Gze);}
+ function kMb(a,b,c,d,e,f,g){qs.call(this,a,b);this.d=c;this.e=d;this.c=e;this.b=f;this.a=dv(g);}
+ function tBd(a,b,c,d,e,f,g,h,i,j,k,l,m){ABd(a,b,c,d,e,f,g,h,i,j,k,l,m);kXd(a,false);return a}
+ function H0b(a){if(a.b.c.i.k==(r3b(),m3b)){return RD(mQb(a.b.c.i,(Ywc(),Awc)),12)}return a.b.c}
+ function I0b(a){if(a.b.d.i.k==(r3b(),m3b)){return RD(mQb(a.b.d.i,(Ywc(),Awc)),12)}return a.b.d}
+ function nDb(a){var b;b=mDb(a);if(Gdb(b.a,0)){return bwb(),bwb(),awb}return bwb(),new ewb(b.b)}
+ function SCb(a){var b;b=RCb(a);if(Gdb(b.a,0)){return Tvb(),Tvb(),Svb}return Tvb(),new Yvb(b.b)}
+ function TCb(a){var b;b=RCb(a);if(Gdb(b.a,0)){return Tvb(),Tvb(),Svb}return Tvb(),new Yvb(b.c)}
+ function o8b(a){switch(a.g){case 2:return qpd(),ppd;case 4:return qpd(),Xod;default:return a;}}
+ function p8b(a){switch(a.g){case 1:return qpd(),npd;case 3:return qpd(),Yod;default:return a;}}
+ function C9c(a){switch(a.g){case 0:return new s9c;case 1:return new x9c;default:return null;}}
+ function Zcc(){Zcc=geb;Ycc=new kGd('edgelabelcenterednessanalysis.includelabel',(Geb(),Eeb));}
+ function jKc(){jKc=geb;iKc=mfd(qfd(pfd(pfd(new ufd,(sXb(),pXb),(hcc(),Qbc)),qXb,Gbc),rXb),Pbc);}
+ function DLc(){DLc=geb;CLc=mfd(qfd(pfd(pfd(new ufd,(sXb(),pXb),(hcc(),Qbc)),qXb,Gbc),rXb),Pbc);}
+ function lYd(){lYd=geb;iYd=new i1d;kYd=cD(WC(y7,1),lKe,179,0,[]);jYd=cD(WC(s7,1),mKe,62,0,[]);}
+ function P8b(){P8b=geb;O8b=new Q8b('TO_INTERNAL_LTR',0);N8b=new Q8b('TO_INPUT_DIRECTION',1);}
+ function J3b(){J3b=geb;G3b=new r4b;E3b=new w4b;F3b=new A4b;D3b=new E4b;H3b=new I4b;I3b=new M4b;}
+ function Cac(a,b){b.Ug(iBe,1);LJb(KJb(new PJb((i1b(),new t1b(a,false,false,new _1b)))));b.Vg();}
+ function M_c(a,b,c){c.Ug('DFS Treeifying phase',1);L_c(a,b);J_c(a,b);a.a=null;a.b=null;c.Vg();}
+ function Leb(a,b){Geb();return bE(a)?jhb(a,WD(b)):_D(a)?Jfb(a,UD(b)):$D(a)?Ieb(a,TD(b)):a.Fd(b)}
+ function Ld(a,b){var c,d;uFb(b);for(d=b.vc().Kc();d.Ob();){c=RD(d.Pb(),44);a.zc(c.ld(),c.md());}}
+ function ege(a,b,c){var d;for(d=c.Kc();d.Ob();){if(!cge(a,b,d.Pb())){return false}}return true}
+ function S6d(a,b,c,d,e){var f;if(c){f=BYd(b.Dh(),a.c);e=c.Rh(b,-1-(f==-1?d:f),null,e);}return e}
+ function T6d(a,b,c,d,e){var f;if(c){f=BYd(b.Dh(),a.c);e=c.Th(b,-1-(f==-1?d:f),null,e);}return e}
+ function Uib(a){var b;if(a.b==-2){if(a.e==0){b=-1;}else {for(b=0;a.a[b]==0;b++);}a.b=b;}return a.b}
+ function fjb(a){uFb(a);if(a.length==0){throw Adb(new Vgb('Zero length BigInteger'))}mjb(this,a);}
+ function $Hd(a){this.i=a.gc();if(this.i>0){this.g=this.aj(this.i+(this.i/8|0)+1);a.Qc(this.g);}}
+ function dmc(a,b,c){this.g=a;this.d=b;this.e=c;this.a=new bnb;bmc(this);yob();_mb(this.a,null);}
+ function aad(a,b){b.q=a;a.d=$wnd.Math.max(a.d,b.r);a.b+=b.d+(a.a.c.length==0?0:a.c);Rmb(a.a,b);}
+ function xid(a,b){var c,d,e,f;e=a.c;c=a.c+a.b;f=a.d;d=a.d+a.a;return b.a>e&&b.af&&b.be?(c=e):BFb(b,c+1);a.a=zhb(a.a,0,b)+(''+d)+yhb(a.a,c);}
+ function ktb(a,b){a.a=Bdb(a.a,1);a.c=$wnd.Math.min(a.c,b);a.b=$wnd.Math.max(a.b,b);a.d=Bdb(a.d,b);}
+ function wdc(a,b){return b1||a.Ob()){++a.a;a.g=0;b=a.i;a.Ob();return b}else {throw Adb(new Dvb)}}
+ function GRc(a){switch(a.a.g){case 1:return new lSc;case 3:return new VUc;default:return new WRc;}}
+ function fyd(a,b){switch(b){case 1:return !!a.n&&a.n.i!=0;case 2:return a.k!=null;}return Cxd(a,b)}
+ function Hdb(a){if(jxe>22);e=a.h+b.h+(d>>22);return hD(c&dxe,d&dxe,e&exe)}
+ function DD(a,b){var c,d,e;c=a.l-b.l;d=a.m-b.m+(c>>22);e=a.h-b.h+(d>>22);return hD(c&dxe,d&dxe,e&exe)}
+ function Jpc(a){var b,c;Hpc(a);for(c=new Anb(a.d);c.ad)throw Adb(new aMd(b,d));a.Si()&&(c=bHd(a,c));return a.Ei(b,c)}
+ function eQb(a,b,c,d,e){var f,g;for(g=c;g<=e;g++){for(f=b;f<=d;f++){PPb(a,f,g)||TPb(a,f,g,true,false);}}}
+ function uid(a){tid();var b,c,d;c=$C(l3,Nve,8,2,0,1);d=0;for(b=0;b<2;b++){d+=0.5;c[b]=Cid(d,a);}return c}
+ function xD(a){var b,c,d;b=~a.l+1&dxe;c=~a.m+(b==0?1:0)&dxe;d=~a.h+(b==0&&c==0?1:0)&exe;return hD(b,c,d)}
+ function mgb(a){var b;if(a<0){return qwe}else if(a==0){return 0}else {for(b=hwe;(b&a)==0;b>>=1);return b}}
+ function zSd(a,b,c){if(a>=128)return false;return a<64?Pdb(Cdb(Sdb(1,a),c),0):Pdb(Cdb(Sdb(1,a-64),b),0)}
+ function oQb(a,b,c){return c==null?(!a.q&&(a.q=new Tsb),_jb(a.q,b)):(!a.q&&(a.q=new Tsb),Zjb(a.q,b,c)),a}
+ function pQb(a,b,c){c==null?(!a.q&&(a.q=new Tsb),_jb(a.q,b)):(!a.q&&(a.q=new Tsb),Zjb(a.q,b,c));return a}
+ function KTb(a){var b,c;c=new gUb;kQb(c,a);pQb(c,(JVb(),HVb),a);b=new Tsb;MTb(a,c,b);LTb(a,c,b);return c}
+ function cIc(a){var b,c;b=a.t-a.k[a.o.p]*a.d+a.j[a.o.p]>a.f;c=a.u+a.e[a.o.p]*a.d>a.f*a.s*a.d;return b||c}
+ function qmc(a,b){var c,d,e,f;c=false;d=a.a[b].length;for(f=0;f=0,'Negative initial capacity');mFb(b>=0,'Non-positive load factor');akb(this);}
+ function iib(a,b,c,d,e){var f,g;g=a.length;f=c.length;if(b<0||d<0||e<0||b+e>g||d+e>f){throw Adb(new ueb)}}
+ function zob(a,b){yob();var c,d,e,f,g;g=false;for(d=b,e=0,f=d.length;e1||b>=0&&a.b<3}
+ function nD(a){var b,c,d;b=~a.l+1&dxe;c=~a.m+(b==0?1:0)&dxe;d=~a.h+(b==0&&c==0?1:0)&exe;a.l=b;a.m=c;a.h=d;}
+ function Cob(a){yob();var b,c,d;d=1;for(c=a.Kc();c.Ob();){b=c.Pb();d=31*d+(b!=null?tb(b):0);d=d|0;}return d}
+ function kD(a,b,c,d,e){var f;f=BD(a,b);c&&nD(f);if(e){a=mD(a,b);d?(eD=xD(a)):(eD=hD(a.l,a.m,a.h));}return f}
+ function Qlc(a,b,c){a.g=Wlc(a,b,(qpd(),Xod),a.b);a.d=Wlc(a,c,Xod,a.b);if(a.g.c==0||a.d.c==0){return}Tlc(a);}
+ function Rlc(a,b,c){a.g=Wlc(a,b,(qpd(),ppd),a.j);a.d=Wlc(a,c,ppd,a.j);if(a.g.c==0||a.d.c==0){return}Tlc(a);}
+ function Xyd(a,b){switch(b){case 7:return !!a.e&&a.e.i!=0;case 8:return !!a.d&&a.d.i!=0;}return wyd(a,b)}
+ function STb(a,b){switch(b.g){case 0:ZD(a.b,641)||(a.b=new tUb);break;case 1:ZD(a.b,642)||(a.b=new zUb);}}
+ function tbd(a){switch(a.g){case 0:return new _dd;default:throw Adb(new agb(eGe+(a.f!=null?a.f:''+a.g)));}}
+ function bdd(a){switch(a.g){case 0:return new vdd;default:throw Adb(new agb(eGe+(a.f!=null?a.f:''+a.g)));}}
+ function LCc(a,b,c){return !QDb(CDb(new SDb(null,new Swb(a.c,16)),new PAb(new gsd(b,c)))).Bd((xDb(),wDb))}
+ function mWc(a,b){return cjd(jWc(RD(mQb(b,(h_c(),H$c)),88)),new rjd(a.c.e.a-a.b.e.a,a.c.e.b-a.b.e.b))<=0}
+ function dve(a,b){while(a.g==null&&!a.c?sId(a):a.g==null||a.i!=0&&RD(a.g[a.i-1],51).Ob()){mFd(b,tId(a));}}
+ function sYb(a){var b,c;for(c=new Anb(a.a.b);c.ad?1:0}
+ function ICc(a){Rmb(a.c,(hed(),fed));if(_y(a.a,Kfb(UD(iGd((QCc(),OCc)))))){return new asd}return new csd(a)}
+ function fs(a){while(!a.d||!a.d.Ob()){if(!!a.b&&!nmb(a.b)){a.d=RD(smb(a.b),51);}else {return null}}return a.d}
+ function BVc(a){switch(a.g){case 1:return EEe;default:case 2:return 0;case 3:return Gze;case 4:return FEe;}}
+ function fte(){Vse();var a;if(Cse)return Cse;a=Zse(hte('M',true));a=$se(hte('M',false),a);Cse=a;return Cse}
+ function ttd(){ttd=geb;qtd=new utd('ELK',0);rtd=new utd('JSON',1);ptd=new utd('DOT',2);std=new utd('SVG',3);}
+ function TEc(){TEc=geb;SEc=new UEc('STACKED',0);QEc=new UEc('REVERSE_STACKED',1);REc=new UEc('SEQUENCED',2);}
+ function LZc(){LZc=geb;KZc=new MZc(LAe,0);JZc=new MZc('MIDDLE_TO_MIDDLE',1);IZc=new MZc('AVOID_OVERLAP',2);}
+ function sgc(){sgc=geb;qgc=new Lgc;rgc=new Ngc;pgc=new Dgc;ogc=new Pgc;ngc=new Hgc;mgc=(uFb(ngc),new nrb);}
+ function vnd(){vnd=geb;tnd=new A3b(15);snd=new mGd((umd(),tld),tnd);und=Qld;ond=Ekd;pnd=kld;rnd=nld;qnd=mld;}
+ function wgd(a,b){var c,d,e,f,g;for(d=b,e=0,f=d.length;e=a.b.c.length){return}jwb(a,2*b+1);c=2*b+2;c0){b.Cd(c);c.i&&zKc(c);}}}
+ function Ejb(a,b,c){var d;for(d=c-1;d>=0&&a[d]===b[d];d--);return d<0?0:Ldb(Cdb(a[d],yxe),Cdb(b[d],yxe))?-1:1}
+ function it(a,b,c){var d,e;this.g=a;this.c=b;this.a=this;this.d=this;e=Wp(c);d=$C(UG,ewe,227,e,0,1);this.b=d;}
+ function fQb(a,b,c,d,e){var f,g;for(g=c;g<=e;g++){for(f=b;f<=d;f++){if(PPb(a,f,g)){return true}}}return false}
+ function Dc(a,b){var c,d;for(d=a.Zb().Cc().Kc();d.Ob();){c=RD(d.Pb(),16);if(c.Hc(b)){return true}}return false}
+ function iu(a,b,c){var d,e,f,g;uFb(c);g=false;f=a.fd(b);for(e=c.Kc();e.Ob();){d=e.Pb();f.Rb(d);g=true;}return g}
+ function NMd(a,b){var c,d;d=RD(Ywd(a.a,4),129);c=$C(d6,IJe,424,b,0,1);d!=null&&hib(d,0,c,0,d.length);return c}
+ function hSd(a,b){var c;c=new lSd((a.f&256)!=0,a.i,a.a,a.d,(a.f&16)!=0,a.j,a.g,b);a.e!=null||(c.c=a);return c}
+ function Tv(a,b){var c;if(a===b){return true}else if(ZD(b,85)){c=RD(b,85);return Rx(gn(a),c.vc())}return false}
+ function Vjb(a,b,c){var d,e;for(e=c.Kc();e.Ob();){d=RD(e.Pb(),44);if(a.Be(b,d.md())){return true}}return false}
+ function lmc(a,b,c){if(!a.d[b.p][c.p]){kmc(a,b,c);a.d[b.p][c.p]=true;a.d[c.p][b.p]=true;}return a.a[b.p][c.p]}
+ function vMc(a,b){var c;if(!a||a==b||!nQb(b,(Ywc(),pwc))){return false}c=RD(mQb(b,(Ywc(),pwc)),10);return c!=a}
+ function Bhe(a){switch(a.i){case 2:{return true}case 1:{return false}case -1:{++a.c;}default:{return a.$l()}}}
+ function Che(a){switch(a.i){case -2:{return true}case -1:{return false}case 1:{--a.c;}default:{return a._l()}}}
+ function bgb(a){oz.call(this,'The given string does not match the expected format for individual spacings.',a);}
+ function J6c(a,b){var c;b.Ug('Min Size Preprocessing',1);c=vsd(a);Ixd(a,(X6c(),U6c),c.a);Ixd(a,R6c,c.b);b.Vg();}
+ function Djd(a){var b,c,d;b=0;d=$C(l3,Nve,8,a.b,0,1);c=Sub(a,0);while(c.b!=c.d.c){d[b++]=RD(evb(c),8);}return d}
+ function Ajd(a,b,c){var d,e,f;d=new Yub;for(f=Sub(c,0);f.b!=f.d.c;){e=RD(evb(f),8);Mub(d,new sjd(e));}iu(a,b,d);}
+ function az(a,b){var c;c=Bdb(a,b);if(Ldb($db(a,b),0)|Jdb($db(a,c),0)){return c}return Bdb(Sve,$db(Udb(c,63),1))}
+ function le(a,b){var c,d;c=RD(a.d.Bc(b),16);if(!c){return null}d=a.e.hc();d.Gc(c);a.e.d-=c.gc();c.$b();return d}
+ function Dyb(a){var b;b=a.a.c.length;if(b>0){return lyb(b-1,a.a.c.length),Xmb(a.a,b-1)}else {throw Adb(new Srb)}}
+ function nFb(a,b,c){if(a>b){throw Adb(new agb(_xe+a+aye+b))}if(a<0||b>c){throw Adb(new xeb(_xe+a+bye+b+Qxe+c))}}
+ function yXd(a,b){if(a.D==null&&a.B!=null){a.D=a.B;a.B=null;}JXd(a,b==null?null:(uFb(b),b));!!a.C&&a.hl(null);}
+ function JCc(a,b){var c;c=iGd((QCc(),OCc))!=null&&b.Sg()!=null?Kfb(UD(b.Sg()))/Kfb(UD(iGd(OCc))):1;Zjb(a.b,b,c);}
+ function $Lc(a,b){var c,d;d=a.c[b];if(d==0){return}a.c[b]=0;a.d-=d;c=b+1;while(cDEe?a-c>DEe:c-a>DEe}
+ function vjd(a,b){var c;for(c=0;ce){ead(b.q,e);d=c!=b.q.d;}}return d}
+ function C3c(a,b){var c,d,e,f,g,h,i,j;i=b.i;j=b.j;d=a.f;e=d.i;f=d.j;g=i-e;h=j-f;c=$wnd.Math.sqrt(g*g+h*h);return c}
+ function pBd(a,b){var c,d;d=Hvd(a);if(!d){c=(gSd(),nSd(b));d=new Sde(c);WGd(d.El(),a);}return d}
+ function Sc(a,b){var c,d;c=RD(a.c.Bc(b),16);if(!c){return a.jc()}d=a.hc();d.Gc(c);a.d-=c.gc();c.$b();return a.mc(d)}
+ function tKc(a,b){var c,d;d=Kwb(a.d,1)!=0;c=true;while(c){c=false;c=b.c.mg(b.e,d);c=c|DKc(a,b,d,false);d=!d;}yKc(a);}
+ function omc(a,b,c,d){var e,f;a.a=b;f=d?0:1;a.f=(e=new mmc(a.c,a.a,c,f),new Pmc(c,a.a,e,a.e,a.b,a.c==(RKc(),PKc)));}
+ function Imb(a){var b;sFb(a.a!=a.b);b=a.d.a[a.a];zmb(a.b==a.d.c&&b!=null);a.c=a.a;a.a=a.a+1&a.d.a.length-1;return b}
+ function Vib(a){var b;if(a.c!=0){return a.c}for(b=0;b=a.c.b:a.a<=a.c.b)){throw Adb(new Dvb)}b=a.a;a.a+=a.c.c;++a.b;return sgb(b)}
+ function h5b(a){var b;b=new y2b(a.a);kQb(b,a);pQb(b,(Ywc(),Awc),a);b.o.a=a.g;b.o.b=a.f;b.n.a=a.i;b.n.b=a.j;return b}
+ function tVc(a){return (qpd(),hpd).Hc(a.j)?Kfb(UD(mQb(a,(Ywc(),Swc)))):xjd(cD(WC(l3,1),Nve,8,0,[a.i.n,a.n,a.a])).b}
+ function ZJc(a){var b;b=vfd(XJc);RD(mQb(a,(Ywc(),kwc)),21).Hc((ovc(),kvc))&&pfd(b,(sXb(),pXb),(hcc(),Ybc));return b}
+ function M2c(a){var b,c,d,e;e=new _sb;for(d=new Anb(a);d.a=0?b:-b;while(d>0){if(d%2==0){c*=c;d=d/2|0;}else {e*=c;d-=1;}}return b<0?1/e:e}
+ function Jid(a,b){var c,d,e;e=1;c=a;d=b>=0?b:-b;while(d>0){if(d%2==0){c*=c;d=d/2|0;}else {e*=c;d-=1;}}return b<0?1/e:e}
+ function Vvd(a,b){var c,d,e,f;f=(e=a?Hvd(a):null,Pje((d=b,e?e.Gl():null,d)));if(f==b){c=Hvd(a);!!c&&c.Gl();}return f}
+ function g2d(a,b,c){var d,e;e=a.f;a.f=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new N3d(a,1,0,e,b);!c?(c=d):c.nj(d);}return c}
+ function e2d(a,b,c){var d,e;e=a.b;a.b=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new N3d(a,1,3,e,b);!c?(c=d):c.nj(d);}return c}
+ function rAd(a,b,c){var d,e;e=a.a;a.a=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new N3d(a,1,1,e,b);!c?(c=d):c.nj(d);}return c}
+ function SNd(a){var b,c;if(a!=null){for(c=0;c=d||b-129&&a<128){return ugb(),b=a+128,c=tgb[b],!c&&(c=tgb[b]=new fgb(a)),c}return new fgb(a)}
+ function bhb(a){var b,c;if(a>-129&&a<128){return dhb(),b=a+128,c=chb[b],!c&&(c=chb[b]=new Xgb(a)),c}return new Xgb(a)}
+ function M$b(a,b){var c;if(a.a.c.length>0){c=RD(Vmb(a.a,a.a.c.length-1),579);if(Q_b(c,b)){return}}Rmb(a.a,new S_b(b));}
+ function Ekc(a){lkc();var b,c;b=a.d.c-a.e.c;c=RD(a.g,154);Umb(c.b,new Ykc(b));Umb(c.c,new $kc(b));xgb(c.i,new alc(b));}
+ function Mlc(a){var b;b=new bib;b.a+='VerticalSegment ';Yhb(b,a.e);b.a+=' ';Zhb(b,Eb(new Gb,new Anb(a.k)));return b.a}
+ function Fmc(a,b){var c,d,e;c=0;for(e=b3b(a,b).Kc();e.Ob();){d=RD(e.Pb(),12);c+=mQb(d,(Ywc(),Iwc))!=null?1:0;}return c}
+ function VTc(a,b,c){var d,e,f;d=0;for(f=Sub(a,0);f.b!=f.d.c;){e=Kfb(UD(evb(f)));if(e>c){break}else e>=b&&++d;}return d}
+ function Wv(b,c){Qb(b);try{return b._b(c)}catch(a){a=zdb(a);if(ZD(a,212)||ZD(a,169)){return false}else throw Adb(a)}}
+ function Nk(b,c){Qb(b);try{return b.Hc(c)}catch(a){a=zdb(a);if(ZD(a,212)||ZD(a,169)){return false}else throw Adb(a)}}
+ function Ok(b,c){Qb(b);try{return b.Mc(c)}catch(a){a=zdb(a);if(ZD(a,212)||ZD(a,169)){return false}else throw Adb(a)}}
+ function Xv(b,c){Qb(b);try{return b.xc(c)}catch(a){a=zdb(a);if(ZD(a,212)||ZD(a,169)){return null}else throw Adb(a)}}
+ function Yv(b,c){Qb(b);try{return b.Bc(c)}catch(a){a=zdb(a);if(ZD(a,212)||ZD(a,169)){return null}else throw Adb(a)}}
+ function aMc(a,b){switch(b.g){case 2:case 1:return b3b(a,b);case 3:case 4:return hv(b3b(a,b));}return yob(),yob(),vob}
+ function QAd(a){var b;if((a.Db&64)!=0)return awd(a);b=new Shb(awd(a));b.a+=' (name: ';Nhb(b,a.zb);b.a+=')';return b.a}
+ function Fgd(a){var b;b=RD(cub(a.c.c,''),233);if(!b){b=new fgd(ogd(ngd(new pgd,''),'Other'));dub(a.c.c,'',b);}return b}
+ function hBd(a,b,c){var d,e;e=a.sb;a.sb=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new N3d(a,1,4,e,b);!c?(c=d):c.nj(d);}return c}
+ function ZVd(a,b,c){var d,e;e=a.r;a.r=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new N3d(a,1,8,e,a.r);!c?(c=d):c.nj(d);}return c}
+ function q5d(a,b,c){var d,e;d=new P3d(a.e,4,13,(e=b.c,e?e:(JTd(),wTd)),null,fZd(a,b),false);!c?(c=d):c.nj(d);return c}
+ function p5d(a,b,c){var d,e;d=new P3d(a.e,3,13,null,(e=b.c,e?e:(JTd(),wTd)),fZd(a,b),false);!c?(c=d):c.nj(d);return c}
+ function Oee(a,b){var c,d;c=RD(b,691);d=c.el();!d&&c.fl(d=ZD(b,90)?new afe(a,RD(b,29)):new mfe(a,RD(b,156)));return d}
+ function KHd(a,b,c){var d;a._i(a.i+1);d=a.Zi(b,c);b!=a.i&&hib(a.g,b,a.g,b+1,a.i-b);bD(a.g,b,d);++a.i;a.Mi(b,c);a.Ni();}
+ function Hyb(a,b){var c;if(b.a){c=b.a.a.length;!a.a?(a.a=new dib(a.d)):Zhb(a.a,a.b);Xhb(a.a,b.a,b.d.length,c);}return a}
+ function wib(a,b){var c;a.c=b;a.a=pjb(b);a.a<54&&(a.f=(c=b.d>1?DFb(b.a[0],b.a[1]):DFb(b.a[0],0),Xdb(b.e>0?c:Odb(c))));}
+ function MDb(a,b){var c;c=new IEb;if(!a.a.Bd(c)){LCb(a);return Kvb(),Kvb(),Jvb}return Kvb(),new Ovb(uFb(LDb(a,c.a,b)))}
+ function t9b(a,b){var c;if(a.c.length==0){return}c=RD(anb(a,$C(jR,WAe,10,a.c.length,0,1)),199);Znb(c,new F9b);q9b(c,b);}
+ function z9b(a,b){var c;if(a.c.length==0){return}c=RD(anb(a,$C(jR,WAe,10,a.c.length,0,1)),199);Znb(c,new K9b);q9b(c,b);}
+ function pb(a,b){return bE(a)?lhb(a,b):_D(a)?Lfb(a,b):$D(a)?(uFb(a),dE(a)===dE(b)):YD(a)?a.Fb(b):aD(a)?mb(a,b):Hz(a,b)}
+ function Cvd(a,b,c){if(b<0){Tvd(a,c);}else {if(!c.rk()){throw Adb(new agb(KHe+c.xe()+LHe))}RD(c,69).wk().Ek(a,a.hi(),b);}}
+ function xFb(a,b,c){if(a<0||b>c){throw Adb(new veb(_xe+a+bye+b+', size: '+c))}if(a>b){throw Adb(new agb(_xe+a+aye+b))}}
+ function oVd(a){var b;if((a.Db&64)!=0)return awd(a);b=new Shb(awd(a));b.a+=' (source: ';Nhb(b,a.d);b.a+=')';return b.a}
+ function JSd(a){if(a>=65&&a<=70){return a-65+10}if(a>=97&&a<=102){return a-97+10}if(a>=48&&a<=57){return a-48}return 0}
+ function lMb(a){hMb();var b,c,d,e;for(c=nMb(),d=0,e=c.length;d=0?jjb(a):Xib(jjb(Odb(a)))));}
+ function G0b(a,b,c,d,e,f){this.e=new bnb;this.f=(BEc(),AEc);Rmb(this.e,a);this.d=b;this.a=c;this.b=d;this.f=e;this.c=f;}
+ function bQb(a,b,c){a.n=YC(lE,[Nve,rxe],[376,28],14,[c,eE($wnd.Math.ceil(b/32))],2);a.o=b;a.p=c;a.j=b-1>>1;a.k=c-1>>1;}
+ function ggb(a){a-=a>>1&1431655765;a=(a>>2&858993459)+(a&858993459);a=(a>>4)+a&252645135;a+=a>>8;a+=a>>16;return a&63}
+ function C4d(a,b){var c,d;for(d=new dMd(a);d.e!=d.i.gc();){c=RD(bMd(d),142);if(dE(b)===dE(c)){return true}}return false}
+ function Iee(a,b,c){var d,e,f;f=(e=N5d(a.b,b),e);if(f){d=RD(tfe(Pee(a,f),''),29);if(d){return Ree(a,d,b,c)}}return null}
+ function Lee(a,b,c){var d,e,f;f=(e=N5d(a.b,b),e);if(f){d=RD(tfe(Pee(a,f),''),29);if(d){return See(a,d,b,c)}}return null}
+ function IDd(a,b){var c;c=Ao(a.i,b);if(c==null){throw Adb(new CDd('Node did not exist in input.'))}wEd(b,c);return null}
+ function wvd(a,b){var c;c=wYd(a,b);if(ZD(c,331)){return RD(c,35)}throw Adb(new agb(KHe+b+"' is not a valid attribute"))}
+ function VGd(a,b,c){var d;d=a.gc();if(b>d)throw Adb(new aMd(b,d));if(a.Si()&&a.Hc(c)){throw Adb(new agb(LIe))}a.Gi(b,c);}
+ function w7b(a,b){b.Ug('Sort end labels',1);FDb(CDb(EDb(new SDb(null,new Swb(a.b,16)),new H7b),new J7b),new L7b);b.Vg();}
+ function Cmd(){Cmd=geb;Amd=new Gmd(Sye,0);zmd=new Gmd(Oye,1);ymd=new Gmd(Nye,2);xmd=new Gmd(Zye,3);Bmd=new Gmd('UP',4);}
+ function gbd(){gbd=geb;dbd=new hbd('P1_STRUCTURE',0);ebd=new hbd('P2_PROCESSING_ORDER',1);fbd=new hbd('P3_EXECUTION',2);}
+ function r0c(){r0c=geb;q0c=mfd(mfd(rfd(mfd(mfd(rfd(pfd(new ufd,(YVc(),VVc),(WYc(),VYc)),WVc),RYc),TYc),XVc),NYc),UYc);}
+ function s8b(a){switch(RD(mQb(a,(Ywc(),owc)),311).g){case 1:pQb(a,owc,(Gvc(),Dvc));break;case 2:pQb(a,owc,(Gvc(),Fvc));}}
+ function bUc(a){switch(a){case 0:return new mUc;case 1:return new cUc;case 2:return new hUc;default:throw Adb(new _fb);}}
+ function Fmd(a){switch(a.g){case 2:return zmd;case 1:return ymd;case 4:return xmd;case 3:return Bmd;default:return Amd;}}
+ function UNb(a,b){switch(a.b.g){case 0:case 1:return b;case 2:case 3:return new Uid(b.d,0,b.a,b.b);default:return null;}}
+ function rpd(a){switch(a.g){case 1:return ppd;case 2:return Yod;case 3:return Xod;case 4:return npd;default:return opd;}}
+ function spd(a){switch(a.g){case 1:return npd;case 2:return ppd;case 3:return Yod;case 4:return Xod;default:return opd;}}
+ function tpd(a){switch(a.g){case 1:return Xod;case 2:return npd;case 3:return ppd;case 4:return Yod;default:return opd;}}
+ function cyd(a,b,c,d){switch(b){case 1:return !a.n&&(a.n=new C5d(I4,a,1,7)),a.n;case 2:return a.k;}return Axd(a,b,c,d)}
+ function uLd(a,b,c){var d,e;if(a.Pj()){e=a.Qj();d=SHd(a,b,c);a.Jj(a.Ij(7,sgb(c),d,b,e));return d}else {return SHd(a,b,c)}}
+ function VNd(a,b){var c,d,e;if(a.d==null){++a.e;--a.f;}else {e=b.ld();c=b.Bi();d=(c&lve)%a.d.length;iOd(a,d,XNd(a,d,c,e));}}
+ function xWd(a,b){var c;c=(a.Bb&gwe)!=0;b?(a.Bb|=gwe):(a.Bb&=-1025);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,10,c,b));}
+ function DWd(a,b){var c;c=(a.Bb&qxe)!=0;b?(a.Bb|=qxe):(a.Bb&=-4097);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,12,c,b));}
+ function EWd(a,b){var c;c=(a.Bb&bKe)!=0;b?(a.Bb|=bKe):(a.Bb&=-8193);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,15,c,b));}
+ function FWd(a,b){var c;c=(a.Bb&cKe)!=0;b?(a.Bb|=cKe):(a.Bb&=-2049);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,11,c,b));}
+ function zKc(a){var b;if(a.g){b=a.c.kg()?a.f:a.a;BKc(b.a,a.o,true);BKc(b.a,a.o,false);pQb(a.o,(yCc(),BBc),(Bod(),vod));}}
+ function Orc(a){var b;if(!a.a){throw Adb(new dgb('Cannot offset an unassigned cut.'))}b=a.c-a.b;a.b+=b;Qrc(a,b);Rrc(a,b);}
+ function JDd(a,b){var c;c=Wjb(a.k,b);if(c==null){throw Adb(new CDd('Port did not exist in input.'))}wEd(b,c);return null}
+ function Jje(a){var b,c;for(c=Kje(BXd(a)).Kc();c.Ob();){b=WD(c.Pb());if(bAd(a,b)){return USd((TSd(),SSd),b)}}return null}
+ function qJb(a){var b,c;for(c=a.p.a.ec().Kc();c.Ob();){b=RD(c.Pb(),218);if(b.f&&a.b[b.c]<-1.0E-10){return b}}return null}
+ function Lr(a){var b,c;c=Thb(new bib,91);b=true;while(a.Ob()){b||(c.a+=pve,c);b=false;Yhb(c,a.Pb());}return (c.a+=']',c).a}
+ function o_b(a){var b,c,d;b=new bnb;for(d=new Anb(a.b);d.ab){return 1}if(a==b){return a==0?Qfb(1/a,1/b):0}return isNaN(a)?isNaN(b)?0:1:-1}
+ function pmb(a){var b;b=a.a[a.c-1&a.a.length-1];if(b==null){return null}a.c=a.c-1&a.a.length-1;bD(a.a,a.c,null);return b}
+ function Dqe(a){var b,c,d;d=0;c=a.length;for(b=0;b=1?zmd:xmd}return c}
+ function Xhc(a){switch(RD(mQb(a,(yCc(),yAc)),223).g){case 1:return new jqc;case 3:return new arc;default:return new dqc;}}
+ function MCb(a){if(a.c){MCb(a.c);}else if(a.d){throw Adb(new dgb("Stream already terminated, can't be modified or used"))}}
+ function Ltb(a,b,c){var d;d=a.a.get(b);a.a.set(b,c===undefined?null:c);if(d===undefined){++a.c;++a.b.g;}else {++a.d;}return d}
+ function HHc(a,b,c){var d,e;for(e=a.a.ec().Kc();e.Ob();){d=RD(e.Pb(),10);if(Be(c,RD(Vmb(b,d.p),16))){return d}}return null}
+ function u0c(a,b,c){var d;d=0;!!b&&(Emd(a.a)?(d+=b.f.a/2):(d+=b.f.b/2));!!c&&(Emd(a.a)?(d+=c.f.a/2):(d+=c.f.b/2));return d}
+ function LWb(a,b,c){var d;d=c;!d&&(d=Nqd(new Oqd,0));d.Ug(EAe,2);y0b(a.b,b,d.eh(1));NWb(a,b,d.eh(1));h0b(b,d.eh(1));d.Vg();}
+ function CGd(a,b,c){var d,e;d=(bvd(),e=new Xxd,e);Vxd(d,b);Wxd(d,c);!!a&&WGd((!a.a&&(a.a=new XZd(D4,a,5)),a.a),d);return d}
+ function kyd(a){var b;if((a.Db&64)!=0)return awd(a);b=new Shb(awd(a));b.a+=' (identifier: ';Nhb(b,a.k);b.a+=')';return b.a}
+ function kXd(a,b){var c;c=(a.Bb&QHe)!=0;b?(a.Bb|=QHe):(a.Bb&=-32769);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,18,c,b));}
+ function a6d(a,b){var c;c=(a.Bb&QHe)!=0;b?(a.Bb|=QHe):(a.Bb&=-32769);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,18,c,b));}
+ function AWd(a,b){var c;c=(a.Bb&Ove)!=0;b?(a.Bb|=Ove):(a.Bb&=-16385);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,16,c,b));}
+ function c6d(a,b){var c;c=(a.Bb&txe)!=0;b?(a.Bb|=txe):(a.Bb&=-65537);(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new Q3d(a,1,20,c,b));}
+ function qse(a){var b;b=$C(hE,zwe,28,2,15,1);a-=txe;b[0]=(a>>10)+uxe&Bwe;b[1]=(a&1023)+56320&Bwe;return Ihb(b,0,b.length)}
+ function Zfb(a){var b;b=Neb(a);if(b>3.4028234663852886E38){return oxe}else if(b<-3.4028234663852886E38){return pxe}return b}
+ function Bdb(a,b){var c;if(Kdb(a)&&Kdb(b)){c=a+b;if(jxe'+aXc(b.c):'e_'+tb(b),!!a.b&&!!a.c?aXc(a.b)+'->'+aXc(a.c):'e_'+tb(a))}
+ function rWc(a,b){return lhb(!!b.b&&!!b.c?aXc(b.b)+'->'+aXc(b.c):'e_'+tb(b),!!a.b&&!!a.c?aXc(a.b)+'->'+aXc(a.c):'e_'+tb(a))}
+ function $y(a,b){Zy();return bz(pwe),$wnd.Math.abs(a-b)<=pwe||a==b||isNaN(a)&&isNaN(b)?0:ab?1:cz(isNaN(a),isNaN(b))}
+ function Ymd(){Ymd=geb;Xmd=new Zmd(Sye,0);Vmd=new Zmd('POLYLINE',1);Umd=new Zmd('ORTHOGONAL',2);Wmd=new Zmd('SPLINES',3);}
+ function _6c(){_6c=geb;Z6c=new a7c('ASPECT_RATIO_DRIVEN',0);$6c=new a7c('MAX_SCALE_DRIVEN',1);Y6c=new a7c('AREA_DRIVEN',2);}
+ function Db(b,c,d){var e;try{Cb(b,c,d);}catch(a){a=zdb(a);if(ZD(a,606)){e=a;throw Adb(new Deb(e))}else throw Adb(a)}return c}
+ function Im(a){var b,c,d;for(c=0,d=a.length;cb&&d.Ne(a[f-1],a[f])>0;--f){g=a[f];bD(a,f,a[f-1]);bD(a,f-1,g);}}}
+ function Egd(a,b){var c,d,e,f,g;c=b.f;dub(a.c.d,c,b);if(b.g!=null){for(e=b.g,f=0,g=e.length;fb){fvb(c);break}}cvb(c,b);}
+ function Kic(a,b){var c,d,e;d=Zjc(b);e=Kfb(UD(hFc(d,(yCc(),TBc))));c=$wnd.Math.max(0,e/2-0.5);Iic(b,c,1);Rmb(a,new hjc(b,c));}
+ function L5c(a,b,c){var d;c.Ug('Straight Line Edge Routing',1);c.dh(b,eFe);d=RD(Gxd(b,(u2c(),t2c)),27);M5c(a,d);c.dh(b,gFe);}
+ function K9c(a,b){a.n.c.length==0&&Rmb(a.n,new _9c(a.s,a.t,a.i));Rmb(a.b,b);W9c(RD(Vmb(a.n,a.n.c.length-1),209),b);M9c(a,b);}
+ function Zrb(a){var b;this.a=(b=RD(a.e&&a.e(),9),new Fsb(b,RD(WEb(b,b.length),9),0));this.b=$C(jJ,rve,1,this.a.a.length,5,1);}
+ function jeb(a){var b;if(Array.isArray(a)&&a.Tm===keb){return nfb(rb(a))+'@'+(b=tb(a)>>>0,b.toString(16))}return a.toString()}
+ function jD(a,b){if(a.h==fxe&&a.m==0&&a.l==0){b&&(eD=hD(0,0,0));return gD((MD(),KD))}b&&(eD=hD(a.l,a.m,a.h));return hD(0,0,0)}
+ function _Gb(a,b){switch(b.g){case 2:return a.b;case 1:return a.c;case 4:return a.d;case 3:return a.a;default:return false;}}
+ function IYb(a,b){switch(b.g){case 2:return a.b;case 1:return a.c;case 4:return a.d;case 3:return a.a;default:return false;}}
+ function vyd(a,b,c,d){switch(b){case 3:return a.f;case 4:return a.g;case 5:return a.i;case 6:return a.j;}return cyd(a,b,c,d)}
+ function oIb(a,b){if(b==a.d){return a.e}else if(b==a.e){return a.d}else {throw Adb(new agb('Node '+b+' not part of edge '+a))}}
+ function Uvd(a,b){var c;c=wYd(a.Dh(),b);if(ZD(c,102)){return RD(c,19)}throw Adb(new agb(KHe+b+"' is not a valid reference"))}
+ function Bvd(a,b,c,d){if(b<0){Svd(a,c,d);}else {if(!c.rk()){throw Adb(new agb(KHe+c.xe()+LHe))}RD(c,69).wk().Ck(a,a.hi(),b,d);}}
+ function ig(a){var b;if(a.b){ig(a.b);if(a.b.d!=a.c){throw Adb(new Jrb)}}else if(a.d.dc()){b=RD(a.f.c.xc(a.e),16);!!b&&(a.d=b);}}
+ function VMb(a){RMb();var b,c,d,e;b=a.o.b;for(d=RD(RD(Qc(a.r,(qpd(),npd)),21),87).Kc();d.Ob();){c=RD(d.Pb(),117);e=c.e;e.b+=b;}}
+ function SRb(a){var b,c,d;this.a=new Iub;for(d=new Anb(a);d.a=e){return b.c+c}}return b.c+b.b.gc()}
+ function lQd(a,b){jQd();var c,d,e,f;d=iZd(a);e=b;Wnb(d,0,d.length,e);for(c=0;c0){d+=e;++c;}}c>1&&(d+=a.d*(c-1));return d}
+ function FFd(a){var b,c,d,e,f;f=HFd(a);c=cve(a.c);d=!c;if(d){e=new MB;sC(f,'knownLayouters',e);b=new QFd(e);xgb(a.c,b);}return f}
+ function fHd(a){var b,c,d;d=new Qhb;d.a+='[';for(b=0,c=a.gc();b0&&(BFb(b-1,a.length),a.charCodeAt(b-1)==58)&&!mSd(a,aSd,bSd)}
+ function Sib(a,b){var c;if(dE(a)===dE(b)){return true}if(ZD(b,92)){c=RD(b,92);return a.e==c.e&&a.d==c.d&&Tib(a,c.a)}return false}
+ function vpd(a){qpd();switch(a.g){case 4:return Yod;case 1:return Xod;case 3:return npd;case 2:return ppd;default:return opd;}}
+ function jBb(a){var b,c;if(a.b){return a.b}c=dBb?null:a.d;while(c){b=dBb?null:c.b;if(b){return b}c=dBb?null:c.d;}return SAb(),RAb}
+ function LJb(a){var b,c,d;d=Kfb(UD(a.a.of((umd(),cmd))));for(c=new Anb(a.a.Sf());c.a>5;b=a&31;d=$C(kE,Pwe,28,c+1,15,1);d[c]=1<3){e*=10;--f;}a=(a+(e>>1))/e|0;}d.i=a;return true}
+ function BYd(a,b){var c,d,e;c=(a.i==null&&rYd(a),a.i);d=b.Lj();if(d!=-1){for(e=c.length;d=0;--d){b=c[d];for(e=0;e>1;this.k=b-1>>1;}
+ function Dfd(a){Afd();if(RD(a.of((umd(),pld)),181).Hc((dqd(),bqd))){RD(a.of(Lld),181).Fc((Pod(),Ood));RD(a.of(pld),181).Mc(bqd);}}
+ function ndc(a){var b,c;b=a.d==(btc(),Ysc);c=jdc(a);b&&!c||!b&&c?pQb(a.a,(yCc(),Rzc),(Rjd(),Pjd)):pQb(a.a,(yCc(),Rzc),(Rjd(),Ojd));}
+ function QCc(){QCc=geb;GCc();OCc=(yCc(),bCc);PCc=dv(cD(WC(V5,1),kEe,149,0,[SBc,TBc,VBc,WBc,ZBc,$Bc,_Bc,aCc,dCc,fCc,UBc,XBc,cCc]));}
+ function RDb(a,b){var c;c=RD(zDb(a,tBb(new ZBb,new XBb,new wCb,cD(WC(QL,1),jwe,108,0,[(xBb(),vBb)]))),15);return c.Qc(__c(c.gc()))}
+ function nXc(a,b){var c,d;d=new zAb(a.a.ad(b,true));if(d.a.gc()<=1){throw Adb(new Ngb)}c=d.a.ec().Kc();c.Pb();return RD(c.Pb(),40)}
+ function lQc(a,b,c){var d,e;d=Kfb(a.p[b.i.p])+Kfb(a.d[b.i.p])+b.n.b+b.a.b;e=Kfb(a.p[c.i.p])+Kfb(a.d[c.i.p])+c.n.b+c.a.b;return e-d}
+ function XHd(a,b){var c;if(a.i>0){if(b.lengtha.i&&bD(b,a.i,null);return b}
+ function MXd(a){var b;if((a.Db&64)!=0)return QAd(a);b=new Shb(QAd(a));b.a+=' (instanceClassName: ';Nhb(b,a.D);b.a+=')';return b.a}
+ function ySd(a){var b,c,d,e;e=0;for(c=0,d=a.length;c0){a._j();d=b==null?0:tb(b);e=(d&lve)%a.d.length;c=XNd(a,e,d,b);return c!=-1}else {return false}}
+ function Nrb(a,b){var c,d;a.a=Bdb(a.a,1);a.c=$wnd.Math.min(a.c,b);a.b=$wnd.Math.max(a.b,b);a.d+=b;c=b-a.f;d=a.e+c;a.f=d-a.e-c;a.e=d;}
+ function yyd(a,b){switch(b){case 3:Ayd(a,0);return;case 4:Cyd(a,0);return;case 5:Dyd(a,0);return;case 6:Eyd(a,0);return;}hyd(a,b);}
+ function c3b(a,b){switch(b.g){case 1:return dr(a.j,(J3b(),E3b));case 2:return dr(a.j,(J3b(),G3b));default:return yob(),yob(),vob;}}
+ function zm(a){tm();var b;b=a.Pc();switch(b.length){case 0:return sm;case 1:return new Dy(Qb(b[0]));default:return new Kx(Im(b));}}
+ function kMd(b,c){b.Xj();try{b.d.bd(b.e++,c);b.f=b.d.j;b.g=-1;}catch(a){a=zdb(a);if(ZD(a,77)){throw Adb(new Jrb)}else throw Adb(a)}}
+ function a8d(){a8d=geb;$7d=new b8d;T7d=new e8d;U7d=new h8d;V7d=new k8d;W7d=new n8d;X7d=new q8d;Y7d=new t8d;Z7d=new w8d;_7d=new z8d;}
+ function YA(a,b){WA();var c,d;c=_A(($A(),$A(),ZA));d=null;b==c&&(d=RD(Xjb(VA,a),624));if(!d){d=new XA(a);b==c&&$jb(VA,a,d);}return d}
+ function zDc(a){wDc();var b;(!a.q?(yob(),yob(),wob):a.q)._b((yCc(),iBc))?(b=RD(mQb(a,iBc),203)):(b=RD(mQb(Y2b(a),jBc),203));return b}
+ function hFc(a,b){var c,d;d=null;if(nQb(a,(yCc(),YBc))){c=RD(mQb(a,YBc),96);c.pf(b)&&(d=c.of(b));}d==null&&(d=mQb(Y2b(a),b));return d}
+ function Ze(a,b){var c,d,e;if(ZD(b,44)){c=RD(b,44);d=c.ld();e=Xv(a.Rc(),d);return Hb(e,c.md())&&(e!=null||a.Rc()._b(d))}return false}
+ function $Nd(a,b){var c,d,e;if(a.f>0){a._j();d=b==null?0:tb(b);e=(d&lve)%a.d.length;c=WNd(a,e,d,b);if(c){return c.md()}}return null}
+ function qLd(a,b,c){var d,e,f;if(a.Pj()){d=a.i;f=a.Qj();KHd(a,d,b);e=a.Ij(3,null,b,d,f);!c?(c=e):c.nj(e);}else {KHd(a,a.i,b);}return c}
+ function f$d(a,b,c){var d,e;d=new P3d(a.e,4,10,(e=b.c,ZD(e,90)?RD(e,29):(JTd(),zTd)),null,fZd(a,b),false);!c?(c=d):c.nj(d);return c}
+ function e$d(a,b,c){var d,e;d=new P3d(a.e,3,10,null,(e=b.c,ZD(e,90)?RD(e,29):(JTd(),zTd)),fZd(a,b),false);!c?(c=d):c.nj(d);return c}
+ function SMb(a){RMb();var b;b=new sjd(RD(a.e.of((umd(),nld)),8));if(a.B.Hc((dqd(),Ypd))){b.a<=0&&(b.a=20);b.b<=0&&(b.b=20);}return b}
+ function jjb(a){Pib();var b,c;c=Ydb(a);b=Ydb(Udb(a,32));if(b!=0){return new bjb(c,b)}if(c>10||c<0){return new ajb(1,c)}return Lib[c]}
+ function Mdb(a,b){var c;if(Kdb(a)&&Kdb(b)){c=a%b;if(jxe=0){f=f.a[1];}else {e=f;f=f.a[0];}}return e}
+ function Qyb(a,b,c){var d,e,f;e=null;f=a.b;while(f){d=a.a.Ne(b,f.d);if(c&&d==0){return f}if(d<=0){f=f.a[0];}else {e=f;f=f.a[1];}}return e}
+ function rmc(a,b,c,d){var e,f,g;e=false;if(Lmc(a.f,c,d)){Omc(a.f,a.a[b][c],a.a[b][d]);f=a.a[b];g=f[d];f[d]=f[c];f[c]=g;e=true;}return e}
+ function Nqc(a,b,c){var d,e,f,g;e=RD(Wjb(a.b,c),183);d=0;for(g=new Anb(b.j);g.a>5;b&=31;e=a.d+c+(b==0?0:1);d=$C(kE,Pwe,28,e,15,1);rjb(d,a.a,c,b);f=new cjb(a.e,e,d);Rib(f);return f}
+ function zGc(a,b){var c,d,e;for(d=new is(Mr(a3b(a).a.Kc(),new ir));gs(d);){c=RD(hs(d),18);e=c.d.i;if(e.c==b){return false}}return true}
+ function _Ec(a,b,c){var d,e,f,g,h;g=a.k;h=b.k;d=c[g.g][h.g];e=UD(hFc(a,d));f=UD(hFc(b,d));return $wnd.Math.max((uFb(e),e),(uFb(f),f))}
+ function lA(){if(Error.stackTraceLimit>0){$wnd.Error.stackTraceLimit=Error.stackTraceLimit=64;return true}return 'stack' in new Error}
+ function sGb(a,b){return Zy(),Zy(),bz(pwe),($wnd.Math.abs(a-b)<=pwe||a==b||isNaN(a)&&isNaN(b)?0:ab?1:cz(isNaN(a),isNaN(b)))>0}
+ function uGb(a,b){return Zy(),Zy(),bz(pwe),($wnd.Math.abs(a-b)<=pwe||a==b||isNaN(a)&&isNaN(b)?0:ab?1:cz(isNaN(a),isNaN(b)))<0}
+ function tGb(a,b){return Zy(),Zy(),bz(pwe),($wnd.Math.abs(a-b)<=pwe||a==b||isNaN(a)&&isNaN(b)?0:ab?1:cz(isNaN(a),isNaN(b)))<=0}
+ function Efb(a,b){var c=0;while(!b[c]||b[c]==''){c++;}var d=b[c++];for(;c0&&this.b>0&&(this.g=Aad(this.c,this.b,this.a));}
+ function rC(f,a){var b=f.a;var c;a=String(a);b.hasOwnProperty(a)&&(c=b[a]);var d=(HC(),GC)[typeof c];var e=d?d(c):NC(typeof c);return e}
+ function uDd(a){var b,c,d;d=null;b=uIe in a.a;c=!b;if(c){throw Adb(new CDd('Every element must have an id.'))}d=tDd(qC(a,uIe));return d}
+ function Qqe(a){var b,c;c=Rqe(a);b=null;while(a.c==2){Mqe(a);if(!b){b=(Vse(),Vse(),new iue(2));hue(b,c);c=b;}c.Jm(Rqe(a));}return c}
+ function jOd(a,b){var c,d,e;a._j();d=b==null?0:tb(b);e=(d&lve)%a.d.length;c=WNd(a,e,d,b);if(c){hOd(a,c);return c.md()}else {return null}}
+ function Qib(a,b){if(a.e>b.e){return 1}if(a.eb.d){return a.e}if(a.d=48&&a<48+$wnd.Math.min(10,10)){return a-48}if(a>=97&&a<97){return a-97+10}if(a>=65&&a<65){return a-65+10}return -1}
+ function UHc(a,b){if(b.c==a){return b.d}else if(b.d==a){return b.c}throw Adb(new agb('Input edge is not connected to the input port.'))}
+ function Fae(a){if(mhb(FGe,a)){return Geb(),Feb}else if(mhb(GGe,a)){return Geb(),Eeb}else {throw Adb(new agb('Expecting true or false'))}}
+ function jFb(a){switch(typeof(a)){case jve:return ohb(a);case ive:return Nfb(a);case hve:return Jeb(a);default:return a==null?0:kFb(a);}}
+ function mfd(a,b){if(a.a<0){throw Adb(new dgb('Did not call before(...) or after(...) before calling add(...).'))}tfd(a,a.a,b);return a}
+ function FId(a){EId();if(ZD(a,162)){return RD(Wjb(CId,zK),295).Rg(a)}if(Ujb(CId,rb(a))){return RD(Wjb(CId,rb(a)),295).Rg(a)}return null}
+ function Wwd(a){var b,c;if((a.Db&32)==0){c=(b=RD(Ywd(a,16),29),AYd(!b?a.ii():b)-AYd(a.ii()));c!=0&&$wd(a,32,$C(jJ,rve,1,c,5,1));}return a}
+ function $wd(a,b,c){var d;if((a.Db&b)!=0){if(c==null){Zwd(a,b);}else {d=Xwd(a,b);d==-1?(a.Eb=c):bD(SD(a.Eb),d,c);}}else c!=null&&Twd(a,b,c);}
+ function tTc(a,b,c,d){var e,f;if(b.c.length==0){return}e=pTc(c,d);f=oTc(b);FDb(PDb(new SDb(null,new Swb(f,1)),new CTc),new GTc(a,c,e,d));}
+ function rmb(a,b){var c,d,e,f;d=a.a.length-1;c=b-a.b&d;f=a.c-b&d;e=a.c-a.b&d;zmb(c=f){umb(a,b);return -1}else {vmb(a,b);return 1}}
+ function Hvd(a){var b,c,d;d=a.Jh();if(!d){b=0;for(c=a.Ph();c;c=c.Ph()){if(++b>wxe){return c.Qh()}d=c.Jh();if(!!d||c==a){break}}}return d}
+ function Ue(a,b){var c;if(dE(b)===dE(a)){return true}if(!ZD(b,21)){return false}c=RD(b,21);if(c.gc()!=a.gc()){return false}return a.Ic(c)}
+ function kNc(a,b){if(a.eb.e){return 1}else if(a.fb.f){return 1}return tb(a)-tb(b)}
+ function mhb(a,b){uFb(a);if(b==null){return false}if(lhb(a,b)){return true}return a.length==b.length&&lhb(a.toLowerCase(),b.toLowerCase())}
+ function Hgb(a){var b,c;if(Ddb(a,-129)>0&&Ddb(a,128)<0){return Jgb(),b=Ydb(a)+128,c=Igb[b],!c&&(c=Igb[b]=new zgb(a)),c}return new zgb(a)}
+ function U$b(){U$b=geb;T$b=new V$b(LAe,0);R$b=new V$b('INSIDE_PORT_SIDE_GROUPS',1);Q$b=new V$b('GROUP_MODEL_ORDER',2);S$b=new V$b(MAe,3);}
+ function ufe(a){var b;a.b||vfe(a,(b=Hee(a.e,a.a),!b||!lhb(GGe,$Nd((!b.b&&(b.b=new SVd((JTd(),FTd),C8,b)),b.b),'qualified'))));return a.c}
+ function BA(a,b){var c,d;c=(BFb(b,a.length),a.charCodeAt(b));d=b+1;while(d2000){Oz=a;Pz=$wnd.setTimeout(Yz,10);}}if(Nz++==0){_z(($z(),Zz));return true}return false}
+ function lBb(a,b,c){var d;(bBb?(jBb(a),true):cBb?(SAb(),true):fBb?(SAb(),true):eBb&&(SAb(),false))&&(d=new aBb(b),d.b=c,hBb(a,d),undefined);}
+ function oNb(a,b){var c;c=!a.A.Hc((Qpd(),Ppd))||a.q==(Bod(),wod);a.u.Hc((Pod(),Lod))?c?mNb(a,b):qNb(a,b):a.u.Hc(Nod)&&(c?nNb(a,b):rNb(a,b));}
+ function Bed(a){var b;if(dE(Gxd(a,(umd(),Xkd)))===dE((Fnd(),Dnd))){if(!vCd(a)){Ixd(a,Xkd,End);}else {b=RD(Gxd(vCd(a),Xkd),346);Ixd(a,Xkd,b);}}}
+ function _fc(a){var b,c;if(nQb(a.d.i,(yCc(),tBc))){b=RD(mQb(a.c.i,tBc),17);c=RD(mQb(a.d.i,tBc),17);return hgb(b.a,c.a)>0}else {return false}}
+ function g_b(a,b,c){return new Uid($wnd.Math.min(a.a,b.a)-c/2,$wnd.Math.min(a.b,b.b)-c/2,$wnd.Math.abs(a.a-b.a)+c,$wnd.Math.abs(a.b-b.b)+c)}
+ function _mc(a){var b;this.d=new bnb;this.j=new pjd;this.g=new pjd;b=a.g.b;this.f=RD(mQb(Y2b(b),(yCc(),rAc)),88);this.e=Kfb(UD(k2b(b,ZBc)));}
+ function onc(a){this.d=new bnb;this.e=new gub;this.c=$C(kE,Pwe,28,(qpd(),cD(WC(E3,1),NAe,64,0,[opd,Yod,Xod,npd,ppd])).length,15,1);this.b=a;}
+ function $pc(a,b,c){var d;d=c[a.g][b];switch(a.g){case 1:case 3:return new rjd(0,d);case 2:case 4:return new rjd(d,0);default:return null;}}
+ function Ced(b,c,d){var e,f;f=RD(ltd(c.f),205);try{f.rf(b,d);mtd(c.f,f);}catch(a){a=zdb(a);if(ZD(a,103)){e=a;throw Adb(e)}else throw Adb(a)}}
+ function tEd(a,b,c){var d,e,f,g,h,i;d=null;h=vgd(ygd(),b);f=null;if(h){e=null;i=zhd(h,c);g=null;i!=null&&(g=a.qf(h,i));e=g;f=e;}d=f;return d}
+ function sSd(a,b,c,d){var e;e=a.length;if(b>=e)return e;for(b=b>0?b:0;bd&&bD(b,d,null);return b}
+ function lob(a,b){var c,d;d=a.a.length;b.lengthd&&bD(b,d,null);return b}
+ function Bde(a,b){var c,d;++a.j;if(b!=null){c=(d=a.a.Cb,ZD(d,99)?RD(d,99).th():null);if(Jnb(b,c)){$wd(a.a,4,c);return}}$wd(a.a,4,RD(b,129));}
+ function mne(a){var b;if(a==null)return null;b=Hqe(nue(a,true));if(b==null){throw Adb(new Mle("Invalid hexBinary value: '"+a+"'"))}return b}
+ function wA(a,b,c){var d;if(b.a.length>0){Rmb(a.b,new kB(b.a,c));d=b.a.length;0d&&(b.a+=Hhb($C(hE,zwe,28,-d,15,1)));}}
+ function yIb(a,b,c){var d,e,f;if(c[b.d]){return}c[b.d]=true;for(e=new Anb(CIb(b));e.a=a.b>>1){d=a.c;for(c=a.b;c>b;--c){d=d.b;}}else {d=a.a.a;for(c=0;c=0?a.Wh(e):Rvd(a,d)):c<0?Rvd(a,d):RD(d,69).wk().Bk(a,a.hi(),c)}
+ function Fxd(a){var b,c,d;d=(!a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),a.o);for(c=d.c.Kc();c.e!=c.i.gc();){b=RD(c.Yj(),44);b.md();}return dOd(d)}
+ function iGd(a){var b;if(ZD(a.a,4)){b=FId(a.a);if(b==null){throw Adb(new dgb(HGe+a.b+"'. "+DGe+(lfb(b6),b6.k)+EGe))}return b}else {return a.a}}
+ function iSd(a,b){var c,d;if(a.j.length!=b.j.length)return false;for(c=0,d=a.j.length;c=64&&b<128&&(e=Rdb(e,Sdb(1,b-64)));}return e}
+ function k2b(a,b){var c,d;d=null;if(nQb(a,(umd(),amd))){c=RD(mQb(a,amd),96);c.pf(b)&&(d=c.of(b));}d==null&&!!Y2b(a)&&(d=mQb(Y2b(a),b));return d}
+ function i0b(a,b){var c;c=RD(mQb(a,(yCc(),RAc)),75);if(br(b,f0b)){if(!c){c=new Ejd;pQb(a,RAc,c);}else {Xub(c);}}else !!c&&pQb(a,RAc,null);return c}
+ function tSb(){tSb=geb;sSb=(umd(),Yld);mSb=Ukd;hSb=Dkd;nSb=tld;qSb=(YHb(),UHb);pSb=SHb;rSb=WHb;oSb=RHb;jSb=(eSb(),aSb);iSb=_Rb;kSb=cSb;lSb=dSb;}
+ function PZb(a){NZb();this.c=new bnb;this.d=a;switch(a.g){case 0:case 2:this.a=Fob(MZb);this.b=oxe;break;case 3:case 1:this.a=MZb;this.b=pxe;}}
+ function c9b(a){var b;if(!Cod(RD(mQb(a,(yCc(),BBc)),101))){return}b=a.b;d9b((tFb(0,b.c.length),RD(b.c[0],30)));d9b(RD(Vmb(b,b.c.length-1),30));}
+ function ohc(a,b){b.Ug('Self-Loop post-processing',1);FDb(CDb(CDb(EDb(new SDb(null,new Swb(a.b,16)),new uhc),new whc),new yhc),new Ahc);b.Vg();}
+ function xrd(a,b,c){var d,e;if(a.c){Dyd(a.c,a.c.i+b);Eyd(a.c,a.c.j+c);}else {for(e=new Anb(a.b);e.a=0&&(c.d=a.t);break;case 3:a.t>=0&&(c.a=a.t);}if(a.C){c.b=a.C.b;c.c=a.C.c;}}
+ function JDc(){JDc=geb;IDc=new LDc(mEe,0);FDc=new LDc(BBe,1);GDc=new LDc('LINEAR_SEGMENTS',2);EDc=new LDc('BRANDES_KOEPF',3);HDc=new LDc(lEe,4);}
+ function IRb(){IRb=geb;FRb=new JRb(_ye,0);ERb=new JRb(aze,1);GRb=new JRb(bze,2);HRb=new JRb(cze,3);FRb.a=false;ERb.a=true;GRb.a=false;HRb.a=true;}
+ function IPb(){IPb=geb;FPb=new JPb(_ye,0);EPb=new JPb(aze,1);GPb=new JPb(bze,2);HPb=new JPb(cze,3);FPb.a=false;EPb.a=true;GPb.a=false;HPb.a=true;}
+ function Ivd(a,b,c,d){var e;if(c>=0){return a.Sh(b,c,d)}else {!!a.Ph()&&(d=(e=a.Fh(),e>=0?a.Ah(d):a.Ph().Th(a,-1-e,null,d)));return a.Ch(b,c,d)}}
+ function Zyd(a,b){switch(b){case 7:!a.e&&(a.e=new Yie(G4,a,7,4));sLd(a.e);return;case 8:!a.d&&(a.d=new Yie(G4,a,8,5));sLd(a.d);return;}yyd(a,b);}
+ function Ixd(a,b,c){c==null?(!a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),jOd(a.o,b)):(!a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),fOd(a.o,b,c));return a}
+ function Aob(a,b){yob();var c,d,e,f;c=a;f=b;if(ZD(a,21)&&!ZD(b,21)){c=b;f=a;}for(e=c.Kc();e.Ob();){d=e.Pb();if(f.Hc(d)){return false}}return true}
+ function qTc(a,b,c,d){if(b.ac.b){return true}}}return false}
+ function QD(a,b){if(bE(a)){return !!PD[b]}else if(a.Sm){return !!a.Sm[b]}else if(_D(a)){return !!OD[b]}else if($D(a)){return !!ND[b]}return false}
+ function udc(a){var b;b=a.a;do{b=RD(hs(new is(Mr(Z2b(b).a.Kc(),new ir))),18).c.i;b.k==(r3b(),o3b)&&a.b.Fc(b);}while(b.k==(r3b(),o3b));a.b=hv(a.b);}
+ function UGc(a,b){var c,d,e;e=a;for(d=new is(Mr(Z2b(b).a.Kc(),new ir));gs(d);){c=RD(hs(d),18);!!c.c.i.c&&(e=$wnd.Math.max(e,c.c.i.c.p));}return e}
+ function INb(a,b){var c,d,e;e=0;d=RD(RD(Qc(a.r,b),21),87).Kc();while(d.Ob()){c=RD(d.Pb(),117);e+=c.d.d+c.b.Mf().b+c.d.a;d.Ob()&&(e+=a.w);}return e}
+ function AMb(a,b){var c,d,e;e=0;d=RD(RD(Qc(a.r,b),21),87).Kc();while(d.Ob()){c=RD(d.Pb(),117);e+=c.d.b+c.b.Mf().a+c.d.c;d.Ob()&&(e+=a.w);}return e}
+ function O2c(a){var b,c,d,e;d=0;e=Q2c(a);if(e.c.length==0){return 1}else {for(c=new Anb(e);c.a=0?a.Lh(g,c,true):Qvd(a,f,c)):RD(f,69).wk().yk(a,a.hi(),e,c,d)}
+ function aNb(a,b,c,d){var e,f;f=b.pf((umd(),ild))?RD(b.of(ild),21):a.j;e=lMb(f);if(e==(hMb(),gMb)){return}if(c&&!jMb(e)){return}LKb(cNb(a,e,d),b);}
+ function Y6b(a){switch(a.g){case 1:return mOb(),lOb;case 3:return mOb(),iOb;case 2:return mOb(),kOb;case 4:return mOb(),jOb;default:return null;}}
+ function kmc(a,b,c){if(a.e){switch(a.b){case 1:Ulc(a.c,b,c);break;case 0:Vlc(a.c,b,c);}}else {Slc(a.c,b,c);}a.a[b.p][c.p]=a.c.i;a.a[c.p][b.p]=a.c.e;}
+ function LLc(a){var b,c;if(a==null){return null}c=$C(jR,Nve,199,a.length,0,2);for(b=0;b=0)return e;if(a.ol()){for(d=0;d=e)throw Adb(new aMd(b,e));if(a.Si()){d=a.dd(c);if(d>=0&&d!=b){throw Adb(new agb(LIe))}}return a.Xi(b,c)}
+ function wx(a,b){this.a=RD(Qb(a),253);this.b=RD(Qb(b),253);if(a.Ed(b)>0||a==(Wk(),Vk)||b==(kl(),jl)){throw Adb(new agb('Invalid range: '+Dx(a,b)))}}
+ function p_b(a){var b,c;this.b=new bnb;this.c=a;this.a=false;for(c=new Anb(a.a);c.a0);if((b&-b)==b){return eE(b*Kwb(a,31)*4.6566128730773926E-10)}do{c=Kwb(a,31);d=c%b;}while(c-d+(b-1)<0);return eE(d)}
+ function d2b(a,b,c){switch(c.g){case 1:a.a=b.a/2;a.b=0;break;case 2:a.a=b.a;a.b=b.b/2;break;case 3:a.a=b.a/2;a.b=b.b;break;case 4:a.a=0;a.b=b.b/2;}}
+ function Onc(a,b,c,d){var e,f;for(e=b;e1&&(f=xIb(a,b));return f}
+ function yqd(a){var b;b=Kfb(UD(Gxd(a,(umd(),lmd))))*$wnd.Math.sqrt((!a.a&&(a.a=new C5d(J4,a,10,11)),a.a).i);return new rjd(b,b/Kfb(UD(Gxd(a,kmd))))}
+ function Dzd(a){var b;if(!!a.f&&a.f.Vh()){b=RD(a.f,54);a.f=RD(Vvd(a,b),84);a.f!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,9,8,b,a.f));}return a.f}
+ function Ezd(a){var b;if(!!a.i&&a.i.Vh()){b=RD(a.i,54);a.i=RD(Vvd(a,b),84);a.i!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,9,7,b,a.i));}return a.i}
+ function Z5d(a){var b;if(!!a.b&&(a.b.Db&64)!=0){b=a.b;a.b=RD(Vvd(a,b),19);a.b!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,9,21,b,a.b));}return a.b}
+ function UNd(a,b){var c,d,e;if(a.d==null){++a.e;++a.f;}else {d=b.Bi();_Nd(a,a.f+1);e=(d&lve)%a.d.length;c=a.d[e];!c&&(c=a.d[e]=a.dk());c.Fc(b);++a.f;}}
+ function Mge(a,b,c){var d;if(b.tk()){return false}else if(b.Ik()!=-2){d=b.ik();return d==null?c==null:pb(d,c)}else return b.qk()==a.e.Dh()&&c==null}
+ function Io(){var a;dk(16,fwe);a=Wp(16);this.b=$C(XF,ewe,303,a,0,1);this.c=$C(XF,ewe,303,a,0,1);this.a=null;this.e=null;this.i=0;this.f=a-1;this.g=0;}
+ function j3b(a){v2b.call(this);this.k=(r3b(),p3b);this.j=(dk(6,iwe),new cnb(6));this.b=(dk(2,iwe),new cnb(2));this.d=new T2b;this.f=new C3b;this.a=a;}
+ function wgc(a){var b,c;if(a.c.length<=1){return}b=tgc(a,(qpd(),npd));vgc(a,RD(b.a,17).a,RD(b.b,17).a);c=tgc(a,ppd);vgc(a,RD(c.a,17).a,RD(c.b,17).a);}
+ function vHc(a,b,c){var d,e;e=a.a.b;for(d=e.c.length;d102)return -1;if(a<=57)return a-48;if(a<65)return -1;if(a<=70)return a-65+10;if(a<97)return -1;return a-97+10}
+ function ck(a,b){if(a==null){throw Adb(new Ogb('null key in entry: null='+b))}else if(b==null){throw Adb(new Ogb('null value in entry: '+a+'=null'))}}
+ function Cr(a,b){var c,d;while(a.Ob()){if(!b.Ob()){return false}c=a.Pb();d=b.Pb();if(!(dE(c)===dE(d)||c!=null&&pb(c,d))){return false}}return !b.Ob()}
+ function aLb(a,b){var c;c=cD(WC(iE,1),vxe,28,15,[gKb(a.a[0],b),gKb(a.a[1],b),gKb(a.a[2],b)]);if(a.d){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0];}return c}
+ function bLb(a,b){var c;c=cD(WC(iE,1),vxe,28,15,[hKb(a.a[0],b),hKb(a.a[1],b),hKb(a.a[2],b)]);if(a.d){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0];}return c}
+ function vIc(a,b,c){if(!Cod(RD(mQb(b,(yCc(),BBc)),101))){uIc(a,b,e3b(b,c));uIc(a,b,e3b(b,(qpd(),npd)));uIc(a,b,e3b(b,Yod));yob();_mb(b.j,new JIc(a));}}
+ function sUc(a){var b,c;a.c||vUc(a);c=new Ejd;b=new Anb(a.a);ynb(b);while(b.a0&&(BFb(0,b.length),b.charCodeAt(0)==43)?(BFb(1,b.length+1),b.substr(1)):b))}
+ function qne(a){var b;return a==null?null:new ejb((b=nue(a,true),b.length>0&&(BFb(0,b.length),b.charCodeAt(0)==43)?(BFb(1,b.length+1),b.substr(1)):b))}
+ function Syb(a,b,c,d,e,f,g,h){var i,j;if(!d){return}i=d.a[0];!!i&&Syb(a,b,c,i,e,f,g,h);Tyb(a,c,d.d,e,f,g,h)&&b.Fc(d);j=d.a[1];!!j&&Syb(a,b,c,j,e,f,g,h);}
+ function PPb(b,c,d){try{return Gdb(SPb(b,c,d),1)}catch(a){a=zdb(a);if(ZD(a,333)){throw Adb(new veb(fze+b.o+'*'+b.p+gze+c+pve+d+hze))}else throw Adb(a)}}
+ function QPb(b,c,d){try{return Gdb(SPb(b,c,d),0)}catch(a){a=zdb(a);if(ZD(a,333)){throw Adb(new veb(fze+b.o+'*'+b.p+gze+c+pve+d+hze))}else throw Adb(a)}}
+ function RPb(b,c,d){try{return Gdb(SPb(b,c,d),2)}catch(a){a=zdb(a);if(ZD(a,333)){throw Adb(new veb(fze+b.o+'*'+b.p+gze+c+pve+d+hze))}else throw Adb(a)}}
+ function lMd(b,c){if(b.g==-1){throw Adb(new cgb)}b.Xj();try{b.d.hd(b.g,c);b.f=b.d.j;}catch(a){a=zdb(a);if(ZD(a,77)){throw Adb(new Jrb)}else throw Adb(a)}}
+ function Y7b(a){var b,c,d,e,f;for(d=new Anb(a.b);d.af&&bD(b,f,null);return b}
+ function av(a,b){var c,d;d=a.gc();if(b==null){for(c=0;c0&&(i+=e);j[k]=g;g+=h*(i+d);}}
+ function vsc(a){var b,c,d;d=a.f;a.n=$C(iE,vxe,28,d,15,1);a.d=$C(iE,vxe,28,d,15,1);for(b=0;b0?a.c:0);++e;}a.b=d;a.d=f;}
+ function rKb(a,b){var c;c=cD(WC(iE,1),vxe,28,15,[qKb(a,(ZJb(),WJb),b),qKb(a,XJb,b),qKb(a,YJb,b)]);if(a.f){c[0]=$wnd.Math.max(c[0],c[2]);c[2]=c[0];}return c}
+ function cQb(b,c,d){var e;try{TPb(b,c+b.j,d+b.k,false,true);}catch(a){a=zdb(a);if(ZD(a,77)){e=a;throw Adb(new veb(e.g+ize+c+pve+d+').'))}else throw Adb(a)}}
+ function dQb(b,c,d){var e;try{TPb(b,c+b.j,d+b.k,true,false);}catch(a){a=zdb(a);if(ZD(a,77)){e=a;throw Adb(new veb(e.g+ize+c+pve+d+').'))}else throw Adb(a)}}
+ function u8b(a){var b;if(!nQb(a,(yCc(),dBc))){return}b=RD(mQb(a,dBc),21);if(b.Hc((dod(),Xnd))){b.Mc(Xnd);b.Fc(Znd);}else if(b.Hc(Znd)){b.Mc(Znd);b.Fc(Xnd);}}
+ function v8b(a){var b;if(!nQb(a,(yCc(),dBc))){return}b=RD(mQb(a,dBc),21);if(b.Hc((dod(),cod))){b.Mc(cod);b.Fc(aod);}else if(b.Hc(aod)){b.Mc(aod);b.Fc(cod);}}
+ function oqc(a,b,c,d){var e,f,g,h;a.a==null&&rqc(a,b);g=b.b.j.c.length;f=c.d.p;h=d.d.p;e=h-1;e<0&&(e=g-1);return f<=e?a.a[e]-a.a[f]:a.a[g-1]-a.a[f]+a.a[e]}
+ function Cud(a){var b,c;if(!a.b){a.b=fv(RD(a.f,27).kh().i);for(c=new dMd(RD(a.f,27).kh());c.e!=c.i.gc();){b=RD(bMd(c),135);Rmb(a.b,new Bud(b));}}return a.b}
+ function Dud(a){var b,c;if(!a.e){a.e=fv(wCd(RD(a.f,27)).i);for(c=new dMd(wCd(RD(a.f,27)));c.e!=c.i.gc();){b=RD(bMd(c),123);Rmb(a.e,new Rud(b));}}return a.e}
+ function yud(a){var b,c;if(!a.a){a.a=fv(tCd(RD(a.f,27)).i);for(c=new dMd(tCd(RD(a.f,27)));c.e!=c.i.gc();){b=RD(bMd(c),27);Rmb(a.a,new Fud(a,b));}}return a.a}
+ function DXd(b){var c;if(!b.C&&(b.D!=null||b.B!=null)){c=EXd(b);if(c){b.hl(c);}else {try{b.hl(null);}catch(a){a=zdb(a);if(!ZD(a,63))throw Adb(a)}}}return b.C}
+ function xMb(a){switch(a.q.g){case 5:uMb(a,(qpd(),Yod));uMb(a,npd);break;case 4:vMb(a,(qpd(),Yod));vMb(a,npd);break;default:wMb(a,(qpd(),Yod));wMb(a,npd);}}
+ function GNb(a){switch(a.q.g){case 5:DNb(a,(qpd(),Xod));DNb(a,ppd);break;case 4:ENb(a,(qpd(),Xod));ENb(a,ppd);break;default:FNb(a,(qpd(),Xod));FNb(a,ppd);}}
+ function G$b(a,b){var c,d,e;e=new pjd;for(d=a.Kc();d.Ob();){c=RD(d.Pb(),36);w$b(c,e.a,0);e.a+=c.f.a+b;e.b=$wnd.Math.max(e.b,c.f.b);}e.b>0&&(e.b+=b);return e}
+ function I$b(a,b){var c,d,e;e=new pjd;for(d=a.Kc();d.Ob();){c=RD(d.Pb(),36);w$b(c,0,e.b);e.b+=c.f.b+b;e.a=$wnd.Math.max(e.a,c.f.a);}e.a>0&&(e.a+=b);return e}
+ function l2b(a){var b,c,d;d=lve;for(c=new Anb(a.a);c.a>16==6){return a.Cb.Th(a,5,t7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?a.ii():c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function kA(a){fA();var b=a.e;if(b&&b.stack){var c=b.stack;var d=b+'\n';c.substring(0,d.length)==d&&(c=c.substring(d.length));return c.split('\n')}return []}
+ function pgb(a){var b;b=(wgb(),vgb);return b[a>>>28]|b[a>>24&15]<<4|b[a>>20&15]<<8|b[a>>16&15]<<12|b[a>>12&15]<<16|b[a>>8&15]<<20|b[a>>4&15]<<24|b[a&15]<<28}
+ function mmb(a){var b,c,d;if(a.b!=a.c){return}d=a.a.length;c=mgb($wnd.Math.max(8,d))<<1;if(a.b!=0){b=WEb(a.a,c);lmb(a,b,d);a.a=b;a.b=0;}else {aFb(a.a,c);}a.c=d;}
+ function uNb(a,b){var c;c=a.b;return c.pf((umd(),Gld))?c.ag()==(qpd(),ppd)?-c.Mf().a-Kfb(UD(c.of(Gld))):b+Kfb(UD(c.of(Gld))):c.ag()==(qpd(),ppd)?-c.Mf().a:b}
+ function X2b(a){var b;if(a.b.c.length!=0&&!!RD(Vmb(a.b,0),72).a){return RD(Vmb(a.b,0),72).a}b=R0b(a);if(b!=null){return b}return ''+(!a.c?-1:Wmb(a.c.a,a,0))}
+ function M3b(a){var b;if(a.f.c.length!=0&&!!RD(Vmb(a.f,0),72).a){return RD(Vmb(a.f,0),72).a}b=R0b(a);if(b!=null){return b}return ''+(!a.i?-1:Wmb(a.i.j,a,0))}
+ function skc(a,b){var c,d;if(b<0||b>=a.gc()){return null}for(c=b;c0?a.c:0);e=$wnd.Math.max(e,b.d);++d;}a.e=f;a.b=e;}
+ function Qud(a){var b,c;if(!a.b){a.b=fv(RD(a.f,123).kh().i);for(c=new dMd(RD(a.f,123).kh());c.e!=c.i.gc();){b=RD(bMd(c),135);Rmb(a.b,new Bud(b));}}return a.b}
+ function aHd(a,b){var c,d,e;if(b.dc()){return jQd(),jQd(),iQd}else {c=new ZLd(a,b.gc());for(e=new dMd(a);e.e!=e.i.gc();){d=bMd(e);b.Hc(d)&&WGd(c,d);}return c}}
+ function Axd(a,b,c,d){if(b==0){return d?(!a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),a.o):(!a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),dOd(a.o))}return Dvd(a,b,c,d)}
+ function rBd(a){var b,c;if(a.rb){for(b=0,c=a.rb.i;b>22);e+=d>>22;if(e<0){return false}a.l=c&dxe;a.m=d&dxe;a.h=e&exe;return true}
+ function Tyb(a,b,c,d,e,f,g){var h,i;if(b.Te()&&(i=a.a.Ne(c,d),i<0||!e&&i==0)){return false}if(b.Ue()&&(h=a.a.Ne(c,f),h>0||!g&&h==0)){return false}return true}
+ function Agc(a,b){sgc();var c;c=a.j.g-b.j.g;if(c!=0){return 0}switch(a.j.g){case 2:return Cgc(b,rgc)-Cgc(a,rgc);case 4:return Cgc(a,qgc)-Cgc(b,qgc);}return 0}
+ function uuc(a){switch(a.g){case 0:return nuc;case 1:return ouc;case 2:return puc;case 3:return quc;case 4:return ruc;case 5:return suc;default:return null;}}
+ function cBd(a,b,c){var d,e;d=(e=new R5d,YVd(e,b),PAd(e,c),WGd((!a.c&&(a.c=new C5d(u7,a,12,10)),a.c),e),e);$Vd(d,0);bWd(d,1);aWd(d,true);_Vd(d,true);return d}
+ function THd(a,b){var c,d;if(b>=a.i)throw Adb(new yNd(b,a.i));++a.j;c=a.g[b];d=a.i-b-1;d>0&&hib(a.g,b+1,a.g,b,d);bD(a.g,--a.i,null);a.Qi(b,c);a.Ni();return c}
+ function sWd(a,b){var c,d;if(a.Db>>16==17){return a.Cb.Th(a,21,h7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?a.ii():c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function _Fb(a){var b,c,d,e;yob();_mb(a.c,a.a);for(e=new Anb(a.c);e.ac.a.c.length)){throw Adb(new agb('index must be >= 0 and <= layer node count'))}!!a.c&&Ymb(a.c.a,a);a.c=c;!!c&&Qmb(c.a,b,a);}
+ function Gac(a,b){var c,d,e;for(d=new is(Mr(W2b(a).a.Kc(),new ir));gs(d);){c=RD(hs(d),18);e=RD(b.Kb(c),10);return new cc(Qb(e.n.b+e.o.b/2))}return wb(),wb(),vb}
+ function RQc(a,b){this.c=new Tsb;this.a=a;this.b=b;this.d=RD(mQb(a,(Ywc(),Qwc)),312);dE(mQb(a,(yCc(),eBc)))===dE((Cuc(),Auc))?(this.e=new BRc):(this.e=new uRc);}
+ function ftd(a,b){var c,d;d=null;if(a.pf((umd(),amd))){c=RD(a.of(amd),96);c.pf(b)&&(d=c.of(b));}d==null&&!!a.Tf()&&(d=a.Tf().of(b));d==null&&(d=iGd(b));return d}
+ function ku(b,c){var d,e;d=b.fd(c);try{e=d.Pb();d.Qb();return e}catch(a){a=zdb(a);if(ZD(a,112)){throw Adb(new veb("Can't remove element "+c))}else throw Adb(a)}}
+ function GA(a,b){var c,d,e;d=new uB;e=new vB(d.q.getFullYear()-Owe,d.q.getMonth(),d.q.getDate());c=FA(a,b,e);if(c==0||c0?b:0);++c;}return new rjd(d,e)}
+ function Czd(a,b){var c,d;if(a.Db>>16==6){return a.Cb.Th(a,6,G4,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(pvd(),hvd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function cCd(a,b){var c,d;if(a.Db>>16==7){return a.Cb.Th(a,1,H4,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(pvd(),jvd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function LCd(a,b){var c,d;if(a.Db>>16==9){return a.Cb.Th(a,9,J4,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(pvd(),lvd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function M1d(a,b){var c,d;if(a.Db>>16==5){return a.Cb.Th(a,9,m7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(JTd(),tTd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function qBd(a,b){var c,d;if(a.Db>>16==7){return a.Cb.Th(a,6,t7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(JTd(),CTd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function iVd(a,b){var c,d;if(a.Db>>16==3){return a.Cb.Th(a,0,p7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(JTd(),mTd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function IEd(){this.a=new BDd;this.g=new Io;this.j=new Io;this.b=new Tsb;this.d=new Io;this.i=new Io;this.k=new Tsb;this.c=new Tsb;this.e=new Tsb;this.f=new Tsb;}
+ function kQd(a,b,c){var d,e,f;c<0&&(c=0);f=a.i;for(e=c;ewxe){return Oje(a,d)}if(d==a){return true}}}return false}
+ function yNb(a){tNb();switch(a.q.g){case 5:vNb(a,(qpd(),Yod));vNb(a,npd);break;case 4:wNb(a,(qpd(),Yod));wNb(a,npd);break;default:xNb(a,(qpd(),Yod));xNb(a,npd);}}
+ function CNb(a){tNb();switch(a.q.g){case 5:zNb(a,(qpd(),Xod));zNb(a,ppd);break;case 4:ANb(a,(qpd(),Xod));ANb(a,ppd);break;default:BNb(a,(qpd(),Xod));BNb(a,ppd);}}
+ function RTb(a){var b,c;b=RD(mQb(a,(yVb(),mVb)),17);if(b){c=b.a;c==0?pQb(a,(JVb(),IVb),new Owb):pQb(a,(JVb(),IVb),new Pwb(c));}else {pQb(a,(JVb(),IVb),new Pwb(1));}}
+ function b2b(a,b){var c;c=a.i;switch(b.g){case 1:return -(a.n.b+a.o.b);case 2:return a.n.a-c.o.a;case 3:return a.n.b-c.o.b;case 4:return -(a.n.a+a.o.a);}return 0}
+ function wec(a,b){switch(a.g){case 0:return b==(cxc(),$wc)?sec:tec;case 1:return b==(cxc(),$wc)?sec:rec;case 2:return b==(cxc(),$wc)?rec:tec;default:return rec;}}
+ function Fad(a,b){var c,d,e;Ymb(a.a,b);a.e-=b.r+(a.a.c.length==0?0:a.c);e=fFe;for(d=new Anb(a.a);d.a>16==3){return a.Cb.Th(a,12,J4,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(pvd(),gvd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function sCd(a,b){var c,d;if(a.Db>>16==11){return a.Cb.Th(a,10,J4,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(pvd(),kvd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function n4d(a,b){var c,d;if(a.Db>>16==10){return a.Cb.Th(a,11,h7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(JTd(),ATd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function Q5d(a,b){var c,d;if(a.Db>>16==10){return a.Cb.Th(a,12,s7,b)}return d=Z5d(RD(vYd((c=RD(Ywd(a,16),29),!c?(JTd(),DTd):c),a.Db>>16),19)),a.Cb.Th(a,d.n,d.f,b)}
+ function WVd(a){var b;if((a.Bb&1)==0&&!!a.r&&a.r.Vh()){b=RD(a.r,54);a.r=RD(Vvd(a,b),142);a.r!=b&&(a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,9,8,b,a.r));}return a.r}
+ function pKb(a,b,c){var d;d=cD(WC(iE,1),vxe,28,15,[sKb(a,(ZJb(),WJb),b,c),sKb(a,XJb,b,c),sKb(a,YJb,b,c)]);if(a.f){d[0]=$wnd.Math.max(d[0],d[2]);d[2]=d[0];}return d}
+ function ddc(a,b){var c,d,e;e=kdc(a,b);if(e.c.length==0){return}_mb(e,new Gdc);c=e.c.length;for(d=0;d>19;j=b.h>>19;if(i!=j){return j-i}e=a.h;h=b.h;if(e!=h){return e-h}d=a.m;g=b.m;if(d!=g){return d-g}c=a.l;f=b.l;return c-f}
+ function YHb(){YHb=geb;XHb=(iIb(),fIb);WHb=new lGd(Aye,XHb);VHb=(LHb(),KHb);UHb=new lGd(Bye,VHb);THb=(DHb(),CHb);SHb=new lGd(Cye,THb);RHb=new lGd(Dye,(Geb(),true));}
+ function Iic(a,b,c){var d,e;d=b*c;if(ZD(a.g,154)){e=$jc(a);if(e.f.d){e.f.a||(a.d.a+=d+Tye);}else {a.d.d-=d+Tye;a.d.a+=d+Tye;}}else if(ZD(a.g,10)){a.d.d-=d;a.d.a+=2*d;}}
+ function _pc(a,b,c){var d,e,f,g,h;e=a[c.g];for(h=new Anb(b.d);h.a0?a.b:0);++c;}b.b=d;b.e=e;}
+ function Fo(a){var b,c,d;d=a.b;if(Xp(a.i,d.length)){c=d.length*2;a.b=$C(XF,ewe,303,c,0,1);a.c=$C(XF,ewe,303,c,0,1);a.f=c-1;a.i=0;for(b=a.a;b;b=b.c){Bo(a,b,b);}++a.g;}}
+ function VPb(a,b,c,d){var e,f,g,h;for(e=0;eg&&(h=g/d);e>f&&(i=f/e);ijd(a,$wnd.Math.min(h,i));return a}
+ function OAd(){qAd();var b,c;try{c=RD(M5d((YSd(),XSd),$He),2113);if(c){return c}}catch(a){a=zdb(a);if(ZD(a,103)){b=a;UId((Hde(),b));}else throw Adb(a)}return new KAd}
+ function Qae(){qAd();var b,c;try{c=RD(M5d((YSd(),XSd),AKe),2040);if(c){return c}}catch(a){a=zdb(a);if(ZD(a,103)){b=a;UId((Hde(),b));}else throw Adb(a)}return new Mae}
+ function vne(){Zme();var b,c;try{c=RD(M5d((YSd(),XSd),dLe),2122);if(c){return c}}catch(a){a=zdb(a);if(ZD(a,103)){b=a;UId((Hde(),b));}else throw Adb(a)}return new rne}
+ function f2d(a,b,c){var d,e;e=a.e;a.e=b;if((a.Db&4)!=0&&(a.Db&1)==0){d=new N3d(a,1,4,e,b);!c?(c=d):c.nj(d);}e!=b&&(b?(c=o2d(a,k2d(a,b),c)):(c=o2d(a,a.a,c)));return c}
+ function DB(){uB.call(this);this.e=-1;this.a=false;this.p=qwe;this.k=-1;this.c=-1;this.b=-1;this.g=false;this.f=-1;this.j=-1;this.n=-1;this.i=-1;this.d=-1;this.o=qwe;}
+ function hHb(a,b){var c,d,e;d=a.b.d.d;a.a||(d+=a.b.d.a);e=b.b.d.d;b.a||(e+=b.b.d.a);c=Qfb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c}
+ function XQb(a,b){var c,d,e;d=a.b.b.d;a.a||(d+=a.b.b.a);e=b.b.b.d;b.a||(e+=b.b.b.a);c=Qfb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c}
+ function RYb(a,b){var c,d,e;d=a.b.g.d;a.a||(d+=a.b.g.a);e=b.b.g.d;b.a||(e+=b.b.g.a);c=Qfb(d,e);if(c==0){if(!a.a&&b.a){return -1}else if(!b.a&&a.a){return 1}}return c}
+ function _Wb(){_Wb=geb;YWb=nfd(pfd(pfd(pfd(new ufd,(sXb(),qXb),(hcc(),Dbc)),qXb,Hbc),rXb,Obc),rXb,rbc);$Wb=pfd(pfd(new ufd,qXb,hbc),qXb,sbc);ZWb=nfd(new ufd,rXb,ubc);}
+ function J6b(a){var b,c,d,e,f;b=RD(mQb(a,(Ywc(),cwc)),85);f=a.n;for(d=b.Cc().Kc();d.Ob();){c=RD(d.Pb(),314);e=c.i;e.c+=f.a;e.d+=f.b;c.c?MKb(c):OKb(c);}pQb(a,cwc,null);}
+ function Wpc(a,b,c){var d,e;e=a.b;d=e.d;switch(b.g){case 1:return -d.d-c;case 2:return e.o.a+d.c+c;case 3:return e.o.b+d.a+c;case 4:return -d.b-c;default:return -1;}}
+ function CNc(a,b,c){var d,e;c.Ug('Interactive node placement',1);a.a=RD(mQb(b,(Ywc(),Qwc)),312);for(e=new Anb(b.b);e.a0){g=(f&lve)%a.d.length;e=WNd(a,g,f,b);if(e){h=e.nd(c);return h}}d=a.ck(f,b,c);a.c.Fc(d);return null}
+ function Tee(a,b){var c,d,e,f;switch(Oee(a,b).Kl()){case 3:case 2:{c=mYd(b);for(e=0,f=c.i;e=0;d--){if(lhb(a[d].d,b)||lhb(a[d].d,c)){a.length>=d+1&&a.splice(0,d+1);break}}return a}
+ function Fdb(a,b){var c;if(Kdb(a)&&Kdb(b)){c=a/b;if(jxe0){a.b+=2;a.a+=d;}}else {a.b+=1;a.a+=$wnd.Math.min(d,e);}}
+ function CVc(a){var b;b=RD(mQb(RD(ju(a.b,0),40),(h_c(),T$c)),107);pQb(a,(q$c(),SZc),new rjd(0,0));FVc(new YWc,a,b.b+b.c-Kfb(UD(mQb(a,ZZc))),b.d+b.a-Kfb(UD(mQb(a,_Zc))));}
+ function pDd(a,b){var c,d;d=false;if(bE(b)){d=true;oDd(a,new OC(WD(b)));}if(!d){if(ZD(b,242)){d=true;oDd(a,(c=Qeb(RD(b,242)),new hC(c)));}}if(!d){throw Adb(new Aeb(tIe))}}
+ function g$d(a,b,c,d){var e,f,g;e=new P3d(a.e,1,10,(g=b.c,ZD(g,90)?RD(g,29):(JTd(),zTd)),(f=c.c,ZD(f,90)?RD(f,29):(JTd(),zTd)),fZd(a,b),false);!d?(d=e):d.nj(e);return d}
+ function _2b(a){var b,c;switch(RD(mQb(Y2b(a),(yCc(),QAc)),429).g){case 0:b=a.n;c=a.o;return new rjd(b.a+c.a/2,b.b+c.b/2);case 1:return new sjd(a.n);default:return null;}}
+ function Ouc(){Ouc=geb;Luc=new Puc(LAe,0);Kuc=new Puc('LEFTUP',1);Nuc=new Puc('RIGHTUP',2);Juc=new Puc('LEFTDOWN',3);Muc=new Puc('RIGHTDOWN',4);Iuc=new Puc('BALANCED',5);}
+ function dKc(a,b,c){var d,e,f;d=Qfb(a.a[b.p],a.a[c.p]);if(d==0){e=RD(mQb(b,(Ywc(),qwc)),15);f=RD(mQb(c,qwc),15);if(e.Hc(c)){return -1}else if(f.Hc(b)){return 1}}return d}
+ function k5c(a){switch(a.g){case 1:return new K3c;case 2:return new M3c;case 3:return new I3c;case 0:return null;default:throw Adb(new agb(mFe+(a.f!=null?a.f:''+a.g)));}}
+ function gyd(a,b,c){switch(b){case 1:!a.n&&(a.n=new C5d(I4,a,1,7));sLd(a.n);!a.n&&(a.n=new C5d(I4,a,1,7));YGd(a.n,RD(c,16));return;case 2:jyd(a,WD(c));return;}Dxd(a,b,c);}
+ function xyd(a,b,c){switch(b){case 3:Ayd(a,Kfb(UD(c)));return;case 4:Cyd(a,Kfb(UD(c)));return;case 5:Dyd(a,Kfb(UD(c)));return;case 6:Eyd(a,Kfb(UD(c)));return;}gyd(a,b,c);}
+ function dBd(a,b,c){var d,e,f;f=(d=new R5d,d);e=XVd(f,b,null);!!e&&e.oj();PAd(f,c);WGd((!a.c&&(a.c=new C5d(u7,a,12,10)),a.c),f);$Vd(f,0);bWd(f,1);aWd(f,true);_Vd(f,true);}
+ function M5d(a,b){var c,d,e;c=Ktb(a.i,b);if(ZD(c,241)){e=RD(c,241);e.zi()==null&&undefined;return e.wi()}else if(ZD(c,507)){d=RD(c,2037);e=d.b;return e}else {return null}}
+ function aj(a,b,c,d){var e,f;Qb(b);Qb(c);f=RD(Fn(a.d,b),17);Ob(!!f,'Row %s not in %s',b,a.e);e=RD(Fn(a.b,c),17);Ob(!!e,'Column %s not in %s',c,a.c);return cj(a,f.a,e.a,d)}
+ function ZC(a,b,c,d,e,f,g){var h,i,j,k,l;k=e[f];j=f==g-1;h=j?d:0;l=_C(h,k);d!=10&&cD(WC(a,g-f),b[f],c[f],h,l);if(!j){++f;for(i=0;i1||h==-1){f=RD(i,15);e.Wb(Sje(a,f));}else {e.Wb(Rje(a,RD(i,58)));}}}}
+ function ceb(b,c,d,e){beb();var f=_db;function g(){for(var a=0;a0){return false}}return true}
+ function okc(a){var b,c,d,e,f;for(d=new vkb((new mkb(a.b)).a);d.b;){c=tkb(d);b=RD(c.ld(),10);f=RD(RD(c.md(),42).a,10);e=RD(RD(c.md(),42).b,8);$id(hjd(b.n),$id(ajd(f.n),e));}}
+ function Roc(a){switch(RD(mQb(a.b,(yCc(),BAc)),387).g){case 1:FDb(GDb(EDb(new SDb(null,new Swb(a.d,16)),new kpc),new mpc),new opc);break;case 2:Toc(a);break;case 0:Soc(a);}}
+ function SVc(a,b,c){var d,e,f;d=c;!d&&(d=new Oqd);d.Ug('Layout',a.a.c.length);for(f=new Anb(a.a);f.aAEe){return c}else e>-1.0E-6&&++c;}return c}
+ function n2d(a,b){var c;if(b!=a.b){c=null;!!a.b&&(c=Jvd(a.b,a,-4,c));!!b&&(c=Ivd(b,a,-4,c));c=e2d(a,b,c);!!c&&c.oj();}else (a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,3,b,b));}
+ function q2d(a,b){var c;if(b!=a.f){c=null;!!a.f&&(c=Jvd(a.f,a,-1,c));!!b&&(c=Ivd(b,a,-1,c));c=g2d(a,b,c);!!c&&c.oj();}else (a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,0,b,b));}
+ function Lge(a,b,c,d){var e,f,g,h;if(Mvd(a.e)){e=b.Lk();h=b.md();f=c.md();g=fge(a,1,e,h,f,e.Jk()?kge(a,e,f,ZD(e,102)&&(RD(e,19).Bb&txe)!=0):-1,true);d?d.nj(g):(d=g);}return d}
+ function bne(a){var b,c,d;if(a==null)return null;c=RD(a,15);if(c.dc())return '';d=new Qhb;for(b=c.Kc();b.Ob();){Nhb(d,(nme(),WD(b.Pb())));d.a+=' ';}return qeb(d,d.a.length-1)}
+ function fne(a){var b,c,d;if(a==null)return null;c=RD(a,15);if(c.dc())return '';d=new Qhb;for(b=c.Kc();b.Ob();){Nhb(d,(nme(),WD(b.Pb())));d.a+=' ';}return qeb(d,d.a.length-1)}
+ function QIc(a,b,c){var d,e;d=a.c[b.c.p][b.p];e=a.c[c.c.p][c.p];if(d.a!=null&&e.a!=null){return Jfb(d.a,e.a)}else if(d.a!=null){return -1}else if(e.a!=null){return 1}return 0}
+ function RVc(a,b,c){c.Ug('Tree layout',1);Sed(a.b);Ved(a.b,(YVc(),UVc),UVc);Ved(a.b,VVc,VVc);Ved(a.b,WVc,WVc);Ved(a.b,XVc,XVc);a.a=Qed(a.b,b);SVc(a,b,c.eh(1));c.Vg();return b}
+ function ZDd(a,b){var c,d,e,f,g,h;if(b){f=b.a.length;c=new vue(f);for(h=(c.b-c.a)*c.c<0?(uue(),tue):new Rue(c);h.Ob();){g=RD(h.Pb(),17);e=xDd(b,g.a);d=new aFd(a);$Dd(d.a,e);}}}
+ function oEd(a,b){var c,d,e,f,g,h;if(b){f=b.a.length;c=new vue(f);for(h=(c.b-c.a)*c.c<0?(uue(),tue):new Rue(c);h.Ob();){g=RD(h.Pb(),17);e=xDd(b,g.a);d=new LEd(a);NDd(d.a,e);}}}
+ function ESd(b){var c;if(b!=null&&b.length>0&&ihb(b,b.length-1)==33){try{c=nSd(zhb(b,0,b.length-1));return c.e==null}catch(a){a=zdb(a);if(!ZD(a,33))throw Adb(a)}}return false}
+ function u0b(a,b,c){var d,e,f;d=Y2b(b);e=i2b(d);f=new R3b;P3b(f,b);switch(c.g){case 1:Q3b(f,spd(vpd(e)));break;case 2:Q3b(f,vpd(e));}pQb(f,(yCc(),ABc),UD(mQb(a,ABc)));return f}
+ function jdc(a){var b,c;b=RD(hs(new is(Mr(Z2b(a.a).a.Kc(),new ir))),18);c=RD(hs(new is(Mr(a3b(a.a).a.Kc(),new ir))),18);return Heb(TD(mQb(b,(Ywc(),Nwc))))||Heb(TD(mQb(c,Nwc)))}
+ function Bnc(){Bnc=geb;xnc=new Cnc('ONE_SIDE',0);znc=new Cnc('TWO_SIDES_CORNER',1);Anc=new Cnc('TWO_SIDES_OPPOSING',2);ync=new Cnc('THREE_SIDES',3);wnc=new Cnc('FOUR_SIDES',4);}
+ function Usc(a,b){var c,d,e,f;f=new bnb;e=0;d=b.Kc();while(d.Ob()){c=sgb(RD(d.Pb(),17).a+e);while(c.a=a.f){break}ZEb(f.c,c);}return f}
+ function iIc(a,b){var c,d,e,f,g;for(f=new Anb(b.a);f.a0&&Xlc(this,this.c-1,(qpd(),Xod));this.c0&&a[0].length>0&&(this.c=Heb(TD(mQb(Y2b(a[0][0]),(Ywc(),rwc)))));this.a=$C(aY,Nve,2117,a.length,0,2);this.b=$C(dY,Nve,2118,a.length,0,2);this.d=new Ks;}
+ function TOc(a){if(a.c.length==0){return false}if((tFb(0,a.c.length),RD(a.c[0],18)).c.i.k==(r3b(),o3b)){return true}return yDb(GDb(new SDb(null,new Swb(a,16)),new WOc),new YOc)}
+ function I5c(a,b){var c,d,e,f,g,h,i;h=Q2c(b);f=b.f;i=b.g;g=$wnd.Math.sqrt(f*f+i*i);e=0;for(d=new Anb(h);d.a=0){c=Fdb(a,ixe);d=Mdb(a,ixe);}else {b=Udb(a,1);c=Fdb(b,500000000);d=Mdb(b,500000000);d=Bdb(Sdb(d,1),Cdb(a,1));}return Rdb(Sdb(d,32),Cdb(c,yxe))}
+ function fTb(a,b,c){var d,e;d=(sFb(b.b!=0),RD(Wub(b,b.a.a),8));switch(c.g){case 0:d.b=0;break;case 2:d.b=a.f;break;case 3:d.a=0;break;default:d.a=a.g;}e=Sub(b,0);cvb(e,d);return b}
+ function Vpc(a,b,c,d){var e,f,g,h,i;i=a.b;f=b.d;g=f.j;h=$pc(g,i.d[g.g],c);e=$id(ajd(f.n),f.a);switch(f.j.g){case 1:case 3:h.a+=e.a;break;case 2:case 4:h.b+=e.b;}Pub(d,h,d.c.b,d.c);}
+ function YNc(a,b,c){var d,e,f,g;g=Wmb(a.e,b,0);f=new ZNc;f.b=c;d=new Jkb(a.e,g);while(d.b1;b>>=1){(b&1)!=0&&(d=Wib(d,c));c.d==1?(c=Wib(c,c)):(c=new djb(Tjb(c.a,c.d,$C(kE,Pwe,28,c.d<<1,15,1))));}d=Wib(d,c);return d}
+ function Hwb(){Hwb=geb;var a,b,c,d;Ewb=$C(iE,vxe,28,25,15,1);Fwb=$C(iE,vxe,28,33,15,1);d=1.52587890625E-5;for(b=32;b>=0;b--){Fwb[b]=d;d*=0.5;}c=1;for(a=24;a>=0;a--){Ewb[a]=c;c*=0.5;}}
+ function a5b(a){var b,c;if(Heb(TD(Gxd(a,(yCc(),NAc))))){for(c=new is(Mr(zGd(a).a.Kc(),new ir));gs(c);){b=RD(hs(c),74);if(ozd(b)){if(Heb(TD(Gxd(b,OAc)))){return true}}}}return false}
+ function Qmc(a,b){var c,d,e;if(Ysb(a.f,b)){b.b=a;d=b.c;Wmb(a.j,d,0)!=-1||Rmb(a.j,d);e=b.d;Wmb(a.j,e,0)!=-1||Rmb(a.j,e);c=b.a.b;if(c.c.length!=0){!a.i&&(a.i=new _mc(a));Wmc(a.i,c);}}}
+ function Xpc(a){var b,c,d,e,f;c=a.c.d;d=c.j;e=a.d.d;f=e.j;if(d==f){return c.p=0&&lhb(a.substr(b,'GMT'.length),'GMT')){c[0]=b+3;return JA(a,c,d)}if(b>=0&&lhb(a.substr(b,'UTC'.length),'UTC')){c[0]=b+3;return JA(a,c,d)}return JA(a,c,d)}
+ function Zmc(a,b){var c,d,e,f,g;f=a.g.a;g=a.g.b;for(d=new Anb(a.d);d.ac;f--){a[f]|=b[f-c-1]>>>g;a[f-1]=b[f-c-1]<0&&hib(a.g,b,a.g,b+d,h);g=c.Kc();a.i+=d;for(e=0;e>4&15;f=a[d]&15;g[e++]=oAd[c];g[e++]=oAd[f];}return Ihb(g,0,g.length)}}
+ function Fhb(a){var b,c;if(a>=txe){b=uxe+(a-txe>>10&1023)&Bwe;c=56320+(a-txe&1023)&Bwe;return String.fromCharCode(b)+(''+String.fromCharCode(c))}else {return String.fromCharCode(a&Bwe)}}
+ function UMb(a,b){RMb();var c,d,e,f;e=RD(RD(Qc(a.r,b),21),87);if(e.gc()>=2){d=RD(e.Kc().Pb(),117);c=a.u.Hc((Pod(),Kod));f=a.u.Hc(Ood);return !d.a&&!c&&(e.gc()==2||f)}else {return false}}
+ function v3c(a,b,c,d,e){var f,g,h;f=w3c(a,b,c,d,e);h=false;while(!f){n3c(a,e,true);h=true;f=w3c(a,b,c,d,e);}h&&n3c(a,e,false);g=N2c(e);if(g.c.length!=0){!!a.d&&a.d.Gg(g);v3c(a,e,c,d,g);}}
+ function ind(){ind=geb;gnd=new jnd(LAe,0);end=new jnd('DIRECTED',1);hnd=new jnd('UNDIRECTED',2);cnd=new jnd('ASSOCIATION',3);fnd=new jnd('GENERALIZATION',4);dnd=new jnd('DEPENDENCY',5);}
+ function nsd(a,b){var c;if(!MCd(a)){throw Adb(new dgb(sHe))}c=MCd(a);switch(b.g){case 1:return -(a.j+a.f);case 2:return a.i-c.g;case 3:return a.j-c.f;case 4:return -(a.i+a.g);}return 0}
+ function Jge(a,b,c){var d,e,f;d=b.Lk();f=b.md();e=d.Jk()?fge(a,4,d,f,null,kge(a,d,f,ZD(d,102)&&(RD(d,19).Bb&txe)!=0),true):fge(a,d.tk()?2:1,d,f,d.ik(),-1,true);c?c.nj(e):(c=e);return c}
+ function lwb(a,b){var c,d;uFb(b);d=a.b.c.length;Rmb(a.b,b);while(d>0){c=d;d=(d-1)/2|0;if(a.a.Ne(Vmb(a.b,d),b)<=0){$mb(a.b,c,b);return true}$mb(a.b,c,Vmb(a.b,d));}$mb(a.b,d,b);return true}
+ function sKb(a,b,c,d){var e,f;e=0;if(!c){for(f=0;f=h}
+ function A8c(a){switch(a.g){case 0:return new o8c;case 1:return new u8c;default:throw Adb(new agb('No implementation is available for the width approximator '+(a.f!=null?a.f:''+a.g)));}}
+ function rDd(a,b,c,d){var e;e=false;if(bE(d)){e=true;sDd(b,c,WD(d));}if(!e){if($D(d)){e=true;rDd(a,b,c,d);}}if(!e){if(ZD(d,242)){e=true;qDd(b,c,RD(d,242));}}if(!e){throw Adb(new Aeb(tIe))}}
+ function uee(a,b){var c,d,e;c=b.qi(a.a);if(c){e=$Nd((!c.b&&(c.b=new SVd((JTd(),FTd),C8,c)),c.b),rKe);if(e!=null){for(d=1;d<(lke(),hke).length;++d){if(lhb(hke[d],e)){return d}}}}return 0}
+ function vee(a,b){var c,d,e;c=b.qi(a.a);if(c){e=$Nd((!c.b&&(c.b=new SVd((JTd(),FTd),C8,c)),c.b),rKe);if(e!=null){for(d=1;d<(lke(),ike).length;++d){if(lhb(ike[d],e)){return d}}}}return 0}
+ function Ve(a,b){var c,d,e,f;uFb(b);f=a.a.gc();if(f0?1:0;while(f.a[e]!=c){f=f.a[e];e=a.a.Ne(c.d,f.d)>0?1:0;}f.a[e]=d;d.b=c.b;d.a[0]=c.a[0];d.a[1]=c.a[1];c.a[0]=null;c.a[1]=null;}
+ function zIb(a){var b,c,d,e;b=new bnb;c=$C(xdb,Hye,28,a.a.c.length,16,1);Snb(c,c.length);for(e=new Anb(a.a);e.a0&&O9b((tFb(0,c.c.length),RD(c.c[0],30)),a);c.c.length>1&&O9b(RD(Vmb(c,c.c.length-1),30),a);b.Vg();}
+ function Sod(a){Pod();var b,c;b=ysb(Lod,cD(WC(D3,1),jwe,279,0,[Nod]));if(dy(Tx(b,a))>1){return false}c=ysb(Kod,cD(WC(D3,1),jwe,279,0,[Jod,Ood]));if(dy(Tx(c,a))>1){return false}return true}
+ function FBd(a,b){var c;c=Xjb((YSd(),XSd),a);ZD(c,507)?$jb(XSd,a,new B5d(this,b)):$jb(XSd,a,this);BBd(this,b);if(b==(jTd(),iTd)){this.wb=RD(this,2038);RD(b,2040);}else {this.wb=(lTd(),kTd);}}
+ function Lae(b){var c,d,e;if(b==null){return null}c=null;for(d=0;d=Awe?'error':d>=900?'warn':d>=800?'info':'log');eFb(c,a.a);!!a.b&&fFb(b,c,a.b,'Exception: ',true);}
+ function mQb(a,b){var c,d;d=(!a.q&&(a.q=new Tsb),Wjb(a.q,b));if(d!=null){return d}c=b.Sg();ZD(c,4)&&(c==null?(!a.q&&(a.q=new Tsb),_jb(a.q,b)):(!a.q&&(a.q=new Tsb),Zjb(a.q,b,c)),a);return c}
+ function sXb(){sXb=geb;nXb=new tXb('P1_CYCLE_BREAKING',0);oXb=new tXb('P2_LAYERING',1);pXb=new tXb('P3_NODE_ORDERING',2);qXb=new tXb('P4_NODE_PLACEMENT',3);rXb=new tXb('P5_EDGE_ROUTING',4);}
+ function KZb(a,b){CZb();var c;if(a.c==b.c){if(a.b==b.b||rZb(a.b,b.b)){c=oZb(a.b)?1:-1;if(a.a&&!b.a){return c}else if(!a.a&&b.a){return -c}}return hgb(a.b.g,b.b.g)}else {return Qfb(a.c,b.c)}}
+ function E3c(a,b){var c,d,e;if(p3c(a,b)){return true}for(d=new Anb(b);d.a=e||b<0)throw Adb(new veb(MIe+b+NIe+e));if(c>=e||c<0)throw Adb(new veb(OIe+c+NIe+e));b!=c?(d=(f=a.Cj(c),a.qj(b,f),f)):(d=a.xj(c));return d}
+ function Lje(a){var b,c,d;d=a;if(a){b=0;for(c=a.Eh();c;c=c.Eh()){if(++b>wxe){return Lje(c)}d=c;if(c==a){throw Adb(new dgb('There is a cycle in the containment hierarchy of '+a))}}}return d}
+ function Fe(a){var b,c,d;d=new Jyb(pve,'[',']');for(c=a.Kc();c.Ob();){b=c.Pb();Gyb(d,dE(b)===dE(a)?'(this Collection)':b==null?vve:jeb(b));}return !d.a?d.c:d.e.length==0?d.a.a:d.a.a+(''+d.e)}
+ function p3c(a,b){var c,d;d=false;if(b.gc()<2){return false}for(c=0;c1&&(a.j.b+=a.e);}else {a.j.a+=c.a;a.j.b=$wnd.Math.max(a.j.b,c.b);a.d.c.length>1&&(a.j.a+=a.e);}}
+ function Mnc(){Mnc=geb;Jnc=cD(WC(E3,1),NAe,64,0,[(qpd(),Yod),Xod,npd]);Inc=cD(WC(E3,1),NAe,64,0,[Xod,npd,ppd]);Knc=cD(WC(E3,1),NAe,64,0,[npd,ppd,Yod]);Lnc=cD(WC(E3,1),NAe,64,0,[ppd,Yod,Xod]);}
+ function Upc(a,b,c,d){var e,f,g,h,i,j,k;g=a.c.d;h=a.d.d;if(g.j==h.j){return}k=a.b;e=g.j;i=null;while(e!=h.j){i=b==0?tpd(e):rpd(e);f=$pc(e,k.d[e.g],c);j=$pc(i,k.d[i.g],c);Mub(d,$id(f,j));e=i;}}
+ function OJc(a,b,c,d){var e,f,g,h,i;g=hMc(a.a,b,c);h=RD(g.a,17).a;f=RD(g.b,17).a;if(d){i=RD(mQb(b,(Ywc(),Iwc)),10);e=RD(mQb(c,Iwc),10);if(!!i&&!!e){Slc(a.b,i,e);h+=a.b.i;f+=a.b.e;}}return h>f}
+ function OLc(a){var b,c,d,e,f,g,h,i,j;this.a=LLc(a);this.b=new bnb;for(c=a,d=0,e=c.length;damc(a.d).c){a.i+=a.g.c;cmc(a.d);}else if(amc(a.d).c>amc(a.g).c){a.e+=a.d.c;cmc(a.g);}else {a.i+=_lc(a.g);a.e+=_lc(a.d);cmc(a.g);cmc(a.d);}}}
+ function vTc(a,b,c){var d,e,f,g;f=b.q;g=b.r;new bTc((fTc(),dTc),b,f,1);new bTc(dTc,f,g,1);for(e=new Anb(c);e.ah&&(i=h/d);e>f&&(j=f/e);g=$wnd.Math.min(i,j);a.a+=g*(b.a-a.a);a.b+=g*(b.b-a.b);}
+ function I8c(a,b,c,d,e){var f,g;g=false;f=RD(Vmb(c.b,0),27);while(V8c(a,b,f,d,e)){g=true;T9c(c,f);if(c.b.c.length==0){break}f=RD(Vmb(c.b,0),27);}c.b.c.length==0&&Fad(c.j,c);g&&gad(b.q);return g}
+ function Eid(a,b){tid();var c,d,e,f;if(b.b<2){return false}f=Sub(b,0);c=RD(evb(f),8);d=c;while(f.b!=f.d.c){e=RD(evb(f),8);if(Did(a,d,e)){return true}d=e;}if(Did(a,d,c)){return true}return false}
+ function Bxd(a,b,c,d){var e,f;if(c==0){return !a.o&&(a.o=new DVd((pvd(),mvd),X4,a,0)),BVd(a.o,b,d)}return f=RD(vYd((e=RD(Ywd(a,16),29),!e?a.ii():e),c),69),f.wk().Ak(a,Wwd(a),c-AYd(a.ii()),b,d)}
+ function BBd(a,b){var c;if(b!=a.sb){c=null;!!a.sb&&(c=RD(a.sb,54).Th(a,1,n7,c));!!b&&(c=RD(b,54).Rh(a,1,n7,c));c=hBd(a,b,c);!!c&&c.oj();}else (a.Db&4)!=0&&(a.Db&1)==0&&qvd(a,new N3d(a,1,4,b,b));}
+ function YDd(a,b){var c,d,e,f;if(b){e=vDd(b,'x');c=new ZEd(a);Hzd(c.a,(uFb(e),e));f=vDd(b,'y');d=new $Ed(a);Izd(d.a,(uFb(f),f));}else {throw Adb(new CDd('All edge sections need an end point.'))}}
+ function WDd(a,b){var c,d,e,f;if(b){e=vDd(b,'x');c=new WEd(a);Ozd(c.a,(uFb(e),e));f=vDd(b,'y');d=new XEd(a);Pzd(d.a,(uFb(f),f));}else {throw Adb(new CDd('All edge sections need a start point.'))}}
+ function hBb(a,b){var c,d,e,f,g,h,i;for(d=kBb(a),f=0,h=d.length;f>22-b;e=a.h<>22-b;}else if(b<44){c=0;d=a.l<>44-b;}else {c=0;d=0;e=a.l<a){throw Adb(new agb('k must be smaller than n'))}else return b==0||b==a?1:a==0?0:Bid(a)/(Bid(b)*Bid(a-b))}
+ function msd(a,b){var c,d,e,f;c=new zId(a);while(c.g==null&&!c.c?sId(c):c.g==null||c.i!=0&&RD(c.g[c.i-1],51).Ob()){f=RD(tId(c),58);if(ZD(f,167)){d=RD(f,167);for(e=0;e>4];b[c*2+1]=Fqe[f&15];}return Ihb(b,0,b.length)}
+ function sn(a){fn();var b,c,d;d=a.c.length;switch(d){case 0:return en;case 1:b=RD(Ir(new Anb(a)),44);return xn(b.ld(),b.md());default:c=RD(anb(a,$C(UK,Zve,44,a.c.length,0,1)),173);return new Mx(c);}}
+ function KWb(a){var b,c,d,e,f,g;b=new wmb;c=new wmb;hmb(b,a);hmb(c,a);while(c.b!=c.c){e=RD(smb(c),36);for(g=new Anb(e.a);g.a0&&uLc(a,c,b);return e}return rLc(a,b,c)}
+ function $4c(){$4c=geb;R4c=(umd(),Qld);Y4c=fmd;K4c=kld;L4c=nld;M4c=pld;J4c=ild;N4c=sld;Q4c=Lld;H4c=(D4c(),o4c);I4c=p4c;T4c=v4c;W4c=y4c;U4c=w4c;V4c=x4c;O4c=r4c;P4c=t4c;S4c=u4c;X4c=z4c;Z4c=B4c;G4c=n4c;}
+ function P9c(a,b){var c,d,e,f,g;if(a.e<=b){return a.g}if(R9c(a,a.g,b)){return a.g}f=a.r;d=a.g;g=a.r;e=(f-d)/2+d;while(d+11&&(a.e.b+=a.a);}else {a.e.a+=c.a;a.e.b=$wnd.Math.max(a.e.b,c.b);a.d.c.length>1&&(a.e.a+=a.a);}}
+ function Ipc(a){var b,c,d,e;e=a.i;b=e.b;d=e.j;c=e.g;switch(e.a.g){case 0:c.a=(a.g.b.o.a-d.a)/2;break;case 1:c.a=b.d.n.a+b.d.a.a;break;case 2:c.a=b.d.n.a+b.d.a.a-d.a;break;case 3:c.b=b.d.n.b+b.d.a.b;}}
+ function oOc(a,b,c){var d,e,f;for(e=new is(Mr(W2b(c).a.Kc(),new ir));gs(e);){d=RD(hs(e),18);if(!(!W0b(d)&&!(!W0b(d)&&d.c.i.c==d.d.i.c))){continue}f=gOc(a,d,c,new VOc);f.c.length>1&&(ZEb(b.c,f),true);}}
+ function _id(a,b,c,d,e){if(dd&&(a.a=d);a.be&&(a.b=e);return a}
+ function LFd(a){if(ZD(a,143)){return EFd(RD(a,143))}else if(ZD(a,233)){return FFd(RD(a,233))}else if(ZD(a,23)){return GFd(RD(a,23))}else {throw Adb(new agb(wIe+Fe(new mob(cD(WC(jJ,1),rve,1,5,[a])))))}}
+ function ujb(a,b,c,d,e){var f,g,h;f=true;for(g=0;g>>e|c[g+d+1]<>>e;++g;}return f}
+ function ZQc(a,b,c,d){var e,f,g;if(b.k==(r3b(),o3b)){for(f=new is(Mr(Z2b(b).a.Kc(),new ir));gs(f);){e=RD(hs(f),18);g=e.c.i.k;if(g==o3b&&a.c.a[e.c.i.c.p]==d&&a.c.a[b.c.p]==c){return true}}}return false}
+ function CD(a,b){var c,d,e,f;b&=63;c=a.h&exe;if(b<22){f=c>>>b;e=a.m>>b|c<<22-b;d=a.l>>b|a.m<<22-b;}else if(b<44){f=0;e=c>>>b-22;d=a.m>>b-22|a.h<<44-b;}else {f=0;e=0;d=c>>>b-44;}return hD(d&dxe,e&dxe,f&exe)}
+ function mmc(a,b,c,d){var e;this.b=d;this.e=a==(RKc(),PKc);e=b[c];this.d=YC(xdb,[Nve,Hye],[183,28],16,[e.length,e.length],2);this.a=YC(kE,[Nve,Pwe],[53,28],15,[e.length,e.length],2);this.c=new Ylc(b,c);}
+ function Rmc(a){var b,c,d;a.k=new Si((qpd(),cD(WC(E3,1),NAe,64,0,[opd,Yod,Xod,npd,ppd])).length,a.j.c.length);for(d=new Anb(a.j);d.a=c){_cc(a,b,d.p);return true}}return false}
+ function EA(a,b,c,d){var e,f,g,h,i,j;g=c.length;f=0;e=-1;j=Bhb((BFb(b,a.length+1),a.substr(b)),(wvb(),uvb));for(h=0;hf&&whb(j,Bhb(c[h],uvb))){e=h;f=i;}}e>=0&&(d[0]=b+f);return e}
+ function gCd(a){var b;if((a.Db&64)!=0)return Fyd(a);b=new dib(FHe);!a.a||Zhb(Zhb((b.a+=' "',b),a.a),'"');Zhb(Uhb(Zhb(Uhb(Zhb(Uhb(Zhb(Uhb((b.a+=' (',b),a.i),','),a.j),' | '),a.g),','),a.f),')');return b.a}
+ function xge(a,b,c){var d,e,f,g,h;h=pke(a.e.Dh(),b);e=RD(a.g,124);d=0;for(g=0;gc){return Jb(a,c,'start index')}if(b<0||b>c){return Jb(b,c,'end index')}return hc('end index (%s) must not be less than start index (%s)',cD(WC(jJ,1),rve,1,5,[sgb(b),sgb(a)]))}
+ function dA(b,c){var d,e,f,g;for(e=0,f=b.length;e0&&aGc(a,f,c));}}b.p=0;}
+ function Ahd(a){var b;this.c=new Yub;this.f=a.e;this.e=a.d;this.i=a.g;this.d=a.c;this.b=a.b;this.k=a.j;this.a=a.a;!a.i?(this.j=(b=RD(mfb(d3),9),new Fsb(b,RD(WEb(b,b.length),9),0))):(this.j=a.i);this.g=a.f;}
+ function Wb(a){var b,c,d,e;b=Thb(Zhb(new dib('Predicates.'),'and'),40);c=true;for(e=new Dkb(a);e.b0?h[g-1]:$C(jR,WAe,10,0,0,1);e=h[g];j=g=0?a.ki(e):Tvd(a,d);}else {throw Adb(new agb(KHe+d.xe()+LHe))}}else {Cvd(a,c,d);}}
+ function ADd(a){var b,c;c=null;b=false;if(ZD(a,211)){b=true;c=RD(a,211).a;}if(!b){if(ZD(a,263)){b=true;c=''+RD(a,263).a;}}if(!b){if(ZD(a,493)){b=true;c=''+RD(a,493).a;}}if(!b){throw Adb(new Aeb(tIe))}return c}
+ function gge(a,b,c){var d,e,f,g,h,i;i=pke(a.e.Dh(),b);d=0;h=a.i;e=RD(a.g,124);for(g=0;g=a.d.b.c.length){b=new R4b(a.d);b.p=d.p-1;Rmb(a.d.b,b);c=new R4b(a.d);c.p=d.p;Rmb(a.d.b,c);}g3b(d,RD(Vmb(a.d.b,d.p),30));}}
+ function DVc(a,b,c){var d,e,f;if(!a.b[b.g]){a.b[b.g]=true;d=c;!d&&(d=new YWc);Mub(d.b,b);for(f=a.a[b.g].Kc();f.Ob();){e=RD(f.Pb(),65);e.b!=b&&DVc(a,e.b,d);e.c!=b&&DVc(a,e.c,d);Mub(d.a,e);}return d}return null}
+ function iMb(a){switch(a.g){case 0:case 1:case 2:return qpd(),Yod;case 3:case 4:case 5:return qpd(),npd;case 6:case 7:case 8:return qpd(),ppd;case 9:case 10:case 11:return qpd(),Xod;default:return qpd(),opd;}}
+ function SOc(a,b){var c;if(a.c.length==0){return false}c=zDc((tFb(0,a.c.length),RD(a.c[0],18)).c.i);dOc();if(c==(wDc(),tDc)||c==sDc){return true}return yDb(GDb(new SDb(null,new Swb(a,16)),new $Oc),new aPc(b))}
+ function KDd(a,b){if(ZD(b,207)){return EDd(a,RD(b,27))}else if(ZD(b,193)){return FDd(a,RD(b,123))}else if(ZD(b,452)){return DDd(a,RD(b,166))}else {throw Adb(new agb(wIe+Fe(new mob(cD(WC(jJ,1),rve,1,5,[b])))))}}
+ function Ou(a,b,c){var d,e;this.f=a;d=RD(Wjb(a.b,b),260);e=!d?0:d.a;Sb(c,e);if(c>=(e/2|0)){this.e=!d?null:d.c;this.d=e;while(c++0){Lu(this);}}this.b=b;this.a=null;}
+ function iHb(a,b){var c,d;b.a?jHb(a,b):(c=RD(vAb(a.b,b.b),60),!!c&&c==a.a[b.b.f]&&!!c.a&&c.a!=b.b.a&&c.c.Fc(b.b),d=RD(uAb(a.b,b.b),60),!!d&&a.a[d.f]==b.b&&!!d.a&&d.a!=b.b.a&&b.b.c.Fc(d),wAb(a.b,b.b),undefined);}
+ function wMb(a,b){var c,d;c=RD(Vrb(a.b,b),127);if(RD(RD(Qc(a.r,b),21),87).dc()){c.n.b=0;c.n.c=0;return}c.n.b=a.C.b;c.n.c=a.C.c;a.A.Hc((Qpd(),Ppd))&&BMb(a,b);d=AMb(a,b);BLb(a,b)==(pod(),mod)&&(d+=2*a.w);c.a.a=d;}
+ function FNb(a,b){var c,d;c=RD(Vrb(a.b,b),127);if(RD(RD(Qc(a.r,b),21),87).dc()){c.n.d=0;c.n.a=0;return}c.n.d=a.C.d;c.n.a=a.C.a;a.A.Hc((Qpd(),Ppd))&&JNb(a,b);d=INb(a,b);BLb(a,b)==(pod(),mod)&&(d+=2*a.w);c.a.b=d;}
+ function VQb(a,b){var c,d,e,f;f=new bnb;for(d=new Anb(b);d.a