@metaphi-ai/hum 0.1.44 → 0.1.46
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/dist/cli.mjs +1093 -1077
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -25285,16 +25285,16 @@ var require_extension = __commonJS({
|
|
|
25285
25285
|
throw new SyntaxError("Unexpected end of input");
|
|
25286
25286
|
}
|
|
25287
25287
|
if (end === -1) end = i;
|
|
25288
|
-
const
|
|
25288
|
+
const token2 = header.slice(start, end);
|
|
25289
25289
|
if (extensionName === void 0) {
|
|
25290
|
-
push(offers,
|
|
25290
|
+
push(offers, token2, params);
|
|
25291
25291
|
} else {
|
|
25292
25292
|
if (paramName === void 0) {
|
|
25293
|
-
push(params,
|
|
25293
|
+
push(params, token2, true);
|
|
25294
25294
|
} else if (mustUnescape) {
|
|
25295
|
-
push(params, paramName,
|
|
25295
|
+
push(params, paramName, token2.replace(/\\/g, ""));
|
|
25296
25296
|
} else {
|
|
25297
|
-
push(params, paramName,
|
|
25297
|
+
push(params, paramName, token2);
|
|
25298
25298
|
}
|
|
25299
25299
|
push(offers, extensionName, params);
|
|
25300
25300
|
}
|
|
@@ -67804,10 +67804,10 @@ var require_tokenizer = __commonJS({
|
|
|
67804
67804
|
SCRIPT_DATA: SCRIPT_DATA_STATE,
|
|
67805
67805
|
PLAINTEXT: PLAINTEXT_STATE
|
|
67806
67806
|
};
|
|
67807
|
-
Tokenizer.getTokenAttr = function(
|
|
67808
|
-
for (let i =
|
|
67809
|
-
if (
|
|
67810
|
-
return
|
|
67807
|
+
Tokenizer.getTokenAttr = function(token2, attrName) {
|
|
67808
|
+
for (let i = token2.attrs.length - 1; i >= 0; i--) {
|
|
67809
|
+
if (token2.attrs[i].name === attrName) {
|
|
67810
|
+
return token2.attrs[i].value;
|
|
67811
67811
|
}
|
|
67812
67812
|
}
|
|
67813
67813
|
return null;
|
|
@@ -68481,16 +68481,16 @@ var require_formatting_element_list = __commonJS({
|
|
|
68481
68481
|
this.entries.push({ type: _FormattingElementList.MARKER_ENTRY });
|
|
68482
68482
|
this.length++;
|
|
68483
68483
|
}
|
|
68484
|
-
pushElement(element,
|
|
68484
|
+
pushElement(element, token2) {
|
|
68485
68485
|
this._ensureNoahArkCondition(element);
|
|
68486
68486
|
this.entries.push({
|
|
68487
68487
|
type: _FormattingElementList.ELEMENT_ENTRY,
|
|
68488
68488
|
element,
|
|
68489
|
-
token
|
|
68489
|
+
token: token2
|
|
68490
68490
|
});
|
|
68491
68491
|
this.length++;
|
|
68492
68492
|
}
|
|
68493
|
-
insertElementAfterBookmark(element,
|
|
68493
|
+
insertElementAfterBookmark(element, token2) {
|
|
68494
68494
|
let bookmarkIdx = this.length - 1;
|
|
68495
68495
|
for (; bookmarkIdx >= 0; bookmarkIdx--) {
|
|
68496
68496
|
if (this.entries[bookmarkIdx] === this.bookmark) {
|
|
@@ -68500,7 +68500,7 @@ var require_formatting_element_list = __commonJS({
|
|
|
68500
68500
|
this.entries.splice(bookmarkIdx + 1, 0, {
|
|
68501
68501
|
type: _FormattingElementList.ELEMENT_ENTRY,
|
|
68502
68502
|
element,
|
|
68503
|
-
token
|
|
68503
|
+
token: token2
|
|
68504
68504
|
});
|
|
68505
68505
|
this.length++;
|
|
68506
68506
|
}
|
|
@@ -68859,33 +68859,33 @@ var require_parser_mixin = __commonJS({
|
|
|
68859
68859
|
}
|
|
68860
68860
|
},
|
|
68861
68861
|
//Token processing
|
|
68862
|
-
_processTokenInForeignContent(
|
|
68863
|
-
mxn.currentToken =
|
|
68864
|
-
orig._processTokenInForeignContent.call(this,
|
|
68865
|
-
},
|
|
68866
|
-
_processToken(
|
|
68867
|
-
mxn.currentToken =
|
|
68868
|
-
orig._processToken.call(this,
|
|
68869
|
-
const requireExplicitUpdate =
|
|
68862
|
+
_processTokenInForeignContent(token2) {
|
|
68863
|
+
mxn.currentToken = token2;
|
|
68864
|
+
orig._processTokenInForeignContent.call(this, token2);
|
|
68865
|
+
},
|
|
68866
|
+
_processToken(token2) {
|
|
68867
|
+
mxn.currentToken = token2;
|
|
68868
|
+
orig._processToken.call(this, token2);
|
|
68869
|
+
const requireExplicitUpdate = token2.type === Tokenizer.END_TAG_TOKEN && (token2.tagName === $.HTML || token2.tagName === $.BODY && this.openElements.hasInScope($.BODY));
|
|
68870
68870
|
if (requireExplicitUpdate) {
|
|
68871
68871
|
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
|
68872
68872
|
const element = this.openElements.items[i];
|
|
68873
|
-
if (this.treeAdapter.getTagName(element) ===
|
|
68874
|
-
mxn._setEndLocation(element,
|
|
68873
|
+
if (this.treeAdapter.getTagName(element) === token2.tagName) {
|
|
68874
|
+
mxn._setEndLocation(element, token2);
|
|
68875
68875
|
break;
|
|
68876
68876
|
}
|
|
68877
68877
|
}
|
|
68878
68878
|
}
|
|
68879
68879
|
},
|
|
68880
68880
|
//Doctype
|
|
68881
|
-
_setDocumentType(
|
|
68882
|
-
orig._setDocumentType.call(this,
|
|
68881
|
+
_setDocumentType(token2) {
|
|
68882
|
+
orig._setDocumentType.call(this, token2);
|
|
68883
68883
|
const documentChildren = this.treeAdapter.getChildNodes(this.document);
|
|
68884
68884
|
const cnLength = documentChildren.length;
|
|
68885
68885
|
for (let i = 0; i < cnLength; i++) {
|
|
68886
68886
|
const node = documentChildren[i];
|
|
68887
68887
|
if (this.treeAdapter.isDocumentTypeNode(node)) {
|
|
68888
|
-
this.treeAdapter.setNodeSourceCodeLocation(node,
|
|
68888
|
+
this.treeAdapter.setNodeSourceCodeLocation(node, token2.location);
|
|
68889
68889
|
break;
|
|
68890
68890
|
}
|
|
68891
68891
|
}
|
|
@@ -68896,17 +68896,17 @@ var require_parser_mixin = __commonJS({
|
|
|
68896
68896
|
mxn.lastStartTagToken = null;
|
|
68897
68897
|
orig._attachElementToTree.call(this, element);
|
|
68898
68898
|
},
|
|
68899
|
-
_appendElement(
|
|
68900
|
-
mxn.lastStartTagToken =
|
|
68901
|
-
orig._appendElement.call(this,
|
|
68899
|
+
_appendElement(token2, namespaceURI) {
|
|
68900
|
+
mxn.lastStartTagToken = token2;
|
|
68901
|
+
orig._appendElement.call(this, token2, namespaceURI);
|
|
68902
68902
|
},
|
|
68903
|
-
_insertElement(
|
|
68904
|
-
mxn.lastStartTagToken =
|
|
68905
|
-
orig._insertElement.call(this,
|
|
68903
|
+
_insertElement(token2, namespaceURI) {
|
|
68904
|
+
mxn.lastStartTagToken = token2;
|
|
68905
|
+
orig._insertElement.call(this, token2, namespaceURI);
|
|
68906
68906
|
},
|
|
68907
|
-
_insertTemplate(
|
|
68908
|
-
mxn.lastStartTagToken =
|
|
68909
|
-
orig._insertTemplate.call(this,
|
|
68907
|
+
_insertTemplate(token2) {
|
|
68908
|
+
mxn.lastStartTagToken = token2;
|
|
68909
|
+
orig._insertTemplate.call(this, token2);
|
|
68910
68910
|
const tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current);
|
|
68911
68911
|
this.treeAdapter.setNodeSourceCodeLocation(tmplContent, null);
|
|
68912
68912
|
},
|
|
@@ -68915,19 +68915,19 @@ var require_parser_mixin = __commonJS({
|
|
|
68915
68915
|
this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current, null);
|
|
68916
68916
|
},
|
|
68917
68917
|
//Comments
|
|
68918
|
-
_appendCommentNode(
|
|
68919
|
-
orig._appendCommentNode.call(this,
|
|
68918
|
+
_appendCommentNode(token2, parent) {
|
|
68919
|
+
orig._appendCommentNode.call(this, token2, parent);
|
|
68920
68920
|
const children = this.treeAdapter.getChildNodes(parent);
|
|
68921
68921
|
const commentNode = children[children.length - 1];
|
|
68922
|
-
this.treeAdapter.setNodeSourceCodeLocation(commentNode,
|
|
68922
|
+
this.treeAdapter.setNodeSourceCodeLocation(commentNode, token2.location);
|
|
68923
68923
|
},
|
|
68924
68924
|
//Text
|
|
68925
68925
|
_findFosterParentingLocation() {
|
|
68926
68926
|
mxn.lastFosterParentingLocation = orig._findFosterParentingLocation.call(this);
|
|
68927
68927
|
return mxn.lastFosterParentingLocation;
|
|
68928
68928
|
},
|
|
68929
|
-
_insertCharacters(
|
|
68930
|
-
orig._insertCharacters.call(this,
|
|
68929
|
+
_insertCharacters(token2) {
|
|
68930
|
+
orig._insertCharacters.call(this, token2);
|
|
68931
68931
|
const hasFosterParent = this._shouldFosterParentOnInsertion();
|
|
68932
68932
|
const parent = hasFosterParent && mxn.lastFosterParentingLocation.parent || this.openElements.currentTmplContent || this.openElements.current;
|
|
68933
68933
|
const siblings = this.treeAdapter.getChildNodes(parent);
|
|
@@ -68935,11 +68935,11 @@ var require_parser_mixin = __commonJS({
|
|
|
68935
68935
|
const textNode = siblings[textNodeIdx];
|
|
68936
68936
|
const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
|
|
68937
68937
|
if (tnLoc) {
|
|
68938
|
-
tnLoc.endLine =
|
|
68939
|
-
tnLoc.endCol =
|
|
68940
|
-
tnLoc.endOffset =
|
|
68938
|
+
tnLoc.endLine = token2.location.endLine;
|
|
68939
|
+
tnLoc.endCol = token2.location.endCol;
|
|
68940
|
+
tnLoc.endOffset = token2.location.endOffset;
|
|
68941
68941
|
} else {
|
|
68942
|
-
this.treeAdapter.setNodeSourceCodeLocation(textNode,
|
|
68942
|
+
this.treeAdapter.setNodeSourceCodeLocation(textNode, token2.location);
|
|
68943
68943
|
}
|
|
68944
68944
|
}
|
|
68945
68945
|
};
|
|
@@ -69064,9 +69064,9 @@ var require_parser_mixin2 = __commonJS({
|
|
|
69064
69064
|
Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts);
|
|
69065
69065
|
Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
|
69066
69066
|
},
|
|
69067
|
-
_processInputToken(
|
|
69068
|
-
mxn.ctLoc =
|
|
69069
|
-
orig._processInputToken.call(this,
|
|
69067
|
+
_processInputToken(token2) {
|
|
69068
|
+
mxn.ctLoc = token2.location;
|
|
69069
|
+
orig._processInputToken.call(this, token2);
|
|
69070
69070
|
},
|
|
69071
69071
|
_err(code, options2) {
|
|
69072
69072
|
mxn.locBeforeToken = options2 && options2.beforeToken;
|
|
@@ -69356,18 +69356,18 @@ var require_doctype = __commonJS({
|
|
|
69356
69356
|
}
|
|
69357
69357
|
return false;
|
|
69358
69358
|
}
|
|
69359
|
-
exports.isConforming = function(
|
|
69360
|
-
return
|
|
69359
|
+
exports.isConforming = function(token2) {
|
|
69360
|
+
return token2.name === VALID_DOCTYPE_NAME && token2.publicId === null && (token2.systemId === null || token2.systemId === VALID_SYSTEM_ID);
|
|
69361
69361
|
};
|
|
69362
|
-
exports.getDocumentMode = function(
|
|
69363
|
-
if (
|
|
69362
|
+
exports.getDocumentMode = function(token2) {
|
|
69363
|
+
if (token2.name !== VALID_DOCTYPE_NAME) {
|
|
69364
69364
|
return DOCUMENT_MODE.QUIRKS;
|
|
69365
69365
|
}
|
|
69366
|
-
const systemId =
|
|
69366
|
+
const systemId = token2.systemId;
|
|
69367
69367
|
if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
|
|
69368
69368
|
return DOCUMENT_MODE.QUIRKS;
|
|
69369
69369
|
}
|
|
69370
|
-
let publicId =
|
|
69370
|
+
let publicId = token2.publicId;
|
|
69371
69371
|
if (publicId !== null) {
|
|
69372
69372
|
publicId = publicId.toLowerCase();
|
|
69373
69373
|
if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) {
|
|
@@ -69580,36 +69580,36 @@ var require_foreign_content = __commonJS({
|
|
|
69580
69580
|
const isFontWithAttrs = tn === $.FONT && (Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null || Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null || Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null);
|
|
69581
69581
|
return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn];
|
|
69582
69582
|
};
|
|
69583
|
-
exports.adjustTokenMathMLAttrs = function(
|
|
69584
|
-
for (let i = 0; i <
|
|
69585
|
-
if (
|
|
69586
|
-
|
|
69583
|
+
exports.adjustTokenMathMLAttrs = function(token2) {
|
|
69584
|
+
for (let i = 0; i < token2.attrs.length; i++) {
|
|
69585
|
+
if (token2.attrs[i].name === DEFINITION_URL_ATTR) {
|
|
69586
|
+
token2.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
|
|
69587
69587
|
break;
|
|
69588
69588
|
}
|
|
69589
69589
|
}
|
|
69590
69590
|
};
|
|
69591
|
-
exports.adjustTokenSVGAttrs = function(
|
|
69592
|
-
for (let i = 0; i <
|
|
69593
|
-
const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[
|
|
69591
|
+
exports.adjustTokenSVGAttrs = function(token2) {
|
|
69592
|
+
for (let i = 0; i < token2.attrs.length; i++) {
|
|
69593
|
+
const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token2.attrs[i].name];
|
|
69594
69594
|
if (adjustedAttrName) {
|
|
69595
|
-
|
|
69595
|
+
token2.attrs[i].name = adjustedAttrName;
|
|
69596
69596
|
}
|
|
69597
69597
|
}
|
|
69598
69598
|
};
|
|
69599
|
-
exports.adjustTokenXMLAttrs = function(
|
|
69600
|
-
for (let i = 0; i <
|
|
69601
|
-
const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[
|
|
69599
|
+
exports.adjustTokenXMLAttrs = function(token2) {
|
|
69600
|
+
for (let i = 0; i < token2.attrs.length; i++) {
|
|
69601
|
+
const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token2.attrs[i].name];
|
|
69602
69602
|
if (adjustedAttrEntry) {
|
|
69603
|
-
|
|
69604
|
-
|
|
69605
|
-
|
|
69603
|
+
token2.attrs[i].prefix = adjustedAttrEntry.prefix;
|
|
69604
|
+
token2.attrs[i].name = adjustedAttrEntry.name;
|
|
69605
|
+
token2.attrs[i].namespace = adjustedAttrEntry.namespace;
|
|
69606
69606
|
}
|
|
69607
69607
|
}
|
|
69608
69608
|
};
|
|
69609
|
-
exports.adjustTokenSVGTagName = function(
|
|
69610
|
-
const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[
|
|
69609
|
+
exports.adjustTokenSVGTagName = function(token2) {
|
|
69610
|
+
const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token2.tagName];
|
|
69611
69611
|
if (adjustedTagName) {
|
|
69612
|
-
|
|
69612
|
+
token2.tagName = adjustedTagName;
|
|
69613
69613
|
}
|
|
69614
69614
|
};
|
|
69615
69615
|
function isMathMLTextIntegrationPoint(tn, ns) {
|
|
@@ -70012,20 +70012,20 @@ var require_parser = __commonJS({
|
|
|
70012
70012
|
_runParsingLoop(scriptHandler) {
|
|
70013
70013
|
while (!this.stopped) {
|
|
70014
70014
|
this._setupTokenizerCDATAMode();
|
|
70015
|
-
const
|
|
70016
|
-
if (
|
|
70015
|
+
const token2 = this.tokenizer.getNextToken();
|
|
70016
|
+
if (token2.type === Tokenizer.HIBERNATION_TOKEN) {
|
|
70017
70017
|
break;
|
|
70018
70018
|
}
|
|
70019
70019
|
if (this.skipNextNewLine) {
|
|
70020
70020
|
this.skipNextNewLine = false;
|
|
70021
|
-
if (
|
|
70022
|
-
if (
|
|
70021
|
+
if (token2.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token2.chars[0] === "\n") {
|
|
70022
|
+
if (token2.chars.length === 1) {
|
|
70023
70023
|
continue;
|
|
70024
70024
|
}
|
|
70025
|
-
|
|
70025
|
+
token2.chars = token2.chars.substr(1);
|
|
70026
70026
|
}
|
|
70027
70027
|
}
|
|
70028
|
-
this._processInputToken(
|
|
70028
|
+
this._processInputToken(token2);
|
|
70029
70029
|
if (scriptHandler && this.pendingScript) {
|
|
70030
70030
|
break;
|
|
70031
70031
|
}
|
|
@@ -70088,10 +70088,10 @@ var require_parser = __commonJS({
|
|
|
70088
70088
|
}
|
|
70089
70089
|
}
|
|
70090
70090
|
//Tree mutation
|
|
70091
|
-
_setDocumentType(
|
|
70092
|
-
const name =
|
|
70093
|
-
const publicId =
|
|
70094
|
-
const systemId =
|
|
70091
|
+
_setDocumentType(token2) {
|
|
70092
|
+
const name = token2.name || "";
|
|
70093
|
+
const publicId = token2.publicId || "";
|
|
70094
|
+
const systemId = token2.systemId || "";
|
|
70095
70095
|
this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
|
|
70096
70096
|
}
|
|
70097
70097
|
_attachElementToTree(element) {
|
|
@@ -70102,12 +70102,12 @@ var require_parser = __commonJS({
|
|
|
70102
70102
|
this.treeAdapter.appendChild(parent, element);
|
|
70103
70103
|
}
|
|
70104
70104
|
}
|
|
70105
|
-
_appendElement(
|
|
70106
|
-
const element = this.treeAdapter.createElement(
|
|
70105
|
+
_appendElement(token2, namespaceURI) {
|
|
70106
|
+
const element = this.treeAdapter.createElement(token2.tagName, namespaceURI, token2.attrs);
|
|
70107
70107
|
this._attachElementToTree(element);
|
|
70108
70108
|
}
|
|
70109
|
-
_insertElement(
|
|
70110
|
-
const element = this.treeAdapter.createElement(
|
|
70109
|
+
_insertElement(token2, namespaceURI) {
|
|
70110
|
+
const element = this.treeAdapter.createElement(token2.tagName, namespaceURI, token2.attrs);
|
|
70111
70111
|
this._attachElementToTree(element);
|
|
70112
70112
|
this.openElements.push(element);
|
|
70113
70113
|
}
|
|
@@ -70116,8 +70116,8 @@ var require_parser = __commonJS({
|
|
|
70116
70116
|
this._attachElementToTree(element);
|
|
70117
70117
|
this.openElements.push(element);
|
|
70118
70118
|
}
|
|
70119
|
-
_insertTemplate(
|
|
70120
|
-
const tmpl = this.treeAdapter.createElement(
|
|
70119
|
+
_insertTemplate(token2) {
|
|
70120
|
+
const tmpl = this.treeAdapter.createElement(token2.tagName, NS.HTML, token2.attrs);
|
|
70121
70121
|
const content = this.treeAdapter.createDocumentFragment();
|
|
70122
70122
|
this.treeAdapter.setTemplateContent(tmpl, content);
|
|
70123
70123
|
this._attachElementToTree(tmpl);
|
|
@@ -70128,16 +70128,16 @@ var require_parser = __commonJS({
|
|
|
70128
70128
|
this.treeAdapter.appendChild(this.openElements.current, element);
|
|
70129
70129
|
this.openElements.push(element);
|
|
70130
70130
|
}
|
|
70131
|
-
_appendCommentNode(
|
|
70132
|
-
const commentNode = this.treeAdapter.createCommentNode(
|
|
70131
|
+
_appendCommentNode(token2, parent) {
|
|
70132
|
+
const commentNode = this.treeAdapter.createCommentNode(token2.data);
|
|
70133
70133
|
this.treeAdapter.appendChild(parent, commentNode);
|
|
70134
70134
|
}
|
|
70135
|
-
_insertCharacters(
|
|
70135
|
+
_insertCharacters(token2) {
|
|
70136
70136
|
if (this._shouldFosterParentOnInsertion()) {
|
|
70137
|
-
this._fosterParentText(
|
|
70137
|
+
this._fosterParentText(token2.chars);
|
|
70138
70138
|
} else {
|
|
70139
70139
|
const parent = this.openElements.currentTmplContent || this.openElements.current;
|
|
70140
|
-
this.treeAdapter.insertText(parent,
|
|
70140
|
+
this.treeAdapter.insertText(parent, token2.chars);
|
|
70141
70141
|
}
|
|
70142
70142
|
}
|
|
70143
70143
|
_adoptNodes(donor, recipient) {
|
|
@@ -70147,7 +70147,7 @@ var require_parser = __commonJS({
|
|
|
70147
70147
|
}
|
|
70148
70148
|
}
|
|
70149
70149
|
//Token processing
|
|
70150
|
-
_shouldProcessTokenInForeignContent(
|
|
70150
|
+
_shouldProcessTokenInForeignContent(token2) {
|
|
70151
70151
|
const current = this._getAdjustedCurrentElement();
|
|
70152
70152
|
if (!current || current === this.document) {
|
|
70153
70153
|
return false;
|
|
@@ -70156,47 +70156,47 @@ var require_parser = __commonJS({
|
|
|
70156
70156
|
if (ns === NS.HTML) {
|
|
70157
70157
|
return false;
|
|
70158
70158
|
}
|
|
70159
|
-
if (this.treeAdapter.getTagName(current) === $.ANNOTATION_XML && ns === NS.MATHML &&
|
|
70159
|
+
if (this.treeAdapter.getTagName(current) === $.ANNOTATION_XML && ns === NS.MATHML && token2.type === Tokenizer.START_TAG_TOKEN && token2.tagName === $.SVG) {
|
|
70160
70160
|
return false;
|
|
70161
70161
|
}
|
|
70162
|
-
const isCharacterToken =
|
|
70163
|
-
const isMathMLTextStartTag =
|
|
70162
|
+
const isCharacterToken = token2.type === Tokenizer.CHARACTER_TOKEN || token2.type === Tokenizer.NULL_CHARACTER_TOKEN || token2.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN;
|
|
70163
|
+
const isMathMLTextStartTag = token2.type === Tokenizer.START_TAG_TOKEN && token2.tagName !== $.MGLYPH && token2.tagName !== $.MALIGNMARK;
|
|
70164
70164
|
if ((isMathMLTextStartTag || isCharacterToken) && this._isIntegrationPoint(current, NS.MATHML)) {
|
|
70165
70165
|
return false;
|
|
70166
70166
|
}
|
|
70167
|
-
if ((
|
|
70167
|
+
if ((token2.type === Tokenizer.START_TAG_TOKEN || isCharacterToken) && this._isIntegrationPoint(current, NS.HTML)) {
|
|
70168
70168
|
return false;
|
|
70169
70169
|
}
|
|
70170
|
-
return
|
|
70170
|
+
return token2.type !== Tokenizer.EOF_TOKEN;
|
|
70171
70171
|
}
|
|
70172
|
-
_processToken(
|
|
70173
|
-
TOKEN_HANDLERS[this.insertionMode][
|
|
70172
|
+
_processToken(token2) {
|
|
70173
|
+
TOKEN_HANDLERS[this.insertionMode][token2.type](this, token2);
|
|
70174
70174
|
}
|
|
70175
|
-
_processTokenInBodyMode(
|
|
70176
|
-
TOKEN_HANDLERS[IN_BODY_MODE][
|
|
70175
|
+
_processTokenInBodyMode(token2) {
|
|
70176
|
+
TOKEN_HANDLERS[IN_BODY_MODE][token2.type](this, token2);
|
|
70177
70177
|
}
|
|
70178
|
-
_processTokenInForeignContent(
|
|
70179
|
-
if (
|
|
70180
|
-
characterInForeignContent(this,
|
|
70181
|
-
} else if (
|
|
70182
|
-
nullCharacterInForeignContent(this,
|
|
70183
|
-
} else if (
|
|
70184
|
-
insertCharacters(this,
|
|
70185
|
-
} else if (
|
|
70186
|
-
appendComment(this,
|
|
70187
|
-
} else if (
|
|
70188
|
-
startTagInForeignContent(this,
|
|
70189
|
-
} else if (
|
|
70190
|
-
endTagInForeignContent(this,
|
|
70178
|
+
_processTokenInForeignContent(token2) {
|
|
70179
|
+
if (token2.type === Tokenizer.CHARACTER_TOKEN) {
|
|
70180
|
+
characterInForeignContent(this, token2);
|
|
70181
|
+
} else if (token2.type === Tokenizer.NULL_CHARACTER_TOKEN) {
|
|
70182
|
+
nullCharacterInForeignContent(this, token2);
|
|
70183
|
+
} else if (token2.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN) {
|
|
70184
|
+
insertCharacters(this, token2);
|
|
70185
|
+
} else if (token2.type === Tokenizer.COMMENT_TOKEN) {
|
|
70186
|
+
appendComment(this, token2);
|
|
70187
|
+
} else if (token2.type === Tokenizer.START_TAG_TOKEN) {
|
|
70188
|
+
startTagInForeignContent(this, token2);
|
|
70189
|
+
} else if (token2.type === Tokenizer.END_TAG_TOKEN) {
|
|
70190
|
+
endTagInForeignContent(this, token2);
|
|
70191
70191
|
}
|
|
70192
70192
|
}
|
|
70193
|
-
_processInputToken(
|
|
70194
|
-
if (this._shouldProcessTokenInForeignContent(
|
|
70195
|
-
this._processTokenInForeignContent(
|
|
70193
|
+
_processInputToken(token2) {
|
|
70194
|
+
if (this._shouldProcessTokenInForeignContent(token2)) {
|
|
70195
|
+
this._processTokenInForeignContent(token2);
|
|
70196
70196
|
} else {
|
|
70197
|
-
this._processToken(
|
|
70197
|
+
this._processToken(token2);
|
|
70198
70198
|
}
|
|
70199
|
-
if (
|
|
70199
|
+
if (token2.type === Tokenizer.START_TAG_TOKEN && token2.selfClosing && !token2.ackSelfClosing) {
|
|
70200
70200
|
this._err(ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
|
|
70201
70201
|
}
|
|
70202
70202
|
}
|
|
@@ -70359,17 +70359,17 @@ var require_parser = __commonJS({
|
|
|
70359
70359
|
}
|
|
70360
70360
|
};
|
|
70361
70361
|
module.exports = Parser;
|
|
70362
|
-
function aaObtainFormattingElementEntry(p,
|
|
70363
|
-
let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(
|
|
70362
|
+
function aaObtainFormattingElementEntry(p, token2) {
|
|
70363
|
+
let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token2.tagName);
|
|
70364
70364
|
if (formattingElementEntry) {
|
|
70365
70365
|
if (!p.openElements.contains(formattingElementEntry.element)) {
|
|
70366
70366
|
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
70367
70367
|
formattingElementEntry = null;
|
|
70368
|
-
} else if (!p.openElements.hasInScope(
|
|
70368
|
+
} else if (!p.openElements.hasInScope(token2.tagName)) {
|
|
70369
70369
|
formattingElementEntry = null;
|
|
70370
70370
|
}
|
|
70371
70371
|
} else {
|
|
70372
|
-
genericEndTagInBody(p,
|
|
70372
|
+
genericEndTagInBody(p, token2);
|
|
70373
70373
|
}
|
|
70374
70374
|
return formattingElementEntry;
|
|
70375
70375
|
}
|
|
@@ -70436,8 +70436,8 @@ var require_parser = __commonJS({
|
|
|
70436
70436
|
}
|
|
70437
70437
|
function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
|
|
70438
70438
|
const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
|
|
70439
|
-
const
|
|
70440
|
-
const newElement = p.treeAdapter.createElement(
|
|
70439
|
+
const token2 = formattingElementEntry.token;
|
|
70440
|
+
const newElement = p.treeAdapter.createElement(token2.tagName, ns, token2.attrs);
|
|
70441
70441
|
p._adoptNodes(furthestBlock, newElement);
|
|
70442
70442
|
p.treeAdapter.appendChild(furthestBlock, newElement);
|
|
70443
70443
|
p.activeFormattingElements.insertElementAfterBookmark(newElement, formattingElementEntry.token);
|
|
@@ -70445,10 +70445,10 @@ var require_parser = __commonJS({
|
|
|
70445
70445
|
p.openElements.remove(formattingElementEntry.element);
|
|
70446
70446
|
p.openElements.insertAfter(furthestBlock, newElement);
|
|
70447
70447
|
}
|
|
70448
|
-
function callAdoptionAgency(p,
|
|
70448
|
+
function callAdoptionAgency(p, token2) {
|
|
70449
70449
|
let formattingElementEntry;
|
|
70450
70450
|
for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
|
|
70451
|
-
formattingElementEntry = aaObtainFormattingElementEntry(p,
|
|
70451
|
+
formattingElementEntry = aaObtainFormattingElementEntry(p, token2, formattingElementEntry);
|
|
70452
70452
|
if (!formattingElementEntry) {
|
|
70453
70453
|
break;
|
|
70454
70454
|
}
|
|
@@ -70469,103 +70469,103 @@ var require_parser = __commonJS({
|
|
|
70469
70469
|
function misplacedDoctype(p) {
|
|
70470
70470
|
p._err(ERR.misplacedDoctype);
|
|
70471
70471
|
}
|
|
70472
|
-
function appendComment(p,
|
|
70473
|
-
p._appendCommentNode(
|
|
70472
|
+
function appendComment(p, token2) {
|
|
70473
|
+
p._appendCommentNode(token2, p.openElements.currentTmplContent || p.openElements.current);
|
|
70474
70474
|
}
|
|
70475
|
-
function appendCommentToRootHtmlElement(p,
|
|
70476
|
-
p._appendCommentNode(
|
|
70475
|
+
function appendCommentToRootHtmlElement(p, token2) {
|
|
70476
|
+
p._appendCommentNode(token2, p.openElements.items[0]);
|
|
70477
70477
|
}
|
|
70478
|
-
function appendCommentToDocument(p,
|
|
70479
|
-
p._appendCommentNode(
|
|
70478
|
+
function appendCommentToDocument(p, token2) {
|
|
70479
|
+
p._appendCommentNode(token2, p.document);
|
|
70480
70480
|
}
|
|
70481
|
-
function insertCharacters(p,
|
|
70482
|
-
p._insertCharacters(
|
|
70481
|
+
function insertCharacters(p, token2) {
|
|
70482
|
+
p._insertCharacters(token2);
|
|
70483
70483
|
}
|
|
70484
70484
|
function stopParsing(p) {
|
|
70485
70485
|
p.stopped = true;
|
|
70486
70486
|
}
|
|
70487
|
-
function doctypeInInitialMode(p,
|
|
70488
|
-
p._setDocumentType(
|
|
70489
|
-
const mode =
|
|
70490
|
-
if (!doctype.isConforming(
|
|
70487
|
+
function doctypeInInitialMode(p, token2) {
|
|
70488
|
+
p._setDocumentType(token2);
|
|
70489
|
+
const mode = token2.forceQuirks ? HTML.DOCUMENT_MODE.QUIRKS : doctype.getDocumentMode(token2);
|
|
70490
|
+
if (!doctype.isConforming(token2)) {
|
|
70491
70491
|
p._err(ERR.nonConformingDoctype);
|
|
70492
70492
|
}
|
|
70493
70493
|
p.treeAdapter.setDocumentMode(p.document, mode);
|
|
70494
70494
|
p.insertionMode = BEFORE_HTML_MODE;
|
|
70495
70495
|
}
|
|
70496
|
-
function tokenInInitialMode(p,
|
|
70496
|
+
function tokenInInitialMode(p, token2) {
|
|
70497
70497
|
p._err(ERR.missingDoctype, { beforeToken: true });
|
|
70498
70498
|
p.treeAdapter.setDocumentMode(p.document, HTML.DOCUMENT_MODE.QUIRKS);
|
|
70499
70499
|
p.insertionMode = BEFORE_HTML_MODE;
|
|
70500
|
-
p._processToken(
|
|
70500
|
+
p._processToken(token2);
|
|
70501
70501
|
}
|
|
70502
|
-
function startTagBeforeHtml(p,
|
|
70503
|
-
if (
|
|
70504
|
-
p._insertElement(
|
|
70502
|
+
function startTagBeforeHtml(p, token2) {
|
|
70503
|
+
if (token2.tagName === $.HTML) {
|
|
70504
|
+
p._insertElement(token2, NS.HTML);
|
|
70505
70505
|
p.insertionMode = BEFORE_HEAD_MODE;
|
|
70506
70506
|
} else {
|
|
70507
|
-
tokenBeforeHtml(p,
|
|
70507
|
+
tokenBeforeHtml(p, token2);
|
|
70508
70508
|
}
|
|
70509
70509
|
}
|
|
70510
|
-
function endTagBeforeHtml(p,
|
|
70511
|
-
const tn =
|
|
70510
|
+
function endTagBeforeHtml(p, token2) {
|
|
70511
|
+
const tn = token2.tagName;
|
|
70512
70512
|
if (tn === $.HTML || tn === $.HEAD || tn === $.BODY || tn === $.BR) {
|
|
70513
|
-
tokenBeforeHtml(p,
|
|
70513
|
+
tokenBeforeHtml(p, token2);
|
|
70514
70514
|
}
|
|
70515
70515
|
}
|
|
70516
|
-
function tokenBeforeHtml(p,
|
|
70516
|
+
function tokenBeforeHtml(p, token2) {
|
|
70517
70517
|
p._insertFakeRootElement();
|
|
70518
70518
|
p.insertionMode = BEFORE_HEAD_MODE;
|
|
70519
|
-
p._processToken(
|
|
70519
|
+
p._processToken(token2);
|
|
70520
70520
|
}
|
|
70521
|
-
function startTagBeforeHead(p,
|
|
70522
|
-
const tn =
|
|
70521
|
+
function startTagBeforeHead(p, token2) {
|
|
70522
|
+
const tn = token2.tagName;
|
|
70523
70523
|
if (tn === $.HTML) {
|
|
70524
|
-
startTagInBody(p,
|
|
70524
|
+
startTagInBody(p, token2);
|
|
70525
70525
|
} else if (tn === $.HEAD) {
|
|
70526
|
-
p._insertElement(
|
|
70526
|
+
p._insertElement(token2, NS.HTML);
|
|
70527
70527
|
p.headElement = p.openElements.current;
|
|
70528
70528
|
p.insertionMode = IN_HEAD_MODE;
|
|
70529
70529
|
} else {
|
|
70530
|
-
tokenBeforeHead(p,
|
|
70530
|
+
tokenBeforeHead(p, token2);
|
|
70531
70531
|
}
|
|
70532
70532
|
}
|
|
70533
|
-
function endTagBeforeHead(p,
|
|
70534
|
-
const tn =
|
|
70533
|
+
function endTagBeforeHead(p, token2) {
|
|
70534
|
+
const tn = token2.tagName;
|
|
70535
70535
|
if (tn === $.HEAD || tn === $.BODY || tn === $.HTML || tn === $.BR) {
|
|
70536
|
-
tokenBeforeHead(p,
|
|
70536
|
+
tokenBeforeHead(p, token2);
|
|
70537
70537
|
} else {
|
|
70538
70538
|
p._err(ERR.endTagWithoutMatchingOpenElement);
|
|
70539
70539
|
}
|
|
70540
70540
|
}
|
|
70541
|
-
function tokenBeforeHead(p,
|
|
70541
|
+
function tokenBeforeHead(p, token2) {
|
|
70542
70542
|
p._insertFakeElement($.HEAD);
|
|
70543
70543
|
p.headElement = p.openElements.current;
|
|
70544
70544
|
p.insertionMode = IN_HEAD_MODE;
|
|
70545
|
-
p._processToken(
|
|
70545
|
+
p._processToken(token2);
|
|
70546
70546
|
}
|
|
70547
|
-
function startTagInHead(p,
|
|
70548
|
-
const tn =
|
|
70547
|
+
function startTagInHead(p, token2) {
|
|
70548
|
+
const tn = token2.tagName;
|
|
70549
70549
|
if (tn === $.HTML) {
|
|
70550
|
-
startTagInBody(p,
|
|
70550
|
+
startTagInBody(p, token2);
|
|
70551
70551
|
} else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META) {
|
|
70552
|
-
p._appendElement(
|
|
70553
|
-
|
|
70552
|
+
p._appendElement(token2, NS.HTML);
|
|
70553
|
+
token2.ackSelfClosing = true;
|
|
70554
70554
|
} else if (tn === $.TITLE) {
|
|
70555
|
-
p._switchToTextParsing(
|
|
70555
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.RCDATA);
|
|
70556
70556
|
} else if (tn === $.NOSCRIPT) {
|
|
70557
70557
|
if (p.options.scriptingEnabled) {
|
|
70558
|
-
p._switchToTextParsing(
|
|
70558
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.RAWTEXT);
|
|
70559
70559
|
} else {
|
|
70560
|
-
p._insertElement(
|
|
70560
|
+
p._insertElement(token2, NS.HTML);
|
|
70561
70561
|
p.insertionMode = IN_HEAD_NO_SCRIPT_MODE;
|
|
70562
70562
|
}
|
|
70563
70563
|
} else if (tn === $.NOFRAMES || tn === $.STYLE) {
|
|
70564
|
-
p._switchToTextParsing(
|
|
70564
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.RAWTEXT);
|
|
70565
70565
|
} else if (tn === $.SCRIPT) {
|
|
70566
|
-
p._switchToTextParsing(
|
|
70566
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.SCRIPT_DATA);
|
|
70567
70567
|
} else if (tn === $.TEMPLATE) {
|
|
70568
|
-
p._insertTemplate(
|
|
70568
|
+
p._insertTemplate(token2, NS.HTML);
|
|
70569
70569
|
p.activeFormattingElements.insertMarker();
|
|
70570
70570
|
p.framesetOk = false;
|
|
70571
70571
|
p.insertionMode = IN_TEMPLATE_MODE;
|
|
@@ -70573,16 +70573,16 @@ var require_parser = __commonJS({
|
|
|
70573
70573
|
} else if (tn === $.HEAD) {
|
|
70574
70574
|
p._err(ERR.misplacedStartTagForHeadElement);
|
|
70575
70575
|
} else {
|
|
70576
|
-
tokenInHead(p,
|
|
70576
|
+
tokenInHead(p, token2);
|
|
70577
70577
|
}
|
|
70578
70578
|
}
|
|
70579
|
-
function endTagInHead(p,
|
|
70580
|
-
const tn =
|
|
70579
|
+
function endTagInHead(p, token2) {
|
|
70580
|
+
const tn = token2.tagName;
|
|
70581
70581
|
if (tn === $.HEAD) {
|
|
70582
70582
|
p.openElements.pop();
|
|
70583
70583
|
p.insertionMode = AFTER_HEAD_MODE;
|
|
70584
70584
|
} else if (tn === $.BODY || tn === $.BR || tn === $.HTML) {
|
|
70585
|
-
tokenInHead(p,
|
|
70585
|
+
tokenInHead(p, token2);
|
|
70586
70586
|
} else if (tn === $.TEMPLATE) {
|
|
70587
70587
|
if (p.openElements.tmplCount > 0) {
|
|
70588
70588
|
p.openElements.generateImpliedEndTagsThoroughly();
|
|
@@ -70600,115 +70600,115 @@ var require_parser = __commonJS({
|
|
|
70600
70600
|
p._err(ERR.endTagWithoutMatchingOpenElement);
|
|
70601
70601
|
}
|
|
70602
70602
|
}
|
|
70603
|
-
function tokenInHead(p,
|
|
70603
|
+
function tokenInHead(p, token2) {
|
|
70604
70604
|
p.openElements.pop();
|
|
70605
70605
|
p.insertionMode = AFTER_HEAD_MODE;
|
|
70606
|
-
p._processToken(
|
|
70606
|
+
p._processToken(token2);
|
|
70607
70607
|
}
|
|
70608
|
-
function startTagInHeadNoScript(p,
|
|
70609
|
-
const tn =
|
|
70608
|
+
function startTagInHeadNoScript(p, token2) {
|
|
70609
|
+
const tn = token2.tagName;
|
|
70610
70610
|
if (tn === $.HTML) {
|
|
70611
|
-
startTagInBody(p,
|
|
70611
|
+
startTagInBody(p, token2);
|
|
70612
70612
|
} else if (tn === $.BASEFONT || tn === $.BGSOUND || tn === $.HEAD || tn === $.LINK || tn === $.META || tn === $.NOFRAMES || tn === $.STYLE) {
|
|
70613
|
-
startTagInHead(p,
|
|
70613
|
+
startTagInHead(p, token2);
|
|
70614
70614
|
} else if (tn === $.NOSCRIPT) {
|
|
70615
70615
|
p._err(ERR.nestedNoscriptInHead);
|
|
70616
70616
|
} else {
|
|
70617
|
-
tokenInHeadNoScript(p,
|
|
70617
|
+
tokenInHeadNoScript(p, token2);
|
|
70618
70618
|
}
|
|
70619
70619
|
}
|
|
70620
|
-
function endTagInHeadNoScript(p,
|
|
70621
|
-
const tn =
|
|
70620
|
+
function endTagInHeadNoScript(p, token2) {
|
|
70621
|
+
const tn = token2.tagName;
|
|
70622
70622
|
if (tn === $.NOSCRIPT) {
|
|
70623
70623
|
p.openElements.pop();
|
|
70624
70624
|
p.insertionMode = IN_HEAD_MODE;
|
|
70625
70625
|
} else if (tn === $.BR) {
|
|
70626
|
-
tokenInHeadNoScript(p,
|
|
70626
|
+
tokenInHeadNoScript(p, token2);
|
|
70627
70627
|
} else {
|
|
70628
70628
|
p._err(ERR.endTagWithoutMatchingOpenElement);
|
|
70629
70629
|
}
|
|
70630
70630
|
}
|
|
70631
|
-
function tokenInHeadNoScript(p,
|
|
70632
|
-
const errCode =
|
|
70631
|
+
function tokenInHeadNoScript(p, token2) {
|
|
70632
|
+
const errCode = token2.type === Tokenizer.EOF_TOKEN ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
|
|
70633
70633
|
p._err(errCode);
|
|
70634
70634
|
p.openElements.pop();
|
|
70635
70635
|
p.insertionMode = IN_HEAD_MODE;
|
|
70636
|
-
p._processToken(
|
|
70636
|
+
p._processToken(token2);
|
|
70637
70637
|
}
|
|
70638
|
-
function startTagAfterHead(p,
|
|
70639
|
-
const tn =
|
|
70638
|
+
function startTagAfterHead(p, token2) {
|
|
70639
|
+
const tn = token2.tagName;
|
|
70640
70640
|
if (tn === $.HTML) {
|
|
70641
|
-
startTagInBody(p,
|
|
70641
|
+
startTagInBody(p, token2);
|
|
70642
70642
|
} else if (tn === $.BODY) {
|
|
70643
|
-
p._insertElement(
|
|
70643
|
+
p._insertElement(token2, NS.HTML);
|
|
70644
70644
|
p.framesetOk = false;
|
|
70645
70645
|
p.insertionMode = IN_BODY_MODE;
|
|
70646
70646
|
} else if (tn === $.FRAMESET) {
|
|
70647
|
-
p._insertElement(
|
|
70647
|
+
p._insertElement(token2, NS.HTML);
|
|
70648
70648
|
p.insertionMode = IN_FRAMESET_MODE;
|
|
70649
70649
|
} else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META || tn === $.NOFRAMES || tn === $.SCRIPT || tn === $.STYLE || tn === $.TEMPLATE || tn === $.TITLE) {
|
|
70650
70650
|
p._err(ERR.abandonedHeadElementChild);
|
|
70651
70651
|
p.openElements.push(p.headElement);
|
|
70652
|
-
startTagInHead(p,
|
|
70652
|
+
startTagInHead(p, token2);
|
|
70653
70653
|
p.openElements.remove(p.headElement);
|
|
70654
70654
|
} else if (tn === $.HEAD) {
|
|
70655
70655
|
p._err(ERR.misplacedStartTagForHeadElement);
|
|
70656
70656
|
} else {
|
|
70657
|
-
tokenAfterHead(p,
|
|
70657
|
+
tokenAfterHead(p, token2);
|
|
70658
70658
|
}
|
|
70659
70659
|
}
|
|
70660
|
-
function endTagAfterHead(p,
|
|
70661
|
-
const tn =
|
|
70660
|
+
function endTagAfterHead(p, token2) {
|
|
70661
|
+
const tn = token2.tagName;
|
|
70662
70662
|
if (tn === $.BODY || tn === $.HTML || tn === $.BR) {
|
|
70663
|
-
tokenAfterHead(p,
|
|
70663
|
+
tokenAfterHead(p, token2);
|
|
70664
70664
|
} else if (tn === $.TEMPLATE) {
|
|
70665
|
-
endTagInHead(p,
|
|
70665
|
+
endTagInHead(p, token2);
|
|
70666
70666
|
} else {
|
|
70667
70667
|
p._err(ERR.endTagWithoutMatchingOpenElement);
|
|
70668
70668
|
}
|
|
70669
70669
|
}
|
|
70670
|
-
function tokenAfterHead(p,
|
|
70670
|
+
function tokenAfterHead(p, token2) {
|
|
70671
70671
|
p._insertFakeElement($.BODY);
|
|
70672
70672
|
p.insertionMode = IN_BODY_MODE;
|
|
70673
|
-
p._processToken(
|
|
70673
|
+
p._processToken(token2);
|
|
70674
70674
|
}
|
|
70675
|
-
function whitespaceCharacterInBody(p,
|
|
70675
|
+
function whitespaceCharacterInBody(p, token2) {
|
|
70676
70676
|
p._reconstructActiveFormattingElements();
|
|
70677
|
-
p._insertCharacters(
|
|
70677
|
+
p._insertCharacters(token2);
|
|
70678
70678
|
}
|
|
70679
|
-
function characterInBody(p,
|
|
70679
|
+
function characterInBody(p, token2) {
|
|
70680
70680
|
p._reconstructActiveFormattingElements();
|
|
70681
|
-
p._insertCharacters(
|
|
70681
|
+
p._insertCharacters(token2);
|
|
70682
70682
|
p.framesetOk = false;
|
|
70683
70683
|
}
|
|
70684
|
-
function htmlStartTagInBody(p,
|
|
70684
|
+
function htmlStartTagInBody(p, token2) {
|
|
70685
70685
|
if (p.openElements.tmplCount === 0) {
|
|
70686
|
-
p.treeAdapter.adoptAttributes(p.openElements.items[0],
|
|
70686
|
+
p.treeAdapter.adoptAttributes(p.openElements.items[0], token2.attrs);
|
|
70687
70687
|
}
|
|
70688
70688
|
}
|
|
70689
|
-
function bodyStartTagInBody(p,
|
|
70689
|
+
function bodyStartTagInBody(p, token2) {
|
|
70690
70690
|
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
70691
70691
|
if (bodyElement && p.openElements.tmplCount === 0) {
|
|
70692
70692
|
p.framesetOk = false;
|
|
70693
|
-
p.treeAdapter.adoptAttributes(bodyElement,
|
|
70693
|
+
p.treeAdapter.adoptAttributes(bodyElement, token2.attrs);
|
|
70694
70694
|
}
|
|
70695
70695
|
}
|
|
70696
|
-
function framesetStartTagInBody(p,
|
|
70696
|
+
function framesetStartTagInBody(p, token2) {
|
|
70697
70697
|
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
|
70698
70698
|
if (p.framesetOk && bodyElement) {
|
|
70699
70699
|
p.treeAdapter.detachNode(bodyElement);
|
|
70700
70700
|
p.openElements.popAllUpToHtmlElement();
|
|
70701
|
-
p._insertElement(
|
|
70701
|
+
p._insertElement(token2, NS.HTML);
|
|
70702
70702
|
p.insertionMode = IN_FRAMESET_MODE;
|
|
70703
70703
|
}
|
|
70704
70704
|
}
|
|
70705
|
-
function addressStartTagInBody(p,
|
|
70705
|
+
function addressStartTagInBody(p, token2) {
|
|
70706
70706
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70707
70707
|
p._closePElement();
|
|
70708
70708
|
}
|
|
70709
|
-
p._insertElement(
|
|
70709
|
+
p._insertElement(token2, NS.HTML);
|
|
70710
70710
|
}
|
|
70711
|
-
function numberedHeaderStartTagInBody(p,
|
|
70711
|
+
function numberedHeaderStartTagInBody(p, token2) {
|
|
70712
70712
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70713
70713
|
p._closePElement();
|
|
70714
70714
|
}
|
|
@@ -70716,31 +70716,31 @@ var require_parser = __commonJS({
|
|
|
70716
70716
|
if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
|
|
70717
70717
|
p.openElements.pop();
|
|
70718
70718
|
}
|
|
70719
|
-
p._insertElement(
|
|
70719
|
+
p._insertElement(token2, NS.HTML);
|
|
70720
70720
|
}
|
|
70721
|
-
function preStartTagInBody(p,
|
|
70721
|
+
function preStartTagInBody(p, token2) {
|
|
70722
70722
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70723
70723
|
p._closePElement();
|
|
70724
70724
|
}
|
|
70725
|
-
p._insertElement(
|
|
70725
|
+
p._insertElement(token2, NS.HTML);
|
|
70726
70726
|
p.skipNextNewLine = true;
|
|
70727
70727
|
p.framesetOk = false;
|
|
70728
70728
|
}
|
|
70729
|
-
function formStartTagInBody(p,
|
|
70729
|
+
function formStartTagInBody(p, token2) {
|
|
70730
70730
|
const inTemplate = p.openElements.tmplCount > 0;
|
|
70731
70731
|
if (!p.formElement || inTemplate) {
|
|
70732
70732
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70733
70733
|
p._closePElement();
|
|
70734
70734
|
}
|
|
70735
|
-
p._insertElement(
|
|
70735
|
+
p._insertElement(token2, NS.HTML);
|
|
70736
70736
|
if (!inTemplate) {
|
|
70737
70737
|
p.formElement = p.openElements.current;
|
|
70738
70738
|
}
|
|
70739
70739
|
}
|
|
70740
70740
|
}
|
|
70741
|
-
function listItemStartTagInBody(p,
|
|
70741
|
+
function listItemStartTagInBody(p, token2) {
|
|
70742
70742
|
p.framesetOk = false;
|
|
70743
|
-
const tn =
|
|
70743
|
+
const tn = token2.tagName;
|
|
70744
70744
|
for (let i = p.openElements.stackTop; i >= 0; i--) {
|
|
70745
70745
|
const element = p.openElements.items[i];
|
|
70746
70746
|
const elementTn = p.treeAdapter.getTagName(element);
|
|
@@ -70762,120 +70762,120 @@ var require_parser = __commonJS({
|
|
|
70762
70762
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70763
70763
|
p._closePElement();
|
|
70764
70764
|
}
|
|
70765
|
-
p._insertElement(
|
|
70765
|
+
p._insertElement(token2, NS.HTML);
|
|
70766
70766
|
}
|
|
70767
|
-
function plaintextStartTagInBody(p,
|
|
70767
|
+
function plaintextStartTagInBody(p, token2) {
|
|
70768
70768
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70769
70769
|
p._closePElement();
|
|
70770
70770
|
}
|
|
70771
|
-
p._insertElement(
|
|
70771
|
+
p._insertElement(token2, NS.HTML);
|
|
70772
70772
|
p.tokenizer.state = Tokenizer.MODE.PLAINTEXT;
|
|
70773
70773
|
}
|
|
70774
|
-
function buttonStartTagInBody(p,
|
|
70774
|
+
function buttonStartTagInBody(p, token2) {
|
|
70775
70775
|
if (p.openElements.hasInScope($.BUTTON)) {
|
|
70776
70776
|
p.openElements.generateImpliedEndTags();
|
|
70777
70777
|
p.openElements.popUntilTagNamePopped($.BUTTON);
|
|
70778
70778
|
}
|
|
70779
70779
|
p._reconstructActiveFormattingElements();
|
|
70780
|
-
p._insertElement(
|
|
70780
|
+
p._insertElement(token2, NS.HTML);
|
|
70781
70781
|
p.framesetOk = false;
|
|
70782
70782
|
}
|
|
70783
|
-
function aStartTagInBody(p,
|
|
70783
|
+
function aStartTagInBody(p, token2) {
|
|
70784
70784
|
const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName($.A);
|
|
70785
70785
|
if (activeElementEntry) {
|
|
70786
|
-
callAdoptionAgency(p,
|
|
70786
|
+
callAdoptionAgency(p, token2);
|
|
70787
70787
|
p.openElements.remove(activeElementEntry.element);
|
|
70788
70788
|
p.activeFormattingElements.removeEntry(activeElementEntry);
|
|
70789
70789
|
}
|
|
70790
70790
|
p._reconstructActiveFormattingElements();
|
|
70791
|
-
p._insertElement(
|
|
70792
|
-
p.activeFormattingElements.pushElement(p.openElements.current,
|
|
70791
|
+
p._insertElement(token2, NS.HTML);
|
|
70792
|
+
p.activeFormattingElements.pushElement(p.openElements.current, token2);
|
|
70793
70793
|
}
|
|
70794
|
-
function bStartTagInBody(p,
|
|
70794
|
+
function bStartTagInBody(p, token2) {
|
|
70795
70795
|
p._reconstructActiveFormattingElements();
|
|
70796
|
-
p._insertElement(
|
|
70797
|
-
p.activeFormattingElements.pushElement(p.openElements.current,
|
|
70796
|
+
p._insertElement(token2, NS.HTML);
|
|
70797
|
+
p.activeFormattingElements.pushElement(p.openElements.current, token2);
|
|
70798
70798
|
}
|
|
70799
|
-
function nobrStartTagInBody(p,
|
|
70799
|
+
function nobrStartTagInBody(p, token2) {
|
|
70800
70800
|
p._reconstructActiveFormattingElements();
|
|
70801
70801
|
if (p.openElements.hasInScope($.NOBR)) {
|
|
70802
|
-
callAdoptionAgency(p,
|
|
70802
|
+
callAdoptionAgency(p, token2);
|
|
70803
70803
|
p._reconstructActiveFormattingElements();
|
|
70804
70804
|
}
|
|
70805
|
-
p._insertElement(
|
|
70806
|
-
p.activeFormattingElements.pushElement(p.openElements.current,
|
|
70805
|
+
p._insertElement(token2, NS.HTML);
|
|
70806
|
+
p.activeFormattingElements.pushElement(p.openElements.current, token2);
|
|
70807
70807
|
}
|
|
70808
|
-
function appletStartTagInBody(p,
|
|
70808
|
+
function appletStartTagInBody(p, token2) {
|
|
70809
70809
|
p._reconstructActiveFormattingElements();
|
|
70810
|
-
p._insertElement(
|
|
70810
|
+
p._insertElement(token2, NS.HTML);
|
|
70811
70811
|
p.activeFormattingElements.insertMarker();
|
|
70812
70812
|
p.framesetOk = false;
|
|
70813
70813
|
}
|
|
70814
|
-
function tableStartTagInBody(p,
|
|
70814
|
+
function tableStartTagInBody(p, token2) {
|
|
70815
70815
|
if (p.treeAdapter.getDocumentMode(p.document) !== HTML.DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope($.P)) {
|
|
70816
70816
|
p._closePElement();
|
|
70817
70817
|
}
|
|
70818
|
-
p._insertElement(
|
|
70818
|
+
p._insertElement(token2, NS.HTML);
|
|
70819
70819
|
p.framesetOk = false;
|
|
70820
70820
|
p.insertionMode = IN_TABLE_MODE;
|
|
70821
70821
|
}
|
|
70822
|
-
function areaStartTagInBody(p,
|
|
70822
|
+
function areaStartTagInBody(p, token2) {
|
|
70823
70823
|
p._reconstructActiveFormattingElements();
|
|
70824
|
-
p._appendElement(
|
|
70824
|
+
p._appendElement(token2, NS.HTML);
|
|
70825
70825
|
p.framesetOk = false;
|
|
70826
|
-
|
|
70826
|
+
token2.ackSelfClosing = true;
|
|
70827
70827
|
}
|
|
70828
|
-
function inputStartTagInBody(p,
|
|
70828
|
+
function inputStartTagInBody(p, token2) {
|
|
70829
70829
|
p._reconstructActiveFormattingElements();
|
|
70830
|
-
p._appendElement(
|
|
70831
|
-
const inputType = Tokenizer.getTokenAttr(
|
|
70830
|
+
p._appendElement(token2, NS.HTML);
|
|
70831
|
+
const inputType = Tokenizer.getTokenAttr(token2, ATTRS.TYPE);
|
|
70832
70832
|
if (!inputType || inputType.toLowerCase() !== HIDDEN_INPUT_TYPE) {
|
|
70833
70833
|
p.framesetOk = false;
|
|
70834
70834
|
}
|
|
70835
|
-
|
|
70835
|
+
token2.ackSelfClosing = true;
|
|
70836
70836
|
}
|
|
70837
|
-
function paramStartTagInBody(p,
|
|
70838
|
-
p._appendElement(
|
|
70839
|
-
|
|
70837
|
+
function paramStartTagInBody(p, token2) {
|
|
70838
|
+
p._appendElement(token2, NS.HTML);
|
|
70839
|
+
token2.ackSelfClosing = true;
|
|
70840
70840
|
}
|
|
70841
|
-
function hrStartTagInBody(p,
|
|
70841
|
+
function hrStartTagInBody(p, token2) {
|
|
70842
70842
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70843
70843
|
p._closePElement();
|
|
70844
70844
|
}
|
|
70845
|
-
p._appendElement(
|
|
70845
|
+
p._appendElement(token2, NS.HTML);
|
|
70846
70846
|
p.framesetOk = false;
|
|
70847
70847
|
p.ackSelfClosing = true;
|
|
70848
70848
|
}
|
|
70849
|
-
function imageStartTagInBody(p,
|
|
70850
|
-
|
|
70851
|
-
areaStartTagInBody(p,
|
|
70849
|
+
function imageStartTagInBody(p, token2) {
|
|
70850
|
+
token2.tagName = $.IMG;
|
|
70851
|
+
areaStartTagInBody(p, token2);
|
|
70852
70852
|
}
|
|
70853
|
-
function textareaStartTagInBody(p,
|
|
70854
|
-
p._insertElement(
|
|
70853
|
+
function textareaStartTagInBody(p, token2) {
|
|
70854
|
+
p._insertElement(token2, NS.HTML);
|
|
70855
70855
|
p.skipNextNewLine = true;
|
|
70856
70856
|
p.tokenizer.state = Tokenizer.MODE.RCDATA;
|
|
70857
70857
|
p.originalInsertionMode = p.insertionMode;
|
|
70858
70858
|
p.framesetOk = false;
|
|
70859
70859
|
p.insertionMode = TEXT_MODE;
|
|
70860
70860
|
}
|
|
70861
|
-
function xmpStartTagInBody(p,
|
|
70861
|
+
function xmpStartTagInBody(p, token2) {
|
|
70862
70862
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70863
70863
|
p._closePElement();
|
|
70864
70864
|
}
|
|
70865
70865
|
p._reconstructActiveFormattingElements();
|
|
70866
70866
|
p.framesetOk = false;
|
|
70867
|
-
p._switchToTextParsing(
|
|
70867
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.RAWTEXT);
|
|
70868
70868
|
}
|
|
70869
|
-
function iframeStartTagInBody(p,
|
|
70869
|
+
function iframeStartTagInBody(p, token2) {
|
|
70870
70870
|
p.framesetOk = false;
|
|
70871
|
-
p._switchToTextParsing(
|
|
70871
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.RAWTEXT);
|
|
70872
70872
|
}
|
|
70873
|
-
function noembedStartTagInBody(p,
|
|
70874
|
-
p._switchToTextParsing(
|
|
70873
|
+
function noembedStartTagInBody(p, token2) {
|
|
70874
|
+
p._switchToTextParsing(token2, Tokenizer.MODE.RAWTEXT);
|
|
70875
70875
|
}
|
|
70876
|
-
function selectStartTagInBody(p,
|
|
70876
|
+
function selectStartTagInBody(p, token2) {
|
|
70877
70877
|
p._reconstructActiveFormattingElements();
|
|
70878
|
-
p._insertElement(
|
|
70878
|
+
p._insertElement(token2, NS.HTML);
|
|
70879
70879
|
p.framesetOk = false;
|
|
70880
70880
|
if (p.insertionMode === IN_TABLE_MODE || p.insertionMode === IN_CAPTION_MODE || p.insertionMode === IN_TABLE_BODY_MODE || p.insertionMode === IN_ROW_MODE || p.insertionMode === IN_CELL_MODE) {
|
|
70881
70881
|
p.insertionMode = IN_SELECT_IN_TABLE_MODE;
|
|
@@ -70883,236 +70883,236 @@ var require_parser = __commonJS({
|
|
|
70883
70883
|
p.insertionMode = IN_SELECT_MODE;
|
|
70884
70884
|
}
|
|
70885
70885
|
}
|
|
70886
|
-
function optgroupStartTagInBody(p,
|
|
70886
|
+
function optgroupStartTagInBody(p, token2) {
|
|
70887
70887
|
if (p.openElements.currentTagName === $.OPTION) {
|
|
70888
70888
|
p.openElements.pop();
|
|
70889
70889
|
}
|
|
70890
70890
|
p._reconstructActiveFormattingElements();
|
|
70891
|
-
p._insertElement(
|
|
70891
|
+
p._insertElement(token2, NS.HTML);
|
|
70892
70892
|
}
|
|
70893
|
-
function rbStartTagInBody(p,
|
|
70893
|
+
function rbStartTagInBody(p, token2) {
|
|
70894
70894
|
if (p.openElements.hasInScope($.RUBY)) {
|
|
70895
70895
|
p.openElements.generateImpliedEndTags();
|
|
70896
70896
|
}
|
|
70897
|
-
p._insertElement(
|
|
70897
|
+
p._insertElement(token2, NS.HTML);
|
|
70898
70898
|
}
|
|
70899
|
-
function rtStartTagInBody(p,
|
|
70899
|
+
function rtStartTagInBody(p, token2) {
|
|
70900
70900
|
if (p.openElements.hasInScope($.RUBY)) {
|
|
70901
70901
|
p.openElements.generateImpliedEndTagsWithExclusion($.RTC);
|
|
70902
70902
|
}
|
|
70903
|
-
p._insertElement(
|
|
70903
|
+
p._insertElement(token2, NS.HTML);
|
|
70904
70904
|
}
|
|
70905
|
-
function menuStartTagInBody(p,
|
|
70905
|
+
function menuStartTagInBody(p, token2) {
|
|
70906
70906
|
if (p.openElements.hasInButtonScope($.P)) {
|
|
70907
70907
|
p._closePElement();
|
|
70908
70908
|
}
|
|
70909
|
-
p._insertElement(
|
|
70909
|
+
p._insertElement(token2, NS.HTML);
|
|
70910
70910
|
}
|
|
70911
|
-
function mathStartTagInBody(p,
|
|
70911
|
+
function mathStartTagInBody(p, token2) {
|
|
70912
70912
|
p._reconstructActiveFormattingElements();
|
|
70913
|
-
foreignContent.adjustTokenMathMLAttrs(
|
|
70914
|
-
foreignContent.adjustTokenXMLAttrs(
|
|
70915
|
-
if (
|
|
70916
|
-
p._appendElement(
|
|
70913
|
+
foreignContent.adjustTokenMathMLAttrs(token2);
|
|
70914
|
+
foreignContent.adjustTokenXMLAttrs(token2);
|
|
70915
|
+
if (token2.selfClosing) {
|
|
70916
|
+
p._appendElement(token2, NS.MATHML);
|
|
70917
70917
|
} else {
|
|
70918
|
-
p._insertElement(
|
|
70918
|
+
p._insertElement(token2, NS.MATHML);
|
|
70919
70919
|
}
|
|
70920
|
-
|
|
70920
|
+
token2.ackSelfClosing = true;
|
|
70921
70921
|
}
|
|
70922
|
-
function svgStartTagInBody(p,
|
|
70922
|
+
function svgStartTagInBody(p, token2) {
|
|
70923
70923
|
p._reconstructActiveFormattingElements();
|
|
70924
|
-
foreignContent.adjustTokenSVGAttrs(
|
|
70925
|
-
foreignContent.adjustTokenXMLAttrs(
|
|
70926
|
-
if (
|
|
70927
|
-
p._appendElement(
|
|
70924
|
+
foreignContent.adjustTokenSVGAttrs(token2);
|
|
70925
|
+
foreignContent.adjustTokenXMLAttrs(token2);
|
|
70926
|
+
if (token2.selfClosing) {
|
|
70927
|
+
p._appendElement(token2, NS.SVG);
|
|
70928
70928
|
} else {
|
|
70929
|
-
p._insertElement(
|
|
70929
|
+
p._insertElement(token2, NS.SVG);
|
|
70930
70930
|
}
|
|
70931
|
-
|
|
70931
|
+
token2.ackSelfClosing = true;
|
|
70932
70932
|
}
|
|
70933
|
-
function genericStartTagInBody(p,
|
|
70933
|
+
function genericStartTagInBody(p, token2) {
|
|
70934
70934
|
p._reconstructActiveFormattingElements();
|
|
70935
|
-
p._insertElement(
|
|
70935
|
+
p._insertElement(token2, NS.HTML);
|
|
70936
70936
|
}
|
|
70937
|
-
function startTagInBody(p,
|
|
70938
|
-
const tn =
|
|
70937
|
+
function startTagInBody(p, token2) {
|
|
70938
|
+
const tn = token2.tagName;
|
|
70939
70939
|
switch (tn.length) {
|
|
70940
70940
|
case 1:
|
|
70941
70941
|
if (tn === $.I || tn === $.S || tn === $.B || tn === $.U) {
|
|
70942
|
-
bStartTagInBody(p,
|
|
70942
|
+
bStartTagInBody(p, token2);
|
|
70943
70943
|
} else if (tn === $.P) {
|
|
70944
|
-
addressStartTagInBody(p,
|
|
70944
|
+
addressStartTagInBody(p, token2);
|
|
70945
70945
|
} else if (tn === $.A) {
|
|
70946
|
-
aStartTagInBody(p,
|
|
70946
|
+
aStartTagInBody(p, token2);
|
|
70947
70947
|
} else {
|
|
70948
|
-
genericStartTagInBody(p,
|
|
70948
|
+
genericStartTagInBody(p, token2);
|
|
70949
70949
|
}
|
|
70950
70950
|
break;
|
|
70951
70951
|
case 2:
|
|
70952
70952
|
if (tn === $.DL || tn === $.OL || tn === $.UL) {
|
|
70953
|
-
addressStartTagInBody(p,
|
|
70953
|
+
addressStartTagInBody(p, token2);
|
|
70954
70954
|
} else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
|
|
70955
|
-
numberedHeaderStartTagInBody(p,
|
|
70955
|
+
numberedHeaderStartTagInBody(p, token2);
|
|
70956
70956
|
} else if (tn === $.LI || tn === $.DD || tn === $.DT) {
|
|
70957
|
-
listItemStartTagInBody(p,
|
|
70957
|
+
listItemStartTagInBody(p, token2);
|
|
70958
70958
|
} else if (tn === $.EM || tn === $.TT) {
|
|
70959
|
-
bStartTagInBody(p,
|
|
70959
|
+
bStartTagInBody(p, token2);
|
|
70960
70960
|
} else if (tn === $.BR) {
|
|
70961
|
-
areaStartTagInBody(p,
|
|
70961
|
+
areaStartTagInBody(p, token2);
|
|
70962
70962
|
} else if (tn === $.HR) {
|
|
70963
|
-
hrStartTagInBody(p,
|
|
70963
|
+
hrStartTagInBody(p, token2);
|
|
70964
70964
|
} else if (tn === $.RB) {
|
|
70965
|
-
rbStartTagInBody(p,
|
|
70965
|
+
rbStartTagInBody(p, token2);
|
|
70966
70966
|
} else if (tn === $.RT || tn === $.RP) {
|
|
70967
|
-
rtStartTagInBody(p,
|
|
70967
|
+
rtStartTagInBody(p, token2);
|
|
70968
70968
|
} else if (tn !== $.TH && tn !== $.TD && tn !== $.TR) {
|
|
70969
|
-
genericStartTagInBody(p,
|
|
70969
|
+
genericStartTagInBody(p, token2);
|
|
70970
70970
|
}
|
|
70971
70971
|
break;
|
|
70972
70972
|
case 3:
|
|
70973
70973
|
if (tn === $.DIV || tn === $.DIR || tn === $.NAV) {
|
|
70974
|
-
addressStartTagInBody(p,
|
|
70974
|
+
addressStartTagInBody(p, token2);
|
|
70975
70975
|
} else if (tn === $.PRE) {
|
|
70976
|
-
preStartTagInBody(p,
|
|
70976
|
+
preStartTagInBody(p, token2);
|
|
70977
70977
|
} else if (tn === $.BIG) {
|
|
70978
|
-
bStartTagInBody(p,
|
|
70978
|
+
bStartTagInBody(p, token2);
|
|
70979
70979
|
} else if (tn === $.IMG || tn === $.WBR) {
|
|
70980
|
-
areaStartTagInBody(p,
|
|
70980
|
+
areaStartTagInBody(p, token2);
|
|
70981
70981
|
} else if (tn === $.XMP) {
|
|
70982
|
-
xmpStartTagInBody(p,
|
|
70982
|
+
xmpStartTagInBody(p, token2);
|
|
70983
70983
|
} else if (tn === $.SVG) {
|
|
70984
|
-
svgStartTagInBody(p,
|
|
70984
|
+
svgStartTagInBody(p, token2);
|
|
70985
70985
|
} else if (tn === $.RTC) {
|
|
70986
|
-
rbStartTagInBody(p,
|
|
70986
|
+
rbStartTagInBody(p, token2);
|
|
70987
70987
|
} else if (tn !== $.COL) {
|
|
70988
|
-
genericStartTagInBody(p,
|
|
70988
|
+
genericStartTagInBody(p, token2);
|
|
70989
70989
|
}
|
|
70990
70990
|
break;
|
|
70991
70991
|
case 4:
|
|
70992
70992
|
if (tn === $.HTML) {
|
|
70993
|
-
htmlStartTagInBody(p,
|
|
70993
|
+
htmlStartTagInBody(p, token2);
|
|
70994
70994
|
} else if (tn === $.BASE || tn === $.LINK || tn === $.META) {
|
|
70995
|
-
startTagInHead(p,
|
|
70995
|
+
startTagInHead(p, token2);
|
|
70996
70996
|
} else if (tn === $.BODY) {
|
|
70997
|
-
bodyStartTagInBody(p,
|
|
70997
|
+
bodyStartTagInBody(p, token2);
|
|
70998
70998
|
} else if (tn === $.MAIN || tn === $.MENU) {
|
|
70999
|
-
addressStartTagInBody(p,
|
|
70999
|
+
addressStartTagInBody(p, token2);
|
|
71000
71000
|
} else if (tn === $.FORM) {
|
|
71001
|
-
formStartTagInBody(p,
|
|
71001
|
+
formStartTagInBody(p, token2);
|
|
71002
71002
|
} else if (tn === $.CODE || tn === $.FONT) {
|
|
71003
|
-
bStartTagInBody(p,
|
|
71003
|
+
bStartTagInBody(p, token2);
|
|
71004
71004
|
} else if (tn === $.NOBR) {
|
|
71005
|
-
nobrStartTagInBody(p,
|
|
71005
|
+
nobrStartTagInBody(p, token2);
|
|
71006
71006
|
} else if (tn === $.AREA) {
|
|
71007
|
-
areaStartTagInBody(p,
|
|
71007
|
+
areaStartTagInBody(p, token2);
|
|
71008
71008
|
} else if (tn === $.MATH) {
|
|
71009
|
-
mathStartTagInBody(p,
|
|
71009
|
+
mathStartTagInBody(p, token2);
|
|
71010
71010
|
} else if (tn === $.MENU) {
|
|
71011
|
-
menuStartTagInBody(p,
|
|
71011
|
+
menuStartTagInBody(p, token2);
|
|
71012
71012
|
} else if (tn !== $.HEAD) {
|
|
71013
|
-
genericStartTagInBody(p,
|
|
71013
|
+
genericStartTagInBody(p, token2);
|
|
71014
71014
|
}
|
|
71015
71015
|
break;
|
|
71016
71016
|
case 5:
|
|
71017
71017
|
if (tn === $.STYLE || tn === $.TITLE) {
|
|
71018
|
-
startTagInHead(p,
|
|
71018
|
+
startTagInHead(p, token2);
|
|
71019
71019
|
} else if (tn === $.ASIDE) {
|
|
71020
|
-
addressStartTagInBody(p,
|
|
71020
|
+
addressStartTagInBody(p, token2);
|
|
71021
71021
|
} else if (tn === $.SMALL) {
|
|
71022
|
-
bStartTagInBody(p,
|
|
71022
|
+
bStartTagInBody(p, token2);
|
|
71023
71023
|
} else if (tn === $.TABLE) {
|
|
71024
|
-
tableStartTagInBody(p,
|
|
71024
|
+
tableStartTagInBody(p, token2);
|
|
71025
71025
|
} else if (tn === $.EMBED) {
|
|
71026
|
-
areaStartTagInBody(p,
|
|
71026
|
+
areaStartTagInBody(p, token2);
|
|
71027
71027
|
} else if (tn === $.INPUT) {
|
|
71028
|
-
inputStartTagInBody(p,
|
|
71028
|
+
inputStartTagInBody(p, token2);
|
|
71029
71029
|
} else if (tn === $.PARAM || tn === $.TRACK) {
|
|
71030
|
-
paramStartTagInBody(p,
|
|
71030
|
+
paramStartTagInBody(p, token2);
|
|
71031
71031
|
} else if (tn === $.IMAGE) {
|
|
71032
|
-
imageStartTagInBody(p,
|
|
71032
|
+
imageStartTagInBody(p, token2);
|
|
71033
71033
|
} else if (tn !== $.FRAME && tn !== $.TBODY && tn !== $.TFOOT && tn !== $.THEAD) {
|
|
71034
|
-
genericStartTagInBody(p,
|
|
71034
|
+
genericStartTagInBody(p, token2);
|
|
71035
71035
|
}
|
|
71036
71036
|
break;
|
|
71037
71037
|
case 6:
|
|
71038
71038
|
if (tn === $.SCRIPT) {
|
|
71039
|
-
startTagInHead(p,
|
|
71039
|
+
startTagInHead(p, token2);
|
|
71040
71040
|
} else if (tn === $.CENTER || tn === $.FIGURE || tn === $.FOOTER || tn === $.HEADER || tn === $.HGROUP || tn === $.DIALOG) {
|
|
71041
|
-
addressStartTagInBody(p,
|
|
71041
|
+
addressStartTagInBody(p, token2);
|
|
71042
71042
|
} else if (tn === $.BUTTON) {
|
|
71043
|
-
buttonStartTagInBody(p,
|
|
71043
|
+
buttonStartTagInBody(p, token2);
|
|
71044
71044
|
} else if (tn === $.STRIKE || tn === $.STRONG) {
|
|
71045
|
-
bStartTagInBody(p,
|
|
71045
|
+
bStartTagInBody(p, token2);
|
|
71046
71046
|
} else if (tn === $.APPLET || tn === $.OBJECT) {
|
|
71047
|
-
appletStartTagInBody(p,
|
|
71047
|
+
appletStartTagInBody(p, token2);
|
|
71048
71048
|
} else if (tn === $.KEYGEN) {
|
|
71049
|
-
areaStartTagInBody(p,
|
|
71049
|
+
areaStartTagInBody(p, token2);
|
|
71050
71050
|
} else if (tn === $.SOURCE) {
|
|
71051
|
-
paramStartTagInBody(p,
|
|
71051
|
+
paramStartTagInBody(p, token2);
|
|
71052
71052
|
} else if (tn === $.IFRAME) {
|
|
71053
|
-
iframeStartTagInBody(p,
|
|
71053
|
+
iframeStartTagInBody(p, token2);
|
|
71054
71054
|
} else if (tn === $.SELECT) {
|
|
71055
|
-
selectStartTagInBody(p,
|
|
71055
|
+
selectStartTagInBody(p, token2);
|
|
71056
71056
|
} else if (tn === $.OPTION) {
|
|
71057
|
-
optgroupStartTagInBody(p,
|
|
71057
|
+
optgroupStartTagInBody(p, token2);
|
|
71058
71058
|
} else {
|
|
71059
|
-
genericStartTagInBody(p,
|
|
71059
|
+
genericStartTagInBody(p, token2);
|
|
71060
71060
|
}
|
|
71061
71061
|
break;
|
|
71062
71062
|
case 7:
|
|
71063
71063
|
if (tn === $.BGSOUND) {
|
|
71064
|
-
startTagInHead(p,
|
|
71064
|
+
startTagInHead(p, token2);
|
|
71065
71065
|
} else if (tn === $.DETAILS || tn === $.ADDRESS || tn === $.ARTICLE || tn === $.SECTION || tn === $.SUMMARY) {
|
|
71066
|
-
addressStartTagInBody(p,
|
|
71066
|
+
addressStartTagInBody(p, token2);
|
|
71067
71067
|
} else if (tn === $.LISTING) {
|
|
71068
|
-
preStartTagInBody(p,
|
|
71068
|
+
preStartTagInBody(p, token2);
|
|
71069
71069
|
} else if (tn === $.MARQUEE) {
|
|
71070
|
-
appletStartTagInBody(p,
|
|
71070
|
+
appletStartTagInBody(p, token2);
|
|
71071
71071
|
} else if (tn === $.NOEMBED) {
|
|
71072
|
-
noembedStartTagInBody(p,
|
|
71072
|
+
noembedStartTagInBody(p, token2);
|
|
71073
71073
|
} else if (tn !== $.CAPTION) {
|
|
71074
|
-
genericStartTagInBody(p,
|
|
71074
|
+
genericStartTagInBody(p, token2);
|
|
71075
71075
|
}
|
|
71076
71076
|
break;
|
|
71077
71077
|
case 8:
|
|
71078
71078
|
if (tn === $.BASEFONT) {
|
|
71079
|
-
startTagInHead(p,
|
|
71079
|
+
startTagInHead(p, token2);
|
|
71080
71080
|
} else if (tn === $.FRAMESET) {
|
|
71081
|
-
framesetStartTagInBody(p,
|
|
71081
|
+
framesetStartTagInBody(p, token2);
|
|
71082
71082
|
} else if (tn === $.FIELDSET) {
|
|
71083
|
-
addressStartTagInBody(p,
|
|
71083
|
+
addressStartTagInBody(p, token2);
|
|
71084
71084
|
} else if (tn === $.TEXTAREA) {
|
|
71085
|
-
textareaStartTagInBody(p,
|
|
71085
|
+
textareaStartTagInBody(p, token2);
|
|
71086
71086
|
} else if (tn === $.TEMPLATE) {
|
|
71087
|
-
startTagInHead(p,
|
|
71087
|
+
startTagInHead(p, token2);
|
|
71088
71088
|
} else if (tn === $.NOSCRIPT) {
|
|
71089
71089
|
if (p.options.scriptingEnabled) {
|
|
71090
|
-
noembedStartTagInBody(p,
|
|
71090
|
+
noembedStartTagInBody(p, token2);
|
|
71091
71091
|
} else {
|
|
71092
|
-
genericStartTagInBody(p,
|
|
71092
|
+
genericStartTagInBody(p, token2);
|
|
71093
71093
|
}
|
|
71094
71094
|
} else if (tn === $.OPTGROUP) {
|
|
71095
|
-
optgroupStartTagInBody(p,
|
|
71095
|
+
optgroupStartTagInBody(p, token2);
|
|
71096
71096
|
} else if (tn !== $.COLGROUP) {
|
|
71097
|
-
genericStartTagInBody(p,
|
|
71097
|
+
genericStartTagInBody(p, token2);
|
|
71098
71098
|
}
|
|
71099
71099
|
break;
|
|
71100
71100
|
case 9:
|
|
71101
71101
|
if (tn === $.PLAINTEXT) {
|
|
71102
|
-
plaintextStartTagInBody(p,
|
|
71102
|
+
plaintextStartTagInBody(p, token2);
|
|
71103
71103
|
} else {
|
|
71104
|
-
genericStartTagInBody(p,
|
|
71104
|
+
genericStartTagInBody(p, token2);
|
|
71105
71105
|
}
|
|
71106
71106
|
break;
|
|
71107
71107
|
case 10:
|
|
71108
71108
|
if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) {
|
|
71109
|
-
addressStartTagInBody(p,
|
|
71109
|
+
addressStartTagInBody(p, token2);
|
|
71110
71110
|
} else {
|
|
71111
|
-
genericStartTagInBody(p,
|
|
71111
|
+
genericStartTagInBody(p, token2);
|
|
71112
71112
|
}
|
|
71113
71113
|
break;
|
|
71114
71114
|
default:
|
|
71115
|
-
genericStartTagInBody(p,
|
|
71115
|
+
genericStartTagInBody(p, token2);
|
|
71116
71116
|
}
|
|
71117
71117
|
}
|
|
71118
71118
|
function bodyEndTagInBody(p) {
|
|
@@ -71120,14 +71120,14 @@ var require_parser = __commonJS({
|
|
|
71120
71120
|
p.insertionMode = AFTER_BODY_MODE;
|
|
71121
71121
|
}
|
|
71122
71122
|
}
|
|
71123
|
-
function htmlEndTagInBody(p,
|
|
71123
|
+
function htmlEndTagInBody(p, token2) {
|
|
71124
71124
|
if (p.openElements.hasInScope($.BODY)) {
|
|
71125
71125
|
p.insertionMode = AFTER_BODY_MODE;
|
|
71126
|
-
p._processToken(
|
|
71126
|
+
p._processToken(token2);
|
|
71127
71127
|
}
|
|
71128
71128
|
}
|
|
71129
|
-
function addressEndTagInBody(p,
|
|
71130
|
-
const tn =
|
|
71129
|
+
function addressEndTagInBody(p, token2) {
|
|
71130
|
+
const tn = token2.tagName;
|
|
71131
71131
|
if (p.openElements.hasInScope(tn)) {
|
|
71132
71132
|
p.openElements.generateImpliedEndTags();
|
|
71133
71133
|
p.openElements.popUntilTagNamePopped(tn);
|
|
@@ -71160,8 +71160,8 @@ var require_parser = __commonJS({
|
|
|
71160
71160
|
p.openElements.popUntilTagNamePopped($.LI);
|
|
71161
71161
|
}
|
|
71162
71162
|
}
|
|
71163
|
-
function ddEndTagInBody(p,
|
|
71164
|
-
const tn =
|
|
71163
|
+
function ddEndTagInBody(p, token2) {
|
|
71164
|
+
const tn = token2.tagName;
|
|
71165
71165
|
if (p.openElements.hasInScope(tn)) {
|
|
71166
71166
|
p.openElements.generateImpliedEndTagsWithExclusion(tn);
|
|
71167
71167
|
p.openElements.popUntilTagNamePopped(tn);
|
|
@@ -71173,8 +71173,8 @@ var require_parser = __commonJS({
|
|
|
71173
71173
|
p.openElements.popUntilNumberedHeaderPopped();
|
|
71174
71174
|
}
|
|
71175
71175
|
}
|
|
71176
|
-
function appletEndTagInBody(p,
|
|
71177
|
-
const tn =
|
|
71176
|
+
function appletEndTagInBody(p, token2) {
|
|
71177
|
+
const tn = token2.tagName;
|
|
71178
71178
|
if (p.openElements.hasInScope(tn)) {
|
|
71179
71179
|
p.openElements.generateImpliedEndTags();
|
|
71180
71180
|
p.openElements.popUntilTagNamePopped(tn);
|
|
@@ -71187,8 +71187,8 @@ var require_parser = __commonJS({
|
|
|
71187
71187
|
p.openElements.pop();
|
|
71188
71188
|
p.framesetOk = false;
|
|
71189
71189
|
}
|
|
71190
|
-
function genericEndTagInBody(p,
|
|
71191
|
-
const tn =
|
|
71190
|
+
function genericEndTagInBody(p, token2) {
|
|
71191
|
+
const tn = token2.tagName;
|
|
71192
71192
|
for (let i = p.openElements.stackTop; i > 0; i--) {
|
|
71193
71193
|
const element = p.openElements.items[i];
|
|
71194
71194
|
if (p.treeAdapter.getTagName(element) === tn) {
|
|
@@ -71201,282 +71201,282 @@ var require_parser = __commonJS({
|
|
|
71201
71201
|
}
|
|
71202
71202
|
}
|
|
71203
71203
|
}
|
|
71204
|
-
function endTagInBody(p,
|
|
71205
|
-
const tn =
|
|
71204
|
+
function endTagInBody(p, token2) {
|
|
71205
|
+
const tn = token2.tagName;
|
|
71206
71206
|
switch (tn.length) {
|
|
71207
71207
|
case 1:
|
|
71208
71208
|
if (tn === $.A || tn === $.B || tn === $.I || tn === $.S || tn === $.U) {
|
|
71209
|
-
callAdoptionAgency(p,
|
|
71209
|
+
callAdoptionAgency(p, token2);
|
|
71210
71210
|
} else if (tn === $.P) {
|
|
71211
|
-
pEndTagInBody(p,
|
|
71211
|
+
pEndTagInBody(p, token2);
|
|
71212
71212
|
} else {
|
|
71213
|
-
genericEndTagInBody(p,
|
|
71213
|
+
genericEndTagInBody(p, token2);
|
|
71214
71214
|
}
|
|
71215
71215
|
break;
|
|
71216
71216
|
case 2:
|
|
71217
71217
|
if (tn === $.DL || tn === $.UL || tn === $.OL) {
|
|
71218
|
-
addressEndTagInBody(p,
|
|
71218
|
+
addressEndTagInBody(p, token2);
|
|
71219
71219
|
} else if (tn === $.LI) {
|
|
71220
|
-
liEndTagInBody(p,
|
|
71220
|
+
liEndTagInBody(p, token2);
|
|
71221
71221
|
} else if (tn === $.DD || tn === $.DT) {
|
|
71222
|
-
ddEndTagInBody(p,
|
|
71222
|
+
ddEndTagInBody(p, token2);
|
|
71223
71223
|
} else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
|
|
71224
|
-
numberedHeaderEndTagInBody(p,
|
|
71224
|
+
numberedHeaderEndTagInBody(p, token2);
|
|
71225
71225
|
} else if (tn === $.BR) {
|
|
71226
|
-
brEndTagInBody(p,
|
|
71226
|
+
brEndTagInBody(p, token2);
|
|
71227
71227
|
} else if (tn === $.EM || tn === $.TT) {
|
|
71228
|
-
callAdoptionAgency(p,
|
|
71228
|
+
callAdoptionAgency(p, token2);
|
|
71229
71229
|
} else {
|
|
71230
|
-
genericEndTagInBody(p,
|
|
71230
|
+
genericEndTagInBody(p, token2);
|
|
71231
71231
|
}
|
|
71232
71232
|
break;
|
|
71233
71233
|
case 3:
|
|
71234
71234
|
if (tn === $.BIG) {
|
|
71235
|
-
callAdoptionAgency(p,
|
|
71235
|
+
callAdoptionAgency(p, token2);
|
|
71236
71236
|
} else if (tn === $.DIR || tn === $.DIV || tn === $.NAV || tn === $.PRE) {
|
|
71237
|
-
addressEndTagInBody(p,
|
|
71237
|
+
addressEndTagInBody(p, token2);
|
|
71238
71238
|
} else {
|
|
71239
|
-
genericEndTagInBody(p,
|
|
71239
|
+
genericEndTagInBody(p, token2);
|
|
71240
71240
|
}
|
|
71241
71241
|
break;
|
|
71242
71242
|
case 4:
|
|
71243
71243
|
if (tn === $.BODY) {
|
|
71244
|
-
bodyEndTagInBody(p,
|
|
71244
|
+
bodyEndTagInBody(p, token2);
|
|
71245
71245
|
} else if (tn === $.HTML) {
|
|
71246
|
-
htmlEndTagInBody(p,
|
|
71246
|
+
htmlEndTagInBody(p, token2);
|
|
71247
71247
|
} else if (tn === $.FORM) {
|
|
71248
|
-
formEndTagInBody(p,
|
|
71248
|
+
formEndTagInBody(p, token2);
|
|
71249
71249
|
} else if (tn === $.CODE || tn === $.FONT || tn === $.NOBR) {
|
|
71250
|
-
callAdoptionAgency(p,
|
|
71250
|
+
callAdoptionAgency(p, token2);
|
|
71251
71251
|
} else if (tn === $.MAIN || tn === $.MENU) {
|
|
71252
|
-
addressEndTagInBody(p,
|
|
71252
|
+
addressEndTagInBody(p, token2);
|
|
71253
71253
|
} else {
|
|
71254
|
-
genericEndTagInBody(p,
|
|
71254
|
+
genericEndTagInBody(p, token2);
|
|
71255
71255
|
}
|
|
71256
71256
|
break;
|
|
71257
71257
|
case 5:
|
|
71258
71258
|
if (tn === $.ASIDE) {
|
|
71259
|
-
addressEndTagInBody(p,
|
|
71259
|
+
addressEndTagInBody(p, token2);
|
|
71260
71260
|
} else if (tn === $.SMALL) {
|
|
71261
|
-
callAdoptionAgency(p,
|
|
71261
|
+
callAdoptionAgency(p, token2);
|
|
71262
71262
|
} else {
|
|
71263
|
-
genericEndTagInBody(p,
|
|
71263
|
+
genericEndTagInBody(p, token2);
|
|
71264
71264
|
}
|
|
71265
71265
|
break;
|
|
71266
71266
|
case 6:
|
|
71267
71267
|
if (tn === $.CENTER || tn === $.FIGURE || tn === $.FOOTER || tn === $.HEADER || tn === $.HGROUP || tn === $.DIALOG) {
|
|
71268
|
-
addressEndTagInBody(p,
|
|
71268
|
+
addressEndTagInBody(p, token2);
|
|
71269
71269
|
} else if (tn === $.APPLET || tn === $.OBJECT) {
|
|
71270
|
-
appletEndTagInBody(p,
|
|
71270
|
+
appletEndTagInBody(p, token2);
|
|
71271
71271
|
} else if (tn === $.STRIKE || tn === $.STRONG) {
|
|
71272
|
-
callAdoptionAgency(p,
|
|
71272
|
+
callAdoptionAgency(p, token2);
|
|
71273
71273
|
} else {
|
|
71274
|
-
genericEndTagInBody(p,
|
|
71274
|
+
genericEndTagInBody(p, token2);
|
|
71275
71275
|
}
|
|
71276
71276
|
break;
|
|
71277
71277
|
case 7:
|
|
71278
71278
|
if (tn === $.ADDRESS || tn === $.ARTICLE || tn === $.DETAILS || tn === $.SECTION || tn === $.SUMMARY || tn === $.LISTING) {
|
|
71279
|
-
addressEndTagInBody(p,
|
|
71279
|
+
addressEndTagInBody(p, token2);
|
|
71280
71280
|
} else if (tn === $.MARQUEE) {
|
|
71281
|
-
appletEndTagInBody(p,
|
|
71281
|
+
appletEndTagInBody(p, token2);
|
|
71282
71282
|
} else {
|
|
71283
|
-
genericEndTagInBody(p,
|
|
71283
|
+
genericEndTagInBody(p, token2);
|
|
71284
71284
|
}
|
|
71285
71285
|
break;
|
|
71286
71286
|
case 8:
|
|
71287
71287
|
if (tn === $.FIELDSET) {
|
|
71288
|
-
addressEndTagInBody(p,
|
|
71288
|
+
addressEndTagInBody(p, token2);
|
|
71289
71289
|
} else if (tn === $.TEMPLATE) {
|
|
71290
|
-
endTagInHead(p,
|
|
71290
|
+
endTagInHead(p, token2);
|
|
71291
71291
|
} else {
|
|
71292
|
-
genericEndTagInBody(p,
|
|
71292
|
+
genericEndTagInBody(p, token2);
|
|
71293
71293
|
}
|
|
71294
71294
|
break;
|
|
71295
71295
|
case 10:
|
|
71296
71296
|
if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) {
|
|
71297
|
-
addressEndTagInBody(p,
|
|
71297
|
+
addressEndTagInBody(p, token2);
|
|
71298
71298
|
} else {
|
|
71299
|
-
genericEndTagInBody(p,
|
|
71299
|
+
genericEndTagInBody(p, token2);
|
|
71300
71300
|
}
|
|
71301
71301
|
break;
|
|
71302
71302
|
default:
|
|
71303
|
-
genericEndTagInBody(p,
|
|
71303
|
+
genericEndTagInBody(p, token2);
|
|
71304
71304
|
}
|
|
71305
71305
|
}
|
|
71306
|
-
function eofInBody(p,
|
|
71306
|
+
function eofInBody(p, token2) {
|
|
71307
71307
|
if (p.tmplInsertionModeStackTop > -1) {
|
|
71308
|
-
eofInTemplate(p,
|
|
71308
|
+
eofInTemplate(p, token2);
|
|
71309
71309
|
} else {
|
|
71310
71310
|
p.stopped = true;
|
|
71311
71311
|
}
|
|
71312
71312
|
}
|
|
71313
|
-
function endTagInText(p,
|
|
71314
|
-
if (
|
|
71313
|
+
function endTagInText(p, token2) {
|
|
71314
|
+
if (token2.tagName === $.SCRIPT) {
|
|
71315
71315
|
p.pendingScript = p.openElements.current;
|
|
71316
71316
|
}
|
|
71317
71317
|
p.openElements.pop();
|
|
71318
71318
|
p.insertionMode = p.originalInsertionMode;
|
|
71319
71319
|
}
|
|
71320
|
-
function eofInText(p,
|
|
71320
|
+
function eofInText(p, token2) {
|
|
71321
71321
|
p._err(ERR.eofInElementThatCanContainOnlyText);
|
|
71322
71322
|
p.openElements.pop();
|
|
71323
71323
|
p.insertionMode = p.originalInsertionMode;
|
|
71324
|
-
p._processToken(
|
|
71324
|
+
p._processToken(token2);
|
|
71325
71325
|
}
|
|
71326
|
-
function characterInTable(p,
|
|
71326
|
+
function characterInTable(p, token2) {
|
|
71327
71327
|
const curTn = p.openElements.currentTagName;
|
|
71328
71328
|
if (curTn === $.TABLE || curTn === $.TBODY || curTn === $.TFOOT || curTn === $.THEAD || curTn === $.TR) {
|
|
71329
71329
|
p.pendingCharacterTokens = [];
|
|
71330
71330
|
p.hasNonWhitespacePendingCharacterToken = false;
|
|
71331
71331
|
p.originalInsertionMode = p.insertionMode;
|
|
71332
71332
|
p.insertionMode = IN_TABLE_TEXT_MODE;
|
|
71333
|
-
p._processToken(
|
|
71333
|
+
p._processToken(token2);
|
|
71334
71334
|
} else {
|
|
71335
|
-
tokenInTable(p,
|
|
71335
|
+
tokenInTable(p, token2);
|
|
71336
71336
|
}
|
|
71337
71337
|
}
|
|
71338
|
-
function captionStartTagInTable(p,
|
|
71338
|
+
function captionStartTagInTable(p, token2) {
|
|
71339
71339
|
p.openElements.clearBackToTableContext();
|
|
71340
71340
|
p.activeFormattingElements.insertMarker();
|
|
71341
|
-
p._insertElement(
|
|
71341
|
+
p._insertElement(token2, NS.HTML);
|
|
71342
71342
|
p.insertionMode = IN_CAPTION_MODE;
|
|
71343
71343
|
}
|
|
71344
|
-
function colgroupStartTagInTable(p,
|
|
71344
|
+
function colgroupStartTagInTable(p, token2) {
|
|
71345
71345
|
p.openElements.clearBackToTableContext();
|
|
71346
|
-
p._insertElement(
|
|
71346
|
+
p._insertElement(token2, NS.HTML);
|
|
71347
71347
|
p.insertionMode = IN_COLUMN_GROUP_MODE;
|
|
71348
71348
|
}
|
|
71349
|
-
function colStartTagInTable(p,
|
|
71349
|
+
function colStartTagInTable(p, token2) {
|
|
71350
71350
|
p.openElements.clearBackToTableContext();
|
|
71351
71351
|
p._insertFakeElement($.COLGROUP);
|
|
71352
71352
|
p.insertionMode = IN_COLUMN_GROUP_MODE;
|
|
71353
|
-
p._processToken(
|
|
71353
|
+
p._processToken(token2);
|
|
71354
71354
|
}
|
|
71355
|
-
function tbodyStartTagInTable(p,
|
|
71355
|
+
function tbodyStartTagInTable(p, token2) {
|
|
71356
71356
|
p.openElements.clearBackToTableContext();
|
|
71357
|
-
p._insertElement(
|
|
71357
|
+
p._insertElement(token2, NS.HTML);
|
|
71358
71358
|
p.insertionMode = IN_TABLE_BODY_MODE;
|
|
71359
71359
|
}
|
|
71360
|
-
function tdStartTagInTable(p,
|
|
71360
|
+
function tdStartTagInTable(p, token2) {
|
|
71361
71361
|
p.openElements.clearBackToTableContext();
|
|
71362
71362
|
p._insertFakeElement($.TBODY);
|
|
71363
71363
|
p.insertionMode = IN_TABLE_BODY_MODE;
|
|
71364
|
-
p._processToken(
|
|
71364
|
+
p._processToken(token2);
|
|
71365
71365
|
}
|
|
71366
|
-
function tableStartTagInTable(p,
|
|
71366
|
+
function tableStartTagInTable(p, token2) {
|
|
71367
71367
|
if (p.openElements.hasInTableScope($.TABLE)) {
|
|
71368
71368
|
p.openElements.popUntilTagNamePopped($.TABLE);
|
|
71369
71369
|
p._resetInsertionMode();
|
|
71370
|
-
p._processToken(
|
|
71370
|
+
p._processToken(token2);
|
|
71371
71371
|
}
|
|
71372
71372
|
}
|
|
71373
|
-
function inputStartTagInTable(p,
|
|
71374
|
-
const inputType = Tokenizer.getTokenAttr(
|
|
71373
|
+
function inputStartTagInTable(p, token2) {
|
|
71374
|
+
const inputType = Tokenizer.getTokenAttr(token2, ATTRS.TYPE);
|
|
71375
71375
|
if (inputType && inputType.toLowerCase() === HIDDEN_INPUT_TYPE) {
|
|
71376
|
-
p._appendElement(
|
|
71376
|
+
p._appendElement(token2, NS.HTML);
|
|
71377
71377
|
} else {
|
|
71378
|
-
tokenInTable(p,
|
|
71378
|
+
tokenInTable(p, token2);
|
|
71379
71379
|
}
|
|
71380
|
-
|
|
71380
|
+
token2.ackSelfClosing = true;
|
|
71381
71381
|
}
|
|
71382
|
-
function formStartTagInTable(p,
|
|
71382
|
+
function formStartTagInTable(p, token2) {
|
|
71383
71383
|
if (!p.formElement && p.openElements.tmplCount === 0) {
|
|
71384
|
-
p._insertElement(
|
|
71384
|
+
p._insertElement(token2, NS.HTML);
|
|
71385
71385
|
p.formElement = p.openElements.current;
|
|
71386
71386
|
p.openElements.pop();
|
|
71387
71387
|
}
|
|
71388
71388
|
}
|
|
71389
|
-
function startTagInTable(p,
|
|
71390
|
-
const tn =
|
|
71389
|
+
function startTagInTable(p, token2) {
|
|
71390
|
+
const tn = token2.tagName;
|
|
71391
71391
|
switch (tn.length) {
|
|
71392
71392
|
case 2:
|
|
71393
71393
|
if (tn === $.TD || tn === $.TH || tn === $.TR) {
|
|
71394
|
-
tdStartTagInTable(p,
|
|
71394
|
+
tdStartTagInTable(p, token2);
|
|
71395
71395
|
} else {
|
|
71396
|
-
tokenInTable(p,
|
|
71396
|
+
tokenInTable(p, token2);
|
|
71397
71397
|
}
|
|
71398
71398
|
break;
|
|
71399
71399
|
case 3:
|
|
71400
71400
|
if (tn === $.COL) {
|
|
71401
|
-
colStartTagInTable(p,
|
|
71401
|
+
colStartTagInTable(p, token2);
|
|
71402
71402
|
} else {
|
|
71403
|
-
tokenInTable(p,
|
|
71403
|
+
tokenInTable(p, token2);
|
|
71404
71404
|
}
|
|
71405
71405
|
break;
|
|
71406
71406
|
case 4:
|
|
71407
71407
|
if (tn === $.FORM) {
|
|
71408
|
-
formStartTagInTable(p,
|
|
71408
|
+
formStartTagInTable(p, token2);
|
|
71409
71409
|
} else {
|
|
71410
|
-
tokenInTable(p,
|
|
71410
|
+
tokenInTable(p, token2);
|
|
71411
71411
|
}
|
|
71412
71412
|
break;
|
|
71413
71413
|
case 5:
|
|
71414
71414
|
if (tn === $.TABLE) {
|
|
71415
|
-
tableStartTagInTable(p,
|
|
71415
|
+
tableStartTagInTable(p, token2);
|
|
71416
71416
|
} else if (tn === $.STYLE) {
|
|
71417
|
-
startTagInHead(p,
|
|
71417
|
+
startTagInHead(p, token2);
|
|
71418
71418
|
} else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
|
71419
|
-
tbodyStartTagInTable(p,
|
|
71419
|
+
tbodyStartTagInTable(p, token2);
|
|
71420
71420
|
} else if (tn === $.INPUT) {
|
|
71421
|
-
inputStartTagInTable(p,
|
|
71421
|
+
inputStartTagInTable(p, token2);
|
|
71422
71422
|
} else {
|
|
71423
|
-
tokenInTable(p,
|
|
71423
|
+
tokenInTable(p, token2);
|
|
71424
71424
|
}
|
|
71425
71425
|
break;
|
|
71426
71426
|
case 6:
|
|
71427
71427
|
if (tn === $.SCRIPT) {
|
|
71428
|
-
startTagInHead(p,
|
|
71428
|
+
startTagInHead(p, token2);
|
|
71429
71429
|
} else {
|
|
71430
|
-
tokenInTable(p,
|
|
71430
|
+
tokenInTable(p, token2);
|
|
71431
71431
|
}
|
|
71432
71432
|
break;
|
|
71433
71433
|
case 7:
|
|
71434
71434
|
if (tn === $.CAPTION) {
|
|
71435
|
-
captionStartTagInTable(p,
|
|
71435
|
+
captionStartTagInTable(p, token2);
|
|
71436
71436
|
} else {
|
|
71437
|
-
tokenInTable(p,
|
|
71437
|
+
tokenInTable(p, token2);
|
|
71438
71438
|
}
|
|
71439
71439
|
break;
|
|
71440
71440
|
case 8:
|
|
71441
71441
|
if (tn === $.COLGROUP) {
|
|
71442
|
-
colgroupStartTagInTable(p,
|
|
71442
|
+
colgroupStartTagInTable(p, token2);
|
|
71443
71443
|
} else if (tn === $.TEMPLATE) {
|
|
71444
|
-
startTagInHead(p,
|
|
71444
|
+
startTagInHead(p, token2);
|
|
71445
71445
|
} else {
|
|
71446
|
-
tokenInTable(p,
|
|
71446
|
+
tokenInTable(p, token2);
|
|
71447
71447
|
}
|
|
71448
71448
|
break;
|
|
71449
71449
|
default:
|
|
71450
|
-
tokenInTable(p,
|
|
71450
|
+
tokenInTable(p, token2);
|
|
71451
71451
|
}
|
|
71452
71452
|
}
|
|
71453
|
-
function endTagInTable(p,
|
|
71454
|
-
const tn =
|
|
71453
|
+
function endTagInTable(p, token2) {
|
|
71454
|
+
const tn = token2.tagName;
|
|
71455
71455
|
if (tn === $.TABLE) {
|
|
71456
71456
|
if (p.openElements.hasInTableScope($.TABLE)) {
|
|
71457
71457
|
p.openElements.popUntilTagNamePopped($.TABLE);
|
|
71458
71458
|
p._resetInsertionMode();
|
|
71459
71459
|
}
|
|
71460
71460
|
} else if (tn === $.TEMPLATE) {
|
|
71461
|
-
endTagInHead(p,
|
|
71461
|
+
endTagInHead(p, token2);
|
|
71462
71462
|
} else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML && tn !== $.TBODY && tn !== $.TD && tn !== $.TFOOT && tn !== $.TH && tn !== $.THEAD && tn !== $.TR) {
|
|
71463
|
-
tokenInTable(p,
|
|
71463
|
+
tokenInTable(p, token2);
|
|
71464
71464
|
}
|
|
71465
71465
|
}
|
|
71466
|
-
function tokenInTable(p,
|
|
71466
|
+
function tokenInTable(p, token2) {
|
|
71467
71467
|
const savedFosterParentingState = p.fosterParentingEnabled;
|
|
71468
71468
|
p.fosterParentingEnabled = true;
|
|
71469
|
-
p._processTokenInBodyMode(
|
|
71469
|
+
p._processTokenInBodyMode(token2);
|
|
71470
71470
|
p.fosterParentingEnabled = savedFosterParentingState;
|
|
71471
71471
|
}
|
|
71472
|
-
function whitespaceCharacterInTableText(p,
|
|
71473
|
-
p.pendingCharacterTokens.push(
|
|
71472
|
+
function whitespaceCharacterInTableText(p, token2) {
|
|
71473
|
+
p.pendingCharacterTokens.push(token2);
|
|
71474
71474
|
}
|
|
71475
|
-
function characterInTableText(p,
|
|
71476
|
-
p.pendingCharacterTokens.push(
|
|
71475
|
+
function characterInTableText(p, token2) {
|
|
71476
|
+
p.pendingCharacterTokens.push(token2);
|
|
71477
71477
|
p.hasNonWhitespacePendingCharacterToken = true;
|
|
71478
71478
|
}
|
|
71479
|
-
function tokenInTableText(p,
|
|
71479
|
+
function tokenInTableText(p, token2) {
|
|
71480
71480
|
let i = 0;
|
|
71481
71481
|
if (p.hasNonWhitespacePendingCharacterToken) {
|
|
71482
71482
|
for (; i < p.pendingCharacterTokens.length; i++) {
|
|
@@ -71488,24 +71488,24 @@ var require_parser = __commonJS({
|
|
|
71488
71488
|
}
|
|
71489
71489
|
}
|
|
71490
71490
|
p.insertionMode = p.originalInsertionMode;
|
|
71491
|
-
p._processToken(
|
|
71491
|
+
p._processToken(token2);
|
|
71492
71492
|
}
|
|
71493
|
-
function startTagInCaption(p,
|
|
71494
|
-
const tn =
|
|
71493
|
+
function startTagInCaption(p, token2) {
|
|
71494
|
+
const tn = token2.tagName;
|
|
71495
71495
|
if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || tn === $.TD || tn === $.TFOOT || tn === $.TH || tn === $.THEAD || tn === $.TR) {
|
|
71496
71496
|
if (p.openElements.hasInTableScope($.CAPTION)) {
|
|
71497
71497
|
p.openElements.generateImpliedEndTags();
|
|
71498
71498
|
p.openElements.popUntilTagNamePopped($.CAPTION);
|
|
71499
71499
|
p.activeFormattingElements.clearToLastMarker();
|
|
71500
71500
|
p.insertionMode = IN_TABLE_MODE;
|
|
71501
|
-
p._processToken(
|
|
71501
|
+
p._processToken(token2);
|
|
71502
71502
|
}
|
|
71503
71503
|
} else {
|
|
71504
|
-
startTagInBody(p,
|
|
71504
|
+
startTagInBody(p, token2);
|
|
71505
71505
|
}
|
|
71506
71506
|
}
|
|
71507
|
-
function endTagInCaption(p,
|
|
71508
|
-
const tn =
|
|
71507
|
+
function endTagInCaption(p, token2) {
|
|
71508
|
+
const tn = token2.tagName;
|
|
71509
71509
|
if (tn === $.CAPTION || tn === $.TABLE) {
|
|
71510
71510
|
if (p.openElements.hasInTableScope($.CAPTION)) {
|
|
71511
71511
|
p.openElements.generateImpliedEndTags();
|
|
@@ -71513,70 +71513,70 @@ var require_parser = __commonJS({
|
|
|
71513
71513
|
p.activeFormattingElements.clearToLastMarker();
|
|
71514
71514
|
p.insertionMode = IN_TABLE_MODE;
|
|
71515
71515
|
if (tn === $.TABLE) {
|
|
71516
|
-
p._processToken(
|
|
71516
|
+
p._processToken(token2);
|
|
71517
71517
|
}
|
|
71518
71518
|
}
|
|
71519
71519
|
} else if (tn !== $.BODY && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML && tn !== $.TBODY && tn !== $.TD && tn !== $.TFOOT && tn !== $.TH && tn !== $.THEAD && tn !== $.TR) {
|
|
71520
|
-
endTagInBody(p,
|
|
71520
|
+
endTagInBody(p, token2);
|
|
71521
71521
|
}
|
|
71522
71522
|
}
|
|
71523
|
-
function startTagInColumnGroup(p,
|
|
71524
|
-
const tn =
|
|
71523
|
+
function startTagInColumnGroup(p, token2) {
|
|
71524
|
+
const tn = token2.tagName;
|
|
71525
71525
|
if (tn === $.HTML) {
|
|
71526
|
-
startTagInBody(p,
|
|
71526
|
+
startTagInBody(p, token2);
|
|
71527
71527
|
} else if (tn === $.COL) {
|
|
71528
|
-
p._appendElement(
|
|
71529
|
-
|
|
71528
|
+
p._appendElement(token2, NS.HTML);
|
|
71529
|
+
token2.ackSelfClosing = true;
|
|
71530
71530
|
} else if (tn === $.TEMPLATE) {
|
|
71531
|
-
startTagInHead(p,
|
|
71531
|
+
startTagInHead(p, token2);
|
|
71532
71532
|
} else {
|
|
71533
|
-
tokenInColumnGroup(p,
|
|
71533
|
+
tokenInColumnGroup(p, token2);
|
|
71534
71534
|
}
|
|
71535
71535
|
}
|
|
71536
|
-
function endTagInColumnGroup(p,
|
|
71537
|
-
const tn =
|
|
71536
|
+
function endTagInColumnGroup(p, token2) {
|
|
71537
|
+
const tn = token2.tagName;
|
|
71538
71538
|
if (tn === $.COLGROUP) {
|
|
71539
71539
|
if (p.openElements.currentTagName === $.COLGROUP) {
|
|
71540
71540
|
p.openElements.pop();
|
|
71541
71541
|
p.insertionMode = IN_TABLE_MODE;
|
|
71542
71542
|
}
|
|
71543
71543
|
} else if (tn === $.TEMPLATE) {
|
|
71544
|
-
endTagInHead(p,
|
|
71544
|
+
endTagInHead(p, token2);
|
|
71545
71545
|
} else if (tn !== $.COL) {
|
|
71546
|
-
tokenInColumnGroup(p,
|
|
71546
|
+
tokenInColumnGroup(p, token2);
|
|
71547
71547
|
}
|
|
71548
71548
|
}
|
|
71549
|
-
function tokenInColumnGroup(p,
|
|
71549
|
+
function tokenInColumnGroup(p, token2) {
|
|
71550
71550
|
if (p.openElements.currentTagName === $.COLGROUP) {
|
|
71551
71551
|
p.openElements.pop();
|
|
71552
71552
|
p.insertionMode = IN_TABLE_MODE;
|
|
71553
|
-
p._processToken(
|
|
71553
|
+
p._processToken(token2);
|
|
71554
71554
|
}
|
|
71555
71555
|
}
|
|
71556
|
-
function startTagInTableBody(p,
|
|
71557
|
-
const tn =
|
|
71556
|
+
function startTagInTableBody(p, token2) {
|
|
71557
|
+
const tn = token2.tagName;
|
|
71558
71558
|
if (tn === $.TR) {
|
|
71559
71559
|
p.openElements.clearBackToTableBodyContext();
|
|
71560
|
-
p._insertElement(
|
|
71560
|
+
p._insertElement(token2, NS.HTML);
|
|
71561
71561
|
p.insertionMode = IN_ROW_MODE;
|
|
71562
71562
|
} else if (tn === $.TH || tn === $.TD) {
|
|
71563
71563
|
p.openElements.clearBackToTableBodyContext();
|
|
71564
71564
|
p._insertFakeElement($.TR);
|
|
71565
71565
|
p.insertionMode = IN_ROW_MODE;
|
|
71566
|
-
p._processToken(
|
|
71566
|
+
p._processToken(token2);
|
|
71567
71567
|
} else if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
|
71568
71568
|
if (p.openElements.hasTableBodyContextInTableScope()) {
|
|
71569
71569
|
p.openElements.clearBackToTableBodyContext();
|
|
71570
71570
|
p.openElements.pop();
|
|
71571
71571
|
p.insertionMode = IN_TABLE_MODE;
|
|
71572
|
-
p._processToken(
|
|
71572
|
+
p._processToken(token2);
|
|
71573
71573
|
}
|
|
71574
71574
|
} else {
|
|
71575
|
-
startTagInTable(p,
|
|
71575
|
+
startTagInTable(p, token2);
|
|
71576
71576
|
}
|
|
71577
71577
|
}
|
|
71578
|
-
function endTagInTableBody(p,
|
|
71579
|
-
const tn =
|
|
71578
|
+
function endTagInTableBody(p, token2) {
|
|
71579
|
+
const tn = token2.tagName;
|
|
71580
71580
|
if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
|
71581
71581
|
if (p.openElements.hasInTableScope(tn)) {
|
|
71582
71582
|
p.openElements.clearBackToTableBodyContext();
|
|
@@ -71588,17 +71588,17 @@ var require_parser = __commonJS({
|
|
|
71588
71588
|
p.openElements.clearBackToTableBodyContext();
|
|
71589
71589
|
p.openElements.pop();
|
|
71590
71590
|
p.insertionMode = IN_TABLE_MODE;
|
|
71591
|
-
p._processToken(
|
|
71591
|
+
p._processToken(token2);
|
|
71592
71592
|
}
|
|
71593
71593
|
} else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP || tn !== $.HTML && tn !== $.TD && tn !== $.TH && tn !== $.TR) {
|
|
71594
|
-
endTagInTable(p,
|
|
71594
|
+
endTagInTable(p, token2);
|
|
71595
71595
|
}
|
|
71596
71596
|
}
|
|
71597
|
-
function startTagInRow(p,
|
|
71598
|
-
const tn =
|
|
71597
|
+
function startTagInRow(p, token2) {
|
|
71598
|
+
const tn = token2.tagName;
|
|
71599
71599
|
if (tn === $.TH || tn === $.TD) {
|
|
71600
71600
|
p.openElements.clearBackToTableRowContext();
|
|
71601
|
-
p._insertElement(
|
|
71601
|
+
p._insertElement(token2, NS.HTML);
|
|
71602
71602
|
p.insertionMode = IN_CELL_MODE;
|
|
71603
71603
|
p.activeFormattingElements.insertMarker();
|
|
71604
71604
|
} else if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR) {
|
|
@@ -71606,14 +71606,14 @@ var require_parser = __commonJS({
|
|
|
71606
71606
|
p.openElements.clearBackToTableRowContext();
|
|
71607
71607
|
p.openElements.pop();
|
|
71608
71608
|
p.insertionMode = IN_TABLE_BODY_MODE;
|
|
71609
|
-
p._processToken(
|
|
71609
|
+
p._processToken(token2);
|
|
71610
71610
|
}
|
|
71611
71611
|
} else {
|
|
71612
|
-
startTagInTable(p,
|
|
71612
|
+
startTagInTable(p, token2);
|
|
71613
71613
|
}
|
|
71614
71614
|
}
|
|
71615
|
-
function endTagInRow(p,
|
|
71616
|
-
const tn =
|
|
71615
|
+
function endTagInRow(p, token2) {
|
|
71616
|
+
const tn = token2.tagName;
|
|
71617
71617
|
if (tn === $.TR) {
|
|
71618
71618
|
if (p.openElements.hasInTableScope($.TR)) {
|
|
71619
71619
|
p.openElements.clearBackToTableRowContext();
|
|
@@ -71625,32 +71625,32 @@ var require_parser = __commonJS({
|
|
|
71625
71625
|
p.openElements.clearBackToTableRowContext();
|
|
71626
71626
|
p.openElements.pop();
|
|
71627
71627
|
p.insertionMode = IN_TABLE_BODY_MODE;
|
|
71628
|
-
p._processToken(
|
|
71628
|
+
p._processToken(token2);
|
|
71629
71629
|
}
|
|
71630
71630
|
} else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
|
71631
71631
|
if (p.openElements.hasInTableScope(tn) || p.openElements.hasInTableScope($.TR)) {
|
|
71632
71632
|
p.openElements.clearBackToTableRowContext();
|
|
71633
71633
|
p.openElements.pop();
|
|
71634
71634
|
p.insertionMode = IN_TABLE_BODY_MODE;
|
|
71635
|
-
p._processToken(
|
|
71635
|
+
p._processToken(token2);
|
|
71636
71636
|
}
|
|
71637
71637
|
} else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP || tn !== $.HTML && tn !== $.TD && tn !== $.TH) {
|
|
71638
|
-
endTagInTable(p,
|
|
71638
|
+
endTagInTable(p, token2);
|
|
71639
71639
|
}
|
|
71640
71640
|
}
|
|
71641
|
-
function startTagInCell(p,
|
|
71642
|
-
const tn =
|
|
71641
|
+
function startTagInCell(p, token2) {
|
|
71642
|
+
const tn = token2.tagName;
|
|
71643
71643
|
if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || tn === $.TD || tn === $.TFOOT || tn === $.TH || tn === $.THEAD || tn === $.TR) {
|
|
71644
71644
|
if (p.openElements.hasInTableScope($.TD) || p.openElements.hasInTableScope($.TH)) {
|
|
71645
71645
|
p._closeTableCell();
|
|
71646
|
-
p._processToken(
|
|
71646
|
+
p._processToken(token2);
|
|
71647
71647
|
}
|
|
71648
71648
|
} else {
|
|
71649
|
-
startTagInBody(p,
|
|
71649
|
+
startTagInBody(p, token2);
|
|
71650
71650
|
}
|
|
71651
71651
|
}
|
|
71652
|
-
function endTagInCell(p,
|
|
71653
|
-
const tn =
|
|
71652
|
+
function endTagInCell(p, token2) {
|
|
71653
|
+
const tn = token2.tagName;
|
|
71654
71654
|
if (tn === $.TD || tn === $.TH) {
|
|
71655
71655
|
if (p.openElements.hasInTableScope(tn)) {
|
|
71656
71656
|
p.openElements.generateImpliedEndTags();
|
|
@@ -71661,21 +71661,21 @@ var require_parser = __commonJS({
|
|
|
71661
71661
|
} else if (tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR) {
|
|
71662
71662
|
if (p.openElements.hasInTableScope(tn)) {
|
|
71663
71663
|
p._closeTableCell();
|
|
71664
|
-
p._processToken(
|
|
71664
|
+
p._processToken(token2);
|
|
71665
71665
|
}
|
|
71666
71666
|
} else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML) {
|
|
71667
|
-
endTagInBody(p,
|
|
71667
|
+
endTagInBody(p, token2);
|
|
71668
71668
|
}
|
|
71669
71669
|
}
|
|
71670
|
-
function startTagInSelect(p,
|
|
71671
|
-
const tn =
|
|
71670
|
+
function startTagInSelect(p, token2) {
|
|
71671
|
+
const tn = token2.tagName;
|
|
71672
71672
|
if (tn === $.HTML) {
|
|
71673
|
-
startTagInBody(p,
|
|
71673
|
+
startTagInBody(p, token2);
|
|
71674
71674
|
} else if (tn === $.OPTION) {
|
|
71675
71675
|
if (p.openElements.currentTagName === $.OPTION) {
|
|
71676
71676
|
p.openElements.pop();
|
|
71677
71677
|
}
|
|
71678
|
-
p._insertElement(
|
|
71678
|
+
p._insertElement(token2, NS.HTML);
|
|
71679
71679
|
} else if (tn === $.OPTGROUP) {
|
|
71680
71680
|
if (p.openElements.currentTagName === $.OPTION) {
|
|
71681
71681
|
p.openElements.pop();
|
|
@@ -71683,21 +71683,21 @@ var require_parser = __commonJS({
|
|
|
71683
71683
|
if (p.openElements.currentTagName === $.OPTGROUP) {
|
|
71684
71684
|
p.openElements.pop();
|
|
71685
71685
|
}
|
|
71686
|
-
p._insertElement(
|
|
71686
|
+
p._insertElement(token2, NS.HTML);
|
|
71687
71687
|
} else if (tn === $.INPUT || tn === $.KEYGEN || tn === $.TEXTAREA || tn === $.SELECT) {
|
|
71688
71688
|
if (p.openElements.hasInSelectScope($.SELECT)) {
|
|
71689
71689
|
p.openElements.popUntilTagNamePopped($.SELECT);
|
|
71690
71690
|
p._resetInsertionMode();
|
|
71691
71691
|
if (tn !== $.SELECT) {
|
|
71692
|
-
p._processToken(
|
|
71692
|
+
p._processToken(token2);
|
|
71693
71693
|
}
|
|
71694
71694
|
}
|
|
71695
71695
|
} else if (tn === $.SCRIPT || tn === $.TEMPLATE) {
|
|
71696
|
-
startTagInHead(p,
|
|
71696
|
+
startTagInHead(p, token2);
|
|
71697
71697
|
}
|
|
71698
71698
|
}
|
|
71699
|
-
function endTagInSelect(p,
|
|
71700
|
-
const tn =
|
|
71699
|
+
function endTagInSelect(p, token2) {
|
|
71700
|
+
const tn = token2.tagName;
|
|
71701
71701
|
if (tn === $.OPTGROUP) {
|
|
71702
71702
|
const prevOpenElement = p.openElements.items[p.openElements.stackTop - 1];
|
|
71703
71703
|
const prevOpenElementTn = prevOpenElement && p.treeAdapter.getTagName(prevOpenElement);
|
|
@@ -71715,172 +71715,172 @@ var require_parser = __commonJS({
|
|
|
71715
71715
|
p.openElements.popUntilTagNamePopped($.SELECT);
|
|
71716
71716
|
p._resetInsertionMode();
|
|
71717
71717
|
} else if (tn === $.TEMPLATE) {
|
|
71718
|
-
endTagInHead(p,
|
|
71718
|
+
endTagInHead(p, token2);
|
|
71719
71719
|
}
|
|
71720
71720
|
}
|
|
71721
|
-
function startTagInSelectInTable(p,
|
|
71722
|
-
const tn =
|
|
71721
|
+
function startTagInSelectInTable(p, token2) {
|
|
71722
|
+
const tn = token2.tagName;
|
|
71723
71723
|
if (tn === $.CAPTION || tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR || tn === $.TD || tn === $.TH) {
|
|
71724
71724
|
p.openElements.popUntilTagNamePopped($.SELECT);
|
|
71725
71725
|
p._resetInsertionMode();
|
|
71726
|
-
p._processToken(
|
|
71726
|
+
p._processToken(token2);
|
|
71727
71727
|
} else {
|
|
71728
|
-
startTagInSelect(p,
|
|
71728
|
+
startTagInSelect(p, token2);
|
|
71729
71729
|
}
|
|
71730
71730
|
}
|
|
71731
|
-
function endTagInSelectInTable(p,
|
|
71732
|
-
const tn =
|
|
71731
|
+
function endTagInSelectInTable(p, token2) {
|
|
71732
|
+
const tn = token2.tagName;
|
|
71733
71733
|
if (tn === $.CAPTION || tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR || tn === $.TD || tn === $.TH) {
|
|
71734
71734
|
if (p.openElements.hasInTableScope(tn)) {
|
|
71735
71735
|
p.openElements.popUntilTagNamePopped($.SELECT);
|
|
71736
71736
|
p._resetInsertionMode();
|
|
71737
|
-
p._processToken(
|
|
71737
|
+
p._processToken(token2);
|
|
71738
71738
|
}
|
|
71739
71739
|
} else {
|
|
71740
|
-
endTagInSelect(p,
|
|
71740
|
+
endTagInSelect(p, token2);
|
|
71741
71741
|
}
|
|
71742
71742
|
}
|
|
71743
|
-
function startTagInTemplate(p,
|
|
71744
|
-
const tn =
|
|
71743
|
+
function startTagInTemplate(p, token2) {
|
|
71744
|
+
const tn = token2.tagName;
|
|
71745
71745
|
if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META || tn === $.NOFRAMES || tn === $.SCRIPT || tn === $.STYLE || tn === $.TEMPLATE || tn === $.TITLE) {
|
|
71746
|
-
startTagInHead(p,
|
|
71746
|
+
startTagInHead(p, token2);
|
|
71747
71747
|
} else {
|
|
71748
71748
|
const newInsertionMode = TEMPLATE_INSERTION_MODE_SWITCH_MAP[tn] || IN_BODY_MODE;
|
|
71749
71749
|
p._popTmplInsertionMode();
|
|
71750
71750
|
p._pushTmplInsertionMode(newInsertionMode);
|
|
71751
71751
|
p.insertionMode = newInsertionMode;
|
|
71752
|
-
p._processToken(
|
|
71752
|
+
p._processToken(token2);
|
|
71753
71753
|
}
|
|
71754
71754
|
}
|
|
71755
|
-
function endTagInTemplate(p,
|
|
71756
|
-
if (
|
|
71757
|
-
endTagInHead(p,
|
|
71755
|
+
function endTagInTemplate(p, token2) {
|
|
71756
|
+
if (token2.tagName === $.TEMPLATE) {
|
|
71757
|
+
endTagInHead(p, token2);
|
|
71758
71758
|
}
|
|
71759
71759
|
}
|
|
71760
|
-
function eofInTemplate(p,
|
|
71760
|
+
function eofInTemplate(p, token2) {
|
|
71761
71761
|
if (p.openElements.tmplCount > 0) {
|
|
71762
71762
|
p.openElements.popUntilTagNamePopped($.TEMPLATE);
|
|
71763
71763
|
p.activeFormattingElements.clearToLastMarker();
|
|
71764
71764
|
p._popTmplInsertionMode();
|
|
71765
71765
|
p._resetInsertionMode();
|
|
71766
|
-
p._processToken(
|
|
71766
|
+
p._processToken(token2);
|
|
71767
71767
|
} else {
|
|
71768
71768
|
p.stopped = true;
|
|
71769
71769
|
}
|
|
71770
71770
|
}
|
|
71771
|
-
function startTagAfterBody(p,
|
|
71772
|
-
if (
|
|
71773
|
-
startTagInBody(p,
|
|
71771
|
+
function startTagAfterBody(p, token2) {
|
|
71772
|
+
if (token2.tagName === $.HTML) {
|
|
71773
|
+
startTagInBody(p, token2);
|
|
71774
71774
|
} else {
|
|
71775
|
-
tokenAfterBody(p,
|
|
71775
|
+
tokenAfterBody(p, token2);
|
|
71776
71776
|
}
|
|
71777
71777
|
}
|
|
71778
|
-
function endTagAfterBody(p,
|
|
71779
|
-
if (
|
|
71778
|
+
function endTagAfterBody(p, token2) {
|
|
71779
|
+
if (token2.tagName === $.HTML) {
|
|
71780
71780
|
if (!p.fragmentContext) {
|
|
71781
71781
|
p.insertionMode = AFTER_AFTER_BODY_MODE;
|
|
71782
71782
|
}
|
|
71783
71783
|
} else {
|
|
71784
|
-
tokenAfterBody(p,
|
|
71784
|
+
tokenAfterBody(p, token2);
|
|
71785
71785
|
}
|
|
71786
71786
|
}
|
|
71787
|
-
function tokenAfterBody(p,
|
|
71787
|
+
function tokenAfterBody(p, token2) {
|
|
71788
71788
|
p.insertionMode = IN_BODY_MODE;
|
|
71789
|
-
p._processToken(
|
|
71789
|
+
p._processToken(token2);
|
|
71790
71790
|
}
|
|
71791
|
-
function startTagInFrameset(p,
|
|
71792
|
-
const tn =
|
|
71791
|
+
function startTagInFrameset(p, token2) {
|
|
71792
|
+
const tn = token2.tagName;
|
|
71793
71793
|
if (tn === $.HTML) {
|
|
71794
|
-
startTagInBody(p,
|
|
71794
|
+
startTagInBody(p, token2);
|
|
71795
71795
|
} else if (tn === $.FRAMESET) {
|
|
71796
|
-
p._insertElement(
|
|
71796
|
+
p._insertElement(token2, NS.HTML);
|
|
71797
71797
|
} else if (tn === $.FRAME) {
|
|
71798
|
-
p._appendElement(
|
|
71799
|
-
|
|
71798
|
+
p._appendElement(token2, NS.HTML);
|
|
71799
|
+
token2.ackSelfClosing = true;
|
|
71800
71800
|
} else if (tn === $.NOFRAMES) {
|
|
71801
|
-
startTagInHead(p,
|
|
71801
|
+
startTagInHead(p, token2);
|
|
71802
71802
|
}
|
|
71803
71803
|
}
|
|
71804
|
-
function endTagInFrameset(p,
|
|
71805
|
-
if (
|
|
71804
|
+
function endTagInFrameset(p, token2) {
|
|
71805
|
+
if (token2.tagName === $.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
|
|
71806
71806
|
p.openElements.pop();
|
|
71807
71807
|
if (!p.fragmentContext && p.openElements.currentTagName !== $.FRAMESET) {
|
|
71808
71808
|
p.insertionMode = AFTER_FRAMESET_MODE;
|
|
71809
71809
|
}
|
|
71810
71810
|
}
|
|
71811
71811
|
}
|
|
71812
|
-
function startTagAfterFrameset(p,
|
|
71813
|
-
const tn =
|
|
71812
|
+
function startTagAfterFrameset(p, token2) {
|
|
71813
|
+
const tn = token2.tagName;
|
|
71814
71814
|
if (tn === $.HTML) {
|
|
71815
|
-
startTagInBody(p,
|
|
71815
|
+
startTagInBody(p, token2);
|
|
71816
71816
|
} else if (tn === $.NOFRAMES) {
|
|
71817
|
-
startTagInHead(p,
|
|
71817
|
+
startTagInHead(p, token2);
|
|
71818
71818
|
}
|
|
71819
71819
|
}
|
|
71820
|
-
function endTagAfterFrameset(p,
|
|
71821
|
-
if (
|
|
71820
|
+
function endTagAfterFrameset(p, token2) {
|
|
71821
|
+
if (token2.tagName === $.HTML) {
|
|
71822
71822
|
p.insertionMode = AFTER_AFTER_FRAMESET_MODE;
|
|
71823
71823
|
}
|
|
71824
71824
|
}
|
|
71825
|
-
function startTagAfterAfterBody(p,
|
|
71826
|
-
if (
|
|
71827
|
-
startTagInBody(p,
|
|
71825
|
+
function startTagAfterAfterBody(p, token2) {
|
|
71826
|
+
if (token2.tagName === $.HTML) {
|
|
71827
|
+
startTagInBody(p, token2);
|
|
71828
71828
|
} else {
|
|
71829
|
-
tokenAfterAfterBody(p,
|
|
71829
|
+
tokenAfterAfterBody(p, token2);
|
|
71830
71830
|
}
|
|
71831
71831
|
}
|
|
71832
|
-
function tokenAfterAfterBody(p,
|
|
71832
|
+
function tokenAfterAfterBody(p, token2) {
|
|
71833
71833
|
p.insertionMode = IN_BODY_MODE;
|
|
71834
|
-
p._processToken(
|
|
71834
|
+
p._processToken(token2);
|
|
71835
71835
|
}
|
|
71836
|
-
function startTagAfterAfterFrameset(p,
|
|
71837
|
-
const tn =
|
|
71836
|
+
function startTagAfterAfterFrameset(p, token2) {
|
|
71837
|
+
const tn = token2.tagName;
|
|
71838
71838
|
if (tn === $.HTML) {
|
|
71839
|
-
startTagInBody(p,
|
|
71839
|
+
startTagInBody(p, token2);
|
|
71840
71840
|
} else if (tn === $.NOFRAMES) {
|
|
71841
|
-
startTagInHead(p,
|
|
71841
|
+
startTagInHead(p, token2);
|
|
71842
71842
|
}
|
|
71843
71843
|
}
|
|
71844
|
-
function nullCharacterInForeignContent(p,
|
|
71845
|
-
|
|
71846
|
-
p._insertCharacters(
|
|
71844
|
+
function nullCharacterInForeignContent(p, token2) {
|
|
71845
|
+
token2.chars = unicode.REPLACEMENT_CHARACTER;
|
|
71846
|
+
p._insertCharacters(token2);
|
|
71847
71847
|
}
|
|
71848
|
-
function characterInForeignContent(p,
|
|
71849
|
-
p._insertCharacters(
|
|
71848
|
+
function characterInForeignContent(p, token2) {
|
|
71849
|
+
p._insertCharacters(token2);
|
|
71850
71850
|
p.framesetOk = false;
|
|
71851
71851
|
}
|
|
71852
|
-
function startTagInForeignContent(p,
|
|
71853
|
-
if (foreignContent.causesExit(
|
|
71852
|
+
function startTagInForeignContent(p, token2) {
|
|
71853
|
+
if (foreignContent.causesExit(token2) && !p.fragmentContext) {
|
|
71854
71854
|
while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML && !p._isIntegrationPoint(p.openElements.current)) {
|
|
71855
71855
|
p.openElements.pop();
|
|
71856
71856
|
}
|
|
71857
|
-
p._processToken(
|
|
71857
|
+
p._processToken(token2);
|
|
71858
71858
|
} else {
|
|
71859
71859
|
const current = p._getAdjustedCurrentElement();
|
|
71860
71860
|
const currentNs = p.treeAdapter.getNamespaceURI(current);
|
|
71861
71861
|
if (currentNs === NS.MATHML) {
|
|
71862
|
-
foreignContent.adjustTokenMathMLAttrs(
|
|
71862
|
+
foreignContent.adjustTokenMathMLAttrs(token2);
|
|
71863
71863
|
} else if (currentNs === NS.SVG) {
|
|
71864
|
-
foreignContent.adjustTokenSVGTagName(
|
|
71865
|
-
foreignContent.adjustTokenSVGAttrs(
|
|
71864
|
+
foreignContent.adjustTokenSVGTagName(token2);
|
|
71865
|
+
foreignContent.adjustTokenSVGAttrs(token2);
|
|
71866
71866
|
}
|
|
71867
|
-
foreignContent.adjustTokenXMLAttrs(
|
|
71868
|
-
if (
|
|
71869
|
-
p._appendElement(
|
|
71867
|
+
foreignContent.adjustTokenXMLAttrs(token2);
|
|
71868
|
+
if (token2.selfClosing) {
|
|
71869
|
+
p._appendElement(token2, currentNs);
|
|
71870
71870
|
} else {
|
|
71871
|
-
p._insertElement(
|
|
71871
|
+
p._insertElement(token2, currentNs);
|
|
71872
71872
|
}
|
|
71873
|
-
|
|
71873
|
+
token2.ackSelfClosing = true;
|
|
71874
71874
|
}
|
|
71875
71875
|
}
|
|
71876
|
-
function endTagInForeignContent(p,
|
|
71876
|
+
function endTagInForeignContent(p, token2) {
|
|
71877
71877
|
for (let i = p.openElements.stackTop; i > 0; i--) {
|
|
71878
71878
|
const element = p.openElements.items[i];
|
|
71879
71879
|
if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) {
|
|
71880
|
-
p._processToken(
|
|
71880
|
+
p._processToken(token2);
|
|
71881
71881
|
break;
|
|
71882
71882
|
}
|
|
71883
|
-
if (p.treeAdapter.getTagName(element).toLowerCase() ===
|
|
71883
|
+
if (p.treeAdapter.getTagName(element).toLowerCase() === token2.tagName) {
|
|
71884
71884
|
p.openElements.popUntilElementPopped(element);
|
|
71885
71885
|
break;
|
|
71886
71886
|
}
|
|
@@ -72371,18 +72371,18 @@ var require_doctype2 = __commonJS({
|
|
|
72371
72371
|
}
|
|
72372
72372
|
return false;
|
|
72373
72373
|
}
|
|
72374
|
-
exports.isConforming = function(
|
|
72375
|
-
return
|
|
72374
|
+
exports.isConforming = function(token2) {
|
|
72375
|
+
return token2.name === VALID_DOCTYPE_NAME && token2.publicId === null && (token2.systemId === null || token2.systemId === VALID_SYSTEM_ID);
|
|
72376
72376
|
};
|
|
72377
|
-
exports.getDocumentMode = function(
|
|
72378
|
-
if (
|
|
72377
|
+
exports.getDocumentMode = function(token2) {
|
|
72378
|
+
if (token2.name !== VALID_DOCTYPE_NAME) {
|
|
72379
72379
|
return DOCUMENT_MODE.QUIRKS;
|
|
72380
72380
|
}
|
|
72381
|
-
const systemId =
|
|
72381
|
+
const systemId = token2.systemId;
|
|
72382
72382
|
if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
|
|
72383
72383
|
return DOCUMENT_MODE.QUIRKS;
|
|
72384
72384
|
}
|
|
72385
|
-
let publicId =
|
|
72385
|
+
let publicId = token2.publicId;
|
|
72386
72386
|
if (publicId !== null) {
|
|
72387
72387
|
publicId = publicId.toLowerCase();
|
|
72388
72388
|
if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) {
|
|
@@ -74838,6 +74838,316 @@ var init_update = __esm({
|
|
|
74838
74838
|
}
|
|
74839
74839
|
});
|
|
74840
74840
|
|
|
74841
|
+
// src/engine.js
|
|
74842
|
+
import fs4 from "node:fs";
|
|
74843
|
+
import net from "node:net";
|
|
74844
|
+
import os5 from "node:os";
|
|
74845
|
+
import path3 from "node:path";
|
|
74846
|
+
import crypto from "node:crypto";
|
|
74847
|
+
import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
|
|
74848
|
+
function uvToolDirs() {
|
|
74849
|
+
const dirs = [];
|
|
74850
|
+
if (process.env.UV_TOOL_DIR) dirs.push(process.env.UV_TOOL_DIR);
|
|
74851
|
+
if (win3) {
|
|
74852
|
+
for (const base of [process.env.APPDATA, process.env.LOCALAPPDATA]) if (base) dirs.push(path3.join(base, "uv", "tools"));
|
|
74853
|
+
} else dirs.push(path3.join(process.env.XDG_DATA_HOME || path3.join(os5.homedir(), ".local", "share"), "uv", "tools"));
|
|
74854
|
+
if (!dirs.some(exists)) {
|
|
74855
|
+
for (const uv of ["uv", path3.join(os5.homedir(), ".local", "bin", win3 ? "uv.exe" : "uv")]) {
|
|
74856
|
+
try {
|
|
74857
|
+
const r = spawnSync3(uv, ["tool", "dir"], { encoding: "utf8", windowsHide: true });
|
|
74858
|
+
if (r.status === 0 && r.stdout.trim()) {
|
|
74859
|
+
dirs.push(r.stdout.trim());
|
|
74860
|
+
break;
|
|
74861
|
+
}
|
|
74862
|
+
} catch {
|
|
74863
|
+
}
|
|
74864
|
+
}
|
|
74865
|
+
}
|
|
74866
|
+
return dirs;
|
|
74867
|
+
}
|
|
74868
|
+
function enginePython2(dirs = uvToolDirs()) {
|
|
74869
|
+
for (const dir of dirs) for (const name of ["hum-cli", "hum"]) {
|
|
74870
|
+
const py = win3 ? path3.join(dir, name, "Scripts", "python.exe") : path3.join(dir, name, "bin", "python");
|
|
74871
|
+
if (exists(py)) return py;
|
|
74872
|
+
}
|
|
74873
|
+
return null;
|
|
74874
|
+
}
|
|
74875
|
+
function siblingEngine(execPath = process.execPath) {
|
|
74876
|
+
let dir;
|
|
74877
|
+
try {
|
|
74878
|
+
dir = path3.dirname(fs4.realpathSync(execPath));
|
|
74879
|
+
} catch {
|
|
74880
|
+
return null;
|
|
74881
|
+
}
|
|
74882
|
+
const p = path3.join(dir, "engine", win3 ? "hum-engine.exe" : "hum-engine");
|
|
74883
|
+
return exists(p) ? p : null;
|
|
74884
|
+
}
|
|
74885
|
+
function homeEngine(env3 = process.env) {
|
|
74886
|
+
const home = env3.HUM_HOME || path3.join(os5.homedir(), ".hum");
|
|
74887
|
+
const py = win3 ? path3.join(home, "engine", "Scripts", "python.exe") : path3.join(home, "engine", "bin", "python");
|
|
74888
|
+
return exists(py) ? py : null;
|
|
74889
|
+
}
|
|
74890
|
+
function engineCandidates(env3 = process.env) {
|
|
74891
|
+
const out = [];
|
|
74892
|
+
if (env3.HUM_ENGINE) {
|
|
74893
|
+
const [bin, ...args2] = env3.HUM_ENGINE.split(" ");
|
|
74894
|
+
out.push({ bin, args: args2, where: "HUM_ENGINE" });
|
|
74895
|
+
}
|
|
74896
|
+
const sib = siblingEngine();
|
|
74897
|
+
if (sib) out.push({ bin: sib, args: ["engine"], where: "beside hum" });
|
|
74898
|
+
const home = homeEngine(env3);
|
|
74899
|
+
if (home) out.push({ bin: home, args: ["-m", "hum.cli", "engine"], where: "HUM_HOME/engine" });
|
|
74900
|
+
const py = enginePython2();
|
|
74901
|
+
if (py) out.push({ bin: py, args: ["-m", "hum.cli", "engine"], where: "the interpreter beside it" });
|
|
74902
|
+
out.push({ bin: "hum-engine", args: [], where: "PATH" });
|
|
74903
|
+
out.push({ bin: path3.join(os5.homedir(), ".local", "bin", win3 ? "hum-engine.exe" : "hum-engine"), args: [], where: "uv's bin dir" });
|
|
74904
|
+
return out;
|
|
74905
|
+
}
|
|
74906
|
+
function engineCommand(argv, candidates = engineCandidates()) {
|
|
74907
|
+
for (const c of candidates) {
|
|
74908
|
+
if (c.args[c.args.length - 1] !== "engine") continue;
|
|
74909
|
+
return { bin: c.bin, args: [...c.args.slice(0, -1), ...argv], where: c.where };
|
|
74910
|
+
}
|
|
74911
|
+
return null;
|
|
74912
|
+
}
|
|
74913
|
+
function candidateVersion(c, { env: env3 = process.env, runImpl = spawnSync3 } = {}) {
|
|
74914
|
+
if (!c || !c.bin) return null;
|
|
74915
|
+
if (c.where === "HUM_HOME/engine") return installedVersion(env3);
|
|
74916
|
+
const interp = c.args.length >= 3 && c.args[c.args.length - 3] === "-m" && c.args[c.args.length - 2] === "hum.cli";
|
|
74917
|
+
let r;
|
|
74918
|
+
try {
|
|
74919
|
+
r = runImpl(c.bin, interp ? ASK_VERSION : ["--version"], { encoding: "utf8", windowsHide: true, timeout: 2e4 });
|
|
74920
|
+
} catch {
|
|
74921
|
+
return null;
|
|
74922
|
+
}
|
|
74923
|
+
if (!r || r.status !== 0) return null;
|
|
74924
|
+
const m = String(r.stdout || "").match(/(\d+\.\d+\.\d+)/);
|
|
74925
|
+
return m ? m[1] : null;
|
|
74926
|
+
}
|
|
74927
|
+
function runningVersion(candidates = engineCandidates(), opts = {}) {
|
|
74928
|
+
for (const c of candidates) {
|
|
74929
|
+
const v = candidateVersion(c, opts);
|
|
74930
|
+
if (v) return { version: v, where: c.where };
|
|
74931
|
+
}
|
|
74932
|
+
return null;
|
|
74933
|
+
}
|
|
74934
|
+
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.46" : "" } = {}) {
|
|
74935
|
+
const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
|
|
74936
|
+
const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
|
|
74937
|
+
if (!refused) {
|
|
74938
|
+
return `Hum is not fully installed here \u2014 the half that does the work is missing. Run: ${fix} (or set HUM_ENGINE to the command that runs it)`;
|
|
74939
|
+
}
|
|
74940
|
+
const what = refused.error.code || refused.error.message;
|
|
74941
|
+
const lines = [
|
|
74942
|
+
`Hum is installed (${refused.bin}) but this machine would not run it: ${what}.`
|
|
74943
|
+
];
|
|
74944
|
+
if (win3) {
|
|
74945
|
+
lines.push("On a managed Windows machine that is usually Device Guard / WDAC refusing an executable it does not know.");
|
|
74946
|
+
lines.push(`To see the policy's own message, run: "${refused.bin}" --help`);
|
|
74947
|
+
const dir = uvToolDirs()[0];
|
|
74948
|
+
lines.push(`If uv's environment is elsewhere, point Hum at its interpreter: set HUM_ENGINE=${path3.join(dir || "<uv tool dir>", "hum-cli", "Scripts", "python.exe")} -m hum.cli engine`);
|
|
74949
|
+
} else {
|
|
74950
|
+
lines.push('Set HUM_ENGINE to a command that starts it, e.g. HUM_ENGINE="python -m hum.cli engine"');
|
|
74951
|
+
}
|
|
74952
|
+
return lines.join("\n");
|
|
74953
|
+
}
|
|
74954
|
+
function attempt({ bin, args: args2 }, cwd2, { task, images, resume }) {
|
|
74955
|
+
return new Promise((resolve, reject) => {
|
|
74956
|
+
const runId = crypto.randomBytes(6).toString("hex");
|
|
74957
|
+
fs4.mkdirSync(runDir(), { recursive: true });
|
|
74958
|
+
const logPath = path3.join(runDir(), `${runId}.log`);
|
|
74959
|
+
const log = fs4.openSync(logPath, "a");
|
|
74960
|
+
const argv = [...args2, "-C", cwd2, "--run-id", runId];
|
|
74961
|
+
if (task) argv.push("--task", task);
|
|
74962
|
+
for (const p of images) argv.push("--image", p);
|
|
74963
|
+
if (resume) argv.push("--resume", resume);
|
|
74964
|
+
let settled = false;
|
|
74965
|
+
const settle = (fn) => {
|
|
74966
|
+
if (!settled) {
|
|
74967
|
+
settled = true;
|
|
74968
|
+
fn();
|
|
74969
|
+
}
|
|
74970
|
+
};
|
|
74971
|
+
let child;
|
|
74972
|
+
try {
|
|
74973
|
+
child = spawn2(bin, argv, { stdio: ["ignore", log, log], detached: true, windowsHide: true });
|
|
74974
|
+
} catch (e) {
|
|
74975
|
+
fs4.closeSync(log);
|
|
74976
|
+
reject({ spawn: e });
|
|
74977
|
+
return;
|
|
74978
|
+
}
|
|
74979
|
+
fs4.closeSync(log);
|
|
74980
|
+
let died = false;
|
|
74981
|
+
child.on("error", (e) => settle(() => reject({ spawn: e })));
|
|
74982
|
+
child.on("exit", () => {
|
|
74983
|
+
died = true;
|
|
74984
|
+
});
|
|
74985
|
+
const t0 = Date.now();
|
|
74986
|
+
const poll = () => {
|
|
74987
|
+
if (settled) return;
|
|
74988
|
+
const rec = readRun(runId);
|
|
74989
|
+
if (rec && rec.port) {
|
|
74990
|
+
child.unref();
|
|
74991
|
+
settle(() => resolve(rec));
|
|
74992
|
+
return;
|
|
74993
|
+
}
|
|
74994
|
+
if (rec && rec.error) {
|
|
74995
|
+
settle(() => reject({ failed: rec.error }));
|
|
74996
|
+
return;
|
|
74997
|
+
}
|
|
74998
|
+
if (died && !rec) {
|
|
74999
|
+
settle(() => reject({ died: logPath }));
|
|
75000
|
+
return;
|
|
75001
|
+
}
|
|
75002
|
+
if (Date.now() - t0 > 9e4) {
|
|
75003
|
+
settle(() => reject({ timeout: true }));
|
|
75004
|
+
return;
|
|
75005
|
+
}
|
|
75006
|
+
setTimeout(poll, 50);
|
|
75007
|
+
};
|
|
75008
|
+
poll();
|
|
75009
|
+
});
|
|
75010
|
+
}
|
|
75011
|
+
function failureMessage(error) {
|
|
75012
|
+
return error.message + (error.hint ? `
|
|
75013
|
+
${error.hint}` : "");
|
|
75014
|
+
}
|
|
75015
|
+
function diedMessage(logPath, text = null) {
|
|
75016
|
+
let tail3 = "";
|
|
75017
|
+
try {
|
|
75018
|
+
tail3 = (text ?? fs4.readFileSync(logPath, "utf8")).trim().split("\n").slice(-3).join("\n").trim();
|
|
75019
|
+
} catch {
|
|
75020
|
+
}
|
|
75021
|
+
return `the session did not start${tail3 ? `:
|
|
75022
|
+
${tail3}` : ""}
|
|
75023
|
+
(its log: ${logPath})`;
|
|
75024
|
+
}
|
|
75025
|
+
async function spawnEngine(cwd2, { task = null, images = [], resume = null, candidates = engineCandidates() } = {}) {
|
|
75026
|
+
const failures = [];
|
|
75027
|
+
for (const cand of candidates) {
|
|
75028
|
+
if (!cand.bin) continue;
|
|
75029
|
+
try {
|
|
75030
|
+
return await attempt(cand, cwd2, { task, images, resume });
|
|
75031
|
+
} catch (f) {
|
|
75032
|
+
if (f && f.spawn) {
|
|
75033
|
+
failures.push({ ...cand, error: f.spawn });
|
|
75034
|
+
continue;
|
|
75035
|
+
}
|
|
75036
|
+
if (f && f.failed) throw new EngineError(failureMessage(f.failed));
|
|
75037
|
+
if (f && f.died) throw new EngineError(diedMessage(f.died));
|
|
75038
|
+
if (f && f.timeout) throw new EngineError("the session did not start in time");
|
|
75039
|
+
throw f;
|
|
75040
|
+
}
|
|
75041
|
+
}
|
|
75042
|
+
throw new EngineError(startFailure(failures));
|
|
75043
|
+
}
|
|
75044
|
+
var runDir, readRun, EngineError, win3, exists, Engine;
|
|
75045
|
+
var init_engine = __esm({
|
|
75046
|
+
"src/engine.js"() {
|
|
75047
|
+
init_install();
|
|
75048
|
+
init_update();
|
|
75049
|
+
runDir = () => path3.join(process.env.HUM_HOME || path3.join(os5.homedir(), ".hum"), "run");
|
|
75050
|
+
readRun = (id) => {
|
|
75051
|
+
try {
|
|
75052
|
+
return JSON.parse(fs4.readFileSync(path3.join(runDir(), `${id}.json`), "utf8"));
|
|
75053
|
+
} catch {
|
|
75054
|
+
return null;
|
|
75055
|
+
}
|
|
75056
|
+
};
|
|
75057
|
+
EngineError = class extends Error {
|
|
75058
|
+
};
|
|
75059
|
+
win3 = process.platform === "win32";
|
|
75060
|
+
exists = (p) => {
|
|
75061
|
+
try {
|
|
75062
|
+
fs4.accessSync(p);
|
|
75063
|
+
return true;
|
|
75064
|
+
} catch {
|
|
75065
|
+
return false;
|
|
75066
|
+
}
|
|
75067
|
+
};
|
|
75068
|
+
Engine = class {
|
|
75069
|
+
constructor(port2, token2 = "") {
|
|
75070
|
+
this.port = port2;
|
|
75071
|
+
this.token = token2;
|
|
75072
|
+
this.handlers = [];
|
|
75073
|
+
this.closed = false;
|
|
75074
|
+
}
|
|
75075
|
+
// This front-end has a person at it: it says so on connecting, and the engine counts it as
|
|
75076
|
+
// one. Only a human front-end makes the session attended. The same line carries the run's
|
|
75077
|
+
// token, which the engine reads before it says anything back.
|
|
75078
|
+
connect() {
|
|
75079
|
+
return new Promise((resolve, reject) => {
|
|
75080
|
+
const sock = net.createConnection({ host: "127.0.0.1", port: this.port }, () => {
|
|
75081
|
+
try {
|
|
75082
|
+
sock.write(JSON.stringify({ cmd: "hello", kind: "human", token: this.token }) + "\n");
|
|
75083
|
+
} catch {
|
|
75084
|
+
}
|
|
75085
|
+
resolve();
|
|
75086
|
+
});
|
|
75087
|
+
this.sock = sock;
|
|
75088
|
+
sock.on("error", (e) => {
|
|
75089
|
+
if (!this.closed && this.sock === sock) reject(new EngineError(`could not reach the session: ${e.message}`));
|
|
75090
|
+
});
|
|
75091
|
+
let buf = "";
|
|
75092
|
+
sock.on("data", (d) => {
|
|
75093
|
+
if (this.sock !== sock) return;
|
|
75094
|
+
buf += d.toString();
|
|
75095
|
+
const lines = buf.split("\n");
|
|
75096
|
+
buf = lines.pop();
|
|
75097
|
+
for (const line of lines) {
|
|
75098
|
+
if (!line.trim()) continue;
|
|
75099
|
+
let ev;
|
|
75100
|
+
try {
|
|
75101
|
+
ev = JSON.parse(line);
|
|
75102
|
+
} catch {
|
|
75103
|
+
continue;
|
|
75104
|
+
}
|
|
75105
|
+
for (const h of this.handlers) h(ev);
|
|
75106
|
+
}
|
|
75107
|
+
});
|
|
75108
|
+
sock.on("close", () => {
|
|
75109
|
+
if (this.sock !== sock) return;
|
|
75110
|
+
this.closed = true;
|
|
75111
|
+
for (const h of this.handlers) h({ type: "bye", gone: true });
|
|
75112
|
+
});
|
|
75113
|
+
});
|
|
75114
|
+
}
|
|
75115
|
+
// Attach to another engine (a session running elsewhere on this machine): its token comes
|
|
75116
|
+
// from its run file, the old socket is dropped quietly, the new one greets us with hello
|
|
75117
|
+
// and a replay.
|
|
75118
|
+
async reconnect(port2, token2 = "") {
|
|
75119
|
+
const old = this.sock;
|
|
75120
|
+
this.sock = null;
|
|
75121
|
+
this.port = port2;
|
|
75122
|
+
this.token = token2;
|
|
75123
|
+
this.closed = false;
|
|
75124
|
+
try {
|
|
75125
|
+
old.destroy();
|
|
75126
|
+
} catch {
|
|
75127
|
+
}
|
|
75128
|
+
await this.connect();
|
|
75129
|
+
}
|
|
75130
|
+
on(handler) {
|
|
75131
|
+
this.handlers.push(handler);
|
|
75132
|
+
}
|
|
75133
|
+
send(cmd) {
|
|
75134
|
+
if (this.closed) return;
|
|
75135
|
+
try {
|
|
75136
|
+
this.sock.write(JSON.stringify(cmd) + "\n");
|
|
75137
|
+
} catch {
|
|
75138
|
+
}
|
|
75139
|
+
}
|
|
75140
|
+
close() {
|
|
75141
|
+
this.closed = true;
|
|
75142
|
+
try {
|
|
75143
|
+
this.sock.end();
|
|
75144
|
+
} catch {
|
|
75145
|
+
}
|
|
75146
|
+
}
|
|
75147
|
+
};
|
|
75148
|
+
}
|
|
75149
|
+
});
|
|
75150
|
+
|
|
74841
75151
|
// node_modules/react/cjs/react-jsx-runtime.production.min.js
|
|
74842
75152
|
var require_react_jsx_runtime_production_min = __commonJS({
|
|
74843
75153
|
"node_modules/react/cjs/react-jsx-runtime.production.min.js"(exports) {
|
|
@@ -75768,304 +76078,6 @@ var require_jsx_runtime = __commonJS({
|
|
|
75768
76078
|
}
|
|
75769
76079
|
});
|
|
75770
76080
|
|
|
75771
|
-
// src/engine.js
|
|
75772
|
-
import fs5 from "node:fs";
|
|
75773
|
-
import net from "node:net";
|
|
75774
|
-
import os6 from "node:os";
|
|
75775
|
-
import path4 from "node:path";
|
|
75776
|
-
import crypto from "node:crypto";
|
|
75777
|
-
import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
|
|
75778
|
-
function uvToolDirs() {
|
|
75779
|
-
const dirs = [];
|
|
75780
|
-
if (process.env.UV_TOOL_DIR) dirs.push(process.env.UV_TOOL_DIR);
|
|
75781
|
-
if (win3) {
|
|
75782
|
-
for (const base of [process.env.APPDATA, process.env.LOCALAPPDATA]) if (base) dirs.push(path4.join(base, "uv", "tools"));
|
|
75783
|
-
} else dirs.push(path4.join(process.env.XDG_DATA_HOME || path4.join(os6.homedir(), ".local", "share"), "uv", "tools"));
|
|
75784
|
-
if (!dirs.some(exists)) {
|
|
75785
|
-
for (const uv of ["uv", path4.join(os6.homedir(), ".local", "bin", win3 ? "uv.exe" : "uv")]) {
|
|
75786
|
-
try {
|
|
75787
|
-
const r = spawnSync3(uv, ["tool", "dir"], { encoding: "utf8", windowsHide: true });
|
|
75788
|
-
if (r.status === 0 && r.stdout.trim()) {
|
|
75789
|
-
dirs.push(r.stdout.trim());
|
|
75790
|
-
break;
|
|
75791
|
-
}
|
|
75792
|
-
} catch {
|
|
75793
|
-
}
|
|
75794
|
-
}
|
|
75795
|
-
}
|
|
75796
|
-
return dirs;
|
|
75797
|
-
}
|
|
75798
|
-
function enginePython2(dirs = uvToolDirs()) {
|
|
75799
|
-
for (const dir of dirs) for (const name of ["hum-cli", "hum"]) {
|
|
75800
|
-
const py = win3 ? path4.join(dir, name, "Scripts", "python.exe") : path4.join(dir, name, "bin", "python");
|
|
75801
|
-
if (exists(py)) return py;
|
|
75802
|
-
}
|
|
75803
|
-
return null;
|
|
75804
|
-
}
|
|
75805
|
-
function siblingEngine(execPath = process.execPath) {
|
|
75806
|
-
let dir;
|
|
75807
|
-
try {
|
|
75808
|
-
dir = path4.dirname(fs5.realpathSync(execPath));
|
|
75809
|
-
} catch {
|
|
75810
|
-
return null;
|
|
75811
|
-
}
|
|
75812
|
-
const p = path4.join(dir, "engine", win3 ? "hum-engine.exe" : "hum-engine");
|
|
75813
|
-
return exists(p) ? p : null;
|
|
75814
|
-
}
|
|
75815
|
-
function homeEngine(env3 = process.env) {
|
|
75816
|
-
const home = env3.HUM_HOME || path4.join(os6.homedir(), ".hum");
|
|
75817
|
-
const py = win3 ? path4.join(home, "engine", "Scripts", "python.exe") : path4.join(home, "engine", "bin", "python");
|
|
75818
|
-
return exists(py) ? py : null;
|
|
75819
|
-
}
|
|
75820
|
-
function engineCandidates(env3 = process.env) {
|
|
75821
|
-
const out = [];
|
|
75822
|
-
if (env3.HUM_ENGINE) {
|
|
75823
|
-
const [bin, ...args2] = env3.HUM_ENGINE.split(" ");
|
|
75824
|
-
out.push({ bin, args: args2, where: "HUM_ENGINE" });
|
|
75825
|
-
}
|
|
75826
|
-
const sib = siblingEngine();
|
|
75827
|
-
if (sib) out.push({ bin: sib, args: ["engine"], where: "beside hum" });
|
|
75828
|
-
const home = homeEngine(env3);
|
|
75829
|
-
if (home) out.push({ bin: home, args: ["-m", "hum.cli", "engine"], where: "HUM_HOME/engine" });
|
|
75830
|
-
const py = enginePython2();
|
|
75831
|
-
if (py) out.push({ bin: py, args: ["-m", "hum.cli", "engine"], where: "the interpreter beside it" });
|
|
75832
|
-
out.push({ bin: "hum-engine", args: [], where: "PATH" });
|
|
75833
|
-
out.push({ bin: path4.join(os6.homedir(), ".local", "bin", win3 ? "hum-engine.exe" : "hum-engine"), args: [], where: "uv's bin dir" });
|
|
75834
|
-
return out;
|
|
75835
|
-
}
|
|
75836
|
-
function engineCommand(argv, candidates = engineCandidates()) {
|
|
75837
|
-
for (const c of candidates) {
|
|
75838
|
-
if (c.args[c.args.length - 1] !== "engine") continue;
|
|
75839
|
-
return { bin: c.bin, args: [...c.args.slice(0, -1), ...argv], where: c.where };
|
|
75840
|
-
}
|
|
75841
|
-
return null;
|
|
75842
|
-
}
|
|
75843
|
-
function candidateVersion(c, { env: env3 = process.env, runImpl = spawnSync3 } = {}) {
|
|
75844
|
-
if (!c || !c.bin) return null;
|
|
75845
|
-
if (c.where === "HUM_HOME/engine") return installedVersion(env3);
|
|
75846
|
-
const interp = c.args.length >= 3 && c.args[c.args.length - 3] === "-m" && c.args[c.args.length - 2] === "hum.cli";
|
|
75847
|
-
let r;
|
|
75848
|
-
try {
|
|
75849
|
-
r = runImpl(c.bin, interp ? ASK_VERSION : ["--version"], { encoding: "utf8", windowsHide: true, timeout: 2e4 });
|
|
75850
|
-
} catch {
|
|
75851
|
-
return null;
|
|
75852
|
-
}
|
|
75853
|
-
if (!r || r.status !== 0) return null;
|
|
75854
|
-
const m = String(r.stdout || "").match(/(\d+\.\d+\.\d+)/);
|
|
75855
|
-
return m ? m[1] : null;
|
|
75856
|
-
}
|
|
75857
|
-
function runningVersion(candidates = engineCandidates(), opts = {}) {
|
|
75858
|
-
for (const c of candidates) {
|
|
75859
|
-
const v = candidateVersion(c, opts);
|
|
75860
|
-
if (v) return { version: v, where: c.where };
|
|
75861
|
-
}
|
|
75862
|
-
return null;
|
|
75863
|
-
}
|
|
75864
|
-
function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.1.44" : "" } = {}) {
|
|
75865
|
-
const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
|
|
75866
|
-
const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
|
|
75867
|
-
if (!refused) {
|
|
75868
|
-
return `Hum is not fully installed here \u2014 the half that does the work is missing. Run: ${fix} (or set HUM_ENGINE to the command that runs it)`;
|
|
75869
|
-
}
|
|
75870
|
-
const what = refused.error.code || refused.error.message;
|
|
75871
|
-
const lines = [
|
|
75872
|
-
`Hum is installed (${refused.bin}) but this machine would not run it: ${what}.`
|
|
75873
|
-
];
|
|
75874
|
-
if (win3) {
|
|
75875
|
-
lines.push("On a managed Windows machine that is usually Device Guard / WDAC refusing an executable it does not know.");
|
|
75876
|
-
lines.push(`To see the policy's own message, run: "${refused.bin}" --help`);
|
|
75877
|
-
const dir = uvToolDirs()[0];
|
|
75878
|
-
lines.push(`If uv's environment is elsewhere, point Hum at its interpreter: set HUM_ENGINE=${path4.join(dir || "<uv tool dir>", "hum-cli", "Scripts", "python.exe")} -m hum.cli engine`);
|
|
75879
|
-
} else {
|
|
75880
|
-
lines.push('Set HUM_ENGINE to a command that starts it, e.g. HUM_ENGINE="python -m hum.cli engine"');
|
|
75881
|
-
}
|
|
75882
|
-
return lines.join("\n");
|
|
75883
|
-
}
|
|
75884
|
-
function attempt({ bin, args: args2 }, cwd2, { task, images, resume }) {
|
|
75885
|
-
return new Promise((resolve, reject) => {
|
|
75886
|
-
const runId = crypto.randomBytes(6).toString("hex");
|
|
75887
|
-
fs5.mkdirSync(runDir(), { recursive: true });
|
|
75888
|
-
const logPath = path4.join(runDir(), `${runId}.log`);
|
|
75889
|
-
const log = fs5.openSync(logPath, "a");
|
|
75890
|
-
const argv = [...args2, "-C", cwd2, "--run-id", runId];
|
|
75891
|
-
if (task) argv.push("--task", task);
|
|
75892
|
-
for (const p of images) argv.push("--image", p);
|
|
75893
|
-
if (resume) argv.push("--resume", resume);
|
|
75894
|
-
let settled = false;
|
|
75895
|
-
const settle = (fn) => {
|
|
75896
|
-
if (!settled) {
|
|
75897
|
-
settled = true;
|
|
75898
|
-
fn();
|
|
75899
|
-
}
|
|
75900
|
-
};
|
|
75901
|
-
let child;
|
|
75902
|
-
try {
|
|
75903
|
-
child = spawn2(bin, argv, { stdio: ["ignore", log, log], detached: true, windowsHide: true });
|
|
75904
|
-
} catch (e) {
|
|
75905
|
-
fs5.closeSync(log);
|
|
75906
|
-
reject({ spawn: e });
|
|
75907
|
-
return;
|
|
75908
|
-
}
|
|
75909
|
-
fs5.closeSync(log);
|
|
75910
|
-
let died = false;
|
|
75911
|
-
child.on("error", (e) => settle(() => reject({ spawn: e })));
|
|
75912
|
-
child.on("exit", () => {
|
|
75913
|
-
died = true;
|
|
75914
|
-
});
|
|
75915
|
-
const t0 = Date.now();
|
|
75916
|
-
const poll = () => {
|
|
75917
|
-
if (settled) return;
|
|
75918
|
-
const rec = readRun(runId);
|
|
75919
|
-
if (rec && rec.port) {
|
|
75920
|
-
child.unref();
|
|
75921
|
-
settle(() => resolve(rec));
|
|
75922
|
-
return;
|
|
75923
|
-
}
|
|
75924
|
-
if (rec && rec.error) {
|
|
75925
|
-
settle(() => reject({ failed: rec.error }));
|
|
75926
|
-
return;
|
|
75927
|
-
}
|
|
75928
|
-
if (died && !rec) {
|
|
75929
|
-
settle(() => reject({ died: logPath }));
|
|
75930
|
-
return;
|
|
75931
|
-
}
|
|
75932
|
-
if (Date.now() - t0 > 9e4) {
|
|
75933
|
-
settle(() => reject({ timeout: true }));
|
|
75934
|
-
return;
|
|
75935
|
-
}
|
|
75936
|
-
setTimeout(poll, 50);
|
|
75937
|
-
};
|
|
75938
|
-
poll();
|
|
75939
|
-
});
|
|
75940
|
-
}
|
|
75941
|
-
function failureMessage(error) {
|
|
75942
|
-
return error.message + (error.hint ? `
|
|
75943
|
-
${error.hint}` : "");
|
|
75944
|
-
}
|
|
75945
|
-
function diedMessage(logPath, text = null) {
|
|
75946
|
-
let tail3 = "";
|
|
75947
|
-
try {
|
|
75948
|
-
tail3 = (text ?? fs5.readFileSync(logPath, "utf8")).trim().split("\n").slice(-3).join("\n").trim();
|
|
75949
|
-
} catch {
|
|
75950
|
-
}
|
|
75951
|
-
return `the session did not start${tail3 ? `:
|
|
75952
|
-
${tail3}` : ""}
|
|
75953
|
-
(its log: ${logPath})`;
|
|
75954
|
-
}
|
|
75955
|
-
async function spawnEngine(cwd2, { task = null, images = [], resume = null, candidates = engineCandidates() } = {}) {
|
|
75956
|
-
const failures = [];
|
|
75957
|
-
for (const cand of candidates) {
|
|
75958
|
-
if (!cand.bin) continue;
|
|
75959
|
-
try {
|
|
75960
|
-
return await attempt(cand, cwd2, { task, images, resume });
|
|
75961
|
-
} catch (f) {
|
|
75962
|
-
if (f && f.spawn) {
|
|
75963
|
-
failures.push({ ...cand, error: f.spawn });
|
|
75964
|
-
continue;
|
|
75965
|
-
}
|
|
75966
|
-
if (f && f.failed) throw new EngineError(failureMessage(f.failed));
|
|
75967
|
-
if (f && f.died) throw new EngineError(diedMessage(f.died));
|
|
75968
|
-
if (f && f.timeout) throw new EngineError("the session did not start in time");
|
|
75969
|
-
throw f;
|
|
75970
|
-
}
|
|
75971
|
-
}
|
|
75972
|
-
throw new EngineError(startFailure(failures));
|
|
75973
|
-
}
|
|
75974
|
-
var runDir, readRun, EngineError, win3, exists, Engine;
|
|
75975
|
-
var init_engine = __esm({
|
|
75976
|
-
"src/engine.js"() {
|
|
75977
|
-
init_install();
|
|
75978
|
-
init_update();
|
|
75979
|
-
runDir = () => path4.join(process.env.HUM_HOME || path4.join(os6.homedir(), ".hum"), "run");
|
|
75980
|
-
readRun = (id) => {
|
|
75981
|
-
try {
|
|
75982
|
-
return JSON.parse(fs5.readFileSync(path4.join(runDir(), `${id}.json`), "utf8"));
|
|
75983
|
-
} catch {
|
|
75984
|
-
return null;
|
|
75985
|
-
}
|
|
75986
|
-
};
|
|
75987
|
-
EngineError = class extends Error {
|
|
75988
|
-
};
|
|
75989
|
-
win3 = process.platform === "win32";
|
|
75990
|
-
exists = (p) => {
|
|
75991
|
-
try {
|
|
75992
|
-
fs5.accessSync(p);
|
|
75993
|
-
return true;
|
|
75994
|
-
} catch {
|
|
75995
|
-
return false;
|
|
75996
|
-
}
|
|
75997
|
-
};
|
|
75998
|
-
Engine = class {
|
|
75999
|
-
constructor(port2) {
|
|
76000
|
-
this.port = port2;
|
|
76001
|
-
this.handlers = [];
|
|
76002
|
-
this.closed = false;
|
|
76003
|
-
}
|
|
76004
|
-
connect() {
|
|
76005
|
-
return new Promise((resolve, reject) => {
|
|
76006
|
-
const sock = net.createConnection({ host: "127.0.0.1", port: this.port }, () => resolve());
|
|
76007
|
-
this.sock = sock;
|
|
76008
|
-
sock.on("error", (e) => {
|
|
76009
|
-
if (!this.closed && this.sock === sock) reject(new EngineError(`could not reach the session: ${e.message}`));
|
|
76010
|
-
});
|
|
76011
|
-
let buf = "";
|
|
76012
|
-
sock.on("data", (d) => {
|
|
76013
|
-
if (this.sock !== sock) return;
|
|
76014
|
-
buf += d.toString();
|
|
76015
|
-
const lines = buf.split("\n");
|
|
76016
|
-
buf = lines.pop();
|
|
76017
|
-
for (const line of lines) {
|
|
76018
|
-
if (!line.trim()) continue;
|
|
76019
|
-
let ev;
|
|
76020
|
-
try {
|
|
76021
|
-
ev = JSON.parse(line);
|
|
76022
|
-
} catch {
|
|
76023
|
-
continue;
|
|
76024
|
-
}
|
|
76025
|
-
for (const h of this.handlers) h(ev);
|
|
76026
|
-
}
|
|
76027
|
-
});
|
|
76028
|
-
sock.on("close", () => {
|
|
76029
|
-
if (this.sock !== sock) return;
|
|
76030
|
-
this.closed = true;
|
|
76031
|
-
for (const h of this.handlers) h({ type: "bye", gone: true });
|
|
76032
|
-
});
|
|
76033
|
-
});
|
|
76034
|
-
}
|
|
76035
|
-
// Attach to another engine (a session running elsewhere on this machine): the old
|
|
76036
|
-
// socket is dropped quietly, the new one greets us with hello and a replay.
|
|
76037
|
-
async reconnect(port2) {
|
|
76038
|
-
const old = this.sock;
|
|
76039
|
-
this.sock = null;
|
|
76040
|
-
this.port = port2;
|
|
76041
|
-
this.closed = false;
|
|
76042
|
-
try {
|
|
76043
|
-
old.destroy();
|
|
76044
|
-
} catch {
|
|
76045
|
-
}
|
|
76046
|
-
await this.connect();
|
|
76047
|
-
}
|
|
76048
|
-
on(handler) {
|
|
76049
|
-
this.handlers.push(handler);
|
|
76050
|
-
}
|
|
76051
|
-
send(cmd) {
|
|
76052
|
-
if (this.closed) return;
|
|
76053
|
-
try {
|
|
76054
|
-
this.sock.write(JSON.stringify(cmd) + "\n");
|
|
76055
|
-
} catch {
|
|
76056
|
-
}
|
|
76057
|
-
}
|
|
76058
|
-
close() {
|
|
76059
|
-
this.closed = true;
|
|
76060
|
-
try {
|
|
76061
|
-
this.sock.end();
|
|
76062
|
-
} catch {
|
|
76063
|
-
}
|
|
76064
|
-
}
|
|
76065
|
-
};
|
|
76066
|
-
}
|
|
76067
|
-
});
|
|
76068
|
-
|
|
76069
76081
|
// src/doctor.js
|
|
76070
76082
|
var doctor_exports = {};
|
|
76071
76083
|
__export(doctor_exports, {
|
|
@@ -80548,14 +80560,14 @@ function sliceAnsi2(string, start, end) {
|
|
|
80548
80560
|
let position = 0;
|
|
80549
80561
|
let returnValue = "";
|
|
80550
80562
|
let include = false;
|
|
80551
|
-
for (const
|
|
80563
|
+
for (const token2 of tokens) {
|
|
80552
80564
|
if (end !== void 0 && position >= end) {
|
|
80553
80565
|
break;
|
|
80554
80566
|
}
|
|
80555
|
-
if (
|
|
80556
|
-
activeCodes.push(
|
|
80567
|
+
if (token2.type === "ansi") {
|
|
80568
|
+
activeCodes.push(token2);
|
|
80557
80569
|
if (include) {
|
|
80558
|
-
returnValue +=
|
|
80570
|
+
returnValue += token2.code;
|
|
80559
80571
|
}
|
|
80560
80572
|
} else {
|
|
80561
80573
|
if (!include && position >= start) {
|
|
@@ -80564,9 +80576,9 @@ function sliceAnsi2(string, start, end) {
|
|
|
80564
80576
|
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
80565
80577
|
}
|
|
80566
80578
|
if (include) {
|
|
80567
|
-
returnValue +=
|
|
80579
|
+
returnValue += token2.value;
|
|
80568
80580
|
}
|
|
80569
|
-
position +=
|
|
80581
|
+
position += token2.isFullWidth ? 2 : token2.value.length;
|
|
80570
80582
|
}
|
|
80571
80583
|
}
|
|
80572
80584
|
returnValue += undoAnsiCodes(activeCodes);
|
|
@@ -80722,12 +80734,12 @@ function diffAnsiCodes(from, to) {
|
|
|
80722
80734
|
function styledCharsFromTokens(tokens) {
|
|
80723
80735
|
let codes = [];
|
|
80724
80736
|
const ret = [];
|
|
80725
|
-
for (const
|
|
80726
|
-
if (
|
|
80727
|
-
codes = reduceAnsiCodesIncremental(codes, [
|
|
80728
|
-
} else if (
|
|
80737
|
+
for (const token2 of tokens) {
|
|
80738
|
+
if (token2.type === "ansi") {
|
|
80739
|
+
codes = reduceAnsiCodesIncremental(codes, [token2]);
|
|
80740
|
+
} else if (token2.type === "char") {
|
|
80729
80741
|
ret.push({
|
|
80730
|
-
...
|
|
80742
|
+
...token2,
|
|
80731
80743
|
styles: [...codes]
|
|
80732
80744
|
});
|
|
80733
80745
|
}
|
|
@@ -82193,9 +82205,9 @@ var import_react21 = __toESM(require_react(), 1);
|
|
|
82193
82205
|
|
|
82194
82206
|
// src/app.jsx
|
|
82195
82207
|
var import_react24 = __toESM(require_react(), 1);
|
|
82196
|
-
import
|
|
82197
|
-
import
|
|
82198
|
-
import
|
|
82208
|
+
import fs5 from "node:fs";
|
|
82209
|
+
import os6 from "node:os";
|
|
82210
|
+
import path4 from "node:path";
|
|
82199
82211
|
|
|
82200
82212
|
// node_modules/ink-spinner/build/index.js
|
|
82201
82213
|
var import_react22 = __toESM(require_react(), 1);
|
|
@@ -82374,7 +82386,7 @@ function outputLink(cap, link3, raw, lexer3) {
|
|
|
82374
82386
|
const text = cap[1].replace(/\\([\[\]])/g, "$1");
|
|
82375
82387
|
if (cap[0].charAt(0) !== "!") {
|
|
82376
82388
|
lexer3.state.inLink = true;
|
|
82377
|
-
const
|
|
82389
|
+
const token2 = {
|
|
82378
82390
|
type: "link",
|
|
82379
82391
|
raw,
|
|
82380
82392
|
href,
|
|
@@ -82383,7 +82395,7 @@ function outputLink(cap, link3, raw, lexer3) {
|
|
|
82383
82395
|
tokens: lexer3.inlineTokens(text)
|
|
82384
82396
|
};
|
|
82385
82397
|
lexer3.state.inLink = false;
|
|
82386
|
-
return
|
|
82398
|
+
return token2;
|
|
82387
82399
|
}
|
|
82388
82400
|
return {
|
|
82389
82401
|
type: "image",
|
|
@@ -82651,14 +82663,14 @@ var _Tokenizer = class {
|
|
|
82651
82663
|
html(src) {
|
|
82652
82664
|
const cap = this.rules.block.html.exec(src);
|
|
82653
82665
|
if (cap) {
|
|
82654
|
-
const
|
|
82666
|
+
const token2 = {
|
|
82655
82667
|
type: "html",
|
|
82656
82668
|
block: true,
|
|
82657
82669
|
raw: cap[0],
|
|
82658
82670
|
pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
|
|
82659
82671
|
text: cap[0]
|
|
82660
82672
|
};
|
|
82661
|
-
return
|
|
82673
|
+
return token2;
|
|
82662
82674
|
}
|
|
82663
82675
|
}
|
|
82664
82676
|
def(src) {
|
|
@@ -83221,95 +83233,95 @@ var _Lexer = class __Lexer {
|
|
|
83221
83233
|
return leading + " ".repeat(tabs.length);
|
|
83222
83234
|
});
|
|
83223
83235
|
}
|
|
83224
|
-
let
|
|
83236
|
+
let token2;
|
|
83225
83237
|
let lastToken;
|
|
83226
83238
|
let cutSrc;
|
|
83227
83239
|
let lastParagraphClipped;
|
|
83228
83240
|
while (src) {
|
|
83229
83241
|
if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
|
|
83230
|
-
if (
|
|
83231
|
-
src = src.substring(
|
|
83232
|
-
tokens.push(
|
|
83242
|
+
if (token2 = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
83243
|
+
src = src.substring(token2.raw.length);
|
|
83244
|
+
tokens.push(token2);
|
|
83233
83245
|
return true;
|
|
83234
83246
|
}
|
|
83235
83247
|
return false;
|
|
83236
83248
|
})) {
|
|
83237
83249
|
continue;
|
|
83238
83250
|
}
|
|
83239
|
-
if (
|
|
83240
|
-
src = src.substring(
|
|
83241
|
-
if (
|
|
83251
|
+
if (token2 = this.tokenizer.space(src)) {
|
|
83252
|
+
src = src.substring(token2.raw.length);
|
|
83253
|
+
if (token2.raw.length === 1 && tokens.length > 0) {
|
|
83242
83254
|
tokens[tokens.length - 1].raw += "\n";
|
|
83243
83255
|
} else {
|
|
83244
|
-
tokens.push(
|
|
83256
|
+
tokens.push(token2);
|
|
83245
83257
|
}
|
|
83246
83258
|
continue;
|
|
83247
83259
|
}
|
|
83248
|
-
if (
|
|
83249
|
-
src = src.substring(
|
|
83260
|
+
if (token2 = this.tokenizer.code(src)) {
|
|
83261
|
+
src = src.substring(token2.raw.length);
|
|
83250
83262
|
lastToken = tokens[tokens.length - 1];
|
|
83251
83263
|
if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
|
|
83252
|
-
lastToken.raw += "\n" +
|
|
83253
|
-
lastToken.text += "\n" +
|
|
83264
|
+
lastToken.raw += "\n" + token2.raw;
|
|
83265
|
+
lastToken.text += "\n" + token2.text;
|
|
83254
83266
|
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
83255
83267
|
} else {
|
|
83256
|
-
tokens.push(
|
|
83268
|
+
tokens.push(token2);
|
|
83257
83269
|
}
|
|
83258
83270
|
continue;
|
|
83259
83271
|
}
|
|
83260
|
-
if (
|
|
83261
|
-
src = src.substring(
|
|
83262
|
-
tokens.push(
|
|
83272
|
+
if (token2 = this.tokenizer.fences(src)) {
|
|
83273
|
+
src = src.substring(token2.raw.length);
|
|
83274
|
+
tokens.push(token2);
|
|
83263
83275
|
continue;
|
|
83264
83276
|
}
|
|
83265
|
-
if (
|
|
83266
|
-
src = src.substring(
|
|
83267
|
-
tokens.push(
|
|
83277
|
+
if (token2 = this.tokenizer.heading(src)) {
|
|
83278
|
+
src = src.substring(token2.raw.length);
|
|
83279
|
+
tokens.push(token2);
|
|
83268
83280
|
continue;
|
|
83269
83281
|
}
|
|
83270
|
-
if (
|
|
83271
|
-
src = src.substring(
|
|
83272
|
-
tokens.push(
|
|
83282
|
+
if (token2 = this.tokenizer.hr(src)) {
|
|
83283
|
+
src = src.substring(token2.raw.length);
|
|
83284
|
+
tokens.push(token2);
|
|
83273
83285
|
continue;
|
|
83274
83286
|
}
|
|
83275
|
-
if (
|
|
83276
|
-
src = src.substring(
|
|
83277
|
-
tokens.push(
|
|
83287
|
+
if (token2 = this.tokenizer.blockquote(src)) {
|
|
83288
|
+
src = src.substring(token2.raw.length);
|
|
83289
|
+
tokens.push(token2);
|
|
83278
83290
|
continue;
|
|
83279
83291
|
}
|
|
83280
|
-
if (
|
|
83281
|
-
src = src.substring(
|
|
83282
|
-
tokens.push(
|
|
83292
|
+
if (token2 = this.tokenizer.list(src)) {
|
|
83293
|
+
src = src.substring(token2.raw.length);
|
|
83294
|
+
tokens.push(token2);
|
|
83283
83295
|
continue;
|
|
83284
83296
|
}
|
|
83285
|
-
if (
|
|
83286
|
-
src = src.substring(
|
|
83287
|
-
tokens.push(
|
|
83297
|
+
if (token2 = this.tokenizer.html(src)) {
|
|
83298
|
+
src = src.substring(token2.raw.length);
|
|
83299
|
+
tokens.push(token2);
|
|
83288
83300
|
continue;
|
|
83289
83301
|
}
|
|
83290
|
-
if (
|
|
83291
|
-
src = src.substring(
|
|
83302
|
+
if (token2 = this.tokenizer.def(src)) {
|
|
83303
|
+
src = src.substring(token2.raw.length);
|
|
83292
83304
|
lastToken = tokens[tokens.length - 1];
|
|
83293
83305
|
if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
|
|
83294
|
-
lastToken.raw += "\n" +
|
|
83295
|
-
lastToken.text += "\n" +
|
|
83306
|
+
lastToken.raw += "\n" + token2.raw;
|
|
83307
|
+
lastToken.text += "\n" + token2.raw;
|
|
83296
83308
|
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
83297
|
-
} else if (!this.tokens.links[
|
|
83298
|
-
this.tokens.links[
|
|
83299
|
-
href:
|
|
83300
|
-
title:
|
|
83309
|
+
} else if (!this.tokens.links[token2.tag]) {
|
|
83310
|
+
this.tokens.links[token2.tag] = {
|
|
83311
|
+
href: token2.href,
|
|
83312
|
+
title: token2.title
|
|
83301
83313
|
};
|
|
83302
83314
|
}
|
|
83303
83315
|
continue;
|
|
83304
83316
|
}
|
|
83305
|
-
if (
|
|
83306
|
-
src = src.substring(
|
|
83307
|
-
tokens.push(
|
|
83317
|
+
if (token2 = this.tokenizer.table(src)) {
|
|
83318
|
+
src = src.substring(token2.raw.length);
|
|
83319
|
+
tokens.push(token2);
|
|
83308
83320
|
continue;
|
|
83309
83321
|
}
|
|
83310
|
-
if (
|
|
83311
|
-
src = src.substring(
|
|
83312
|
-
tokens.push(
|
|
83322
|
+
if (token2 = this.tokenizer.lheading(src)) {
|
|
83323
|
+
src = src.substring(token2.raw.length);
|
|
83324
|
+
tokens.push(token2);
|
|
83313
83325
|
continue;
|
|
83314
83326
|
}
|
|
83315
83327
|
cutSrc = src;
|
|
@@ -83327,30 +83339,30 @@ var _Lexer = class __Lexer {
|
|
|
83327
83339
|
cutSrc = src.substring(0, startIndex + 1);
|
|
83328
83340
|
}
|
|
83329
83341
|
}
|
|
83330
|
-
if (this.state.top && (
|
|
83342
|
+
if (this.state.top && (token2 = this.tokenizer.paragraph(cutSrc))) {
|
|
83331
83343
|
lastToken = tokens[tokens.length - 1];
|
|
83332
83344
|
if (lastParagraphClipped && lastToken.type === "paragraph") {
|
|
83333
|
-
lastToken.raw += "\n" +
|
|
83334
|
-
lastToken.text += "\n" +
|
|
83345
|
+
lastToken.raw += "\n" + token2.raw;
|
|
83346
|
+
lastToken.text += "\n" + token2.text;
|
|
83335
83347
|
this.inlineQueue.pop();
|
|
83336
83348
|
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
83337
83349
|
} else {
|
|
83338
|
-
tokens.push(
|
|
83350
|
+
tokens.push(token2);
|
|
83339
83351
|
}
|
|
83340
83352
|
lastParagraphClipped = cutSrc.length !== src.length;
|
|
83341
|
-
src = src.substring(
|
|
83353
|
+
src = src.substring(token2.raw.length);
|
|
83342
83354
|
continue;
|
|
83343
83355
|
}
|
|
83344
|
-
if (
|
|
83345
|
-
src = src.substring(
|
|
83356
|
+
if (token2 = this.tokenizer.text(src)) {
|
|
83357
|
+
src = src.substring(token2.raw.length);
|
|
83346
83358
|
lastToken = tokens[tokens.length - 1];
|
|
83347
83359
|
if (lastToken && lastToken.type === "text") {
|
|
83348
|
-
lastToken.raw += "\n" +
|
|
83349
|
-
lastToken.text += "\n" +
|
|
83360
|
+
lastToken.raw += "\n" + token2.raw;
|
|
83361
|
+
lastToken.text += "\n" + token2.text;
|
|
83350
83362
|
this.inlineQueue.pop();
|
|
83351
83363
|
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
83352
83364
|
} else {
|
|
83353
|
-
tokens.push(
|
|
83365
|
+
tokens.push(token2);
|
|
83354
83366
|
}
|
|
83355
83367
|
continue;
|
|
83356
83368
|
}
|
|
@@ -83375,7 +83387,7 @@ var _Lexer = class __Lexer {
|
|
|
83375
83387
|
* Lexing/Compiling
|
|
83376
83388
|
*/
|
|
83377
83389
|
inlineTokens(src, tokens = []) {
|
|
83378
|
-
let
|
|
83390
|
+
let token2, lastToken, cutSrc;
|
|
83379
83391
|
let maskedSrc = src;
|
|
83380
83392
|
let match;
|
|
83381
83393
|
let keepPrevChar, prevChar;
|
|
@@ -83401,75 +83413,75 @@ var _Lexer = class __Lexer {
|
|
|
83401
83413
|
}
|
|
83402
83414
|
keepPrevChar = false;
|
|
83403
83415
|
if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
|
|
83404
|
-
if (
|
|
83405
|
-
src = src.substring(
|
|
83406
|
-
tokens.push(
|
|
83416
|
+
if (token2 = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
83417
|
+
src = src.substring(token2.raw.length);
|
|
83418
|
+
tokens.push(token2);
|
|
83407
83419
|
return true;
|
|
83408
83420
|
}
|
|
83409
83421
|
return false;
|
|
83410
83422
|
})) {
|
|
83411
83423
|
continue;
|
|
83412
83424
|
}
|
|
83413
|
-
if (
|
|
83414
|
-
src = src.substring(
|
|
83415
|
-
tokens.push(
|
|
83425
|
+
if (token2 = this.tokenizer.escape(src)) {
|
|
83426
|
+
src = src.substring(token2.raw.length);
|
|
83427
|
+
tokens.push(token2);
|
|
83416
83428
|
continue;
|
|
83417
83429
|
}
|
|
83418
|
-
if (
|
|
83419
|
-
src = src.substring(
|
|
83430
|
+
if (token2 = this.tokenizer.tag(src)) {
|
|
83431
|
+
src = src.substring(token2.raw.length);
|
|
83420
83432
|
lastToken = tokens[tokens.length - 1];
|
|
83421
|
-
if (lastToken &&
|
|
83422
|
-
lastToken.raw +=
|
|
83423
|
-
lastToken.text +=
|
|
83433
|
+
if (lastToken && token2.type === "text" && lastToken.type === "text") {
|
|
83434
|
+
lastToken.raw += token2.raw;
|
|
83435
|
+
lastToken.text += token2.text;
|
|
83424
83436
|
} else {
|
|
83425
|
-
tokens.push(
|
|
83437
|
+
tokens.push(token2);
|
|
83426
83438
|
}
|
|
83427
83439
|
continue;
|
|
83428
83440
|
}
|
|
83429
|
-
if (
|
|
83430
|
-
src = src.substring(
|
|
83431
|
-
tokens.push(
|
|
83441
|
+
if (token2 = this.tokenizer.link(src)) {
|
|
83442
|
+
src = src.substring(token2.raw.length);
|
|
83443
|
+
tokens.push(token2);
|
|
83432
83444
|
continue;
|
|
83433
83445
|
}
|
|
83434
|
-
if (
|
|
83435
|
-
src = src.substring(
|
|
83446
|
+
if (token2 = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
83447
|
+
src = src.substring(token2.raw.length);
|
|
83436
83448
|
lastToken = tokens[tokens.length - 1];
|
|
83437
|
-
if (lastToken &&
|
|
83438
|
-
lastToken.raw +=
|
|
83439
|
-
lastToken.text +=
|
|
83449
|
+
if (lastToken && token2.type === "text" && lastToken.type === "text") {
|
|
83450
|
+
lastToken.raw += token2.raw;
|
|
83451
|
+
lastToken.text += token2.text;
|
|
83440
83452
|
} else {
|
|
83441
|
-
tokens.push(
|
|
83453
|
+
tokens.push(token2);
|
|
83442
83454
|
}
|
|
83443
83455
|
continue;
|
|
83444
83456
|
}
|
|
83445
|
-
if (
|
|
83446
|
-
src = src.substring(
|
|
83447
|
-
tokens.push(
|
|
83457
|
+
if (token2 = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
83458
|
+
src = src.substring(token2.raw.length);
|
|
83459
|
+
tokens.push(token2);
|
|
83448
83460
|
continue;
|
|
83449
83461
|
}
|
|
83450
|
-
if (
|
|
83451
|
-
src = src.substring(
|
|
83452
|
-
tokens.push(
|
|
83462
|
+
if (token2 = this.tokenizer.codespan(src)) {
|
|
83463
|
+
src = src.substring(token2.raw.length);
|
|
83464
|
+
tokens.push(token2);
|
|
83453
83465
|
continue;
|
|
83454
83466
|
}
|
|
83455
|
-
if (
|
|
83456
|
-
src = src.substring(
|
|
83457
|
-
tokens.push(
|
|
83467
|
+
if (token2 = this.tokenizer.br(src)) {
|
|
83468
|
+
src = src.substring(token2.raw.length);
|
|
83469
|
+
tokens.push(token2);
|
|
83458
83470
|
continue;
|
|
83459
83471
|
}
|
|
83460
|
-
if (
|
|
83461
|
-
src = src.substring(
|
|
83462
|
-
tokens.push(
|
|
83472
|
+
if (token2 = this.tokenizer.del(src)) {
|
|
83473
|
+
src = src.substring(token2.raw.length);
|
|
83474
|
+
tokens.push(token2);
|
|
83463
83475
|
continue;
|
|
83464
83476
|
}
|
|
83465
|
-
if (
|
|
83466
|
-
src = src.substring(
|
|
83467
|
-
tokens.push(
|
|
83477
|
+
if (token2 = this.tokenizer.autolink(src)) {
|
|
83478
|
+
src = src.substring(token2.raw.length);
|
|
83479
|
+
tokens.push(token2);
|
|
83468
83480
|
continue;
|
|
83469
83481
|
}
|
|
83470
|
-
if (!this.state.inLink && (
|
|
83471
|
-
src = src.substring(
|
|
83472
|
-
tokens.push(
|
|
83482
|
+
if (!this.state.inLink && (token2 = this.tokenizer.url(src))) {
|
|
83483
|
+
src = src.substring(token2.raw.length);
|
|
83484
|
+
tokens.push(token2);
|
|
83473
83485
|
continue;
|
|
83474
83486
|
}
|
|
83475
83487
|
cutSrc = src;
|
|
@@ -83487,18 +83499,18 @@ var _Lexer = class __Lexer {
|
|
|
83487
83499
|
cutSrc = src.substring(0, startIndex + 1);
|
|
83488
83500
|
}
|
|
83489
83501
|
}
|
|
83490
|
-
if (
|
|
83491
|
-
src = src.substring(
|
|
83492
|
-
if (
|
|
83493
|
-
prevChar =
|
|
83502
|
+
if (token2 = this.tokenizer.inlineText(cutSrc)) {
|
|
83503
|
+
src = src.substring(token2.raw.length);
|
|
83504
|
+
if (token2.raw.slice(-1) !== "_") {
|
|
83505
|
+
prevChar = token2.raw.slice(-1);
|
|
83494
83506
|
}
|
|
83495
83507
|
keepPrevChar = true;
|
|
83496
83508
|
lastToken = tokens[tokens.length - 1];
|
|
83497
83509
|
if (lastToken && lastToken.type === "text") {
|
|
83498
|
-
lastToken.raw +=
|
|
83499
|
-
lastToken.text +=
|
|
83510
|
+
lastToken.raw += token2.raw;
|
|
83511
|
+
lastToken.text += token2.text;
|
|
83500
83512
|
} else {
|
|
83501
|
-
tokens.push(
|
|
83513
|
+
tokens.push(token2);
|
|
83502
83514
|
}
|
|
83503
83515
|
continue;
|
|
83504
83516
|
}
|
|
@@ -83684,16 +83696,16 @@ var _Parser = class __Parser {
|
|
|
83684
83696
|
parse(tokens, top = true) {
|
|
83685
83697
|
let out = "";
|
|
83686
83698
|
for (let i = 0; i < tokens.length; i++) {
|
|
83687
|
-
const
|
|
83688
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[
|
|
83689
|
-
const genericToken =
|
|
83699
|
+
const token2 = tokens[i];
|
|
83700
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token2.type]) {
|
|
83701
|
+
const genericToken = token2;
|
|
83690
83702
|
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
83691
83703
|
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
83692
83704
|
out += ret || "";
|
|
83693
83705
|
continue;
|
|
83694
83706
|
}
|
|
83695
83707
|
}
|
|
83696
|
-
switch (
|
|
83708
|
+
switch (token2.type) {
|
|
83697
83709
|
case "space": {
|
|
83698
83710
|
continue;
|
|
83699
83711
|
}
|
|
@@ -83702,17 +83714,17 @@ var _Parser = class __Parser {
|
|
|
83702
83714
|
continue;
|
|
83703
83715
|
}
|
|
83704
83716
|
case "heading": {
|
|
83705
|
-
const headingToken =
|
|
83717
|
+
const headingToken = token2;
|
|
83706
83718
|
out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
|
|
83707
83719
|
continue;
|
|
83708
83720
|
}
|
|
83709
83721
|
case "code": {
|
|
83710
|
-
const codeToken =
|
|
83722
|
+
const codeToken = token2;
|
|
83711
83723
|
out += this.renderer.code(codeToken.text, codeToken.lang, !!codeToken.escaped);
|
|
83712
83724
|
continue;
|
|
83713
83725
|
}
|
|
83714
83726
|
case "table": {
|
|
83715
|
-
const tableToken =
|
|
83727
|
+
const tableToken = token2;
|
|
83716
83728
|
let header = "";
|
|
83717
83729
|
let cell = "";
|
|
83718
83730
|
for (let j = 0; j < tableToken.header.length; j++) {
|
|
@@ -83732,13 +83744,13 @@ var _Parser = class __Parser {
|
|
|
83732
83744
|
continue;
|
|
83733
83745
|
}
|
|
83734
83746
|
case "blockquote": {
|
|
83735
|
-
const blockquoteToken =
|
|
83747
|
+
const blockquoteToken = token2;
|
|
83736
83748
|
const body = this.parse(blockquoteToken.tokens);
|
|
83737
83749
|
out += this.renderer.blockquote(body);
|
|
83738
83750
|
continue;
|
|
83739
83751
|
}
|
|
83740
83752
|
case "list": {
|
|
83741
|
-
const listToken =
|
|
83753
|
+
const listToken = token2;
|
|
83742
83754
|
const ordered = listToken.ordered;
|
|
83743
83755
|
const start = listToken.start;
|
|
83744
83756
|
const loose = listToken.loose;
|
|
@@ -83773,17 +83785,17 @@ var _Parser = class __Parser {
|
|
|
83773
83785
|
continue;
|
|
83774
83786
|
}
|
|
83775
83787
|
case "html": {
|
|
83776
|
-
const htmlToken =
|
|
83788
|
+
const htmlToken = token2;
|
|
83777
83789
|
out += this.renderer.html(htmlToken.text, htmlToken.block);
|
|
83778
83790
|
continue;
|
|
83779
83791
|
}
|
|
83780
83792
|
case "paragraph": {
|
|
83781
|
-
const paragraphToken =
|
|
83793
|
+
const paragraphToken = token2;
|
|
83782
83794
|
out += this.renderer.paragraph(this.parseInline(paragraphToken.tokens));
|
|
83783
83795
|
continue;
|
|
83784
83796
|
}
|
|
83785
83797
|
case "text": {
|
|
83786
|
-
let textToken =
|
|
83798
|
+
let textToken = token2;
|
|
83787
83799
|
let body = textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text;
|
|
83788
83800
|
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
83789
83801
|
textToken = tokens[++i];
|
|
@@ -83793,7 +83805,7 @@ var _Parser = class __Parser {
|
|
|
83793
83805
|
continue;
|
|
83794
83806
|
}
|
|
83795
83807
|
default: {
|
|
83796
|
-
const errMsg = 'Token with "' +
|
|
83808
|
+
const errMsg = 'Token with "' + token2.type + '" type was not found.';
|
|
83797
83809
|
if (this.options.silent) {
|
|
83798
83810
|
console.error(errMsg);
|
|
83799
83811
|
return "";
|
|
@@ -83812,47 +83824,47 @@ var _Parser = class __Parser {
|
|
|
83812
83824
|
renderer2 = renderer2 || this.renderer;
|
|
83813
83825
|
let out = "";
|
|
83814
83826
|
for (let i = 0; i < tokens.length; i++) {
|
|
83815
|
-
const
|
|
83816
|
-
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[
|
|
83817
|
-
const ret = this.options.extensions.renderers[
|
|
83818
|
-
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(
|
|
83827
|
+
const token2 = tokens[i];
|
|
83828
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token2.type]) {
|
|
83829
|
+
const ret = this.options.extensions.renderers[token2.type].call({ parser: this }, token2);
|
|
83830
|
+
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token2.type)) {
|
|
83819
83831
|
out += ret || "";
|
|
83820
83832
|
continue;
|
|
83821
83833
|
}
|
|
83822
83834
|
}
|
|
83823
|
-
switch (
|
|
83835
|
+
switch (token2.type) {
|
|
83824
83836
|
case "escape": {
|
|
83825
|
-
const escapeToken =
|
|
83837
|
+
const escapeToken = token2;
|
|
83826
83838
|
out += renderer2.text(escapeToken.text);
|
|
83827
83839
|
break;
|
|
83828
83840
|
}
|
|
83829
83841
|
case "html": {
|
|
83830
|
-
const tagToken =
|
|
83842
|
+
const tagToken = token2;
|
|
83831
83843
|
out += renderer2.html(tagToken.text);
|
|
83832
83844
|
break;
|
|
83833
83845
|
}
|
|
83834
83846
|
case "link": {
|
|
83835
|
-
const linkToken =
|
|
83847
|
+
const linkToken = token2;
|
|
83836
83848
|
out += renderer2.link(linkToken.href, linkToken.title, this.parseInline(linkToken.tokens, renderer2));
|
|
83837
83849
|
break;
|
|
83838
83850
|
}
|
|
83839
83851
|
case "image": {
|
|
83840
|
-
const imageToken =
|
|
83852
|
+
const imageToken = token2;
|
|
83841
83853
|
out += renderer2.image(imageToken.href, imageToken.title, imageToken.text);
|
|
83842
83854
|
break;
|
|
83843
83855
|
}
|
|
83844
83856
|
case "strong": {
|
|
83845
|
-
const strongToken =
|
|
83857
|
+
const strongToken = token2;
|
|
83846
83858
|
out += renderer2.strong(this.parseInline(strongToken.tokens, renderer2));
|
|
83847
83859
|
break;
|
|
83848
83860
|
}
|
|
83849
83861
|
case "em": {
|
|
83850
|
-
const emToken =
|
|
83862
|
+
const emToken = token2;
|
|
83851
83863
|
out += renderer2.em(this.parseInline(emToken.tokens, renderer2));
|
|
83852
83864
|
break;
|
|
83853
83865
|
}
|
|
83854
83866
|
case "codespan": {
|
|
83855
|
-
const codespanToken =
|
|
83867
|
+
const codespanToken = token2;
|
|
83856
83868
|
out += renderer2.codespan(codespanToken.text);
|
|
83857
83869
|
break;
|
|
83858
83870
|
}
|
|
@@ -83861,17 +83873,17 @@ var _Parser = class __Parser {
|
|
|
83861
83873
|
break;
|
|
83862
83874
|
}
|
|
83863
83875
|
case "del": {
|
|
83864
|
-
const delToken =
|
|
83876
|
+
const delToken = token2;
|
|
83865
83877
|
out += renderer2.del(this.parseInline(delToken.tokens, renderer2));
|
|
83866
83878
|
break;
|
|
83867
83879
|
}
|
|
83868
83880
|
case "text": {
|
|
83869
|
-
const textToken =
|
|
83881
|
+
const textToken = token2;
|
|
83870
83882
|
out += renderer2.text(textToken.text);
|
|
83871
83883
|
break;
|
|
83872
83884
|
}
|
|
83873
83885
|
default: {
|
|
83874
|
-
const errMsg = 'Token with "' +
|
|
83886
|
+
const errMsg = 'Token with "' + token2.type + '" type was not found.';
|
|
83875
83887
|
if (this.options.silent) {
|
|
83876
83888
|
console.error(errMsg);
|
|
83877
83889
|
return "";
|
|
@@ -83932,11 +83944,11 @@ var Marked = class {
|
|
|
83932
83944
|
*/
|
|
83933
83945
|
walkTokens(tokens, callback) {
|
|
83934
83946
|
let values = [];
|
|
83935
|
-
for (const
|
|
83936
|
-
values = values.concat(callback.call(this,
|
|
83937
|
-
switch (
|
|
83947
|
+
for (const token2 of tokens) {
|
|
83948
|
+
values = values.concat(callback.call(this, token2));
|
|
83949
|
+
switch (token2.type) {
|
|
83938
83950
|
case "table": {
|
|
83939
|
-
const tableToken =
|
|
83951
|
+
const tableToken = token2;
|
|
83940
83952
|
for (const cell of tableToken.header) {
|
|
83941
83953
|
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
83942
83954
|
}
|
|
@@ -83948,12 +83960,12 @@ var Marked = class {
|
|
|
83948
83960
|
break;
|
|
83949
83961
|
}
|
|
83950
83962
|
case "list": {
|
|
83951
|
-
const listToken =
|
|
83963
|
+
const listToken = token2;
|
|
83952
83964
|
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
83953
83965
|
break;
|
|
83954
83966
|
}
|
|
83955
83967
|
default: {
|
|
83956
|
-
const genericToken =
|
|
83968
|
+
const genericToken = token2;
|
|
83957
83969
|
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
83958
83970
|
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
83959
83971
|
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
@@ -84104,11 +84116,11 @@ var Marked = class {
|
|
|
84104
84116
|
if (pack.walkTokens) {
|
|
84105
84117
|
const walkTokens2 = this.defaults.walkTokens;
|
|
84106
84118
|
const packWalktokens = pack.walkTokens;
|
|
84107
|
-
opts.walkTokens = function(
|
|
84119
|
+
opts.walkTokens = function(token2) {
|
|
84108
84120
|
let values = [];
|
|
84109
|
-
values.push(packWalktokens.call(this,
|
|
84121
|
+
values.push(packWalktokens.call(this, token2));
|
|
84110
84122
|
if (walkTokens2) {
|
|
84111
|
-
values = values.concat(walkTokens2.call(this,
|
|
84123
|
+
values = values.concat(walkTokens2.call(this, token2));
|
|
84112
84124
|
}
|
|
84113
84125
|
return values;
|
|
84114
84126
|
};
|
|
@@ -84361,10 +84373,10 @@ function renderBlocks(tokens, width) {
|
|
|
84361
84373
|
}
|
|
84362
84374
|
return parts.filter((p) => p.replace(ANSI_RE, "").trim().length > 0);
|
|
84363
84375
|
}
|
|
84364
|
-
function renderTable(
|
|
84376
|
+
function renderTable(token2, width) {
|
|
84365
84377
|
const inline2 = (cell) => renderInline(cell.tokens?.length ? cell.tokens : [{ type: "text", text: cell.text }]);
|
|
84366
|
-
const head =
|
|
84367
|
-
const rows =
|
|
84378
|
+
const head = token2.header.map((c) => accent(inline2(c)));
|
|
84379
|
+
const rows = token2.rows.map((r) => r.map(inline2));
|
|
84368
84380
|
const ncols = head.length;
|
|
84369
84381
|
const all = [head, ...rows];
|
|
84370
84382
|
const natural = head.map((_, c) => Math.max(
|
|
@@ -84433,6 +84445,7 @@ function bannerLines(ev, homeRel2 = (p) => p, mine = "") {
|
|
|
84433
84445
|
|
|
84434
84446
|
// src/app.jsx
|
|
84435
84447
|
init_update();
|
|
84448
|
+
init_engine();
|
|
84436
84449
|
|
|
84437
84450
|
// src/input.jsx
|
|
84438
84451
|
var import_react23 = __toESM(require_react(), 1);
|
|
@@ -84575,7 +84588,7 @@ var input_default = MultilineInput;
|
|
|
84575
84588
|
|
|
84576
84589
|
// src/app.jsx
|
|
84577
84590
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
84578
|
-
var MINE = true ? "0.1.
|
|
84591
|
+
var MINE = true ? "0.1.46" : "";
|
|
84579
84592
|
var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
|
|
84580
84593
|
var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
|
|
84581
84594
|
var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
|
|
@@ -84583,7 +84596,7 @@ var shortSession = (name) => (name || "").replace(/\.jsonl$/, "");
|
|
|
84583
84596
|
var PICKER_ROWS = 8;
|
|
84584
84597
|
var sessionRows = (p, here) => {
|
|
84585
84598
|
const q = p.query.trim().toLowerCase();
|
|
84586
|
-
const all = p.all.map((it) => ({ ...it, dir: it.cwd ?
|
|
84599
|
+
const all = p.all.map((it) => ({ ...it, dir: it.cwd ? path4.basename(it.cwd) : "" }));
|
|
84587
84600
|
const inHere = all.filter((it) => it.cwd && here && it.cwd === here);
|
|
84588
84601
|
const scope = p.scope === "here" && inHere.length ? "here" : "all";
|
|
84589
84602
|
let rows = all;
|
|
@@ -84605,7 +84618,7 @@ var ago = (at) => {
|
|
|
84605
84618
|
return `${Math.floor(secs / 86400)}d ago`;
|
|
84606
84619
|
};
|
|
84607
84620
|
var homeRel = (p) => {
|
|
84608
|
-
const h =
|
|
84621
|
+
const h = os6.homedir();
|
|
84609
84622
|
return p && h && p.startsWith(h) ? "~" + p.slice(h.length) : p;
|
|
84610
84623
|
};
|
|
84611
84624
|
var handEdit = (stat) => {
|
|
@@ -84617,11 +84630,11 @@ var handEdit = (stat) => {
|
|
|
84617
84630
|
};
|
|
84618
84631
|
var fmtCost = (c) => c >= 0.01 ? `$${c.toFixed(2)}` : c > 0 ? `$${c.toFixed(4)}` : "$0";
|
|
84619
84632
|
var fmtTokens = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k tokens` : `${t || 0} tokens`;
|
|
84620
|
-
var HISTORY_PATH =
|
|
84633
|
+
var HISTORY_PATH = path4.join(os6.homedir(), ".hum", "history.json");
|
|
84621
84634
|
var HISTORY_MAX = 300;
|
|
84622
84635
|
var loadHistory = () => {
|
|
84623
84636
|
try {
|
|
84624
|
-
const a = JSON.parse(
|
|
84637
|
+
const a = JSON.parse(fs5.readFileSync(HISTORY_PATH, "utf8"));
|
|
84625
84638
|
return Array.isArray(a) ? a.filter((x) => typeof x === "string") : [];
|
|
84626
84639
|
} catch {
|
|
84627
84640
|
return [];
|
|
@@ -84629,8 +84642,8 @@ var loadHistory = () => {
|
|
|
84629
84642
|
};
|
|
84630
84643
|
var saveHistory = (arr) => {
|
|
84631
84644
|
try {
|
|
84632
|
-
|
|
84633
|
-
|
|
84645
|
+
fs5.mkdirSync(path4.dirname(HISTORY_PATH), { recursive: true });
|
|
84646
|
+
fs5.writeFileSync(HISTORY_PATH, JSON.stringify(arr.slice(-HISTORY_MAX)));
|
|
84634
84647
|
} catch {
|
|
84635
84648
|
}
|
|
84636
84649
|
};
|
|
@@ -85387,7 +85400,7 @@ function App2({ engine: engine2, task, resume, images = [] }) {
|
|
|
85387
85400
|
if (!it) return;
|
|
85388
85401
|
setPicker(null);
|
|
85389
85402
|
if (it.live && it.live.here) {
|
|
85390
|
-
} else if (it.live && it.live.port) attachTo(it.live.port);
|
|
85403
|
+
} else if (it.live && it.live.port) attachTo(it.live.port, it.live.run_id);
|
|
85391
85404
|
else engine2.send({ cmd: "resume", name: it.name });
|
|
85392
85405
|
} else if (key.ctrl && input === "a") setPicker((p) => ({ ...p, scope: p.scope === "here" ? "all" : "here", index: 0, top: 0 }));
|
|
85393
85406
|
else if (key.backspace || key.delete) setPicker((p) => ({ ...p, query: p.query.slice(0, -1), index: 0, top: 0 }));
|
|
@@ -85418,11 +85431,12 @@ function App2({ engine: engine2, task, resume, images = [] }) {
|
|
|
85418
85431
|
(0, import_react24.useEffect)(() => {
|
|
85419
85432
|
setMenuIndex(0);
|
|
85420
85433
|
}, [value]);
|
|
85421
|
-
const attachTo = (port2) => {
|
|
85434
|
+
const attachTo = (port2, runId) => {
|
|
85422
85435
|
resetForSession();
|
|
85423
85436
|
helloRef.current = false;
|
|
85424
85437
|
setPhaseBoth("connecting");
|
|
85425
|
-
|
|
85438
|
+
const token2 = (readRun(runId || "") || {}).token || "";
|
|
85439
|
+
engine2.reconnect(port2, token2).catch((e) => {
|
|
85426
85440
|
append({ kind: "error", text: `could not attach: ${e.message}` });
|
|
85427
85441
|
setPhaseBoth("idle");
|
|
85428
85442
|
});
|
|
@@ -86081,7 +86095,7 @@ init_update();
|
|
|
86081
86095
|
init_install();
|
|
86082
86096
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
86083
86097
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
86084
|
-
var MINE2 = true ? "0.1.
|
|
86098
|
+
var MINE2 = true ? "0.1.46" : "0.0.0";
|
|
86085
86099
|
var layout = installLayout();
|
|
86086
86100
|
function completeInstall() {
|
|
86087
86101
|
if (layout.kind !== "npm" || !needsInstall(MINE2)) return;
|
|
@@ -86148,6 +86162,7 @@ if (!process.stdin.isTTY) {
|
|
|
86148
86162
|
process.exit(1);
|
|
86149
86163
|
}
|
|
86150
86164
|
var port = Number(process.env.HUM_ENGINE_PORT || 0);
|
|
86165
|
+
var token = port ? (readRun(process.env.HUM_RUN_ID || "") || {}).token || "" : "";
|
|
86151
86166
|
var startedHere = false;
|
|
86152
86167
|
try {
|
|
86153
86168
|
if (!port) {
|
|
@@ -86155,6 +86170,7 @@ try {
|
|
|
86155
86170
|
const rec = await spawnEngine(args.cwd, { task: args.task, images: args.images, resume: args.resume && args.resume !== "pick" ? args.resume : null });
|
|
86156
86171
|
startedHere = true;
|
|
86157
86172
|
port = rec.port;
|
|
86173
|
+
token = rec.token || "";
|
|
86158
86174
|
}
|
|
86159
86175
|
} catch (exc) {
|
|
86160
86176
|
if (exc instanceof EngineError) {
|
|
@@ -86163,7 +86179,7 @@ try {
|
|
|
86163
86179
|
}
|
|
86164
86180
|
throw exc;
|
|
86165
86181
|
}
|
|
86166
|
-
var engine = new Engine(port);
|
|
86182
|
+
var engine = new Engine(port, token);
|
|
86167
86183
|
try {
|
|
86168
86184
|
await engine.connect();
|
|
86169
86185
|
} catch (exc) {
|