@docyrus/docyrus 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -2
- package/agent-loader.js +2640 -0
- package/agent-loader.js.map +7 -0
- package/main.js +833 -505
- package/main.js.map +4 -4
- package/package.json +5 -1
- package/resources/pi-agent/prompts/agent-system.md +25 -0
- package/resources/pi-agent/prompts/coder-append-system.md +19 -0
- package/resources/pi-agent/skills/docyrus-ai/SKILL.md +28 -0
- package/resources/pi-agent/skills/docyrus-api-dev/SKILL.md +161 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/api-client.md +349 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/authentication.md +238 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/data-source-query-guide.md +2059 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/formula-design-guide-llm.md +320 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/query-and-formulas.md +592 -0
- package/resources/pi-agent/skills/docyrus-api-doctor/SKILL.md +70 -0
- package/resources/pi-agent/skills/docyrus-api-doctor/references/checklist-details.md +588 -0
- package/resources/pi-agent/skills/docyrus-app-dev/SKILL.md +159 -0
- package/resources/pi-agent/skills/docyrus-app-dev/references/api-client-and-auth.md +275 -0
- package/resources/pi-agent/skills/docyrus-app-dev/references/collections-and-patterns.md +352 -0
- package/resources/pi-agent/skills/docyrus-app-dev/references/data-source-query-guide.md +2059 -0
- package/resources/pi-agent/skills/docyrus-app-dev/references/formula-design-guide-llm.md +320 -0
- package/resources/pi-agent/skills/docyrus-app-dev/references/query-guide.md +525 -0
- package/resources/pi-agent/skills/docyrus-app-ui-design/SKILL.md +466 -0
- package/resources/pi-agent/skills/docyrus-app-ui-design/references/component-selection-guide.md +602 -0
- package/resources/pi-agent/skills/docyrus-app-ui-design/references/icon-usage-guide.md +463 -0
- package/resources/pi-agent/skills/docyrus-app-ui-design/references/preferred-components-catalog.md +242 -0
- package/resources/pi-agent/skills/docyrus-apps/SKILL.md +54 -0
- package/resources/pi-agent/skills/docyrus-architect/SKILL.md +174 -0
- package/resources/pi-agent/skills/docyrus-architect/references/custom-query-guide.md +410 -0
- package/resources/pi-agent/skills/docyrus-architect/references/data-source-query-guide.md +2059 -0
- package/resources/pi-agent/skills/docyrus-architect/references/formula-design-guide-llm.md +320 -0
- package/resources/pi-agent/skills/docyrus-architect/references/formula-reference.md +145 -0
- package/resources/pi-agent/skills/docyrus-auth/SKILL.md +100 -0
- package/resources/pi-agent/skills/docyrus-cli-app/SKILL.md +279 -0
- package/resources/pi-agent/skills/docyrus-cli-app/references/cli-manifest.md +532 -0
- package/resources/pi-agent/skills/docyrus-cli-app/references/list-query-examples.md +248 -0
- package/resources/pi-agent/skills/docyrus-curl/SKILL.md +32 -0
- package/resources/pi-agent/skills/docyrus-discover/SKILL.md +63 -0
- package/resources/pi-agent/skills/docyrus-ds/SKILL.md +95 -0
- package/resources/pi-agent/skills/docyrus-env/SKILL.md +21 -0
- package/resources/pi-agent/skills/docyrus-studio/SKILL.md +369 -0
- 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
|
|
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(
|
|
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(
|
|
53730
|
-
return
|
|
53729
|
+
exports2.isSurrogate = function(cp2) {
|
|
53730
|
+
return cp2 >= 55296 && cp2 <= 57343;
|
|
53731
53731
|
};
|
|
53732
|
-
exports2.isSurrogatePair = function(
|
|
53733
|
-
return
|
|
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(
|
|
53739
|
-
return
|
|
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(
|
|
53742
|
-
return
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
53888
|
-
if (this.skipNextNewLine &&
|
|
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 (
|
|
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(
|
|
53899
|
-
|
|
53898
|
+
if (unicode.isSurrogate(cp2)) {
|
|
53899
|
+
cp2 = this._processSurrogate(cp2);
|
|
53900
53900
|
}
|
|
53901
|
-
const isCommonValidRange =
|
|
53901
|
+
const isCommonValidRange = cp2 > 31 && cp2 < 127 || cp2 === $.LINE_FEED || cp2 === $.CARRIAGE_RETURN || cp2 > 159 && cp2 < 64976;
|
|
53902
53902
|
if (!isCommonValidRange) {
|
|
53903
|
-
this._checkForProblematicCharacters(
|
|
53903
|
+
this._checkForProblematicCharacters(cp2);
|
|
53904
53904
|
}
|
|
53905
|
-
return
|
|
53905
|
+
return cp2;
|
|
53906
53906
|
}
|
|
53907
|
-
_checkForProblematicCharacters(
|
|
53908
|
-
if (unicode.isControlCodePoint(
|
|
53907
|
+
_checkForProblematicCharacters(cp2) {
|
|
53908
|
+
if (unicode.isControlCodePoint(cp2)) {
|
|
53909
53909
|
this._err(ERR.controlCharacterInInputStream);
|
|
53910
|
-
} else if (unicode.isUndefinedCodePoint(
|
|
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(
|
|
54058
|
-
return
|
|
54057
|
+
function isWhitespace(cp2) {
|
|
54058
|
+
return cp2 === $.SPACE || cp2 === $.LINE_FEED || cp2 === $.TABULATION || cp2 === $.FORM_FEED;
|
|
54059
54059
|
}
|
|
54060
|
-
function isAsciiDigit(
|
|
54061
|
-
return
|
|
54060
|
+
function isAsciiDigit(cp2) {
|
|
54061
|
+
return cp2 >= $.DIGIT_0 && cp2 <= $.DIGIT_9;
|
|
54062
54062
|
}
|
|
54063
|
-
function isAsciiUpper(
|
|
54064
|
-
return
|
|
54063
|
+
function isAsciiUpper(cp2) {
|
|
54064
|
+
return cp2 >= $.LATIN_CAPITAL_A && cp2 <= $.LATIN_CAPITAL_Z;
|
|
54065
54065
|
}
|
|
54066
|
-
function isAsciiLower(
|
|
54067
|
-
return
|
|
54066
|
+
function isAsciiLower(cp2) {
|
|
54067
|
+
return cp2 >= $.LATIN_SMALL_A && cp2 <= $.LATIN_SMALL_Z;
|
|
54068
54068
|
}
|
|
54069
|
-
function isAsciiLetter(
|
|
54070
|
-
return isAsciiLower(
|
|
54069
|
+
function isAsciiLetter(cp2) {
|
|
54070
|
+
return isAsciiLower(cp2) || isAsciiUpper(cp2);
|
|
54071
54071
|
}
|
|
54072
|
-
function isAsciiAlphaNumeric(
|
|
54073
|
-
return isAsciiLetter(
|
|
54072
|
+
function isAsciiAlphaNumeric(cp2) {
|
|
54073
|
+
return isAsciiLetter(cp2) || isAsciiDigit(cp2);
|
|
54074
54074
|
}
|
|
54075
|
-
function isAsciiUpperHexDigit(
|
|
54076
|
-
return
|
|
54075
|
+
function isAsciiUpperHexDigit(cp2) {
|
|
54076
|
+
return cp2 >= $.LATIN_CAPITAL_A && cp2 <= $.LATIN_CAPITAL_F;
|
|
54077
54077
|
}
|
|
54078
|
-
function isAsciiLowerHexDigit(
|
|
54079
|
-
return
|
|
54078
|
+
function isAsciiLowerHexDigit(cp2) {
|
|
54079
|
+
return cp2 >= $.LATIN_SMALL_A && cp2 <= $.LATIN_SMALL_F;
|
|
54080
54080
|
}
|
|
54081
|
-
function isAsciiHexDigit(
|
|
54082
|
-
return isAsciiDigit(
|
|
54081
|
+
function isAsciiHexDigit(cp2) {
|
|
54082
|
+
return isAsciiDigit(cp2) || isAsciiUpperHexDigit(cp2) || isAsciiLowerHexDigit(cp2);
|
|
54083
54083
|
}
|
|
54084
|
-
function toAsciiLowerCodePoint(
|
|
54085
|
-
return
|
|
54084
|
+
function toAsciiLowerCodePoint(cp2) {
|
|
54085
|
+
return cp2 + 32;
|
|
54086
54086
|
}
|
|
54087
|
-
function toChar(
|
|
54088
|
-
if (
|
|
54089
|
-
return String.fromCharCode(
|
|
54087
|
+
function toChar(cp2) {
|
|
54088
|
+
if (cp2 <= 65535) {
|
|
54089
|
+
return String.fromCharCode(cp2);
|
|
54090
54090
|
}
|
|
54091
|
-
|
|
54092
|
-
return String.fromCharCode(
|
|
54091
|
+
cp2 -= 65536;
|
|
54092
|
+
return String.fromCharCode(cp2 >>> 10 & 1023 | 55296) + String.fromCharCode(56320 | cp2 & 1023);
|
|
54093
54093
|
}
|
|
54094
|
-
function toAsciiLowerChar(
|
|
54095
|
-
return String.fromCharCode(toAsciiLowerCodePoint(
|
|
54094
|
+
function toAsciiLowerChar(cp2) {
|
|
54095
|
+
return String.fromCharCode(toAsciiLowerCodePoint(cp2));
|
|
54096
54096
|
}
|
|
54097
|
-
function findNamedEntityTreeBranch(nodeIx,
|
|
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 <
|
|
54104
|
+
if (midCp < cp2) {
|
|
54105
54105
|
lo = mid + 1;
|
|
54106
|
-
} else if (midCp >
|
|
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
|
|
54142
|
+
const cp2 = this._consume();
|
|
54143
54143
|
if (!this._ensureHibernation()) {
|
|
54144
|
-
this[this.state](
|
|
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
|
|
54187
|
+
let cp2 = startCp;
|
|
54188
54188
|
let patternCp = void 0;
|
|
54189
54189
|
for (; patternPos < patternLength; patternPos++) {
|
|
54190
54190
|
if (patternPos > 0) {
|
|
54191
|
-
|
|
54191
|
+
cp2 = this._consume();
|
|
54192
54192
|
consumedCount++;
|
|
54193
54193
|
}
|
|
54194
|
-
if (
|
|
54194
|
+
if (cp2 === $.EOF) {
|
|
54195
54195
|
isMatch = false;
|
|
54196
54196
|
break;
|
|
54197
54197
|
}
|
|
54198
54198
|
patternCp = pattern[patternPos];
|
|
54199
|
-
if (
|
|
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(
|
|
54329
|
+
_emitCodePoint(cp2) {
|
|
54330
54330
|
let type = _Tokenizer2.CHARACTER_TOKEN;
|
|
54331
|
-
if (isWhitespace(
|
|
54331
|
+
if (isWhitespace(cp2)) {
|
|
54332
54332
|
type = _Tokenizer2.WHITESPACE_CHARACTER_TOKEN;
|
|
54333
|
-
} else if (
|
|
54333
|
+
} else if (cp2 === $.NULL) {
|
|
54334
54334
|
type = _Tokenizer2.NULL_CHARACTER_TOKEN;
|
|
54335
54335
|
}
|
|
54336
|
-
this._appendCharToCurrentCharacterToken(type, toChar(
|
|
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
|
|
54363
|
-
this.tempBuff.push(
|
|
54362
|
+
const cp2 = this._consume();
|
|
54363
|
+
this.tempBuff.push(cp2);
|
|
54364
54364
|
excess++;
|
|
54365
|
-
if (
|
|
54365
|
+
if (cp2 === $.EOF) {
|
|
54366
54366
|
break;
|
|
54367
54367
|
}
|
|
54368
54368
|
if (inNode) {
|
|
54369
|
-
i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i,
|
|
54369
|
+
i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i, cp2) : -1;
|
|
54370
54370
|
} else {
|
|
54371
|
-
i =
|
|
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](
|
|
54404
|
+
[DATA_STATE](cp2) {
|
|
54405
54405
|
this.preprocessor.dropParsedChunk();
|
|
54406
|
-
if (
|
|
54406
|
+
if (cp2 === $.LESS_THAN_SIGN) {
|
|
54407
54407
|
this.state = TAG_OPEN_STATE;
|
|
54408
|
-
} else if (
|
|
54408
|
+
} else if (cp2 === $.AMPERSAND) {
|
|
54409
54409
|
this.returnState = DATA_STATE;
|
|
54410
54410
|
this.state = CHARACTER_REFERENCE_STATE;
|
|
54411
|
-
} else if (
|
|
54411
|
+
} else if (cp2 === $.NULL) {
|
|
54412
54412
|
this._err(ERR.unexpectedNullCharacter);
|
|
54413
|
-
this._emitCodePoint(
|
|
54414
|
-
} else if (
|
|
54413
|
+
this._emitCodePoint(cp2);
|
|
54414
|
+
} else if (cp2 === $.EOF) {
|
|
54415
54415
|
this._emitEOFToken();
|
|
54416
54416
|
} else {
|
|
54417
|
-
this._emitCodePoint(
|
|
54417
|
+
this._emitCodePoint(cp2);
|
|
54418
54418
|
}
|
|
54419
54419
|
}
|
|
54420
54420
|
// RCDATA state
|
|
54421
54421
|
//------------------------------------------------------------------
|
|
54422
|
-
[RCDATA_STATE](
|
|
54422
|
+
[RCDATA_STATE](cp2) {
|
|
54423
54423
|
this.preprocessor.dropParsedChunk();
|
|
54424
|
-
if (
|
|
54424
|
+
if (cp2 === $.AMPERSAND) {
|
|
54425
54425
|
this.returnState = RCDATA_STATE;
|
|
54426
54426
|
this.state = CHARACTER_REFERENCE_STATE;
|
|
54427
|
-
} else if (
|
|
54427
|
+
} else if (cp2 === $.LESS_THAN_SIGN) {
|
|
54428
54428
|
this.state = RCDATA_LESS_THAN_SIGN_STATE;
|
|
54429
|
-
} else if (
|
|
54429
|
+
} else if (cp2 === $.NULL) {
|
|
54430
54430
|
this._err(ERR.unexpectedNullCharacter);
|
|
54431
54431
|
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
|
54432
|
-
} else if (
|
|
54432
|
+
} else if (cp2 === $.EOF) {
|
|
54433
54433
|
this._emitEOFToken();
|
|
54434
54434
|
} else {
|
|
54435
|
-
this._emitCodePoint(
|
|
54435
|
+
this._emitCodePoint(cp2);
|
|
54436
54436
|
}
|
|
54437
54437
|
}
|
|
54438
54438
|
// RAWTEXT state
|
|
54439
54439
|
//------------------------------------------------------------------
|
|
54440
|
-
[RAWTEXT_STATE](
|
|
54440
|
+
[RAWTEXT_STATE](cp2) {
|
|
54441
54441
|
this.preprocessor.dropParsedChunk();
|
|
54442
|
-
if (
|
|
54442
|
+
if (cp2 === $.LESS_THAN_SIGN) {
|
|
54443
54443
|
this.state = RAWTEXT_LESS_THAN_SIGN_STATE;
|
|
54444
|
-
} else if (
|
|
54444
|
+
} else if (cp2 === $.NULL) {
|
|
54445
54445
|
this._err(ERR.unexpectedNullCharacter);
|
|
54446
54446
|
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
|
54447
|
-
} else if (
|
|
54447
|
+
} else if (cp2 === $.EOF) {
|
|
54448
54448
|
this._emitEOFToken();
|
|
54449
54449
|
} else {
|
|
54450
|
-
this._emitCodePoint(
|
|
54450
|
+
this._emitCodePoint(cp2);
|
|
54451
54451
|
}
|
|
54452
54452
|
}
|
|
54453
54453
|
// Script data state
|
|
54454
54454
|
//------------------------------------------------------------------
|
|
54455
|
-
[SCRIPT_DATA_STATE](
|
|
54455
|
+
[SCRIPT_DATA_STATE](cp2) {
|
|
54456
54456
|
this.preprocessor.dropParsedChunk();
|
|
54457
|
-
if (
|
|
54457
|
+
if (cp2 === $.LESS_THAN_SIGN) {
|
|
54458
54458
|
this.state = SCRIPT_DATA_LESS_THAN_SIGN_STATE;
|
|
54459
|
-
} else if (
|
|
54459
|
+
} else if (cp2 === $.NULL) {
|
|
54460
54460
|
this._err(ERR.unexpectedNullCharacter);
|
|
54461
54461
|
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
|
54462
|
-
} else if (
|
|
54462
|
+
} else if (cp2 === $.EOF) {
|
|
54463
54463
|
this._emitEOFToken();
|
|
54464
54464
|
} else {
|
|
54465
|
-
this._emitCodePoint(
|
|
54465
|
+
this._emitCodePoint(cp2);
|
|
54466
54466
|
}
|
|
54467
54467
|
}
|
|
54468
54468
|
// PLAINTEXT state
|
|
54469
54469
|
//------------------------------------------------------------------
|
|
54470
|
-
[PLAINTEXT_STATE](
|
|
54470
|
+
[PLAINTEXT_STATE](cp2) {
|
|
54471
54471
|
this.preprocessor.dropParsedChunk();
|
|
54472
|
-
if (
|
|
54472
|
+
if (cp2 === $.NULL) {
|
|
54473
54473
|
this._err(ERR.unexpectedNullCharacter);
|
|
54474
54474
|
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
|
54475
|
-
} else if (
|
|
54475
|
+
} else if (cp2 === $.EOF) {
|
|
54476
54476
|
this._emitEOFToken();
|
|
54477
54477
|
} else {
|
|
54478
|
-
this._emitCodePoint(
|
|
54478
|
+
this._emitCodePoint(cp2);
|
|
54479
54479
|
}
|
|
54480
54480
|
}
|
|
54481
54481
|
// Tag open state
|
|
54482
54482
|
//------------------------------------------------------------------
|
|
54483
|
-
[TAG_OPEN_STATE](
|
|
54484
|
-
if (
|
|
54483
|
+
[TAG_OPEN_STATE](cp2) {
|
|
54484
|
+
if (cp2 === $.EXCLAMATION_MARK) {
|
|
54485
54485
|
this.state = MARKUP_DECLARATION_OPEN_STATE;
|
|
54486
|
-
} else if (
|
|
54486
|
+
} else if (cp2 === $.SOLIDUS) {
|
|
54487
54487
|
this.state = END_TAG_OPEN_STATE;
|
|
54488
|
-
} else if (isAsciiLetter(
|
|
54488
|
+
} else if (isAsciiLetter(cp2)) {
|
|
54489
54489
|
this._createStartTagToken();
|
|
54490
54490
|
this._reconsumeInState(TAG_NAME_STATE);
|
|
54491
|
-
} else if (
|
|
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 (
|
|
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](
|
|
54508
|
-
if (isAsciiLetter(
|
|
54507
|
+
[END_TAG_OPEN_STATE](cp2) {
|
|
54508
|
+
if (isAsciiLetter(cp2)) {
|
|
54509
54509
|
this._createEndTagToken();
|
|
54510
54510
|
this._reconsumeInState(TAG_NAME_STATE);
|
|
54511
|
-
} else if (
|
|
54511
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
54512
54512
|
this._err(ERR.missingEndTagName);
|
|
54513
54513
|
this.state = DATA_STATE;
|
|
54514
|
-
} else if (
|
|
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](
|
|
54527
|
-
if (isWhitespace(
|
|
54526
|
+
[TAG_NAME_STATE](cp2) {
|
|
54527
|
+
if (isWhitespace(cp2)) {
|
|
54528
54528
|
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
|
54529
|
-
} else if (
|
|
54529
|
+
} else if (cp2 === $.SOLIDUS) {
|
|
54530
54530
|
this.state = SELF_CLOSING_START_TAG_STATE;
|
|
54531
|
-
} else if (
|
|
54531
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
54532
54532
|
this.state = DATA_STATE;
|
|
54533
54533
|
this._emitCurrentToken();
|
|
54534
|
-
} else if (isAsciiUpper(
|
|
54535
|
-
this.currentToken.tagName += toAsciiLowerChar(
|
|
54536
|
-
} else if (
|
|
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 (
|
|
54539
|
+
} else if (cp2 === $.EOF) {
|
|
54540
54540
|
this._err(ERR.eofInTag);
|
|
54541
54541
|
this._emitEOFToken();
|
|
54542
54542
|
} else {
|
|
54543
|
-
this.currentToken.tagName += toChar(
|
|
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](
|
|
54549
|
-
if (
|
|
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](
|
|
54560
|
-
if (isAsciiLetter(
|
|
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](
|
|
54571
|
-
if (isAsciiUpper(
|
|
54572
|
-
this.currentToken.tagName += toAsciiLowerChar(
|
|
54573
|
-
this.tempBuff.push(
|
|
54574
|
-
} else if (isAsciiLower(
|
|
54575
|
-
this.currentToken.tagName += toChar(
|
|
54576
|
-
this.tempBuff.push(
|
|
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(
|
|
54579
|
+
if (isWhitespace(cp2)) {
|
|
54580
54580
|
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
|
54581
54581
|
return;
|
|
54582
54582
|
}
|
|
54583
|
-
if (
|
|
54583
|
+
if (cp2 === $.SOLIDUS) {
|
|
54584
54584
|
this.state = SELF_CLOSING_START_TAG_STATE;
|
|
54585
54585
|
return;
|
|
54586
54586
|
}
|
|
54587
|
-
if (
|
|
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](
|
|
54601
|
-
if (
|
|
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](
|
|
54612
|
-
if (isAsciiLetter(
|
|
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](
|
|
54623
|
-
if (isAsciiUpper(
|
|
54624
|
-
this.currentToken.tagName += toAsciiLowerChar(
|
|
54625
|
-
this.tempBuff.push(
|
|
54626
|
-
} else if (isAsciiLower(
|
|
54627
|
-
this.currentToken.tagName += toChar(
|
|
54628
|
-
this.tempBuff.push(
|
|
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(
|
|
54631
|
+
if (isWhitespace(cp2)) {
|
|
54632
54632
|
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
|
54633
54633
|
return;
|
|
54634
54634
|
}
|
|
54635
|
-
if (
|
|
54635
|
+
if (cp2 === $.SOLIDUS) {
|
|
54636
54636
|
this.state = SELF_CLOSING_START_TAG_STATE;
|
|
54637
54637
|
return;
|
|
54638
54638
|
}
|
|
54639
|
-
if (
|
|
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](
|
|
54653
|
-
if (
|
|
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 (
|
|
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](
|
|
54667
|
-
if (isAsciiLetter(
|
|
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](
|
|
54678
|
-
if (isAsciiUpper(
|
|
54679
|
-
this.currentToken.tagName += toAsciiLowerChar(
|
|
54680
|
-
this.tempBuff.push(
|
|
54681
|
-
} else if (isAsciiLower(
|
|
54682
|
-
this.currentToken.tagName += toChar(
|
|
54683
|
-
this.tempBuff.push(
|
|
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(
|
|
54686
|
+
if (isWhitespace(cp2)) {
|
|
54687
54687
|
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
|
54688
54688
|
return;
|
|
54689
|
-
} else if (
|
|
54689
|
+
} else if (cp2 === $.SOLIDUS) {
|
|
54690
54690
|
this.state = SELF_CLOSING_START_TAG_STATE;
|
|
54691
54691
|
return;
|
|
54692
|
-
} else if (
|
|
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](
|
|
54706
|
-
if (
|
|
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](
|
|
54716
|
-
if (
|
|
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](
|
|
54726
|
-
if (
|
|
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 (
|
|
54729
|
+
} else if (cp2 === $.LESS_THAN_SIGN) {
|
|
54730
54730
|
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
|
|
54731
|
-
} else if (
|
|
54731
|
+
} else if (cp2 === $.NULL) {
|
|
54732
54732
|
this._err(ERR.unexpectedNullCharacter);
|
|
54733
54733
|
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
|
54734
|
-
} else if (
|
|
54734
|
+
} else if (cp2 === $.EOF) {
|
|
54735
54735
|
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
|
54736
54736
|
this._emitEOFToken();
|
|
54737
54737
|
} else {
|
|
54738
|
-
this._emitCodePoint(
|
|
54738
|
+
this._emitCodePoint(cp2);
|
|
54739
54739
|
}
|
|
54740
54740
|
}
|
|
54741
54741
|
// Script data escaped dash state
|
|
54742
54742
|
//------------------------------------------------------------------
|
|
54743
|
-
[SCRIPT_DATA_ESCAPED_DASH_STATE](
|
|
54744
|
-
if (
|
|
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 (
|
|
54747
|
+
} else if (cp2 === $.LESS_THAN_SIGN) {
|
|
54748
54748
|
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
|
|
54749
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
54764
|
-
if (
|
|
54763
|
+
[SCRIPT_DATA_ESCAPED_DASH_DASH_STATE](cp2) {
|
|
54764
|
+
if (cp2 === $.HYPHEN_MINUS) {
|
|
54765
54765
|
this._emitChars("-");
|
|
54766
|
-
} else if (
|
|
54766
|
+
} else if (cp2 === $.LESS_THAN_SIGN) {
|
|
54767
54767
|
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
|
|
54768
|
-
} else if (
|
|
54768
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
54769
54769
|
this.state = SCRIPT_DATA_STATE;
|
|
54770
54770
|
this._emitChars(">");
|
|
54771
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
54786
|
-
if (
|
|
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(
|
|
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](
|
|
54801
|
-
if (isAsciiLetter(
|
|
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](
|
|
54812
|
-
if (isAsciiUpper(
|
|
54813
|
-
this.currentToken.tagName += toAsciiLowerChar(
|
|
54814
|
-
this.tempBuff.push(
|
|
54815
|
-
} else if (isAsciiLower(
|
|
54816
|
-
this.currentToken.tagName += toChar(
|
|
54817
|
-
this.tempBuff.push(
|
|
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(
|
|
54820
|
+
if (isWhitespace(cp2)) {
|
|
54821
54821
|
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
|
54822
54822
|
return;
|
|
54823
54823
|
}
|
|
54824
|
-
if (
|
|
54824
|
+
if (cp2 === $.SOLIDUS) {
|
|
54825
54825
|
this.state = SELF_CLOSING_START_TAG_STATE;
|
|
54826
54826
|
return;
|
|
54827
54827
|
}
|
|
54828
|
-
if (
|
|
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](
|
|
54842
|
-
if (isWhitespace(
|
|
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(
|
|
54845
|
-
} else if (isAsciiUpper(
|
|
54846
|
-
this.tempBuff.push(toAsciiLowerCodePoint(
|
|
54847
|
-
this._emitCodePoint(
|
|
54848
|
-
} else if (isAsciiLower(
|
|
54849
|
-
this.tempBuff.push(
|
|
54850
|
-
this._emitCodePoint(
|
|
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](
|
|
54858
|
-
if (
|
|
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 (
|
|
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 (
|
|
54864
|
+
} else if (cp2 === $.NULL) {
|
|
54865
54865
|
this._err(ERR.unexpectedNullCharacter);
|
|
54866
54866
|
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
|
54867
|
-
} else if (
|
|
54867
|
+
} else if (cp2 === $.EOF) {
|
|
54868
54868
|
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
|
54869
54869
|
this._emitEOFToken();
|
|
54870
54870
|
} else {
|
|
54871
|
-
this._emitCodePoint(
|
|
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](
|
|
54877
|
-
if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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(
|
|
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](
|
|
54898
|
-
if (
|
|
54897
|
+
[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE](cp2) {
|
|
54898
|
+
if (cp2 === $.HYPHEN_MINUS) {
|
|
54899
54899
|
this._emitChars("-");
|
|
54900
|
-
} else if (
|
|
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 (
|
|
54903
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
54904
54904
|
this.state = SCRIPT_DATA_STATE;
|
|
54905
54905
|
this._emitChars(">");
|
|
54906
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
54921
|
-
if (
|
|
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](
|
|
54932
|
-
if (isWhitespace(
|
|
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(
|
|
54935
|
-
} else if (isAsciiUpper(
|
|
54936
|
-
this.tempBuff.push(toAsciiLowerCodePoint(
|
|
54937
|
-
this._emitCodePoint(
|
|
54938
|
-
} else if (isAsciiLower(
|
|
54939
|
-
this.tempBuff.push(
|
|
54940
|
-
this._emitCodePoint(
|
|
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](
|
|
54948
|
-
if (isWhitespace(
|
|
54947
|
+
[BEFORE_ATTRIBUTE_NAME_STATE](cp2) {
|
|
54948
|
+
if (isWhitespace(cp2)) {
|
|
54949
54949
|
return;
|
|
54950
54950
|
}
|
|
54951
|
-
if (
|
|
54951
|
+
if (cp2 === $.SOLIDUS || cp2 === $.GREATER_THAN_SIGN || cp2 === $.EOF) {
|
|
54952
54952
|
this._reconsumeInState(AFTER_ATTRIBUTE_NAME_STATE);
|
|
54953
|
-
} else if (
|
|
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](
|
|
54965
|
-
if (isWhitespace(
|
|
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 (
|
|
54968
|
+
} else if (cp2 === $.EQUALS_SIGN) {
|
|
54969
54969
|
this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE);
|
|
54970
|
-
} else if (isAsciiUpper(
|
|
54971
|
-
this.currentAttr.name += toAsciiLowerChar(
|
|
54972
|
-
} else if (
|
|
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(
|
|
54975
|
-
} else if (
|
|
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(
|
|
54979
|
+
this.currentAttr.name += toChar(cp2);
|
|
54980
54980
|
}
|
|
54981
54981
|
}
|
|
54982
54982
|
// After attribute name state
|
|
54983
54983
|
//------------------------------------------------------------------
|
|
54984
|
-
[AFTER_ATTRIBUTE_NAME_STATE](
|
|
54985
|
-
if (isWhitespace(
|
|
54984
|
+
[AFTER_ATTRIBUTE_NAME_STATE](cp2) {
|
|
54985
|
+
if (isWhitespace(cp2)) {
|
|
54986
54986
|
return;
|
|
54987
54987
|
}
|
|
54988
|
-
if (
|
|
54988
|
+
if (cp2 === $.SOLIDUS) {
|
|
54989
54989
|
this.state = SELF_CLOSING_START_TAG_STATE;
|
|
54990
|
-
} else if (
|
|
54990
|
+
} else if (cp2 === $.EQUALS_SIGN) {
|
|
54991
54991
|
this.state = BEFORE_ATTRIBUTE_VALUE_STATE;
|
|
54992
|
-
} else if (
|
|
54992
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
54993
54993
|
this.state = DATA_STATE;
|
|
54994
54994
|
this._emitCurrentToken();
|
|
54995
|
-
} else if (
|
|
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](
|
|
55006
|
-
if (isWhitespace(
|
|
55005
|
+
[BEFORE_ATTRIBUTE_VALUE_STATE](cp2) {
|
|
55006
|
+
if (isWhitespace(cp2)) {
|
|
55007
55007
|
return;
|
|
55008
55008
|
}
|
|
55009
|
-
if (
|
|
55009
|
+
if (cp2 === $.QUOTATION_MARK) {
|
|
55010
55010
|
this.state = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;
|
|
55011
|
-
} else if (
|
|
55011
|
+
} else if (cp2 === $.APOSTROPHE) {
|
|
55012
55012
|
this.state = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;
|
|
55013
|
-
} else if (
|
|
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](
|
|
55024
|
-
if (
|
|
55023
|
+
[ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE](cp2) {
|
|
55024
|
+
if (cp2 === $.QUOTATION_MARK) {
|
|
55025
55025
|
this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;
|
|
55026
|
-
} else if (
|
|
55026
|
+
} else if (cp2 === $.AMPERSAND) {
|
|
55027
55027
|
this.returnState = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;
|
|
55028
55028
|
this.state = CHARACTER_REFERENCE_STATE;
|
|
55029
|
-
} else if (
|
|
55029
|
+
} else if (cp2 === $.NULL) {
|
|
55030
55030
|
this._err(ERR.unexpectedNullCharacter);
|
|
55031
55031
|
this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
|
|
55032
|
-
} else if (
|
|
55032
|
+
} else if (cp2 === $.EOF) {
|
|
55033
55033
|
this._err(ERR.eofInTag);
|
|
55034
55034
|
this._emitEOFToken();
|
|
55035
55035
|
} else {
|
|
55036
|
-
this.currentAttr.value += toChar(
|
|
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](
|
|
55042
|
-
if (
|
|
55041
|
+
[ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE](cp2) {
|
|
55042
|
+
if (cp2 === $.APOSTROPHE) {
|
|
55043
55043
|
this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;
|
|
55044
|
-
} else if (
|
|
55044
|
+
} else if (cp2 === $.AMPERSAND) {
|
|
55045
55045
|
this.returnState = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;
|
|
55046
55046
|
this.state = CHARACTER_REFERENCE_STATE;
|
|
55047
|
-
} else if (
|
|
55047
|
+
} else if (cp2 === $.NULL) {
|
|
55048
55048
|
this._err(ERR.unexpectedNullCharacter);
|
|
55049
55049
|
this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
|
|
55050
|
-
} else if (
|
|
55050
|
+
} else if (cp2 === $.EOF) {
|
|
55051
55051
|
this._err(ERR.eofInTag);
|
|
55052
55052
|
this._emitEOFToken();
|
|
55053
55053
|
} else {
|
|
55054
|
-
this.currentAttr.value += toChar(
|
|
55054
|
+
this.currentAttr.value += toChar(cp2);
|
|
55055
55055
|
}
|
|
55056
55056
|
}
|
|
55057
55057
|
// Attribute value (unquoted) state
|
|
55058
55058
|
//------------------------------------------------------------------
|
|
55059
|
-
[ATTRIBUTE_VALUE_UNQUOTED_STATE](
|
|
55060
|
-
if (isWhitespace(
|
|
55059
|
+
[ATTRIBUTE_VALUE_UNQUOTED_STATE](cp2) {
|
|
55060
|
+
if (isWhitespace(cp2)) {
|
|
55061
55061
|
this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);
|
|
55062
|
-
} else if (
|
|
55062
|
+
} else if (cp2 === $.AMPERSAND) {
|
|
55063
55063
|
this.returnState = ATTRIBUTE_VALUE_UNQUOTED_STATE;
|
|
55064
55064
|
this.state = CHARACTER_REFERENCE_STATE;
|
|
55065
|
-
} else if (
|
|
55065
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55066
55066
|
this._leaveAttrValue(DATA_STATE);
|
|
55067
55067
|
this._emitCurrentToken();
|
|
55068
|
-
} else if (
|
|
55068
|
+
} else if (cp2 === $.NULL) {
|
|
55069
55069
|
this._err(ERR.unexpectedNullCharacter);
|
|
55070
55070
|
this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
|
|
55071
|
-
} else if (
|
|
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(
|
|
55074
|
-
} else if (
|
|
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(
|
|
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](
|
|
55084
|
-
if (isWhitespace(
|
|
55083
|
+
[AFTER_ATTRIBUTE_VALUE_QUOTED_STATE](cp2) {
|
|
55084
|
+
if (isWhitespace(cp2)) {
|
|
55085
55085
|
this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);
|
|
55086
|
-
} else if (
|
|
55086
|
+
} else if (cp2 === $.SOLIDUS) {
|
|
55087
55087
|
this._leaveAttrValue(SELF_CLOSING_START_TAG_STATE);
|
|
55088
|
-
} else if (
|
|
55088
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55089
55089
|
this._leaveAttrValue(DATA_STATE);
|
|
55090
55090
|
this._emitCurrentToken();
|
|
55091
|
-
} else if (
|
|
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](
|
|
55102
|
-
if (
|
|
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 (
|
|
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](
|
|
55117
|
-
if (
|
|
55116
|
+
[BOGUS_COMMENT_STATE](cp2) {
|
|
55117
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55118
55118
|
this.state = DATA_STATE;
|
|
55119
55119
|
this._emitCurrentToken();
|
|
55120
|
-
} else if (
|
|
55120
|
+
} else if (cp2 === $.EOF) {
|
|
55121
55121
|
this._emitCurrentToken();
|
|
55122
55122
|
this._emitEOFToken();
|
|
55123
|
-
} else if (
|
|
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(
|
|
55127
|
+
this.currentToken.data += toChar(cp2);
|
|
55128
55128
|
}
|
|
55129
55129
|
}
|
|
55130
55130
|
// Markup declaration open state
|
|
55131
55131
|
//------------------------------------------------------------------
|
|
55132
|
-
[MARKUP_DECLARATION_OPEN_STATE](
|
|
55133
|
-
if (this._consumeSequenceIfMatch($$.DASH_DASH_STRING,
|
|
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,
|
|
55136
|
+
} else if (this._consumeSequenceIfMatch($$.DOCTYPE_STRING, cp2, false)) {
|
|
55137
55137
|
this.state = DOCTYPE_STATE;
|
|
55138
|
-
} else if (this._consumeSequenceIfMatch($$.CDATA_START_STRING,
|
|
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](
|
|
55156
|
-
if (
|
|
55155
|
+
[COMMENT_START_STATE](cp2) {
|
|
55156
|
+
if (cp2 === $.HYPHEN_MINUS) {
|
|
55157
55157
|
this.state = COMMENT_START_DASH_STATE;
|
|
55158
|
-
} else if (
|
|
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](
|
|
55169
|
-
if (
|
|
55168
|
+
[COMMENT_START_DASH_STATE](cp2) {
|
|
55169
|
+
if (cp2 === $.HYPHEN_MINUS) {
|
|
55170
55170
|
this.state = COMMENT_END_STATE;
|
|
55171
|
-
} else if (
|
|
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 (
|
|
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](
|
|
55187
|
-
if (
|
|
55186
|
+
[COMMENT_STATE](cp2) {
|
|
55187
|
+
if (cp2 === $.HYPHEN_MINUS) {
|
|
55188
55188
|
this.state = COMMENT_END_DASH_STATE;
|
|
55189
|
-
} else if (
|
|
55189
|
+
} else if (cp2 === $.LESS_THAN_SIGN) {
|
|
55190
55190
|
this.currentToken.data += "<";
|
|
55191
55191
|
this.state = COMMENT_LESS_THAN_SIGN_STATE;
|
|
55192
|
-
} else if (
|
|
55192
|
+
} else if (cp2 === $.NULL) {
|
|
55193
55193
|
this._err(ERR.unexpectedNullCharacter);
|
|
55194
55194
|
this.currentToken.data += unicode.REPLACEMENT_CHARACTER;
|
|
55195
|
-
} else if (
|
|
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(
|
|
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](
|
|
55206
|
-
if (
|
|
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 (
|
|
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](
|
|
55218
|
-
if (
|
|
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](
|
|
55227
|
-
if (
|
|
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](
|
|
55236
|
-
if (
|
|
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](
|
|
55244
|
-
if (
|
|
55243
|
+
[COMMENT_END_DASH_STATE](cp2) {
|
|
55244
|
+
if (cp2 === $.HYPHEN_MINUS) {
|
|
55245
55245
|
this.state = COMMENT_END_STATE;
|
|
55246
|
-
} else if (
|
|
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](
|
|
55258
|
-
if (
|
|
55257
|
+
[COMMENT_END_STATE](cp2) {
|
|
55258
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55259
55259
|
this.state = DATA_STATE;
|
|
55260
55260
|
this._emitCurrentToken();
|
|
55261
|
-
} else if (
|
|
55261
|
+
} else if (cp2 === $.EXCLAMATION_MARK) {
|
|
55262
55262
|
this.state = COMMENT_END_BANG_STATE;
|
|
55263
|
-
} else if (
|
|
55263
|
+
} else if (cp2 === $.HYPHEN_MINUS) {
|
|
55264
55264
|
this.currentToken.data += "-";
|
|
55265
|
-
} else if (
|
|
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](
|
|
55277
|
-
if (
|
|
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 (
|
|
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 (
|
|
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](
|
|
55296
|
-
if (isWhitespace(
|
|
55295
|
+
[DOCTYPE_STATE](cp2) {
|
|
55296
|
+
if (isWhitespace(cp2)) {
|
|
55297
55297
|
this.state = BEFORE_DOCTYPE_NAME_STATE;
|
|
55298
|
-
} else if (
|
|
55298
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55299
55299
|
this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE);
|
|
55300
|
-
} else if (
|
|
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](
|
|
55314
|
-
if (isWhitespace(
|
|
55313
|
+
[BEFORE_DOCTYPE_NAME_STATE](cp2) {
|
|
55314
|
+
if (isWhitespace(cp2)) {
|
|
55315
55315
|
return;
|
|
55316
55316
|
}
|
|
55317
|
-
if (isAsciiUpper(
|
|
55318
|
-
this._createDoctypeToken(toAsciiLowerChar(
|
|
55317
|
+
if (isAsciiUpper(cp2)) {
|
|
55318
|
+
this._createDoctypeToken(toAsciiLowerChar(cp2));
|
|
55319
55319
|
this.state = DOCTYPE_NAME_STATE;
|
|
55320
|
-
} else if (
|
|
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 (
|
|
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 (
|
|
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(
|
|
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](
|
|
55344
|
-
if (isWhitespace(
|
|
55343
|
+
[DOCTYPE_NAME_STATE](cp2) {
|
|
55344
|
+
if (isWhitespace(cp2)) {
|
|
55345
55345
|
this.state = AFTER_DOCTYPE_NAME_STATE;
|
|
55346
|
-
} else if (
|
|
55346
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55347
55347
|
this.state = DATA_STATE;
|
|
55348
55348
|
this._emitCurrentToken();
|
|
55349
|
-
} else if (isAsciiUpper(
|
|
55350
|
-
this.currentToken.name += toAsciiLowerChar(
|
|
55351
|
-
} else if (
|
|
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 (
|
|
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(
|
|
55360
|
+
this.currentToken.name += toChar(cp2);
|
|
55361
55361
|
}
|
|
55362
55362
|
}
|
|
55363
55363
|
// After DOCTYPE name state
|
|
55364
55364
|
//------------------------------------------------------------------
|
|
55365
|
-
[AFTER_DOCTYPE_NAME_STATE](
|
|
55366
|
-
if (isWhitespace(
|
|
55365
|
+
[AFTER_DOCTYPE_NAME_STATE](cp2) {
|
|
55366
|
+
if (isWhitespace(cp2)) {
|
|
55367
55367
|
return;
|
|
55368
55368
|
}
|
|
55369
|
-
if (
|
|
55369
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55370
55370
|
this.state = DATA_STATE;
|
|
55371
55371
|
this._emitCurrentToken();
|
|
55372
|
-
} else if (
|
|
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,
|
|
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,
|
|
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](
|
|
55390
|
-
if (isWhitespace(
|
|
55389
|
+
[AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE](cp2) {
|
|
55390
|
+
if (isWhitespace(cp2)) {
|
|
55391
55391
|
this.state = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
|
|
55392
|
-
} else if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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](
|
|
55419
|
-
if (isWhitespace(
|
|
55418
|
+
[BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp2) {
|
|
55419
|
+
if (isWhitespace(cp2)) {
|
|
55420
55420
|
return;
|
|
55421
55421
|
}
|
|
55422
|
-
if (
|
|
55422
|
+
if (cp2 === $.QUOTATION_MARK) {
|
|
55423
55423
|
this.currentToken.publicId = "";
|
|
55424
55424
|
this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
|
55425
|
-
} else if (
|
|
55425
|
+
} else if (cp2 === $.APOSTROPHE) {
|
|
55426
55426
|
this.currentToken.publicId = "";
|
|
55427
55427
|
this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE;
|
|
55428
|
-
} else if (
|
|
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 (
|
|
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](
|
|
55447
|
-
if (
|
|
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 (
|
|
55449
|
+
} else if (cp2 === $.NULL) {
|
|
55450
55450
|
this._err(ERR.unexpectedNullCharacter);
|
|
55451
55451
|
this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER;
|
|
55452
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
55469
|
-
if (
|
|
55468
|
+
[DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE](cp2) {
|
|
55469
|
+
if (cp2 === $.APOSTROPHE) {
|
|
55470
55470
|
this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
|
|
55471
|
-
} else if (
|
|
55471
|
+
} else if (cp2 === $.NULL) {
|
|
55472
55472
|
this._err(ERR.unexpectedNullCharacter);
|
|
55473
55473
|
this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER;
|
|
55474
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
55491
|
-
if (isWhitespace(
|
|
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 (
|
|
55493
|
+
} else if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55494
55494
|
this.state = DATA_STATE;
|
|
55495
55495
|
this._emitCurrentToken();
|
|
55496
|
-
} else if (
|
|
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 (
|
|
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 (
|
|
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](
|
|
55518
|
-
if (isWhitespace(
|
|
55517
|
+
[BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE](cp2) {
|
|
55518
|
+
if (isWhitespace(cp2)) {
|
|
55519
55519
|
return;
|
|
55520
55520
|
}
|
|
55521
|
-
if (
|
|
55521
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55522
55522
|
this._emitCurrentToken();
|
|
55523
55523
|
this.state = DATA_STATE;
|
|
55524
|
-
} else if (
|
|
55524
|
+
} else if (cp2 === $.QUOTATION_MARK) {
|
|
55525
55525
|
this.currentToken.systemId = "";
|
|
55526
55526
|
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
|
55527
|
-
} else if (
|
|
55527
|
+
} else if (cp2 === $.APOSTROPHE) {
|
|
55528
55528
|
this.currentToken.systemId = "";
|
|
55529
55529
|
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
|
|
55530
|
-
} else if (
|
|
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](
|
|
55544
|
-
if (isWhitespace(
|
|
55543
|
+
[AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE](cp2) {
|
|
55544
|
+
if (isWhitespace(cp2)) {
|
|
55545
55545
|
this.state = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
|
|
55546
|
-
} else if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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](
|
|
55573
|
-
if (isWhitespace(
|
|
55572
|
+
[BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp2) {
|
|
55573
|
+
if (isWhitespace(cp2)) {
|
|
55574
55574
|
return;
|
|
55575
55575
|
}
|
|
55576
|
-
if (
|
|
55576
|
+
if (cp2 === $.QUOTATION_MARK) {
|
|
55577
55577
|
this.currentToken.systemId = "";
|
|
55578
55578
|
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
|
55579
|
-
} else if (
|
|
55579
|
+
} else if (cp2 === $.APOSTROPHE) {
|
|
55580
55580
|
this.currentToken.systemId = "";
|
|
55581
55581
|
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
|
|
55582
|
-
} else if (
|
|
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 (
|
|
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](
|
|
55601
|
-
if (
|
|
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 (
|
|
55603
|
+
} else if (cp2 === $.NULL) {
|
|
55604
55604
|
this._err(ERR.unexpectedNullCharacter);
|
|
55605
55605
|
this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER;
|
|
55606
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
55623
|
-
if (
|
|
55622
|
+
[DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp2) {
|
|
55623
|
+
if (cp2 === $.APOSTROPHE) {
|
|
55624
55624
|
this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
|
|
55625
|
-
} else if (
|
|
55625
|
+
} else if (cp2 === $.NULL) {
|
|
55626
55626
|
this._err(ERR.unexpectedNullCharacter);
|
|
55627
55627
|
this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER;
|
|
55628
|
-
} else if (
|
|
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 (
|
|
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(
|
|
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](
|
|
55645
|
-
if (isWhitespace(
|
|
55644
|
+
[AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp2) {
|
|
55645
|
+
if (isWhitespace(cp2)) {
|
|
55646
55646
|
return;
|
|
55647
55647
|
}
|
|
55648
|
-
if (
|
|
55648
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55649
55649
|
this._emitCurrentToken();
|
|
55650
55650
|
this.state = DATA_STATE;
|
|
55651
|
-
} else if (
|
|
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](
|
|
55664
|
-
if (
|
|
55663
|
+
[BOGUS_DOCTYPE_STATE](cp2) {
|
|
55664
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55665
55665
|
this._emitCurrentToken();
|
|
55666
55666
|
this.state = DATA_STATE;
|
|
55667
|
-
} else if (
|
|
55667
|
+
} else if (cp2 === $.NULL) {
|
|
55668
55668
|
this._err(ERR.unexpectedNullCharacter);
|
|
55669
|
-
} else if (
|
|
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](
|
|
55677
|
-
if (
|
|
55676
|
+
[CDATA_SECTION_STATE](cp2) {
|
|
55677
|
+
if (cp2 === $.RIGHT_SQUARE_BRACKET) {
|
|
55678
55678
|
this.state = CDATA_SECTION_BRACKET_STATE;
|
|
55679
|
-
} else if (
|
|
55679
|
+
} else if (cp2 === $.EOF) {
|
|
55680
55680
|
this._err(ERR.eofInCdata);
|
|
55681
55681
|
this._emitEOFToken();
|
|
55682
55682
|
} else {
|
|
55683
|
-
this._emitCodePoint(
|
|
55683
|
+
this._emitCodePoint(cp2);
|
|
55684
55684
|
}
|
|
55685
55685
|
}
|
|
55686
55686
|
// CDATA section bracket state
|
|
55687
55687
|
//------------------------------------------------------------------
|
|
55688
|
-
[CDATA_SECTION_BRACKET_STATE](
|
|
55689
|
-
if (
|
|
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](
|
|
55699
|
-
if (
|
|
55698
|
+
[CDATA_SECTION_END_STATE](cp2) {
|
|
55699
|
+
if (cp2 === $.GREATER_THAN_SIGN) {
|
|
55700
55700
|
this.state = DATA_STATE;
|
|
55701
|
-
} else if (
|
|
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](
|
|
55710
|
+
[CHARACTER_REFERENCE_STATE](cp2) {
|
|
55711
55711
|
this.tempBuff = [$.AMPERSAND];
|
|
55712
|
-
if (
|
|
55713
|
-
this.tempBuff.push(
|
|
55712
|
+
if (cp2 === $.NUMBER_SIGN) {
|
|
55713
|
+
this.tempBuff.push(cp2);
|
|
55714
55714
|
this.state = NUMERIC_CHARACTER_REFERENCE_STATE;
|
|
55715
|
-
} else if (isAsciiAlphaNumeric(
|
|
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](
|
|
55725
|
-
const matchResult = this._matchNamedCharacterReference(
|
|
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](
|
|
55746
|
-
if (isAsciiAlphaNumeric(
|
|
55745
|
+
[AMBIGUOUS_AMPERSAND_STATE](cp2) {
|
|
55746
|
+
if (isAsciiAlphaNumeric(cp2)) {
|
|
55747
55747
|
if (this._isCharacterReferenceInAttribute()) {
|
|
55748
|
-
this.currentAttr.value += toChar(
|
|
55748
|
+
this.currentAttr.value += toChar(cp2);
|
|
55749
55749
|
} else {
|
|
55750
|
-
this._emitCodePoint(
|
|
55750
|
+
this._emitCodePoint(cp2);
|
|
55751
55751
|
}
|
|
55752
55752
|
} else {
|
|
55753
|
-
if (
|
|
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](
|
|
55761
|
+
[NUMERIC_CHARACTER_REFERENCE_STATE](cp2) {
|
|
55762
55762
|
this.charRefCode = 0;
|
|
55763
|
-
if (
|
|
55764
|
-
this.tempBuff.push(
|
|
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](
|
|
55773
|
-
if (isAsciiHexDigit(
|
|
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](
|
|
55784
|
-
if (isAsciiDigit(
|
|
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](
|
|
55795
|
-
if (isAsciiUpperHexDigit(
|
|
55796
|
-
this.charRefCode = this.charRefCode * 16 +
|
|
55797
|
-
} else if (isAsciiLowerHexDigit(
|
|
55798
|
-
this.charRefCode = this.charRefCode * 16 +
|
|
55799
|
-
} else if (isAsciiDigit(
|
|
55800
|
-
this.charRefCode = this.charRefCode * 16 +
|
|
55801
|
-
} else if (
|
|
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](
|
|
55811
|
-
if (isAsciiDigit(
|
|
55812
|
-
this.charRefCode = this.charRefCode * 10 +
|
|
55813
|
-
} else if (
|
|
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(
|
|
56802
|
+
methods[state] = function(cp2) {
|
|
56803
56803
|
mxn.ctLoc = mxn._getCurrentLocation();
|
|
56804
|
-
orig[state].call(this,
|
|
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
|
|
80941
|
-
if (!(
|
|
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:
|
|
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
|
|
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
|
|
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.
|
|
124681
|
+
version: "0.0.18",
|
|
124682
124682
|
private: false,
|
|
124683
124683
|
description: "Docyrus API CLI",
|
|
124684
124684
|
main: "./main.js",
|
|
@@ -124686,11 +124686,15 @@ var package_default = {
|
|
|
124686
124686
|
docyrus: "main.js"
|
|
124687
124687
|
},
|
|
124688
124688
|
dependencies: {
|
|
124689
|
+
"@clack/prompts": "^0.11.0",
|
|
124690
|
+
"@mariozechner/pi-ai": "0.59.0",
|
|
124691
|
+
"@mariozechner/pi-coding-agent": "0.59.0",
|
|
124689
124692
|
"@opentui/core": "^0.1.85",
|
|
124690
124693
|
"@opentui/react": "^0.1.85",
|
|
124691
124694
|
incur: "^0.1.6",
|
|
124692
124695
|
marked: "^15.0.12",
|
|
124693
124696
|
"marked-terminal": "^7.3.0",
|
|
124697
|
+
picocolors: "^1.1.1",
|
|
124694
124698
|
react: "^19.1.1",
|
|
124695
124699
|
undici: "^7.16.0"
|
|
124696
124700
|
},
|
|
@@ -124705,34 +124709,6 @@ var package_default = {
|
|
|
124705
124709
|
}
|
|
124706
124710
|
};
|
|
124707
124711
|
|
|
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
124712
|
// src/schemas.ts
|
|
124737
124713
|
var EnvSchema = external_exports.object({
|
|
124738
124714
|
DOCYRUS_API_CLIENT_ID: external_exports.string().optional().describe("Default Docyrus OAuth2 client id")
|
|
@@ -124824,6 +124800,93 @@ var OAuth2DeviceAuthorizationSchema = external_exports.object({
|
|
|
124824
124800
|
interval: external_exports.number().int().nonnegative().default(5)
|
|
124825
124801
|
});
|
|
124826
124802
|
|
|
124803
|
+
// src/commands/agentCommand.ts
|
|
124804
|
+
var PI_AGENT_MODES = ["text", "json"];
|
|
124805
|
+
var PI_AGENT_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"];
|
|
124806
|
+
function hasRawVerboseFlag() {
|
|
124807
|
+
return process.argv.includes("--verbose");
|
|
124808
|
+
}
|
|
124809
|
+
function createPiAgentCommand(params) {
|
|
124810
|
+
return Cli_exports.create(params.profile, {
|
|
124811
|
+
description: params.description,
|
|
124812
|
+
env: EnvSchema,
|
|
124813
|
+
outputPolicy: "agent-only",
|
|
124814
|
+
args: external_exports.object({
|
|
124815
|
+
prompt: external_exports.string().optional().describe("Optional initial prompt; omit to open the interactive TUI")
|
|
124816
|
+
}),
|
|
124817
|
+
options: external_exports.object({
|
|
124818
|
+
print: external_exports.boolean().optional().describe("Run one-shot print mode instead of the interactive TUI"),
|
|
124819
|
+
mode: external_exports.enum(PI_AGENT_MODES).optional().describe("Print mode output: text or json"),
|
|
124820
|
+
continue: external_exports.boolean().optional().describe("Continue the previous pi session"),
|
|
124821
|
+
resume: external_exports.boolean().optional().describe("Open the pi session picker"),
|
|
124822
|
+
provider: external_exports.string().optional().describe("Model provider"),
|
|
124823
|
+
model: external_exports.string().optional().describe("Model pattern or full provider/model id"),
|
|
124824
|
+
thinking: external_exports.enum(PI_AGENT_THINKING_LEVELS).optional().describe("Thinking level"),
|
|
124825
|
+
session: external_exports.string().optional().describe("Specific session file to use"),
|
|
124826
|
+
sessionDir: external_exports.string().optional().describe("Override session storage directory"),
|
|
124827
|
+
apiKey: external_exports.string().optional().describe("Temporary provider API key override for this run"),
|
|
124828
|
+
verbose: external_exports.boolean().optional().describe("Enable verbose pi startup output")
|
|
124829
|
+
}),
|
|
124830
|
+
alias: {
|
|
124831
|
+
print: "p",
|
|
124832
|
+
continue: "c",
|
|
124833
|
+
resume: "r"
|
|
124834
|
+
},
|
|
124835
|
+
run: async (context) => {
|
|
124836
|
+
const prompt = context.args.prompt?.trim();
|
|
124837
|
+
const request = {
|
|
124838
|
+
profile: params.profile,
|
|
124839
|
+
prompt: prompt && prompt.length > 0 ? prompt : void 0,
|
|
124840
|
+
...context.options,
|
|
124841
|
+
verbose: context.options.verbose || hasRawVerboseFlag() ? true : void 0
|
|
124842
|
+
};
|
|
124843
|
+
await params.dependencies.launchPiAgent(request);
|
|
124844
|
+
}
|
|
124845
|
+
});
|
|
124846
|
+
}
|
|
124847
|
+
function createAgentCli(dependencies) {
|
|
124848
|
+
return createPiAgentCommand({
|
|
124849
|
+
profile: "agent",
|
|
124850
|
+
description: "Launch the Docyrus pi assistant",
|
|
124851
|
+
dependencies
|
|
124852
|
+
});
|
|
124853
|
+
}
|
|
124854
|
+
function createCoderCli(dependencies) {
|
|
124855
|
+
return createPiAgentCommand({
|
|
124856
|
+
profile: "coder",
|
|
124857
|
+
description: "Launch the Docyrus pi coding agent",
|
|
124858
|
+
dependencies
|
|
124859
|
+
});
|
|
124860
|
+
}
|
|
124861
|
+
|
|
124862
|
+
// src/commands/aiCommand.ts
|
|
124863
|
+
var import_node_crypto2 = require("node:crypto");
|
|
124864
|
+
|
|
124865
|
+
// src/errors.ts
|
|
124866
|
+
var ApplicationError = class extends Error {
|
|
124867
|
+
constructor(message, data = {}, httpStatusCode = 500) {
|
|
124868
|
+
super(message);
|
|
124869
|
+
this.data = data;
|
|
124870
|
+
this.httpStatusCode = httpStatusCode;
|
|
124871
|
+
}
|
|
124872
|
+
};
|
|
124873
|
+
var UserInputError = class extends ApplicationError {
|
|
124874
|
+
constructor(message, data = {}) {
|
|
124875
|
+
super(message, data, 400);
|
|
124876
|
+
}
|
|
124877
|
+
};
|
|
124878
|
+
var AuthSessionError = class extends ApplicationError {
|
|
124879
|
+
constructor(message, data = {}) {
|
|
124880
|
+
super(message, data, 401);
|
|
124881
|
+
}
|
|
124882
|
+
};
|
|
124883
|
+
var ApiResponseError = class extends ApplicationError {
|
|
124884
|
+
constructor(details) {
|
|
124885
|
+
super(details.error_description || details.error || "Docyrus API request failed", details, details.status || 500);
|
|
124886
|
+
this.details = details;
|
|
124887
|
+
}
|
|
124888
|
+
};
|
|
124889
|
+
|
|
124827
124890
|
// src/services/resultContext.ts
|
|
124828
124891
|
function isObject2(value) {
|
|
124829
124892
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -125181,6 +125244,8 @@ var DEFAULT_LOGIN_SCOPES = [
|
|
|
125181
125244
|
"AI.ReadWrite.All"
|
|
125182
125245
|
].join(" ");
|
|
125183
125246
|
var DOCYRUS_SETTINGS_DIR_NAME = ".docyrus";
|
|
125247
|
+
var DOCYRUS_PI_DIR_NAME = "pi";
|
|
125248
|
+
var DOCYRUS_PI_AGENT_DIR_NAME = "agent";
|
|
125184
125249
|
var AUTH_DIR_PATH = (0, import_node_path3.join)((0, import_node_os5.homedir)(), DOCYRUS_SETTINGS_DIR_NAME);
|
|
125185
125250
|
var AUTH_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "auth.json");
|
|
125186
125251
|
var CONFIG_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "config.json");
|
|
@@ -125216,6 +125281,9 @@ var DEFAULT_DEVICE_CODE_EXPIRY_SECONDS = 600;
|
|
|
125216
125281
|
function getLocalDocyrusSettingsRootPath(cwd = process.cwd()) {
|
|
125217
125282
|
return (0, import_node_path3.join)(cwd, DOCYRUS_SETTINGS_DIR_NAME);
|
|
125218
125283
|
}
|
|
125284
|
+
function resolveDocyrusPiAgentRootPath(settingsRootPath) {
|
|
125285
|
+
return (0, import_node_path3.join)(settingsRootPath, DOCYRUS_PI_DIR_NAME, DOCYRUS_PI_AGENT_DIR_NAME);
|
|
125286
|
+
}
|
|
125219
125287
|
function toDocyrusSettingsPaths(rootPath, scope) {
|
|
125220
125288
|
return {
|
|
125221
125289
|
scope,
|
|
@@ -128845,9 +128913,254 @@ var EnvironmentConfigService = class {
|
|
|
128845
128913
|
}
|
|
128846
128914
|
};
|
|
128847
128915
|
|
|
128848
|
-
// src/services/
|
|
128916
|
+
// src/services/piAgentLauncher.ts
|
|
128917
|
+
var import_node_child_process3 = require("node:child_process");
|
|
128918
|
+
var import_node_fs4 = require("node:fs");
|
|
128849
128919
|
var import_promises7 = require("node:fs/promises");
|
|
128850
128920
|
var import_node_path9 = require("node:path");
|
|
128921
|
+
function summarizeFailure2(result) {
|
|
128922
|
+
const stderr = result.stderr?.toString().trim();
|
|
128923
|
+
if (stderr && stderr.length > 0) {
|
|
128924
|
+
return stderr;
|
|
128925
|
+
}
|
|
128926
|
+
if (typeof result.status === "number") {
|
|
128927
|
+
return `Docyrus pi loader exited with code ${result.status}.`;
|
|
128928
|
+
}
|
|
128929
|
+
if (result.signal) {
|
|
128930
|
+
return `Docyrus pi loader exited due to signal ${result.signal}.`;
|
|
128931
|
+
}
|
|
128932
|
+
return "Docyrus pi loader terminated unexpectedly.";
|
|
128933
|
+
}
|
|
128934
|
+
function resolvePackagedPiResourceRoot(options2 = {}) {
|
|
128935
|
+
const cwd = options2.cwd ?? process.cwd();
|
|
128936
|
+
const dirname6 = options2.dirname ?? __dirname;
|
|
128937
|
+
const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
|
|
128938
|
+
const candidates = [
|
|
128939
|
+
(0, import_node_path9.resolve)(cwd, "apps/api-cli/resources/pi-agent"),
|
|
128940
|
+
(0, import_node_path9.resolve)(dirname6, "../resources/pi-agent"),
|
|
128941
|
+
(0, import_node_path9.resolve)(dirname6, "resources/pi-agent"),
|
|
128942
|
+
(0, import_node_path9.resolve)(cwd, "dist/apps/api-cli/resources/pi-agent")
|
|
128943
|
+
];
|
|
128944
|
+
const resolved = candidates.find((candidate) => fileExists(candidate));
|
|
128945
|
+
if (!resolved) {
|
|
128946
|
+
throw new UserInputError(`Unable to locate pi agent resources. Checked: ${candidates.join(", ")}`);
|
|
128947
|
+
}
|
|
128948
|
+
return resolved;
|
|
128949
|
+
}
|
|
128950
|
+
function resolveDocyrusPiLoaderEntryPath(options2 = {}) {
|
|
128951
|
+
const cwd = options2.cwd ?? process.cwd();
|
|
128952
|
+
const dirname6 = options2.dirname ?? __dirname;
|
|
128953
|
+
const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
|
|
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, "dist", "apps", "api-cli", "agent-loader.js"));
|
|
128966
|
+
addCandidate((0, import_node_path9.join)(currentDir, "agent-loader.js"));
|
|
128967
|
+
if ((0, import_node_path9.basename)(currentDir) === "dist") {
|
|
128968
|
+
addCandidate((0, import_node_path9.join)(currentDir, "apps", "api-cli", "agent-loader.js"));
|
|
128969
|
+
}
|
|
128970
|
+
const parentDir = (0, import_node_path9.resolve)(currentDir, "..");
|
|
128971
|
+
if (parentDir === currentDir) {
|
|
128972
|
+
break;
|
|
128973
|
+
}
|
|
128974
|
+
currentDir = parentDir;
|
|
128975
|
+
}
|
|
128976
|
+
};
|
|
128977
|
+
addCandidate((0, import_node_path9.resolve)(cwd, "dist/apps/api-cli/agent-loader.js"));
|
|
128978
|
+
addCandidate((0, import_node_path9.resolve)(dirname6, "../agent-loader.js"));
|
|
128979
|
+
addCandidate((0, import_node_path9.resolve)(dirname6, "agent-loader.js"));
|
|
128980
|
+
collectAncestorCandidates(cwd);
|
|
128981
|
+
collectAncestorCandidates(dirname6);
|
|
128982
|
+
const resolved = candidates.find((candidate) => fileExists(candidate));
|
|
128983
|
+
if (!resolved) {
|
|
128984
|
+
throw new UserInputError(`Unable to locate Docyrus pi loader entry file. Checked: ${candidates.join(", ")}`);
|
|
128985
|
+
}
|
|
128986
|
+
return resolved;
|
|
128987
|
+
}
|
|
128988
|
+
function resolveInstalledPiPackageRootPath(options2 = {}) {
|
|
128989
|
+
const cwd = options2.cwd ?? process.cwd();
|
|
128990
|
+
const dirname6 = options2.dirname ?? __dirname;
|
|
128991
|
+
const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
|
|
128992
|
+
const seen = /* @__PURE__ */ new Set();
|
|
128993
|
+
const candidates = options2.candidatePaths ?? [];
|
|
128994
|
+
const addCandidate = (candidate) => {
|
|
128995
|
+
if (!seen.has(candidate)) {
|
|
128996
|
+
seen.add(candidate);
|
|
128997
|
+
candidates.push(candidate);
|
|
128998
|
+
}
|
|
128999
|
+
};
|
|
129000
|
+
const collectAncestorCandidates = (startDir) => {
|
|
129001
|
+
let currentDir = (0, import_node_path9.resolve)(startDir);
|
|
129002
|
+
while (true) {
|
|
129003
|
+
addCandidate((0, import_node_path9.join)(currentDir, "node_modules", "@mariozechner", "pi-coding-agent", "package.json"));
|
|
129004
|
+
if ((0, import_node_path9.basename)(currentDir) === "node_modules") {
|
|
129005
|
+
addCandidate((0, import_node_path9.join)(currentDir, "@mariozechner", "pi-coding-agent", "package.json"));
|
|
129006
|
+
}
|
|
129007
|
+
const parentDir = (0, import_node_path9.resolve)(currentDir, "..");
|
|
129008
|
+
if (parentDir === currentDir) {
|
|
129009
|
+
break;
|
|
129010
|
+
}
|
|
129011
|
+
currentDir = parentDir;
|
|
129012
|
+
}
|
|
129013
|
+
};
|
|
129014
|
+
addCandidate((0, import_node_path9.resolve)(cwd, "apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
|
|
129015
|
+
collectAncestorCandidates(cwd);
|
|
129016
|
+
collectAncestorCandidates(dirname6);
|
|
129017
|
+
const resolvedPackageJson = candidates.find((candidate) => fileExists(candidate));
|
|
129018
|
+
if (!resolvedPackageJson) {
|
|
129019
|
+
throw new UserInputError(`Unable to locate the installed pi package root. Checked: ${candidates.join(", ")}`);
|
|
129020
|
+
}
|
|
129021
|
+
return (0, import_node_path9.resolve)(resolvedPackageJson, "..");
|
|
129022
|
+
}
|
|
129023
|
+
function createPiAgentRuntimeSkill(params) {
|
|
129024
|
+
const commandPrefix = params.scope === "global" ? "docyrus -g" : "docyrus";
|
|
129025
|
+
const authLines = params.activeProfile ? [
|
|
129026
|
+
`- email: \`${params.activeProfile.email}\``,
|
|
129027
|
+
`- tenant: \`${params.activeProfile.tenantName} (${params.activeProfile.tenantNo})\``,
|
|
129028
|
+
`- userId: \`${params.activeProfile.userId}\``,
|
|
129029
|
+
`- tenantId: \`${params.activeProfile.tenantId}\``
|
|
129030
|
+
] : [
|
|
129031
|
+
"- No active Docyrus auth session is available.",
|
|
129032
|
+
`- Authenticate first with \`${commandPrefix} auth login\` before making Docyrus API calls.`
|
|
129033
|
+
];
|
|
129034
|
+
return [
|
|
129035
|
+
"---",
|
|
129036
|
+
"name: docyrus-runtime-context",
|
|
129037
|
+
"description: Runtime context for the active Docyrus CLI scope, environment, and auth session.",
|
|
129038
|
+
"disable-model-invocation: true",
|
|
129039
|
+
"---",
|
|
129040
|
+
"",
|
|
129041
|
+
"# Docyrus Runtime Context",
|
|
129042
|
+
"",
|
|
129043
|
+
"- Primary domain: Docyrus. Assume user requests are Docyrus-related unless the prompt clearly says otherwise.",
|
|
129044
|
+
`- Current Docyrus settings scope: \`${params.scope}\``,
|
|
129045
|
+
`- Current working directory: \`${params.cwd}\``,
|
|
129046
|
+
`- Active Docyrus settings root: \`${params.settingsRootPath}\``,
|
|
129047
|
+
`- Use this exact Docyrus CLI command prefix in this session: \`${commandPrefix}\``,
|
|
129048
|
+
"- Prefer machine-readable Docyrus operations by appending `--json` whenever you need to inspect or transform CLI output.",
|
|
129049
|
+
"- Prefer the Docyrus CLI over guessed HTTP endpoints or undocumented API behavior.",
|
|
129050
|
+
"",
|
|
129051
|
+
"## Active Environment",
|
|
129052
|
+
"",
|
|
129053
|
+
`- id: \`${params.activeEnvironment.id}\``,
|
|
129054
|
+
`- name: \`${params.activeEnvironment.name}\``,
|
|
129055
|
+
`- apiBaseUrl: \`${params.activeEnvironment.apiBaseUrl}\``,
|
|
129056
|
+
"",
|
|
129057
|
+
"## Active Auth Context",
|
|
129058
|
+
"",
|
|
129059
|
+
...authLines,
|
|
129060
|
+
"",
|
|
129061
|
+
"## Preferred Workflow",
|
|
129062
|
+
"",
|
|
129063
|
+
`- For Docyrus platform questions or mutations, start with \`${commandPrefix} --json\` commands or add \`--json\` to specific subcommands such as \`${commandPrefix} apps list --json\`.`,
|
|
129064
|
+
`- 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.`
|
|
129065
|
+
].join("\n");
|
|
129066
|
+
}
|
|
129067
|
+
async function syncPackagedSkills(params) {
|
|
129068
|
+
const sourceSkillsRoot = (0, import_node_path9.join)(params.resourceRoot, "skills");
|
|
129069
|
+
const targetSkillsRoot = (0, import_node_path9.join)(params.agentRootPath, "skills");
|
|
129070
|
+
await (0, import_promises7.mkdir)(targetSkillsRoot, {
|
|
129071
|
+
recursive: true,
|
|
129072
|
+
mode: 448
|
|
129073
|
+
});
|
|
129074
|
+
const entries = await (0, import_promises7.readdir)(sourceSkillsRoot, {
|
|
129075
|
+
withFileTypes: true
|
|
129076
|
+
});
|
|
129077
|
+
await Promise.all(entries.map(async (entry) => {
|
|
129078
|
+
await (0, import_promises7.cp)((0, import_node_path9.join)(sourceSkillsRoot, entry.name), (0, import_node_path9.join)(targetSkillsRoot, entry.name), {
|
|
129079
|
+
recursive: true,
|
|
129080
|
+
force: true
|
|
129081
|
+
});
|
|
129082
|
+
}));
|
|
129083
|
+
}
|
|
129084
|
+
async function writeRuntimeSkill(params) {
|
|
129085
|
+
const runtimeSkillDir = (0, import_node_path9.join)(params.agentRootPath, "skills", "docyrus-runtime-context");
|
|
129086
|
+
await (0, import_promises7.mkdir)(runtimeSkillDir, {
|
|
129087
|
+
recursive: true,
|
|
129088
|
+
mode: 448
|
|
129089
|
+
});
|
|
129090
|
+
await (0, import_promises7.writeFile)((0, import_node_path9.join)(runtimeSkillDir, "SKILL.md"), `${params.content}
|
|
129091
|
+
`, {
|
|
129092
|
+
encoding: "utf8",
|
|
129093
|
+
mode: 384
|
|
129094
|
+
});
|
|
129095
|
+
}
|
|
129096
|
+
function validatePiAgentLaunchRequest(params) {
|
|
129097
|
+
if (params.request.mode && !params.request.print && params.stdinIsTTY) {
|
|
129098
|
+
throw new UserInputError("`--mode` requires `--print` when stdin is interactive.");
|
|
129099
|
+
}
|
|
129100
|
+
if (params.request.print && !params.request.prompt && params.stdinIsTTY) {
|
|
129101
|
+
throw new UserInputError("`--print` requires a prompt or piped stdin.");
|
|
129102
|
+
}
|
|
129103
|
+
}
|
|
129104
|
+
function createPiAgentLauncher(options2) {
|
|
129105
|
+
const cwd = options2.cwd ?? process.cwd();
|
|
129106
|
+
const stdinIsTTY = options2.stdinIsTTY ?? process.stdin.isTTY ?? false;
|
|
129107
|
+
const spawnCommand = options2.spawnSyncFn ?? import_node_child_process3.spawnSync;
|
|
129108
|
+
const processExecPath = options2.processExecPath ?? process.execPath;
|
|
129109
|
+
const resolveResourceRoot = options2.resolvePackagedPiResourceRootFn ?? resolvePackagedPiResourceRoot;
|
|
129110
|
+
const resolveLoaderPath = options2.resolveDocyrusPiLoaderEntryPathFn ?? resolveDocyrusPiLoaderEntryPath;
|
|
129111
|
+
const resolvePiPackageRoot = options2.resolveInstalledPiPackageRootPathFn ?? resolveInstalledPiPackageRootPath;
|
|
129112
|
+
return async (request) => {
|
|
129113
|
+
validatePiAgentLaunchRequest({
|
|
129114
|
+
request,
|
|
129115
|
+
stdinIsTTY
|
|
129116
|
+
});
|
|
129117
|
+
const activeEnvironment = await options2.environmentConfigService.getActiveEnvironment();
|
|
129118
|
+
const activeProfile = await options2.authStore.getActiveProfile(activeEnvironment.apiBaseUrl);
|
|
129119
|
+
const settingsRootPath = options2.settingsPaths.rootPath;
|
|
129120
|
+
const agentRootPath = resolveDocyrusPiAgentRootPath(settingsRootPath);
|
|
129121
|
+
const resourceRoot = resolveResourceRoot({ cwd });
|
|
129122
|
+
await syncPackagedSkills({
|
|
129123
|
+
resourceRoot,
|
|
129124
|
+
agentRootPath
|
|
129125
|
+
});
|
|
129126
|
+
await writeRuntimeSkill({
|
|
129127
|
+
agentRootPath,
|
|
129128
|
+
content: createPiAgentRuntimeSkill({
|
|
129129
|
+
scope: options2.settingsPaths.scope,
|
|
129130
|
+
cwd,
|
|
129131
|
+
activeEnvironment,
|
|
129132
|
+
activeProfile,
|
|
129133
|
+
settingsRootPath
|
|
129134
|
+
})
|
|
129135
|
+
});
|
|
129136
|
+
const loaderEntryPath = resolveLoaderPath({ cwd });
|
|
129137
|
+
const piPackageRoot = resolvePiPackageRoot({ cwd });
|
|
129138
|
+
const result = spawnCommand(processExecPath, [loaderEntryPath], {
|
|
129139
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
129140
|
+
encoding: "utf8",
|
|
129141
|
+
cwd,
|
|
129142
|
+
env: {
|
|
129143
|
+
...process.env,
|
|
129144
|
+
PI_CODING_AGENT_DIR: agentRootPath,
|
|
129145
|
+
PI_PACKAGE_DIR: piPackageRoot,
|
|
129146
|
+
DOCYRUS_PI_REQUEST: JSON.stringify(request),
|
|
129147
|
+
DOCYRUS_PI_VERSION: options2.version || "dev"
|
|
129148
|
+
}
|
|
129149
|
+
});
|
|
129150
|
+
if (result.error) {
|
|
129151
|
+
throw new UserInputError(`Unable to start Docyrus pi loader: ${result.error.message}`, {
|
|
129152
|
+
cause: result.error
|
|
129153
|
+
});
|
|
129154
|
+
}
|
|
129155
|
+
if (result.status !== 0) {
|
|
129156
|
+
throw new UserInputError(`Docyrus pi loader failed: ${summarizeFailure2(result)}`);
|
|
129157
|
+
}
|
|
129158
|
+
};
|
|
129159
|
+
}
|
|
129160
|
+
|
|
129161
|
+
// src/services/tenantOpenApi.ts
|
|
129162
|
+
var import_promises8 = require("node:fs/promises");
|
|
129163
|
+
var import_node_path10 = require("node:path");
|
|
128851
129164
|
function resolveSourceUrl(tenantId, template) {
|
|
128852
129165
|
return template.replace("{tenantId}", encodeURIComponent(tenantId));
|
|
128853
129166
|
}
|
|
@@ -128871,16 +129184,16 @@ var TenantOpenApiService = class {
|
|
|
128871
129184
|
}
|
|
128872
129185
|
async #writeOpenApiFile(tenantId, parsedContent) {
|
|
128873
129186
|
const filePath = this.getTenantOpenApiFilePath(tenantId);
|
|
128874
|
-
await (0,
|
|
129187
|
+
await (0, import_promises8.mkdir)((0, import_node_path10.dirname)(filePath), {
|
|
128875
129188
|
recursive: true,
|
|
128876
129189
|
mode: 448
|
|
128877
129190
|
});
|
|
128878
|
-
await (0,
|
|
129191
|
+
await (0, import_promises8.writeFile)(filePath, `${JSON.stringify(parsedContent, null, 2)}
|
|
128879
129192
|
`, {
|
|
128880
129193
|
encoding: "utf8",
|
|
128881
129194
|
mode: 384
|
|
128882
129195
|
});
|
|
128883
|
-
await (0,
|
|
129196
|
+
await (0, import_promises8.chmod)(filePath, 384);
|
|
128884
129197
|
return filePath;
|
|
128885
129198
|
}
|
|
128886
129199
|
async #generateTenantOpenApiViaAuthenticatedEndpoint(tenantId, options2) {
|
|
@@ -128917,7 +129230,7 @@ var TenantOpenApiService = class {
|
|
|
128917
129230
|
throw new AuthSessionError("Tenant ID is required to resolve OpenAPI spec path.");
|
|
128918
129231
|
}
|
|
128919
129232
|
const rootPath = this.params?.rootPath || TENANT_OPENAPI_ROOT_PATH;
|
|
128920
|
-
return (0,
|
|
129233
|
+
return (0, import_node_path10.join)(rootPath, normalizedTenantId, "openapi.json");
|
|
128921
129234
|
}
|
|
128922
129235
|
async downloadTenantOpenApi(tenantId, options2 = {}) {
|
|
128923
129236
|
const normalizedTenantId = tenantId.trim();
|
|
@@ -128978,6 +129291,8 @@ var ROOT_HELP_COMMANDS = [
|
|
|
128978
129291
|
{ command: "auth accounts list", description: "List saved user accounts" },
|
|
128979
129292
|
{ command: "auth tenants use <uuid|tenantNo>", description: "Switch active tenant for selected user" },
|
|
128980
129293
|
{ command: 'ai "<prompt>"', description: "Send a prompt to the default Docyrus CLI agent" },
|
|
129294
|
+
{ command: "agent [prompt]", description: "Launch the scoped Docyrus pi assistant" },
|
|
129295
|
+
{ command: "coder [prompt]", description: "Launch the scoped Docyrus pi coding agent" },
|
|
128981
129296
|
{ command: "discover api", description: "Download active tenant OpenAPI spec" },
|
|
128982
129297
|
{ command: "discover namespaces", description: "List namespaces from tenant OpenAPI spec" },
|
|
128983
129298
|
{ command: "discover path <prefix>", description: "List endpoint paths by prefix" },
|
|
@@ -129004,6 +129319,13 @@ function createDocyrusCli(params) {
|
|
|
129004
129319
|
fetchFn: params?.fetchFn,
|
|
129005
129320
|
rootPath: settingsPaths.tenantOpenApiRootPath
|
|
129006
129321
|
});
|
|
129322
|
+
const piAgentLauncher = createPiAgentLauncher({
|
|
129323
|
+
settingsPaths,
|
|
129324
|
+
environmentConfigService,
|
|
129325
|
+
authStore,
|
|
129326
|
+
cwd: params?.cwd,
|
|
129327
|
+
version: package_default.version
|
|
129328
|
+
});
|
|
129007
129329
|
const createAuthSessionService = (apiBaseUrl) => {
|
|
129008
129330
|
return new AuthSessionService({
|
|
129009
129331
|
apiBaseUrl: normalizeApiBaseUrl(apiBaseUrl),
|
|
@@ -129055,6 +129377,12 @@ function createDocyrusCli(params) {
|
|
|
129055
129377
|
environmentConfigService,
|
|
129056
129378
|
authStore
|
|
129057
129379
|
}));
|
|
129380
|
+
cli2.command(createAgentCli({
|
|
129381
|
+
launchPiAgent: piAgentLauncher
|
|
129382
|
+
}));
|
|
129383
|
+
cli2.command(createCoderCli({
|
|
129384
|
+
launchPiAgent: piAgentLauncher
|
|
129385
|
+
}));
|
|
129058
129386
|
cli2.command(createDsCli({
|
|
129059
129387
|
createApiClient,
|
|
129060
129388
|
environmentConfigService,
|