@angular/platform-server
Version:
Angular - library for using Angular in Node.js
1,476 lines (1,462 loc) • 496 kB
JavaScript
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
// external/npm/node_modules/domino/lib/Event.js
var require_Event = __commonJS({
"external/npm/node_modules/domino/lib/Event.js"(exports, module) {
"use strict";
module.exports = Event;
Event.CAPTURING_PHASE = 1;
Event.AT_TARGET = 2;
Event.BUBBLING_PHASE = 3;
function Event(type, dictionary) {
this.type = "";
this.target = null;
this.currentTarget = null;
this.eventPhase = Event.AT_TARGET;
this.bubbles = false;
this.cancelable = false;
this.isTrusted = false;
this.defaultPrevented = false;
this.timeStamp = Date.now();
this._propagationStopped = false;
this._immediatePropagationStopped = false;
this._initialized = true;
this._dispatching = false;
if (type)
this.type = type;
if (dictionary) {
for (var p in dictionary) {
this[p] = dictionary[p];
}
}
}
Event.prototype = Object.create(Object.prototype, {
constructor: { value: Event },
stopPropagation: { value: function stopPropagation() {
this._propagationStopped = true;
} },
stopImmediatePropagation: { value: function stopImmediatePropagation() {
this._propagationStopped = true;
this._immediatePropagationStopped = true;
} },
preventDefault: { value: function preventDefault() {
if (this.cancelable)
this.defaultPrevented = true;
} },
initEvent: { value: function initEvent(type, bubbles, cancelable) {
this._initialized = true;
if (this._dispatching)
return;
this._propagationStopped = false;
this._immediatePropagationStopped = false;
this.defaultPrevented = false;
this.isTrusted = false;
this.target = null;
this.type = type;
this.bubbles = bubbles;
this.cancelable = cancelable;
} }
});
}
});
// external/npm/node_modules/domino/lib/UIEvent.js
var require_UIEvent = __commonJS({
"external/npm/node_modules/domino/lib/UIEvent.js"(exports, module) {
"use strict";
var Event = require_Event();
module.exports = UIEvent;
function UIEvent() {
Event.call(this);
this.view = null;
this.detail = 0;
}
UIEvent.prototype = Object.create(Event.prototype, {
constructor: { value: UIEvent },
initUIEvent: { value: function(type, bubbles, cancelable, view, detail) {
this.initEvent(type, bubbles, cancelable);
this.view = view;
this.detail = detail;
} }
});
}
});
// external/npm/node_modules/domino/lib/MouseEvent.js
var require_MouseEvent = __commonJS({
"external/npm/node_modules/domino/lib/MouseEvent.js"(exports, module) {
"use strict";
var UIEvent = require_UIEvent();
module.exports = MouseEvent;
function MouseEvent() {
UIEvent.call(this);
this.screenX = this.screenY = this.clientX = this.clientY = 0;
this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false;
this.button = 0;
this.buttons = 1;
this.relatedTarget = null;
}
MouseEvent.prototype = Object.create(UIEvent.prototype, {
constructor: { value: MouseEvent },
initMouseEvent: { value: function(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget) {
this.initEvent(type, bubbles, cancelable, view, detail);
this.screenX = screenX;
this.screenY = screenY;
this.clientX = clientX;
this.clientY = clientY;
this.ctrlKey = ctrlKey;
this.altKey = altKey;
this.shiftKey = shiftKey;
this.metaKey = metaKey;
this.button = button;
switch (button) {
case 0:
this.buttons = 1;
break;
case 1:
this.buttons = 4;
break;
case 2:
this.buttons = 2;
break;
default:
this.buttons = 0;
break;
}
this.relatedTarget = relatedTarget;
} },
getModifierState: { value: function(key) {
switch (key) {
case "Alt":
return this.altKey;
case "Control":
return this.ctrlKey;
case "Shift":
return this.shiftKey;
case "Meta":
return this.metaKey;
default:
return false;
}
} }
});
}
});
// external/npm/node_modules/domino/lib/DOMException.js
var require_DOMException = __commonJS({
"external/npm/node_modules/domino/lib/DOMException.js"(exports, module) {
"use strict";
module.exports = DOMException;
var INDEX_SIZE_ERR = 1;
var HIERARCHY_REQUEST_ERR = 3;
var WRONG_DOCUMENT_ERR = 4;
var INVALID_CHARACTER_ERR = 5;
var NO_MODIFICATION_ALLOWED_ERR = 7;
var NOT_FOUND_ERR = 8;
var NOT_SUPPORTED_ERR = 9;
var INVALID_STATE_ERR = 11;
var SYNTAX_ERR = 12;
var INVALID_MODIFICATION_ERR = 13;
var NAMESPACE_ERR = 14;
var INVALID_ACCESS_ERR = 15;
var TYPE_MISMATCH_ERR = 17;
var SECURITY_ERR = 18;
var NETWORK_ERR = 19;
var ABORT_ERR = 20;
var URL_MISMATCH_ERR = 21;
var QUOTA_EXCEEDED_ERR = 22;
var TIMEOUT_ERR = 23;
var INVALID_NODE_TYPE_ERR = 24;
var DATA_CLONE_ERR = 25;
var names = [
null,
"INDEX_SIZE_ERR",
null,
"HIERARCHY_REQUEST_ERR",
"WRONG_DOCUMENT_ERR",
"INVALID_CHARACTER_ERR",
null,
"NO_MODIFICATION_ALLOWED_ERR",
"NOT_FOUND_ERR",
"NOT_SUPPORTED_ERR",
"INUSE_ATTRIBUTE_ERR",
"INVALID_STATE_ERR",
"SYNTAX_ERR",
"INVALID_MODIFICATION_ERR",
"NAMESPACE_ERR",
"INVALID_ACCESS_ERR",
null,
"TYPE_MISMATCH_ERR",
"SECURITY_ERR",
"NETWORK_ERR",
"ABORT_ERR",
"URL_MISMATCH_ERR",
"QUOTA_EXCEEDED_ERR",
"TIMEOUT_ERR",
"INVALID_NODE_TYPE_ERR",
"DATA_CLONE_ERR"
];
var messages = [
null,
"INDEX_SIZE_ERR (1): the index is not in the allowed range",
null,
"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model",
"WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required",
"INVALID_CHARACTER_ERR (5): the string contains invalid characters",
null,
"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified",
"NOT_FOUND_ERR (8): the object can not be found here",
"NOT_SUPPORTED_ERR (9): this operation is not supported",
"INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute",
"INVALID_STATE_ERR (11): the object is in an invalid state",
"SYNTAX_ERR (12): the string did not match the expected pattern",
"INVALID_MODIFICATION_ERR (13): the object can not be modified in this way",
"NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML",
"INVALID_ACCESS_ERR (15): the object does not support the operation or argument",
null,
"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type",
"SECURITY_ERR (18): the operation is insecure",
"NETWORK_ERR (19): a network error occurred",
"ABORT_ERR (20): the user aborted an operation",
"URL_MISMATCH_ERR (21): the given URL does not match another URL",
"QUOTA_EXCEEDED_ERR (22): the quota has been exceeded",
"TIMEOUT_ERR (23): a timeout occurred",
"INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation",
"DATA_CLONE_ERR (25): the object can not be cloned."
];
var constants = {
INDEX_SIZE_ERR,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR,
WRONG_DOCUMENT_ERR,
INVALID_CHARACTER_ERR,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR,
NOT_FOUND_ERR,
NOT_SUPPORTED_ERR,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR,
SYNTAX_ERR,
INVALID_MODIFICATION_ERR,
NAMESPACE_ERR,
INVALID_ACCESS_ERR,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR,
SECURITY_ERR,
NETWORK_ERR,
ABORT_ERR,
URL_MISMATCH_ERR,
QUOTA_EXCEEDED_ERR,
TIMEOUT_ERR,
INVALID_NODE_TYPE_ERR,
DATA_CLONE_ERR
};
function DOMException(code) {
Error.call(this);
Error.captureStackTrace(this, this.constructor);
this.code = code;
this.message = messages[code];
this.name = names[code];
}
DOMException.prototype.__proto__ = Error.prototype;
for (c in constants) {
v = { value: constants[c] };
Object.defineProperty(DOMException, c, v);
Object.defineProperty(DOMException.prototype, c, v);
}
var v;
var c;
}
});
// external/npm/node_modules/domino/lib/config.js
var require_config = __commonJS({
"external/npm/node_modules/domino/lib/config.js"(exports) {
exports.isApiWritable = !globalThis.__domino_frozen__;
}
});
// external/npm/node_modules/domino/lib/utils.js
var require_utils = __commonJS({
"external/npm/node_modules/domino/lib/utils.js"(exports) {
"use strict";
var DOMException = require_DOMException();
var ERR = DOMException;
var isApiWritable = require_config().isApiWritable;
exports.NAMESPACE = {
HTML: "http://www.w3.org/1999/xhtml",
XML: "http://www.w3.org/XML/1998/namespace",
XMLNS: "http://www.w3.org/2000/xmlns/",
MATHML: "http://www.w3.org/1998/Math/MathML",
SVG: "http://www.w3.org/2000/svg",
XLINK: "http://www.w3.org/1999/xlink"
};
exports.IndexSizeError = function() {
throw new DOMException(ERR.INDEX_SIZE_ERR);
};
exports.HierarchyRequestError = function() {
throw new DOMException(ERR.HIERARCHY_REQUEST_ERR);
};
exports.WrongDocumentError = function() {
throw new DOMException(ERR.WRONG_DOCUMENT_ERR);
};
exports.InvalidCharacterError = function() {
throw new DOMException(ERR.INVALID_CHARACTER_ERR);
};
exports.NoModificationAllowedError = function() {
throw new DOMException(ERR.NO_MODIFICATION_ALLOWED_ERR);
};
exports.NotFoundError = function() {
throw new DOMException(ERR.NOT_FOUND_ERR);
};
exports.NotSupportedError = function() {
throw new DOMException(ERR.NOT_SUPPORTED_ERR);
};
exports.InvalidStateError = function() {
throw new DOMException(ERR.INVALID_STATE_ERR);
};
exports.SyntaxError = function() {
throw new DOMException(ERR.SYNTAX_ERR);
};
exports.InvalidModificationError = function() {
throw new DOMException(ERR.INVALID_MODIFICATION_ERR);
};
exports.NamespaceError = function() {
throw new DOMException(ERR.NAMESPACE_ERR);
};
exports.InvalidAccessError = function() {
throw new DOMException(ERR.INVALID_ACCESS_ERR);
};
exports.TypeMismatchError = function() {
throw new DOMException(ERR.TYPE_MISMATCH_ERR);
};
exports.SecurityError = function() {
throw new DOMException(ERR.SECURITY_ERR);
};
exports.NetworkError = function() {
throw new DOMException(ERR.NETWORK_ERR);
};
exports.AbortError = function() {
throw new DOMException(ERR.ABORT_ERR);
};
exports.UrlMismatchError = function() {
throw new DOMException(ERR.URL_MISMATCH_ERR);
};
exports.QuotaExceededError = function() {
throw new DOMException(ERR.QUOTA_EXCEEDED_ERR);
};
exports.TimeoutError = function() {
throw new DOMException(ERR.TIMEOUT_ERR);
};
exports.InvalidNodeTypeError = function() {
throw new DOMException(ERR.INVALID_NODE_TYPE_ERR);
};
exports.DataCloneError = function() {
throw new DOMException(ERR.DATA_CLONE_ERR);
};
exports.nyi = function() {
throw new Error("NotYetImplemented");
};
exports.shouldOverride = function() {
throw new Error("Abstract function; should be overriding in subclass.");
};
exports.assert = function(expr, msg) {
if (!expr) {
throw new Error("Assertion failed: " + (msg || "") + "\n" + new Error().stack);
}
};
exports.expose = function(src, c) {
for (var n in src) {
Object.defineProperty(c.prototype, n, { value: src[n], writable: isApiWritable });
}
};
exports.merge = function(a, b) {
for (var n in b) {
a[n] = b[n];
}
};
exports.documentOrder = function(n, m) {
return 3 - (n.compareDocumentPosition(m) & 6);
};
exports.toASCIILowerCase = function(s) {
return s.replace(/[A-Z]+/g, function(c) {
return c.toLowerCase();
});
};
exports.toASCIIUpperCase = function(s) {
return s.replace(/[a-z]+/g, function(c) {
return c.toUpperCase();
});
};
}
});
// external/npm/node_modules/domino/lib/EventTarget.js
var require_EventTarget = __commonJS({
"external/npm/node_modules/domino/lib/EventTarget.js"(exports, module) {
"use strict";
var Event = require_Event();
var MouseEvent = require_MouseEvent();
var utils = require_utils();
module.exports = EventTarget;
function EventTarget() {
}
EventTarget.prototype = {
addEventListener: function addEventListener(type, listener, capture) {
if (!listener)
return;
if (capture === void 0)
capture = false;
if (!this._listeners)
this._listeners = /* @__PURE__ */ Object.create(null);
if (!this._listeners[type])
this._listeners[type] = [];
var list = this._listeners[type];
for (var i = 0, n = list.length; i < n; i++) {
var l = list[i];
if (l.listener === listener && l.capture === capture)
return;
}
var obj = { listener, capture };
if (typeof listener === "function")
obj.f = listener;
list.push(obj);
},
removeEventListener: function removeEventListener(type, listener, capture) {
if (capture === void 0)
capture = false;
if (this._listeners) {
var list = this._listeners[type];
if (list) {
for (var i = 0, n = list.length; i < n; i++) {
var l = list[i];
if (l.listener === listener && l.capture === capture) {
if (list.length === 1) {
this._listeners[type] = void 0;
} else {
list.splice(i, 1);
}
return;
}
}
}
}
},
dispatchEvent: function dispatchEvent(event) {
return this._dispatchEvent(event, false);
},
_dispatchEvent: function _dispatchEvent(event, trusted) {
if (typeof trusted !== "boolean")
trusted = false;
function invoke(target, event2) {
var type = event2.type, phase = event2.eventPhase;
event2.currentTarget = target;
if (phase !== Event.CAPTURING_PHASE && target._handlers && target._handlers[type]) {
var handler = target._handlers[type];
var rv;
if (typeof handler === "function") {
rv = handler.call(event2.currentTarget, event2);
} else {
var f = handler.handleEvent;
if (typeof f !== "function")
throw new TypeError("handleEvent property of event handler object isnot a function.");
rv = f.call(handler, event2);
}
switch (event2.type) {
case "mouseover":
if (rv === true)
event2.preventDefault();
break;
case "beforeunload":
default:
if (rv === false)
event2.preventDefault();
break;
}
}
var list = target._listeners && target._listeners[type];
if (!list)
return;
list = list.slice();
for (var i2 = 0, n2 = list.length; i2 < n2; i2++) {
if (event2._immediatePropagationStopped)
return;
var l = list[i2];
if (phase === Event.CAPTURING_PHASE && !l.capture || phase === Event.BUBBLING_PHASE && l.capture)
continue;
if (l.f) {
l.f.call(event2.currentTarget, event2);
} else {
var fn = l.listener.handleEvent;
if (typeof fn !== "function")
throw new TypeError("handleEvent property of event listener object is not a function.");
fn.call(l.listener, event2);
}
}
}
if (!event._initialized || event._dispatching)
utils.InvalidStateError();
event.isTrusted = trusted;
event._dispatching = true;
event.target = this;
var ancestors = [];
for (var n = this.parentNode; n; n = n.parentNode)
ancestors.push(n);
event.eventPhase = Event.CAPTURING_PHASE;
for (var i = ancestors.length - 1; i >= 0; i--) {
invoke(ancestors[i], event);
if (event._propagationStopped)
break;
}
if (!event._propagationStopped) {
event.eventPhase = Event.AT_TARGET;
invoke(this, event);
}
if (event.bubbles && !event._propagationStopped) {
event.eventPhase = Event.BUBBLING_PHASE;
for (var ii = 0, nn = ancestors.length; ii < nn; ii++) {
invoke(ancestors[ii], event);
if (event._propagationStopped)
break;
}
}
event._dispatching = false;
event.eventPhase = Event.AT_TARGET;
event.currentTarget = null;
if (trusted && !event.defaultPrevented && event instanceof MouseEvent) {
switch (event.type) {
case "mousedown":
this._armed = {
x: event.clientX,
y: event.clientY,
t: event.timeStamp
};
break;
case "mouseout":
case "mouseover":
this._armed = null;
break;
case "mouseup":
if (this._isClick(event))
this._doClick(event);
this._armed = null;
break;
}
}
return !event.defaultPrevented;
},
_isClick: function(event) {
return this._armed !== null && event.type === "mouseup" && event.isTrusted && event.button === 0 && event.timeStamp - this._armed.t < 1e3 && Math.abs(event.clientX - this._armed.x) < 10 && Math.abs(event.clientY - this._armed.Y) < 10;
},
_doClick: function(event) {
if (this._click_in_progress)
return;
this._click_in_progress = true;
var activated = this;
while (activated && !activated._post_click_activation_steps)
activated = activated.parentNode;
if (activated && activated._pre_click_activation_steps) {
activated._pre_click_activation_steps();
}
var click = this.ownerDocument.createEvent("MouseEvent");
click.initMouseEvent(
"click",
true,
true,
this.ownerDocument.defaultView,
1,
event.screenX,
event.screenY,
event.clientX,
event.clientY,
event.ctrlKey,
event.altKey,
event.shiftKey,
event.metaKey,
event.button,
null
);
var result = this._dispatchEvent(click, true);
if (activated) {
if (result) {
if (activated._post_click_activation_steps)
activated._post_click_activation_steps(click);
} else {
if (activated._cancelled_activation_steps)
activated._cancelled_activation_steps();
}
}
},
_setEventHandler: function _setEventHandler(type, handler) {
if (!this._handlers)
this._handlers = /* @__PURE__ */ Object.create(null);
this._handlers[type] = handler;
},
_getEventHandler: function _getEventHandler(type) {
return this._handlers && this._handlers[type] || null;
}
};
}
});
// external/npm/node_modules/domino/lib/LinkedList.js
var require_LinkedList = __commonJS({
"external/npm/node_modules/domino/lib/LinkedList.js"(exports, module) {
"use strict";
var utils = require_utils();
var LinkedList = module.exports = {
valid: function(a) {
utils.assert(a, "list falsy");
utils.assert(a._previousSibling, "previous falsy");
utils.assert(a._nextSibling, "next falsy");
return true;
},
insertBefore: function(a, b) {
utils.assert(LinkedList.valid(a) && LinkedList.valid(b));
var a_first = a, a_last = a._previousSibling;
var b_first = b, b_last = b._previousSibling;
a_first._previousSibling = b_last;
a_last._nextSibling = b_first;
b_last._nextSibling = a_first;
b_first._previousSibling = a_last;
utils.assert(LinkedList.valid(a) && LinkedList.valid(b));
},
replace: function(a, b) {
utils.assert(LinkedList.valid(a) && (b === null || LinkedList.valid(b)));
if (b !== null) {
LinkedList.insertBefore(b, a);
}
LinkedList.remove(a);
utils.assert(LinkedList.valid(a) && (b === null || LinkedList.valid(b)));
},
remove: function(a) {
utils.assert(LinkedList.valid(a));
var prev = a._previousSibling;
if (prev === a) {
return;
}
var next = a._nextSibling;
prev._nextSibling = next;
next._previousSibling = prev;
a._previousSibling = a._nextSibling = a;
utils.assert(LinkedList.valid(a));
}
};
}
});
// external/npm/node_modules/domino/lib/NodeUtils.js
var require_NodeUtils = __commonJS({
"external/npm/node_modules/domino/lib/NodeUtils.js"(exports, module) {
"use strict";
module.exports = {
serializeOne,
\u0275escapeMatchingClosingTag: escapeMatchingClosingTag,
\u0275escapeClosingCommentTag: escapeClosingCommentTag,
\u0275escapeProcessingInstructionContent: escapeProcessingInstructionContent
};
var utils = require_utils();
var NAMESPACE = utils.NAMESPACE;
var hasRawContent = {
STYLE: true,
SCRIPT: true,
XMP: true,
IFRAME: true,
NOEMBED: true,
NOFRAMES: true,
PLAINTEXT: true
};
var emptyElements = {
area: true,
base: true,
basefont: true,
bgsound: true,
br: true,
col: true,
embed: true,
frame: true,
hr: true,
img: true,
input: true,
keygen: true,
link: true,
meta: true,
param: true,
source: true,
track: true,
wbr: true
};
var extraNewLine = {};
var ESCAPE_REGEXP = /[&<>\u00A0]/g;
var ESCAPE_ATTR_REGEXP = /[&"<>\u00A0]/g;
function escape(s) {
if (!ESCAPE_REGEXP.test(s)) {
return s;
}
return s.replace(ESCAPE_REGEXP, (c) => {
switch (c) {
case "&":
return "&";
case "<":
return "<";
case ">":
return ">";
case "\xA0":
return " ";
}
});
}
function escapeAttr(s) {
if (!ESCAPE_ATTR_REGEXP.test(s)) {
return s;
}
return s.replace(ESCAPE_ATTR_REGEXP, (c) => {
switch (c) {
case "<":
return "<";
case ">":
return ">";
case "&":
return "&";
case '"':
return """;
case "\xA0":
return " ";
}
});
}
function attrname(a) {
var ns = a.namespaceURI;
if (!ns)
return a.localName;
if (ns === NAMESPACE.XML)
return "xml:" + a.localName;
if (ns === NAMESPACE.XLINK)
return "xlink:" + a.localName;
if (ns === NAMESPACE.XMLNS) {
if (a.localName === "xmlns")
return "xmlns";
else
return "xmlns:" + a.localName;
}
return a.name;
}
function escapeMatchingClosingTag(rawText, parentTag) {
const parentClosingTag = "</" + parentTag;
if (!rawText.toLowerCase().includes(parentClosingTag)) {
return rawText;
}
const result = [...rawText];
const matches = rawText.matchAll(new RegExp(parentClosingTag, "ig"));
for (const match of matches) {
result[match.index] = "<";
}
return result.join("");
}
var CLOSING_COMMENT_REGEXP = /--!?>/;
function escapeClosingCommentTag(rawContent) {
if (!CLOSING_COMMENT_REGEXP.test(rawContent)) {
return rawContent;
}
return rawContent.replace(/(--\!?)>/g, "$1>");
}
function escapeProcessingInstructionContent(rawContent) {
return rawContent.includes(">") ? rawContent.replaceAll(">", ">") : rawContent;
}
function serializeOne(kid, parent) {
var s = "";
switch (kid.nodeType) {
case 1:
var ns = kid.namespaceURI;
var html = ns === NAMESPACE.HTML;
var tagname = html || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML ? kid.localName : kid.tagName;
s += "<" + tagname;
for (var j = 0, k = kid._numattrs; j < k; j++) {
var a = kid._attr(j);
s += " " + attrname(a);
if (a.value !== void 0)
s += '="' + escapeAttr(a.value) + '"';
}
s += ">";
if (!(html && emptyElements[tagname])) {
var ss = kid.serialize();
if (hasRawContent[tagname.toUpperCase()]) {
ss = escapeMatchingClosingTag(ss, tagname);
}
if (html && extraNewLine[tagname] && ss.charAt(0) === "\n")
s += "\n";
s += ss;
s += "</" + tagname + ">";
}
break;
case 3:
case 4:
var parenttag;
if (parent.nodeType === 1 && parent.namespaceURI === NAMESPACE.HTML)
parenttag = parent.tagName;
else
parenttag = "";
if (hasRawContent[parenttag] || parenttag === "NOSCRIPT" && parent.ownerDocument._scripting_enabled) {
s += kid.data;
} else {
s += escape(kid.data);
}
break;
case 8:
s += "<!--" + escapeClosingCommentTag(kid.data) + "-->";
break;
case 7:
const content = escapeProcessingInstructionContent(kid.data);
s += "<?" + kid.target + " " + content + "?>";
break;
case 10:
s += "<!DOCTYPE " + kid.name;
if (false) {
if (kid.publicID) {
s += ' PUBLIC "' + kid.publicId + '"';
}
if (kid.systemId) {
s += ' "' + kid.systemId + '"';
}
}
s += ">";
break;
default:
utils.InvalidStateError();
}
return s;
}
}
});
// external/npm/node_modules/domino/lib/Node.js
var require_Node = __commonJS({
"external/npm/node_modules/domino/lib/Node.js"(exports, module) {
"use strict";
module.exports = Node;
var EventTarget = require_EventTarget();
var LinkedList = require_LinkedList();
var NodeUtils = require_NodeUtils();
var utils = require_utils();
function Node() {
EventTarget.call(this);
this.parentNode = null;
this._nextSibling = this._previousSibling = this;
this._index = void 0;
}
var ELEMENT_NODE = Node.ELEMENT_NODE = 1;
var ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE = 2;
var TEXT_NODE = Node.TEXT_NODE = 3;
var CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE = 4;
var ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE = 5;
var ENTITY_NODE = Node.ENTITY_NODE = 6;
var PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE = 7;
var COMMENT_NODE = Node.COMMENT_NODE = 8;
var DOCUMENT_NODE = Node.DOCUMENT_NODE = 9;
var DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE = 10;
var DOCUMENT_FRAGMENT_NODE = Node.DOCUMENT_FRAGMENT_NODE = 11;
var NOTATION_NODE = Node.NOTATION_NODE = 12;
var DOCUMENT_POSITION_DISCONNECTED = Node.DOCUMENT_POSITION_DISCONNECTED = 1;
var DOCUMENT_POSITION_PRECEDING = Node.DOCUMENT_POSITION_PRECEDING = 2;
var DOCUMENT_POSITION_FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING = 4;
var DOCUMENT_POSITION_CONTAINS = Node.DOCUMENT_POSITION_CONTAINS = 8;
var DOCUMENT_POSITION_CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY = 16;
var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
Node.prototype = Object.create(EventTarget.prototype, {
baseURI: { get: utils.nyi },
parentElement: { get: function() {
return this.parentNode && this.parentNode.nodeType === ELEMENT_NODE ? this.parentNode : null;
} },
hasChildNodes: { value: utils.shouldOverride },
firstChild: { get: utils.shouldOverride },
lastChild: { get: utils.shouldOverride },
isConnected: {
get: function() {
let node = this;
while (node != null) {
if (node.nodeType === Node.DOCUMENT_NODE) {
return true;
}
node = node.parentNode;
if (node != null && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
node = node.host;
}
}
return false;
}
},
previousSibling: { get: function() {
var parent = this.parentNode;
if (!parent)
return null;
if (this === parent.firstChild)
return null;
return this._previousSibling;
} },
nextSibling: { get: function() {
var parent = this.parentNode, next = this._nextSibling;
if (!parent)
return null;
if (next === parent.firstChild)
return null;
return next;
} },
textContent: {
get: function() {
return null;
},
set: function(v) {
}
},
innerText: {
get: function() {
return null;
},
set: function(v) {
}
},
_countChildrenOfType: { value: function(type) {
var sum = 0;
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
if (kid.nodeType === type)
sum++;
}
return sum;
} },
_ensureInsertValid: { value: function _ensureInsertValid(node, child, isPreinsert) {
var parent = this, i, kid;
if (!node.nodeType)
throw new TypeError("not a node");
switch (parent.nodeType) {
case DOCUMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
case ELEMENT_NODE:
break;
default:
utils.HierarchyRequestError();
}
if (node.isAncestor(parent))
utils.HierarchyRequestError();
if (child !== null || !isPreinsert) {
if (child.parentNode !== parent)
utils.NotFoundError();
}
switch (node.nodeType) {
case DOCUMENT_FRAGMENT_NODE:
case DOCUMENT_TYPE_NODE:
case ELEMENT_NODE:
case TEXT_NODE:
case PROCESSING_INSTRUCTION_NODE:
case COMMENT_NODE:
break;
default:
utils.HierarchyRequestError();
}
if (parent.nodeType === DOCUMENT_NODE) {
switch (node.nodeType) {
case TEXT_NODE:
utils.HierarchyRequestError();
break;
case DOCUMENT_FRAGMENT_NODE:
if (node._countChildrenOfType(TEXT_NODE) > 0)
utils.HierarchyRequestError();
switch (node._countChildrenOfType(ELEMENT_NODE)) {
case 0:
break;
case 1:
if (child !== null) {
if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE)
utils.HierarchyRequestError();
for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) {
if (kid.nodeType === DOCUMENT_TYPE_NODE)
utils.HierarchyRequestError();
}
}
i = parent._countChildrenOfType(ELEMENT_NODE);
if (isPreinsert) {
if (i > 0)
utils.HierarchyRequestError();
} else {
if (i > 1 || i === 1 && child.nodeType !== ELEMENT_NODE)
utils.HierarchyRequestError();
}
break;
default:
utils.HierarchyRequestError();
}
break;
case ELEMENT_NODE:
if (child !== null) {
if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE)
utils.HierarchyRequestError();
for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) {
if (kid.nodeType === DOCUMENT_TYPE_NODE)
utils.HierarchyRequestError();
}
}
i = parent._countChildrenOfType(ELEMENT_NODE);
if (isPreinsert) {
if (i > 0)
utils.HierarchyRequestError();
} else {
if (i > 1 || i === 1 && child.nodeType !== ELEMENT_NODE)
utils.HierarchyRequestError();
}
break;
case DOCUMENT_TYPE_NODE:
if (child === null) {
if (parent._countChildrenOfType(ELEMENT_NODE))
utils.HierarchyRequestError();
} else {
for (kid = parent.firstChild; kid !== null; kid = kid.nextSibling) {
if (kid === child)
break;
if (kid.nodeType === ELEMENT_NODE)
utils.HierarchyRequestError();
}
}
i = parent._countChildrenOfType(DOCUMENT_TYPE_NODE);
if (isPreinsert) {
if (i > 0)
utils.HierarchyRequestError();
} else {
if (i > 1 || i === 1 && child.nodeType !== DOCUMENT_TYPE_NODE)
utils.HierarchyRequestError();
}
break;
}
} else {
if (node.nodeType === DOCUMENT_TYPE_NODE)
utils.HierarchyRequestError();
}
} },
insertBefore: { value: function insertBefore(node, child) {
var parent = this;
parent._ensureInsertValid(node, child, true);
var refChild = child;
if (refChild === node) {
refChild = node.nextSibling;
}
parent.doc.adoptNode(node);
node._insertOrReplace(parent, refChild, false);
return node;
} },
appendChild: { value: function(child) {
return this.insertBefore(child, null);
} },
_appendChild: { value: function(child) {
child._insertOrReplace(this, null, false);
} },
removeChild: { value: function removeChild(child) {
var parent = this;
if (!child.nodeType)
throw new TypeError("not a node");
if (child.parentNode !== parent)
utils.NotFoundError();
child.remove();
return child;
} },
replaceChild: { value: function replaceChild(node, child) {
var parent = this;
parent._ensureInsertValid(node, child, false);
if (node.doc !== parent.doc) {
parent.doc.adoptNode(node);
}
node._insertOrReplace(parent, child, true);
return child;
} },
contains: { value: function contains(node) {
if (node === null) {
return false;
}
if (this === node) {
return true;
}
return (this.compareDocumentPosition(node) & DOCUMENT_POSITION_CONTAINED_BY) !== 0;
} },
compareDocumentPosition: { value: function compareDocumentPosition(that) {
if (this === that)
return 0;
if (this.doc !== that.doc || this.rooted !== that.rooted)
return DOCUMENT_POSITION_DISCONNECTED + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
var these = [], those = [];
for (var n = this; n !== null; n = n.parentNode)
these.push(n);
for (n = that; n !== null; n = n.parentNode)
those.push(n);
these.reverse();
those.reverse();
if (these[0] !== those[0])
return DOCUMENT_POSITION_DISCONNECTED + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
n = Math.min(these.length, those.length);
for (var i = 1; i < n; i++) {
if (these[i] !== those[i]) {
if (these[i].index < those[i].index)
return DOCUMENT_POSITION_FOLLOWING;
else
return DOCUMENT_POSITION_PRECEDING;
}
}
if (these.length < those.length)
return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY;
else
return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS;
} },
isSameNode: { value: function isSameNode(node) {
return this === node;
} },
isEqualNode: { value: function isEqualNode(node) {
if (!node)
return false;
if (node.nodeType !== this.nodeType)
return false;
if (!this.isEqual(node))
return false;
for (var c1 = this.firstChild, c2 = node.firstChild; c1 && c2; c1 = c1.nextSibling, c2 = c2.nextSibling) {
if (!c1.isEqualNode(c2))
return false;
}
return c1 === null && c2 === null;
} },
cloneNode: { value: function(deep) {
var clone = this.clone();
if (deep) {
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
clone._appendChild(kid.cloneNode(true));
}
}
return clone;
} },
lookupPrefix: { value: function lookupPrefix(ns) {
var e;
if (ns === "" || ns === null || ns === void 0)
return null;
switch (this.nodeType) {
case ELEMENT_NODE:
return this._lookupNamespacePrefix(ns, this);
case DOCUMENT_NODE:
e = this.documentElement;
return e ? e.lookupPrefix(ns) : null;
case ENTITY_NODE:
case NOTATION_NODE:
case DOCUMENT_FRAGMENT_NODE:
case DOCUMENT_TYPE_NODE:
return null;
case ATTRIBUTE_NODE:
e = this.ownerElement;
return e ? e.lookupPrefix(ns) : null;
default:
e = this.parentElement;
return e ? e.lookupPrefix(ns) : null;
}
} },
lookupNamespaceURI: { value: function lookupNamespaceURI(prefix) {
if (prefix === "" || prefix === void 0) {
prefix = null;
}
var e;
switch (this.nodeType) {
case ELEMENT_NODE:
return utils.shouldOverride();
case DOCUMENT_NODE:
e = this.documentElement;
return e ? e.lookupNamespaceURI(prefix) : null;
case ENTITY_NODE:
case NOTATION_NODE:
case DOCUMENT_TYPE_NODE:
case DOCUMENT_FRAGMENT_NODE:
return null;
case ATTRIBUTE_NODE:
e = this.ownerElement;
return e ? e.lookupNamespaceURI(prefix) : null;
default:
e = this.parentElement;
return e ? e.lookupNamespaceURI(prefix) : null;
}
} },
isDefaultNamespace: { value: function isDefaultNamespace(ns) {
if (ns === "" || ns === void 0) {
ns = null;
}
var defaultNamespace = this.lookupNamespaceURI(null);
return defaultNamespace === ns;
} },
index: { get: function() {
var parent = this.parentNode;
if (this === parent.firstChild)
return 0;
var kids = parent.childNodes;
if (this._index === void 0 || kids[this._index] !== this) {
for (var i = 0; i < kids.length; i++) {
kids[i]._index = i;
}
utils.assert(kids[this._index] === this);
}
return this._index;
} },
isAncestor: { value: function(that) {
if (this.doc !== that.doc)
return false;
if (this.rooted !== that.rooted)
return false;
for (var e = that; e; e = e.parentNode) {
if (e === this)
return true;
}
return false;
} },
ensureSameDoc: { value: function(that) {
if (that.ownerDocument === null) {
that.ownerDocument = this.doc;
} else if (that.ownerDocument !== this.doc) {
utils.WrongDocumentError();
}
} },
removeChildren: { value: utils.shouldOverride },
_insertOrReplace: { value: function _insertOrReplace(parent, before, isReplace) {
var child = this, before_index, i;
if (child.nodeType === DOCUMENT_FRAGMENT_NODE && child.rooted) {
utils.HierarchyRequestError();
}
if (parent._childNodes) {
before_index = before === null ? parent._childNodes.length : before.index;
if (child.parentNode === parent) {
var child_index = child.index;
if (child_index < before_index) {
before_index--;
}
}
}
if (isReplace) {
if (before.rooted)
before.doc.mutateRemove(before);
before.parentNode = null;
}
var n = before;
if (n === null) {
n = parent.firstChild;
}
var bothRooted = child.rooted && parent.rooted;
if (child.nodeType === DOCUMENT_FRAGMENT_NODE) {
var spliceArgs = [0, isReplace ? 1 : 0], next;
for (var kid = child.firstChild; kid !== null; kid = next) {
next = kid.nextSibling;
spliceArgs.push(kid);
kid.parentNode = parent;
}
var len = spliceArgs.length;
if (isReplace) {
LinkedList.replace(n, len > 2 ? spliceArgs[2] : null);
} else if (len > 2 && n !== null) {
LinkedList.insertBefore(spliceArgs[2], n);
}
if (parent._childNodes) {
spliceArgs[0] = before === null ? parent._childNodes.length : before._index;
parent._childNodes.splice.apply(parent._childNodes, spliceArgs);
for (i = 2; i < len; i++) {
spliceArgs[i]._index = spliceArgs[0] + (i - 2);
}
} else if (parent._firstChild === before) {
if (len > 2) {
parent._firstChild = spliceArgs[2];
} else if (isReplace) {
parent._firstChild = null;
}
}
if (child._childNodes) {
child._childNodes.length = 0;
} else {
child._firstChild = null;
}
if (parent.rooted) {
parent.modify();
for (i = 2; i < len; i++) {
parent.doc.mutateInsert(spliceArgs[i]);
}
}
} else {
if (before === child) {
return;
}
if (bothRooted) {
child._remove();
} else if (child.parentNode) {
child.remove();
}
child.parentNode = parent;
if (isReplace) {
LinkedList.replace(n, child);
if (parent._childNodes) {
child._index = before_index;
parent._childNodes[before_index] = child;
} else if (parent._firstChild === before) {
parent._firstChild = child;
}
} else {
if (n !== null) {
LinkedList.insertBefore(child, n);
}
if (parent._childNodes) {
child._index = before_index;
parent._childNodes.splice(before_index, 0, child);
} else if (parent._firstChild === before) {
parent._firstChild = child;
}
}
if (bothRooted) {
parent.modify();
parent.doc.mutateMove(child);
} else if (parent.rooted) {
parent.modify();
parent.doc.mutateInsert(child);
}
}
} },
lastModTime: { get: function() {
if (!this._lastModTime) {
this._lastModTime = this.doc.modclock;
}
return this._lastModTime;
} },
modify: { value: function() {
if (this.doc.modclock) {
var time = ++this.doc.modclock;
for (var n = this; n; n = n.parentElement) {
if (n._lastModTime) {
n._lastModTime = time;
}
}
}
} },
doc: { get: function() {
return this.ownerDocument || this;
} },
rooted: { get: function() {
return !!this._nid;
} },
normalize: { value: function() {
var next;
for (var child = this.firstChild; child !== null; child = next) {
next = child.nextSibling;
if (child.normalize) {
child.normalize();
}
if (child.nodeType !== Node.TEXT_NODE) {
continue;
}
if (child.nodeValue === "") {
this.removeChild(child);
continue;
}
var prevChild = child.previousSibling;
if (prevChild === null) {
continue;
} else if (prevChild.nodeType === Node.TEXT_NODE) {
prevChild.appendData(child.nodeValue);
this.removeChild(child);
}
}
} },
serialize: { value: function() {
if (this._innerHTML) {
return this._innerHTML;
}
var s = "";
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
s += NodeUtils.serializeOne(kid, this);
}
return s;
} },
outerHTML: {
get: function() {
return NodeUtils.serializeOne(this, { nodeType: 0 });
},
set: utils.nyi
},
ELEMENT_NODE: { value: ELEMENT_NODE },
ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE },
TEXT_NODE: { value: TEXT_NODE },
CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE },
ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE },
ENTITY_NODE: { value: ENTITY_NODE },
PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE },
COMMENT_NODE: { value: COMMENT_NODE },
DOCUMENT_NODE: { value: DOCUMENT_NODE },
DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE },
DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE },
NOTATION_NODE: { value: NOTATION_NODE },
DOCUMENT_POSITION_DISCONNECTED: { value: DOCUMENT_POSITION_DISCONNECTED },
DOCUMENT_POSITION_PRECEDING: { value: DOCUMENT_POSITION_PRECEDING },
DOCUMENT_POSITION_FOLLOWING: { value: DOCUMENT_POSITION_FOLLOWING },
DOCUMENT_POSITION_CONTAINS: { value: DOCUMENT_POSITION_CONTAINS },
DOCUMENT_POSITION_CONTAINED_BY: { value: DOCUMENT_POSITION_CONTAINED_BY },
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC }
});
}
});
// external/npm/node_modules/domino/lib/NodeList.es6.js
var require_NodeList_es6 = __commonJS({
"external/npm/node_modules/domino/lib/NodeList.es6.js"(exports, module) {
"use strict";
module.exports = class NodeList extends Array {
constructor(a) {
super(a && a.length || 0);
if (a) {
for (var idx in a) {
this[idx] = a[idx];
}
}
}
item(i) {
return this[i] || null;
}
};
}
});
// external/npm/node_modules/domino/lib/NodeList.es5.js
var require_NodeList_es5 = __commonJS({
"external/npm/node_modules/domino/lib/NodeList.es5.js"(exports, module) {
"use strict";
function item(i) {
return this[i] || null;
}
function NodeList(a) {
if (!a)
a = [];
a.item = item;
return a;
}
module.exports = NodeList;
}
});
// external/npm/node_modules/domino/lib/NodeList.js
var require_NodeList = __commonJS({
"external/npm/node_modules/domino/lib/NodeList.js"(exports, module) {
"use strict";
var NodeList;
try {
NodeList = require_NodeList_es6();
} catch (e) {
NodeList = require_NodeList_es5();
}
module.exports = NodeList;
}
});
// external/npm/node_modules/domino/lib/ContainerNode.js
var require_ContainerNode = __commonJS({
"external/npm/node_modules/domino/lib/ContainerNode.js"(exports, module) {
"use strict";
module.exports = ContainerNode;
var Node = require_Node();
var NodeList = require_NodeList();
function ContainerNode() {
Node.call(this);
this._firstChild = this._childNodes = null;
}
ContainerNode.prototype = Object.create(Node.prototype, {
hasChildNodes: { value: function() {
if (this._childNodes) {
return this._childNodes.length > 0;
}
return this._firstChild !== null;
} },
childNodes: { get: function() {
this._ensureChildNodes();
return this._childNodes;
} },
firstChild: { get: function() {
if (this._childNode