@docyrus/docyrus 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +25 -2
  2. package/main.js +1028 -540
  3. package/main.js.map +4 -4
  4. package/package.json +2 -1
  5. package/resources/pi-agent/prompts/agent-system.md +25 -0
  6. package/resources/pi-agent/prompts/coder-append-system.md +19 -0
  7. package/resources/pi-agent/skills/docyrus-ai/SKILL.md +28 -0
  8. package/resources/pi-agent/skills/docyrus-api-dev/SKILL.md +161 -0
  9. package/resources/pi-agent/skills/docyrus-api-dev/references/api-client.md +349 -0
  10. package/resources/pi-agent/skills/docyrus-api-dev/references/authentication.md +238 -0
  11. package/resources/pi-agent/skills/docyrus-api-dev/references/data-source-query-guide.md +2059 -0
  12. package/resources/pi-agent/skills/docyrus-api-dev/references/formula-design-guide-llm.md +320 -0
  13. package/resources/pi-agent/skills/docyrus-api-dev/references/query-and-formulas.md +592 -0
  14. package/resources/pi-agent/skills/docyrus-api-doctor/SKILL.md +70 -0
  15. package/resources/pi-agent/skills/docyrus-api-doctor/references/checklist-details.md +588 -0
  16. package/resources/pi-agent/skills/docyrus-app-dev/SKILL.md +159 -0
  17. package/resources/pi-agent/skills/docyrus-app-dev/references/api-client-and-auth.md +275 -0
  18. package/resources/pi-agent/skills/docyrus-app-dev/references/collections-and-patterns.md +352 -0
  19. package/resources/pi-agent/skills/docyrus-app-dev/references/data-source-query-guide.md +2059 -0
  20. package/resources/pi-agent/skills/docyrus-app-dev/references/formula-design-guide-llm.md +320 -0
  21. package/resources/pi-agent/skills/docyrus-app-dev/references/query-guide.md +525 -0
  22. package/resources/pi-agent/skills/docyrus-app-ui-design/SKILL.md +466 -0
  23. package/resources/pi-agent/skills/docyrus-app-ui-design/references/component-selection-guide.md +602 -0
  24. package/resources/pi-agent/skills/docyrus-app-ui-design/references/icon-usage-guide.md +463 -0
  25. package/resources/pi-agent/skills/docyrus-app-ui-design/references/preferred-components-catalog.md +242 -0
  26. package/resources/pi-agent/skills/docyrus-apps/SKILL.md +54 -0
  27. package/resources/pi-agent/skills/docyrus-architect/SKILL.md +174 -0
  28. package/resources/pi-agent/skills/docyrus-architect/references/custom-query-guide.md +410 -0
  29. package/resources/pi-agent/skills/docyrus-architect/references/data-source-query-guide.md +2059 -0
  30. package/resources/pi-agent/skills/docyrus-architect/references/formula-design-guide-llm.md +320 -0
  31. package/resources/pi-agent/skills/docyrus-architect/references/formula-reference.md +145 -0
  32. package/resources/pi-agent/skills/docyrus-auth/SKILL.md +100 -0
  33. package/resources/pi-agent/skills/docyrus-cli-app/SKILL.md +279 -0
  34. package/resources/pi-agent/skills/docyrus-cli-app/references/cli-manifest.md +532 -0
  35. package/resources/pi-agent/skills/docyrus-cli-app/references/list-query-examples.md +248 -0
  36. package/resources/pi-agent/skills/docyrus-curl/SKILL.md +32 -0
  37. package/resources/pi-agent/skills/docyrus-discover/SKILL.md +63 -0
  38. package/resources/pi-agent/skills/docyrus-ds/SKILL.md +95 -0
  39. package/resources/pi-agent/skills/docyrus-env/SKILL.md +21 -0
  40. package/resources/pi-agent/skills/docyrus-studio/SKILL.md +369 -0
  41. package/resources/pi-agent/skills/docyrus-tui/SKILL.md +15 -0
package/main.js CHANGED
@@ -18851,7 +18851,7 @@ var require_core3 = __commonJS({
18851
18851
  return match && match.index === 0;
18852
18852
  }
18853
18853
  var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
18854
- function join5(regexps, separator = "|") {
18854
+ function join6(regexps, separator = "|") {
18855
18855
  let numCaptures = 0;
18856
18856
  return regexps.map((regex) => {
18857
18857
  numCaptures += 1;
@@ -19155,7 +19155,7 @@ var require_core3 = __commonJS({
19155
19155
  this.exec = () => null;
19156
19156
  }
19157
19157
  const terminators = this.regexes.map((el) => el[1]);
19158
- this.matcherRe = langRe(join5(terminators), true);
19158
+ this.matcherRe = langRe(join6(terminators), true);
19159
19159
  this.lastIndex = 0;
19160
19160
  }
19161
19161
  /** @param {string} s */
@@ -53726,20 +53726,20 @@ var require_unicode = __commonJS({
53726
53726
  SYSTEM_STRING: [83, 89, 83, 84, 69, 77]
53727
53727
  //SYSTEM
53728
53728
  };
53729
- exports2.isSurrogate = function(cp) {
53730
- return cp >= 55296 && cp <= 57343;
53729
+ exports2.isSurrogate = function(cp2) {
53730
+ return cp2 >= 55296 && cp2 <= 57343;
53731
53731
  };
53732
- exports2.isSurrogatePair = function(cp) {
53733
- return cp >= 56320 && cp <= 57343;
53732
+ exports2.isSurrogatePair = function(cp2) {
53733
+ return cp2 >= 56320 && cp2 <= 57343;
53734
53734
  };
53735
53735
  exports2.getSurrogatePairCodePoint = function(cp1, cp2) {
53736
53736
  return (cp1 - 55296) * 1024 + 9216 + cp2;
53737
53737
  };
53738
- exports2.isControlCodePoint = function(cp) {
53739
- return cp !== 32 && cp !== 10 && cp !== 13 && cp !== 9 && cp !== 12 && cp >= 1 && cp <= 31 || cp >= 127 && cp <= 159;
53738
+ exports2.isControlCodePoint = function(cp2) {
53739
+ return cp2 !== 32 && cp2 !== 10 && cp2 !== 13 && cp2 !== 9 && cp2 !== 12 && cp2 >= 1 && cp2 <= 31 || cp2 >= 127 && cp2 <= 159;
53740
53740
  };
53741
- exports2.isUndefinedCodePoint = function(cp) {
53742
- return cp >= 64976 && cp <= 65007 || UNDEFINED_CODE_POINTS.indexOf(cp) > -1;
53741
+ exports2.isUndefinedCodePoint = function(cp2) {
53742
+ return cp2 >= 64976 && cp2 <= 65007 || UNDEFINED_CODE_POINTS.indexOf(cp2) > -1;
53743
53743
  };
53744
53744
  }
53745
53745
  });
@@ -53839,20 +53839,20 @@ var require_preprocessor = __commonJS({
53839
53839
  this.gapStack.push(this.lastGapPos);
53840
53840
  this.lastGapPos = this.pos;
53841
53841
  }
53842
- _processSurrogate(cp) {
53842
+ _processSurrogate(cp2) {
53843
53843
  if (this.pos !== this.lastCharPos) {
53844
53844
  const nextCp = this.html.charCodeAt(this.pos + 1);
53845
53845
  if (unicode.isSurrogatePair(nextCp)) {
53846
53846
  this.pos++;
53847
53847
  this._addGap();
53848
- return unicode.getSurrogatePairCodePoint(cp, nextCp);
53848
+ return unicode.getSurrogatePairCodePoint(cp2, nextCp);
53849
53849
  }
53850
53850
  } else if (!this.lastChunkWritten) {
53851
53851
  this.endOfChunkHit = true;
53852
53852
  return $.EOF;
53853
53853
  }
53854
53854
  this._err(ERR.surrogateInInputStream);
53855
- return cp;
53855
+ return cp2;
53856
53856
  }
53857
53857
  dropParsedChunk() {
53858
53858
  if (this.pos > this.bufferWaterline) {
@@ -53884,30 +53884,30 @@ var require_preprocessor = __commonJS({
53884
53884
  this.endOfChunkHit = !this.lastChunkWritten;
53885
53885
  return $.EOF;
53886
53886
  }
53887
- let cp = this.html.charCodeAt(this.pos);
53888
- if (this.skipNextNewLine && cp === $.LINE_FEED) {
53887
+ let cp2 = this.html.charCodeAt(this.pos);
53888
+ if (this.skipNextNewLine && cp2 === $.LINE_FEED) {
53889
53889
  this.skipNextNewLine = false;
53890
53890
  this._addGap();
53891
53891
  return this.advance();
53892
53892
  }
53893
- if (cp === $.CARRIAGE_RETURN) {
53893
+ if (cp2 === $.CARRIAGE_RETURN) {
53894
53894
  this.skipNextNewLine = true;
53895
53895
  return $.LINE_FEED;
53896
53896
  }
53897
53897
  this.skipNextNewLine = false;
53898
- if (unicode.isSurrogate(cp)) {
53899
- cp = this._processSurrogate(cp);
53898
+ if (unicode.isSurrogate(cp2)) {
53899
+ cp2 = this._processSurrogate(cp2);
53900
53900
  }
53901
- const isCommonValidRange = cp > 31 && cp < 127 || cp === $.LINE_FEED || cp === $.CARRIAGE_RETURN || cp > 159 && cp < 64976;
53901
+ const isCommonValidRange = cp2 > 31 && cp2 < 127 || cp2 === $.LINE_FEED || cp2 === $.CARRIAGE_RETURN || cp2 > 159 && cp2 < 64976;
53902
53902
  if (!isCommonValidRange) {
53903
- this._checkForProblematicCharacters(cp);
53903
+ this._checkForProblematicCharacters(cp2);
53904
53904
  }
53905
- return cp;
53905
+ return cp2;
53906
53906
  }
53907
- _checkForProblematicCharacters(cp) {
53908
- if (unicode.isControlCodePoint(cp)) {
53907
+ _checkForProblematicCharacters(cp2) {
53908
+ if (unicode.isControlCodePoint(cp2)) {
53909
53909
  this._err(ERR.controlCharacterInInputStream);
53910
- } else if (unicode.isUndefinedCodePoint(cp)) {
53910
+ } else if (unicode.isUndefinedCodePoint(cp2)) {
53911
53911
  this._err(ERR.noncharacterInInputStream);
53912
53912
  }
53913
53913
  }
@@ -54054,56 +54054,56 @@ var require_tokenizer = __commonJS({
54054
54054
  var HEXADEMICAL_CHARACTER_REFERENCE_STATE = "HEXADEMICAL_CHARACTER_REFERENCE_STATE";
54055
54055
  var DECIMAL_CHARACTER_REFERENCE_STATE = "DECIMAL_CHARACTER_REFERENCE_STATE";
54056
54056
  var NUMERIC_CHARACTER_REFERENCE_END_STATE = "NUMERIC_CHARACTER_REFERENCE_END_STATE";
54057
- function isWhitespace(cp) {
54058
- return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED;
54057
+ function isWhitespace(cp2) {
54058
+ return cp2 === $.SPACE || cp2 === $.LINE_FEED || cp2 === $.TABULATION || cp2 === $.FORM_FEED;
54059
54059
  }
54060
- function isAsciiDigit(cp) {
54061
- return cp >= $.DIGIT_0 && cp <= $.DIGIT_9;
54060
+ function isAsciiDigit(cp2) {
54061
+ return cp2 >= $.DIGIT_0 && cp2 <= $.DIGIT_9;
54062
54062
  }
54063
- function isAsciiUpper(cp) {
54064
- return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z;
54063
+ function isAsciiUpper(cp2) {
54064
+ return cp2 >= $.LATIN_CAPITAL_A && cp2 <= $.LATIN_CAPITAL_Z;
54065
54065
  }
54066
- function isAsciiLower(cp) {
54067
- return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z;
54066
+ function isAsciiLower(cp2) {
54067
+ return cp2 >= $.LATIN_SMALL_A && cp2 <= $.LATIN_SMALL_Z;
54068
54068
  }
54069
- function isAsciiLetter(cp) {
54070
- return isAsciiLower(cp) || isAsciiUpper(cp);
54069
+ function isAsciiLetter(cp2) {
54070
+ return isAsciiLower(cp2) || isAsciiUpper(cp2);
54071
54071
  }
54072
- function isAsciiAlphaNumeric(cp) {
54073
- return isAsciiLetter(cp) || isAsciiDigit(cp);
54072
+ function isAsciiAlphaNumeric(cp2) {
54073
+ return isAsciiLetter(cp2) || isAsciiDigit(cp2);
54074
54074
  }
54075
- function isAsciiUpperHexDigit(cp) {
54076
- return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_F;
54075
+ function isAsciiUpperHexDigit(cp2) {
54076
+ return cp2 >= $.LATIN_CAPITAL_A && cp2 <= $.LATIN_CAPITAL_F;
54077
54077
  }
54078
- function isAsciiLowerHexDigit(cp) {
54079
- return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_F;
54078
+ function isAsciiLowerHexDigit(cp2) {
54079
+ return cp2 >= $.LATIN_SMALL_A && cp2 <= $.LATIN_SMALL_F;
54080
54080
  }
54081
- function isAsciiHexDigit(cp) {
54082
- return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp);
54081
+ function isAsciiHexDigit(cp2) {
54082
+ return isAsciiDigit(cp2) || isAsciiUpperHexDigit(cp2) || isAsciiLowerHexDigit(cp2);
54083
54083
  }
54084
- function toAsciiLowerCodePoint(cp) {
54085
- return cp + 32;
54084
+ function toAsciiLowerCodePoint(cp2) {
54085
+ return cp2 + 32;
54086
54086
  }
54087
- function toChar(cp) {
54088
- if (cp <= 65535) {
54089
- return String.fromCharCode(cp);
54087
+ function toChar(cp2) {
54088
+ if (cp2 <= 65535) {
54089
+ return String.fromCharCode(cp2);
54090
54090
  }
54091
- cp -= 65536;
54092
- return String.fromCharCode(cp >>> 10 & 1023 | 55296) + String.fromCharCode(56320 | cp & 1023);
54091
+ cp2 -= 65536;
54092
+ return String.fromCharCode(cp2 >>> 10 & 1023 | 55296) + String.fromCharCode(56320 | cp2 & 1023);
54093
54093
  }
54094
- function toAsciiLowerChar(cp) {
54095
- return String.fromCharCode(toAsciiLowerCodePoint(cp));
54094
+ function toAsciiLowerChar(cp2) {
54095
+ return String.fromCharCode(toAsciiLowerCodePoint(cp2));
54096
54096
  }
54097
- function findNamedEntityTreeBranch(nodeIx, cp) {
54097
+ function findNamedEntityTreeBranch(nodeIx, cp2) {
54098
54098
  const branchCount = neTree[++nodeIx];
54099
54099
  let lo = ++nodeIx;
54100
54100
  let hi = lo + branchCount - 1;
54101
54101
  while (lo <= hi) {
54102
54102
  const mid = lo + hi >>> 1;
54103
54103
  const midCp = neTree[mid];
54104
- if (midCp < cp) {
54104
+ if (midCp < cp2) {
54105
54105
  lo = mid + 1;
54106
- } else if (midCp > cp) {
54106
+ } else if (midCp > cp2) {
54107
54107
  hi = mid - 1;
54108
54108
  } else {
54109
54109
  return neTree[mid + branchCount];
@@ -54139,9 +54139,9 @@ var require_tokenizer = __commonJS({
54139
54139
  getNextToken() {
54140
54140
  while (!this.tokenQueue.length && this.active) {
54141
54141
  this.consumedAfterSnapshot = 0;
54142
- const cp = this._consume();
54142
+ const cp2 = this._consume();
54143
54143
  if (!this._ensureHibernation()) {
54144
- this[this.state](cp);
54144
+ this[this.state](cp2);
54145
54145
  }
54146
54146
  }
54147
54147
  return this.tokenQueue.shift();
@@ -54184,19 +54184,19 @@ var require_tokenizer = __commonJS({
54184
54184
  let isMatch = true;
54185
54185
  const patternLength = pattern.length;
54186
54186
  let patternPos = 0;
54187
- let cp = startCp;
54187
+ let cp2 = startCp;
54188
54188
  let patternCp = void 0;
54189
54189
  for (; patternPos < patternLength; patternPos++) {
54190
54190
  if (patternPos > 0) {
54191
- cp = this._consume();
54191
+ cp2 = this._consume();
54192
54192
  consumedCount++;
54193
54193
  }
54194
- if (cp === $.EOF) {
54194
+ if (cp2 === $.EOF) {
54195
54195
  isMatch = false;
54196
54196
  break;
54197
54197
  }
54198
54198
  patternCp = pattern[patternPos];
54199
- if (cp !== patternCp && (caseSensitive || cp !== toAsciiLowerCodePoint(patternCp))) {
54199
+ if (cp2 !== patternCp && (caseSensitive || cp2 !== toAsciiLowerCodePoint(patternCp))) {
54200
54200
  isMatch = false;
54201
54201
  break;
54202
54202
  }
@@ -54326,14 +54326,14 @@ var require_tokenizer = __commonJS({
54326
54326
  this._createCharacterToken(type, ch);
54327
54327
  }
54328
54328
  }
54329
- _emitCodePoint(cp) {
54329
+ _emitCodePoint(cp2) {
54330
54330
  let type = _Tokenizer2.CHARACTER_TOKEN;
54331
- if (isWhitespace(cp)) {
54331
+ if (isWhitespace(cp2)) {
54332
54332
  type = _Tokenizer2.WHITESPACE_CHARACTER_TOKEN;
54333
- } else if (cp === $.NULL) {
54333
+ } else if (cp2 === $.NULL) {
54334
54334
  type = _Tokenizer2.NULL_CHARACTER_TOKEN;
54335
54335
  }
54336
- this._appendCharToCurrentCharacterToken(type, toChar(cp));
54336
+ this._appendCharToCurrentCharacterToken(type, toChar(cp2));
54337
54337
  }
54338
54338
  _emitSeveralCodePoints(codePoints) {
54339
54339
  for (let i = 0; i < codePoints.length; i++) {
@@ -54359,16 +54359,16 @@ var require_tokenizer = __commonJS({
54359
54359
  result = current & DATA_DUPLET_FLAG ? [neTree[++i], neTree[++i]] : [neTree[++i]];
54360
54360
  excess = 0;
54361
54361
  }
54362
- const cp = this._consume();
54363
- this.tempBuff.push(cp);
54362
+ const cp2 = this._consume();
54363
+ this.tempBuff.push(cp2);
54364
54364
  excess++;
54365
- if (cp === $.EOF) {
54365
+ if (cp2 === $.EOF) {
54366
54366
  break;
54367
54367
  }
54368
54368
  if (inNode) {
54369
- i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i, cp) : -1;
54369
+ i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i, cp2) : -1;
54370
54370
  } else {
54371
- i = cp === current ? ++i : -1;
54371
+ i = cp2 === current ? ++i : -1;
54372
54372
  }
54373
54373
  }
54374
54374
  while (excess--) {
@@ -54401,98 +54401,98 @@ var require_tokenizer = __commonJS({
54401
54401
  // State machine
54402
54402
  // Data state
54403
54403
  //------------------------------------------------------------------
54404
- [DATA_STATE](cp) {
54404
+ [DATA_STATE](cp2) {
54405
54405
  this.preprocessor.dropParsedChunk();
54406
- if (cp === $.LESS_THAN_SIGN) {
54406
+ if (cp2 === $.LESS_THAN_SIGN) {
54407
54407
  this.state = TAG_OPEN_STATE;
54408
- } else if (cp === $.AMPERSAND) {
54408
+ } else if (cp2 === $.AMPERSAND) {
54409
54409
  this.returnState = DATA_STATE;
54410
54410
  this.state = CHARACTER_REFERENCE_STATE;
54411
- } else if (cp === $.NULL) {
54411
+ } else if (cp2 === $.NULL) {
54412
54412
  this._err(ERR.unexpectedNullCharacter);
54413
- this._emitCodePoint(cp);
54414
- } else if (cp === $.EOF) {
54413
+ this._emitCodePoint(cp2);
54414
+ } else if (cp2 === $.EOF) {
54415
54415
  this._emitEOFToken();
54416
54416
  } else {
54417
- this._emitCodePoint(cp);
54417
+ this._emitCodePoint(cp2);
54418
54418
  }
54419
54419
  }
54420
54420
  // RCDATA state
54421
54421
  //------------------------------------------------------------------
54422
- [RCDATA_STATE](cp) {
54422
+ [RCDATA_STATE](cp2) {
54423
54423
  this.preprocessor.dropParsedChunk();
54424
- if (cp === $.AMPERSAND) {
54424
+ if (cp2 === $.AMPERSAND) {
54425
54425
  this.returnState = RCDATA_STATE;
54426
54426
  this.state = CHARACTER_REFERENCE_STATE;
54427
- } else if (cp === $.LESS_THAN_SIGN) {
54427
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54428
54428
  this.state = RCDATA_LESS_THAN_SIGN_STATE;
54429
- } else if (cp === $.NULL) {
54429
+ } else if (cp2 === $.NULL) {
54430
54430
  this._err(ERR.unexpectedNullCharacter);
54431
54431
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54432
- } else if (cp === $.EOF) {
54432
+ } else if (cp2 === $.EOF) {
54433
54433
  this._emitEOFToken();
54434
54434
  } else {
54435
- this._emitCodePoint(cp);
54435
+ this._emitCodePoint(cp2);
54436
54436
  }
54437
54437
  }
54438
54438
  // RAWTEXT state
54439
54439
  //------------------------------------------------------------------
54440
- [RAWTEXT_STATE](cp) {
54440
+ [RAWTEXT_STATE](cp2) {
54441
54441
  this.preprocessor.dropParsedChunk();
54442
- if (cp === $.LESS_THAN_SIGN) {
54442
+ if (cp2 === $.LESS_THAN_SIGN) {
54443
54443
  this.state = RAWTEXT_LESS_THAN_SIGN_STATE;
54444
- } else if (cp === $.NULL) {
54444
+ } else if (cp2 === $.NULL) {
54445
54445
  this._err(ERR.unexpectedNullCharacter);
54446
54446
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54447
- } else if (cp === $.EOF) {
54447
+ } else if (cp2 === $.EOF) {
54448
54448
  this._emitEOFToken();
54449
54449
  } else {
54450
- this._emitCodePoint(cp);
54450
+ this._emitCodePoint(cp2);
54451
54451
  }
54452
54452
  }
54453
54453
  // Script data state
54454
54454
  //------------------------------------------------------------------
54455
- [SCRIPT_DATA_STATE](cp) {
54455
+ [SCRIPT_DATA_STATE](cp2) {
54456
54456
  this.preprocessor.dropParsedChunk();
54457
- if (cp === $.LESS_THAN_SIGN) {
54457
+ if (cp2 === $.LESS_THAN_SIGN) {
54458
54458
  this.state = SCRIPT_DATA_LESS_THAN_SIGN_STATE;
54459
- } else if (cp === $.NULL) {
54459
+ } else if (cp2 === $.NULL) {
54460
54460
  this._err(ERR.unexpectedNullCharacter);
54461
54461
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54462
- } else if (cp === $.EOF) {
54462
+ } else if (cp2 === $.EOF) {
54463
54463
  this._emitEOFToken();
54464
54464
  } else {
54465
- this._emitCodePoint(cp);
54465
+ this._emitCodePoint(cp2);
54466
54466
  }
54467
54467
  }
54468
54468
  // PLAINTEXT state
54469
54469
  //------------------------------------------------------------------
54470
- [PLAINTEXT_STATE](cp) {
54470
+ [PLAINTEXT_STATE](cp2) {
54471
54471
  this.preprocessor.dropParsedChunk();
54472
- if (cp === $.NULL) {
54472
+ if (cp2 === $.NULL) {
54473
54473
  this._err(ERR.unexpectedNullCharacter);
54474
54474
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54475
- } else if (cp === $.EOF) {
54475
+ } else if (cp2 === $.EOF) {
54476
54476
  this._emitEOFToken();
54477
54477
  } else {
54478
- this._emitCodePoint(cp);
54478
+ this._emitCodePoint(cp2);
54479
54479
  }
54480
54480
  }
54481
54481
  // Tag open state
54482
54482
  //------------------------------------------------------------------
54483
- [TAG_OPEN_STATE](cp) {
54484
- if (cp === $.EXCLAMATION_MARK) {
54483
+ [TAG_OPEN_STATE](cp2) {
54484
+ if (cp2 === $.EXCLAMATION_MARK) {
54485
54485
  this.state = MARKUP_DECLARATION_OPEN_STATE;
54486
- } else if (cp === $.SOLIDUS) {
54486
+ } else if (cp2 === $.SOLIDUS) {
54487
54487
  this.state = END_TAG_OPEN_STATE;
54488
- } else if (isAsciiLetter(cp)) {
54488
+ } else if (isAsciiLetter(cp2)) {
54489
54489
  this._createStartTagToken();
54490
54490
  this._reconsumeInState(TAG_NAME_STATE);
54491
- } else if (cp === $.QUESTION_MARK) {
54491
+ } else if (cp2 === $.QUESTION_MARK) {
54492
54492
  this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);
54493
54493
  this._createCommentToken();
54494
54494
  this._reconsumeInState(BOGUS_COMMENT_STATE);
54495
- } else if (cp === $.EOF) {
54495
+ } else if (cp2 === $.EOF) {
54496
54496
  this._err(ERR.eofBeforeTagName);
54497
54497
  this._emitChars("<");
54498
54498
  this._emitEOFToken();
@@ -54504,14 +54504,14 @@ var require_tokenizer = __commonJS({
54504
54504
  }
54505
54505
  // End tag open state
54506
54506
  //------------------------------------------------------------------
54507
- [END_TAG_OPEN_STATE](cp) {
54508
- if (isAsciiLetter(cp)) {
54507
+ [END_TAG_OPEN_STATE](cp2) {
54508
+ if (isAsciiLetter(cp2)) {
54509
54509
  this._createEndTagToken();
54510
54510
  this._reconsumeInState(TAG_NAME_STATE);
54511
- } else if (cp === $.GREATER_THAN_SIGN) {
54511
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
54512
54512
  this._err(ERR.missingEndTagName);
54513
54513
  this.state = DATA_STATE;
54514
- } else if (cp === $.EOF) {
54514
+ } else if (cp2 === $.EOF) {
54515
54515
  this._err(ERR.eofBeforeTagName);
54516
54516
  this._emitChars("</");
54517
54517
  this._emitEOFToken();
@@ -54523,30 +54523,30 @@ var require_tokenizer = __commonJS({
54523
54523
  }
54524
54524
  // Tag name state
54525
54525
  //------------------------------------------------------------------
54526
- [TAG_NAME_STATE](cp) {
54527
- if (isWhitespace(cp)) {
54526
+ [TAG_NAME_STATE](cp2) {
54527
+ if (isWhitespace(cp2)) {
54528
54528
  this.state = BEFORE_ATTRIBUTE_NAME_STATE;
54529
- } else if (cp === $.SOLIDUS) {
54529
+ } else if (cp2 === $.SOLIDUS) {
54530
54530
  this.state = SELF_CLOSING_START_TAG_STATE;
54531
- } else if (cp === $.GREATER_THAN_SIGN) {
54531
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
54532
54532
  this.state = DATA_STATE;
54533
54533
  this._emitCurrentToken();
54534
- } else if (isAsciiUpper(cp)) {
54535
- this.currentToken.tagName += toAsciiLowerChar(cp);
54536
- } else if (cp === $.NULL) {
54534
+ } else if (isAsciiUpper(cp2)) {
54535
+ this.currentToken.tagName += toAsciiLowerChar(cp2);
54536
+ } else if (cp2 === $.NULL) {
54537
54537
  this._err(ERR.unexpectedNullCharacter);
54538
54538
  this.currentToken.tagName += unicode.REPLACEMENT_CHARACTER;
54539
- } else if (cp === $.EOF) {
54539
+ } else if (cp2 === $.EOF) {
54540
54540
  this._err(ERR.eofInTag);
54541
54541
  this._emitEOFToken();
54542
54542
  } else {
54543
- this.currentToken.tagName += toChar(cp);
54543
+ this.currentToken.tagName += toChar(cp2);
54544
54544
  }
54545
54545
  }
54546
54546
  // RCDATA less-than sign state
54547
54547
  //------------------------------------------------------------------
54548
- [RCDATA_LESS_THAN_SIGN_STATE](cp) {
54549
- if (cp === $.SOLIDUS) {
54548
+ [RCDATA_LESS_THAN_SIGN_STATE](cp2) {
54549
+ if (cp2 === $.SOLIDUS) {
54550
54550
  this.tempBuff = [];
54551
54551
  this.state = RCDATA_END_TAG_OPEN_STATE;
54552
54552
  } else {
@@ -54556,8 +54556,8 @@ var require_tokenizer = __commonJS({
54556
54556
  }
54557
54557
  // RCDATA end tag open state
54558
54558
  //------------------------------------------------------------------
54559
- [RCDATA_END_TAG_OPEN_STATE](cp) {
54560
- if (isAsciiLetter(cp)) {
54559
+ [RCDATA_END_TAG_OPEN_STATE](cp2) {
54560
+ if (isAsciiLetter(cp2)) {
54561
54561
  this._createEndTagToken();
54562
54562
  this._reconsumeInState(RCDATA_END_TAG_NAME_STATE);
54563
54563
  } else {
@@ -54567,24 +54567,24 @@ var require_tokenizer = __commonJS({
54567
54567
  }
54568
54568
  // RCDATA end tag name state
54569
54569
  //------------------------------------------------------------------
54570
- [RCDATA_END_TAG_NAME_STATE](cp) {
54571
- if (isAsciiUpper(cp)) {
54572
- this.currentToken.tagName += toAsciiLowerChar(cp);
54573
- this.tempBuff.push(cp);
54574
- } else if (isAsciiLower(cp)) {
54575
- this.currentToken.tagName += toChar(cp);
54576
- this.tempBuff.push(cp);
54570
+ [RCDATA_END_TAG_NAME_STATE](cp2) {
54571
+ if (isAsciiUpper(cp2)) {
54572
+ this.currentToken.tagName += toAsciiLowerChar(cp2);
54573
+ this.tempBuff.push(cp2);
54574
+ } else if (isAsciiLower(cp2)) {
54575
+ this.currentToken.tagName += toChar(cp2);
54576
+ this.tempBuff.push(cp2);
54577
54577
  } else {
54578
54578
  if (this.lastStartTagName === this.currentToken.tagName) {
54579
- if (isWhitespace(cp)) {
54579
+ if (isWhitespace(cp2)) {
54580
54580
  this.state = BEFORE_ATTRIBUTE_NAME_STATE;
54581
54581
  return;
54582
54582
  }
54583
- if (cp === $.SOLIDUS) {
54583
+ if (cp2 === $.SOLIDUS) {
54584
54584
  this.state = SELF_CLOSING_START_TAG_STATE;
54585
54585
  return;
54586
54586
  }
54587
- if (cp === $.GREATER_THAN_SIGN) {
54587
+ if (cp2 === $.GREATER_THAN_SIGN) {
54588
54588
  this.state = DATA_STATE;
54589
54589
  this._emitCurrentToken();
54590
54590
  return;
@@ -54597,8 +54597,8 @@ var require_tokenizer = __commonJS({
54597
54597
  }
54598
54598
  // RAWTEXT less-than sign state
54599
54599
  //------------------------------------------------------------------
54600
- [RAWTEXT_LESS_THAN_SIGN_STATE](cp) {
54601
- if (cp === $.SOLIDUS) {
54600
+ [RAWTEXT_LESS_THAN_SIGN_STATE](cp2) {
54601
+ if (cp2 === $.SOLIDUS) {
54602
54602
  this.tempBuff = [];
54603
54603
  this.state = RAWTEXT_END_TAG_OPEN_STATE;
54604
54604
  } else {
@@ -54608,8 +54608,8 @@ var require_tokenizer = __commonJS({
54608
54608
  }
54609
54609
  // RAWTEXT end tag open state
54610
54610
  //------------------------------------------------------------------
54611
- [RAWTEXT_END_TAG_OPEN_STATE](cp) {
54612
- if (isAsciiLetter(cp)) {
54611
+ [RAWTEXT_END_TAG_OPEN_STATE](cp2) {
54612
+ if (isAsciiLetter(cp2)) {
54613
54613
  this._createEndTagToken();
54614
54614
  this._reconsumeInState(RAWTEXT_END_TAG_NAME_STATE);
54615
54615
  } else {
@@ -54619,24 +54619,24 @@ var require_tokenizer = __commonJS({
54619
54619
  }
54620
54620
  // RAWTEXT end tag name state
54621
54621
  //------------------------------------------------------------------
54622
- [RAWTEXT_END_TAG_NAME_STATE](cp) {
54623
- if (isAsciiUpper(cp)) {
54624
- this.currentToken.tagName += toAsciiLowerChar(cp);
54625
- this.tempBuff.push(cp);
54626
- } else if (isAsciiLower(cp)) {
54627
- this.currentToken.tagName += toChar(cp);
54628
- this.tempBuff.push(cp);
54622
+ [RAWTEXT_END_TAG_NAME_STATE](cp2) {
54623
+ if (isAsciiUpper(cp2)) {
54624
+ this.currentToken.tagName += toAsciiLowerChar(cp2);
54625
+ this.tempBuff.push(cp2);
54626
+ } else if (isAsciiLower(cp2)) {
54627
+ this.currentToken.tagName += toChar(cp2);
54628
+ this.tempBuff.push(cp2);
54629
54629
  } else {
54630
54630
  if (this.lastStartTagName === this.currentToken.tagName) {
54631
- if (isWhitespace(cp)) {
54631
+ if (isWhitespace(cp2)) {
54632
54632
  this.state = BEFORE_ATTRIBUTE_NAME_STATE;
54633
54633
  return;
54634
54634
  }
54635
- if (cp === $.SOLIDUS) {
54635
+ if (cp2 === $.SOLIDUS) {
54636
54636
  this.state = SELF_CLOSING_START_TAG_STATE;
54637
54637
  return;
54638
54638
  }
54639
- if (cp === $.GREATER_THAN_SIGN) {
54639
+ if (cp2 === $.GREATER_THAN_SIGN) {
54640
54640
  this._emitCurrentToken();
54641
54641
  this.state = DATA_STATE;
54642
54642
  return;
@@ -54649,11 +54649,11 @@ var require_tokenizer = __commonJS({
54649
54649
  }
54650
54650
  // Script data less-than sign state
54651
54651
  //------------------------------------------------------------------
54652
- [SCRIPT_DATA_LESS_THAN_SIGN_STATE](cp) {
54653
- if (cp === $.SOLIDUS) {
54652
+ [SCRIPT_DATA_LESS_THAN_SIGN_STATE](cp2) {
54653
+ if (cp2 === $.SOLIDUS) {
54654
54654
  this.tempBuff = [];
54655
54655
  this.state = SCRIPT_DATA_END_TAG_OPEN_STATE;
54656
- } else if (cp === $.EXCLAMATION_MARK) {
54656
+ } else if (cp2 === $.EXCLAMATION_MARK) {
54657
54657
  this.state = SCRIPT_DATA_ESCAPE_START_STATE;
54658
54658
  this._emitChars("<!");
54659
54659
  } else {
@@ -54663,8 +54663,8 @@ var require_tokenizer = __commonJS({
54663
54663
  }
54664
54664
  // Script data end tag open state
54665
54665
  //------------------------------------------------------------------
54666
- [SCRIPT_DATA_END_TAG_OPEN_STATE](cp) {
54667
- if (isAsciiLetter(cp)) {
54666
+ [SCRIPT_DATA_END_TAG_OPEN_STATE](cp2) {
54667
+ if (isAsciiLetter(cp2)) {
54668
54668
  this._createEndTagToken();
54669
54669
  this._reconsumeInState(SCRIPT_DATA_END_TAG_NAME_STATE);
54670
54670
  } else {
@@ -54674,22 +54674,22 @@ var require_tokenizer = __commonJS({
54674
54674
  }
54675
54675
  // Script data end tag name state
54676
54676
  //------------------------------------------------------------------
54677
- [SCRIPT_DATA_END_TAG_NAME_STATE](cp) {
54678
- if (isAsciiUpper(cp)) {
54679
- this.currentToken.tagName += toAsciiLowerChar(cp);
54680
- this.tempBuff.push(cp);
54681
- } else if (isAsciiLower(cp)) {
54682
- this.currentToken.tagName += toChar(cp);
54683
- this.tempBuff.push(cp);
54677
+ [SCRIPT_DATA_END_TAG_NAME_STATE](cp2) {
54678
+ if (isAsciiUpper(cp2)) {
54679
+ this.currentToken.tagName += toAsciiLowerChar(cp2);
54680
+ this.tempBuff.push(cp2);
54681
+ } else if (isAsciiLower(cp2)) {
54682
+ this.currentToken.tagName += toChar(cp2);
54683
+ this.tempBuff.push(cp2);
54684
54684
  } else {
54685
54685
  if (this.lastStartTagName === this.currentToken.tagName) {
54686
- if (isWhitespace(cp)) {
54686
+ if (isWhitespace(cp2)) {
54687
54687
  this.state = BEFORE_ATTRIBUTE_NAME_STATE;
54688
54688
  return;
54689
- } else if (cp === $.SOLIDUS) {
54689
+ } else if (cp2 === $.SOLIDUS) {
54690
54690
  this.state = SELF_CLOSING_START_TAG_STATE;
54691
54691
  return;
54692
- } else if (cp === $.GREATER_THAN_SIGN) {
54692
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
54693
54693
  this._emitCurrentToken();
54694
54694
  this.state = DATA_STATE;
54695
54695
  return;
@@ -54702,8 +54702,8 @@ var require_tokenizer = __commonJS({
54702
54702
  }
54703
54703
  // Script data escape start state
54704
54704
  //------------------------------------------------------------------
54705
- [SCRIPT_DATA_ESCAPE_START_STATE](cp) {
54706
- if (cp === $.HYPHEN_MINUS) {
54705
+ [SCRIPT_DATA_ESCAPE_START_STATE](cp2) {
54706
+ if (cp2 === $.HYPHEN_MINUS) {
54707
54707
  this.state = SCRIPT_DATA_ESCAPE_START_DASH_STATE;
54708
54708
  this._emitChars("-");
54709
54709
  } else {
@@ -54712,8 +54712,8 @@ var require_tokenizer = __commonJS({
54712
54712
  }
54713
54713
  // Script data escape start dash state
54714
54714
  //------------------------------------------------------------------
54715
- [SCRIPT_DATA_ESCAPE_START_DASH_STATE](cp) {
54716
- if (cp === $.HYPHEN_MINUS) {
54715
+ [SCRIPT_DATA_ESCAPE_START_DASH_STATE](cp2) {
54716
+ if (cp2 === $.HYPHEN_MINUS) {
54717
54717
  this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE;
54718
54718
  this._emitChars("-");
54719
54719
  } else {
@@ -54722,71 +54722,71 @@ var require_tokenizer = __commonJS({
54722
54722
  }
54723
54723
  // Script data escaped state
54724
54724
  //------------------------------------------------------------------
54725
- [SCRIPT_DATA_ESCAPED_STATE](cp) {
54726
- if (cp === $.HYPHEN_MINUS) {
54725
+ [SCRIPT_DATA_ESCAPED_STATE](cp2) {
54726
+ if (cp2 === $.HYPHEN_MINUS) {
54727
54727
  this.state = SCRIPT_DATA_ESCAPED_DASH_STATE;
54728
54728
  this._emitChars("-");
54729
- } else if (cp === $.LESS_THAN_SIGN) {
54729
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54730
54730
  this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
54731
- } else if (cp === $.NULL) {
54731
+ } else if (cp2 === $.NULL) {
54732
54732
  this._err(ERR.unexpectedNullCharacter);
54733
54733
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54734
- } else if (cp === $.EOF) {
54734
+ } else if (cp2 === $.EOF) {
54735
54735
  this._err(ERR.eofInScriptHtmlCommentLikeText);
54736
54736
  this._emitEOFToken();
54737
54737
  } else {
54738
- this._emitCodePoint(cp);
54738
+ this._emitCodePoint(cp2);
54739
54739
  }
54740
54740
  }
54741
54741
  // Script data escaped dash state
54742
54742
  //------------------------------------------------------------------
54743
- [SCRIPT_DATA_ESCAPED_DASH_STATE](cp) {
54744
- if (cp === $.HYPHEN_MINUS) {
54743
+ [SCRIPT_DATA_ESCAPED_DASH_STATE](cp2) {
54744
+ if (cp2 === $.HYPHEN_MINUS) {
54745
54745
  this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE;
54746
54746
  this._emitChars("-");
54747
- } else if (cp === $.LESS_THAN_SIGN) {
54747
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54748
54748
  this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
54749
- } else if (cp === $.NULL) {
54749
+ } else if (cp2 === $.NULL) {
54750
54750
  this._err(ERR.unexpectedNullCharacter);
54751
54751
  this.state = SCRIPT_DATA_ESCAPED_STATE;
54752
54752
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54753
- } else if (cp === $.EOF) {
54753
+ } else if (cp2 === $.EOF) {
54754
54754
  this._err(ERR.eofInScriptHtmlCommentLikeText);
54755
54755
  this._emitEOFToken();
54756
54756
  } else {
54757
54757
  this.state = SCRIPT_DATA_ESCAPED_STATE;
54758
- this._emitCodePoint(cp);
54758
+ this._emitCodePoint(cp2);
54759
54759
  }
54760
54760
  }
54761
54761
  // Script data escaped dash dash state
54762
54762
  //------------------------------------------------------------------
54763
- [SCRIPT_DATA_ESCAPED_DASH_DASH_STATE](cp) {
54764
- if (cp === $.HYPHEN_MINUS) {
54763
+ [SCRIPT_DATA_ESCAPED_DASH_DASH_STATE](cp2) {
54764
+ if (cp2 === $.HYPHEN_MINUS) {
54765
54765
  this._emitChars("-");
54766
- } else if (cp === $.LESS_THAN_SIGN) {
54766
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54767
54767
  this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
54768
- } else if (cp === $.GREATER_THAN_SIGN) {
54768
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
54769
54769
  this.state = SCRIPT_DATA_STATE;
54770
54770
  this._emitChars(">");
54771
- } else if (cp === $.NULL) {
54771
+ } else if (cp2 === $.NULL) {
54772
54772
  this._err(ERR.unexpectedNullCharacter);
54773
54773
  this.state = SCRIPT_DATA_ESCAPED_STATE;
54774
54774
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54775
- } else if (cp === $.EOF) {
54775
+ } else if (cp2 === $.EOF) {
54776
54776
  this._err(ERR.eofInScriptHtmlCommentLikeText);
54777
54777
  this._emitEOFToken();
54778
54778
  } else {
54779
54779
  this.state = SCRIPT_DATA_ESCAPED_STATE;
54780
- this._emitCodePoint(cp);
54780
+ this._emitCodePoint(cp2);
54781
54781
  }
54782
54782
  }
54783
54783
  // Script data escaped less-than sign state
54784
54784
  //------------------------------------------------------------------
54785
- [SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE](cp) {
54786
- if (cp === $.SOLIDUS) {
54785
+ [SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE](cp2) {
54786
+ if (cp2 === $.SOLIDUS) {
54787
54787
  this.tempBuff = [];
54788
54788
  this.state = SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE;
54789
- } else if (isAsciiLetter(cp)) {
54789
+ } else if (isAsciiLetter(cp2)) {
54790
54790
  this.tempBuff = [];
54791
54791
  this._emitChars("<");
54792
54792
  this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE);
@@ -54797,8 +54797,8 @@ var require_tokenizer = __commonJS({
54797
54797
  }
54798
54798
  // Script data escaped end tag open state
54799
54799
  //------------------------------------------------------------------
54800
- [SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE](cp) {
54801
- if (isAsciiLetter(cp)) {
54800
+ [SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE](cp2) {
54801
+ if (isAsciiLetter(cp2)) {
54802
54802
  this._createEndTagToken();
54803
54803
  this._reconsumeInState(SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE);
54804
54804
  } else {
@@ -54808,24 +54808,24 @@ var require_tokenizer = __commonJS({
54808
54808
  }
54809
54809
  // Script data escaped end tag name state
54810
54810
  //------------------------------------------------------------------
54811
- [SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE](cp) {
54812
- if (isAsciiUpper(cp)) {
54813
- this.currentToken.tagName += toAsciiLowerChar(cp);
54814
- this.tempBuff.push(cp);
54815
- } else if (isAsciiLower(cp)) {
54816
- this.currentToken.tagName += toChar(cp);
54817
- this.tempBuff.push(cp);
54811
+ [SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE](cp2) {
54812
+ if (isAsciiUpper(cp2)) {
54813
+ this.currentToken.tagName += toAsciiLowerChar(cp2);
54814
+ this.tempBuff.push(cp2);
54815
+ } else if (isAsciiLower(cp2)) {
54816
+ this.currentToken.tagName += toChar(cp2);
54817
+ this.tempBuff.push(cp2);
54818
54818
  } else {
54819
54819
  if (this.lastStartTagName === this.currentToken.tagName) {
54820
- if (isWhitespace(cp)) {
54820
+ if (isWhitespace(cp2)) {
54821
54821
  this.state = BEFORE_ATTRIBUTE_NAME_STATE;
54822
54822
  return;
54823
54823
  }
54824
- if (cp === $.SOLIDUS) {
54824
+ if (cp2 === $.SOLIDUS) {
54825
54825
  this.state = SELF_CLOSING_START_TAG_STATE;
54826
54826
  return;
54827
54827
  }
54828
- if (cp === $.GREATER_THAN_SIGN) {
54828
+ if (cp2 === $.GREATER_THAN_SIGN) {
54829
54829
  this._emitCurrentToken();
54830
54830
  this.state = DATA_STATE;
54831
54831
  return;
@@ -54838,87 +54838,87 @@ var require_tokenizer = __commonJS({
54838
54838
  }
54839
54839
  // Script data double escape start state
54840
54840
  //------------------------------------------------------------------
54841
- [SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE](cp) {
54842
- if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) {
54841
+ [SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE](cp2) {
54842
+ if (isWhitespace(cp2) || cp2 === $.SOLIDUS || cp2 === $.GREATER_THAN_SIGN) {
54843
54843
  this.state = this._isTempBufferEqualToScriptString() ? SCRIPT_DATA_DOUBLE_ESCAPED_STATE : SCRIPT_DATA_ESCAPED_STATE;
54844
- this._emitCodePoint(cp);
54845
- } else if (isAsciiUpper(cp)) {
54846
- this.tempBuff.push(toAsciiLowerCodePoint(cp));
54847
- this._emitCodePoint(cp);
54848
- } else if (isAsciiLower(cp)) {
54849
- this.tempBuff.push(cp);
54850
- this._emitCodePoint(cp);
54844
+ this._emitCodePoint(cp2);
54845
+ } else if (isAsciiUpper(cp2)) {
54846
+ this.tempBuff.push(toAsciiLowerCodePoint(cp2));
54847
+ this._emitCodePoint(cp2);
54848
+ } else if (isAsciiLower(cp2)) {
54849
+ this.tempBuff.push(cp2);
54850
+ this._emitCodePoint(cp2);
54851
54851
  } else {
54852
54852
  this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE);
54853
54853
  }
54854
54854
  }
54855
54855
  // Script data double escaped state
54856
54856
  //------------------------------------------------------------------
54857
- [SCRIPT_DATA_DOUBLE_ESCAPED_STATE](cp) {
54858
- if (cp === $.HYPHEN_MINUS) {
54857
+ [SCRIPT_DATA_DOUBLE_ESCAPED_STATE](cp2) {
54858
+ if (cp2 === $.HYPHEN_MINUS) {
54859
54859
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE;
54860
54860
  this._emitChars("-");
54861
- } else if (cp === $.LESS_THAN_SIGN) {
54861
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54862
54862
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;
54863
54863
  this._emitChars("<");
54864
- } else if (cp === $.NULL) {
54864
+ } else if (cp2 === $.NULL) {
54865
54865
  this._err(ERR.unexpectedNullCharacter);
54866
54866
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54867
- } else if (cp === $.EOF) {
54867
+ } else if (cp2 === $.EOF) {
54868
54868
  this._err(ERR.eofInScriptHtmlCommentLikeText);
54869
54869
  this._emitEOFToken();
54870
54870
  } else {
54871
- this._emitCodePoint(cp);
54871
+ this._emitCodePoint(cp2);
54872
54872
  }
54873
54873
  }
54874
54874
  // Script data double escaped dash state
54875
54875
  //------------------------------------------------------------------
54876
- [SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE](cp) {
54877
- if (cp === $.HYPHEN_MINUS) {
54876
+ [SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE](cp2) {
54877
+ if (cp2 === $.HYPHEN_MINUS) {
54878
54878
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE;
54879
54879
  this._emitChars("-");
54880
- } else if (cp === $.LESS_THAN_SIGN) {
54880
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54881
54881
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;
54882
54882
  this._emitChars("<");
54883
- } else if (cp === $.NULL) {
54883
+ } else if (cp2 === $.NULL) {
54884
54884
  this._err(ERR.unexpectedNullCharacter);
54885
54885
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
54886
54886
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54887
- } else if (cp === $.EOF) {
54887
+ } else if (cp2 === $.EOF) {
54888
54888
  this._err(ERR.eofInScriptHtmlCommentLikeText);
54889
54889
  this._emitEOFToken();
54890
54890
  } else {
54891
54891
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
54892
- this._emitCodePoint(cp);
54892
+ this._emitCodePoint(cp2);
54893
54893
  }
54894
54894
  }
54895
54895
  // Script data double escaped dash dash state
54896
54896
  //------------------------------------------------------------------
54897
- [SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE](cp) {
54898
- if (cp === $.HYPHEN_MINUS) {
54897
+ [SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE](cp2) {
54898
+ if (cp2 === $.HYPHEN_MINUS) {
54899
54899
  this._emitChars("-");
54900
- } else if (cp === $.LESS_THAN_SIGN) {
54900
+ } else if (cp2 === $.LESS_THAN_SIGN) {
54901
54901
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;
54902
54902
  this._emitChars("<");
54903
- } else if (cp === $.GREATER_THAN_SIGN) {
54903
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
54904
54904
  this.state = SCRIPT_DATA_STATE;
54905
54905
  this._emitChars(">");
54906
- } else if (cp === $.NULL) {
54906
+ } else if (cp2 === $.NULL) {
54907
54907
  this._err(ERR.unexpectedNullCharacter);
54908
54908
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
54909
54909
  this._emitChars(unicode.REPLACEMENT_CHARACTER);
54910
- } else if (cp === $.EOF) {
54910
+ } else if (cp2 === $.EOF) {
54911
54911
  this._err(ERR.eofInScriptHtmlCommentLikeText);
54912
54912
  this._emitEOFToken();
54913
54913
  } else {
54914
54914
  this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
54915
- this._emitCodePoint(cp);
54915
+ this._emitCodePoint(cp2);
54916
54916
  }
54917
54917
  }
54918
54918
  // Script data double escaped less-than sign state
54919
54919
  //------------------------------------------------------------------
54920
- [SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE](cp) {
54921
- if (cp === $.SOLIDUS) {
54920
+ [SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE](cp2) {
54921
+ if (cp2 === $.SOLIDUS) {
54922
54922
  this.tempBuff = [];
54923
54923
  this.state = SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE;
54924
54924
  this._emitChars("/");
@@ -54928,29 +54928,29 @@ var require_tokenizer = __commonJS({
54928
54928
  }
54929
54929
  // Script data double escape end state
54930
54930
  //------------------------------------------------------------------
54931
- [SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE](cp) {
54932
- if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) {
54931
+ [SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE](cp2) {
54932
+ if (isWhitespace(cp2) || cp2 === $.SOLIDUS || cp2 === $.GREATER_THAN_SIGN) {
54933
54933
  this.state = this._isTempBufferEqualToScriptString() ? SCRIPT_DATA_ESCAPED_STATE : SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
54934
- this._emitCodePoint(cp);
54935
- } else if (isAsciiUpper(cp)) {
54936
- this.tempBuff.push(toAsciiLowerCodePoint(cp));
54937
- this._emitCodePoint(cp);
54938
- } else if (isAsciiLower(cp)) {
54939
- this.tempBuff.push(cp);
54940
- this._emitCodePoint(cp);
54934
+ this._emitCodePoint(cp2);
54935
+ } else if (isAsciiUpper(cp2)) {
54936
+ this.tempBuff.push(toAsciiLowerCodePoint(cp2));
54937
+ this._emitCodePoint(cp2);
54938
+ } else if (isAsciiLower(cp2)) {
54939
+ this.tempBuff.push(cp2);
54940
+ this._emitCodePoint(cp2);
54941
54941
  } else {
54942
54942
  this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE);
54943
54943
  }
54944
54944
  }
54945
54945
  // Before attribute name state
54946
54946
  //------------------------------------------------------------------
54947
- [BEFORE_ATTRIBUTE_NAME_STATE](cp) {
54948
- if (isWhitespace(cp)) {
54947
+ [BEFORE_ATTRIBUTE_NAME_STATE](cp2) {
54948
+ if (isWhitespace(cp2)) {
54949
54949
  return;
54950
54950
  }
54951
- if (cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) {
54951
+ if (cp2 === $.SOLIDUS || cp2 === $.GREATER_THAN_SIGN || cp2 === $.EOF) {
54952
54952
  this._reconsumeInState(AFTER_ATTRIBUTE_NAME_STATE);
54953
- } else if (cp === $.EQUALS_SIGN) {
54953
+ } else if (cp2 === $.EQUALS_SIGN) {
54954
54954
  this._err(ERR.unexpectedEqualsSignBeforeAttributeName);
54955
54955
  this._createAttr("=");
54956
54956
  this.state = ATTRIBUTE_NAME_STATE;
@@ -54961,38 +54961,38 @@ var require_tokenizer = __commonJS({
54961
54961
  }
54962
54962
  // Attribute name state
54963
54963
  //------------------------------------------------------------------
54964
- [ATTRIBUTE_NAME_STATE](cp) {
54965
- if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) {
54964
+ [ATTRIBUTE_NAME_STATE](cp2) {
54965
+ if (isWhitespace(cp2) || cp2 === $.SOLIDUS || cp2 === $.GREATER_THAN_SIGN || cp2 === $.EOF) {
54966
54966
  this._leaveAttrName(AFTER_ATTRIBUTE_NAME_STATE);
54967
54967
  this._unconsume();
54968
- } else if (cp === $.EQUALS_SIGN) {
54968
+ } else if (cp2 === $.EQUALS_SIGN) {
54969
54969
  this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE);
54970
- } else if (isAsciiUpper(cp)) {
54971
- this.currentAttr.name += toAsciiLowerChar(cp);
54972
- } else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN) {
54970
+ } else if (isAsciiUpper(cp2)) {
54971
+ this.currentAttr.name += toAsciiLowerChar(cp2);
54972
+ } else if (cp2 === $.QUOTATION_MARK || cp2 === $.APOSTROPHE || cp2 === $.LESS_THAN_SIGN) {
54973
54973
  this._err(ERR.unexpectedCharacterInAttributeName);
54974
- this.currentAttr.name += toChar(cp);
54975
- } else if (cp === $.NULL) {
54974
+ this.currentAttr.name += toChar(cp2);
54975
+ } else if (cp2 === $.NULL) {
54976
54976
  this._err(ERR.unexpectedNullCharacter);
54977
54977
  this.currentAttr.name += unicode.REPLACEMENT_CHARACTER;
54978
54978
  } else {
54979
- this.currentAttr.name += toChar(cp);
54979
+ this.currentAttr.name += toChar(cp2);
54980
54980
  }
54981
54981
  }
54982
54982
  // After attribute name state
54983
54983
  //------------------------------------------------------------------
54984
- [AFTER_ATTRIBUTE_NAME_STATE](cp) {
54985
- if (isWhitespace(cp)) {
54984
+ [AFTER_ATTRIBUTE_NAME_STATE](cp2) {
54985
+ if (isWhitespace(cp2)) {
54986
54986
  return;
54987
54987
  }
54988
- if (cp === $.SOLIDUS) {
54988
+ if (cp2 === $.SOLIDUS) {
54989
54989
  this.state = SELF_CLOSING_START_TAG_STATE;
54990
- } else if (cp === $.EQUALS_SIGN) {
54990
+ } else if (cp2 === $.EQUALS_SIGN) {
54991
54991
  this.state = BEFORE_ATTRIBUTE_VALUE_STATE;
54992
- } else if (cp === $.GREATER_THAN_SIGN) {
54992
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
54993
54993
  this.state = DATA_STATE;
54994
54994
  this._emitCurrentToken();
54995
- } else if (cp === $.EOF) {
54995
+ } else if (cp2 === $.EOF) {
54996
54996
  this._err(ERR.eofInTag);
54997
54997
  this._emitEOFToken();
54998
54998
  } else {
@@ -55002,15 +55002,15 @@ var require_tokenizer = __commonJS({
55002
55002
  }
55003
55003
  // Before attribute value state
55004
55004
  //------------------------------------------------------------------
55005
- [BEFORE_ATTRIBUTE_VALUE_STATE](cp) {
55006
- if (isWhitespace(cp)) {
55005
+ [BEFORE_ATTRIBUTE_VALUE_STATE](cp2) {
55006
+ if (isWhitespace(cp2)) {
55007
55007
  return;
55008
55008
  }
55009
- if (cp === $.QUOTATION_MARK) {
55009
+ if (cp2 === $.QUOTATION_MARK) {
55010
55010
  this.state = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;
55011
- } else if (cp === $.APOSTROPHE) {
55011
+ } else if (cp2 === $.APOSTROPHE) {
55012
55012
  this.state = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;
55013
- } else if (cp === $.GREATER_THAN_SIGN) {
55013
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55014
55014
  this._err(ERR.missingAttributeValue);
55015
55015
  this.state = DATA_STATE;
55016
55016
  this._emitCurrentToken();
@@ -55020,75 +55020,75 @@ var require_tokenizer = __commonJS({
55020
55020
  }
55021
55021
  // Attribute value (double-quoted) state
55022
55022
  //------------------------------------------------------------------
55023
- [ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE](cp) {
55024
- if (cp === $.QUOTATION_MARK) {
55023
+ [ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE](cp2) {
55024
+ if (cp2 === $.QUOTATION_MARK) {
55025
55025
  this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;
55026
- } else if (cp === $.AMPERSAND) {
55026
+ } else if (cp2 === $.AMPERSAND) {
55027
55027
  this.returnState = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;
55028
55028
  this.state = CHARACTER_REFERENCE_STATE;
55029
- } else if (cp === $.NULL) {
55029
+ } else if (cp2 === $.NULL) {
55030
55030
  this._err(ERR.unexpectedNullCharacter);
55031
55031
  this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
55032
- } else if (cp === $.EOF) {
55032
+ } else if (cp2 === $.EOF) {
55033
55033
  this._err(ERR.eofInTag);
55034
55034
  this._emitEOFToken();
55035
55035
  } else {
55036
- this.currentAttr.value += toChar(cp);
55036
+ this.currentAttr.value += toChar(cp2);
55037
55037
  }
55038
55038
  }
55039
55039
  // Attribute value (single-quoted) state
55040
55040
  //------------------------------------------------------------------
55041
- [ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE](cp) {
55042
- if (cp === $.APOSTROPHE) {
55041
+ [ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE](cp2) {
55042
+ if (cp2 === $.APOSTROPHE) {
55043
55043
  this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;
55044
- } else if (cp === $.AMPERSAND) {
55044
+ } else if (cp2 === $.AMPERSAND) {
55045
55045
  this.returnState = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;
55046
55046
  this.state = CHARACTER_REFERENCE_STATE;
55047
- } else if (cp === $.NULL) {
55047
+ } else if (cp2 === $.NULL) {
55048
55048
  this._err(ERR.unexpectedNullCharacter);
55049
55049
  this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
55050
- } else if (cp === $.EOF) {
55050
+ } else if (cp2 === $.EOF) {
55051
55051
  this._err(ERR.eofInTag);
55052
55052
  this._emitEOFToken();
55053
55053
  } else {
55054
- this.currentAttr.value += toChar(cp);
55054
+ this.currentAttr.value += toChar(cp2);
55055
55055
  }
55056
55056
  }
55057
55057
  // Attribute value (unquoted) state
55058
55058
  //------------------------------------------------------------------
55059
- [ATTRIBUTE_VALUE_UNQUOTED_STATE](cp) {
55060
- if (isWhitespace(cp)) {
55059
+ [ATTRIBUTE_VALUE_UNQUOTED_STATE](cp2) {
55060
+ if (isWhitespace(cp2)) {
55061
55061
  this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);
55062
- } else if (cp === $.AMPERSAND) {
55062
+ } else if (cp2 === $.AMPERSAND) {
55063
55063
  this.returnState = ATTRIBUTE_VALUE_UNQUOTED_STATE;
55064
55064
  this.state = CHARACTER_REFERENCE_STATE;
55065
- } else if (cp === $.GREATER_THAN_SIGN) {
55065
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55066
55066
  this._leaveAttrValue(DATA_STATE);
55067
55067
  this._emitCurrentToken();
55068
- } else if (cp === $.NULL) {
55068
+ } else if (cp2 === $.NULL) {
55069
55069
  this._err(ERR.unexpectedNullCharacter);
55070
55070
  this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
55071
- } else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN || cp === $.EQUALS_SIGN || cp === $.GRAVE_ACCENT) {
55071
+ } else if (cp2 === $.QUOTATION_MARK || cp2 === $.APOSTROPHE || cp2 === $.LESS_THAN_SIGN || cp2 === $.EQUALS_SIGN || cp2 === $.GRAVE_ACCENT) {
55072
55072
  this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);
55073
- this.currentAttr.value += toChar(cp);
55074
- } else if (cp === $.EOF) {
55073
+ this.currentAttr.value += toChar(cp2);
55074
+ } else if (cp2 === $.EOF) {
55075
55075
  this._err(ERR.eofInTag);
55076
55076
  this._emitEOFToken();
55077
55077
  } else {
55078
- this.currentAttr.value += toChar(cp);
55078
+ this.currentAttr.value += toChar(cp2);
55079
55079
  }
55080
55080
  }
55081
55081
  // After attribute value (quoted) state
55082
55082
  //------------------------------------------------------------------
55083
- [AFTER_ATTRIBUTE_VALUE_QUOTED_STATE](cp) {
55084
- if (isWhitespace(cp)) {
55083
+ [AFTER_ATTRIBUTE_VALUE_QUOTED_STATE](cp2) {
55084
+ if (isWhitespace(cp2)) {
55085
55085
  this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);
55086
- } else if (cp === $.SOLIDUS) {
55086
+ } else if (cp2 === $.SOLIDUS) {
55087
55087
  this._leaveAttrValue(SELF_CLOSING_START_TAG_STATE);
55088
- } else if (cp === $.GREATER_THAN_SIGN) {
55088
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55089
55089
  this._leaveAttrValue(DATA_STATE);
55090
55090
  this._emitCurrentToken();
55091
- } else if (cp === $.EOF) {
55091
+ } else if (cp2 === $.EOF) {
55092
55092
  this._err(ERR.eofInTag);
55093
55093
  this._emitEOFToken();
55094
55094
  } else {
@@ -55098,12 +55098,12 @@ var require_tokenizer = __commonJS({
55098
55098
  }
55099
55099
  // Self-closing start tag state
55100
55100
  //------------------------------------------------------------------
55101
- [SELF_CLOSING_START_TAG_STATE](cp) {
55102
- if (cp === $.GREATER_THAN_SIGN) {
55101
+ [SELF_CLOSING_START_TAG_STATE](cp2) {
55102
+ if (cp2 === $.GREATER_THAN_SIGN) {
55103
55103
  this.currentToken.selfClosing = true;
55104
55104
  this.state = DATA_STATE;
55105
55105
  this._emitCurrentToken();
55106
- } else if (cp === $.EOF) {
55106
+ } else if (cp2 === $.EOF) {
55107
55107
  this._err(ERR.eofInTag);
55108
55108
  this._emitEOFToken();
55109
55109
  } else {
@@ -55113,29 +55113,29 @@ var require_tokenizer = __commonJS({
55113
55113
  }
55114
55114
  // Bogus comment state
55115
55115
  //------------------------------------------------------------------
55116
- [BOGUS_COMMENT_STATE](cp) {
55117
- if (cp === $.GREATER_THAN_SIGN) {
55116
+ [BOGUS_COMMENT_STATE](cp2) {
55117
+ if (cp2 === $.GREATER_THAN_SIGN) {
55118
55118
  this.state = DATA_STATE;
55119
55119
  this._emitCurrentToken();
55120
- } else if (cp === $.EOF) {
55120
+ } else if (cp2 === $.EOF) {
55121
55121
  this._emitCurrentToken();
55122
55122
  this._emitEOFToken();
55123
- } else if (cp === $.NULL) {
55123
+ } else if (cp2 === $.NULL) {
55124
55124
  this._err(ERR.unexpectedNullCharacter);
55125
55125
  this.currentToken.data += unicode.REPLACEMENT_CHARACTER;
55126
55126
  } else {
55127
- this.currentToken.data += toChar(cp);
55127
+ this.currentToken.data += toChar(cp2);
55128
55128
  }
55129
55129
  }
55130
55130
  // Markup declaration open state
55131
55131
  //------------------------------------------------------------------
55132
- [MARKUP_DECLARATION_OPEN_STATE](cp) {
55133
- if (this._consumeSequenceIfMatch($$.DASH_DASH_STRING, cp, true)) {
55132
+ [MARKUP_DECLARATION_OPEN_STATE](cp2) {
55133
+ if (this._consumeSequenceIfMatch($$.DASH_DASH_STRING, cp2, true)) {
55134
55134
  this._createCommentToken();
55135
55135
  this.state = COMMENT_START_STATE;
55136
- } else if (this._consumeSequenceIfMatch($$.DOCTYPE_STRING, cp, false)) {
55136
+ } else if (this._consumeSequenceIfMatch($$.DOCTYPE_STRING, cp2, false)) {
55137
55137
  this.state = DOCTYPE_STATE;
55138
- } else if (this._consumeSequenceIfMatch($$.CDATA_START_STRING, cp, true)) {
55138
+ } else if (this._consumeSequenceIfMatch($$.CDATA_START_STRING, cp2, true)) {
55139
55139
  if (this.allowCDATA) {
55140
55140
  this.state = CDATA_SECTION_STATE;
55141
55141
  } else {
@@ -55152,10 +55152,10 @@ var require_tokenizer = __commonJS({
55152
55152
  }
55153
55153
  // Comment start state
55154
55154
  //------------------------------------------------------------------
55155
- [COMMENT_START_STATE](cp) {
55156
- if (cp === $.HYPHEN_MINUS) {
55155
+ [COMMENT_START_STATE](cp2) {
55156
+ if (cp2 === $.HYPHEN_MINUS) {
55157
55157
  this.state = COMMENT_START_DASH_STATE;
55158
- } else if (cp === $.GREATER_THAN_SIGN) {
55158
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55159
55159
  this._err(ERR.abruptClosingOfEmptyComment);
55160
55160
  this.state = DATA_STATE;
55161
55161
  this._emitCurrentToken();
@@ -55165,14 +55165,14 @@ var require_tokenizer = __commonJS({
55165
55165
  }
55166
55166
  // Comment start dash state
55167
55167
  //------------------------------------------------------------------
55168
- [COMMENT_START_DASH_STATE](cp) {
55169
- if (cp === $.HYPHEN_MINUS) {
55168
+ [COMMENT_START_DASH_STATE](cp2) {
55169
+ if (cp2 === $.HYPHEN_MINUS) {
55170
55170
  this.state = COMMENT_END_STATE;
55171
- } else if (cp === $.GREATER_THAN_SIGN) {
55171
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55172
55172
  this._err(ERR.abruptClosingOfEmptyComment);
55173
55173
  this.state = DATA_STATE;
55174
55174
  this._emitCurrentToken();
55175
- } else if (cp === $.EOF) {
55175
+ } else if (cp2 === $.EOF) {
55176
55176
  this._err(ERR.eofInComment);
55177
55177
  this._emitCurrentToken();
55178
55178
  this._emitEOFToken();
@@ -55183,30 +55183,30 @@ var require_tokenizer = __commonJS({
55183
55183
  }
55184
55184
  // Comment state
55185
55185
  //------------------------------------------------------------------
55186
- [COMMENT_STATE](cp) {
55187
- if (cp === $.HYPHEN_MINUS) {
55186
+ [COMMENT_STATE](cp2) {
55187
+ if (cp2 === $.HYPHEN_MINUS) {
55188
55188
  this.state = COMMENT_END_DASH_STATE;
55189
- } else if (cp === $.LESS_THAN_SIGN) {
55189
+ } else if (cp2 === $.LESS_THAN_SIGN) {
55190
55190
  this.currentToken.data += "<";
55191
55191
  this.state = COMMENT_LESS_THAN_SIGN_STATE;
55192
- } else if (cp === $.NULL) {
55192
+ } else if (cp2 === $.NULL) {
55193
55193
  this._err(ERR.unexpectedNullCharacter);
55194
55194
  this.currentToken.data += unicode.REPLACEMENT_CHARACTER;
55195
- } else if (cp === $.EOF) {
55195
+ } else if (cp2 === $.EOF) {
55196
55196
  this._err(ERR.eofInComment);
55197
55197
  this._emitCurrentToken();
55198
55198
  this._emitEOFToken();
55199
55199
  } else {
55200
- this.currentToken.data += toChar(cp);
55200
+ this.currentToken.data += toChar(cp2);
55201
55201
  }
55202
55202
  }
55203
55203
  // Comment less-than sign state
55204
55204
  //------------------------------------------------------------------
55205
- [COMMENT_LESS_THAN_SIGN_STATE](cp) {
55206
- if (cp === $.EXCLAMATION_MARK) {
55205
+ [COMMENT_LESS_THAN_SIGN_STATE](cp2) {
55206
+ if (cp2 === $.EXCLAMATION_MARK) {
55207
55207
  this.currentToken.data += "!";
55208
55208
  this.state = COMMENT_LESS_THAN_SIGN_BANG_STATE;
55209
- } else if (cp === $.LESS_THAN_SIGN) {
55209
+ } else if (cp2 === $.LESS_THAN_SIGN) {
55210
55210
  this.currentToken.data += "!";
55211
55211
  } else {
55212
55212
  this._reconsumeInState(COMMENT_STATE);
@@ -55214,8 +55214,8 @@ var require_tokenizer = __commonJS({
55214
55214
  }
55215
55215
  // Comment less-than sign bang state
55216
55216
  //------------------------------------------------------------------
55217
- [COMMENT_LESS_THAN_SIGN_BANG_STATE](cp) {
55218
- if (cp === $.HYPHEN_MINUS) {
55217
+ [COMMENT_LESS_THAN_SIGN_BANG_STATE](cp2) {
55218
+ if (cp2 === $.HYPHEN_MINUS) {
55219
55219
  this.state = COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE;
55220
55220
  } else {
55221
55221
  this._reconsumeInState(COMMENT_STATE);
@@ -55223,8 +55223,8 @@ var require_tokenizer = __commonJS({
55223
55223
  }
55224
55224
  // Comment less-than sign bang dash state
55225
55225
  //------------------------------------------------------------------
55226
- [COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE](cp) {
55227
- if (cp === $.HYPHEN_MINUS) {
55226
+ [COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE](cp2) {
55227
+ if (cp2 === $.HYPHEN_MINUS) {
55228
55228
  this.state = COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE;
55229
55229
  } else {
55230
55230
  this._reconsumeInState(COMMENT_END_DASH_STATE);
@@ -55232,18 +55232,18 @@ var require_tokenizer = __commonJS({
55232
55232
  }
55233
55233
  // Comment less-than sign bang dash dash state
55234
55234
  //------------------------------------------------------------------
55235
- [COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE](cp) {
55236
- if (cp !== $.GREATER_THAN_SIGN && cp !== $.EOF) {
55235
+ [COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE](cp2) {
55236
+ if (cp2 !== $.GREATER_THAN_SIGN && cp2 !== $.EOF) {
55237
55237
  this._err(ERR.nestedComment);
55238
55238
  }
55239
55239
  this._reconsumeInState(COMMENT_END_STATE);
55240
55240
  }
55241
55241
  // Comment end dash state
55242
55242
  //------------------------------------------------------------------
55243
- [COMMENT_END_DASH_STATE](cp) {
55244
- if (cp === $.HYPHEN_MINUS) {
55243
+ [COMMENT_END_DASH_STATE](cp2) {
55244
+ if (cp2 === $.HYPHEN_MINUS) {
55245
55245
  this.state = COMMENT_END_STATE;
55246
- } else if (cp === $.EOF) {
55246
+ } else if (cp2 === $.EOF) {
55247
55247
  this._err(ERR.eofInComment);
55248
55248
  this._emitCurrentToken();
55249
55249
  this._emitEOFToken();
@@ -55254,15 +55254,15 @@ var require_tokenizer = __commonJS({
55254
55254
  }
55255
55255
  // Comment end state
55256
55256
  //------------------------------------------------------------------
55257
- [COMMENT_END_STATE](cp) {
55258
- if (cp === $.GREATER_THAN_SIGN) {
55257
+ [COMMENT_END_STATE](cp2) {
55258
+ if (cp2 === $.GREATER_THAN_SIGN) {
55259
55259
  this.state = DATA_STATE;
55260
55260
  this._emitCurrentToken();
55261
- } else if (cp === $.EXCLAMATION_MARK) {
55261
+ } else if (cp2 === $.EXCLAMATION_MARK) {
55262
55262
  this.state = COMMENT_END_BANG_STATE;
55263
- } else if (cp === $.HYPHEN_MINUS) {
55263
+ } else if (cp2 === $.HYPHEN_MINUS) {
55264
55264
  this.currentToken.data += "-";
55265
- } else if (cp === $.EOF) {
55265
+ } else if (cp2 === $.EOF) {
55266
55266
  this._err(ERR.eofInComment);
55267
55267
  this._emitCurrentToken();
55268
55268
  this._emitEOFToken();
@@ -55273,15 +55273,15 @@ var require_tokenizer = __commonJS({
55273
55273
  }
55274
55274
  // Comment end bang state
55275
55275
  //------------------------------------------------------------------
55276
- [COMMENT_END_BANG_STATE](cp) {
55277
- if (cp === $.HYPHEN_MINUS) {
55276
+ [COMMENT_END_BANG_STATE](cp2) {
55277
+ if (cp2 === $.HYPHEN_MINUS) {
55278
55278
  this.currentToken.data += "--!";
55279
55279
  this.state = COMMENT_END_DASH_STATE;
55280
- } else if (cp === $.GREATER_THAN_SIGN) {
55280
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55281
55281
  this._err(ERR.incorrectlyClosedComment);
55282
55282
  this.state = DATA_STATE;
55283
55283
  this._emitCurrentToken();
55284
- } else if (cp === $.EOF) {
55284
+ } else if (cp2 === $.EOF) {
55285
55285
  this._err(ERR.eofInComment);
55286
55286
  this._emitCurrentToken();
55287
55287
  this._emitEOFToken();
@@ -55292,12 +55292,12 @@ var require_tokenizer = __commonJS({
55292
55292
  }
55293
55293
  // DOCTYPE state
55294
55294
  //------------------------------------------------------------------
55295
- [DOCTYPE_STATE](cp) {
55296
- if (isWhitespace(cp)) {
55295
+ [DOCTYPE_STATE](cp2) {
55296
+ if (isWhitespace(cp2)) {
55297
55297
  this.state = BEFORE_DOCTYPE_NAME_STATE;
55298
- } else if (cp === $.GREATER_THAN_SIGN) {
55298
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55299
55299
  this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE);
55300
- } else if (cp === $.EOF) {
55300
+ } else if (cp2 === $.EOF) {
55301
55301
  this._err(ERR.eofInDoctype);
55302
55302
  this._createDoctypeToken(null);
55303
55303
  this.currentToken.forceQuirks = true;
@@ -55310,73 +55310,73 @@ var require_tokenizer = __commonJS({
55310
55310
  }
55311
55311
  // Before DOCTYPE name state
55312
55312
  //------------------------------------------------------------------
55313
- [BEFORE_DOCTYPE_NAME_STATE](cp) {
55314
- if (isWhitespace(cp)) {
55313
+ [BEFORE_DOCTYPE_NAME_STATE](cp2) {
55314
+ if (isWhitespace(cp2)) {
55315
55315
  return;
55316
55316
  }
55317
- if (isAsciiUpper(cp)) {
55318
- this._createDoctypeToken(toAsciiLowerChar(cp));
55317
+ if (isAsciiUpper(cp2)) {
55318
+ this._createDoctypeToken(toAsciiLowerChar(cp2));
55319
55319
  this.state = DOCTYPE_NAME_STATE;
55320
- } else if (cp === $.NULL) {
55320
+ } else if (cp2 === $.NULL) {
55321
55321
  this._err(ERR.unexpectedNullCharacter);
55322
55322
  this._createDoctypeToken(unicode.REPLACEMENT_CHARACTER);
55323
55323
  this.state = DOCTYPE_NAME_STATE;
55324
- } else if (cp === $.GREATER_THAN_SIGN) {
55324
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55325
55325
  this._err(ERR.missingDoctypeName);
55326
55326
  this._createDoctypeToken(null);
55327
55327
  this.currentToken.forceQuirks = true;
55328
55328
  this._emitCurrentToken();
55329
55329
  this.state = DATA_STATE;
55330
- } else if (cp === $.EOF) {
55330
+ } else if (cp2 === $.EOF) {
55331
55331
  this._err(ERR.eofInDoctype);
55332
55332
  this._createDoctypeToken(null);
55333
55333
  this.currentToken.forceQuirks = true;
55334
55334
  this._emitCurrentToken();
55335
55335
  this._emitEOFToken();
55336
55336
  } else {
55337
- this._createDoctypeToken(toChar(cp));
55337
+ this._createDoctypeToken(toChar(cp2));
55338
55338
  this.state = DOCTYPE_NAME_STATE;
55339
55339
  }
55340
55340
  }
55341
55341
  // DOCTYPE name state
55342
55342
  //------------------------------------------------------------------
55343
- [DOCTYPE_NAME_STATE](cp) {
55344
- if (isWhitespace(cp)) {
55343
+ [DOCTYPE_NAME_STATE](cp2) {
55344
+ if (isWhitespace(cp2)) {
55345
55345
  this.state = AFTER_DOCTYPE_NAME_STATE;
55346
- } else if (cp === $.GREATER_THAN_SIGN) {
55346
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55347
55347
  this.state = DATA_STATE;
55348
55348
  this._emitCurrentToken();
55349
- } else if (isAsciiUpper(cp)) {
55350
- this.currentToken.name += toAsciiLowerChar(cp);
55351
- } else if (cp === $.NULL) {
55349
+ } else if (isAsciiUpper(cp2)) {
55350
+ this.currentToken.name += toAsciiLowerChar(cp2);
55351
+ } else if (cp2 === $.NULL) {
55352
55352
  this._err(ERR.unexpectedNullCharacter);
55353
55353
  this.currentToken.name += unicode.REPLACEMENT_CHARACTER;
55354
- } else if (cp === $.EOF) {
55354
+ } else if (cp2 === $.EOF) {
55355
55355
  this._err(ERR.eofInDoctype);
55356
55356
  this.currentToken.forceQuirks = true;
55357
55357
  this._emitCurrentToken();
55358
55358
  this._emitEOFToken();
55359
55359
  } else {
55360
- this.currentToken.name += toChar(cp);
55360
+ this.currentToken.name += toChar(cp2);
55361
55361
  }
55362
55362
  }
55363
55363
  // After DOCTYPE name state
55364
55364
  //------------------------------------------------------------------
55365
- [AFTER_DOCTYPE_NAME_STATE](cp) {
55366
- if (isWhitespace(cp)) {
55365
+ [AFTER_DOCTYPE_NAME_STATE](cp2) {
55366
+ if (isWhitespace(cp2)) {
55367
55367
  return;
55368
55368
  }
55369
- if (cp === $.GREATER_THAN_SIGN) {
55369
+ if (cp2 === $.GREATER_THAN_SIGN) {
55370
55370
  this.state = DATA_STATE;
55371
55371
  this._emitCurrentToken();
55372
- } else if (cp === $.EOF) {
55372
+ } else if (cp2 === $.EOF) {
55373
55373
  this._err(ERR.eofInDoctype);
55374
55374
  this.currentToken.forceQuirks = true;
55375
55375
  this._emitCurrentToken();
55376
55376
  this._emitEOFToken();
55377
- } else if (this._consumeSequenceIfMatch($$.PUBLIC_STRING, cp, false)) {
55377
+ } else if (this._consumeSequenceIfMatch($$.PUBLIC_STRING, cp2, false)) {
55378
55378
  this.state = AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE;
55379
- } else if (this._consumeSequenceIfMatch($$.SYSTEM_STRING, cp, false)) {
55379
+ } else if (this._consumeSequenceIfMatch($$.SYSTEM_STRING, cp2, false)) {
55380
55380
  this.state = AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE;
55381
55381
  } else if (!this._ensureHibernation()) {
55382
55382
  this._err(ERR.invalidCharacterSequenceAfterDoctypeName);
@@ -55386,23 +55386,23 @@ var require_tokenizer = __commonJS({
55386
55386
  }
55387
55387
  // After DOCTYPE public keyword state
55388
55388
  //------------------------------------------------------------------
55389
- [AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE](cp) {
55390
- if (isWhitespace(cp)) {
55389
+ [AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE](cp2) {
55390
+ if (isWhitespace(cp2)) {
55391
55391
  this.state = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
55392
- } else if (cp === $.QUOTATION_MARK) {
55392
+ } else if (cp2 === $.QUOTATION_MARK) {
55393
55393
  this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
55394
55394
  this.currentToken.publicId = "";
55395
55395
  this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE;
55396
- } else if (cp === $.APOSTROPHE) {
55396
+ } else if (cp2 === $.APOSTROPHE) {
55397
55397
  this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
55398
55398
  this.currentToken.publicId = "";
55399
55399
  this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE;
55400
- } else if (cp === $.GREATER_THAN_SIGN) {
55400
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55401
55401
  this._err(ERR.missingDoctypePublicIdentifier);
55402
55402
  this.currentToken.forceQuirks = true;
55403
55403
  this.state = DATA_STATE;
55404
55404
  this._emitCurrentToken();
55405
- } else if (cp === $.EOF) {
55405
+ } else if (cp2 === $.EOF) {
55406
55406
  this._err(ERR.eofInDoctype);
55407
55407
  this.currentToken.forceQuirks = true;
55408
55408
  this._emitCurrentToken();
@@ -55415,22 +55415,22 @@ var require_tokenizer = __commonJS({
55415
55415
  }
55416
55416
  // Before DOCTYPE public identifier state
55417
55417
  //------------------------------------------------------------------
55418
- [BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp) {
55419
- if (isWhitespace(cp)) {
55418
+ [BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp2) {
55419
+ if (isWhitespace(cp2)) {
55420
55420
  return;
55421
55421
  }
55422
- if (cp === $.QUOTATION_MARK) {
55422
+ if (cp2 === $.QUOTATION_MARK) {
55423
55423
  this.currentToken.publicId = "";
55424
55424
  this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE;
55425
- } else if (cp === $.APOSTROPHE) {
55425
+ } else if (cp2 === $.APOSTROPHE) {
55426
55426
  this.currentToken.publicId = "";
55427
55427
  this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE;
55428
- } else if (cp === $.GREATER_THAN_SIGN) {
55428
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55429
55429
  this._err(ERR.missingDoctypePublicIdentifier);
55430
55430
  this.currentToken.forceQuirks = true;
55431
55431
  this.state = DATA_STATE;
55432
55432
  this._emitCurrentToken();
55433
- } else if (cp === $.EOF) {
55433
+ } else if (cp2 === $.EOF) {
55434
55434
  this._err(ERR.eofInDoctype);
55435
55435
  this.currentToken.forceQuirks = true;
55436
55436
  this._emitCurrentToken();
@@ -55443,65 +55443,65 @@ var require_tokenizer = __commonJS({
55443
55443
  }
55444
55444
  // DOCTYPE public identifier (double-quoted) state
55445
55445
  //------------------------------------------------------------------
55446
- [DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE](cp) {
55447
- if (cp === $.QUOTATION_MARK) {
55446
+ [DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE](cp2) {
55447
+ if (cp2 === $.QUOTATION_MARK) {
55448
55448
  this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
55449
- } else if (cp === $.NULL) {
55449
+ } else if (cp2 === $.NULL) {
55450
55450
  this._err(ERR.unexpectedNullCharacter);
55451
55451
  this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER;
55452
- } else if (cp === $.GREATER_THAN_SIGN) {
55452
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55453
55453
  this._err(ERR.abruptDoctypePublicIdentifier);
55454
55454
  this.currentToken.forceQuirks = true;
55455
55455
  this._emitCurrentToken();
55456
55456
  this.state = DATA_STATE;
55457
- } else if (cp === $.EOF) {
55457
+ } else if (cp2 === $.EOF) {
55458
55458
  this._err(ERR.eofInDoctype);
55459
55459
  this.currentToken.forceQuirks = true;
55460
55460
  this._emitCurrentToken();
55461
55461
  this._emitEOFToken();
55462
55462
  } else {
55463
- this.currentToken.publicId += toChar(cp);
55463
+ this.currentToken.publicId += toChar(cp2);
55464
55464
  }
55465
55465
  }
55466
55466
  // DOCTYPE public identifier (single-quoted) state
55467
55467
  //------------------------------------------------------------------
55468
- [DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE](cp) {
55469
- if (cp === $.APOSTROPHE) {
55468
+ [DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE](cp2) {
55469
+ if (cp2 === $.APOSTROPHE) {
55470
55470
  this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
55471
- } else if (cp === $.NULL) {
55471
+ } else if (cp2 === $.NULL) {
55472
55472
  this._err(ERR.unexpectedNullCharacter);
55473
55473
  this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER;
55474
- } else if (cp === $.GREATER_THAN_SIGN) {
55474
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55475
55475
  this._err(ERR.abruptDoctypePublicIdentifier);
55476
55476
  this.currentToken.forceQuirks = true;
55477
55477
  this._emitCurrentToken();
55478
55478
  this.state = DATA_STATE;
55479
- } else if (cp === $.EOF) {
55479
+ } else if (cp2 === $.EOF) {
55480
55480
  this._err(ERR.eofInDoctype);
55481
55481
  this.currentToken.forceQuirks = true;
55482
55482
  this._emitCurrentToken();
55483
55483
  this._emitEOFToken();
55484
55484
  } else {
55485
- this.currentToken.publicId += toChar(cp);
55485
+ this.currentToken.publicId += toChar(cp2);
55486
55486
  }
55487
55487
  }
55488
55488
  // After DOCTYPE public identifier state
55489
55489
  //------------------------------------------------------------------
55490
- [AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp) {
55491
- if (isWhitespace(cp)) {
55490
+ [AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp2) {
55491
+ if (isWhitespace(cp2)) {
55492
55492
  this.state = BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE;
55493
- } else if (cp === $.GREATER_THAN_SIGN) {
55493
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55494
55494
  this.state = DATA_STATE;
55495
55495
  this._emitCurrentToken();
55496
- } else if (cp === $.QUOTATION_MARK) {
55496
+ } else if (cp2 === $.QUOTATION_MARK) {
55497
55497
  this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
55498
55498
  this.currentToken.systemId = "";
55499
55499
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
55500
- } else if (cp === $.APOSTROPHE) {
55500
+ } else if (cp2 === $.APOSTROPHE) {
55501
55501
  this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
55502
55502
  this.currentToken.systemId = "";
55503
55503
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
55504
- } else if (cp === $.EOF) {
55504
+ } else if (cp2 === $.EOF) {
55505
55505
  this._err(ERR.eofInDoctype);
55506
55506
  this.currentToken.forceQuirks = true;
55507
55507
  this._emitCurrentToken();
@@ -55514,20 +55514,20 @@ var require_tokenizer = __commonJS({
55514
55514
  }
55515
55515
  // Between DOCTYPE public and system identifiers state
55516
55516
  //------------------------------------------------------------------
55517
- [BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE](cp) {
55518
- if (isWhitespace(cp)) {
55517
+ [BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE](cp2) {
55518
+ if (isWhitespace(cp2)) {
55519
55519
  return;
55520
55520
  }
55521
- if (cp === $.GREATER_THAN_SIGN) {
55521
+ if (cp2 === $.GREATER_THAN_SIGN) {
55522
55522
  this._emitCurrentToken();
55523
55523
  this.state = DATA_STATE;
55524
- } else if (cp === $.QUOTATION_MARK) {
55524
+ } else if (cp2 === $.QUOTATION_MARK) {
55525
55525
  this.currentToken.systemId = "";
55526
55526
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
55527
- } else if (cp === $.APOSTROPHE) {
55527
+ } else if (cp2 === $.APOSTROPHE) {
55528
55528
  this.currentToken.systemId = "";
55529
55529
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
55530
- } else if (cp === $.EOF) {
55530
+ } else if (cp2 === $.EOF) {
55531
55531
  this._err(ERR.eofInDoctype);
55532
55532
  this.currentToken.forceQuirks = true;
55533
55533
  this._emitCurrentToken();
@@ -55540,23 +55540,23 @@ var require_tokenizer = __commonJS({
55540
55540
  }
55541
55541
  // After DOCTYPE system keyword state
55542
55542
  //------------------------------------------------------------------
55543
- [AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE](cp) {
55544
- if (isWhitespace(cp)) {
55543
+ [AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE](cp2) {
55544
+ if (isWhitespace(cp2)) {
55545
55545
  this.state = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
55546
- } else if (cp === $.QUOTATION_MARK) {
55546
+ } else if (cp2 === $.QUOTATION_MARK) {
55547
55547
  this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
55548
55548
  this.currentToken.systemId = "";
55549
55549
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
55550
- } else if (cp === $.APOSTROPHE) {
55550
+ } else if (cp2 === $.APOSTROPHE) {
55551
55551
  this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
55552
55552
  this.currentToken.systemId = "";
55553
55553
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
55554
- } else if (cp === $.GREATER_THAN_SIGN) {
55554
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55555
55555
  this._err(ERR.missingDoctypeSystemIdentifier);
55556
55556
  this.currentToken.forceQuirks = true;
55557
55557
  this.state = DATA_STATE;
55558
55558
  this._emitCurrentToken();
55559
- } else if (cp === $.EOF) {
55559
+ } else if (cp2 === $.EOF) {
55560
55560
  this._err(ERR.eofInDoctype);
55561
55561
  this.currentToken.forceQuirks = true;
55562
55562
  this._emitCurrentToken();
@@ -55569,22 +55569,22 @@ var require_tokenizer = __commonJS({
55569
55569
  }
55570
55570
  // Before DOCTYPE system identifier state
55571
55571
  //------------------------------------------------------------------
55572
- [BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp) {
55573
- if (isWhitespace(cp)) {
55572
+ [BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp2) {
55573
+ if (isWhitespace(cp2)) {
55574
55574
  return;
55575
55575
  }
55576
- if (cp === $.QUOTATION_MARK) {
55576
+ if (cp2 === $.QUOTATION_MARK) {
55577
55577
  this.currentToken.systemId = "";
55578
55578
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
55579
- } else if (cp === $.APOSTROPHE) {
55579
+ } else if (cp2 === $.APOSTROPHE) {
55580
55580
  this.currentToken.systemId = "";
55581
55581
  this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
55582
- } else if (cp === $.GREATER_THAN_SIGN) {
55582
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55583
55583
  this._err(ERR.missingDoctypeSystemIdentifier);
55584
55584
  this.currentToken.forceQuirks = true;
55585
55585
  this.state = DATA_STATE;
55586
55586
  this._emitCurrentToken();
55587
- } else if (cp === $.EOF) {
55587
+ } else if (cp2 === $.EOF) {
55588
55588
  this._err(ERR.eofInDoctype);
55589
55589
  this.currentToken.forceQuirks = true;
55590
55590
  this._emitCurrentToken();
@@ -55597,58 +55597,58 @@ var require_tokenizer = __commonJS({
55597
55597
  }
55598
55598
  // DOCTYPE system identifier (double-quoted) state
55599
55599
  //------------------------------------------------------------------
55600
- [DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE](cp) {
55601
- if (cp === $.QUOTATION_MARK) {
55600
+ [DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE](cp2) {
55601
+ if (cp2 === $.QUOTATION_MARK) {
55602
55602
  this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
55603
- } else if (cp === $.NULL) {
55603
+ } else if (cp2 === $.NULL) {
55604
55604
  this._err(ERR.unexpectedNullCharacter);
55605
55605
  this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER;
55606
- } else if (cp === $.GREATER_THAN_SIGN) {
55606
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55607
55607
  this._err(ERR.abruptDoctypeSystemIdentifier);
55608
55608
  this.currentToken.forceQuirks = true;
55609
55609
  this._emitCurrentToken();
55610
55610
  this.state = DATA_STATE;
55611
- } else if (cp === $.EOF) {
55611
+ } else if (cp2 === $.EOF) {
55612
55612
  this._err(ERR.eofInDoctype);
55613
55613
  this.currentToken.forceQuirks = true;
55614
55614
  this._emitCurrentToken();
55615
55615
  this._emitEOFToken();
55616
55616
  } else {
55617
- this.currentToken.systemId += toChar(cp);
55617
+ this.currentToken.systemId += toChar(cp2);
55618
55618
  }
55619
55619
  }
55620
55620
  // DOCTYPE system identifier (single-quoted) state
55621
55621
  //------------------------------------------------------------------
55622
- [DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp) {
55623
- if (cp === $.APOSTROPHE) {
55622
+ [DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp2) {
55623
+ if (cp2 === $.APOSTROPHE) {
55624
55624
  this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
55625
- } else if (cp === $.NULL) {
55625
+ } else if (cp2 === $.NULL) {
55626
55626
  this._err(ERR.unexpectedNullCharacter);
55627
55627
  this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER;
55628
- } else if (cp === $.GREATER_THAN_SIGN) {
55628
+ } else if (cp2 === $.GREATER_THAN_SIGN) {
55629
55629
  this._err(ERR.abruptDoctypeSystemIdentifier);
55630
55630
  this.currentToken.forceQuirks = true;
55631
55631
  this._emitCurrentToken();
55632
55632
  this.state = DATA_STATE;
55633
- } else if (cp === $.EOF) {
55633
+ } else if (cp2 === $.EOF) {
55634
55634
  this._err(ERR.eofInDoctype);
55635
55635
  this.currentToken.forceQuirks = true;
55636
55636
  this._emitCurrentToken();
55637
55637
  this._emitEOFToken();
55638
55638
  } else {
55639
- this.currentToken.systemId += toChar(cp);
55639
+ this.currentToken.systemId += toChar(cp2);
55640
55640
  }
55641
55641
  }
55642
55642
  // After DOCTYPE system identifier state
55643
55643
  //------------------------------------------------------------------
55644
- [AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp) {
55645
- if (isWhitespace(cp)) {
55644
+ [AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp2) {
55645
+ if (isWhitespace(cp2)) {
55646
55646
  return;
55647
55647
  }
55648
- if (cp === $.GREATER_THAN_SIGN) {
55648
+ if (cp2 === $.GREATER_THAN_SIGN) {
55649
55649
  this._emitCurrentToken();
55650
55650
  this.state = DATA_STATE;
55651
- } else if (cp === $.EOF) {
55651
+ } else if (cp2 === $.EOF) {
55652
55652
  this._err(ERR.eofInDoctype);
55653
55653
  this.currentToken.forceQuirks = true;
55654
55654
  this._emitCurrentToken();
@@ -55660,33 +55660,33 @@ var require_tokenizer = __commonJS({
55660
55660
  }
55661
55661
  // Bogus DOCTYPE state
55662
55662
  //------------------------------------------------------------------
55663
- [BOGUS_DOCTYPE_STATE](cp) {
55664
- if (cp === $.GREATER_THAN_SIGN) {
55663
+ [BOGUS_DOCTYPE_STATE](cp2) {
55664
+ if (cp2 === $.GREATER_THAN_SIGN) {
55665
55665
  this._emitCurrentToken();
55666
55666
  this.state = DATA_STATE;
55667
- } else if (cp === $.NULL) {
55667
+ } else if (cp2 === $.NULL) {
55668
55668
  this._err(ERR.unexpectedNullCharacter);
55669
- } else if (cp === $.EOF) {
55669
+ } else if (cp2 === $.EOF) {
55670
55670
  this._emitCurrentToken();
55671
55671
  this._emitEOFToken();
55672
55672
  }
55673
55673
  }
55674
55674
  // CDATA section state
55675
55675
  //------------------------------------------------------------------
55676
- [CDATA_SECTION_STATE](cp) {
55677
- if (cp === $.RIGHT_SQUARE_BRACKET) {
55676
+ [CDATA_SECTION_STATE](cp2) {
55677
+ if (cp2 === $.RIGHT_SQUARE_BRACKET) {
55678
55678
  this.state = CDATA_SECTION_BRACKET_STATE;
55679
- } else if (cp === $.EOF) {
55679
+ } else if (cp2 === $.EOF) {
55680
55680
  this._err(ERR.eofInCdata);
55681
55681
  this._emitEOFToken();
55682
55682
  } else {
55683
- this._emitCodePoint(cp);
55683
+ this._emitCodePoint(cp2);
55684
55684
  }
55685
55685
  }
55686
55686
  // CDATA section bracket state
55687
55687
  //------------------------------------------------------------------
55688
- [CDATA_SECTION_BRACKET_STATE](cp) {
55689
- if (cp === $.RIGHT_SQUARE_BRACKET) {
55688
+ [CDATA_SECTION_BRACKET_STATE](cp2) {
55689
+ if (cp2 === $.RIGHT_SQUARE_BRACKET) {
55690
55690
  this.state = CDATA_SECTION_END_STATE;
55691
55691
  } else {
55692
55692
  this._emitChars("]");
@@ -55695,10 +55695,10 @@ var require_tokenizer = __commonJS({
55695
55695
  }
55696
55696
  // CDATA section end state
55697
55697
  //------------------------------------------------------------------
55698
- [CDATA_SECTION_END_STATE](cp) {
55699
- if (cp === $.GREATER_THAN_SIGN) {
55698
+ [CDATA_SECTION_END_STATE](cp2) {
55699
+ if (cp2 === $.GREATER_THAN_SIGN) {
55700
55700
  this.state = DATA_STATE;
55701
- } else if (cp === $.RIGHT_SQUARE_BRACKET) {
55701
+ } else if (cp2 === $.RIGHT_SQUARE_BRACKET) {
55702
55702
  this._emitChars("]");
55703
55703
  } else {
55704
55704
  this._emitChars("]]");
@@ -55707,12 +55707,12 @@ var require_tokenizer = __commonJS({
55707
55707
  }
55708
55708
  // Character reference state
55709
55709
  //------------------------------------------------------------------
55710
- [CHARACTER_REFERENCE_STATE](cp) {
55710
+ [CHARACTER_REFERENCE_STATE](cp2) {
55711
55711
  this.tempBuff = [$.AMPERSAND];
55712
- if (cp === $.NUMBER_SIGN) {
55713
- this.tempBuff.push(cp);
55712
+ if (cp2 === $.NUMBER_SIGN) {
55713
+ this.tempBuff.push(cp2);
55714
55714
  this.state = NUMERIC_CHARACTER_REFERENCE_STATE;
55715
- } else if (isAsciiAlphaNumeric(cp)) {
55715
+ } else if (isAsciiAlphaNumeric(cp2)) {
55716
55716
  this._reconsumeInState(NAMED_CHARACTER_REFERENCE_STATE);
55717
55717
  } else {
55718
55718
  this._flushCodePointsConsumedAsCharacterReference();
@@ -55721,8 +55721,8 @@ var require_tokenizer = __commonJS({
55721
55721
  }
55722
55722
  // Named character reference state
55723
55723
  //------------------------------------------------------------------
55724
- [NAMED_CHARACTER_REFERENCE_STATE](cp) {
55725
- const matchResult = this._matchNamedCharacterReference(cp);
55724
+ [NAMED_CHARACTER_REFERENCE_STATE](cp2) {
55725
+ const matchResult = this._matchNamedCharacterReference(cp2);
55726
55726
  if (this._ensureHibernation()) {
55727
55727
  this.tempBuff = [$.AMPERSAND];
55728
55728
  } else if (matchResult) {
@@ -55742,15 +55742,15 @@ var require_tokenizer = __commonJS({
55742
55742
  }
55743
55743
  // Ambiguos ampersand state
55744
55744
  //------------------------------------------------------------------
55745
- [AMBIGUOUS_AMPERSAND_STATE](cp) {
55746
- if (isAsciiAlphaNumeric(cp)) {
55745
+ [AMBIGUOUS_AMPERSAND_STATE](cp2) {
55746
+ if (isAsciiAlphaNumeric(cp2)) {
55747
55747
  if (this._isCharacterReferenceInAttribute()) {
55748
- this.currentAttr.value += toChar(cp);
55748
+ this.currentAttr.value += toChar(cp2);
55749
55749
  } else {
55750
- this._emitCodePoint(cp);
55750
+ this._emitCodePoint(cp2);
55751
55751
  }
55752
55752
  } else {
55753
- if (cp === $.SEMICOLON) {
55753
+ if (cp2 === $.SEMICOLON) {
55754
55754
  this._err(ERR.unknownNamedCharacterReference);
55755
55755
  }
55756
55756
  this._reconsumeInState(this.returnState);
@@ -55758,10 +55758,10 @@ var require_tokenizer = __commonJS({
55758
55758
  }
55759
55759
  // Numeric character reference state
55760
55760
  //------------------------------------------------------------------
55761
- [NUMERIC_CHARACTER_REFERENCE_STATE](cp) {
55761
+ [NUMERIC_CHARACTER_REFERENCE_STATE](cp2) {
55762
55762
  this.charRefCode = 0;
55763
- if (cp === $.LATIN_SMALL_X || cp === $.LATIN_CAPITAL_X) {
55764
- this.tempBuff.push(cp);
55763
+ if (cp2 === $.LATIN_SMALL_X || cp2 === $.LATIN_CAPITAL_X) {
55764
+ this.tempBuff.push(cp2);
55765
55765
  this.state = HEXADEMICAL_CHARACTER_REFERENCE_START_STATE;
55766
55766
  } else {
55767
55767
  this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_START_STATE);
@@ -55769,8 +55769,8 @@ var require_tokenizer = __commonJS({
55769
55769
  }
55770
55770
  // Hexademical character reference start state
55771
55771
  //------------------------------------------------------------------
55772
- [HEXADEMICAL_CHARACTER_REFERENCE_START_STATE](cp) {
55773
- if (isAsciiHexDigit(cp)) {
55772
+ [HEXADEMICAL_CHARACTER_REFERENCE_START_STATE](cp2) {
55773
+ if (isAsciiHexDigit(cp2)) {
55774
55774
  this._reconsumeInState(HEXADEMICAL_CHARACTER_REFERENCE_STATE);
55775
55775
  } else {
55776
55776
  this._err(ERR.absenceOfDigitsInNumericCharacterReference);
@@ -55780,8 +55780,8 @@ var require_tokenizer = __commonJS({
55780
55780
  }
55781
55781
  // Decimal character reference start state
55782
55782
  //------------------------------------------------------------------
55783
- [DECIMAL_CHARACTER_REFERENCE_START_STATE](cp) {
55784
- if (isAsciiDigit(cp)) {
55783
+ [DECIMAL_CHARACTER_REFERENCE_START_STATE](cp2) {
55784
+ if (isAsciiDigit(cp2)) {
55785
55785
  this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_STATE);
55786
55786
  } else {
55787
55787
  this._err(ERR.absenceOfDigitsInNumericCharacterReference);
@@ -55791,14 +55791,14 @@ var require_tokenizer = __commonJS({
55791
55791
  }
55792
55792
  // Hexademical character reference state
55793
55793
  //------------------------------------------------------------------
55794
- [HEXADEMICAL_CHARACTER_REFERENCE_STATE](cp) {
55795
- if (isAsciiUpperHexDigit(cp)) {
55796
- this.charRefCode = this.charRefCode * 16 + cp - 55;
55797
- } else if (isAsciiLowerHexDigit(cp)) {
55798
- this.charRefCode = this.charRefCode * 16 + cp - 87;
55799
- } else if (isAsciiDigit(cp)) {
55800
- this.charRefCode = this.charRefCode * 16 + cp - 48;
55801
- } else if (cp === $.SEMICOLON) {
55794
+ [HEXADEMICAL_CHARACTER_REFERENCE_STATE](cp2) {
55795
+ if (isAsciiUpperHexDigit(cp2)) {
55796
+ this.charRefCode = this.charRefCode * 16 + cp2 - 55;
55797
+ } else if (isAsciiLowerHexDigit(cp2)) {
55798
+ this.charRefCode = this.charRefCode * 16 + cp2 - 87;
55799
+ } else if (isAsciiDigit(cp2)) {
55800
+ this.charRefCode = this.charRefCode * 16 + cp2 - 48;
55801
+ } else if (cp2 === $.SEMICOLON) {
55802
55802
  this.state = NUMERIC_CHARACTER_REFERENCE_END_STATE;
55803
55803
  } else {
55804
55804
  this._err(ERR.missingSemicolonAfterCharacterReference);
@@ -55807,10 +55807,10 @@ var require_tokenizer = __commonJS({
55807
55807
  }
55808
55808
  // Decimal character reference state
55809
55809
  //------------------------------------------------------------------
55810
- [DECIMAL_CHARACTER_REFERENCE_STATE](cp) {
55811
- if (isAsciiDigit(cp)) {
55812
- this.charRefCode = this.charRefCode * 10 + cp - 48;
55813
- } else if (cp === $.SEMICOLON) {
55810
+ [DECIMAL_CHARACTER_REFERENCE_STATE](cp2) {
55811
+ if (isAsciiDigit(cp2)) {
55812
+ this.charRefCode = this.charRefCode * 10 + cp2 - 48;
55813
+ } else if (cp2 === $.SEMICOLON) {
55814
55814
  this.state = NUMERIC_CHARACTER_REFERENCE_END_STATE;
55815
55815
  } else {
55816
55816
  this._err(ERR.missingSemicolonAfterCharacterReference);
@@ -56799,9 +56799,9 @@ var require_tokenizer_mixin = __commonJS({
56799
56799
  };
56800
56800
  Object.keys(Tokenizer.MODE).forEach((modeName) => {
56801
56801
  const state = Tokenizer.MODE[modeName];
56802
- methods[state] = function(cp) {
56802
+ methods[state] = function(cp2) {
56803
56803
  mxn.ctLoc = mxn._getCurrentLocation();
56804
- orig[state].call(this, cp);
56804
+ orig[state].call(this, cp2);
56805
56805
  };
56806
56806
  });
56807
56807
  return methods;
@@ -80937,8 +80937,8 @@ var require_formdata_parser = __commonJS({
80937
80937
  return false;
80938
80938
  }
80939
80939
  for (let i = 0; i < length; ++i) {
80940
- const cp = boundary.charCodeAt(i);
80941
- if (!(cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 39 || cp === 45 || cp === 95)) {
80940
+ const cp2 = boundary.charCodeAt(i);
80941
+ if (!(cp2 >= 48 && cp2 <= 57 || cp2 >= 65 && cp2 <= 90 || cp2 >= 97 && cp2 <= 122 || cp2 === 39 || cp2 === 45 || cp2 === 95)) {
80942
80942
  return false;
80943
80943
  }
80944
80944
  }
@@ -87850,7 +87850,7 @@ var require_snapshot_utils = __commonJS({
87850
87850
  var require_snapshot_recorder = __commonJS({
87851
87851
  "../../node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
87852
87852
  "use strict";
87853
- var { writeFile: writeFile4, readFile: readFile6, mkdir: mkdir4 } = require("node:fs/promises");
87853
+ var { writeFile: writeFile5, readFile: readFile6, mkdir: mkdir5 } = require("node:fs/promises");
87854
87854
  var { dirname: dirname6, resolve } = require("node:path");
87855
87855
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = require("node:timers");
87856
87856
  var { InvalidArgumentError, UndiciError } = require_errors3();
@@ -88082,12 +88082,12 @@ var require_snapshot_recorder = __commonJS({
88082
88082
  throw new InvalidArgumentError("Snapshot path is required");
88083
88083
  }
88084
88084
  const resolvedPath = resolve(path3);
88085
- await mkdir4(dirname6(resolvedPath), { recursive: true });
88085
+ await mkdir5(dirname6(resolvedPath), { recursive: true });
88086
88086
  const data = Array.from(this.#snapshots.entries()).map(([hash3, snapshot]) => ({
88087
88087
  hash: hash3,
88088
88088
  snapshot
88089
88089
  }));
88090
- await writeFile4(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
88090
+ await writeFile5(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
88091
88091
  }
88092
88092
  /**
88093
88093
  * Clears all recorded snapshots
@@ -124678,7 +124678,7 @@ function buildInputSchema(args, env2, options2) {
124678
124678
  // package.json
124679
124679
  var package_default = {
124680
124680
  name: "@docyrus/docyrus",
124681
- version: "0.0.15",
124681
+ version: "0.0.17",
124682
124682
  private: false,
124683
124683
  description: "Docyrus API CLI",
124684
124684
  main: "./main.js",
@@ -124686,6 +124686,7 @@ var package_default = {
124686
124686
  docyrus: "main.js"
124687
124687
  },
124688
124688
  dependencies: {
124689
+ "@mariozechner/pi-coding-agent": "0.58.4",
124689
124690
  "@opentui/core": "^0.1.85",
124690
124691
  "@opentui/react": "^0.1.85",
124691
124692
  incur: "^0.1.6",
@@ -124705,34 +124706,6 @@ var package_default = {
124705
124706
  }
124706
124707
  };
124707
124708
 
124708
- // src/commands/aiCommand.ts
124709
- var import_node_crypto2 = require("node:crypto");
124710
-
124711
- // src/errors.ts
124712
- var ApplicationError = class extends Error {
124713
- constructor(message, data = {}, httpStatusCode = 500) {
124714
- super(message);
124715
- this.data = data;
124716
- this.httpStatusCode = httpStatusCode;
124717
- }
124718
- };
124719
- var UserInputError = class extends ApplicationError {
124720
- constructor(message, data = {}) {
124721
- super(message, data, 400);
124722
- }
124723
- };
124724
- var AuthSessionError = class extends ApplicationError {
124725
- constructor(message, data = {}) {
124726
- super(message, data, 401);
124727
- }
124728
- };
124729
- var ApiResponseError = class extends ApplicationError {
124730
- constructor(details) {
124731
- super(details.error_description || details.error || "Docyrus API request failed", details, details.status || 500);
124732
- this.details = details;
124733
- }
124734
- };
124735
-
124736
124709
  // src/schemas.ts
124737
124710
  var EnvSchema = external_exports.object({
124738
124711
  DOCYRUS_API_CLIENT_ID: external_exports.string().optional().describe("Default Docyrus OAuth2 client id")
@@ -124824,6 +124797,93 @@ var OAuth2DeviceAuthorizationSchema = external_exports.object({
124824
124797
  interval: external_exports.number().int().nonnegative().default(5)
124825
124798
  });
124826
124799
 
124800
+ // src/commands/agentCommand.ts
124801
+ var PI_AGENT_MODES = ["text", "json"];
124802
+ var PI_AGENT_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"];
124803
+ function hasRawVerboseFlag() {
124804
+ return process.argv.includes("--verbose");
124805
+ }
124806
+ function createPiAgentCommand(params) {
124807
+ return Cli_exports.create(params.profile, {
124808
+ description: params.description,
124809
+ env: EnvSchema,
124810
+ outputPolicy: "agent-only",
124811
+ args: external_exports.object({
124812
+ prompt: external_exports.string().optional().describe("Optional initial prompt; omit to open the interactive TUI")
124813
+ }),
124814
+ options: external_exports.object({
124815
+ print: external_exports.boolean().optional().describe("Run one-shot print mode instead of the interactive TUI"),
124816
+ mode: external_exports.enum(PI_AGENT_MODES).optional().describe("Print mode output: text or json"),
124817
+ continue: external_exports.boolean().optional().describe("Continue the previous pi session"),
124818
+ resume: external_exports.boolean().optional().describe("Open the pi session picker"),
124819
+ provider: external_exports.string().optional().describe("Model provider"),
124820
+ model: external_exports.string().optional().describe("Model pattern or full provider/model id"),
124821
+ thinking: external_exports.enum(PI_AGENT_THINKING_LEVELS).optional().describe("Thinking level"),
124822
+ session: external_exports.string().optional().describe("Specific session file to use"),
124823
+ sessionDir: external_exports.string().optional().describe("Override session storage directory"),
124824
+ apiKey: external_exports.string().optional().describe("Temporary provider API key override for this run"),
124825
+ verbose: external_exports.boolean().optional().describe("Enable verbose pi startup output")
124826
+ }),
124827
+ alias: {
124828
+ print: "p",
124829
+ continue: "c",
124830
+ resume: "r"
124831
+ },
124832
+ run: async (context) => {
124833
+ const prompt = context.args.prompt?.trim();
124834
+ const request = {
124835
+ profile: params.profile,
124836
+ prompt: prompt && prompt.length > 0 ? prompt : void 0,
124837
+ ...context.options,
124838
+ verbose: context.options.verbose || hasRawVerboseFlag() ? true : void 0
124839
+ };
124840
+ await params.dependencies.launchPiAgent(request);
124841
+ }
124842
+ });
124843
+ }
124844
+ function createAgentCli(dependencies) {
124845
+ return createPiAgentCommand({
124846
+ profile: "agent",
124847
+ description: "Launch the Docyrus pi assistant",
124848
+ dependencies
124849
+ });
124850
+ }
124851
+ function createCoderCli(dependencies) {
124852
+ return createPiAgentCommand({
124853
+ profile: "coder",
124854
+ description: "Launch the Docyrus pi coding agent",
124855
+ dependencies
124856
+ });
124857
+ }
124858
+
124859
+ // src/commands/aiCommand.ts
124860
+ var import_node_crypto2 = require("node:crypto");
124861
+
124862
+ // src/errors.ts
124863
+ var ApplicationError = class extends Error {
124864
+ constructor(message, data = {}, httpStatusCode = 500) {
124865
+ super(message);
124866
+ this.data = data;
124867
+ this.httpStatusCode = httpStatusCode;
124868
+ }
124869
+ };
124870
+ var UserInputError = class extends ApplicationError {
124871
+ constructor(message, data = {}) {
124872
+ super(message, data, 400);
124873
+ }
124874
+ };
124875
+ var AuthSessionError = class extends ApplicationError {
124876
+ constructor(message, data = {}) {
124877
+ super(message, data, 401);
124878
+ }
124879
+ };
124880
+ var ApiResponseError = class extends ApplicationError {
124881
+ constructor(details) {
124882
+ super(details.error_description || details.error || "Docyrus API request failed", details, details.status || 500);
124883
+ this.details = details;
124884
+ }
124885
+ };
124886
+
124827
124887
  // src/services/resultContext.ts
124828
124888
  function isObject2(value) {
124829
124889
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -125181,6 +125241,8 @@ var DEFAULT_LOGIN_SCOPES = [
125181
125241
  "AI.ReadWrite.All"
125182
125242
  ].join(" ");
125183
125243
  var DOCYRUS_SETTINGS_DIR_NAME = ".docyrus";
125244
+ var DOCYRUS_PI_DIR_NAME = "pi";
125245
+ var DOCYRUS_PI_AGENT_DIR_NAME = "agent";
125184
125246
  var AUTH_DIR_PATH = (0, import_node_path3.join)((0, import_node_os5.homedir)(), DOCYRUS_SETTINGS_DIR_NAME);
125185
125247
  var AUTH_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "auth.json");
125186
125248
  var CONFIG_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "config.json");
@@ -125216,6 +125278,9 @@ var DEFAULT_DEVICE_CODE_EXPIRY_SECONDS = 600;
125216
125278
  function getLocalDocyrusSettingsRootPath(cwd = process.cwd()) {
125217
125279
  return (0, import_node_path3.join)(cwd, DOCYRUS_SETTINGS_DIR_NAME);
125218
125280
  }
125281
+ function resolveDocyrusPiAgentRootPath(settingsRootPath) {
125282
+ return (0, import_node_path3.join)(settingsRootPath, DOCYRUS_PI_DIR_NAME, DOCYRUS_PI_AGENT_DIR_NAME);
125283
+ }
125219
125284
  function toDocyrusSettingsPaths(rootPath, scope) {
125220
125285
  return {
125221
125286
  scope,
@@ -126227,7 +126292,7 @@ function parseOpenApiDocument(raw) {
126227
126292
  }
126228
126293
  return parsed;
126229
126294
  }
126230
- async function loadOpenApiSpec(dependencies, tenantId) {
126295
+ async function loadOpenApiSpec(dependencies, tenantId, options2) {
126231
126296
  let filePath = dependencies.tenantOpenApiService.getTenantOpenApiFilePath(tenantId);
126232
126297
  let downloaded = false;
126233
126298
  let sourceUrl;
@@ -126241,7 +126306,7 @@ async function loadOpenApiSpec(dependencies, tenantId) {
126241
126306
  cause: error48
126242
126307
  });
126243
126308
  }
126244
- const downloadResult = await dependencies.tenantOpenApiService.downloadTenantOpenApi(tenantId);
126309
+ const downloadResult = await dependencies.tenantOpenApiService.downloadTenantOpenApi(tenantId, options2);
126245
126310
  downloaded = true;
126246
126311
  sourceUrl = downloadResult.sourceUrl;
126247
126312
  filePath = downloadResult.filePath;
@@ -126260,11 +126325,15 @@ async function withActiveTenantSpec(dependencies) {
126260
126325
  if (!activeProfile) {
126261
126326
  throw new AuthSessionError("No active session found. Run 'docyrus auth login'.");
126262
126327
  }
126263
- const spec = await loadOpenApiSpec(dependencies, activeProfile.tenantId);
126328
+ const authSessionService = dependencies.createAuthSessionService(apiBaseUrl);
126329
+ const authToken = await authSessionService.getValidAccessToken();
126264
126330
  return {
126265
126331
  apiBaseUrl,
126266
126332
  activeProfile,
126267
- spec
126333
+ spec: await loadOpenApiSpec(dependencies, activeProfile.tenantId, {
126334
+ apiBaseUrl,
126335
+ authToken
126336
+ })
126268
126337
  };
126269
126338
  }
126270
126339
  function createDiscoverCli(dependencies) {
@@ -126280,7 +126349,12 @@ function createDiscoverCli(dependencies) {
126280
126349
  if (!activeProfile) {
126281
126350
  throw new AuthSessionError("No active session found. Run 'docyrus auth login'.");
126282
126351
  }
126283
- const downloaded = await dependencies.tenantOpenApiService.downloadTenantOpenApi(activeProfile.tenantId);
126352
+ const authSessionService = dependencies.createAuthSessionService(apiBaseUrl);
126353
+ const authToken = await authSessionService.getValidAccessToken();
126354
+ const downloaded = await dependencies.tenantOpenApiService.downloadTenantOpenApi(activeProfile.tenantId, {
126355
+ apiBaseUrl,
126356
+ authToken
126357
+ });
126284
126358
  return await injectContext({
126285
126359
  apiBaseUrl,
126286
126360
  authStore: dependencies.authStore,
@@ -126753,6 +126827,65 @@ function requireNonEmptyObject(payload, label) {
126753
126827
  throw new UserInputError(`${label} payload is empty. Provide flags, --data, or --from-file.`);
126754
126828
  }
126755
126829
  }
126830
+ function isRecord5(value) {
126831
+ return typeof value === "object" && value !== null && !Array.isArray(value);
126832
+ }
126833
+ function normalizeBatchUpdateFieldItem(item) {
126834
+ if (!isRecord5(item)) {
126835
+ return item;
126836
+ }
126837
+ const normalized = {
126838
+ ...item
126839
+ };
126840
+ if (!("fieldId" in normalized) && typeof normalized.id === "string") {
126841
+ normalized.fieldId = normalized.id;
126842
+ }
126843
+ if (!("readOnly" in normalized) && "read_only" in normalized) {
126844
+ normalized.readOnly = normalized.read_only;
126845
+ }
126846
+ if (!("defaultValue" in normalized) && "default_value" in normalized) {
126847
+ normalized.defaultValue = normalized.default_value;
126848
+ }
126849
+ if (!("relationDataSourceId" in normalized) && "relation_data_source_id" in normalized) {
126850
+ normalized.relationDataSourceId = normalized.relation_data_source_id;
126851
+ }
126852
+ if (!("editorOptions" in normalized) && "options" in normalized) {
126853
+ normalized.editorOptions = normalized.options;
126854
+ }
126855
+ return normalized;
126856
+ }
126857
+ function normalizeBatchUpdateFieldsPayload(payload) {
126858
+ const fields = payload.fields;
126859
+ if (!Array.isArray(fields)) {
126860
+ return payload;
126861
+ }
126862
+ return {
126863
+ ...payload,
126864
+ fields: fields.map((item) => normalizeBatchUpdateFieldItem(item))
126865
+ };
126866
+ }
126867
+ function normalizeUpdateEnumItem(item) {
126868
+ if (!isRecord5(item)) {
126869
+ return item;
126870
+ }
126871
+ if (!("enumId" in item) && typeof item.id === "string") {
126872
+ return {
126873
+ ...item,
126874
+ enumId: item.id
126875
+ };
126876
+ }
126877
+ return item;
126878
+ }
126879
+ function normalizeUpdateEnumsPayload(payload) {
126880
+ const enums = payload.enums;
126881
+ if (!Array.isArray(enums)) {
126882
+ return payload;
126883
+ }
126884
+ return {
126885
+ ...payload,
126886
+ enums: enums.map((item) => normalizeUpdateEnumItem(item))
126887
+ };
126888
+ }
126756
126889
  function createStudioCli(dependencies) {
126757
126890
  const studioCli = Cli_exports.create("studio", {
126758
126891
  description: "Studio (dev app data source CRUD) commands",
@@ -127249,10 +127382,11 @@ function createStudioCli(dependencies) {
127249
127382
  }),
127250
127383
  "fields"
127251
127384
  );
127385
+ const normalizedPayload = normalizeBatchUpdateFieldsPayload(payload);
127252
127386
  const response = await studio.apiClient.request({
127253
127387
  method: "PATCH",
127254
127388
  path: `/dev/apps/${appId}/data-sources/${dataSourceId}/fields/batch`,
127255
- body: payload
127389
+ body: normalizedPayload
127256
127390
  });
127257
127391
  return await wrapStudioPayload(studio.apiBaseUrl, dependencies, response.data);
127258
127392
  }
@@ -127413,10 +127547,11 @@ function createStudioCli(dependencies) {
127413
127547
  }),
127414
127548
  "enums"
127415
127549
  );
127550
+ const normalizedPayload = normalizeUpdateEnumsPayload(payload);
127416
127551
  const response = await studio.apiClient.request({
127417
127552
  method: "PATCH",
127418
127553
  path: `/dev/apps/${appId}/data-sources/${dataSourceId}/fields/${fieldId}/enums`,
127419
- body: payload
127554
+ body: normalizedPayload
127420
127555
  });
127421
127556
  return await wrapStudioPayload(studio.apiBaseUrl, dependencies, response.data);
127422
127557
  }
@@ -127750,7 +127885,7 @@ var ApiClient = class {
127750
127885
 
127751
127886
  // src/services/authSession.ts
127752
127887
  var DEFAULT_MANUAL_ACCESS_TOKEN_EXPIRY_SECONDS = 3600;
127753
- function isRecord5(value) {
127888
+ function isRecord6(value) {
127754
127889
  return typeof value === "object" && value !== null;
127755
127890
  }
127756
127891
  function extractRecordValue(record2, keys) {
@@ -128063,11 +128198,11 @@ var AuthSessionService = class {
128063
128198
  fetchFn: this.params.fetchFn
128064
128199
  });
128065
128200
  const payload = response.data;
128066
- const dataCandidate = isRecord5(payload) && isRecord5(payload.data) ? payload.data : payload;
128067
- if (!isRecord5(dataCandidate)) {
128201
+ const dataCandidate = isRecord6(payload) && isRecord6(payload.data) ? payload.data : payload;
128202
+ if (!isRecord6(dataCandidate)) {
128068
128203
  throw new AuthSessionError("Unable to parse /users/me response.");
128069
128204
  }
128070
- const tenantCandidate = isRecord5(dataCandidate.tenant) ? dataCandidate.tenant : void 0;
128205
+ const tenantCandidate = isRecord6(dataCandidate.tenant) ? dataCandidate.tenant : void 0;
128071
128206
  const userId = extractString3(dataCandidate, ["id", "user_id"]);
128072
128207
  const email3 = extractString3(dataCandidate, ["email"]);
128073
128208
  const tenantId = tenantCandidate ? extractString3(tenantCandidate, ["id"]) : extractString3(dataCandidate, ["tenant_id", "tenantId"]);
@@ -128093,13 +128228,13 @@ var AuthSessionService = class {
128093
128228
  fetchFn: this.params.fetchFn
128094
128229
  });
128095
128230
  const payload = response.data;
128096
- const listCandidate = Array.isArray(payload) ? payload : isRecord5(payload) && Array.isArray(payload.data) ? payload.data : null;
128231
+ const listCandidate = Array.isArray(payload) ? payload : isRecord6(payload) && Array.isArray(payload.data) ? payload.data : null;
128097
128232
  if (!listCandidate) {
128098
128233
  throw new AuthSessionError("Unable to parse tenant catalog response.");
128099
128234
  }
128100
128235
  const mapped = [];
128101
128236
  for (const item of listCandidate) {
128102
- if (!isRecord5(item)) {
128237
+ if (!isRecord6(item)) {
128103
128238
  continue;
128104
128239
  }
128105
128240
  const tenantId = extractString3(item, ["id", "tenant_id"]);
@@ -128775,25 +128910,364 @@ var EnvironmentConfigService = class {
128775
128910
  }
128776
128911
  };
128777
128912
 
128778
- // src/services/tenantOpenApi.ts
128913
+ // src/services/piAgentLauncher.ts
128914
+ var import_node_child_process3 = require("node:child_process");
128915
+ var import_node_fs4 = require("node:fs");
128779
128916
  var import_promises7 = require("node:fs/promises");
128780
128917
  var import_node_path9 = require("node:path");
128918
+ function summarizeFailure2(result) {
128919
+ const stderr = result.stderr?.toString().trim();
128920
+ if (stderr && stderr.length > 0) {
128921
+ return stderr;
128922
+ }
128923
+ if (typeof result.status === "number") {
128924
+ return `pi process exited with code ${result.status}.`;
128925
+ }
128926
+ if (result.signal) {
128927
+ return `pi process exited due to signal ${result.signal}.`;
128928
+ }
128929
+ return "pi process terminated unexpectedly.";
128930
+ }
128931
+ function resolvePackagedPiResourceRoot(options2 = {}) {
128932
+ const cwd = options2.cwd ?? process.cwd();
128933
+ const dirname6 = options2.dirname ?? __dirname;
128934
+ const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
128935
+ const candidates = [
128936
+ (0, import_node_path9.resolve)(cwd, "apps/api-cli/resources/pi-agent"),
128937
+ (0, import_node_path9.resolve)(dirname6, "../resources/pi-agent"),
128938
+ (0, import_node_path9.resolve)(dirname6, "resources/pi-agent"),
128939
+ (0, import_node_path9.resolve)(cwd, "dist/apps/api-cli/resources/pi-agent")
128940
+ ];
128941
+ const resolved = candidates.find((candidate) => fileExists(candidate));
128942
+ if (!resolved) {
128943
+ throw new UserInputError(
128944
+ `Unable to locate pi agent resources. Checked: ${candidates.join(", ")}`
128945
+ );
128946
+ }
128947
+ return resolved;
128948
+ }
128949
+ function resolveInstalledPiCliEntryPath(options2 = {}) {
128950
+ const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
128951
+ const cwd = options2.cwd ?? process.cwd();
128952
+ const dirname6 = options2.dirname ?? __dirname;
128953
+ const packageSegments = ["@mariozechner", "pi-coding-agent", "dist", "cli.js"];
128954
+ const seen = /* @__PURE__ */ new Set();
128955
+ const candidates = options2.candidatePaths ?? [];
128956
+ const addCandidate = (candidate) => {
128957
+ if (!seen.has(candidate)) {
128958
+ seen.add(candidate);
128959
+ candidates.push(candidate);
128960
+ }
128961
+ };
128962
+ const collectAncestorCandidates = (startDir) => {
128963
+ let currentDir = (0, import_node_path9.resolve)(startDir);
128964
+ while (true) {
128965
+ addCandidate((0, import_node_path9.join)(currentDir, "node_modules", ...packageSegments));
128966
+ if ((0, import_node_path9.basename)(currentDir) === "node_modules") {
128967
+ addCandidate((0, import_node_path9.join)(currentDir, ...packageSegments));
128968
+ }
128969
+ const parentDir = (0, import_node_path9.resolve)(currentDir, "..");
128970
+ if (parentDir === currentDir) {
128971
+ break;
128972
+ }
128973
+ currentDir = parentDir;
128974
+ }
128975
+ };
128976
+ addCandidate((0, import_node_path9.resolve)(cwd, "apps/api-cli/node_modules", ...packageSegments));
128977
+ collectAncestorCandidates(cwd);
128978
+ collectAncestorCandidates(dirname6);
128979
+ const cliEntryPath = candidates.find((candidate) => fileExists(candidate));
128980
+ if (!cliEntryPath) {
128981
+ throw new UserInputError(`Unable to locate pi CLI entry file. Checked: ${candidates.join(", ")}`);
128982
+ }
128983
+ return cliEntryPath;
128984
+ }
128985
+ function normalizePiPromptPath(resourceRoot, profile) {
128986
+ if (profile === "agent") {
128987
+ return {
128988
+ tools: ["read", "bash", "grep", "find", "ls"],
128989
+ promptPath: (0, import_node_path9.join)(resourceRoot, "prompts", "agent-system.md"),
128990
+ promptFlag: "--system-prompt"
128991
+ };
128992
+ }
128993
+ return {
128994
+ tools: ["read", "bash", "edit", "write", "grep", "find", "ls"],
128995
+ promptPath: (0, import_node_path9.join)(resourceRoot, "prompts", "coder-append-system.md"),
128996
+ promptFlag: "--append-system-prompt"
128997
+ };
128998
+ }
128999
+ function toPiMode(mode) {
129000
+ return mode;
129001
+ }
129002
+ function buildPiAgentCliArgs(params) {
129003
+ const profile = normalizePiPromptPath(params.resourceRoot, params.request.profile);
129004
+ const args = [
129005
+ "--tools",
129006
+ profile.tools.join(","),
129007
+ profile.promptFlag,
129008
+ profile.promptPath
129009
+ ];
129010
+ if (params.request.print) {
129011
+ args.push("--print");
129012
+ }
129013
+ const mode = toPiMode(params.request.mode);
129014
+ if (mode) {
129015
+ args.push("--mode", mode);
129016
+ }
129017
+ if (params.request.continue) {
129018
+ args.push("--continue");
129019
+ }
129020
+ if (params.request.resume) {
129021
+ args.push("--resume");
129022
+ }
129023
+ if (params.request.provider) {
129024
+ args.push("--provider", params.request.provider);
129025
+ }
129026
+ if (params.request.model) {
129027
+ args.push("--model", params.request.model);
129028
+ }
129029
+ if (params.request.thinking) {
129030
+ args.push("--thinking", params.request.thinking);
129031
+ }
129032
+ if (params.request.session) {
129033
+ args.push("--session", params.request.session);
129034
+ }
129035
+ if (params.request.sessionDir) {
129036
+ args.push("--session-dir", params.request.sessionDir);
129037
+ }
129038
+ if (params.request.apiKey) {
129039
+ args.push("--api-key", params.request.apiKey);
129040
+ }
129041
+ if (params.request.verbose) {
129042
+ args.push("--verbose");
129043
+ }
129044
+ if (params.request.prompt) {
129045
+ args.push(params.request.prompt);
129046
+ }
129047
+ return args;
129048
+ }
129049
+ function createPiAgentRuntimeSkill(params) {
129050
+ const commandPrefix = params.scope === "global" ? "docyrus -g" : "docyrus";
129051
+ const authLines = params.activeProfile ? [
129052
+ `- email: \`${params.activeProfile.email}\``,
129053
+ `- tenant: \`${params.activeProfile.tenantName} (${params.activeProfile.tenantNo})\``,
129054
+ `- userId: \`${params.activeProfile.userId}\``,
129055
+ `- tenantId: \`${params.activeProfile.tenantId}\``
129056
+ ] : [
129057
+ `- No active Docyrus auth session is available.`,
129058
+ `- Authenticate first with \`${commandPrefix} auth login\` before making Docyrus API calls.`
129059
+ ];
129060
+ return [
129061
+ "---",
129062
+ "name: docyrus-runtime-context",
129063
+ "description: Runtime context for the active Docyrus CLI scope, environment, and auth session.",
129064
+ "disable-model-invocation: true",
129065
+ "---",
129066
+ "",
129067
+ "# Docyrus Runtime Context",
129068
+ "",
129069
+ "- Primary domain: Docyrus. Assume user requests are Docyrus-related unless the prompt clearly says otherwise.",
129070
+ `- Current Docyrus settings scope: \`${params.scope}\``,
129071
+ `- Current working directory: \`${params.cwd}\``,
129072
+ `- Active Docyrus settings root: \`${params.settingsRootPath}\``,
129073
+ `- Use this exact Docyrus CLI command prefix in this session: \`${commandPrefix}\``,
129074
+ "- Prefer machine-readable Docyrus operations by appending `--json` whenever you need to inspect or transform CLI output.",
129075
+ "- Prefer the Docyrus CLI over guessed HTTP endpoints or undocumented API behavior.",
129076
+ "",
129077
+ "## Active Environment",
129078
+ "",
129079
+ `- id: \`${params.activeEnvironment.id}\``,
129080
+ `- name: \`${params.activeEnvironment.name}\``,
129081
+ `- apiBaseUrl: \`${params.activeEnvironment.apiBaseUrl}\``,
129082
+ "",
129083
+ "## Active Auth Context",
129084
+ "",
129085
+ ...authLines,
129086
+ "",
129087
+ "## Preferred Workflow",
129088
+ "",
129089
+ `- For Docyrus platform questions or mutations, start with \`${commandPrefix} --json\` commands or add \`--json\` to specific subcommands such as \`${commandPrefix} apps list --json\`.`,
129090
+ `- Use \`${commandPrefix} auth who --json\`, \`${commandPrefix} apps list --json\`, \`${commandPrefix} discover namespaces --json\`, and other Docyrus CLI commands to inspect real tenant state before making claims.`
129091
+ ].join("\n");
129092
+ }
129093
+ async function syncPackagedSkills(params) {
129094
+ const sourceSkillsRoot = (0, import_node_path9.join)(params.resourceRoot, "skills");
129095
+ const targetSkillsRoot = (0, import_node_path9.join)(params.agentRootPath, "skills");
129096
+ await (0, import_promises7.mkdir)(targetSkillsRoot, {
129097
+ recursive: true,
129098
+ mode: 448
129099
+ });
129100
+ const entries = await (0, import_promises7.readdir)(sourceSkillsRoot, {
129101
+ withFileTypes: true
129102
+ });
129103
+ await Promise.all(entries.map(async (entry) => {
129104
+ await (0, import_promises7.cp)(
129105
+ (0, import_node_path9.join)(sourceSkillsRoot, entry.name),
129106
+ (0, import_node_path9.join)(targetSkillsRoot, entry.name),
129107
+ {
129108
+ recursive: true,
129109
+ force: true
129110
+ }
129111
+ );
129112
+ }));
129113
+ }
129114
+ async function writeRuntimeSkill(params) {
129115
+ const runtimeSkillDir = (0, import_node_path9.join)(params.agentRootPath, "skills", "docyrus-runtime-context");
129116
+ await (0, import_promises7.mkdir)(runtimeSkillDir, {
129117
+ recursive: true,
129118
+ mode: 448
129119
+ });
129120
+ await (0, import_promises7.writeFile)((0, import_node_path9.join)(runtimeSkillDir, "SKILL.md"), `${params.content}
129121
+ `, {
129122
+ encoding: "utf8",
129123
+ mode: 384
129124
+ });
129125
+ }
129126
+ function validatePiAgentLaunchRequest(params) {
129127
+ if (params.request.mode && !params.request.print && params.stdinIsTTY) {
129128
+ throw new UserInputError("`--mode` requires `--print` when stdin is interactive.");
129129
+ }
129130
+ if (params.request.print && !params.request.prompt && params.stdinIsTTY) {
129131
+ throw new UserInputError("`--print` requires a prompt or piped stdin.");
129132
+ }
129133
+ }
129134
+ function createPiAgentLauncher(options2) {
129135
+ const cwd = options2.cwd ?? process.cwd();
129136
+ const stdinIsTTY = options2.stdinIsTTY ?? process.stdin.isTTY ?? false;
129137
+ const spawnCommand = options2.spawnSyncFn ?? import_node_child_process3.spawnSync;
129138
+ const processExecPath = options2.processExecPath ?? process.execPath;
129139
+ const resolveResourceRoot = options2.resolvePackagedPiResourceRootFn ?? resolvePackagedPiResourceRoot;
129140
+ const resolvePiCliEntry = options2.resolveInstalledPiCliEntryPathFn ?? resolveInstalledPiCliEntryPath;
129141
+ return async (request) => {
129142
+ validatePiAgentLaunchRequest({
129143
+ request,
129144
+ stdinIsTTY
129145
+ });
129146
+ const activeEnvironment = await options2.environmentConfigService.getActiveEnvironment();
129147
+ const activeProfile = await options2.authStore.getActiveProfile(activeEnvironment.apiBaseUrl);
129148
+ const settingsRootPath = options2.settingsPaths.rootPath;
129149
+ const agentRootPath = resolveDocyrusPiAgentRootPath(settingsRootPath);
129150
+ const resourceRoot = resolveResourceRoot({
129151
+ cwd
129152
+ });
129153
+ await syncPackagedSkills({
129154
+ resourceRoot,
129155
+ agentRootPath
129156
+ });
129157
+ await writeRuntimeSkill({
129158
+ agentRootPath,
129159
+ content: createPiAgentRuntimeSkill({
129160
+ scope: options2.settingsPaths.scope,
129161
+ cwd,
129162
+ activeEnvironment,
129163
+ activeProfile,
129164
+ settingsRootPath
129165
+ })
129166
+ });
129167
+ const piCliEntryPath = resolvePiCliEntry();
129168
+ const args = buildPiAgentCliArgs({
129169
+ request,
129170
+ resourceRoot
129171
+ });
129172
+ const promptProfile = normalizePiPromptPath(resourceRoot, request.profile);
129173
+ if (!(0, import_node_fs4.existsSync)(promptProfile.promptPath)) {
129174
+ throw new UserInputError(`Unable to locate pi prompt asset at ${promptProfile.promptPath}.`);
129175
+ }
129176
+ const result = spawnCommand(processExecPath, [piCliEntryPath, ...args], {
129177
+ stdio: ["inherit", "inherit", "pipe"],
129178
+ encoding: "utf8",
129179
+ cwd,
129180
+ env: {
129181
+ ...process.env,
129182
+ PI_CODING_AGENT_DIR: agentRootPath
129183
+ }
129184
+ });
129185
+ if (result.error) {
129186
+ throw new UserInputError(`Unable to start pi agent: ${result.error.message}`, {
129187
+ cause: result.error
129188
+ });
129189
+ }
129190
+ if (result.status !== 0) {
129191
+ throw new UserInputError(`pi agent failed: ${summarizeFailure2(result)}`);
129192
+ }
129193
+ };
129194
+ }
129195
+
129196
+ // src/services/tenantOpenApi.ts
129197
+ var import_promises8 = require("node:fs/promises");
129198
+ var import_node_path10 = require("node:path");
128781
129199
  function resolveSourceUrl(tenantId, template) {
128782
129200
  return template.replace("{tenantId}", encodeURIComponent(tenantId));
128783
129201
  }
129202
+ async function parseOpenApiJsonResponse(response, params) {
129203
+ const content = await response.text();
129204
+ let parsedContent;
129205
+ try {
129206
+ parsedContent = JSON.parse(content);
129207
+ } catch (error48) {
129208
+ throw new AuthSessionError("Downloaded tenant OpenAPI spec is invalid JSON.", {
129209
+ tenantId: params.tenantId,
129210
+ sourceUrl: params.sourceUrl,
129211
+ cause: error48
129212
+ });
129213
+ }
129214
+ return parsedContent;
129215
+ }
128784
129216
  var TenantOpenApiService = class {
128785
129217
  constructor(params) {
128786
129218
  this.params = params;
128787
129219
  }
129220
+ async #writeOpenApiFile(tenantId, parsedContent) {
129221
+ const filePath = this.getTenantOpenApiFilePath(tenantId);
129222
+ await (0, import_promises8.mkdir)((0, import_node_path10.dirname)(filePath), {
129223
+ recursive: true,
129224
+ mode: 448
129225
+ });
129226
+ await (0, import_promises8.writeFile)(filePath, `${JSON.stringify(parsedContent, null, 2)}
129227
+ `, {
129228
+ encoding: "utf8",
129229
+ mode: 384
129230
+ });
129231
+ await (0, import_promises8.chmod)(filePath, 384);
129232
+ return filePath;
129233
+ }
129234
+ async #generateTenantOpenApiViaAuthenticatedEndpoint(tenantId, options2) {
129235
+ if (!options2.apiBaseUrl || !options2.authToken) {
129236
+ throw new AuthSessionError("Failed to download tenant OpenAPI spec.", {
129237
+ tenantId,
129238
+ reason: "OpenAPI file is missing and no authenticated fallback request could be made."
129239
+ });
129240
+ }
129241
+ const apiUrl = `${normalizeApiBaseUrl(options2.apiBaseUrl)}/api/openapi.json`;
129242
+ const response = await (this.params?.fetchFn || fetch)(apiUrl, {
129243
+ method: "GET",
129244
+ headers: {
129245
+ Accept: "application/json",
129246
+ Authorization: `Bearer ${options2.authToken}`
129247
+ }
129248
+ });
129249
+ if (!response.ok) {
129250
+ throw new AuthSessionError("Failed to generate tenant OpenAPI spec via authenticated endpoint.", {
129251
+ tenantId,
129252
+ sourceUrl: apiUrl,
129253
+ status: response.status,
129254
+ statusText: response.statusText
129255
+ });
129256
+ }
129257
+ return await parseOpenApiJsonResponse(response, {
129258
+ tenantId,
129259
+ sourceUrl: apiUrl
129260
+ });
129261
+ }
128788
129262
  getTenantOpenApiFilePath(tenantId) {
128789
129263
  const normalizedTenantId = tenantId.trim();
128790
129264
  if (!normalizedTenantId) {
128791
129265
  throw new AuthSessionError("Tenant ID is required to resolve OpenAPI spec path.");
128792
129266
  }
128793
129267
  const rootPath = this.params?.rootPath || TENANT_OPENAPI_ROOT_PATH;
128794
- return (0, import_node_path9.join)(rootPath, normalizedTenantId, "openapi.json");
129268
+ return (0, import_node_path10.join)(rootPath, normalizedTenantId, "openapi.json");
128795
129269
  }
128796
- async downloadTenantOpenApi(tenantId) {
129270
+ async downloadTenantOpenApi(tenantId, options2 = {}) {
128797
129271
  const normalizedTenantId = tenantId.trim();
128798
129272
  if (!normalizedTenantId) {
128799
129273
  throw new AuthSessionError("Tenant ID is required to download OpenAPI spec.");
@@ -128806,35 +129280,34 @@ var TenantOpenApiService = class {
128806
129280
  method: "GET"
128807
129281
  });
128808
129282
  if (!response.ok) {
128809
- throw new AuthSessionError("Failed to download tenant OpenAPI spec.", {
128810
- tenantId: normalizedTenantId,
128811
- sourceUrl,
128812
- status: response.status,
128813
- statusText: response.statusText
129283
+ if (response.status !== 404) {
129284
+ throw new AuthSessionError("Failed to download tenant OpenAPI spec.", {
129285
+ tenantId: normalizedTenantId,
129286
+ sourceUrl,
129287
+ status: response.status,
129288
+ statusText: response.statusText
129289
+ });
129290
+ }
129291
+ const generatedSpec = await this.#generateTenantOpenApiViaAuthenticatedEndpoint(normalizedTenantId, options2);
129292
+ const retryResponse = await (this.params?.fetchFn || fetch)(sourceUrl, {
129293
+ method: "GET"
128814
129294
  });
128815
- }
128816
- const content = await response.text();
128817
- let parsedContent;
128818
- try {
128819
- parsedContent = JSON.parse(content);
128820
- } catch (error48) {
128821
- throw new AuthSessionError("Downloaded tenant OpenAPI spec is invalid JSON.", {
129295
+ const parsedContent2 = retryResponse.ok ? await parseOpenApiJsonResponse(retryResponse, {
129296
+ tenantId: normalizedTenantId,
129297
+ sourceUrl
129298
+ }) : generatedSpec;
129299
+ const filePath2 = await this.#writeOpenApiFile(normalizedTenantId, parsedContent2);
129300
+ return {
128822
129301
  tenantId: normalizedTenantId,
128823
129302
  sourceUrl,
128824
- cause: error48
128825
- });
129303
+ filePath: filePath2
129304
+ };
128826
129305
  }
128827
- const filePath = this.getTenantOpenApiFilePath(normalizedTenantId);
128828
- await (0, import_promises7.mkdir)((0, import_node_path9.dirname)(filePath), {
128829
- recursive: true,
128830
- mode: 448
128831
- });
128832
- await (0, import_promises7.writeFile)(filePath, `${JSON.stringify(parsedContent, null, 2)}
128833
- `, {
128834
- encoding: "utf8",
128835
- mode: 384
129306
+ const parsedContent = await parseOpenApiJsonResponse(response, {
129307
+ tenantId: normalizedTenantId,
129308
+ sourceUrl
128836
129309
  });
128837
- await (0, import_promises7.chmod)(filePath, 384);
129310
+ const filePath = await this.#writeOpenApiFile(normalizedTenantId, parsedContent);
128838
129311
  return {
128839
129312
  tenantId: normalizedTenantId,
128840
129313
  sourceUrl,
@@ -128853,6 +129326,8 @@ var ROOT_HELP_COMMANDS = [
128853
129326
  { command: "auth accounts list", description: "List saved user accounts" },
128854
129327
  { command: "auth tenants use <uuid|tenantNo>", description: "Switch active tenant for selected user" },
128855
129328
  { command: 'ai "<prompt>"', description: "Send a prompt to the default Docyrus CLI agent" },
129329
+ { command: "agent [prompt]", description: "Launch the scoped Docyrus pi assistant" },
129330
+ { command: "coder [prompt]", description: "Launch the scoped Docyrus pi coding agent" },
128856
129331
  { command: "discover api", description: "Download active tenant OpenAPI spec" },
128857
129332
  { command: "discover namespaces", description: "List namespaces from tenant OpenAPI spec" },
128858
129333
  { command: "discover path <prefix>", description: "List endpoint paths by prefix" },
@@ -128879,6 +129354,12 @@ function createDocyrusCli(params) {
128879
129354
  fetchFn: params?.fetchFn,
128880
129355
  rootPath: settingsPaths.tenantOpenApiRootPath
128881
129356
  });
129357
+ const piAgentLauncher = createPiAgentLauncher({
129358
+ settingsPaths,
129359
+ environmentConfigService,
129360
+ authStore,
129361
+ cwd: params?.cwd
129362
+ });
128882
129363
  const createAuthSessionService = (apiBaseUrl) => {
128883
129364
  return new AuthSessionService({
128884
129365
  apiBaseUrl: normalizeApiBaseUrl(apiBaseUrl),
@@ -128930,6 +129411,12 @@ function createDocyrusCli(params) {
128930
129411
  environmentConfigService,
128931
129412
  authStore
128932
129413
  }));
129414
+ cli2.command(createAgentCli({
129415
+ launchPiAgent: piAgentLauncher
129416
+ }));
129417
+ cli2.command(createCoderCli({
129418
+ launchPiAgent: piAgentLauncher
129419
+ }));
128933
129420
  cli2.command(createDsCli({
128934
129421
  createApiClient,
128935
129422
  environmentConfigService,
@@ -128937,6 +129424,7 @@ function createDocyrusCli(params) {
128937
129424
  }));
128938
129425
  cli2.command(createDiscoverCli({
128939
129426
  environmentConfigService,
129427
+ createAuthSessionService,
128940
129428
  authStore,
128941
129429
  tenantOpenApiService
128942
129430
  }));