@amplitude/rrweb-player 2.1.6 → 2.1.7
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/rrweb-player.cjs +825 -745
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +825 -745
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +825 -745
- package/dist/rrweb-player.umd.cjs.map +2 -2
- package/dist/rrweb-player.umd.min.cjs +27 -27
- package/dist/rrweb-player.umd.min.cjs.map +3 -3
- package/package.json +5 -5
package/dist/rrweb-player.cjs
CHANGED
|
@@ -14014,643 +14014,119 @@ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
|
|
|
14014
14014
|
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
14015
14015
|
return NodeType2;
|
|
14016
14016
|
})(NodeType$1 || {});
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
const comment2 = /\/\*.*?\*\//g;
|
|
14022
|
-
cssText.replace(comment2, "").split(listDelimiter).forEach(function(item) {
|
|
14023
|
-
if (item) {
|
|
14024
|
-
const tmp = item.split(propertyDelimiter);
|
|
14025
|
-
tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());
|
|
14026
|
-
}
|
|
14027
|
-
});
|
|
14028
|
-
return res;
|
|
14029
|
-
}
|
|
14030
|
-
function toCSSText(style) {
|
|
14031
|
-
const properties = [];
|
|
14032
|
-
for (const name in style) {
|
|
14033
|
-
const value = style[name];
|
|
14034
|
-
if (typeof value !== "string") continue;
|
|
14035
|
-
const normalizedName = hyphenate(name);
|
|
14036
|
-
properties.push(`${normalizedName}: ${value};`);
|
|
14037
|
-
}
|
|
14038
|
-
return properties.join(" ");
|
|
14039
|
-
}
|
|
14040
|
-
const camelizeRE = /-([a-z])/g;
|
|
14041
|
-
const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
14042
|
-
const camelize = (str) => {
|
|
14043
|
-
if (CUSTOM_PROPERTY_REGEX.test(str)) return str;
|
|
14044
|
-
return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : "");
|
|
14017
|
+
const NAMESPACES = {
|
|
14018
|
+
svg: "http://www.w3.org/2000/svg",
|
|
14019
|
+
"xlink:href": "http://www.w3.org/1999/xlink",
|
|
14020
|
+
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
14045
14021
|
};
|
|
14046
|
-
const
|
|
14047
|
-
|
|
14048
|
-
|
|
14022
|
+
const SVGTagMap = {
|
|
14023
|
+
altglyph: "altGlyph",
|
|
14024
|
+
altglyphdef: "altGlyphDef",
|
|
14025
|
+
altglyphitem: "altGlyphItem",
|
|
14026
|
+
animatecolor: "animateColor",
|
|
14027
|
+
animatemotion: "animateMotion",
|
|
14028
|
+
animatetransform: "animateTransform",
|
|
14029
|
+
clippath: "clipPath",
|
|
14030
|
+
feblend: "feBlend",
|
|
14031
|
+
fecolormatrix: "feColorMatrix",
|
|
14032
|
+
fecomponenttransfer: "feComponentTransfer",
|
|
14033
|
+
fecomposite: "feComposite",
|
|
14034
|
+
feconvolvematrix: "feConvolveMatrix",
|
|
14035
|
+
fediffuselighting: "feDiffuseLighting",
|
|
14036
|
+
fedisplacementmap: "feDisplacementMap",
|
|
14037
|
+
fedistantlight: "feDistantLight",
|
|
14038
|
+
fedropshadow: "feDropShadow",
|
|
14039
|
+
feflood: "feFlood",
|
|
14040
|
+
fefunca: "feFuncA",
|
|
14041
|
+
fefuncb: "feFuncB",
|
|
14042
|
+
fefuncg: "feFuncG",
|
|
14043
|
+
fefuncr: "feFuncR",
|
|
14044
|
+
fegaussianblur: "feGaussianBlur",
|
|
14045
|
+
feimage: "feImage",
|
|
14046
|
+
femerge: "feMerge",
|
|
14047
|
+
femergenode: "feMergeNode",
|
|
14048
|
+
femorphology: "feMorphology",
|
|
14049
|
+
feoffset: "feOffset",
|
|
14050
|
+
fepointlight: "fePointLight",
|
|
14051
|
+
fespecularlighting: "feSpecularLighting",
|
|
14052
|
+
fespotlight: "feSpotLight",
|
|
14053
|
+
fetile: "feTile",
|
|
14054
|
+
feturbulence: "feTurbulence",
|
|
14055
|
+
foreignobject: "foreignObject",
|
|
14056
|
+
glyphref: "glyphRef",
|
|
14057
|
+
lineargradient: "linearGradient",
|
|
14058
|
+
radialgradient: "radialGradient"
|
|
14049
14059
|
};
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
__publicField22(this, "ELEMENT_NODE", 1);
|
|
14061
|
-
__publicField22(this, "TEXT_NODE", 3);
|
|
14062
|
-
__publicField22(this, "nodeType");
|
|
14063
|
-
__publicField22(this, "nodeName");
|
|
14064
|
-
__publicField22(this, "RRNodeType");
|
|
14065
|
-
}
|
|
14066
|
-
get childNodes() {
|
|
14067
|
-
const childNodes2 = [];
|
|
14068
|
-
let childIterator = this.firstChild;
|
|
14069
|
-
while (childIterator) {
|
|
14070
|
-
childNodes2.push(childIterator);
|
|
14071
|
-
childIterator = childIterator.nextSibling;
|
|
14072
|
-
}
|
|
14073
|
-
return childNodes2;
|
|
14074
|
-
}
|
|
14075
|
-
contains(node2) {
|
|
14076
|
-
if (!(node2 instanceof BaseRRNode)) return false;
|
|
14077
|
-
else if (node2.ownerDocument !== this.ownerDocument) return false;
|
|
14078
|
-
else if (node2 === this) return true;
|
|
14079
|
-
while (node2.parentNode) {
|
|
14080
|
-
if (node2.parentNode === this) return true;
|
|
14081
|
-
node2 = node2.parentNode;
|
|
14082
|
-
}
|
|
14083
|
-
return false;
|
|
14084
|
-
}
|
|
14085
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14086
|
-
appendChild(_newChild) {
|
|
14087
|
-
throw new Error(
|
|
14088
|
-
`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14089
|
-
);
|
|
14090
|
-
}
|
|
14091
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14092
|
-
insertBefore(_newChild, _refChild) {
|
|
14093
|
-
throw new Error(
|
|
14094
|
-
`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`
|
|
14095
|
-
);
|
|
14096
|
-
}
|
|
14097
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14098
|
-
removeChild(_node) {
|
|
14099
|
-
throw new Error(
|
|
14100
|
-
`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14101
|
-
);
|
|
14102
|
-
}
|
|
14103
|
-
toString() {
|
|
14104
|
-
return "RRNode";
|
|
14105
|
-
}
|
|
14060
|
+
let createdNodeSet = null;
|
|
14061
|
+
function diff(oldTree, newTree, replayer, rrnodeMirror = newTree.mirror || newTree.ownerDocument.mirror) {
|
|
14062
|
+
oldTree = diffBeforeUpdatingChildren(
|
|
14063
|
+
oldTree,
|
|
14064
|
+
newTree,
|
|
14065
|
+
replayer,
|
|
14066
|
+
rrnodeMirror
|
|
14067
|
+
);
|
|
14068
|
+
diffChildren(oldTree, newTree, replayer, rrnodeMirror);
|
|
14069
|
+
diffAfterUpdatingChildren(oldTree, newTree, replayer);
|
|
14106
14070
|
}
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
__publicField22(this, "RRNodeType", NodeType$1.Document);
|
|
14115
|
-
__publicField22(this, "textContent", null);
|
|
14116
|
-
this.ownerDocument = this;
|
|
14117
|
-
}
|
|
14118
|
-
get documentElement() {
|
|
14119
|
-
return this.childNodes.find(
|
|
14120
|
-
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HTML"
|
|
14121
|
-
) || null;
|
|
14122
|
-
}
|
|
14123
|
-
get body() {
|
|
14124
|
-
var _a22;
|
|
14125
|
-
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14126
|
-
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "BODY"
|
|
14127
|
-
)) || null;
|
|
14128
|
-
}
|
|
14129
|
-
get head() {
|
|
14130
|
-
var _a22;
|
|
14131
|
-
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14132
|
-
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HEAD"
|
|
14133
|
-
)) || null;
|
|
14134
|
-
}
|
|
14135
|
-
get implementation() {
|
|
14136
|
-
return this;
|
|
14071
|
+
function diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
14072
|
+
var _a22;
|
|
14073
|
+
if (replayer.afterAppend && !createdNodeSet) {
|
|
14074
|
+
createdNodeSet = /* @__PURE__ */ new WeakSet();
|
|
14075
|
+
setTimeout(() => {
|
|
14076
|
+
createdNodeSet = null;
|
|
14077
|
+
}, 0);
|
|
14137
14078
|
}
|
|
14138
|
-
|
|
14139
|
-
|
|
14079
|
+
if (!sameNodeType(oldTree, newTree)) {
|
|
14080
|
+
const calibratedOldTree = createOrGetNode(
|
|
14081
|
+
newTree,
|
|
14082
|
+
replayer.mirror,
|
|
14083
|
+
rrnodeMirror
|
|
14084
|
+
);
|
|
14085
|
+
(_a22 = oldTree.parentNode) == null ? void 0 : _a22.replaceChild(calibratedOldTree, oldTree);
|
|
14086
|
+
oldTree = calibratedOldTree;
|
|
14140
14087
|
}
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14088
|
+
switch (newTree.RRNodeType) {
|
|
14089
|
+
case NodeType$1.Document: {
|
|
14090
|
+
if (!nodeMatching(oldTree, newTree, replayer.mirror, rrnodeMirror)) {
|
|
14091
|
+
const newMeta = rrnodeMirror.getMeta(newTree);
|
|
14092
|
+
if (newMeta) {
|
|
14093
|
+
replayer.mirror.removeNodeFromMap(oldTree);
|
|
14094
|
+
oldTree.close();
|
|
14095
|
+
oldTree.open();
|
|
14096
|
+
replayer.mirror.add(oldTree, newMeta);
|
|
14097
|
+
createdNodeSet == null ? void 0 : createdNodeSet.add(oldTree);
|
|
14098
|
+
}
|
|
14148
14099
|
}
|
|
14100
|
+
break;
|
|
14149
14101
|
}
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14102
|
+
case NodeType$1.Element: {
|
|
14103
|
+
const oldElement = oldTree;
|
|
14104
|
+
const newRRElement = newTree;
|
|
14105
|
+
switch (newRRElement.tagName) {
|
|
14106
|
+
case "IFRAME": {
|
|
14107
|
+
const oldContentDocument = oldTree.contentDocument;
|
|
14108
|
+
if (!oldContentDocument) break;
|
|
14109
|
+
diff(
|
|
14110
|
+
oldContentDocument,
|
|
14111
|
+
newTree.contentDocument,
|
|
14112
|
+
replayer,
|
|
14113
|
+
rrnodeMirror
|
|
14114
|
+
);
|
|
14115
|
+
break;
|
|
14116
|
+
}
|
|
14117
|
+
}
|
|
14118
|
+
if (newRRElement.shadowRoot) {
|
|
14119
|
+
if (!oldElement.shadowRoot) oldElement.attachShadow({ mode: "open" });
|
|
14120
|
+
diffChildren(
|
|
14121
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14122
|
+
oldElement.shadowRoot,
|
|
14123
|
+
newRRElement.shadowRoot,
|
|
14124
|
+
replayer,
|
|
14125
|
+
rrnodeMirror
|
|
14160
14126
|
);
|
|
14161
14127
|
}
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
child2.parentElement = null;
|
|
14165
|
-
return child2;
|
|
14166
|
-
}
|
|
14167
|
-
removeChild(node2) {
|
|
14168
|
-
return removeChild(this, node2);
|
|
14169
|
-
}
|
|
14170
|
-
open() {
|
|
14171
|
-
this.firstChild = null;
|
|
14172
|
-
this.lastChild = null;
|
|
14173
|
-
}
|
|
14174
|
-
close() {
|
|
14175
|
-
}
|
|
14176
|
-
/**
|
|
14177
|
-
* Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).
|
|
14178
|
-
* There are two lines used this function:
|
|
14179
|
-
* 1. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""\>')
|
|
14180
|
-
* 2. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ""\>')
|
|
14181
|
-
*/
|
|
14182
|
-
write(content) {
|
|
14183
|
-
let publicId;
|
|
14184
|
-
if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">')
|
|
14185
|
-
publicId = "-//W3C//DTD XHTML 1.0 Transitional//EN";
|
|
14186
|
-
else if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')
|
|
14187
|
-
publicId = "-//W3C//DTD HTML 4.0 Transitional//EN";
|
|
14188
|
-
if (publicId) {
|
|
14189
|
-
const doctype = this.createDocumentType("html", publicId, "");
|
|
14190
|
-
this.open();
|
|
14191
|
-
this.appendChild(doctype);
|
|
14192
|
-
}
|
|
14193
|
-
}
|
|
14194
|
-
createDocument(_namespace, _qualifiedName, _doctype) {
|
|
14195
|
-
return new BaseRRDocument();
|
|
14196
|
-
}
|
|
14197
|
-
createDocumentType(qualifiedName, publicId, systemId) {
|
|
14198
|
-
const doctype = new BaseRRDocumentType(qualifiedName, publicId, systemId);
|
|
14199
|
-
doctype.ownerDocument = this;
|
|
14200
|
-
return doctype;
|
|
14201
|
-
}
|
|
14202
|
-
createElement(tagName) {
|
|
14203
|
-
const element = new BaseRRElement(tagName);
|
|
14204
|
-
element.ownerDocument = this;
|
|
14205
|
-
return element;
|
|
14206
|
-
}
|
|
14207
|
-
createElementNS(_namespaceURI, qualifiedName) {
|
|
14208
|
-
return this.createElement(qualifiedName);
|
|
14209
|
-
}
|
|
14210
|
-
createTextNode(data) {
|
|
14211
|
-
const text = new BaseRRText(data);
|
|
14212
|
-
text.ownerDocument = this;
|
|
14213
|
-
return text;
|
|
14214
|
-
}
|
|
14215
|
-
createComment(data) {
|
|
14216
|
-
const comment2 = new BaseRRComment(data);
|
|
14217
|
-
comment2.ownerDocument = this;
|
|
14218
|
-
return comment2;
|
|
14219
|
-
}
|
|
14220
|
-
createCDATASection(data) {
|
|
14221
|
-
const CDATASection = new BaseRRCDATASection(data);
|
|
14222
|
-
CDATASection.ownerDocument = this;
|
|
14223
|
-
return CDATASection;
|
|
14224
|
-
}
|
|
14225
|
-
toString() {
|
|
14226
|
-
return "RRDocument";
|
|
14227
|
-
}
|
|
14228
|
-
}
|
|
14229
|
-
class BaseRRDocumentType extends BaseRRNode {
|
|
14230
|
-
constructor(qualifiedName, publicId, systemId) {
|
|
14231
|
-
super();
|
|
14232
|
-
__publicField22(this, "nodeType", 10);
|
|
14233
|
-
__publicField22(this, "RRNodeType", NodeType$1.DocumentType);
|
|
14234
|
-
__publicField22(this, "name");
|
|
14235
|
-
__publicField22(this, "publicId");
|
|
14236
|
-
__publicField22(this, "systemId");
|
|
14237
|
-
__publicField22(this, "textContent", null);
|
|
14238
|
-
this.name = qualifiedName;
|
|
14239
|
-
this.publicId = publicId;
|
|
14240
|
-
this.systemId = systemId;
|
|
14241
|
-
this.nodeName = qualifiedName;
|
|
14242
|
-
}
|
|
14243
|
-
toString() {
|
|
14244
|
-
return "RRDocumentType";
|
|
14245
|
-
}
|
|
14246
|
-
}
|
|
14247
|
-
class BaseRRElement extends BaseRRNode {
|
|
14248
|
-
constructor(tagName) {
|
|
14249
|
-
super();
|
|
14250
|
-
__publicField22(this, "nodeType", 1);
|
|
14251
|
-
__publicField22(this, "RRNodeType", NodeType$1.Element);
|
|
14252
|
-
__publicField22(this, "tagName");
|
|
14253
|
-
__publicField22(this, "attributes", {});
|
|
14254
|
-
__publicField22(this, "shadowRoot", null);
|
|
14255
|
-
__publicField22(this, "scrollLeft");
|
|
14256
|
-
__publicField22(this, "scrollTop");
|
|
14257
|
-
this.tagName = tagName.toUpperCase();
|
|
14258
|
-
this.nodeName = tagName.toUpperCase();
|
|
14259
|
-
}
|
|
14260
|
-
get textContent() {
|
|
14261
|
-
let result2 = "";
|
|
14262
|
-
this.childNodes.forEach((node2) => result2 += node2.textContent);
|
|
14263
|
-
return result2;
|
|
14264
|
-
}
|
|
14265
|
-
set textContent(textContent2) {
|
|
14266
|
-
this.firstChild = null;
|
|
14267
|
-
this.lastChild = null;
|
|
14268
|
-
this.appendChild(this.ownerDocument.createTextNode(textContent2));
|
|
14269
|
-
}
|
|
14270
|
-
get classList() {
|
|
14271
|
-
return new ClassList(
|
|
14272
|
-
this.attributes.class,
|
|
14273
|
-
(newClassName) => {
|
|
14274
|
-
this.attributes.class = newClassName;
|
|
14275
|
-
}
|
|
14276
|
-
);
|
|
14277
|
-
}
|
|
14278
|
-
get id() {
|
|
14279
|
-
return this.attributes.id || "";
|
|
14280
|
-
}
|
|
14281
|
-
get className() {
|
|
14282
|
-
return this.attributes.class || "";
|
|
14283
|
-
}
|
|
14284
|
-
get style() {
|
|
14285
|
-
const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};
|
|
14286
|
-
const hyphenateRE2 = /\B([A-Z])/g;
|
|
14287
|
-
style.setProperty = (name, value, priority) => {
|
|
14288
|
-
if (hyphenateRE2.test(name)) return;
|
|
14289
|
-
const normalizedName = camelize(name);
|
|
14290
|
-
if (!value) delete style[normalizedName];
|
|
14291
|
-
else style[normalizedName] = value;
|
|
14292
|
-
if (priority === "important") style[normalizedName] += " !important";
|
|
14293
|
-
this.attributes.style = toCSSText(style);
|
|
14294
|
-
};
|
|
14295
|
-
style.removeProperty = (name) => {
|
|
14296
|
-
if (hyphenateRE2.test(name)) return "";
|
|
14297
|
-
const normalizedName = camelize(name);
|
|
14298
|
-
const value = style[normalizedName] || "";
|
|
14299
|
-
delete style[normalizedName];
|
|
14300
|
-
this.attributes.style = toCSSText(style);
|
|
14301
|
-
return value;
|
|
14302
|
-
};
|
|
14303
|
-
return style;
|
|
14304
|
-
}
|
|
14305
|
-
getAttribute(name) {
|
|
14306
|
-
if (this.attributes[name] === void 0) return null;
|
|
14307
|
-
return this.attributes[name];
|
|
14308
|
-
}
|
|
14309
|
-
setAttribute(name, attribute) {
|
|
14310
|
-
this.attributes[name] = attribute;
|
|
14311
|
-
}
|
|
14312
|
-
setAttributeNS(_namespace, qualifiedName, value) {
|
|
14313
|
-
this.setAttribute(qualifiedName, value);
|
|
14314
|
-
}
|
|
14315
|
-
removeAttribute(name) {
|
|
14316
|
-
delete this.attributes[name];
|
|
14317
|
-
}
|
|
14318
|
-
appendChild(newChild) {
|
|
14319
|
-
return appendChild(this, newChild);
|
|
14320
|
-
}
|
|
14321
|
-
insertBefore(newChild, refChild) {
|
|
14322
|
-
return insertBefore(this, newChild, refChild);
|
|
14323
|
-
}
|
|
14324
|
-
removeChild(node2) {
|
|
14325
|
-
return removeChild(this, node2);
|
|
14326
|
-
}
|
|
14327
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14328
|
-
attachShadow(_init) {
|
|
14329
|
-
const shadowRoot2 = this.ownerDocument.createElement("SHADOWROOT");
|
|
14330
|
-
this.shadowRoot = shadowRoot2;
|
|
14331
|
-
return shadowRoot2;
|
|
14332
|
-
}
|
|
14333
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14334
|
-
dispatchEvent(_event) {
|
|
14335
|
-
return true;
|
|
14336
|
-
}
|
|
14337
|
-
toString() {
|
|
14338
|
-
let attributeString = "";
|
|
14339
|
-
for (const attribute in this.attributes) {
|
|
14340
|
-
attributeString += `${attribute}="${this.attributes[attribute]}" `;
|
|
14341
|
-
}
|
|
14342
|
-
return `${this.tagName} ${attributeString}`;
|
|
14343
|
-
}
|
|
14344
|
-
}
|
|
14345
|
-
class BaseRRMediaElement extends BaseRRElement {
|
|
14346
|
-
constructor() {
|
|
14347
|
-
super(...arguments);
|
|
14348
|
-
__publicField22(this, "currentTime");
|
|
14349
|
-
__publicField22(this, "volume");
|
|
14350
|
-
__publicField22(this, "paused");
|
|
14351
|
-
__publicField22(this, "muted");
|
|
14352
|
-
__publicField22(this, "playbackRate");
|
|
14353
|
-
__publicField22(this, "loop");
|
|
14354
|
-
}
|
|
14355
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14356
|
-
attachShadow(_init) {
|
|
14357
|
-
throw new Error(
|
|
14358
|
-
`RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`
|
|
14359
|
-
);
|
|
14360
|
-
}
|
|
14361
|
-
play() {
|
|
14362
|
-
this.paused = false;
|
|
14363
|
-
}
|
|
14364
|
-
pause() {
|
|
14365
|
-
this.paused = true;
|
|
14366
|
-
}
|
|
14367
|
-
}
|
|
14368
|
-
class BaseRRDialogElement extends BaseRRElement {
|
|
14369
|
-
constructor() {
|
|
14370
|
-
super(...arguments);
|
|
14371
|
-
__publicField22(this, "tagName", "DIALOG");
|
|
14372
|
-
__publicField22(this, "nodeName", "DIALOG");
|
|
14373
|
-
}
|
|
14374
|
-
get isModal() {
|
|
14375
|
-
return this.getAttribute("rr_open_mode") === "modal";
|
|
14376
|
-
}
|
|
14377
|
-
get open() {
|
|
14378
|
-
return this.getAttribute("open") !== null;
|
|
14379
|
-
}
|
|
14380
|
-
close() {
|
|
14381
|
-
this.removeAttribute("open");
|
|
14382
|
-
this.removeAttribute("rr_open_mode");
|
|
14383
|
-
}
|
|
14384
|
-
show() {
|
|
14385
|
-
this.setAttribute("open", "");
|
|
14386
|
-
this.setAttribute("rr_open_mode", "non-modal");
|
|
14387
|
-
}
|
|
14388
|
-
showModal() {
|
|
14389
|
-
this.setAttribute("open", "");
|
|
14390
|
-
this.setAttribute("rr_open_mode", "modal");
|
|
14391
|
-
}
|
|
14392
|
-
}
|
|
14393
|
-
class BaseRRText extends BaseRRNode {
|
|
14394
|
-
constructor(data) {
|
|
14395
|
-
super();
|
|
14396
|
-
__publicField22(this, "nodeType", 3);
|
|
14397
|
-
__publicField22(this, "nodeName", "#text");
|
|
14398
|
-
__publicField22(this, "RRNodeType", NodeType$1.Text);
|
|
14399
|
-
__publicField22(this, "data");
|
|
14400
|
-
this.data = data;
|
|
14401
|
-
}
|
|
14402
|
-
get textContent() {
|
|
14403
|
-
return this.data;
|
|
14404
|
-
}
|
|
14405
|
-
set textContent(textContent2) {
|
|
14406
|
-
this.data = textContent2;
|
|
14407
|
-
}
|
|
14408
|
-
toString() {
|
|
14409
|
-
return `RRText text=${JSON.stringify(this.data)}`;
|
|
14410
|
-
}
|
|
14411
|
-
}
|
|
14412
|
-
class BaseRRComment extends BaseRRNode {
|
|
14413
|
-
constructor(data) {
|
|
14414
|
-
super();
|
|
14415
|
-
__publicField22(this, "nodeType", 8);
|
|
14416
|
-
__publicField22(this, "nodeName", "#comment");
|
|
14417
|
-
__publicField22(this, "RRNodeType", NodeType$1.Comment);
|
|
14418
|
-
__publicField22(this, "data");
|
|
14419
|
-
this.data = data;
|
|
14420
|
-
}
|
|
14421
|
-
get textContent() {
|
|
14422
|
-
return this.data;
|
|
14423
|
-
}
|
|
14424
|
-
set textContent(textContent2) {
|
|
14425
|
-
this.data = textContent2;
|
|
14426
|
-
}
|
|
14427
|
-
toString() {
|
|
14428
|
-
return `RRComment text=${JSON.stringify(this.data)}`;
|
|
14429
|
-
}
|
|
14430
|
-
}
|
|
14431
|
-
class BaseRRCDATASection extends BaseRRNode {
|
|
14432
|
-
constructor(data) {
|
|
14433
|
-
super();
|
|
14434
|
-
__publicField22(this, "nodeName", "#cdata-section");
|
|
14435
|
-
__publicField22(this, "nodeType", 4);
|
|
14436
|
-
__publicField22(this, "RRNodeType", NodeType$1.CDATA);
|
|
14437
|
-
__publicField22(this, "data");
|
|
14438
|
-
this.data = data;
|
|
14439
|
-
}
|
|
14440
|
-
get textContent() {
|
|
14441
|
-
return this.data;
|
|
14442
|
-
}
|
|
14443
|
-
set textContent(textContent2) {
|
|
14444
|
-
this.data = textContent2;
|
|
14445
|
-
}
|
|
14446
|
-
toString() {
|
|
14447
|
-
return `RRCDATASection data=${JSON.stringify(this.data)}`;
|
|
14448
|
-
}
|
|
14449
|
-
}
|
|
14450
|
-
class ClassList {
|
|
14451
|
-
constructor(classText, onChange) {
|
|
14452
|
-
__publicField22(this, "onChange");
|
|
14453
|
-
__publicField22(this, "classes", []);
|
|
14454
|
-
__publicField22(this, "add", (...classNames) => {
|
|
14455
|
-
for (const item of classNames) {
|
|
14456
|
-
const className = String(item);
|
|
14457
|
-
if (this.classes.indexOf(className) >= 0) continue;
|
|
14458
|
-
this.classes.push(className);
|
|
14459
|
-
}
|
|
14460
|
-
this.onChange && this.onChange(this.classes.join(" "));
|
|
14461
|
-
});
|
|
14462
|
-
__publicField22(this, "remove", (...classNames) => {
|
|
14463
|
-
this.classes = this.classes.filter(
|
|
14464
|
-
(item) => classNames.indexOf(item) === -1
|
|
14465
|
-
);
|
|
14466
|
-
this.onChange && this.onChange(this.classes.join(" "));
|
|
14467
|
-
});
|
|
14468
|
-
if (classText) {
|
|
14469
|
-
const classes = classText.trim().split(/\s+/);
|
|
14470
|
-
this.classes.push(...classes);
|
|
14471
|
-
}
|
|
14472
|
-
this.onChange = onChange;
|
|
14473
|
-
}
|
|
14474
|
-
}
|
|
14475
|
-
function appendChild(parent, newChild) {
|
|
14476
|
-
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
14477
|
-
if (parent.lastChild) {
|
|
14478
|
-
parent.lastChild.nextSibling = newChild;
|
|
14479
|
-
newChild.previousSibling = parent.lastChild;
|
|
14480
|
-
} else {
|
|
14481
|
-
parent.firstChild = newChild;
|
|
14482
|
-
newChild.previousSibling = null;
|
|
14483
|
-
}
|
|
14484
|
-
parent.lastChild = newChild;
|
|
14485
|
-
newChild.nextSibling = null;
|
|
14486
|
-
newChild.parentNode = parent;
|
|
14487
|
-
newChild.parentElement = parent;
|
|
14488
|
-
newChild.ownerDocument = parent.ownerDocument;
|
|
14489
|
-
return newChild;
|
|
14490
|
-
}
|
|
14491
|
-
function insertBefore(parent, newChild, refChild) {
|
|
14492
|
-
if (!refChild) return appendChild(parent, newChild);
|
|
14493
|
-
if (refChild.parentNode !== parent)
|
|
14494
|
-
throw new Error(
|
|
14495
|
-
"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode."
|
|
14496
|
-
);
|
|
14497
|
-
if (newChild === refChild) return newChild;
|
|
14498
|
-
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
14499
|
-
newChild.previousSibling = refChild.previousSibling;
|
|
14500
|
-
refChild.previousSibling = newChild;
|
|
14501
|
-
newChild.nextSibling = refChild;
|
|
14502
|
-
if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;
|
|
14503
|
-
else parent.firstChild = newChild;
|
|
14504
|
-
newChild.parentElement = parent;
|
|
14505
|
-
newChild.parentNode = parent;
|
|
14506
|
-
newChild.ownerDocument = parent.ownerDocument;
|
|
14507
|
-
return newChild;
|
|
14508
|
-
}
|
|
14509
|
-
function removeChild(parent, child2) {
|
|
14510
|
-
if (child2.parentNode !== parent)
|
|
14511
|
-
throw new Error(
|
|
14512
|
-
"Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode."
|
|
14513
|
-
);
|
|
14514
|
-
if (child2.previousSibling)
|
|
14515
|
-
child2.previousSibling.nextSibling = child2.nextSibling;
|
|
14516
|
-
else parent.firstChild = child2.nextSibling;
|
|
14517
|
-
if (child2.nextSibling)
|
|
14518
|
-
child2.nextSibling.previousSibling = child2.previousSibling;
|
|
14519
|
-
else parent.lastChild = child2.previousSibling;
|
|
14520
|
-
child2.previousSibling = null;
|
|
14521
|
-
child2.nextSibling = null;
|
|
14522
|
-
child2.parentElement = null;
|
|
14523
|
-
child2.parentNode = null;
|
|
14524
|
-
return child2;
|
|
14525
|
-
}
|
|
14526
|
-
var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
|
|
14527
|
-
NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
|
|
14528
|
-
NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
|
|
14529
|
-
NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
|
|
14530
|
-
NodeType2[NodeType2["TEXT_NODE"] = 3] = "TEXT_NODE";
|
|
14531
|
-
NodeType2[NodeType2["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
|
|
14532
|
-
NodeType2[NodeType2["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
|
|
14533
|
-
NodeType2[NodeType2["ENTITY_NODE"] = 6] = "ENTITY_NODE";
|
|
14534
|
-
NodeType2[NodeType2["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
|
|
14535
|
-
NodeType2[NodeType2["COMMENT_NODE"] = 8] = "COMMENT_NODE";
|
|
14536
|
-
NodeType2[NodeType2["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
|
|
14537
|
-
NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
|
|
14538
|
-
NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
|
|
14539
|
-
return NodeType2;
|
|
14540
|
-
})(NodeType$2 || {});
|
|
14541
|
-
const NAMESPACES = {
|
|
14542
|
-
svg: "http://www.w3.org/2000/svg",
|
|
14543
|
-
"xlink:href": "http://www.w3.org/1999/xlink",
|
|
14544
|
-
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
14545
|
-
};
|
|
14546
|
-
const SVGTagMap = {
|
|
14547
|
-
altglyph: "altGlyph",
|
|
14548
|
-
altglyphdef: "altGlyphDef",
|
|
14549
|
-
altglyphitem: "altGlyphItem",
|
|
14550
|
-
animatecolor: "animateColor",
|
|
14551
|
-
animatemotion: "animateMotion",
|
|
14552
|
-
animatetransform: "animateTransform",
|
|
14553
|
-
clippath: "clipPath",
|
|
14554
|
-
feblend: "feBlend",
|
|
14555
|
-
fecolormatrix: "feColorMatrix",
|
|
14556
|
-
fecomponenttransfer: "feComponentTransfer",
|
|
14557
|
-
fecomposite: "feComposite",
|
|
14558
|
-
feconvolvematrix: "feConvolveMatrix",
|
|
14559
|
-
fediffuselighting: "feDiffuseLighting",
|
|
14560
|
-
fedisplacementmap: "feDisplacementMap",
|
|
14561
|
-
fedistantlight: "feDistantLight",
|
|
14562
|
-
fedropshadow: "feDropShadow",
|
|
14563
|
-
feflood: "feFlood",
|
|
14564
|
-
fefunca: "feFuncA",
|
|
14565
|
-
fefuncb: "feFuncB",
|
|
14566
|
-
fefuncg: "feFuncG",
|
|
14567
|
-
fefuncr: "feFuncR",
|
|
14568
|
-
fegaussianblur: "feGaussianBlur",
|
|
14569
|
-
feimage: "feImage",
|
|
14570
|
-
femerge: "feMerge",
|
|
14571
|
-
femergenode: "feMergeNode",
|
|
14572
|
-
femorphology: "feMorphology",
|
|
14573
|
-
feoffset: "feOffset",
|
|
14574
|
-
fepointlight: "fePointLight",
|
|
14575
|
-
fespecularlighting: "feSpecularLighting",
|
|
14576
|
-
fespotlight: "feSpotLight",
|
|
14577
|
-
fetile: "feTile",
|
|
14578
|
-
feturbulence: "feTurbulence",
|
|
14579
|
-
foreignobject: "foreignObject",
|
|
14580
|
-
glyphref: "glyphRef",
|
|
14581
|
-
lineargradient: "linearGradient",
|
|
14582
|
-
radialgradient: "radialGradient"
|
|
14583
|
-
};
|
|
14584
|
-
let createdNodeSet = null;
|
|
14585
|
-
function diff(oldTree, newTree, replayer, rrnodeMirror = newTree.mirror || newTree.ownerDocument.mirror) {
|
|
14586
|
-
oldTree = diffBeforeUpdatingChildren(
|
|
14587
|
-
oldTree,
|
|
14588
|
-
newTree,
|
|
14589
|
-
replayer,
|
|
14590
|
-
rrnodeMirror
|
|
14591
|
-
);
|
|
14592
|
-
diffChildren(oldTree, newTree, replayer, rrnodeMirror);
|
|
14593
|
-
diffAfterUpdatingChildren(oldTree, newTree, replayer);
|
|
14594
|
-
}
|
|
14595
|
-
function diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
14596
|
-
var _a22;
|
|
14597
|
-
if (replayer.afterAppend && !createdNodeSet) {
|
|
14598
|
-
createdNodeSet = /* @__PURE__ */ new WeakSet();
|
|
14599
|
-
setTimeout(() => {
|
|
14600
|
-
createdNodeSet = null;
|
|
14601
|
-
}, 0);
|
|
14602
|
-
}
|
|
14603
|
-
if (!sameNodeType(oldTree, newTree)) {
|
|
14604
|
-
const calibratedOldTree = createOrGetNode(
|
|
14605
|
-
newTree,
|
|
14606
|
-
replayer.mirror,
|
|
14607
|
-
rrnodeMirror
|
|
14608
|
-
);
|
|
14609
|
-
(_a22 = oldTree.parentNode) == null ? void 0 : _a22.replaceChild(calibratedOldTree, oldTree);
|
|
14610
|
-
oldTree = calibratedOldTree;
|
|
14611
|
-
}
|
|
14612
|
-
switch (newTree.RRNodeType) {
|
|
14613
|
-
case NodeType$1.Document: {
|
|
14614
|
-
if (!nodeMatching(oldTree, newTree, replayer.mirror, rrnodeMirror)) {
|
|
14615
|
-
const newMeta = rrnodeMirror.getMeta(newTree);
|
|
14616
|
-
if (newMeta) {
|
|
14617
|
-
replayer.mirror.removeNodeFromMap(oldTree);
|
|
14618
|
-
oldTree.close();
|
|
14619
|
-
oldTree.open();
|
|
14620
|
-
replayer.mirror.add(oldTree, newMeta);
|
|
14621
|
-
createdNodeSet == null ? void 0 : createdNodeSet.add(oldTree);
|
|
14622
|
-
}
|
|
14623
|
-
}
|
|
14624
|
-
break;
|
|
14625
|
-
}
|
|
14626
|
-
case NodeType$1.Element: {
|
|
14627
|
-
const oldElement = oldTree;
|
|
14628
|
-
const newRRElement = newTree;
|
|
14629
|
-
switch (newRRElement.tagName) {
|
|
14630
|
-
case "IFRAME": {
|
|
14631
|
-
const oldContentDocument = oldTree.contentDocument;
|
|
14632
|
-
if (!oldContentDocument) break;
|
|
14633
|
-
diff(
|
|
14634
|
-
oldContentDocument,
|
|
14635
|
-
newTree.contentDocument,
|
|
14636
|
-
replayer,
|
|
14637
|
-
rrnodeMirror
|
|
14638
|
-
);
|
|
14639
|
-
break;
|
|
14640
|
-
}
|
|
14641
|
-
}
|
|
14642
|
-
if (newRRElement.shadowRoot) {
|
|
14643
|
-
if (!oldElement.shadowRoot) oldElement.attachShadow({ mode: "open" });
|
|
14644
|
-
diffChildren(
|
|
14645
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14646
|
-
oldElement.shadowRoot,
|
|
14647
|
-
newRRElement.shadowRoot,
|
|
14648
|
-
replayer,
|
|
14649
|
-
rrnodeMirror
|
|
14650
|
-
);
|
|
14651
|
-
}
|
|
14652
|
-
diffProps(oldElement, newRRElement, rrnodeMirror);
|
|
14653
|
-
break;
|
|
14128
|
+
diffProps(oldElement, newRRElement, rrnodeMirror);
|
|
14129
|
+
break;
|
|
14654
14130
|
}
|
|
14655
14131
|
}
|
|
14656
14132
|
return oldTree;
|
|
@@ -14812,7 +14288,13 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14812
14288
|
nodeMatching(oldStartNode, newEndNode, replayer.mirror, rrnodeMirror)
|
|
14813
14289
|
) {
|
|
14814
14290
|
try {
|
|
14815
|
-
|
|
14291
|
+
insertPreservingCSSOM(
|
|
14292
|
+
oldTree,
|
|
14293
|
+
oldStartNode,
|
|
14294
|
+
oldEndNode.nextSibling,
|
|
14295
|
+
replayer.mirror,
|
|
14296
|
+
rrnodeMirror
|
|
14297
|
+
);
|
|
14816
14298
|
} catch (e2) {
|
|
14817
14299
|
console.warn(e2);
|
|
14818
14300
|
}
|
|
@@ -14823,7 +14305,13 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14823
14305
|
nodeMatching(oldEndNode, newStartNode, replayer.mirror, rrnodeMirror)
|
|
14824
14306
|
) {
|
|
14825
14307
|
try {
|
|
14826
|
-
|
|
14308
|
+
insertPreservingCSSOM(
|
|
14309
|
+
oldTree,
|
|
14310
|
+
oldEndNode,
|
|
14311
|
+
oldStartNode,
|
|
14312
|
+
replayer.mirror,
|
|
14313
|
+
rrnodeMirror
|
|
14314
|
+
);
|
|
14827
14315
|
} catch (e2) {
|
|
14828
14316
|
console.warn(e2);
|
|
14829
14317
|
}
|
|
@@ -14842,7 +14330,13 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14842
14330
|
const nodeToMove = oldChildren[indexInOld];
|
|
14843
14331
|
if (indexInOld !== void 0 && nodeToMove && nodeMatching(nodeToMove, newStartNode, replayer.mirror, rrnodeMirror)) {
|
|
14844
14332
|
try {
|
|
14845
|
-
|
|
14333
|
+
insertPreservingCSSOM(
|
|
14334
|
+
oldTree,
|
|
14335
|
+
nodeToMove,
|
|
14336
|
+
oldStartNode,
|
|
14337
|
+
replayer.mirror,
|
|
14338
|
+
rrnodeMirror
|
|
14339
|
+
);
|
|
14846
14340
|
} catch (e2) {
|
|
14847
14341
|
console.warn(e2);
|
|
14848
14342
|
}
|
|
@@ -14853,119 +14347,709 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14853
14347
|
replayer.mirror,
|
|
14854
14348
|
rrnodeMirror
|
|
14855
14349
|
);
|
|
14856
|
-
if (oldTree.nodeName === "#document" && oldStartNode && /**
|
|
14857
|
-
* Special case 1: one document isn't allowed to have two doctype nodes at the same time, so we need to remove the old one first before inserting the new one.
|
|
14858
|
-
* How this case happens: A parent document in the old tree already has a doctype node with an id e.g. #1. A new full snapshot rebuilds the replayer with a new doctype node with another id #2. According to the algorithm, the new doctype node will be inserted before the old one, which is not allowed by the Document standard.
|
|
14859
|
-
*/
|
|
14860
|
-
(newNode.nodeType === newNode.DOCUMENT_TYPE_NODE && oldStartNode.nodeType === oldStartNode.DOCUMENT_TYPE_NODE || /**
|
|
14861
|
-
* Special case 2: one document isn't allowed to have two HTMLElements at the same time, so we need to remove the old one first before inserting the new one.
|
|
14862
|
-
* How this case happens: A mounted iframe element has an automatically created HTML element. We should delete it before inserting a serialized one. Otherwise, an error 'Only one element on document allowed' will be thrown.
|
|
14863
|
-
*/
|
|
14864
|
-
newNode.nodeType === newNode.ELEMENT_NODE && oldStartNode.nodeType === oldStartNode.ELEMENT_NODE)) {
|
|
14865
|
-
oldTree.removeChild(oldStartNode);
|
|
14866
|
-
replayer.mirror.removeNodeFromMap(oldStartNode);
|
|
14867
|
-
oldStartNode = oldChildren[++oldStartIndex];
|
|
14868
|
-
}
|
|
14869
|
-
try {
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14350
|
+
if (oldTree.nodeName === "#document" && oldStartNode && /**
|
|
14351
|
+
* Special case 1: one document isn't allowed to have two doctype nodes at the same time, so we need to remove the old one first before inserting the new one.
|
|
14352
|
+
* How this case happens: A parent document in the old tree already has a doctype node with an id e.g. #1. A new full snapshot rebuilds the replayer with a new doctype node with another id #2. According to the algorithm, the new doctype node will be inserted before the old one, which is not allowed by the Document standard.
|
|
14353
|
+
*/
|
|
14354
|
+
(newNode.nodeType === newNode.DOCUMENT_TYPE_NODE && oldStartNode.nodeType === oldStartNode.DOCUMENT_TYPE_NODE || /**
|
|
14355
|
+
* Special case 2: one document isn't allowed to have two HTMLElements at the same time, so we need to remove the old one first before inserting the new one.
|
|
14356
|
+
* How this case happens: A mounted iframe element has an automatically created HTML element. We should delete it before inserting a serialized one. Otherwise, an error 'Only one element on document allowed' will be thrown.
|
|
14357
|
+
*/
|
|
14358
|
+
newNode.nodeType === newNode.ELEMENT_NODE && oldStartNode.nodeType === oldStartNode.ELEMENT_NODE)) {
|
|
14359
|
+
oldTree.removeChild(oldStartNode);
|
|
14360
|
+
replayer.mirror.removeNodeFromMap(oldStartNode);
|
|
14361
|
+
oldStartNode = oldChildren[++oldStartIndex];
|
|
14362
|
+
}
|
|
14363
|
+
try {
|
|
14364
|
+
insertPreservingCSSOM(
|
|
14365
|
+
oldTree,
|
|
14366
|
+
newNode,
|
|
14367
|
+
oldStartNode || null,
|
|
14368
|
+
replayer.mirror,
|
|
14369
|
+
rrnodeMirror
|
|
14370
|
+
);
|
|
14371
|
+
} catch (e2) {
|
|
14372
|
+
console.warn(e2);
|
|
14373
|
+
}
|
|
14374
|
+
}
|
|
14375
|
+
newStartNode = newChildren[++newStartIndex];
|
|
14376
|
+
}
|
|
14377
|
+
}
|
|
14378
|
+
if (oldStartIndex > oldEndIndex) {
|
|
14379
|
+
const referenceRRNode = newChildren[newEndIndex + 1];
|
|
14380
|
+
let referenceNode = null;
|
|
14381
|
+
if (referenceRRNode)
|
|
14382
|
+
referenceNode = replayer.mirror.getNode(
|
|
14383
|
+
rrnodeMirror.getId(referenceRRNode)
|
|
14384
|
+
);
|
|
14385
|
+
for (; newStartIndex <= newEndIndex; ++newStartIndex) {
|
|
14386
|
+
const newNode = createOrGetNode(
|
|
14387
|
+
newChildren[newStartIndex],
|
|
14388
|
+
replayer.mirror,
|
|
14389
|
+
rrnodeMirror
|
|
14390
|
+
);
|
|
14391
|
+
try {
|
|
14392
|
+
insertPreservingCSSOM(
|
|
14393
|
+
oldTree,
|
|
14394
|
+
newNode,
|
|
14395
|
+
referenceNode,
|
|
14396
|
+
replayer.mirror,
|
|
14397
|
+
rrnodeMirror
|
|
14398
|
+
);
|
|
14399
|
+
} catch (e2) {
|
|
14400
|
+
console.warn(e2);
|
|
14401
|
+
}
|
|
14402
|
+
}
|
|
14403
|
+
} else if (newStartIndex > newEndIndex) {
|
|
14404
|
+
for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {
|
|
14405
|
+
const node2 = oldChildren[oldStartIndex];
|
|
14406
|
+
if (!node2 || node2.parentNode !== oldTree) continue;
|
|
14407
|
+
try {
|
|
14408
|
+
oldTree.removeChild(node2);
|
|
14409
|
+
replayer.mirror.removeNodeFromMap(node2);
|
|
14410
|
+
} catch (e2) {
|
|
14411
|
+
console.warn(e2);
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
}
|
|
14415
|
+
let oldChild = oldTree.firstChild;
|
|
14416
|
+
let newChild = newTree.firstChild;
|
|
14417
|
+
while (oldChild !== null && newChild !== null) {
|
|
14418
|
+
diff(oldChild, newChild, replayer, rrnodeMirror);
|
|
14419
|
+
oldChild = oldChild.nextSibling;
|
|
14420
|
+
newChild = newChild.nextSibling;
|
|
14421
|
+
}
|
|
14422
|
+
}
|
|
14423
|
+
const nodesBuiltFromDom = /* @__PURE__ */ new WeakSet();
|
|
14424
|
+
function insertPreservingCSSOM(parent, node2, referenceNode, domMirror, rrnodeMirror) {
|
|
14425
|
+
const saved = node2.isConnected ? collectStyleRules(node2).filter(([styleElement]) => {
|
|
14426
|
+
const rrNode = rrnodeMirror.getNode(domMirror.getId(styleElement));
|
|
14427
|
+
return rrNode !== null && nodesBuiltFromDom.has(rrNode);
|
|
14428
|
+
}) : [];
|
|
14429
|
+
parent.insertBefore(node2, referenceNode);
|
|
14430
|
+
for (const [styleElement, rules2] of saved)
|
|
14431
|
+
restoreStyleRules(styleElement, rules2);
|
|
14432
|
+
}
|
|
14433
|
+
function collectStyleRules(node2) {
|
|
14434
|
+
if (node2.nodeType !== node2.ELEMENT_NODE) return [];
|
|
14435
|
+
const styleElements = [];
|
|
14436
|
+
const collect = (element) => {
|
|
14437
|
+
if (element.localName === "style")
|
|
14438
|
+
styleElements.push(element);
|
|
14439
|
+
if (element.shadowRoot)
|
|
14440
|
+
for (const child2 of Array.from(element.shadowRoot.children))
|
|
14441
|
+
collect(child2);
|
|
14442
|
+
for (const child2 of Array.from(element.children)) collect(child2);
|
|
14443
|
+
};
|
|
14444
|
+
collect(node2);
|
|
14445
|
+
const saved = [];
|
|
14446
|
+
for (const styleElement of styleElements) {
|
|
14447
|
+
try {
|
|
14448
|
+
const sheet = styleElement.sheet;
|
|
14449
|
+
if (sheet)
|
|
14450
|
+
saved.push([
|
|
14451
|
+
styleElement,
|
|
14452
|
+
Array.from(sheet.cssRules, (rule2) => rule2.cssText)
|
|
14453
|
+
]);
|
|
14454
|
+
} catch (e2) {
|
|
14455
|
+
}
|
|
14456
|
+
}
|
|
14457
|
+
return saved;
|
|
14458
|
+
}
|
|
14459
|
+
function restoreStyleRules(styleElement, rules2) {
|
|
14460
|
+
try {
|
|
14461
|
+
const sheet = styleElement.sheet;
|
|
14462
|
+
if (!sheet) return;
|
|
14463
|
+
const current = sheet.cssRules;
|
|
14464
|
+
if (current.length === rules2.length && rules2.every((rule2, i2) => current[i2].cssText === rule2))
|
|
14465
|
+
return;
|
|
14466
|
+
while (sheet.cssRules.length > 0)
|
|
14467
|
+
sheet.deleteRule(sheet.cssRules.length - 1);
|
|
14468
|
+
for (const rule2 of rules2) {
|
|
14469
|
+
try {
|
|
14470
|
+
sheet.insertRule(rule2, sheet.cssRules.length);
|
|
14471
|
+
} catch (e2) {
|
|
14472
|
+
}
|
|
14473
|
+
}
|
|
14474
|
+
} catch (e2) {
|
|
14475
|
+
}
|
|
14476
|
+
}
|
|
14477
|
+
function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
14478
|
+
const nodeId = rrnodeMirror.getId(rrNode);
|
|
14479
|
+
const sn = rrnodeMirror.getMeta(rrNode);
|
|
14480
|
+
let node2 = null;
|
|
14481
|
+
if (nodeId > -1) node2 = domMirror.getNode(nodeId);
|
|
14482
|
+
if (node2 !== null && sameNodeType(node2, rrNode)) return node2;
|
|
14483
|
+
switch (rrNode.RRNodeType) {
|
|
14484
|
+
case NodeType$1.Document:
|
|
14485
|
+
node2 = new Document();
|
|
14486
|
+
break;
|
|
14487
|
+
case NodeType$1.DocumentType:
|
|
14488
|
+
node2 = document.implementation.createDocumentType(
|
|
14489
|
+
rrNode.name,
|
|
14490
|
+
rrNode.publicId,
|
|
14491
|
+
rrNode.systemId
|
|
14492
|
+
);
|
|
14493
|
+
break;
|
|
14494
|
+
case NodeType$1.Element: {
|
|
14495
|
+
let tagName = rrNode.tagName.toLowerCase();
|
|
14496
|
+
tagName = SVGTagMap[tagName] || tagName;
|
|
14497
|
+
if (sn && "isSVG" in sn && (sn == null ? void 0 : sn.isSVG)) {
|
|
14498
|
+
node2 = document.createElementNS(NAMESPACES["svg"], tagName);
|
|
14499
|
+
} else node2 = document.createElement(rrNode.tagName);
|
|
14500
|
+
break;
|
|
14501
|
+
}
|
|
14502
|
+
case NodeType$1.Text:
|
|
14503
|
+
node2 = document.createTextNode(rrNode.data);
|
|
14504
|
+
break;
|
|
14505
|
+
case NodeType$1.Comment:
|
|
14506
|
+
node2 = document.createComment(rrNode.data);
|
|
14507
|
+
break;
|
|
14508
|
+
case NodeType$1.CDATA:
|
|
14509
|
+
node2 = document.createCDATASection(rrNode.data);
|
|
14510
|
+
break;
|
|
14511
|
+
}
|
|
14512
|
+
if (sn) domMirror.add(node2, { ...sn });
|
|
14513
|
+
try {
|
|
14514
|
+
createdNodeSet == null ? void 0 : createdNodeSet.add(node2);
|
|
14515
|
+
} catch (e2) {
|
|
14516
|
+
}
|
|
14517
|
+
return node2;
|
|
14518
|
+
}
|
|
14519
|
+
function sameNodeType(node1, node2) {
|
|
14520
|
+
if (node1.nodeType !== node2.nodeType) return false;
|
|
14521
|
+
return node1.nodeType !== node1.ELEMENT_NODE || node1.tagName.toUpperCase() === node2.tagName;
|
|
14522
|
+
}
|
|
14523
|
+
function nodeMatching(node1, node2, domMirror, rrdomMirror) {
|
|
14524
|
+
const node1Id = domMirror.getId(node1);
|
|
14525
|
+
const node2Id = rrdomMirror.getId(node2);
|
|
14526
|
+
if (node1Id === -1 || node1Id !== node2Id) return false;
|
|
14527
|
+
return sameNodeType(node1, node2);
|
|
14528
|
+
}
|
|
14529
|
+
function parseCSSText(cssText) {
|
|
14530
|
+
const res = {};
|
|
14531
|
+
const listDelimiter = /;(?![^(]*\))/g;
|
|
14532
|
+
const propertyDelimiter = /:(.+)/;
|
|
14533
|
+
const comment2 = /\/\*.*?\*\//g;
|
|
14534
|
+
cssText.replace(comment2, "").split(listDelimiter).forEach(function(item) {
|
|
14535
|
+
if (item) {
|
|
14536
|
+
const tmp = item.split(propertyDelimiter);
|
|
14537
|
+
tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());
|
|
14538
|
+
}
|
|
14539
|
+
});
|
|
14540
|
+
return res;
|
|
14541
|
+
}
|
|
14542
|
+
function toCSSText(style) {
|
|
14543
|
+
const properties = [];
|
|
14544
|
+
for (const name in style) {
|
|
14545
|
+
const value = style[name];
|
|
14546
|
+
if (typeof value !== "string") continue;
|
|
14547
|
+
const normalizedName = hyphenate(name);
|
|
14548
|
+
properties.push(`${normalizedName}: ${value};`);
|
|
14549
|
+
}
|
|
14550
|
+
return properties.join(" ");
|
|
14551
|
+
}
|
|
14552
|
+
const camelizeRE = /-([a-z])/g;
|
|
14553
|
+
const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
14554
|
+
const camelize = (str) => {
|
|
14555
|
+
if (CUSTOM_PROPERTY_REGEX.test(str)) return str;
|
|
14556
|
+
return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : "");
|
|
14557
|
+
};
|
|
14558
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
14559
|
+
const hyphenate = (str) => {
|
|
14560
|
+
return str.replace(hyphenateRE, "-$1").toLowerCase();
|
|
14561
|
+
};
|
|
14562
|
+
class BaseRRNode {
|
|
14563
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
14564
|
+
constructor(..._args) {
|
|
14565
|
+
__publicField22(this, "parentElement", null);
|
|
14566
|
+
__publicField22(this, "parentNode", null);
|
|
14567
|
+
__publicField22(this, "ownerDocument");
|
|
14568
|
+
__publicField22(this, "firstChild", null);
|
|
14569
|
+
__publicField22(this, "lastChild", null);
|
|
14570
|
+
__publicField22(this, "previousSibling", null);
|
|
14571
|
+
__publicField22(this, "nextSibling", null);
|
|
14572
|
+
__publicField22(this, "ELEMENT_NODE", 1);
|
|
14573
|
+
__publicField22(this, "TEXT_NODE", 3);
|
|
14574
|
+
__publicField22(this, "nodeType");
|
|
14575
|
+
__publicField22(this, "nodeName");
|
|
14576
|
+
__publicField22(this, "RRNodeType");
|
|
14577
|
+
}
|
|
14578
|
+
get childNodes() {
|
|
14579
|
+
const childNodes2 = [];
|
|
14580
|
+
let childIterator = this.firstChild;
|
|
14581
|
+
while (childIterator) {
|
|
14582
|
+
childNodes2.push(childIterator);
|
|
14583
|
+
childIterator = childIterator.nextSibling;
|
|
14584
|
+
}
|
|
14585
|
+
return childNodes2;
|
|
14586
|
+
}
|
|
14587
|
+
contains(node2) {
|
|
14588
|
+
if (!(node2 instanceof BaseRRNode)) return false;
|
|
14589
|
+
else if (node2.ownerDocument !== this.ownerDocument) return false;
|
|
14590
|
+
else if (node2 === this) return true;
|
|
14591
|
+
while (node2.parentNode) {
|
|
14592
|
+
if (node2.parentNode === this) return true;
|
|
14593
|
+
node2 = node2.parentNode;
|
|
14594
|
+
}
|
|
14595
|
+
return false;
|
|
14596
|
+
}
|
|
14597
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14598
|
+
appendChild(_newChild) {
|
|
14599
|
+
throw new Error(
|
|
14600
|
+
`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14601
|
+
);
|
|
14602
|
+
}
|
|
14603
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14604
|
+
insertBefore(_newChild, _refChild) {
|
|
14605
|
+
throw new Error(
|
|
14606
|
+
`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`
|
|
14607
|
+
);
|
|
14608
|
+
}
|
|
14609
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14610
|
+
removeChild(_node) {
|
|
14611
|
+
throw new Error(
|
|
14612
|
+
`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14613
|
+
);
|
|
14614
|
+
}
|
|
14615
|
+
toString() {
|
|
14616
|
+
return "RRNode";
|
|
14617
|
+
}
|
|
14618
|
+
}
|
|
14619
|
+
class BaseRRDocument extends BaseRRNode {
|
|
14620
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14621
|
+
constructor(...args) {
|
|
14622
|
+
super(args);
|
|
14623
|
+
__publicField22(this, "nodeType", 9);
|
|
14624
|
+
__publicField22(this, "nodeName", "#document");
|
|
14625
|
+
__publicField22(this, "compatMode", "CSS1Compat");
|
|
14626
|
+
__publicField22(this, "RRNodeType", NodeType$1.Document);
|
|
14627
|
+
__publicField22(this, "textContent", null);
|
|
14628
|
+
this.ownerDocument = this;
|
|
14629
|
+
}
|
|
14630
|
+
get documentElement() {
|
|
14631
|
+
return this.childNodes.find(
|
|
14632
|
+
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HTML"
|
|
14633
|
+
) || null;
|
|
14634
|
+
}
|
|
14635
|
+
get body() {
|
|
14636
|
+
var _a22;
|
|
14637
|
+
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14638
|
+
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "BODY"
|
|
14639
|
+
)) || null;
|
|
14640
|
+
}
|
|
14641
|
+
get head() {
|
|
14642
|
+
var _a22;
|
|
14643
|
+
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14644
|
+
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HEAD"
|
|
14645
|
+
)) || null;
|
|
14646
|
+
}
|
|
14647
|
+
get implementation() {
|
|
14648
|
+
return this;
|
|
14649
|
+
}
|
|
14650
|
+
get firstElementChild() {
|
|
14651
|
+
return this.documentElement;
|
|
14652
|
+
}
|
|
14653
|
+
appendChild(newChild) {
|
|
14654
|
+
const nodeType = newChild.RRNodeType;
|
|
14655
|
+
if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {
|
|
14656
|
+
if (this.childNodes.some((s2) => s2.RRNodeType === nodeType)) {
|
|
14657
|
+
throw new Error(
|
|
14658
|
+
`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? "RRElement" : "RRDoctype"} on RRDocument allowed.`
|
|
14659
|
+
);
|
|
14874
14660
|
}
|
|
14875
|
-
newStartNode = newChildren[++newStartIndex];
|
|
14876
14661
|
}
|
|
14662
|
+
const child2 = appendChild(this, newChild);
|
|
14663
|
+
child2.parentElement = null;
|
|
14664
|
+
return child2;
|
|
14877
14665
|
}
|
|
14878
|
-
|
|
14879
|
-
const
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
for (; newStartIndex <= newEndIndex; ++newStartIndex) {
|
|
14886
|
-
const newNode = createOrGetNode(
|
|
14887
|
-
newChildren[newStartIndex],
|
|
14888
|
-
replayer.mirror,
|
|
14889
|
-
rrnodeMirror
|
|
14890
|
-
);
|
|
14891
|
-
try {
|
|
14892
|
-
oldTree.insertBefore(newNode, referenceNode);
|
|
14893
|
-
} catch (e2) {
|
|
14894
|
-
console.warn(e2);
|
|
14666
|
+
insertBefore(newChild, refChild) {
|
|
14667
|
+
const nodeType = newChild.RRNodeType;
|
|
14668
|
+
if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {
|
|
14669
|
+
if (this.childNodes.some((s2) => s2.RRNodeType === nodeType)) {
|
|
14670
|
+
throw new Error(
|
|
14671
|
+
`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? "RRElement" : "RRDoctype"} on RRDocument allowed.`
|
|
14672
|
+
);
|
|
14895
14673
|
}
|
|
14896
14674
|
}
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14675
|
+
const child2 = insertBefore(this, newChild, refChild);
|
|
14676
|
+
child2.parentElement = null;
|
|
14677
|
+
return child2;
|
|
14678
|
+
}
|
|
14679
|
+
removeChild(node2) {
|
|
14680
|
+
return removeChild(this, node2);
|
|
14681
|
+
}
|
|
14682
|
+
open() {
|
|
14683
|
+
this.firstChild = null;
|
|
14684
|
+
this.lastChild = null;
|
|
14685
|
+
}
|
|
14686
|
+
close() {
|
|
14687
|
+
}
|
|
14688
|
+
/**
|
|
14689
|
+
* Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).
|
|
14690
|
+
* There are two lines used this function:
|
|
14691
|
+
* 1. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""\>')
|
|
14692
|
+
* 2. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ""\>')
|
|
14693
|
+
*/
|
|
14694
|
+
write(content) {
|
|
14695
|
+
let publicId;
|
|
14696
|
+
if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">')
|
|
14697
|
+
publicId = "-//W3C//DTD XHTML 1.0 Transitional//EN";
|
|
14698
|
+
else if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')
|
|
14699
|
+
publicId = "-//W3C//DTD HTML 4.0 Transitional//EN";
|
|
14700
|
+
if (publicId) {
|
|
14701
|
+
const doctype = this.createDocumentType("html", publicId, "");
|
|
14702
|
+
this.open();
|
|
14703
|
+
this.appendChild(doctype);
|
|
14704
|
+
}
|
|
14705
|
+
}
|
|
14706
|
+
createDocument(_namespace, _qualifiedName, _doctype) {
|
|
14707
|
+
return new BaseRRDocument();
|
|
14708
|
+
}
|
|
14709
|
+
createDocumentType(qualifiedName, publicId, systemId) {
|
|
14710
|
+
const doctype = new BaseRRDocumentType(qualifiedName, publicId, systemId);
|
|
14711
|
+
doctype.ownerDocument = this;
|
|
14712
|
+
return doctype;
|
|
14713
|
+
}
|
|
14714
|
+
createElement(tagName) {
|
|
14715
|
+
const element = new BaseRRElement(tagName);
|
|
14716
|
+
element.ownerDocument = this;
|
|
14717
|
+
return element;
|
|
14718
|
+
}
|
|
14719
|
+
createElementNS(_namespaceURI, qualifiedName) {
|
|
14720
|
+
return this.createElement(qualifiedName);
|
|
14721
|
+
}
|
|
14722
|
+
createTextNode(data) {
|
|
14723
|
+
const text = new BaseRRText(data);
|
|
14724
|
+
text.ownerDocument = this;
|
|
14725
|
+
return text;
|
|
14726
|
+
}
|
|
14727
|
+
createComment(data) {
|
|
14728
|
+
const comment2 = new BaseRRComment(data);
|
|
14729
|
+
comment2.ownerDocument = this;
|
|
14730
|
+
return comment2;
|
|
14731
|
+
}
|
|
14732
|
+
createCDATASection(data) {
|
|
14733
|
+
const CDATASection = new BaseRRCDATASection(data);
|
|
14734
|
+
CDATASection.ownerDocument = this;
|
|
14735
|
+
return CDATASection;
|
|
14736
|
+
}
|
|
14737
|
+
toString() {
|
|
14738
|
+
return "RRDocument";
|
|
14739
|
+
}
|
|
14740
|
+
}
|
|
14741
|
+
class BaseRRDocumentType extends BaseRRNode {
|
|
14742
|
+
constructor(qualifiedName, publicId, systemId) {
|
|
14743
|
+
super();
|
|
14744
|
+
__publicField22(this, "nodeType", 10);
|
|
14745
|
+
__publicField22(this, "RRNodeType", NodeType$1.DocumentType);
|
|
14746
|
+
__publicField22(this, "name");
|
|
14747
|
+
__publicField22(this, "publicId");
|
|
14748
|
+
__publicField22(this, "systemId");
|
|
14749
|
+
__publicField22(this, "textContent", null);
|
|
14750
|
+
this.name = qualifiedName;
|
|
14751
|
+
this.publicId = publicId;
|
|
14752
|
+
this.systemId = systemId;
|
|
14753
|
+
this.nodeName = qualifiedName;
|
|
14754
|
+
}
|
|
14755
|
+
toString() {
|
|
14756
|
+
return "RRDocumentType";
|
|
14757
|
+
}
|
|
14758
|
+
}
|
|
14759
|
+
class BaseRRElement extends BaseRRNode {
|
|
14760
|
+
constructor(tagName) {
|
|
14761
|
+
super();
|
|
14762
|
+
__publicField22(this, "nodeType", 1);
|
|
14763
|
+
__publicField22(this, "RRNodeType", NodeType$1.Element);
|
|
14764
|
+
__publicField22(this, "tagName");
|
|
14765
|
+
__publicField22(this, "attributes", {});
|
|
14766
|
+
__publicField22(this, "shadowRoot", null);
|
|
14767
|
+
__publicField22(this, "scrollLeft");
|
|
14768
|
+
__publicField22(this, "scrollTop");
|
|
14769
|
+
this.tagName = tagName.toUpperCase();
|
|
14770
|
+
this.nodeName = tagName.toUpperCase();
|
|
14771
|
+
}
|
|
14772
|
+
get textContent() {
|
|
14773
|
+
let result2 = "";
|
|
14774
|
+
this.childNodes.forEach((node2) => result2 += node2.textContent);
|
|
14775
|
+
return result2;
|
|
14776
|
+
}
|
|
14777
|
+
set textContent(textContent2) {
|
|
14778
|
+
this.firstChild = null;
|
|
14779
|
+
this.lastChild = null;
|
|
14780
|
+
this.appendChild(this.ownerDocument.createTextNode(textContent2));
|
|
14781
|
+
}
|
|
14782
|
+
get classList() {
|
|
14783
|
+
return new ClassList(
|
|
14784
|
+
this.attributes.class,
|
|
14785
|
+
(newClassName) => {
|
|
14786
|
+
this.attributes.class = newClassName;
|
|
14906
14787
|
}
|
|
14788
|
+
);
|
|
14789
|
+
}
|
|
14790
|
+
get id() {
|
|
14791
|
+
return this.attributes.id || "";
|
|
14792
|
+
}
|
|
14793
|
+
get className() {
|
|
14794
|
+
return this.attributes.class || "";
|
|
14795
|
+
}
|
|
14796
|
+
get style() {
|
|
14797
|
+
const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};
|
|
14798
|
+
const hyphenateRE2 = /\B([A-Z])/g;
|
|
14799
|
+
style.setProperty = (name, value, priority) => {
|
|
14800
|
+
if (hyphenateRE2.test(name)) return;
|
|
14801
|
+
const normalizedName = camelize(name);
|
|
14802
|
+
if (!value) delete style[normalizedName];
|
|
14803
|
+
else style[normalizedName] = value;
|
|
14804
|
+
if (priority === "important") style[normalizedName] += " !important";
|
|
14805
|
+
this.attributes.style = toCSSText(style);
|
|
14806
|
+
};
|
|
14807
|
+
style.removeProperty = (name) => {
|
|
14808
|
+
if (hyphenateRE2.test(name)) return "";
|
|
14809
|
+
const normalizedName = camelize(name);
|
|
14810
|
+
const value = style[normalizedName] || "";
|
|
14811
|
+
delete style[normalizedName];
|
|
14812
|
+
this.attributes.style = toCSSText(style);
|
|
14813
|
+
return value;
|
|
14814
|
+
};
|
|
14815
|
+
return style;
|
|
14816
|
+
}
|
|
14817
|
+
getAttribute(name) {
|
|
14818
|
+
if (this.attributes[name] === void 0) return null;
|
|
14819
|
+
return this.attributes[name];
|
|
14820
|
+
}
|
|
14821
|
+
setAttribute(name, attribute) {
|
|
14822
|
+
this.attributes[name] = attribute;
|
|
14823
|
+
}
|
|
14824
|
+
setAttributeNS(_namespace, qualifiedName, value) {
|
|
14825
|
+
this.setAttribute(qualifiedName, value);
|
|
14826
|
+
}
|
|
14827
|
+
removeAttribute(name) {
|
|
14828
|
+
delete this.attributes[name];
|
|
14829
|
+
}
|
|
14830
|
+
appendChild(newChild) {
|
|
14831
|
+
return appendChild(this, newChild);
|
|
14832
|
+
}
|
|
14833
|
+
insertBefore(newChild, refChild) {
|
|
14834
|
+
return insertBefore(this, newChild, refChild);
|
|
14835
|
+
}
|
|
14836
|
+
removeChild(node2) {
|
|
14837
|
+
return removeChild(this, node2);
|
|
14838
|
+
}
|
|
14839
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14840
|
+
attachShadow(_init) {
|
|
14841
|
+
const shadowRoot2 = this.ownerDocument.createElement("SHADOWROOT");
|
|
14842
|
+
this.shadowRoot = shadowRoot2;
|
|
14843
|
+
return shadowRoot2;
|
|
14844
|
+
}
|
|
14845
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14846
|
+
dispatchEvent(_event) {
|
|
14847
|
+
return true;
|
|
14848
|
+
}
|
|
14849
|
+
toString() {
|
|
14850
|
+
let attributeString = "";
|
|
14851
|
+
for (const attribute in this.attributes) {
|
|
14852
|
+
attributeString += `${attribute}="${this.attributes[attribute]}" `;
|
|
14907
14853
|
}
|
|
14854
|
+
return `${this.tagName} ${attributeString}`;
|
|
14908
14855
|
}
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14856
|
+
}
|
|
14857
|
+
class BaseRRMediaElement extends BaseRRElement {
|
|
14858
|
+
constructor() {
|
|
14859
|
+
super(...arguments);
|
|
14860
|
+
__publicField22(this, "currentTime");
|
|
14861
|
+
__publicField22(this, "volume");
|
|
14862
|
+
__publicField22(this, "paused");
|
|
14863
|
+
__publicField22(this, "muted");
|
|
14864
|
+
__publicField22(this, "playbackRate");
|
|
14865
|
+
__publicField22(this, "loop");
|
|
14866
|
+
}
|
|
14867
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14868
|
+
attachShadow(_init) {
|
|
14869
|
+
throw new Error(
|
|
14870
|
+
`RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`
|
|
14871
|
+
);
|
|
14872
|
+
}
|
|
14873
|
+
play() {
|
|
14874
|
+
this.paused = false;
|
|
14875
|
+
}
|
|
14876
|
+
pause() {
|
|
14877
|
+
this.paused = true;
|
|
14915
14878
|
}
|
|
14916
14879
|
}
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14880
|
+
class BaseRRDialogElement extends BaseRRElement {
|
|
14881
|
+
constructor() {
|
|
14882
|
+
super(...arguments);
|
|
14883
|
+
__publicField22(this, "tagName", "DIALOG");
|
|
14884
|
+
__publicField22(this, "nodeName", "DIALOG");
|
|
14885
|
+
}
|
|
14886
|
+
get isModal() {
|
|
14887
|
+
return this.getAttribute("rr_open_mode") === "modal";
|
|
14888
|
+
}
|
|
14889
|
+
get open() {
|
|
14890
|
+
return this.getAttribute("open") !== null;
|
|
14891
|
+
}
|
|
14892
|
+
close() {
|
|
14893
|
+
this.removeAttribute("open");
|
|
14894
|
+
this.removeAttribute("rr_open_mode");
|
|
14895
|
+
}
|
|
14896
|
+
show() {
|
|
14897
|
+
this.setAttribute("open", "");
|
|
14898
|
+
this.setAttribute("rr_open_mode", "non-modal");
|
|
14899
|
+
}
|
|
14900
|
+
showModal() {
|
|
14901
|
+
this.setAttribute("open", "");
|
|
14902
|
+
this.setAttribute("rr_open_mode", "modal");
|
|
14903
|
+
}
|
|
14904
|
+
}
|
|
14905
|
+
class BaseRRText extends BaseRRNode {
|
|
14906
|
+
constructor(data) {
|
|
14907
|
+
super();
|
|
14908
|
+
__publicField22(this, "nodeType", 3);
|
|
14909
|
+
__publicField22(this, "nodeName", "#text");
|
|
14910
|
+
__publicField22(this, "RRNodeType", NodeType$1.Text);
|
|
14911
|
+
__publicField22(this, "data");
|
|
14912
|
+
this.data = data;
|
|
14913
|
+
}
|
|
14914
|
+
get textContent() {
|
|
14915
|
+
return this.data;
|
|
14916
|
+
}
|
|
14917
|
+
set textContent(textContent2) {
|
|
14918
|
+
this.data = textContent2;
|
|
14919
|
+
}
|
|
14920
|
+
toString() {
|
|
14921
|
+
return `RRText text=${JSON.stringify(this.data)}`;
|
|
14922
|
+
}
|
|
14923
|
+
}
|
|
14924
|
+
class BaseRRComment extends BaseRRNode {
|
|
14925
|
+
constructor(data) {
|
|
14926
|
+
super();
|
|
14927
|
+
__publicField22(this, "nodeType", 8);
|
|
14928
|
+
__publicField22(this, "nodeName", "#comment");
|
|
14929
|
+
__publicField22(this, "RRNodeType", NodeType$1.Comment);
|
|
14930
|
+
__publicField22(this, "data");
|
|
14931
|
+
this.data = data;
|
|
14932
|
+
}
|
|
14933
|
+
get textContent() {
|
|
14934
|
+
return this.data;
|
|
14935
|
+
}
|
|
14936
|
+
set textContent(textContent2) {
|
|
14937
|
+
this.data = textContent2;
|
|
14938
|
+
}
|
|
14939
|
+
toString() {
|
|
14940
|
+
return `RRComment text=${JSON.stringify(this.data)}`;
|
|
14941
|
+
}
|
|
14942
|
+
}
|
|
14943
|
+
class BaseRRCDATASection extends BaseRRNode {
|
|
14944
|
+
constructor(data) {
|
|
14945
|
+
super();
|
|
14946
|
+
__publicField22(this, "nodeName", "#cdata-section");
|
|
14947
|
+
__publicField22(this, "nodeType", 4);
|
|
14948
|
+
__publicField22(this, "RRNodeType", NodeType$1.CDATA);
|
|
14949
|
+
__publicField22(this, "data");
|
|
14950
|
+
this.data = data;
|
|
14951
|
+
}
|
|
14952
|
+
get textContent() {
|
|
14953
|
+
return this.data;
|
|
14954
|
+
}
|
|
14955
|
+
set textContent(textContent2) {
|
|
14956
|
+
this.data = textContent2;
|
|
14957
|
+
}
|
|
14958
|
+
toString() {
|
|
14959
|
+
return `RRCDATASection data=${JSON.stringify(this.data)}`;
|
|
14960
|
+
}
|
|
14961
|
+
}
|
|
14962
|
+
class ClassList {
|
|
14963
|
+
constructor(classText, onChange) {
|
|
14964
|
+
__publicField22(this, "onChange");
|
|
14965
|
+
__publicField22(this, "classes", []);
|
|
14966
|
+
__publicField22(this, "add", (...classNames) => {
|
|
14967
|
+
for (const item of classNames) {
|
|
14968
|
+
const className = String(item);
|
|
14969
|
+
if (this.classes.indexOf(className) >= 0) continue;
|
|
14970
|
+
this.classes.push(className);
|
|
14971
|
+
}
|
|
14972
|
+
this.onChange && this.onChange(this.classes.join(" "));
|
|
14973
|
+
});
|
|
14974
|
+
__publicField22(this, "remove", (...classNames) => {
|
|
14975
|
+
this.classes = this.classes.filter(
|
|
14976
|
+
(item) => classNames.indexOf(item) === -1
|
|
14932
14977
|
);
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
node2 = document.createElementNS(NAMESPACES["svg"], tagName);
|
|
14939
|
-
} else node2 = document.createElement(rrNode.tagName);
|
|
14940
|
-
break;
|
|
14978
|
+
this.onChange && this.onChange(this.classes.join(" "));
|
|
14979
|
+
});
|
|
14980
|
+
if (classText) {
|
|
14981
|
+
const classes = classText.trim().split(/\s+/);
|
|
14982
|
+
this.classes.push(...classes);
|
|
14941
14983
|
}
|
|
14942
|
-
|
|
14943
|
-
node2 = document.createTextNode(rrNode.data);
|
|
14944
|
-
break;
|
|
14945
|
-
case NodeType$1.Comment:
|
|
14946
|
-
node2 = document.createComment(rrNode.data);
|
|
14947
|
-
break;
|
|
14948
|
-
case NodeType$1.CDATA:
|
|
14949
|
-
node2 = document.createCDATASection(rrNode.data);
|
|
14950
|
-
break;
|
|
14984
|
+
this.onChange = onChange;
|
|
14951
14985
|
}
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14986
|
+
}
|
|
14987
|
+
function appendChild(parent, newChild) {
|
|
14988
|
+
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
14989
|
+
if (parent.lastChild) {
|
|
14990
|
+
parent.lastChild.nextSibling = newChild;
|
|
14991
|
+
newChild.previousSibling = parent.lastChild;
|
|
14992
|
+
} else {
|
|
14993
|
+
parent.firstChild = newChild;
|
|
14994
|
+
newChild.previousSibling = null;
|
|
14956
14995
|
}
|
|
14957
|
-
|
|
14996
|
+
parent.lastChild = newChild;
|
|
14997
|
+
newChild.nextSibling = null;
|
|
14998
|
+
newChild.parentNode = parent;
|
|
14999
|
+
newChild.parentElement = parent;
|
|
15000
|
+
newChild.ownerDocument = parent.ownerDocument;
|
|
15001
|
+
return newChild;
|
|
14958
15002
|
}
|
|
14959
|
-
function
|
|
14960
|
-
if (
|
|
14961
|
-
|
|
15003
|
+
function insertBefore(parent, newChild, refChild) {
|
|
15004
|
+
if (!refChild) return appendChild(parent, newChild);
|
|
15005
|
+
if (refChild.parentNode !== parent)
|
|
15006
|
+
throw new Error(
|
|
15007
|
+
"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode."
|
|
15008
|
+
);
|
|
15009
|
+
if (newChild === refChild) return newChild;
|
|
15010
|
+
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
15011
|
+
newChild.previousSibling = refChild.previousSibling;
|
|
15012
|
+
refChild.previousSibling = newChild;
|
|
15013
|
+
newChild.nextSibling = refChild;
|
|
15014
|
+
if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;
|
|
15015
|
+
else parent.firstChild = newChild;
|
|
15016
|
+
newChild.parentElement = parent;
|
|
15017
|
+
newChild.parentNode = parent;
|
|
15018
|
+
newChild.ownerDocument = parent.ownerDocument;
|
|
15019
|
+
return newChild;
|
|
14962
15020
|
}
|
|
14963
|
-
function
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
15021
|
+
function removeChild(parent, child2) {
|
|
15022
|
+
if (child2.parentNode !== parent)
|
|
15023
|
+
throw new Error(
|
|
15024
|
+
"Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode."
|
|
15025
|
+
);
|
|
15026
|
+
if (child2.previousSibling)
|
|
15027
|
+
child2.previousSibling.nextSibling = child2.nextSibling;
|
|
15028
|
+
else parent.firstChild = child2.nextSibling;
|
|
15029
|
+
if (child2.nextSibling)
|
|
15030
|
+
child2.nextSibling.previousSibling = child2.previousSibling;
|
|
15031
|
+
else parent.lastChild = child2.previousSibling;
|
|
15032
|
+
child2.previousSibling = null;
|
|
15033
|
+
child2.nextSibling = null;
|
|
15034
|
+
child2.parentElement = null;
|
|
15035
|
+
child2.parentNode = null;
|
|
15036
|
+
return child2;
|
|
14968
15037
|
}
|
|
15038
|
+
var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
|
|
15039
|
+
NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
|
|
15040
|
+
NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
|
|
15041
|
+
NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
|
|
15042
|
+
NodeType2[NodeType2["TEXT_NODE"] = 3] = "TEXT_NODE";
|
|
15043
|
+
NodeType2[NodeType2["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
|
|
15044
|
+
NodeType2[NodeType2["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
|
|
15045
|
+
NodeType2[NodeType2["ENTITY_NODE"] = 6] = "ENTITY_NODE";
|
|
15046
|
+
NodeType2[NodeType2["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
|
|
15047
|
+
NodeType2[NodeType2["COMMENT_NODE"] = 8] = "COMMENT_NODE";
|
|
15048
|
+
NodeType2[NodeType2["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
|
|
15049
|
+
NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
|
|
15050
|
+
NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
|
|
15051
|
+
return NodeType2;
|
|
15052
|
+
})(NodeType$2 || {});
|
|
14969
15053
|
class RRDocument extends BaseRRDocument {
|
|
14970
15054
|
constructor(mirror2) {
|
|
14971
15055
|
super();
|
|
@@ -15150,6 +15234,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
|
|
|
15150
15234
|
}
|
|
15151
15235
|
rrdom.mirror.add(rrNode, { ...sn });
|
|
15152
15236
|
}
|
|
15237
|
+
nodesBuiltFromDom.add(rrNode);
|
|
15153
15238
|
return rrNode;
|
|
15154
15239
|
}
|
|
15155
15240
|
function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument()) {
|
|
@@ -15545,15 +15630,12 @@ function hasShadowRoot(n2) {
|
|
|
15545
15630
|
return Boolean(index.shadowRoot(n2));
|
|
15546
15631
|
}
|
|
15547
15632
|
function getNestedRule(rules2, position) {
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
return getNestedRule(
|
|
15553
|
-
rule2.cssRules[position[1]].cssRules,
|
|
15554
|
-
position.slice(2)
|
|
15555
|
-
);
|
|
15633
|
+
var _a22;
|
|
15634
|
+
let rule2 = rules2[position[0]];
|
|
15635
|
+
for (let i2 = 1; i2 < position.length && rule2; i2++) {
|
|
15636
|
+
rule2 = (_a22 = rule2.cssRules) == null ? void 0 : _a22[position[i2]];
|
|
15556
15637
|
}
|
|
15638
|
+
return rule2;
|
|
15557
15639
|
}
|
|
15558
15640
|
function getPositionsAndIndex(nestedIndex) {
|
|
15559
15641
|
const positions = [...nestedIndex];
|
|
@@ -18227,8 +18309,12 @@ class Replayer {
|
|
|
18227
18309
|
case IncrementalSource.StyleDeclaration: {
|
|
18228
18310
|
if (this.usingVirtualDom) {
|
|
18229
18311
|
if (d.styleId) this.constructedStyleMutations.push(d);
|
|
18230
|
-
else if (d.id)
|
|
18231
|
-
|
|
18312
|
+
else if (d.id) {
|
|
18313
|
+
const target = this.virtualDom.mirror.getNode(
|
|
18314
|
+
d.id
|
|
18315
|
+
);
|
|
18316
|
+
(_b2 = target == null ? void 0 : target.rules) == null ? void 0 : _b2.push(d);
|
|
18317
|
+
}
|
|
18232
18318
|
} else this.applyStyleSheetMutation(d);
|
|
18233
18319
|
break;
|
|
18234
18320
|
}
|
|
@@ -18819,11 +18905,9 @@ class Replayer {
|
|
|
18819
18905
|
}
|
|
18820
18906
|
}
|
|
18821
18907
|
applyStyleDeclaration(data, styleSheet) {
|
|
18908
|
+
const rule2 = getNestedRule(styleSheet.cssRules, data.index);
|
|
18909
|
+
if (!(rule2 == null ? void 0 : rule2.style)) return;
|
|
18822
18910
|
if (data.set) {
|
|
18823
|
-
const rule2 = getNestedRule(
|
|
18824
|
-
styleSheet.rules,
|
|
18825
|
-
data.index
|
|
18826
|
-
);
|
|
18827
18911
|
rule2.style.setProperty(
|
|
18828
18912
|
data.set.property,
|
|
18829
18913
|
data.set.value,
|
|
@@ -18831,10 +18915,6 @@ class Replayer {
|
|
|
18831
18915
|
);
|
|
18832
18916
|
}
|
|
18833
18917
|
if (data.remove) {
|
|
18834
|
-
const rule2 = getNestedRule(
|
|
18835
|
-
styleSheet.rules,
|
|
18836
|
-
data.index
|
|
18837
|
-
);
|
|
18838
18918
|
rule2.style.removeProperty(data.remove.property);
|
|
18839
18919
|
}
|
|
18840
18920
|
}
|